target
stringlengths 5
300
| feat_repo_name
stringlengths 6
76
| text
stringlengths 26
1.05M
|
---|---|---|
src/components/Header/Header.js | noomorph/quizzard2 | /*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
import React from 'react';
import styles from './Header.less';
import withStyles from '../../decorators/withStyles';
import Link from '../../utils/Link';
import Navigation from '../Navigation';
@withStyles(styles)
class Header {
render() {
return (
<div className="Header">
<div className="Header-container">
<a className="Header-brand" href="/" onClick={Link.handleClick}>
<img className="Header-brandImg" src={require('./logo-small.png')} width="38" height="38" alt="React" />
<span className="Header-brandTxt">Your Company</span>
</a>
<Navigation className="Header-nav" />
<div className="Header-banner">
<h1 className="Header-bannerTitle">React</h1>
<p className="Header-bannerDesc">Complex web apps made easy</p>
</div>
</div>
</div>
);
}
}
export default Header;
|
DjangoWebProject/DjangoWebProject/app/static/app/scripts/jquery.js | kaleid0scope/SITE-database | /*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery-1.10.2.min.map
*/
(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t
}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle);
u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window); |
examples/counter/test/components/Counter.spec.js | splendido/redux | import expect from 'expect'
import React from 'react'
import { shallow } from 'enzyme'
import Counter from '../../components/Counter'
function setup(value = 0) {
const actions = {
onIncrement: expect.createSpy(),
onDecrement: expect.createSpy()
}
const component = shallow(
<Counter value={value} {...actions} />
)
return {
component: component,
actions: actions,
buttons: component.find('button'),
p: component.find('p')
}
}
describe('Counter component', () => {
it('should display count', () => {
const { p } = setup()
expect(p.text()).toMatch(/^Clicked: 0 times/)
})
it('first button should call onIncrement', () => {
const { buttons, actions } = setup()
buttons.at(0).simulate('click')
expect(actions.onIncrement).toHaveBeenCalled()
})
it('second button should call onDecrement', () => {
const { buttons, actions } = setup()
buttons.at(1).simulate('click')
expect(actions.onDecrement).toHaveBeenCalled()
})
it('third button should not call onIncrement if the counter is even', () => {
const { buttons, actions } = setup(42)
buttons.at(2).simulate('click')
expect(actions.onIncrement).toNotHaveBeenCalled()
})
it('third button should call onIncrement if the counter is odd', () => {
const { buttons, actions } = setup(43)
buttons.at(2).simulate('click')
expect(actions.onIncrement).toHaveBeenCalled()
})
it('third button should call onIncrement if the counter is odd and negative', () => {
const { buttons, actions } = setup(-43)
buttons.at(2).simulate('click')
expect(actions.onIncrement).toHaveBeenCalled()
})
it('fourth button should call onIncrement in a second', (done) => {
const { buttons, actions } = setup()
buttons.at(3).simulate('click')
setTimeout(() => {
expect(actions.onIncrement).toHaveBeenCalled()
done()
}, 1000)
})
})
|
stories/Loading.js | ecmadao/light-ui | import React from 'react';
import { storiesOf } from '@storybook/react';
import LoadingWrapper from '../examples/LoadingWrapper';
storiesOf('Loading', module)
.add('No closeable', () => (
<LoadingWrapper />
))
.add('Closeable, without callback', () => (
<LoadingWrapper closeAble={true} />
))
.add('Closeable, has callback', () => (
<LoadingWrapper closeAble={true} hasCloseCallback={true} />
))
.add('Custom style', () => (
<LoadingWrapper closeAble={true} customStyle={true} />
));
|
src/frontend/components/NavBar.js | ErdMutter92/Project-Atlantis | import React from 'react';
import {Navbar, Nav, NavItem, Input} from 'react-bootstrap';
var NavBar = React.createClass({
getInitialState: function () {
return {
active: window.location.hash.split('?')[0]
};
},
componentDidMount: function () {
window.addEventListener('hashchange', function () {
this.setState({
active: window.location.hash.split('?')[0]
});
}.bind(this));
},
render: function () {
return (
<Navbar>
<Navbar.Header>
<Navbar.Brand>
<a href="#">Project Atlantis</a>
</Navbar.Brand>
</Navbar.Header>
<Navbar.Collapse>
<Nav>
<NavItem active={((this.state.active === "#/blogs") || (this.state.active === "#/")) ? true : false} eventKey={1} href="#/blogs">Blog</NavItem>
<NavItem active={(this.state.active === "#/stargate") ? true : false} eventKey={2} href="#/stargate">Stargate</NavItem>
<NavItem active={(this.state.active === "#/photos") ? true : false} eventKey={2} href="#/photos">Photos</NavItem>
</Nav>
<Navbar.Form pullRight>
<Input type="text" placeholder="Search"/>
</Navbar.Form>
</Navbar.Collapse>
</Navbar>
);
}
});
export default NavBar;
|
ajax/libs/react-date-picker/8.3.3/entry.min.js | cdnjs/cdnjs | "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("react-calendar/dist/Calendar.css");var _DatePicker=_interopRequireDefault(require("./DatePicker"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}require("./DatePicker.css");var _default=_DatePicker.default;exports.default=_default; |
ajax/libs/material-ui/5.0.0-alpha.1/ListItemAvatar/ListItemAvatar.js | cdnjs/cdnjs | "use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.styles = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var React = _interopRequireWildcard(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _clsx = _interopRequireDefault(require("clsx"));
var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
var _ListContext = _interopRequireDefault(require("../List/ListContext"));
var styles = {
/* Styles applied to the root element. */
root: {
minWidth: 56,
flexShrink: 0
},
/* Styles applied to the root element when the parent `ListItem` uses `alignItems="flex-start"`. */
alignItemsFlexStart: {
marginTop: 8
}
};
/**
* A simple wrapper to apply `List` styles to an `Avatar`.
*/
exports.styles = styles;
var ListItemAvatar = /*#__PURE__*/React.forwardRef(function ListItemAvatar(props, ref) {
var classes = props.classes,
className = props.className,
other = (0, _objectWithoutProperties2.default)(props, ["classes", "className"]);
var context = React.useContext(_ListContext.default);
return /*#__PURE__*/React.createElement("div", (0, _extends2.default)({
className: (0, _clsx.default)(classes.root, className, context.alignItems === 'flex-start' && classes.alignItemsFlexStart),
ref: ref
}, other));
});
process.env.NODE_ENV !== "production" ? ListItemAvatar.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the d.ts file and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* The content of the component – normally `Avatar`.
*/
children: _propTypes.default.element.isRequired,
/**
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: _propTypes.default.object,
/**
* @ignore
*/
className: _propTypes.default.string
} : void 0;
var _default = (0, _withStyles.default)(styles, {
name: 'MuiListItemAvatar'
})(ListItemAvatar);
exports.default = _default; |
ajax/libs/extjs/4.2.1/src/data/NodeStore.js | joaojeronimo/cdnjs | /*
This file is part of Ext JS 4.2
Copyright (c) 2011-2013 Sencha Inc
Contact: http://www.sencha.com/contact
GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as
published by the Free Software Foundation and appearing in the file LICENSE included in the
packaging of this file.
Please review the following information to ensure the GNU General Public License version 3.0
requirements will be met: http://www.gnu.org/copyleft/gpl.html.
If you are unsure which license is appropriate for your use, please contact the sales department
at http://www.sencha.com/contact.
Build date: 2013-05-16 14:36:50 (f9be68accb407158ba2b1be2c226a6ce1f649314)
*/
/**
* Node Store
* @private
*/
Ext.define('Ext.data.NodeStore', {
extend: 'Ext.data.Store',
alias: 'store.node',
requires: ['Ext.data.NodeInterface'],
/**
* @property {Boolean} isNodeStore
* `true` in this class to identify an object as an instantiated NodeStore, or subclass thereof.
*/
isNodeStore: true,
/**
* @cfg {Ext.data.Model} node
* The Record you want to bind this Store to. Note that
* this record will be decorated with the Ext.data.NodeInterface if this is not the
* case yet.
*/
node: null,
/**
* @cfg {Boolean} recursive
* Set this to true if you want this NodeStore to represent
* all the descendents of the node in its flat data collection. This is useful for
* rendering a tree structure to a DataView and is being used internally by
* the TreeView. Any records that are moved, removed, inserted or appended to the
* node at any depth below the node this store is bound to will be automatically
* updated in this Store's internal flat data structure.
*/
recursive: false,
/**
* @cfg {Boolean} rootVisible
* False to not include the root node in this Stores collection.
*/
rootVisible: false,
/**
* @cfg {Ext.data.TreeStore} treeStore
* The TreeStore that is used by this NodeStore's Ext.tree.View.
*/
/**
* @protected
* Recursion level counter. Incremented when expansion or collaping of a node is initiated,
* including when nested nodes below the expanding/collapsing root begin expanding or collapsing.
*
* This ensures that collapsestart, collapsecomplete, expandstart and expandcomplete only
* fire on the top level node being collapsed/expanded.
*
* Also, allows listeners to the `add` and `remove` events to know whether a collapse of expand is in progress.
*/
isExpandingOrCollapsing: 0,
constructor: function(config) {
var me = this,
node;
config = config || {};
Ext.apply(me, config);
//<debug>
if (Ext.isDefined(me.proxy)) {
Ext.Error.raise("A NodeStore cannot be bound to a proxy. Instead bind it to a record " +
"decorated with the NodeInterface by setting the node config.");
}
me.useModelWarning = false;
//</debug>
config.proxy = {type: 'proxy'};
me.callParent([config]);
node = me.node;
if (node) {
me.node = null;
me.setNode(node);
}
},
// NodeStores are never buffered or paged. They are loaded from the TreeStore to reflect all visible
// nodes.
// BufferedRenderer always asks for the *total* count, so this must return the count.
getTotalCount: function() {
return this.getCount();
},
setNode: function(node) {
var me = this;
if (me.node && me.node != node) {
// We want to unbind our listeners on the old node
me.mun(me.node, {
expand: me.onNodeExpand,
collapse: me.onNodeCollapse,
append: me.onNodeAppend,
insert: me.onNodeInsert,
bulkremove: me.onBulkRemove,
remove: me.onNodeRemove,
sort: me.onNodeSort,
scope: me
});
me.node = null;
}
if (node) {
Ext.data.NodeInterface.decorate(node.self);
me.removeAll();
if (me.rootVisible) {
me.add(node);
} else if (!node.isExpanded() && me.treeStore.autoLoad !== false) {
node.expand();
}
me.mon(node, {
expand: me.onNodeExpand,
collapse: me.onNodeCollapse,
append: me.onNodeAppend,
insert: me.onNodeInsert,
bulkremove: me.onBulkRemove,
remove: me.onNodeRemove,
sort: me.onNodeSort,
scope: me
});
me.node = node;
if (node.isExpanded() && node.isLoaded()) {
me.onNodeExpand(node, node.childNodes, true);
}
}
},
onNodeSort: function(node, childNodes) {
var me = this;
if ((me.indexOf(node) !== -1 || (node === me.node && !me.rootVisible) && node.isExpanded())) {
Ext.suspendLayouts();
me.onNodeCollapse(node, childNodes, true);
me.onNodeExpand(node, childNodes, true);
Ext.resumeLayouts(true);
}
},
// Triggered by a NodeInterface's bubbled "expand" event.
onNodeExpand: function(parent, records, suppressEvent) {
var me = this,
insertIndex = me.indexOf(parent) + 1,
toAdd = [];
// Used by the TreeView to bracket recursive expand & collapse ops
// and refresh the size. This is most effective when folder nodes are loaded,
// and this method is able to recurse.
if (!suppressEvent) {
me.fireEvent('beforeexpand', parent, records, insertIndex);
}
me.handleNodeExpand(parent, records, toAdd);
// The add event from this insertion is handled by TreeView.onAdd.
// That implementation calls parent and then ensures the previous sibling's joining lines are correct.
// The datachanged event is relayed by the TreeStore. Internally, that's not used.
me.insert(insertIndex, toAdd);
// Triggers the TreeView's onExpand method which calls refreshSize,
// and fires its afteritemexpand event
if (!suppressEvent) {
me.fireEvent('expand', parent, records);
}
},
// Collects child nodes to remove into the passed toRemove array.
// When available, all descendant nodes are pushed into that array using recursion.
handleNodeExpand: function(parent, records, toAdd) {
var me = this,
ln = records ? records.length : 0,
i, record;
// recursive is hardcoded to true in TreeView.
if (!me.recursive && parent !== me.node) {
return;
}
if (parent !== this.node && !me.isVisible(parent)) {
return;
}
if (ln) {
// The view items corresponding to these are rendered.
// Loop through and expand any of the non-leaf nodes which are expanded
for (i = 0; i < ln; i++) {
record = records[i];
// Add to array being collected by recursion when child nodes are loaded.
// Must be done here in loop so that child nodes are inserted into the stream in place
// in recursive calls.
toAdd.push(record);
if (record.isExpanded()) {
if (record.isLoaded()) {
// Take a shortcut - appends to toAdd array
me.handleNodeExpand(record, record.childNodes, toAdd);
}
else {
// Might be asynchronous if child nodes are not immediately available
record.set('expanded', false);
record.expand();
}
}
}
}
},
// Triggered by NodeInterface's bubbled bulkremove event
onBulkRemove: function(parent, childNodes, isMove) {
this.onNodeCollapse(parent, childNodes, true);
},
// Triggered by a NodeInterface's bubbled "collapse" event.
onNodeCollapse: function(parent, records, suppressEvent, callback, scope) {
var me = this,
collapseIndex = me.indexOf(parent) + 1,
node, lastNodeIndexPlus, sibling, found;
if (!me.recursive && parent !== me.node) {
return;
}
// Used by the TreeView to bracket recursive expand & collapse ops.
// The TreeViewsets up the animWrap object if we are animating.
// It also caches the collapse callback to call when it receives the
// end collapse event. See below.
if (!suppressEvent) {
me.fireEvent('beforecollapse', parent, records, collapseIndex, callback, scope);
}
// Only attempt to remove the records if they are there.
// Collapsing an ancestor node *immediately removes from the view, ALL its descendant nodes at all levels*.
// But if the collapse was recursive, all descendant root nodes will still fire their
// events. But we must ignore those events here - we have nothing to do.
if (records.length && me.data.contains(records[0])) {
// Calculate the index *one beyond* the last node we are going to remove
// Need to loop up the tree to find the nearest view sibling, since it could
// exist at some level above the current node.
node = parent;
while (node.parentNode) {
sibling = node.nextSibling;
if (sibling) {
found = true;
lastNodeIndexPlus = me.indexOf(sibling);
break;
} else {
node = node.parentNode;
}
}
if (!found) {
lastNodeIndexPlus = me.getCount();
}
// Remove the whole collapsed node set.
me.removeAt(collapseIndex, lastNodeIndexPlus - collapseIndex);
}
// Triggers the TreeView's onCollapse method which calls refreshSize,
// and fires its afteritecollapse event
if (!suppressEvent) {
me.fireEvent('collapse', parent, records, collapseIndex);
}
},
onNodeAppend: function(parent, node, index) {
var me = this,
refNode, sibling;
// Only react to a node append if it is to a node which is expanded, and is part of a tree
if (me.isVisible(node)) {
if (index === 0) {
refNode = parent;
} else {
sibling = node.previousSibling;
while (sibling.isExpanded() && sibling.lastChild) {
sibling = sibling.lastChild;
}
refNode = sibling;
}
me.insert(me.indexOf(refNode) + 1, node);
if (!node.isLeaf() && node.isExpanded()) {
if (node.isLoaded()) {
// Take a shortcut
me.onNodeExpand(node, node.childNodes, true);
} else if (!me.treeStore.fillCount ) {
// If the node has been marked as expanded, it means the children
// should be provided as part of the raw data. If we're filling the nodes,
// the children may not have been loaded yet, so only do this if we're
// not in the middle of populating the nodes.
node.set('expanded', false);
node.expand();
}
}
}
},
onNodeInsert: function(parent, node, refNode) {
var me = this,
index = this.indexOf(refNode);
if (index != -1 && me.isVisible(node)) {
me.insert(index, node);
if (!node.isLeaf() && node.isExpanded()) {
if (node.isLoaded()) {
// Take a shortcut
me.onNodeExpand(node, node.childNodes, true);
}
else {
node.set('expanded', false);
node.expand();
}
}
}
},
onNodeRemove: function(parent, node, isMove) {
var me = this;
if (me.indexOf(node) != -1) {
// If the removed node is a non-leaf and is expanded, use the onCollapse method to get rid
// of all descendants at any level.
if (!node.isLeaf() && node.isExpanded()) {
// onCollapse expects to be able to use the "collapsing" node's parentNode
// and nextSibling pointers so temporarily reinstate them.
// Reinstating them is safe because we pass the suppressEvents flag, and no user code
// is executed.
node.parentNode = node.removeContext.parentNode;
node.nextSibling = node.removeContext.nextSibling;
me.onNodeCollapse(node, node.childNodes, true);
node.parentNode = node.nextSibling = null;
}
me.remove(node);
}
},
isVisible: function(node) {
var parent = node.parentNode;
while (parent) {
// Hit root and it is expanded, the node is visible
if (parent === this.node && parent.data.expanded) {
return true;
}
// Hit a collapsed ancestor, the node is not visible
if (!parent.data.expanded) {
return false;
}
parent = parent.parentNode;
}
// Walked off the top - the node is not part of the tree structure
return false;
}
}); |
ajax/libs/jquery.fancytree/2.6.0/jquery.fancytree.min.js | chriszarate/cdnjs | /*!
* jquery.fancytree.js
* Dynamic tree view control, with support for lazy loading of branches.
* https://github.com/mar10/fancytree/
*
* Copyright (c) 2006-2014, Martin Wendt (http://wwWendt.de)
* Released under the MIT license
* https://github.com/mar10/fancytree/wiki/LicenseInfo
*
* @version 2.6.0
* @date 2014-11-29T08:33
*/
!function(a,b,c,d){"use strict";function e(b,c){b||(c=c?": "+c:"",a.error("Fancytree assertion failed"+c))}function f(a,c){var d,e,f=b.console?b.console[a]:null;if(f)try{f.apply(b.console,c)}catch(g){for(e="",d=0;d<c.length;d++)e+=c[d];f(e)}}function g(a){return!(!a.tree||a.statusNodeType===d)}function h(b){var c,d,e,f=a.map(a.trim(b).split("."),function(a){return parseInt(a,10)}),g=a.map(Array.prototype.slice.call(arguments,1),function(a){return parseInt(a,10)});for(c=0;c<g.length;c++)if(d=f[c]||0,e=g[c]||0,d!==e)return d>e;return!0}function i(a,b,c,d,e){var f=function(){var c=b[a],f=d[a],g=b.ext[e],h=function(){return c.apply(b,arguments)};return function(){var a=b._local,c=b._super;try{return b._local=g,b._super=h,f.apply(b,arguments)}finally{b._local=a,b._super=c}}}();return f}function j(b,c,d,e){for(var f in d)"function"==typeof d[f]?"function"==typeof b[f]?b[f]=i(f,b,c,d,e):"_"===f.charAt(0)?b.ext[e][f]=i(f,b,c,d,e):a.error("Could not override tree."+f+". Use prefix '_' to create tree."+e+"._"+f):"options"!==f&&(b.ext[e][f]=d[f])}function k(b,c){return b===d?a.Deferred(function(){this.resolve()}).promise():a.Deferred(function(){this.resolveWith(b,c)}).promise()}function l(b,c){return b===d?a.Deferred(function(){this.reject()}).promise():a.Deferred(function(){this.rejectWith(b,c)}).promise()}function m(a,b){return function(){a.resolveWith(b)}}function n(b){var c=a.extend({},b.data()),d=c.json;return delete c.fancytree,d&&(delete c.json,c=a.extend(c,d)),c}function o(a){return a=a.toLowerCase(),function(b){return b.title.toLowerCase().indexOf(a)>=0}}function p(a){var b=new RegExp("^"+a,"i");return function(a){return b.test(a.title)}}function q(b,c){var d,f,g,h;for(this.parent=b,this.tree=b.tree,this.ul=null,this.li=null,this.statusNodeType=null,this._isLoading=!1,this._error=null,this.data={},d=0,f=x.length;f>d;d++)g=x[d],this[g]=c[g];c.data&&a.extend(this.data,c.data);for(g in c)y[g]||a.isFunction(c[g])||z[g]||(this.data[g]=c[g]);null==this.key?this.tree.options.defaultKey?(this.key=this.tree.options.defaultKey(this),e(this.key,"defaultKey() must return a unique key")):this.key="_"+t._nextNodeKey++:this.key=""+this.key,c.active&&(e(null===this.tree.activeNode,"only one active node allowed"),this.tree.activeNode=this),c.selected&&(this.tree.lastSelectedNode=this),this.children=null,h=c.children,h&&h.length&&this._setChildren(h),this.tree._callHook("treeRegisterNode",this.tree,!0,this)}function r(b){this.widget=b,this.$div=b.element,this.options=b.options,this.options&&a.isFunction(this.options.lazyload)&&(a.isFunction(this.options.lazyLoad)||(this.options.lazyLoad=function(){t.warn("The 'lazyload' event is deprecated since 2014-02-25. Use 'lazyLoad' (with uppercase L) instead."),b.options.lazyload.apply(this,arguments)})),this.options&&a.isFunction(this.options.loaderror)&&a.error("The 'loaderror' event was renamed since 2014-07-03. Use 'loadError' (with uppercase E) instead."),this.ext={},this.data=n(this.$div),this._id=a.ui.fancytree._nextId++,this._ns=".fancytree-"+this._id,this.activeNode=null,this.focusNode=null,this._hasFocus=null,this.lastSelectedNode=null,this.systemFocusElement=null,this.lastQuicksearchTerm="",this.lastQuicksearchTime=0,this.statusClassPropName="span",this.ariaPropName="li",this.nodeContainerAttrName="li",this.$div.find(">ul.fancytree-container").remove();var c,d={tree:this};this.rootNode=new q(d,{title:"root",key:"root_"+this._id,children:null,expanded:!0}),this.rootNode.parent=null,c=a("<ul>",{"class":"ui-fancytree fancytree-container"}).appendTo(this.$div),this.$container=c,this.rootNode.ul=c[0],null==this.options.debugLevel&&(this.options.debugLevel=t.debugLevel),this.$container.attr("tabindex",this.options.tabbable?"0":"-1"),this.options.aria&&this.$container.attr("role","tree").attr("aria-multiselectable",!0)}if(a.ui&&a.ui.fancytree)return void a.ui.fancytree.warn("Fancytree: ignored duplicate include");e(a.ui,"Fancytree requires jQuery UI (http://jqueryui.com)");var s,t=null,u={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},v="active expanded focus folder hideCheckbox lazy selected unselectable".split(" "),w={},x="expanded extraClasses folder hideCheckbox key lazy refKey selected title tooltip unselectable".split(" "),y={},z={active:!0,children:!0,data:!0,focus:!0};for(s=0;s<v.length;s++)w[v[s]]=!0;for(s=0;s<x.length;s++)y[x[s]]=!0;q.prototype={_findDirectChild:function(a){var b,c,d=this.children;if(d)if("string"==typeof a){for(b=0,c=d.length;c>b;b++)if(d[b].key===a)return d[b]}else{if("number"==typeof a)return this.children[a];if(a.parent===this)return a}return null},_setChildren:function(a){e(a&&(!this.children||0===this.children.length),"only init supported"),this.children=[];for(var b=0,c=a.length;c>b;b++)this.children.push(new q(this,a[b]))},addChildren:function(b,c){var d,f,g,h=null,i=[];for(a.isPlainObject(b)&&(b=[b]),this.children||(this.children=[]),d=0,f=b.length;f>d;d++)i.push(new q(this,b[d]));return h=i[0],null==c?this.children=this.children.concat(i):(c=this._findDirectChild(c),g=a.inArray(c,this.children),e(g>=0,"insertBefore must be an existing child"),this.children.splice.apply(this.children,[g,0].concat(i))),(!this.parent||this.parent.ul||this.tr)&&this.render(),3===this.tree.options.selectMode&&this.fixSelection3FromEndNodes(),h},addNode:function(a,b){switch((b===d||"over"===b)&&(b="child"),b){case"after":return this.getParent().addChildren(a,this.getNextSibling());case"before":return this.getParent().addChildren(a,this);case"firstChild":var c=this.children?this.children[0]:null;return this.addChildren(a,c);case"child":case"over":return this.addChildren(a)}e(!1,"Invalid mode: "+b)},appendSibling:function(a){return this.addNode(a,"after")},applyPatch:function(b){if(null===b)return this.remove(),k(this);var c,d,e,f={children:!0,expanded:!0,parent:!0};for(c in b)e=b[c],f[c]||a.isFunction(e)||(y[c]?this[c]=e:this.data[c]=e);return b.hasOwnProperty("children")&&(this.removeChildren(),b.children&&this._setChildren(b.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),d=b.hasOwnProperty("expanded")?this.setExpanded(b.expanded):k(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(a,b,c){return a.addNode(this.toDict(!0,c),b)},countChildren:function(a){var b,c,d,e=this.children;if(!e)return 0;if(d=e.length,a!==!1)for(b=0,c=d;c>b;b++)d+=e[b].countChildren();return d},debug:function(){this.tree.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),f("log",arguments))},discard:function(){return this.warn("FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead."),this.resetLazy()},findAll:function(b){b=a.isFunction(b)?b:o(b);var c=[];return this.visit(function(a){b(a)&&c.push(a)}),c},findFirst:function(b){b=a.isFunction(b)?b:o(b);var c=null;return this.visit(function(a){return b(a)?(c=a,!1):void 0}),c},_changeSelectStatusAttrs:function(a){var b=!1;switch(a){case!1:b=this.selected||this.partsel,this.selected=!1,this.partsel=!1;break;case!0:b=!this.selected||!this.partsel,this.selected=!0,this.partsel=!0;break;case d:b=this.selected||!this.partsel,this.selected=!1,this.partsel=!0;break;default:e(!1,"invalid state: "+a)}return b&&this.renderStatus(),b},fixSelection3AfterClick:function(){var a=this.isSelected();this.visit(function(b){b._changeSelectStatusAttrs(a)}),this.fixSelection3FromEndNodes()},fixSelection3FromEndNodes:function(){function a(b){var c,e,f,g,h,i,j,k=b.children;if(k&&k.length){for(i=!0,j=!1,c=0,e=k.length;e>c;c++)f=k[c],g=a(f),g!==!1&&(j=!0),g!==!0&&(i=!1);h=i?!0:j?d:!1}else h=!!b.selected;return b._changeSelectStatusAttrs(h),h}e(3===this.tree.options.selectMode,"expected selectMode 3"),a(this),this.visitParents(function(a){var b,c,e,f,g=a.children,h=!0,i=!1;for(b=0,c=g.length;c>b;b++)e=g[b],(e.selected||e.partsel)&&(i=!0),e.unselectable||e.selected||(h=!1);f=h?!0:i?d:!1,a._changeSelectStatusAttrs(f)})},fromDict:function(b){for(var c in b)y[c]?this[c]=b[c]:"data"===c?a.extend(this.data,b.data):a.isFunction(b[c])||z[c]||(this.data[c]=b[c]);b.children&&(this.removeChildren(),this.addChildren(b.children)),this.renderTitle()},getChildren:function(){return this.hasChildren()===d?d:this.children},getFirstChild:function(){return this.children?this.children[0]:null},getIndex:function(){return a.inArray(this,this.parent.children)},getIndexHier:function(b){b=b||".";var c=[];return a.each(this.getParentList(!1,!0),function(a,b){c.push(b.getIndex()+1)}),c.join(b)},getKeyPath:function(a){var b=[],c=this.tree.options.keyPathSeparator;return this.visitParents(function(a){a.parent&&b.unshift(a.key)},!a),c+b.join(c)},getLastChild:function(){return this.children?this.children[this.children.length-1]:null},getLevel:function(){for(var a=0,b=this.parent;b;)a++,b=b.parent;return a},getNextSibling:function(){if(this.parent){var a,b,c=this.parent.children;for(a=0,b=c.length-1;b>a;a++)if(c[a]===this)return c[a+1]}return null},getParent:function(){return this.parent},getParentList:function(a,b){for(var c=[],d=b?this:this.parent;d;)(a||d.parent)&&c.unshift(d),d=d.parent;return c},getPrevSibling:function(){if(this.parent){var a,b,c=this.parent.children;for(a=1,b=c.length;b>a;a++)if(c[a]===this)return c[a-1]}return null},hasChildren:function(){return this.lazy?null==this.children?d:0===this.children.length?!1:1===this.children.length&&this.children[0].isStatusNode()?d:!0:!(!this.children||!this.children.length)},hasFocus:function(){return this.tree.hasFocus()&&this.tree.focusNode===this},info:function(){this.tree.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),f("info",arguments))},isActive:function(){return this.tree.activeNode===this},isChildOf:function(a){return this.parent&&this.parent===a},isDescendantOf:function(a){if(!a||a.tree!==this.tree)return!1;for(var b=this.parent;b;){if(b===a)return!0;b=b.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var a=this.parent;return!a||a.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var a=this.parent;return!a||a.children[a.children.length-1]===this},isLazy:function(){return!!this.lazy},isLoaded:function(){return!this.lazy||this.hasChildren()!==d},isLoading:function(){return!!this._isLoading},isRoot:function(){return this.isRootNode()},isRootNode:function(){return this.tree.rootNode===this},isSelected:function(){return!!this.selected},isStatusNode:function(){return!!this.statusNodeType},isTopLevel:function(){return this.tree.rootNode===this.parent},isUndefined:function(){return this.hasChildren()===d},isVisible:function(){var a,b,c=this.getParentList(!1,!1);for(a=0,b=c.length;b>a;a++)if(!c[a].expanded)return!1;return!0},lazyLoad:function(a){return this.warn("FancytreeNode.lazyLoad() is deprecated since 2014-02-16. Use .load() instead."),this.load(a)},load:function(a){var b,c,d=this;return e(this.isLazy(),"load() requires a lazy node"),a||this.isUndefined()?(this.isLoaded()&&this.resetLazy(),c=this.tree._triggerNodeEvent("lazyLoad",this),c===!1?k(this):(e("boolean"!=typeof c,"lazyLoad event must return source in data.result"),b=this.tree._callHook("nodeLoadChildren",this,c),this.expanded&&b.always(function(){d.render()}),b)):k(this)},makeVisible:function(b){var c,d=this,e=[],f=new a.Deferred,g=this.getParentList(!1,!1),h=g.length,i=!(b&&b.noAnimation===!0),j=!(b&&b.scrollIntoView===!1);for(c=h-1;c>=0;c--)e.push(g[c].setExpanded(!0,b));return a.when.apply(a,e).done(function(){j?d.scrollIntoView(i).done(function(){f.resolve()}):f.resolve()}),f.promise()},moveTo:function(b,c,f){(c===d||"over"===c)&&(c="child");var g,h=this.parent,i="child"===c?b:b.parent;if(this!==b){if(!this.parent)throw"Cannot move system root";if(i.isDescendantOf(this))throw"Cannot move a node to its own descendant";if(1===this.parent.children.length){if(this.parent===i)return;this.parent.children=this.parent.lazy?[]:null,this.parent.expanded=!1}else g=a.inArray(this,this.parent.children),e(g>=0),this.parent.children.splice(g,1);if(this.parent=i,i.hasChildren())switch(c){case"child":i.children.push(this);break;case"before":g=a.inArray(b,i.children),e(g>=0),i.children.splice(g,0,this);break;case"after":g=a.inArray(b,i.children),e(g>=0),i.children.splice(g+1,0,this);break;default:throw"Invalid mode "+c}else i.children=[this];f&&b.visit(f,!0),this.tree!==b.tree&&(this.warn("Cross-tree moveTo is experimantal!"),this.visit(function(a){a.tree=b.tree},!0)),h.isDescendantOf(i)||h.render(),i.isDescendantOf(h)||i===h||i.render()}},navigate:function(b,c){function d(d){if(d){try{d.makeVisible()}catch(e){}return a(d.span).is(":visible")?c===!1?d.setFocus():d.setActive():(d.debug("Navigate: skipping hidden node"),void d.navigate(b,c))}}var e,f,g=!0,h=a.ui.keyCode,i=null;switch(b){case h.BACKSPACE:this.parent&&this.parent.parent&&d(this.parent);break;case h.LEFT:this.expanded?(this.setExpanded(!1),d(this)):this.parent&&this.parent.parent&&d(this.parent);break;case h.RIGHT:this.expanded||!this.children&&!this.lazy?this.children&&this.children.length&&d(this.children[0]):(this.setExpanded(),d(this));break;case h.UP:for(i=this.getPrevSibling();i&&!a(i.span).is(":visible");)i=i.getPrevSibling();for(;i&&i.expanded&&i.children&&i.children.length;)i=i.children[i.children.length-1];!i&&this.parent&&this.parent.parent&&(i=this.parent),d(i);break;case h.DOWN:if(this.expanded&&this.children&&this.children.length)i=this.children[0];else for(f=this.getParentList(!1,!0),e=f.length-1;e>=0;e--){for(i=f[e].getNextSibling();i&&!a(i.span).is(":visible");)i=i.getNextSibling();if(i)break}d(i);break;default:g=!1}},remove:function(){return this.parent.removeChild(this)},removeChild:function(a){return this.tree._callHook("nodeRemoveChild",this,a)},removeChildren:function(){return this.tree._callHook("nodeRemoveChildren",this)},render:function(a,b){return this.tree._callHook("nodeRender",this,a,b)},renderTitle:function(){return this.tree._callHook("nodeRenderTitle",this)},renderStatus:function(){return this.tree._callHook("nodeRenderStatus",this)},resetLazy:function(){this.removeChildren(),this.expanded=!1,this.lazy=!0,this.children=d,this.renderStatus()},scheduleAction:function(a,b){this.tree.timer&&clearTimeout(this.tree.timer),this.tree.timer=null;var c=this;switch(a){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){c.tree.debug("setTimeout: trigger expand"),c.setExpanded(!0)},b);break;case"activate":this.tree.timer=setTimeout(function(){c.tree.debug("setTimeout: trigger activate"),c.setActive(!0)},b);break;default:throw"Invalid mode "+a}},scrollIntoView:function(f,h){h!==d&&g(h)&&(this.warn("scrollIntoView() with 'topNode' option is deprecated since 2014-05-08. Use 'options.topNode' instead."),h={topNode:h});var i,j,k,l,m=a.extend({effects:f===!0?{duration:200,queue:!1}:f,scrollOfs:this.tree.options.scrollOfs,scrollParent:this.tree.options.scrollParent||this.tree.$container,topNode:null},h),n=new a.Deferred,o=this,p=a(this.span).height(),q=a(m.scrollParent),r=m.scrollOfs.top||0,s=m.scrollOfs.bottom||0,t=q.height(),u=q.scrollTop(),v=q,w=q[0]===b,x=m.topNode||null,y=null;return e(a(this.span).is(":visible"),"scrollIntoView node is invisible"),w?(j=a(this.span).offset().top,i=x&&x.span?a(x.span).offset().top:0,v=a("html,body")):(e(q[0]!==c&&q[0]!==c.body,"scrollParent should be an simple element or `window`, not document or body."),l=q.offset().top,j=a(this.span).offset().top-l+u,i=x?a(x.span).offset().top-l+u:0,k=Math.max(0,q.innerHeight()-q[0].clientHeight),t-=k),u+r>j?y=j-r:j+p>u+t-s&&(y=j+p-t+s,x&&(e(x.isRoot()||a(x.span).is(":visible"),"topNode must be visible"),y>i&&(y=i-r))),null!==y?m.effects?(m.effects.complete=function(){n.resolveWith(o)},v.stop(!0).animate({scrollTop:y},m.effects)):(v[0].scrollTop=y,n.resolveWith(this)):n.resolveWith(this),n.promise()},setActive:function(a,b){return this.tree._callHook("nodeSetActive",this,a,b)},setExpanded:function(a,b){return this.tree._callHook("nodeSetExpanded",this,a,b)},setFocus:function(a){return this.tree._callHook("nodeSetFocus",this,a)},setSelected:function(a){return this.tree._callHook("nodeSetSelected",this,a)},setStatus:function(a,b,c){return this.tree._callHook("nodeSetStatus",this,a,b,c)},setTitle:function(a){this.title=a,this.renderTitle()},sortChildren:function(a,b){var c,d,e=this.children;if(e){if(a=a||function(a,b){var c=a.title.toLowerCase(),d=b.title.toLowerCase();return c===d?0:c>d?1:-1},e.sort(a),b)for(c=0,d=e.length;d>c;c++)e[c].children&&e[c].sortChildren(a,"$norender$");"$norender$"!==b&&this.render()}},toDict:function(b,c){var d,e,f,g={},h=this;if(a.each(x,function(a,b){(h[b]||h[b]===!1)&&(g[b]=h[b])}),a.isEmptyObject(this.data)||(g.data=a.extend({},this.data),a.isEmptyObject(g.data)&&delete g.data),c&&c(g),b&&this.hasChildren())for(g.children=[],d=0,e=this.children.length;e>d;d++)f=this.children[d],f.isStatusNode()||g.children.push(f.toDict(!0,c));return g},toggleExpanded:function(){return this.tree._callHook("nodeToggleExpanded",this)},toggleSelected:function(){return this.tree._callHook("nodeToggleSelected",this)},toString:function(){return"<FancytreeNode(#"+this.key+", '"+this.title+"')>"},visit:function(a,b){var c,d,e=!0,f=this.children;if(b===!0&&(e=a(this),e===!1||"skip"===e))return e;if(f)for(c=0,d=f.length;d>c&&(e=f[c].visit(a,!0),e!==!1);c++);return e},visitAndLoad:function(b,c,d){var e,f,g,h=this;return b&&c===!0&&(f=b(h),f===!1||"skip"===f)?d?f:k():h.children||h.lazy?(e=new a.Deferred,g=[],h.load().done(function(){for(var c=0,d=h.children.length;d>c;c++){if(f=h.children[c].visitAndLoad(b,!0,!0),f===!1){e.reject();break}"skip"!==f&&g.push(f)}a.when.apply(this,g).then(function(){e.resolve()})}),e.promise()):k()},visitParents:function(a,b){if(b&&a(this)===!1)return!1;for(var c=this.parent;c;){if(a(c)===!1)return!1;c=c.parent}return!0},warn:function(){Array.prototype.unshift.call(arguments,this.toString()),f("warn",arguments)}},r.prototype={_makeHookContext:function(b,c,e){var f,g;return b.node!==d?(c&&b.originalEvent!==c&&a.error("invalid args"),f=b):b.tree?(g=b.tree,f={node:b,tree:g,widget:g.widget,options:g.widget.options,originalEvent:c}):b.widget?f={node:null,tree:b,widget:b.widget,options:b.widget.options,originalEvent:c}:a.error("invalid args"),e&&a.extend(f,e),f},_callHook:function(b,c){var d=this._makeHookContext(c),e=this[b],f=Array.prototype.slice.call(arguments,2);return a.isFunction(e)||a.error("_callHook('"+b+"') is not a function"),f.unshift(d),e.apply(this,f)},_requireExtension:function(b,c,d,f){d=!!d;var g=this._local.name,h=this.options.extensions,i=a.inArray(b,h)<a.inArray(g,h),j=c&&null==this.ext[b],k=!j&&null!=d&&d!==i;return e(g&&g!==b),j||k?(f||(j||c?(f="'"+g+"' extension requires '"+b+"'",k&&(f+=" to be registered "+(d?"before":"after")+" itself")):f="If used together, `"+b+"` must be registered "+(d?"before":"after")+" `"+g+"`"),a.error(f),!1):!0},activateKey:function(a){var b=this.getNodeByKey(a);return b?b.setActive():this.activeNode&&this.activeNode.setActive(!1),b},applyPatch:function(b){var c,d,f,g,h,i,j=b.length,k=[];for(d=0;j>d;d++)f=b[d],e(2===f.length,"patchList must be an array of length-2-arrays"),g=f[0],h=f[1],i=null===g?this.rootNode:this.getNodeByKey(g),i?(c=new a.Deferred,k.push(c),i.applyPatch(h).always(m(c,i))):this.warn("could not find node with key '"+g+"'");return a.when.apply(a,k).promise()},count:function(){return this.rootNode.countChildren()},debug:function(){this.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),f("log",arguments))},findNextNode:function(b,c){var d=null,e=c.parent.children,f=null,g=function(a,b,c){var d,e,f=a.children,h=f.length,i=f[b];if(i&&c(i)===!1)return!1;if(i&&i.children&&i.expanded&&g(i,0,c)===!1)return!1;for(d=b+1;h>d;d++)if(g(a,d,c)===!1)return!1;return e=a.parent,e?g(e,e.children.indexOf(a)+1,c):g(a,0,c)};return b="string"==typeof b?p(b):b,c=c||this.getFirstChild(),g(c.parent,e.indexOf(c),function(e){return e===d?!1:(d=d||e,a(e.span).is(":visible")?b(e)&&(f=e,f!==c)?!1:void 0:void e.debug("quicksearch: skipping hidden node"))}),f},generateFormElements:function(b,c){var d,e=b!==!1?"ft_"+this._id+"[]":b,f=c!==!1?"ft_"+this._id+"_active":c,g="fancytree_result_"+this._id,h=a("#"+g);h.length?h.empty():h=a("<div>",{id:g}).hide().insertAfter(this.$container),e&&(d=this.getSelectedNodes(3===this.options.selectMode),a.each(d,function(b,c){h.append(a("<input>",{type:"checkbox",name:e,value:c.key,checked:!0}))})),f&&this.activeNode&&h.append(a("<input>",{type:"radio",name:f,value:this.activeNode.key,checked:!0}))},getActiveNode:function(){return this.activeNode},getFirstChild:function(){return this.rootNode.getFirstChild()},getFocusNode:function(){return this.focusNode},getNodeByKey:function(a,b){var d,e;return!b&&(d=c.getElementById(this.options.idPrefix+a))?d.ftnode?d.ftnode:null:(b=b||this.rootNode,e=null,b.visit(function(b){return b.key===a?(e=b,!1):void 0},!0),e)},getRootNode:function(){return this.rootNode},getSelectedNodes:function(a){var b=[];return this.rootNode.visit(function(c){return c.selected&&(b.push(c),a===!0)?"skip":void 0}),b},hasFocus:function(){return!!this._hasFocus},info:function(){this.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),f("info",arguments))},loadKeyPath:function(b,c,e){function f(a,b,d){c.call(r,b,"loading"),b.load().done(function(){r.loadKeyPath.call(r,l[a],c,b).always(m(d,r))}).fail(function(){r.warn("loadKeyPath: error loading: "+a+" (parent: "+o+")"),c.call(r,b,"error"),d.reject()})}var g,h,i,j,k,l,n,o,p,q=this.options.keyPathSeparator,r=this;for(a.isArray(b)||(b=[b]),l={},i=0;i<b.length;i++)for(o=e||this.rootNode,j=b[i],j.charAt(0)===q&&(j=j.substr(1)),p=j.split(q);p.length;){if(k=p.shift(),n=o._findDirectChild(k),!n){this.warn("loadKeyPath: key not found: "+k+" (parent: "+o+")"),c.call(this,k,"error");break}if(0===p.length){c.call(this,n,"ok");break}if(n.lazy&&n.hasChildren()===d){c.call(this,n,"loaded"),l[k]?l[k].push(p.join(q)):l[k]=[p.join(q)];break}c.call(this,n,"loaded"),o=n}g=[];for(k in l)n=o._findDirectChild(k),h=new a.Deferred,g.push(h),f(k,n,h);return a.when.apply(a,g).promise()},reactivate:function(a){var b=this.activeNode;b&&(this.activeNode=null,b.setActive(),a&&b.setFocus())},reload:function(a){return this._callHook("treeClear",this),this._callHook("treeLoad",this,a)},render:function(a,b){return this.rootNode.render(a,b)},setFocus:function(a){return this._callHook("treeSetFocus",this,a)},toDict:function(a,b){var c=this.rootNode.toDict(!0,b);return a?c:c.children},toString:function(){return"<Fancytree(#"+this._id+")>"},_triggerNodeEvent:function(a,b,c,e){var f=this._makeHookContext(b,c,e),g=this.widget._trigger(a,c,f);return g!==!1&&f.result!==d?f.result:g},_triggerTreeEvent:function(a,b,c){var e=this._makeHookContext(this,b,c),f=this.widget._trigger(a,b,e);return f!==!1&&e.result!==d?e.result:f},visit:function(a){return this.rootNode.visit(a,!1)},warn:function(){Array.prototype.unshift.call(arguments,this.toString()),f("warn",arguments)}},a.extend(r.prototype,{nodeClick:function(a){var b,c,d=a.targetType,e=a.node;if("expander"===d)this._callHook("nodeToggleExpanded",a);else if("checkbox"===d)this._callHook("nodeToggleSelected",a),a.options.focusOnSelect&&this._callHook("nodeSetFocus",a,!0);else{if(c=!1,b=!0,e.folder)switch(a.options.clickFolderMode){case 2:c=!0,b=!1;break;case 3:b=!0,c=!0}b&&(this.nodeSetFocus(a),this._callHook("nodeSetActive",a,!0)),c&&this._callHook("nodeToggleExpanded",a)}},nodeCollapseSiblings:function(a,b){var c,d,e,f=a.node;if(f.parent)for(c=f.parent.children,d=0,e=c.length;e>d;d++)c[d]!==f&&c[d].expanded&&this._callHook("nodeSetExpanded",c[d],!1,b)},nodeDblclick:function(a){"title"===a.targetType&&4===a.options.clickFolderMode&&this._callHook("nodeToggleExpanded",a),"title"===a.targetType&&a.originalEvent.preventDefault()},nodeKeydown:function(b){var c,d,e,f=b.originalEvent,g=b.node,h=b.tree,i=b.options,j=f.which,k=String.fromCharCode(j),l=!(f.altKey||f.ctrlKey||f.metaKey||f.shiftKey),m=a(f.target),n=!0,o=!(f.ctrlKey||!i.autoActivate),p=a.ui.keyCode;if(g||(this.getFirstChild().setFocus(),g=b.node=this.focusNode,g.debug("Keydown force focus on first node")),i.quicksearch&&l&&/\w/.test(k)&&!m.is(":input:enabled"))return d=(new Date).getTime(),d-h.lastQuicksearchTime>500&&(h.lastQuicksearchTerm=""),h.lastQuicksearchTime=d,h.lastQuicksearchTerm+=k,c=h.findNextNode(h.lastQuicksearchTerm,h.getActiveNode()),c&&c.setActive(),void f.preventDefault();switch(j){case p.NUMPAD_ADD:case 187:h.nodeSetExpanded(b,!0);break;case p.NUMPAD_SUBTRACT:case 189:h.nodeSetExpanded(b,!1);break;case p.SPACE:i.checkbox?h.nodeToggleSelected(b):h.nodeSetActive(b,!0);break;case p.ENTER:h.nodeSetActive(b,!0);break;case p.BACKSPACE:case p.LEFT:case p.RIGHT:case p.UP:case p.DOWN:e=g.navigate(f.which,o);break;default:n=!1}n&&f.preventDefault()},nodeLoadChildren:function(b,c){var d,f,g,h=b.tree,i=b.node;return a.isFunction(c)&&(c=c()),c.url&&(d=a.extend({},b.options.ajax,c),d.debugDelay?(f=d.debugDelay,a.isArray(f)&&(f=f[0]+Math.random()*(f[1]-f[0])),i.debug("nodeLoadChildren waiting debug delay "+Math.round(f)+"ms"),d.debugDelay=!1,g=a.Deferred(function(b){setTimeout(function(){a.ajax(d).done(function(){b.resolveWith(this,arguments)}).fail(function(){b.rejectWith(this,arguments)})},f)})):g=a.ajax(d),c=new a.Deferred,g.done(function(d){var e,f;if("string"==typeof d&&a.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),b.options.postProcess){if(f=h._triggerNodeEvent("postProcess",b,b.originalEvent,{response:d,error:null,dataType:this.dataType}),f.error)return e=a.isPlainObject(f.error)?f.error:{message:f.error},e=h._makeHookContext(i,null,e),void c.rejectWith(this,[e]);d=a.isArray(f)?f:d}else d&&d.hasOwnProperty("d")&&b.options.enableAspx&&(d="string"==typeof d.d?a.parseJSON(d.d):d.d);c.resolveWith(this,[d])}).fail(function(a,b,d){var e=h._makeHookContext(i,null,{error:a,args:Array.prototype.slice.call(arguments),message:d,details:a.status+": "+d});c.rejectWith(this,[e])})),a.isFunction(c.promise)&&(e(!i.isLoading()),h.nodeSetStatus(b,"loading"),c.done(function(){h.nodeSetStatus(b,"ok")}).fail(function(a){var c;c=a.node&&a.error&&a.message?a:h._makeHookContext(i,null,{error:a,args:Array.prototype.slice.call(arguments),message:a?a.message||a.toString():""}),h._triggerNodeEvent("loadError",c,null)!==!1&&h.nodeSetStatus(b,"error",c.message,c.details)})),a.when(c).done(function(b){var c;a.isPlainObject(b)&&(e(a.isArray(b.children),"source must contain (or be) an array of children"),e(i.isRoot(),"source may only be an object for root nodes"),c=b,b=b.children,delete c.children,a.extend(h.data,c)),e(a.isArray(b),"expected array of children"),i._setChildren(b),h._triggerNodeEvent("loadChildren",i)})},nodeLoadKeyPath:function(){},nodeRemoveChild:function(b,c){var d,f=b.node,g=b.options,h=a.extend({},b,{node:c}),i=f.children;return 1===i.length?(e(c===i[0]),this.nodeRemoveChildren(b)):(this.activeNode&&(c===this.activeNode||this.activeNode.isDescendantOf(c))&&this.activeNode.setActive(!1),this.focusNode&&(c===this.focusNode||this.focusNode.isDescendantOf(c))&&(this.focusNode=null),this.nodeRemoveMarkup(h),this.nodeRemoveChildren(h),d=a.inArray(c,i),e(d>=0),c.visit(function(a){a.parent=null},!0),this._callHook("treeRegisterNode",this,!1,c),g.removeNode&&g.removeNode.call(b.tree,{type:"removeNode"},h),void i.splice(d,1))},nodeRemoveChildMarkup:function(b){var c=b.node;c.ul&&(c.isRoot()?a(c.ul).empty():(a(c.ul).remove(),c.ul=null),c.visit(function(a){a.li=a.ul=null}))},nodeRemoveChildren:function(b){var c,d=b.tree,e=b.node,f=e.children,g=b.options;f&&(this.activeNode&&this.activeNode.isDescendantOf(e)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(e)&&(this.focusNode=null),this.nodeRemoveChildMarkup(b),c=a.extend({},b),e.visit(function(a){a.parent=null,d._callHook("treeRegisterNode",d,!1,a),g.removeNode&&(c.node=a,g.removeNode.call(b.tree,{type:"removeNode"},c))}),e.children=e.lazy?[]:null,this.nodeRenderStatus(b))},nodeRemoveMarkup:function(b){var c=b.node;c.li&&(a(c.li).remove(),c.li=null),this.nodeRemoveChildMarkup(b)},nodeRender:function(b,d,f,g,h){var i,j,k,l,m,n,o,p=b.node,q=b.tree,r=b.options,s=r.aria,t=!1,u=p.parent,v=!u,w=p.children;if(v||u.ul){if(e(v||u.ul,"parent UL must exist"),v||(p.li&&(d||p.li.parentNode!==p.parent.ul)&&(p.li.parentNode!==p.parent.ul&&this.warn("unlink "+p+" (must be child of "+p.parent+")"),this.nodeRemoveMarkup(b)),p.li?this.nodeRenderStatus(b):(t=!0,p.li=c.createElement("li"),p.li.ftnode=p,p.key&&r.generateIds&&(p.li.id=r.idPrefix+p.key),p.span=c.createElement("span"),p.span.className="fancytree-node",s&&a(p.span).attr("aria-labelledby","ftal_"+p.key),p.li.appendChild(p.span),this.nodeRenderTitle(b),r.createNode&&r.createNode.call(q,{type:"createNode"},b)),r.renderNode&&r.renderNode.call(q,{type:"renderNode"},b)),w){if(v||p.expanded||f===!0){for(p.ul||(p.ul=c.createElement("ul"),(g===!0&&!h||!p.expanded)&&(p.ul.style.display="none"),s&&a(p.ul).attr("role","group"),p.li?p.li.appendChild(p.ul):p.tree.$div.append(p.ul)),l=0,m=w.length;m>l;l++)o=a.extend({},b,{node:w[l]}),this.nodeRender(o,d,f,!1,!0);for(i=p.ul.firstChild;i;)k=i.ftnode,k&&k.parent!==p?(p.debug("_fixParent: remove missing "+k,i),n=i.nextSibling,i.parentNode.removeChild(i),i=n):i=i.nextSibling;for(i=p.ul.firstChild,l=0,m=w.length-1;m>l;l++)j=w[l],k=i.ftnode,j!==k?p.ul.insertBefore(j.li,k.li):i=i.nextSibling}}else p.ul&&(this.warn("remove child markup for "+p),this.nodeRemoveChildMarkup(b));v||t&&u.ul.appendChild(p.li)}},nodeRenderTitle:function(a,b){var c,e,f,g,h,i,j=a.node,k=a.tree,l=a.options,m=l.aria,n=j.getLevel(),o=[],p=j.data.icon;b!==d&&(j.title=b),j.span&&(n<l.minExpandLevel?(j.lazy||(j.expanded=!0),n>1&&o.push(m?"<span role='button' class='fancytree-expander fancytree-expander-fixed'></span>":"<span class='fancytree-expander fancytree-expander-fixed''></span>")):o.push(m?"<span role='button' class='fancytree-expander'></span>":"<span class='fancytree-expander'></span>"),l.checkbox&&j.hideCheckbox!==!0&&!j.isStatusNode()&&o.push(m?"<span role='checkbox' class='fancytree-checkbox'></span>":"<span class='fancytree-checkbox'></span>"),g=m?" role='img'":"",(p===!0||p!==!1&&l.icons!==!1)&&(p&&"string"==typeof p?(p="/"===p.charAt(0)?p:(l.imagePath||"")+p,o.push("<img src='"+p+"' class='fancytree-icon' alt='' />")):(e=l.iconClass&&l.iconClass.call(k,j,a)||j.data.iconclass||null,o.push(e?"<span "+g+" class='fancytree-custom-icon "+e+"'></span>":"<span "+g+" class='fancytree-icon'></span>"))),f="",l.renderTitle&&(f=l.renderTitle.call(k,{type:"renderTitle"},a)||""),f||(i=j.tooltip?" title='"+t.escapeHtml(j.tooltip)+"'":"",c=m?" id='ftal_"+j.key+"'":"",g=m?" role='treeitem'":"",h=l.titlesTabbable?" tabindex='0'":"",f="<span "+g+" class='fancytree-title'"+c+i+h+">"+j.title+"</span>"),o.push(f),j.span.innerHTML=o.join(""),this.nodeRenderStatus(a))},nodeRenderStatus:function(b){var c=b.node,d=b.tree,e=b.options,f=c.hasChildren(),g=c.isLastSibling(),h=e.aria,i=a(c.span).find(".fancytree-title"),j=e._classNames,k=[],l=c[d.statusClassPropName];l&&(k.push(j.node),d.activeNode===c&&k.push(j.active),d.focusNode===c?(k.push(j.focused),h&&i.attr("aria-activedescendant",!0)):h&&i.removeAttr("aria-activedescendant"),c.expanded?(k.push(j.expanded),h&&i.attr("aria-expanded",!0)):h&&i.removeAttr("aria-expanded"),c.folder&&k.push(j.folder),f!==!1&&k.push(j.hasChildren),g&&k.push(j.lastsib),c.lazy&&null==c.children&&k.push(j.lazy),c.partsel&&k.push(j.partsel),c.unselectable&&k.push(j.unselectable),c._isLoading&&k.push(j.loading),c._error&&k.push(j.error),c.selected?(k.push(j.selected),h&&i.attr("aria-selected",!0)):h&&i.attr("aria-selected",!1),c.extraClasses&&k.push(c.extraClasses),k.push(f===!1?j.combinedExpanderPrefix+"n"+(g?"l":""):j.combinedExpanderPrefix+(c.expanded?"e":"c")+(c.lazy&&null==c.children?"d":"")+(g?"l":"")),k.push(j.combinedIconPrefix+(c.expanded?"e":"c")+(c.folder?"f":"")),l.className=k.join(" "),c.li&&(c.li.className=g?j.lastsib:""))
},nodeSetActive:function(b,c,d){d=d||{};var f,g=b.node,h=b.tree,i=b.options,j=d.noEvents===!0,m=g===h.activeNode;return c=c!==!1,m===c?k(g):c&&!j&&this._triggerNodeEvent("beforeActivate",g,b.originalEvent)===!1?l(g,["rejected"]):void(c?(h.activeNode&&(e(h.activeNode!==g,"node was active (inconsistency)"),f=a.extend({},b,{node:h.activeNode}),h.nodeSetActive(f,!1),e(null===h.activeNode,"deactivate was out of sync?")),i.activeVisible&&g.makeVisible({scrollIntoView:!1}),h.activeNode=g,h.nodeRenderStatus(b),h.nodeSetFocus(b),j||h._triggerNodeEvent("activate",g,b.originalEvent)):(e(h.activeNode===g,"node was not active (inconsistency)"),h.activeNode=null,this.nodeRenderStatus(b),j||b.tree._triggerNodeEvent("deactivate",g,b.originalEvent)))},nodeSetExpanded:function(b,c,e){e=e||{};var f,g,h,i,j,m,n=b.node,o=b.tree,p=b.options,q=e.noAnimation===!0,r=e.noEvents===!0;if(c=c!==!1,n.expanded&&c||!n.expanded&&!c)return k(n);if(c&&!n.lazy&&!n.hasChildren())return k(n);if(!c&&n.getLevel()<p.minExpandLevel)return l(n,["locked"]);if(!r&&this._triggerNodeEvent("beforeExpand",n,b.originalEvent)===!1)return l(n,["rejected"]);if(q||n.isVisible()||(q=e.noAnimation=!0),g=new a.Deferred,c&&!n.expanded&&p.autoCollapse){j=n.getParentList(!1,!0),m=p.autoCollapse;try{for(p.autoCollapse=!1,h=0,i=j.length;i>h;h++)this._callHook("nodeCollapseSiblings",j[h],e)}finally{p.autoCollapse=m}}return g.done(function(){c&&p.autoScroll&&!q?n.getLastChild().scrollIntoView(!0,{topNode:n}).always(function(){r||b.tree._triggerNodeEvent(c?"expand":"collapse",b)}):r||b.tree._triggerNodeEvent(c?"expand":"collapse",b)}),f=function(d){var e,f,g,h;if(n.expanded=c,o._callHook("nodeRender",b,!1,!1,!0),n.ul)if(g="none"!==n.ul.style.display,h=!!n.expanded,g===h)n.warn("nodeSetExpanded: UL.style.display already set");else{if(p.fx&&!q)return e=p.fx.duration||200,f=p.fx.easing,void a(n.ul).animate(p.fx,e,f,function(){d()});n.ul.style.display=n.expanded||!parent?"":"none"}d()},c&&n.lazy&&n.hasChildren()===d?n.load().done(function(){g.notifyWith&&g.notifyWith(n,["loaded"]),f(function(){g.resolveWith(n)})}).fail(function(a){f(function(){g.rejectWith(n,["load failed ("+a+")"])})}):f(function(){g.resolveWith(n)}),g.promise()},nodeSetFocus:function(b,c){var d,e=b.tree,f=b.node;if(c=c!==!1,e.focusNode){if(e.focusNode===f&&c)return;d=a.extend({},b,{node:e.focusNode}),e.focusNode=null,this._triggerNodeEvent("blur",d),this._callHook("nodeRenderStatus",d)}c&&(this.hasFocus()||(f.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",b,!0,!0)),f.makeVisible({scrollIntoView:!1}),e.focusNode=f,this._triggerNodeEvent("focus",b),b.options.autoScroll&&f.scrollIntoView(),this._callHook("nodeRenderStatus",b))},nodeSetSelected:function(a,b){var c=a.node,d=a.tree,e=a.options;if(b=b!==!1,c.debug("nodeSetSelected("+b+")",a),!c.unselectable){if(c.selected&&b||!c.selected&&!b)return!!c.selected;if(this._triggerNodeEvent("beforeSelect",c,a.originalEvent)===!1)return!!c.selected;b&&1===e.selectMode?d.lastSelectedNode&&d.lastSelectedNode.setSelected(!1):3===e.selectMode&&(c.selected=b,c.fixSelection3AfterClick()),c.selected=b,this.nodeRenderStatus(a),d.lastSelectedNode=b?c:null,d._triggerNodeEvent("select",a)}},nodeSetStatus:function(b,c,d,e){function f(){var a=h.children?h.children[0]:null;if(a&&a.isStatusNode()){try{h.ul&&(h.ul.removeChild(a.li),a.li=null)}catch(b){}1===h.children.length?h.children=[]:h.children.shift()}}function g(b,c){var d=h.children?h.children[0]:null;return d&&d.isStatusNode()?(a.extend(d,b),i._callHook("nodeRenderTitle",d)):(b.key="_statusNode",h._setChildren([b]),h.children[0].statusNodeType=c,i.render()),h.children[0]}var h=b.node,i=b.tree;switch(c){case"ok":f(),h._isLoading=!1,h._error=null,h.renderStatus();break;case"loading":h.parent||g({title:i.options.strings.loading+(d?" ("+d+") ":""),tooltip:e,extraClasses:"fancytree-statusnode-wait"},c),h._isLoading=!0,h._error=null,h.renderStatus();break;case"error":g({title:i.options.strings.loadError+(d?" ("+d+") ":""),tooltip:e,extraClasses:"fancytree-statusnode-error"},c),h._isLoading=!1,h._error={message:d,details:e},h.renderStatus();break;default:a.error("invalid node status "+c)}},nodeToggleExpanded:function(a){return this.nodeSetExpanded(a,!a.node.expanded)},nodeToggleSelected:function(a){return this.nodeSetSelected(a,!a.node.selected)},treeClear:function(a){var b=a.tree;b.activeNode=null,b.focusNode=null,b.$div.find(">ul.fancytree-container").empty(),b.rootNode.children=null},treeCreate:function(){},treeDestroy:function(){},treeInit:function(a){this.treeLoad(a)},treeLoad:function(b,c){var d,e,f,g=b.tree,h=b.widget.element,i=a.extend({},b,{node:this.rootNode});if(g.rootNode.children&&this.treeClear(b),c=c||this.options.source)"string"==typeof c&&a.error("Not implemented");else switch(d=h.data("type")||"html"){case"html":e=h.find(">ul:first"),e.addClass("ui-fancytree-source ui-helper-hidden"),c=a.ui.fancytree.parseHtml(e),this.data=a.extend(this.data,n(e));break;case"json":c=a.parseJSON(h.text()),c.children&&(c.title&&(g.title=c.title),c=c.children);break;default:a.error("Invalid data-type: "+d)}return f=this.nodeLoadChildren(i,c).done(function(){g.render(),3===b.options.selectMode&&g.rootNode.fixSelection3FromEndNodes(),g._triggerTreeEvent("init",null,{status:!0})}).fail(function(){g.render(),g._triggerTreeEvent("init",null,{status:!1})})},treeRegisterNode:function(){},treeSetFocus:function(a,b){b=b!==!1,b!==this.hasFocus()&&(this._hasFocus=b,this.$container.toggleClass("fancytree-treefocus",b),this._triggerTreeEvent(b?"focusTree":"blurTree"))}}),a.widget("ui.fancytree",{options:{activeVisible:!0,ajax:{type:"GET",cache:!1,dataType:"json"},aria:!1,autoActivate:!0,autoCollapse:!1,autoScroll:!1,checkbox:!1,clickFolderMode:4,debugLevel:null,disabled:!1,enableAspx:!0,extensions:[],fx:{height:"toggle",duration:200},generateIds:!1,icons:!0,idPrefix:"ft_",focusOnSelect:!1,keyboard:!0,keyPathSeparator:"/",minExpandLevel:1,quicksearch:!1,scrollOfs:{top:0,bottom:0},scrollParent:null,selectMode:2,strings:{loading:"Loading…",loadError:"Load error!"},tabbable:!0,titlesTabbable:!1,_classNames:{node:"fancytree-node",folder:"fancytree-folder",combinedExpanderPrefix:"fancytree-exp-",combinedIconPrefix:"fancytree-ico-",hasChildren:"fancytree-has-children",active:"fancytree-active",selected:"fancytree-selected",expanded:"fancytree-expanded",lazy:"fancytree-lazy",focused:"fancytree-focused",partsel:"fancytree-partsel",unselectable:"fancytree-unselectable",lastsib:"fancytree-lastsib",loading:"fancytree-loading",error:"fancytree-error"},lazyLoad:null,postProcess:null},_create:function(){this.tree=new r(this),this.$source=this.source||"json"===this.element.data("type")?this.element:this.element.find(">ul:first");var b,c,f,g=this.options.extensions,h=this.tree;for(f=0;f<g.length;f++)c=g[f],b=a.ui.fancytree._extensions[c],b||a.error("Could not apply extension '"+c+"' (it is not registered, did you forget to include it?)"),this.tree.options[c]=a.extend(!0,{},b.options,this.tree.options[c]),e(this.tree.ext[c]===d,"Extension name must not exist as Fancytree.ext attribute: '"+c+"'"),this.tree.ext[c]={},j(this.tree,h,b,c),h=b;this.tree._callHook("treeCreate",this.tree)},_init:function(){this.tree._callHook("treeInit",this.tree),this._bind()},_setOption:function(b,c){var d=!0,e=!1;switch(b){case"aria":case"checkbox":case"icons":case"minExpandLevel":case"tabbable":this.tree._callHook("treeCreate",this.tree),e=!0;break;case"source":d=!1,this.tree._callHook("treeLoad",this.tree,c)}this.tree.debug("set option "+b+"="+c+" <"+typeof c+">"),d&&a.Widget.prototype._setOption.apply(this,arguments),e&&this.tree.render(!0,!1)},destroy:function(){this._unbind(),this.tree._callHook("treeDestroy",this.tree),this.tree.$div.find(">ul.fancytree-container").remove(),this.$source&&this.$source.removeClass("ui-helper-hidden"),a.Widget.prototype.destroy.call(this)},_unbind:function(){var b=this.tree._ns;this.element.unbind(b),this.tree.$container.unbind(b),a(c).unbind(b)},_bind:function(){var a=this,b=this.options,c=this.tree,d=c._ns;this._unbind(),c.$container.on("focusin"+d+" focusout"+d,function(a){var b=t.getNode(a),d="focusin"===a.type;b?c._callHook("nodeSetFocus",b,d):c._callHook("treeSetFocus",c,d)}).on("selectstart"+d,"span.fancytree-title",function(a){a.preventDefault()}).on("keydown"+d,function(a){if(b.disabled||b.keyboard===!1)return!0;var d,e=c.focusNode,f=c._makeHookContext(e||c,a),g=c.phase;try{return c.phase="userEvent",d=e?c._triggerNodeEvent("keydown",e,a):c._triggerTreeEvent("keydown",a),"preventNav"===d?d=!0:d!==!1&&(d=c._callHook("nodeKeydown",f)),d}finally{c.phase=g}}).on("click"+d+" dblclick"+d,function(c){if(b.disabled)return!0;var d,e=t.getEventTarget(c),f=e.node,g=a.tree,h=g.phase;if(!f)return!0;d=g._makeHookContext(f,c);try{switch(g.phase="userEvent",c.type){case"click":return d.targetType=e.type,g._triggerNodeEvent("click",d,c)===!1?!1:g._callHook("nodeClick",d);case"dblclick":return d.targetType=e.type,g._triggerNodeEvent("dblclick",d,c)===!1?!1:g._callHook("nodeDblclick",d)}}finally{g.phase=h}})},getActiveNode:function(){return this.tree.activeNode},getNodeByKey:function(a){return this.tree.getNodeByKey(a)},getRootNode:function(){return this.tree.rootNode},getTree:function(){return this.tree}}),t=a.ui.fancytree,a.extend(a.ui.fancytree,{version:"2.6.0",buildType: "production",debugLevel: 1,_nextId:1,_nextNodeKey:1,_extensions:{},_FancytreeClass:r,_FancytreeNodeClass:q,jquerySupports:{positionMyOfs:h(a.ui.version,1,9)},assert:function(a,b){return e(a,b)},debounce:function(a,b,c,d){var e;return 3===arguments.length&&"boolean"!=typeof c&&(d=c,c=!1),function(){var f=arguments;d=d||this,c&&!e&&b.apply(d,f),clearTimeout(e),e=setTimeout(function(){c||b.apply(d,f),e=null},a)}},debug:function(){a.ui.fancytree.debugLevel>=2&&f("log",arguments)},error:function(){f("error",arguments)},escapeHtml:function(a){return(""+a).replace(/[&<>"'\/]/g,function(a){return u[a]})},unescapeHtml:function(a){var b=c.createElement("div");return b.innerHTML=a,0===b.childNodes.length?"":b.childNodes[0].nodeValue},getEventTargetType:function(a){return this.getEventTarget(a).type},getEventTarget:function(b){var c=b&&b.target?b.target.className:"",e={node:this.getNode(b.target),type:d};return/\bfancytree-title\b/.test(c)?e.type="title":/\bfancytree-expander\b/.test(c)?e.type=e.node.hasChildren()===!1?"prefix":"expander":/\bfancytree-checkbox\b/.test(c)||/\bfancytree-radio\b/.test(c)?e.type="checkbox":/\bfancytree-icon\b/.test(c)?e.type="icon":/\bfancytree-node\b/.test(c)?e.type="title":b&&b.target&&a(b.target).closest(".fancytree-title").length&&(e.type="title"),e},getNode:function(a){if(a instanceof q)return a;for(a.selector!==d?a=a[0]:a.originalEvent!==d&&(a=a.target);a;){if(a.ftnode)return a.ftnode;a=a.parentNode}return null},info:function(){a.ui.fancytree.debugLevel>=1&&f("info",arguments)},parseHtml:function(b){var c,e,f,g,h,i,j,k,l=b.find(">li"),m=[];return l.each(function(){var l,o=a(this),p=o.find(">span:first",this),q=p.length?null:o.find(">a:first"),r={tooltip:null,data:{}};for(p.length?r.title=p.html():q&&q.length?(r.title=q.html(),r.data.href=q.attr("href"),r.data.target=q.attr("target"),r.tooltip=q.attr("title")):(r.title=o.html(),g=r.title.search(/<ul/i),g>=0&&(r.title=r.title.substring(0,g))),r.title=a.trim(r.title),e=0,f=v.length;f>e;e++)r[v[e]]=d;for(j=this.className.split(" "),c=[],e=0,f=j.length;f>e;e++)k=j[e],w[k]?r[k]=!0:c.push(k);if(r.extraClasses=c.join(" "),h=o.attr("title"),h&&(r.tooltip=h),h=o.attr("id"),h&&(r.key=h),l=n(o),l&&!a.isEmptyObject(l)){for(e=0,f=x.length;f>e;e++)h=x[e],i=l[h],null!=i&&(delete l[h],r[h]=i);a.extend(r.data,l)}b=o.find(">ul:first"),r.children=b.length?a.ui.fancytree.parseHtml(b):r.lazy?d:null,m.push(r)}),m},registerExtension:function(b){e(null!=b.name,"extensions must have a `name` property."),e(null!=b.version,"extensions must have a `version` property."),a.ui.fancytree._extensions[b.name]=b},warn:function(){f("warn",arguments)}})}(jQuery,window,document); |
modules/dreamview/frontend/src/components/Layouts/MonitorPanel.js | ApolloAuto/apollo | import 'styles/monitor.scss';
import React from 'react';
import {
Tabs, TabList, Tab, TabPanel,
} from 'react-tabs';
import { MONITOR_MENU } from 'store/options';
import CameraParam from 'components/CameraParam';
import { CameraVideo } from 'components/Tasks/SensorCamera';
import DataCollectionMonitor from 'components/DataCollectionMonitor';
import PNCMonitor from 'components/PNCMonitor';
import ConsoleTeleOp from 'components/TeleopMonitor/ConsoleTeleop';
import CarTeleOp from 'components/TeleopMonitor/CarTeleop';
import FuelClient from 'components/FuelClient';
export default class MonitorPanel extends React.Component {
renderMonitor() {
const { viewName } = this.props;
switch (viewName) {
case MONITOR_MENU.CONSOLE_TELEOP_MONITOR:
return <ConsoleTeleOp />;
case MONITOR_MENU.CAR_TELEOP_MONITOR:
return <CarTeleOp />;
case MONITOR_MENU.CAMERA_PARAM:
return <CameraParam />;
case MONITOR_MENU.DATA_COLLECTION_MONITOR:
return <DataCollectionMonitor />;
case MONITOR_MENU.PNC_MONITOR:
return <PNCMonitor />;
case MONITOR_MENU.FUEL_CLIENT:
return <FuelClient />;
default:
return null;
}
}
render() {
const { showCameraVideo } = this.props;
return (
<div className="right-pane">
{showCameraVideo
&& (
<Tabs>
<TabList>
<Tab>Camera View</Tab>
</TabList>
<TabPanel>
<CameraVideo />
</TabPanel>
</Tabs>
)}
{this.renderMonitor()}
</div>
);
}
}
|
ajax/libs/material-ui/5.0.0-alpha.21/internal/svg-icons/ErrorOutline.js | cdnjs/cdnjs | import * as React from 'react';
import createSvgIcon from '../../utils/createSvgIcon';
/**
* @ignore - internal component.
*/
export default createSvgIcon( /*#__PURE__*/React.createElement("path", {
d: "M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
}), 'ErrorOutline'); |
app/client/src/routes/manageCampaignVolunteers/index.js | uprisecampaigns/uprise-app | import React from 'react';
import ManageCampaignVolunteers from 'scenes/ManageCampaignVolunteers';
import Layout from 'components/Layout';
import organizeCampaignPaths from 'routes/organizeCampaignPaths';
export default organizeCampaignPaths({
path: '/organize/:slug/volunteers',
component: campaign => (
<Layout>
<ManageCampaignVolunteers campaignId={campaign.id} />
</Layout>
),
});
|
src/svg-icons/maps/directions-transit.js | ngbrown/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsDirectionsTransit = (props) => (
<SvgIcon {...props}>
<path d="M12 2c-4.42 0-8 .5-8 4v9.5C4 17.43 5.57 19 7.5 19L6 20.5v.5h12v-.5L16.5 19c1.93 0 3.5-1.57 3.5-3.5V6c0-3.5-3.58-4-8-4zM7.5 17c-.83 0-1.5-.67-1.5-1.5S6.67 14 7.5 14s1.5.67 1.5 1.5S8.33 17 7.5 17zm3.5-6H6V6h5v5zm5.5 6c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm1.5-6h-5V6h5v5z"/>
</SvgIcon>
);
MapsDirectionsTransit = pure(MapsDirectionsTransit);
MapsDirectionsTransit.displayName = 'MapsDirectionsTransit';
MapsDirectionsTransit.muiName = 'SvgIcon';
export default MapsDirectionsTransit;
|
components/GlobalModal.js | react-community/native-directory | import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { StyleSheet, css } from 'glamor/aphrodite';
import { keyframes } from 'glamor';
class GlobalModal extends React.Component {
static propTypes = {
modal: PropTypes.object,
};
state = {
isLoaded: false,
isNotFound: false,
};
componentDidUpdate(prevProps) {
if (this.props.modal && !prevProps.modal) {
window.history.pushState(null, null, `?modal=${this.props.modal.content}`);
window.addEventListener('popstate', this._handlePopState);
}
}
componentWillReceiveProps(nextProps, nextState) {
if (!nextProps.modal) {
return;
}
const img = new Image();
img.onload = () => {
this.setState({
isLoaded: true,
isNotFound: false,
});
};
img.onerror = () => {
this.setState({
isLoaded: true,
isNotFound: true,
});
};
img.src = nextProps.modal.content;
}
_handlePopState = () => {
this.props.dispatch({
type: 'CLEAR_MODAL',
});
};
_dismissModal = () => {
if (!this.props.modal) {
return;
}
this.setState({ isLoaded: false, isNotFound: false }, () => {
window.history.go(-1);
window.removeEventListener('popstate', this._handlePopState);
this.props.dispatch({
type: 'CLEAR_MODAL',
});
});
};
render() {
if (!this.props.modal) {
return null;
}
return (
<div
ref={m => {
this._modal = m;
}}
className={css(styles.globalModal)}
onClick={this._dismissModal}>
{this.state.isLoaded ? (
<img
src={this.props.modal.content}
className={css(styles.globalModalContent, styles.globalModalContentImage)}
/>
) : (
<div className={css(styles.globalModalContent)}>
{this.state.isNotFound ? 'Image failed to load' : 'Loading'}
</div>
)}
</div>
);
}
}
let fadeInKeyframes = keyframes({
from: {
opacity: 0,
},
to: {
opacity: 1,
},
});
let styles = StyleSheet.create({
fadeIn: { animation: fadeInKeyframes },
globalModal: {
animation: `${fadeInKeyframes} 200ms cubic-bezier(0.645, 0.045, 0.355, 1)`,
position: 'fixed',
background: 'rgba(0, 0, 0, 0.9)',
color: '#FFFFFF',
top: 0,
right: 0,
left: 0,
bottom: 0,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
},
globalModalContent: {
display: 'block',
maxHeight: '80%',
maxWidth: '80%',
textAlign: 'center',
fontSize: '1.4rem',
},
globalModalContentImage: {
boxShadow: '0 1px 4px rgba(0, 0, 0, 0.8)',
},
});
export default connect(state => {
return { modal: state.modal };
})(GlobalModal);
|
src/js/components/Animate.js | kylebyerly-hp/grommet | // (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { findDOMNode } from 'react-dom';
import { TransitionGroup } from 'react-transition-group';
import classnames from 'classnames';
import CSSClassnames from '../utils/CSSClassnames';
import { findScrollParents } from '../utils/DOM';
const CLASS_ROOT = CSSClassnames.ANIMATE;
class AnimateChild extends Component {
constructor(props, context) {
super(props, context);
const { enter, leave } = props;
// leave will reuse enter if leave is not defined
this.state = {
enter: enter,
leave: leave || enter,
state: 'inactive'
};
}
componentWillReceiveProps (nextProps) {
const { enter, leave } = nextProps;
this.setState({ enter: enter, leave: leave || enter });
if (nextProps.visible !== this.props.visible) {
const [ nextState, lastState ] = nextProps.visible ?
[ 'enter', 'active' ] : [ 'leave', 'inactive' ];
this._delay(nextState, this._done.bind(this, lastState));
}
}
componentWillUnmount () {
if (this._timer) {
clearTimeout(this._timer);
this._timer = undefined;
}
}
componentWillAppear (callback) {
if (true === this.props.visible) {
this._delay('enter', callback);
}
}
componentWillEnter (callback) {
if (true === this.props.visible) {
this._delay('enter', callback);
}
}
componentDidAppear () {
this._done('active');
}
componentDidEnter () {
this._done('active');
}
componentWillLeave (callback) {
this._delay('leave', callback);
}
componentDidLeave (callback) {
this._done('inactive');
}
_delay (state, callback) {
const { delay } = this.state[state];
// ensure we start out inactive in case we aren't being kept in the DOM
if ('enter' === state) {
this.setState({ state: 'inactive '});
}
clearTimeout(this._timer);
this._timer = setTimeout(this._start.bind(this, state, callback),
delay || 1);
}
_start (state, callback) {
const { duration } = this.state[state];
this.setState({ state });
this._timer = setTimeout(callback, duration);
}
_done (state) {
this.setState({ state });
}
render () {
const { children } = this.props;
const { enter, leave, state } = this.state;
const animation = (this.state[state] || this.state.enter).animation;
const className = classnames(
`${CLASS_ROOT}__child`,
`${CLASS_ROOT}__child--${animation}`,
`${CLASS_ROOT}__child--${state}`
);
const duration = ('enter' === state || 'inactive' === state) ?
enter.duration : leave.duration;
const style = { transitionDuration: `${duration || 0}ms` };
return <div className={className} style={style}>{children}</div>;
}
}
AnimateChild.propTypes = {
enter: PropTypes.shape({
animation: PropTypes.string,
duration: PropTypes.number,
delay: PropTypes.number
}).isRequired,
leave: PropTypes.shape({
animation: PropTypes.string,
duration: PropTypes.number,
delay: PropTypes.number
}),
visible: PropTypes.bool
};
AnimateChild.defaultProps = {
visible: false
};
export default class Animate extends Component {
constructor(props, context) {
super(props, context);
this._checkScroll = this._checkScroll.bind(this);
this.state = { visible: true === props.visible };
}
componentDidMount () {
if ('scroll' === this.props.visible) {
this._listenForScroll();
}
}
componentWillReceiveProps (nextProps) {
const { visible } = this.props;
if (visible !== nextProps.visible) {
if ('scroll' === visible) {
this._unlistenForScroll();
} else if ('scroll' === nextProps.visible) {
this._listenForScroll();
}
this.setState({ visible: true === nextProps.visible });
}
}
componentWillUnmount () {
if ('scroll' === this.props.visible) {
this._unlistenForScroll();
}
}
_listenForScroll () {
// add a timeout so that the findScrollParents function
// get the right container sizes
setTimeout(() => {
const scrollParents = findScrollParents(findDOMNode(this.animateRef));
if (scrollParents.indexOf(document) === -1) {
document.addEventListener('scroll', this._checkScroll);
}
scrollParents.forEach((scrollParent) => {
scrollParent.addEventListener('scroll', this._checkScroll);
}, this);
}, 0);
}
_unlistenForScroll () {
const scrollParents = findScrollParents(findDOMNode(this.animateRef));
if (scrollParents.indexOf(document) === -1) {
document.removeEventListener('scroll', this._checkScroll);
}
scrollParents.forEach((scrollParent) => {
scrollParent.removeEventListener('scroll', this._checkScroll);
}, this);
}
_checkScroll () {
const { onAppear, onLeave } = this.props;
const group = findDOMNode(this.animateRef);
const rect = group.getBoundingClientRect();
if (rect.top < window.innerHeight) {
this.setState({ visible: true }, () => {
if (onAppear) {
onAppear();
}
});
} else {
this.setState({ visible: false }, () => {
if (onLeave) {
onLeave();
}
});
}
}
render () {
const {
enter, leave, className, children, component, keep, ...props
} = this.props;
delete props.onAppear;
delete props.onLeave;
delete props.visible;
const { visible } = this.state;
const classes = classnames( CLASS_ROOT, className );
let animateChildren;
if (keep || visible) {
animateChildren = React.Children.map(children, (child, index) => (
<AnimateChild key={index} enter={enter} leave={leave}
visible={visible}>
{child}
</AnimateChild>
));
}
return (
<TransitionGroup
{...props}
className={classes}
component={component}
ref={ref => this.animateRef = ref}
>
{animateChildren}
</TransitionGroup>
);
}
}
const ANIMATIONS =
['fade', 'slide-up', 'slide-down', 'slide-left', 'slide-right', 'jiggle'];
Animate.propTypes = {
component: PropTypes.oneOfType([
PropTypes.string,
PropTypes.func
]),
enter: PropTypes.shape({
animation: PropTypes.oneOf(ANIMATIONS).isRequired,
duration: PropTypes.number,
delay: PropTypes.number
}).isRequired,
keep: PropTypes.bool,
leave: PropTypes.shape({
animation: PropTypes.oneOf(ANIMATIONS).isRequired,
duration: PropTypes.number,
delay: PropTypes.number
}),
onAppear: PropTypes.func,
onLeave: PropTypes.func,
visible: PropTypes.oneOfType([
PropTypes.oneOf(['scroll']),
PropTypes.bool
])
};
Animate.defaultProps = {
component: 'div',
enter: { animation: 'fade', duration: 300 },
visible: true
};
|
app/javascript/mastodon/features/followers/index.js | vahnj/mastodon | import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import LoadingIndicator from '../../components/loading_indicator';
import {
fetchAccount,
fetchFollowers,
expandFollowers,
} from '../../actions/accounts';
import { ScrollContainer } from 'react-router-scroll-4';
import AccountContainer from '../../containers/account_container';
import Column from '../ui/components/column';
import HeaderContainer from '../account_timeline/containers/header_container';
import LoadMore from '../../components/load_more';
import ColumnBackButton from '../../components/column_back_button';
import ImmutablePureComponent from 'react-immutable-pure-component';
const mapStateToProps = (state, props) => ({
accountIds: state.getIn(['user_lists', 'followers', props.params.accountId, 'items']),
hasMore: !!state.getIn(['user_lists', 'followers', props.params.accountId, 'next']),
});
@connect(mapStateToProps)
export default class Followers extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
};
componentWillMount () {
this.props.dispatch(fetchAccount(this.props.params.accountId));
this.props.dispatch(fetchFollowers(this.props.params.accountId));
}
componentWillReceiveProps (nextProps) {
if (nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) {
this.props.dispatch(fetchAccount(nextProps.params.accountId));
this.props.dispatch(fetchFollowers(nextProps.params.accountId));
}
}
handleScroll = (e) => {
const { scrollTop, scrollHeight, clientHeight } = e.target;
if (scrollTop === scrollHeight - clientHeight && this.props.hasMore) {
this.props.dispatch(expandFollowers(this.props.params.accountId));
}
}
handleLoadMore = (e) => {
e.preventDefault();
this.props.dispatch(expandFollowers(this.props.params.accountId));
}
render () {
const { accountIds, hasMore } = this.props;
let loadMore = null;
if (!accountIds) {
return (
<Column>
<LoadingIndicator />
</Column>
);
}
if (hasMore) {
loadMore = <LoadMore onClick={this.handleLoadMore} />;
}
return (
<Column>
<ColumnBackButton />
<ScrollContainer scrollKey='followers'>
<div className='scrollable' onScroll={this.handleScroll}>
<div className='followers'>
<HeaderContainer accountId={this.props.params.accountId} hideTabs />
{accountIds.map(id => <AccountContainer key={id} id={id} withNote={false} />)}
{loadMore}
</div>
</div>
</ScrollContainer>
</Column>
);
}
}
|
fields/types/name/NameColumn.js | andrewlinfoot/keystone | import React from 'react';
import ItemsTableCell from '../../components/ItemsTableCell';
import ItemsTableValue from '../../components/ItemsTableValue';
import displayName from 'display-name';
var NameColumn = React.createClass({
displayName: 'NameColumn',
propTypes: {
col: React.PropTypes.object,
data: React.PropTypes.object,
linkTo: React.PropTypes.string,
},
renderValue () {
var value = this.props.data.fields[this.props.col.path];
if (!value || (!value.first && !value.last)) return '(no name)';
return displayName(value.first, value.last);
},
render () {
return (
<ItemsTableCell>
<ItemsTableValue to={this.props.linkTo} padded interior field={this.props.col.type}>
{this.renderValue()}
</ItemsTableValue>
</ItemsTableCell>
);
},
});
module.exports = NameColumn;
|
ajax/libs/F2/1.3.3/f2.no-bootstrap.js | wmkcc/cdnjs | ;(function(exports) {
if (exports.F2 && !exports.F2_TESTING_MODE) {
return;
}
/*!
JSON.org requires the following notice to accompany json2:
Copyright (c) 2002 JSON.org
http://json.org
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
/*
This code should be minified before deployment.
See http://javascript.crockford.com/jsmin.html
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
NOT CONTROL.
This file creates a global JSON object containing two methods: stringify
and parse.
JSON.stringify(value, replacer, space)
value any JavaScript value, usually an object or array.
replacer an optional parameter that determines how object
values are stringified for objects. It can be a
function or an array of strings.
space an optional parameter that specifies the indentation
of nested structures. If it is omitted, the text will
be packed without extra whitespace. If it is a number,
it will specify the number of spaces to indent at each
level. If it is a string (such as '\t' or ' '),
it contains the characters used to indent at each level.
This method produces a JSON text from a JavaScript value.
When an object value is found, if the object contains a toJSON
method, its toJSON method will be called and the result will be
stringified. A toJSON method does not serialize: it returns the
value represented by the name/value pair that should be serialized,
or undefined if nothing should be serialized. The toJSON method
will be passed the key associated with the value, and this will be
bound to the value
For example, this would serialize Dates as ISO strings.
Date.prototype.toJSON = function (key) {
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};
You can provide an optional replacer method. It will be passed the
key and value of each member, with this bound to the containing
object. The value that is returned from your method will be
serialized. If your method returns undefined, then the member will
be excluded from the serialization.
If the replacer parameter is an array of strings, then it will be
used to select the members to be serialized. It filters the results
such that only members with keys listed in the replacer array are
stringified.
Values that do not have JSON representations, such as undefined or
functions, will not be serialized. Such values in objects will be
dropped; in arrays they will be replaced with null. You can use
a replacer function to replace those with JSON values.
JSON.stringify(undefined) returns undefined.
The optional space parameter produces a stringification of the
value that is filled with line breaks and indentation to make it
easier to read.
If the space parameter is a non-empty string, then that string will
be used for indentation. If the space parameter is a number, then
the indentation will be that many spaces.
Example:
text = JSON.stringify(['e', {pluribus: 'unum'}]);
// text is '["e",{"pluribus":"unum"}]'
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
text = JSON.stringify([new Date()], function (key, value) {
return this[key] instanceof Date ?
'Date(' + this[key] + ')' : value;
});
// text is '["Date(---current time---)"]'
JSON.parse(text, reviver)
This method parses a JSON text to produce an object or array.
It can throw a SyntaxError exception.
The optional reviver parameter is a function that can filter and
transform the results. It receives each of the keys and values,
and its return value is used instead of the original value.
If it returns what it received, then the structure is not modified.
If it returns undefined then the member is deleted.
Example:
// Parse the text. Values that look like ISO date strings will
// be converted to Date objects.
myData = JSON.parse(text, function (key, value) {
var a;
if (typeof value === 'string') {
a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
if (a) {
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+a[5], +a[6]));
}
}
return value;
});
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
var d;
if (typeof value === 'string' &&
value.slice(0, 5) === 'Date(' &&
value.slice(-1) === ')') {
d = new Date(value.slice(5, -1));
if (d) {
return d;
}
}
return value;
});
This is a reference implementation. You are free to copy, modify, or
redistribute.
*/
/*jslint evil: true, regexp: true */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
lastIndex, length, parse, prototype, push, replace, slice, stringify,
test, toJSON, toString, valueOf
*/
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
if (typeof JSON !== 'object') {
JSON = {};
}
(function () {
'use strict';
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function (key) {
return isFinite(this.valueOf())
? this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z'
: null;
};
String.prototype.toJSON =
Number.prototype.toJSON =
Boolean.prototype.toJSON = function (key) {
return this.valueOf();
};
}
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
indent,
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
rep;
function quote(string) {
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
escapable.lastIndex = 0;
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string'
? c
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}
function str(key, holder) {
// Produce a string from holder[key].
var i, // The loop counter.
k, // The member key.
v, // The member value.
length,
mind = gap,
partial,
value = holder[key];
// If the value has a toJSON method, call it to obtain a replacement value.
if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
// What happens next depends on the value's type.
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.
return String(value);
// If the type is 'object', we might be dealing with an object or an array or
// null.
case 'object':
// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.
if (!value) {
return 'null';
}
// Make an array to hold the partial results of stringifying this object value.
gap += indent;
partial = [];
// Is the value an array?
if (Object.prototype.toString.apply(value) === '[object Array]') {
// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
v = partial.length === 0
? '[]'
: gap
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
: '[' + partial.join(',') + ']';
gap = mind;
return v;
}
// If the replacer is an array, use it to select the members to be stringified.
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
if (typeof rep[i] === 'string') {
k = rep[i];
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
// Otherwise, iterate through all of the keys in the object.
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
v = partial.length === 0
? '{}'
: gap
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
: '{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
// If the JSON object does not yet have a stringify method, give it one.
if (typeof JSON.stringify !== 'function') {
JSON.stringify = function (value, replacer, space) {
// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.
var i;
gap = '';
indent = '';
// If the space parameter is a number, make an indent string containing that
// many spaces.
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' ';
}
// If the space parameter is a string, it will be used as the indent string.
} else if (typeof space === 'string') {
indent = space;
}
// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.
rep = replacer;
if (replacer && typeof replacer !== 'function' &&
(typeof replacer !== 'object' ||
typeof replacer.length !== 'number')) {
throw new Error('JSON.stringify');
}
// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.
return str('', {'': value});
};
}
// If the JSON object does not yet have a parse method, give it one.
if (typeof JSON.parse !== 'function') {
JSON.parse = function (text, reviver) {
// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.
var j;
function walk(holder, key) {
// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.
text = String(text);
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' +
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
}
// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.
// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
if (/^[\],:{}\s]*$/
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
j = eval('(' + text + ')');
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
return typeof reviver === 'function'
? walk({'': j}, '')
: j;
}
// If the text is not JSON parseable, then a SyntaxError is thrown.
throw new SyntaxError('JSON.parse');
};
}
}());
/*!
* jQuery JavaScript Library v1.8.3
* The jQuery Foundation and other contributors require the following notice to accompany jQuery:
*
* Copyright (c) 2013 jQuery Foundation and other contributors
*
* http://jquery.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
(function( window, undefined ) {
var
// A central reference to the root jQuery(document)
rootjQuery,
// The deferred used on DOM ready
readyList,
// Use the correct document accordingly with window argument (sandbox)
document = window.document,
location = window.location,
navigator = window.navigator,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// Save a reference to some core methods
core_push = Array.prototype.push,
core_slice = Array.prototype.slice,
core_indexOf = Array.prototype.indexOf,
core_toString = Object.prototype.toString,
core_hasOwn = Object.prototype.hasOwnProperty,
core_trim = String.prototype.trim,
// Define a local copy of jQuery
jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Used for matching numbers
core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,
// Used for detecting and trimming whitespace
core_rnotwhite = /\S/,
core_rspace = /\s+/,
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return ( letter + "" ).toUpperCase();
},
// The ready event handler and self cleanup method
DOMContentLoaded = function() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
jQuery.ready();
} else if ( document.readyState === "complete" ) {
// we're here because readyState === "complete" in oldIE
// which is good enough for us to call the dom ready!
document.detachEvent( "onreadystatechange", DOMContentLoaded );
jQuery.ready();
}
},
// [[Class]] -> type pairs
class2type = {};
jQuery.fn = jQuery.prototype = {
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc;
// Handle $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = rquickExpr.exec( selector );
}
// Match html or make sure no context is specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
doc = ( context && context.nodeType ? context.ownerDocument || context : document );
// scripts is true for back-compat
selector = jQuery.parseHTML( match[1], doc, true );
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
this.attr.call( selector, context, true );
}
return jQuery.merge( this, selector );
// HANDLE: $(#id)
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return ( context || rootjQuery ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The current version of jQuery being used
jquery: "1.8.3",
// The default length of a jQuery object is 0
length: 0,
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
toArray: function() {
return core_slice.call( this );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
( num < 0 ? this[ this.length + num ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems, name, selector ) {
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
if ( name === "find" ) {
ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
} else if ( name ) {
ret.selector = this.selector + "." + name + "(" + selector + ")";
}
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Add the callback
jQuery.ready.promise().done( fn );
return this;
},
eq: function( i ) {
i = +i;
return i === -1 ?
this.slice( i ) :
this.slice( i, i + 1 );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
slice: function() {
return this.pushStack( core_slice.apply( this, arguments ),
"slice", core_slice.call(arguments).join(",") );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: core_push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// extend jQuery itself if only one argument is passed
if ( length === i ) {
target = this;
--i;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {
// Abort if there are pending holds or we're already ready
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
return;
}
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready, 1 );
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger("ready").off("ready");
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
isWindow: function( obj ) {
return obj != null && obj == obj.window;
},
isNumeric: function( obj ) {
return !isNaN( parseFloat(obj) ) && isFinite( obj );
},
type: function( obj ) {
return obj == null ?
String( obj ) :
class2type[ core_toString.call(obj) ] || "object";
},
isPlainObject: function( obj ) {
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
try {
// Not own constructor property must be Object
if ( obj.constructor &&
!core_hasOwn.call(obj, "constructor") &&
!core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || core_hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw new Error( msg );
},
// data: string of html
// context (optional): If specified, the fragment will be created in this context, defaults to document
// scripts (optional): If true, will include scripts passed in the html string
parseHTML: function( data, context, scripts ) {
var parsed;
if ( !data || typeof data !== "string" ) {
return null;
}
if ( typeof context === "boolean" ) {
scripts = context;
context = 0;
}
context = context || document;
// Single tag
if ( (parsed = rsingleTag.exec( data )) ) {
return [ context.createElement( parsed[1] ) ];
}
parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] );
return jQuery.merge( [],
(parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes );
},
parseJSON: function( data ) {
if ( !data || typeof data !== "string") {
return null;
}
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
jQuery.error( "Invalid JSON: " + data );
},
// Cross-browser xml parsing
parseXML: function( data ) {
var xml, tmp;
if ( !data || typeof data !== "string" ) {
return null;
}
try {
if ( window.DOMParser ) { // Standard
tmp = new DOMParser();
xml = tmp.parseFromString( data , "text/xml" );
} else { // IE
xml = new ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
},
noop: function() {},
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && core_rnotwhite.test( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
// args is for internal usage only
each: function( obj, callback, args ) {
var name,
i = 0,
length = obj.length,
isObj = length === undefined || jQuery.isFunction( obj );
if ( args ) {
if ( isObj ) {
for ( name in obj ) {
if ( callback.apply( obj[ name ], args ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.apply( obj[ i++ ], args ) === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isObj ) {
for ( name in obj ) {
if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) {
break;
}
}
}
}
return obj;
},
// Use native String.trim function wherever possible
trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
function( text ) {
return text == null ?
"" :
core_trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makeArray: function( arr, results ) {
var type,
ret = results || [];
if ( arr != null ) {
// The window, strings (and functions) also have 'length'
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
type = jQuery.type( arr );
if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) {
core_push.call( ret, arr );
} else {
jQuery.merge( ret, arr );
}
}
return ret;
},
inArray: function( elem, arr, i ) {
var len;
if ( arr ) {
if ( core_indexOf ) {
return core_indexOf.call( arr, elem, i );
}
len = arr.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var l = second.length,
i = first.length,
j = 0;
if ( typeof l === "number" ) {
for ( ; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var retVal,
ret = [],
i = 0,
length = elems.length;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value, key,
ret = [],
i = 0,
length = elems.length,
// jquery objects are treated as arrays
isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
// Go through the array, translating each of the items to their
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
// Go through every key on the object,
} else {
for ( key in elems ) {
value = callback( elems[ key ], key, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return ret.concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var tmp, args, proxy;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = core_slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context, args.concat( core_slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
var exec,
bulk = key == null,
i = 0,
length = elems.length;
// Sets many values
if ( key && typeof key === "object" ) {
for ( i in key ) {
jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
}
chainable = 1;
// Sets one value
} else if ( value !== undefined ) {
// Optionally, function values get executed if exec is true
exec = pass === undefined && jQuery.isFunction( value );
if ( bulk ) {
// Bulk operations only iterate when executing function values
if ( exec ) {
exec = fn;
fn = function( elem, key, value ) {
return exec.call( jQuery( elem ), value );
};
// Otherwise they run against the entire set
} else {
fn.call( elems, value );
fn = null;
}
}
if ( fn ) {
for (; i < length; i++ ) {
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
}
}
chainable = 1;
}
return chainable ?
elems :
// Gets
bulk ?
fn.call( elems ) :
length ? fn( elems[0], key ) : emptyGet;
},
now: function() {
return ( new Date() ).getTime();
}
});
jQuery.ready.promise = function( obj ) {
if ( !readyList ) {
readyList = jQuery.Deferred();
// Catch cases where $(document).ready() is called after the browser event has already occurred.
// we once tried to use readyState "interactive" here, but it caused issues like the one
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout( jQuery.ready, 1 );
// Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", jQuery.ready, false );
// If IE event model is used
} else {
// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", DOMContentLoaded );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", jQuery.ready );
// If IE and not a frame
// continually check to see if the document is ready
var top = false;
try {
top = window.frameElement == null && document.documentElement;
} catch(e) {}
if ( top && top.doScroll ) {
(function doScrollCheck() {
if ( !jQuery.isReady ) {
try {
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top.doScroll("left");
} catch(e) {
return setTimeout( doScrollCheck, 50 );
}
// and execute any waiting functions
jQuery.ready();
}
})();
}
}
}
return readyList.promise( obj );
};
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
// String to Object options format cache
var optionsCache = {};
// Convert String-formatted options into Object-formatted ones and store in cache
function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.split( core_rspace ), function( _, flag ) {
object[ flag ] = true;
});
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
( optionsCache[ options ] || createOptions( options ) ) :
jQuery.extend( {}, options );
var // Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// Flag to know if list is currently firing
firing,
// First callback to fire (used internally by add and fireWith)
firingStart,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [],
// Fire callbacks
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
firing = true;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
memory = false; // To prevent further calls using add
break;
}
}
firing = false;
if ( list ) {
if ( stack ) {
if ( stack.length ) {
fire( stack.shift() );
}
} else if ( memory ) {
list = [];
} else {
self.disable();
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// First, we save the current length
var start = list.length;
(function add( args ) {
jQuery.each( args, function( _, arg ) {
var type = jQuery.type( arg );
if ( type === "function" ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && type !== "string" ) {
// Inspect recursively
add( arg );
}
});
})( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away
} else if ( memory ) {
firingStart = start;
fire( memory );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
jQuery.each( arguments, function( _, arg ) {
var index;
while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// Handle firing indexes
if ( firing ) {
if ( index <= firingLength ) {
firingLength--;
}
if ( index <= firingIndex ) {
firingIndex--;
}
}
}
});
}
return this;
},
// Control if a given callback is in the list
has: function( fn ) {
return jQuery.inArray( fn, list ) > -1;
},
// Remove all callbacks from the list
empty: function() {
list = [];
return this;
},
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function() {
return !list;
},
// Lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory ) {
self.disable();
}
return this;
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
if ( list && ( !fired || stack ) ) {
if ( firing ) {
stack.push( args );
} else {
fire( args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self;
};
jQuery.extend({
Deferred: function( func ) {
var tuples = [
// action, add listener, listener list, final state
[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
[ "notify", "progress", jQuery.Callbacks("memory") ]
],
state = "pending",
promise = {
state: function() {
return state;
},
always: function() {
deferred.done( arguments ).fail( arguments );
return this;
},
then: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
return jQuery.Deferred(function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var action = tuple[ 0 ],
fn = fns[ i ];
// deferred[ done | fail | progress ] for forwarding actions to newDefer
deferred[ tuple[1] ]( jQuery.isFunction( fn ) ?
function() {
var returned = fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.done( newDefer.resolve )
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
}
} :
newDefer[ action ]
);
});
fns = null;
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
return obj != null ? jQuery.extend( obj, promise ) : promise;
}
},
deferred = {};
// Keep pipe for back-compat
promise.pipe = promise.then;
// Add list-specific methods
jQuery.each( tuples, function( i, tuple ) {
var list = tuple[ 2 ],
stateString = tuple[ 3 ];
// promise[ done | fail | progress ] = list.add
promise[ tuple[1] ] = list.add;
// Handle state
if ( stateString ) {
list.add(function() {
// state = [ resolved | rejected ]
state = stateString;
// [ reject_list | resolve_list ].disable; progress_list.lock
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
}
// deferred[ resolve | reject | notify ] = list.fire
deferred[ tuple[0] ] = list.fire;
deferred[ tuple[0] + "With" ] = list.fireWith;
});
// Make the deferred a promise
promise.promise( deferred );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( subordinate /* , ..., subordinateN */ ) {
var i = 0,
resolveValues = core_slice.call( arguments ),
length = resolveValues.length,
// the count of uncompleted subordinates
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
// Update function for both resolve and progress values
updateFunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
if( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
}
};
},
progressValues, progressContexts, resolveContexts;
// add listeners to Deferred subordinates; treat others as resolved
if ( length > 1 ) {
progressValues = new Array( length );
progressContexts = new Array( length );
resolveContexts = new Array( length );
for ( ; i < length; i++ ) {
if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
resolveValues[ i ].promise()
.done( updateFunc( i, resolveContexts, resolveValues ) )
.fail( deferred.reject )
.progress( updateFunc( i, progressContexts, progressValues ) );
} else {
--remaining;
}
}
}
// if we're not waiting on anything, resolve the master
if ( !remaining ) {
deferred.resolveWith( resolveContexts, resolveValues );
}
return deferred.promise();
}
});
jQuery.support = (function() {
var support,
all,
a,
select,
opt,
input,
fragment,
eventName,
i,
isSupported,
clickFn,
div = document.createElement("div");
// Setup
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
// Support tests won't run in some limited or non-browser environments
all = div.getElementsByTagName("*");
a = div.getElementsByTagName("a")[ 0 ];
if ( !all || !a || !all.length ) {
return {};
}
// First batch of tests
select = document.createElement("select");
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName("input")[ 0 ];
a.style.cssText = "top:1px;float:left;opacity:.5";
support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: ( div.firstChild.nodeType === 3 ),
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName("tbody").length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName("link").length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: ( a.getAttribute("href") === "/a" ),
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity: /^0.5/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (WebKit defaults to "" instead)
checkOn: ( input.value === "on" ),
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// Tests for enctype support on a form (#6743)
enctype: !!document.createElement("form").enctype,
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
boxModel: ( document.compatMode === "CSS1Compat" ),
// Will be defined later
submitBubbles: true,
changeBubbles: true,
focusinBubbles: false,
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: true,
boxSizingReliable: true,
pixelPosition: false
};
// Make sure checked status is properly cloned
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Test to see if it's possible to delete an expando from an element
// Fails in Internet Explorer
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
div.attachEvent( "onclick", clickFn = function() {
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
support.noCloneEvent = false;
});
div.cloneNode( true ).fireEvent("onclick");
div.detachEvent( "onclick", clickFn );
}
// Check if a radio maintains its value
// after being appended to the DOM
input = document.createElement("input");
input.value = "t";
input.setAttribute( "type", "radio" );
support.radioValue = input.value === "t";
input.setAttribute( "checked", "checked" );
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute( "name", "t" );
div.appendChild( input );
fragment = document.createDocumentFragment();
fragment.appendChild( div.lastChild );
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
fragment.removeChild( input );
fragment.appendChild( div );
// Technique from Juriy Zaytsev
// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
// We only care about the case where non-standard event systems
// are used, namely in IE. Short-circuiting here helps us to
// avoid an eval call (in setAttribute) which can cause CSP
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
if ( div.attachEvent ) {
for ( i in {
submit: true,
change: true,
focusin: true
}) {
eventName = "on" + i;
isSupported = ( eventName in div );
if ( !isSupported ) {
div.setAttribute( eventName, "return;" );
isSupported = ( typeof div[ eventName ] === "function" );
}
support[ i + "Bubbles" ] = isSupported;
}
}
// Run tests that need a body at doc ready
jQuery(function() {
var container, div, tds, marginDiv,
divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;",
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
return;
}
container = document.createElement("div");
container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px";
body.insertBefore( container, body.firstChild );
// Construct the test element
div = document.createElement("div");
container.appendChild( div );
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
tds = div.getElementsByTagName("td");
tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Check if empty table cells still have offsetWidth/Height
// (IE <= 8 fail this test)
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// Check box-sizing and margin behavior
div.innerHTML = "";
div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
support.boxSizing = ( div.offsetWidth === 4 );
support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
// NOTE: To any future maintainer, we've window.getComputedStyle
// because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. For more
// info see bug #3333
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
marginDiv = document.createElement("div");
marginDiv.style.cssText = div.style.cssText = divReset;
marginDiv.style.marginRight = marginDiv.style.width = "0";
div.style.width = "1px";
div.appendChild( marginDiv );
support.reliableMarginRight =
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
}
if ( typeof div.style.zoom !== "undefined" ) {
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
// (IE < 8 does this)
div.innerHTML = "";
div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display = "block";
div.style.overflow = "visible";
div.innerHTML = "<div></div>";
div.firstChild.style.width = "5px";
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
container.style.zoom = 1;
}
// Null elements to avoid leaks in IE
body.removeChild( container );
container = div = tds = marginDiv = null;
});
// Null elements to avoid leaks in IE
fragment.removeChild( div );
all = a = select = opt = input = fragment = div = null;
return support;
})();
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
rmultiDash = /([A-Z])/g;
jQuery.extend({
cache: {},
deletedIds: [],
// Remove at next major release (1.9/2.0)
uuid: 0,
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, ret,
internalKey = jQuery.expando,
getByName = typeof name === "string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
cache[ id ] = {};
// Avoids exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( getByName ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
},
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i, l,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split(" ");
}
}
}
for ( i = 0, l = name.length; i < l; i++ ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject( cache[ id ] ) ) {
return;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
} else if ( jQuery.support.deleteExpando || cache != cache.window ) {
delete cache[ id ];
// When all else fails, null
} else {
cache[ id ] = null;
}
},
// For internal use only.
_data: function( elem, name, data ) {
return jQuery.data( elem, name, data, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
// nodes accept data unless otherwise specified; rejection can be conditional
return !noData || noData !== true && elem.getAttribute("classid") === noData;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var parts, part, attr, name, l,
elem = this[0],
i = 0,
data = null;
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attr = elem.attributes;
for ( l = attr.length; i < l; i++ ) {
name = attr[i].name;
if ( !name.indexOf( "data-" ) ) {
name = jQuery.camelCase( name.substring(5) );
dataAttr( elem, name, data[ name ] );
}
}
jQuery._data( elem, "parsedAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
parts = key.split( ".", 2 );
parts[1] = parts[1] ? "." + parts[1] : "";
part = parts[1] + "!";
return jQuery.access( this, function( value ) {
if ( value === undefined ) {
data = this.triggerHandler( "getData" + part, [ parts[0] ] );
// Try to fetch any internally stored data first
if ( data === undefined && elem ) {
data = jQuery.data( elem, key );
data = dataAttr( elem, key, data );
}
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
}
parts[1] = value;
this.each(function() {
var self = jQuery( this );
self.triggerHandler( "setData" + part, parts );
jQuery.data( this, key, value );
self.triggerHandler( "changeData" + part, parts );
});
}, null, value, arguments.length > 1, null, false );
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
var name;
for ( name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
jQuery.extend({
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray(data) ) {
queue = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
queue.push( data );
}
}
return queue || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
jQuery.dequeue( elem, type );
};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startLength--;
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
// clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}
if ( !startLength && hooks ) {
hooks.empty.fire();
}
},
// not intended for public consumption - generates a queueHooks object, or returns the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, {
empty: jQuery.Callbacks("once memory").add(function() {
jQuery.removeData( elem, type + "queue", true );
jQuery.removeData( elem, key, true );
})
});
}
});
jQuery.fn.extend({
queue: function( type, data ) {
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jQuery.queue( this[0], type );
}
return data === undefined ?
this :
this.each(function() {
var queue = jQuery.queue( this, type, data );
// ensure a hooks for this queue
jQuery._queueHooks( this, type );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
type = type || "fx";
return this.queue( type, function( next, hooks ) {
var timeout = setTimeout( next, time );
hooks.stop = function() {
clearTimeout( timeout );
};
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, obj ) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
};
if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";
while( i-- ) {
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}
}
resolve();
return defer.promise( obj );
}
});
var nodeHook, boolHook, fixSpecified,
rclass = /[\t\r\n]/g,
rreturn = /\r/g,
rtype = /^(?:button|input)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea|)$/i,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classNames, i, l, elem,
setClass, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call(this, j, this.className) );
});
}
if ( value && typeof value === "string" ) {
classNames = value.split( core_rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 ) {
if ( !elem.className && classNames.length === 1 ) {
elem.className = value;
} else {
setClass = " " + elem.className + " ";
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) {
setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim( setClass );
}
}
}
}
return this;
},
removeClass: function( value ) {
var removes, className, elem, c, cl, i, l;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call(this, j, this.className) );
});
}
if ( (value && typeof value === "string") || value === undefined ) {
removes = ( value || "" ).split( core_rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 && elem.className ) {
className = (" " + elem.className + " ").replace( rclass, " " );
// loop over each item in the removal list
for ( c = 0, cl = removes.length; c < cl; c++ ) {
// Remove until there is nothing to remove,
while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) {
className = className.replace( " " + removes[ c ] + " " , " " );
}
}
elem.className = value ? jQuery.trim( className ) : "";
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.split( core_rspace );
while ( (className = classNames[ i++ ]) ) {
// check each className given, space separated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
} else if ( type === "undefined" || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// toggle whole className
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ",
i = 0,
l = this.length;
for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
return true;
}
}
return false;
},
val: function( value ) {
var hooks, ret, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var val,
self = jQuery(this);
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, self.val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
return !val || val.specified ? elem.value : elem.text;
}
},
select: {
get: function( elem ) {
var value, option,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one" || index < 0,
values = one ? null : [],
max = one ? index + 1 : options.length,
i = index < 0 ?
max :
one ? index : 0;
// Loop through all the selected options
for ( ; i < max; i++ ) {
option = options[ i ];
// oldIE doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
return values;
},
set: function( elem, value ) {
var values = jQuery.makeArray( value );
jQuery(elem).find("option").each(function() {
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
});
if ( !values.length ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
// Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9
attrFn: {},
attr: function( elem, name, value, pass ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) {
return jQuery( elem )[ name ]( value );
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === "undefined" ) {
return jQuery.prop( elem, name, value );
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( notxml ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
return;
} else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, value + "" );
return value;
}
} else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
ret = elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return ret === null ?
undefined :
ret;
}
},
removeAttr: function( elem, value ) {
var propName, attrNames, name, isBool,
i = 0;
if ( value && elem.nodeType === 1 ) {
attrNames = value.split( core_rspace );
for ( ; i < attrNames.length; i++ ) {
name = attrNames[ i ];
if ( name ) {
propName = jQuery.propFix[ name ] || name;
isBool = rboolean.test( name );
// See #9699 for explanation of this approach (setting first, then removal)
// Do not do this for boolean attributes (see #10870)
if ( !isBool ) {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
// Set corresponding property to false for boolean attributes
if ( isBool && propName in elem ) {
elem[ propName ] = false;
}
}
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
// We can't allow the type property to be changed (since it causes problems in IE)
if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
jQuery.error( "type property can't be changed" );
} else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to it's default in case type is set after value
// This is for element creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
},
// Use the value property for back compat
// Use the nodeHook for button elements in IE6/7 (#1954)
value: {
get: function( elem, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.get( elem, name );
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.set( elem, value, name );
}
// Does not return so that setAttribute is also used
elem.value = value;
}
}
},
propFix: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function( elem, name, value ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
return ( elem[ name ] = value );
}
} else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
return elem[ name ];
}
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode = elem.getAttributeNode("tabindex");
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
}
}
});
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode,
property = jQuery.prop( elem, name );
return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
fixSpecified = {
name: true,
id: true,
coords: true
};
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret;
ret = elem.getAttributeNode( name );
return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ?
ret.value :
undefined;
},
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
ret = document.createAttribute( name );
elem.setAttributeNode( ret );
}
return ( ret.value = value + "" );
}
};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
});
});
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
get: nodeHook.get,
set: function( elem, value, name ) {
if ( value === "" ) {
value = "false";
}
nodeHook.set( elem, value, name );
}
};
}
// Some attributes require a special call on IE
if ( !jQuery.support.hrefNormalized ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret === null ? undefined : ret;
}
});
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Normalize to lowercase since IE uppercases css property names
return elem.style.cssText.toLowerCase() || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = value + "" );
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
});
}
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
}
};
});
}
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
});
});
var rformElems = /^(?:textarea|input|select)$/i,
rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/,
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
hoverHack = function( events ) {
return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
add: function( elem, types, handler, data, selector ) {
var elemData, eventHandle, events,
t, tns, type, namespaces, handleObj,
handleObjIn, handlers, special;
// Don't attach events to noData or text/comment nodes (allow plain objects tho)
if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
events = elemData.events;
if ( !events ) {
elemData.events = events = {};
}
eventHandle = elemData.handle;
if ( !eventHandle ) {
elemData.handle = eventHandle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem = elem;
}
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = jQuery.trim( hoverHack(types) ).split( " " );
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = tns[1];
namespaces = ( tns[2] || "" ).split( "." ).sort();
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: tns[1],
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
namespace: namespaces.join(".")
}, handleObjIn );
// Init the event handler queue if we're the first
handlers = events[ type ];
if ( !handlers ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegateCount++, 0, handleObj );
} else {
handlers.push( handleObj );
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
global: {},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var t, tns, type, origType, namespaces, origCount,
j, events, special, eventType, handleObj,
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = origType = tns[1];
namespaces = tns[2];
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jQuery.event.special[ type ] || {};
type = ( selector? special.delegateType : special.bindType ) || type;
eventType = events[ type ] || [];
origCount = eventType.length;
namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
// Remove matching events
for ( j = 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !namespaces || namespaces.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
eventType.splice( j--, 1 );
if ( handleObj.selector ) {
eventType.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( eventType.length === 0 && origCount !== eventType.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
delete elemData.handle;
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery.removeData( elem, "events", true );
}
},
// Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers.
customEvent: {
"getData": true,
"setData": true,
"changeData": true
},
trigger: function( event, data, elem, onlyHandlers ) {
// Don't do events on text and comment nodes
if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
return;
}
// Event object or event type
var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType,
type = event.type || event,
namespaces = [];
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf( "!" ) >= 0 ) {
// Exclusive events trigger only for the exact event (no namespaces)
type = type.slice(0, -1);
exclusive = true;
}
if ( type.indexOf( "." ) >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
// No jQuery handlers for this event type, and it can't have inline handlers
return;
}
// Caller can pass in an Event, Object, or just an event type string
event = typeof event === "object" ?
// jQuery.Event object
event[ jQuery.expando ] ? event :
// Object literal
new jQuery.Event( type, event ) :
// Just the event type (string)
new jQuery.Event( type );
event.type = type;
event.isTrigger = true;
event.exclusive = exclusive;
event.namespace = namespaces.join( "." );
event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
// Handle a global trigger
if ( !elem ) {
// TODO: Stop taunting the data cache; remove global events and always attach to document
cache = jQuery.cache;
for ( i in cache ) {
if ( cache[ i ].events && cache[ i ].events[ type ] ) {
jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
}
}
return;
}
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data != null ? jQuery.makeArray( data ) : [];
data.unshift( event );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
eventPath = [[ elem, special.bindType || type ]];
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
for ( old = elem; cur; cur = cur.parentNode ) {
eventPath.push([ cur, bubbleType ]);
old = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( old === (elem.ownerDocument || document) ) {
eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
}
}
// Fire handlers on the event path
for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
cur = eventPath[i][0];
event.type = eventPath[i][1];
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Note that this is a bare JS function and not a jQuery handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
event.preventDefault();
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
// IE<9 dies on focus/blur to hidden element (#1486)
if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
old = elem[ ontype ];
if ( old ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
elem[ type ]();
jQuery.event.triggered = undefined;
if ( old ) {
elem[ ontype ] = old;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event || window.event );
var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related,
handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
delegateCount = handlers.delegateCount,
args = core_slice.call( arguments ),
run_all = !event.exclusive && !event.namespace,
special = jQuery.event.special[ event.type ] || {},
handlerQueue = [];
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers that should run if there are delegated events
// Avoid non-left-click bubbling in Firefox (#3861)
if ( delegateCount && !(event.button && event.type === "click") ) {
for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
// Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764)
if ( cur.disabled !== true || event.type !== "click" ) {
selMatch = {};
matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
sel = handleObj.selector;
if ( selMatch[ sel ] === undefined ) {
selMatch[ sel ] = handleObj.needsContext ?
jQuery( sel, this ).index( cur ) >= 0 :
jQuery.find( sel, this, null, [ cur ] ).length;
}
if ( selMatch[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, matches: matches });
}
}
}
}
// Add the remaining (directly-bound) handlers
if ( handlers.length > delegateCount ) {
handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
}
// Run delegates first; they may want to stop propagation beneath us
for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
matched = handlerQueue[ i ];
event.currentTarget = matched.elem;
for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
handleObj = matched.matches[ j ];
// Triggered event must either 1) be non-exclusive and have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
event.data = handleObj.data;
event.handleObj = handleObj;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
// Includes some event props shared by KeyEvent and MouseEvent
// *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function( event, original ) {
// Add which for key events
if ( event.which == null ) {
event.which = original.charCode != null ? original.charCode : original.keyCode;
}
return event;
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function( event, original ) {
var eventDoc, doc, body,
button = original.button,
fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
}
return event;
}
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop,
originalEvent = event,
fixHook = jQuery.event.fixHooks[ event.type ] || {},
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = jQuery.Event( originalEvent );
for ( i = copy.length; i; ) {
prop = copy[ --i ];
event[ prop ] = originalEvent[ prop ];
}
// Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Target should not be a text node (#504, Safari)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8)
event.metaKey = !!event.metaKey;
return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
delegateType: "focusin"
},
blur: {
delegateType: "focusout"
},
beforeunload: {
setup: function( data, namespaces, eventHandle ) {
// We only want to do this special case on windows
if ( jQuery.isWindow( this ) ) {
this.onbeforeunload = eventHandle;
}
},
teardown: function( namespaces, eventHandle ) {
if ( this.onbeforeunload === eventHandle ) {
this.onbeforeunload = null;
}
}
}
},
simulate: function( type, elem, event, bubble ) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e = jQuery.extend(
new jQuery.Event(),
event,
{ type: type,
isSimulated: true,
originalEvent: {}
}
);
if ( bubble ) {
jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
}
};
// Some plugins are using, but it's undocumented/deprecated and will be removed.
// The 1.7 special event interface should provide all the hooks needed now.
jQuery.event.handle = jQuery.event.dispatch;
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
var name = "on" + type;
if ( elem.detachEvent ) {
// #8545, #7054, preventing memory leaks for custom events in IE6-8
// detachEvent needed property on element, by name of that event, to properly expose it to GC
if ( typeof elem[ name ] === "undefined" ) {
elem[ name ] = null;
}
elem.detachEvent( name, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !(this instanceof jQuery.Event) ) {
return new jQuery.Event( src, props );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if ( props ) {
jQuery.extend( this, props );
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
function returnFalse() {
return false;
}
function returnTrue() {
return true;
}
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
preventDefault: function() {
this.isDefaultPrevented = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if preventDefault exists run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// otherwise set the returnValue property of the original event to false (IE)
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if stopPropagation exists run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// otherwise set the cancelBubble property of the original event to true (IE)
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
},
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse
};
// Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj,
selector = handleObj.selector;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = fix;
}
return ret;
}
};
});
// IE submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !jQuery._data( form, "_submit_attached" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true;
});
jQuery._data( form, "_submit_attached", true );
}
});
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) {
delete event._submit_bubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
}
},
teardown: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" );
}
};
}
// IE change delegation and checkbox/radio fix
if ( !jQuery.support.changeBubbles ) {
jQuery.event.special.change = {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true;
}
});
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) {
this._just_changed = false;
}
// Allow triggered, simulated change events (#11500)
jQuery.event.simulate( "change", this, event, true );
});
}
return false;
}
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add( this, "beforeactivate._change", function( e ) {
var elem = e.target;
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
jQuery._data( elem, "_change_attached", true );
}
});
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
return event.handleObj.handler.apply( this, arguments );
}
},
teardown: function() {
jQuery.event.remove( this, "._change" );
return !rformElems.test( this.nodeName );
}
};
}
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0,
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
};
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
});
}
jQuery.fn.extend({
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
var origFn, type;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) { // && selector != null
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one );
}
return this;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
},
one: function( types, selector, data, fn ) {
return this.on( types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each(function() {
jQuery.event.remove( this, types, fn, selector );
});
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
live: function( types, data, fn ) {
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
},
die: function( types, fn ) {
jQuery( this.context ).off( types, this.selector || "**", fn );
return this;
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
if ( this[0] ) {
return jQuery.event.trigger( type, data, this[0], true );
}
},
toggle: function( fn ) {
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
},
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
});
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
if ( fn == null ) {
fn = data;
data = null;
}
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
if ( rkeyEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
}
if ( rmouseEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
}
});
/*!
* Sizzle CSS Selector Engine
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://sizzlejs.com/
*/
(function( window, undefined ) {
var cachedruns,
assertGetIdNotName,
Expr,
getText,
isXML,
contains,
compile,
sortOrder,
hasDuplicate,
outermostContext,
baseHasDuplicate = true,
strundefined = "undefined",
expando = ( "sizcache" + Math.random() ).replace( ".", "" ),
Token = String,
document = window.document,
docElem = document.documentElement,
dirruns = 0,
done = 0,
pop = [].pop,
push = [].push,
slice = [].slice,
// Use a stripped-down indexOf if a native one is unavailable
indexOf = [].indexOf || function( elem ) {
var i = 0,
len = this.length;
for ( ; i < len; i++ ) {
if ( this[i] === elem ) {
return i;
}
}
return -1;
},
// Augment a function for special use by Sizzle
markFunction = function( fn, value ) {
fn[ expando ] = value == null || value;
return fn;
},
createCache = function() {
var cache = {},
keys = [];
return markFunction(function( key, value ) {
// Only keep the most recent entries
if ( keys.push( key ) > Expr.cacheLength ) {
delete cache[ keys.shift() ];
}
// Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157)
return (cache[ key + " " ] = value);
}, cache );
},
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
// Regex
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",
// Loosely modeled on CSS identifier characters
// An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = characterEncoding.replace( "w", "w#" ),
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
operators = "([*^$|!~]?=)",
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
"*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
// Prefer arguments not in parens/brackets,
// then attribute selectors and non-pseudos (denoted by :),
// then anything else
// These preferences are here to reduce the number of selectors
// needing tokenize in the PSEUDO preFilter
pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)",
// For matchExpr.POS and matchExpr.needsContext
pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
"*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
rpseudo = new RegExp( pseudos ),
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,
rnot = /^:not/,
rsibling = /[\x20\t\r\n\f]*[+~]/,
rendsWithNot = /:not\($/,
rheader = /h\d/i,
rinputs = /input|select|textarea|button/i,
rbackslash = /\\(?!\\)/g,
matchExpr = {
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
"NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"POS": new RegExp( pos, "i" ),
"CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
// For use in libraries implementing .is()
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" )
},
// Support
// Used for testing something on an element
assert = function( fn ) {
var div = document.createElement("div");
try {
return fn( div );
} catch (e) {
return false;
} finally {
// release memory in IE
div = null;
}
},
// Check if getElementsByTagName("*") returns only elements
assertTagNameNoComments = assert(function( div ) {
div.appendChild( document.createComment("") );
return !div.getElementsByTagName("*").length;
}),
// Check if getAttribute returns normalized href attributes
assertHrefNotNormalized = assert(function( div ) {
div.innerHTML = "<a href='#'></a>";
return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
div.firstChild.getAttribute("href") === "#";
}),
// Check if attributes should be retrieved by attribute nodes
assertAttributes = assert(function( div ) {
div.innerHTML = "<select></select>";
var type = typeof div.lastChild.getAttribute("multiple");
// IE8 returns a string for some attributes even when not present
return type !== "boolean" && type !== "string";
}),
// Check if getElementsByClassName can be trusted
assertUsableClassName = assert(function( div ) {
// Opera can't find a second classname (in 9.6)
div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
return false;
}
// Safari 3.2 caches class attributes and doesn't catch changes
div.lastChild.className = "e";
return div.getElementsByClassName("e").length === 2;
}),
// Check if getElementById returns elements by name
// Check if getElementsByName privileges form controls or returns elements by ID
assertUsableName = assert(function( div ) {
// Inject content
div.id = expando + 0;
div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
docElem.insertBefore( div, docElem.firstChild );
// Test
var pass = document.getElementsByName &&
// buggy browsers will return fewer than the correct 2
document.getElementsByName( expando ).length === 2 +
// buggy browsers will return more than the correct 0
document.getElementsByName( expando + 0 ).length;
assertGetIdNotName = !document.getElementById( expando );
// Cleanup
docElem.removeChild( div );
return pass;
});
// If slice is not available, provide a backup
try {
slice.call( docElem.childNodes, 0 )[0].nodeType;
} catch ( e ) {
slice = function( i ) {
var elem,
results = [];
for ( ; (elem = this[i]); i++ ) {
results.push( elem );
}
return results;
};
}
function Sizzle( selector, context, results, seed ) {
results = results || [];
context = context || document;
var match, elem, xml, m,
nodeType = context.nodeType;
if ( !selector || typeof selector !== "string" ) {
return results;
}
if ( nodeType !== 1 && nodeType !== 9 ) {
return [];
}
xml = isXML( context );
if ( !xml && !seed ) {
if ( (match = rquickExpr.exec( selector )) ) {
// Speed-up: Sizzle("#ID")
if ( (m = match[1]) ) {
if ( nodeType === 9 ) {
elem = context.getElementById( m );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE, Opera, and Webkit return items
// by name instead of ID
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
} else {
// Context is not a document
if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
contains( context, elem ) && elem.id === m ) {
results.push( elem );
return results;
}
}
// Speed-up: Sizzle("TAG")
} else if ( match[2] ) {
push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
return results;
// Speed-up: Sizzle(".CLASS")
} else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) {
push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
return results;
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed, xml );
}
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
return Sizzle( expr, null, null, [ elem ] ).length > 0;
};
// Returns a function to use in pseudos for input types
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
// Returns a function to use in pseudos for buttons
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
// Returns a function to use in pseudos for positionals
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( nodeType ) {
if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (see #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
} else {
// If no nodeType, this is expected to be an array
for ( ; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
ret += getText( node );
}
}
return ret;
};
isXML = Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
// Element contains another
contains = Sizzle.contains = docElem.contains ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) );
} :
docElem.compareDocumentPosition ?
function( a, b ) {
return b && !!( a.compareDocumentPosition( b ) & 16 );
} :
function( a, b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
return false;
};
Sizzle.attr = function( elem, name ) {
var val,
xml = isXML( elem );
if ( !xml ) {
name = name.toLowerCase();
}
if ( (val = Expr.attrHandle[ name ]) ) {
return val( elem );
}
if ( xml || assertAttributes ) {
return elem.getAttribute( name );
}
val = elem.getAttributeNode( name );
return val ?
typeof elem[ name ] === "boolean" ?
elem[ name ] ? name : null :
val.specified ? val.value : null :
null;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
// IE6/7 return a modified href
attrHandle: assertHrefNotNormalized ?
{} :
{
"href": function( elem ) {
return elem.getAttribute( "href", 2 );
},
"type": function( elem ) {
return elem.getAttribute("type");
}
},
find: {
"ID": assertGetIdNotName ?
function( id, context, xml ) {
if ( typeof context.getElementById !== strundefined && !xml ) {
var m = context.getElementById( id );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
} :
function( id, context, xml ) {
if ( typeof context.getElementById !== strundefined && !xml ) {
var m = context.getElementById( id );
return m ?
m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
[m] :
undefined :
[];
}
},
"TAG": assertTagNameNoComments ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== strundefined ) {
return context.getElementsByTagName( tag );
}
} :
function( tag, context ) {
var results = context.getElementsByTagName( tag );
// Filter out possible comments
if ( tag === "*" ) {
var elem,
tmp = [],
i = 0;
for ( ; (elem = results[i]); i++ ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
},
"NAME": assertUsableName && function( tag, context ) {
if ( typeof context.getElementsByName !== strundefined ) {
return context.getElementsByName( name );
}
},
"CLASS": assertUsableClassName && function( className, context, xml ) {
if ( typeof context.getElementsByClassName !== strundefined && !xml ) {
return context.getElementsByClassName( className );
}
}
},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
"ATTR": function( match ) {
match[1] = match[1].replace( rbackslash, "" );
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"CHILD": function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
3 xn-component of xn+y argument ([+-]?\d*n|)
4 sign of xn-component
5 x of xn-component
6 sign of y-component
7 y of y-component
*/
match[1] = match[1].toLowerCase();
if ( match[1] === "nth" ) {
// nth-child requires argument
if ( !match[2] ) {
Sizzle.error( match[0] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) );
match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" );
// other types prohibit arguments
} else if ( match[2] ) {
Sizzle.error( match[0] );
}
return match;
},
"PSEUDO": function( match ) {
var unquoted, excess;
if ( matchExpr["CHILD"].test( match[0] ) ) {
return null;
}
if ( match[3] ) {
match[2] = match[3];
} else if ( (unquoted = match[4]) ) {
// Only check arguments that contain a pseudo
if ( rpseudo.test(unquoted) &&
// Get excess from tokenize (recursively)
(excess = tokenize( unquoted, true )) &&
// advance to the next closing parenthesis
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
// excess is a negative index
unquoted = unquoted.slice( 0, excess );
match[0] = match[0].slice( 0, excess );
}
match[2] = unquoted;
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"ID": assertGetIdNotName ?
function( id ) {
id = id.replace( rbackslash, "" );
return function( elem ) {
return elem.getAttribute("id") === id;
};
} :
function( id ) {
id = id.replace( rbackslash, "" );
return function( elem ) {
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
return node && node.value === id;
};
},
"TAG": function( nodeName ) {
if ( nodeName === "*" ) {
return function() { return true; };
}
nodeName = nodeName.replace( rbackslash, "" ).toLowerCase();
return function( elem ) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function( className ) {
var pattern = classCache[ expando ][ className + " " ];
return pattern ||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
classCache( className, function( elem ) {
return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
});
},
"ATTR": function( name, operator, check ) {
return function( elem, context ) {
var result = Sizzle.attr( elem, name );
if ( result == null ) {
return operator === "!=";
}
if ( !operator ) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexOf( check ) === 0 :
operator === "*=" ? check && result.indexOf( check ) > -1 :
operator === "$=" ? check && result.substr( result.length - check.length ) === check :
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" :
false;
};
},
"CHILD": function( type, argument, first, last ) {
if ( type === "nth" ) {
return function( elem ) {
var node, diff,
parent = elem.parentNode;
if ( first === 1 && last === 0 ) {
return true;
}
if ( parent ) {
diff = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
diff++;
if ( elem === node ) {
break;
}
}
}
}
// Incorporate the offset (or cast to NaN), then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
};
}
return function( elem ) {
var node = elem;
switch ( type ) {
case "only":
case "first":
while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
if ( type === "first" ) {
return true;
}
node = elem;
/* falls through */
case "last":
while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
return true;
}
};
},
"PSEUDO": function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
Sizzle.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if ( fn[ expando ] ) {
return fn( argument );
}
// But maintain support for old signatures
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
markFunction(function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
idx = indexOf.call( seed, matched[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] );
}
}) :
function( elem ) {
return fn( elem, 0, args );
};
}
return fn;
}
},
pseudos: {
"not": markFunction(function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
markFunction(function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// Match elements unmatched by `matcher`
while ( i-- ) {
if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function( elem, context, xml ) {
input[0] = elem;
matcher( input, null, xml, results );
return !results.pop();
};
}),
"has": markFunction(function( selector ) {
return function( elem ) {
return Sizzle( selector, elem ).length > 0;
};
}),
"contains": markFunction(function( text ) {
return function( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
};
}),
"enabled": function( elem ) {
return elem.disabled === false;
},
"disabled": function( elem ) {
return elem.disabled === true;
},
"checked": function( elem ) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"selected": function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
"parent": function( elem ) {
return !Expr.pseudos["empty"]( elem );
},
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
// not comment, processing instructions, or others
// Thanks to Diego Perini for the nodeName shortcut
// Greater than "@" means alpha characters (specifically not starting with "#" or "?")
var nodeType;
elem = elem.firstChild;
while ( elem ) {
if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) {
return false;
}
elem = elem.nextSibling;
}
return true;
},
"header": function( elem ) {
return rheader.test( elem.nodeName );
},
"text": function( elem ) {
var type, attr;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" &&
(type = elem.type) === "text" &&
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type );
},
// Input types
"radio": createInputPseudo("radio"),
"checkbox": createInputPseudo("checkbox"),
"file": createInputPseudo("file"),
"password": createInputPseudo("password"),
"image": createInputPseudo("image"),
"submit": createButtonPseudo("submit"),
"reset": createButtonPseudo("reset"),
"button": function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"input": function( elem ) {
return rinputs.test( elem.nodeName );
},
"focus": function( elem ) {
var doc = elem.ownerDocument;
return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
"active": function( elem ) {
return elem === elem.ownerDocument.activeElement;
},
// Positional types
"first": createPositionalPseudo(function() {
return [ 0 ];
}),
"last": createPositionalPseudo(function( matchIndexes, length ) {
return [ length - 1 ];
}),
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
}),
"even": createPositionalPseudo(function( matchIndexes, length ) {
for ( var i = 0; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function( matchIndexes, length ) {
for ( var i = 1; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
})
}
};
function siblingCheck( a, b, ret ) {
if ( a === b ) {
return ret;
}
var cur = a.nextSibling;
while ( cur ) {
if ( cur === b ) {
return -1;
}
cur = cur.nextSibling;
}
return 1;
}
sortOrder = docElem.compareDocumentPosition ?
function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
return ( !a.compareDocumentPosition || !b.compareDocumentPosition ?
a.compareDocumentPosition :
a.compareDocumentPosition(b) & 4
) ? -1 : 1;
} :
function( a, b ) {
// The nodes are identical, we can exit early
if ( a === b ) {
hasDuplicate = true;
return 0;
// Fallback to using sourceIndex (in IE) if it's available on both nodes
} else if ( a.sourceIndex && b.sourceIndex ) {
return a.sourceIndex - b.sourceIndex;
}
var al, bl,
ap = [],
bp = [],
aup = a.parentNode,
bup = b.parentNode,
cur = aup;
// If the nodes are siblings (or identical) we can do a quick check
if ( aup === bup ) {
return siblingCheck( a, b );
// If no parents were found then the nodes are disconnected
} else if ( !aup ) {
return -1;
} else if ( !bup ) {
return 1;
}
// Otherwise they're somewhere else in the tree so we need
// to build up a full list of the parentNodes for comparison
while ( cur ) {
ap.unshift( cur );
cur = cur.parentNode;
}
cur = bup;
while ( cur ) {
bp.unshift( cur );
cur = cur.parentNode;
}
al = ap.length;
bl = bp.length;
// Start walking down the tree looking for a discrepancy
for ( var i = 0; i < al && i < bl; i++ ) {
if ( ap[i] !== bp[i] ) {
return siblingCheck( ap[i], bp[i] );
}
}
// We ended someplace up the tree so do a sibling check
return i === al ?
siblingCheck( a, bp[i], -1 ) :
siblingCheck( ap[i], b, 1 );
};
// Always assume the presence of duplicates if sort doesn't
// pass them to our comparison function (as in Google Chrome).
[0, 0].sort( sortOrder );
baseHasDuplicate = !hasDuplicate;
// Document sorting and removing duplicates
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
i = 1,
j = 0;
hasDuplicate = baseHasDuplicate;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( ; (elem = results[i]); i++ ) {
if ( elem === results[ i - 1 ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
return results;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
function tokenize( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ expando ][ selector + " " ];
if ( cached ) {
return parseOnly ? 0 : cached.slice( 0 );
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while ( soFar ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
// Don't consume trailing commas as valid
soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( tokens = [] );
}
matched = false;
// Combinators
if ( (match = rcombinators.exec( soFar )) ) {
tokens.push( matched = new Token( match.shift() ) );
soFar = soFar.slice( matched.length );
// Cast descendant combinators to space
matched.type = match[0].replace( rtrim, " " );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
tokens.push( matched = new Token( match.shift() ) );
soFar = soFar.slice( matched.length );
matched.type = type;
matched.matches = match;
}
}
if ( !matched ) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error( selector ) :
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
}
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checkNonElements = base && combinator.dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( checkNonElements || elem.nodeType === 1 ) {
return matcher( elem, context, xml );
}
}
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if ( !xml ) {
var cache,
dirkey = dirruns + " " + doneName + " ",
cachedkey = dirkey + cachedruns;
while ( (elem = elem[ dir ]) ) {
if ( checkNonElements || elem.nodeType === 1 ) {
if ( (cache = elem[ expando ]) === cachedkey ) {
return elem.sizset;
} else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) {
if ( elem.sizset ) {
return elem;
}
} else {
elem[ expando ] = cachedkey;
if ( matcher( elem, context, xml ) ) {
elem.sizset = true;
return elem;
}
elem.sizset = false;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( checkNonElements || elem.nodeType === 1 ) {
if ( matcher( elem, context, xml ) ) {
return elem;
}
}
}
}
};
}
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
}
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
}
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
}
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf.call( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && tokens.join("")
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
var bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, expandContext ) {
var elem, j, matcher,
setMatched = [],
matchedCount = 0,
i = "0",
unmatched = seed && [],
outermost = expandContext != null,
contextBackup = outermostContext,
// We must always have either seed elements or context
elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
// Nested matchers should use non-integer dirruns
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);
if ( outermost ) {
outermostContext = context !== document && context;
cachedruns = superMatcher.el;
}
// Add elements passing elementMatchers directly to results
for ( ; (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
for ( j = 0; (matcher = elementMatchers[j]); j++ ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
cachedruns = ++superMatcher.el;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if ( bySet && i !== matchedCount ) {
for ( j = 0; (matcher = setMatchers[j]); j++ ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
superMatcher.el = 0;
return bySet ?
markFunction( superMatcher ) :
superMatcher;
}
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ expando ][ selector + " " ];
if ( !cached ) {
// Generate a function of recursive functions that can be used to check each element
if ( !group ) {
group = tokenize( selector );
}
i = group.length;
while ( i-- ) {
cached = matcherFromTokens( group[i] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
elementMatchers.push( cached );
}
}
// Cache the compiled function
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
}
return cached;
};
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}
function select( selector, context, results, seed, xml ) {
var i, tokens, token, type, find,
match = tokenize( selector ),
j = match.length;
if ( !seed ) {
// Try to minimize operations if there is only one group
if ( match.length === 1 ) {
// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
context.nodeType === 9 && !xml &&
Expr.relative[ tokens[1].type ] ) {
context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0];
if ( !context ) {
return results;
}
selector = selector.slice( tokens.shift().length );
}
// Fetch a seed set for right-to-left matching
for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( rbackslash, "" ),
rsibling.test( tokens[0].type ) && context.parentNode || context,
xml
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && tokens.join("");
if ( !selector ) {
push.apply( results, slice.call( seed, 0 ) );
return results;
}
break;
}
}
}
}
}
// Compile and execute a filtering function
// Provide `match` to avoid retokenization if we modified the selector above
compile( selector, match )(
seed,
context,
xml,
results,
rsibling.test( selector )
);
return results;
}
if ( document.querySelectorAll ) {
(function() {
var disconnectedMatch,
oldSelect = select,
rescape = /'|\\/g,
rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
// qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA
// A support test would require too much code (would include document ready)
rbuggyQSA = [ ":focus" ],
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
// A support test would require too much code (would include document ready)
// just skip matchesSelector for :active
rbuggyMatches = [ ":active" ],
matches = docElem.matchesSelector ||
docElem.mozMatchesSelector ||
docElem.webkitMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector;
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function( div ) {
// Select is set to empty string on purpose
// This is to test IE's treatment of not explictly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
div.innerHTML = "<select><option selected=''></option></select>";
// IE8 - Some boolean attributes are not treated correctly
if ( !div.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here (do not put tests after this one)
if ( !div.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked");
}
});
assert(function( div ) {
// Opera 10-12/IE9 - ^= $= *= and empty values
// Should not select anything
div.innerHTML = "<p test=''></p>";
if ( div.querySelectorAll("[test^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here (do not put tests after this one)
div.innerHTML = "<input type='hidden'/>";
if ( !div.querySelectorAll(":enabled").length ) {
rbuggyQSA.push(":enabled", ":disabled");
}
});
// rbuggyQSA always contains :focus, so no need for a length check
rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") );
select = function( selector, context, results, seed, xml ) {
// Only use querySelectorAll when not filtering,
// when this is not xml,
// and when no QSA bugs apply
if ( !seed && !xml && !rbuggyQSA.test( selector ) ) {
var groups, i,
old = true,
nid = expando,
newContext = context,
newSelector = context.nodeType === 9 && selector;
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
groups = tokenize( selector );
if ( (old = context.getAttribute("id")) ) {
nid = old.replace( rescape, "\\$&" );
} else {
context.setAttribute( "id", nid );
}
nid = "[id='" + nid + "'] ";
i = groups.length;
while ( i-- ) {
groups[i] = nid + groups[i].join("");
}
newContext = rsibling.test( selector ) && context.parentNode || context;
newSelector = groups.join(",");
}
if ( newSelector ) {
try {
push.apply( results, slice.call( newContext.querySelectorAll(
newSelector
), 0 ) );
return results;
} catch(qsaError) {
} finally {
if ( !old ) {
context.removeAttribute("id");
}
}
}
}
return oldSelect( selector, context, results, seed, xml );
};
if ( matches ) {
assert(function( div ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
disconnectedMatch = matches.call( div, "div" );
// This should fail with an exception
// Gecko does not error, returns false instead
try {
matches.call( div, "[test!='']:sizzle" );
rbuggyMatches.push( "!=", pseudos );
} catch ( e ) {}
});
// rbuggyMatches always contains :active and :focus, so no need for a length check
rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") );
Sizzle.matchesSelector = function( elem, expr ) {
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
// rbuggyMatches always contains :active, so no need for an existence check
if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) {
try {
var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch(e) {}
}
return Sizzle( expr, null, null, [ elem ] ).length > 0;
};
}
})();
}
// Deprecated
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Back-compat
function setFilters() {}
Expr.filters = setFilters.prototype = Expr.pseudos;
Expr.setFilters = new setFilters();
// Override sizzle attribute retrieval
Sizzle.attr = jQuery.attr;
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.pseudos;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})( window );
var runtil = /Until$/,
rparentsprev = /^(?:parents|prev(?:Until|All))/,
isSimple = /^.[^:#\[\.,]*$/,
rneedsContext = jQuery.expr.match.needsContext,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
find: function( selector ) {
var i, l, length, n, r, ret,
self = this;
if ( typeof selector !== "string" ) {
return jQuery( selector ).filter(function() {
for ( i = 0, l = self.length; i < l; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
});
}
ret = this.pushStack( "", "find", selector );
for ( i = 0, l = this.length; i < l; i++ ) {
length = ret.length;
jQuery.find( selector, this[i], ret );
if ( i > 0 ) {
// Make sure that the results are unique
for ( n = length; n < ret.length; n++ ) {
for ( r = 0; r < length; r++ ) {
if ( ret[r] === ret[n] ) {
ret.splice(n--, 1);
break;
}
}
}
}
}
return ret;
},
has: function( target ) {
var i,
targets = jQuery( target, this ),
len = targets.length;
return this.filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector, false), "not", selector);
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true), "filter", selector );
},
is: function( selector ) {
return !!selector && (
typeof selector === "string" ?
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
rneedsContext.test( selector ) ?
jQuery( selector, this.context ).index( this[0] ) >= 0 :
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
var cur,
i = 0,
l = this.length,
ret = [],
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( ; i < l; i++ ) {
cur = this[i];
while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
}
cur = cur.parentNode;
}
}
ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
return this.pushStack( ret, "closest", selectors );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
}
// index in selector
if ( typeof elem === "string" ) {
return jQuery.inArray( this[0], jQuery( elem ) );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context ) :
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
all :
jQuery.unique( all ) );
},
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter(selector)
);
}
});
jQuery.fn.andSelf = jQuery.fn.addBack;
// A painfully simple check to see if an element is disconnected
// from a document (should be improved, where feasible).
function isDisconnected( node ) {
return !node || !node.parentNode || node.parentNode.nodeType === 11;
}
function sibling( cur, dir ) {
do {
cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 );
return cur;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return sibling( elem, "nextSibling" );
},
prev: function( elem ) {
return sibling( elem, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.merge( [], elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
if ( this.length > 1 && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret, name, core_slice.call( arguments ).join(",") );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem, i ) {
return ( elem === qualifier ) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem, i ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
});
}
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
rnocache = /<(?:script|object|embed|option|style)/i,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
rcheckableType = /^(?:checkbox|radio)$/,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /\/(java|ecma)script/i,
rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
area: [ 1, "<map>", "</map>" ],
_default: [ 0, "", "" ]
},
safeFragment = createSafeFragment( document ),
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
// unless wrapped in a div with non-breaking characters in front of it.
if ( !jQuery.support.htmlSerialize ) {
wrapMap._default = [ 1, "X<div>", "</div>" ];
}
jQuery.fn.extend({
text: function( value ) {
return jQuery.access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
}, null, value, arguments.length );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
var isFunction = jQuery.isFunction( html );
return this.each(function(i) {
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
if ( !isDisconnected( this[0] ) ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this );
});
}
if ( arguments.length ) {
var set = jQuery.clean( arguments );
return this.pushStack( jQuery.merge( set, this ), "before", this.selector );
}
},
after: function() {
if ( !isDisconnected( this[0] ) ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this.nextSibling );
});
}
if ( arguments.length ) {
var set = jQuery.clean( arguments );
return this.pushStack( jQuery.merge( this, set ), "after", this.selector );
}
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
jQuery.cleanData( [ elem ] );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
}
return this;
},
empty: function() {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
return jQuery.access( this, function( value ) {
var elem = this[0] || {},
i = 0,
l = this.length;
if ( value === undefined ) {
return elem.nodeType === 1 ?
elem.innerHTML.replace( rinlinejQuery, "" ) :
undefined;
}
// See if we can take a shortcut and just use innerHTML
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
!wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
value = value.replace( rxhtmlTag, "<$1></$2>" );
try {
for (; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
elem = this[i] || {};
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName( "*" ) );
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch(e) {}
}
if ( elem ) {
this.empty().append( value );
}
}, null, value, arguments.length );
},
replaceWith: function( value ) {
if ( !isDisconnected( this[0] ) ) {
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this), old = self.html();
self.replaceWith( value.call( this, i, old ) );
});
}
if ( typeof value !== "string" ) {
value = jQuery( value ).detach();
}
return this.each(function() {
var next = this.nextSibling,
parent = this.parentNode;
jQuery( this ).remove();
if ( next ) {
jQuery(next).before( value );
} else {
jQuery(parent).append( value );
}
});
}
return this.length ?
this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
this;
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, table, callback ) {
// Flatten any nested arrays
args = [].concat.apply( [], args );
var results, first, fragment, iNoClone,
i = 0,
value = args[0],
scripts = [],
l = this.length;
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) {
return this.each(function() {
jQuery(this).domManip( args, table, callback );
});
}
if ( jQuery.isFunction(value) ) {
return this.each(function(i) {
var self = jQuery(this);
args[0] = value.call( this, i, table ? self.html() : undefined );
self.domManip( args, table, callback );
});
}
if ( this[0] ) {
results = jQuery.buildFragment( args, this, scripts );
fragment = results.fragment;
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
// Use the original fragment for the last item instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
// Fragments from the fragment cache must always be cloned and never used in place.
for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) {
callback.call(
table && jQuery.nodeName( this[i], "table" ) ?
findOrAppend( this[i], "tbody" ) :
this[i],
i === iNoClone ?
fragment :
jQuery.clone( fragment, true, true )
);
}
}
// Fix #11809: Avoid leaking memory
fragment = first = null;
if ( scripts.length ) {
jQuery.each( scripts, function( i, elem ) {
if ( elem.src ) {
if ( jQuery.ajax ) {
jQuery.ajax({
url: elem.src,
type: "GET",
dataType: "script",
async: false,
global: false,
"throws": true
});
} else {
jQuery.error("no ajax");
}
} else {
jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
});
}
}
return this;
}
});
function findOrAppend( elem, tag ) {
return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function cloneFixAttributes( src, dest ) {
var nodeName;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
// clearAttributes removes the attributes, which we don't want,
// but also removes the attachEvent events, which we *do* want
if ( dest.clearAttributes ) {
dest.clearAttributes();
}
// mergeAttributes, in contrast, only merges back on the
// original attributes, not the events
if ( dest.mergeAttributes ) {
dest.mergeAttributes( src );
}
nodeName = dest.nodeName.toLowerCase();
if ( nodeName === "object" ) {
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML;
}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) {
dest.innerHTML = src.innerHTML;
}
} else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
dest.defaultChecked = dest.checked = src.checked;
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
// IE blanks contents when cloning scripts
} else if ( nodeName === "script" && dest.text !== src.text ) {
dest.text = src.text;
}
// Event data gets referenced instead of copied if the expando
// gets copied too
dest.removeAttribute( jQuery.expando );
}
jQuery.buildFragment = function( args, context, scripts ) {
var fragment, cacheable, cachehit,
first = args[ 0 ];
// Set context from what may come in as undefined or a jQuery collection or a node
// Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 &
// also doubles as fix for #8950 where plain objects caused createDocumentFragment exception
context = context || document;
context = !context.nodeType && context[0] || context;
context = context.ownerDocument || context;
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document
// Cloning options loses the selected state, so don't cache them
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
// Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document &&
first.charAt(0) === "<" && !rnocache.test( first ) &&
(jQuery.support.checkClone || !rchecked.test( first )) &&
(jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
// Mark cacheable and look for a hit
cacheable = true;
fragment = jQuery.fragments[ first ];
cachehit = fragment !== undefined;
}
if ( !fragment ) {
fragment = context.createDocumentFragment();
jQuery.clean( args, context, fragment, scripts );
// Update the cache, but only store false
// unless this is a second parsing of the same content
if ( cacheable ) {
jQuery.fragments[ first ] = cachehit && fragment;
}
}
return { fragment: fragment, cacheable: cacheable };
};
jQuery.fragments = {};
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var elems,
i = 0,
ret = [],
insert = jQuery( selector ),
l = insert.length,
parent = this.length === 1 && this[0].parentNode;
if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) {
insert[ original ]( this[0] );
return this;
} else {
for ( ; i < l; i++ ) {
elems = ( i > 0 ? this.clone(true) : this ).get();
jQuery( insert[i] )[ original ]( elems );
ret = ret.concat( elems );
}
return this.pushStack( ret, name, insert.selector );
}
};
});
function getAll( elem ) {
if ( typeof elem.getElementsByTagName !== "undefined" ) {
return elem.getElementsByTagName( "*" );
} else if ( typeof elem.querySelectorAll !== "undefined" ) {
return elem.querySelectorAll( "*" );
} else {
return [];
}
}
// Used in clean, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var srcElements,
destElements,
i,
clone;
if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
clone = elem.cloneNode( true );
// IE<=8 does not properly clone detached, unknown element nodes
} else {
fragmentDiv.innerHTML = elem.outerHTML;
fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
}
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// IE copies events bound via attachEvent when using cloneNode.
// Calling detachEvent on the clone will also remove the events
// from the original. In order to get around this, we use some
// proprietary methods to clear the events. Thanks to MooTools
// guys for this hotness.
cloneFixAttributes( elem, clone );
// Using Sizzle here is crazy slow, so we use getElementsByTagName instead
srcElements = getAll( elem );
destElements = getAll( clone );
// Weird iteration because IE will replace the length property
// with an element if you are cloning the body and one of the
// elements on the page has a name or id of "length"
for ( i = 0; srcElements[i]; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) {
cloneFixAttributes( srcElements[i], destElements[i] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
cloneCopyEvent( elem, clone );
if ( deepDataAndEvents ) {
srcElements = getAll( elem );
destElements = getAll( clone );
for ( i = 0; srcElements[i]; ++i ) {
cloneCopyEvent( srcElements[i], destElements[i] );
}
}
}
srcElements = destElements = null;
// Return the cloned set
return clone;
},
clean: function( elems, context, fragment, scripts ) {
var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags,
safe = context === document && safeFragment,
ret = [];
// Ensure that context is a document
if ( !context || typeof context.createDocumentFragment === "undefined" ) {
context = document;
}
// Use the already-created safe fragment if context permits
for ( i = 0; (elem = elems[i]) != null; i++ ) {
if ( typeof elem === "number" ) {
elem += "";
}
if ( !elem ) {
continue;
}
// Convert html string into DOM nodes
if ( typeof elem === "string" ) {
if ( !rhtml.test( elem ) ) {
elem = context.createTextNode( elem );
} else {
// Ensure a safe container in which to render the html
safe = safe || createSafeFragment( context );
div = context.createElement("div");
safe.appendChild( div );
// Fix "XHTML"-style tags in all browsers
elem = elem.replace(rxhtmlTag, "<$1></$2>");
// Go to html and back, then peel off extra wrappers
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
depth = wrap[0];
div.innerHTML = wrap[1] + elem + wrap[2];
// Move to the right depth
while ( depth-- ) {
div = div.lastChild;
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
hasBody = rtbody.test(elem);
tbody = tag === "table" && !hasBody ?
div.firstChild && div.firstChild.childNodes :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !hasBody ?
div.childNodes :
[];
for ( j = tbody.length - 1; j >= 0 ; --j ) {
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
tbody[ j ].parentNode.removeChild( tbody[ j ] );
}
}
}
// IE completely kills leading whitespace when innerHTML is used
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
}
elem = div.childNodes;
// Take out of fragment container (we need a fresh div each time)
div.parentNode.removeChild( div );
}
}
if ( elem.nodeType ) {
ret.push( elem );
} else {
jQuery.merge( ret, elem );
}
}
// Fix #11356: Clear elements from safeFragment
if ( div ) {
elem = div = safe = null;
}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if ( !jQuery.support.appendChecked ) {
for ( i = 0; (elem = ret[i]) != null; i++ ) {
if ( jQuery.nodeName( elem, "input" ) ) {
fixDefaultChecked( elem );
} else if ( typeof elem.getElementsByTagName !== "undefined" ) {
jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
}
}
}
// Append elements to a provided document fragment
if ( fragment ) {
// Special handling of each script element
handleScript = function( elem ) {
// Check if we consider it executable
if ( !elem.type || rscriptType.test( elem.type ) ) {
// Detach the script and store it in the scripts array (if provided) or the fragment
// Return truthy to indicate that it has been handled
return scripts ?
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
fragment.appendChild( elem );
}
};
for ( i = 0; (elem = ret[i]) != null; i++ ) {
// Check if we're done after handling an executable script
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
// Append to fragment and handle embedded scripts
fragment.appendChild( elem );
if ( typeof elem.getElementsByTagName !== "undefined" ) {
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
// Splice the scripts into ret after their former ancestor and advance our index beyond them
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
i += jsTags.length;
}
}
}
}
return ret;
},
cleanData: function( elems, /* internal */ acceptData ) {
var data, id, elem, type,
i = 0,
internalKey = jQuery.expando,
cache = jQuery.cache,
deleteExpando = jQuery.support.deleteExpando,
special = jQuery.event.special;
for ( ; (elem = elems[i]) != null; i++ ) {
if ( acceptData || jQuery.acceptData( elem ) ) {
id = elem[ internalKey ];
data = id && cache[ id ];
if ( data ) {
if ( data.events ) {
for ( type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
}
// Remove cache only if it was not already removed by jQuery.event.remove
if ( cache[ id ] ) {
delete cache[ id ];
// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if ( deleteExpando ) {
delete elem[ internalKey ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( internalKey );
} else {
elem[ internalKey ] = null;
}
jQuery.deletedIds.push( id );
}
}
}
}
}
});
// Limit scope pollution from any deprecated API
(function() {
var matched, browser;
// Use of jQuery.browser is frowned upon.
// More details: http://api.jquery.com/jQuery.browser
// jQuery.uaMatch maintained for back-compat
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
matched = jQuery.uaMatch( navigator.userAgent );
browser = {};
if ( matched.browser ) {
browser[ matched.browser ] = true;
browser.version = matched.version;
}
// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
browser.webkit = true;
} else if ( browser.webkit ) {
browser.safari = true;
}
jQuery.browser = browser;
jQuery.sub = function() {
function jQuerySub( selector, context ) {
return new jQuerySub.fn.init( selector, context );
}
jQuery.extend( true, jQuerySub, this );
jQuerySub.superclass = this;
jQuerySub.fn = jQuerySub.prototype = this();
jQuerySub.fn.constructor = jQuerySub;
jQuerySub.sub = this.sub;
jQuerySub.fn.init = function init( selector, context ) {
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
context = jQuerySub( context );
}
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
};
jQuerySub.fn.init.prototype = jQuerySub.fn;
var rootjQuerySub = jQuerySub(document);
return jQuerySub;
};
})();
var curCSS, iframe, iframeDoc,
ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
rposition = /^(top|right|bottom|left)$/,
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rmargin = /^margin/,
rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ),
elemdisplay = { BODY: "block" },
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
letterSpacing: 0,
fontWeight: 400
},
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
eventsToggle = jQuery.fn.toggle;
// return a css property mapped to a potentially vendor prefixed property
function vendorPropName( style, name ) {
// shortcut for names that are not vendor prefixed
if ( name in style ) {
return name;
}
// check for vendor prefixed names
var capName = name.charAt(0).toUpperCase() + name.slice(1),
origName = name,
i = cssPrefixes.length;
while ( i-- ) {
name = cssPrefixes[ i ] + capName;
if ( name in style ) {
return name;
}
}
return origName;
}
function isHidden( elem, el ) {
elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
}
function showHide( elements, show ) {
var elem, display,
values = [],
index = 0,
length = elements.length;
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
values[ index ] = jQuery._data( elem, "olddisplay" );
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && elem.style.display === "none" ) {
elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( elem.style.display === "" && isHidden( elem ) ) {
values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
}
} else {
display = curCSS( elem, "display" );
if ( !values[ index ] && display !== "none" ) {
jQuery._data( elem, "olddisplay", display );
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( index = 0; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
elem.style.display = show ? values[ index ] || "" : "none";
}
}
return elements;
}
jQuery.fn.extend({
css: function( name, value ) {
return jQuery.access( this, function( elem, name, value ) {
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
}, name, value, arguments.length > 1 );
},
show: function() {
return showHide( this, true );
},
hide: function() {
return showHide( this );
},
toggle: function( state, fn2 ) {
var bool = typeof state === "boolean";
if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) {
return eventsToggle.apply( this, arguments );
}
return this.each(function() {
if ( bool ? state : isHidden( this ) ) {
jQuery( this ).show();
} else {
jQuery( this ).hide();
}
});
}
});
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity" );
return ret === "" ? "1" : ret;
}
}
}
},
// Exclude the following css properties to add px
cssNumber: {
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, type, hooks,
origName = jQuery.camelCase( name ),
style = elem.style;
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
// Fixes bug #9237
type = "number";
}
// Make sure that NaN and null values aren't set. See: #7116
if ( value == null || type === "number" && isNaN( value ) ) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
value += "px";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try {
style[ name ] = value;
} catch(e) {}
}
} else {
// If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
return ret;
}
// Otherwise just get the value from the style object
return style[ name ];
}
},
css: function( elem, name, numeric, extra ) {
var val, num, hooks,
origName = jQuery.camelCase( name );
// Make sure that we're working with the right name
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks ) {
val = hooks.get( elem, true, extra );
}
// Otherwise, if a way to get the computed value exists, use that
if ( val === undefined ) {
val = curCSS( elem, name );
}
//convert "normal" to computed value
if ( val === "normal" && name in cssNormalTransform ) {
val = cssNormalTransform[ name ];
}
// Return, converting to number if forced or a qualifier was provided and val looks numeric
if ( numeric || extra !== undefined ) {
num = parseFloat( val );
return numeric || jQuery.isNumeric( num ) ? num || 0 : val;
}
return val;
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback ) {
var ret, name,
old = {};
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.call( elem );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
}
});
// NOTE: To any future maintainer, we've window.getComputedStyle
// because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
curCSS = function( elem, name ) {
var ret, width, minWidth, maxWidth,
computed = window.getComputedStyle( elem, null ),
style = elem.style;
if ( computed ) {
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
ret = computed.getPropertyValue( name ) || computed[ name ];
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
// A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
return ret;
};
} else if ( document.documentElement.currentStyle ) {
curCSS = function( elem, name ) {
var left, rsLeft,
ret = elem.currentStyle && elem.currentStyle[ name ],
style = elem.style;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && style[ name ] ) {
ret = style[ name ];
}
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
// but not position css attributes, as those are proportional to the parent element instead
// and we can't measure the parent instead because it might trigger a "stacking dolls" problem
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
// Remember the original values
left = style.left;
rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
elem.runtimeStyle.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
elem.runtimeStyle.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
function setPositiveNumber( elem, value, subtract ) {
var matches = rnumsplit.exec( value );
return matches ?
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
value;
}
function augmentWidthOrHeight( elem, name, extra, isBorderBox ) {
var i = extra === ( isBorderBox ? "border" : "content" ) ?
// If we already have the right measurement, avoid augmentation
4 :
// Otherwise initialize for horizontal or vertical properties
name === "width" ? 1 : 0,
val = 0;
for ( ; i < 4; i += 2 ) {
// both box models exclude margin, so add it if we want it
if ( extra === "margin" ) {
// we use jQuery.css instead of curCSS here
// because of the reliableMarginRight CSS hook!
val += jQuery.css( elem, extra + cssExpand[ i ], true );
}
// From this point on we use curCSS for maximum performance (relevant in animations)
if ( isBorderBox ) {
// border-box includes padding, so remove it if we want content
if ( extra === "content" ) {
val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
}
// at this point, extra isn't border nor margin, so remove border
if ( extra !== "margin" ) {
val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
}
} else {
// at this point, extra isn't content, so add padding
val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
// at this point, extra isn't content nor padding, so add border
if ( extra !== "padding" ) {
val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
}
}
}
return val;
}
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value
var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
valueIsBorderBox = true,
isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if ( val <= 0 || val == null ) {
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test(val) ) {
return val;
}
// we need the check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
}
// use the active box-sizing model to add/subtract irrelevant styles
return ( val +
augmentWidthOrHeight(
elem,
name,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox
)
) + "px";
}
// Try to determine the default display value of an element
function css_defaultDisplay( nodeName ) {
if ( elemdisplay[ nodeName ] ) {
return elemdisplay[ nodeName ];
}
var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ),
display = elem.css("display");
elem.remove();
// If the simple way fails,
// get element's real default display by attaching it to a temp iframe
if ( display === "none" || display === "" ) {
// Use the already-created iframe if possible
iframe = document.body.appendChild(
iframe || jQuery.extend( document.createElement("iframe"), {
frameBorder: 0,
width: 0,
height: 0
})
);
// Create a cacheable copy of the iframe document on first call.
// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
// document to it; WebKit & Firefox won't allow reusing the iframe document.
if ( !iframeDoc || !iframe.createElement ) {
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
iframeDoc.write("<!doctype html><html><body>");
iframeDoc.close();
}
elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) );
display = curCSS( elem, "display" );
document.body.removeChild( iframe );
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
return display;
}
jQuery.each([ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
// certain elements can have dimension info if we invisibly show them
// however, it must have a current display style that would benefit from this
if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) {
return jQuery.swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
});
} else {
return getWidthOrHeight( elem, name, extra );
}
}
},
set: function( elem, value, extra ) {
return setPositiveNumber( elem, value, extra ?
augmentWidthOrHeight(
elem,
name,
extra,
jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"
) : 0
);
}
};
});
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
computed ? "1" : "";
},
set: function( elem, value ) {
var style = elem.style,
currentStyle = elem.currentStyle,
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
filter = currentStyle && currentStyle.filter || style.filter || "";
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
style.removeAttribute ) {
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// if "filter:" is present at all, clearType is disabled, we want to avoid this
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" );
// if there there is no filter style applied in a css rule, we are done
if ( currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
// These hooks cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
jQuery(function() {
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
return jQuery.swap( elem, { "display": "inline-block" }, function() {
if ( computed ) {
return curCSS( elem, "marginRight" );
}
});
}
};
}
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// getComputedStyle returns percent when specified for top/left/bottom/right
// rather than make the css module depend on the offset module, we just check for it here
if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
jQuery.each( [ "top", "left" ], function( i, prop ) {
jQuery.cssHooks[ prop ] = {
get: function( elem, computed ) {
if ( computed ) {
var ret = curCSS( elem, prop );
// if curCSS returns percentage, fallback to offset
return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret;
}
}
};
});
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
// These hooks are used by animate to expand properties
jQuery.each({
margin: "",
padding: "",
border: "Width"
}, function( prefix, suffix ) {
jQuery.cssHooks[ prefix + suffix ] = {
expand: function( value ) {
var i,
// assumes a single number if not a string
parts = typeof value === "string" ? value.split(" ") : [ value ],
expanded = {};
for ( i = 0; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
}
return expanded;
}
};
if ( !rmargin.test( prefix ) ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
}
});
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
rselectTextarea = /^(?:select|textarea)/i;
jQuery.fn.extend({
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map(function(){
return this.elements ? jQuery.makeArray( this.elements ) : this;
})
.filter(function(){
return this.name && !this.disabled &&
( this.checked || rselectTextarea.test( this.nodeName ) ||
rinput.test( this.type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val, i ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
});
//Serialize an array of form elements or a set of
//key/values into a query string
jQuery.param = function( a, traditional ) {
var prefix,
s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
};
function buildParams( prefix, obj, traditional, add ) {
var name;
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// If array item is non-scalar (array or object), encode its
// numeric index to resolve deserialization ambiguity issues.
// Note that rack (as of 1.0.0) can't currently deserialize
// nested arrays properly, and attempting to do so may cause
// a server error. Possible fixes are to modify rack's
// deserialization algorithm or to provide an option or flag
// to force array serialization to be shallow.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
var
// Document location
ajaxLocParts,
ajaxLocation,
rhash = /#.*$/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rquery = /\?/,
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rts = /([?&])_=[^&]*/,
rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
// Keep a copy of the old load method
_load = jQuery.fn.load,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = ["*/"] + ["*"];
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
ajaxLocation.href = "";
ajaxLocation = ajaxLocation.href;
}
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType, list, placeBefore,
dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ),
i = 0,
length = dataTypes.length;
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression
for ( ; i < length; i++ ) {
dataType = dataTypes[ i ];
// We control if we're asked to add before
// any existing element
placeBefore = /^\+/.test( dataType );
if ( placeBefore ) {
dataType = dataType.substr( 1 ) || "*";
}
list = structure[ dataType ] = structure[ dataType ] || [];
// then we add to the structure accordingly
list[ placeBefore ? "unshift" : "push" ]( func );
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
dataType /* internal */, inspected /* internal */ ) {
dataType = dataType || options.dataTypes[ 0 ];
inspected = inspected || {};
inspected[ dataType ] = true;
var selection,
list = structure[ dataType ],
i = 0,
length = list ? list.length : 0,
executeOnly = ( structure === prefilters );
for ( ; i < length && ( executeOnly || !selection ); i++ ) {
selection = list[ i ]( options, originalOptions, jqXHR );
// If we got redirected to another dataType
// we try there if executing only and not done already
if ( typeof selection === "string" ) {
if ( !executeOnly || inspected[ selection ] ) {
selection = undefined;
} else {
options.dataTypes.unshift( selection );
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, selection, inspected );
}
}
}
// If we're only executing or nothing was selected
// we try the catchall dataType if not done already
if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, "*", inspected );
}
// unnecessary when only executing (prefilters)
// but it'll be ignored by the caller in that case
return selection;
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var key, deep,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
}
jQuery.fn.load = function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
}
// Don't do a request if no elements are being requested
if ( !this.length ) {
return this;
}
var selector, type, response,
self = this,
off = url.indexOf(" ");
if ( off >= 0 ) {
selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( params && typeof params === "object" ) {
type = "POST";
}
// Request the remote document
jQuery.ajax({
url: url,
// if "type" variable is undefined, then "GET" method will be used
type: type,
dataType: "html",
data: params,
complete: function( jqXHR, status ) {
if ( callback ) {
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
}
}
}).done(function( responseText ) {
// Save response for use in complete callback
response = arguments;
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
jQuery("<div>")
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
.append( responseText.replace( rscript, "" ) )
// Locate the specified elements
.find( selector ) :
// If not, just inject the full result
responseText );
});
return this;
};
// Attach a bunch of functions for handling common AJAX events
jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
jQuery.fn[ o ] = function( f ){
return this.on( o, f );
};
});
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
return jQuery.ajax({
type: method,
url: url,
data: data,
success: callback,
dataType: type
});
};
});
jQuery.extend({
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
if ( settings ) {
// Building a settings object
ajaxExtend( target, jQuery.ajaxSettings );
} else {
// Extending ajaxSettings
settings = target;
target = jQuery.ajaxSettings;
}
ajaxExtend( target, settings );
return target;
},
ajaxSettings: {
url: ajaxLocation,
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
type: "GET",
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
processData: true,
async: true,
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
text: "text/plain",
json: "application/json, text/javascript",
"*": allTypes
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText"
},
// List of data converters
// 1) key format is "source_type destination_type" (a single space in-between)
// 2) the catchall symbol "*" can be used for source_type
converters: {
// Convert anything to text
"* text": window.String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": jQuery.parseJSON,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
context: true,
url: true
}
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var // ifModified key
ifModifiedKey,
// Response headers
responseHeadersString,
responseHeaders,
// transport
transport,
// timeout handle
timeoutTimer,
// Cross-domain detection vars
parts,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events
// It's the callbackContext if one was provided in the options
// and if it's a DOM node or a jQuery collection
globalEventContext = callbackContext !== s &&
( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
jQuery( callbackContext ) : jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks( "once memory" ),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// The jqXHR state
state = 0,
// Default abort message
strAbort = "canceled",
// Fake xhr
jqXHR = {
readyState: 0,
// Caches the header
setRequestHeader: function( name, value ) {
if ( !state ) {
var lname = name.toLowerCase();
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( state === 2 ) {
if ( !responseHeaders ) {
responseHeaders = {};
while( ( match = rheaders.exec( responseHeadersString ) ) ) {
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
}
return match === undefined ? null : match;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Cancel the request
abort: function( statusText ) {
statusText = statusText || strAbort;
if ( transport ) {
transport.abort( statusText );
}
done( 0, statusText );
return this;
}
};
// Callback for when everything is done
// It is defined here because jslint complains if it is declared
// at the end of the function (which would be more logical and readable)
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// If successful, handle type chaining
if ( status >= 200 && status < 300 || status === 304 ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
modified = jqXHR.getResponseHeader("Last-Modified");
if ( modified ) {
jQuery.lastModified[ ifModifiedKey ] = modified;
}
modified = jqXHR.getResponseHeader("Etag");
if ( modified ) {
jQuery.etag[ ifModifiedKey ] = modified;
}
}
// If not modified
if ( status === 304 ) {
statusText = "notmodified";
isSuccess = true;
// If we have data
} else {
isSuccess = ajaxConvert( s, response );
statusText = isSuccess.state;
success = isSuccess.data;
error = isSuccess.error;
isSuccess = !error;
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( !statusText || status ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger( "ajaxStop" );
}
}
}
// Attach deferreds
deferred.promise( jqXHR );
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
jqXHR.complete = completeDeferred.add;
// Status-dependent callbacks
jqXHR.statusCode = function( map ) {
if ( map ) {
var tmp;
if ( state < 2 ) {
for ( tmp in map ) {
statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
}
} else {
tmp = map[ jqXHR.status ];
jqXHR.always( tmp );
}
}
return this;
};
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// We also use the url parameter if available
s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace );
// A cross-domain request is in order when we have a protocol:host:port mismatch
if ( s.crossDomain == null ) {
parts = rurl.exec( s.url.toLowerCase() );
s.crossDomain = !!( parts &&
( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
);
}
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Apply prefilters
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefilter, stop there
if ( state === 2 ) {
return jqXHR;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
}
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Get ifModifiedKey before adding the anti-cache parameter
ifModifiedKey = s.url;
// Add anti-cache in url if needed
if ( s.cache === false ) {
var ts = jQuery.now(),
// try replacing _= if it is there
ret = s.url.replace( rts, "$1_=" + ts );
// if nothing was replaced, add timestamp to the end
s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
ifModifiedKey = ifModifiedKey || s.url;
if ( jQuery.lastModified[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
}
if ( jQuery.etag[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
}
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
// Abort if not done already and return
return jqXHR.abort();
}
// aborting is no longer a cancellation
strAbort = "abort";
// Install callbacks on deferreds
for ( i in { success: 1, error: 1, complete: 1 } ) {
jqXHR[ i ]( s[ i ] );
}
// Get transport
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = setTimeout( function(){
jqXHR.abort( "timeout" );
}, s.timeout );
}
try {
state = 1;
transport.send( requestHeaders, done );
} catch (e) {
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
throw e;
}
}
}
return jqXHR;
},
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {}
});
/* Handles responses to an ajax request:
* - sets all responseXXX fields accordingly
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var ct, type, finalDataType, firstDataType,
contents = s.contents,
dataTypes = s.dataTypes,
responseFields = s.responseFields;
// Fill responseXXX fields
for ( type in responseFields ) {
if ( type in responses ) {
jqXHR[ responseFields[type] ] = responses[ type ];
}
}
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
// Chain conversions given the request and the original response
function ajaxConvert( s, response ) {
var conv, conv2, current, tmp,
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice(),
prev = dataTypes[ 0 ],
converters = {},
i = 0;
// Apply the dataFilter if provided
if ( s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
// Convert to each sequential dataType, tolerating list modification
for ( ; (current = dataTypes[++i]); ) {
// There's only work to do if current dataType is non-auto
if ( current !== "*" ) {
// Convert response if prev dataType is non-auto and differs from current
if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
if ( !conv ) {
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split(" ");
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
current = tmp[ 0 ];
dataTypes.splice( i--, 0, current );
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
if ( conv && s["throws"] ) {
response = conv( response );
} else {
try {
response = conv( response );
} catch ( e ) {
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
}
}
}
}
// Update prev for next iteration
prev = current;
}
}
return { state: "success", data: response };
}
var oldCallbacks = [],
rquestion = /\?/,
rjsonp = /(=)\?(?=&|$)|\?\?/,
nonce = jQuery.now();
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
this[ callback ] = true;
return callback;
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
data = s.data,
url = s.url,
hasCallback = s.jsonp !== false,
replaceInUrl = hasCallback && rjsonp.test( url ),
replaceInData = hasCallback && !replaceInUrl && typeof data === "string" &&
!( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") &&
rjsonp.test( data );
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) {
// Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
s.jsonpCallback() :
s.jsonpCallback;
overwritten = window[ callbackName ];
// Insert callback into url or form data
if ( replaceInUrl ) {
s.url = url.replace( rjsonp, "$1" + callbackName );
} else if ( replaceInData ) {
s.data = data.replace( rjsonp, "$1" + callbackName );
} else if ( hasCallback ) {
s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
}
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( callbackName + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Install callback
window[ callbackName ] = function() {
responseContainer = arguments;
};
// Clean-up function (fires after converters)
jqXHR.always(function() {
// Restore preexisting value
window[ callbackName ] = overwritten;
// Save back as free
if ( s[ callbackName ] ) {
// make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback;
// save the callback name for future use
oldCallbacks.push( callbackName );
}
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
overwritten( responseContainer[ 0 ] );
}
responseContainer = overwritten = undefined;
});
// Delegate to script
return "script";
}
});
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /javascript|ecmascript/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
});
// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
s.global = false;
}
});
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script,
head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement( "script" );
script.async = "async";
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( head && script.parentNode ) {
head.removeChild( script );
}
// Dereference the script
script = undefined;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709 and #4378).
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( 0, 1 );
}
}
};
}
});
var xhrCallbacks,
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject ? function() {
// Abort all pending requests
for ( var key in xhrCallbacks ) {
xhrCallbacks[ key ]( 0, 1 );
}
} : false,
xhrId = 0;
// Functions to create xhrs
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
} catch( e ) {}
}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
(function( xhr ) {
jQuery.extend( jQuery.support, {
ajax: !!xhr,
cors: !!xhr && ( "withCredentials" in xhr )
});
})( jQuery.ajaxSettings.xhr() );
// Create transport if the browser can provide an xhr
if ( jQuery.support.ajax ) {
jQuery.ajaxTransport(function( s ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !s.crossDomain || jQuery.support.cors ) {
var callback;
return {
send: function( headers, complete ) {
// Get a new xhr
var handle, i,
xhr = s.xhr();
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open( s.type, s.url, s.async, s.username, s.password );
} else {
xhr.open( s.type, s.url, s.async );
}
// Apply custom fields if provided
if ( s.xhrFields ) {
for ( i in s.xhrFields ) {
xhr[ i ] = s.xhrFields[ i ];
}
}
// Override mime type if needed
if ( s.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( s.mimeType );
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
// Need an extra try/catch for cross domain requests in Firefox 3
try {
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
} catch( _ ) {}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( s.hasContent && s.data ) || null );
// Listener
callback = function( _, isAbort ) {
var status,
statusText,
responseHeaders,
responses,
xml;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occurred
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
try {
// Was never called and is aborted or complete
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// Only called once
callback = undefined;
// Do not keep as active anymore
if ( handle ) {
xhr.onreadystatechange = jQuery.noop;
if ( xhrOnUnloadAbort ) {
delete xhrCallbacks[ handle ];
}
}
// If it's an abort
if ( isAbort ) {
// Abort it manually if needed
if ( xhr.readyState !== 4 ) {
xhr.abort();
}
} else {
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
responses = {};
xml = xhr.responseXML;
// Construct response list
if ( xml && xml.documentElement /* #4958 */ ) {
responses.xml = xml;
}
// When requesting binary data, IE6-9 will throw an exception
// on any attempt to access responseText (#11426)
try {
responses.text = xhr.responseText;
} catch( e ) {
}
// Firefox throws an exception when accessing
// statusText for faulty cross-domain requests
try {
statusText = xhr.statusText;
} catch( e ) {
// We normalize with Webkit giving an empty statusText
statusText = "";
}
// Filter status for non standard behaviors
// If the request is local and we have data: assume a success
// (success with no data won't get notified, that's the best we
// can do given current implementations)
if ( !status && s.isLocal && !s.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
}
}
} catch( firefoxAccessException ) {
if ( !isAbort ) {
complete( -1, firefoxAccessException );
}
}
// Call complete if needed
if ( responses ) {
complete( status, statusText, responses, responseHeaders );
}
};
if ( !s.async ) {
// if we're in sync mode we fire the callback
callback();
} else if ( xhr.readyState === 4 ) {
// (IE6 & IE7) if it's in cache and has been
// retrieved directly we need to fire the callback
setTimeout( callback, 0 );
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
xhr.onreadystatechange = callback;
}
},
abort: function() {
if ( callback ) {
callback(0,1);
}
}
};
}
});
}
var fxNow, timerId,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
rrun = /queueHooks$/,
animationPrefilters = [ defaultPrefilter ],
tweeners = {
"*": [function( prop, value ) {
var end, unit,
tween = this.createTween( prop, value ),
parts = rfxnum.exec( value ),
target = tween.cur(),
start = +target || 0,
scale = 1,
maxIterations = 20;
if ( parts ) {
end = +parts[2];
unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" && start ) {
// Iteratively approximate from a nonzero starting point
// Prefer the current property, because this process will be trivial if it uses the same units
// Fallback to end or a simple constant
start = jQuery.css( tween.elem, prop, true ) || end || 1;
do {
// If previous iteration zeroed out, double until we get *something*
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
scale = scale || ".5";
// Adjust and apply
start = start / scale;
jQuery.style( tween.elem, prop, start + unit );
// Update scale, tolerating zero or NaN from tween.cur()
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
}
tween.unit = unit;
tween.start = start;
// If a +=/-= token was provided, we're doing a relative animation
tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
}
return tween;
}]
};
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout(function() {
fxNow = undefined;
}, 0 );
return ( fxNow = jQuery.now() );
}
function createTweens( animation, props ) {
jQuery.each( props, function( prop, value ) {
var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
index = 0,
length = collection.length;
for ( ; index < length; index++ ) {
if ( collection[ index ].call( animation, prop, value ) ) {
// we're done with this property
return;
}
}
});
}
function Animation( elem, properties, options ) {
var result,
index = 0,
tweenerIndex = 0,
length = animationPrefilters.length,
deferred = jQuery.Deferred().always( function() {
// don't match elem in the :animated selector
delete tick.elem;
}),
tick = function() {
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( percent );
}
deferred.notifyWith( elem, [ animation, percent, remaining ]);
if ( percent < 1 && length ) {
return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
}
},
animation = deferred.promise({
elem: elem,
props: jQuery.extend( {}, properties ),
opts: jQuery.extend( true, { specialEasing: {} }, options ),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function( prop, end, easing ) {
var tween = jQuery.Tween( elem, animation.opts, prop, end,
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.tweens.push( tween );
return tween;
},
stop: function( gotoEnd ) {
var index = 0,
// if we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( 1 );
}
// resolve when we played the last frame
// otherwise, reject
if ( gotoEnd ) {
deferred.resolveWith( elem, [ animation, gotoEnd ] );
} else {
deferred.rejectWith( elem, [ animation, gotoEnd ] );
}
return this;
}
}),
props = animation.props;
propFilter( props, animation.opts.specialEasing );
for ( ; index < length ; index++ ) {
result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
if ( result ) {
return result;
}
}
createTweens( animation, props );
if ( jQuery.isFunction( animation.opts.start ) ) {
animation.opts.start.call( elem, animation );
}
jQuery.fx.timer(
jQuery.extend( tick, {
anim: animation,
queue: animation.opts.queue,
elem: elem
})
);
// attach callbacks from options
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
}
function propFilter( props, specialEasing ) {
var index, name, easing, value, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( jQuery.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
if ( index !== name ) {
props[ name ] = value;
delete props[ index ];
}
hooks = jQuery.cssHooks[ name ];
if ( hooks && "expand" in hooks ) {
value = hooks.expand( value );
delete props[ name ];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'index' from above because we have the correct "name"
for ( index in value ) {
if ( !( index in props ) ) {
props[ index ] = value[ index ];
specialEasing[ index ] = easing;
}
}
} else {
specialEasing[ name ] = easing;
}
}
}
jQuery.Animation = jQuery.extend( Animation, {
tweener: function( props, callback ) {
if ( jQuery.isFunction( props ) ) {
callback = props;
props = [ "*" ];
} else {
props = props.split(" ");
}
var prop,
index = 0,
length = props.length;
for ( ; index < length ; index++ ) {
prop = props[ index ];
tweeners[ prop ] = tweeners[ prop ] || [];
tweeners[ prop ].unshift( callback );
}
},
prefilter: function( callback, prepend ) {
if ( prepend ) {
animationPrefilters.unshift( callback );
} else {
animationPrefilters.push( callback );
}
}
});
function defaultPrefilter( elem, props, opts ) {
var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire,
anim = this,
style = elem.style,
orig = {},
handled = [],
hidden = elem.nodeType && isHidden( elem );
// handle queue: false promises
if ( !opts.queue ) {
hooks = jQuery._queueHooks( elem, "fx" );
if ( hooks.unqueued == null ) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function() {
if ( !hooks.unqueued ) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always(function() {
// doing this makes sure that the complete handler will be called
// before this completes
anim.always(function() {
hooks.unqueued--;
if ( !jQuery.queue( elem, "fx" ).length ) {
hooks.empty.fire();
}
});
});
}
// height/width overflow pass
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if ( jQuery.css( elem, "display" ) === "inline" &&
jQuery.css( elem, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
style.display = "inline-block";
} else {
style.zoom = 1;
}
}
}
if ( opts.overflow ) {
style.overflow = "hidden";
if ( !jQuery.support.shrinkWrapBlocks ) {
anim.done(function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
});
}
}
// show/hide pass
for ( index in props ) {
value = props[ index ];
if ( rfxtypes.exec( value ) ) {
delete props[ index ];
toggle = toggle || value === "toggle";
if ( value === ( hidden ? "hide" : "show" ) ) {
continue;
}
handled.push( index );
}
}
length = handled.length;
if ( length ) {
dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
// store state if its toggle - enables .stop().toggle() to "reverse"
if ( toggle ) {
dataShow.hidden = !hidden;
}
if ( hidden ) {
jQuery( elem ).show();
} else {
anim.done(function() {
jQuery( elem ).hide();
});
}
anim.done(function() {
var prop;
jQuery.removeData( elem, "fxshow", true );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
});
for ( index = 0 ; index < length ; index++ ) {
prop = handled[ index ];
tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
if ( !( prop in dataShow ) ) {
dataShow[ prop ] = tween.start;
if ( hidden ) {
tween.end = tween.start;
tween.start = prop === "width" || prop === "height" ? 1 : 0;
}
}
}
}
}
function Tween( elem, options, prop, end, easing ) {
return new Tween.prototype.init( elem, options, prop, end, easing );
}
jQuery.Tween = Tween;
Tween.prototype = {
constructor: Tween,
init: function( elem, options, prop, end, easing, unit ) {
this.elem = elem;
this.prop = prop;
this.easing = easing || "swing";
this.options = options;
this.start = this.now = this.cur();
this.end = end;
this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
},
cur: function() {
var hooks = Tween.propHooks[ this.prop ];
return hooks && hooks.get ?
hooks.get( this ) :
Tween.propHooks._default.get( this );
},
run: function( percent ) {
var eased,
hooks = Tween.propHooks[ this.prop ];
if ( this.options.duration ) {
this.pos = eased = jQuery.easing[ this.easing ](
percent, this.options.duration * percent, 0, 1, this.options.duration
);
} else {
this.pos = eased = percent;
}
this.now = ( this.end - this.start ) * eased + this.start;
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
if ( hooks && hooks.set ) {
hooks.set( this );
} else {
Tween.propHooks._default.set( this );
}
return this;
}
};
Tween.prototype.init.prototype = Tween.prototype;
Tween.propHooks = {
_default: {
get: function( tween ) {
var result;
if ( tween.elem[ tween.prop ] != null &&
(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
return tween.elem[ tween.prop ];
}
// passing any value as a 4th parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails
// so, simple values such as "10px" are parsed to Float.
// complex values such as "rotate(1rad)" are returned as is.
result = jQuery.css( tween.elem, tween.prop, false, "" );
// Empty strings, null, undefined and "auto" are converted to 0.
return !result || result === "auto" ? 0 : result;
},
set: function( tween ) {
// use step hook for back compat - use cssHook if its there - use .style if its
// available and use plain properties where available
if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
} else {
tween.elem[ tween.prop ] = tween.now;
}
}
}
};
// Remove in 2.0 - this supports IE8's panic based approach
// to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function( tween ) {
if ( tween.elem.nodeType && tween.elem.parentNode ) {
tween.elem[ tween.prop ] = tween.now;
}
}
};
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
var cssFn = jQuery.fn[ name ];
jQuery.fn[ name ] = function( speed, easing, callback ) {
return speed == null || typeof speed === "boolean" ||
// special check for .toggle( handler, handler, ... )
( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};
});
jQuery.fn.extend({
fadeTo: function( speed, to, easing, callback ) {
// show any hidden elements after setting opacity to 0
return this.filter( isHidden ).css( "opacity", 0 ).show()
// animate to the value specified
.end().animate({ opacity: to }, speed, easing, callback );
},
animate: function( prop, speed, easing, callback ) {
var empty = jQuery.isEmptyObject( prop ),
optall = jQuery.speed( speed, easing, callback ),
doAnimation = function() {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
// Empty animations resolve immediately
if ( empty ) {
anim.stop( true );
}
};
return empty || optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
var stopQueue = function( hooks ) {
var stop = hooks.stop;
delete hooks.stop;
stop( gotoEnd );
};
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each(function() {
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
data = jQuery._data( this );
if ( index ) {
if ( data[ index ] && data[ index ].stop ) {
stopQueue( data[ index ] );
}
} else {
for ( index in data ) {
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
stopQueue( data[ index ] );
}
}
}
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
timers[ index ].anim.stop( gotoEnd );
dequeue = false;
timers.splice( index, 1 );
}
}
// start the next in the queue if the last step wasn't forced
// timers currently will call their complete callbacks, which will dequeue
// but only if they were gotoEnd
if ( dequeue || !gotoEnd ) {
jQuery.dequeue( this, type );
}
});
}
});
// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
var which,
attrs = { height: type },
i = 0;
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
includeWidth = includeWidth? 1 : 0;
for( ; i < 4 ; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
}
if ( includeWidth ) {
attrs.opacity = attrs.width = type;
}
return attrs;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx("show"),
slideUp: genFx("hide"),
slideToggle: genFx("toggle"),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
});
jQuery.speed = function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
// normalize opt.queue - true/undefined/null -> "fx"
if ( opt.queue == null || opt.queue === true ) {
opt.queue = "fx";
}
// Queueing
opt.old = opt.complete;
opt.complete = function() {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
}
};
return opt;
};
jQuery.easing = {
linear: function( p ) {
return p;
},
swing: function( p ) {
return 0.5 - Math.cos( p*Math.PI ) / 2;
}
};
jQuery.timers = [];
jQuery.fx = Tween.prototype.init;
jQuery.fx.tick = function() {
var timer,
timers = jQuery.timers,
i = 0;
fxNow = jQuery.now();
for ( ; i < timers.length; i++ ) {
timer = timers[ i ];
// Checks the timer has not already been removed
if ( !timer() && timers[ i ] === timer ) {
timers.splice( i--, 1 );
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
fxNow = undefined;
};
jQuery.fx.timer = function( timer ) {
if ( timer() && jQuery.timers.push( timer ) && !timerId ) {
timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
}
};
jQuery.fx.interval = 13;
jQuery.fx.stop = function() {
clearInterval( timerId );
timerId = null;
};
jQuery.fx.speeds = {
slow: 600,
fast: 200,
// Default speed
_default: 400
};
// Back Compat <1.8 extension point
jQuery.fx.step = {};
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
var rroot = /^(?:body|html)$/i;
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft,
box = { top: 0, left: 0 },
elem = this[ 0 ],
doc = elem && elem.ownerDocument;
if ( !doc ) {
return;
}
if ( (body = doc.body) === elem ) {
return jQuery.offset.bodyOffset( elem );
}
docElem = doc.documentElement;
// Make sure it's not a disconnected DOM node
if ( !jQuery.contains( docElem, elem ) ) {
return box;
}
// If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== "undefined" ) {
box = elem.getBoundingClientRect();
}
win = getWindow( doc );
clientTop = docElem.clientTop || body.clientTop || 0;
clientLeft = docElem.clientLeft || body.clientLeft || 0;
scrollTop = win.pageYOffset || docElem.scrollTop;
scrollLeft = win.pageXOffset || docElem.scrollLeft;
return {
top: box.top + scrollTop - clientTop,
left: box.left + scrollLeft - clientLeft
};
};
jQuery.offset = {
bodyOffset: function( body ) {
var top = body.offsetTop,
left = body.offsetLeft;
if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
}
return { top: top, left: left };
},
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
props = {}, curPosition = {}, curTop, curLeft;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
if ( options.top != null ) {
props.top = ( options.top - curOffset.top ) + curTop;
}
if ( options.left != null ) {
props.left = ( options.left - curOffset.left ) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend({
position: function() {
if ( !this[0] ) {
return;
}
var elem = this[0],
// Get *real* offsetParent
offsetParent = this.offsetParent(),
// Get correct offsets
offset = this.offset(),
parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
// Add offsetParent borders
parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
// Subtract the two offsets
return {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.body;
while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || document.body;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
var top = /Y/.test( prop );
jQuery.fn[ method ] = function( val ) {
return jQuery.access( this, function( elem, method, val ) {
var win = getWindow( elem );
if ( val === undefined ) {
return win ? (prop in win) ? win[ prop ] :
win.document.documentElement[ method ] :
elem[ method ];
}
if ( win ) {
win.scrollTo(
!top ? val : jQuery( win ).scrollLeft(),
top ? val : jQuery( win ).scrollTop()
);
} else {
elem[ method ] = val;
}
}, method, val, arguments.length, null );
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
// margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return jQuery.access( this, function( elem, type, value ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return elem.document.documentElement[ "client" + name ];
}
// Get document width or height
if ( elem.nodeType === 9 ) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ],
doc[ "client" + name ]
);
}
return value === undefined ?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css( elem, type, value, extra ) :
// Set width or height on the element
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable, null );
};
});
});
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
// Expose jQuery as an AMD module, but only for AMD loaders that
// understand the issues with loading multiple versions of jQuery
// in a page that all might call define(). The loader will indicate
// they have special allowances for multiple jQuery versions by
// specifying define.amd.jQuery = true. Register as a named module,
// since jQuery can be concatenated with other files that may use define,
// but not use a proper concatenation script that understands anonymous
// AMD modules. A named AMD is safest and most robust way to register.
// Lowercase jquery is used because AMD module names are derived from
// file names, and jQuery is normally delivered in a lowercase file name.
// Do this after creating the global so that if an AMD module wants to call
// noConflict to hide this version of jQuery, it will work.
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
define( "jquery", [], function () { return jQuery; } );
}
})( window );
/*!
* This file creates $ and jQuery variables within the F2 closure scope
*/
var $, jQuery = $ = window.jQuery.noConflict(true);
/*!
* Hij1nx requires the following notice to accompany EventEmitter:
*
* Copyright (c) 2011 hij1nx
*
* http://www.twitter.com/hij1nx
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the 'Software'), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
!function(exports, undefined) {
var isArray = Array.isArray ? Array.isArray : function _isArray(obj) {
return Object.prototype.toString.call(obj) === "[object Array]";
};
var defaultMaxListeners = 10;
function init() {
this._events = new Object;
}
function configure(conf) {
if (conf) {
conf.delimiter && (this.delimiter = conf.delimiter);
conf.wildcard && (this.wildcard = conf.wildcard);
if (this.wildcard) {
this.listenerTree = new Object;
}
}
}
function EventEmitter(conf) {
this._events = new Object;
configure.call(this, conf);
}
//
// Attention, function return type now is array, always !
// It has zero elements if no any matches found and one or more
// elements (leafs) if there are matches
//
function searchListenerTree(handlers, type, tree, i) {
if (!tree) {
return [];
}
var listeners=[], leaf, len, branch, xTree, xxTree, isolatedBranch, endReached,
typeLength = type.length, currentType = type[i], nextType = type[i+1];
if (i === typeLength && tree._listeners) {
//
// If at the end of the event(s) list and the tree has listeners
// invoke those listeners.
//
if (typeof tree._listeners === 'function') {
handlers && handlers.push(tree._listeners);
return [tree];
} else {
for (leaf = 0, len = tree._listeners.length; leaf < len; leaf++) {
handlers && handlers.push(tree._listeners[leaf]);
}
return [tree];
}
}
if ((currentType === '*' || currentType === '**') || tree[currentType]) {
//
// If the event emitted is '*' at this part
// or there is a concrete match at this patch
//
if (currentType === '*') {
for (branch in tree) {
if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+1));
}
}
return listeners;
} else if(currentType === '**') {
endReached = (i+1 === typeLength || (i+2 === typeLength && nextType === '*'));
if(endReached && tree._listeners) {
// The next element has a _listeners, add it to the handlers.
listeners = listeners.concat(searchListenerTree(handlers, type, tree, typeLength));
}
for (branch in tree) {
if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
if(branch === '*' || branch === '**') {
if(tree[branch]._listeners && !endReached) {
listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], typeLength));
}
listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
} else if(branch === nextType) {
listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+2));
} else {
// No match on this one, shift into the tree but not in the type array.
listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
}
}
}
return listeners;
}
listeners = listeners.concat(searchListenerTree(handlers, type, tree[currentType], i+1));
}
xTree = tree['*'];
if (xTree) {
//
// If the listener tree will allow any match for this part,
// then recursively explore all branches of the tree
//
searchListenerTree(handlers, type, xTree, i+1);
}
xxTree = tree['**'];
if(xxTree) {
if(i < typeLength) {
if(xxTree._listeners) {
// If we have a listener on a '**', it will catch all, so add its handler.
searchListenerTree(handlers, type, xxTree, typeLength);
}
// Build arrays of matching next branches and others.
for(branch in xxTree) {
if(branch !== '_listeners' && xxTree.hasOwnProperty(branch)) {
if(branch === nextType) {
// We know the next element will match, so jump twice.
searchListenerTree(handlers, type, xxTree[branch], i+2);
} else if(branch === currentType) {
// Current node matches, move into the tree.
searchListenerTree(handlers, type, xxTree[branch], i+1);
} else {
isolatedBranch = {};
isolatedBranch[branch] = xxTree[branch];
searchListenerTree(handlers, type, { '**': isolatedBranch }, i+1);
}
}
}
} else if(xxTree._listeners) {
// We have reached the end and still on a '**'
searchListenerTree(handlers, type, xxTree, typeLength);
} else if(xxTree['*'] && xxTree['*']._listeners) {
searchListenerTree(handlers, type, xxTree['*'], typeLength);
}
}
return listeners;
}
function growListenerTree(type, listener) {
type = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
//
// Looks for two consecutive '**', if so, don't add the event at all.
//
for(var i = 0, len = type.length; i+1 < len; i++) {
if(type[i] === '**' && type[i+1] === '**') {
return;
}
}
var tree = this.listenerTree;
var name = type.shift();
while (name) {
if (!tree[name]) {
tree[name] = new Object;
}
tree = tree[name];
if (type.length === 0) {
if (!tree._listeners) {
tree._listeners = listener;
}
else if(typeof tree._listeners === 'function') {
tree._listeners = [tree._listeners, listener];
}
else if (isArray(tree._listeners)) {
tree._listeners.push(listener);
if (!tree._listeners.warned) {
var m = defaultMaxListeners;
if (typeof this._events.maxListeners !== 'undefined') {
m = this._events.maxListeners;
}
if (m > 0 && tree._listeners.length > m) {
tree._listeners.warned = true;
console.error('(node) warning: possible EventEmitter memory ' +
'leak detected. %d listeners added. ' +
'Use emitter.setMaxListeners() to increase limit.',
tree._listeners.length);
console.trace();
}
}
}
return true;
}
name = type.shift();
}
return true;
};
// By default EventEmitters will print a warning if more than
// 10 listeners are added to it. This is a useful default which
// helps finding memory leaks.
//
// Obviously not all Emitters should be limited to 10. This function allows
// that to be increased. Set to zero for unlimited.
EventEmitter.prototype.delimiter = '.';
EventEmitter.prototype.setMaxListeners = function(n) {
this._events || init.call(this);
this._events.maxListeners = n;
};
EventEmitter.prototype.event = '';
EventEmitter.prototype.once = function(event, fn) {
this.many(event, 1, fn);
return this;
};
EventEmitter.prototype.many = function(event, ttl, fn) {
var self = this;
if (typeof fn !== 'function') {
throw new Error('many only accepts instances of Function');
}
function listener() {
if (--ttl === 0) {
self.off(event, listener);
}
fn.apply(this, arguments);
};
listener._origin = fn;
this.on(event, listener);
return self;
};
EventEmitter.prototype.emit = function() {
this._events || init.call(this);
var type = arguments[0];
if (type === 'newListener') {
if (!this._events.newListener) { return false; }
}
// Loop through the *_all* functions and invoke them.
if (this._all) {
var l = arguments.length;
var args = new Array(l - 1);
for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
for (i = 0, l = this._all.length; i < l; i++) {
this.event = type;
this._all[i].apply(this, args);
}
}
// If there is no 'error' event listener then throw.
if (type === 'error') {
if (!this._all &&
!this._events.error &&
!(this.wildcard && this.listenerTree.error)) {
if (arguments[1] instanceof Error) {
throw arguments[1]; // Unhandled 'error' event
} else {
throw new Error("Uncaught, unspecified 'error' event.");
}
return false;
}
}
var handler;
if(this.wildcard) {
handler = [];
var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
searchListenerTree.call(this, handler, ns, this.listenerTree, 0);
}
else {
handler = this._events[type];
}
if (typeof handler === 'function') {
this.event = type;
if (arguments.length === 1) {
handler.call(this);
}
else if (arguments.length > 1)
switch (arguments.length) {
case 2:
handler.call(this, arguments[1]);
break;
case 3:
handler.call(this, arguments[1], arguments[2]);
break;
// slower
default:
var l = arguments.length;
var args = new Array(l - 1);
for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
handler.apply(this, args);
}
return true;
}
else if (handler) {
var l = arguments.length;
var args = new Array(l - 1);
for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
var listeners = handler.slice();
for (var i = 0, l = listeners.length; i < l; i++) {
this.event = type;
listeners[i].apply(this, args);
}
return (listeners.length > 0) || this._all;
}
else {
return this._all;
}
};
EventEmitter.prototype.on = function(type, listener) {
if (typeof type === 'function') {
this.onAny(type);
return this;
}
if (typeof listener !== 'function') {
throw new Error('on only accepts instances of Function');
}
this._events || init.call(this);
// To avoid recursion in the case that type == "newListeners"! Before
// adding it to the listeners, first emit "newListeners".
this.emit('newListener', type, listener);
if(this.wildcard) {
growListenerTree.call(this, type, listener);
return this;
}
if (!this._events[type]) {
// Optimize the case of one listener. Don't need the extra array object.
this._events[type] = listener;
}
else if(typeof this._events[type] === 'function') {
// Adding the second element, need to change to array.
this._events[type] = [this._events[type], listener];
}
else if (isArray(this._events[type])) {
// If we've already got an array, just append.
this._events[type].push(listener);
// Check for listener leak
if (!this._events[type].warned) {
var m = defaultMaxListeners;
if (typeof this._events.maxListeners !== 'undefined') {
m = this._events.maxListeners;
}
if (m > 0 && this._events[type].length > m) {
this._events[type].warned = true;
console.error('(node) warning: possible EventEmitter memory ' +
'leak detected. %d listeners added. ' +
'Use emitter.setMaxListeners() to increase limit.',
this._events[type].length);
console.trace();
}
}
}
return this;
};
EventEmitter.prototype.onAny = function(fn) {
if(!this._all) {
this._all = [];
}
if (typeof fn !== 'function') {
throw new Error('onAny only accepts instances of Function');
}
// Add the function to the event listener collection.
this._all.push(fn);
return this;
};
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
EventEmitter.prototype.off = function(type, listener) {
if (typeof listener !== 'function') {
throw new Error('removeListener only takes instances of Function');
}
var handlers,leafs=[];
if(this.wildcard) {
var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
}
else {
// does not use listeners(), so no side effect of creating _events[type]
if (!this._events[type]) return this;
handlers = this._events[type];
leafs.push({_listeners:handlers});
}
for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) {
var leaf = leafs[iLeaf];
handlers = leaf._listeners;
if (isArray(handlers)) {
var position = -1;
for (var i = 0, length = handlers.length; i < length; i++) {
if (handlers[i] === listener ||
(handlers[i].listener && handlers[i].listener === listener) ||
(handlers[i]._origin && handlers[i]._origin === listener)) {
position = i;
break;
}
}
if (position < 0) {
return this;
}
if(this.wildcard) {
leaf._listeners.splice(position, 1)
}
else {
this._events[type].splice(position, 1);
}
if (handlers.length === 0) {
if(this.wildcard) {
delete leaf._listeners;
}
else {
delete this._events[type];
}
}
}
else if (handlers === listener ||
(handlers.listener && handlers.listener === listener) ||
(handlers._origin && handlers._origin === listener)) {
if(this.wildcard) {
delete leaf._listeners;
}
else {
delete this._events[type];
}
}
}
return this;
};
EventEmitter.prototype.offAny = function(fn) {
var i = 0, l = 0, fns;
if (fn && this._all && this._all.length > 0) {
fns = this._all;
for(i = 0, l = fns.length; i < l; i++) {
if(fn === fns[i]) {
fns.splice(i, 1);
return this;
}
}
} else {
this._all = [];
}
return this;
};
EventEmitter.prototype.removeListener = EventEmitter.prototype.off;
EventEmitter.prototype.removeAllListeners = function(type) {
if (arguments.length === 0) {
!this._events || init.call(this);
return this;
}
if(this.wildcard) {
var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
var leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) {
var leaf = leafs[iLeaf];
leaf._listeners = null;
}
}
else {
if (!this._events[type]) return this;
this._events[type] = null;
}
return this;
};
EventEmitter.prototype.listeners = function(type) {
if(this.wildcard) {
var handlers = [];
var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
searchListenerTree.call(this, handlers, ns, this.listenerTree, 0);
return handlers;
}
this._events || init.call(this);
if (!this._events[type]) this._events[type] = [];
if (!isArray(this._events[type])) {
this._events[type] = [this._events[type]];
}
return this._events[type];
};
EventEmitter.prototype.listenersAny = function() {
if(this._all) {
return this._all;
}
else {
return [];
}
};
// if (typeof define === 'function' && define.amd) {
// define('EventEmitter2', [], function() {
// return EventEmitter;
// });
// } else {
exports.EventEmitter2 = EventEmitter;
// }
}(typeof process !== 'undefined' && typeof process.title !== 'undefined' && typeof exports !== 'undefined' ? exports : window);
/*!
* Øyvind Sean Kinsey and others require the following notice to accompany easyXDM:
*
* http://easyxdm.net/
* Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
(function (window, document, location, setTimeout, decodeURIComponent, encodeURIComponent) {
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global JSON, XMLHttpRequest, window, escape, unescape, ActiveXObject */
var global = this;
var channelId = Math.floor(Math.random() * 10000); // randomize the initial id in case of multiple closures loaded
var emptyFn = Function.prototype;
var reURI = /^((http.?:)\/\/([^:\/\s]+)(:\d+)*)/; // returns groups for protocol (2), domain (3) and port (4)
var reParent = /[\-\w]+\/\.\.\//; // matches a foo/../ expression
var reDoubleSlash = /([^:])\/\//g; // matches // anywhere but in the protocol
var namespace = ""; // stores namespace under which easyXDM object is stored on the page (empty if object is global)
var easyXDM = {};
var _easyXDM = window.easyXDM; // map over global easyXDM in case of overwrite
var IFRAME_PREFIX = "easyXDM_";
var HAS_NAME_PROPERTY_BUG;
var useHash = false; // whether to use the hash over the query
var flashVersion; // will be set if using flash
var HAS_FLASH_THROTTLED_BUG;
// http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting
function isHostMethod(object, property){
var t = typeof object[property];
return t == 'function' ||
(!!(t == 'object' && object[property])) ||
t == 'unknown';
}
function isHostObject(object, property){
return !!(typeof(object[property]) == 'object' && object[property]);
}
// end
// http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
function isArray(o){
return Object.prototype.toString.call(o) === '[object Array]';
}
// end
function hasFlash(){
try {
var activeX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
flashVersion = Array.prototype.slice.call(activeX.GetVariable("$version").match(/(\d+),(\d+),(\d+),(\d+)/), 1);
HAS_FLASH_THROTTLED_BUG = parseInt(flashVersion[0], 10) > 9 && parseInt(flashVersion[1], 10) > 0;
activeX = null;
return true;
}
catch (notSupportedException) {
return false;
}
}
/*
* Cross Browser implementation for adding and removing event listeners.
*/
var on, un;
if (isHostMethod(window, "addEventListener")) {
on = function(target, type, listener){
target.addEventListener(type, listener, false);
};
un = function(target, type, listener){
target.removeEventListener(type, listener, false);
};
}
else if (isHostMethod(window, "attachEvent")) {
on = function(object, sEvent, fpNotify){
object.attachEvent("on" + sEvent, fpNotify);
};
un = function(object, sEvent, fpNotify){
object.detachEvent("on" + sEvent, fpNotify);
};
}
else {
throw new Error("Browser not supported");
}
/*
* Cross Browser implementation of DOMContentLoaded.
*/
var domIsReady = false, domReadyQueue = [], readyState;
if ("readyState" in document) {
// If browser is WebKit-powered, check for both 'loaded' (legacy browsers) and
// 'interactive' (HTML5 specs, recent WebKit builds) states.
// https://bugs.webkit.org/show_bug.cgi?id=45119
readyState = document.readyState;
domIsReady = readyState == "complete" || (~ navigator.userAgent.indexOf('AppleWebKit/') && (readyState == "loaded" || readyState == "interactive"));
}
else {
// If readyState is not supported in the browser, then in order to be able to fire whenReady functions apropriately
// when added dynamically _after_ DOM load, we have to deduce wether the DOM is ready or not.
// We only need a body to add elements to, so the existence of document.body is enough for us.
domIsReady = !!document.body;
}
function dom_onReady(){
if (domIsReady) {
return;
}
domIsReady = true;
for (var i = 0; i < domReadyQueue.length; i++) {
domReadyQueue[i]();
}
domReadyQueue.length = 0;
}
if (!domIsReady) {
if (isHostMethod(window, "addEventListener")) {
on(document, "DOMContentLoaded", dom_onReady);
}
else {
on(document, "readystatechange", function(){
if (document.readyState == "complete") {
dom_onReady();
}
});
if (document.documentElement.doScroll && window === top) {
var doScrollCheck = function(){
if (domIsReady) {
return;
}
// http://javascript.nwbox.com/IEContentLoaded/
try {
document.documentElement.doScroll("left");
}
catch (e) {
setTimeout(doScrollCheck, 1);
return;
}
dom_onReady();
};
doScrollCheck();
}
}
// A fallback to window.onload, that will always work
on(window, "load", dom_onReady);
}
/**
* This will add a function to the queue of functions to be run once the DOM reaches a ready state.
* If functions are added after this event then they will be executed immediately.
* @param {function} fn The function to add
* @param {Object} scope An optional scope for the function to be called with.
*/
function whenReady(fn, scope){
if (domIsReady) {
fn.call(scope);
return;
}
domReadyQueue.push(function(){
fn.call(scope);
});
}
/**
* Returns an instance of easyXDM from the parent window with
* respect to the namespace.
*
* @return An instance of easyXDM (in the parent window)
*/
function getParentObject(){
var obj = parent;
if (namespace !== "") {
for (var i = 0, ii = namespace.split("."); i < ii.length; i++) {
obj = obj[ii[i]];
}
}
return obj.easyXDM;
}
/**
* Removes easyXDM variable from the global scope. It also returns control
* of the easyXDM variable to whatever code used it before.
*
* @param {String} ns A string representation of an object that will hold
* an instance of easyXDM.
* @return An instance of easyXDM
*/
function noConflict(ns){
window.easyXDM = _easyXDM;
namespace = ns;
if (namespace) {
IFRAME_PREFIX = "easyXDM_" + namespace.replace(".", "_") + "_";
}
return easyXDM;
}
/*
* Methods for working with URLs
*/
/**
* Get the domain name from a url.
* @param {String} url The url to extract the domain from.
* @return The domain part of the url.
* @type {String}
*/
function getDomainName(url){
return url.match(reURI)[3];
}
/**
* Get the port for a given URL, or "" if none
* @param {String} url The url to extract the port from.
* @return The port part of the url.
* @type {String}
*/
function getPort(url){
return url.match(reURI)[4] || "";
}
/**
* Returns a string containing the schema, domain and if present the port
* @param {String} url The url to extract the location from
* @return {String} The location part of the url
*/
function getLocation(url){
var m = url.toLowerCase().match(reURI);
var proto = m[2], domain = m[3], port = m[4] || "";
if ((proto == "http:" && port == ":80") || (proto == "https:" && port == ":443")) {
port = "";
}
return proto + "//" + domain + port;
}
/**
* Resolves a relative url into an absolute one.
* @param {String} url The path to resolve.
* @return {String} The resolved url.
*/
function resolveUrl(url){
// replace all // except the one in proto with /
url = url.replace(reDoubleSlash, "$1/");
// If the url is a valid url we do nothing
if (!url.match(/^(http||https):\/\//)) {
// If this is a relative path
var path = (url.substring(0, 1) === "/") ? "" : location.pathname;
if (path.substring(path.length - 1) !== "/") {
path = path.substring(0, path.lastIndexOf("/") + 1);
}
url = location.protocol + "//" + location.host + path + url;
}
// reduce all 'xyz/../' to just ''
while (reParent.test(url)) {
url = url.replace(reParent, "");
}
return url;
}
/**
* Appends the parameters to the given url.<br/>
* The base url can contain existing query parameters.
* @param {String} url The base url.
* @param {Object} parameters The parameters to add.
* @return {String} A new valid url with the parameters appended.
*/
function appendQueryParameters(url, parameters){
var hash = "", indexOf = url.indexOf("#");
if (indexOf !== -1) {
hash = url.substring(indexOf);
url = url.substring(0, indexOf);
}
var q = [];
for (var key in parameters) {
if (parameters.hasOwnProperty(key)) {
q.push(key + "=" + encodeURIComponent(parameters[key]));
}
}
return url + (useHash ? "#" : (url.indexOf("?") == -1 ? "?" : "&")) + q.join("&") + hash;
}
// build the query object either from location.query, if it contains the xdm_e argument, or from location.hash
var query = (function(input){
input = input.substring(1).split("&");
var data = {}, pair, i = input.length;
while (i--) {
pair = input[i].split("=");
data[pair[0]] = decodeURIComponent(pair[1]);
}
return data;
}(/xdm_e=/.test(location.search) ? location.search : location.hash));
/*
* Helper methods
*/
/**
* Helper for checking if a variable/property is undefined
* @param {Object} v The variable to test
* @return {Boolean} True if the passed variable is undefined
*/
function undef(v){
return typeof v === "undefined";
}
/**
* A safe implementation of HTML5 JSON. Feature testing is used to make sure the implementation works.
* @return {JSON} A valid JSON conforming object, or null if not found.
*/
var getJSON = function(){
var cached = {};
var obj = {
a: [1, 2, 3]
}, json = "{\"a\":[1,2,3]}";
if (typeof JSON != "undefined" && typeof JSON.stringify === "function" && JSON.stringify(obj).replace((/\s/g), "") === json) {
// this is a working JSON instance
return JSON;
}
if (Object.toJSON) {
if (Object.toJSON(obj).replace((/\s/g), "") === json) {
// this is a working stringify method
cached.stringify = Object.toJSON;
}
}
if (typeof String.prototype.evalJSON === "function") {
obj = json.evalJSON();
if (obj.a && obj.a.length === 3 && obj.a[2] === 3) {
// this is a working parse method
cached.parse = function(str){
return str.evalJSON();
};
}
}
if (cached.stringify && cached.parse) {
// Only memoize the result if we have valid instance
getJSON = function(){
return cached;
};
return cached;
}
return null;
};
/**
* Applies properties from the source object to the target object.<br/>
* @param {Object} target The target of the properties.
* @param {Object} source The source of the properties.
* @param {Boolean} noOverwrite Set to True to only set non-existing properties.
*/
function apply(destination, source, noOverwrite){
var member;
for (var prop in source) {
if (source.hasOwnProperty(prop)) {
if (prop in destination) {
member = source[prop];
if (typeof member === "object") {
apply(destination[prop], member, noOverwrite);
}
else if (!noOverwrite) {
destination[prop] = source[prop];
}
}
else {
destination[prop] = source[prop];
}
}
}
return destination;
}
// This tests for the bug in IE where setting the [name] property using javascript causes the value to be redirected into [submitName].
function testForNamePropertyBug(){
var form = document.body.appendChild(document.createElement("form")), input = form.appendChild(document.createElement("input"));
input.name = IFRAME_PREFIX + "TEST" + channelId; // append channelId in order to avoid caching issues
HAS_NAME_PROPERTY_BUG = input !== form.elements[input.name];
document.body.removeChild(form);
}
/**
* Creates a frame and appends it to the DOM.
* @param config {object} This object can have the following properties
* <ul>
* <li> {object} prop The properties that should be set on the frame. This should include the 'src' property.</li>
* <li> {object} attr The attributes that should be set on the frame.</li>
* <li> {DOMElement} container Its parent element (Optional).</li>
* <li> {function} onLoad A method that should be called with the frames contentWindow as argument when the frame is fully loaded. (Optional)</li>
* </ul>
* @return The frames DOMElement
* @type DOMElement
*/
function createFrame(config){
if (undef(HAS_NAME_PROPERTY_BUG)) {
testForNamePropertyBug();
}
var frame;
// This is to work around the problems in IE6/7 with setting the name property.
// Internally this is set as 'submitName' instead when using 'iframe.name = ...'
// This is not required by easyXDM itself, but is to facilitate other use cases
if (HAS_NAME_PROPERTY_BUG) {
frame = document.createElement("<iframe name=\"" + config.props.name + "\"/>");
}
else {
frame = document.createElement("IFRAME");
frame.name = config.props.name;
}
frame.id = frame.name = config.props.name;
delete config.props.name;
if (config.onLoad) {
on(frame, "load", config.onLoad);
}
if (typeof config.container == "string") {
config.container = document.getElementById(config.container);
}
if (!config.container) {
// This needs to be hidden like this, simply setting display:none and the like will cause failures in some browsers.
apply(frame.style, {
position: "absolute",
top: "-2000px"
});
config.container = document.body;
}
// HACK for some reason, IE needs the source set
// after the frame has been appended into the DOM
// so remove the src, and set it afterwards
var src = config.props.src;
delete config.props.src;
// transfer properties to the frame
apply(frame, config.props);
frame.border = frame.frameBorder = 0;
frame.allowTransparency = true;
config.container.appendChild(frame);
// HACK see above
frame.src = src;
config.props.src = src;
return frame;
}
/**
* Check whether a domain is allowed using an Access Control List.
* The ACL can contain * and ? as wildcards, or can be regular expressions.
* If regular expressions they need to begin with ^ and end with $.
* @param {Array/String} acl The list of allowed domains
* @param {String} domain The domain to test.
* @return {Boolean} True if the domain is allowed, false if not.
*/
function checkAcl(acl, domain){
// normalize into an array
if (typeof acl == "string") {
acl = [acl];
}
var re, i = acl.length;
while (i--) {
re = acl[i];
re = new RegExp(re.substr(0, 1) == "^" ? re : ("^" + re.replace(/(\*)/g, ".$1").replace(/\?/g, ".") + "$"));
if (re.test(domain)) {
return true;
}
}
return false;
}
/*
* Functions related to stacks
*/
/**
* Prepares an array of stack-elements suitable for the current configuration
* @param {Object} config The Transports configuration. See easyXDM.Socket for more.
* @return {Array} An array of stack-elements with the TransportElement at index 0.
*/
function prepareTransportStack(config){
var protocol = config.protocol, stackEls;
config.isHost = config.isHost || undef(query.xdm_p);
useHash = config.hash || false;
if (!config.props) {
config.props = {};
}
if (!config.isHost) {
config.channel = query.xdm_c;
config.secret = query.xdm_s;
config.remote = query.xdm_e;
protocol = query.xdm_p;
if (config.acl && !checkAcl(config.acl, config.remote)) {
throw new Error("Access denied for " + config.remote);
}
}
else {
config.remote = resolveUrl(config.remote);
config.channel = config.channel || "default" + channelId++;
config.secret = Math.random().toString(16).substring(2);
if (undef(protocol)) {
if (getLocation(location.href) == getLocation(config.remote)) {
/*
* Both documents has the same origin, lets use direct access.
*/
protocol = "4";
}
else if (isHostMethod(window, "postMessage") || isHostMethod(document, "postMessage")) {
/*
* This is supported in IE8+, Firefox 3+, Opera 9+, Chrome 2+ and Safari 4+
*/
protocol = "1";
}
else if (config.swf && isHostMethod(window, "ActiveXObject") && hasFlash()) {
/*
* The Flash transport superseedes the NixTransport as the NixTransport has been blocked by MS
*/
protocol = "6";
}
else if (navigator.product === "Gecko" && "frameElement" in window && navigator.userAgent.indexOf('WebKit') == -1) {
/*
* This is supported in Gecko (Firefox 1+)
*/
protocol = "5";
}
else if (config.remoteHelper) {
/*
* This is supported in all browsers that retains the value of window.name when
* navigating from one domain to another, and where parent.frames[foo] can be used
* to get access to a frame from the same domain
*/
config.remoteHelper = resolveUrl(config.remoteHelper);
protocol = "2";
}
else {
/*
* This is supported in all browsers where [window].location is writable for all
* The resize event will be used if resize is supported and the iframe is not put
* into a container, else polling will be used.
*/
protocol = "0";
}
}
}
config.protocol = protocol; // for conditional branching
switch (protocol) {
case "0":// 0 = HashTransport
apply(config, {
interval: 100,
delay: 2000,
useResize: true,
useParent: false,
usePolling: false
}, true);
if (config.isHost) {
if (!config.local) {
// If no local is set then we need to find an image hosted on the current domain
var domain = location.protocol + "//" + location.host, images = document.body.getElementsByTagName("img"), image;
var i = images.length;
while (i--) {
image = images[i];
if (image.src.substring(0, domain.length) === domain) {
config.local = image.src;
break;
}
}
if (!config.local) {
// If no local was set, and we are unable to find a suitable file, then we resort to using the current window
config.local = window;
}
}
var parameters = {
xdm_c: config.channel,
xdm_p: 0
};
if (config.local === window) {
// We are using the current window to listen to
config.usePolling = true;
config.useParent = true;
config.local = location.protocol + "//" + location.host + location.pathname + location.search;
parameters.xdm_e = config.local;
parameters.xdm_pa = 1; // use parent
}
else {
parameters.xdm_e = resolveUrl(config.local);
}
if (config.container) {
config.useResize = false;
parameters.xdm_po = 1; // use polling
}
config.remote = appendQueryParameters(config.remote, parameters);
}
else {
apply(config, {
channel: query.xdm_c,
remote: query.xdm_e,
useParent: !undef(query.xdm_pa),
usePolling: !undef(query.xdm_po),
useResize: config.useParent ? false : config.useResize
});
}
stackEls = [new easyXDM.stack.HashTransport(config), new easyXDM.stack.ReliableBehavior({}), new easyXDM.stack.QueueBehavior({
encode: true,
maxLength: 4000 - config.remote.length
}), new easyXDM.stack.VerifyBehavior({
initiate: config.isHost
})];
break;
case "1":
stackEls = [new easyXDM.stack.PostMessageTransport(config)];
break;
case "2":
stackEls = [new easyXDM.stack.NameTransport(config), new easyXDM.stack.QueueBehavior(), new easyXDM.stack.VerifyBehavior({
initiate: config.isHost
})];
break;
case "3":
stackEls = [new easyXDM.stack.NixTransport(config)];
break;
case "4":
stackEls = [new easyXDM.stack.SameOriginTransport(config)];
break;
case "5":
stackEls = [new easyXDM.stack.FrameElementTransport(config)];
break;
case "6":
if (!flashVersion) {
hasFlash();
}
stackEls = [new easyXDM.stack.FlashTransport(config)];
break;
}
// this behavior is responsible for buffering outgoing messages, and for performing lazy initialization
stackEls.push(new easyXDM.stack.QueueBehavior({
lazy: config.lazy,
remove: true
}));
return stackEls;
}
/**
* Chains all the separate stack elements into a single usable stack.<br/>
* If an element is missing a necessary method then it will have a pass-through method applied.
* @param {Array} stackElements An array of stack elements to be linked.
* @return {easyXDM.stack.StackElement} The last element in the chain.
*/
function chainStack(stackElements){
var stackEl, defaults = {
incoming: function(message, origin){
this.up.incoming(message, origin);
},
outgoing: function(message, recipient){
this.down.outgoing(message, recipient);
},
callback: function(success){
this.up.callback(success);
},
init: function(){
this.down.init();
},
destroy: function(){
this.down.destroy();
}
};
for (var i = 0, len = stackElements.length; i < len; i++) {
stackEl = stackElements[i];
apply(stackEl, defaults, true);
if (i !== 0) {
stackEl.down = stackElements[i - 1];
}
if (i !== len - 1) {
stackEl.up = stackElements[i + 1];
}
}
return stackEl;
}
/**
* This will remove a stackelement from its stack while leaving the stack functional.
* @param {Object} element The elment to remove from the stack.
*/
function removeFromStack(element){
element.up.down = element.down;
element.down.up = element.up;
element.up = element.down = null;
}
/*
* Export the main object and any other methods applicable
*/
/**
* @class easyXDM
* A javascript library providing cross-browser, cross-domain messaging/RPC.
* @version 2.4.15.118
* @singleton
*/
apply(easyXDM, {
/**
* The version of the library
* @type {string}
*/
version: "2.4.15.118",
/**
* This is a map containing all the query parameters passed to the document.
* All the values has been decoded using decodeURIComponent.
* @type {object}
*/
query: query,
/**
* @private
*/
stack: {},
/**
* Applies properties from the source object to the target object.<br/>
* @param {object} target The target of the properties.
* @param {object} source The source of the properties.
* @param {boolean} noOverwrite Set to True to only set non-existing properties.
*/
apply: apply,
/**
* A safe implementation of HTML5 JSON. Feature testing is used to make sure the implementation works.
* @return {JSON} A valid JSON conforming object, or null if not found.
*/
getJSONObject: getJSON,
/**
* This will add a function to the queue of functions to be run once the DOM reaches a ready state.
* If functions are added after this event then they will be executed immediately.
* @param {function} fn The function to add
* @param {object} scope An optional scope for the function to be called with.
*/
whenReady: whenReady,
/**
* Removes easyXDM variable from the global scope. It also returns control
* of the easyXDM variable to whatever code used it before.
*
* @param {String} ns A string representation of an object that will hold
* an instance of easyXDM.
* @return An instance of easyXDM
*/
noConflict: noConflict
});
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global console, _FirebugCommandLine, easyXDM, window, escape, unescape, isHostObject, undef, _trace, domIsReady, emptyFn, namespace */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, isHostObject, isHostMethod, un, on, createFrame, debug */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.DomHelper
* Contains methods for dealing with the DOM
* @singleton
*/
easyXDM.DomHelper = {
/**
* Provides a consistent interface for adding eventhandlers
* @param {Object} target The target to add the event to
* @param {String} type The name of the event
* @param {Function} listener The listener
*/
on: on,
/**
* Provides a consistent interface for removing eventhandlers
* @param {Object} target The target to remove the event from
* @param {String} type The name of the event
* @param {Function} listener The listener
*/
un: un,
/**
* Checks for the presence of the JSON object.
* If it is not present it will use the supplied path to load the JSON2 library.
* This should be called in the documents head right after the easyXDM script tag.
* http://json.org/json2.js
* @param {String} path A valid path to json2.js
*/
requiresJSON: function(path){
if (!isHostObject(window, "JSON")) {
// we need to encode the < in order to avoid an illegal token error
// when the script is inlined in a document.
document.write('<' + 'script type="text/javascript" src="' + path + '"><' + '/script>');
}
}
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, debug */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
(function(){
// The map containing the stored functions
var _map = {};
/**
* @class easyXDM.Fn
* This contains methods related to function handling, such as storing callbacks.
* @singleton
* @namespace easyXDM
*/
easyXDM.Fn = {
/**
* Stores a function using the given name for reference
* @param {String} name The name that the function should be referred by
* @param {Function} fn The function to store
* @namespace easyXDM.fn
*/
set: function(name, fn){
_map[name] = fn;
},
/**
* Retrieves the function referred to by the given name
* @param {String} name The name of the function to retrieve
* @param {Boolean} del If the function should be deleted after retrieval
* @return {Function} The stored function
* @namespace easyXDM.fn
*/
get: function(name, del){
var fn = _map[name];
if (del) {
delete _map[name];
}
return fn;
}
};
}());
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, chainStack, prepareTransportStack, getLocation, debug */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.Socket
* This class creates a transport channel between two domains that is usable for sending and receiving string-based messages.<br/>
* The channel is reliable, supports queueing, and ensures that the message originates from the expected domain.<br/>
* Internally different stacks will be used depending on the browsers features and the available parameters.
* <h2>How to set up</h2>
* Setting up the provider:
* <pre><code>
* var socket = new easyXDM.Socket({
* local: "name.html",
* onReady: function(){
* // you need to wait for the onReady callback before using the socket
* socket.postMessage("foo-message");
* },
* onMessage: function(message, origin) {
* alert("received " + message + " from " + origin);
* }
* });
* </code></pre>
* Setting up the consumer:
* <pre><code>
* var socket = new easyXDM.Socket({
* remote: "http://remotedomain/page.html",
* remoteHelper: "http://remotedomain/name.html",
* onReady: function(){
* // you need to wait for the onReady callback before using the socket
* socket.postMessage("foo-message");
* },
* onMessage: function(message, origin) {
* alert("received " + message + " from " + origin);
* }
* });
* </code></pre>
* If you are unable to upload the <code>name.html</code> file to the consumers domain then remove the <code>remoteHelper</code> property
* and easyXDM will fall back to using the HashTransport instead of the NameTransport when not able to use any of the primary transports.
* @namespace easyXDM
* @constructor
* @cfg {String/Window} local The url to the local name.html document, a local static file, or a reference to the local window.
* @cfg {Boolean} lazy (Consumer only) Set this to true if you want easyXDM to defer creating the transport until really needed.
* @cfg {String} remote (Consumer only) The url to the providers document.
* @cfg {String} remoteHelper (Consumer only) The url to the remote name.html file. This is to support NameTransport as a fallback. Optional.
* @cfg {Number} delay The number of milliseconds easyXDM should try to get a reference to the local window. Optional, defaults to 2000.
* @cfg {Number} interval The interval used when polling for messages. Optional, defaults to 300.
* @cfg {String} channel (Consumer only) The name of the channel to use. Can be used to set consistent iframe names. Must be unique. Optional.
* @cfg {Function} onMessage The method that should handle incoming messages.<br/> This method should accept two arguments, the message as a string, and the origin as a string. Optional.
* @cfg {Function} onReady A method that should be called when the transport is ready. Optional.
* @cfg {DOMElement|String} container (Consumer only) The element, or the id of the element that the primary iframe should be inserted into. If not set then the iframe will be positioned off-screen. Optional.
* @cfg {Array/String} acl (Provider only) Here you can specify which '[protocol]://[domain]' patterns that should be allowed to act as the consumer towards this provider.<br/>
* This can contain the wildcards ? and *. Examples are 'http://example.com', '*.foo.com' and '*dom?.com'. If you want to use reqular expressions then you pattern needs to start with ^ and end with $.
* If none of the patterns match an Error will be thrown.
* @cfg {Object} props (Consumer only) Additional properties that should be applied to the iframe. This can also contain nested objects e.g: <code>{style:{width:"100px", height:"100px"}}</code>.
* Properties such as 'name' and 'src' will be overrided. Optional.
*/
easyXDM.Socket = function(config){
// create the stack
var stack = chainStack(prepareTransportStack(config).concat([{
incoming: function(message, origin){
config.onMessage(message, origin);
},
callback: function(success){
if (config.onReady) {
config.onReady(success);
}
}
}])), recipient = getLocation(config.remote);
// set the origin
this.origin = getLocation(config.remote);
/**
* Initiates the destruction of the stack.
*/
this.destroy = function(){
stack.destroy();
};
/**
* Posts a message to the remote end of the channel
* @param {String} message The message to send
*/
this.postMessage = function(message){
stack.outgoing(message, recipient);
};
stack.init();
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, undef,, chainStack, prepareTransportStack, debug, getLocation */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.Rpc
* Creates a proxy object that can be used to call methods implemented on the remote end of the channel, and also to provide the implementation
* of methods to be called from the remote end.<br/>
* The instantiated object will have methods matching those specified in <code>config.remote</code>.<br/>
* This requires the JSON object present in the document, either natively, using json.org's json2 or as a wrapper around library spesific methods.
* <h2>How to set up</h2>
* <pre><code>
* var rpc = new easyXDM.Rpc({
* // this configuration is equal to that used by the Socket.
* remote: "http://remotedomain/...",
* onReady: function(){
* // you need to wait for the onReady callback before using the proxy
* rpc.foo(...
* }
* },{
* local: {..},
* remote: {..}
* });
* </code></pre>
*
* <h2>Exposing functions (procedures)</h2>
* <pre><code>
* var rpc = new easyXDM.Rpc({
* ...
* },{
* local: {
* nameOfMethod: {
* method: function(arg1, arg2, success, error){
* ...
* }
* },
* // with shorthand notation
* nameOfAnotherMethod: function(arg1, arg2, success, error){
* }
* },
* remote: {...}
* });
* </code></pre>
* The function referenced by [method] will receive the passed arguments followed by the callback functions <code>success</code> and <code>error</code>.<br/>
* To send a successfull result back you can use
* <pre><code>
* return foo;
* </pre></code>
* or
* <pre><code>
* success(foo);
* </pre></code>
* To return an error you can use
* <pre><code>
* throw new Error("foo error");
* </code></pre>
* or
* <pre><code>
* error("foo error");
* </code></pre>
*
* <h2>Defining remotely exposed methods (procedures/notifications)</h2>
* The definition of the remote end is quite similar:
* <pre><code>
* var rpc = new easyXDM.Rpc({
* ...
* },{
* local: {...},
* remote: {
* nameOfMethod: {}
* }
* });
* </code></pre>
* To call a remote method use
* <pre><code>
* rpc.nameOfMethod("arg1", "arg2", function(value) {
* alert("success: " + value);
* }, function(message) {
* alert("error: " + message + );
* });
* </code></pre>
* Both the <code>success</code> and <code>errror</code> callbacks are optional.<br/>
* When called with no callback a JSON-RPC 2.0 notification will be executed.
* Be aware that you will not be notified of any errors with this method.
* <br/>
* <h2>Specifying a custom serializer</h2>
* If you do not want to use the JSON2 library for non-native JSON support, but instead capabilities provided by some other library
* then you can specify a custom serializer using <code>serializer: foo</code>
* <pre><code>
* var rpc = new easyXDM.Rpc({
* ...
* },{
* local: {...},
* remote: {...},
* serializer : {
* parse: function(string){ ... },
* stringify: function(object) {...}
* }
* });
* </code></pre>
* If <code>serializer</code> is set then the class will not attempt to use the native implementation.
* @namespace easyXDM
* @constructor
* @param {Object} config The underlying transports configuration. See easyXDM.Socket for available parameters.
* @param {Object} jsonRpcConfig The description of the interface to implement.
*/
easyXDM.Rpc = function(config, jsonRpcConfig){
// expand shorthand notation
if (jsonRpcConfig.local) {
for (var method in jsonRpcConfig.local) {
if (jsonRpcConfig.local.hasOwnProperty(method)) {
var member = jsonRpcConfig.local[method];
if (typeof member === "function") {
jsonRpcConfig.local[method] = {
method: member
};
}
}
}
}
// create the stack
var stack = chainStack(prepareTransportStack(config).concat([new easyXDM.stack.RpcBehavior(this, jsonRpcConfig), {
callback: function(success){
if (config.onReady) {
config.onReady(success);
}
}
}]));
// set the origin
this.origin = getLocation(config.remote);
/**
* Initiates the destruction of the stack.
*/
this.destroy = function(){
stack.destroy();
};
stack.init();
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, un, on, apply, whenReady, getParentObject, IFRAME_PREFIX*/
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.SameOriginTransport
* SameOriginTransport is a transport class that can be used when both domains have the same origin.<br/>
* This can be useful for testing and for when the main application supports both internal and external sources.
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The transports configuration.
* @cfg {String} remote The remote document to communicate with.
*/
easyXDM.stack.SameOriginTransport = function(config){
var pub, frame, send, targetOrigin;
return (pub = {
outgoing: function(message, domain, fn){
send(message);
if (fn) {
fn();
}
},
destroy: function(){
if (frame) {
frame.parentNode.removeChild(frame);
frame = null;
}
},
onDOMReady: function(){
targetOrigin = getLocation(config.remote);
if (config.isHost) {
// set up the iframe
apply(config.props, {
src: appendQueryParameters(config.remote, {
xdm_e: location.protocol + "//" + location.host + location.pathname,
xdm_c: config.channel,
xdm_p: 4 // 4 = SameOriginTransport
}),
name: IFRAME_PREFIX + config.channel + "_provider"
});
frame = createFrame(config);
easyXDM.Fn.set(config.channel, function(sendFn){
send = sendFn;
setTimeout(function(){
pub.up.callback(true);
}, 0);
return function(msg){
pub.up.incoming(msg, targetOrigin);
};
});
}
else {
send = getParentObject().Fn.get(config.channel, true)(function(msg){
pub.up.incoming(msg, targetOrigin);
});
setTimeout(function(){
pub.up.callback(true);
}, 0);
}
},
init: function(){
whenReady(pub.onDOMReady, pub);
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global global, easyXDM, window, getLocation, appendQueryParameters, createFrame, debug, apply, whenReady, IFRAME_PREFIX, namespace, resolveUrl, getDomainName, HAS_FLASH_THROTTLED_BUG, getPort, query*/
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.FlashTransport
* FlashTransport is a transport class that uses an SWF with LocalConnection to pass messages back and forth.
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The transports configuration.
* @cfg {String} remote The remote domain to communicate with.
* @cfg {String} secret the pre-shared secret used to secure the communication.
* @cfg {String} swf The path to the swf file
* @cfg {Boolean} swfNoThrottle Set this to true if you want to take steps to avoid beeing throttled when hidden.
* @cfg {String || DOMElement} swfContainer Set this if you want to control where the swf is placed
*/
easyXDM.stack.FlashTransport = function(config){
var pub, // the public interface
frame, send, targetOrigin, swf, swfContainer;
function onMessage(message, origin){
setTimeout(function(){
pub.up.incoming(message, targetOrigin);
}, 0);
}
/**
* This method adds the SWF to the DOM and prepares the initialization of the channel
*/
function addSwf(domain){
// the differentiating query argument is needed in Flash9 to avoid a caching issue where LocalConnection would throw an error.
var url = config.swf + "?host=" + config.isHost;
var id = "easyXDM_swf_" + Math.floor(Math.random() * 10000);
// prepare the init function that will fire once the swf is ready
easyXDM.Fn.set("flash_loaded" + domain.replace(/[\-.]/g, "_"), function(){
easyXDM.stack.FlashTransport[domain].swf = swf = swfContainer.firstChild;
var queue = easyXDM.stack.FlashTransport[domain].queue;
for (var i = 0; i < queue.length; i++) {
queue[i]();
}
queue.length = 0;
});
if (config.swfContainer) {
swfContainer = (typeof config.swfContainer == "string") ? document.getElementById(config.swfContainer) : config.swfContainer;
}
else {
// create the container that will hold the swf
swfContainer = document.createElement('div');
// http://bugs.adobe.com/jira/browse/FP-4796
// http://tech.groups.yahoo.com/group/flexcoders/message/162365
// https://groups.google.com/forum/#!topic/easyxdm/mJZJhWagoLc
apply(swfContainer.style, HAS_FLASH_THROTTLED_BUG && config.swfNoThrottle ? {
height: "20px",
width: "20px",
position: "fixed",
right: 0,
top: 0
} : {
height: "1px",
width: "1px",
position: "absolute",
overflow: "hidden",
right: 0,
top: 0
});
document.body.appendChild(swfContainer);
}
// create the object/embed
var flashVars = "callback=flash_loaded" + domain.replace(/[\-.]/g, "_") + "&proto=" + global.location.protocol + "&domain=" + getDomainName(global.location.href) + "&port=" + getPort(global.location.href) + "&ns=" + namespace;
swfContainer.innerHTML = "<object height='20' width='20' type='application/x-shockwave-flash' id='" + id + "' data='" + url + "'>" +
"<param name='allowScriptAccess' value='always'></param>" +
"<param name='wmode' value='transparent'>" +
"<param name='movie' value='" +
url +
"'></param>" +
"<param name='flashvars' value='" +
flashVars +
"'></param>" +
"<embed type='application/x-shockwave-flash' FlashVars='" +
flashVars +
"' allowScriptAccess='always' wmode='transparent' src='" +
url +
"' height='1' width='1'></embed>" +
"</object>";
}
return (pub = {
outgoing: function(message, domain, fn){
swf.postMessage(config.channel, message.toString());
if (fn) {
fn();
}
},
destroy: function(){
try {
swf.destroyChannel(config.channel);
}
catch (e) {
}
swf = null;
if (frame) {
frame.parentNode.removeChild(frame);
frame = null;
}
},
onDOMReady: function(){
targetOrigin = config.remote;
// Prepare the code that will be run after the swf has been intialized
easyXDM.Fn.set("flash_" + config.channel + "_init", function(){
setTimeout(function(){
pub.up.callback(true);
});
});
// set up the omMessage handler
easyXDM.Fn.set("flash_" + config.channel + "_onMessage", onMessage);
config.swf = resolveUrl(config.swf); // reports have been made of requests gone rogue when using relative paths
var swfdomain = getDomainName(config.swf);
var fn = function(){
// set init to true in case the fn was called was invoked from a separate instance
easyXDM.stack.FlashTransport[swfdomain].init = true;
swf = easyXDM.stack.FlashTransport[swfdomain].swf;
// create the channel
swf.createChannel(config.channel, config.secret, getLocation(config.remote), config.isHost);
if (config.isHost) {
// if Flash is going to be throttled and we want to avoid this
if (HAS_FLASH_THROTTLED_BUG && config.swfNoThrottle) {
apply(config.props, {
position: "fixed",
right: 0,
top: 0,
height: "20px",
width: "20px"
});
}
// set up the iframe
apply(config.props, {
src: appendQueryParameters(config.remote, {
xdm_e: getLocation(location.href),
xdm_c: config.channel,
xdm_p: 6, // 6 = FlashTransport
xdm_s: config.secret
}),
name: IFRAME_PREFIX + config.channel + "_provider"
});
frame = createFrame(config);
}
};
if (easyXDM.stack.FlashTransport[swfdomain] && easyXDM.stack.FlashTransport[swfdomain].init) {
// if the swf is in place and we are the consumer
fn();
}
else {
// if the swf does not yet exist
if (!easyXDM.stack.FlashTransport[swfdomain]) {
// add the queue to hold the init fn's
easyXDM.stack.FlashTransport[swfdomain] = {
queue: [fn]
};
addSwf(swfdomain);
}
else {
easyXDM.stack.FlashTransport[swfdomain].queue.push(fn);
}
}
},
init: function(){
whenReady(pub.onDOMReady, pub);
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, un, on, apply, whenReady, IFRAME_PREFIX*/
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.PostMessageTransport
* PostMessageTransport is a transport class that uses HTML5 postMessage for communication.<br/>
* <a href="http://msdn.microsoft.com/en-us/library/ms644944(VS.85).aspx">http://msdn.microsoft.com/en-us/library/ms644944(VS.85).aspx</a><br/>
* <a href="https://developer.mozilla.org/en/DOM/window.postMessage">https://developer.mozilla.org/en/DOM/window.postMessage</a>
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The transports configuration.
* @cfg {String} remote The remote domain to communicate with.
*/
easyXDM.stack.PostMessageTransport = function(config){
var pub, // the public interface
frame, // the remote frame, if any
callerWindow, // the window that we will call with
targetOrigin; // the domain to communicate with
/**
* Resolves the origin from the event object
* @private
* @param {Object} event The messageevent
* @return {String} The scheme, host and port of the origin
*/
function _getOrigin(event){
if (event.origin) {
// This is the HTML5 property
return getLocation(event.origin);
}
if (event.uri) {
// From earlier implementations
return getLocation(event.uri);
}
if (event.domain) {
// This is the last option and will fail if the
// origin is not using the same schema as we are
return location.protocol + "//" + event.domain;
}
throw "Unable to retrieve the origin of the event";
}
/**
* This is the main implementation for the onMessage event.<br/>
* It checks the validity of the origin and passes the message on if appropriate.
* @private
* @param {Object} event The messageevent
*/
function _window_onMessage(event){
var origin = _getOrigin(event);
if (origin == targetOrigin && event.data.substring(0, config.channel.length + 1) == config.channel + " ") {
pub.up.incoming(event.data.substring(config.channel.length + 1), origin);
}
}
return (pub = {
outgoing: function(message, domain, fn){
callerWindow.postMessage(config.channel + " " + message, domain || targetOrigin);
if (fn) {
fn();
}
},
destroy: function(){
un(window, "message", _window_onMessage);
if (frame) {
callerWindow = null;
frame.parentNode.removeChild(frame);
frame = null;
}
},
onDOMReady: function(){
targetOrigin = getLocation(config.remote);
if (config.isHost) {
// add the event handler for listening
var waitForReady = function(event){
if (event.data == config.channel + "-ready") {
// replace the eventlistener
callerWindow = ("postMessage" in frame.contentWindow) ? frame.contentWindow : frame.contentWindow.document;
un(window, "message", waitForReady);
on(window, "message", _window_onMessage);
setTimeout(function(){
pub.up.callback(true);
}, 0);
}
};
on(window, "message", waitForReady);
// set up the iframe
apply(config.props, {
src: appendQueryParameters(config.remote, {
xdm_e: getLocation(location.href),
xdm_c: config.channel,
xdm_p: 1 // 1 = PostMessage
}),
name: IFRAME_PREFIX + config.channel + "_provider"
});
frame = createFrame(config);
}
else {
// add the event handler for listening
on(window, "message", _window_onMessage);
callerWindow = ("postMessage" in window.parent) ? window.parent : window.parent.document;
callerWindow.postMessage(config.channel + "-ready", targetOrigin);
setTimeout(function(){
pub.up.callback(true);
}, 0);
}
},
init: function(){
whenReady(pub.onDOMReady, pub);
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, apply, query, whenReady, IFRAME_PREFIX*/
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.FrameElementTransport
* FrameElementTransport is a transport class that can be used with Gecko-browser as these allow passing variables using the frameElement property.<br/>
* Security is maintained as Gecho uses Lexical Authorization to determine under which scope a function is running.
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The transports configuration.
* @cfg {String} remote The remote document to communicate with.
*/
easyXDM.stack.FrameElementTransport = function(config){
var pub, frame, send, targetOrigin;
return (pub = {
outgoing: function(message, domain, fn){
send.call(this, message);
if (fn) {
fn();
}
},
destroy: function(){
if (frame) {
frame.parentNode.removeChild(frame);
frame = null;
}
},
onDOMReady: function(){
targetOrigin = getLocation(config.remote);
if (config.isHost) {
// set up the iframe
apply(config.props, {
src: appendQueryParameters(config.remote, {
xdm_e: getLocation(location.href),
xdm_c: config.channel,
xdm_p: 5 // 5 = FrameElementTransport
}),
name: IFRAME_PREFIX + config.channel + "_provider"
});
frame = createFrame(config);
frame.fn = function(sendFn){
delete frame.fn;
send = sendFn;
setTimeout(function(){
pub.up.callback(true);
}, 0);
// remove the function so that it cannot be used to overwrite the send function later on
return function(msg){
pub.up.incoming(msg, targetOrigin);
};
};
}
else {
// This is to mitigate origin-spoofing
if (document.referrer && getLocation(document.referrer) != query.xdm_e) {
window.top.location = query.xdm_e;
}
send = window.frameElement.fn(function(msg){
pub.up.incoming(msg, targetOrigin);
});
pub.up.callback(true);
}
},
init: function(){
whenReady(pub.onDOMReady, pub);
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, undef, getLocation, appendQueryParameters, resolveUrl, createFrame, debug, un, apply, whenReady, IFRAME_PREFIX*/
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.NameTransport
* NameTransport uses the window.name property to relay data.
* The <code>local</code> parameter needs to be set on both the consumer and provider,<br/>
* and the <code>remoteHelper</code> parameter needs to be set on the consumer.
* @constructor
* @param {Object} config The transports configuration.
* @cfg {String} remoteHelper The url to the remote instance of hash.html - this is only needed for the host.
* @namespace easyXDM.stack
*/
easyXDM.stack.NameTransport = function(config){
var pub; // the public interface
var isHost, callerWindow, remoteWindow, readyCount, callback, remoteOrigin, remoteUrl;
function _sendMessage(message){
var url = config.remoteHelper + (isHost ? "#_3" : "#_2") + config.channel;
callerWindow.contentWindow.sendMessage(message, url);
}
function _onReady(){
if (isHost) {
if (++readyCount === 2 || !isHost) {
pub.up.callback(true);
}
}
else {
_sendMessage("ready");
pub.up.callback(true);
}
}
function _onMessage(message){
pub.up.incoming(message, remoteOrigin);
}
function _onLoad(){
if (callback) {
setTimeout(function(){
callback(true);
}, 0);
}
}
return (pub = {
outgoing: function(message, domain, fn){
callback = fn;
_sendMessage(message);
},
destroy: function(){
callerWindow.parentNode.removeChild(callerWindow);
callerWindow = null;
if (isHost) {
remoteWindow.parentNode.removeChild(remoteWindow);
remoteWindow = null;
}
},
onDOMReady: function(){
isHost = config.isHost;
readyCount = 0;
remoteOrigin = getLocation(config.remote);
config.local = resolveUrl(config.local);
if (isHost) {
// Register the callback
easyXDM.Fn.set(config.channel, function(message){
if (isHost && message === "ready") {
// Replace the handler
easyXDM.Fn.set(config.channel, _onMessage);
_onReady();
}
});
// Set up the frame that points to the remote instance
remoteUrl = appendQueryParameters(config.remote, {
xdm_e: config.local,
xdm_c: config.channel,
xdm_p: 2
});
apply(config.props, {
src: remoteUrl + '#' + config.channel,
name: IFRAME_PREFIX + config.channel + "_provider"
});
remoteWindow = createFrame(config);
}
else {
config.remoteHelper = config.remote;
easyXDM.Fn.set(config.channel, _onMessage);
}
// Set up the iframe that will be used for the transport
callerWindow = createFrame({
props: {
src: config.local + "#_4" + config.channel
},
onLoad: function onLoad(){
// Remove the handler
var w = callerWindow || this;
un(w, "load", onLoad);
easyXDM.Fn.set(config.channel + "_load", _onLoad);
(function test(){
if (typeof w.contentWindow.sendMessage == "function") {
_onReady();
}
else {
setTimeout(test, 50);
}
}());
}
});
},
init: function(){
whenReady(pub.onDOMReady, pub);
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, getLocation, createFrame, debug, un, on, apply, whenReady, IFRAME_PREFIX*/
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.HashTransport
* HashTransport is a transport class that uses the IFrame URL Technique for communication.<br/>
* <a href="http://msdn.microsoft.com/en-us/library/bb735305.aspx">http://msdn.microsoft.com/en-us/library/bb735305.aspx</a><br/>
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The transports configuration.
* @cfg {String/Window} local The url to the local file used for proxying messages, or the local window.
* @cfg {Number} delay The number of milliseconds easyXDM should try to get a reference to the local window.
* @cfg {Number} interval The interval used when polling for messages.
*/
easyXDM.stack.HashTransport = function(config){
var pub;
var me = this, isHost, _timer, pollInterval, _lastMsg, _msgNr, _listenerWindow, _callerWindow;
var useParent, _remoteOrigin;
function _sendMessage(message){
if (!_callerWindow) {
return;
}
var url = config.remote + "#" + (_msgNr++) + "_" + message;
((isHost || !useParent) ? _callerWindow.contentWindow : _callerWindow).location = url;
}
function _handleHash(hash){
_lastMsg = hash;
pub.up.incoming(_lastMsg.substring(_lastMsg.indexOf("_") + 1), _remoteOrigin);
}
/**
* Checks location.hash for a new message and relays this to the receiver.
* @private
*/
function _pollHash(){
if (!_listenerWindow) {
return;
}
var href = _listenerWindow.location.href, hash = "", indexOf = href.indexOf("#");
if (indexOf != -1) {
hash = href.substring(indexOf);
}
if (hash && hash != _lastMsg) {
_handleHash(hash);
}
}
function _attachListeners(){
_timer = setInterval(_pollHash, pollInterval);
}
return (pub = {
outgoing: function(message, domain){
_sendMessage(message);
},
destroy: function(){
window.clearInterval(_timer);
if (isHost || !useParent) {
_callerWindow.parentNode.removeChild(_callerWindow);
}
_callerWindow = null;
},
onDOMReady: function(){
isHost = config.isHost;
pollInterval = config.interval;
_lastMsg = "#" + config.channel;
_msgNr = 0;
useParent = config.useParent;
_remoteOrigin = getLocation(config.remote);
if (isHost) {
config.props = {
src: config.remote,
name: IFRAME_PREFIX + config.channel + "_provider"
};
if (useParent) {
config.onLoad = function(){
_listenerWindow = window;
_attachListeners();
pub.up.callback(true);
};
}
else {
var tries = 0, max = config.delay / 50;
(function getRef(){
if (++tries > max) {
throw new Error("Unable to reference listenerwindow");
}
try {
_listenerWindow = _callerWindow.contentWindow.frames[IFRAME_PREFIX + config.channel + "_consumer"];
}
catch (ex) {
}
if (_listenerWindow) {
_attachListeners();
pub.up.callback(true);
}
else {
setTimeout(getRef, 50);
}
}());
}
_callerWindow = createFrame(config);
}
else {
_listenerWindow = window;
_attachListeners();
if (useParent) {
_callerWindow = parent;
pub.up.callback(true);
}
else {
apply(config, {
props: {
src: config.remote + "#" + config.channel + new Date(),
name: IFRAME_PREFIX + config.channel + "_consumer"
},
onLoad: function(){
pub.up.callback(true);
}
});
_callerWindow = createFrame(config);
}
}
},
init: function(){
whenReady(pub.onDOMReady, pub);
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, debug */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.ReliableBehavior
* This is a behavior that tries to make the underlying transport reliable by using acknowledgements.
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The behaviors configuration.
*/
easyXDM.stack.ReliableBehavior = function(config){
var pub, // the public interface
callback; // the callback to execute when we have a confirmed success/failure
var idOut = 0, idIn = 0, currentMessage = "";
return (pub = {
incoming: function(message, origin){
var indexOf = message.indexOf("_"), ack = message.substring(0, indexOf).split(",");
message = message.substring(indexOf + 1);
if (ack[0] == idOut) {
currentMessage = "";
if (callback) {
callback(true);
}
}
if (message.length > 0) {
pub.down.outgoing(ack[1] + "," + idOut + "_" + currentMessage, origin);
if (idIn != ack[1]) {
idIn = ack[1];
pub.up.incoming(message, origin);
}
}
},
outgoing: function(message, origin, fn){
currentMessage = message;
callback = fn;
pub.down.outgoing(idIn + "," + (++idOut) + "_" + message, origin);
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, debug, undef, removeFromStack*/
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.QueueBehavior
* This is a behavior that enables queueing of messages. <br/>
* It will buffer incoming messages and dispach these as fast as the underlying transport allows.
* This will also fragment/defragment messages so that the outgoing message is never bigger than the
* set length.
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The behaviors configuration. Optional.
* @cfg {Number} maxLength The maximum length of each outgoing message. Set this to enable fragmentation.
*/
easyXDM.stack.QueueBehavior = function(config){
var pub, queue = [], waiting = true, incoming = "", destroying, maxLength = 0, lazy = false, doFragment = false;
function dispatch(){
if (config.remove && queue.length === 0) {
removeFromStack(pub);
return;
}
if (waiting || queue.length === 0 || destroying) {
return;
}
waiting = true;
var message = queue.shift();
pub.down.outgoing(message.data, message.origin, function(success){
waiting = false;
if (message.callback) {
setTimeout(function(){
message.callback(success);
}, 0);
}
dispatch();
});
}
return (pub = {
init: function(){
if (undef(config)) {
config = {};
}
if (config.maxLength) {
maxLength = config.maxLength;
doFragment = true;
}
if (config.lazy) {
lazy = true;
}
else {
pub.down.init();
}
},
callback: function(success){
waiting = false;
var up = pub.up; // in case dispatch calls removeFromStack
dispatch();
up.callback(success);
},
incoming: function(message, origin){
if (doFragment) {
var indexOf = message.indexOf("_"), seq = parseInt(message.substring(0, indexOf), 10);
incoming += message.substring(indexOf + 1);
if (seq === 0) {
if (config.encode) {
incoming = decodeURIComponent(incoming);
}
pub.up.incoming(incoming, origin);
incoming = "";
}
}
else {
pub.up.incoming(message, origin);
}
},
outgoing: function(message, origin, fn){
if (config.encode) {
message = encodeURIComponent(message);
}
var fragments = [], fragment;
if (doFragment) {
// fragment into chunks
while (message.length !== 0) {
fragment = message.substring(0, maxLength);
message = message.substring(fragment.length);
fragments.push(fragment);
}
// enqueue the chunks
while ((fragment = fragments.shift())) {
queue.push({
data: fragments.length + "_" + fragment,
origin: origin,
callback: fragments.length === 0 ? fn : null
});
}
}
else {
queue.push({
data: message,
origin: origin,
callback: fn
});
}
if (lazy) {
pub.down.init();
}
else {
dispatch();
}
},
destroy: function(){
destroying = true;
pub.down.destroy();
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, undef, debug */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.VerifyBehavior
* This behavior will verify that communication with the remote end is possible, and will also sign all outgoing,
* and verify all incoming messages. This removes the risk of someone hijacking the iframe to send malicious messages.
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The behaviors configuration.
* @cfg {Boolean} initiate If the verification should be initiated from this end.
*/
easyXDM.stack.VerifyBehavior = function(config){
var pub, mySecret, theirSecret, verified = false;
function startVerification(){
mySecret = Math.random().toString(16).substring(2);
pub.down.outgoing(mySecret);
}
return (pub = {
incoming: function(message, origin){
var indexOf = message.indexOf("_");
if (indexOf === -1) {
if (message === mySecret) {
pub.up.callback(true);
}
else if (!theirSecret) {
theirSecret = message;
if (!config.initiate) {
startVerification();
}
pub.down.outgoing(message);
}
}
else {
if (message.substring(0, indexOf) === theirSecret) {
pub.up.incoming(message.substring(indexOf + 1), origin);
}
}
},
outgoing: function(message, origin, fn){
pub.down.outgoing(mySecret + "_" + message, origin, fn);
},
callback: function(success){
if (config.initiate) {
startVerification();
}
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, undef, getJSON, debug, emptyFn, isArray */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected].
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.RpcBehavior
* This uses JSON-RPC 2.0 to expose local methods and to invoke remote methods and have responses returned over the the string based transport stack.<br/>
* Exposed methods can return values synchronous, asyncronous, or bet set up to not return anything.
* @namespace easyXDM.stack
* @constructor
* @param {Object} proxy The object to apply the methods to.
* @param {Object} config The definition of the local and remote interface to implement.
* @cfg {Object} local The local interface to expose.
* @cfg {Object} remote The remote methods to expose through the proxy.
* @cfg {Object} serializer The serializer to use for serializing and deserializing the JSON. Should be compatible with the HTML5 JSON object. Optional, will default to JSON.
*/
easyXDM.stack.RpcBehavior = function(proxy, config){
var pub, serializer = config.serializer || getJSON();
var _callbackCounter = 0, _callbacks = {};
/**
* Serializes and sends the message
* @private
* @param {Object} data The JSON-RPC message to be sent. The jsonrpc property will be added.
*/
function _send(data){
data.jsonrpc = "2.0";
pub.down.outgoing(serializer.stringify(data));
}
/**
* Creates a method that implements the given definition
* @private
* @param {Object} The method configuration
* @param {String} method The name of the method
* @return {Function} A stub capable of proxying the requested method call
*/
function _createMethod(definition, method){
var slice = Array.prototype.slice;
return function(){
var l = arguments.length, callback, message = {
method: method
};
if (l > 0 && typeof arguments[l - 1] === "function") {
//with callback, procedure
if (l > 1 && typeof arguments[l - 2] === "function") {
// two callbacks, success and error
callback = {
success: arguments[l - 2],
error: arguments[l - 1]
};
message.params = slice.call(arguments, 0, l - 2);
}
else {
// single callback, success
callback = {
success: arguments[l - 1]
};
message.params = slice.call(arguments, 0, l - 1);
}
_callbacks["" + (++_callbackCounter)] = callback;
message.id = _callbackCounter;
}
else {
// no callbacks, a notification
message.params = slice.call(arguments, 0);
}
if (definition.namedParams && message.params.length === 1) {
message.params = message.params[0];
}
// Send the method request
_send(message);
};
}
/**
* Executes the exposed method
* @private
* @param {String} method The name of the method
* @param {Number} id The callback id to use
* @param {Function} method The exposed implementation
* @param {Array} params The parameters supplied by the remote end
*/
function _executeMethod(method, id, fn, params){
if (!fn) {
if (id) {
_send({
id: id,
error: {
code: -32601,
message: "Procedure not found."
}
});
}
return;
}
var success, error;
if (id) {
success = function(result){
success = emptyFn;
_send({
id: id,
result: result
});
};
error = function(message, data){
error = emptyFn;
var msg = {
id: id,
error: {
code: -32099,
message: message
}
};
if (data) {
msg.error.data = data;
}
_send(msg);
};
}
else {
success = error = emptyFn;
}
// Call local method
if (!isArray(params)) {
params = [params];
}
try {
var result = fn.method.apply(fn.scope, params.concat([success, error]));
if (!undef(result)) {
success(result);
}
}
catch (ex1) {
error(ex1.message);
}
}
return (pub = {
incoming: function(message, origin){
var data = serializer.parse(message);
if (data.method) {
// A method call from the remote end
if (config.handle) {
config.handle(data, _send);
}
else {
_executeMethod(data.method, data.id, config.local[data.method], data.params);
}
}
else {
// A method response from the other end
var callback = _callbacks[data.id];
if (data.error) {
if (callback.error) {
callback.error(data.error);
}
}
else if (callback.success) {
callback.success(data.result);
}
delete _callbacks[data.id];
}
},
init: function(){
if (config.remote) {
// Implement the remote sides exposed methods
for (var method in config.remote) {
if (config.remote.hasOwnProperty(method)) {
proxy[method] = _createMethod(config.remote[method], method);
}
}
}
pub.down.init();
},
destroy: function(){
for (var method in config.remote) {
if (config.remote.hasOwnProperty(method) && proxy.hasOwnProperty(method)) {
delete proxy[method];
}
}
pub.down.destroy();
}
});
};
global.easyXDM = easyXDM;
})(window, document, location, window.setTimeout, decodeURIComponent, encodeURIComponent);
/*!
* F2 v1.3.3 04-07-2014
* Copyright (c) 2013 Markit On Demand, Inc. http://www.openf2.org
*
* "F2" is licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
* Please note that F2 ("Software") may contain third party material that Markit
* On Demand Inc. has a license to use and include within the Software (the
* "Third Party Material"). A list of the software comprising the Third Party Material
* and the terms and conditions under which such Third Party Material is distributed
* are reproduced in the ThirdPartyMaterial.md file available at:
*
* https://github.com/OpenF2/F2/blob/master/ThirdPartyMaterial.md
*
* The inclusion of the Third Party Material in the Software does not grant, provide
* nor result in you having acquiring any rights whatsoever, other than as stipulated
* in the terms and conditions related to the specific Third Party Material, if any.
*
*/
var F2;
/**
* Open F2
* @module f2
* @main f2
*/
F2 = (function() {
/**
* Abosolutizes a relative URL
* @method _absolutizeURI
* @private
* @param {e.g., location.href} base
* @param {URL to absolutize} href
* @returns {string} URL
* Source: https://gist.github.com/Yaffle/1088850
* Tests: http://skew.org/uri/uri_tests.html
*/
var _absolutizeURI = function(base, href) {// RFC 3986
function removeDotSegments(input) {
var output = [];
input.replace(/^(\.\.?(\/|$))+/, '')
.replace(/\/(\.(\/|$))+/g, '/')
.replace(/\/\.\.$/, '/../')
.replace(/\/?[^\/]*/g, function (p) {
if (p === '/..') {
output.pop();
} else {
output.push(p);
}
});
return output.join('').replace(/^\//, input.charAt(0) === '/' ? '/' : '');
}
href = _parseURI(href || '');
base = _parseURI(base || '');
return !href || !base ? null : (href.protocol || base.protocol) +
(href.protocol || href.authority ? href.authority : base.authority) +
removeDotSegments(href.protocol || href.authority || href.pathname.charAt(0) === '/' ? href.pathname : (href.pathname ? ((base.authority && !base.pathname ? '/' : '') + base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + href.pathname) : base.pathname)) +
(href.protocol || href.authority || href.pathname ? href.search : (href.search || base.search)) +
href.hash;
};
/**
* Parses URI
* @method _parseURI
* @private
* @param {The URL to parse} url
* @returns {Parsed URL} string
* Source: https://gist.github.com/Yaffle/1088850
* Tests: http://skew.org/uri/uri_tests.html
*/
var _parseURI = function(url) {
var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
// authority = '//' + user + ':' + pass '@' + hostname + ':' port
return (m ? {
href : m[0] || '',
protocol : m[1] || '',
authority: m[2] || '',
host : m[3] || '',
hostname : m[4] || '',
port : m[5] || '',
pathname : m[6] || '',
search : m[7] || '',
hash : m[8] || ''
} : null);
};
return {
/**
* A function to pass into F2.stringify which will prevent circular
* reference errors when serializing objects
* @method appConfigReplacer
*/
appConfigReplacer: function(key, value) {
if (key == 'root' || key == 'ui' || key == 'height') {
return undefined;
} else {
return value;
}
},
/**
* The apps namespace is a place for app developers to put the javascript
* class that is used to initialize their app. The javascript classes should
* be namepaced with the {{#crossLink "F2.AppConfig"}}{{/crossLink}}.appId.
* It is recommended that the code be placed in a closure to help keep the
* global namespace clean.
*
* If the class has an 'init' function, that function will be called
* automatically by F2.
* @property Apps
* @type object
* @example
* F2.Apps["com_example_helloworld"] = (function() {
* var App_Class = function(appConfig, appContent, root) {
* this._app = appConfig; // the F2.AppConfig object
* this._appContent = appContent // the F2.AppManifest.AppContent object
* this.$root = $(root); // the root DOM Element that contains this app
* }
*
* App_Class.prototype.init = function() {
* // perform init actions
* }
*
* return App_Class;
* })();
* @example
* F2.Apps["com_example_helloworld"] = function(appConfig, appContent, root) {
* return {
* init:function() {
* // perform init actions
* }
* };
* };
* @for F2
*/
Apps: {},
/**
* Creates a namespace on F2 and copies the contents of an object into
* that namespace optionally overwriting existing properties.
* @method extend
* @param {string} ns The namespace to create. Pass a falsy value to
* add properties to the F2 namespace directly.
* @param {object} obj The object to copy into the namespace.
* @param {bool} overwrite True if object properties should be overwritten
* @return {object} The created object
*/
extend: function (ns, obj, overwrite) {
var isFunc = typeof obj === 'function';
var parts = ns ? ns.split('.') : [];
var parent = this;
obj = obj || {};
// ignore leading global
if (parts[0] === 'F2') {
parts = parts.slice(1);
}
// create namespaces
for (var i = 0, len = parts.length; i < len; i++) {
if (!parent[parts[i]]) {
parent[parts[i]] = isFunc && i + 1 == len ? obj : {};
}
parent = parent[parts[i]];
}
// copy object into namespace
if (!isFunc) {
for (var prop in obj) {
if (typeof parent[prop] === 'undefined' || overwrite) {
parent[prop] = obj[prop];
}
}
}
return parent;
},
/**
* Generates a somewhat random id
* @method guid
* @return {string} A random id
* @for F2
*/
guid: function() {
var S4 = function() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
};
return (S4()+S4()+'-'+S4()+'-'+S4()+'-'+S4()+'-'+S4()+S4()+S4());
},
/**
* Search for a value within an array.
* @method inArray
* @param {object} value The value to search for
* @param {Array} array The array to search
* @return {bool} True if the item is in the array
*/
inArray: function(value, array) {
return jQuery.inArray(value, array) > -1;
},
/**
* Tests a URL to see if it's on the same domain (local) or not
* @method isLocalRequest
* @param {URL to test} url
* @returns {bool} Whether the URL is local or not
* Derived from: https://github.com/jquery/jquery/blob/master/src/ajax.js
*/
isLocalRequest: function(url){
var rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
urlLower = url.toLowerCase(),
parts = rurl.exec( urlLower ),
ajaxLocation,
ajaxLocParts;
try {
ajaxLocation = location.href;
} catch( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement('a');
ajaxLocation.href = '';
ajaxLocation = ajaxLocation.href;
}
ajaxLocation = ajaxLocation.toLowerCase();
// uh oh, the url must be relative
// make it fully qualified and re-regex url
if (!parts){
urlLower = _absolutizeURI(ajaxLocation,urlLower).toLowerCase();
parts = rurl.exec( urlLower );
}
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation ) || [];
// do hostname and protocol and port of manifest URL match location.href? (a "local" request on the same domain)
var matched = !(parts &&
(parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
(parts[ 3 ] || (parts[ 1 ] === 'http:' ? '80' : '443')) !==
(ajaxLocParts[ 3 ] || (ajaxLocParts[ 1 ] === 'http:' ? '80' : '443'))));
return matched;
},
/**
* Utility method to determine whether or not the argument passed in is or is not a native dom node.
* @method isNativeDOMNode
* @param {object} testObject The object you want to check as native dom node.
* @return {bool} Returns true if the object passed is a native dom node.
*/
isNativeDOMNode: function(testObject) {
var bIsNode = (
typeof Node === 'object' ? testObject instanceof Node :
testObject && typeof testObject === 'object' && typeof testObject.nodeType === 'number' && typeof testObject.nodeName === 'string'
);
var bIsElement = (
typeof HTMLElement === 'object' ? testObject instanceof HTMLElement : //DOM2
testObject && typeof testObject === 'object' && testObject.nodeType === 1 && typeof testObject.nodeName === 'string'
);
return (bIsNode || bIsElement);
},
/**
* A utility logging function to write messages or objects to the browser console. This is a proxy for the [`console` API](https://developers.google.com/chrome-developer-tools/docs/console).
* @method log
* @param {object|string} Object/Method An object to be logged _or_ a `console` API method name, such as `warn` or `error`. All of the console method names are [detailed in the Chrome docs](https://developers.google.com/chrome-developer-tools/docs/console-api).
* @param {object} [obj2]* An object to be logged
* @example
//Pass any object (string, int, array, object, bool) to .log()
F2.log('foo');
F2.log(myArray);
//Use a console method name as the first argument.
F2.log('error', err);
F2.log('info', 'The session ID is ' + sessionId);
* Some code derived from [HTML5 Boilerplate console plugin](https://github.com/h5bp/html5-boilerplate/blob/master/js/plugins.js)
*/
log: function() {
var _log;
var _logMethod = 'log';
var method;
var noop = function () { };
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeStamp', 'trace', 'warn'
];
var length = methods.length;
var console = (window.console = window.console || {});
var args;
while (length--) {
method = methods[length];
// Only stub undefined methods.
if (!console[method]) {
console[method] = noop;
}
//if first arg is a console function, use it.
//defaults to console.log()
if (arguments && arguments.length > 1 && arguments[0] == method){
_logMethod = method;
//remove console func from args
args = Array.prototype.slice.call(arguments, 1);
}
}
if (Function.prototype.bind) {
_log = Function.prototype.bind.call(console[_logMethod], console);
} else {
_log = function() {
Function.prototype.apply.call(console[_logMethod], console, (args || arguments));
};
}
_log.apply(this, (args || arguments));
},
/**
* Wrapper to convert a JSON string to an object
* @method parse
* @param {string} str The JSON string to convert
* @return {object} The parsed object
*/
parse: function(str) {
return JSON.parse(str);
},
/**
* Wrapper to convert an object to JSON
*
* **Note: When using F2.stringify on an F2.AppConfig object, it is
* recommended to pass F2.appConfigReplacer as the replacer function in
* order to prevent circular serialization errors.**
* @method stringify
* @param {object} value The object to convert
* @param {function|Array} replacer An optional parameter that determines
* how object values are stringified for objects. It can be a function or an
* array of strings.
* @param {int|string} space An optional parameter that specifies the
* indentation of nested structures. If it is omitted, the text will be
* packed without extra whitespace. If it is a number, it will specify the
* number of spaces to indent at each level. If it is a string (such as '\t'
* or ' '), it contains the characters used to indent at each level.
* @return {string} The JSON string
*/
stringify: function(value, replacer, space) {
return JSON.stringify(value, replacer, space);
},
/**
* Function to get the F2 version number
* @method version
* @return {string} F2 version number
*/
version: function() { return '1.3.3'; }
};
})();
/**
* The new `AppHandlers` functionality provides Container Developers a higher level of control over configuring app rendering and interaction.
*
*<p class="alert alert-block alert-warning">
*The addition of `F2.AppHandlers` replaces the previous {{#crossLink "F2.ContainerConfig"}}{{/crossLink}} properties `beforeAppRender`, `appRender`, and `afterAppRender`. These methods were deprecated—but not removed—in version 1.2. They will be permanently removed in a future version of F2.
*</p>
*
*<p class="alert alert-block alert-info">
*Starting with F2 version 1.2, `AppHandlers` is the preferred method for Container Developers to manage app layout.
*</p>
*
* ### Order of Execution
*
* **App Rendering**
*
* 0. {{#crossLink "F2/registerApps"}}F2.registerApps(){{/crossLink}} method is called by the Container Developer and the following methods are run for *each* {{#crossLink "F2.AppConfig"}}{{/crossLink}} passed.
* 1. **'appCreateRoot'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_CREATE\_ROOT*) handlers are fired in the order they were attached.
* 2. **'appRenderBefore'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_RENDER\_BEFORE*) handlers are fired in the order they were attached.
* 3. Each app's `manifestUrl` is requested asynchronously; on success the following methods are fired.
* 3. **'appRender'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_RENDER*) handlers are fired in the order they were attached.
* 4. **'appRenderAfter'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_RENDER\_AFTER*) handlers are fired in the order they were attached.
*
*
* **App Removal**
* 0. {{#crossLink "F2/removeApp"}}F2.removeApp(){{/crossLink}} with a specific {{#crossLink "F2.AppConfig/instanceId "}}{{/crossLink}} or {{#crossLink "F2/removeAllApps"}}F2.removeAllApps(){{/crossLink}} method is called by the Container Developer and the following methods are run.
* 1. **'appDestroyBefore'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_DESTROY\_BEFORE*) handlers are fired in the order they were attached.
* 2. **'appDestroy'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_DESTROY*) handlers are fired in the order they were attached.
* 3. **'appDestroyAfter'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_DESTROY\_AFTER*) handlers are fired in the order they were attached.
*
* **Error Handling**
* 0. **'appScriptLoadFailed'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_SCRIPT\_LOAD\_FAILED*) handlers are fired in the order they were attached.
*
* @class F2.AppHandlers
*/
F2.extend('AppHandlers', (function() {
// the hidden token that we will check against every time someone tries to add, remove, fire handler
var _ct = F2.guid();
var _f2t = F2.guid();
var _handlerCollection = {
appCreateRoot: [],
appRenderBefore: [],
appDestroyBefore: [],
appRenderAfter: [],
appDestroyAfter: [],
appRender: [],
appDestroy: [],
appScriptLoadFailed: []
};
var _defaultMethods = {
appRender: function(appConfig, appHtml)
{
var $root = null;
// if no app root is defined use the app's outer most node
if(!F2.isNativeDOMNode(appConfig.root))
{
appConfig.root = jQuery(appHtml).get(0);
// get a handle on the root in jQuery
$root = jQuery(appConfig.root);
}
else
{
// get a handle on the root in jQuery
$root = jQuery(appConfig.root);
// append the app html to the root
$root.append(appHtml);
}
// append the root to the body by default.
jQuery('body').append($root);
},
appDestroy: function(appInstance)
{
// call the apps destroy method, if it has one
if(appInstance && appInstance.app && appInstance.app.destroy && typeof(appInstance.app.destroy) == 'function')
{
appInstance.app.destroy();
}
// warn the Container and App Developer that even though they have a destroy method it hasn't been
else if(appInstance && appInstance.app && appInstance.app.destroy)
{
F2.log(appInstance.config.appId + ' has a destroy property, but destroy is not of type function and as such will not be executed.');
}
// fade out and remove the root
jQuery(appInstance.config.root).fadeOut(500, function() {
jQuery(this).remove();
});
}
};
var _createHandler = function(token, sNamespace, func_or_element, bDomNodeAppropriate)
{
// will throw an exception and stop execution if the token is invalid
_validateToken(token);
// create handler structure. Not all arguments properties will be populated/used.
var handler = {
func: (typeof(func_or_element)) ? func_or_element : null,
namespace: sNamespace,
domNode: (F2.isNativeDOMNode(func_or_element)) ? func_or_element : null
};
if(!handler.func && !handler.domNode)
{
throw ('Invalid or null argument passed. Handler will not be added to collection. A valid dom element or callback function is required.');
}
if(handler.domNode && !bDomNodeAppropriate)
{
throw ('Invalid argument passed. Handler will not be added to collection. A callback function is required for this event type.');
}
return handler;
};
var _validateToken = function(sToken)
{
// check token against F2 and container
if(_ct != sToken && _f2t != sToken) { throw ('Invalid token passed. Please verify that you have correctly received and stored token from F2.AppHandlers.getToken().'); }
};
var _removeHandler = function(sToken, eventKey, sNamespace)
{
// will throw an exception and stop execution if the token is invalid
_validateToken(sToken);
if(!sNamespace && !eventKey)
{
return;
}
// remove by event key
else if(!sNamespace && eventKey)
{
_handlerCollection[eventKey] = [];
}
// remove by namespace only
else if(sNamespace && !eventKey)
{
sNamespace = sNamespace.toLowerCase();
for(var currentEventKey in _handlerCollection)
{
var eventCollection = _handlerCollection[currentEventKey];
var newEvents = [];
for(var i = 0, ec = eventCollection.length; i < ec; i++)
{
var currentEventHandler = eventCollection[i];
if(currentEventHandler)
{
if(!currentEventHandler.namespace || currentEventHandler.namespace.toLowerCase() != sNamespace)
{
newEvents.push(currentEventHandler);
}
}
}
eventCollection = newEvents;
}
}
else if(sNamespace && _handlerCollection[eventKey])
{
sNamespace = sNamespace.toLowerCase();
var newHandlerCollection = [];
for(var iCounter = 0, hc = _handlerCollection[eventKey].length; iCounter < hc; iCounter++)
{
var currentHandler = _handlerCollection[eventKey][iCounter];
if(currentHandler)
{
if(!currentHandler.namespace || currentHandler.namespace.toLowerCase() != sNamespace)
{
newHandlerCollection.push(currentHandler);
}
}
}
_handlerCollection[eventKey] = newHandlerCollection;
}
};
return {
/**
* Allows Container Developer to retrieve a unique token which must be passed to
* all `on` and `off` methods. This function will self destruct and can only be called
* one time. Container Developers must store the return value inside of a closure.
* @method getToken
**/
getToken: function()
{
// delete this method for security that way only the container has access to the token 1 time.
// kind of Ethan Hunt-ish, this message will self destruct immediately.
delete this.getToken;
// return the token, which we validate against.
return _ct;
},
/**
* Allows F2 to get a token internally. Token is required to call {{#crossLink "F2.AppHandlers/\_\_trigger:method"}}{{/crossLink}}.
* This function will self destruct to eliminate other sources from using the {{#crossLink "F2.AppHandlers/\_\_trigger:method"}}{{/crossLink}}
* and additional internal methods.
* @method __f2GetToken
* @private
**/
__f2GetToken: function()
{
// delete this method for security that way only the F2 internally has access to the token 1 time.
// kind of Ethan Hunt-ish, this message will self destruct immediately.
delete this.__f2GetToken;
// return the token, which we validate against.
return _f2t;
},
/**
* Allows F2 to trigger specific events internally.
* @method __trigger
* @private
* @chainable
* @param {String} token The token received from {{#crossLink "F2.AppHandlers/\_\_f2GetToken:method"}}{{/crossLink}}.
* @param {String} eventKey The event to fire. The complete list of event keys is available in {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.
**/
__trigger: function(token, eventKey) // additional arguments will likely be passed
{
// will throw an exception and stop execution if the token is invalid
if(token != _f2t)
{
throw ('Token passed is invalid. Only F2 is allowed to call F2.AppHandlers.__trigger().');
}
if(_handlerCollection && _handlerCollection[eventKey])
{
// create a collection of arguments that are safe to pass to the callback.
var passableArgs = [];
// populate that collection with all arguments except token and eventKey
for(var i = 2, j = arguments.length; i < j; i++)
{
passableArgs.push(arguments[i]);
}
if(_handlerCollection[eventKey].length === 0 && _defaultMethods[eventKey])
{
_defaultMethods[eventKey].apply(F2, passableArgs);
return this;
}
else if(_handlerCollection[eventKey].length === 0 && !_handlerCollection[eventKey])
{
return this;
}
// fire all event listeners in the order that they were added.
for(var iCounter = 0, hcl = _handlerCollection[eventKey].length; iCounter < hcl; iCounter++)
{
var handler = _handlerCollection[eventKey][iCounter];
// appRender where root is already defined
if (handler.domNode && arguments[2] && arguments[2].root && arguments[3])
{
var $appRoot = jQuery(arguments[2].root).append(arguments[3]);
jQuery(handler.domNode).append($appRoot);
}
else if (handler.domNode && arguments[2] && !arguments[2].root && arguments[3])
{
// set the root to the actual HTML of the app
arguments[2].root = jQuery(arguments[3]).get(0);
// appends the root to the dom node specified
jQuery(handler.domNode).append(arguments[2].root);
}
else
{
handler.func.apply(F2, passableArgs);
}
}
}
else
{
throw ('Invalid EventKey passed. Check your inputs and try again.');
}
return this;
},
/**
* Allows Container Developer to easily tell all apps to render in a specific location. Only valid for eventType `appRender`.
* @method on
* @chainable
* @param {String} token The token received from {{#crossLink "F2.AppHandlers/getToken:method"}}{{/crossLink}}.
* @param {String} eventKey{.namespace} The event key used to determine which event to attach the listener to. The namespace is useful for removal
* purposes. At this time it does not affect when an event is fired. Complete list of event keys available in
* {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.
* @params {HTMLElement} element Specific DOM element to which app gets appended.
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* 'appRender',
* document.getElementById('my_app')
* );
*
* Or:
* @example
* F2.AppHandlers.on(
* _token,
* 'appRender.myNamespace',
* document.getElementById('my_app')
* );
**/
/**
* Allows Container Developer to add listener method that will be triggered when a specific event occurs.
* @method on
* @chainable
* @param {String} token The token received from {{#crossLink "F2.AppHandlers/getToken:method"}}{{/crossLink}}.
* @param {String} eventKey{.namespace} The event key used to determine which event to attach the listener to. The namespace is useful for removal
* purposes. At this time it does not affect when an event is fired. Complete list of event keys available in
* {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.
* @params {Function} listener A function that will be triggered when a specific event occurs. For detailed argument definition refer to {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* 'appRenderBefore'
* function() { F2.log('before app rendered!'); }
* );
*
* Or:
* @example
* F2.AppHandlers.on(
* _token,
* 'appRenderBefore.myNamespace',
* function() { F2.log('before app rendered!'); }
* );
**/
on: function(token, eventKey, func_or_element)
{
var sNamespace = null;
if(!eventKey)
{
throw ('eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.');
}
// we need to check the key for a namespace
if(eventKey.indexOf('.') > -1)
{
var arData = eventKey.split('.');
eventKey = arData[0];
sNamespace = arData[1];
}
if(_handlerCollection && _handlerCollection[eventKey])
{
_handlerCollection[eventKey].push(
_createHandler(
token,
sNamespace,
func_or_element,
(eventKey == 'appRender')
)
);
}
else
{
throw ('Invalid EventKey passed. Check your inputs and try again.');
}
return this;
},
/**
* Allows Container Developer to remove listener methods for specific events
* @method off
* @chainable
* @param {String} token The token received from {{#crossLink "F2.AppHandlers/getToken:method"}}{{/crossLink}}.
* @param {String} eventKey{.namespace} The event key used to determine which event to attach the listener to. If no namespace is provided all
* listeners for the specified event type will be removed.
* Complete list available in {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.off(_token,'appRenderBefore');
*
**/
off: function(token, eventKey)
{
var sNamespace = null;
if(!eventKey)
{
throw ('eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.');
}
// we need to check the key for a namespace
if(eventKey.indexOf('.') > -1)
{
var arData = eventKey.split('.');
eventKey = arData[0];
sNamespace = arData[1];
}
if(_handlerCollection && _handlerCollection[eventKey])
{
_removeHandler(
token,
eventKey,
sNamespace
);
}
else
{
throw ('Invalid EventKey passed. Check your inputs and try again.');
}
return this;
}
};
})());
F2.extend('Constants', {
/**
* A convenient collection of all available appHandler events.
* @class F2.Constants.AppHandlers
**/
AppHandlers: (function()
{
return {
/**
* Equivalent to `appCreateRoot`. Identifies the create root method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} )
* @property APP_CREATE_ROOT
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_CREATE_ROOT,
* function(appConfig)
* {
* // If you want to create a custom root. By default F2 uses the app's outermost HTML element.
* // the app's html is not available until after the manifest is retrieved so this logic occurs in F2.Constants.AppHandlers.APP_RENDER
* appConfig.root = jQuery('<section></section>').get(0);
* }
* );
*/
APP_CREATE_ROOT: 'appCreateRoot',
/**
* Equivalent to `appRenderBefore`. Identifies the before app render method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} )
* @property APP_RENDER_BEFORE
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_RENDER_BEFORE,
* function(appConfig)
* {
* F2.log(appConfig);
* }
* );
*/
APP_RENDER_BEFORE: 'appRenderBefore',
/**
* Equivalent to `appRender`. Identifies the app render method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}}, [appHtml](../../app-development.html#app-design) )
* @property APP_RENDER
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_RENDER,
* function(appConfig, appHtml)
* {
* var $root = null;
*
* // if no app root is defined use the app's outer most node
* if(!F2.isNativeDOMNode(appConfig.root))
* {
* appConfig.root = jQuery(appHtml).get(0);
* // get a handle on the root in jQuery
* $root = jQuery(appConfig.root);
* }
* else
* {
* // get a handle on the root in jQuery
* $root = jQuery(appConfig.root);
*
* // append the app html to the root
* $root.append(appHtml);
* }
*
* // append the root to the body by default.
* jQuery('body').append($root);
* }
* );
*/
APP_RENDER: 'appRender',
/**
* Equivalent to `appRenderAfter`. Identifies the after app render method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} )
* @property APP_RENDER_AFTER
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_RENDER_AFTER,
* function(appConfig)
* {
* F2.log(appConfig);
* }
* );
*/
APP_RENDER_AFTER: 'appRenderAfter',
/**
* Equivalent to `appDestroyBefore`. Identifies the before app destroy method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( appInstance )
* @property APP_DESTROY_BEFORE
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_DESTROY_BEFORE,
* function(appInstance)
* {
* F2.log(appInstance);
* }
* );
*/
APP_DESTROY_BEFORE: 'appDestroyBefore',
/**
* Equivalent to `appDestroy`. Identifies the app destroy method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( appInstance )
* @property APP_DESTROY
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_DESTROY,
* function(appInstance)
* {
* // call the apps destroy method, if it has one
* if(appInstance && appInstance.app && appInstance.app.destroy && typeof(appInstance.app.destroy) == 'function')
* {
* appInstance.app.destroy();
* }
* else if(appInstance && appInstance.app && appInstance.app.destroy)
* {
* F2.log(appInstance.config.appId + ' has a destroy property, but destroy is not of type function and as such will not be executed.');
* }
*
* // fade out and remove the root
* jQuery(appInstance.config.root).fadeOut(500, function() {
* jQuery(this).remove();
* });
* }
* );
*/
APP_DESTROY: 'appDestroy',
/**
* Equivalent to `appDestroyAfter`. Identifies the after app destroy method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( appInstance )
* @property APP_DESTROY_AFTER
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_DESTROY_AFTER,
* function(appInstance)
* {
* F2.log(appInstance);
* }
* );
*/
APP_DESTROY_AFTER: 'appDestroyAfter',
/**
* Equivalent to `appScriptLoadFailed`. Identifies the app script load failed method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}}, scriptInfo )
* @property APP_SCRIPT_LOAD_FAILED
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED,
* function(appConfig, scriptInfo)
* {
* F2.log(appConfig.appId);
* }
* );
*/
APP_SCRIPT_LOAD_FAILED: 'appScriptLoadFailed'
};
})()
});
/**
* Class stubs for documentation purposes
* @main F2
*/
F2.extend('', {
/**
* The App Class is an optional class that can be namespaced onto the
* {{#crossLink "F2\Apps"}}{{/crossLink}} namespace. The
* [F2 Docs](../../app-development.html#app-class)
* has more information on the usage of the App Class.
* @class F2.App
* @constructor
* @param {F2.AppConfig} appConfig The F2.AppConfig object for the app
* @param {F2.AppManifest.AppContent} appContent The F2.AppManifest.AppContent
* object
* @param {Element} root The root DOM Element for the app
*/
App: function(appConfig, appContent, root) {
return {
/**
* An optional init function that will automatically be called when
* F2.{{#crossLink "F2\registerApps"}}{{/crossLink}} is called.
* @method init
* @optional
*/
init:function() {}
};
},
/**
* The AppConfig object represents an app's meta data
* @class F2.AppConfig
*/
AppConfig: {
/**
* The unique ID of the app. More information can be found
* [here](../../app-development.html#f2-appid)
* @property appId
* @type string
* @required
*/
appId: '',
/**
* An object that represents the context of an app
* @property context
* @type object
*/
context: {},
/**
* True if the app should be requested in a single request with other apps.
* @property enableBatchRequests
* @type bool
* @default false
*/
enableBatchRequests: false,
/**
* The height of the app. The initial height will be pulled from
* the {{#crossLink "F2.AppConfig"}}{{/crossLink}} object, but later
* modified by calling
* F2.UI.{{#crossLink "F2.UI/updateHeight"}}{{/crossLink}}. This is used
* for secure apps to be able to set the initial height of the iframe.
* @property height
* @type int
*/
height: 0,
/**
* The unique runtime ID of the app.
*
* **This property is populated during the
* F2.{{#crossLink "F2/registerApps"}}{{/crossLink}} process**
* @property instanceId
* @type string
*/
instanceId: '',
/**
* True if the app will be loaded in an iframe. This property
* will be true if the {{#crossLink "F2.AppConfig"}}{{/crossLink}} object
* sets isSecure = true. It will also be true if the
* [container](../../container-development.html) has made the decision to
* run apps in iframes.
* @property isSecure
* @type bool
* @default false
*/
isSecure: false,
/**
* The url to retrieve the {{#crossLink "F2.AppManifest"}}{{/crossLink}}
* object.
* @property manifestUrl
* @type string
* @required
*/
manifestUrl: '',
/**
* The recommended maximum width in pixels that this app should be run.
* **It is up to the [container](../../container-development.html) to
* implement the logic to prevent an app from being run when the maxWidth
* requirements are not met.**
* @property maxWidth
* @type int
*/
maxWidth: 0,
/**
* The recommended minimum grid size that this app should be run. This
* value corresponds to the 12-grid system that is used by the
* [container](../../container-development.html). This property should be
* set by apps that require a certain number of columns in their layout.
* @property minGridSize
* @type int
* @default 4
*/
minGridSize: 4,
/**
* The recommended minimum width in pixels that this app should be run. **It
* is up to the [container](../../container-development.html) to implement
* the logic to prevent an app from being run when the minWidth requirements
* are not met.
* @property minWidth
* @type int
* @default 300
*/
minWidth: 300,
/**
* The name of the app
* @property name
* @type string
* @required
*/
name: '',
/**
* The root DOM element that contains the app
*
* **This property is populated during the
* F2.{{#crossLink "F2/registerApps"}}{{/crossLink}} process**
* @property root
* @type Element
*/
root: undefined,
/**
* The instance of F2.UI providing easy access to F2.UI methods
*
* **This property is populated during the
* F2.{{#crossLink "F2/registerApps"}}{{/crossLink}} process**
* @property ui
* @type F2.UI
*/
ui: undefined,
/**
* The views that this app supports. Available views
* are defined in {{#crossLink "F2.Constants.Views"}}{{/crossLink}}. The
* presence of a view can be checked via
* F2.{{#crossLink "F2/inArray"}}{{/crossLink}}:
*
* F2.inArray(F2.Constants.Views.SETTINGS, app.views)
*
* @property views
* @type Array
*/
views: []
},
/**
* The assets needed to render an app on the page
* @class F2.AppManifest
*/
AppManifest: {
/**
* The array of {{#crossLink "F2.AppManifest.AppContent"}}{{/crossLink}}
* objects
* @property apps
* @type Array
* @required
*/
apps: [],
/**
* Any inline javascript tha should initially be run
* @property inlineScripts
* @type Array
* @optional
*/
inlineScripts: [],
/**
* Urls to javascript files required by the app
* @property scripts
* @type Array
* @optional
*/
scripts: [],
/**
* Urls to CSS files required by the app
* @property styles
* @type Array
* @optional
*/
styles: []
},
/**
* The AppContent object
* @class F2.AppManifest.AppContent
**/
AppContent: {
/**
* Arbitrary data to be passed along with the app
* @property data
* @type object
* @optional
*/
data: {},
/**
* The string of HTML representing the app
* @property html
* @type string
* @required
*/
html: '',
/**
* A status message
* @property status
* @type string
* @optional
*/
status: ''
},
/**
* An object containing configuration information for the
* [container](../../container-development.html)
* @class F2.ContainerConfig
*/
ContainerConfig: {
/**
* Allows the [container](../../container-development.html) to override how
* an app's html is inserted into the page. The function should accept an
* {{#crossLink "F2.AppConfig"}}{{/crossLink}} object and also a string of
* html
* @method afterAppRender
* @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @param {string} html The string of html representing the app
* @return {Element} The DOM Element surrounding the app
*/
afterAppRender: function(appConfig, html) {},
/**
* Allows the [container](../../container-development.html) to wrap an app
* in extra html. The function should accept an
* {{#crossLink "F2.AppConfig"}}{{/crossLink}} object and also a string of
* html. The extra html can provide links to edit app settings and remove an
* app from the container. See
* {{#crossLink "F2.Constants.Css"}}{{/crossLink}} for CSS classes that
* should be applied to elements.
* @method appRender
* @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @param {string} html The string of html representing the app
*/
appRender: function(appConfig, html) {},
/**
* Allows the container to render html for an app before the AppManifest for
* an app has loaded. This can be useful if the design calls for loading
* icons to appear for each app before each app is loaded and rendered to
* the page.
* @method beforeAppRender
* @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @return {Element} The DOM Element surrounding the app
*/
beforeAppRender: function(appConfig) {},
/**
* True to enable debug mode in F2.js. Adds additional logging, resource cache busting, etc.
* @property debugMode
* @type bool
* @default false
*/
debugMode: false,
/**
* Milliseconds before F2 fires callback on script resource load errors. Due to issue with the way Internet Explorer attaches load events to script elements, the error event doesn't fire.
* @property scriptErrorTimeout
* @type milliseconds
* @default 7000 (7 seconds)
*/
scriptErrorTimeout: 7000,
/**
* Tells the container that it is currently running within
* a secure app page
* @property isSecureAppPage
* @type bool
*/
isSecureAppPage: false,
/**
* Allows the container to specify which page is used when
* loading a secure app. The page must reside on a different domain than the
* container
* @property secureAppPagePath
* @type string
* @for F2.ContainerConfig
*/
secureAppPagePath: '',
/**
* Specifies what views a container will provide buttons
* or links to. Generally, the views will be switched via buttons or links
* in the app's header.
* @property supportedViews
* @type Array
* @required
*/
supportedViews: [],
/**
* An object containing configuration defaults for F2.UI
* @class F2.ContainerConfig.UI
*/
UI: {
/**
* An object containing configuration defaults for the
* F2.UI.{{#crossLink "F2.UI/showMask"}}{{/crossLink}} and
* F2.UI.{{#crossLink "F2.UI/hideMask"}}{{/crossLink}} methods.
* @class F2.ContainerConfig.UI.Mask
*/
Mask: {
/**
* The backround color of the overlay
* @property backgroundColor
* @type string
* @default #FFF
*/
backgroundColor: '#FFF',
/**
* The path to the loading icon
* @property loadingIcon
* @type string
*/
loadingIcon: '',
/**
* The opacity of the background overlay
* @property opacity
* @type int
* @default 0.6
*/
opacity: 0.6,
/**
* Do not use inline styles for mask functinality. Instead classes will
* be applied to the elements and it is up to the container provider to
* implement the class definitions.
* @property useClasses
* @type bool
* @default false
*/
useClasses: false,
/**
* The z-index to use for the overlay
* @property zIndex
* @type int
* @default 2
*/
zIndex: 2
}
},
/**
* Allows the container to fully override how the AppManifest request is
* made inside of F2.
*
* @method xhr
* @param {string} url The manifest url
* @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}}
* objects
* @param {function} success The function to be called if the request
* succeeds
* @param {function} error The function to be called if the request fails
* @param {function} complete The function to be called when the request
* finishes (after success and error callbacks have been executed)
* @return {XMLHttpRequest} The XMLHttpRequest object (or an object that has
* an `abort` function (such as the jqXHR object in jQuery) to abort the
* request)
*
* @example
* F2.init({
* xhr: function(url, appConfigs, success, error, complete) {
* $.ajax({
* url: url,
* type: 'POST',
* data: {
* params: F2.stringify(appConfigs, F2.appConfigReplacer)
* },
* jsonp: false, // do not put 'callback=' in the query string
* jsonpCallback: F2.Constants.JSONP_CALLBACK + appConfigs[0].appId, // Unique function name
* dataType: 'json',
* success: function(appManifest) {
* // custom success logic
* success(appManifest); // fire success callback
* },
* error: function() {
* // custom error logic
* error(); // fire error callback
* },
* complete: function() {
* // custom complete logic
* complete(); // fire complete callback
* }
* });
* }
* });
*
* @for F2.ContainerConfig
*/
//xhr: function(url, appConfigs, success, error, complete) {},
/**
* Allows the container to override individual parts of the AppManifest
* request. See properties and methods with the `xhr.` prefix.
* @property xhr
* @type Object
*
* @example
* F2.init({
* xhr: {
* url: function(url, appConfigs) {
* return 'http://example.com/proxy.php?url=' + encocdeURIComponent(url);
* }
* }
* });
*/
xhr: {
/**
* Allows the container to override the request data type (JSON or JSONP)
* that is used for the request
* @method xhr.dataType
* @param {string} url The manifest url
* @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}}
* objects
* @return {string} The request data type that should be used
*
* @example
* F2.init({
* xhr: {
* dataType: function(url) {
* return F2.isLocalRequest(url) ? 'json' : 'jsonp';
* },
* type: function(url) {
* return F2.isLocalRequest(url) ? 'POST' : 'GET';
* }
* }
* });
*/
dataType: function(url, appConfigs) {},
/**
* Allows the container to override the request method that is used (just
* like the `type` parameter to `jQuery.ajax()`.
* @method xhr.type
* @param {string} url The manifest url
* @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}}
* objects
* @return {string} The request method that should be used
*
* @example
* F2.init({
* xhr: {
* dataType: function(url) {
* return F2.isLocalRequest(url) ? 'json' : 'jsonp';
* },
* type: function(url) {
* return F2.isLocalRequest(url) ? 'POST' : 'GET';
* }
* }
* });
*/
type: function(url, appConfigs) {},
/**
* Allows the container to override the url that is used to request an
* app's F2.{{#crossLink "F2.AppManifest"}}{{/crossLink}}
* @method xhr.url
* @param {string} url The manifest url
* @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}}
* objects
* @return {string} The url that should be used for the request
*
* @example
* F2.init({
* xhr: {
* url: function(url, appConfigs) {
* return 'http://example.com/proxy.php?url=' + encocdeURIComponent(url);
* }
* }
* });
*/
url: function(url, appConfigs) {}
},
/**
* Allows the container to override the script loader which requests
* dependencies defined in the {{#crossLink "F2.AppManifest"}}{{/crossLink}}.
* @property loadScripts
* @type function
*
* @example
* F2.init({
* loadScripts: function(scripts,inlines,callback){
* //load scripts using $.load() for each script or require(scripts)
* callback();
* }
* });
*/
loadScripts: function(scripts,inlines,callback){},
/**
* Allows the container to override the stylesheet loader which requests
* dependencies defined in the {{#crossLink "F2.AppManifest"}}{{/crossLink}}.
* @property loadStyles
* @type function
*
* @example
* F2.init({
* loadStyles: function(styles,callback){
* //load styles using $.load() for each stylesheet or another method
* callback();
* }
* });
*/
loadStyles: function(styles,callback){}
}
});
/**
* Constants used throughout the Open Financial Framework
* @class F2.Constants
* @static
*/
F2.extend('Constants', {
/**
* CSS class constants
* @class F2.Constants.Css
*/
Css: (function() {
/** @private */
var _PREFIX = 'f2-';
return {
/**
* The APP class should be applied to the DOM Element that surrounds the
* entire app, including any extra html that surrounds the APP\_CONTAINER
* that is inserted by the container. See the
* {{#crossLink "F2.ContainerConfig"}}{{/crossLink}} object.
* @property APP
* @type string
* @static
* @final
*/
APP: _PREFIX + 'app',
/**
* The APP\_CONTAINER class should be applied to the outermost DOM Element
* of the app.
* @property APP_CONTAINER
* @type string
* @static
* @final
*/
APP_CONTAINER: _PREFIX + 'app-container',
/**
* The APP\_TITLE class should be applied to the DOM Element that contains
* the title for an app. If this class is not present, then
* F2.UI.{{#crossLink "F2.UI/setTitle"}}{{/crossLink}} will not function.
* @property APP_TITLE
* @type string
* @static
* @final
*/
APP_TITLE: _PREFIX + 'app-title',
/**
* The APP\_VIEW class should be applied to the DOM Element that contains
* a view for an app. The DOM Element should also have a
* {{#crossLink "F2.Constants.Views"}}{{/crossLink}}.DATA_ATTRIBUTE
* attribute that specifies which
* {{#crossLink "F2.Constants.Views"}}{{/crossLink}} it is.
* @property APP_VIEW
* @type string
* @static
* @final
*/
APP_VIEW: _PREFIX + 'app-view',
/**
* APP\_VIEW\_TRIGGER class should be applied to the DOM Elements that
* trigger an
* {{#crossLink "F2.Constants.Events"}}{{/crossLink}}.APP\_VIEW\_CHANGE
* event. The DOM Element should also have a
* {{#crossLink "F2.Constants.Views"}}{{/crossLink}}.DATA_ATTRIBUTE
* attribute that specifies which
* {{#crossLink "F2.Constants.Views"}}{{/crossLink}} it will trigger.
* @property APP_VIEW_TRIGGER
* @type string
* @static
* @final
*/
APP_VIEW_TRIGGER: _PREFIX + 'app-view-trigger',
/**
* The MASK class is applied to the overlay element that is created
* when the F2.UI.{{#crossLink "F2.UI/showMask"}}{{/crossLink}} method is
* fired.
* @property MASK
* @type string
* @static
* @final
*/
MASK: _PREFIX + 'mask',
/**
* The MASK_CONTAINER class is applied to the Element that is passed into
* the F2.UI.{{#crossLink "F2.UI/showMask"}}{{/crossLink}} method.
* @property MASK_CONTAINER
* @type string
* @static
* @final
*/
MASK_CONTAINER: _PREFIX + 'mask-container'
};
})(),
/**
* Events constants
* @class F2.Constants.Events
*/
Events: (function() {
/** @private */
var _APP_EVENT_PREFIX = 'App.';
/** @private */
var _CONTAINER_EVENT_PREFIX = 'Container.';
return {
/**
* The APP\_SYMBOL\_CHANGE event is fired when the symbol is changed in an
* app. It is up to the app developer to fire this event.
* Returns an object with the symbol and company name:
*
* { symbol: 'MSFT', name: 'Microsoft Corp (NASDAQ)' }
*
* @property APP_SYMBOL_CHANGE
* @type string
* @static
* @final
*/
APP_SYMBOL_CHANGE: _APP_EVENT_PREFIX + 'symbolChange',
/**
* The APP\_WIDTH\_CHANGE event will be fired by the container when the
* width of an app is changed. The app's instanceId should be concatenated
* to this constant.
* Returns an object with the gridSize and width in pixels:
*
* { gridSize:8, width:620 }
*
* @property APP_WIDTH_CHANGE
* @type string
* @static
* @final
*/
APP_WIDTH_CHANGE: _APP_EVENT_PREFIX + 'widthChange.',
/**
* The CONTAINER\_SYMBOL\_CHANGE event is fired when the symbol is changed
* at the container level. This event should only be fired by the
* container or container provider.
* Returns an object with the symbol and company name:
*
* { symbol: 'MSFT', name: 'Microsoft Corp (NASDAQ)' }
*
* @property CONTAINER_SYMBOL_CHANGE
* @type string
* @static
* @final
*/
CONTAINER_SYMBOL_CHANGE: _CONTAINER_EVENT_PREFIX + 'symbolChange',
/**
* The CONTAINER\_WIDTH\_CHANGE event will be fired by the container when
* the width of the container has changed.
* @property CONTAINER_WIDTH_CHANGE
* @type string
* @static
* @final
*/
CONTAINER_WIDTH_CHANGE: _CONTAINER_EVENT_PREFIX + 'widthChange'
};
})(),
JSONP_CALLBACK: 'F2_jsonpCallback_',
/**
* Constants for use with cross-domain sockets
* @class F2.Constants.Sockets
* @protected
*/
Sockets: {
/**
* The EVENT message is sent whenever
* F2.Events.{{#crossLink "F2.Events/emit"}}{{/crossLink}} is fired
* @property EVENT
* @type string
* @static
* @final
*/
EVENT: '__event__',
/**
* The LOAD message is sent when an iframe socket initially loads.
* Returns a JSON string that represents:
*
* [ App, AppManifest]
*
* @property LOAD
* @type string
* @static
* @final
*/
LOAD: '__socketLoad__',
/**
* The RPC message is sent when a method is passed up from within a secure
* app page.
* @property RPC
* @type string
* @static
* @final
*/
RPC: '__rpc__',
/**
* The RPC\_CALLBACK message is sent when a call back from an RPC method is
* fired.
* @property RPC_CALLBACK
* @type string
* @static
* @final
*/
RPC_CALLBACK: '__rpcCallback__',
/**
* The UI\_RPC message is sent when a UI method called.
* @property UI_RPC
* @type string
* @static
* @final
*/
UI_RPC: '__uiRpc__'
},
/**
* The available view types to apps. The view should be specified by applying
* the {{#crossLink "F2.Constants.Css"}}{{/crossLink}}.APP\_VIEW class to the
* containing DOM Element. A DATA\_ATTRIBUTE attribute should be added to the
* Element as well which defines what view type is represented.
* The `hide` class can be applied to views that should be hidden by default.
* @class F2.Constants.Views
*/
Views: {
/**
* The DATA_ATTRIBUTE should be placed on the DOM Element that contains the
* view.
* @property DATA_ATTRIBUTE
* @type string
* @static
* @final
*/
DATA_ATTRIBUTE: 'data-f2-view',
/**
* The ABOUT view gives details about the app.
* @property ABOUT
* @type string
* @static
* @final
*/
ABOUT: 'about',
/**
* The HELP view provides users with help information for using an app.
* @property HELP
* @type string
* @static
* @final
*/
HELP: 'help',
/**
* The HOME view is the main view for an app. This view should always
* be provided by an app.
* @property HOME
* @type string
* @static
* @final
*/
HOME: 'home',
/**
* The REMOVE view is a special view that handles the removal of an app
* from the container.
* @property REMOVE
* @type string
* @static
* @final
*/
REMOVE: 'remove',
/**
* The SETTINGS view provides users the ability to modify advanced settings
* for an app.
* @property SETTINGS
* @type string
* @static
* @final
*/
SETTINGS: 'settings'
}
});
/**
* Handles [Context](../../app-development.html#context) passing from
* containers to apps and apps to apps.
* @class F2.Events
*/
F2.extend('Events', (function() {
// init EventEmitter
var _events = new EventEmitter2({
wildcard:true
});
// unlimited listeners, set to > 0 for debugging
_events.setMaxListeners(0);
return {
/**
* Same as F2.Events.emit except that it will not send the event
* to all sockets.
* @method _socketEmit
* @private
* @param {string} event The event name
* @param {object} [arg]* The arguments to be passed
*/
_socketEmit: function() {
return EventEmitter2.prototype.emit.apply(_events, [].slice.call(arguments));
},
/**
* Execute each of the listeners that may be listening for the specified
* event name in order with the list of arguments.
* @method emit
* @param {string} event The event name
* @param {object} [arg]* The arguments to be passed
*/
emit: function() {
F2.Rpc.broadcast(F2.Constants.Sockets.EVENT, [].slice.call(arguments));
return EventEmitter2.prototype.emit.apply(_events, [].slice.call(arguments));
},
/**
* Adds a listener that will execute n times for the event before being
* removed. The listener is invoked only the first time the event is
* fired, after which it is removed.
* @method many
* @param {string} event The event name
* @param {int} timesToListen The number of times to execute the event
* before being removed
* @param {function} listener The function to be fired when the event is
* emitted
*/
many: function(event, timesToListen, listener) {
return _events.many(event, timesToListen, listener);
},
/**
* Remove a listener for the specified event.
* @method off
* @param {string} event The event name
* @param {function} listener The function that will be removed
*/
off: function(event, listener) {
return _events.off(event, listener);
},
/**
* Adds a listener for the specified event
* @method on
* @param {string} event The event name
* @param {function} listener The function to be fired when the event is
* emitted
*/
on: function(event, listener){
return _events.on(event, listener);
},
/**
* Adds a one time listener for the event. The listener is invoked only
* the first time the event is fired, after which it is removed.
* @method once
* @param {string} event The event name
* @param {function} listener The function to be fired when the event is
* emitted
*/
once: function(event, listener) {
return _events.once(event, listener);
}
};
})());
/**
* Handles socket communication between the container and secure apps
* @class F2.Rpc
*/
F2.extend('Rpc', (function(){
var _callbacks = {};
var _secureAppPagePath = '';
var _apps = {};
var _rEvents = new RegExp('^' + F2.Constants.Sockets.EVENT);
var _rRpc = new RegExp('^' + F2.Constants.Sockets.RPC);
var _rRpcCallback = new RegExp('^' + F2.Constants.Sockets.RPC_CALLBACK);
var _rSocketLoad = new RegExp('^' + F2.Constants.Sockets.LOAD);
var _rUiCall = new RegExp('^' + F2.Constants.Sockets.UI_RPC);
/**
* Creates a socket connection from the app to the container using
* <a href="http://easyxdm.net" target="_blank">easyXDM</a>.
* @method _createAppToContainerSocket
* @private
*/
var _createAppToContainerSocket = function() {
var appConfig; // socket closure
var isLoaded = false;
// its possible for messages to be received before the socket load event has
// happened. We'll save off these messages and replay them once the socket
// is ready
var messagePlayback = [];
var socket = new easyXDM.Socket({
onMessage: function(message, origin){
// handle Socket Load
if (!isLoaded && _rSocketLoad.test(message)) {
message = message.replace(_rSocketLoad, '');
var appParts = F2.parse(message);
// make sure we have the AppConfig and AppManifest
if (appParts.length == 2) {
appConfig = appParts[0];
// save socket
_apps[appConfig.instanceId] = {
config:appConfig,
socket:socket
};
// register app
F2.registerApps([appConfig], [appParts[1]]);
// socket message playback
jQuery.each(messagePlayback, function(i, e) {
_onMessage(appConfig, message, origin);
});
isLoaded = true;
}
} else if (isLoaded) {
// pass everyting else to _onMessage
_onMessage(appConfig, message, origin);
} else {
//F2.log('socket not ready, queuing message', message);
messagePlayback.push(message);
}
}
});
};
/**
* Creates a socket connection from the container to the app using
* <a href="http://easyxdm.net" target="_blank">easyXDM</a>.
* @method _createContainerToAppSocket
* @private
* @param {appConfig} appConfig The F2.AppConfig object
* @param {F2.AppManifest} appManifest The F2.AppManifest object
*/
var _createContainerToAppSocket = function(appConfig, appManifest) {
var container = jQuery(appConfig.root);
if (!container.is('.' + F2.Constants.Css.APP_CONTAINER)) {
container.find('.' + F2.Constants.Css.APP_CONTAINER);
}
if (!container.length) {
F2.log('Unable to locate app in order to establish secure connection.');
return;
}
var iframeProps = {
scrolling:'no',
style:{
width:'100%'
}
};
if (appConfig.height) {
iframeProps.style.height = appConfig.height + 'px';
}
var socket = new easyXDM.Socket({
remote: _secureAppPagePath,
container: container.get(0),
props:iframeProps,
onMessage: function(message, origin) {
// pass everything to _onMessage
_onMessage(appConfig, message, origin);
},
onReady: function() {
socket.postMessage(F2.Constants.Sockets.LOAD + F2.stringify([appConfig, appManifest], F2.appConfigReplacer));
}
});
return socket;
};
/**
* @method _createRpcCallback
* @private
* @param {string} instanceId The app's Instance ID
* @param {function} callbackId The callback ID
* @return {function} A function to make the RPC call
*/
var _createRpcCallback = function(instanceId, callbackId) {
return function() {
F2.Rpc.call(
instanceId,
F2.Constants.Sockets.RPC_CALLBACK,
callbackId,
[].slice.call(arguments).slice(2)
);
};
};
/**
* Handles messages that come across the sockets
* @method _onMessage
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @param {string} message The socket message
* @param {string} origin The originator
*/
var _onMessage = function(appConfig, message, origin) {
var obj, func;
function parseFunction(parent, functionName) {
var path = String(functionName).split('.');
for (var i = 0; i < path.length; i++) {
if (parent[path[i]] === undefined) {
parent = undefined;
break;
}
parent = parent[path[i]];
}
return parent;
}
function parseMessage(regEx, message, instanceId) {
var o = F2.parse(message.replace(regEx, ''));
// if obj.callbacks
// for each callback
// for each params
// if callback matches param
// replace param with _createRpcCallback(app.instanceId, callback)
if (o.params && o.params.length && o.callbacks && o.callbacks.length) {
jQuery.each(o.callbacks, function(i, c) {
jQuery.each(o.params, function(i, p) {
if (c == p) {
o.params[i] = _createRpcCallback(instanceId, c);
}
});
});
}
return o;
}
// handle UI Call
if (_rUiCall.test(message)) {
obj = parseMessage(_rUiCall, message, appConfig.instanceId);
func = parseFunction(appConfig.ui, obj.functionName);
// if we found the function, call it
if (func !== undefined) {
func.apply(appConfig.ui, obj.params);
} else {
F2.log('Unable to locate UI RPC function: ' + obj.functionName);
}
// handle RPC
} else if (_rRpc.test(message)) {
obj = parseMessage(_rRpc, message, appConfig.instanceId);
func = parseFunction(window, obj.functionName);
if (func !== undefined) {
func.apply(func, obj.params);
} else {
F2.log('Unable to locate RPC function: ' + obj.functionName);
}
// handle RPC Callback
} else if (_rRpcCallback.test(message)) {
obj = parseMessage(_rRpcCallback, message, appConfig.instanceId);
if (_callbacks[obj.functionName] !== undefined) {
_callbacks[obj.functionName].apply(_callbacks[obj.functionName], obj.params);
delete _callbacks[obj.functionName];
}
// handle Events
} else if (_rEvents.test(message)) {
obj = parseMessage(_rEvents, message, appConfig.instanceId);
F2.Events._socketEmit.apply(F2.Events, obj);
}
};
/**
* Registers a callback function
* @method _registerCallback
* @private
* @param {function} callback The callback function
* @return {string} The callback ID
*/
var _registerCallback = function(callback) {
var callbackId = F2.guid();
_callbacks[callbackId] = callback;
return callbackId;
};
return {
/**
* Broadcast an RPC function to all sockets
* @method broadcast
* @param {string} messageType The message type
* @param {Array} params The parameters to broadcast
*/
broadcast: function(messageType, params) {
// check valid messageType
var message = messageType + F2.stringify(params);
jQuery.each(_apps, function(i, a) {
a.socket.postMessage(message);
});
},
/**
* Calls a remote function
* @method call
* @param {string} instanceId The app's Instance ID
* @param {string} messageType The message type
* @param {string} functionName The name of the remote function
* @param {Array} params An array of parameters to pass to the remote
* function. Any functions found within the params will be treated as a
* callback function.
*/
call: function(instanceId, messageType, functionName, params) {
// loop through params and find functions and convert them to callbacks
var callbacks = [];
jQuery.each(params, function(i, e) {
if (typeof e === 'function') {
var cid = _registerCallback(e);
params[i] = cid;
callbacks.push(cid);
}
});
// check valid messageType
_apps[instanceId].socket.postMessage(
messageType + F2.stringify({
functionName:functionName,
params:params,
callbacks:callbacks
})
);
},
/**
* Init function which tells F2.Rpc whether it is running at the container-
* level or the app-level. This method is generally called by
* F2.{{#crossLink "F2/init"}}{{/crossLink}}
* @method init
* @param {string} [secureAppPagePath] The
* {{#crossLink "F2.ContainerConfig"}}{{/crossLink}}.secureAppPagePath
* property
*/
init: function(secureAppPagePath) {
_secureAppPagePath = secureAppPagePath;
if (!_secureAppPagePath) {
_createAppToContainerSocket();
}
},
/**
* Determines whether the Instance ID is considered to be 'remote'. This is
* determined by checking if 1) the app has an open socket and 2) whether
* F2.Rpc is running inside of an iframe
* @method isRemote
* @param {string} instanceId The Instance ID
* @return {bool} True if there is an open socket
*/
isRemote: function(instanceId) {
return (
// we have an app
_apps[instanceId] !== undefined &&
// the app is secure
_apps[instanceId].config.isSecure &&
// we can't access the iframe
jQuery(_apps[instanceId].config.root).find('iframe').length === 0
);
},
/**
* Creates a container-to-app or app-to-container socket for communication
* @method register
* @param {F2.AppConfig} [appConfig] The F2.AppConfig object
* @param {F2.AppManifest} [appManifest] The F2.AppManifest object
*/
register: function(appConfig, appManifest) {
if (!!appConfig && !!appManifest) {
_apps[appConfig.instanceId] = {
config:appConfig,
socket:_createContainerToAppSocket(appConfig, appManifest)
};
} else {
F2.log('Unable to register socket connection. Please check container configuration.');
}
}
};
})());
F2.extend('UI', (function(){
var _containerConfig;
/**
* UI helper methods
* @class F2.UI
* @constructor
* @param {F2.AppConfig} appConfig The F2.AppConfig object
*/
var UI_Class = function(appConfig) {
var _appConfig = appConfig;
var $root = jQuery(appConfig.root);
var _updateHeight = function(height) {
height = height || jQuery(_appConfig.root).outerHeight();
if (F2.Rpc.isRemote(_appConfig.instanceId)) {
F2.Rpc.call(
_appConfig.instanceId,
F2.Constants.Sockets.UI_RPC,
'updateHeight',
[
height
]
);
} else {
_appConfig.height = height;
$root.find('iframe').height(_appConfig.height);
}
};
return {
/**
* Removes a overlay from an Element on the page
* @method hideMask
* @param {string|Element} selector The Element or selector to an Element
* that currently contains the loader
*/
hideMask: function(selector) {
F2.UI.hideMask(_appConfig.instanceId, selector);
},
/**
* Helper methods for creating and using Modals
* @class F2.UI.Modals
* @for F2.UI
*/
Modals: (function(){
var _renderAlert = function(message) {
return [
'<div class="modal">',
'<header class="modal-header">',
'<h3>Alert!</h3>',
'</header>',
'<div class="modal-body">',
'<p>',
message,
'</p>',
'</div>',
'<div class="modal-footer">',
'<button class="btn btn-primary btn-ok">OK</button>',
'</div>',
'</div>'
].join('');
};
var _renderConfirm = function(message) {
return [
'<div class="modal">',
'<header class="modal-header">',
'<h3>Confirm</h3>',
'</header>',
'<div class="modal-body">',
'<p>',
message,
'</p>',
'</div>',
'<div class="modal-footer">',
'<button type="button" class="btn btn-primary btn-ok">OK</button>',
'<button type="button" class="btn btn-cancel">Cancel</button">',
'</div>',
'</div>'
].join('');
};
return {
/**
* Display an alert message on the page
* @method alert
* @param {string} message The message to be displayed
* @param {function} [callback] The callback to be fired when the user
* closes the dialog
* @for F2.UI.Modals
*/
alert: function(message, callback) {
if (!F2.isInit()) {
F2.log('F2.init() must be called before F2.UI.Modals.alert()');
return;
}
if (F2.Rpc.isRemote(_appConfig.instanceId)) {
F2.Rpc.call(
_appConfig.instanceId,
F2.Constants.Sockets.UI_RPC,
'Modals.alert',
[].slice.call(arguments)
);
} else {
// display the alert
jQuery(_renderAlert(message))
.on('show', function() {
var modal = this;
jQuery(modal).find('.btn-primary').on('click', function() {
jQuery(modal).modal('hide').remove();
(callback || jQuery.noop)();
});
})
.modal({backdrop:true});
}
},
/**
* Display a confirm message on the page
* @method confirm
* @param {string} message The message to be displayed
* @param {function} okCallback The function that will be called when the OK
* button is pressed
* @param {function} cancelCallback The function that will be called when
* the Cancel button is pressed
* @for F2.UI.Modals
*/
confirm: function(message, okCallback, cancelCallback) {
if (!F2.isInit()) {
F2.log('F2.init() must be called before F2.UI.Modals.confirm()');
return;
}
if (F2.Rpc.isRemote(_appConfig.instanceId)) {
F2.Rpc.call(
_appConfig.instanceId,
F2.Constants.Sockets.UI_RPC,
'Modals.confirm',
[].slice.call(arguments)
);
} else {
// display the alert
jQuery(_renderConfirm(message))
.on('show', function() {
var modal = this;
jQuery(modal).find('.btn-ok').on('click', function() {
jQuery(modal).modal('hide').remove();
(okCallback || jQuery.noop)();
});
jQuery(modal).find('.btn-cancel').on('click', function() {
jQuery(modal).modal('hide').remove();
(cancelCallback || jQuery.noop)();
});
})
.modal({backdrop:true});
}
}
};
})(),
/**
* Sets the title of the app as shown in the browser. Depending on the
* container HTML, this method may do nothing if the container has not been
* configured properly or else the container provider does not allow Title's
* to be set.
* @method setTitle
* @params {string} title The title of the app
* @for F2.UI
*/
setTitle: function(title) {
if (F2.Rpc.isRemote(_appConfig.instanceId)) {
F2.Rpc.call(
_appConfig.instanceId,
F2.Constants.Sockets.UI_RPC,
'setTitle',
[
title
]
);
} else {
jQuery(_appConfig.root).find('.' + F2.Constants.Css.APP_TITLE).text(title);
}
},
/**
* Display an ovarlay over an Element on the page
* @method showMask
* @param {string|Element} selector The Element or selector to an Element
* over which to display the loader
* @param {bool} showLoading Display a loading icon
*/
showMask: function(selector, showLoader) {
F2.UI.showMask(_appConfig.instanceId, selector, showLoader);
},
/**
* For secure apps, this method updates the size of the iframe that
* contains the app. **Note: It is recommended that app developers call
* this method anytime Elements are added or removed from the DOM**
* @method updateHeight
* @params {int} height The height of the app
*/
updateHeight: _updateHeight,
/**
* Helper methods for creating and using Views
* @class F2.UI.Views
* @for F2.UI
*/
Views: (function(){
var _events = new EventEmitter2();
var _rValidEvents = /change/i;
// unlimited listeners, set to > 0 for debugging
_events.setMaxListeners(0);
var _isValid = function(eventName) {
if (_rValidEvents.test(eventName)) {
return true;
} else {
F2.log('"' + eventName + '" is not a valid F2.UI.Views event name');
return false;
}
};
return {
/**
* Change the current view for the app or add an event listener
* @method change
* @param {string|function} [input] If a string is passed in, the view
* will be changed for the app. If a function is passed in, a change
* event listener will be added.
* @for F2.UI.Views
*/
change: function(input) {
if (typeof input === 'function') {
this.on('change', input);
} else if (typeof input === 'string') {
if (_appConfig.isSecure && !F2.Rpc.isRemote(_appConfig.instanceId)) {
F2.Rpc.call(
_appConfig.instanceId,
F2.Constants.Sockets.UI_RPC,
'Views.change',
[].slice.call(arguments)
);
} else if (F2.inArray(input, _appConfig.views)) {
jQuery('.' + F2.Constants.Css.APP_VIEW, $root)
.addClass('hide')
.filter('[data-f2-view="' + input + '"]', $root)
.removeClass('hide');
_updateHeight();
_events.emit('change', input);
}
}
},
/**
* Removes a view event listener
* @method off
* @param {string} event The event name
* @param {function} listener The function that will be removed
* @for F2.UI.Views
*/
off: function(event, listener) {
if (_isValid(event)) {
_events.off(event, listener);
}
},
/**
* Adds a view event listener
* @method on
* @param {string} event The event name
* @param {function} listener The function to be fired when the event is
* emitted
* @for F2.UI.Views
*/
on: function(event, listener) {
if (_isValid(event)) {
_events.on(event, listener);
}
}
};
})()
};
};
/**
* Removes a overlay from an Element on the page
* @method hideMask
* @static
* @param {string} instanceId The Instance ID of the app
* @param {string|Element} selector The Element or selector to an Element
* that currently contains the loader
* @for F2.UI
*/
UI_Class.hideMask = function(instanceId, selector) {
if (!F2.isInit()) {
F2.log('F2.init() must be called before F2.UI.hideMask()');
return;
}
if (F2.Rpc.isRemote(instanceId) && !jQuery(selector).is('.' + F2.Constants.Css.APP)) {
F2.Rpc.call(
instanceId,
F2.Constants.Sockets.RPC,
'F2.UI.hideMask',
[
instanceId,
// must only pass the selector argument. if we pass an Element there
// will be F2.stringify() errors
jQuery(selector).selector
]
);
} else {
var container = jQuery(selector);
container.find('> .' + F2.Constants.Css.MASK).remove();
container.removeClass(F2.Constants.Css.MASK_CONTAINER);
// if the element contains this data property, we need to reset static
// position
if (container.data(F2.Constants.Css.MASK_CONTAINER)) {
container.css({'position':'static'});
}
}
};
/**
*
* @method init
* @static
* @param {F2.ContainerConfig} containerConfig The F2.ContainerConfig object
*/
UI_Class.init = function(containerConfig) {
_containerConfig = containerConfig;
// set defaults
_containerConfig.UI = jQuery.extend(true, {}, F2.ContainerConfig.UI, _containerConfig.UI || {});
};
/**
* Display an ovarlay over an Element on the page
* @method showMask
* @static
* @param {string} instanceId The Instance ID of the app
* @param {string|Element} selector The Element or selector to an Element
* over which to display the loader
* @param {bool} showLoading Display a loading icon
*/
UI_Class.showMask = function(instanceId, selector, showLoading) {
if (!F2.isInit()) {
F2.log('F2.init() must be called before F2.UI.showMask()');
return;
}
if (F2.Rpc.isRemote(instanceId) && jQuery(selector).is('.' + F2.Constants.Css.APP)) {
F2.Rpc.call(
instanceId,
F2.Constants.Sockets.RPC,
'F2.UI.showMask',
[
instanceId,
// must only pass the selector argument. if we pass an Element there
// will be F2.stringify() errors
jQuery(selector).selector,
showLoading
]
);
} else {
if (showLoading && !_containerConfig.UI.Mask.loadingIcon) {
F2.log('Unable to display loading icon. Please set F2.ContainerConfig.UI.Mask.loadingIcon when calling F2.init();');
}
var container = jQuery(selector).addClass(F2.Constants.Css.MASK_CONTAINER);
var mask = jQuery('<div>')
.height('100%' /*container.outerHeight()*/)
.width('100%' /*container.outerWidth()*/)
.addClass(F2.Constants.Css.MASK);
// set inline styles if useClasses is false
if (!_containerConfig.UI.Mask.useClasses) {
mask.css({
'background-color':_containerConfig.UI.Mask.backgroundColor,
'background-image': !!_containerConfig.UI.Mask.loadingIcon ? ('url(' + _containerConfig.UI.Mask.loadingIcon + ')') : '',
'background-position':'50% 50%',
'background-repeat':'no-repeat',
'display':'block',
'left':0,
'min-height':30,
'padding':0,
'position':'absolute',
'top':0,
'z-index':_containerConfig.UI.Mask.zIndex,
'filter':'alpha(opacity=' + (_containerConfig.UI.Mask.opacity * 100) + ')',
'opacity':_containerConfig.UI.Mask.opacity
});
}
// only set the position if the container is currently static
if (container.css('position') === 'static') {
container.css({'position':'relative'});
// setting this data property tells hideMask to set the position
// back to static
container.data(F2.Constants.Css.MASK_CONTAINER, true);
}
// add the mask to the container
container.append(mask);
}
};
return UI_Class;
})());
/**
* Root namespace of the F2 SDK
* @module f2
* @class F2
*/
F2.extend('', (function() {
var _apps = {};
var _config = false;
var _bUsesAppHandlers = false;
var _sAppHandlerToken = F2.AppHandlers.__f2GetToken();
/**
* Appends the app's html to the DOM
* @method _afterAppRender
* @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @param {string} html The string of html
* @return {Element} The DOM Element that contains the app
*/
var _afterAppRender = function(appConfig, html) {
var handler = _config.afterAppRender || function(appConfig, html) {
return jQuery(html).appendTo('body');
};
var appContainer = handler(appConfig, html);
if ( !! _config.afterAppRender && !appContainer) {
F2.log('F2.ContainerConfig.afterAppRender() must return the DOM Element that contains the app');
return;
}
else {
// apply APP class and Instance ID
jQuery(appContainer).addClass(F2.Constants.Css.APP);
return appContainer.get(0);
}
};
/**
* Renders the html for an app.
* @method _appRender
* @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @param {string} html The string of html
*/
var _appRender = function(appConfig, html) {
// apply APP_CONTAINER class
html = _outerHtml(jQuery(html).addClass(F2.Constants.Css.APP_CONTAINER + ' ' + appConfig.appId));
// optionally apply wrapper html
if (_config.appRender) {
html = _config.appRender(appConfig, html);
}
// apply APP class and instanceId
return _outerHtml(html);
};
/**
* Rendering hook to allow containers to render some html prior to an app
* loading
* @method _beforeAppRender
* @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @return {Element} The DOM Element surrounding the app
*/
var _beforeAppRender = function(appConfig) {
var handler = _config.beforeAppRender || jQuery.noop;
return handler(appConfig);
};
/**
* Handler to inform the container that a script failed to load
* @method _onScriptLoadFailure
* @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @param scriptInfo The path of the script that failed to load or the exception info
* for the inline script that failed to execute
*/
var _appScriptLoadFailed = function(appConfig, scriptInfo) {
var handler = _config.appScriptLoadFailed || jQuery.noop;
return handler(appConfig, scriptInfo);
};
/**
* Adds properties to the AppConfig object
* @method _createAppConfig
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @return {F2.AppConfig} The new F2.AppConfig object, prepopulated with
* necessary properties
*/
var _createAppConfig = function(appConfig) {
// make a copy of the app config to ensure that the original is not modified
appConfig = jQuery.extend(true, {}, appConfig);
// create the instanceId for the app
appConfig.instanceId = appConfig.instanceId || F2.guid();
// default the views if not provided
appConfig.views = appConfig.views || [];
if (!F2.inArray(F2.Constants.Views.HOME, appConfig.views)) {
appConfig.views.push(F2.Constants.Views.HOME);
}
return appConfig;
};
/**
* Adds properties to the ContainerConfig object to take advantage of defaults
* @method _hydrateContainerConfig
* @private
* @param {F2.ContainerConfig} containerConfig The F2.ContainerConfig object
*/
var _hydrateContainerConfig = function(containerConfig) {
if (!containerConfig.scriptErrorTimeout) {
containerConfig.scriptErrorTimeout = F2.ContainerConfig.scriptErrorTimeout;
}
if (containerConfig.debugMode !== true) {
containerConfig.debugMode = F2.ContainerConfig.debugMode;
}
};
/**
* Attach app events
* @method _initAppEvents
* @private
*/
var _initAppEvents = function(appConfig) {
jQuery(appConfig.root).on('click', '.' + F2.Constants.Css.APP_VIEW_TRIGGER + '[' + F2.Constants.Views.DATA_ATTRIBUTE + ']', function(event) {
event.preventDefault();
var view = jQuery(this).attr(F2.Constants.Views.DATA_ATTRIBUTE).toLowerCase();
// handle the special REMOVE view
if (view == F2.Constants.Views.REMOVE) {
F2.removeApp(appConfig.instanceId);
}
else {
appConfig.ui.Views.change(view);
}
});
};
/**
* Attach container Events
* @method _initContainerEvents
* @private
*/
var _initContainerEvents = function() {
var resizeTimeout;
var resizeHandler = function() {
F2.Events.emit(F2.Constants.Events.CONTAINER_WIDTH_CHANGE);
};
jQuery(window).on('resize', function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(resizeHandler, 100);
});
};
/**
* Has the container been init?
* @method _isInit
* @private
* @return {bool} True if the container has been init
*/
var _isInit = function() {
return !!_config;
};
/**
* Instantiates each app from it's appConfig and stores that in a local private collection
* @method _createAppInstance
* @private
* @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}} objects
*/
var _createAppInstance = function(appConfig, appContent) {
// instantiate F2.UI
appConfig.ui = new F2.UI(appConfig);
// instantiate F2.App
if (F2.Apps[appConfig.appId] !== undefined) {
if (typeof F2.Apps[appConfig.appId] === 'function') {
// IE
setTimeout(function() {
_apps[appConfig.instanceId].app = new F2.Apps[appConfig.appId](appConfig, appContent, appConfig.root);
if (_apps[appConfig.instanceId].app['init'] !== undefined) {
_apps[appConfig.instanceId].app.init();
}
}, 0);
}
else {
F2.log('app initialization class is defined but not a function. (' + appConfig.appId + ')');
}
}
};
/**
* Loads the app's html/css/javascript
* @method loadApp
* @private
* @param {Array} appConfigs An array of
* {{#crossLink "F2.AppConfig"}}{{/crossLink}} objects
* @param {F2.AppManifest} [appManifest] The AppManifest object
*/
var _loadApps = function(appConfigs, appManifest) {
appConfigs = [].concat(appConfigs);
// check for secure app
if (appConfigs.length == 1 && appConfigs[0].isSecure && !_config.isSecureAppPage) {
_loadSecureApp(appConfigs[0], appManifest);
return;
}
// check that the number of apps in manifest matches the number requested
if (appConfigs.length != appManifest.apps.length) {
F2.log('The number of apps defined in the AppManifest do not match the number requested.', appManifest);
return;
}
// Fn for loading manifest Styles
var _loadStyles = function(styles, cb) {
// Attempt to use the user provided method
if (_config.loadStyles) {
_config.loadStyles(styles, cb);
}
else {
// load styles, see #101
var stylesFragment = null,
useCreateStyleSheet = !! document.createStyleSheet;
jQuery.each(styles, function(i, e) {
if (useCreateStyleSheet) {
document.createStyleSheet(e);
}
else {
stylesFragment = stylesFragment || [];
stylesFragment.push('<link rel="stylesheet" type="text/css" href="' + e + '"/>');
}
});
if (stylesFragment) {
jQuery('head').append(stylesFragment.join(''));
}
cb();
}
};
// Fn for loading manifest Scripts
var _loadScripts = function(scripts, cb) {
// Attempt to use the user provided method
if (_config.loadScripts) {
_config.loadScripts(scripts, cb);
}
else {
if (scripts.length) {
var scriptCount = scripts.length;
var scriptsLoaded = 0;
// Check for IE10+ so that we don't rely on onreadystatechange
var readyStates = ('addEventListener' in window) ? {} : {
'loaded': true,
'complete': true
};
// Log and emit event for the failed (400,500) scripts
var _error = function(e) {
setTimeout(function() {
var evtData = {
src: e.target.src,
appId: appConfigs[0].appId
};
// Send error to console
F2.log('Script defined in \'' + evtData.appId + '\' failed to load \'' + evtData.src + '\'');
// Emit event
F2.Events.emit('RESOURCE_FAILED_TO_LOAD', evtData);
if (!_bUsesAppHandlers) {
_appScriptLoadFailed(appConfigs[0], evtData.src);
}
else {
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED,
appConfigs[0],
evtData.src
);
}
}, _config.scriptErrorTimeout); // Defaults to 7000
};
// Load scripts and eval inlines once complete
jQuery.each(scripts, function(i, e) {
var doc = document,
script = doc.createElement('script'),
resourceUrl = e;
// If in debugMode, add cache buster to each script URL
if (_config.debugMode) {
resourceUrl += '?cachebuster=' + new Date().getTime();
}
// Scripts needed to be loaded in order they're defined in the AppManifest
script.async = false;
// Add other attrs
script.src = resourceUrl;
script.type = 'text/javascript';
script.charset = 'utf-8';
script.onerror = _error;
// Use a closure for the load event so that we can dereference the original script
script.onload = script.onreadystatechange = function(e) {
e = e || window.event; // For older IE
if (e.type == 'load' || readyStates[script.readyState]) {
// Done, cleanup
script.onload = script.onreadystatechange = script.onerror = null;
// Dereference script
script = null;
// Are we done loading all scripts for this app?
if (++scriptsLoaded === scriptCount) {
cb();
}
}
};
doc.body.appendChild(script);
});
}
else {
cb();
}
}
};
var _loadInlineScripts = function(inlines, cb) {
// Attempt to use the user provided method
if (_config.loadInlineScripts) {
_config.loadInlineScripts(inlines, cb);
}
else {
for (var i = 0, len = inlines.length; i < len; i++) {
try {
eval(inlines[i]);
}
catch (exception) {
F2.log('Error loading inline script: ' + exception + '\n\n' + inlines[i]);
if (!_bUsesAppHandlers) {
_appScriptLoadFailed(appConfigs[0], exception);
}
else {
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED,
appConfigs[0],
exception
);
}
}
}
cb();
}
};
// Determine whether an element has been added to the page
var elementInDocument = function(element) {
if (element) {
while (element.parentNode) {
element = element.parentNode;
if (element === document) {
return true;
}
}
}
return false;
};
// Fn for loading manifest app html
var _loadHtml = function(apps) {
jQuery.each(apps, function(i, a) {
if (!_bUsesAppHandlers) {
// load html and save the root node
appConfigs[i].root = _afterAppRender(appConfigs[i], _appRender(appConfigs[i], a.html));
}
else {
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_RENDER,
appConfigs[i], // the app config
_outerHtml(a.html)
);
var appId = appConfigs[i].appId;
var root = appConfigs[i].root;
if (!root) {
throw ('Root for ' + appId + ' must be a native DOM element and cannot be null or undefined. Check your AppHandler callbacks to ensure you have set App root to a native DOM element.');
}
if (!elementInDocument(root)) {
throw ('App root for ' + appId + ' was not appended to the DOM. Check your AppHandler callbacks to ensure you have rendered the app root to the DOM.');
}
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_RENDER_AFTER,
appConfigs[i] // the app config
);
if (!F2.isNativeDOMNode(root)) {
throw ('App root for ' + appId + ' must be a native DOM element. Check your AppHandler callbacks to ensure you have set app root to a native DOM element.');
}
$(root).addClass(F2.Constants.Css.APP_CONTAINER + ' ' + appId);
}
// init events
_initAppEvents(appConfigs[i]);
});
};
// Pull out the manifest data
var scripts = appManifest.scripts || [];
var styles = appManifest.styles || [];
var inlines = appManifest.inlineScripts || [];
var apps = appManifest.apps || [];
// Finally, load the styles, html, and scripts
_loadStyles(styles, function() {
// Put the html on the page
_loadHtml(apps);
// Add the script content to the page
_loadScripts(scripts, function() {
// Load any inline scripts
_loadInlineScripts(inlines, function() {
// Create the apps
jQuery.each(appConfigs, function(i, a) {
_createAppInstance(a, appManifest.apps[i]);
});
});
});
});
};
/**
* Loads the app's html/css/javascript into an iframe
* @method loadSecureApp
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @param {F2.AppManifest} appManifest The app's html/css/js to be loaded into the
* page.
*/
var _loadSecureApp = function(appConfig, appManifest) {
// make sure the container is configured for secure apps
if (_config.secureAppPagePath) {
if (!_bUsesAppHandlers) {
// create the html container for the iframe
appConfig.root = _afterAppRender(appConfig, _appRender(appConfig, '<div></div>'));
}
else {
var $root = jQuery(appConfig.root);
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_RENDER,
appConfig, // the app config
appManifest.html
);
if ($root.parents('body:first').length === 0) {
throw ('App was never rendered on the page. Please check your AppHandler callbacks to ensure you have rendered the app root to the DOM.');
}
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_RENDER_AFTER,
appConfig // the app config
);
if (!appConfig.root) {
throw ('App Root must be a native dom node and can not be null or undefined. Please check your AppHandler callbacks to ensure you have set App Root to a native dom node.');
}
if (!F2.isNativeDOMNode(appConfig.root)) {
throw ('App Root must be a native dom node. Please check your AppHandler callbacks to ensure you have set App Root to a native dom node.');
}
jQuery(appConfig.root).addClass(F2.Constants.Css.APP_CONTAINER + ' ' + appConfig.appId);
}
// instantiate F2.UI
appConfig.ui = new F2.UI(appConfig);
// init events
_initAppEvents(appConfig);
// create RPC socket
F2.Rpc.register(appConfig, appManifest);
}
else {
F2.log('Unable to load secure app: "secureAppPagePath" is not defined in F2.ContainerConfig.');
}
};
var _outerHtml = function(html) {
return jQuery('<div></div>').append(html).html();
};
/**
* Checks if the app is valid
* @method _validateApp
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @returns {bool} True if the app is valid
*/
var _validateApp = function(appConfig) {
// check for valid app configurations
if (!appConfig.appId) {
F2.log('"appId" missing from app object');
return false;
}
else if (!appConfig.root && !appConfig.manifestUrl) {
F2.log('"manifestUrl" missing from app object');
return false;
}
return true;
};
/**
* Checks if the ContainerConfig is valid
* @method _validateContainerConfig
* @private
* @returns {bool} True if the config is valid
*/
var _validateContainerConfig = function() {
if (_config) {
if (_config.xhr) {
if (!(typeof _config.xhr === 'function' || typeof _config.xhr === 'object')) {
throw ('ContainerConfig.xhr should be a function or an object');
}
if (_config.xhr.dataType && typeof _config.xhr.dataType !== 'function') {
throw ('ContainerConfig.xhr.dataType should be a function');
}
if (_config.xhr.type && typeof _config.xhr.type !== 'function') {
throw ('ContainerConfig.xhr.type should be a function');
}
if (_config.xhr.url && typeof _config.xhr.url !== 'function') {
throw ('ContainerConfig.xhr.url should be a function');
}
}
}
return true;
};
return {
/**
* Gets the current list of apps in the container
* @method getContainerState
* @returns {Array} An array of objects containing the appId
*/
getContainerState: function() {
if (!_isInit()) {
F2.log('F2.init() must be called before F2.getContainerState()');
return;
}
return jQuery.map(_apps, function(app) {
return {
appId: app.config.appId
};
});
},
/**
* Initializes the container. This method must be called before performing
* any other actions in the container.
* @method init
* @param {F2.ContainerConfig} config The configuration object
*/
init: function(config) {
_config = config || {};
_validateContainerConfig();
_hydrateContainerConfig(_config);
// dictates whether we use the old logic or the new logic.
// TODO: Remove in v2.0
_bUsesAppHandlers = (!_config.beforeAppRender && !_config.appRender && !_config.afterAppRender && !_config.appScriptLoadFailed);
// only establish RPC connection if the container supports the secure app page
if ( !! _config.secureAppPagePath || _config.isSecureAppPage) {
F2.Rpc.init( !! _config.secureAppPagePath ? _config.secureAppPagePath : false);
}
F2.UI.init(_config);
if (!_config.isSecureAppPage) {
_initContainerEvents();
}
},
/**
* Has the container been init?
* @method isInit
* @return {bool} True if the container has been init
*/
isInit: _isInit,
/**
* Begins the loading process for all apps and/or initialization process for pre-loaded apps.
* The app will be passed the {{#crossLink "F2.AppConfig"}}{{/crossLink}} object which will
* contain the app's unique instanceId within the container. If the
* {{#crossLink "F2.AppConfig"}}{{/crossLink}}.root property is populated the app is considered
* to be a pre-loaded app and will be handled accordingly. Optionally, the
* {{#crossLink "F2.AppManifest"}}{{/crossLink}} can be passed in and those
* assets will be used instead of making a request.
* @method registerApps
* @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}}
* objects
* @param {Array} [appManifests] An array of
* {{#crossLink "F2.AppManifest"}}{{/crossLink}}
* objects. This array must be the same length as the apps array that is
* objects. This array must be the same length as the apps array that is
* passed in. This can be useful if apps are loaded on the server-side and
* passed down to the client.
* @example
* Traditional App requests.
*
* // Traditional f2 app configs
* var arConfigs = [
* {
* appId: 'com_externaldomain_example_app',
* context: {},
* manifestUrl: 'http://www.externaldomain.com/F2/AppManifest'
* },
* {
* appId: 'com_externaldomain_example_app',
* context: {},
* manifestUrl: 'http://www.externaldomain.com/F2/AppManifest'
* },
* {
* appId: 'com_externaldomain_example_app2',
* context: {},
* manifestUrl: 'http://www.externaldomain.com/F2/AppManifest'
* }
* ];
*
* F2.init();
* F2.registerApps(arConfigs);
*
* @example
* Pre-loaded and tradition apps mixed.
*
* // Pre-loaded apps and traditional f2 app configs
* // you can preload the same app multiple times as long as you have a unique root for each
* var arConfigs = [
* {
* appId: 'com_mydomain_example_app',
* context: {},
* root: 'div#example-app-1',
* manifestUrl: ''
* },
* {
* appId: 'com_mydomain_example_app',
* context: {},
* root: 'div#example-app-2',
* manifestUrl: ''
* },
* {
* appId: 'com_externaldomain_example_app',
* context: {},
* manifestUrl: 'http://www.externaldomain.com/F2/AppManifest'
* }
* ];
*
* F2.init();
* F2.registerApps(arConfigs);
*
* @example
* Apps with predefined manifests.
*
* // Traditional f2 app configs
* var arConfigs = [
* {appId: 'com_externaldomain_example_app', context: {}},
* {appId: 'com_externaldomain_example_app', context: {}},
* {appId: 'com_externaldomain_example_app2', context: {}}
* ];
*
* // Pre requested manifest responses
* var arManifests = [
* {
* apps: ['<div>Example App!</div>'],
* inlineScripts: [],
* scripts: ['http://www.domain.com/js/AppClass.js'],
* styles: ['http://www.domain.com/css/AppStyles.css']
* },
* {
* apps: ['<div>Example App!</div>'],
* inlineScripts: [],
* scripts: ['http://www.domain.com/js/AppClass.js'],
* styles: ['http://www.domain.com/css/AppStyles.css']
* },
* {
* apps: ['<div>Example App 2!</div>'],
* inlineScripts: [],
* scripts: ['http://www.domain.com/js/App2Class.js'],
* styles: ['http://www.domain.com/css/App2Styles.css']
* }
* ];
*
* F2.init();
* F2.registerApps(arConfigs, arManifests);
*/
registerApps: function(appConfigs, appManifests) {
if (!_isInit()) {
F2.log('F2.init() must be called before F2.registerApps()');
return;
}
else if (!appConfigs) {
F2.log('At least one AppConfig must be passed when calling F2.registerApps()');
return;
}
var appStack = [];
var batches = {};
var callbackStack = {};
var haveManifests = false;
appConfigs = [].concat(appConfigs);
appManifests = [].concat(appManifests || []);
haveManifests = !! appManifests.length;
// appConfigs must have a length
if (!appConfigs.length) {
F2.log('At least one AppConfig must be passed when calling F2.registerApps()');
return;
// ensure that the array of apps and manifests are qual
}
else if (appConfigs.length && haveManifests && appConfigs.length != appManifests.length) {
F2.log('The length of "apps" does not equal the length of "appManifests"');
return;
}
// validate each app and assign it an instanceId
// then determine which apps can be batched together
jQuery.each(appConfigs, function(i, a) {
// add properties and methods
a = _createAppConfig(a);
// Will set to itself, for preloaded apps, or set to null for apps that aren't already
// on the page.
a.root = a.root || null;
// we validate the app after setting the root property because pre-load apps do no require
// manifest url
if (!_validateApp(a)) {
return; // move to the next app
}
// save app
_apps[a.instanceId] = {
config: a
};
// If the root property is defined then this app is considered to be preloaded and we will
// run it through that logic.
if (a.root) {
if ((!a.root && typeof(a.root) != 'string') && !F2.isNativeDOMNode(a.root)) {
F2.log('AppConfig invalid for pre-load, not a valid string and not dom node');
F2.log('AppConfig instance:', a);
throw ('Preloaded appConfig.root property must be a native dom node or a string representing a sizzle selector. Please check your inputs and try again.');
}
else if (jQuery(a.root).length != 1) {
F2.log('AppConfig invalid for pre-load, root not unique');
F2.log('AppConfig instance:', a);
F2.log('Number of dom node instances:', jQuery(a.root).length);
throw ('Preloaded appConfig.root property must map to a unique dom node. Please check your inputs and try again.');
}
// instantiate F2.App
_createAppInstance(a);
// init events
_initAppEvents(a);
// Continue on in the .each loop, no need to continue because the app is on the page
// the js in initialized, and it is ready to role.
return; // equivalent to continue in .each
}
if (!_bUsesAppHandlers) {
// fire beforeAppRender
a.root = _beforeAppRender(a);
}
else {
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_CREATE_ROOT,
a // the app config
);
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_RENDER_BEFORE,
a // the app config
);
}
// if we have the manifest, go ahead and load the app
if (haveManifests) {
_loadApps(a, appManifests[i]);
}
else {
// check if this app can be batched
if (a.enableBatchRequests && !a.isSecure) {
batches[a.manifestUrl.toLowerCase()] = batches[a.manifestUrl.toLowerCase()] || [];
batches[a.manifestUrl.toLowerCase()].push(a);
}
else {
appStack.push({
apps: [a],
url: a.manifestUrl
});
}
}
});
// we don't have the manifests, go ahead and load them
if (!haveManifests) {
// add the batches to the appStack
jQuery.each(batches, function(i, b) {
appStack.push({
url: i,
apps: b
});
});
// if an app is being loaded more than once on the page, there is the
// potential that the jsonp callback will be clobbered if the request
// for the AppManifest for the app comes back at the same time as
// another request for the same app. We'll create a callbackStack
// that will ensure that requests for the same app are loaded in order
// rather than at the same time
jQuery.each(appStack, function(i, req) {
// define the callback function based on the first app's App ID
var jsonpCallback = F2.Constants.JSONP_CALLBACK + req.apps[0].appId;
// push the request onto the callback stack
callbackStack[jsonpCallback] = callbackStack[jsonpCallback] || [];
callbackStack[jsonpCallback].push(req);
});
// loop through each item in the callback stack and make the request
// for the AppManifest. When the request is complete, pop the next
// request off the stack and make the request.
jQuery.each(callbackStack, function(i, requests) {
var manifestRequest = function(jsonpCallback, req) {
if (!req) {
return;
}
// setup defaults and callbacks
var url = req.url,
type = 'GET',
dataType = 'jsonp',
completeFunc = function() {
manifestRequest(i, requests.pop());
},
errorFunc = function() {
jQuery.each(req.apps, function(idx, item) {
F2.log('Removed failed ' + item.name + ' app', item);
F2.removeApp(item.instanceId);
});
},
successFunc = function(appManifest) {
_loadApps(req.apps, appManifest);
};
// optionally fire xhr overrides
if (_config.xhr && _config.xhr.dataType) {
dataType = _config.xhr.dataType(req.url, req.apps);
if (typeof dataType !== 'string') {
throw ('ContainerConfig.xhr.dataType should return a string');
}
}
if (_config.xhr && _config.xhr.type) {
type = _config.xhr.type(req.url, req.apps);
if (typeof type !== 'string') {
throw ('ContainerConfig.xhr.type should return a string');
}
}
if (_config.xhr && _config.xhr.url) {
url = _config.xhr.url(req.url, req.apps);
if (typeof url !== 'string') {
throw ('ContainerConfig.xhr.url should return a string');
}
}
// setup the default request function if an override is not present
var requestFunc = _config.xhr;
if (typeof requestFunc !== 'function') {
requestFunc = function(url, appConfigs, successCallback, errorCallback, completeCallback) {
jQuery.ajax({
url: url,
type: type,
data: {
params: F2.stringify(req.apps, F2.appConfigReplacer)
},
jsonp: false, // do not put 'callback=' in the query string
jsonpCallback: jsonpCallback, // Unique function name
dataType: dataType,
success: successCallback,
error: function(jqxhr, settings, exception) {
F2.log('Failed to load app(s)', exception.toString(), req.apps);
errorCallback();
},
complete: completeCallback
});
};
}
requestFunc(url, req.apps, successFunc, errorFunc, completeFunc);
};
manifestRequest(i, requests.pop());
});
}
},
/**
* Removes all apps from the container
* @method removeAllApps
*/
removeAllApps: function() {
if (!_isInit()) {
F2.log('F2.init() must be called before F2.removeAllApps()');
return;
}
jQuery.each(_apps, function(i, a) {
F2.removeApp(a.config.instanceId);
});
},
/**
* Removes an app from the container
* @method removeApp
* @param {string} instanceId The app's instanceId
*/
removeApp: function(instanceId) {
if (!_isInit()) {
F2.log('F2.init() must be called before F2.removeApp()');
return;
}
if (_apps[instanceId]) {
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_DESTROY_BEFORE,
_apps[instanceId] // the app instance
);
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_DESTROY,
_apps[instanceId] // the app instance
);
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_DESTROY_AFTER,
_apps[instanceId] // the app instance
);
delete _apps[instanceId];
}
}
};
})());
exports.F2 = F2;
if (typeof define !== 'undefined' && define.amd) {
define(function() {
return F2;
});
}
})(typeof exports !== 'undefined' ? exports : window); |
packages/linter-jsxhint/node_modules/jsxhint/test/fixtures/jshint_parity.js | nlhuykhang/atom-config | 'use strict'
var React = require('react-tools/build/modules/React');
var statusForm = React.createClass({displayName: 'statusForm',
render: function(){
if (var foo = true){
// linter will hate this
}
return React.DOM.form( {class:"form-horizontal", role:"form"},
React.DOM.div( {class:"form-group"},
React.DOM.label( {for:"brand-lead", class:"col-sm-4 control-label"}, "Brand lead:"),
React.DOM.div( {class:"col-sm-8"},
React.DOM.input( {class:"form-control",
placeholder:"brand lead",
type:"text",
id:"brand-lead",
ref:"brandLead",
'data-state':"brandLead"} )
)
),
React.DOM.div( {class:"form-group"},
React.DOM.label( {for:"status-text", class:"col-sm-4 control-label"}, "Status:"),
React.DOM.div( {class:"col-sm-8"},
React.DOM.textarea(
{id:"status-text",
class:"form-control",
rows:"40",
ref:"statusText",
'data-state':"statusText"})
)
),
React.DOM.input( {class:"btn btn-success", type:"submit", value:"Save status"})
)
}
});
module.exports = statusForm;
|
webapp-src/src/Hutch/LangDropdown.js | babelouest/hutch | import React, { Component } from 'react';
import i18next from 'i18next';
import messageDispatcher from '../lib/MessageDispatcher';
class LangDropdown extends Component {
constructor(props) {
super(props);
this.state = {
config: props.config
};
this.changeLang = this.changeLang.bind(this);
}
changeLang(e, lang) {
e.preventDefault();
messageDispatcher.sendMessage("App", {action: 'lang', lang: lang});
}
render() {
var langList = [];
this.state.config.frontend.lang.forEach((lang, index) => {
var classValue = "dropdown-item";
if (i18next.language === lang) {
classValue += " active"
}
langList.push(
<li key={index}><a className={classValue} href="#" onClick={(e) => this.changeLang(e, lang)}>{i18next.t("lang-"+lang)}</a></li>
);
});
return (
<div className="dropdown">
<button className="btn btn-secondary dropdown-toggle" type="button" id="langDropdown" data-bs-toggle="dropdown" aria-expanded="false">
{i18next.t("lang-"+i18next.language)}
</button>
<ul className="dropdown-menu" aria-labelledby="langDropdown">
{langList}
</ul>
</div>
);
}
}
export default LangDropdown;
|
src/components/withViewport.js | Light1c3/ResumeSite | /**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React, { Component } from 'react'; // eslint-disable-line no-unused-vars
import EventEmitter from 'eventemitter3';
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
let EE;
let viewport = { width: 1366, height: 768 }; // Default size for server-side rendering
const RESIZE_EVENT = 'resize';
function handleWindowResize() {
if (viewport.width !== window.innerWidth || viewport.height !== window.innerHeight) {
viewport = { width: window.innerWidth, height: window.innerHeight };
EE.emit(RESIZE_EVENT, viewport);
}
}
function withViewport(ComposedComponent) {
return class WithViewport extends Component {
constructor() {
super();
this.state = {
viewport: canUseDOM ? { width: window.innerWidth, height: window.innerHeight } : viewport,
};
}
componentDidMount() {
if (!EE) {
EE = new EventEmitter();
window.addEventListener('resize', handleWindowResize);
window.addEventListener('orientationchange', handleWindowResize);
}
EE.on(RESIZE_EVENT, this.handleResize, this);
}
componentWillUnmount() {
EE.removeListener(RESIZE_EVENT, this.handleResize, this);
if (!EE.listeners(RESIZE_EVENT, true)) {
window.removeEventListener('resize', handleWindowResize);
window.removeEventListener('orientationchange', handleWindowResize);
EE = null;
}
}
render() {
return <ComposedComponent {...this.props} viewport={this.state.viewport} />;
}
handleResize(value) {
this.setState({ viewport: value }); // eslint-disable-line react/no-set-state
}
};
}
export default withViewport;
|
ajax/libs/yui/3.11.0/event-focus/event-focus-min.js | pazguille/cdnjs | YUI.add("event-focus",function(e,t){function u(t,r,u){var a="_"+t+"Notifiers";e.Event.define(t,{_useActivate:o,_attach:function(i,s,o){return e.DOM.isWindow(i)?n._attach([t,function(e){s.fire(e)},i]):n._attach([r,this._proxy,i,this,s,o],{capture:!0})},_proxy:function(t,r,i){var s=t.target,f=t.currentTarget,l=s.getData(a),c=e.stamp(f._node),h=o||s!==f,p;r.currentTarget=i?s:f,r.container=i?f:null,l?h=!0:(l={},s.setData(a,l),h&&(p=n._attach([u,this._notify,s._node]).sub,p.once=!0)),l[c]||(l[c]=[]),l[c].push(r),h||this._notify(t)},_notify:function(t,n){var r=t.currentTarget,i=r.getData(a),o=r.ancestors(),u=r.get("ownerDocument"),f=[],l=i?e.Object.keys(i).length:0,c,h,p,d,v,m,g,y,b,w;r.clearData(a),o.push(r),u&&o.unshift(u),o._nodes.reverse(),l&&(m=l,o.some(function(t){var n=e.stamp(t),r=i[n],s,o;if(r){l--;for(s=0,o=r.length;s<o;++s)r[s].handle.sub.filter&&f.push(r[s])}return!l}),l=m);while(l&&(c=o.shift())){d=e.stamp(c),h=i[d];if(h){for(g=0,y=h.length;g<y;++g){p=h[g],b=p.handle.sub,v=!0,t.currentTarget=c,b.filter&&(v=b.filter.apply(c,[c,t].concat(b.args||[])),f.splice(s(f,p),1)),v&&(t.container=p.container,w=p.fire(t));if(w===!1||t.stopped===2)break}delete h[d],l--}if(t.stopped!==2)for(g=0,y=f.length;g<y;++g){p=f[g],b=p.handle.sub,b.filter.apply(c,[c,t].concat(b.args||[]))&&(t.container=p.container,t.currentTarget=c,w=p.fire(t));if(w===!1||t.stopped===2)break}if(t.stopped)break}},on:function(e,t,n){t.handle=this._attach(e._node,n)},detach:function(e,t){t.handle.detach()},delegate:function(t,n,r,s){i(s)&&(n.filter=function(n){return e.Selector.test(n._node,s,t===n?null:t._node)}),n.handle=this._attach(t._node,r,!0)},detachDelegate:function(e,t){t.handle.detach()}},!0)}var n=e.Event,r=e.Lang,i=r.isString,s=e.Array.indexOf,o=function(){var t=!1,n=e.config.doc,r;return n&&(r=n.createElement("p"),r.setAttribute("onbeforeactivate",";"),t=r.onbeforeactivate!==undefined),t}();o?(u("focus","beforeactivate","focusin"),u("blur","beforedeactivate","focusout")):(u("focus","focus","focus"),u("blur","blur","blur"))},"@VERSION@",{requires:["event-synthetic"]});
|
example/src/views/swipe_decker.js | fengshanjian/react-native-komect-uikit | import Expo from 'expo';
import React, { Component } from 'react';
import { StyleSheet, Text, View, Dimensions } from 'react-native';
import { Button, Card, Icon } from 'react-native-elements';
import { SwipeDeck } from 'react-native-elements';
const SCREEN_WIDTH = Dimensions.get('window').width;
const SCREEN_HEIGHT = Dimensions.get('window').height;
// test data
const DATA = [
{
id: 1,
text: 'Amanda',
age: 28,
uri: 'http://f9view.com/wp-content/uploads/2013/10/American-Beautiful-Girls-Wallpapers-Hollywood-Celebs-1920x1200px.jpg',
},
{ id: 2, text: 'Emma', age: 29, uri: 'https://i.imgur.com/FHxVpN4.jpg' },
{
id: 3,
text: 'Scarlett',
age: 25,
uri: 'https://i.ytimg.com/vi/GOJZ5TIlc3M/maxresdefault.jpg',
},
{
id: 4,
text: 'Keira',
age: 27,
uri: 'http://www.bdprimeit.com/wp-content/uploads/Keira-Knightley-Most-beautiful-Hollywood-actress.jpg',
},
{
id: 5,
text: 'Ashley',
age: 30,
uri: 'https://s-media-cache-ak0.pinimg.com/736x/4c/89/67/4c8967fac1822eeddf09670565430fd5.jpg',
},
{
id: 6,
text: 'Jennifer',
age: 24,
uri: 'https://2.bp.blogspot.com/-Vy0NVWhQfKo/Ubma2Mx2YTI/AAAAAAAAH3s/LC_u8LRfm8o/s1600/aimee-teegarden-04.jpg',
},
{
id: 7,
text: 'Sarah',
age: 28,
uri: 'https://s-media-cache-ak0.pinimg.com/736x/41/75/26/4175268906d97492e4a3175eab95c0f5.jpg',
},
];
class SwipeDecker extends Component {
renderCard(card) {
return (
<Card
key={card.id}
containerStyle={{
borderRadius: 10,
width: SCREEN_WIDTH * 0.92,
height: SCREEN_HEIGHT - 165,
}}
featuredTitle={`${card.text}, ${card.age}`}
featuredTitleStyle={{
position: 'absolute',
left: 15,
bottom: 10,
fontSize: 30,
}}
image={{ uri: card.uri }}
imageStyle={{
borderRadius: 10,
width: SCREEN_WIDTH * 0.915,
height: SCREEN_HEIGHT - 165,
}}
/>
);
}
onSwipeRight(card) {
console.log('Card liked: ' + card.text);
}
onSwipeLeft(card) {
console.log('Card disliked: ' + card.text);
}
renderNoMoreCards() {
return (
<Card
containerStyle={{
borderRadius: 10,
width: SCREEN_WIDTH * 0.92,
height: SCREEN_HEIGHT - 165,
}}
featuredTitle="No more cards"
featuredTitleStyle={{ fontSize: 25 }}
image={{ uri: 'https://i.imgflip.com/1j2oed.jpg' }}
imageStyle={{
borderRadius: 10,
width: SCREEN_WIDTH * 0.915,
height: SCREEN_HEIGHT - 165,
}}
/>
);
}
renderHeader() {
return (
<View style={styles.header}>
<View style={styles.headerLeftIcon}>
<Icon name="user" type="font-awesome" color="#ccc" size={35} />
</View>
<View style={styles.headerCenter}>
<View style={styles.headerCenterToggleContainer}>
<View style={styles.headerCenterToggleLeft}>
<Icon
name="fire"
type="material-community"
color="#fff"
size={28}
/>
</View>
<View style={styles.headerCenterToggleRight}>
<Icon name="group" type="font-awesome" color="#ccc" size={25} />
</View>
</View>
</View>
<View style={styles.headerRightIcon}>
<Icon name="comments" type="font-awesome" color="#ccc" size={35} />
</View>
</View>
);
}
renderFooter() {
return (
<View style={styles.footer}>
<View style={[styles.footerIcon, { paddingLeft: 10 }]}>
<Icon
containerStyle={{
backgroundColor: 'white',
width: 50,
height: 50,
borderRadius: 25,
}}
name="replay"
size={30}
color="orange"
/>
</View>
<View style={styles.footerIcon}>
<Icon
containerStyle={{
backgroundColor: 'white',
width: 60,
height: 60,
borderRadius: 30,
}}
name="close"
size={45}
color="red"
/>
</View>
<View style={styles.footerIcon}>
<Icon
containerStyle={{
backgroundColor: 'white',
width: 48,
height: 48,
borderRadius: 24,
}}
name="bolt"
type="font-awesome"
size={30}
color="purple"
/>
</View>
<View style={styles.footerIcon}>
<Icon
containerStyle={{
backgroundColor: 'white',
width: 60,
height: 60,
borderRadius: 30,
}}
name="favorite"
size={35}
color="green"
/>
</View>
<View style={[styles.footerIcon, { paddingRight: 10 }]}>
<Icon
containerStyle={{
backgroundColor: 'white',
width: 50,
height: 50,
borderRadius: 25,
}}
name="star"
size={30}
color="blue"
/>
</View>
</View>
);
}
render() {
return (
<View style={styles.container}>
{this.renderHeader()}
<View style={styles.deck}>
<SwipeDeck
data={DATA}
renderCard={this.renderCard}
renderNoMoreCards={this.renderNoMoreCards}
onSwipeRight={this.onSwipeRight}
onSwipeLeft={this.onSwipeLeft}
/>
</View>
{this.renderFooter()}
</View>
);
}
}
SwipeDecker.navigationOptions = {
title: 'Swipe Decker',
header: null,
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'rgba(211, 211, 211, 0.4)',
},
header: {
height: 64,
paddingTop: 35,
flexDirection: 'row',
},
headerLeftIcon: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
alignSelf: 'center',
marginLeft: 15,
},
headerCenter: {
flex: 6,
justifyContent: 'center',
alignItems: 'center',
alignSelf: 'center',
},
headerCenterToggleContainer: {
flexDirection: 'row',
width: 160,
height: 45,
borderRadius: 30,
borderWidth: 2,
borderColor: '#ccc',
},
headerCenterToggleLeft: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#ff0000',
borderRadius: 30,
},
headerCenterToggleRight: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
headerRightIcon: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
alignSelf: 'center',
marginRight: 20,
},
deck: {
flex: 1,
},
footer: {
height: 64,
flexDirection: 'row',
paddingBottom: 10,
},
footerIcon: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
alignSelf: 'center',
margin: 10,
},
});
export default SwipeDecker;
|
source/patterns/01-molecules/list-group/__tests__/list-group.spec.js | apparena/patterns | /* eslint-env mocha */
import React from 'react';
import {shallow, configure} from 'enzyme';
import Index from '../index';
import Adapter from 'enzyme-adapter-react-16';
configure({adapter: new Adapter()});
test('renders a ListGroup', () => {
const wrapper = shallow(
<Index classNames="custom-list-group" listItems={[
{disabled: 'Im disabled'},
{0: <div>Lines of code</div>},
{1: 'Im normal'},
{'list-group-item-danger': '9001 errors were found in your code. Fix now?'}
]}
/>
);
expect(wrapper.find('.custom-list-group').length).toBe(1);
expect(wrapper.find('ul.list-group').length).toBe(1);
expect(wrapper.find('.list-group-item').length).toBe(4);
expect(wrapper.find('.disabled').length).toBe(1);
expect(wrapper.find('.list-group-item-danger').length).toBe(1);
}); |
src/components/NotFoundPage/index.js | jsk7/personal-web | import React from 'react';
import { Link } from 'react-router';
const NotFoundPage = () => {
return (
<div className="page-not-found">
<h4>
A wild 404 appeared!
</h4>
<Link to="/"> Volver a la home </Link>
</div>
);
};
export default NotFoundPage;
|
src/svg-icons/action/pan-tool.js | ichiohta/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionPanTool = (props) => (
<SvgIcon {...props}>
<path d="M23 5.5V20c0 2.2-1.8 4-4 4h-7.3c-1.08 0-2.1-.43-2.85-1.19L1 14.83s1.26-1.23 1.3-1.25c.22-.19.49-.29.79-.29.22 0 .42.06.6.16.04.01 4.31 2.46 4.31 2.46V4c0-.83.67-1.5 1.5-1.5S11 3.17 11 4v7h1V1.5c0-.83.67-1.5 1.5-1.5S15 .67 15 1.5V11h1V2.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5V11h1V5.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5z"/>
</SvgIcon>
);
ActionPanTool = pure(ActionPanTool);
ActionPanTool.displayName = 'ActionPanTool';
ActionPanTool.muiName = 'SvgIcon';
export default ActionPanTool;
|
src/components/LoadingPastIndicator/__tests__/LoadingPastIndicator.spec.js | instructure/canvas-planner | /*
* Copyright (C) 2017 - present Instructure, Inc.
*
* This file is part of Canvas.
*
* Canvas is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, version 3 of the License.
*
* Canvas is distributed in the hope that they will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React from 'react';
import LoadingPastIndicator from '../index';
import {shallow} from 'enzyme';
jest.mock( '../../../utilities/scrollUtils');
import {animateSlideDown} from '../../../utilities/scrollUtils'; // eslint-disable-line import/first
it('renders very little', () => {
const wrapper = shallow(<LoadingPastIndicator />);
expect(wrapper).toMatchSnapshot();
});
it('renders spinner while loading', () => {
const wrapper = shallow(<LoadingPastIndicator loadingPast={true} />);
expect(wrapper).toMatchSnapshot();
});
it('still renders loading even when no more items in the past', () => {
const wrapper = shallow(<LoadingPastIndicator loadingPast={true} allPastItemsLoaded={true} />);
expect(wrapper).toMatchSnapshot();
});
it('renders TV when all past items loaded', () => {
const wrapper = shallow(<LoadingPastIndicator allPastItemsLoaded={true} />);
expect(wrapper).toMatchSnapshot();
});
it('updates only when props change', () => {
const wrapper = shallow(<LoadingPastIndicator allPastItemsLoaded={false} loadingPast={false} />);
let shouldUpdate = wrapper.instance().shouldComponentUpdate({allPastItemsLoaded: false, loadingPast: false});
expect(shouldUpdate).toBe(false);
shouldUpdate = wrapper.instance().shouldComponentUpdate({allPastItemsLoaded: true, loadingPast: false});
expect(shouldUpdate).toBe(true);
});
it('runs the animation only when props transition to true', () => {
const wrapper = shallow(<LoadingPastIndicator allPastItemsLoaded={false} loadingPast={false}/>);
// we change a prop then call componentDidUpdate with the previous properties and
// if either of these 2 props transitions from false -> true, componentDidUpdate should
// run the animation by calling animateSlideDown. Any other change and it should not.
wrapper.setProps({allPastItemsLoaded: false, loadingPast: true});
wrapper.instance().componentDidUpdate({allPastItemsLoaded: false, loadingPast: false});
expect(animateSlideDown).toHaveBeenCalledTimes(1); // animateSlideDown was called. That's once.
wrapper.setProps({allPastItemsLoaded: false, loadingPast: false});
wrapper.instance().componentDidUpdate({allPastItemsLoaded: false, loadingPast: true});
expect(animateSlideDown).toHaveBeenCalledTimes(1); // animateSlideDown not called. Still only once.
wrapper.setProps({allPastItemsLoaded: true, loadingPast: false});
wrapper.instance().componentDidUpdate({allPastItemsLoaded: false, loadingPast: false});
expect(animateSlideDown).toHaveBeenCalledTimes(2); // allPastItemsLoaded trigger the animation. That's twice
// no prop change. even though allPastItemsLoaded is true, animation should not run
wrapper.instance().componentDidUpdate({allPastItemsLoaded: true, loadingPast: false});
expect(animateSlideDown).toHaveBeenCalledTimes(2);
wrapper.instance().componentDidUpdate({loadingError: 'whoops'});
expect(animateSlideDown).toHaveBeenCalledTimes(3);
});
it('shows an Alert when there\'s a query error', () => {
const wrapper = shallow(<LoadingPastIndicator loadingError={'uh oh'}/>);
expect(wrapper).toMatchSnapshot();
});
|
src/components/Header.js | mike-plummer/mike-plummer.github.io | import React from 'react';
const Header = (props) => (
<header id="header" className="alt">
<span className="style5 icon minor fa-bolt" />
<h1>Mike Plummer</h1>
<p>Full-stack developer, North Texas</p>
</header>
);
export default Header;
|
packages/react-server-website/middleware/PageHeader.js | redfin/react-server | import React from 'react';
import Header from '../components/Header';
export default class PageHeader {
getElements(next) {
var elements = [];
elements.push(
<Header />
)
return elements.concat(next());
}
}
|
src/components/Header/Header.js | JeffJin/jigsaw-puzzle | /**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import s from './Header.scss';
import withStyles from '../../decorators/withStyles';
import Link from '../Link';
import Navigation from '../Navigation';
@withStyles(s)
class Header extends Component {
render() {
return (
<div className={s.root}>
<div className={s.container}>
<Navigation className={s.nav} />
<Link className={s.brand} to="/">
<img src={require('./logo-small.png')} width="38" height="38" alt="React" />
<span className={s.brandTxt}>Your Company</span>
</Link>
<div className={s.banner}>
<h1 className={s.bannerTitle}>React</h1>
<p className={s.bannerDesc}>Complex web apps made easy</p>
</div>
</div>
</div>
);
}
}
export default Header;
|
src/svg-icons/av/fiber-dvr.js | pradel/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let AvFiberDvr = (props) => (
<SvgIcon {...props}>
<path d="M17.5 10.5h2v1h-2zm-13 0h2v3h-2zM21 3H3c-1.11 0-2 .89-2 2v14c0 1.1.89 2 2 2h18c1.11 0 2-.9 2-2V5c0-1.11-.89-2-2-2zM8 13.5c0 .85-.65 1.5-1.5 1.5H3V9h3.5c.85 0 1.5.65 1.5 1.5v3zm4.62 1.5h-1.5L9.37 9h1.5l1 3.43 1-3.43h1.5l-1.75 6zM21 11.5c0 .6-.4 1.15-.9 1.4L21 15h-1.5l-.85-2H17.5v2H16V9h3.5c.85 0 1.5.65 1.5 1.5v1z"/>
</SvgIcon>
);
AvFiberDvr = pure(AvFiberDvr);
AvFiberDvr.displayName = 'AvFiberDvr';
export default AvFiberDvr;
|
node_modules/react-slick/src/dots.js | qingege/react_draft | 'use strict';
import React from 'react';
import classnames from 'classnames';
var getDotCount = function (spec) {
var dots;
dots = Math.ceil(spec.slideCount / spec.slidesToScroll);
return dots;
};
export var Dots = React.createClass({
clickHandler: function (options, e) {
// In Autoplay the focus stays on clicked button even after transition
// to next slide. That only goes away by click somewhere outside
e.preventDefault();
this.props.clickHandler(options);
},
render: function () {
var dotCount = getDotCount({
slideCount: this.props.slideCount,
slidesToScroll: this.props.slidesToScroll
});
// Apply join & split to Array to pre-fill it for IE8
//
// Credit: http://stackoverflow.com/a/13735425/1849458
var dots = Array.apply(null, Array(dotCount + 1).join('0').split('')).map((x, i) => {
var leftBound = (i * this.props.slidesToScroll);
var rightBound = (i * this.props.slidesToScroll) + (this.props.slidesToScroll - 1);
var className = classnames({
'slick-active': (this.props.currentSlide >= leftBound) && (this.props.currentSlide <= rightBound)
});
var dotOptions = {
message: 'dots',
index: i,
slidesToScroll: this.props.slidesToScroll,
currentSlide: this.props.currentSlide
};
var onClick = this.clickHandler.bind(this, dotOptions);
return (
<li key={i} className={className}>
{React.cloneElement(this.props.customPaging(i), {onClick})}
</li>
);
});
return (
<ul className={this.props.dotsClass} style={{display: 'block'}}>
{dots}
</ul>
);
}
});
|
src/svg-icons/image/crop-square.js | frnk94/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageCropSquare = (props) => (
<SvgIcon {...props}>
<path d="M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H6V6h12v12z"/>
</SvgIcon>
);
ImageCropSquare = pure(ImageCropSquare);
ImageCropSquare.displayName = 'ImageCropSquare';
ImageCropSquare.muiName = 'SvgIcon';
export default ImageCropSquare;
|
docs/src/app/components/pages/components/Drawer/ExampleSimple.js | matthewoates/material-ui | import React from 'react';
import Drawer from 'material-ui/Drawer';
import MenuItem from 'material-ui/MenuItem';
import RaisedButton from 'material-ui/RaisedButton';
export default class DrawerSimpleExample extends React.Component {
constructor(props) {
super(props);
this.state = {open: false};
}
handleToggle = () => this.setState({open: !this.state.open});
render() {
return (
<div>
<RaisedButton
label="Toggle Drawer"
onTouchTap={this.handleToggle}
/>
<Drawer open={this.state.open}>
<MenuItem>Menu Item</MenuItem>
<MenuItem>Menu Item 2</MenuItem>
</Drawer>
</div>
);
}
}
|
githubApp/__tests__/index.android.js | anchoretics/ztf-work-app | import 'react-native';
import React from 'react';
import Index from '../index.android.js';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
it('renders correctly', () => {
const tree = renderer.create(
<Index />
);
});
|
misc/jquery.js | hacktm15/pph |
/*!
* jQuery JavaScript Library v1.4.4
* http://jquery.com/
*
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2010, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Thu Nov 11 19:04:53 2010 -0500
*/
(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h=
h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;k<J.length;k++){h=J[k];h.origType.replace(X,"")===a.type?f.push(h.selector):J.splice(k--,1)}f=c(a.target).closest(f,a.currentTarget);o=0;for(x=f.length;o<x;o++){r=f[o];for(k=0;k<J.length;k++){h=J[k];if(r.selector===h.selector&&(!A||A.test(h.namespace))){l=r.elem;e=null;if(h.preType==="mouseenter"||
h.preType==="mouseleave"){a.type=h.preType;e=c(a.relatedTarget).closest(h.selector)[0]}if(!e||e!==l)C.push({elem:l,handleObj:h,level:r.level})}}}o=0;for(x=C.length;o<x;o++){f=C[o];if(d&&f.level>d)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La,
"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,
e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,
"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+
a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,
C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j,
s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this,
j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length},
toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j===
-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false;
if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K<Q;K++)if((j=arguments[K])!=null)for(s in j){v=G[s];z=j[s];if(G!==z)if(ga&&z&&(b.isPlainObject(z)||(H=b.isArray(z)))){if(H){H=false;v=v&&b.isArray(v)?v:[]}else v=v&&b.isPlainObject(v)?v:{};G[s]=b.extend(ga,v,z)}else if(z!==B)G[s]=z}return G};b.extend({noConflict:function(j){E.$=e;if(j)E.jQuery=d;return b},isReady:false,readyWait:1,ready:function(j){j===true&&b.readyWait--;
if(!b.readyWait||j!==true&&!b.isReady){if(!t.body)return setTimeout(b.ready,1);b.isReady=true;if(!(j!==true&&--b.readyWait>0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload",
b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&&
!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&&
l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H<G;){if(s.apply(j[H++],v)===false)break}else if(K)for(z in j){if(s.call(j[z],
z,j[z])===false)break}else for(v=j[0];H<G&&s.call(v,H,v)!==false;v=j[++H]);return j},trim:O?function(j){return j==null?"":O.call(j)}:function(j){return j==null?"":j.toString().replace(k,"").replace(o,"")},makeArray:function(j,s){var v=s||[];if(j!=null){var z=b.type(j);j.length==null||z==="string"||z==="function"||z==="regexp"||b.isWindow(j)?M.call(v,j):b.merge(v,j)}return v},inArray:function(j,s){if(s.indexOf)return s.indexOf(j);for(var v=0,z=s.length;v<z;v++)if(s[v]===j)return v;return-1},merge:function(j,
s){var v=j.length,z=0;if(typeof s.length==="number")for(var H=s.length;z<H;z++)j[v++]=s[z];else for(;s[z]!==B;)j[v++]=s[z++];j.length=v;return j},grep:function(j,s,v){var z=[],H;v=!!v;for(var G=0,K=j.length;G<K;G++){H=!!s(j[G],G);v!==H&&z.push(j[G])}return z},map:function(j,s,v){for(var z=[],H,G=0,K=j.length;G<K;G++){H=s(j[G],G,v);if(H!=null)z[z.length]=H}return z.concat.apply([],z)},guid:1,proxy:function(j,s,v){if(arguments.length===2)if(typeof s==="string"){v=j;j=v[s];s=B}else if(s&&!b.isFunction(s)){v=
s;s=B}if(!s&&j)s=function(){return j.apply(v||this,arguments)};if(j)s.guid=j.guid=j.guid||s.guid||b.guid++;return s},access:function(j,s,v,z,H,G){var K=j.length;if(typeof s==="object"){for(var Q in s)b.access(j,Q,s[Q],z,H,v);return j}if(v!==B){z=!G&&z&&b.isFunction(v);for(Q=0;Q<K;Q++)H(j[Q],s,z?v.call(j[Q],Q,H(j[Q],s)):v,G);return j}return K?H(j[0],s):B},now:function(){return(new Date).getTime()},uaMatch:function(j){j=j.toLowerCase();j=L.exec(j)||g.exec(j)||i.exec(j)||j.indexOf("compatible")<0&&n.exec(j)||
[];return{browser:j[1]||"",version:j[2]||"0"}},browser:{}});b.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(j,s){R["[object "+s+"]"]=s.toLowerCase()});m=b.uaMatch(m);if(m.browser){b.browser[m.browser]=true;b.browser.version=m.version}if(b.browser.webkit)b.browser.safari=true;if(D)b.inArray=function(j,s){return D.call(s,j)};if(!/\s/.test("\u00a0")){k=/^[\s\xA0]+/;o=/[\s\xA0]+$/}f=b(t);if(t.addEventListener)u=function(){t.removeEventListener("DOMContentLoaded",u,
false);b.ready()};else if(t.attachEvent)u=function(){if(t.readyState==="complete"){t.detachEvent("onreadystatechange",u);b.ready()}};return E.jQuery=E.$=b}();(function(){c.support={};var a=t.documentElement,b=t.createElement("script"),d=t.createElement("div"),e="script"+c.now();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"),
k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false,
scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent=
false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom=
1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="<div style='width:4px;'></div>";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display=
"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h=
c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);
else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h<l;h++){f=e[h].name;if(f.indexOf("data-")===0){f=f.substr(5);ka(this[0],f,d[f])}}}return d}else if(typeof a==="object")return this.each(function(){c.data(this,
a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(b===B){d=this.triggerHandler("getData"+k[1]+"!",[k[0]]);if(d===B&&this.length){d=c.data(this[0],a);d=ka(this[0],a,d)}return d===B&&k[1]?this.data(k[0]):d}else return this.each(function(){var o=c(this),x=[k[0],b];o.triggerHandler("setData"+k[1]+"!",x);c.data(this,a,b);o.triggerHandler("changeData"+k[1]+"!",x)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var e=
c.data(a,b);if(!d)return e||[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===B)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,
a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var sa=/[\n\t]/g,ha=/\s+/,Sa=/\r/g,Ta=/^(?:href|src|style)$/,Ua=/^(?:button|input)$/i,Va=/^(?:button|input|object|select|textarea)$/i,Wa=/^a(?:rea)?$/i,ta=/^(?:radio|checkbox)$/i;c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",
colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(x){var r=c(this);r.addClass(a.call(this,x,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===
1)if(f.className){for(var h=" "+f.className+" ",l=f.className,k=0,o=b.length;k<o;k++)if(h.indexOf(" "+b[k]+" ")<0)l+=" "+b[k];f.className=c.trim(l)}else f.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(o){var x=c(this);x.removeClass(a.call(this,o,x.attr("class")))});if(a&&typeof a==="string"||a===B)for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1&&f.className)if(a){for(var h=(" "+f.className+" ").replace(sa," "),
l=0,k=b.length;l<k;l++)h=h.replace(" "+b[l]+" "," ");f.className=c.trim(h)}else f.className=""}return this},toggleClass:function(a,b){var d=typeof a,e=typeof b==="boolean";if(c.isFunction(a))return this.each(function(f){var h=c(this);h.toggleClass(a.call(this,f,h.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var f,h=0,l=c(this),k=b,o=a.split(ha);f=o[h++];){k=e?k:!l.hasClass(f);l[k?"addClass":"removeClass"](f)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,
"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(sa," ").indexOf(a)>-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";
if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h<e;h++){var l=f[h];if(l.selected&&(c.support.optDisabled?!l.disabled:l.getAttribute("disabled")===null)&&(!l.parentNode.disabled||!c.nodeName(l.parentNode,"optgroup"))){a=c(l).val();if(b)return a;d.push(a)}}return d}if(ta.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Sa,"")}return B}var k=c.isFunction(a);return this.each(function(o){var x=c(this),r=a;if(this.nodeType===1){if(k)r=
a.call(this,o,x.val());if(r==null)r="";else if(typeof r==="number")r+="";else if(c.isArray(r))r=c.map(r,function(C){return C==null?"":C+""});if(c.isArray(r)&&ta.test(this.type))this.checked=c.inArray(x.val(),r)>=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},
attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&
b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0};
c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,
arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid=
d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+
c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h<A.length;h++){C=A[h];if(d.guid===C.guid){if(k||x.test(C.namespace)){e==null&&A.splice(h--,1);r.remove&&r.remove.call(a,C)}if(e!=null)break}}if(A.length===0||e!=null&&A.length===1){if(!r.teardown||r.teardown.call(a,o)===false)c.removeEvent(a,f,w.handle);delete I[f]}}else for(h=0;h<A.length;h++){C=A[h];if(k||x.test(C.namespace)){c.event.remove(a,r,C.handler,h);A.splice(h--,1)}}}if(c.isEmptyObject(I)){if(b=
w.handle)b.elem=null;delete w.events;delete w.handle;if(typeof w==="function")c.removeData(a,J);else c.isEmptyObject(w)&&c.removeData(a)}}}}},trigger:function(a,b,d,e){var f=a.type||a;if(!e){a=typeof a==="object"?a[c.expando]?a:c.extend(c.Event(f),a):c.Event(f);if(f.indexOf("!")>=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===
8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k===
"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+
d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f<l;f++){var k=d[f];if(b||e.test(k.namespace)){a.handler=k.handler;a.data=k.data;a.handleObj=k;k=k.handler.apply(this,h);if(k!==B){a.result=k;if(k===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
fix:function(a){if(a[c.expando])return a;var b=a;a=c.Event(b);for(var d=this.props.length,e;d;){e=this.props[--d];a[e]=b[e]}if(!a.target)a.target=a.srcElement||t;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=t.documentElement;d=t.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==B)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,Y(a.origType,a.selector),c.extend({},a,{handler:Ka,guid:a.handler.guid}))},remove:function(a){c.event.remove(this,
Y(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,d){if(c.isWindow(this))this.onbeforeunload=d},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.removeEvent=t.removeEventListener?function(a,b,d){a.removeEventListener&&a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent&&a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=
c.now();this[c.expando]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=ca;var a=this.originalEvent;if(a)if(a.preventDefault)a.preventDefault();else a.returnValue=false},stopPropagation:function(){this.isPropagationStopped=ca;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ca;this.stopPropagation()},isDefaultPrevented:U,isPropagationStopped:U,isImmediatePropagationStopped:U};
var va=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},wa=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?wa:va,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?wa:va)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!==
"form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length){a.liveFired=B;return la("submit",this,arguments)}});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13){a.liveFired=B;return la("submit",this,arguments)}})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var V,
xa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired=
B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type===
"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]===
0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h<k;h++)c.event.add(this[h],d,l,e)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var d in a)this.unbind(d,
a[d]);else{d=0;for(var e=this.length;d<e;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,e){return this.live(b,d,e,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var d=c.Event(a);d.preventDefault();d.stopPropagation();c.event.trigger(d,b,this[0]);return d.result}},toggle:function(a){for(var b=arguments,d=
1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(e){var f=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,f+1);e.preventDefault();return b[f].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var ya={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,e,f,h){var l,k=0,o,x,r=h||this.selector;h=h?this:c(this.context);if(typeof d===
"object"&&!d.preventDefault){for(l in d)h[b](l,e,d[l],r);return this}if(c.isFunction(e)){f=e;e=B}for(d=(d||"").split(" ");(l=d[k++])!=null;){o=X.exec(l);x="";if(o){x=o[0];l=l.replace(X,"")}if(l==="hover")d.push("mouseenter"+x,"mouseleave"+x);else{o=l;if(l==="focus"||l==="blur"){d.push(ya[l]+x);l+=x}else l=(ya[l]||l)+x;if(b==="live"){x=0;for(var A=h.length;x<A;x++)c.event.add(h[x],"live."+Y(l,r),{data:e,selector:r,handler:f,origType:l,origHandler:f,preType:o})}else h.unbind("live."+Y(l,r),f)}}return this}});
c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d,e){if(e==null){e=d;d=null}return arguments.length>0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p<u;p++){var y=m[p];if(y){var F=false;for(y=y[g];y;){if(y.sizcache===n){F=m[y.sizset];break}if(y.nodeType===1&&!q){y.sizcache=n;y.sizset=p}if(y.nodeName.toLowerCase()===i){F=y;break}y=y[g]}m[p]=F}}}function b(g,i,n,m,p,q){p=0;for(var u=m.length;p<u;p++){var y=m[p];if(y){var F=false;for(y=y[g];y;){if(y.sizcache===n){F=m[y.sizset];break}if(y.nodeType===1){if(!q){y.sizcache=n;y.sizset=p}if(typeof i!=="string"){if(y===i){F=true;break}}else if(k.filter(i,
[y]).length>0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3];
break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr,
q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h=
l;g.sort(w);if(h)for(var i=1;i<g.length;i++)g[i]===g[i-1]&&g.splice(i--,1)}return g};k.matches=function(g,i){return k(g,null,null,i)};k.matchesSelector=function(g,i){return k(i,null,null,[g]).length>0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p<q;p++){var u,y=o.order[p];if(u=o.leftMatch[y].exec(g)){var F=u[1];u.splice(1,1);if(F.substr(F.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");m=o.find[y](u,i,n);if(m!=null){g=g.replace(o.match[y],"");break}}}}m||(m=i.getElementsByTagName("*"));
return{set:m,expr:g}};k.filter=function(g,i,n,m){for(var p,q,u=g,y=[],F=i,M=i&&i[0]&&k.isXML(i[0]);g&&i.length;){for(var N in o.filter)if((p=o.leftMatch[N].exec(g))!=null&&p[2]){var O,D,R=o.filter[N];D=p[1];q=false;p.splice(1,1);if(D.substr(D.length-1)!=="\\"){if(F===y)y=[];if(o.preFilter[N])if(p=o.preFilter[N](p,F,n,y,m,M)){if(p===true)continue}else q=O=true;if(p)for(var j=0;(D=F[j])!=null;j++)if(D){O=R(D,p,j,F);var s=m^!!O;if(n&&O!=null)if(s)q=true;else F[j]=false;else if(s){y.push(D);q=true}}if(O!==
B){n||(F=y);g=g.replace(o.match[N],"");if(!q)return[];break}}}if(g===u)if(q==null)k.error(g);else break;u=g}return F};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var o=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,i){var n=typeof i==="string",m=n&&!/\W/.test(i);n=n&&!m;if(m)i=i.toLowerCase();m=0;for(var p=g.length,q;m<p;m++)if(q=g[m]){for(;(q=q.previousSibling)&&q.nodeType!==1;);g[m]=n||q&&q.nodeName.toLowerCase()===
i?q||false:q===i}n&&k.filter(i,g,true)},">":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p<q;p++){if(n=g[p]){n=n.parentNode;g[p]=n.nodeName.toLowerCase()===i?n:false}}else{for(;p<q;p++)if(n=g[p])g[p]=m?n.parentNode:n.parentNode===i;m&&k.filter(i,g,true)}},"":function(g,i,n){var m,p=e++,q=b;if(typeof i==="string"&&!/\W/.test(i)){m=i=i.toLowerCase();q=a}q("parentNode",i,p,g,m,n)},"~":function(g,i,n){var m,p=e++,q=b;if(typeof i==="string"&&!/\W/.test(i)){m=
i=i.toLowerCase();q=a}q("previousSibling",i,p,g,m,n)}},find:{ID:function(g,i,n){if(typeof i.getElementById!=="undefined"&&!n)return(g=i.getElementById(g[1]))&&g.parentNode?[g]:[]},NAME:function(g,i){if(typeof i.getElementsByName!=="undefined"){for(var n=[],m=i.getElementsByName(g[1]),p=0,q=m.length;p<q;p++)m[p].getAttribute("name")===g[1]&&n.push(m[p]);return n.length===0?null:n}},TAG:function(g,i){return i.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,i,n,m,p,q){g=" "+g[1].replace(/\\/g,
"")+" ";if(q)return g;q=0;for(var u;(u=i[q])!=null;q++)if(u)if(p^(u.className&&(" "+u.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n,
m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===
true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===
g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return i<n[3]-0},gt:function(g,i,n){return i>n[3]-0},nth:function(g,i,n){return n[3]-
0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n<m;n++)if(i[n]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+p)},CHILD:function(g,i){var n=i[1],m=g;switch(n){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(n===
"first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":n=i[2];var p=i[3];if(n===1&&p===0)return true;var q=i[0],u=g.parentNode;if(u&&(u.sizcache!==q||!g.nodeIndex)){var y=0;for(m=u.firstChild;m;m=m.nextSibling)if(m.nodeType===1)m.nodeIndex=++y;u.sizcache=q}m=g.nodeIndex-p;return n===0?m===0:m%n===0&&m/n>=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===
i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]];
if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m,
g);else if(typeof g.length==="number")for(var p=g.length;n<p;n++)m.push(g[n]);else for(;g[n];n++)m.push(g[n]);return m}}var w,I;if(t.documentElement.compareDocumentPosition)w=function(g,i){if(g===i){h=true;return 0}if(!g.compareDocumentPosition||!i.compareDocumentPosition)return g.compareDocumentPosition?-1:1;return g.compareDocumentPosition(i)&4?-1:1};else{w=function(g,i){var n,m,p=[],q=[];n=g.parentNode;m=i.parentNode;var u=n;if(g===i){h=true;return 0}else if(n===m)return I(g,i);else if(n){if(!m)return 1}else return-1;
for(;u;){p.unshift(u);u=u.parentNode}for(u=m;u;){q.unshift(u);u=u.parentNode}n=p.length;m=q.length;for(u=0;u<n&&u<m;u++)if(p[u]!==q[u])return I(p[u],q[u]);return u===n?I(g,q[u],-1):I(p[u],i,1)};I=function(g,i,n){if(g===i)return n;for(g=g.nextSibling;g;){if(g===i)return-1;g=g.nextSibling}return 1}}k.getText=function(g){for(var i="",n,m=0;g[m];m++){n=g[m];if(n.nodeType===3||n.nodeType===4)i+=n.nodeValue;else if(n.nodeType!==8)i+=k.getText(n.childNodes)}return i};(function(){var g=t.createElement("div"),
i="script"+(new Date).getTime(),n=t.documentElement;g.innerHTML="<a name='"+i+"'/>";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g);
n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&&
function(){var g=k,i=t.createElement("div");i.innerHTML="<p class='TEST'></p>";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F||
p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g=
t.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition?
function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n<u;n++)k(g,q[n],m);return k.filter(p,m)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=k.getText;c.isXMLDoc=k.isXML;
c.contains=k.contains})();var Za=/Until$/,$a=/^(?:parents|prevUntil|prevAll)/,ab=/,/,Na=/^.[^:#\[\.,]*$/,bb=Array.prototype.slice,cb=c.expr.match.POS;c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,e=0,f=this.length;e<f;e++){d=b.length;c.find(a,this[e],b);if(e>0)for(var h=d;h<b.length;h++)for(var l=0;l<d;l++)if(b[l]===b[h]){b.splice(h--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,e=b.length;d<e;d++)if(c.contains(this,b[d]))return true})},
not:function(a){return this.pushStack(ma(this,a,false),"not",a)},filter:function(a){return this.pushStack(ma(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e<f;e++){l=a[e];k[l]||(k[l]=c.expr.match.POS.test(l)?c(l,b||this.context):l)}for(;h&&h.ownerDocument&&h!==b;){for(l in k){e=k[l];if(e.jquery?e.index(h)>-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h=
h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e<f;e++)for(h=this[e];h;)if(l?l.index(h)>-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context):
c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,
2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,
b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&
e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/<tbody/i,eb=/<|&#?\w+;/,Ca=/<(?:script|object|embed|option|style)/i,Da=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/\=([^="'>\s]+\/)>/g,P={option:[1,
"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null;
else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1></$2>");try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(e){this.empty().append(a)}}else c.isFunction(a)?this.each(function(f){var h=c(this);h.html(a.call(this,f,h.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=
c(this),e=d.html();d.replaceWith(a.call(this,b,e))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){var e,f,h,l=a[0],k=[];if(!c.support.checkClone&&arguments.length===3&&typeof l==="string"&&Da.test(l))return this.each(function(){c(this).domManip(a,
b,d,true)});if(c.isFunction(l))return this.each(function(x){var r=c(this);a[0]=l.call(this,x,b?r.html():B);r.domManip(a,b,d)});if(this[0]){e=l&&l.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:c.buildFragment(a,this,k);h=e.fragment;if(f=h.childNodes.length===1?h=h.firstChild:h.firstChild){b=b&&c.nodeName(f,"tr");f=0;for(var o=this.length;f<o;f++)d.call(b?c.nodeName(this[f],"table")?this[f].getElementsByTagName("tbody")[0]||this[f].appendChild(this[f].ownerDocument.createElement("tbody")):
this[f]:this[f],f>0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",
prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f<h;f++){var l=(f>0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument||
b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1></$2>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]==="<table>"&&!x?r.childNodes:[];for(o=k.length-
1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script"))));
d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i,
jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,
zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),
h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b);
if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f=
d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left;
e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b===
"object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("<div>").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&
!this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})},
getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html",
script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data||
!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache=
false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset;
A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type",
b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&&
c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d||
c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]=
encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess",
[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),
e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}});
if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show",
3),a,b,d);else{d=0;for(var e=this.length;d<e;d++){a=this[d];b=a.style.display;if(!c.data(a,"olddisplay")&&b==="none")b=a.style.display="";b===""&&c.css(a,"display")==="none"&&c.data(a,"olddisplay",qa(a.nodeName))}for(d=0;d<e;d++){a=this[d];b=a.style.display;if(b===""||b==="none")a.style.display=c.data(a,"olddisplay")||""}return this}},hide:function(a,b,d){if(a||a===0)return this.animate(S("hide",3),a,b,d);else{a=0;for(b=this.length;a<b;a++){d=c.css(this[a],"display");d!=="none"&&c.data(this[a],"olddisplay",
d)}for(a=0;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b,d){var e=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||e?this.each(function(){var f=e?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(S("toggle",3),a,b,d);return this},fadeTo:function(a,b,d,e){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d,e)},animate:function(a,b,d,e){var f=c.speed(b,
d,e);if(c.isEmptyObject(a))return this.each(f.complete);return this[f.queue===false?"each":"queue"](function(){var h=c.extend({},f),l,k=this.nodeType===1,o=k&&c(this).is(":hidden"),x=this;for(l in a){var r=c.camelCase(l);if(l!==r){a[r]=a[l];delete a[l];l=r}if(a[l]==="hide"&&o||a[l]==="show"&&!o)return h.complete.call(this);if(k&&(l==="height"||l==="width")){h.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(c.css(this,"display")==="inline"&&c.css(this,"float")==="none")if(c.support.inlineBlockNeedsLayout)if(qa(this.nodeName)===
"inline")this.style.display="inline-block";else{this.style.display="inline";this.style.zoom=1}else this.style.display="inline-block"}if(c.isArray(a[l])){(h.specialEasing=h.specialEasing||{})[l]=a[l][1];a[l]=a[l][0]}}if(h.overflow!=null)this.style.overflow="hidden";h.curAnim=c.extend({},a);c.each(a,function(A,C){var J=new c.fx(x,h,A);if(vb.test(C))J[C==="toggle"?o?"show":"hide":C](a);else{var w=wb.exec(C),I=J.cur()||0;if(w){var L=parseFloat(w[2]),g=w[3]||"px";if(g!=="px"){c.style(x,A,(L||1)+g);I=(L||
1)/J.cur()*I;c.style(x,A,I+g)}if(w[1])L=(w[1]==="-="?-1:1)*L+I;J.custom(I,L,g)}else J.custom(I,C,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var e=d.length-1;e>=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b,
d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a*
Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)}
var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;
this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide||
this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=
c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},interval:13,stop:function(){clearInterval(ba);ba=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===
b.elem}).length};var xb=/^t(?:able|d|h)$/i,Ia=/^(?:body|html)$/i;c.fn.offset="getBoundingClientRect"in t.documentElement?function(a){var b=this[0],d;if(a)return this.each(function(l){c.offset.setOffset(this,a,l)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);try{d=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,h=f.documentElement;if(!d||!c.contains(h,b))return d||{top:0,left:0};b=f.body;f=fa(f);return{top:d.top+(f.pageYOffset||c.support.boxModel&&
h.scrollTop||b.scrollTop)-(h.clientTop||b.clientTop||0),left:d.left+(f.pageXOffset||c.support.boxModel&&h.scrollLeft||b.scrollLeft)-(h.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(x){c.offset.setOffset(this,a,x)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d,e=b.offsetParent,f=b.ownerDocument,h=f.documentElement,l=f.body;d=(f=f.defaultView)?f.getComputedStyle(b,null):b.currentStyle;
for(var k=b.offsetTop,o=b.offsetLeft;(b=b.parentNode)&&b!==l&&b!==h;){if(c.offset.supportsFixedPosition&&d.position==="fixed")break;d=f?f.getComputedStyle(b,null):b.currentStyle;k-=b.scrollTop;o-=b.scrollLeft;if(b===e){k+=b.offsetTop;o+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&xb.test(b.nodeName))){k+=parseFloat(d.borderTopWidth)||0;o+=parseFloat(d.borderLeftWidth)||0}e=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"){k+=
parseFloat(d.borderTopWidth)||0;o+=parseFloat(d.borderLeftWidth)||0}d=d}if(d.position==="relative"||d.position==="static"){k+=l.offsetTop;o+=l.offsetLeft}if(c.offset.supportsFixedPosition&&d.position==="fixed"){k+=Math.max(h.scrollTop,l.scrollTop);o+=Math.max(h.scrollLeft,l.scrollLeft)}return{top:k,left:o}};c.offset={initialize:function(){var a=t.body,b=t.createElement("div"),d,e,f,h=parseFloat(c.css(a,"marginTop"))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",
height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);d=b.firstChild;e=d.firstChild;f=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=e.offsetTop!==5;this.doesAddBorderForTableAndCells=
f.offsetTop===5;e.style.position="fixed";e.style.top="20px";this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15;e.style.position=e.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==h;a.removeChild(b);c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.css(a,
"marginTop"))||0;d+=parseFloat(c.css(a,"marginLeft"))||0}return{top:b,left:d}},setOffset:function(a,b,d){var e=c.css(a,"position");if(e==="static")a.style.position="relative";var f=c(a),h=f.offset(),l=c.css(a,"top"),k=c.css(a,"left"),o=e==="absolute"&&c.inArray("auto",[l,k])>-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a,
e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&&
c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();
c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+
b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window);
|
packages/material-ui-icons/src/GpsFixedRounded.js | kybarg/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<path d="M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3c-.46-4.17-3.77-7.48-7.94-7.94V2c0-.55-.45-1-1-1s-1 .45-1 1v1.06C6.83 3.52 3.52 6.83 3.06 11H2c-.55 0-1 .45-1 1s.45 1 1 1h1.06c.46 4.17 3.77 7.48 7.94 7.94V22c0 .55.45 1 1 1s1-.45 1-1v-1.06c4.17-.46 7.48-3.77 7.94-7.94H22c.55 0 1-.45 1-1s-.45-1-1-1h-1.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z" />
, 'GpsFixedRounded');
|
ajax/libs/react-modal/0.0.3/react-modal.js | luhad/cdnjs | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.ReactModal=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
/** @jsx React.DOM */
var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null);
var ModalPortal = _dereq_('./ModalPortal');
var ariaAppHider = _dereq_('../helpers/ariaAppHider');
var injectCSS = _dereq_('../helpers/injectCSS');
var Modal = module.exports = React.createClass({
displayName: 'Modal',
statics: {
setAppElement: ariaAppHider.setElement,
injectCSS: injectCSS
},
propTypes: {
isOpen: React.PropTypes.bool.isRequired,
onRequestClose: React.PropTypes.func,
appElement: React.PropTypes.instanceOf(HTMLElement),
closeTimeoutMS: React.PropTypes.number,
ariaHideApp: React.PropTypes.bool
},
getDefaultProps: function () {
return {
isOpen: false,
ariaHideApp: true,
closeTimeoutMS: 0
};
},
componentDidMount: function() {
this.node = document.createElement('div');
this.node.className = 'ReactModalPortal';
document.body.appendChild(this.node);
this.renderPortal(this.props);
},
componentWillReceiveProps: function(newProps) {
this.renderPortal(newProps);
},
componentWillUnmount: function() {
React.unmountComponentAtNode(this.node);
document.body.removeChild(this.node);
},
renderPortal: function(props) {
if (props.ariaHideApp) {
ariaAppHider.toggle(props.isOpen, props.appElement);
}
sanitizeProps(props);
this.portal = React.renderComponent(ModalPortal(props), this.node);
},
render: function () {
return null;
}
});
function sanitizeProps(props) {
delete props.ref;
}
},{"../helpers/ariaAppHider":3,"../helpers/injectCSS":5,"./ModalPortal":2}],2:[function(_dereq_,module,exports){
var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null);
var div = React.DOM.div;
var focusManager = _dereq_('../helpers/focusManager');
var scopeTab = _dereq_('../helpers/scopeTab');
// so that our CSS is statically analyzable
var CLASS_NAMES = {
overlay: {
base: 'ReactModal__Overlay',
afterOpen: 'ReactModal__Overlay--after-open',
beforeClose: 'ReactModal__Overlay--before-close',
},
content: {
base: 'ReactModal__Content',
afterOpen: 'ReactModal__Content--after-open',
beforeClose: 'ReactModal__Content--before-close',
}
};
function stopPropagation(event) {
event.stopPropagation();
}
var ModalPortal = module.exports = React.createClass({
displayName: 'ModalPortal',
getInitialState: function() {
return {
afterOpen: false,
beforeClose: false
};
},
componentDidMount: function() {
this.handleProps(this.props);
this.maybeFocus();
},
componentWillReceiveProps: function(newProps) {
this.handleProps(newProps);
},
handleProps: function(props) {
if (props.isOpen === true)
this.open();
else if (props.isOpen === false)
this.close();
},
open: function() {
focusManager.setupScopedFocus(this.getDOMNode());
focusManager.markForFocusLater();
this.setState({isOpen: true}, function() {
this.setState({afterOpen: true});
}.bind(this));
},
close: function() {
if (!this.ownerHandlesClose())
return;
if (this.props.closeTimeoutMS > 0)
this.closeWithTimeout();
else
this.closeWithoutTimeout();
},
componentDidUpdate: function() {
this.maybeFocus();
},
maybeFocus: function() {
if (this.props.isOpen)
this.focusContent();
},
focusContent: function() {
this.refs.content.getDOMNode().focus();
},
closeWithTimeout: function() {
this.setState({beforeClose: true}, function() {
setTimeout(this.closeWithoutTimeout, this.props.closeTimeoutMS);
}.bind(this));
},
closeWithoutTimeout: function() {
this.setState({
afterOpen: false,
beforeClose: false
}, this.afterClose);
},
afterClose: function() {
focusManager.returnFocus();
focusManager.teardownScopedFocus();
},
handleKeyDown: function(event) {
if (event.key == 9 /*tab*/) scopeTab(this.getDOMNode(), event);
if (event.key == 27 /*esc*/) this.requestClose();
},
handleOverlayClick: function() {
if (this.ownerHandlesClose())
this.requestClose();
else
this.focusContent();
},
requestClose: function() {
if (this.ownerHandlesClose)
this.props.onRequestClose();
},
ownerHandlesClose: function() {
return this.props.onRequestClose;
},
shouldBeClosed: function() {
return !this.props.isOpen && !this.state.beforeClose;
},
overlayStyles: { position: 'fixed', left: 0, right: 0, top: 0, bottom: 0 },
buildClassName: function(which) {
var className = CLASS_NAMES[which].base;
if (this.state.afterOpen)
className += ' '+CLASS_NAMES[which].afterOpen;
if (this.state.beforeClose)
className += ' '+CLASS_NAMES[which].beforeClose;
return className;
},
render: function() {
return this.shouldBeClosed() ? div() : (
div({
className: this.buildClassName('overlay'),
style: this.overlayStyles,
onClick: this.handleOverlayClick
},
div({
ref: "content",
className: this.buildClassName('content'),
tabIndex: "-1",
onClick: stopPropagation,
onKeyDown: this.handleKeyDown
},
this.props.children
)
)
);
}
});
},{"../helpers/focusManager":4,"../helpers/scopeTab":6}],3:[function(_dereq_,module,exports){
var _element = null;
function setElement(element) {
_element = element;
}
function hide(appElement) {
validateElement(appElement);
(appElement || _element).setAttribute('aria-hidden', 'true');
}
function show(appElement) {
validateElement(appElement);
(appElement || _element).removeAttribute('aria-hidden');
}
function toggle(shouldHide, appElement) {
if (shouldHide)
hide(appElement);
else
show(appElement);
}
function validateElement(appElement) {
if (!appElement && !_element)
throw new Error('react-modal: You must set an element with `Modal.setAppElement(el)` to make this accessible');
}
function resetForTesting() {
_element = null;
}
exports.toggle = toggle;
exports.setElement = setElement;
exports.show = show;
exports.hide = hide;
exports.resetForTesting = resetForTesting;
},{}],4:[function(_dereq_,module,exports){
var findTabbable = _dereq_('../helpers/tabbable');
var modalElement = null;
var focusLaterElement = null;
var needToFocus = false;
function handleBlur(event) {
needToFocus = true;
}
function handleFocus(event) {
if (needToFocus) {
needToFocus = false;
// need to see how jQuery shims document.on('focusin') so we don't need the
// setTimeout, firefox doesn't support focusin, if it did, we could focus
// the the element outisde of a setTimeout. Side-effect of this
// implementation is that the document.body gets focus, and then we focus
// our element right after, seems fine.
setTimeout(function() {
if (modalElement.contains(document.activeElement))
return;
var el = (findTabbable(modalElement)[0] || modalElement);
el.focus();
}, 0);
}
}
exports.markForFocusLater = function() {
focusLaterElement = document.activeElement;
};
exports.returnFocus = function() {
try {
focusLaterElement.focus();
}
catch (e) {
console.warn('You tried to return focus to '+focusLaterElement+' but it is not in the DOM anymore');
}
focusLaterElement = null;
};
exports.setupScopedFocus = function(element) {
modalElement = element;
window.addEventListener('blur', handleBlur, false);
document.addEventListener('focus', handleFocus, true);
};
exports.teardownScopedFocus = function() {
modalElement = null;
window.removeEventListener('blur', handleBlur);
document.removeEventListener('focus', handleFocus);
};
},{"../helpers/tabbable":7}],5:[function(_dereq_,module,exports){
module.exports = function() {
injectStyle([
'.ReactModal__Overlay {',
' background-color: rgba(255, 255, 255, 0.75);',
'}',
'.ReactModal__Content {',
' position: absolute;',
' top: 40px;',
' left: 40px;',
' right: 40px;',
' bottom: 40px;',
' border: 1px solid #ccc;',
' background: #fff;',
' overflow: auto;',
' -webkit-overflow-scrolling: touch;',
' border-radius: 4px;',
' outline: none;',
' padding: 20px;',
'}',
'@media (max-width: 768px) {',
' .ReactModal__Content {',
' top: 10px;',
' left: 10px;',
' right: 10px;',
' bottom: 10px;',
' padding: 10px;',
' }',
'}'
].join('\n'));
};
function injectStyle(css) {
var style = document.getElementById('rackt-style');
if (!style) {
style = document.createElement('style');
style.setAttribute('id', 'rackt-style');
var head = document.getElementsByTagName('head')[0];
head.insertBefore(style, head.firstChild);
}
style.innerHTML = style.innerHTML+'\n'+css;
}
},{}],6:[function(_dereq_,module,exports){
var findTabbable = _dereq_('../helpers/tabbable');
module.exports = function(node, event) {
var tabbable = findTabbable(node);
var finalTabbable = tabbable[event.shiftKey ? 0 : tabbable.length - 1];
var leavingFinalTabbable = (
finalTabbable === document.activeElement ||
// handle immediate shift+tab after opening with mouse
node === document.activeElement
);
if (!leavingFinalTabbable) return;
event.preventDefault();
var target = tabbable[event.shiftKey ? tabbable.length - 1 : 0];
target.focus();
};
},{"../helpers/tabbable":7}],7:[function(_dereq_,module,exports){
/*!
* Adapted from jQuery UI core
*
* http://jqueryui.com
*
* Copyright 2014 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/category/ui-core/
*/
function focusable(element, isTabIndexNotNaN) {
var nodeName = element.nodeName.toLowerCase();
return (/input|select|textarea|button|object/.test(nodeName) ?
!element.disabled :
"a" === nodeName ?
element.href || isTabIndexNotNaN :
isTabIndexNotNaN) && visible(element);
}
function hidden(el) {
return (el.offsetWidth <= 0 && el.offsetHeight <= 0) ||
el.style.display === 'none';
}
function visible(element) {
while (element) {
if (element === document.body) break;
if (hidden(element)) return false;
element = element.parentNode;
}
return true;
}
function tabbable(element) {
var tabIndex = element.getAttribute('tabindex');
if (tabIndex === null) tabIndex = undefined;
var isTabIndexNaN = isNaN(tabIndex);
return (isTabIndexNaN || tabIndex >= 0) && focusable(element, !isTabIndexNaN);
}
function findTabbableDescendants(element) {
return [].slice.call(element.querySelectorAll('*'), 0).filter(function(el) {
return tabbable(el);
});
}
module.exports = findTabbableDescendants;
},{}],8:[function(_dereq_,module,exports){
module.exports = _dereq_('./components/Modal');
},{"./components/Modal":1}]},{},[8])
(8)
}); |
fields/types/select/SelectColumn.js | benkroeger/keystone | import React from 'react';
import ItemsTableCell from '../../components/ItemsTableCell';
import ItemsTableValue from '../../components/ItemsTableValue';
var SelectColumn = React.createClass({
displayName: 'SelectColumn',
propTypes: {
col: React.PropTypes.object,
data: React.PropTypes.object,
linkTo: React.PropTypes.string,
},
getValue () {
const value = this.props.data.fields[this.props.col.path];
const option = this.props.col.field.ops.filter(i => i.value === value)[0];
return option ? option.label : null;
},
render () {
const value = this.getValue();
const empty = !value && this.props.linkTo ? true : false;
return (
<ItemsTableCell>
<ItemsTableValue field={this.props.col.type} to={this.props.linkTo} empty={empty}>
{value}
</ItemsTableValue>
</ItemsTableCell>
);
},
});
module.exports = SelectColumn;
|
examples/with-redux-saga/pages/other.js | giacomorebonato/next.js | import React from 'react'
import {increment, startClock} from '../actions'
import {withReduxSaga} from '../store'
import Page from '../components/page'
class Counter extends React.Component {
static async getInitialProps ({store}) {
store.dispatch(increment())
}
componentDidMount () {
this.props.dispatch(startClock())
}
render () {
return <Page title='Other Page' linkTo='/' />
}
}
export default withReduxSaga(Counter)
|
vendor/yiisoft/yii2/assets/yii.gridView.js | xigua5/test | /**
* Yii GridView widget.
*
* This is the JavaScript widget used by the yii\grid\GridView widget.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <[email protected]>
* @since 2.0
*/
(function ($) {
$.fn.yiiGridView = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.yiiGridView');
return false;
}
};
var defaults = {
filterUrl: undefined,
filterSelector: undefined
};
var gridData = {};
var gridEvents = {
/**
* beforeFilter event is triggered before filtering the grid.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*
* If the handler returns a boolean false, it will stop filter form submission after this event. As
* a result, afterFilter event will not be triggered.
*/
beforeFilter: 'beforeFilter',
/**
* afterFilter event is triggered after filtering the grid and filtered results are fetched.
* The signature of the event handler should be:
* function (event)
* where
* - event: an Event object.
*/
afterFilter: 'afterFilter'
};
var methods = {
init: function (options) {
return this.each(function () {
var $e = $(this);
var settings = $.extend({}, defaults, options || {});
var id = $e.attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id] = $.extend(gridData[id], {settings: settings});
var enterPressed = false;
$(document).off('change.yiiGridView keydown.yiiGridView', settings.filterSelector)
.on('change.yiiGridView keydown.yiiGridView', settings.filterSelector, function (event) {
if (event.type === 'keydown') {
if (event.keyCode !== 13) {
return; // only react to enter key
} else {
enterPressed = true;
}
} else {
// prevent processing for both keydown and change events
if (enterPressed) {
enterPressed = false;
return;
}
}
methods.applyFilter.apply($e);
return false;
});
});
},
applyFilter: function () {
var $grid = $(this), event;
var settings = gridData[$grid.attr('id')].settings;
var data = {};
$.each($(settings.filterSelector).serializeArray(), function () {
if (!(this.name in data)) {
data[this.name] = [];
}
data[this.name].push(this.value);
});
var namesInFilter = Object.keys(data);
$.each(yii.getQueryParams(settings.filterUrl), function (name, value) {
if (namesInFilter.indexOf(name) === -1 && namesInFilter.indexOf(name.replace(/\[\]$/, '')) === -1) {
if (!$.isArray(value)) {
value = [value];
}
if (!(name in data)) {
data[name] = value;
} else {
$.each(value, function (i, val) {
if ($.inArray(val, data[name])) {
data[name].push(val);
}
});
}
}
});
var pos = settings.filterUrl.indexOf('?');
var url = pos < 0 ? settings.filterUrl : settings.filterUrl.substring(0, pos);
$grid.find('form.gridview-filter-form').remove();
var $form = $('<form/>', {
action: url,
method: 'get',
'class': 'gridview-filter-form',
style: 'display:none',
'data-pjax': ''
}).appendTo($grid);
$.each(data, function (name, values) {
$.each(values, function (index, value) {
$form.append($('<input/>').attr({type: 'hidden', name: name, value: value}));
});
});
event = $.Event(gridEvents.beforeFilter);
$grid.trigger(event);
if (event.result === false) {
return;
}
$form.submit();
$grid.trigger(gridEvents.afterFilter);
},
setSelectionColumn: function (options) {
var $grid = $(this);
var id = $(this).attr('id');
if (gridData[id] === undefined) {
gridData[id] = {};
}
gridData[id].selectionColumn = options.name;
if (!options.multiple || !options.checkAll) {
return;
}
var checkAll = "#" + id + " input[name='" + options.checkAll + "']";
//var inputs = options.class ? "input." + options.class : "input[name='" + options.name + "']";
//var inputs = "input[name='" + options.name + "']";
var inputs = options['class'] ? "input." + options['class'] : "input[name='" + options.name + "']";
var inputsEnabled = "#" + id + " " + inputs + ":enabled";
$(document).off('click.yiiGridView', checkAll).on('click.yiiGridView', checkAll, function () {
$grid.find(inputs + ":enabled").prop('checked', this.checked);
});
$(document).off('click.yiiGridView', inputsEnabled).on('click.yiiGridView', inputsEnabled, function () {
var all = $grid.find(inputs).length == $grid.find(inputs + ":checked").length;
$grid.find("input[name='" + options.checkAll + "']").prop('checked', all);
});
},
getSelectedRows: function () {
var $grid = $(this);
var data = gridData[$grid.attr('id')];
var keys = [];
if (data.selectionColumn) {
$grid.find("input[name='" + data.selectionColumn + "']:checked").each(function () {
keys.push($(this).parent().closest('tr').data('key'));
});
}
return keys;
},
destroy: function () {
return this.each(function () {
$(window).unbind('.yiiGridView');
$(this).removeData('yiiGridView');
});
},
data: function () {
var id = $(this).attr('id');
return gridData[id];
}
};
})(window.jQuery);
|
src/components/StatusAlert.js | anitrack/anitrack-web | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Alert } from 'reactstrap';
import { resetStatus } from 'actions/status';
class StatusAlert extends Component {
constructor(props){
super(props);
this.state = {alert: {}};
}
componentWillReceiveProps(nextProps){
if(nextProps.about === this.props.target){
if(nextProps.status === "success"){
this.props.onSuccess();
this.setState({alert: {color: "success", message: this.props.children}})
}else{
this.setState({alert: {color: "danger", message: nextProps.error}})
}
resetStatus();
}
}
reset(){
this.setState({alert: {}})
}
err(message){
this.setState({alert: {color: "danger", message}})
}
render() {
const alert = Object.keys(this.state.alert).length === 0 ? null : <Alert color={this.state.alert.color}>{this.state.alert.message}</Alert>
return (
<div>
{alert}
</div>
);
}
}
const mapStateToProps = (state) => {
return {
about: state.status.about,
status: state.status.status,
error: state.status.error
};
};
export default connect(mapStateToProps, null, null, { withRef: true })(StatusAlert);
|
src/js/components/icons/Edit.js | samogami/grommet | // (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP
import React, { Component } from 'react';
export default class Edit extends Component {
componentDidMount () {
console.warn('This icon has been deprecated. Please check http://www.grommet.io/docs/develop/icon for the new set of icons.');
}
render () {
var className = 'control-icon control-icon-edit';
if (this.props.className) {
className += ' ' + this.props.className;
}
return (
<svg className={className} viewBox="0 0 48 48" version="1.1">
<g fill="none">
<circle strokeWidth="2" cx="24" cy="24" r="9"/>
<line strokeWidth="2" x1="24" y1="11" x2="24" y2="15"/>
<line strokeWidth="2" x1="33.2" y1="14.8" x2="30.3" y2="17.6"/>
<line strokeWidth="2" x1="37" y1="24" x2="33" y2="24"/>
<line strokeWidth="2" x1="33.2" y1="33.2" x2="30.3" y2="30.4"/>
<line strokeWidth="2" x1="24" y1="37" x2="24" y2="33"/>
<line strokeWidth="2" x1="14.8" y1="33.2" x2="17.7" y2="30.4"/>
<line strokeWidth="2" x1="11" y1="24" x2="15.2" y2="24"/>
<line strokeWidth="2" x1="14.8" y1="14.8" x2="17.7" y2="17.6"/>
</g>
</svg>
);
}
}
|
ajax/libs/core-js/0.9.1/library.js | hare1039/cdnjs | /**
* Core.js 0.9.1
* https://github.com/zloirock/core-js
* License: http://rock.mit-license.org
* © 2015 Denis Pushkarev
*/
!function(undefined){
'use strict';
var __e = null, __g = null;
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(1);
__webpack_require__(2);
__webpack_require__(3);
__webpack_require__(4);
__webpack_require__(5);
__webpack_require__(6);
__webpack_require__(7);
__webpack_require__(8);
__webpack_require__(9);
__webpack_require__(10);
__webpack_require__(11);
__webpack_require__(12);
__webpack_require__(13);
__webpack_require__(14);
__webpack_require__(15);
__webpack_require__(16);
__webpack_require__(17);
__webpack_require__(18);
__webpack_require__(19);
__webpack_require__(20);
__webpack_require__(21);
__webpack_require__(22);
__webpack_require__(23);
__webpack_require__(24);
__webpack_require__(25);
__webpack_require__(26);
__webpack_require__(27);
__webpack_require__(28);
__webpack_require__(29);
__webpack_require__(30);
__webpack_require__(31);
__webpack_require__(32);
__webpack_require__(33);
__webpack_require__(34);
__webpack_require__(35);
__webpack_require__(36);
__webpack_require__(37);
__webpack_require__(38);
__webpack_require__(39);
__webpack_require__(40);
__webpack_require__(41);
__webpack_require__(42);
__webpack_require__(43);
__webpack_require__(44);
__webpack_require__(45);
__webpack_require__(46);
__webpack_require__(47);
__webpack_require__(48);
__webpack_require__(49);
__webpack_require__(50);
__webpack_require__(51);
__webpack_require__(52);
__webpack_require__(53);
__webpack_require__(54);
__webpack_require__(55);
__webpack_require__(56);
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, cof = __webpack_require__(58)
, $def = __webpack_require__(59)
, invoke = __webpack_require__(60)
, arrayMethod = __webpack_require__(61)
, IE_PROTO = __webpack_require__(62).safe('__proto__')
, assert = __webpack_require__(63)
, assertObject = assert.obj
, ObjectProto = Object.prototype
, A = []
, slice = A.slice
, indexOf = A.indexOf
, classof = cof.classof
, has = $.has
, defineProperty = $.setDesc
, getOwnDescriptor = $.getDesc
, defineProperties = $.setDescs
, isFunction = $.isFunction
, toObject = $.toObject
, toLength = $.toLength
, IE8_DOM_DEFINE = false;
if(!$.DESC){
try {
IE8_DOM_DEFINE = defineProperty(document.createElement('div'), 'x',
{get: function(){ return 8; }}
).x == 8;
} catch(e){ /* empty */ }
$.setDesc = function(O, P, Attributes){
if(IE8_DOM_DEFINE)try {
return defineProperty(O, P, Attributes);
} catch(e){ /* empty */ }
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
if('value' in Attributes)assertObject(O)[P] = Attributes.value;
return O;
};
$.getDesc = function(O, P){
if(IE8_DOM_DEFINE)try {
return getOwnDescriptor(O, P);
} catch(e){ /* empty */ }
if(has(O, P))return $.desc(!ObjectProto.propertyIsEnumerable.call(O, P), O[P]);
};
$.setDescs = defineProperties = function(O, Properties){
assertObject(O);
var keys = $.getKeys(Properties)
, length = keys.length
, i = 0
, P;
while(length > i)$.setDesc(O, P = keys[i++], Properties[P]);
return O;
};
}
$def($def.S + $def.F * !$.DESC, 'Object', {
// 19.1.2.6 / 15.2.3.3 Object.getOwnPropertyDescriptor(O, P)
getOwnPropertyDescriptor: $.getDesc,
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
defineProperty: $.setDesc,
// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
defineProperties: defineProperties
});
// IE 8- don't enum bug keys
var keys1 = ('constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,' +
'toLocaleString,toString,valueOf').split(',')
// Additional keys for getOwnPropertyNames
, keys2 = keys1.concat('length', 'prototype')
, keysLen1 = keys1.length;
// Create object with `null` prototype: use iframe Object with cleared prototype
var createDict = function(){
// Thrash, waste and sodomy: IE GC bug
var iframe = document.createElement('iframe')
, i = keysLen1
, gt = '>'
, iframeDocument;
iframe.style.display = 'none';
$.html.appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write('<script>document.F=Object</script' + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while(i--)delete createDict.prototype[keys1[i]];
return createDict();
};
function createGetKeys(names, length){
return function(object){
var O = toObject(object)
, i = 0
, result = []
, key;
for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while(length > i)if(has(O, key = names[i++])){
~indexOf.call(result, key) || result.push(key);
}
return result;
};
}
function isPrimitive(it){ return !$.isObject(it); }
function Empty(){}
$def($def.S, 'Object', {
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
getPrototypeOf: $.getProto = $.getProto || function(O){
O = Object(assert.def(O));
if(has(O, IE_PROTO))return O[IE_PROTO];
if(isFunction(O.constructor) && O instanceof O.constructor){
return O.constructor.prototype;
} return O instanceof Object ? ObjectProto : null;
},
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
getOwnPropertyNames: $.getNames = $.getNames || createGetKeys(keys2, keys2.length, true),
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
create: $.create = $.create || function(O, /*?*/Properties){
var result;
if(O !== null){
Empty.prototype = assertObject(O);
result = new Empty();
Empty.prototype = null;
// add "__proto__" for Object.getPrototypeOf shim
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : defineProperties(result, Properties);
},
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
keys: $.getKeys = $.getKeys || createGetKeys(keys1, keysLen1, false),
// 19.1.2.17 / 15.2.3.8 Object.seal(O)
seal: $.it, // <- cap
// 19.1.2.5 / 15.2.3.9 Object.freeze(O)
freeze: $.it, // <- cap
// 19.1.2.15 / 15.2.3.10 Object.preventExtensions(O)
preventExtensions: $.it, // <- cap
// 19.1.2.13 / 15.2.3.11 Object.isSealed(O)
isSealed: isPrimitive, // <- cap
// 19.1.2.12 / 15.2.3.12 Object.isFrozen(O)
isFrozen: isPrimitive, // <- cap
// 19.1.2.11 / 15.2.3.13 Object.isExtensible(O)
isExtensible: $.isObject // <- cap
});
// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
$def($def.P, 'Function', {
bind: function(that /*, args... */){
var fn = assert.fn(this)
, partArgs = slice.call(arguments, 1);
function bound(/* args... */){
var args = partArgs.concat(slice.call(arguments));
return invoke(fn, args, this instanceof bound ? $.create(fn.prototype) : that);
}
if(fn.prototype)bound.prototype = fn.prototype;
return bound;
}
});
// Fix for not array-like ES3 string
function arrayMethodFix(fn){
return function(){
return fn.apply($.ES5Object(this), arguments);
};
}
if(!(0 in Object('z') && 'z'[0] == 'z')){
$.ES5Object = function(it){
return cof(it) == 'String' ? it.split('') : Object(it);
};
}
$def($def.P + $def.F * ($.ES5Object != Object), 'Array', {
slice: arrayMethodFix(slice),
join: arrayMethodFix(A.join)
});
// 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
$def($def.S, 'Array', {
isArray: function(arg){
return cof(arg) == 'Array';
}
});
function createArrayReduce(isRight){
return function(callbackfn, memo){
assert.fn(callbackfn);
var O = toObject(this)
, length = toLength(O.length)
, index = isRight ? length - 1 : 0
, i = isRight ? -1 : 1;
if(arguments.length < 2)for(;;){
if(index in O){
memo = O[index];
index += i;
break;
}
index += i;
assert(isRight ? index >= 0 : length > index, 'Reduce of empty array with no initial value');
}
for(;isRight ? index >= 0 : length > index; index += i)if(index in O){
memo = callbackfn(memo, O[index], index, this);
}
return memo;
};
}
$def($def.P, 'Array', {
// 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
forEach: $.each = $.each || arrayMethod(0),
// 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
map: arrayMethod(1),
// 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
filter: arrayMethod(2),
// 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
some: arrayMethod(3),
// 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
every: arrayMethod(4),
// 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
reduce: createArrayReduce(false),
// 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
reduceRight: createArrayReduce(true),
// 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
indexOf: indexOf = indexOf || __webpack_require__(64)(false),
// 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
lastIndexOf: function(el, fromIndex /* = @[*-1] */){
var O = toObject(this)
, length = toLength(O.length)
, index = length - 1;
if(arguments.length > 1)index = Math.min(index, $.toInteger(fromIndex));
if(index < 0)index = toLength(length + index);
for(;index >= 0; index--)if(index in O)if(O[index] === el)return index;
return -1;
}
});
// 21.1.3.25 / 15.5.4.20 String.prototype.trim()
$def($def.P, 'String', {trim: __webpack_require__(65)(/^\s*([\s\S]*\S)?\s*$/, '$1')});
// 20.3.3.1 / 15.9.4.4 Date.now()
$def($def.S, 'Date', {now: function(){
return +new Date;
}});
function lz(num){
return num > 9 ? num : '0' + num;
}
// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
// PhantomJS and old webkit had a broken Date implementation.
var date = new Date(-5e13 - 1)
, brokenDate = !(date.toISOString && date.toISOString() == '0385-07-25T07:06:39.999Z');
$def($def.P + $def.F * brokenDate, 'Date', {toISOString: function(){
if(!isFinite(this))throw RangeError('Invalid time value');
var d = this
, y = d.getUTCFullYear()
, m = d.getUTCMilliseconds()
, s = y < 0 ? '-' : y > 9999 ? '+' : '';
return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) +
'-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) +
'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) +
':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z';
}});
if(classof(function(){ return arguments; }()) == 'Object')cof.classof = function(it){
var tag = classof(it);
return tag == 'Object' && isFunction(it.callee) ? 'Arguments' : tag;
};
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// ECMAScript 6 symbols shim
var $ = __webpack_require__(57)
, setTag = __webpack_require__(58).set
, uid = __webpack_require__(62)
, $def = __webpack_require__(59)
, keyOf = __webpack_require__(66)
, enumKeys = __webpack_require__(67)
, assertObject = __webpack_require__(63).obj
, has = $.has
, $create = $.create
, getDesc = $.getDesc
, setDesc = $.setDesc
, desc = $.desc
, getNames = $.getNames
, toObject = $.toObject
, Symbol = $.g.Symbol
, setter = false
, TAG = uid('tag')
, HIDDEN = uid('hidden')
, SymbolRegistry = {}
, AllSymbols = {}
, useNative = $.isFunction(Symbol);
function wrap(tag){
var sym = AllSymbols[tag] = $.set($create(Symbol.prototype), TAG, tag);
$.DESC && setter && setDesc(Object.prototype, tag, {
configurable: true,
set: function(value){
if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
setDesc(this, tag, desc(1, value));
}
});
return sym;
}
function defineProperty(it, key, D){
if(D && has(AllSymbols, key)){
if(!D.enumerable){
if(!has(it, HIDDEN))setDesc(it, HIDDEN, desc(1, {}));
it[HIDDEN][key] = true;
} else {
if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
D.enumerable = false;
}
} return setDesc(it, key, D);
}
function defineProperties(it, P){
assertObject(it);
var keys = enumKeys(P = toObject(P))
, i = 0
, l = keys.length
, key;
while(l > i)defineProperty(it, key = keys[i++], P[key]);
return it;
}
function create(it, P){
return P === undefined ? $create(it) : defineProperties($create(it), P);
}
function getOwnPropertyDescriptor(it, key){
var D = getDesc(it = toObject(it), key);
if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
return D;
}
function getOwnPropertyNames(it){
var names = getNames(toObject(it))
, result = []
, i = 0
, key;
while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key);
return result;
}
function getOwnPropertySymbols(it){
var names = getNames(toObject(it))
, result = []
, i = 0
, key;
while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]);
return result;
}
// 19.4.1.1 Symbol([description])
if(!useNative){
Symbol = function Symbol(description){
if(this instanceof Symbol)throw TypeError('Symbol is not a constructor');
return wrap(uid(description));
};
$.hide(Symbol.prototype, 'toString', function(){
return this[TAG];
});
$.create = create;
$.setDesc = defineProperty;
$.getDesc = getOwnPropertyDescriptor;
$.setDescs = defineProperties;
$.getNames = getOwnPropertyNames;
$.getSymbols = getOwnPropertySymbols;
}
var symbolStatics = {
// 19.4.2.1 Symbol.for(key)
'for': function(key){
return has(SymbolRegistry, key += '')
? SymbolRegistry[key]
: SymbolRegistry[key] = Symbol(key);
},
// 19.4.2.5 Symbol.keyFor(sym)
keyFor: function keyFor(key){
return keyOf(SymbolRegistry, key);
},
useSetter: function(){ setter = true; },
useSimple: function(){ setter = false; }
};
// 19.4.2.2 Symbol.hasInstance
// 19.4.2.3 Symbol.isConcatSpreadable
// 19.4.2.4 Symbol.iterator
// 19.4.2.6 Symbol.match
// 19.4.2.8 Symbol.replace
// 19.4.2.9 Symbol.search
// 19.4.2.10 Symbol.species
// 19.4.2.11 Symbol.split
// 19.4.2.12 Symbol.toPrimitive
// 19.4.2.13 Symbol.toStringTag
// 19.4.2.14 Symbol.unscopables
$.each.call((
'hasInstance,isConcatSpreadable,iterator,match,replace,search,' +
'species,split,toPrimitive,toStringTag,unscopables'
).split(','), function(it){
var sym = __webpack_require__(68)(it);
symbolStatics[it] = useNative ? sym : wrap(sym);
}
);
setter = true;
$def($def.G + $def.W, {Symbol: Symbol});
$def($def.S, 'Symbol', symbolStatics);
$def($def.S + $def.F * !useNative, 'Object', {
// 19.1.2.2 Object.create(O [, Properties])
create: create,
// 19.1.2.4 Object.defineProperty(O, P, Attributes)
defineProperty: defineProperty,
// 19.1.2.3 Object.defineProperties(O, Properties)
defineProperties: defineProperties,
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
getOwnPropertyDescriptor: getOwnPropertyDescriptor,
// 19.1.2.7 Object.getOwnPropertyNames(O)
getOwnPropertyNames: getOwnPropertyNames,
// 19.1.2.8 Object.getOwnPropertySymbols(O)
getOwnPropertySymbols: getOwnPropertySymbols
});
// 19.4.3.5 Symbol.prototype[@@toStringTag]
setTag(Symbol, 'Symbol');
// 20.2.1.9 Math[@@toStringTag]
setTag(Math, 'Math', true);
// 24.3.3 JSON[@@toStringTag]
setTag($.g.JSON, 'JSON', true);
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.1 Object.assign(target, source)
var $def = __webpack_require__(59);
$def($def.S, 'Object', {assign: __webpack_require__(69)});
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.10 Object.is(value1, value2)
var $def = __webpack_require__(59);
$def($def.S, 'Object', {
is: function is(x, y){
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
}
});
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $def = __webpack_require__(59);
$def($def.S, 'Object', {setPrototypeOf: __webpack_require__(70).set});
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 19.1.3.6 Object.prototype.toString()
var $ = __webpack_require__(57)
, cof = __webpack_require__(58)
, tmp = {};
tmp[__webpack_require__(68)('toStringTag')] = 'z';
if($.FW && cof(tmp) != 'z')$.hide(Object.prototype, 'toString', function toString(){
return '[object ' + cof.classof(this) + ']';
});
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, isObject = $.isObject
, toObject = $.toObject;
function wrapObjectMethod(METHOD, MODE){
var fn = ($.core.Object || {})[METHOD] || Object[METHOD]
, f = 0
, o = {};
o[METHOD] = MODE == 1 ? function(it){
return isObject(it) ? fn(it) : it;
} : MODE == 2 ? function(it){
return isObject(it) ? fn(it) : true;
} : MODE == 3 ? function(it){
return isObject(it) ? fn(it) : false;
} : MODE == 4 ? function getOwnPropertyDescriptor(it, key){
return fn(toObject(it), key);
} : MODE == 5 ? function getPrototypeOf(it){
return fn(Object($.assertDefined(it)));
} : function(it){
return fn(toObject(it));
};
try {
fn('z');
} catch(e){
f = 1;
}
$def($def.S + $def.F * f, 'Object', o);
}
wrapObjectMethod('freeze', 1);
wrapObjectMethod('seal', 1);
wrapObjectMethod('preventExtensions', 1);
wrapObjectMethod('isFrozen', 2);
wrapObjectMethod('isSealed', 2);
wrapObjectMethod('isExtensible', 3);
wrapObjectMethod('getOwnPropertyDescriptor', 4);
wrapObjectMethod('getPrototypeOf', 5);
wrapObjectMethod('keys');
wrapObjectMethod('getOwnPropertyNames');
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, NAME = 'name'
, setDesc = $.setDesc
, FunctionProto = Function.prototype;
// 19.2.4.2 name
NAME in FunctionProto || $.FW && $.DESC && setDesc(FunctionProto, NAME, {
configurable: true,
get: function(){
var match = String(this).match(/^\s*function ([^ (]*)/)
, name = match ? match[1] : '';
$.has(this, NAME) || setDesc(this, NAME, $.desc(5, name));
return name;
},
set: function(value){
$.has(this, NAME) || setDesc(this, NAME, $.desc(0, value));
}
});
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, abs = Math.abs
, floor = Math.floor
, _isFinite = $.g.isFinite
, MAX_SAFE_INTEGER = 0x1fffffffffffff; // pow(2, 53) - 1 == 9007199254740991;
function isInteger(it){
return !$.isObject(it) && _isFinite(it) && floor(it) === it;
}
$def($def.S, 'Number', {
// 20.1.2.1 Number.EPSILON
EPSILON: Math.pow(2, -52),
// 20.1.2.2 Number.isFinite(number)
isFinite: function isFinite(it){
return typeof it == 'number' && _isFinite(it);
},
// 20.1.2.3 Number.isInteger(number)
isInteger: isInteger,
// 20.1.2.4 Number.isNaN(number)
isNaN: function isNaN(number){
return number != number;
},
// 20.1.2.5 Number.isSafeInteger(number)
isSafeInteger: function isSafeInteger(number){
return isInteger(number) && abs(number) <= MAX_SAFE_INTEGER;
},
// 20.1.2.6 Number.MAX_SAFE_INTEGER
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER,
// 20.1.2.10 Number.MIN_SAFE_INTEGER
MIN_SAFE_INTEGER: -MAX_SAFE_INTEGER,
// 20.1.2.12 Number.parseFloat(string)
parseFloat: parseFloat,
// 20.1.2.13 Number.parseInt(string, radix)
parseInt: parseInt
});
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
var Infinity = 1 / 0
, $def = __webpack_require__(59)
, E = Math.E
, pow = Math.pow
, abs = Math.abs
, exp = Math.exp
, log = Math.log
, sqrt = Math.sqrt
, ceil = Math.ceil
, floor = Math.floor
, EPSILON = pow(2, -52)
, EPSILON32 = pow(2, -23)
, MAX32 = pow(2, 127) * (2 - EPSILON32)
, MIN32 = pow(2, -126);
function roundTiesToEven(n){
return n + 1 / EPSILON - 1 / EPSILON;
}
// 20.2.2.28 Math.sign(x)
function sign(x){
return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
}
// 20.2.2.5 Math.asinh(x)
function asinh(x){
return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : log(x + sqrt(x * x + 1));
}
// 20.2.2.14 Math.expm1(x)
function expm1(x){
return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp(x) - 1;
}
$def($def.S, 'Math', {
// 20.2.2.3 Math.acosh(x)
acosh: function acosh(x){
return (x = +x) < 1 ? NaN : isFinite(x) ? log(x / E + sqrt(x + 1) * sqrt(x - 1) / E) + 1 : x;
},
// 20.2.2.5 Math.asinh(x)
asinh: asinh,
// 20.2.2.7 Math.atanh(x)
atanh: function atanh(x){
return (x = +x) == 0 ? x : log((1 + x) / (1 - x)) / 2;
},
// 20.2.2.9 Math.cbrt(x)
cbrt: function cbrt(x){
return sign(x = +x) * pow(abs(x), 1 / 3);
},
// 20.2.2.11 Math.clz32(x)
clz32: function clz32(x){
return (x >>>= 0) ? 31 - floor(log(x + 0.5) * Math.LOG2E) : 32;
},
// 20.2.2.12 Math.cosh(x)
cosh: function cosh(x){
return (exp(x = +x) + exp(-x)) / 2;
},
// 20.2.2.14 Math.expm1(x)
expm1: expm1,
// 20.2.2.16 Math.fround(x)
fround: function fround(x){
var $abs = abs(x)
, $sign = sign(x)
, a, result;
if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
a = (1 + EPSILON32 / EPSILON) * $abs;
result = a - (a - $abs);
if(result > MAX32 || result != result)return $sign * Infinity;
return $sign * result;
},
// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
hypot: function hypot(value1, value2){ // eslint-disable-line no-unused-vars
var sum = 0
, len1 = arguments.length
, len2 = len1
, args = Array(len1)
, larg = -Infinity
, arg;
while(len1--){
arg = args[len1] = +arguments[len1];
if(arg == Infinity || arg == -Infinity)return Infinity;
if(arg > larg)larg = arg;
}
larg = arg || 1;
while(len2--)sum += pow(args[len2] / larg, 2);
return larg * sqrt(sum);
},
// 20.2.2.18 Math.imul(x, y)
imul: function imul(x, y){
var UInt16 = 0xffff
, xn = +x
, yn = +y
, xl = UInt16 & xn
, yl = UInt16 & yn;
return 0 | xl * yl + ((UInt16 & xn >>> 16) * yl + xl * (UInt16 & yn >>> 16) << 16 >>> 0);
},
// 20.2.2.20 Math.log1p(x)
log1p: function log1p(x){
return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log(1 + x);
},
// 20.2.2.21 Math.log10(x)
log10: function log10(x){
return log(x) / Math.LN10;
},
// 20.2.2.22 Math.log2(x)
log2: function log2(x){
return log(x) / Math.LN2;
},
// 20.2.2.28 Math.sign(x)
sign: sign,
// 20.2.2.30 Math.sinh(x)
sinh: function sinh(x){
return abs(x = +x) < 1 ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (E / 2);
},
// 20.2.2.33 Math.tanh(x)
tanh: function tanh(x){
var a = expm1(x = +x)
, b = expm1(-x);
return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
},
// 20.2.2.34 Math.trunc(x)
trunc: function trunc(it){
return (it > 0 ? floor : ceil)(it);
}
});
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59)
, toIndex = __webpack_require__(57).toIndex
, fromCharCode = String.fromCharCode;
$def($def.S, 'String', {
// 21.1.2.2 String.fromCodePoint(...codePoints)
fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars
var res = []
, len = arguments.length
, i = 0
, code;
while(len > i){
code = +arguments[i++];
if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');
res.push(code < 0x10000
? fromCharCode(code)
: fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
);
} return res.join('');
}
});
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59);
$def($def.S, 'String', {
// 21.1.2.4 String.raw(callSite, ...substitutions)
raw: function raw(callSite){
var tpl = $.toObject(callSite.raw)
, len = $.toLength(tpl.length)
, sln = arguments.length
, res = []
, i = 0;
while(len > i){
res.push(String(tpl[i++]));
if(i < sln)res.push(String(arguments[i]));
} return res.join('');
}
});
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
var set = __webpack_require__(57).set
, at = __webpack_require__(71)(true)
, ITER = __webpack_require__(62).safe('iter')
, $iter = __webpack_require__(72)
, step = $iter.step;
// 21.1.3.27 String.prototype[@@iterator]()
__webpack_require__(73)(String, 'String', function(iterated){
set(this, ITER, {o: String(iterated), i: 0});
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function(){
var iter = this[ITER]
, O = iter.o
, index = iter.i
, point;
if(index >= O.length)return step(1);
point = at.call(O, index);
iter.i += point.length;
return step(0, point);
});
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59);
$def($def.P, 'String', {
// 21.1.3.3 String.prototype.codePointAt(pos)
codePointAt: __webpack_require__(71)(false)
});
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, cof = __webpack_require__(58)
, $def = __webpack_require__(59)
, toLength = $.toLength;
$def($def.P, 'String', {
// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
endsWith: function endsWith(searchString /*, endPosition = @length */){
if(cof(searchString) == 'RegExp')throw TypeError();
var that = String($.assertDefined(this))
, endPosition = arguments[1]
, len = toLength(that.length)
, end = endPosition === undefined ? len : Math.min(toLength(endPosition), len);
searchString += '';
return that.slice(end - searchString.length, end) === searchString;
}
});
/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, cof = __webpack_require__(58)
, $def = __webpack_require__(59);
$def($def.P, 'String', {
// 21.1.3.7 String.prototype.includes(searchString, position = 0)
includes: function includes(searchString /*, position = 0 */){
if(cof(searchString) == 'RegExp')throw TypeError();
return !!~String($.assertDefined(this)).indexOf(searchString, arguments[1]);
}
});
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, $def = __webpack_require__(59);
$def($def.P, 'String', {
// 21.1.3.13 String.prototype.repeat(count)
repeat: function repeat(count){
var str = String($.assertDefined(this))
, res = ''
, n = $.toInteger(count);
if(n < 0 || n == Infinity)throw RangeError("Count can't be negative");
for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str;
return res;
}
});
/***/ },
/* 18 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, cof = __webpack_require__(58)
, $def = __webpack_require__(59);
$def($def.P, 'String', {
// 21.1.3.18 String.prototype.startsWith(searchString [, position ])
startsWith: function startsWith(searchString /*, position = 0 */){
if(cof(searchString) == 'RegExp')throw TypeError();
var that = String($.assertDefined(this))
, index = $.toLength(Math.min(arguments[1], that.length));
searchString += '';
return that.slice(index, index + searchString.length) === searchString;
}
});
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, ctx = __webpack_require__(74)
, $def = __webpack_require__(59)
, $iter = __webpack_require__(72)
, call = __webpack_require__(75);
$def($def.S + $def.F * !__webpack_require__(76)(function(iter){ Array.from(iter); }), 'Array', {
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
var O = Object($.assertDefined(arrayLike))
, mapfn = arguments[1]
, mapping = mapfn !== undefined
, f = mapping ? ctx(mapfn, arguments[2], 2) : undefined
, index = 0
, length, result, step, iterator;
if($iter.is(O)){
iterator = $iter.get(O);
// strange IE quirks mode bug -> use typeof instead of isFunction
result = new (typeof this == 'function' ? this : Array);
for(; !(step = iterator.next()).done; index++){
result[index] = mapping ? call(iterator, f, [step.value, index], true) : step.value;
}
} else {
// strange IE quirks mode bug -> use typeof instead of isFunction
result = new (typeof this == 'function' ? this : Array)(length = $.toLength(O.length));
for(; length > index; index++){
result[index] = mapping ? f(O[index], index) : O[index];
}
}
result.length = index;
return result;
}
});
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59);
$def($def.S, 'Array', {
// 22.1.2.3 Array.of( ...items)
of: function of(/* ...args */){
var index = 0
, length = arguments.length
// strange IE quirks mode bug -> use typeof instead of isFunction
, result = new (typeof this == 'function' ? this : Array)(length);
while(length > index)result[index] = arguments[index++];
result.length = length;
return result;
}
});
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, setUnscope = __webpack_require__(77)
, ITER = __webpack_require__(62).safe('iter')
, $iter = __webpack_require__(72)
, step = $iter.step
, Iterators = $iter.Iterators;
// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
__webpack_require__(73)(Array, 'Array', function(iterated, kind){
$.set(this, ITER, {o: $.toObject(iterated), i: 0, k: kind});
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
}, function(){
var iter = this[ITER]
, O = iter.o
, kind = iter.k
, index = iter.i++;
if(!O || index >= O.length){
iter.o = undefined;
return step(1);
}
if(kind == 'keys' )return step(0, index);
if(kind == 'values')return step(0, O[index]);
return step(0, [index, O[index]]);
}, 'values');
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators.Arguments = Iterators.Array;
setUnscope('keys');
setUnscope('values');
setUnscope('entries');
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(78)(Array);
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, toIndex = $.toIndex;
$def($def.P, 'Array', {
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
copyWithin: function copyWithin(target/* = 0 */, start /* = 0, end = @length */){
var O = Object($.assertDefined(this))
, len = $.toLength(O.length)
, to = toIndex(target, len)
, from = toIndex(start, len)
, end = arguments[2]
, fin = end === undefined ? len : toIndex(end, len)
, count = Math.min(fin - from, len - to)
, inc = 1;
if(from < to && to < from + count){
inc = -1;
from = from + count - 1;
to = to + count - 1;
}
while(count-- > 0){
if(from in O)O[to] = O[from];
else delete O[to];
to += inc;
from += inc;
} return O;
}
});
__webpack_require__(77)('copyWithin');
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, toIndex = $.toIndex;
$def($def.P, 'Array', {
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
fill: function fill(value /*, start = 0, end = @length */){
var O = Object($.assertDefined(this))
, length = $.toLength(O.length)
, index = toIndex(arguments[1], length)
, end = arguments[2]
, endPos = end === undefined ? length : toIndex(end, length);
while(endPos > index)O[index++] = value;
return O;
}
});
__webpack_require__(77)('fill');
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59);
$def($def.P, 'Array', {
// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
find: __webpack_require__(61)(5)
});
__webpack_require__(77)('find');
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59);
$def($def.P, 'Array', {
// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
findIndex: __webpack_require__(61)(6)
});
__webpack_require__(77)('findIndex');
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, ctx = __webpack_require__(74)
, cof = __webpack_require__(58)
, $def = __webpack_require__(59)
, assert = __webpack_require__(63)
, forOf = __webpack_require__(79)
, setProto = __webpack_require__(70).set
, species = __webpack_require__(78)
, SPECIES = __webpack_require__(68)('species')
, RECORD = __webpack_require__(62).safe('record')
, PROMISE = 'Promise'
, global = $.g
, process = global.process
, asap = process && process.nextTick || __webpack_require__(80).set
, P = global[PROMISE]
, isFunction = $.isFunction
, isObject = $.isObject
, assertFunction = assert.fn
, assertObject = assert.obj
, test;
var useNative = isFunction(P) && isFunction(P.resolve) &&
P.resolve(test = new P(function(){})) == test;
// actual Firefox has broken subclass support, test that
function P2(x){
var self = new P(x);
setProto(self, P2.prototype);
return self;
}
if(useNative){
try { // protect against bad/buggy Object.setPrototype
setProto(P2, P);
P2.prototype = $.create(P.prototype, {constructor: {value: P2}});
if(!(P2.resolve(5).then(function(){}) instanceof P2)){
useNative = false;
}
} catch(e){ useNative = false; }
}
// helpers
function getConstructor(C){
var S = assertObject(C)[SPECIES];
return S != undefined ? S : C;
}
function isThenable(it){
var then;
if(isObject(it))then = it.then;
return isFunction(then) ? then : false;
}
function isUnhandled(promise){
var record = promise[RECORD]
, chain = record.c
, i = 0
, react;
if(record.h)return false;
while(chain.length > i){
react = chain[i++];
if(react.fail || !isUnhandled(react.P))return false;
} return true;
}
function notify(record, isReject){
var chain = record.c;
if(isReject || chain.length)asap(function(){
var promise = record.p
, value = record.v
, ok = record.s == 1
, i = 0;
if(isReject && isUnhandled(promise)){
setTimeout(function(){
if(isUnhandled(promise)){
if(cof(process) == 'process'){
process.emit('unhandledRejection', value, promise);
} else if(global.console && isFunction(console.error)){
console.error('Unhandled promise rejection', value);
}
}
}, 1e3);
} else while(chain.length > i)!function(react){
var cb = ok ? react.ok : react.fail
, ret, then;
try {
if(cb){
if(!ok)record.h = true;
ret = cb === true ? value : cb(value);
if(ret === react.P){
react.rej(TypeError(PROMISE + '-chain cycle'));
} else if(then = isThenable(ret)){
then.call(ret, react.res, react.rej);
} else react.res(ret);
} else react.rej(value);
} catch(err){
react.rej(err);
}
}(chain[i++]);
chain.length = 0;
});
}
function $reject(value){
var record = this;
if(record.d)return;
record.d = true;
record = record.r || record; // unwrap
record.v = value;
record.s = 2;
notify(record, true);
}
function $resolve(value){
var record = this
, then, wrapper;
if(record.d)return;
record.d = true;
record = record.r || record; // unwrap
try {
if(then = isThenable(value)){
wrapper = {r: record, d: false}; // wrap
then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
} else {
record.v = value;
record.s = 1;
notify(record);
}
} catch(err){
$reject.call(wrapper || {r: record, d: false}, err); // wrap
}
}
// constructor polyfill
if(!useNative){
// 25.4.3.1 Promise(executor)
P = function Promise(executor){
assertFunction(executor);
var record = {
p: assert.inst(this, P, PROMISE), // <- promise
c: [], // <- chain
s: 0, // <- state
d: false, // <- done
v: undefined, // <- value
h: false // <- handled rejection
};
$.hide(this, RECORD, record);
try {
executor(ctx($resolve, record, 1), ctx($reject, record, 1));
} catch(err){
$reject.call(record, err);
}
};
$.mix(P.prototype, {
// 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
then: function then(onFulfilled, onRejected){
var S = assertObject(assertObject(this).constructor)[SPECIES];
var react = {
ok: isFunction(onFulfilled) ? onFulfilled : true,
fail: isFunction(onRejected) ? onRejected : false
};
var promise = react.P = new (S != undefined ? S : P)(function(res, rej){
react.res = assertFunction(res);
react.rej = assertFunction(rej);
});
var record = this[RECORD];
record.c.push(react);
record.s && notify(record);
return promise;
},
// 25.4.5.1 Promise.prototype.catch(onRejected)
'catch': function(onRejected){
return this.then(undefined, onRejected);
}
});
}
// export
$def($def.G + $def.W + $def.F * !useNative, {Promise: P});
cof.set(P, PROMISE);
species(P);
species($.core[PROMISE]); // for wrapper
// statics
$def($def.S + $def.F * !useNative, PROMISE, {
// 25.4.4.5 Promise.reject(r)
reject: function reject(r){
return new (getConstructor(this))(function(res, rej){
rej(r);
});
},
// 25.4.4.6 Promise.resolve(x)
resolve: function resolve(x){
return isObject(x) && RECORD in x && $.getProto(x) === this.prototype
? x : new (getConstructor(this))(function(res){
res(x);
});
}
});
$def($def.S + $def.F * !(useNative && __webpack_require__(76)(function(iter){
P.all(iter)['catch'](function(){});
})), PROMISE, {
// 25.4.4.1 Promise.all(iterable)
all: function all(iterable){
var C = getConstructor(this)
, values = [];
return new C(function(res, rej){
forOf(iterable, false, values.push, values);
var remaining = values.length
, results = Array(remaining);
if(remaining)$.each.call(values, function(promise, index){
C.resolve(promise).then(function(value){
results[index] = value;
--remaining || res(results);
}, rej);
});
else res(results);
});
},
// 25.4.4.4 Promise.race(iterable)
race: function race(iterable){
var C = getConstructor(this);
return new C(function(res, rej){
forOf(iterable, false, function(promise){
C.resolve(promise).then(res, rej);
});
});
}
});
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var strong = __webpack_require__(81);
// 23.1 Map Objects
__webpack_require__(82)('Map', {
// 23.1.3.6 Map.prototype.get(key)
get: function get(key){
var entry = strong.getEntry(this, key);
return entry && entry.v;
},
// 23.1.3.9 Map.prototype.set(key, value)
set: function set(key, value){
return strong.def(this, key === 0 ? 0 : key, value);
}
}, strong, true);
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var strong = __webpack_require__(81);
// 23.2 Set Objects
__webpack_require__(82)('Set', {
// 23.2.3.1 Set.prototype.add(value)
add: function add(value){
return strong.def(this, value = value === 0 ? 0 : value, value);
}
}, strong);
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, weak = __webpack_require__(83)
, leakStore = weak.leakStore
, ID = weak.ID
, WEAK = weak.WEAK
, has = $.has
, isObject = $.isObject
, isFrozen = Object.isFrozen || $.core.Object.isFrozen
, tmp = {};
// 23.3 WeakMap Objects
var WeakMap = __webpack_require__(82)('WeakMap', {
// 23.3.3.3 WeakMap.prototype.get(key)
get: function get(key){
if(isObject(key)){
if(isFrozen(key))return leakStore(this).get(key);
if(has(key, WEAK))return key[WEAK][this[ID]];
}
},
// 23.3.3.5 WeakMap.prototype.set(key, value)
set: function set(key, value){
return weak.def(this, key, value);
}
}, weak, true, true);
// IE11 WeakMap frozen keys fix
if($.FW && new WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){
$.each.call(['delete', 'has', 'get', 'set'], function(key){
var method = WeakMap.prototype[key];
WeakMap.prototype[key] = function(a, b){
// store frozen objects on leaky map
if(isObject(a) && isFrozen(a)){
var result = leakStore(this)[key](a, b);
return key == 'set' ? this : result;
// store all the rest on native weakmap
} return method.call(this, a, b);
};
});
}
/***/ },
/* 31 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var weak = __webpack_require__(83);
// 23.4 WeakSet Objects
__webpack_require__(82)('WeakSet', {
// 23.4.3.1 WeakSet.prototype.add(value)
add: function add(value){
return weak.def(this, value, true);
}
}, weak, false, true);
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, setProto = __webpack_require__(70)
, $iter = __webpack_require__(72)
, ITER = __webpack_require__(62).safe('iter')
, step = $iter.step
, assert = __webpack_require__(63)
, isObject = $.isObject
, getDesc = $.getDesc
, setDesc = $.setDesc
, getProto = $.getProto
, apply = Function.apply
, assertObject = assert.obj
, _isExtensible = Object.isExtensible || $.it;
function Enumerate(iterated){
$.set(this, ITER, {o: iterated, k: undefined, i: 0});
}
$iter.create(Enumerate, 'Object', function(){
var iter = this[ITER]
, keys = iter.k
, key;
if(keys == undefined){
iter.k = keys = [];
for(key in iter.o)keys.push(key);
}
do {
if(iter.i >= keys.length)return step(1);
} while(!((key = keys[iter.i++]) in iter.o));
return step(0, key);
});
function wrap(fn){
return function(it){
assertObject(it);
try {
fn.apply(undefined, arguments);
return true;
} catch(e){
return false;
}
};
}
function get(target, propertyKey/*, receiver*/){
var receiver = arguments.length < 3 ? target : arguments[2]
, desc = getDesc(assertObject(target), propertyKey), proto;
if(desc)return $.has(desc, 'value')
? desc.value
: desc.get === undefined
? undefined
: desc.get.call(receiver);
return isObject(proto = getProto(target))
? get(proto, propertyKey, receiver)
: undefined;
}
function set(target, propertyKey, V/*, receiver*/){
var receiver = arguments.length < 4 ? target : arguments[3]
, ownDesc = getDesc(assertObject(target), propertyKey)
, existingDescriptor, proto;
if(!ownDesc){
if(isObject(proto = getProto(target))){
return set(proto, propertyKey, V, receiver);
}
ownDesc = $.desc(0);
}
if($.has(ownDesc, 'value')){
if(ownDesc.writable === false || !isObject(receiver))return false;
existingDescriptor = getDesc(receiver, propertyKey) || $.desc(0);
existingDescriptor.value = V;
setDesc(receiver, propertyKey, existingDescriptor);
return true;
}
return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);
}
var reflect = {
// 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
apply: __webpack_require__(74)(Function.call, apply, 3),
// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
construct: function construct(target, argumentsList /*, newTarget*/){
var proto = assert.fn(arguments.length < 3 ? target : arguments[2]).prototype
, instance = $.create(isObject(proto) ? proto : Object.prototype)
, result = apply.call(target, instance, argumentsList);
return isObject(result) ? result : instance;
},
// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
defineProperty: wrap(setDesc),
// 26.1.4 Reflect.deleteProperty(target, propertyKey)
deleteProperty: function deleteProperty(target, propertyKey){
var desc = getDesc(assertObject(target), propertyKey);
return desc && !desc.configurable ? false : delete target[propertyKey];
},
// 26.1.5 Reflect.enumerate(target)
enumerate: function enumerate(target){
return new Enumerate(assertObject(target));
},
// 26.1.6 Reflect.get(target, propertyKey [, receiver])
get: get,
// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){
return getDesc(assertObject(target), propertyKey);
},
// 26.1.8 Reflect.getPrototypeOf(target)
getPrototypeOf: function getPrototypeOf(target){
return getProto(assertObject(target));
},
// 26.1.9 Reflect.has(target, propertyKey)
has: function has(target, propertyKey){
return propertyKey in target;
},
// 26.1.10 Reflect.isExtensible(target)
isExtensible: function isExtensible(target){
return !!_isExtensible(assertObject(target));
},
// 26.1.11 Reflect.ownKeys(target)
ownKeys: __webpack_require__(84),
// 26.1.12 Reflect.preventExtensions(target)
preventExtensions: wrap(Object.preventExtensions || $.it),
// 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
set: set
};
// 26.1.14 Reflect.setPrototypeOf(target, proto)
if(setProto)reflect.setPrototypeOf = function setPrototypeOf(target, proto){
setProto.check(target, proto);
try {
setProto.set(target, proto);
return true;
} catch(e){
return false;
}
};
$def($def.G, {Reflect: {}});
$def($def.S, 'Reflect', reflect);
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/domenic/Array.prototype.includes
var $def = __webpack_require__(59);
$def($def.P, 'Array', {
includes: __webpack_require__(64)(true)
});
__webpack_require__(77)('includes');
/***/ },
/* 34 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/mathiasbynens/String.prototype.at
var $def = __webpack_require__(59);
$def($def.P, 'String', {
at: __webpack_require__(71)(true)
});
/***/ },
/* 35 */
/***/ function(module, exports, __webpack_require__) {
// https://gist.github.com/kangax/9698100
var $def = __webpack_require__(59);
$def($def.S, 'RegExp', {
escape: __webpack_require__(65)(/([\\\-[\]{}()*+?.,^$|])/g, '\\$1', true)
});
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
// https://gist.github.com/WebReflection/9353781
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, ownKeys = __webpack_require__(84);
$def($def.S, 'Object', {
getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){
var O = $.toObject(object)
, result = {};
$.each.call(ownKeys(O), function(key){
$.setDesc(result, key, $.desc(0, $.getDesc(O, key)));
});
return result;
}
});
/***/ },
/* 37 */
/***/ function(module, exports, __webpack_require__) {
// http://goo.gl/XkBrjD
var $ = __webpack_require__(57)
, $def = __webpack_require__(59);
function createObjectToArray(isEntries){
return function(object){
var O = $.toObject(object)
, keys = $.getKeys(O)
, length = keys.length
, i = 0
, result = Array(length)
, key;
if(isEntries)while(length > i)result[i] = [key = keys[i++], O[key]];
else while(length > i)result[i] = O[keys[i++]];
return result;
};
}
$def($def.S, 'Object', {
values: createObjectToArray(false),
entries: createObjectToArray(true)
});
/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
__webpack_require__(85)('Map');
/***/ },
/* 39 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
__webpack_require__(85)('Set');
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59)
, $task = __webpack_require__(80);
$def($def.G + $def.B, {
setImmediate: $task.set,
clearImmediate: $task.clear
});
/***/ },
/* 41 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(21);
var $ = __webpack_require__(57)
, Iterators = __webpack_require__(72).Iterators
, ITERATOR = __webpack_require__(68)('iterator')
, ArrayValues = Iterators.Array
, NodeList = $.g.NodeList;
if($.FW && NodeList && !(ITERATOR in NodeList.prototype)){
$.hide(NodeList.prototype, ITERATOR, ArrayValues);
}
Iterators.NodeList = ArrayValues;
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
// ie9- setTimeout & setInterval additional parameters fix
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, invoke = __webpack_require__(60)
, partial = __webpack_require__(86)
, navigator = $.g.navigator
, MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check
function wrap(set){
return MSIE ? function(fn, time /*, ...args */){
return set(invoke(
partial,
[].slice.call(arguments, 2),
$.isFunction(fn) ? fn : Function(fn)
), time);
} : set;
}
$def($def.G + $def.B + $def.F * MSIE, {
setTimeout: wrap($.g.setTimeout),
setInterval: wrap($.g.setInterval)
});
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, ctx = __webpack_require__(74)
, $def = __webpack_require__(59)
, assign = __webpack_require__(69)
, keyOf = __webpack_require__(66)
, ITER = __webpack_require__(62).safe('iter')
, assert = __webpack_require__(63)
, $iter = __webpack_require__(72)
, forOf = __webpack_require__(79)
, step = $iter.step
, getKeys = $.getKeys
, toObject = $.toObject
, has = $.has;
function Dict(iterable){
var dict = $.create(null);
if(iterable != undefined){
if($iter.is(iterable)){
forOf(iterable, true, function(key, value){
dict[key] = value;
});
} else assign(dict, iterable);
}
return dict;
}
Dict.prototype = null;
function DictIterator(iterated, kind){
$.set(this, ITER, {o: toObject(iterated), a: getKeys(iterated), i: 0, k: kind});
}
$iter.create(DictIterator, 'Dict', function(){
var iter = this[ITER]
, O = iter.o
, keys = iter.a
, kind = iter.k
, key;
do {
if(iter.i >= keys.length){
iter.o = undefined;
return step(1);
}
} while(!has(O, key = keys[iter.i++]));
if(kind == 'keys' )return step(0, key);
if(kind == 'values')return step(0, O[key]);
return step(0, [key, O[key]]);
});
function createDictIter(kind){
return function(it){
return new DictIterator(it, kind);
};
}
function generic(A, B){
// strange IE quirks mode bug -> use typeof instead of isFunction
return typeof A == 'function' ? A : B;
}
// 0 -> Dict.forEach
// 1 -> Dict.map
// 2 -> Dict.filter
// 3 -> Dict.some
// 4 -> Dict.every
// 5 -> Dict.find
// 6 -> Dict.findKey
// 7 -> Dict.mapPairs
function createDictMethod(TYPE){
var IS_MAP = TYPE == 1
, IS_EVERY = TYPE == 4;
return function(object, callbackfn, that /* = undefined */){
var f = ctx(callbackfn, that, 3)
, O = toObject(object)
, result = IS_MAP || TYPE == 7 || TYPE == 2 ? new (generic(this, Dict)) : undefined
, key, val, res;
for(key in O)if(has(O, key)){
val = O[key];
res = f(val, key, object);
if(TYPE){
if(IS_MAP)result[key] = res; // map
else if(res)switch(TYPE){
case 2: result[key] = val; break; // filter
case 3: return true; // some
case 5: return val; // find
case 6: return key; // findKey
case 7: result[res[0]] = res[1]; // mapPairs
} else if(IS_EVERY)return false; // every
}
}
return TYPE == 3 || IS_EVERY ? IS_EVERY : result;
};
}
// true -> Dict.turn
// false -> Dict.reduce
function createDictReduce(IS_TURN){
return function(object, mapfn, init){
assert.fn(mapfn);
var O = toObject(object)
, keys = getKeys(O)
, length = keys.length
, i = 0
, memo, key, result;
if(IS_TURN){
memo = init == undefined ? new (generic(this, Dict)) : Object(init);
} else if(arguments.length < 3){
assert(length, 'Reduce of empty object with no initial value');
memo = O[keys[i++]];
} else memo = Object(init);
while(length > i)if(has(O, key = keys[i++])){
result = mapfn(memo, O[key], key, object);
if(IS_TURN){
if(result === false)break;
} else memo = result;
}
return memo;
};
}
var findKey = createDictMethod(6);
$def($def.G + $def.F, {Dict: $.mix(Dict, {
keys: createDictIter('keys'),
values: createDictIter('values'),
entries: createDictIter('entries'),
forEach: createDictMethod(0),
map: createDictMethod(1),
filter: createDictMethod(2),
some: createDictMethod(3),
every: createDictMethod(4),
find: createDictMethod(5),
findKey: findKey,
mapPairs: createDictMethod(7),
reduce: createDictReduce(false),
turn: createDictReduce(true),
keyOf: keyOf,
includes: function(object, el){
return (el == el ? keyOf(object, el) : findKey(object, function(it){
return it != it;
})) !== undefined;
},
// Has / get / set own property
has: has,
get: function(object, key){
if(has(object, key))return object[key];
},
set: $.def,
isDict: function(it){
return $.isObject(it) && $.getProto(it) === Dict.prototype;
}
})});
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
var core = __webpack_require__(57).core
, $iter = __webpack_require__(72);
core.isIterable = $iter.is;
core.getIterator = $iter.get;
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, ctx = __webpack_require__(74)
, safe = __webpack_require__(62).safe
, $def = __webpack_require__(59)
, $iter = __webpack_require__(72)
, forOf = __webpack_require__(79)
, ENTRIES = safe('entries')
, FN = safe('fn')
, ITER = safe('iter')
, call = __webpack_require__(75)
, getIterator = $iter.get
, setIterator = $iter.set
, createIterator = $iter.create;
function $for(iterable, entries){
if(!(this instanceof $for))return new $for(iterable, entries);
this[ITER] = getIterator(iterable);
this[ENTRIES] = !!entries;
}
createIterator($for, 'Wrapper', function(){
return this[ITER].next();
});
var $forProto = $for.prototype;
setIterator($forProto, function(){
return this[ITER]; // unwrap
});
function createChainIterator(next){
function Iterator(iter, fn, that){
this[ITER] = getIterator(iter);
this[ENTRIES] = iter[ENTRIES];
this[FN] = ctx(fn, that, iter[ENTRIES] ? 2 : 1);
}
createIterator(Iterator, 'Chain', next, $forProto);
setIterator(Iterator.prototype, $.that); // override $forProto iterator
return Iterator;
}
var MapIter = createChainIterator(function(){
var step = this[ITER].next();
return step.done
? step
: $iter.step(0, call(this[ITER], this[FN], step.value, this[ENTRIES]));
});
var FilterIter = createChainIterator(function(){
for(;;){
var step = this[ITER].next();
if(step.done || call(this[ITER], this[FN], step.value, this[ENTRIES]))return step;
}
});
$.mix($forProto, {
of: function(fn, that){
forOf(this, this[ENTRIES], fn, that);
},
array: function(fn, that){
var result = [];
forOf(fn != undefined ? this.map(fn, that) : this, false, result.push, result);
return result;
},
filter: function(fn, that){
return new FilterIter(this, fn, that);
},
map: function(fn, that){
return new MapIter(this, fn, that);
}
});
$for.isIterable = $iter.is;
$for.getIterator = getIterator;
$def($def.G + $def.F, {$for: $for});
/***/ },
/* 46 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, partial = __webpack_require__(86);
// https://esdiscuss.org/topic/promise-returning-delay-function
$def($def.G + $def.F, {
delay: function(time){
return new ($.core.Promise || $.g.Promise)(function(resolve){
setTimeout(partial.call(resolve, true), time);
});
}
});
/***/ },
/* 47 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, $def = __webpack_require__(59);
// Placeholder
$.core._ = $.path._ = $.path._ || {};
$def($def.P + $def.F, 'Function', {
part: __webpack_require__(86)
});
/***/ },
/* 48 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, ownKeys = __webpack_require__(84);
function define(target, mixin){
var keys = ownKeys($.toObject(mixin))
, length = keys.length
, i = 0, key;
while(length > i)$.setDesc(target, key = keys[i++], $.getDesc(mixin, key));
return target;
}
$def($def.S + $def.F, 'Object', {
isObject: $.isObject,
classof: __webpack_require__(58).classof,
define: define,
make: function(proto, mixin){
return define($.create(proto), mixin);
}
});
/***/ },
/* 49 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, assertFunction = __webpack_require__(63).fn;
$def($def.P + $def.F, 'Array', {
turn: function(fn, target /* = [] */){
assertFunction(fn);
var memo = target == undefined ? [] : Object(target)
, O = $.ES5Object(this)
, length = $.toLength(O.length)
, index = 0;
while(length > index)if(fn(memo, O[index], index++, this) === false)break;
return memo;
}
});
__webpack_require__(77)('turn');
/***/ },
/* 50 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, ITER = __webpack_require__(62).safe('iter');
__webpack_require__(73)(Number, 'Number', function(iterated){
$.set(this, ITER, {l: $.toLength(iterated), i: 0});
}, function(){
var iter = this[ITER]
, i = iter.i++
, done = i >= iter.l;
return {done: done, value: done ? undefined : i};
});
/***/ },
/* 51 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, invoke = __webpack_require__(60)
, methods = {};
methods.random = function(lim /* = 0 */){
var a = +this
, b = lim == undefined ? 0 : +lim
, m = Math.min(a, b);
return Math.random() * (Math.max(a, b) - m) + m;
};
if($.FW)$.each.call((
// ES3:
'round,floor,ceil,abs,sin,asin,cos,acos,tan,atan,exp,sqrt,max,min,pow,atan2,' +
// ES6:
'acosh,asinh,atanh,cbrt,clz32,cosh,expm1,hypot,imul,log1p,log10,log2,sign,sinh,tanh,trunc'
).split(','), function(key){
var fn = Math[key];
if(fn)methods[key] = function(/* ...args */){
// ie9- dont support strict mode & convert `this` to object -> convert it to number
var args = [+this]
, i = 0;
while(arguments.length > i)args.push(arguments[i++]);
return invoke(fn, args);
};
}
);
$def($def.P + $def.F, 'Number', methods);
/***/ },
/* 52 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59)
, replacer = __webpack_require__(65);
var escapeHTMLDict = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
}, unescapeHTMLDict = {}, key;
for(key in escapeHTMLDict)unescapeHTMLDict[escapeHTMLDict[key]] = key;
$def($def.P + $def.F, 'String', {
escapeHTML: replacer(/[&<>"']/g, escapeHTMLDict),
unescapeHTML: replacer(/&(?:amp|lt|gt|quot|apos);/g, unescapeHTMLDict)
});
/***/ },
/* 53 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, core = $.core
, formatRegExp = /\b\w\w?\b/g
, flexioRegExp = /:(.*)\|(.*)$/
, locales = {}
, current = 'en'
, SECONDS = 'Seconds'
, MINUTES = 'Minutes'
, HOURS = 'Hours'
, DATE = 'Date'
, MONTH = 'Month'
, YEAR = 'FullYear';
function lz(num){
return num > 9 ? num : '0' + num;
}
function createFormat(prefix){
return function(template, locale /* = current */){
var that = this
, dict = locales[$.has(locales, locale) ? locale : current];
function get(unit){
return that[prefix + unit]();
}
return String(template).replace(formatRegExp, function(part){
switch(part){
case 's' : return get(SECONDS); // Seconds : 0-59
case 'ss' : return lz(get(SECONDS)); // Seconds : 00-59
case 'm' : return get(MINUTES); // Minutes : 0-59
case 'mm' : return lz(get(MINUTES)); // Minutes : 00-59
case 'h' : return get(HOURS); // Hours : 0-23
case 'hh' : return lz(get(HOURS)); // Hours : 00-23
case 'D' : return get(DATE); // Date : 1-31
case 'DD' : return lz(get(DATE)); // Date : 01-31
case 'W' : return dict[0][get('Day')]; // Day : Понедельник
case 'N' : return get(MONTH) + 1; // Month : 1-12
case 'NN' : return lz(get(MONTH) + 1); // Month : 01-12
case 'M' : return dict[2][get(MONTH)]; // Month : Январь
case 'MM' : return dict[1][get(MONTH)]; // Month : Января
case 'Y' : return get(YEAR); // Year : 2014
case 'YY' : return lz(get(YEAR) % 100); // Year : 14
} return part;
});
};
}
function addLocale(lang, locale){
function split(index){
var result = [];
$.each.call(locale.months.split(','), function(it){
result.push(it.replace(flexioRegExp, '$' + index));
});
return result;
}
locales[lang] = [locale.weekdays.split(','), split(1), split(2)];
return core;
}
$def($def.P + $def.F, DATE, {
format: createFormat('get'),
formatUTC: createFormat('getUTC')
});
addLocale(current, {
weekdays: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday',
months: 'January,February,March,April,May,June,July,August,September,October,November,December'
});
addLocale('ru', {
weekdays: 'Воскресенье,Понедельник,Вторник,Среда,Четверг,Пятница,Суббота',
months: 'Январ:я|ь,Феврал:я|ь,Март:а|,Апрел:я|ь,Ма:я|й,Июн:я|ь,' +
'Июл:я|ь,Август:а|,Сентябр:я|ь,Октябр:я|ь,Ноябр:я|ь,Декабр:я|ь'
});
core.locale = function(locale){
return $.has(locales, locale) ? current = locale : current;
};
core.addLocale = addLocale;
/***/ },
/* 54 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59);
$def($def.G + $def.F, {global: __webpack_require__(57).g});
/***/ },
/* 55 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, log = {}
, enabled = true;
// Methods from https://github.com/DeveloperToolsWG/console-object/blob/master/api.md
$.each.call(('assert,clear,count,debug,dir,dirxml,error,exception,' +
'group,groupCollapsed,groupEnd,info,isIndependentlyComposed,log,' +
'markTimeline,profile,profileEnd,table,time,timeEnd,timeline,' +
'timelineEnd,timeStamp,trace,warn').split(','), function(key){
log[key] = function(){
if(enabled && $.g.console && $.isFunction(console[key])){
return Function.apply.call(console[key], console, arguments);
}
};
});
$def($def.G + $def.F, {log: __webpack_require__(69)(log.log, log, {
enable: function(){
enabled = true;
},
disable: function(){
enabled = false;
}
})});
/***/ },
/* 56 */
/***/ function(module, exports, __webpack_require__) {
// JavaScript 1.6 / Strawman array statics shim
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, $Array = $.core.Array || Array
, statics = {};
function setStatics(keys, length){
$.each.call(keys.split(','), function(key){
if(length == undefined && key in $Array)statics[key] = $Array[key];
else if(key in [])statics[key] = __webpack_require__(74)(Function.call, [][key], length);
});
}
setStatics('pop,reverse,shift,keys,values,entries', 1);
setStatics('indexOf,every,some,forEach,map,filter,find,findIndex,includes', 3);
setStatics('join,slice,concat,push,splice,unshift,sort,lastIndexOf,' +
'reduce,reduceRight,copyWithin,fill,turn');
$def($def.S, 'Array', statics);
/***/ },
/* 57 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var global = typeof self != 'undefined' ? self : Function('return this')()
, core = {}
, defineProperty = Object.defineProperty
, hasOwnProperty = {}.hasOwnProperty
, ceil = Math.ceil
, floor = Math.floor
, max = Math.max
, min = Math.min;
// The engine works fine with descriptors? Thank's IE8 for his funny defineProperty.
var DESC = !!function(){
try {
return defineProperty({}, 'a', {get: function(){ return 2; }}).a == 2;
} catch(e){ /* empty */ }
}();
var hide = createDefiner(1);
// 7.1.4 ToInteger
function toInteger(it){
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
}
function desc(bitmap, value){
return {
enumerable : !(bitmap & 1),
configurable: !(bitmap & 2),
writable : !(bitmap & 4),
value : value
};
}
function simpleSet(object, key, value){
object[key] = value;
return object;
}
function createDefiner(bitmap){
return DESC ? function(object, key, value){
return $.setDesc(object, key, desc(bitmap, value));
} : simpleSet;
}
function isObject(it){
return it !== null && (typeof it == 'object' || typeof it == 'function');
}
function isFunction(it){
return typeof it == 'function';
}
function assertDefined(it){
if(it == undefined)throw TypeError("Can't call method on " + it);
return it;
}
var $ = module.exports = __webpack_require__(87)({
g: global,
core: core,
html: global.document && document.documentElement,
// http://jsperf.com/core-js-isobject
isObject: isObject,
isFunction: isFunction,
it: function(it){
return it;
},
that: function(){
return this;
},
// 7.1.4 ToInteger
toInteger: toInteger,
// 7.1.15 ToLength
toLength: function(it){
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
},
toIndex: function(index, length){
index = toInteger(index);
return index < 0 ? max(index + length, 0) : min(index, length);
},
has: function(it, key){
return hasOwnProperty.call(it, key);
},
create: Object.create,
getProto: Object.getPrototypeOf,
DESC: DESC,
desc: desc,
getDesc: Object.getOwnPropertyDescriptor,
setDesc: defineProperty,
setDescs: Object.defineProperties,
getKeys: Object.keys,
getNames: Object.getOwnPropertyNames,
getSymbols: Object.getOwnPropertySymbols,
assertDefined: assertDefined,
// Dummy, fix for not array-like ES3 string in es5 module
ES5Object: Object,
toObject: function(it){
return $.ES5Object(assertDefined(it));
},
hide: hide,
def: createDefiner(0),
set: global.Symbol ? simpleSet : hide,
mix: function(target, src){
for(var key in src)hide(target, key, src[key]);
return target;
},
each: [].forEach
});
/* eslint-disable no-undef */
if(typeof __e != 'undefined')__e = core;
if(typeof __g != 'undefined')__g = global;
/***/ },
/* 58 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, TAG = __webpack_require__(68)('toStringTag')
, toString = {}.toString;
function cof(it){
return toString.call(it).slice(8, -1);
}
cof.classof = function(it){
var O, T;
return it == undefined ? it === undefined ? 'Undefined' : 'Null'
: typeof (T = (O = Object(it))[TAG]) == 'string' ? T : cof(O);
};
cof.set = function(it, tag, stat){
if(it && !$.has(it = stat ? it : it.prototype, TAG))$.hide(it, TAG, tag);
};
module.exports = cof;
/***/ },
/* 59 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, global = $.g
, core = $.core
, isFunction = $.isFunction;
function ctx(fn, that){
return function(){
return fn.apply(that, arguments);
};
}
// type bitmap
$def.F = 1; // forced
$def.G = 2; // global
$def.S = 4; // static
$def.P = 8; // proto
$def.B = 16; // bind
$def.W = 32; // wrap
function $def(type, name, source){
var key, own, out, exp
, isGlobal = type & $def.G
, target = isGlobal ? global : type & $def.S
? global[name] : (global[name] || {}).prototype
, exports = isGlobal ? core : core[name] || (core[name] = {});
if(isGlobal)source = name;
for(key in source){
// contains in native
own = !(type & $def.F) && target && key in target;
if(own && key in exports)continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
if(isGlobal && !isFunction(target[key]))exp = source[key];
// bind timers to global for call from export context
else if(type & $def.B && own)exp = ctx(out, global);
// wrap global constructors for prevent change them in library
else if(type & $def.W && target[key] == out)!function(C){
exp = function(param){
return this instanceof C ? new C(param) : C(param);
};
exp.prototype = C.prototype;
}(out);
else exp = type & $def.P && isFunction(out) ? ctx(Function.call, out) : out;
// export
$.hide(exports, key, exp);
}
}
module.exports = $def;
/***/ },
/* 60 */
/***/ function(module, exports, __webpack_require__) {
// Fast apply
// http://jsperf.lnkit.com/fast-apply/5
module.exports = function(fn, args, that){
var un = that === undefined;
switch(args.length){
case 0: return un ? fn()
: fn.call(that);
case 1: return un ? fn(args[0])
: fn.call(that, args[0]);
case 2: return un ? fn(args[0], args[1])
: fn.call(that, args[0], args[1]);
case 3: return un ? fn(args[0], args[1], args[2])
: fn.call(that, args[0], args[1], args[2]);
case 4: return un ? fn(args[0], args[1], args[2], args[3])
: fn.call(that, args[0], args[1], args[2], args[3]);
case 5: return un ? fn(args[0], args[1], args[2], args[3], args[4])
: fn.call(that, args[0], args[1], args[2], args[3], args[4]);
} return fn.apply(that, args);
};
/***/ },
/* 61 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 0 -> Array#forEach
// 1 -> Array#map
// 2 -> Array#filter
// 3 -> Array#some
// 4 -> Array#every
// 5 -> Array#find
// 6 -> Array#findIndex
var $ = __webpack_require__(57)
, ctx = __webpack_require__(74);
module.exports = function(TYPE){
var IS_MAP = TYPE == 1
, IS_FILTER = TYPE == 2
, IS_SOME = TYPE == 3
, IS_EVERY = TYPE == 4
, IS_FIND_INDEX = TYPE == 6
, NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
return function(callbackfn/*, that = undefined */){
var O = Object($.assertDefined(this))
, self = $.ES5Object(O)
, f = ctx(callbackfn, arguments[1], 3)
, length = $.toLength(self.length)
, index = 0
, result = IS_MAP ? Array(length) : IS_FILTER ? [] : undefined
, val, res;
for(;length > index; index++)if(NO_HOLES || index in self){
val = self[index];
res = f(val, index, O);
if(TYPE){
if(IS_MAP)result[index] = res; // map
else if(res)switch(TYPE){
case 3: return true; // some
case 5: return val; // find
case 6: return index; // findIndex
case 2: result.push(val); // filter
} else if(IS_EVERY)return false; // every
}
}
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
};
};
/***/ },
/* 62 */
/***/ function(module, exports, __webpack_require__) {
var sid = 0;
function uid(key){
return 'Symbol(' + key + ')_' + (++sid + Math.random()).toString(36);
}
uid.safe = __webpack_require__(57).g.Symbol || uid;
module.exports = uid;
/***/ },
/* 63 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57);
function assert(condition, msg1, msg2){
if(!condition)throw TypeError(msg2 ? msg1 + msg2 : msg1);
}
assert.def = $.assertDefined;
assert.fn = function(it){
if(!$.isFunction(it))throw TypeError(it + ' is not a function!');
return it;
};
assert.obj = function(it){
if(!$.isObject(it))throw TypeError(it + ' is not an object!');
return it;
};
assert.inst = function(it, Constructor, name){
if(!(it instanceof Constructor))throw TypeError(name + ": use the 'new' operator!");
return it;
};
module.exports = assert;
/***/ },
/* 64 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// false -> Array#indexOf
// true -> Array#includes
var $ = __webpack_require__(57);
module.exports = function(IS_INCLUDES){
return function(el /*, fromIndex = 0 */){
var O = $.toObject(this)
, length = $.toLength(O.length)
, index = $.toIndex(arguments[1], length)
, value;
if(IS_INCLUDES && el != el)while(length > index){
value = O[index++];
if(value != value)return true;
} else for(;length > index; index++)if(IS_INCLUDES || index in O){
if(O[index] === el)return IS_INCLUDES || index;
} return !IS_INCLUDES && -1;
};
};
/***/ },
/* 65 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = function(regExp, replace, isStatic){
var replacer = replace === Object(replace) ? function(part){
return replace[part];
} : replace;
return function(it){
return String(isStatic ? it : this).replace(regExp, replacer);
};
};
/***/ },
/* 66 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57);
module.exports = function(object, el){
var O = $.toObject(object)
, keys = $.getKeys(O)
, length = keys.length
, index = 0
, key;
while(length > index)if(O[key = keys[index++]] === el)return key;
};
/***/ },
/* 67 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57);
module.exports = function(it){
var keys = $.getKeys(it)
, getDesc = $.getDesc
, getSymbols = $.getSymbols;
if(getSymbols)$.each.call(getSymbols(it), function(key){
if(getDesc(it, key).enumerable)keys.push(key);
});
return keys;
};
/***/ },
/* 68 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(57).g
, store = {};
module.exports = function(name){
return store[name] || (store[name] =
global.Symbol && global.Symbol[name] || __webpack_require__(62).safe('Symbol.' + name));
};
/***/ },
/* 69 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, enumKeys = __webpack_require__(67);
// 19.1.2.1 Object.assign(target, source, ...)
/* eslint-disable no-unused-vars */
module.exports = Object.assign || function assign(target, source){
/* eslint-enable no-unused-vars */
var T = Object($.assertDefined(target))
, l = arguments.length
, i = 1;
while(l > i){
var S = $.ES5Object(arguments[i++])
, keys = enumKeys(S)
, length = keys.length
, j = 0
, key;
while(length > j)T[key = keys[j++]] = S[key];
}
return T;
};
/***/ },
/* 70 */
/***/ function(module, exports, __webpack_require__) {
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var $ = __webpack_require__(57)
, assert = __webpack_require__(63);
function check(O, proto){
assert.obj(O);
assert(proto === null || $.isObject(proto), proto, ": can't set as prototype!");
}
module.exports = {
set: Object.setPrototypeOf || ('__proto__' in {} // eslint-disable-line
? function(buggy, set){
try {
set = __webpack_require__(74)(Function.call, $.getDesc(Object.prototype, '__proto__').set, 2);
set({}, []);
} catch(e){ buggy = true; }
return function setPrototypeOf(O, proto){
check(O, proto);
if(buggy)O.__proto__ = proto;
else set(O, proto);
return O;
};
}()
: undefined),
check: check
};
/***/ },
/* 71 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// true -> String#at
// false -> String#codePointAt
var $ = __webpack_require__(57);
module.exports = function(TO_STRING){
return function(pos){
var s = String($.assertDefined(this))
, i = $.toInteger(pos)
, l = s.length
, a, b;
if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
a = s.charCodeAt(i);
return a < 0xd800 || a > 0xdbff || i + 1 === l
|| (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
? TO_STRING ? s.charAt(i) : a
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
};
};
/***/ },
/* 72 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, cof = __webpack_require__(58)
, assertObject = __webpack_require__(63).obj
, SYMBOL_ITERATOR = __webpack_require__(68)('iterator')
, FF_ITERATOR = '@@iterator'
, Iterators = {}
, IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
setIterator(IteratorPrototype, $.that);
function setIterator(O, value){
$.hide(O, SYMBOL_ITERATOR, value);
// Add iterator for FF iterator protocol
if(FF_ITERATOR in [])$.hide(O, FF_ITERATOR, value);
}
module.exports = {
// Safari has buggy iterators w/o `next`
BUGGY: 'keys' in [] && !('next' in [].keys()),
Iterators: Iterators,
step: function(done, value){
return {value: value, done: !!done};
},
is: function(it){
var O = Object(it)
, Symbol = $.g.Symbol
, SYM = Symbol && Symbol.iterator || FF_ITERATOR;
return SYM in O || SYMBOL_ITERATOR in O || $.has(Iterators, cof.classof(O));
},
get: function(it){
var Symbol = $.g.Symbol
, ext = it[Symbol && Symbol.iterator || FF_ITERATOR]
, getIter = ext || it[SYMBOL_ITERATOR] || Iterators[cof.classof(it)];
return assertObject(getIter.call(it));
},
set: setIterator,
create: function(Constructor, NAME, next, proto){
Constructor.prototype = $.create(proto || IteratorPrototype, {next: $.desc(1, next)});
cof.set(Constructor, NAME + ' Iterator');
}
};
/***/ },
/* 73 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59)
, $ = __webpack_require__(57)
, cof = __webpack_require__(58)
, $iter = __webpack_require__(72)
, SYMBOL_ITERATOR = __webpack_require__(68)('iterator')
, FF_ITERATOR = '@@iterator'
, VALUES = 'values'
, Iterators = $iter.Iterators;
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE){
$iter.create(Constructor, NAME, next);
function createMethod(kind){
return function(){
return new Constructor(this, kind);
};
}
var TAG = NAME + ' Iterator'
, proto = Base.prototype
, _native = proto[SYMBOL_ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
, _default = _native || createMethod(DEFAULT)
, methods, key;
// Fix native
if(_native){
var IteratorPrototype = $.getProto(_default.call(new Base));
// Set @@toStringTag to native iterators
cof.set(IteratorPrototype, TAG, true);
// FF fix
if($.FW && $.has(proto, FF_ITERATOR))$iter.set(IteratorPrototype, $.that);
}
// Define iterator
if($.FW)$iter.set(proto, _default);
// Plug for library
Iterators[NAME] = _default;
Iterators[TAG] = $.that;
if(DEFAULT){
methods = {
keys: IS_SET ? _default : createMethod('keys'),
values: DEFAULT == VALUES ? _default : createMethod(VALUES),
entries: DEFAULT != VALUES ? _default : createMethod('entries')
};
if(FORCE)for(key in methods){
if(!(key in proto))$.hide(proto, key, methods[key]);
} else $def($def.P + $def.F * $iter.BUGGY, NAME, methods);
}
};
/***/ },
/* 74 */
/***/ function(module, exports, __webpack_require__) {
// Optional / simple context binding
var assertFunction = __webpack_require__(63).fn;
module.exports = function(fn, that, length){
assertFunction(fn);
if(~length && that === undefined)return fn;
switch(length){
case 1: return function(a){
return fn.call(that, a);
};
case 2: return function(a, b){
return fn.call(that, a, b);
};
case 3: return function(a, b, c){
return fn.call(that, a, b, c);
};
} return function(/* ...args */){
return fn.apply(that, arguments);
};
};
/***/ },
/* 75 */
/***/ function(module, exports, __webpack_require__) {
var assertObject = __webpack_require__(63).obj;
function close(iterator){
var ret = iterator['return'];
if(ret !== undefined)assertObject(ret.call(iterator));
}
function call(iterator, fn, value, entries){
try {
return entries ? fn(assertObject(value)[0], value[1]) : fn(value);
} catch(e){
close(iterator);
throw e;
}
}
call.close = close;
module.exports = call;
/***/ },
/* 76 */
/***/ function(module, exports, __webpack_require__) {
var SYMBOL_ITERATOR = __webpack_require__(68)('iterator')
, SAFE_CLOSING = false;
try {
var riter = [7][SYMBOL_ITERATOR]();
riter['return'] = function(){ SAFE_CLOSING = true; };
Array.from(riter, function(){ throw 2; });
} catch(e){ /* empty */ }
module.exports = function(exec){
if(!SAFE_CLOSING)return false;
var safe = false;
try {
var arr = [7]
, iter = arr[SYMBOL_ITERATOR]();
iter.next = function(){ safe = true; };
arr[SYMBOL_ITERATOR] = function(){ return iter; };
exec(arr);
} catch(e){ /* empty */ }
return safe;
};
/***/ },
/* 77 */
/***/ function(module, exports, __webpack_require__) {
// 22.1.3.31 Array.prototype[@@unscopables]
var $ = __webpack_require__(57)
, UNSCOPABLES = __webpack_require__(68)('unscopables');
if($.FW && !(UNSCOPABLES in []))$.hide(Array.prototype, UNSCOPABLES, {});
module.exports = function(key){
if($.FW)[][UNSCOPABLES][key] = true;
};
/***/ },
/* 78 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, SPECIES = __webpack_require__(68)('species');
module.exports = function(C){
if($.DESC && !(SPECIES in C))$.setDesc(C, SPECIES, {
configurable: true,
get: $.that
});
};
/***/ },
/* 79 */
/***/ function(module, exports, __webpack_require__) {
var ctx = __webpack_require__(74)
, get = __webpack_require__(72).get
, call = __webpack_require__(75);
module.exports = function(iterable, entries, fn, that){
var iterator = get(iterable)
, f = ctx(fn, that, entries ? 2 : 1)
, step;
while(!(step = iterator.next()).done){
if(call(iterator, f, step.value, entries) === false){
return call.close(iterator);
}
}
};
/***/ },
/* 80 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, ctx = __webpack_require__(74)
, cof = __webpack_require__(58)
, invoke = __webpack_require__(60)
, global = $.g
, isFunction = $.isFunction
, html = $.html
, document = global.document
, process = global.process
, setTask = global.setImmediate
, clearTask = global.clearImmediate
, postMessage = global.postMessage
, addEventListener = global.addEventListener
, MessageChannel = global.MessageChannel
, counter = 0
, queue = {}
, ONREADYSTATECHANGE = 'onreadystatechange'
, defer, channel, port;
function run(){
var id = +this;
if($.has(queue, id)){
var fn = queue[id];
delete queue[id];
fn();
}
}
function listner(event){
run.call(event.data);
}
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if(!isFunction(setTask) || !isFunction(clearTask)){
setTask = function(fn){
var args = [], i = 1;
while(arguments.length > i)args.push(arguments[i++]);
queue[++counter] = function(){
invoke(isFunction(fn) ? fn : Function(fn), args);
};
defer(counter);
return counter;
};
clearTask = function(id){
delete queue[id];
};
// Node.js 0.8-
if(cof(process) == 'process'){
defer = function(id){
process.nextTick(ctx(run, id, 1));
};
// Modern browsers, skip implementation for WebWorkers
// IE8 has postMessage, but it's sync & typeof its postMessage is object
} else if(addEventListener && isFunction(postMessage) && !global.importScripts){
defer = function(id){
postMessage(id, '*');
};
addEventListener('message', listner, false);
// WebWorkers
} else if(isFunction(MessageChannel)){
channel = new MessageChannel;
port = channel.port2;
channel.port1.onmessage = listner;
defer = ctx(port.postMessage, port, 1);
// IE8-
} else if(document && ONREADYSTATECHANGE in document.createElement('script')){
defer = function(id){
html.appendChild(document.createElement('script'))[ONREADYSTATECHANGE] = function(){
html.removeChild(this);
run.call(id);
};
};
// Rest old browsers
} else {
defer = function(id){
setTimeout(ctx(run, id, 1), 0);
};
}
}
module.exports = {
set: setTask,
clear: clearTask
};
/***/ },
/* 81 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, ctx = __webpack_require__(74)
, safe = __webpack_require__(62).safe
, assert = __webpack_require__(63)
, forOf = __webpack_require__(79)
, step = __webpack_require__(72).step
, has = $.has
, set = $.set
, isObject = $.isObject
, hide = $.hide
, isFrozen = Object.isFrozen || $.core.Object.isFrozen
, ID = safe('id')
, O1 = safe('O1')
, LAST = safe('last')
, FIRST = safe('first')
, ITER = safe('iter')
, SIZE = $.DESC ? safe('size') : 'size'
, id = 0;
function fastKey(it, create){
// return primitive with prefix
if(!isObject(it))return (typeof it == 'string' ? 'S' : 'P') + it;
// can't set id to frozen object
if(isFrozen(it))return 'F';
if(!has(it, ID)){
// not necessary to add id
if(!create)return 'E';
// add missing object id
hide(it, ID, ++id);
// return object id with prefix
} return 'O' + it[ID];
}
function getEntry(that, key){
// fast case
var index = fastKey(key), entry;
if(index != 'F')return that[O1][index];
// frozen object case
for(entry = that[FIRST]; entry; entry = entry.n){
if(entry.k == key)return entry;
}
}
module.exports = {
getConstructor: function(NAME, IS_MAP, ADDER){
function C(){
var that = assert.inst(this, C, NAME)
, iterable = arguments[0];
set(that, O1, $.create(null));
set(that, SIZE, 0);
set(that, LAST, undefined);
set(that, FIRST, undefined);
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
}
$.mix(C.prototype, {
// 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear: function clear(){
for(var that = this, data = that[O1], entry = that[FIRST]; entry; entry = entry.n){
entry.r = true;
if(entry.p)entry.p = entry.p.n = undefined;
delete data[entry.i];
}
that[FIRST] = that[LAST] = undefined;
that[SIZE] = 0;
},
// 23.1.3.3 Map.prototype.delete(key)
// 23.2.3.4 Set.prototype.delete(value)
'delete': function(key){
var that = this
, entry = getEntry(that, key);
if(entry){
var next = entry.n
, prev = entry.p;
delete that[O1][entry.i];
entry.r = true;
if(prev)prev.n = next;
if(next)next.p = prev;
if(that[FIRST] == entry)that[FIRST] = next;
if(that[LAST] == entry)that[LAST] = prev;
that[SIZE]--;
} return !!entry;
},
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
forEach: function forEach(callbackfn /*, that = undefined */){
var f = ctx(callbackfn, arguments[1], 3)
, entry;
while(entry = entry ? entry.n : this[FIRST]){
f(entry.v, entry.k, this);
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
}
},
// 23.1.3.7 Map.prototype.has(key)
// 23.2.3.7 Set.prototype.has(value)
has: function has(key){
return !!getEntry(this, key);
}
});
if($.DESC)$.setDesc(C.prototype, 'size', {
get: function(){
return assert.def(this[SIZE]);
}
});
return C;
},
def: function(that, key, value){
var entry = getEntry(that, key)
, prev, index;
// change existing entry
if(entry){
entry.v = value;
// create new entry
} else {
that[LAST] = entry = {
i: index = fastKey(key, true), // <- index
k: key, // <- key
v: value, // <- value
p: prev = that[LAST], // <- previous entry
n: undefined, // <- next entry
r: false // <- removed
};
if(!that[FIRST])that[FIRST] = entry;
if(prev)prev.n = entry;
that[SIZE]++;
// add to index
if(index != 'F')that[O1][index] = entry;
} return that;
},
getEntry: getEntry,
// add .keys, .values, .entries, [@@iterator]
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
setIter: function(C, NAME, IS_MAP){
__webpack_require__(73)(C, NAME, function(iterated, kind){
set(this, ITER, {o: iterated, k: kind});
}, function(){
var iter = this[ITER]
, kind = iter.k
, entry = iter.l;
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
// get next entry
if(!iter.o || !(iter.l = entry = entry ? entry.n : iter.o[FIRST])){
// or finish the iteration
iter.o = undefined;
return step(1);
}
// return step by kind
if(kind == 'keys' )return step(0, entry.k);
if(kind == 'values')return step(0, entry.v);
return step(0, [entry.k, entry.v]);
}, IS_MAP ? 'entries' : 'values' , !IS_MAP, true);
}
};
/***/ },
/* 82 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, BUGGY = __webpack_require__(72).BUGGY
, forOf = __webpack_require__(79)
, species = __webpack_require__(78)
, assertInstance = __webpack_require__(63).inst;
module.exports = function(NAME, methods, common, IS_MAP, IS_WEAK){
var Base = $.g[NAME]
, C = Base
, ADDER = IS_MAP ? 'set' : 'add'
, proto = C && C.prototype
, O = {};
function fixMethod(KEY, CHAIN){
var method = proto[KEY];
if($.FW)proto[KEY] = function(a, b){
var result = method.call(this, a === 0 ? 0 : a, b);
return CHAIN ? this : result;
};
}
if(!$.isFunction(C) || !(IS_WEAK || !BUGGY && proto.forEach && proto.entries)){
// create collection constructor
C = common.getConstructor(NAME, IS_MAP, ADDER);
$.mix(C.prototype, methods);
} else {
var inst = new C
, chain = inst[ADDER](IS_WEAK ? {} : -0, 1)
, buggyZero;
// wrap for init collections from iterable
if(!__webpack_require__(76)(function(iter){ new C(iter); })){ // eslint-disable-line no-new
C = function(){
assertInstance(this, C, NAME);
var that = new Base
, iterable = arguments[0];
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
return that;
};
C.prototype = proto;
if($.FW)proto.constructor = C;
}
IS_WEAK || inst.forEach(function(val, key){
buggyZero = 1 / key === -Infinity;
});
// fix converting -0 key to +0
if(buggyZero){
fixMethod('delete');
fixMethod('has');
IS_MAP && fixMethod('get');
}
// + fix .add & .set for chaining
if(buggyZero || chain !== inst)fixMethod(ADDER, true);
}
__webpack_require__(58).set(C, NAME);
O[NAME] = C;
$def($def.G + $def.W + $def.F * (C != Base), O);
species(C);
species($.core[NAME]); // for wrapper
if(!IS_WEAK)common.setIter(C, NAME, IS_MAP);
return C;
};
/***/ },
/* 83 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, safe = __webpack_require__(62).safe
, assert = __webpack_require__(63)
, forOf = __webpack_require__(79)
, _has = $.has
, isObject = $.isObject
, hide = $.hide
, isFrozen = Object.isFrozen || $.core.Object.isFrozen
, id = 0
, ID = safe('id')
, WEAK = safe('weak')
, LEAK = safe('leak')
, method = __webpack_require__(61)
, find = method(5)
, findIndex = method(6);
function findFrozen(store, key){
return find.call(store.array, function(it){
return it[0] === key;
});
}
// fallback for frozen keys
function leakStore(that){
return that[LEAK] || hide(that, LEAK, {
array: [],
get: function(key){
var entry = findFrozen(this, key);
if(entry)return entry[1];
},
has: function(key){
return !!findFrozen(this, key);
},
set: function(key, value){
var entry = findFrozen(this, key);
if(entry)entry[1] = value;
else this.array.push([key, value]);
},
'delete': function(key){
var index = findIndex.call(this.array, function(it){
return it[0] === key;
});
if(~index)this.array.splice(index, 1);
return !!~index;
}
})[LEAK];
}
module.exports = {
getConstructor: function(NAME, IS_MAP, ADDER){
function C(){
$.set(assert.inst(this, C, NAME), ID, id++);
var iterable = arguments[0];
if(iterable != undefined)forOf(iterable, IS_MAP, this[ADDER], this);
}
$.mix(C.prototype, {
// 23.3.3.2 WeakMap.prototype.delete(key)
// 23.4.3.3 WeakSet.prototype.delete(value)
'delete': function(key){
if(!isObject(key))return false;
if(isFrozen(key))return leakStore(this)['delete'](key);
return _has(key, WEAK) && _has(key[WEAK], this[ID]) && delete key[WEAK][this[ID]];
},
// 23.3.3.4 WeakMap.prototype.has(key)
// 23.4.3.4 WeakSet.prototype.has(value)
has: function has(key){
if(!isObject(key))return false;
if(isFrozen(key))return leakStore(this).has(key);
return _has(key, WEAK) && _has(key[WEAK], this[ID]);
}
});
return C;
},
def: function(that, key, value){
if(isFrozen(assert.obj(key))){
leakStore(that).set(key, value);
} else {
_has(key, WEAK) || hide(key, WEAK, {});
key[WEAK][that[ID]] = value;
} return that;
},
leakStore: leakStore,
WEAK: WEAK,
ID: ID
};
/***/ },
/* 84 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, assertObject = __webpack_require__(63).obj;
module.exports = function ownKeys(it){
assertObject(it);
var keys = $.getNames(it)
, getSymbols = $.getSymbols;
return getSymbols ? keys.concat(getSymbols(it)) : keys;
};
/***/ },
/* 85 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var $def = __webpack_require__(59)
, forOf = __webpack_require__(79);
module.exports = function(NAME){
$def($def.P, NAME, {
toJSON: function toJSON(){
var arr = [];
forOf(this, false, arr.push, arr);
return arr;
}
});
};
/***/ },
/* 86 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, invoke = __webpack_require__(60)
, assertFunction = __webpack_require__(63).fn;
module.exports = function(/* ...pargs */){
var fn = assertFunction(this)
, length = arguments.length
, pargs = Array(length)
, i = 0
, _ = $.path._
, holder = false;
while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true;
return function(/* ...args */){
var that = this
, _length = arguments.length
, j = 0, k = 0, args;
if(!holder && !_length)return invoke(fn, pargs, that);
args = pargs.slice();
if(holder)for(;length > j; j++)if(args[j] === _)args[j] = arguments[k++];
while(_length > k)args.push(arguments[k++]);
return invoke(fn, args, that);
};
};
/***/ },
/* 87 */
/***/ function(module, exports, __webpack_require__) {
module.exports = function($){
$.FW = false;
$.path = $.core;
return $;
};
/***/ }
/******/ ]);
// CommonJS export
if(typeof module != 'undefined' && module.exports)module.exports = __e;
// RequireJS export
else if(typeof define == 'function' && define.amd)define(function(){return __e});
// Export to global object
else __g.core = __e;
}(); |
node_modules/react-bootstrap/es/SafeAnchor.js | NathanBWaters/jb_club | import _extends from 'babel-runtime/helpers/extends';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import React from 'react';
import elementType from 'react-prop-types/lib/elementType';
var propTypes = {
href: React.PropTypes.string,
onClick: React.PropTypes.func,
disabled: React.PropTypes.bool,
role: React.PropTypes.string,
tabIndex: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string]),
/**
* this is sort of silly but needed for Button
*/
componentClass: elementType
};
var defaultProps = {
componentClass: 'a'
};
function isTrivialHref(href) {
return !href || href.trim() === '#';
}
/**
* There are situations due to browser quirks or Bootstrap CSS where
* an anchor tag is needed, when semantically a button tag is the
* better choice. SafeAnchor ensures that when an anchor is used like a
* button its accessible. It also emulates input `disabled` behavior for
* links, which is usually desirable for Buttons, NavItems, MenuItems, etc.
*/
var SafeAnchor = function (_React$Component) {
_inherits(SafeAnchor, _React$Component);
function SafeAnchor(props, context) {
_classCallCheck(this, SafeAnchor);
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
_this.handleClick = _this.handleClick.bind(_this);
return _this;
}
SafeAnchor.prototype.handleClick = function handleClick(event) {
var _props = this.props,
disabled = _props.disabled,
href = _props.href,
onClick = _props.onClick;
if (disabled || isTrivialHref(href)) {
event.preventDefault();
}
if (disabled) {
event.stopPropagation();
return;
}
if (onClick) {
onClick(event);
}
};
SafeAnchor.prototype.render = function render() {
var _props2 = this.props,
Component = _props2.componentClass,
disabled = _props2.disabled,
props = _objectWithoutProperties(_props2, ['componentClass', 'disabled']);
if (isTrivialHref(props.href)) {
props.role = props.role || 'button';
// we want to make sure there is a href attribute on the node
// otherwise, the cursor incorrectly styled (except with role='button')
props.href = props.href || '#';
}
if (disabled) {
props.tabIndex = -1;
props.style = _extends({ pointerEvents: 'none' }, props.style);
}
return React.createElement(Component, _extends({}, props, {
onClick: this.handleClick
}));
};
return SafeAnchor;
}(React.Component);
SafeAnchor.propTypes = propTypes;
SafeAnchor.defaultProps = defaultProps;
export default SafeAnchor; |
ajax/libs/oboe.js/1.4.0/oboe-browser.js | Piicksarn/cdnjs | // this file is the concatenation of several js files. See https://github.com/jimhigson/oboe-browser.js/tree/master/src for the unconcatenated source
(function (window, Object, Array, Error, undefined ) {
/**
* Partially complete a function.
*
* Eg:
* var add3 = partialComplete( function add(a,b){return a+b}, 3 );
*
* add3(4) // gives 7
*
*
* function wrap(left, right, cen){return left + " " + cen + " " + right;}
*
* var pirateGreeting = partialComplete( wrap , "I'm", ", a mighty pirate!" );
*
* pirateGreeting("Guybrush Threepwood");
* // gives "I'm Guybrush Threepwood, a mighty pirate!"
*/
var partialComplete = varArgs(function( fn, boundArgs ) {
return varArgs(function( callArgs ) {
return fn.apply(this, boundArgs.concat(callArgs));
});
}),
/**
* Compose zero or more functions:
*
* compose(f1, f2, f3)(x) = f1(f2(f3(x))))
*
* The last (inner-most) function may take more than one parameter:
*
* compose(f1, f2, f3)(x,y) = f1(f2(f3(x,y))))
*/
compose = varArgs(function(fns) {
var fnsList = arrayAsList(fns);
function next(params, curFn) {
return [apply(params, curFn)];
}
return varArgs(function(startParams){
return foldR(next, startParams, fnsList)[0];
});
}),
/**
* Call a list of functions with the same args until one returns a
* truthy result. Similar to the || operator.
*
* So:
* lazyUnion([f1,f2,f3 ... fn])( p1, p2 ... pn )
*
* Is equivalent to:
* apply([p1, p2 ... pn], f1) ||
* apply([p1, p2 ... pn], f2) ||
* apply([p1, p2 ... pn], f3) ... apply(fn, [p1, p2 ... pn])
*
* @returns the first return value that is given that is truthy.
*/
lazyUnion = varArgs(function(fns) {
return varArgs(function(params){
var maybeValue;
for (var i = 0; i < len(fns); i++) {
maybeValue = apply(params, fns[i]);
if( maybeValue ) {
return maybeValue;
}
}
});
});
/**
* This file declares various pieces of functional programming.
*
* This isn't a general purpose functional library, to keep things small it
* has just the parts useful for Oboe.js.
*/
/**
* Call a single function with the given arguments array.
* Basically, a functional-style version of the OO-style Function#apply for
* when we don't care about the context ('this') of the call.
*
* The order of arguments allows partial completion of the arguments array
*/
function apply(args, fn) {
return fn.apply(undefined, args);
}
/**
* Define variable argument functions but cut out all that tedious messing about
* with the arguments object. Delivers the variable-length part of the arguments
* list as an array.
*
* Eg:
*
* var myFunction = varArgs(
* function( fixedArgument, otherFixedArgument, variableNumberOfArguments ){
* console.log( variableNumberOfArguments );
* }
* )
*
* myFunction('a', 'b', 1, 2, 3); // logs [1,2,3]
*
* var myOtherFunction = varArgs(function( variableNumberOfArguments ){
* console.log( variableNumberOfArguments );
* })
*
* myFunction(1, 2, 3); // logs [1,2,3]
*
*/
function varArgs(fn){
var numberOfFixedArguments = fn.length -1;
return function(){
var numberOfVaraibleArguments = arguments.length - numberOfFixedArguments,
argumentsToFunction = Array.prototype.slice.call(arguments);
// remove the last n element from the array and append it onto the end of
// itself as a sub-array
argumentsToFunction.push(
argumentsToFunction.splice(numberOfFixedArguments, numberOfVaraibleArguments)
);
return fn.apply( this, argumentsToFunction );
}
}
/**
* Swap the order of parameters to a binary function
*
* A bit like this flip: http://zvon.org/other/haskell/Outputprelude/flip_f.html
*/
function flip(fn){
return function(a, b){
return fn(b,a);
}
}
/**
* Create a function which is the intersection of two other functions.
*
* Like the && operator, if the first is truthy, the second is never called,
* otherwise the return value from the second is returned.
*/
function lazyIntersection(fn1, fn2) {
return function (param) {
return fn1(param) && fn2(param);
};
}
/**
* This file defines some loosely associated syntactic sugar for
* Javascript programming
*/
/**
* Returns true if the given candidate is of type T
*/
function isOfType(T, maybeSomething){
return maybeSomething && maybeSomething.constructor === T;
}
function pluck(key, object){
return object[key];
}
var attr = partialComplete(partialComplete, pluck),
len = attr('length'),
isString = partialComplete(isOfType, String);
/**
* I don't like saying this:
*
* foo !=== undefined
*
* because of the double-negative. I find this:
*
* defined(foo)
*
* easier to read.
*/
function defined( value ) {
return value !== undefined;
}
function always(){return true}
/**
* Returns true if object o has a key named like every property in
* the properties array. Will give false if any are missing, or if o
* is not an object.
*/
function hasAllProperties(fieldList, o) {
return (o instanceof Object)
&&
all(function (field) {
return (field in o);
}, fieldList);
}
/**
* Like cons in Lisp
*/
function cons(x, xs) {
/* Internally lists are linked 2-element Javascript arrays.
So that lists are all immutable we Object.freeze in newer
Javascript runtimes.
In older engines freeze should have been polyfilled as the
identity function. */
return Object.freeze([x,xs]);
}
/**
* The empty list
*/
var emptyList = null,
/**
* Get the head of a list.
*
* Ie, head(cons(a,b)) = a
*/
head = attr(0),
/**
* Get the tail of a list.
*
* Ie, head(cons(a,b)) = a
*/
tail = attr(1);
/**
* Converts an array to a list
*
* asList([a,b,c])
*
* is equivalent to:
*
* cons(a, cons(b, cons(c, emptyList)))
**/
function arrayAsList(inputArray){
return reverseList(
inputArray.reduce(
flip(cons),
emptyList
)
);
}
/**
* A varargs version of arrayAsList. Works a bit like list
* in LISP.
*
* list(a,b,c)
*
* is equivalent to:
*
* cons(a, cons(b, cons(c, emptyList)))
*/
var list = varArgs(arrayAsList);
/**
* Convert a list back to a js native array
*/
function listAsArray(list){
return foldR( function(arraySoFar, listItem){
arraySoFar.unshift(listItem);
return arraySoFar;
}, [], list );
}
/**
* Map a function over a list
*/
function map(fn, list) {
return list
? cons(fn(head(list)), map(fn,tail(list)))
: emptyList
;
}
/**
* foldR implementation. Reduce a list down to a single value.
*
* @pram {Function} fn (rightEval, curVal) -> result
*/
function foldR(fn, startValue, list) {
return list
? fn(foldR(fn, startValue, tail(list)), head(list))
: startValue
;
}
/**
* Return a list like the one given but with the first instance equal
* to item removed
*/
function without(list, item) {
return list
? ( head(list) == item
? tail(list)
: cons(head(list), without(tail(list), item))
)
: emptyList
;
}
/**
* Returns true if the given function holds for every item in
* the list, false otherwise
*/
function all(fn, list) {
return !list ||
fn(head(list)) && all(fn, tail(list));
}
/**
* Apply a function to every item in a list
*
* This doesn't make any sense if we're doing pure functional because
* it doesn't return anything. Hence, this is only really useful if fn
* has side-effects.
*/
function each(fn, list) {
if( list ){
fn(head(list));
each(fn, tail(list));
}
}
/**
* Reverse the order of a list
*/
function reverseList(list){
// js re-implementation of 3rd solution from:
// http://www.haskell.org/haskellwiki/99_questions/Solutions/5
function reverseInner( list, reversedAlready ) {
if( !list ) {
return reversedAlready;
}
return reverseInner(tail(list), cons(head(list), reversedAlready))
}
return reverseInner(list, emptyList);
}
;(function (clarinet) {
// non node-js needs to set clarinet debug on root
var env
, fastlist
;
if(typeof process === 'object' && process.env) env = process.env;
else env = window;
if(typeof FastList === 'function') {
fastlist = FastList;
} else if (typeof require === 'function') {
try { fastlist = require('fast-list'); } catch (exc) { fastlist = Array; }
} else fastlist = Array;
clarinet.parser = function (opt) { return new CParser(opt);};
clarinet.CParser = CParser;
clarinet.CStream = CStream;
clarinet.createStream = createStream;
clarinet.MAX_BUFFER_LENGTH = 64 * 1024;
clarinet.DEBUG = (env.CDEBUG==='debug');
clarinet.INFO = (env.CDEBUG==='debug' || env.CDEBUG==='info');
clarinet.EVENTS =
[ "value"
, "string"
, "key"
, "openobject"
, "closeobject"
, "openarray"
, "closearray"
, "error"
, "end"
, "ready"
];
var buffers = [ "textNode", "numberNode" ]
, streamWraps = clarinet.EVENTS.filter(function (ev) {
return ev !== "error" && ev !== "end";
})
, S = 0
, Stream
;
clarinet.STATE =
{ BEGIN : S++
, VALUE : S++ // general stuff
, OPEN_OBJECT : S++ // {
, CLOSE_OBJECT : S++ // }
, OPEN_ARRAY : S++ // [
, CLOSE_ARRAY : S++ // ]
, TEXT_ESCAPE : S++ // \ stuff
, STRING : S++ // ""
, BACKSLASH : S++
, END : S++ // No more stack
, OPEN_KEY : S++ // , "a"
, CLOSE_KEY : S++ // :
, TRUE : S++ // r
, TRUE2 : S++ // u
, TRUE3 : S++ // e
, FALSE : S++ // a
, FALSE2 : S++ // l
, FALSE3 : S++ // s
, FALSE4 : S++ // e
, NULL : S++ // u
, NULL2 : S++ // l
, NULL3 : S++ // l
, NUMBER_DECIMAL_POINT : S++ // .
, NUMBER_DIGIT : S++ // [0-9]
};
for (var s_ in clarinet.STATE) clarinet.STATE[clarinet.STATE[s_]] = s_;
// switcharoo
S = clarinet.STATE;
if (!Object.create) {
Object.create = function (o) {
function f () { this["__proto__"] = o; }
f.prototype = o;
return new f;
};
}
if (!Object.getPrototypeOf) {
Object.getPrototypeOf = function (o) {
return o["__proto__"];
};
}
if (!Object.keys) {
Object.keys = function (o) {
var a = [];
for (var i in o) if (o.hasOwnProperty(i)) a.push(i);
return a;
};
}
function checkBufferLength (parser) {
var maxAllowed = Math.max(clarinet.MAX_BUFFER_LENGTH, 10)
, maxActual = 0
;
for (var i = 0, l = buffers.length; i < l; i ++) {
var len = parser[buffers[i]].length;
if (len > maxAllowed) {
switch (buffers[i]) {
case "text":
closeText(parser);
break;
default:
error(parser, "Max buffer length exceeded: "+ buffers[i]);
}
}
maxActual = Math.max(maxActual, len);
}
parser.bufferCheckPosition = (clarinet.MAX_BUFFER_LENGTH - maxActual)
+ parser.position;
}
function clearBuffers (parser) {
for (var i = 0, l = buffers.length; i < l; i ++) {
parser[buffers[i]] = "";
}
}
var stringTokenPattern = /[\\"\n]/g;
function CParser (opt) {
if (!(this instanceof CParser)) return new CParser (opt);
var parser = this;
clearBuffers(parser);
parser.bufferCheckPosition = clarinet.MAX_BUFFER_LENGTH;
parser.q = parser.c = parser.p = "";
parser.opt = opt || {};
parser.closed = parser.closedRoot = parser.sawRoot = false;
parser.tag = parser.error = null;
parser.state = S.BEGIN;
parser.stack = new fastlist();
// mostly just for error reporting
parser.position = parser.column = 0;
parser.line = 1;
parser.slashed = false;
parser.unicodeI = 0;
parser.unicodeS = null;
emit(parser, "onready");
}
CParser.prototype =
{ end : function () { end(this); }
, write : write
, resume : function () { this.error = null; return this; }
, close : function () { return this.write(null); }
};
try { Stream = require("stream").Stream; }
catch (ex) { Stream = function () {}; }
function createStream (opt) { return new CStream(opt); }
function CStream (opt) {
if (!(this instanceof CStream)) return new CStream(opt);
this._parser = new CParser(opt);
this.writable = true;
this.readable = true;
var me = this;
Stream.apply(me);
this._parser.onend = function () { me.emit("end"); };
this._parser.onerror = function (er) {
me.emit("error", er);
me._parser.error = null;
};
streamWraps.forEach(function (ev) {
Object.defineProperty(me, "on" + ev,
{ get : function () { return me._parser["on" + ev]; }
, set : function (h) {
if (!h) {
me.removeAllListeners(ev);
me._parser["on"+ev] = h;
return h;
}
me.on(ev, h);
}
, enumerable : true
, configurable : false
});
});
}
CStream.prototype = Object.create(Stream.prototype,
{ constructor: { value: CStream } });
CStream.prototype.write = function (data) {
this._parser.write(data.toString());
this.emit("data", data);
return true;
};
CStream.prototype.end = function (chunk) {
if (chunk && chunk.length) this._parser.write(chunk.toString());
this._parser.end();
return true;
};
CStream.prototype.on = function (ev, handler) {
var me = this;
if (!me._parser["on"+ev] && streamWraps.indexOf(ev) !== -1) {
me._parser["on"+ev] = function () {
var args = arguments.length === 1 ? [arguments[0]]
: Array.apply(null, arguments);
args.splice(0, 0, ev);
me.emit.apply(me, args);
};
}
return Stream.prototype.on.call(me, ev, handler);
};
CStream.prototype.destroy = function () {
clearBuffers(this._parser);
this.emit("close");
};
function emit(parser, event, data) {
if(clarinet.INFO) console.log('-- emit', event, data);
if (parser[event]) parser[event](data);
}
function emitNode(parser, event, data) {
closeValue(parser);
emit(parser, event, data);
}
function closeValue(parser, event) {
parser.textNode = textopts(parser.opt, parser.textNode);
if (parser.textNode) {
emit(parser, (event ? event : "onvalue"), parser.textNode);
}
parser.textNode = "";
}
function closeNumber(parser) {
if (parser.numberNode)
emit(parser, "onvalue", parseFloat(parser.numberNode));
parser.numberNode = "";
}
function textopts (opt, text) {
if (opt.trim) text = text.trim();
if (opt.normalize) text = text.replace(/\s+/g, " ");
return text;
}
function error (parser, er) {
closeValue(parser);
er += "\nLine: "+parser.line+
"\nColumn: "+parser.column+
"\nChar: "+parser.c;
er = new Error(er);
parser.error = er;
emit(parser, "onerror", er);
return parser;
}
function end(parser) {
if (parser.state !== S.VALUE) error(parser, "Unexpected end");
closeValue(parser);
parser.c = "";
parser.closed = true;
emit(parser, "onend");
CParser.call(parser, parser.opt);
return parser;
}
function write (chunk) {
var parser = this;
if (this.error) throw this.error;
if (parser.closed) return error(parser,
"Cannot write after close. Assign an onready handler.");
if (chunk === null) return end(parser);
var i = 0, c = chunk[0], p = parser.p;
if (clarinet.DEBUG) console.log('write -> [' + chunk + ']');
while (c) {
p = c;
parser.c = c = chunk.charAt(i++);
// if chunk doesnt have next, like streaming char by char
// this way we need to check if previous is really previous
// if not we need to reset to what the parser says is the previous
// from buffer
if(p !== c ) parser.p = p;
else p = parser.p;
if(!c) break;
if (clarinet.DEBUG) console.log(i,c,clarinet.STATE[parser.state]);
parser.position ++;
if (c === "\n") {
parser.line ++;
parser.column = 0;
} else parser.column ++;
switch (parser.state) {
case S.BEGIN:
if (c === "{") parser.state = S.OPEN_OBJECT;
else if (c === "[") parser.state = S.OPEN_ARRAY;
else if (c !== '\r' && c !== '\n' && c !== ' ' && c !== '\t')
error(parser, "Non-whitespace before {[.");
continue;
case S.OPEN_KEY:
case S.OPEN_OBJECT:
if (c === '\r' || c === '\n' || c === ' ' || c === '\t') continue;
if(parser.state === S.OPEN_KEY) parser.stack.push(S.CLOSE_KEY);
else {
if(c === '}') {
emit(parser, 'onopenobject');
emit(parser, 'oncloseobject');
parser.state = parser.stack.pop() || S.VALUE;
continue;
} else parser.stack.push(S.CLOSE_OBJECT);
}
if(c === '"') parser.state = S.STRING;
else error(parser, "Malformed object key should start with \"");
continue;
case S.CLOSE_KEY:
case S.CLOSE_OBJECT:
if (c === '\r' || c === '\n' || c === ' ' || c === '\t') continue;
var event = (parser.state === S.CLOSE_KEY) ? 'key' : 'object';
if(c===':') {
if(parser.state === S.CLOSE_OBJECT) {
parser.stack.push(S.CLOSE_OBJECT);
closeValue(parser, 'onopenobject');
} else closeValue(parser, 'onkey');
parser.state = S.VALUE;
} else if (c==='}') {
emitNode(parser, 'oncloseobject');
parser.state = parser.stack.pop() || S.VALUE;
} else if(c===',') {
if(parser.state === S.CLOSE_OBJECT)
parser.stack.push(S.CLOSE_OBJECT);
closeValue(parser);
parser.state = S.OPEN_KEY;
} else error(parser, 'Bad object');
continue;
case S.OPEN_ARRAY: // after an array there always a value
case S.VALUE:
if (c === '\r' || c === '\n' || c === ' ' || c === '\t') continue;
if(parser.state===S.OPEN_ARRAY) {
emit(parser, 'onopenarray');
parser.state = S.VALUE;
if(c === ']') {
emit(parser, 'onclosearray');
parser.state = parser.stack.pop() || S.VALUE;
continue;
} else {
parser.stack.push(S.CLOSE_ARRAY);
}
}
if(c === '"') parser.state = S.STRING;
else if(c === '{') parser.state = S.OPEN_OBJECT;
else if(c === '[') parser.state = S.OPEN_ARRAY;
else if(c === 't') parser.state = S.TRUE;
else if(c === 'f') parser.state = S.FALSE;
else if(c === 'n') parser.state = S.NULL;
else if(c === '-') { // keep and continue
parser.numberNode += c;
} else if(c==='0') {
parser.numberNode += c;
parser.state = S.NUMBER_DIGIT;
} else if('123456789'.indexOf(c) !== -1) {
parser.numberNode += c;
parser.state = S.NUMBER_DIGIT;
} else error(parser, "Bad value");
continue;
case S.CLOSE_ARRAY:
if(c===',') {
parser.stack.push(S.CLOSE_ARRAY);
closeValue(parser, 'onvalue');
parser.state = S.VALUE;
} else if (c===']') {
emitNode(parser, 'onclosearray');
parser.state = parser.stack.pop() || S.VALUE;
} else if (c === '\r' || c === '\n' || c === ' ' || c === '\t')
continue;
else error(parser, 'Bad array');
continue;
case S.STRING:
// thanks thejh, this is an about 50% performance improvement.
var starti = i-1
, slashed = parser.slashed
, unicodeI = parser.unicodeI
;
STRING_BIGLOOP: while (true) {
if (clarinet.DEBUG)
console.log(i,c,clarinet.STATE[parser.state]
,slashed);
// zero means "no unicode active". 1-4 mean "parse some more". end after 4.
while (unicodeI > 0) {
parser.unicodeS += c;
c = chunk.charAt(i++);
if (unicodeI === 4) {
// TODO this might be slow? well, probably not used too often anyway
parser.textNode += String.fromCharCode(parseInt(parser.unicodeS, 16));
unicodeI = 0;
starti = i-1;
} else {
unicodeI++;
}
// we can just break here: no stuff we skipped that still has to be sliced out or so
if (!c) break STRING_BIGLOOP;
}
if (c === '"' && !slashed) {
parser.state = parser.stack.pop() || S.VALUE;
parser.textNode += chunk.substring(starti, i-1);
if(!parser.textNode) {
emit(parser, "onvalue", "");
}
break;
}
if (c === '\\' && !slashed) {
slashed = true;
parser.textNode += chunk.substring(starti, i-1);
c = chunk.charAt(i++);
if (!c) break;
}
if (slashed) {
slashed = false;
if (c === 'n') { parser.textNode += '\n'; }
else if (c === 'r') { parser.textNode += '\r'; }
else if (c === 't') { parser.textNode += '\t'; }
else if (c === 'f') { parser.textNode += '\f'; }
else if (c === 'b') { parser.textNode += '\b'; }
else if (c === 'u') {
// \uxxxx. meh!
unicodeI = 1;
parser.unicodeS = '';
} else {
parser.textNode += c;
}
c = chunk.charAt(i++);
starti = i-1;
if (!c) break;
else continue;
}
stringTokenPattern.lastIndex = i;
var reResult = stringTokenPattern.exec(chunk);
if (reResult === null) {
i = chunk.length+1;
parser.textNode += chunk.substring(starti, i-1);
break;
}
i = reResult.index+1;
c = chunk.charAt(reResult.index);
if (!c) {
parser.textNode += chunk.substring(starti, i-1);
break;
}
}
parser.slashed = slashed;
parser.unicodeI = unicodeI;
continue;
case S.TRUE:
if (c==='') continue; // strange buffers
if (c==='r') parser.state = S.TRUE2;
else error(parser, 'Invalid true started with t'+ c);
continue;
case S.TRUE2:
if (c==='') continue;
if (c==='u') parser.state = S.TRUE3;
else error(parser, 'Invalid true started with tr'+ c);
continue;
case S.TRUE3:
if (c==='') continue;
if(c==='e') {
emit(parser, "onvalue", true);
parser.state = parser.stack.pop() || S.VALUE;
} else error(parser, 'Invalid true started with tru'+ c);
continue;
case S.FALSE:
if (c==='') continue;
if (c==='a') parser.state = S.FALSE2;
else error(parser, 'Invalid false started with f'+ c);
continue;
case S.FALSE2:
if (c==='') continue;
if (c==='l') parser.state = S.FALSE3;
else error(parser, 'Invalid false started with fa'+ c);
continue;
case S.FALSE3:
if (c==='') continue;
if (c==='s') parser.state = S.FALSE4;
else error(parser, 'Invalid false started with fal'+ c);
continue;
case S.FALSE4:
if (c==='') continue;
if (c==='e') {
emit(parser, "onvalue", false);
parser.state = parser.stack.pop() || S.VALUE;
} else error(parser, 'Invalid false started with fals'+ c);
continue;
case S.NULL:
if (c==='') continue;
if (c==='u') parser.state = S.NULL2;
else error(parser, 'Invalid null started with n'+ c);
continue;
case S.NULL2:
if (c==='') continue;
if (c==='l') parser.state = S.NULL3;
else error(parser, 'Invalid null started with nu'+ c);
continue;
case S.NULL3:
if (c==='') continue;
if(c==='l') {
emit(parser, "onvalue", null);
parser.state = parser.stack.pop() || S.VALUE;
} else error(parser, 'Invalid null started with nul'+ c);
continue;
case S.NUMBER_DECIMAL_POINT:
if(c==='.') {
parser.numberNode += c;
parser.state = S.NUMBER_DIGIT;
} else error(parser, 'Leading zero not followed by .');
continue;
case S.NUMBER_DIGIT:
if('0123456789'.indexOf(c) !== -1) parser.numberNode += c;
else if (c==='.') {
if(parser.numberNode.indexOf('.')!==-1)
error(parser, 'Invalid number has two dots');
parser.numberNode += c;
} else if (c==='e' || c==='E') {
if(parser.numberNode.indexOf('e')!==-1 ||
parser.numberNode.indexOf('E')!==-1 )
error(parser, 'Invalid number has two exponential');
parser.numberNode += c;
} else if (c==="+" || c==="-") {
if(!(p==='e' || p==='E'))
error(parser, 'Invalid symbol in number');
parser.numberNode += c;
} else {
closeNumber(parser);
i--; // go back one
parser.state = parser.stack.pop() || S.VALUE;
}
continue;
default:
error(parser, "Unknown state: " + parser.state);
}
}
if (parser.position >= parser.bufferCheckPosition)
checkBufferLength(parser);
return parser;
}
})(typeof exports === "undefined" ? clarinet = {} : exports);
/**
* A bridge used to assign stateless functions to listen to clarinet.
*
* As well as the parameter from clarinet, each callback will also be passed
* the result of the last callback.
*
* This may also be used to clear all listeners by assigning zero handlers:
*
* clarinetListenerAdaptor( clarinet, {} )
*/
function clarinetListenerAdaptor(clarinetParser, handlers){
var state;
clarinet.EVENTS.forEach(function(eventName){
var handlerFunction = handlers[eventName];
clarinetParser['on'+eventName] = handlerFunction &&
function(param) {
state = handlerFunction( state, param);
};
});
}
function httpTransport(){
return new XMLHttpRequest();
}
/**
* A wrapper around the browser XmlHttpRequest object that raises an
* event whenever a new part of the response is available.
*
* In older browsers progressive reading is impossible so all the
* content is given in a single call. For newer ones several events
* should be raised, allowing progressive interpretation of the response.
*
* @param {Function} fire a function to pass events to when something happens
* @param {Function} on a function to use to subscribe to events
* @param {XMLHttpRequest} xhr the xhr to use as the transport. Under normal
* operation, will have been created using httpTransport() above
* but for tests a stub can be provided instead.
* @param {String} method one of 'GET' 'POST' 'PUT' 'PATCH' 'DELETE'
* @param {String} url the url to make a request to
* @param {String|Object} data some content to be sent with the request.
* Only valid if method is POST or PUT.
* @param {Object} [headers] the http request headers to send
*/
function streamingHttp(fire, on, xhr, method, url, data, headers) {
var numberOfCharsAlreadyGivenToCallback = 0;
// When an ABORTING message is put on the event bus abort
// the ajax request
on( ABORTING, function(){
// if we keep the onreadystatechange while aborting the XHR gives
// a callback like a successful call so first remove this listener
// by assigning null:
xhr.onreadystatechange = null;
xhr.abort();
});
/** Given a value from the user to send as the request body, return in
* a form that is suitable to sending over the wire. Returns either a
* string, or null.
*/
function validatedRequestBody( body ) {
if( !body )
return null;
return isString(body)? body: JSON.stringify(body);
}
/**
* Handle input from the underlying xhr: either a state change,
* the progress event or the request being complete.
*/
function handleProgress() {
var textSoFar = xhr.responseText,
newText = textSoFar.substr(numberOfCharsAlreadyGivenToCallback);
/* Raise the event for new text.
On older browsers, the new text is the whole response.
On newer/better ones, the fragment part that we got since
last progress. */
if( newText ) {
fire( NEW_CONTENT, newText );
}
numberOfCharsAlreadyGivenToCallback = len(textSoFar);
}
if('onprogress' in xhr){ // detect browser support for progressive delivery
xhr.onprogress = handleProgress;
}
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 ) {
// is this a 2xx http code?
var sucessful = String(xhr.status)[0] == 2;
if( sucessful ) {
// In Chrome 29 (not 28) no onprogress is fired when a response
// is complete before the onload. We need to always do handleInput
// in case we get the load but have not had a final progress event.
// This looks like a bug and may change in future but let's take
// the safest approach and assume we might not have received a
// progress event for each part of the response
handleProgress();
fire( END_OF_CONTENT );
} else {
fire( ERROR_EVENT, xhr.status );
}
}
};
try{
xhr.open(method, url, true);
for( var headerName in headers ){
xhr.setRequestHeader(headerName, headers[headerName]);
}
xhr.send(validatedRequestBody(data));
} catch( e ) {
// To keep a consistent interface with Node, we can't fire an event here.
// Node's streaming http adaptor receives the error as an asynchronous
// event rather than as an exception. If we fired now, the Oboe user
// has had no chance to add a .fail listener so there is no way
// the event could be useful. For both these reasons defer the
// firing to the next JS frame.
window.setTimeout(partialComplete(fire, ERROR_EVENT, e), 0);
}
}
var jsonPathSyntax = (function() {
var
/**
* Export a regular expression as a simple function by exposing just
* the Regex#exec. This allows regex tests to be used under the same
* interface as differently implemented tests, or for a user of the
* tests to not concern themselves with their implementation as regular
* expressions.
*
* This could also be expressed point-free as:
* Function.prototype.bind.bind(RegExp.prototype.exec),
*
* But that's far too confusing! (and not even smaller once minified
* and gzipped)
*/
regexDescriptor = function regexDescriptor(regex) {
return regex.exec.bind(regex);
}
/**
* Join several regular expressions and express as a function.
* This allows the token patterns to reuse component regular expressions
* instead of being expressed in full using huge and confusing regular
* expressions.
*/
, jsonPathClause = varArgs(function( componentRegexes ) {
// The regular expressions all start with ^ because we
// only want to find matches at the start of the
// JSONPath fragment we are inspecting
componentRegexes.unshift(/^/);
return regexDescriptor(
RegExp(
componentRegexes.map(attr('source')).join('')
)
);
})
, possiblyCapturing = /(\$?)/
, namedNode = /([\w-_]+|\*)/
, namePlaceholder = /()/
, nodeInArrayNotation = /\["([^"]+)"\]/
, numberedNodeInArrayNotation = /\[(\d+|\*)\]/
, fieldList = /{([\w ]*?)}/
, optionalFieldList = /(?:{([\w ]*?)})?/
// foo or *
, jsonPathNamedNodeInObjectNotation = jsonPathClause(
possiblyCapturing,
namedNode,
optionalFieldList
)
// ["foo"]
, jsonPathNamedNodeInArrayNotation = jsonPathClause(
possiblyCapturing,
nodeInArrayNotation,
optionalFieldList
)
// [2] or [*]
, jsonPathNumberedNodeInArrayNotation = jsonPathClause(
possiblyCapturing,
numberedNodeInArrayNotation,
optionalFieldList
)
// {a b c}
, jsonPathPureDuckTyping = jsonPathClause(
possiblyCapturing,
namePlaceholder,
fieldList
)
// ..
, jsonPathDoubleDot = jsonPathClause(/\.\./)
// .
, jsonPathDot = jsonPathClause(/\./)
// !
, jsonPathBang = jsonPathClause(
possiblyCapturing,
/!/
)
// nada!
, emptyString = jsonPathClause(/$/)
;
/* We export only a single function. When called, this function injects
into another function the descriptors from above.
*/
return function (fn){
return fn(
lazyUnion(
jsonPathNamedNodeInObjectNotation
, jsonPathNamedNodeInArrayNotation
, jsonPathNumberedNodeInArrayNotation
, jsonPathPureDuckTyping
)
, jsonPathDoubleDot
, jsonPathDot
, jsonPathBang
, emptyString
);
};
}());
/**
* This file provides various listeners which can be used to build up
* a changing ascent based on the callbacks provided by Clarinet. It listens
* to the low-level events from Clarinet and fires higher-level ones.
*
* The building up is stateless so to track a JSON file
* clarinetListenerAdaptor.js is required to store the ascent state
* between calls.
*/
var keyOf = attr('key');
var nodeOf = attr('node');
/**
* A special value to use in the path list to represent the path 'to' a root
* object (which doesn't really have any path). This prevents the need for
* special-casing detection of the root object and allows it to be treated
* like any other object. We might think of this as being similar to the
* 'unnamed root' domain ".", eg if I go to
* http://en.wikipedia.org./wiki/En/Main_page the dot after 'org' deliminates
* the unnamed root of the DNS.
*
* This is kept as an object to take advantage that in Javascript's OO objects
* are guaranteed to be distinct, therefore no other object can possibly clash
* with this one. Strings, numbers etc provide no such guarantee.
**/
var ROOT_PATH = {};
/**
* Create a new set of handlers for clarinet's events, bound to the fire
* function given.
*/
function incrementalContentBuilder( fire) {
function arrayIndicesAreKeys( possiblyInconsistentAscent, newDeepestNode) {
/* for values in arrays we aren't pre-warned of the coming paths
(Clarinet gives no call to onkey like it does for values in objects)
so if we are in an array we need to create this path ourselves. The
key will be len(parentNode) because array keys are always sequential
numbers. */
var parentNode = nodeOf( head( possiblyInconsistentAscent));
return isOfType( Array, parentNode)
?
pathFound( possiblyInconsistentAscent,
len(parentNode),
newDeepestNode
)
:
// nothing needed, return unchanged
possiblyInconsistentAscent
;
}
function nodeFound( ascent, newDeepestNode ) {
if( !ascent ) {
// we discovered the root node,
fire( ROOT_FOUND, newDeepestNode);
return pathFound( ascent, ROOT_PATH, newDeepestNode);
}
// we discovered a non-root node
var arrayConsistentAscent = arrayIndicesAreKeys( ascent, newDeepestNode),
ancestorBranches = tail( arrayConsistentAscent),
previouslyUnmappedName = keyOf( head( arrayConsistentAscent));
appendBuiltContent(
ancestorBranches,
previouslyUnmappedName,
newDeepestNode
);
return cons(
namedNode( previouslyUnmappedName, newDeepestNode ),
ancestorBranches
);
}
/**
* Add a new value to the object we are building up to represent the
* parsed JSON
*/
function appendBuiltContent( ancestorBranches, key, node ){
nodeOf( head( ancestorBranches))[key] = node;
}
/**
* Get a new key->node mapping
*
* @param {String|Number} key
* @param {Object|Array|String|Number|null} node a value found in the json
*/
function namedNode(key, node) {
return {key:key, node:node};
}
/**
* For when we find a new key in the json.
*
* @param {String|Number|Object} newDeepestName the key. If we are in an
* array will be a number, otherwise a string. May take the special
* value ROOT_PATH if the root node has just been found
*
* @param {String|Number|Object|Array|Null|undefined} [maybeNewDeepestNode]
* usually this won't be known so can be undefined. Can't use null
* to represent unknown because null is a valid value in JSON
**/
function pathFound(ascent, newDeepestName, maybeNewDeepestNode) {
if( ascent ) { // if not root
// If we have the key but (unless adding to an array) no known value
// yet. Put that key in the output but against no defined value:
appendBuiltContent( ascent, newDeepestName, maybeNewDeepestNode );
}
var ascentWithNewPath = cons(
namedNode( newDeepestName,
maybeNewDeepestNode),
ascent
);
fire( PATH_FOUND, ascentWithNewPath);
return ascentWithNewPath;
}
/**
* For when the current node ends
*/
function curNodeFinished( ascent ) {
fire( NODE_FOUND, ascent);
// pop the complete node and its path off the list:
return tail( ascent);
}
return {
openobject : function (ascent, firstKey) {
var ascentAfterNodeFound = nodeFound(ascent, {});
/* It is a perculiarity of Clarinet that for non-empty objects it
gives the first key with the openobject event instead of
in a subsequent key event.
firstKey could be the empty string in a JSON object like
{'':'foo'} which is technically valid.
So can't check with !firstKey, have to see if has any
defined value. */
return defined(firstKey)
?
/* We know the first key of the newly parsed object. Notify that
path has been found but don't put firstKey permanently onto
pathList yet because we haven't identified what is at that key
yet. Give null as the value because we haven't seen that far
into the json yet */
pathFound(ascentAfterNodeFound, firstKey)
:
ascentAfterNodeFound
;
},
openarray: function (ascent) {
return nodeFound(ascent, []);
},
// called by Clarinet when keys are found in objects
key: pathFound,
/* Emitted by Clarinet when primitive values are found, ie Strings,
Numbers, and null.
Because these are always leaves in the JSON, we find and finish the
node in one step, expressed as functional composition: */
value: compose( curNodeFinished, nodeFound ),
// we make no distinction in how we handle object and arrays closing.
// For both, interpret as the end of the current node.
closeobject: curNodeFinished,
closearray: curNodeFinished
};
}
/**
* The jsonPath evaluator compiler used for Oboe.js.
*
* One function is exposed. This function takes a String JSONPath spec and
* returns a function to test candidate ascents for matches.
*
* String jsonPath -> (List ascent) -> Boolean|Object
*
* This file is coded in a pure functional style. That is, no function has
* side effects, every function evaluates to the same value for the same
* arguments and no variables are reassigned.
*/
// the call to jsonPathSyntax injects the token syntaxes that are needed
// inside the compiler
var jsonPathCompiler = jsonPathSyntax(function (pathNodeSyntax,
doubleDotSyntax,
dotSyntax,
bangSyntax,
emptySyntax ) {
var CAPTURING_INDEX = 1;
var NAME_INDEX = 2;
var FIELD_LIST_INDEX = 3;
var headKey = compose(keyOf, head);
/**
* Create an evaluator function for a named path node, expressed in the
* JSONPath like:
* foo
* ["bar"]
* [2]
*/
function nameClause(previousExpr, detection ) {
var name = detection[NAME_INDEX],
matchesName = ( !name || name == '*' )
? always
: function(ascent){return headKey(ascent) == name};
return lazyIntersection(matchesName, previousExpr);
}
/**
* Create an evaluator function for a a duck-typed node, expressed like:
*
* {spin, taste, colour}
* .particle{spin, taste, colour}
* *{spin, taste, colour}
*/
function duckTypeClause(previousExpr, detection) {
var fieldListStr = detection[FIELD_LIST_INDEX];
if (!fieldListStr)
return previousExpr; // don't wrap at all, return given expr as-is
var hasAllrequiredFields = partialComplete(
hasAllProperties,
arrayAsList(fieldListStr.split(/\W+/))
),
isMatch = compose(
hasAllrequiredFields,
nodeOf,
head
);
return lazyIntersection(isMatch, previousExpr);
}
/**
* Expression for $, returns the evaluator function
*/
function capture( previousExpr, detection ) {
// extract meaning from the detection
var capturing = !!detection[CAPTURING_INDEX];
if (!capturing)
return previousExpr; // don't wrap at all, return given expr as-is
return lazyIntersection(previousExpr, head);
}
/**
* Create an evaluator function that moves onto the next item on the
* lists. This function is the place where the logic to move up a
* level in the ascent exists.
*
* Eg, for JSONPath ".foo" we need skip1(nameClause(always, [,'foo']))
*/
function skip1(previousExpr) {
if( previousExpr == always ) {
/* If there is no previous expression this consume command
is at the start of the jsonPath.
Since JSONPath specifies what we'd like to find but not
necessarily everything leading down to it, when running
out of JSONPath to check against we default to true */
return always;
}
/** return true if the ascent we have contains only the JSON root,
* false otherwise
*/
function notAtRoot(ascent){
return headKey(ascent) != ROOT_PATH;
}
return lazyIntersection(
/* If we're already at the root but there are more
expressions to satisfy, can't consume any more. No match.
This check is why none of the other exprs have to be able
to handle empty lists; skip1 is the only evaluator that
moves onto the next token and it refuses to do so once it
reaches the last item in the list. */
notAtRoot,
/* We are not at the root of the ascent yet.
Move to the next level of the ascent by handing only
the tail to the previous expression */
compose(previousExpr, tail)
);
}
/**
* Create an evaluator function for the .. (double dot) token. Consumes
* zero or more levels of the ascent, the fewest that are required to find
* a match when given to previousExpr.
*/
function skipMany(previousExpr) {
if( previousExpr == always ) {
/* If there is no previous expression this consume command
is at the start of the jsonPath.
Since JSONPath specifies what we'd like to find but not
necessarily everything leading down to it, when running
out of JSONPath to check against we default to true */
return always;
}
var
// In JSONPath .. is equivalent to !.. so if .. reaches the root
// the match has succeeded. Ie, we might write ..foo or !..foo
// and both should match identically.
terminalCaseWhenArrivingAtRoot = rootExpr(),
terminalCaseWhenPreviousExpressionIsSatisfied = previousExpr,
recursiveCase = skip1(skipManyInner),
cases = lazyUnion(
terminalCaseWhenArrivingAtRoot
, terminalCaseWhenPreviousExpressionIsSatisfied
, recursiveCase
);
function skipManyInner(ascent) {
if( !ascent ) {
// have gone past the start, not a match:
return false;
}
return cases(ascent);
}
return skipManyInner;
}
/**
* Generate an evaluator for ! - matches only the root element of the json
* and ignores any previous expressions since nothing may precede !.
*/
function rootExpr() {
return function(ascent){
return headKey(ascent) == ROOT_PATH;
};
}
/**
* Generate a statement wrapper to sit around the outermost
* clause evaluator.
*
* Handles the case where the capturing is implicit because the JSONPath
* did not contain a '$' by returning the last node.
*/
function statementExpr(lastClause) {
return function(ascent) {
// kick off the evaluation by passing through to the last clause
var exprMatch = lastClause(ascent);
return exprMatch === true ? head(ascent) : exprMatch;
};
}
/**
* For when a token has been found in the JSONPath input.
* Compiles the parser for that token and returns in combination with the
* parser already generated.
*
* @param {Function} exprs a list of the clause evaluator generators for
* the token that was found
* @param {Function} parserGeneratedSoFar the parser already found
* @param {Array} detection the match given by the regex engine when
* the feature was found
*/
function expressionsReader( exprs, parserGeneratedSoFar, detection ) {
// if exprs is zero-length foldR will pass back the
// parserGeneratedSoFar as-is so we don't need to treat
// this as a special case
return foldR(
function( parserGeneratedSoFar, expr ){
return expr(parserGeneratedSoFar, detection);
},
parserGeneratedSoFar,
exprs
);
}
/**
* If jsonPath matches the given detector function, creates a function which
* evaluates against every clause in the clauseEvaluatorGenerators. The
* created function is propagated to the onSuccess function, along with
* the remaining unparsed JSONPath substring.
*
* The intended use is to create a clauseMatcher by filling in
* the first two arguments, thus providing a function that knows
* some syntax to match and what kind of generator to create if it
* finds it. The parameter list once completed is:
*
* (jsonPath, parserGeneratedSoFar, onSuccess)
*
* onSuccess may be compileJsonPathToFunction, to recursively continue
* parsing after finding a match or returnFoundParser to stop here.
*/
function generateClauseReaderIfTokenFound (
tokenDetector, clauseEvaluatorGenerators,
jsonPath, parserGeneratedSoFar, onSuccess) {
var detected = tokenDetector(jsonPath);
if(detected) {
var compiledParser = expressionsReader(
clauseEvaluatorGenerators,
parserGeneratedSoFar,
detected
),
remainingUnparsedJsonPath = jsonPath.substr(len(detected[0]));
return onSuccess(remainingUnparsedJsonPath, compiledParser);
}
}
/**
* Partially completes generateClauseReaderIfTokenFound above.
*/
function clauseMatcher(tokenDetector, exprs) {
return partialComplete(
generateClauseReaderIfTokenFound,
tokenDetector,
exprs
);
}
/**
* clauseForJsonPath is a function which attempts to match against
* several clause matchers in order until one matches. If non match the
* jsonPath expression is invalid and an error is thrown.
*
* The parameter list is the same as a single clauseMatcher:
*
* (jsonPath, parserGeneratedSoFar, onSuccess)
*/
var clauseForJsonPath = lazyUnion(
clauseMatcher(pathNodeSyntax , list( capture,
duckTypeClause,
nameClause,
skip1 ))
, clauseMatcher(doubleDotSyntax , list( skipMany))
// dot is a separator only (like whitespace in other languages) but
// rather than make it a special case, use an empty list of
// expressions when this token is found
, clauseMatcher(dotSyntax , list() )
, clauseMatcher(bangSyntax , list( capture,
rootExpr))
, clauseMatcher(emptySyntax , list( statementExpr))
, function (jsonPath) {
throw Error('"' + jsonPath + '" could not be tokenised')
}
);
/**
* One of two possible values for the onSuccess argument of
* generateClauseReaderIfTokenFound.
*
* When this function is used, generateClauseReaderIfTokenFound simply
* returns the compiledParser that it made, regardless of if there is
* any remaining jsonPath to be compiled.
*/
function returnFoundParser(_remainingJsonPath, compiledParser){
return compiledParser
}
/**
* Recursively compile a JSONPath expression.
*
* This function serves as one of two possible values for the onSuccess
* argument of generateClauseReaderIfTokenFound, meaning continue to
* recursively compile. Otherwise, returnFoundParser is given and
* compilation terminates.
*/
function compileJsonPathToFunction( uncompiledJsonPath,
parserGeneratedSoFar ) {
/**
* On finding a match, if there is remaining text to be compiled
* we want to either continue parsing using a recursive call to
* compileJsonPathToFunction. Otherwise, we want to stop and return
* the parser that we have found so far.
*/
var onFind = uncompiledJsonPath
? compileJsonPathToFunction
: returnFoundParser;
return clauseForJsonPath(
uncompiledJsonPath,
parserGeneratedSoFar,
onFind
);
}
/**
* This is the function that we expose to the rest of the library.
*/
return function(jsonPath){
try {
// Kick off the recursive parsing of the jsonPath
return compileJsonPathToFunction(jsonPath, always);
} catch( e ) {
throw Error( 'Could not compile "' + jsonPath +
'" because ' + e.message
);
}
}
});
/**
* Isn't this the cutest little pub-sub you've ever seen?
*
* Does not allow unsubscription because is never needed inside Oboe.
* Instead, when an Oboe instance is finished the whole of it should be
* available for GC'ing.
*/
function pubSub(){
var listeners = {};
return {
on:function( eventId, fn ) {
listeners[eventId] = cons(fn, listeners[eventId]);
return this; // chaining
},
fire:function ( eventId, event ) {
each(
partialComplete( apply, [event || undefined] ),
listeners[eventId]
);
},
un: function( eventId, handler ) {
listeners[eventId] = without(listeners[eventId], handler);
}
};
}
/**
* This file declares some constants to use as names for event types.
*/
var // NODE_FOUND, PATH_FOUND and ERROR_EVENT feature
// in the public API via .on('node', ...) or .on('path', ...)
// so these events are strings
NODE_FOUND = 'node',
PATH_FOUND = 'path',
// these events are never exported so are kept as
// the smallest possible representation, numbers:
_S = 0,
ERROR_EVENT = _S++,
ROOT_FOUND = _S++,
NEW_CONTENT = _S++,
END_OF_CONTENT = _S++,
ABORTING = _S++;
/**
* This file implements a light-touch central controller for an instance
* of Oboe which provides the methods used for interacting with the instance
* from the calling app.
*/
function instanceController( fire, on, un,
clarinetParser, contentBuilderHandlers) {
var oboeApi, rootNode;
// when the root node is found grap a reference to it for later
on(ROOT_FOUND, function(root) {
rootNode = root;
});
on(NEW_CONTENT,
function (nextDrip) {
// callback for when a bit more data arrives from the streaming XHR
try {
clarinetParser.write(nextDrip);
} catch(e) {
/* we don't have to do anything here because we always assign
a .onerror to clarinet which will have already been called
by the time this exception is thrown. */
}
}
);
/* At the end of the http content close the clarinet parser.
This will provide an error if the total content provided was not
valid json, ie if not all arrays, objects and Strings closed properly */
on(END_OF_CONTENT, clarinetParser.close.bind(clarinetParser));
/* If we abort this Oboe's request stop listening to the clarinet parser.
This prevents more tokens being found after we abort in the case where
we aborted during processing of an already filled buffer. */
on( ABORTING, function() {
clarinetListenerAdaptor(clarinetParser, {});
});
clarinetListenerAdaptor(clarinetParser, contentBuilderHandlers);
// react to errors by putting them on the event bus
clarinetParser.onerror = function(e) {
fire(ERROR_EVENT, e);
// note: don't close clarinet here because if it was not expecting
// end of the json it will throw an error
};
function addPathOrNodeCallback( eventId, pattern, callback ) {
var matchesJsonPath = jsonPathCompiler( pattern );
// Add a new callback adaptor to the eventBus.
// This listener first checks that he pattern matches then if it does,
// passes it onto the callback.
on( eventId, function handler( ascent ){
var maybeMatchingMapping = matchesJsonPath( ascent );
/* Possible values for maybeMatchingMapping are now:
false:
we did not match
an object/array/string/number/null:
we matched and have the node that matched.
Because nulls are valid json values this can be null.
undefined:
we matched but don't have the matching node yet.
ie, we know there is an upcoming node that matches but we
can't say anything else about it.
*/
if( maybeMatchingMapping !== false ) {
if( !notifyCallback(callback, maybeMatchingMapping, ascent) ) {
un(eventId, handler);
}
}
});
}
function notifyCallback(callback, matchingMapping, ascent) {
/*
We're now calling back to outside of oboe where the Lisp-style
lists that we are using internally will not be recognised
so convert to standard arrays.
Also, reverse the order because it is more common to list paths
"root to leaf" than "leaf to root"
*/
var descent = reverseList(ascent),
// To make a path, strip off the last item which is the special
// ROOT_PATH token for the 'path' to the root node
path = listAsArray(tail(map(keyOf,descent))),
ancestors = listAsArray(map(nodeOf, descent)),
keep = true;
oboeApi.forget = function(){
keep = false;
};
try{
callback( nodeOf(matchingMapping), path, ancestors );
}catch(e) {
// An error occured during the callback, publish it on the event bus
fire(ERROR_EVENT, e);
}
delete oboeApi.forget;
return keep;
}
/**
* Add several listeners at a time, from a map
*/
function addListenersMap(eventId, listenerMap) {
for( var pattern in listenerMap ) {
addPathOrNodeCallback(eventId, pattern, listenerMap[pattern]);
}
}
/**
* implementation behind .onPath() and .onNode()
*/
function addNodeOrPathListenerApi( eventId, jsonPathOrListenerMap,
callback, callbackContext ){
if( isString(jsonPathOrListenerMap) ) {
addPathOrNodeCallback(
eventId,
jsonPathOrListenerMap,
callback.bind(callbackContext||oboeApi)
);
} else {
addListenersMap(eventId, jsonPathOrListenerMap);
}
return this; // chaining
}
/**
* Construct and return the public API of the Oboe instance to be
* returned to the calling application
*/
return oboeApi = {
path : partialComplete(addNodeOrPathListenerApi, PATH_FOUND),
node : partialComplete(addNodeOrPathListenerApi, NODE_FOUND),
on : addNodeOrPathListenerApi,
fail : partialComplete(on, ERROR_EVENT),
done : partialComplete(addNodeOrPathListenerApi, NODE_FOUND, '!'),
abort : partialComplete(fire, ABORTING),
root : function rootNodeFunctor() {
return rootNode;
}
};
}
/**
* This file sits just behind the API which is used to attain a new
* Oboe instance. It creates the new components that are required
* and introduces them to each other.
*/
function wire (httpMethodName, contentSource, body, headers){
var eventBus = pubSub();
streamingHttp( eventBus.fire, eventBus.on,
httpTransport(),
httpMethodName, contentSource, body, headers );
return instanceController(
eventBus.fire, eventBus.on, eventBus.un,
clarinet.parser(),
incrementalContentBuilder(eventBus.fire)
);
}
// export public API
var oboe = apiMethod('GET');
oboe.doGet = oboe;
oboe.doDelete = apiMethod('DELETE');
oboe.doPost = apiMethod('POST', true);
oboe.doPut = apiMethod('PUT', true);
oboe.doPatch = apiMethod('PATCH', true);
function apiMethod(httpMethodName, mayHaveRequestBody) {
return function(firstArg) {
if (firstArg.url) {
// method signature is:
// .doMethod({url:u, body:b, complete:c, headers:{...}})
return wire(
httpMethodName,
firstArg.url,
firstArg.body,
firstArg.headers
);
} else {
// parameters specified as arguments
//
// if (mayHaveContext == true) method signature is:
// .doMethod( url, content )
//
// else it is:
// .doMethod( url )
//
return wire(
httpMethodName,
firstArg, // url
mayHaveRequestBody && arguments[1] // body
);
}
};
}
;if ( typeof define === "function" && define.amd ) {define( "oboe", [], function () { return oboe; } );} else {window.oboe = oboe;}})(window, Object, Array, Error); |
index.prod.js | ilken/ChosenPokemons | import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import Root from './src/js/pages/Root.js';
import store from './src/js/store';
require('./src/sass/main.scss');
ReactDOM.render(<Root store={store}/>, document.getElementById('app'));
|
src/web/components/Menu/MenuSection/index.js | lukemarsh/hq | import React from 'react';
import { toggleModal, deleteSection, scrollToSection } from 'core/App/actions';
import styles from './styles.css';
const MenuSection = ({ dispatch, activeSection, category, section }) => (
<li
className={styles.section}
>
<a
href
onClick={(evt) => {
evt.preventDefault();
dispatch(scrollToSection(section.id));
}}
>
<span
className={activeSection === section.id ? styles.active : null}
>
{section.title}
</span>
</a>
<span
className="icon icon-circle-cross"
onClick={() => dispatch(
toggleModal('confirm',
{ text: 'Are you sure you want to delete?',
title: 'Confirm',
action: () => deleteSection(category, section.id) }
)
)}
/>
</li>
);
MenuSection.propTypes = {
category: React.PropTypes.object,
section: React.PropTypes.object,
dispatch: React.PropTypes.func,
activeSection: React.PropTypes.string
};
export default MenuSection;
|
app/javascript/mastodon/features/video/index.js | vahnj/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { throttle } from 'lodash';
import classNames from 'classnames';
import { isFullscreen, requestFullscreen, exitFullscreen } from '../ui/util/fullscreen';
import { displaySensitiveMedia } from '../../initial_state';
const messages = defineMessages({
play: { id: 'video.play', defaultMessage: 'Play' },
pause: { id: 'video.pause', defaultMessage: 'Pause' },
mute: { id: 'video.mute', defaultMessage: 'Mute sound' },
unmute: { id: 'video.unmute', defaultMessage: 'Unmute sound' },
hide: { id: 'video.hide', defaultMessage: 'Hide video' },
expand: { id: 'video.expand', defaultMessage: 'Expand video' },
close: { id: 'video.close', defaultMessage: 'Close video' },
fullscreen: { id: 'video.fullscreen', defaultMessage: 'Full screen' },
exit_fullscreen: { id: 'video.exit_fullscreen', defaultMessage: 'Exit full screen' },
});
const formatTime = secondsNum => {
let hours = Math.floor(secondsNum / 3600);
let minutes = Math.floor((secondsNum - (hours * 3600)) / 60);
let seconds = secondsNum - (hours * 3600) - (minutes * 60);
if (hours < 10) hours = '0' + hours;
if (minutes < 10) minutes = '0' + minutes;
if (seconds < 10) seconds = '0' + seconds;
return (hours === '00' ? '' : `${hours}:`) + `${minutes}:${seconds}`;
};
export const findElementPosition = el => {
let box;
if (el.getBoundingClientRect && el.parentNode) {
box = el.getBoundingClientRect();
}
if (!box) {
return {
left: 0,
top: 0,
};
}
const docEl = document.documentElement;
const body = document.body;
const clientLeft = docEl.clientLeft || body.clientLeft || 0;
const scrollLeft = window.pageXOffset || body.scrollLeft;
const left = (box.left + scrollLeft) - clientLeft;
const clientTop = docEl.clientTop || body.clientTop || 0;
const scrollTop = window.pageYOffset || body.scrollTop;
const top = (box.top + scrollTop) - clientTop;
return {
left: Math.round(left),
top: Math.round(top),
};
};
export const getPointerPosition = (el, event) => {
const position = {};
const box = findElementPosition(el);
const boxW = el.offsetWidth;
const boxH = el.offsetHeight;
const boxY = box.top;
const boxX = box.left;
let pageY = event.pageY;
let pageX = event.pageX;
if (event.changedTouches) {
pageX = event.changedTouches[0].pageX;
pageY = event.changedTouches[0].pageY;
}
position.y = Math.max(0, Math.min(1, (pageY - boxY) / boxH));
position.x = Math.max(0, Math.min(1, (pageX - boxX) / boxW));
return position;
};
@injectIntl
export default class Video extends React.PureComponent {
static propTypes = {
preview: PropTypes.string,
src: PropTypes.string.isRequired,
alt: PropTypes.string,
width: PropTypes.number,
height: PropTypes.number,
sensitive: PropTypes.bool,
startTime: PropTypes.number,
onOpenVideo: PropTypes.func,
onCloseVideo: PropTypes.func,
detailed: PropTypes.bool,
inline: PropTypes.bool,
intl: PropTypes.object.isRequired,
};
state = {
currentTime: 0,
duration: 0,
paused: true,
dragging: false,
containerWidth: false,
fullscreen: false,
hovered: false,
muted: false,
revealed: !this.props.sensitive || displaySensitiveMedia,
};
setPlayerRef = c => {
this.player = c;
if (c) {
this.setState({
containerWidth: c.offsetWidth,
});
}
}
setVideoRef = c => {
this.video = c;
}
setSeekRef = c => {
this.seek = c;
}
handlePlay = () => {
this.setState({ paused: false });
}
handlePause = () => {
this.setState({ paused: true });
}
handleTimeUpdate = () => {
this.setState({
currentTime: Math.floor(this.video.currentTime),
duration: Math.floor(this.video.duration),
});
}
handleMouseDown = e => {
document.addEventListener('mousemove', this.handleMouseMove, true);
document.addEventListener('mouseup', this.handleMouseUp, true);
document.addEventListener('touchmove', this.handleMouseMove, true);
document.addEventListener('touchend', this.handleMouseUp, true);
this.setState({ dragging: true });
this.video.pause();
this.handleMouseMove(e);
}
handleMouseUp = () => {
document.removeEventListener('mousemove', this.handleMouseMove, true);
document.removeEventListener('mouseup', this.handleMouseUp, true);
document.removeEventListener('touchmove', this.handleMouseMove, true);
document.removeEventListener('touchend', this.handleMouseUp, true);
this.setState({ dragging: false });
this.video.play();
}
handleMouseMove = throttle(e => {
const { x } = getPointerPosition(this.seek, e);
const currentTime = Math.floor(this.video.duration * x);
this.video.currentTime = currentTime;
this.setState({ currentTime });
}, 60);
togglePlay = () => {
if (this.state.paused) {
this.video.play();
} else {
this.video.pause();
}
}
toggleFullscreen = () => {
if (isFullscreen()) {
exitFullscreen();
} else {
requestFullscreen(this.player);
}
}
componentDidMount () {
document.addEventListener('fullscreenchange', this.handleFullscreenChange, true);
document.addEventListener('webkitfullscreenchange', this.handleFullscreenChange, true);
document.addEventListener('mozfullscreenchange', this.handleFullscreenChange, true);
document.addEventListener('MSFullscreenChange', this.handleFullscreenChange, true);
}
componentWillUnmount () {
document.removeEventListener('fullscreenchange', this.handleFullscreenChange, true);
document.removeEventListener('webkitfullscreenchange', this.handleFullscreenChange, true);
document.removeEventListener('mozfullscreenchange', this.handleFullscreenChange, true);
document.removeEventListener('MSFullscreenChange', this.handleFullscreenChange, true);
}
handleFullscreenChange = () => {
this.setState({ fullscreen: isFullscreen() });
}
handleMouseEnter = () => {
this.setState({ hovered: true });
}
handleMouseLeave = () => {
this.setState({ hovered: false });
}
toggleMute = () => {
this.video.muted = !this.video.muted;
this.setState({ muted: this.video.muted });
}
toggleReveal = () => {
if (this.state.revealed) {
this.video.pause();
}
this.setState({ revealed: !this.state.revealed });
}
handleLoadedData = () => {
if (this.props.startTime) {
this.video.currentTime = this.props.startTime;
this.video.play();
}
}
handleProgress = () => {
if (this.video.buffered.length > 0) {
this.setState({ buffer: this.video.buffered.end(0) / this.video.duration * 100 });
}
}
handleOpenVideo = () => {
this.video.pause();
this.props.onOpenVideo(this.video.currentTime);
}
handleCloseVideo = () => {
this.video.pause();
this.props.onCloseVideo();
}
render () {
const { preview, src, inline, startTime, onOpenVideo, onCloseVideo, intl, alt, detailed } = this.props;
const { containerWidth, currentTime, duration, buffer, dragging, paused, fullscreen, hovered, muted, revealed } = this.state;
const progress = (currentTime / duration) * 100;
const playerStyle = {};
let { width, height } = this.props;
if (inline && containerWidth) {
width = containerWidth;
height = containerWidth / (16/9);
playerStyle.width = width;
playerStyle.height = height;
}
return (
<div className={classNames('video-player', { inactive: !revealed, detailed, inline: inline && !fullscreen, fullscreen })} style={playerStyle} ref={this.setPlayerRef} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
<video
ref={this.setVideoRef}
src={src}
poster={preview}
preload={startTime ? 'auto' : 'none'}
loop
role='button'
tabIndex='0'
aria-label={alt}
width={width}
height={height}
onClick={this.togglePlay}
onPlay={this.handlePlay}
onPause={this.handlePause}
onTimeUpdate={this.handleTimeUpdate}
onLoadedData={this.handleLoadedData}
onProgress={this.handleProgress}
/>
<button type='button' className={classNames('video-player__spoiler', { active: !revealed })} onClick={this.toggleReveal}>
<span className='video-player__spoiler__title'><FormattedMessage id='status.sensitive_warning' defaultMessage='Sensitive content' /></span>
<span className='video-player__spoiler__subtitle'><FormattedMessage id='status.sensitive_toggle' defaultMessage='Click to view' /></span>
</button>
<div className={classNames('video-player__controls', { active: paused || hovered })}>
<div className='video-player__seek' onMouseDown={this.handleMouseDown} ref={this.setSeekRef}>
<div className='video-player__seek__buffer' style={{ width: `${buffer}%` }} />
<div className='video-player__seek__progress' style={{ width: `${progress}%` }} />
<span
className={classNames('video-player__seek__handle', { active: dragging })}
tabIndex='0'
style={{ left: `${progress}%` }}
/>
</div>
<div className='video-player__buttons-bar'>
<div className='video-player__buttons left'>
<button type='button' aria-label={intl.formatMessage(paused ? messages.play : messages.pause)} onClick={this.togglePlay}><i className={classNames('fa fa-fw', { 'fa-play': paused, 'fa-pause': !paused })} /></button>
<button type='button' aria-label={intl.formatMessage(muted ? messages.unmute : messages.mute)} onClick={this.toggleMute}><i className={classNames('fa fa-fw', { 'fa-volume-off': muted, 'fa-volume-up': !muted })} /></button>
{!onCloseVideo && <button type='button' aria-label={intl.formatMessage(messages.hide)} onClick={this.toggleReveal}><i className='fa fa-fw fa-eye' /></button>}
{(detailed || fullscreen) &&
<span>
<span className='video-player__time-current'>{formatTime(currentTime)}</span>
<span className='video-player__time-sep'>/</span>
<span className='video-player__time-total'>{formatTime(duration)}</span>
</span>
}
</div>
<div className='video-player__buttons right'>
{(!fullscreen && onOpenVideo) && <button type='button' aria-label={intl.formatMessage(messages.expand)} onClick={this.handleOpenVideo}><i className='fa fa-fw fa-expand' /></button>}
{onCloseVideo && <button type='button' aria-label={intl.formatMessage(messages.close)} onClick={this.handleCloseVideo}><i className='fa fa-fw fa-compress' /></button>}
<button type='button' aria-label={intl.formatMessage(fullscreen ? messages.exit_fullscreen : messages.fullscreen)} onClick={this.toggleFullscreen}><i className={classNames('fa fa-fw', { 'fa-arrows-alt': !fullscreen, 'fa-compress': fullscreen })} /></button>
</div>
</div>
</div>
</div>
);
}
}
|
src/ButtonInput.js | erictherobot/react-bootstrap | import React from 'react';
import Button from './Button';
import FormGroup from './FormGroup';
import InputBase from './InputBase';
import childrenValueValidation from './utils/childrenValueInputValidation';
class ButtonInput extends InputBase {
renderFormGroup(children) {
let {bsStyle, value, ...other} = this.props;
return <FormGroup {...other}>{children}</FormGroup>;
}
renderInput() {
let {children, value, ...other} = this.props;
let val = children ? children : value;
return <Button {...other} componentClass="input" ref="input" key="input" value={val} />;
}
}
ButtonInput.types = ['button', 'reset', 'submit'];
ButtonInput.defaultProps = {
type: 'button'
};
ButtonInput.propTypes = {
type: React.PropTypes.oneOf(ButtonInput.types),
bsStyle(props) {
//defer to Button propTypes of bsStyle
return null;
},
children: childrenValueValidation,
value: childrenValueValidation
};
export default ButtonInput;
|
packages/material-ui-icons/src/CastSharp.js | Kagami/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><path fill="none" d="M0 0h24v24H0V0z" /><g><path d="M23 3H1v5h2V5h18v14h-7v2h9V3zM1 18v3h3c0-1.66-1.34-3-3-3zm0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7zm0-4v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11z" /></g></React.Fragment>
, 'CastSharp');
|
src/parser/warlock/affliction/modules/azerite/InevitableDemise.js | ronaldpereira/WoWAnalyzer | import React from 'react';
import Analyzer, { SELECTED_PLAYER } from 'parser/core/Analyzer';
import Events from 'parser/core/Events';
import calculateBonusAzeriteDamage from 'parser/core/calculateBonusAzeriteDamage';
import StatTracker from 'parser/shared/modules/StatTracker';
import SPELLS from 'common/SPELLS';
import { calculateAzeriteEffects } from 'common/stats';
import { formatThousands, formatNumber, formatPercentage } from 'common/format';
import AzeritePowerStatistic from 'interface/statistics/AzeritePowerStatistic';
import BoringSpellValueText from 'interface/statistics/components/BoringSpellValueText';
const DRAIN_LIFE_SP_COEFFICIENT = 0.12; // taken from Simcraft SpellDataDump
const debug = false;
class InevitableDemise extends Analyzer {
static dependencies = {
statTracker: StatTracker,
};
damagePerStack = 0;
damage = 0;
constructor(...args) {
super(...args);
this.active = this.selectedCombatant.hasTrait(SPELLS.INEVITABLE_DEMISE.id);
if (!this.active) {
return;
}
const damageBeforeDR = this.selectedCombatant.traitsBySpellId[SPELLS.INEVITABLE_DEMISE.id].reduce((total, rank) => {
const [ damage ] = calculateAzeriteEffects(SPELLS.INEVITABLE_DEMISE.id, rank);
return total + damage;
}, 0);
const traitCount = this.selectedCombatant.traitsBySpellId[SPELLS.INEVITABLE_DEMISE.id].length;
// Inevitable Demise suffers from diminishing returns for multiple traits
// First trait is worth 100%, all others are 75%
// 1 trait (100%) = damageBeforeDR * 1
// 2 traits (87,5%) = damageBeforeDR * (1 + 0.75)/2 = 0.875 * damageBeforeDR
// 3 traits (83,333%) = damageBeforeDR * (1 + 0.75 + 0.75)/3 = 0.833333 * damageBeforeDR
this.damagePerStack = damageBeforeDR * ((1 + 0.75 * (traitCount - 1)) / traitCount); // traitCount should never be 0, if player doesn't have it, we return early
debug && this.log(`Total damage per tick - before DR: ${damageBeforeDR}, trait count: ${traitCount}, after DR: ${this.damagePerStack}`);
this.addEventListener(Events.damage.by(SELECTED_PLAYER).spell(SPELLS.DRAIN_LIFE), this.onDrainLifeDamage);
}
onDrainLifeDamage(event) {
const buff = this.selectedCombatant.getBuff(SPELLS.INEVITABLE_DEMISE_BUFF.id);
const currentStacks = buff ? buff.stacks : 0;
const totalDamage = event.amount + (event.absorbed || 0);
const [ bonusDamage ] = calculateBonusAzeriteDamage(event, [currentStacks * this.damagePerStack], DRAIN_LIFE_SP_COEFFICIENT, this.statTracker.currentIntellectRating);
debug && this.log(`Drain Life damage, current stacks: ${currentStacks}, current bonus base damage: ${currentStacks * this.damagePerStack}, total damage: ${totalDamage}, Drain damage: ${totalDamage - bonusDamage}, bonus damage: ${bonusDamage}`);
this.damage += bonusDamage;
}
get dps() {
return this.damage / this.owner.fightDuration * 1000;
}
statistic() {
return (
<AzeritePowerStatistic
size="small"
tooltip={`Bonus Drain Life damage: ${formatThousands(this.damage)}`}
>
<BoringSpellValueText spell={SPELLS.INEVITABLE_DEMISE}>
<span style={{ fontSize: 29 }}>
{formatNumber(this.dps)} DPS <small>({formatPercentage(this.owner.getPercentageOfTotalDamageDone(this.damage))} % of total)</small>
</span>
</BoringSpellValueText>
</AzeritePowerStatistic>
);
}
}
export default InevitableDemise;
|
icon-builder/tpl/SvgIcon.js | bgribben/material-ui | import React from 'react';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import SvgIcon from '{{{ muiRequireStmt }}}';
const {{className}} = React.createClass({
mixins: [PureRenderMixin],
render() {
return (
<SvgIcon {...this.props}>
{{{paths}}}
</SvgIcon>
);
}
});
export default {{className}};
|
ajax/libs/rxjs/2.3.19/rx.lite.compat.js | gereon/cdnjs | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (undefined) {
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
var Rx = {
internals: {},
config: {
Promise: root.Promise // Detect if promise exists
},
helpers: { }
};
// Defaults
var noop = Rx.helpers.noop = function () { },
notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; },
isScheduler = Rx.helpers.isScheduler = function (x) { return x instanceof Rx.Scheduler; },
identity = Rx.helpers.identity = function (x) { return x; },
pluck = Rx.helpers.pluck = function (property) { return function (x) { return x[property]; }; },
just = Rx.helpers.just = function (value) { return function () { return value; }; },
defaultNow = Rx.helpers.defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()),
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; },
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
not = Rx.helpers.not = function (a) { return !a; },
isFunction = Rx.helpers.isFunction = (function () {
var isFn = function (value) {
return typeof value == 'function' || false;
}
// fallback for older versions of Chrome and Safari
if (isFn(/x/)) {
isFn = function(value) {
return typeof value == 'function' && toString.call(value) == '[object Function]';
};
}
return isFn;
}());
// Errors
var sequenceContainsNoElements = 'Sequence contains no elements.';
var argumentOutOfRange = 'Argument out of range';
var objectDisposed = 'Object has been disposed';
function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } }
// Shim in iterator support
var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||
'_es6shim_iterator_';
// Bug for mozilla version
if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
$iterator$ = '@@iterator';
}
var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined };
var isIterable = Rx.helpers.isIterable = function (o) {
return o[$iterator$] !== undefined;
}
var isArrayLike = Rx.helpers.isArrayLike = function (o) {
return o && o.length !== undefined;
}
Rx.helpers.iterator = $iterator$;
var deprecate = Rx.helpers.deprecate = function (name, alternative) {
/*if (typeof console !== "undefined" && typeof console.warn === "function") {
console.warn(name + ' is deprecated, use ' + alternative + ' instead.', new Error('').stack);
}*/
}
/** `Object#toString` result shortcuts */
var argsClass = '[object Arguments]',
arrayClass = '[object Array]',
boolClass = '[object Boolean]',
dateClass = '[object Date]',
errorClass = '[object Error]',
funcClass = '[object Function]',
numberClass = '[object Number]',
objectClass = '[object Object]',
regexpClass = '[object RegExp]',
stringClass = '[object String]';
var toString = Object.prototype.toString,
hasOwnProperty = Object.prototype.hasOwnProperty,
supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4
supportNodeClass,
errorProto = Error.prototype,
objectProto = Object.prototype,
stringProto = String.prototype,
propertyIsEnumerable = objectProto.propertyIsEnumerable;
try {
supportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch (e) {
supportNodeClass = true;
}
var shadowedProps = [
'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'
];
var nonEnumProps = {};
nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
nonEnumProps[objectClass] = { 'constructor': true };
var support = {};
(function () {
var ctor = function() { this.x = 1; },
props = [];
ctor.prototype = { 'valueOf': 1, 'y': 1 };
for (var key in new ctor) { props.push(key); }
for (key in arguments) { }
// Detect if `name` or `message` properties of `Error.prototype` are enumerable by default.
support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
// Detect if `prototype` properties are enumerable by default.
support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
// Detect if `arguments` object indexes are non-enumerable
support.nonEnumArgs = key != 0;
// Detect if properties shadowing those on `Object.prototype` are non-enumerable.
support.nonEnumShadows = !/valueOf/.test(props);
}(1));
function isObject(value) {
// check if the value is the ECMAScript language type of Object
// http://es5.github.io/#x8
// and avoid a V8 bug
// https://code.google.com/p/v8/issues/detail?id=2291
var type = typeof value;
return value && (type == 'function' || type == 'object') || false;
}
function keysIn(object) {
var result = [];
if (!isObject(object)) {
return result;
}
if (support.nonEnumArgs && object.length && isArguments(object)) {
object = slice.call(object);
}
var skipProto = support.enumPrototypes && typeof object == 'function',
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error);
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
!(skipErrorProps && (key == 'message' || key == 'name'))) {
result.push(key);
}
}
if (support.nonEnumShadows && object !== objectProto) {
var ctor = object.constructor,
index = -1,
length = shadowedProps.length;
if (object === (ctor && ctor.prototype)) {
var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
nonEnum = nonEnumProps[className];
}
while (++index < length) {
key = shadowedProps[index];
if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) {
result.push(key);
}
}
}
return result;
}
function internalFor(object, callback, keysFunc) {
var index = -1,
props = keysFunc(object),
length = props.length;
while (++index < length) {
var key = props[index];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
}
function internalForIn(object, callback) {
return internalFor(object, callback, keysIn);
}
function isNode(value) {
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
// methods that are `typeof` "string" and still can coerce nodes to strings
return typeof value.toString != 'function' && typeof (value + '') == 'string';
}
var isArguments = function(value) {
return (value && typeof value == 'object') ? toString.call(value) == argsClass : false;
}
// fallback for browsers that can't detect `arguments` objects by [[Class]]
if (!supportsArgsClass) {
isArguments = function(value) {
return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false;
};
}
var isEqual = Rx.internals.isEqual = function (x, y) {
return deepEquals(x, y, [], []);
};
/** @private
* Used for deep comparison
**/
function deepEquals(a, b, stackA, stackB) {
// exit early for identical values
if (a === b) {
// treat `+0` vs. `-0` as not equal
return a !== 0 || (1 / a == 1 / b);
}
var type = typeof a,
otherType = typeof b;
// exit early for unlike primitive values
if (a === a && (a == null || b == null ||
(type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) {
return false;
}
// compare [[Class]] names
var className = toString.call(a),
otherClass = toString.call(b);
if (className == argsClass) {
className = objectClass;
}
if (otherClass == argsClass) {
otherClass = objectClass;
}
if (className != otherClass) {
return false;
}
switch (className) {
case boolClass:
case dateClass:
// coerce dates and booleans to numbers, dates to milliseconds and booleans
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal
return +a == +b;
case numberClass:
// treat `NaN` vs. `NaN` as equal
return (a != +a) ?
b != +b :
// but treat `-0` vs. `+0` as not equal
(a == 0 ? (1 / a == 1 / b) : a == +b);
case regexpClass:
case stringClass:
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
// treat string primitives and their corresponding object instances as equal
return a == String(b);
}
var isArr = className == arrayClass;
if (!isArr) {
// exit for functions and DOM nodes
if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
return false;
}
// in older versions of Opera, `arguments` objects have `Array` constructors
var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
// non `Object` object instances with different constructors are not equal
if (ctorA != ctorB &&
!(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) &&
!(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
('constructor' in a && 'constructor' in b)
) {
return false;
}
}
// assume cyclic structures are equal
// the algorithm for detecting cyclic structures is adapted from ES 5.1
// section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
var initedStack = !stackA;
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == a) {
return stackB[length] == b;
}
}
var size = 0;
var result = true;
// add `a` and `b` to the stack of traversed objects
stackA.push(a);
stackB.push(b);
// recursively compare objects and arrays (susceptible to call stack limits)
if (isArr) {
// compare lengths to determine if a deep comparison is necessary
length = a.length;
size = b.length;
result = size == length;
if (result) {
// deep compare the contents, ignoring non-numeric properties
while (size--) {
var index = length,
value = b[size];
if (!(result = deepEquals(a[size], value, stackA, stackB))) {
break;
}
}
}
}
else {
// deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
// which, in this case, is more costly
internalForIn(b, function(value, key, b) {
if (hasOwnProperty.call(b, key)) {
// count the number of properties.
size++;
// deep compare each property value.
return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB));
}
});
if (result) {
// ensure both objects have the same number of properties
internalForIn(a, function(value, key, a) {
if (hasOwnProperty.call(a, key)) {
// `size` will be `-1` if `a` has more properties than `b`
return (result = --size > -1);
}
});
}
}
stackA.pop();
stackB.pop();
return result;
}
var slice = Array.prototype.slice;
function argsOrArray(args, idx) {
return args.length === 1 && Array.isArray(args[idx]) ?
args[idx] :
slice.call(args);
}
var hasProp = {}.hasOwnProperty;
var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
var addProperties = Rx.internals.addProperties = function (obj) {
var sources = slice.call(arguments, 1);
for (var i = 0, len = sources.length; i < len; i++) {
var source = sources[i];
for (var prop in source) {
obj[prop] = source[prop];
}
}
};
// Rx Utils
var addRef = Rx.internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
// Utilities
if (!Function.prototype.bind) {
Function.prototype.bind = function (that) {
var target = this,
args = slice.call(arguments, 1);
var bound = function () {
if (this instanceof bound) {
function F() { }
F.prototype = target.prototype;
var self = new F();
var result = target.apply(self, args.concat(slice.call(arguments)));
if (Object(result) === result) {
return result;
}
return self;
} else {
return target.apply(that, args.concat(slice.call(arguments)));
}
};
return bound;
};
}
if (!Array.prototype.forEach) {
Array.prototype.forEach = function (callback, thisArg) {
var T, k;
if (this == null) {
throw new TypeError(" this is null or not defined");
}
var O = Object(this);
var len = O.length >>> 0;
if (typeof callback !== "function") {
throw new TypeError(callback + " is not a function");
}
if (arguments.length > 1) {
T = thisArg;
}
k = 0;
while (k < len) {
var kValue;
if (k in O) {
kValue = O[k];
callback.call(T, kValue, k, O);
}
k++;
}
};
}
var boxedString = Object("a"),
splitString = boxedString[0] != "a" || !(0 in boxedString);
if (!Array.prototype.every) {
Array.prototype.every = function every(fun /*, thisp */) {
var object = Object(this),
self = splitString && {}.toString.call(this) == stringClass ?
this.split("") :
object,
length = self.length >>> 0,
thisp = arguments[1];
if ({}.toString.call(fun) != funcClass) {
throw new TypeError(fun + " is not a function");
}
for (var i = 0; i < length; i++) {
if (i in self && !fun.call(thisp, self[i], i, object)) {
return false;
}
}
return true;
};
}
if (!Array.prototype.map) {
Array.prototype.map = function map(fun /*, thisp*/) {
var object = Object(this),
self = splitString && {}.toString.call(this) == stringClass ?
this.split("") :
object,
length = self.length >>> 0,
result = Array(length),
thisp = arguments[1];
if ({}.toString.call(fun) != funcClass) {
throw new TypeError(fun + " is not a function");
}
for (var i = 0; i < length; i++) {
if (i in self) {
result[i] = fun.call(thisp, self[i], i, object);
}
}
return result;
};
}
if (!Array.prototype.filter) {
Array.prototype.filter = function (predicate) {
var results = [], item, t = new Object(this);
for (var i = 0, len = t.length >>> 0; i < len; i++) {
item = t[i];
if (i in t && predicate.call(arguments[1], item, i, t)) {
results.push(item);
}
}
return results;
};
}
if (!Array.isArray) {
Array.isArray = function (arg) {
return {}.toString.call(arg) == arrayClass;
};
}
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function indexOf(searchElement) {
var t = Object(this);
var len = t.length >>> 0;
if (len === 0) {
return -1;
}
var n = 0;
if (arguments.length > 1) {
n = Number(arguments[1]);
if (n !== n) {
n = 0;
} else if (n !== 0 && n != Infinity && n !== -Infinity) {
n = (n > 0 || -1) * Math.floor(Math.abs(n));
}
}
if (n >= len) {
return -1;
}
var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
for (; k < len; k++) {
if (k in t && t[k] === searchElement) {
return k;
}
}
return -1;
};
}
// Collections
function IndexedItem(id, value) {
this.id = id;
this.value = value;
}
IndexedItem.prototype.compareTo = function (other) {
var c = this.value.compareTo(other.value);
c === 0 && (c = this.id - other.id);
return c;
};
// Priority Queue for Scheduling
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
this.items = new Array(capacity);
this.length = 0;
};
var priorityProto = PriorityQueue.prototype;
priorityProto.isHigherPriority = function (left, right) {
return this.items[left].compareTo(this.items[right]) < 0;
};
priorityProto.percolate = function (index) {
if (index >= this.length || index < 0) { return; }
var parent = index - 1 >> 1;
if (parent < 0 || parent === index) { return; }
if (this.isHigherPriority(index, parent)) {
var temp = this.items[index];
this.items[index] = this.items[parent];
this.items[parent] = temp;
this.percolate(parent);
}
};
priorityProto.heapify = function (index) {
+index || (index = 0);
if (index >= this.length || index < 0) { return; }
var left = 2 * index + 1,
right = 2 * index + 2,
first = index;
if (left < this.length && this.isHigherPriority(left, first)) {
first = left;
}
if (right < this.length && this.isHigherPriority(right, first)) {
first = right;
}
if (first !== index) {
var temp = this.items[index];
this.items[index] = this.items[first];
this.items[first] = temp;
this.heapify(first);
}
};
priorityProto.peek = function () { return this.items[0].value; };
priorityProto.removeAt = function (index) {
this.items[index] = this.items[--this.length];
delete this.items[this.length];
this.heapify();
};
priorityProto.dequeue = function () {
var result = this.peek();
this.removeAt(0);
return result;
};
priorityProto.enqueue = function (item) {
var index = this.length++;
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
this.percolate(index);
};
priorityProto.remove = function (item) {
for (var i = 0; i < this.length; i++) {
if (this.items[i].value === item) {
this.removeAt(i);
return true;
}
}
return false;
};
PriorityQueue.count = 0;
/**
* Represents a group of disposable resources that are disposed together.
* @constructor
*/
var CompositeDisposable = Rx.CompositeDisposable = function () {
this.disposables = argsOrArray(arguments, 0);
this.isDisposed = false;
this.length = this.disposables.length;
};
var CompositeDisposablePrototype = CompositeDisposable.prototype;
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
* @param {Mixed} item Disposable to add.
*/
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {
item.dispose();
} else {
this.disposables.push(item);
this.length++;
}
};
/**
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
* @param {Mixed} item Disposable to remove.
* @returns {Boolean} true if found; false otherwise.
*/
CompositeDisposablePrototype.remove = function (item) {
var shouldDispose = false;
if (!this.isDisposed) {
var idx = this.disposables.indexOf(item);
if (idx !== -1) {
shouldDispose = true;
this.disposables.splice(idx, 1);
this.length--;
item.dispose();
}
}
return shouldDispose;
};
/**
* Disposes all disposables in the group and removes them from the group.
*/
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
}
};
/**
* Converts the existing CompositeDisposable to an array of disposables
* @returns {Array} An array of disposable objects.
*/
CompositeDisposablePrototype.toArray = function () {
return this.disposables.slice(0);
};
/**
* Provides a set of static methods for creating Disposables.
*
* @constructor
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;
this.action = action || noop;
};
/** Performs the task of cleaning up resources. */
Disposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.action();
this.isDisposed = true;
}
};
/**
* Creates a disposable object that invokes the specified action when disposed.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
/**
* Gets the disposable that does nothing when disposed.
*/
var disposableEmpty = Disposable.empty = { dispose: noop };
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = (function () {
function BooleanDisposable () {
this.isDisposed = false;
this.current = null;
}
var booleanDisposablePrototype = BooleanDisposable.prototype;
/**
* Gets the underlying disposable.
* @return The underlying disposable.
*/
booleanDisposablePrototype.getDisposable = function () {
return this.current;
};
/**
* Sets the underlying disposable.
* @param {Disposable} value The new underlying disposable.
*/
booleanDisposablePrototype.setDisposable = function (value) {
var shouldDispose = this.isDisposed, old;
if (!shouldDispose) {
old = this.current;
this.current = value;
}
old && old.dispose();
shouldDispose && value && value.dispose();
};
/**
* Disposes the underlying disposable as well as all future replacements.
*/
booleanDisposablePrototype.dispose = function () {
var old;
if (!this.isDisposed) {
this.isDisposed = true;
old = this.current;
this.current = null;
}
old && old.dispose();
};
return BooleanDisposable;
}());
var SerialDisposable = Rx.SerialDisposable = SingleAssignmentDisposable;
/**
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
*/
var RefCountDisposable = Rx.RefCountDisposable = (function () {
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
this.isInnerDisposed = false;
}
InnerDisposable.prototype.dispose = function () {
if (!this.disposable.isDisposed) {
if (!this.isInnerDisposed) {
this.isInnerDisposed = true;
this.disposable.count--;
if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {
this.disposable.isDisposed = true;
this.disposable.underlyingDisposable.dispose();
}
}
}
};
/**
* Initializes a new instance of the RefCountDisposable with the specified disposable.
* @constructor
* @param {Disposable} disposable Underlying disposable.
*/
function RefCountDisposable(disposable) {
this.underlyingDisposable = disposable;
this.isDisposed = false;
this.isPrimaryDisposed = false;
this.count = 0;
}
/**
* Disposes the underlying disposable only when all dependent disposables have been disposed
*/
RefCountDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
if (!this.isPrimaryDisposed) {
this.isPrimaryDisposed = true;
if (this.count === 0) {
this.isDisposed = true;
this.underlyingDisposable.dispose();
}
}
}
};
/**
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.
*/
RefCountDisposable.prototype.getDisposable = function () {
return this.isDisposed ? disposableEmpty : new InnerDisposable(this);
};
return RefCountDisposable;
})();
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
this.scheduler = scheduler;
this.state = state;
this.action = action;
this.dueTime = dueTime;
this.comparer = comparer || defaultSubComparer;
this.disposable = new SingleAssignmentDisposable();
}
ScheduledItem.prototype.invoke = function () {
this.disposable.setDisposable(this.invokeCore());
};
ScheduledItem.prototype.compareTo = function (other) {
return this.comparer(this.dueTime, other.dueTime);
};
ScheduledItem.prototype.isCancelled = function () {
return this.disposable.isDisposed;
};
ScheduledItem.prototype.invokeCore = function () {
return this.action(this.scheduler, this.state);
};
/** Provides a set of static properties to access commonly used schedulers. */
var Scheduler = Rx.Scheduler = (function () {
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {
this.now = now;
this._schedule = schedule;
this._scheduleRelative = scheduleRelative;
this._scheduleAbsolute = scheduleAbsolute;
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
var schedulerProto = Scheduler.prototype;
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.schedule = function (action) {
return this._schedule(action, invokeAction);
};
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithState = function (state, action) {
return this._schedule(state, action);
};
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelative = function (dueTime, action) {
return this._scheduleRelative(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative(state, dueTime, action);
};
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsolute = function (dueTime, action) {
return this._scheduleAbsolute(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute(state, dueTime, action);
};
/** Gets the current time according to the local machine's system clock. */
Scheduler.now = defaultNow;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
Scheduler.normalize = function (timeSpan) {
timeSpan < 0 && (timeSpan = 0);
return timeSpan;
};
return Scheduler;
}());
var normalizeTime = Scheduler.normalize;
(function (schedulerProto) {
function invokeRecImmediate(scheduler, pair) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function scheduleInnerRecursive(action, self) {
action(function(dt) { self(action, dt); });
}
/**
* Schedules an action to be executed recursively.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursive = function (action) {
return this.scheduleRecursiveWithState(action, function (_action, self) {
_action(function () { self(_action); }); });
};
/**
* Schedules an action to be executed recursively.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithState = function (state, action) {
return this.scheduleWithState({ first: state, second: action }, invokeRecImmediate);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) {
return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) {
return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
});
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodic = function (period, action) {
return this.schedulePeriodicWithState(null, period, action);
};
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) {
if (typeof root.setInterval === 'undefined') { throw new Error('Periodic scheduling not supported.'); }
var s = state;
var id = root.setInterval(function () {
s = action(s);
}, period);
return disposableCreate(function () {
root.clearInterval(id);
});
};
}(Scheduler.prototype));
/** Gets a scheduler that schedules work immediately on the current thread. */
var immediateScheduler = Scheduler.immediate = (function () {
function scheduleNow(state, action) { return action(this, state); }
function scheduleRelative(state, dueTime, action) {
var dt = normalizeTime(dueTime);
while (dt - this.now() > 0) { }
return action(this, state);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}());
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
function runTrampoline (q) {
var item;
while (q.length > 0) {
item = q.dequeue();
if (!item.isCancelled()) {
// Note, do not schedule blocking work!
while (item.dueTime - Scheduler.now() > 0) {
}
if (!item.isCancelled()) {
item.invoke();
}
}
}
}
function scheduleNow(state, action) {
return this.scheduleWithRelativeAndState(state, 0, action);
}
function scheduleRelative(state, dueTime, action) {
var dt = this.now() + Scheduler.normalize(dueTime),
si = new ScheduledItem(this, state, action, dt);
if (!queue) {
queue = new PriorityQueue(4);
queue.enqueue(si);
try {
runTrampoline(queue);
} catch (e) {
throw e;
} finally {
queue = null;
}
} else {
queue.enqueue(si);
}
return si.disposable;
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
currentScheduler.scheduleRequired = function () { return !queue; };
currentScheduler.ensureTrampoline = function (action) {
if (!queue) { this.schedule(action); } else { action(); }
};
return currentScheduler;
}());
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
function tick(command, recurse) {
recurse(0, this._period);
try {
this._state = this._action(this._state);
} catch (e) {
this._cancel.dispose();
throw e;
}
}
function SchedulePeriodicRecursive(scheduler, state, period, action) {
this._scheduler = scheduler;
this._state = state;
this._period = period;
this._action = action;
}
SchedulePeriodicRecursive.prototype.start = function () {
var d = new SingleAssignmentDisposable();
this._cancel = d;
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
return d;
};
return SchedulePeriodicRecursive;
}());
var scheduleMethod, clearMethod = noop;
var localTimer = (function () {
var localSetTimeout, localClearTimeout = noop;
if ('WScript' in this) {
localSetTimeout = function (fn, time) {
WScript.Sleep(time);
fn();
};
} else if (!!root.setTimeout) {
localSetTimeout = root.setTimeout;
localClearTimeout = root.clearTimeout;
} else {
throw new Error('No concurrency detected!');
}
return {
setTimeout: localSetTimeout,
clearTimeout: localClearTimeout
};
}());
var localSetTimeout = localTimer.setTimeout,
localClearTimeout = localTimer.clearTimeout;
(function () {
var reNative = RegExp('^' +
String(toString)
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/toString| for [^\]]+/g, '.*?') + '$'
);
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
!reNative.test(setImmediate) && setImmediate,
clearImmediate = typeof (clearImmediate = freeGlobal && moduleExports && freeGlobal.clearImmediate) == 'function' &&
!reNative.test(clearImmediate) && clearImmediate;
function postMessageSupported () {
// Ensure not in a worker
if (!root.postMessage || root.importScripts) { return false; }
var isAsync = false,
oldHandler = root.onmessage;
// Test for async
root.onmessage = function () { isAsync = true; };
root.postMessage('', '*');
root.onmessage = oldHandler;
return isAsync;
}
// Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout
if (typeof setImmediate === 'function') {
scheduleMethod = setImmediate;
clearMethod = clearImmediate;
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleMethod = process.nextTick;
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
tasks = {},
taskId = 0;
var onGlobalPostMessage = function (event) {
// Only if we're a match to avoid any other global events
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
var handleId = event.data.substring(MSG_PREFIX.length),
action = tasks[handleId];
action();
delete tasks[handleId];
}
}
if (root.addEventListener) {
root.addEventListener('message', onGlobalPostMessage, false);
} else {
root.attachEvent('onmessage', onGlobalPostMessage, false);
}
scheduleMethod = function (action) {
var currentId = taskId++;
tasks[currentId] = action;
root.postMessage(MSG_PREFIX + currentId, '*');
};
} else if (!!root.MessageChannel) {
var channel = new root.MessageChannel(),
channelTasks = {},
channelTaskId = 0;
channel.port1.onmessage = function (event) {
var id = event.data,
action = channelTasks[id];
action();
delete channelTasks[id];
};
scheduleMethod = function (action) {
var id = channelTaskId++;
channelTasks[id] = action;
channel.port2.postMessage(id);
};
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
scheduleMethod = function (action) {
var scriptElement = root.document.createElement('script');
scriptElement.onreadystatechange = function () {
action();
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
root.document.documentElement.appendChild(scriptElement);
};
} else {
scheduleMethod = function (action) { return localSetTimeout(action, 0); };
clearMethod = localClearTimeout;
}
}());
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*/
var timeoutScheduler = Scheduler.timeout = (function () {
function scheduleNow(state, action) {
var scheduler = this,
disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
});
return new CompositeDisposable(disposable, disposableCreate(function () {
clearMethod(id);
}));
}
function scheduleRelative(state, dueTime, action) {
var scheduler = this,
dt = Scheduler.normalize(dueTime);
if (dt === 0) {
return scheduler.scheduleWithState(state, action);
}
var disposable = new SingleAssignmentDisposable();
var id = localSetTimeout(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
}, dt);
return new CompositeDisposable(disposable, disposableCreate(function () {
localClearTimeout(id);
}));
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
})();
/**
* Represents a notification to an observer.
*/
var Notification = Rx.Notification = (function () {
function Notification(kind, hasValue) {
this.hasValue = hasValue == null ? false : hasValue;
this.kind = kind;
}
/**
* Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
*
* @memberOf Notification
* @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
* @param {Function} onError Delegate to invoke for an OnError notification.
* @param {Function} onCompleted Delegate to invoke for an OnCompleted notification.
* @returns {Any} Result produced by the observation.
*/
Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) {
return observerOrOnNext && typeof observerOrOnNext === 'object' ?
this._acceptObservable(observerOrOnNext) :
this._accept(observerOrOnNext, onError, onCompleted);
};
/**
* Returns an observable sequence with a single notification.
*
* @memberOf Notifications
* @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
*/
Notification.prototype.toObservable = function (scheduler) {
var notification = this;
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
notification._acceptObservable(observer);
notification.kind === 'N' && observer.onCompleted();
});
});
};
return Notification;
})();
/**
* Creates an object that represents an OnNext notification to an observer.
* @param {Any} value The value contained in the notification.
* @returns {Notification} The OnNext notification containing the value.
*/
var notificationCreateOnNext = Notification.createOnNext = (function () {
function _accept (onNext) { return onNext(this.value); }
function _acceptObservable(observer) { return observer.onNext(this.value); }
function toString () { return 'OnNext(' + this.value + ')'; }
return function (value) {
var notification = new Notification('N', true);
notification.value = value;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnError notification to an observer.
* @param {Any} error The exception contained in the notification.
* @returns {Notification} The OnError notification containing the exception.
*/
var notificationCreateOnError = Notification.createOnError = (function () {
function _accept (onNext, onError) { return onError(this.exception); }
function _acceptObservable(observer) { return observer.onError(this.exception); }
function toString () { return 'OnError(' + this.exception + ')'; }
return function (e) {
var notification = new Notification('E');
notification.exception = e;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnCompleted notification to an observer.
* @returns {Notification} The OnCompleted notification.
*/
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
function _accept (onNext, onError, onCompleted) { return onCompleted(); }
function _acceptObservable(observer) { return observer.onCompleted(); }
function toString () { return 'OnCompleted()'; }
return function () {
var notification = new Notification('C');
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
var Enumerator = Rx.internals.Enumerator = function (next) {
this._next = next;
};
Enumerator.prototype.next = function () {
return this._next();
};
Enumerator.prototype[$iterator$] = function () { return this; }
var Enumerable = Rx.internals.Enumerable = function (iterator) {
this._iterator = iterator;
};
Enumerable.prototype[$iterator$] = function () {
return this._iterator();
};
Enumerable.prototype.concat = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e;
try {
e = sources[$iterator$]();
} catch (err) {
observer.onError(err);
return;
}
var isDisposed,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
var currentItem;
if (isDisposed) { return; }
try {
currentItem = e.next();
} catch (ex) {
observer.onError(ex);
return;
}
if (currentItem.done) {
observer.onCompleted();
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () { self(); })
);
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
Enumerable.prototype.catchError = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e;
try {
e = sources[$iterator$]();
} catch (err) {
observer.onError(err);
return;
}
var isDisposed,
lastException,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
if (isDisposed) { return; }
var currentItem;
try {
currentItem = e.next();
} catch (ex) {
observer.onError(ex);
return;
}
if (currentItem.done) {
if (lastException) {
observer.onError(lastException);
} else {
observer.onCompleted();
}
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
observer.onNext.bind(observer),
function (exn) {
lastException = exn;
self();
},
observer.onCompleted.bind(observer)));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
if (repeatCount == null) { repeatCount = -1; }
return new Enumerable(function () {
var left = repeatCount;
return new Enumerator(function () {
if (left === 0) { return doneEnumerator; }
if (left > 0) { left--; }
return { done: false, value: value };
});
});
};
var enumerableOf = Enumerable.of = function (source, selector, thisArg) {
selector || (selector = identity);
return new Enumerable(function () {
var index = -1;
return new Enumerator(
function () {
return ++index < source.length ?
{ done: false, value: selector.call(thisArg, source[index], index, source) } :
doneEnumerator;
});
});
};
/**
* Supports push-style iteration over an observable sequence.
*/
var Observer = Rx.Observer = function () { };
/**
* Creates a notification callback from an observer.
* @returns The action that forwards its input notification to the underlying observer.
*/
Observer.prototype.toNotifier = function () {
var observer = this;
return function (n) { return n.accept(observer); };
};
/**
* Hides the identity of an observer.
* @returns An observer that hides the identity of the specified observer.
*/
Observer.prototype.asObserver = function () {
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
};
/**
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
onNext || (onNext = noop);
onError || (onError = defaultError);
onCompleted || (onCompleted = noop);
return new AnonymousObserver(onNext, onError, onCompleted);
};
/**
* Creates an observer from a notification callback.
* @param {Function} handler Action that handles a notification.
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
*/
Observer.fromNotifier = function (handler, thisArg) {
return new AnonymousObserver(function (x) {
return handler.call(thisArg, notificationCreateOnNext(x));
}, function (e) {
return handler.call(thisArg, notificationCreateOnError(e));
}, function () {
return handler.call(thisArg, notificationCreateOnCompleted());
});
};
/**
* Abstract base class for implementations of the Observer class.
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
*/
var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) {
inherits(AbstractObserver, __super__);
/**
* Creates a new observer in a non-stopped state.
*/
function AbstractObserver() {
this.isStopped = false;
__super__.call(this);
}
/**
* Notifies the observer of a new element in the sequence.
* @param {Any} value Next element in the sequence.
*/
AbstractObserver.prototype.onNext = function (value) {
if (!this.isStopped) { this.next(value); }
};
/**
* Notifies the observer that an exception has occurred.
* @param {Any} error The error that has occurred.
*/
AbstractObserver.prototype.onError = function (error) {
if (!this.isStopped) {
this.isStopped = true;
this.error(error);
}
};
/**
* Notifies the observer of the end of the sequence.
*/
AbstractObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.completed();
}
};
/**
* Disposes the observer, causing it to transition to the stopped state.
*/
AbstractObserver.prototype.dispose = function () {
this.isStopped = true;
};
AbstractObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.error(e);
return true;
}
return false;
};
return AbstractObserver;
}(Observer));
/**
* Class to create an Observer instance from delegate-based implementations of the on* methods.
*/
var AnonymousObserver = Rx.AnonymousObserver = (function (__super__) {
inherits(AnonymousObserver, __super__);
/**
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
* @param {Any} onNext Observer's OnNext action implementation.
* @param {Any} onError Observer's OnError action implementation.
* @param {Any} onCompleted Observer's OnCompleted action implementation.
*/
function AnonymousObserver(onNext, onError, onCompleted) {
__super__.call(this);
this._onNext = onNext;
this._onError = onError;
this._onCompleted = onCompleted;
}
/**
* Calls the onNext action.
* @param {Any} value Next element in the sequence.
*/
AnonymousObserver.prototype.next = function (value) {
this._onNext(value);
};
/**
* Calls the onError action.
* @param {Any} error The error that has occurred.
*/
AnonymousObserver.prototype.error = function (error) {
this._onError(error);
};
/**
* Calls the onCompleted action.
*/
AnonymousObserver.prototype.completed = function () {
this._onCompleted();
};
return AnonymousObserver;
}(AbstractObserver));
var observableProto;
/**
* Represents a push-style collection.
*/
var Observable = Rx.Observable = (function () {
function Observable(subscribe) {
this._subscribe = subscribe;
}
observableProto = Observable.prototype;
/**
* Subscribes an observer to the observable sequence.
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
return this._subscribe(typeof observerOrOnNext === 'object' ?
observerOrOnNext :
observerCreate(observerOrOnNext, onError, onCompleted));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnNext = function (onNext, thisArg) {
return this._subscribe(observerCreate(arguments.length === 2 ? function(x) { onNext.call(thisArg, x); } : onNext));
};
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnError = function (onError, thisArg) {
return this._subscribe(observerCreate(null, arguments.length === 2 ? function(e) { onError.call(thisArg, e); } : onError));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnCompleted = function (onCompleted, thisArg) {
return this._subscribe(observerCreate(null, null, arguments.length === 2 ? function() { onCompleted.call(thisArg); } : onCompleted));
};
return Observable;
})();
var ScheduledObserver = Rx.internals.ScheduledObserver = (function (__super__) {
inherits(ScheduledObserver, __super__);
function ScheduledObserver(scheduler, observer) {
__super__.call(this);
this.scheduler = scheduler;
this.observer = observer;
this.isAcquired = false;
this.hasFaulted = false;
this.queue = [];
this.disposable = new SerialDisposable();
}
ScheduledObserver.prototype.next = function (value) {
var self = this;
this.queue.push(function () { self.observer.onNext(value); });
};
ScheduledObserver.prototype.error = function (e) {
var self = this;
this.queue.push(function () { self.observer.onError(e); });
};
ScheduledObserver.prototype.completed = function () {
var self = this;
this.queue.push(function () { self.observer.onCompleted(); });
};
ScheduledObserver.prototype.ensureActive = function () {
var isOwner = false, parent = this;
if (!this.hasFaulted && this.queue.length > 0) {
isOwner = !this.isAcquired;
this.isAcquired = true;
}
if (isOwner) {
this.disposable.setDisposable(this.scheduler.scheduleRecursive(function (self) {
var work;
if (parent.queue.length > 0) {
work = parent.queue.shift();
} else {
parent.isAcquired = false;
return;
}
try {
work();
} catch (ex) {
parent.queue = [];
parent.hasFaulted = true;
throw ex;
}
self();
}));
}
};
ScheduledObserver.prototype.dispose = function () {
__super__.prototype.dispose.call(this);
this.disposable.dispose();
};
return ScheduledObserver;
}(AbstractObserver));
/**
* Creates an array from an observable sequence.
* @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
var self = this;
return new AnonymousObservable(function(observer) {
var arr = [];
return self.subscribe(
arr.push.bind(arr),
observer.onError.bind(observer),
function () {
observer.onNext(arr);
observer.onCompleted();
});
});
};
/**
* Creates an observable sequence from a specified subscribe method implementation.
*
* @example
* var res = Rx.Observable.create(function (observer) { return function () { } );
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
* var res = Rx.Observable.create(function (observer) { } );
*
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/
Observable.create = Observable.createWithDisposable = function (subscribe) {
return new AnonymousObservable(subscribe);
};
/**
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
*
* @example
* var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise.
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
*/
var observableDefer = Observable.defer = function (observableFactory) {
return new AnonymousObservable(function (observer) {
var result;
try {
result = observableFactory();
} catch (e) {
return observableThrow(e).subscribe(observer);
}
isPromise(result) && (result = observableFromPromise(result));
return result.subscribe(observer);
});
};
/**
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
*
* @example
* var res = Rx.Observable.empty();
* var res = Rx.Observable.empty(Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
* @returns {Observable} An observable sequence with no elements.
*/
var observableEmpty = Observable.empty = function (scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onCompleted();
});
});
};
var maxSafeInteger = Math.pow(2, 53) - 1;
function StringIterable(str) {
this._s = s;
}
StringIterable.prototype[$iterator$] = function () {
return new StringIterator(this._s);
};
function StringIterator(str) {
this._s = s;
this._l = s.length;
this._i = 0;
}
StringIterator.prototype[$iterator$] = function () {
return this;
};
StringIterator.prototype.next = function () {
if (this._i < this._l) {
var val = this._s.charAt(this._i++);
return { done: false, value: val };
} else {
return doneEnumerator;
}
};
function ArrayIterable(a) {
this._a = a;
}
ArrayIterable.prototype[$iterator$] = function () {
return new ArrayIterator(this._a);
};
function ArrayIterator(a) {
this._a = a;
this._l = toLength(a);
this._i = 0;
}
ArrayIterator.prototype[$iterator$] = function () {
return this;
};
ArrayIterator.prototype.next = function () {
if (this._i < this._l) {
var val = this._a[this._i++];
return { done: false, value: val };
} else {
return doneEnumerator;
}
};
function numberIsFinite(value) {
return typeof value === 'number' && root.isFinite(value);
}
function isNan(n) {
return n !== n;
}
function getIterable(o) {
var i = o[$iterator$], it;
if (!i && typeof o === 'string') {
it = new StringIterable(o);
return it[$iterator$]();
}
if (!i && o.length !== undefined) {
it = new ArrayIterable(o);
return it[$iterator$]();
}
if (!i) { throw new TypeError('Object is not iterable'); }
return o[$iterator$]();
}
function sign(value) {
var number = +value;
if (number === 0) { return number; }
if (isNaN(number)) { return number; }
return number < 0 ? -1 : 1;
}
function toLength(o) {
var len = +o.length;
if (isNaN(len)) { return 0; }
if (len === 0 || !numberIsFinite(len)) { return len; }
len = sign(len) * Math.floor(Math.abs(len));
if (len <= 0) { return 0; }
if (len > maxSafeInteger) { return maxSafeInteger; }
return len;
}
/**
* This method creates a new Observable sequence from an array-like or iterable object.
* @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence.
* @param {Function} [mapFn] Map function to call on every element of the array.
* @param {Any} [thisArg] The context to use calling the mapFn if provided.
* @param {Scheduler} [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
*/
var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) {
if (iterable == null) {
throw new Error('iterable cannot be null.')
}
if (mapFn && !isFunction(mapFn)) {
throw new Error('mapFn when provided must be a function');
}
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
var list = Object(iterable), it = getIterable(list);
return new AnonymousObservable(function (observer) {
var i = 0;
return scheduler.scheduleRecursive(function (self) {
var next;
try {
next = it.next();
} catch (e) {
observer.onError(e);
return;
}
if (next.done) {
observer.onCompleted();
return;
}
var result = next.value;
if (mapFn && isFunction(mapFn)) {
try {
result = mapFn.call(thisArg, result, i);
} catch (e) {
observer.onError(e);
return;
}
}
observer.onNext(result);
i++;
self();
});
});
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
* @deprecated use Observable.from or Observable.of
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
*/
var observableFromArray = Observable.fromArray = function (array, scheduler) {
deprecate('fromArray', 'from');
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var count = 0, len = array.length;
return scheduler.scheduleRecursive(function (self) {
if (count < len) {
observer.onNext(array[count++]);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
* @returns {Observable} An observable sequence whose observers will never get called.
*/
var observableNever = Observable.never = function () {
return new AnonymousObservable(function () {
return disposableEmpty;
});
};
function observableOf (scheduler, array) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var count = 0, len = array.length;
return scheduler.scheduleRecursive(function (self) {
if (count < len) {
observer.onNext(array[count++]);
self();
} else {
observer.onCompleted();
}
});
});
}
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.of = function () {
return observableOf(null, arguments);
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.ofWithScheduler = function (scheduler) {
return observableOf(scheduler, slice.call(arguments, 1));
};
/**
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.range(0, 10);
* var res = Rx.Observable.range(0, 10, Rx.Scheduler.timeout);
* @param {Number} start The value of the first integer in the sequence.
* @param {Number} count The number of sequential integers to generate.
* @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.
* @returns {Observable} An observable sequence that contains a range of sequential integral numbers.
*/
Observable.range = function (start, count, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleRecursiveWithState(0, function (i, self) {
if (i < count) {
observer.onNext(start + i);
self(i + 1);
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.repeat(42);
* var res = Rx.Observable.repeat(42, 4);
* 3 - res = Rx.Observable.repeat(42, 4, Rx.Scheduler.timeout);
* 4 - res = Rx.Observable.repeat(42, null, Rx.Scheduler.timeout);
* @param {Mixed} value Element to repeat.
* @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
* @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence that repeats the given element the specified number of times.
*/
Observable.repeat = function (value, repeatCount, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return observableReturn(value, scheduler).repeat(repeatCount == null ? -1 : repeatCount);
};
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
* There is an alias called 'just', and 'returnValue' for browsers <IE9.
*
* @example
* var res = Rx.Observable.return(42);
* var res = Rx.Observable.return(42, Rx.Scheduler.timeout);
* @param {Mixed} value Single element in the resulting observable sequence.
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence containing the single specified element.
*/
var observableReturn = Observable['return'] = Observable.just = function (value, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onNext(value);
observer.onCompleted();
});
});
};
/** @deprecated use return or just */
Observable.returnValue = function () {
deprecate('returnValue', 'return or just');
return observableReturn.apply(null, arguments);
};
/**
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
* There is an alias to this method called 'throwError' for browsers <IE9.
* @param {Mixed} exception An object used for the sequence's termination.
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
*/
var observableThrow = Observable['throw'] = Observable.throwException = Observable.throwError = function (exception, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onError(exception);
});
});
};
function observableCatchHandler(source, handler) {
return new AnonymousObservable(function (observer) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(observer.onNext.bind(observer), function (exception) {
var d, result;
try {
result = handler(exception);
} catch (ex) {
observer.onError(ex);
return;
}
isPromise(result) && (result = observableFromPromise(result));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(result.subscribe(observer));
}, observer.onCompleted.bind(observer)));
return subscription;
});
}
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @example
* 1 - xs.catchException(ys)
* 2 - xs.catchException(function (ex) { return ys(ex); })
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
*/
observableProto['catch'] = observableProto.catchError = function (handlerOrSecond) {
return typeof handlerOrSecond === 'function' ?
observableCatchHandler(this, handlerOrSecond) :
observableCatch([this, handlerOrSecond]);
};
/**
* @deprecated use #catch or #catchError instead.
*/
observableProto.catchException = function (handlerOrSecond) {
deprecate('catchException', 'catch or catchError');
return this.catchError(handlerOrSecond);
};
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs.
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable.catchError = Observable['catch'] = function () {
return enumerableOf(argsOrArray(arguments, 0)).catchError();
};
/**
* @deprecated use #catch or #catchError instead.
*/
Observable.catchException = function () {
deprecate('catchException', 'catch or catchError');
return observableCatch.apply(null, arguments);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
* This can be in the form of an argument list of observables or an array.
*
* @example
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.combineLatest = function () {
var args = slice.call(arguments);
if (Array.isArray(args[0])) {
args[0].unshift(this);
} else {
args.unshift(this);
}
return combineLatest.apply(this, args);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
*
* @example
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
var combineLatest = Observable.combineLatest = function () {
var args = slice.call(arguments), resultSelector = args.pop();
if (Array.isArray(args[0])) {
args = args[0];
}
return new AnonymousObservable(function (observer) {
var falseFactory = function () { return false; },
n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
}
function done (i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
values[i] = x;
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
subscriptions[i] = sad;
}(idx));
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
*
* @example
* 1 - concatenated = xs.concat(ys, zs);
* 2 - concatenated = xs.concat([ys, zs]);
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
observableProto.concat = function () {
var items = slice.call(arguments, 0);
items.unshift(this);
return observableConcat.apply(this, items);
};
/**
* Concatenates all the observable sequences.
* @param {Array | Arguments} args Arguments or an array to concat to the observable sequence.
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
return enumerableOf(argsOrArray(arguments, 0)).concat();
};
/**
* Concatenates an observable sequence of observable sequences.
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
*/
observableProto.concatAll = function () {
return this.merge(1);
};
/** @deprecated Use `concatAll` instead. */
observableProto.concatObservable = function () {
deprecate('concatObservable', 'concatAll');
return this.merge(1);
};
/**
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
* Or merges two observable sequences into a single observable sequence.
*
* @example
* 1 - merged = sources.merge(1);
* 2 - merged = source.merge(otherSource);
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.merge = function (maxConcurrentOrOther) {
if (typeof maxConcurrentOrOther !== 'number') { return observableMerge(this, maxConcurrentOrOther); }
var sources = this;
return new AnonymousObservable(function (observer) {
var activeCount = 0, group = new CompositeDisposable(), isStopped = false, q = [];
function subscribe(xs) {
var subscription = new SingleAssignmentDisposable();
group.add(subscription);
// Check for promises support
isPromise(xs) && (xs = observableFromPromise(xs));
subscription.setDisposable(xs.subscribe(observer.onNext.bind(observer), observer.onError.bind(observer), function () {
group.remove(subscription);
if (q.length > 0) {
subscribe(q.shift());
} else {
activeCount--;
isStopped && activeCount === 0 && observer.onCompleted();
}
}));
}
group.add(sources.subscribe(function (innerSource) {
if (activeCount < maxConcurrentOrOther) {
activeCount++;
subscribe(innerSource);
} else {
q.push(innerSource);
}
}, observer.onError.bind(observer), function () {
isStopped = true;
activeCount === 0 && observer.onCompleted();
}));
return group;
});
};
/**
* Merges all the observable sequences into a single observable sequence.
* The scheduler is optional and if not specified, the immediate scheduler is used.
*
* @example
* 1 - merged = Rx.Observable.merge(xs, ys, zs);
* 2 - merged = Rx.Observable.merge([xs, ys, zs]);
* 3 - merged = Rx.Observable.merge(scheduler, xs, ys, zs);
* 4 - merged = Rx.Observable.merge(scheduler, [xs, ys, zs]);
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/
var observableMerge = Observable.merge = function () {
var scheduler, sources;
if (!arguments[0]) {
scheduler = immediateScheduler;
sources = slice.call(arguments, 1);
} else if (arguments[0].now) {
scheduler = arguments[0];
sources = slice.call(arguments, 1);
} else {
scheduler = immediateScheduler;
sources = slice.call(arguments, 0);
}
if (Array.isArray(sources[0])) {
sources = sources[0];
}
return observableOf(scheduler, sources).mergeAll();
};
/**
* Merges an observable sequence of observable sequences into an observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.mergeAll = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable(),
isStopped = false,
m = new SingleAssignmentDisposable();
group.add(m);
m.setDisposable(sources.subscribe(function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
group.add(innerSubscription);
// Check for promises support
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(observer.onNext.bind(observer), observer.onError.bind(observer), function () {
group.remove(innerSubscription);
isStopped && group.length === 1 && observer.onCompleted();
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
group.length === 1 && observer.onCompleted();
}));
return group;
});
};
/**
* @deprecated use #mergeAll instead.
*/
observableProto.mergeObservable = function () {
deprecate('mergeObservable', 'mergeAll');
return this.mergeAll.apply(this, arguments);
};
/**
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
* @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
*/
observableProto.skipUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
var isOpen = false;
var disposables = new CompositeDisposable(source.subscribe(function (left) {
isOpen && observer.onNext(left);
}, observer.onError.bind(observer), function () {
isOpen && observer.onCompleted();
}));
isPromise(other) && (other = observableFromPromise(other));
var rightSubscription = new SingleAssignmentDisposable();
disposables.add(rightSubscription);
rightSubscription.setDisposable(other.subscribe(function () {
isOpen = true;
rightSubscription.dispose();
}, observer.onError.bind(observer), function () {
rightSubscription.dispose();
}));
return disposables;
});
};
/**
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto['switch'] = observableProto.switchLatest = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasLatest = false,
innerSubscription = new SerialDisposable(),
isStopped = false,
latest = 0,
subscription = sources.subscribe(
function (innerSource) {
var d = new SingleAssignmentDisposable(), id = ++latest;
hasLatest = true;
innerSubscription.setDisposable(d);
// Check if Promise or Observable
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
d.setDisposable(innerSource.subscribe(
function (x) { latest === id && observer.onNext(x); },
function (e) { latest === id && observer.onError(e); },
function () {
if (latest === id) {
hasLatest = false;
isStopped && observer.onCompleted();
}
}));
},
observer.onError.bind(observer),
function () {
isStopped = true;
!hasLatest && observer.onCompleted();
});
return new CompositeDisposable(subscription, innerSubscription);
});
};
/**
* Returns the values from the source observable sequence until the other observable sequence produces a value.
* @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
*/
observableProto.takeUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
isPromise(other) && (other = observableFromPromise(other));
return new CompositeDisposable(
source.subscribe(observer),
other.subscribe(observer.onCompleted.bind(observer), observer.onError.bind(observer), noop)
);
});
};
function zipArray(second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var index = 0, len = second.length;
return first.subscribe(function (left) {
if (index < len) {
var right = second[index++], result;
try {
result = resultSelector(left, right);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
} else {
observer.onCompleted();
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
}
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the sources.
*
* @example
* 1 - res = obs1.zip(obs2, fn);
* 1 - res = x1.zip([1,2,3], fn);
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.zip = function () {
if (Array.isArray(arguments[0])) {
return zipArray.apply(this, arguments);
}
var parent = this, sources = slice.call(arguments), resultSelector = sources.pop();
sources.unshift(parent);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
var res, queuedValues;
if (queues.every(function (x) { return x.length > 0; })) {
try {
queuedValues = queues.map(function (x) { return x.shift(); });
res = resultSelector.apply(parent, queuedValues);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(function (x) { return x; })) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = sources[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
subscriptions[i] = sad;
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
* @param arguments Observable sources.
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
Observable.zip = function () {
var args = slice.call(arguments, 0), first = args.shift();
return first.zip.apply(first, args);
};
/**
* Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
* @param arguments Observable sources.
* @returns {Observable} An observable sequence containing lists of elements at corresponding indexes.
*/
Observable.zipArray = function () {
var sources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
if (queues.every(function (x) { return x.length > 0; })) {
var res = queues.map(function (x) { return x.shift(); });
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
return;
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
return;
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
})(idx);
}
var compositeDisposable = new CompositeDisposable(subscriptions);
compositeDisposable.add(disposableCreate(function () {
for (var qIdx = 0, qLen = queues.length; qIdx < qLen; qIdx++) { queues[qIdx] = []; }
}));
return compositeDisposable;
});
};
/**
* Hides the identity of an observable sequence.
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
*/
observableProto.asObservable = function () {
return new AnonymousObservable(this.subscribe.bind(this));
};
/**
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
*/
observableProto.dematerialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
return x.accept(observer);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
*
* var obs = observable.distinctUntilChanged();
* var obs = observable.distinctUntilChanged(function (x) { return x.id; });
* var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
*
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/
observableProto.distinctUntilChanged = function (keySelector, comparer) {
var source = this;
keySelector || (keySelector = identity);
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
var hasCurrentKey = false, currentKey;
return source.subscribe(function (value) {
var comparerEquals = false, key;
try {
key = keySelector(value);
} catch (exception) {
observer.onError(exception);
return;
}
if (hasCurrentKey) {
try {
comparerEquals = comparer(currentKey, key);
} catch (exception) {
observer.onError(exception);
return;
}
}
if (!hasCurrentKey || !comparerEquals) {
hasCurrentKey = true;
currentKey = key;
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto['do'] = observableProto.tap = function (observerOrOnNext, onError, onCompleted) {
var source = this, onNextFunc;
if (typeof observerOrOnNext === 'function') {
onNextFunc = observerOrOnNext;
} else {
onNextFunc = observerOrOnNext.onNext.bind(observerOrOnNext);
onError = observerOrOnNext.onError.bind(observerOrOnNext);
onCompleted = observerOrOnNext.onCompleted.bind(observerOrOnNext);
}
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
try {
onNextFunc(x);
} catch (e) {
observer.onError(e);
}
observer.onNext(x);
}, function (err) {
if (onError) {
try {
onError(err);
} catch (e) {
observer.onError(e);
}
}
observer.onError(err);
}, function () {
if (onCompleted) {
try {
onCompleted();
} catch (e) {
observer.onError(e);
}
}
observer.onCompleted();
});
});
};
/** @deprecated use #do or #tap instead. */
observableProto.doAction = function () {
deprecate('doAction', 'do or tap');
return this.tap.apply(this, arguments);
};
/**
* Invokes an action for each element in the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onNext Action to invoke for each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) {
return this.tap(arguments.length === 2 ? function (x) { onNext.call(thisArg, x); } : onNext);
};
/**
* Invokes an action upon exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onError Action to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) {
return this.tap(noop, arguments.length === 2 ? function (e) { onError.call(thisArg, e); } : onError);
};
/**
* Invokes an action upon graceful termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) {
return this.tap(noop, null, arguments.length === 2 ? function () { onCompleted.call(thisArg); } : onCompleted);
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
*/
observableProto['finally'] = observableProto.ensure = function (action) {
var source = this;
return new AnonymousObservable(function (observer) {
var subscription;
try {
subscription = source.subscribe(observer);
} catch (e) {
action();
throw e;
}
return disposableCreate(function () {
try {
subscription.dispose();
} catch (e) {
throw e;
} finally {
action();
}
});
});
};
/**
* @deprecated use #finally or #ensure instead.
*/
observableProto.finallyAction = function (action) {
deprecate('finallyAction', 'finally or ensure');
return this.ensure(action);
};
/**
* Ignores all elements in an observable sequence leaving only the termination messages.
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
*/
observableProto.ignoreElements = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(noop, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Materializes the implicit notifications of an observable sequence as explicit notification values.
* @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.
*/
observableProto.materialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (value) {
observer.onNext(notificationCreateOnNext(value));
}, function (e) {
observer.onNext(notificationCreateOnError(e));
observer.onCompleted();
}, function () {
observer.onNext(notificationCreateOnCompleted());
observer.onCompleted();
});
});
};
/**
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
*/
observableProto.repeat = function (repeatCount) {
return enumerableRepeat(this, repeatCount).concat();
};
/**
* Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.
* Note if you encounter an error and want it to retry once, then you must use .retry(2);
*
* @example
* var res = retried = retry.repeat();
* var res = retried = retry.repeat(2);
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retry = function (retryCount) {
return enumerableRepeat(this, retryCount).catchError();
};
/**
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
* For aggregation behavior with no intermediate results, see Observable.aggregate.
* @example
* var res = source.scan(function (acc, x) { return acc + x; });
* var res = source.scan(0, function (acc, x) { return acc + x; });
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing the accumulated values.
*/
observableProto.scan = function () {
var hasSeed = false, seed, accumulator, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[0];
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return new AnonymousObservable(function (observer) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
!hasValue && (hasValue = true);
try {
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(accumulation);
},
observer.onError.bind(observer),
function () {
!hasValue && hasSeed && observer.onNext(seed);
observer.onCompleted();
}
);
});
};
/**
* Bypasses a specified number of elements at the end of an observable sequence.
* @description
* This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
* @param count Number of elements to bypass at the end of the source sequence.
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*/
observableProto.skipLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && observer.onNext(q.shift());
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.
* @example
* var res = source.startWith(1, 2, 3);
* var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
* @param {Arguments} args The specified values to prepend to the observable sequence
* @returns {Observable} The source sequence prepended with the specified values.
*/
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (!!arguments.length && isScheduler(arguments[0])) {
scheduler = arguments[0];
start = 1;
} else {
scheduler = immediateScheduler;
}
values = slice.call(arguments, start);
return enumerableOf([observableFromArray(values, scheduler), this]).concat();
};
/**
* Returns a specified number of contiguous elements from the end of an observable sequence.
* @description
* This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
* the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
*/
observableProto.takeLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, observer.onError.bind(observer), function () {
while (q.length > 0) { observer.onNext(q.shift()); }
observer.onCompleted();
});
});
};
function concatMap(source, selector, thisArg) {
return source.map(function (x, i) {
var result = selector.call(thisArg, x, i, source);
isPromise(result) && (result = observableFromPromise(result));
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
return result;
}).concatAll();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {
if (isFunction(selector) && isFunction(resultSelector)) {
return this.concatMap(function (x, i) {
var selectorResult = selector(x, i);
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
return selectorResult.map(function (y, i2) {
return resultSelector(x, y, i, i2);
});
});
}
return isFunction(selector) ?
concatMap(this, selector, thisArg) :
concatMap(this, function () { return selector; });
};
/**
* Projects each element of an observable sequence into a new form by incorporating the element's index.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
observableProto.select = observableProto.map = function (selector, thisArg) {
var selectorFn = isFunction(selector) ? selector : function () { return selector; },
source = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return source.subscribe(function (value) {
var result;
try {
result = selectorFn.call(thisArg, value, count++, source);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Retrieves the value of a specified property from all elements in the Observable sequence.
* @param {String} prop The property to pluck.
* @returns {Observable} Returns a new Observable sequence of property values.
*/
observableProto.pluck = function (prop) {
return this.map(function (x) { return x[prop]; });
};
function flatMap(source, selector, thisArg) {
return source.map(function (x, i) {
var result = selector.call(thisArg, x, i, source);
isPromise(result) && (result = observableFromPromise(result));
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
return result;
}).mergeAll();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) {
if (isFunction(selector) && isFunction(resultSelector)) {
return this.flatMap(function (x, i) {
var selectorResult = selector(x, i);
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
return selectorResult.map(function (y, i2) {
return resultSelector(x, y, i, i2);
});
}, thisArg);
}
return isFunction(selector) ?
flatMap(this, selector, thisArg) :
flatMap(this, function () { return selector; });
};
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto.selectSwitch = observableProto.flatMapLatest = observableProto.switchMap = function (selector, thisArg) {
return this.select(selector, thisArg).switchLatest();
};
/**
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
* @param {Number} count The number of elements to skip before returning the remaining elements.
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
*/
observableProto.skip = function (count) {
if (count < 0) { throw new Error(argumentOutOfRange); }
var source = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return source.subscribe(function (x) {
if (remaining <= 0) {
observer.onNext(x);
} else {
remaining--;
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
* The element's index is used in the logic of the predicate function.
*
* var res = source.skipWhile(function (value) { return value < 10; });
* var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
observableProto.skipWhile = function (predicate, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = false;
return source.subscribe(function (x) {
if (!running) {
try {
running = !predicate.call(thisArg, x, i++, source);
} catch (e) {
observer.onError(e);
return;
}
}
running && observer.onNext(x);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).
*
* var res = source.take(5);
* var res = source.take(0, Rx.Scheduler.timeout);
* @param {Number} count The number of elements to return.
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
*/
observableProto.take = function (count, scheduler) {
if (count < 0) { throw new RangeError(argumentOutOfRange); }
if (count === 0) { return observableEmpty(scheduler); }
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining-- > 0) {
observer.onNext(x);
remaining === 0 && observer.onCompleted();
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns elements from an observable sequence as long as a specified condition is true.
* The element's index is used in the logic of the predicate function.
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
observableProto.takeWhile = function (predicate, thisArg) {
var observable = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = true;
return observable.subscribe(function (x) {
if (running) {
try {
running = predicate.call(thisArg, x, i++, observable);
} catch (e) {
observer.onError(e);
return;
}
if (running) {
observer.onNext(x);
} else {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
*
* @example
* var res = source.where(function (value) { return value < 10; });
* var res = source.where(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
observableProto.where = observableProto.filter = function (predicate, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var shouldRun;
try {
shouldRun = predicate.call(thisArg, value, count++, parent);
} catch (e) {
observer.onError(e);
return;
}
shouldRun && observer.onNext(value);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
Observable.fromCallback = function (func, context, selector) {
return function () {
var args = slice.call(arguments, 0);
return new AnonymousObservable(function (observer) {
function handler(e) {
var results = e;
if (selector) {
try {
results = selector(arguments);
} catch (err) {
observer.onError(err);
return;
}
observer.onNext(results);
} else {
if (results.length <= 1) {
observer.onNext.apply(observer, results);
} else {
observer.onNext(results);
}
}
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
}).publishLast().refCount();
};
};
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
Observable.fromNodeCallback = function (func, context, selector) {
return function () {
var args = slice.call(arguments, 0);
return new AnonymousObservable(function (observer) {
function handler(err) {
if (err) {
observer.onError(err);
return;
}
var results = slice.call(arguments, 1);
if (selector) {
try {
results = selector(results);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(results);
} else {
if (results.length <= 1) {
observer.onNext.apply(observer, results);
} else {
observer.onNext(results);
}
}
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
}).publishLast().refCount();
};
};
function fixEvent(event) {
var stopPropagation = function () {
this.cancelBubble = true;
};
var preventDefault = function () {
this.bubbledKeyCode = this.keyCode;
if (this.ctrlKey) {
try {
this.keyCode = 0;
} catch (e) { }
}
this.defaultPrevented = true;
this.returnValue = false;
this.modified = true;
};
event || (event = root.event);
if (!event.target) {
event.target = event.target || event.srcElement;
if (event.type == 'mouseover') {
event.relatedTarget = event.fromElement;
}
if (event.type == 'mouseout') {
event.relatedTarget = event.toElement;
}
// Adding stopPropogation and preventDefault to IE
if (!event.stopPropagation) {
event.stopPropagation = stopPropagation;
event.preventDefault = preventDefault;
}
// Normalize key events
switch (event.type) {
case 'keypress':
var c = ('charCode' in event ? event.charCode : event.keyCode);
if (c == 10) {
c = 0;
event.keyCode = 13;
} else if (c == 13 || c == 27) {
c = 0;
} else if (c == 3) {
c = 99;
}
event.charCode = c;
event.keyChar = event.charCode ? String.fromCharCode(event.charCode) : '';
break;
}
}
return event;
}
function createListener (element, name, handler) {
// Standards compliant
if (element.addEventListener) {
element.addEventListener(name, handler, false);
return disposableCreate(function () {
element.removeEventListener(name, handler, false);
});
}
if (element.attachEvent) {
// IE Specific
var innerHandler = function (event) {
handler(fixEvent(event));
};
element.attachEvent('on' + name, innerHandler);
return disposableCreate(function () {
element.detachEvent('on' + name, innerHandler);
});
}
// Level 1 DOM Events
element['on' + name] = handler;
return disposableCreate(function () {
element['on' + name] = null;
});
}
function createEventListener (el, eventName, handler) {
var disposables = new CompositeDisposable();
// Asume NodeList
if (Object.prototype.toString.call(el) === '[object NodeList]') {
for (var i = 0, len = el.length; i < len; i++) {
disposables.add(createEventListener(el.item(i), eventName, handler));
}
} else if (el) {
disposables.add(createListener(el, eventName, handler));
}
return disposables;
}
/**
* Configuration option to determine whether to use native events only
*/
Rx.config.useNativeEvents = false;
// Check for Angular/jQuery/Zepto support
var jq =
!!root.angular && !!angular.element ? angular.element :
(!!root.jQuery ? root.jQuery : (
!!root.Zepto ? root.Zepto : null));
// Check for ember
var ember = !!root.Ember && typeof root.Ember.addListener === 'function';
// Check for Backbone.Marionette. Note if using AMD add Marionette as a dependency of rxjs
// for proper loading order!
var marionette = !!root.Backbone && !!root.Backbone.Marionette;
/**
* Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.
*
* @example
* var source = Rx.Observable.fromEvent(element, 'mouseup');
*
* @param {Object} element The DOMElement or NodeList to attach a listener.
* @param {String} eventName The event name to attach the observable sequence.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence of events from the specified element and the specified event.
*/
Observable.fromEvent = function (element, eventName, selector) {
// Node.js specific
if (element.addListener) {
return fromEventPattern(
function (h) { element.addListener(eventName, h); },
function (h) { element.removeListener(eventName, h); },
selector);
}
// Use only if non-native events are allowed
if (!Rx.config.useNativeEvents) {
if (marionette) {
return fromEventPattern(
function (h) { element.on(eventName, h); },
function (h) { element.off(eventName, h); },
selector);
}
if (ember) {
return fromEventPattern(
function (h) { Ember.addListener(element, eventName, h); },
function (h) { Ember.removeListener(element, eventName, h); },
selector);
}
if (jq) {
var $elem = jq(element);
return fromEventPattern(
function (h) { $elem.on(eventName, h); },
function (h) { $elem.off(eventName, h); },
selector);
}
}
return new AnonymousObservable(function (observer) {
return createEventListener(
element,
eventName,
function handler (e) {
var results = e;
if (selector) {
try {
results = selector(arguments);
} catch (err) {
observer.onError(err);
return
}
}
observer.onNext(results);
});
}).publish().refCount();
};
/**
* Creates an observable sequence from an event emitter via an addHandler/removeHandler pair.
* @param {Function} addHandler The function to add a handler to the emitter.
* @param {Function} [removeHandler] The optional function to remove a handler from an emitter.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence which wraps an event from an event emitter
*/
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) {
return new AnonymousObservable(function (observer) {
function innerHandler (e) {
var result = e;
if (selector) {
try {
result = selector(arguments);
} catch (err) {
observer.onError(err);
return;
}
}
observer.onNext(result);
}
var returnValue = addHandler(innerHandler);
return disposableCreate(function () {
if (removeHandler) {
removeHandler(innerHandler, returnValue);
}
});
}).publish().refCount();
};
/**
* Converts a Promise to an Observable sequence
* @param {Promise} An ES6 Compliant promise.
* @returns {Observable} An Observable sequence which wraps the existing promise success and failure.
*/
var observableFromPromise = Observable.fromPromise = function (promise) {
return observableDefer(function () {
var subject = new Rx.AsyncSubject();
promise.then(
function (value) {
subject.onNext(value);
subject.onCompleted();
},
subject.onError.bind(subject));
return subject;
});
};
/*
* Converts an existing observable sequence to an ES6 Compatible Promise
* @example
* var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);
*
* // With config
* Rx.config.Promise = RSVP.Promise;
* var promise = Rx.Observable.return(42).toPromise();
* @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise.
* @returns {Promise} An ES6 compatible promise with the last value from the observable sequence.
*/
observableProto.toPromise = function (promiseCtor) {
promiseCtor || (promiseCtor = Rx.config.Promise);
if (!promiseCtor) { throw new TypeError('Promise type not provided nor in Rx.config.Promise'); }
var source = this;
return new promiseCtor(function (resolve, reject) {
// No cancellation can be done
var value, hasValue = false;
source.subscribe(function (v) {
value = v;
hasValue = true;
}, reject, function () {
hasValue && resolve(value);
});
});
};
/**
* Invokes the asynchronous function, surfacing the result through an observable sequence.
* @param {Function} functionAsync Asynchronous function which returns a Promise to run.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*/
Observable.startAsync = function (functionAsync) {
var promise;
try {
promise = functionAsync();
} catch (e) {
return observableThrow(e);
}
return observableFromPromise(promise);
}
/**
* Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
* subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
* invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
*
* @example
* 1 - res = source.multicast(observable);
* 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
*
* @param {Function|Subject} subjectOrSubjectSelector
* Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.
* Or:
* Subject to push source elements into.
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.multicast = function (subjectOrSubjectSelector, selector) {
var source = this;
return typeof subjectOrSubjectSelector === 'function' ?
new AnonymousObservable(function (observer) {
var connectable = source.multicast(subjectOrSubjectSelector());
return new CompositeDisposable(selector(connectable).subscribe(observer), connectable.connect());
}) :
new ConnectableObservable(source, subjectOrSubjectSelector);
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of Multicast using a regular Subject.
*
* @example
* var resres = source.publish();
* var res = source.publish(function (x) { return x; });
*
* @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publish = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new Subject(); }, selector) :
this.multicast(new Subject());
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.share();
*
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.share = function () {
return this.publish().refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
* This operator is a specialization of Multicast using a AsyncSubject.
*
* @example
* var res = source.publishLast();
* var res = source.publishLast(function (x) { return x; });
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishLast = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new AsyncSubject(); }, selector) :
this.multicast(new AsyncSubject());
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
* This operator is a specialization of Multicast using a BehaviorSubject.
*
* @example
* var res = source.publishValue(42);
* var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42);
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishValue = function (initialValueOrSelector, initialValue) {
return arguments.length === 2 ?
this.multicast(function () {
return new BehaviorSubject(initialValue);
}, initialValueOrSelector) :
this.multicast(new BehaviorSubject(initialValueOrSelector));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue.
* This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.shareValue(42);
*
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareValue = function (initialValue) {
return this.publishValue(initialValue).refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of Multicast using a ReplaySubject.
*
* @example
* var res = source.replay(null, 3);
* var res = source.replay(null, 3, 500);
* var res = source.replay(null, 3, 500, scheduler);
* var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler);
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param window [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.replay = function (selector, bufferSize, window, scheduler) {
return selector && isFunction(selector) ?
this.multicast(function () { return new ReplaySubject(bufferSize, window, scheduler); }, selector) :
this.multicast(new ReplaySubject(bufferSize, window, scheduler));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.shareReplay(3);
* var res = source.shareReplay(3, 500);
* var res = source.shareReplay(3, 500, scheduler);
*
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param window [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareReplay = function (bufferSize, window, scheduler) {
return this.replay(null, bufferSize, window, scheduler).refCount();
};
var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {
inherits(ConnectableObservable, __super__);
function ConnectableObservable(source, subject) {
var hasSubscription = false,
subscription,
sourceObservable = source.asObservable();
this.connect = function () {
if (!hasSubscription) {
hasSubscription = true;
subscription = new CompositeDisposable(sourceObservable.subscribe(subject), disposableCreate(function () {
hasSubscription = false;
}));
}
return subscription;
};
__super__.call(this, subject.subscribe.bind(subject));
}
ConnectableObservable.prototype.refCount = function () {
var connectableSubscription, count = 0, source = this;
return new AnonymousObservable(function (observer) {
var shouldConnect = ++count === 1,
subscription = source.subscribe(observer);
shouldConnect && (connectableSubscription = source.connect());
return function () {
subscription.dispose();
--count === 0 && connectableSubscription.dispose();
};
});
};
return ConnectableObservable;
}(Observable));
function observableTimerDate(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithAbsolute(dueTime, function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerDateAndPeriod(dueTime, period, scheduler) {
return new AnonymousObservable(function (observer) {
var count = 0, d = dueTime, p = normalizeTime(period);
return scheduler.scheduleRecursiveWithAbsolute(d, function (self) {
if (p > 0) {
var now = scheduler.now();
d = d + p;
d <= now && (d = now + p);
}
observer.onNext(count++);
self(d);
});
});
}
function observableTimerTimeSpan(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithRelative(normalizeTime(dueTime), function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) {
return dueTime === period ?
new AnonymousObservable(function (observer) {
return scheduler.schedulePeriodicWithState(0, period, function (count) {
observer.onNext(count);
return count + 1;
});
}) :
observableDefer(function () {
return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler);
});
}
/**
* Returns an observable sequence that produces a value after each period.
*
* @example
* 1 - res = Rx.Observable.interval(1000);
* 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);
*
* @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
* @returns {Observable} An observable sequence that produces a value after each period.
*/
var observableinterval = Observable.interval = function (period, scheduler) {
return observableTimerTimeSpanAndPeriod(period, period, isScheduler(scheduler) ? scheduler : timeoutScheduler);
};
/**
* Returns an observable sequence that produces a value after dueTime has elapsed and then after each period.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.
* @param {Mixed} [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period.
*/
var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) {
var period;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
if (periodOrScheduler !== undefined && typeof periodOrScheduler === 'number') {
period = periodOrScheduler;
} else if (isScheduler(periodOrScheduler)) {
scheduler = periodOrScheduler;
}
if (dueTime instanceof Date && period === undefined) {
return observableTimerDate(dueTime.getTime(), scheduler);
}
if (dueTime instanceof Date && period !== undefined) {
period = periodOrScheduler;
return observableTimerDateAndPeriod(dueTime.getTime(), period, scheduler);
}
return period === undefined ?
observableTimerTimeSpan(dueTime, scheduler) :
observableTimerTimeSpanAndPeriod(dueTime, period, scheduler);
};
function observableDelayTimeSpan(source, dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
var active = false,
cancelable = new SerialDisposable(),
exception = null,
q = [],
running = false,
subscription;
subscription = source.materialize().timestamp(scheduler).subscribe(function (notification) {
var d, shouldRun;
if (notification.value.kind === 'E') {
q = [];
q.push(notification);
exception = notification.value.exception;
shouldRun = !running;
} else {
q.push({ value: notification.value, timestamp: notification.timestamp + dueTime });
shouldRun = !active;
active = true;
}
if (shouldRun) {
if (exception !== null) {
observer.onError(exception);
} else {
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleRecursiveWithRelative(dueTime, function (self) {
var e, recurseDueTime, result, shouldRecurse;
if (exception !== null) {
return;
}
running = true;
do {
result = null;
if (q.length > 0 && q[0].timestamp - scheduler.now() <= 0) {
result = q.shift().value;
}
if (result !== null) {
result.accept(observer);
}
} while (result !== null);
shouldRecurse = false;
recurseDueTime = 0;
if (q.length > 0) {
shouldRecurse = true;
recurseDueTime = Math.max(0, q[0].timestamp - scheduler.now());
} else {
active = false;
}
e = exception;
running = false;
if (e !== null) {
observer.onError(e);
} else if (shouldRecurse) {
self(recurseDueTime);
}
}));
}
}
});
return new CompositeDisposable(subscription, cancelable);
});
}
function observableDelayDate(source, dueTime, scheduler) {
return observableDefer(function () {
return observableDelayTimeSpan(source, dueTime - scheduler.now(), scheduler);
});
}
/**
* Time shifts the observable sequence by dueTime. The relative time intervals between the values are preserved.
*
* @example
* 1 - res = Rx.Observable.delay(new Date());
* 2 - res = Rx.Observable.delay(new Date(), Rx.Scheduler.timeout);
*
* 3 - res = Rx.Observable.delay(5000);
* 4 - res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout);
* @memberOf Observable#
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.
* @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delay = function (dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return dueTime instanceof Date ?
observableDelayDate(this, dueTime.getTime(), scheduler) :
observableDelayTimeSpan(this, dueTime, scheduler);
};
/**
* Ignores values from an observable sequence which are followed by another value before dueTime.
* @param {Number} dueTime Duration of the debounce period for each value (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the debounce timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The debounced sequence.
*/
observableProto.debounce = observableProto.throttleWithTimeout = function (dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var cancelable = new SerialDisposable(), hasvalue = false, value, id = 0;
var subscription = source.subscribe(
function (x) {
hasvalue = true;
value = x;
id++;
var currentId = id,
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleWithRelative(dueTime, function () {
hasvalue && id === currentId && observer.onNext(value);
hasvalue = false;
}));
},
function (e) {
cancelable.dispose();
observer.onError(e);
hasvalue = false;
id++;
},
function () {
cancelable.dispose();
hasvalue && observer.onNext(value);
observer.onCompleted();
hasvalue = false;
id++;
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* @deprecated use #debounce or #throttleWithTimeout instead.
*/
observableProto.throttle = function(dueTime, scheduler) {
deprecate('throttle', 'debounce or throttleWithTimeout');
return this.debounce(dueTime, scheduler);
};
/**
* Records the timestamp for each value in an observable sequence.
*
* @example
* 1 - res = source.timestamp(); // produces { value: x, timestamp: ts }
* 2 - res = source.timestamp(Rx.Scheduler.timeout);
*
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with timestamp information on values.
*/
observableProto.timestamp = function (scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return this.map(function (x) {
return { value: x, timestamp: scheduler.now() };
});
};
function sampleObservable(source, sampler) {
return new AnonymousObservable(function (observer) {
var atEnd, value, hasValue;
function sampleSubscribe() {
if (hasValue) {
hasValue = false;
observer.onNext(value);
}
atEnd && observer.onCompleted();
}
return new CompositeDisposable(
source.subscribe(function (newValue) {
hasValue = true;
value = newValue;
}, observer.onError.bind(observer), function () {
atEnd = true;
}),
sampler.subscribe(sampleSubscribe, observer.onError.bind(observer), sampleSubscribe)
);
});
}
/**
* Samples the observable sequence at each interval.
*
* @example
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
* 2 - res = source.sample(5000); // 5 seconds
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Sampled observable sequence.
*/
observableProto.sample = observableProto.throttleLatest = function (intervalOrSampler, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return typeof intervalOrSampler === 'number' ?
sampleObservable(this, observableinterval(intervalOrSampler, scheduler)) :
sampleObservable(this, intervalOrSampler);
};
/**
* Returns the source observable sequence or the other observable sequence if dueTime elapses.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
* @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
* @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
observableProto.timeout = function (dueTime, other, scheduler) {
(other == null || typeof other === 'string') && (other = observableThrow(new Error(other || 'Timeout')));
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = dueTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (observer) {
var id = 0,
original = new SingleAssignmentDisposable(),
subscription = new SerialDisposable(),
switched = false,
timer = new SerialDisposable();
subscription.setDisposable(original);
function createTimer() {
var myId = id;
timer.setDisposable(scheduler[schedulerMethod](dueTime, function () {
if (id === myId) {
isPromise(other) && (other = observableFromPromise(other));
subscription.setDisposable(other.subscribe(observer));
}
}));
}
createTimer();
original.setDisposable(source.subscribe(function (x) {
if (!switched) {
id++;
observer.onNext(x);
createTimer();
}
}, function (e) {
if (!switched) {
id++;
observer.onError(e);
}
}, function () {
if (!switched) {
id++;
observer.onCompleted();
}
}));
return new CompositeDisposable(subscription, timer);
});
};
/**
* Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration.
* @param {Number} windowDuration time to wait before emitting another item after emitting the last item
* @param {Scheduler} [scheduler] the Scheduler to use internally to manage the timers that handle timeout for each item. If not provided, defaults to Scheduler.timeout.
* @returns {Observable} An Observable that performs the throttle operation.
*/
observableProto.throttleFirst = function (windowDuration, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var duration = +windowDuration || 0;
if (duration <= 0) { throw new RangeError('windowDuration cannot be less or equal zero.'); }
var source = this;
return new AnonymousObservable(function (observer) {
var lastOnNext = 0;
return source.subscribe(
function (x) {
var now = scheduler.now();
if (lastOnNext === 0 || now - lastOnNext >= duration) {
lastOnNext = now;
observer.onNext(x);
}
},
observer.onError.bind(observer),
observer.onCompleted.bind(observer)
);
});
};
var PausableObservable = (function (_super) {
inherits(PausableObservable, _super);
function subscribe(observer) {
var conn = this.source.publish(),
subscription = conn.subscribe(observer),
connection = disposableEmpty;
var pausable = this.pauser.distinctUntilChanged().subscribe(function (b) {
if (b) {
connection = conn.connect();
} else {
connection.dispose();
connection = disposableEmpty;
}
});
return new CompositeDisposable(subscription, connection, pausable);
}
function PausableObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
_super.call(this, subscribe);
}
PausableObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausable(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausable = function (pauser) {
return new PausableObservable(this, pauser);
};
function combineLatestSource(source, subject, resultSelector) {
return new AnonymousObservable(function (observer) {
var hasValue = [false, false],
hasValueAll = false,
isDone = false,
values = new Array(2),
err;
function next(x, i) {
values[i] = x
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
if (err) {
observer.onError(err);
return;
}
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
}
if (isDone && values[1]) {
observer.onCompleted();
}
}
return new CompositeDisposable(
source.subscribe(
function (x) {
next(x, 0);
},
function (e) {
if (values[1]) {
observer.onError(e);
} else {
err = e;
}
},
function () {
isDone = true;
values[1] && observer.onCompleted();
}),
subject.subscribe(
function (x) {
next(x, 1);
},
observer.onError.bind(observer),
function () {
isDone = true;
next(true, 1);
})
);
});
}
var PausableBufferedObservable = (function (__super__) {
inherits(PausableBufferedObservable, __super__);
function subscribe(observer) {
var q = [], previousShouldFire;
var subscription =
combineLatestSource(
this.source,
this.pauser.distinctUntilChanged().startWith(false),
function (data, shouldFire) {
return { data: data, shouldFire: shouldFire };
})
.subscribe(
function (results) {
if (previousShouldFire !== undefined && results.shouldFire != previousShouldFire) {
previousShouldFire = results.shouldFire;
// change in shouldFire
if (results.shouldFire) {
while (q.length > 0) {
observer.onNext(q.shift());
}
}
} else {
previousShouldFire = results.shouldFire;
// new data
if (results.shouldFire) {
observer.onNext(results.data);
} else {
q.push(results.data);
}
}
},
function (err) {
// Empty buffer before sending error
while (q.length > 0) {
observer.onNext(q.shift());
}
observer.onError(err);
},
function () {
// Empty buffer before sending completion
while (q.length > 0) {
observer.onNext(q.shift());
}
observer.onCompleted();
}
);
return subscription;
}
function PausableBufferedObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
__super__.call(this, subscribe);
}
PausableBufferedObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableBufferedObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableBufferedObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false,
* and yields the values that were buffered while paused.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausableBuffered(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausableBuffered = function (subject) {
return new PausableBufferedObservable(this, subject);
};
/**
* Attaches a controller to the observable sequence with the ability to queue.
* @example
* var source = Rx.Observable.interval(100).controlled();
* source.request(3); // Reads 3 values
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.controlled = function (enableQueue) {
if (enableQueue == null) { enableQueue = true; }
return new ControlledObservable(this, enableQueue);
};
var ControlledObservable = (function (_super) {
inherits(ControlledObservable, _super);
function subscribe (observer) {
return this.source.subscribe(observer);
}
function ControlledObservable (source, enableQueue) {
_super.call(this, subscribe);
this.subject = new ControlledSubject(enableQueue);
this.source = source.multicast(this.subject).refCount();
}
ControlledObservable.prototype.request = function (numberOfItems) {
if (numberOfItems == null) { numberOfItems = -1; }
return this.subject.request(numberOfItems);
};
return ControlledObservable;
}(Observable));
var ControlledSubject = Rx.ControlledSubject = (function (_super) {
function subscribe (observer) {
return this.subject.subscribe(observer);
}
inherits(ControlledSubject, _super);
function ControlledSubject(enableQueue) {
if (enableQueue == null) {
enableQueue = true;
}
_super.call(this, subscribe);
this.subject = new Subject();
this.enableQueue = enableQueue;
this.queue = enableQueue ? [] : null;
this.requestedCount = 0;
this.requestedDisposable = disposableEmpty;
this.error = null;
this.hasFailed = false;
this.hasCompleted = false;
this.controlledDisposable = disposableEmpty;
}
addProperties(ControlledSubject.prototype, Observer, {
onCompleted: function () {
checkDisposed.call(this);
this.hasCompleted = true;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onCompleted();
}
},
onError: function (error) {
checkDisposed.call(this);
this.hasFailed = true;
this.error = error;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onError(error);
}
},
onNext: function (value) {
checkDisposed.call(this);
var hasRequested = false;
if (this.requestedCount === 0) {
if (this.enableQueue) {
this.queue.push(value);
}
} else {
if (this.requestedCount !== -1) {
if (this.requestedCount-- === 0) {
this.disposeCurrentRequest();
}
}
hasRequested = true;
}
if (hasRequested) {
this.subject.onNext(value);
}
},
_processRequest: function (numberOfItems) {
if (this.enableQueue) {
//console.log('queue length', this.queue.length);
while (this.queue.length >= numberOfItems && numberOfItems > 0) {
//console.log('number of items', numberOfItems);
this.subject.onNext(this.queue.shift());
numberOfItems--;
}
if (this.queue.length !== 0) {
return { numberOfItems: numberOfItems, returnValue: true };
} else {
return { numberOfItems: numberOfItems, returnValue: false };
}
}
if (this.hasFailed) {
this.subject.onError(this.error);
this.controlledDisposable.dispose();
this.controlledDisposable = disposableEmpty;
} else if (this.hasCompleted) {
this.subject.onCompleted();
this.controlledDisposable.dispose();
this.controlledDisposable = disposableEmpty;
}
return { numberOfItems: numberOfItems, returnValue: false };
},
request: function (number) {
checkDisposed.call(this);
this.disposeCurrentRequest();
var self = this,
r = this._processRequest(number);
number = r.numberOfItems;
if (!r.returnValue) {
this.requestedCount = number;
this.requestedDisposable = disposableCreate(function () {
self.requestedCount = 0;
});
return this.requestedDisposable
} else {
return disposableEmpty;
}
},
disposeCurrentRequest: function () {
this.requestedDisposable.dispose();
this.requestedDisposable = disposableEmpty;
},
dispose: function () {
this.isDisposed = true;
this.error = null;
this.subject.dispose();
this.requestedDisposable.dispose();
}
});
return ControlledSubject;
}(Observable));
/**
* Executes a transducer to transform the observable sequence
* @param {Transducer} transducer A transducer to execute
* @returns {Observable} An Observable sequence containing the results from the transducer.
*/
observableProto.transduce = function(transducer) {
var source = this;
function transformForObserver(observer) {
return {
init: function() {
return observer;
},
step: function(obs, input) {
return obs.onNext(input);
},
result: function(obs) {
return obs.onCompleted();
}
};
}
return new AnonymousObservable(function(observer) {
var xform = transducer(transformForObserver(observer));
return source.subscribe(
function(v) {
try {
xform.step(observer, v);
} catch (e) {
observer.onError(e);
}
},
observer.onError.bind(observer),
function() { xform.result(observer); }
);
});
};
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
inherits(AnonymousObservable, __super__);
// Fix subscriber to check for undefined or function returned to decorate as Disposable
function fixSubscriber(subscriber) {
if (subscriber && typeof subscriber.dispose === 'function') { return subscriber; }
return typeof subscriber === 'function' ?
disposableCreate(subscriber) :
disposableEmpty;
}
function AnonymousObservable(subscribe) {
if (!(this instanceof AnonymousObservable)) {
return new AnonymousObservable(subscribe);
}
function s(observer) {
var setDisposable = function () {
try {
autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver)));
} catch (e) {
if (!autoDetachObserver.fail(e)) {
throw e;
}
}
};
var autoDetachObserver = new AutoDetachObserver(observer);
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.schedule(setDisposable);
} else {
setDisposable();
}
return autoDetachObserver;
}
__super__.call(this, s);
}
return AnonymousObservable;
}(Observable));
var AutoDetachObserver = (function (__super__) {
inherits(AutoDetachObserver, __super__);
function AutoDetachObserver(observer) {
__super__.call(this);
this.observer = observer;
this.m = new SingleAssignmentDisposable();
}
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
AutoDetachObserverPrototype.next = function (value) {
var noError = false;
try {
this.observer.onNext(value);
noError = true;
} catch (e) {
throw e;
} finally {
!noError && this.dispose();
}
};
AutoDetachObserverPrototype.error = function (err) {
try {
this.observer.onError(err);
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.completed = function () {
try {
this.observer.onCompleted();
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
AutoDetachObserverPrototype.getDisposable = function (value) { return this.m.getDisposable(); };
AutoDetachObserverPrototype.dispose = function () {
__super__.prototype.dispose.call(this);
this.m.dispose();
};
return AutoDetachObserver;
}(AbstractObserver));
/** @private */
var InnerSubscription = function (subject, observer) {
this.subject = subject;
this.observer = observer;
};
/**
* @private
* @memberOf InnerSubscription
*/
InnerSubscription.prototype.dispose = function () {
if (!this.subject.isDisposed && this.observer !== null) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
this.observer = null;
}
};
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
var Subject = Rx.Subject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.exception) {
observer.onError(this.exception);
return disposableEmpty;
}
observer.onCompleted();
return disposableEmpty;
}
inherits(Subject, _super);
/**
* Creates a subject.
* @constructor
*/
function Subject() {
_super.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.observers = [];
}
addProperties(Subject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
for (var i = 0, len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
/**
* Creates a subject from the specified observer and observable.
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
Subject.create = function (observer, observable) {
return new AnonymousSubject(observer, observable);
};
return Subject;
}(Observable));
/**
* Represents the result of an asynchronous operation.
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
*/
var AsyncSubject = Rx.AsyncSubject = (function (__super__) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
var ex = this.exception,
hv = this.hasValue,
v = this.value;
if (ex) {
observer.onError(ex);
} else if (hv) {
observer.onNext(v);
observer.onCompleted();
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(AsyncSubject, __super__);
/**
* Creates a subject that can only receive one value and that value is cached for all future observations.
* @constructor
*/
function AsyncSubject() {
__super__.call(this, subscribe);
this.isDisposed = false;
this.isStopped = false;
this.value = null;
this.hasValue = false;
this.observers = [];
this.exception = null;
}
addProperties(AsyncSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
checkDisposed.call(this);
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
*/
onCompleted: function () {
var o, i, len;
checkDisposed.call(this);
if (!this.isStopped) {
this.isStopped = true;
var os = this.observers.slice(0),
v = this.value,
hv = this.hasValue;
if (hv) {
for (i = 0, len = os.length; i < len; i++) {
o = os[i];
o.onNext(v);
o.onCompleted();
}
} else {
for (i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the error.
* @param {Mixed} error The Error to send to all observers.
*/
onError: function (error) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = error;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers = [];
}
},
/**
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
* @param {Mixed} value The value to store in the subject.
*/
onNext: function (value) {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.value = value;
this.hasValue = true;
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.exception = null;
this.value = null;
}
});
return AsyncSubject;
}(Observable));
var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {
inherits(AnonymousSubject, __super__);
function AnonymousSubject(observer, observable) {
this.observer = observer;
this.observable = observable;
__super__.call(this, this.observable.subscribe.bind(this.observable));
}
addProperties(AnonymousSubject.prototype, Observer, {
onCompleted: function () {
this.observer.onCompleted();
},
onError: function (exception) {
this.observer.onError(exception);
},
onNext: function (value) {
this.observer.onNext(value);
}
});
return AnonymousSubject;
}(Observable));
/**
* Represents a value that changes over time.
* Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.
*/
var BehaviorSubject = Rx.BehaviorSubject = (function (__super__) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
observer.onNext(this.value);
return new InnerSubscription(this, observer);
}
var ex = this.exception;
if (ex) {
observer.onError(ex);
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(BehaviorSubject, __super__);
/**
* @constructor
* Initializes a new instance of the BehaviorSubject class which creates a subject that caches its last value and starts with the specified value.
* @param {Mixed} value Initial value sent to observers when no other value has been received by the subject yet.
*/
function BehaviorSubject(value) {
__super__.call(this, subscribe);
this.value = value,
this.observers = [],
this.isDisposed = false,
this.isStopped = false,
this.exception = null;
}
addProperties(BehaviorSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.isStopped = true;
for (var i = 0, os = this.observers.slice(0), len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.exception = error;
for (var i = 0, os = this.observers.slice(0), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers = [];
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.value = value;
for (var i = 0, os = this.observers.slice(0), len = os.length; i < len; i++) {
os[i].onNext(value);
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.value = null;
this.exception = null;
}
});
return BehaviorSubject;
}(Observable));
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.
*/
var ReplaySubject = Rx.ReplaySubject = (function (__super__) {
function createRemovableDisposable(subject, observer) {
return disposableCreate(function () {
observer.dispose();
!subject.isDisposed && subject.observers.splice(subject.observers.indexOf(observer), 1);
});
}
function subscribe(observer) {
var so = new ScheduledObserver(this.scheduler, observer),
subscription = createRemovableDisposable(this, so);
checkDisposed.call(this);
this._trim(this.scheduler.now());
this.observers.push(so);
for (var i = 0, len = this.q.length; i < len; i++) {
so.onNext(this.q[i].value);
}
if (this.hasError) {
so.onError(this.error);
} else if (this.isStopped) {
so.onCompleted();
}
so.ensureActive();
return subscription;
}
inherits(ReplaySubject, __super__);
/**
* Initializes a new instance of the ReplaySubject class with the specified buffer size, window size and scheduler.
* @param {Number} [bufferSize] Maximum element count of the replay buffer.
* @param {Number} [windowSize] Maximum time length of the replay buffer.
* @param {Scheduler} [scheduler] Scheduler the observers are invoked on.
*/
function ReplaySubject(bufferSize, windowSize, scheduler) {
this.bufferSize = bufferSize == null ? Number.MAX_VALUE : bufferSize;
this.windowSize = windowSize == null ? Number.MAX_VALUE : windowSize;
this.scheduler = scheduler || currentThreadScheduler;
this.q = [];
this.observers = [];
this.isStopped = false;
this.isDisposed = false;
this.hasError = false;
this.error = null;
__super__.call(this, subscribe);
}
addProperties(ReplaySubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
_trim: function (now) {
while (this.q.length > this.bufferSize) {
this.q.shift();
}
while (this.q.length > 0 && (now - this.q[0].interval) > this.windowSize) {
this.q.shift();
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (this.isStopped) { return; }
var now = this.scheduler.now();
this.q.push({ interval: now, value: value });
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
var observer = o[i];
observer.onNext(value);
observer.ensureActive();
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.error = error;
this.hasError = true;
var now = this.scheduler.now();
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
var observer = o[i];
observer.onError(error);
observer.ensureActive();
}
this.observers = [];
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.isStopped = true;
var now = this.scheduler.now();
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
var observer = o[i];
observer.onCompleted();
observer.ensureActive();
}
this.observers = [];
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
return ReplaySubject;
}(Observable));
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
root.Rx = Rx;
define(function() {
return Rx;
});
} else if (freeExports && freeModule) {
// in Node.js or RingoJS
if (moduleExports) {
(freeModule.exports = Rx).Rx = Rx;
} else {
freeExports.Rx = Rx;
}
} else {
// in a browser or Rhino
root.Rx = Rx;
}
}.call(this));
|
src/App.js | huguobo/React-ToDo | import React, { Component } from 'react';
class VideoDemo extends Component{
componentDidMount(){
const inputDom = document.getElementById('searchInput');
inputDom.oninput=this.debounceX(this.saySomething,2000)
}
debounce(func, wait, immediate) {
var timeout,
result;
return function () {
var context = this,
args = arguments;
var later = function () {
timeout = null;
if (!immediate)
result = func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow)
result = func.apply(context, args);
return result;
};
};
debounceX (fn, wait) {
let timer = null;
return () => {
clearTimeout(timer);
timer = setTimeout(() => {
fn();
}, wait);
};
};
saySomething(){
console.log('request....................');
}
render(){
return(
<div>
<div>
<input id='searchInput' type='text' list='suggestList'></input>
</div>
<datalist id='suggestList'>
<option>566</option>
<option>34</option>
</datalist>
</div>
)
}
}
export default VideoDemo; |
files/rxjs/2.4.4/rx.js | CTres/jsdelivr | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (undefined) {
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
var Rx = {
internals: {},
config: {
Promise: root.Promise
},
helpers: { }
};
// Defaults
var noop = Rx.helpers.noop = function () { },
notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; },
isScheduler = Rx.helpers.isScheduler = function (x) { return x instanceof Rx.Scheduler; },
identity = Rx.helpers.identity = function (x) { return x; },
pluck = Rx.helpers.pluck = function (property) { return function (x) { return x[property]; }; },
just = Rx.helpers.just = function (value) { return function () { return value; }; },
defaultNow = Rx.helpers.defaultNow = Date.now,
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; },
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
not = Rx.helpers.not = function (a) { return !a; },
isFunction = Rx.helpers.isFunction = (function () {
var isFn = function (value) {
return typeof value == 'function' || false;
}
// fallback for older versions of Chrome and Safari
if (isFn(/x/)) {
isFn = function(value) {
return typeof value == 'function' && toString.call(value) == '[object Function]';
};
}
return isFn;
}());
function cloneArray(arr) { for(var a = [], i = 0, len = arr.length; i < len; i++) { a.push(arr[i]); } return a;}
Rx.config.longStackSupport = false;
var hasStacks = false;
try {
throw new Error();
} catch (e) {
hasStacks = !!e.stack;
}
// All code after this point will be filtered from stack traces reported by RxJS
var rStartingLine = captureLine(), rFileName;
var STACK_JUMP_SEPARATOR = "From previous event:";
function makeStackTraceLong(error, observable) {
// If possible, transform the error stack trace by removing Node and RxJS
// cruft, then concatenating with the stack trace of `observable`.
if (hasStacks &&
observable.stack &&
typeof error === "object" &&
error !== null &&
error.stack &&
error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1
) {
var stacks = [];
for (var o = observable; !!o; o = o.source) {
if (o.stack) {
stacks.unshift(o.stack);
}
}
stacks.unshift(error.stack);
var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n");
error.stack = filterStackString(concatedStacks);
}
}
function filterStackString(stackString) {
var lines = stackString.split("\n"),
desiredLines = [];
for (var i = 0, len = lines.length; i < len; i++) {
var line = lines[i];
if (!isInternalFrame(line) && !isNodeFrame(line) && line) {
desiredLines.push(line);
}
}
return desiredLines.join("\n");
}
function isInternalFrame(stackLine) {
var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine);
if (!fileNameAndLineNumber) {
return false;
}
var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1];
return fileName === rFileName &&
lineNumber >= rStartingLine &&
lineNumber <= rEndingLine;
}
function isNodeFrame(stackLine) {
return stackLine.indexOf("(module.js:") !== -1 ||
stackLine.indexOf("(node.js:") !== -1;
}
function captureLine() {
if (!hasStacks) { return; }
try {
throw new Error();
} catch (e) {
var lines = e.stack.split("\n");
var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2];
var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);
if (!fileNameAndLineNumber) { return; }
rFileName = fileNameAndLineNumber[0];
return fileNameAndLineNumber[1];
}
}
function getFileNameAndLineNumber(stackLine) {
// Named functions: "at functionName (filename:lineNumber:columnNumber)"
var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);
if (attempt1) { return [attempt1[1], Number(attempt1[2])]; }
// Anonymous functions: "at filename:lineNumber:columnNumber"
var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);
if (attempt2) { return [attempt2[1], Number(attempt2[2])]; }
// Firefox style: "function@filename:lineNumber or @filename:lineNumber"
var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine);
if (attempt3) { return [attempt3[1], Number(attempt3[2])]; }
}
var EmptyError = Rx.EmptyError = function() {
this.message = 'Sequence contains no elements.';
Error.call(this);
};
EmptyError.prototype = Error.prototype;
var ObjectDisposedError = Rx.ObjectDisposedError = function() {
this.message = 'Object has been disposed';
Error.call(this);
};
ObjectDisposedError.prototype = Error.prototype;
var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function () {
this.message = 'Argument out of range';
Error.call(this);
};
ArgumentOutOfRangeError.prototype = Error.prototype;
var NotSupportedError = Rx.NotSupportedError = function (message) {
this.message = message || 'This operation is not supported';
Error.call(this);
};
NotSupportedError.prototype = Error.prototype;
var NotImplementedError = Rx.NotImplementedError = function (message) {
this.message = message || 'This operation is not implemented';
Error.call(this);
};
NotImplementedError.prototype = Error.prototype;
var notImplemented = Rx.helpers.notImplemented = function () {
throw new NotImplementedError();
};
var notSupported = Rx.helpers.notSupported = function () {
throw new NotSupportedError();
};
// Shim in iterator support
var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||
'_es6shim_iterator_';
// Bug for mozilla version
if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
$iterator$ = '@@iterator';
}
var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined };
var isIterable = Rx.helpers.isIterable = function (o) {
return o[$iterator$] !== undefined;
}
var isArrayLike = Rx.helpers.isArrayLike = function (o) {
return o && o.length !== undefined;
}
Rx.helpers.iterator = $iterator$;
var bindCallback = Rx.internals.bindCallback = function (func, thisArg, argCount) {
if (typeof thisArg === 'undefined') { return func; }
switch(argCount) {
case 0:
return function() {
return func.call(thisArg)
};
case 1:
return function(arg) {
return func.call(thisArg, arg);
}
case 2:
return function(value, index) {
return func.call(thisArg, value, index);
};
case 3:
return function(value, index, collection) {
return func.call(thisArg, value, index, collection);
};
}
return function() {
return func.apply(thisArg, arguments);
};
};
/** Used to determine if values are of the language type Object */
var dontEnums = ['toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'],
dontEnumsLength = dontEnums.length;
/** `Object#toString` result shortcuts */
var argsClass = '[object Arguments]',
arrayClass = '[object Array]',
boolClass = '[object Boolean]',
dateClass = '[object Date]',
errorClass = '[object Error]',
funcClass = '[object Function]',
numberClass = '[object Number]',
objectClass = '[object Object]',
regexpClass = '[object RegExp]',
stringClass = '[object String]';
var toString = Object.prototype.toString,
hasOwnProperty = Object.prototype.hasOwnProperty,
supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4
supportNodeClass,
errorProto = Error.prototype,
objectProto = Object.prototype,
stringProto = String.prototype,
propertyIsEnumerable = objectProto.propertyIsEnumerable;
try {
supportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch (e) {
supportNodeClass = true;
}
var nonEnumProps = {};
nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
nonEnumProps[objectClass] = { 'constructor': true };
var support = {};
(function () {
var ctor = function() { this.x = 1; },
props = [];
ctor.prototype = { 'valueOf': 1, 'y': 1 };
for (var key in new ctor) { props.push(key); }
for (key in arguments) { }
// Detect if `name` or `message` properties of `Error.prototype` are enumerable by default.
support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
// Detect if `prototype` properties are enumerable by default.
support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
// Detect if `arguments` object indexes are non-enumerable
support.nonEnumArgs = key != 0;
// Detect if properties shadowing those on `Object.prototype` are non-enumerable.
support.nonEnumShadows = !/valueOf/.test(props);
}(1));
var isObject = Rx.internals.isObject = function(value) {
var type = typeof value;
return value && (type == 'function' || type == 'object') || false;
};
function keysIn(object) {
var result = [];
if (!isObject(object)) {
return result;
}
if (support.nonEnumArgs && object.length && isArguments(object)) {
object = slice.call(object);
}
var skipProto = support.enumPrototypes && typeof object == 'function',
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error);
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
!(skipErrorProps && (key == 'message' || key == 'name'))) {
result.push(key);
}
}
if (support.nonEnumShadows && object !== objectProto) {
var ctor = object.constructor,
index = -1,
length = dontEnumsLength;
if (object === (ctor && ctor.prototype)) {
var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
nonEnum = nonEnumProps[className];
}
while (++index < length) {
key = dontEnums[index];
if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) {
result.push(key);
}
}
}
return result;
}
function internalFor(object, callback, keysFunc) {
var index = -1,
props = keysFunc(object),
length = props.length;
while (++index < length) {
var key = props[index];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
}
function internalForIn(object, callback) {
return internalFor(object, callback, keysIn);
}
function isNode(value) {
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
// methods that are `typeof` "string" and still can coerce nodes to strings
return typeof value.toString != 'function' && typeof (value + '') == 'string';
}
var isArguments = function(value) {
return (value && typeof value == 'object') ? toString.call(value) == argsClass : false;
}
// fallback for browsers that can't detect `arguments` objects by [[Class]]
if (!supportsArgsClass) {
isArguments = function(value) {
return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false;
};
}
var isEqual = Rx.internals.isEqual = function (x, y) {
return deepEquals(x, y, [], []);
};
/** @private
* Used for deep comparison
**/
function deepEquals(a, b, stackA, stackB) {
// exit early for identical values
if (a === b) {
// treat `+0` vs. `-0` as not equal
return a !== 0 || (1 / a == 1 / b);
}
var type = typeof a,
otherType = typeof b;
// exit early for unlike primitive values
if (a === a && (a == null || b == null ||
(type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) {
return false;
}
// compare [[Class]] names
var className = toString.call(a),
otherClass = toString.call(b);
if (className == argsClass) {
className = objectClass;
}
if (otherClass == argsClass) {
otherClass = objectClass;
}
if (className != otherClass) {
return false;
}
switch (className) {
case boolClass:
case dateClass:
// coerce dates and booleans to numbers, dates to milliseconds and booleans
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal
return +a == +b;
case numberClass:
// treat `NaN` vs. `NaN` as equal
return (a != +a) ?
b != +b :
// but treat `-0` vs. `+0` as not equal
(a == 0 ? (1 / a == 1 / b) : a == +b);
case regexpClass:
case stringClass:
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
// treat string primitives and their corresponding object instances as equal
return a == String(b);
}
var isArr = className == arrayClass;
if (!isArr) {
// exit for functions and DOM nodes
if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
return false;
}
// in older versions of Opera, `arguments` objects have `Array` constructors
var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
// non `Object` object instances with different constructors are not equal
if (ctorA != ctorB &&
!(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) &&
!(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
('constructor' in a && 'constructor' in b)
) {
return false;
}
}
// assume cyclic structures are equal
// the algorithm for detecting cyclic structures is adapted from ES 5.1
// section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
var initedStack = !stackA;
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == a) {
return stackB[length] == b;
}
}
var size = 0;
var result = true;
// add `a` and `b` to the stack of traversed objects
stackA.push(a);
stackB.push(b);
// recursively compare objects and arrays (susceptible to call stack limits)
if (isArr) {
// compare lengths to determine if a deep comparison is necessary
length = a.length;
size = b.length;
result = size == length;
if (result) {
// deep compare the contents, ignoring non-numeric properties
while (size--) {
var index = length,
value = b[size];
if (!(result = deepEquals(a[size], value, stackA, stackB))) {
break;
}
}
}
}
else {
// deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
// which, in this case, is more costly
internalForIn(b, function(value, key, b) {
if (hasOwnProperty.call(b, key)) {
// count the number of properties.
size++;
// deep compare each property value.
return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB));
}
});
if (result) {
// ensure both objects have the same number of properties
internalForIn(a, function(value, key, a) {
if (hasOwnProperty.call(a, key)) {
// `size` will be `-1` if `a` has more properties than `b`
return (result = --size > -1);
}
});
}
}
stackA.pop();
stackB.pop();
return result;
}
var hasProp = {}.hasOwnProperty,
slice = Array.prototype.slice;
var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
var addProperties = Rx.internals.addProperties = function (obj) {
for(var sources = [], i = 1, len = arguments.length; i < len; i++) { sources.push(arguments[i]); }
for (var idx = 0, ln = sources.length; idx < ln; idx++) {
var source = sources[idx];
for (var prop in source) {
obj[prop] = source[prop];
}
}
};
// Rx Utils
var addRef = Rx.internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
var errorObj = {e: {}};
var tryCatchTarget;
function tryCatcher() {
try {
return tryCatchTarget.apply(this, arguments);
} catch (e) {
errorObj.e = e;
return errorObj;
}
}
function tryCatch(fn) {
if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }
tryCatchTarget = fn;
return tryCatcher;
}
function thrower(e) {
throw e;
}
// Collections
function IndexedItem(id, value) {
this.id = id;
this.value = value;
}
IndexedItem.prototype.compareTo = function (other) {
var c = this.value.compareTo(other.value);
c === 0 && (c = this.id - other.id);
return c;
};
// Priority Queue for Scheduling
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
this.items = new Array(capacity);
this.length = 0;
};
var priorityProto = PriorityQueue.prototype;
priorityProto.isHigherPriority = function (left, right) {
return this.items[left].compareTo(this.items[right]) < 0;
};
priorityProto.percolate = function (index) {
if (index >= this.length || index < 0) { return; }
var parent = index - 1 >> 1;
if (parent < 0 || parent === index) { return; }
if (this.isHigherPriority(index, parent)) {
var temp = this.items[index];
this.items[index] = this.items[parent];
this.items[parent] = temp;
this.percolate(parent);
}
};
priorityProto.heapify = function (index) {
+index || (index = 0);
if (index >= this.length || index < 0) { return; }
var left = 2 * index + 1,
right = 2 * index + 2,
first = index;
if (left < this.length && this.isHigherPriority(left, first)) {
first = left;
}
if (right < this.length && this.isHigherPriority(right, first)) {
first = right;
}
if (first !== index) {
var temp = this.items[index];
this.items[index] = this.items[first];
this.items[first] = temp;
this.heapify(first);
}
};
priorityProto.peek = function () { return this.items[0].value; };
priorityProto.removeAt = function (index) {
this.items[index] = this.items[--this.length];
this.items[this.length] = undefined;
this.heapify();
};
priorityProto.dequeue = function () {
var result = this.peek();
this.removeAt(0);
return result;
};
priorityProto.enqueue = function (item) {
var index = this.length++;
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
this.percolate(index);
};
priorityProto.remove = function (item) {
for (var i = 0; i < this.length; i++) {
if (this.items[i].value === item) {
this.removeAt(i);
return true;
}
}
return false;
};
PriorityQueue.count = 0;
/**
* Represents a group of disposable resources that are disposed together.
* @constructor
*/
var CompositeDisposable = Rx.CompositeDisposable = function () {
var args = [], i, len;
if (Array.isArray(arguments[0])) {
args = arguments[0];
len = args.length;
} else {
len = arguments.length;
args = new Array(len);
for(i = 0; i < len; i++) { args[i] = arguments[i]; }
}
for(i = 0; i < len; i++) {
if (!isDisposable(args[i])) { throw new TypeError('Not a disposable'); }
}
this.disposables = args;
this.isDisposed = false;
this.length = args.length;
};
var CompositeDisposablePrototype = CompositeDisposable.prototype;
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
* @param {Mixed} item Disposable to add.
*/
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {
item.dispose();
} else {
this.disposables.push(item);
this.length++;
}
};
/**
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
* @param {Mixed} item Disposable to remove.
* @returns {Boolean} true if found; false otherwise.
*/
CompositeDisposablePrototype.remove = function (item) {
var shouldDispose = false;
if (!this.isDisposed) {
var idx = this.disposables.indexOf(item);
if (idx !== -1) {
shouldDispose = true;
this.disposables.splice(idx, 1);
this.length--;
item.dispose();
}
}
return shouldDispose;
};
/**
* Disposes all disposables in the group and removes them from the group.
*/
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var len = this.disposables.length, currentDisposables = new Array(len);
for(var i = 0; i < len; i++) { currentDisposables[i] = this.disposables[i]; }
this.disposables = [];
this.length = 0;
for (i = 0; i < len; i++) {
currentDisposables[i].dispose();
}
}
};
/**
* Provides a set of static methods for creating Disposables.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;
this.action = action || noop;
};
/** Performs the task of cleaning up resources. */
Disposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.action();
this.isDisposed = true;
}
};
/**
* Creates a disposable object that invokes the specified action when disposed.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
/**
* Gets the disposable that does nothing when disposed.
*/
var disposableEmpty = Disposable.empty = { dispose: noop };
/**
* Validates whether the given object is a disposable
* @param {Object} Object to test whether it has a dispose method
* @returns {Boolean} true if a disposable object, else false.
*/
var isDisposable = Disposable.isDisposable = function (d) {
return d && isFunction(d.dispose);
};
var checkDisposed = Disposable.checkDisposed = function (disposable) {
if (disposable.isDisposed) { throw new ObjectDisposedError(); }
};
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = (function () {
function BooleanDisposable () {
this.isDisposed = false;
this.current = null;
}
var booleanDisposablePrototype = BooleanDisposable.prototype;
/**
* Gets the underlying disposable.
* @return The underlying disposable.
*/
booleanDisposablePrototype.getDisposable = function () {
return this.current;
};
/**
* Sets the underlying disposable.
* @param {Disposable} value The new underlying disposable.
*/
booleanDisposablePrototype.setDisposable = function (value) {
var shouldDispose = this.isDisposed;
if (!shouldDispose) {
var old = this.current;
this.current = value;
}
old && old.dispose();
shouldDispose && value && value.dispose();
};
/**
* Disposes the underlying disposable as well as all future replacements.
*/
booleanDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var old = this.current;
this.current = null;
}
old && old.dispose();
};
return BooleanDisposable;
}());
var SerialDisposable = Rx.SerialDisposable = SingleAssignmentDisposable;
/**
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
*/
var RefCountDisposable = Rx.RefCountDisposable = (function () {
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
this.isInnerDisposed = false;
}
InnerDisposable.prototype.dispose = function () {
if (!this.disposable.isDisposed && !this.isInnerDisposed) {
this.isInnerDisposed = true;
this.disposable.count--;
if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {
this.disposable.isDisposed = true;
this.disposable.underlyingDisposable.dispose();
}
}
};
/**
* Initializes a new instance of the RefCountDisposable with the specified disposable.
* @constructor
* @param {Disposable} disposable Underlying disposable.
*/
function RefCountDisposable(disposable) {
this.underlyingDisposable = disposable;
this.isDisposed = false;
this.isPrimaryDisposed = false;
this.count = 0;
}
/**
* Disposes the underlying disposable only when all dependent disposables have been disposed
*/
RefCountDisposable.prototype.dispose = function () {
if (!this.isDisposed && !this.isPrimaryDisposed) {
this.isPrimaryDisposed = true;
if (this.count === 0) {
this.isDisposed = true;
this.underlyingDisposable.dispose();
}
}
};
/**
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.
*/
RefCountDisposable.prototype.getDisposable = function () {
return this.isDisposed ? disposableEmpty : new InnerDisposable(this);
};
return RefCountDisposable;
})();
function ScheduledDisposable(scheduler, disposable) {
this.scheduler = scheduler;
this.disposable = disposable;
this.isDisposed = false;
}
function scheduleItem(s, self) {
if (!self.isDisposed) {
self.isDisposed = true;
self.disposable.dispose();
}
}
ScheduledDisposable.prototype.dispose = function () {
this.scheduler.scheduleWithState(this, scheduleItem);
};
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
this.scheduler = scheduler;
this.state = state;
this.action = action;
this.dueTime = dueTime;
this.comparer = comparer || defaultSubComparer;
this.disposable = new SingleAssignmentDisposable();
}
ScheduledItem.prototype.invoke = function () {
this.disposable.setDisposable(this.invokeCore());
};
ScheduledItem.prototype.compareTo = function (other) {
return this.comparer(this.dueTime, other.dueTime);
};
ScheduledItem.prototype.isCancelled = function () {
return this.disposable.isDisposed;
};
ScheduledItem.prototype.invokeCore = function () {
return this.action(this.scheduler, this.state);
};
/** Provides a set of static properties to access commonly used schedulers. */
var Scheduler = Rx.Scheduler = (function () {
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {
this.now = now;
this._schedule = schedule;
this._scheduleRelative = scheduleRelative;
this._scheduleAbsolute = scheduleAbsolute;
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
var schedulerProto = Scheduler.prototype;
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.schedule = function (action) {
return this._schedule(action, invokeAction);
};
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithState = function (state, action) {
return this._schedule(state, action);
};
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelative = function (dueTime, action) {
return this._scheduleRelative(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative(state, dueTime, action);
};
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsolute = function (dueTime, action) {
return this._scheduleAbsolute(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute(state, dueTime, action);
};
/** Gets the current time according to the local machine's system clock. */
Scheduler.now = defaultNow;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
Scheduler.normalize = function (timeSpan) {
timeSpan < 0 && (timeSpan = 0);
return timeSpan;
};
return Scheduler;
}());
var normalizeTime = Scheduler.normalize;
(function (schedulerProto) {
function invokeRecImmediate(scheduler, pair) {
var state = pair[0], action = pair[1], group = new CompositeDisposable();
function recursiveAction(state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
}
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair[0], action = pair[1], group = new CompositeDisposable();
function recursiveAction(state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method](state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function scheduleInnerRecursive(action, self) {
action(function(dt) { self(action, dt); });
}
/**
* Schedules an action to be executed recursively.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursive = function (action) {
return this.scheduleRecursiveWithState(action, function (_action, self) {
_action(function () { self(_action); }); });
};
/**
* Schedules an action to be executed recursively.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithState = function (state, action) {
return this.scheduleWithState([state, action], invokeRecImmediate);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) {
return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative([state, action], dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) {
return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute([state, action], dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
});
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodic = function (period, action) {
return this.schedulePeriodicWithState(null, period, action);
};
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) {
if (typeof root.setInterval === 'undefined') { throw new NotSupportedError(); }
period = normalizeTime(period);
var s = state, id = root.setInterval(function () { s = action(s); }, period);
return disposableCreate(function () { root.clearInterval(id); });
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions.
* @param {Function} handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false.
* @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling.
*/
schedulerProto.catchError = schedulerProto['catch'] = function (handler) {
return new CatchScheduler(this, handler);
};
}(Scheduler.prototype));
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
function tick(command, recurse) {
recurse(0, this._period);
try {
this._state = this._action(this._state);
} catch (e) {
this._cancel.dispose();
throw e;
}
}
function SchedulePeriodicRecursive(scheduler, state, period, action) {
this._scheduler = scheduler;
this._state = state;
this._period = period;
this._action = action;
}
SchedulePeriodicRecursive.prototype.start = function () {
var d = new SingleAssignmentDisposable();
this._cancel = d;
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
return d;
};
return SchedulePeriodicRecursive;
}());
/** Gets a scheduler that schedules work immediately on the current thread. */
var immediateScheduler = Scheduler.immediate = (function () {
function scheduleNow(state, action) { return action(this, state); }
return new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);
}());
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
function runTrampoline () {
while (queue.length > 0) {
var item = queue.dequeue();
!item.isCancelled() && item.invoke();
}
}
function scheduleNow(state, action) {
var si = new ScheduledItem(this, state, action, this.now());
if (!queue) {
queue = new PriorityQueue(4);
queue.enqueue(si);
var result = tryCatch(runTrampoline)();
queue = null;
if (result === errorObj) { return thrower(result.e); }
} else {
queue.enqueue(si);
}
return si.disposable;
}
var currentScheduler = new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);
currentScheduler.scheduleRequired = function () { return !queue; };
return currentScheduler;
}());
var scheduleMethod, clearMethod = noop;
var localTimer = (function () {
var localSetTimeout, localClearTimeout = noop;
if ('WScript' in this) {
localSetTimeout = function (fn, time) {
WScript.Sleep(time);
fn();
};
} else if (!!root.setTimeout) {
localSetTimeout = root.setTimeout;
localClearTimeout = root.clearTimeout;
} else {
throw new NotSupportedError();
}
return {
setTimeout: localSetTimeout,
clearTimeout: localClearTimeout
};
}());
var localSetTimeout = localTimer.setTimeout,
localClearTimeout = localTimer.clearTimeout;
(function () {
var reNative = RegExp('^' +
String(toString)
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/toString| for [^\]]+/g, '.*?') + '$'
);
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
!reNative.test(setImmediate) && setImmediate,
clearImmediate = typeof (clearImmediate = freeGlobal && moduleExports && freeGlobal.clearImmediate) == 'function' &&
!reNative.test(clearImmediate) && clearImmediate;
function postMessageSupported () {
// Ensure not in a worker
if (!root.postMessage || root.importScripts) { return false; }
var isAsync = false,
oldHandler = root.onmessage;
// Test for async
root.onmessage = function () { isAsync = true; };
root.postMessage('', '*');
root.onmessage = oldHandler;
return isAsync;
}
// Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout
if (typeof setImmediate === 'function') {
scheduleMethod = setImmediate;
clearMethod = clearImmediate;
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleMethod = process.nextTick;
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
tasks = {},
taskId = 0;
var onGlobalPostMessage = function (event) {
// Only if we're a match to avoid any other global events
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
var handleId = event.data.substring(MSG_PREFIX.length),
action = tasks[handleId];
action();
delete tasks[handleId];
}
}
if (root.addEventListener) {
root.addEventListener('message', onGlobalPostMessage, false);
} else {
root.attachEvent('onmessage', onGlobalPostMessage, false);
}
scheduleMethod = function (action) {
var currentId = taskId++;
tasks[currentId] = action;
root.postMessage(MSG_PREFIX + currentId, '*');
};
} else if (!!root.MessageChannel) {
var channel = new root.MessageChannel(),
channelTasks = {},
channelTaskId = 0;
channel.port1.onmessage = function (event) {
var id = event.data,
action = channelTasks[id];
action();
delete channelTasks[id];
};
scheduleMethod = function (action) {
var id = channelTaskId++;
channelTasks[id] = action;
channel.port2.postMessage(id);
};
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
scheduleMethod = function (action) {
var scriptElement = root.document.createElement('script');
scriptElement.onreadystatechange = function () {
action();
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
root.document.documentElement.appendChild(scriptElement);
};
} else {
scheduleMethod = function (action) { return localSetTimeout(action, 0); };
clearMethod = localClearTimeout;
}
}());
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*/
var timeoutScheduler = Scheduler.timeout = Scheduler.default = (function () {
function scheduleNow(state, action) {
var scheduler = this,
disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
});
return new CompositeDisposable(disposable, disposableCreate(function () {
clearMethod(id);
}));
}
function scheduleRelative(state, dueTime, action) {
var scheduler = this,
dt = Scheduler.normalize(dueTime);
if (dt === 0) {
return scheduler.scheduleWithState(state, action);
}
var disposable = new SingleAssignmentDisposable();
var id = localSetTimeout(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
}, dt);
return new CompositeDisposable(disposable, disposableCreate(function () {
localClearTimeout(id);
}));
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
})();
var CatchScheduler = (function (__super__) {
function scheduleNow(state, action) {
return this._scheduler.scheduleWithState(state, this._wrap(action));
}
function scheduleRelative(state, dueTime, action) {
return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action));
}
function scheduleAbsolute(state, dueTime, action) {
return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action));
}
inherits(CatchScheduler, __super__);
function CatchScheduler(scheduler, handler) {
this._scheduler = scheduler;
this._handler = handler;
this._recursiveOriginal = null;
this._recursiveWrapper = null;
__super__.call(this, this._scheduler.now.bind(this._scheduler), scheduleNow, scheduleRelative, scheduleAbsolute);
}
CatchScheduler.prototype._clone = function (scheduler) {
return new CatchScheduler(scheduler, this._handler);
};
CatchScheduler.prototype._wrap = function (action) {
var parent = this;
return function (self, state) {
try {
return action(parent._getRecursiveWrapper(self), state);
} catch (e) {
if (!parent._handler(e)) { throw e; }
return disposableEmpty;
}
};
};
CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) {
if (this._recursiveOriginal !== scheduler) {
this._recursiveOriginal = scheduler;
var wrapper = this._clone(scheduler);
wrapper._recursiveOriginal = scheduler;
wrapper._recursiveWrapper = wrapper;
this._recursiveWrapper = wrapper;
}
return this._recursiveWrapper;
};
CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) {
var self = this, failed = false, d = new SingleAssignmentDisposable();
d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) {
if (failed) { return null; }
try {
return action(state1);
} catch (e) {
failed = true;
if (!self._handler(e)) { throw e; }
d.dispose();
return null;
}
}));
return d;
};
return CatchScheduler;
}(Scheduler));
/**
* Represents a notification to an observer.
*/
var Notification = Rx.Notification = (function () {
function Notification(kind, value, exception, accept, acceptObservable, toString) {
this.kind = kind;
this.value = value;
this.exception = exception;
this._accept = accept;
this._acceptObservable = acceptObservable;
this.toString = toString;
}
/**
* Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
*
* @memberOf Notification
* @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
* @param {Function} onError Delegate to invoke for an OnError notification.
* @param {Function} onCompleted Delegate to invoke for an OnCompleted notification.
* @returns {Any} Result produced by the observation.
*/
Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) {
return observerOrOnNext && typeof observerOrOnNext === 'object' ?
this._acceptObservable(observerOrOnNext) :
this._accept(observerOrOnNext, onError, onCompleted);
};
/**
* Returns an observable sequence with a single notification.
*
* @memberOf Notifications
* @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
*/
Notification.prototype.toObservable = function (scheduler) {
var self = this;
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithState(self, function (_, notification) {
notification._acceptObservable(observer);
notification.kind === 'N' && observer.onCompleted();
});
});
};
return Notification;
})();
/**
* Creates an object that represents an OnNext notification to an observer.
* @param {Any} value The value contained in the notification.
* @returns {Notification} The OnNext notification containing the value.
*/
var notificationCreateOnNext = Notification.createOnNext = (function () {
function _accept(onNext) { return onNext(this.value); }
function _acceptObservable(observer) { return observer.onNext(this.value); }
function toString() { return 'OnNext(' + this.value + ')'; }
return function (value) {
return new Notification('N', value, null, _accept, _acceptObservable, toString);
};
}());
/**
* Creates an object that represents an OnError notification to an observer.
* @param {Any} error The exception contained in the notification.
* @returns {Notification} The OnError notification containing the exception.
*/
var notificationCreateOnError = Notification.createOnError = (function () {
function _accept (onNext, onError) { return onError(this.exception); }
function _acceptObservable(observer) { return observer.onError(this.exception); }
function toString () { return 'OnError(' + this.exception + ')'; }
return function (e) {
return new Notification('E', null, e, _accept, _acceptObservable, toString);
};
}());
/**
* Creates an object that represents an OnCompleted notification to an observer.
* @returns {Notification} The OnCompleted notification.
*/
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
function _accept (onNext, onError, onCompleted) { return onCompleted(); }
function _acceptObservable(observer) { return observer.onCompleted(); }
function toString () { return 'OnCompleted()'; }
return function () {
return new Notification('C', null, null, _accept, _acceptObservable, toString);
};
}());
var Enumerator = Rx.internals.Enumerator = function (next) {
this._next = next;
};
Enumerator.prototype.next = function () {
return this._next();
};
Enumerator.prototype[$iterator$] = function () { return this; }
var Enumerable = Rx.internals.Enumerable = function (iterator) {
this._iterator = iterator;
};
Enumerable.prototype[$iterator$] = function () {
return this._iterator();
};
Enumerable.prototype.concat = function () {
var sources = this;
return new AnonymousObservable(function (o) {
var e = sources[$iterator$]();
var isDisposed, subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
if (isDisposed) { return; }
try {
var currentItem = e.next();
} catch (ex) {
return o.onError(ex);
}
if (currentItem.done) {
return o.onCompleted();
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
function(x) { o.onNext(x); },
function(err) { o.onError(err); },
self)
);
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
Enumerable.prototype.catchError = function () {
var sources = this;
return new AnonymousObservable(function (o) {
var e = sources[$iterator$]();
var isDisposed, subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function (lastException, self) {
if (isDisposed) { return; }
try {
var currentItem = e.next();
} catch (ex) {
return observer.onError(ex);
}
if (currentItem.done) {
if (lastException !== null) {
o.onError(lastException);
} else {
o.onCompleted();
}
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
function(x) { o.onNext(x); },
self,
function() { o.onCompleted(); }));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
Enumerable.prototype.catchErrorWhen = function (notificationHandler) {
var sources = this;
return new AnonymousObservable(function (o) {
var exceptions = new Subject(),
notifier = new Subject(),
handled = notificationHandler(exceptions),
notificationDisposable = handled.subscribe(notifier);
var e = sources[$iterator$]();
var isDisposed,
lastException,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
if (isDisposed) { return; }
try {
var currentItem = e.next();
} catch (ex) {
return o.onError(ex);
}
if (currentItem.done) {
if (lastException) {
o.onError(lastException);
} else {
o.onCompleted();
}
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var outer = new SingleAssignmentDisposable();
var inner = new SingleAssignmentDisposable();
subscription.setDisposable(new CompositeDisposable(inner, outer));
outer.setDisposable(currentValue.subscribe(
function(x) { o.onNext(x); },
function (exn) {
inner.setDisposable(notifier.subscribe(self, function(ex) {
o.onError(ex);
}, function() {
o.onCompleted();
}));
exceptions.onNext(exn);
},
function() { o.onCompleted(); }));
});
return new CompositeDisposable(notificationDisposable, subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
if (repeatCount == null) { repeatCount = -1; }
return new Enumerable(function () {
var left = repeatCount;
return new Enumerator(function () {
if (left === 0) { return doneEnumerator; }
if (left > 0) { left--; }
return { done: false, value: value };
});
});
};
var enumerableOf = Enumerable.of = function (source, selector, thisArg) {
if (selector) {
var selectorFn = bindCallback(selector, thisArg, 3);
}
return new Enumerable(function () {
var index = -1;
return new Enumerator(
function () {
return ++index < source.length ?
{ done: false, value: !selector ? source[index] : selectorFn(source[index], index, source) } :
doneEnumerator;
});
});
};
/**
* Supports push-style iteration over an observable sequence.
*/
var Observer = Rx.Observer = function () { };
/**
* Creates a notification callback from an observer.
* @returns The action that forwards its input notification to the underlying observer.
*/
Observer.prototype.toNotifier = function () {
var observer = this;
return function (n) { return n.accept(observer); };
};
/**
* Hides the identity of an observer.
* @returns An observer that hides the identity of the specified observer.
*/
Observer.prototype.asObserver = function () {
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
};
/**
* Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods.
* If a violation is detected, an Error is thrown from the offending observer method call.
* @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.
*/
Observer.prototype.checked = function () { return new CheckedObserver(this); };
/**
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
onNext || (onNext = noop);
onError || (onError = defaultError);
onCompleted || (onCompleted = noop);
return new AnonymousObserver(onNext, onError, onCompleted);
};
/**
* Creates an observer from a notification callback.
*
* @static
* @memberOf Observer
* @param {Function} handler Action that handles a notification.
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
*/
Observer.fromNotifier = function (handler, thisArg) {
return new AnonymousObserver(function (x) {
return handler.call(thisArg, notificationCreateOnNext(x));
}, function (e) {
return handler.call(thisArg, notificationCreateOnError(e));
}, function () {
return handler.call(thisArg, notificationCreateOnCompleted());
});
};
/**
* Schedules the invocation of observer methods on the given scheduler.
* @param {Scheduler} scheduler Scheduler to schedule observer messages on.
* @returns {Observer} Observer whose messages are scheduled on the given scheduler.
*/
Observer.prototype.notifyOn = function (scheduler) {
return new ObserveOnObserver(scheduler, this);
};
Observer.prototype.makeSafe = function(disposable) {
return new AnonymousSafeObserver(this._onNext, this._onError, this._onCompleted, disposable);
};
/**
* Abstract base class for implementations of the Observer class.
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
*/
var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) {
inherits(AbstractObserver, __super__);
/**
* Creates a new observer in a non-stopped state.
*/
function AbstractObserver() {
this.isStopped = false;
__super__.call(this);
}
// Must be implemented by other observers
AbstractObserver.prototype.next = notImplemented;
AbstractObserver.prototype.error = notImplemented;
AbstractObserver.prototype.completed = notImplemented;
/**
* Notifies the observer of a new element in the sequence.
* @param {Any} value Next element in the sequence.
*/
AbstractObserver.prototype.onNext = function (value) {
if (!this.isStopped) { this.next(value); }
};
/**
* Notifies the observer that an exception has occurred.
* @param {Any} error The error that has occurred.
*/
AbstractObserver.prototype.onError = function (error) {
if (!this.isStopped) {
this.isStopped = true;
this.error(error);
}
};
/**
* Notifies the observer of the end of the sequence.
*/
AbstractObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.completed();
}
};
/**
* Disposes the observer, causing it to transition to the stopped state.
*/
AbstractObserver.prototype.dispose = function () {
this.isStopped = true;
};
AbstractObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.error(e);
return true;
}
return false;
};
return AbstractObserver;
}(Observer));
/**
* Class to create an Observer instance from delegate-based implementations of the on* methods.
*/
var AnonymousObserver = Rx.AnonymousObserver = (function (__super__) {
inherits(AnonymousObserver, __super__);
/**
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
* @param {Any} onNext Observer's OnNext action implementation.
* @param {Any} onError Observer's OnError action implementation.
* @param {Any} onCompleted Observer's OnCompleted action implementation.
*/
function AnonymousObserver(onNext, onError, onCompleted) {
__super__.call(this);
this._onNext = onNext;
this._onError = onError;
this._onCompleted = onCompleted;
}
/**
* Calls the onNext action.
* @param {Any} value Next element in the sequence.
*/
AnonymousObserver.prototype.next = function (value) {
this._onNext(value);
};
/**
* Calls the onError action.
* @param {Any} error The error that has occurred.
*/
AnonymousObserver.prototype.error = function (error) {
this._onError(error);
};
/**
* Calls the onCompleted action.
*/
AnonymousObserver.prototype.completed = function () {
this._onCompleted();
};
return AnonymousObserver;
}(AbstractObserver));
var CheckedObserver = (function (__super__) {
inherits(CheckedObserver, __super__);
function CheckedObserver(observer) {
__super__.call(this);
this._observer = observer;
this._state = 0; // 0 - idle, 1 - busy, 2 - done
}
var CheckedObserverPrototype = CheckedObserver.prototype;
CheckedObserverPrototype.onNext = function (value) {
this.checkAccess();
var res = tryCatch(this._observer.onNext).call(this._observer, value);
this._state = 0;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.onError = function (err) {
this.checkAccess();
var res = tryCatch(this._observer.onError).call(this._observer, err);
this._state = 2;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.onCompleted = function () {
this.checkAccess();
var res = tryCatch(this._observer.onCompleted).call(this._observer);
this._state = 2;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.checkAccess = function () {
if (this._state === 1) { throw new Error('Re-entrancy detected'); }
if (this._state === 2) { throw new Error('Observer completed'); }
if (this._state === 0) { this._state = 1; }
};
return CheckedObserver;
}(Observer));
var ScheduledObserver = Rx.internals.ScheduledObserver = (function (__super__) {
inherits(ScheduledObserver, __super__);
function ScheduledObserver(scheduler, observer) {
__super__.call(this);
this.scheduler = scheduler;
this.observer = observer;
this.isAcquired = false;
this.hasFaulted = false;
this.queue = [];
this.disposable = new SerialDisposable();
}
ScheduledObserver.prototype.next = function (value) {
var self = this;
this.queue.push(function () { self.observer.onNext(value); });
};
ScheduledObserver.prototype.error = function (e) {
var self = this;
this.queue.push(function () { self.observer.onError(e); });
};
ScheduledObserver.prototype.completed = function () {
var self = this;
this.queue.push(function () { self.observer.onCompleted(); });
};
ScheduledObserver.prototype.ensureActive = function () {
var isOwner = false, parent = this;
if (!this.hasFaulted && this.queue.length > 0) {
isOwner = !this.isAcquired;
this.isAcquired = true;
}
if (isOwner) {
this.disposable.setDisposable(this.scheduler.scheduleRecursive(function (self) {
var work;
if (parent.queue.length > 0) {
work = parent.queue.shift();
} else {
parent.isAcquired = false;
return;
}
try {
work();
} catch (ex) {
parent.queue = [];
parent.hasFaulted = true;
throw ex;
}
self();
}));
}
};
ScheduledObserver.prototype.dispose = function () {
__super__.prototype.dispose.call(this);
this.disposable.dispose();
};
return ScheduledObserver;
}(AbstractObserver));
var ObserveOnObserver = (function (__super__) {
inherits(ObserveOnObserver, __super__);
function ObserveOnObserver(scheduler, observer, cancel) {
__super__.call(this, scheduler, observer);
this._cancel = cancel;
}
ObserveOnObserver.prototype.next = function (value) {
__super__.prototype.next.call(this, value);
this.ensureActive();
};
ObserveOnObserver.prototype.error = function (e) {
__super__.prototype.error.call(this, e);
this.ensureActive();
};
ObserveOnObserver.prototype.completed = function () {
__super__.prototype.completed.call(this);
this.ensureActive();
};
ObserveOnObserver.prototype.dispose = function () {
__super__.prototype.dispose.call(this);
this._cancel && this._cancel.dispose();
this._cancel = null;
};
return ObserveOnObserver;
})(ScheduledObserver);
var observableProto;
/**
* Represents a push-style collection.
*/
var Observable = Rx.Observable = (function () {
function Observable(subscribe) {
if (Rx.config.longStackSupport && hasStacks) {
try {
throw new Error();
} catch (e) {
this.stack = e.stack.substring(e.stack.indexOf("\n") + 1);
}
var self = this;
this._subscribe = function (observer) {
var oldOnError = observer.onError.bind(observer);
observer.onError = function (err) {
makeStackTraceLong(err, self);
oldOnError(err);
};
return subscribe.call(self, observer);
};
} else {
this._subscribe = subscribe;
}
}
observableProto = Observable.prototype;
/**
* Subscribes an observer to the observable sequence.
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
return this._subscribe(typeof observerOrOnNext === 'object' ?
observerOrOnNext :
observerCreate(observerOrOnNext, onError, onCompleted));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnNext = function (onNext, thisArg) {
return this._subscribe(observerCreate(typeof thisArg !== 'undefined' ? function(x) { onNext.call(thisArg, x); } : onNext));
};
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnError = function (onError, thisArg) {
return this._subscribe(observerCreate(null, typeof thisArg !== 'undefined' ? function(e) { onError.call(thisArg, e); } : onError));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnCompleted = function (onCompleted, thisArg) {
return this._subscribe(observerCreate(null, null, typeof thisArg !== 'undefined' ? function() { onCompleted.call(thisArg); } : onCompleted));
};
return Observable;
})();
var ObservableBase = Rx.ObservableBase = (function (__super__) {
inherits(ObservableBase, __super__);
function fixSubscriber(subscriber) {
return subscriber && isFunction(subscriber.dispose) ? subscriber :
isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;
}
function setDisposable(s, state) {
var ado = state[0], self = state[1];
var sub = tryCatch(self.subscribeCore).call(self, ado);
if (sub === errorObj) {
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
}
ado.setDisposable(fixSubscriber(sub));
}
function subscribe(observer) {
var ado = new AutoDetachObserver(observer), state = [ado, this];
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.scheduleWithState(state, setDisposable);
} else {
setDisposable(null, state);
}
return ado;
}
function ObservableBase() {
__super__.call(this, subscribe);
}
ObservableBase.prototype.subscribeCore = notImplemented;
return ObservableBase;
}(Observable));
/**
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
*
* This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
* that require to be run on a scheduler, use subscribeOn.
*
* @param {Scheduler} scheduler Scheduler to notify observers on.
* @returns {Observable} The source sequence whose observations happen on the specified scheduler.
*/
observableProto.observeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(new ObserveOnObserver(scheduler, observer));
}, source);
};
/**
* Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
* see the remarks section for more information on the distinction between subscribeOn and observeOn.
* This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
* callbacks on a scheduler, use observeOn.
* @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on.
* @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
d.setDisposable(m);
m.setDisposable(scheduler.schedule(function () {
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer)));
}));
return d;
}, source);
};
/**
* Converts a Promise to an Observable sequence
* @param {Promise} An ES6 Compliant promise.
* @returns {Observable} An Observable sequence which wraps the existing promise success and failure.
*/
var observableFromPromise = Observable.fromPromise = function (promise) {
return observableDefer(function () {
var subject = new Rx.AsyncSubject();
promise.then(
function (value) {
subject.onNext(value);
subject.onCompleted();
},
subject.onError.bind(subject));
return subject;
});
};
/*
* Converts an existing observable sequence to an ES6 Compatible Promise
* @example
* var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);
*
* // With config
* Rx.config.Promise = RSVP.Promise;
* var promise = Rx.Observable.return(42).toPromise();
* @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise.
* @returns {Promise} An ES6 compatible promise with the last value from the observable sequence.
*/
observableProto.toPromise = function (promiseCtor) {
promiseCtor || (promiseCtor = Rx.config.Promise);
if (!promiseCtor) { throw new NotSupportedError('Promise type not provided nor in Rx.config.Promise'); }
var source = this;
return new promiseCtor(function (resolve, reject) {
// No cancellation can be done
var value, hasValue = false;
source.subscribe(function (v) {
value = v;
hasValue = true;
}, reject, function () {
hasValue && resolve(value);
});
});
};
var ToArrayObservable = (function(__super__) {
inherits(ToArrayObservable, __super__);
function ToArrayObservable(source) {
this.source = source;
__super__.call(this);
}
ToArrayObservable.prototype.subscribeCore = function(observer) {
return this.source.subscribe(new ToArrayObserver(observer));
};
return ToArrayObservable;
}(ObservableBase));
function ToArrayObserver(observer) {
this.observer = observer;
this.a = [];
this.isStopped = false;
}
ToArrayObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } };
ToArrayObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
}
};
ToArrayObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onNext(this.a);
this.observer.onCompleted();
}
};
ToArrayObserver.prototype.dispose = function () { this.isStopped = true; }
ToArrayObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
/**
* Creates an array from an observable sequence.
* @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
return new ToArrayObservable(this);
};
/**
* Creates an observable sequence from a specified subscribe method implementation.
* @example
* var res = Rx.Observable.create(function (observer) { return function () { } );
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
* var res = Rx.Observable.create(function (observer) { } );
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/
Observable.create = Observable.createWithDisposable = function (subscribe, parent) {
return new AnonymousObservable(subscribe, parent);
};
/**
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
*
* @example
* var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise.
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
*/
var observableDefer = Observable.defer = function (observableFactory) {
return new AnonymousObservable(function (observer) {
var result;
try {
result = observableFactory();
} catch (e) {
return observableThrow(e).subscribe(observer);
}
isPromise(result) && (result = observableFromPromise(result));
return result.subscribe(observer);
});
};
/**
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
*
* @example
* var res = Rx.Observable.empty();
* var res = Rx.Observable.empty(Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
* @returns {Observable} An observable sequence with no elements.
*/
var observableEmpty = Observable.empty = function (scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onCompleted();
});
});
};
var FromObservable = (function(__super__) {
inherits(FromObservable, __super__);
function FromObservable(iterable, mapper, scheduler) {
this.iterable = iterable;
this.mapper = mapper;
this.scheduler = scheduler;
__super__.call(this);
}
FromObservable.prototype.subscribeCore = function (observer) {
var sink = new FromSink(observer, this);
return sink.run();
};
return FromObservable;
}(ObservableBase));
var FromSink = (function () {
function FromSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
FromSink.prototype.run = function () {
var list = Object(this.parent.iterable),
it = getIterable(list),
observer = this.observer,
mapper = this.parent.mapper;
function loopRecursive(i, recurse) {
try {
var next = it.next();
} catch (e) {
return observer.onError(e);
}
if (next.done) {
return observer.onCompleted();
}
var result = next.value;
if (mapper) {
try {
result = mapper(result, i);
} catch (e) {
return observer.onError(e);
}
}
observer.onNext(result);
recurse(i + 1);
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
return FromSink;
}());
var maxSafeInteger = Math.pow(2, 53) - 1;
function StringIterable(str) {
this._s = s;
}
StringIterable.prototype[$iterator$] = function () {
return new StringIterator(this._s);
};
function StringIterator(str) {
this._s = s;
this._l = s.length;
this._i = 0;
}
StringIterator.prototype[$iterator$] = function () {
return this;
};
StringIterator.prototype.next = function () {
return this._i < this._l ? { done: false, value: this._s.charAt(this._i++) } : doneEnumerator;
};
function ArrayIterable(a) {
this._a = a;
}
ArrayIterable.prototype[$iterator$] = function () {
return new ArrayIterator(this._a);
};
function ArrayIterator(a) {
this._a = a;
this._l = toLength(a);
this._i = 0;
}
ArrayIterator.prototype[$iterator$] = function () {
return this;
};
ArrayIterator.prototype.next = function () {
return this._i < this._l ? { done: false, value: this._a[this._i++] } : doneEnumerator;
};
function numberIsFinite(value) {
return typeof value === 'number' && root.isFinite(value);
}
function isNan(n) {
return n !== n;
}
function getIterable(o) {
var i = o[$iterator$], it;
if (!i && typeof o === 'string') {
it = new StringIterable(o);
return it[$iterator$]();
}
if (!i && o.length !== undefined) {
it = new ArrayIterable(o);
return it[$iterator$]();
}
if (!i) { throw new TypeError('Object is not iterable'); }
return o[$iterator$]();
}
function sign(value) {
var number = +value;
if (number === 0) { return number; }
if (isNaN(number)) { return number; }
return number < 0 ? -1 : 1;
}
function toLength(o) {
var len = +o.length;
if (isNaN(len)) { return 0; }
if (len === 0 || !numberIsFinite(len)) { return len; }
len = sign(len) * Math.floor(Math.abs(len));
if (len <= 0) { return 0; }
if (len > maxSafeInteger) { return maxSafeInteger; }
return len;
}
/**
* This method creates a new Observable sequence from an array-like or iterable object.
* @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence.
* @param {Function} [mapFn] Map function to call on every element of the array.
* @param {Any} [thisArg] The context to use calling the mapFn if provided.
* @param {Scheduler} [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
*/
var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) {
if (iterable == null) {
throw new Error('iterable cannot be null.')
}
if (mapFn && !isFunction(mapFn)) {
throw new Error('mapFn when provided must be a function');
}
if (mapFn) {
var mapper = bindCallback(mapFn, thisArg, 2);
}
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new FromObservable(iterable, mapper, scheduler);
}
var FromArrayObservable = (function(__super__) {
inherits(FromArrayObservable, __super__);
function FromArrayObservable(args, scheduler) {
this.args = args;
this.scheduler = scheduler;
__super__.call(this);
}
FromArrayObservable.prototype.subscribeCore = function (observer) {
var sink = new FromArraySink(observer, this);
return sink.run();
};
return FromArrayObservable;
}(ObservableBase));
function FromArraySink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
FromArraySink.prototype.run = function () {
var observer = this.observer, args = this.parent.args, len = args.length;
function loopRecursive(i, recurse) {
if (i < len) {
observer.onNext(args[i]);
recurse(i + 1);
} else {
observer.onCompleted();
}
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
* @deprecated use Observable.from or Observable.of
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
*/
var observableFromArray = Observable.fromArray = function (array, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new FromArrayObservable(array, scheduler)
};
/**
* Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.
* @returns {Observable} The generated sequence.
*/
Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var first = true, state = initialState;
return scheduler.scheduleRecursive(function (self) {
var hasResult, result;
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
}
} catch (exception) {
observer.onError(exception);
return;
}
if (hasResult) {
observer.onNext(result);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
* @returns {Observable} An observable sequence whose observers will never get called.
*/
var observableNever = Observable.never = function () {
return new AnonymousObservable(function () {
return disposableEmpty;
});
};
function observableOf (scheduler, array) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new FromArrayObservable(array, scheduler);
}
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.of = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return new FromArrayObservable(args, currentThreadScheduler);
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.ofWithScheduler = function (scheduler) {
var len = arguments.length, args = new Array(len - 1);
for(var i = 1; i < len; i++) { args[i - 1] = arguments[i]; }
return new FromArrayObservable(args, scheduler);
};
/**
* Convert an object into an observable sequence of [key, value] pairs.
* @param {Object} obj The object to inspect.
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} An observable sequence of [key, value] pairs from the object.
*/
Observable.pairs = function (obj, scheduler) {
scheduler || (scheduler = Rx.Scheduler.currentThread);
return new AnonymousObservable(function (observer) {
var keys = Object.keys(obj), len = keys.length;
return scheduler.scheduleRecursiveWithState(0, function (idx, self) {
if (idx < len) {
var key = keys[idx];
observer.onNext([key, obj[key]]);
self(idx + 1);
} else {
observer.onCompleted();
}
});
});
};
var RangeObservable = (function(__super__) {
inherits(RangeObservable, __super__);
function RangeObservable(start, count, scheduler) {
this.start = start;
this.count = count;
this.scheduler = scheduler;
__super__.call(this);
}
RangeObservable.prototype.subscribeCore = function (observer) {
var sink = new RangeSink(observer, this);
return sink.run();
};
return RangeObservable;
}(ObservableBase));
var RangeSink = (function () {
function RangeSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
RangeSink.prototype.run = function () {
var start = this.parent.start, count = this.parent.count, observer = this.observer;
function loopRecursive(i, recurse) {
if (i < count) {
observer.onNext(start + i);
recurse(i + 1);
} else {
observer.onCompleted();
}
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
return RangeSink;
}());
/**
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
* @param {Number} start The value of the first integer in the sequence.
* @param {Number} count The number of sequential integers to generate.
* @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.
* @returns {Observable} An observable sequence that contains a range of sequential integral numbers.
*/
Observable.range = function (start, count, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new RangeObservable(start, count, scheduler);
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.repeat(42);
* var res = Rx.Observable.repeat(42, 4);
* 3 - res = Rx.Observable.repeat(42, 4, Rx.Scheduler.timeout);
* 4 - res = Rx.Observable.repeat(42, null, Rx.Scheduler.timeout);
* @param {Mixed} value Element to repeat.
* @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
* @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence that repeats the given element the specified number of times.
*/
Observable.repeat = function (value, repeatCount, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return observableReturn(value, scheduler).repeat(repeatCount == null ? -1 : repeatCount);
};
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
* There is an alias called 'just', and 'returnValue' for browsers <IE9.
* @param {Mixed} value Single element in the resulting observable sequence.
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence containing the single specified element.
*/
var observableReturn = Observable['return'] = Observable.just = function (value, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onNext(value);
observer.onCompleted();
});
});
};
/** @deprecated use return or just */
Observable.returnValue = function () {
//deprecate('returnValue', 'return or just');
return observableReturn.apply(null, arguments);
};
/**
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
* There is an alias to this method called 'throwError' for browsers <IE9.
* @param {Mixed} error An object used for the sequence's termination.
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
*/
var observableThrow = Observable['throw'] = Observable.throwError = function (error, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onError(error);
});
});
};
/** @deprecated use #some instead */
Observable.throwException = function () {
//deprecate('throwException', 'throwError');
return Observable.throwError.apply(null, arguments);
};
/**
* Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
* @param {Function} resourceFactory Factory function to obtain a resource object.
* @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.
* @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.
*/
Observable.using = function (resourceFactory, observableFactory) {
return new AnonymousObservable(function (observer) {
var disposable = disposableEmpty, resource, source;
try {
resource = resourceFactory();
resource && (disposable = resource);
source = observableFactory(resource);
} catch (exception) {
return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable);
}
return new CompositeDisposable(source.subscribe(observer), disposable);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
* @param {Observable} rightSource Second observable sequence or Promise.
* @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first.
*/
observableProto.amb = function (rightSource) {
var leftSource = this;
return new AnonymousObservable(function (observer) {
var choice,
leftChoice = 'L', rightChoice = 'R',
leftSubscription = new SingleAssignmentDisposable(),
rightSubscription = new SingleAssignmentDisposable();
isPromise(rightSource) && (rightSource = observableFromPromise(rightSource));
function choiceL() {
if (!choice) {
choice = leftChoice;
rightSubscription.dispose();
}
}
function choiceR() {
if (!choice) {
choice = rightChoice;
leftSubscription.dispose();
}
}
leftSubscription.setDisposable(leftSource.subscribe(function (left) {
choiceL();
if (choice === leftChoice) {
observer.onNext(left);
}
}, function (err) {
choiceL();
if (choice === leftChoice) {
observer.onError(err);
}
}, function () {
choiceL();
if (choice === leftChoice) {
observer.onCompleted();
}
}));
rightSubscription.setDisposable(rightSource.subscribe(function (right) {
choiceR();
if (choice === rightChoice) {
observer.onNext(right);
}
}, function (err) {
choiceR();
if (choice === rightChoice) {
observer.onError(err);
}
}, function () {
choiceR();
if (choice === rightChoice) {
observer.onCompleted();
}
}));
return new CompositeDisposable(leftSubscription, rightSubscription);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
*
* @example
* var = Rx.Observable.amb(xs, ys, zs);
* @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.
*/
Observable.amb = function () {
var acc = observableNever(), items = [];
if (Array.isArray(arguments[0])) {
items = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { items.push(arguments[i]); }
}
function func(previous, current) {
return previous.amb(current);
}
for (var i = 0, len = items.length; i < len; i++) {
acc = func(acc, items[i]);
}
return acc;
};
function observableCatchHandler(source, handler) {
return new AnonymousObservable(function (o) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(function (x) { o.onNext(x); }, function (e) {
try {
var result = handler(e);
} catch (ex) {
return o.onError(ex);
}
isPromise(result) && (result = observableFromPromise(result));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(result.subscribe(o));
}, function (x) { o.onCompleted(x); }));
return subscription;
}, source);
}
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @example
* 1 - xs.catchException(ys)
* 2 - xs.catchException(function (ex) { return ys(ex); })
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
*/
observableProto['catch'] = observableProto.catchError = observableProto.catchException = function (handlerOrSecond) {
return typeof handlerOrSecond === 'function' ?
observableCatchHandler(this, handlerOrSecond) :
observableCatch([this, handlerOrSecond]);
};
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs.
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable.catchError = Observable['catch'] = Observable.catchException = function () {
var items = [];
if (Array.isArray(arguments[0])) {
items = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { items.push(arguments[i]); }
}
return enumerableOf(items).catchError();
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
* This can be in the form of an argument list of observables or an array.
*
* @example
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.combineLatest = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
if (Array.isArray(args[0])) {
args[0].unshift(this);
} else {
args.unshift(this);
}
return combineLatest.apply(this, args);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
*
* @example
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
var combineLatest = Observable.combineLatest = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var resultSelector = args.pop();
Array.isArray(args[0]) && (args = args[0]);
return new AnonymousObservable(function (o) {
var n = args.length,
falseFactory = function () { return false; },
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
var res = resultSelector.apply(null, values);
} catch (e) {
return o.onError(e);
}
o.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
o.onCompleted();
}
}
function done (i) {
isDone[i] = true;
isDone.every(identity) && o.onCompleted();
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
values[i] = x;
next(i);
},
function(e) { o.onError(e); },
function () { done(i); }
));
subscriptions[i] = sad;
}(idx));
}
return new CompositeDisposable(subscriptions);
}, this);
};
/**
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
observableProto.concat = function () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
args.unshift(this);
return observableConcat.apply(null, args);
};
/**
* Concatenates all the observable sequences.
* @param {Array | Arguments} args Arguments or an array to concat to the observable sequence.
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
var args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
args = new Array(arguments.length);
for(var i = 0, len = arguments.length; i < len; i++) { args[i] = arguments[i]; }
}
return enumerableOf(args).concat();
};
/**
* Concatenates an observable sequence of observable sequences.
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
*/
observableProto.concatAll = observableProto.concatObservable = function () {
return this.merge(1);
};
var MergeObservable = (function (__super__) {
inherits(MergeObservable, __super__);
function MergeObservable(source, maxConcurrent) {
this.source = source;
this.maxConcurrent = maxConcurrent;
__super__.call(this);
}
MergeObservable.prototype.subscribeCore = function(observer) {
var g = new CompositeDisposable();
g.add(this.source.subscribe(new MergeObserver(observer, this.maxConcurrent, g)));
return g;
};
return MergeObservable;
}(ObservableBase));
var MergeObserver = (function () {
function MergeObserver(o, max, g) {
this.o = o;
this.max = max;
this.g = g;
this.done = false;
this.q = [];
this.activeCount = 0;
this.isStopped = false;
}
MergeObserver.prototype.handleSubscribe = function (xs) {
var sad = new SingleAssignmentDisposable();
this.g.add(sad);
isPromise(xs) && (xs = observableFromPromise(xs));
sad.setDisposable(xs.subscribe(new InnerObserver(this, sad)));
};
MergeObserver.prototype.onNext = function (innerSource) {
if (this.isStopped) { return; }
if(this.activeCount < this.max) {
this.activeCount++;
this.handleSubscribe(innerSource);
} else {
this.q.push(innerSource);
}
};
MergeObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
MergeObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.done = true;
this.activeCount === 0 && this.o.onCompleted();
}
};
MergeObserver.prototype.dispose = function() { this.isStopped = true; };
MergeObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
function InnerObserver(parent, sad) {
this.parent = parent;
this.sad = sad;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.parent.o.onNext(x); } };
InnerObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
this.isStopped = true;
var parent = this.parent;
parent.g.remove(this.sad);
if (parent.q.length > 0) {
parent.handleSubscribe(parent.q.shift());
} else {
parent.activeCount--;
parent.done && parent.activeCount === 0 && parent.o.onCompleted();
}
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
return true;
}
return false;
};
return MergeObserver;
}());
/**
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
* Or merges two observable sequences into a single observable sequence.
*
* @example
* 1 - merged = sources.merge(1);
* 2 - merged = source.merge(otherSource);
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.merge = function (maxConcurrentOrOther) {
return typeof maxConcurrentOrOther !== 'number' ?
observableMerge(this, maxConcurrentOrOther) :
new MergeObservable(this, maxConcurrentOrOther);
};
/**
* Merges all the observable sequences into a single observable sequence.
* The scheduler is optional and if not specified, the immediate scheduler is used.
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/
var observableMerge = Observable.merge = function () {
var scheduler, sources = [], i, len = arguments.length;
if (!arguments[0]) {
scheduler = immediateScheduler;
for(i = 1; i < len; i++) { sources.push(arguments[i]); }
} else if (isScheduler(arguments[0])) {
scheduler = arguments[0];
for(i = 1; i < len; i++) { sources.push(arguments[i]); }
} else {
scheduler = immediateScheduler;
for(i = 0; i < len; i++) { sources.push(arguments[i]); }
}
if (Array.isArray(sources[0])) {
sources = sources[0];
}
return observableOf(scheduler, sources).mergeAll();
};
var CompositeError = Rx.CompositeError = function(errors) {
this.name = "NotImplementedError";
this.innerErrors = errors;
this.message = 'This contains multiple errors. Check the innerErrors';
Error.call(this);
}
CompositeError.prototype = Error.prototype;
/**
* Flattens an Observable that emits Observables into one Observable, in a way that allows an Observer to
* receive all successfully emitted items from all of the source Observables without being interrupted by
* an error notification from one of them.
*
* This behaves like Observable.prototype.mergeAll except that if any of the merged Observables notify of an
* error via the Observer's onError, mergeDelayError will refrain from propagating that
* error notification until all of the merged Observables have finished emitting items.
* @param {Array | Arguments} args Arguments or an array to merge.
* @returns {Observable} an Observable that emits all of the items emitted by the Observables emitted by the Observable
*/
Observable.mergeDelayError = function() {
var args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
var len = arguments.length;
args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
}
var source = observableOf(null, args);
return new AnonymousObservable(function (o) {
var group = new CompositeDisposable(),
m = new SingleAssignmentDisposable(),
isStopped = false,
errors = [];
function setCompletion() {
if (errors.length === 0) {
o.onCompleted();
} else if (errors.length === 1) {
o.onError(errors[0]);
} else {
o.onError(new CompositeError(errors));
}
}
group.add(m);
m.setDisposable(source.subscribe(
function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
group.add(innerSubscription);
// Check for promises support
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(
function (x) { o.onNext(x); },
function (e) {
errors.push(e);
group.remove(innerSubscription);
isStopped && group.length === 1 && setCompletion();
},
function () {
group.remove(innerSubscription);
isStopped && group.length === 1 && setCompletion();
}));
},
function (e) {
errors.push(e);
isStopped = true;
group.length === 1 && setCompletion();
},
function () {
isStopped = true;
group.length === 1 && setCompletion();
}));
return group;
});
};
var MergeAllObservable = (function (__super__) {
inherits(MergeAllObservable, __super__);
function MergeAllObservable(source) {
this.source = source;
__super__.call(this);
}
MergeAllObservable.prototype.subscribeCore = function (observer) {
var g = new CompositeDisposable(), m = new SingleAssignmentDisposable();
g.add(m);
m.setDisposable(this.source.subscribe(new MergeAllObserver(observer, g)));
return g;
};
return MergeAllObservable;
}(ObservableBase));
var MergeAllObserver = (function() {
function MergeAllObserver(o, g) {
this.o = o;
this.g = g;
this.isStopped = false;
this.done = false;
}
MergeAllObserver.prototype.onNext = function(innerSource) {
if(this.isStopped) { return; }
var sad = new SingleAssignmentDisposable();
this.g.add(sad);
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
sad.setDisposable(innerSource.subscribe(new InnerObserver(this, this.g, sad)));
};
MergeAllObserver.prototype.onError = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
MergeAllObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
this.isStopped = true;
this.done = true;
this.g.length === 1 && this.o.onCompleted();
}
};
MergeAllObserver.prototype.dispose = function() { this.isStopped = true; };
MergeAllObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
function InnerObserver(parent, g, sad) {
this.parent = parent;
this.g = g;
this.sad = sad;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if (!this.isStopped) { this.parent.o.onNext(x); } };
InnerObserver.prototype.onError = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
var parent = this.parent;
this.isStopped = true;
parent.g.remove(this.sad);
parent.done && parent.g.length === 1 && parent.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
return true;
}
return false;
};
return MergeAllObserver;
}());
/**
* Merges an observable sequence of observable sequences into an observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.mergeAll = observableProto.mergeObservable = function () {
return new MergeAllObservable(this);
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
* @param {Observable} second Second observable sequence used to produce results after the first sequence terminates.
* @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.
*/
observableProto.onErrorResumeNext = function (second) {
if (!second) { throw new Error('Second observable is required'); }
return onErrorResumeNext([this, second]);
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.onErrorResumeNext(xs, ys, zs);
* 1 - res = Rx.Observable.onErrorResumeNext([xs, ys, zs]);
* @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
*/
var onErrorResumeNext = Observable.onErrorResumeNext = function () {
var sources = [];
if (Array.isArray(arguments[0])) {
sources = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { sources.push(arguments[i]); }
}
return new AnonymousObservable(function (observer) {
var pos = 0, subscription = new SerialDisposable(),
cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, d;
if (pos < sources.length) {
current = sources[pos++];
isPromise(current) && (current = observableFromPromise(current));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(observer.onNext.bind(observer), self, self));
} else {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
* @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
*/
observableProto.skipUntil = function (other) {
var source = this;
return new AnonymousObservable(function (o) {
var isOpen = false;
var disposables = new CompositeDisposable(source.subscribe(function (left) {
isOpen && o.onNext(left);
}, function (e) { o.onError(e); }, function () {
isOpen && o.onCompleted();
}));
isPromise(other) && (other = observableFromPromise(other));
var rightSubscription = new SingleAssignmentDisposable();
disposables.add(rightSubscription);
rightSubscription.setDisposable(other.subscribe(function () {
isOpen = true;
rightSubscription.dispose();
}, function (e) { o.onError(e); }, function () {
rightSubscription.dispose();
}));
return disposables;
}, source);
};
/**
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto['switch'] = observableProto.switchLatest = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasLatest = false,
innerSubscription = new SerialDisposable(),
isStopped = false,
latest = 0,
subscription = sources.subscribe(
function (innerSource) {
var d = new SingleAssignmentDisposable(), id = ++latest;
hasLatest = true;
innerSubscription.setDisposable(d);
// Check if Promise or Observable
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
d.setDisposable(innerSource.subscribe(
function (x) { latest === id && observer.onNext(x); },
function (e) { latest === id && observer.onError(e); },
function () {
if (latest === id) {
hasLatest = false;
isStopped && observer.onCompleted();
}
}));
},
function (e) { observer.onError(e); },
function () {
isStopped = true;
!hasLatest && observer.onCompleted();
});
return new CompositeDisposable(subscription, innerSubscription);
}, sources);
};
/**
* Returns the values from the source observable sequence until the other observable sequence produces a value.
* @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
*/
observableProto.takeUntil = function (other) {
var source = this;
return new AnonymousObservable(function (o) {
isPromise(other) && (other = observableFromPromise(other));
return new CompositeDisposable(
source.subscribe(o),
other.subscribe(function () { o.onCompleted(); }, function (e) { o.onError(e); }, noop)
);
}, source);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function only when the (first) source observable sequence produces an element.
*
* @example
* 1 - obs = obs1.withLatestFrom(obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = obs1.withLatestFrom([obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.withLatestFrom = function () {
var len = arguments.length, args = new Array(len)
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var resultSelector = args.pop(), source = this;
if (typeof source === 'undefined') {
throw new Error('Source observable not found for withLatestFrom().');
}
if (typeof resultSelector !== 'function') {
throw new Error('withLatestFrom() expects a resultSelector function.');
}
if (Array.isArray(args[0])) {
args = args[0];
}
return new AnonymousObservable(function (observer) {
var falseFactory = function () { return false; },
n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
values = new Array(n);
var subscriptions = new Array(n + 1);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var other = args[i], sad = new SingleAssignmentDisposable();
isPromise(other) && (other = observableFromPromise(other));
sad.setDisposable(other.subscribe(function (x) {
values[i] = x;
hasValue[i] = true;
hasValueAll = hasValue.every(identity);
}, observer.onError.bind(observer), function () {}));
subscriptions[i] = sad;
}(idx));
}
var sad = new SingleAssignmentDisposable();
sad.setDisposable(source.subscribe(function (x) {
var res;
var allValues = [x].concat(values);
if (!hasValueAll) return;
try {
res = resultSelector.apply(null, allValues);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
}, observer.onError.bind(observer), function () {
observer.onCompleted();
}));
subscriptions[n] = sad;
return new CompositeDisposable(subscriptions);
}, this);
};
function zipArray(second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var index = 0, len = second.length;
return first.subscribe(function (left) {
if (index < len) {
var right = second[index++], result;
try {
result = resultSelector(left, right);
} catch (e) {
return observer.onError(e);
}
observer.onNext(result);
} else {
observer.onCompleted();
}
}, function (e) { observer.onError(e); }, function () { observer.onCompleted(); });
}, first);
}
function falseFactory() { return false; }
function emptyArrayFactory() { return []; }
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args.
*
* @example
* 1 - res = obs1.zip(obs2, fn);
* 1 - res = x1.zip([1,2,3], fn);
* @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function.
*/
observableProto.zip = function () {
if (Array.isArray(arguments[0])) { return zipArray.apply(this, arguments); }
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var parent = this, resultSelector = args.pop();
args.unshift(parent);
return new AnonymousObservable(function (observer) {
var n = args.length,
queues = arrayInitialize(n, emptyArrayFactory),
isDone = arrayInitialize(n, falseFactory);
function next(i) {
var res, queuedValues;
if (queues.every(function (x) { return x.length > 0; })) {
try {
queuedValues = queues.map(function (x) { return x.shift(); });
res = resultSelector.apply(parent, queuedValues);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(function (x) { return x; })) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
queues[i].push(x);
next(i);
}, function (e) { observer.onError(e); }, function () {
done(i);
}));
subscriptions[i] = sad;
})(idx);
}
return new CompositeDisposable(subscriptions);
}, parent);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
* @param arguments Observable sources.
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
Observable.zip = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var first = args.shift();
return first.zip.apply(first, args);
};
/**
* Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
* @param arguments Observable sources.
* @returns {Observable} An observable sequence containing lists of elements at corresponding indexes.
*/
Observable.zipArray = function () {
var sources;
if (Array.isArray(arguments[0])) {
sources = arguments[0];
} else {
var len = arguments.length;
sources = new Array(len);
for(var i = 0; i < len; i++) { sources[i] = arguments[i]; }
}
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
if (queues.every(function (x) { return x.length > 0; })) {
var res = queues.map(function (x) { return x.shift(); });
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
return;
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
return;
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
queues[i].push(x);
next(i);
}, function (e) { observer.onError(e); }, function () {
done(i);
}));
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Hides the identity of an observable sequence.
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
*/
observableProto.asObservable = function () {
var source = this;
return new AnonymousObservable(function (o) { return source.subscribe(o); }, this);
};
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
*
* @example
* var res = xs.bufferWithCount(10);
* var res = xs.bufferWithCount(10, 1);
* @param {Number} count Length of each buffer.
* @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithCount = function (count, skip) {
if (typeof skip !== 'number') {
skip = count;
}
return this.windowWithCount(count, skip).selectMany(function (x) {
return x.toArray();
}).where(function (x) {
return x.length > 0;
});
};
/**
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
*/
observableProto.dematerialize = function () {
var source = this;
return new AnonymousObservable(function (o) {
return source.subscribe(function (x) { return x.accept(o); }, function(e) { o.onError(e); }, function () { o.onCompleted(); });
}, this);
};
/**
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
*
* var obs = observable.distinctUntilChanged();
* var obs = observable.distinctUntilChanged(function (x) { return x.id; });
* var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
*
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/
observableProto.distinctUntilChanged = function (keySelector, comparer) {
var source = this;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (o) {
var hasCurrentKey = false, currentKey;
return source.subscribe(function (value) {
var key = value;
if (keySelector) {
try {
key = keySelector(value);
} catch (e) {
o.onError(e);
return;
}
}
if (hasCurrentKey) {
try {
var comparerEquals = comparer(currentKey, key);
} catch (e) {
o.onError(e);
return;
}
}
if (!hasCurrentKey || !comparerEquals) {
hasCurrentKey = true;
currentKey = key;
o.onNext(value);
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, this);
};
/**
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto['do'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {
var source = this, tapObserver = typeof observerOrOnNext === 'function' || typeof observerOrOnNext === 'undefined'?
observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) :
observerOrOnNext;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
try {
tapObserver.onNext(x);
} catch (e) {
observer.onError(e);
}
observer.onNext(x);
}, function (err) {
try {
tapObserver.onError(err);
} catch (e) {
observer.onError(e);
}
observer.onError(err);
}, function () {
try {
tapObserver.onCompleted();
} catch (e) {
observer.onError(e);
}
observer.onCompleted();
});
}, this);
};
/**
* Invokes an action for each element in the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onNext Action to invoke for each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) {
return this.tap(typeof thisArg !== 'undefined' ? function (x) { onNext.call(thisArg, x); } : onNext);
};
/**
* Invokes an action upon exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onError Action to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) {
return this.tap(noop, typeof thisArg !== 'undefined' ? function (e) { onError.call(thisArg, e); } : onError);
};
/**
* Invokes an action upon graceful termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) {
return this.tap(noop, null, typeof thisArg !== 'undefined' ? function () { onCompleted.call(thisArg); } : onCompleted);
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
*/
observableProto['finally'] = observableProto.ensure = function (action) {
var source = this;
return new AnonymousObservable(function (observer) {
var subscription;
try {
subscription = source.subscribe(observer);
} catch (e) {
action();
throw e;
}
return disposableCreate(function () {
try {
subscription.dispose();
} catch (e) {
throw e;
} finally {
action();
}
});
}, this);
};
/**
* @deprecated use #finally or #ensure instead.
*/
observableProto.finallyAction = function (action) {
//deprecate('finallyAction', 'finally or ensure');
return this.ensure(action);
};
/**
* Ignores all elements in an observable sequence leaving only the termination messages.
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
*/
observableProto.ignoreElements = function () {
var source = this;
return new AnonymousObservable(function (o) {
return source.subscribe(noop, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Materializes the implicit notifications of an observable sequence as explicit notification values.
* @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.
*/
observableProto.materialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (value) {
observer.onNext(notificationCreateOnNext(value));
}, function (e) {
observer.onNext(notificationCreateOnError(e));
observer.onCompleted();
}, function () {
observer.onNext(notificationCreateOnCompleted());
observer.onCompleted();
});
}, source);
};
/**
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
*/
observableProto.repeat = function (repeatCount) {
return enumerableRepeat(this, repeatCount).concat();
};
/**
* Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.
* Note if you encounter an error and want it to retry once, then you must use .retry(2);
*
* @example
* var res = retried = retry.repeat();
* var res = retried = retry.repeat(2);
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retry = function (retryCount) {
return enumerableRepeat(this, retryCount).catchError();
};
/**
* Repeats the source observable sequence upon error each time the notifier emits or until it successfully terminates.
* if the notifier completes, the observable sequence completes.
*
* @example
* var timer = Observable.timer(500);
* var source = observable.retryWhen(timer);
* @param {Observable} [notifier] An observable that triggers the retries or completes the observable with onNext or onCompleted respectively.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retryWhen = function (notifier) {
return enumerableRepeat(this).catchErrorWhen(notifier);
};
/**
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
* For aggregation behavior with no intermediate results, see Observable.aggregate.
* @example
* var res = source.scan(function (acc, x) { return acc + x; });
* var res = source.scan(0, function (acc, x) { return acc + x; });
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing the accumulated values.
*/
observableProto.scan = function () {
var hasSeed = false, seed, accumulator, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[0];
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return new AnonymousObservable(function (o) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
!hasValue && (hasValue = true);
try {
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
o.onError(e);
return;
}
o.onNext(accumulation);
},
function (e) { o.onError(e); },
function () {
!hasValue && hasSeed && o.onNext(seed);
o.onCompleted();
}
);
}, source);
};
/**
* Bypasses a specified number of elements at the end of an observable sequence.
* @description
* This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
* @param count Number of elements to bypass at the end of the source sequence.
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*/
observableProto.skipLast = function (count) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && o.onNext(q.shift());
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.
* @example
* var res = source.startWith(1, 2, 3);
* var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
* @param {Arguments} args The specified values to prepend to the observable sequence
* @returns {Observable} The source sequence prepended with the specified values.
*/
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (!!arguments.length && isScheduler(arguments[0])) {
scheduler = arguments[0];
start = 1;
} else {
scheduler = immediateScheduler;
}
for(var args = [], i = start, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
return enumerableOf([observableFromArray(args, scheduler), this]).concat();
};
/**
* Returns a specified number of contiguous elements from the end of an observable sequence.
* @description
* This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
* the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
*/
observableProto.takeLast = function (count) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, function (e) { o.onError(e); }, function () {
while (q.length > 0) { o.onNext(q.shift()); }
o.onCompleted();
});
}, source);
};
/**
* Returns an array with the specified number of contiguous elements from the end of an observable sequence.
*
* @description
* This operator accumulates a buffer with a length enough to store count elements. Upon completion of the
* source sequence, this buffer is produced on the result sequence.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
*/
observableProto.takeLastBuffer = function (count) {
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, function (e) { o.onError(e); }, function () {
o.onNext(q);
o.onCompleted();
});
}, source);
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on element count information.
*
* var res = xs.windowWithCount(10);
* var res = xs.windowWithCount(10, 1);
* @param {Number} count Length of each window.
* @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithCount = function (count, skip) {
var source = this;
+count || (count = 0);
Math.abs(count) === Infinity && (count = 0);
if (count <= 0) { throw new ArgumentOutOfRangeError(); }
skip == null && (skip = count);
+skip || (skip = 0);
Math.abs(skip) === Infinity && (skip = 0);
if (skip <= 0) { throw new ArgumentOutOfRangeError(); }
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(),
refCountDisposable = new RefCountDisposable(m),
n = 0,
q = [];
function createWindow () {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
}
createWindow();
m.setDisposable(source.subscribe(
function (x) {
for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }
var c = n - count + 1;
c >= 0 && c % skip === 0 && q.shift().onCompleted();
++n % skip === 0 && createWindow();
},
function (e) {
while (q.length > 0) { q.shift().onError(e); }
observer.onError(e);
},
function () {
while (q.length > 0) { q.shift().onCompleted(); }
observer.onCompleted();
}
));
return refCountDisposable;
}, source);
};
function concatMap(source, selector, thisArg) {
var selectorFunc = bindCallback(selector, thisArg, 3);
return source.map(function (x, i) {
var result = selectorFunc(x, i, source);
isPromise(result) && (result = observableFromPromise(result));
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
return result;
}).concatAll();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {
if (isFunction(selector) && isFunction(resultSelector)) {
return this.concatMap(function (x, i) {
var selectorResult = selector(x, i);
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
return selectorResult.map(function (y, i2) {
return resultSelector(x, y, i, i2);
});
});
}
return isFunction(selector) ?
concatMap(this, selector, thisArg) :
concatMap(this, function () { return selector; });
};
/**
* Projects each notification of an observable sequence to an observable sequence and concats the resulting observable sequences into one observable sequence.
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
* @param {Function} onError A transform function to apply when an error occurs in the source sequence.
* @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.
* @param {Any} [thisArg] An optional "this" to use to invoke each transform.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
*/
observableProto.concatMapObserver = observableProto.selectConcatObserver = function(onNext, onError, onCompleted, thisArg) {
var source = this,
onNextFunc = bindCallback(onNext, thisArg, 2),
onErrorFunc = bindCallback(onError, thisArg, 1),
onCompletedFunc = bindCallback(onCompleted, thisArg, 0);
return new AnonymousObservable(function (observer) {
var index = 0;
return source.subscribe(
function (x) {
var result;
try {
result = onNextFunc(x, index++);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
},
function (err) {
var result;
try {
result = onErrorFunc(err);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
},
function () {
var result;
try {
result = onCompletedFunc();
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
});
}, this).concatAll();
};
/**
* Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
*
* var res = obs = xs.defaultIfEmpty();
* 2 - obs = xs.defaultIfEmpty(false);
*
* @memberOf Observable#
* @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.
* @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
*/
observableProto.defaultIfEmpty = function (defaultValue) {
var source = this;
defaultValue === undefined && (defaultValue = null);
return new AnonymousObservable(function (observer) {
var found = false;
return source.subscribe(function (x) {
found = true;
observer.onNext(x);
},
function (e) { observer.onError(e); },
function () {
!found && observer.onNext(defaultValue);
observer.onCompleted();
});
}, source);
};
// Swap out for Array.findIndex
function arrayIndexOfComparer(array, item, comparer) {
for (var i = 0, len = array.length; i < len; i++) {
if (comparer(array[i], item)) { return i; }
}
return -1;
}
function HashSet(comparer) {
this.comparer = comparer;
this.set = [];
}
HashSet.prototype.push = function(value) {
var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1;
retValue && this.set.push(value);
return retValue;
};
/**
* Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
* Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
*
* @example
* var res = obs = xs.distinct();
* 2 - obs = xs.distinct(function (x) { return x.id; });
* 2 - obs = xs.distinct(function (x) { return x.id; }, function (a,b) { return a === b; });
* @param {Function} [keySelector] A function to compute the comparison key for each element.
* @param {Function} [comparer] Used to compare items in the collection.
* @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
*/
observableProto.distinct = function (keySelector, comparer) {
var source = this;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (o) {
var hashSet = new HashSet(comparer);
return source.subscribe(function (x) {
var key = x;
if (keySelector) {
try {
key = keySelector(x);
} catch (e) {
o.onError(e);
return;
}
}
hashSet.push(key) && o.onNext(x);
},
function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, this);
};
var MapObservable = (function (__super__) {
inherits(MapObservable, __super__);
function MapObservable(source, selector, thisArg) {
this.source = source;
this.selector = bindCallback(selector, thisArg, 3);
__super__.call(this);
}
MapObservable.prototype.internalMap = function (selector, thisArg) {
var self = this;
return new MapObservable(this.source, function (x, i, o) { return selector(self.selector(x, i, o), i, o); }, thisArg)
};
MapObservable.prototype.subscribeCore = function (observer) {
return this.source.subscribe(new MapObserver(observer, this.selector, this));
};
return MapObservable;
}(ObservableBase));
function MapObserver(observer, selector, source) {
this.observer = observer;
this.selector = selector;
this.source = source;
this.i = 0;
this.isStopped = false;
}
MapObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var result = tryCatch(this.selector).call(this, x, this.i++, this.source);
if (result === errorObj) {
return this.observer.onError(result.e);
}
this.observer.onNext(result);
/*try {
var result = this.selector(x, this.i++, this.source);
} catch (e) {
return this.observer.onError(e);
}
this.observer.onNext(result);*/
};
MapObserver.prototype.onError = function (e) {
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
};
MapObserver.prototype.onCompleted = function () {
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
};
MapObserver.prototype.dispose = function() { this.isStopped = true; };
MapObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
/**
* Projects each element of an observable sequence into a new form by incorporating the element's index.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
observableProto.map = observableProto.select = function (selector, thisArg) {
var selectorFn = typeof selector === 'function' ? selector : function () { return selector; };
return this instanceof MapObservable ?
this.internalMap(selectorFn, thisArg) :
new MapObservable(this, selectorFn, thisArg);
};
/**
* Retrieves the value of a specified nested property from all elements in
* the Observable sequence.
* @param {Arguments} arguments The nested properties to pluck.
* @returns {Observable} Returns a new Observable sequence of property values.
*/
observableProto.pluck = function () {
var args = arguments, len = arguments.length;
if (len === 0) { throw new Error('List of properties cannot be empty.'); }
return this.map(function (x) {
var currentProp = x;
for (var i = 0; i < len; i++) {
var p = currentProp[args[i]];
if (typeof p !== 'undefined') {
currentProp = p;
} else {
return undefined;
}
}
return currentProp;
});
};
/**
* Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
* @param {Function} onError A transform function to apply when an error occurs in the source sequence.
* @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.
* @param {Any} [thisArg] An optional "this" to use to invoke each transform.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
*/
observableProto.flatMapObserver = observableProto.selectManyObserver = function (onNext, onError, onCompleted, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var index = 0;
return source.subscribe(
function (x) {
var result;
try {
result = onNext.call(thisArg, x, index++);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
},
function (err) {
var result;
try {
result = onError.call(thisArg, err);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
},
function () {
var result;
try {
result = onCompleted.call(thisArg);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
});
}, source).mergeAll();
};
function flatMap(source, selector, thisArg) {
var selectorFunc = bindCallback(selector, thisArg, 3);
return source.map(function (x, i) {
var result = selectorFunc(x, i, source);
isPromise(result) && (result = observableFromPromise(result));
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
return result;
}).mergeAll();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) {
if (isFunction(selector) && isFunction(resultSelector)) {
return this.flatMap(function (x, i) {
var selectorResult = selector(x, i);
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
return selectorResult.map(function (y, i2) {
return resultSelector(x, y, i, i2);
});
}, thisArg);
}
return isFunction(selector) ?
flatMap(this, selector, thisArg) :
flatMap(this, function () { return selector; });
};
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto.selectSwitch = observableProto.flatMapLatest = observableProto.switchMap = function (selector, thisArg) {
return this.select(selector, thisArg).switchLatest();
};
/**
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
* @param {Number} count The number of elements to skip before returning the remaining elements.
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
*/
observableProto.skip = function (count) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var remaining = count;
return source.subscribe(function (x) {
if (remaining <= 0) {
o.onNext(x);
} else {
remaining--;
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
* The element's index is used in the logic of the predicate function.
*
* var res = source.skipWhile(function (value) { return value < 10; });
* var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
observableProto.skipWhile = function (predicate, thisArg) {
var source = this,
callback = bindCallback(predicate, thisArg, 3);
return new AnonymousObservable(function (o) {
var i = 0, running = false;
return source.subscribe(function (x) {
if (!running) {
try {
running = !callback(x, i++, source);
} catch (e) {
o.onError(e);
return;
}
}
running && o.onNext(x);
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).
*
* var res = source.take(5);
* var res = source.take(0, Rx.Scheduler.timeout);
* @param {Number} count The number of elements to return.
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
*/
observableProto.take = function (count, scheduler) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
if (count === 0) { return observableEmpty(scheduler); }
var source = this;
return new AnonymousObservable(function (o) {
var remaining = count;
return source.subscribe(function (x) {
if (remaining-- > 0) {
o.onNext(x);
remaining === 0 && o.onCompleted();
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Returns elements from an observable sequence as long as a specified condition is true.
* The element's index is used in the logic of the predicate function.
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
observableProto.takeWhile = function (predicate, thisArg) {
var source = this,
callback = bindCallback(predicate, thisArg, 3);
return new AnonymousObservable(function (o) {
var i = 0, running = true;
return source.subscribe(function (x) {
if (running) {
try {
running = callback(x, i++, source);
} catch (e) {
o.onError(e);
return;
}
if (running) {
o.onNext(x);
} else {
o.onCompleted();
}
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
var FilterObservable = (function (__super__) {
inherits(FilterObservable, __super__);
function FilterObservable(source, predicate, thisArg) {
this.source = source;
this.predicate = bindCallback(predicate, thisArg, 3);
__super__.call(this);
}
FilterObservable.prototype.subscribeCore = function (observer) {
return this.source.subscribe(new FilterObserver(observer, this.predicate, this));
};
FilterObservable.prototype.internalFilter = function(predicate, thisArg) {
var self = this;
return new FilterObservable(this.source, function(x, i, o) { return self.predicate(x, i, o) && predicate(x, i, o); }, thisArg);
};
return FilterObservable;
}(ObservableBase));
function FilterObserver(observer, predicate, source) {
this.observer = observer;
this.predicate = predicate;
this.source = source;
this.i = 0;
this.isStopped = false;
}
FilterObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var shouldYield = tryCatch(this.predicate).call(this, x, this.i++, this.source);
if (shouldYield === errorObj) {
return this.observer.onError(shouldYield.e);
}
shouldYield && this.observer.onNext(x);
};
FilterObserver.prototype.onError = function (e) {
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
};
FilterObserver.prototype.onCompleted = function () {
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
};
FilterObserver.prototype.dispose = function() { this.isStopped = true; };
FilterObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
/**
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
observableProto.filter = observableProto.where = function (predicate, thisArg) {
return this instanceof FilterObservable ? this.internalFilter(predicate, thisArg) :
new FilterObservable(this, predicate, thisArg);
};
/**
* Executes a transducer to transform the observable sequence
* @param {Transducer} transducer A transducer to execute
* @returns {Observable} An Observable sequence containing the results from the transducer.
*/
observableProto.transduce = function(transducer) {
var source = this;
function transformForObserver(observer) {
return {
init: function() {
return observer;
},
step: function(obs, input) {
return obs.onNext(input);
},
result: function(obs) {
return obs.onCompleted();
}
};
}
return new AnonymousObservable(function(observer) {
var xform = transducer(transformForObserver(observer));
return source.subscribe(
function(v) {
try {
xform.step(observer, v);
} catch (e) {
observer.onError(e);
}
},
observer.onError.bind(observer),
function() { xform.result(observer); }
);
}, source);
};
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
inherits(AnonymousObservable, __super__);
// Fix subscriber to check for undefined or function returned to decorate as Disposable
function fixSubscriber(subscriber) {
return subscriber && isFunction(subscriber.dispose) ? subscriber :
isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;
}
function setDisposable(s, state) {
var ado = state[0], subscribe = state[1];
var sub = tryCatch(subscribe)(ado);
if (sub === errorObj) {
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
}
ado.setDisposable(fixSubscriber(sub));
}
function AnonymousObservable(subscribe, parent) {
this.source = parent;
function s(observer) {
var ado = new AutoDetachObserver(observer), state = [ado, subscribe];
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.scheduleWithState(state, setDisposable);
} else {
setDisposable(null, state);
}
return ado;
}
__super__.call(this, s);
}
return AnonymousObservable;
}(Observable));
var AutoDetachObserver = (function (__super__) {
inherits(AutoDetachObserver, __super__);
function AutoDetachObserver(observer) {
__super__.call(this);
this.observer = observer;
this.m = new SingleAssignmentDisposable();
}
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
AutoDetachObserverPrototype.next = function (value) {
var result = tryCatch(this.observer.onNext).call(this.observer, value);
if (result === errorObj) {
this.dispose();
thrower(result.e);
}
};
AutoDetachObserverPrototype.error = function (err) {
var result = tryCatch(this.observer.onError).call(this.observer, err);
this.dispose();
result === errorObj && thrower(result.e);
};
AutoDetachObserverPrototype.completed = function () {
var result = tryCatch(this.observer.onCompleted).call(this.observer);
this.dispose();
result === errorObj && thrower(result.e);
};
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
AutoDetachObserverPrototype.getDisposable = function () { return this.m.getDisposable(); };
AutoDetachObserverPrototype.dispose = function () {
__super__.prototype.dispose.call(this);
this.m.dispose();
};
return AutoDetachObserver;
}(AbstractObserver));
var InnerSubscription = function (subject, observer) {
this.subject = subject;
this.observer = observer;
};
InnerSubscription.prototype.dispose = function () {
if (!this.subject.isDisposed && this.observer !== null) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
this.observer = null;
}
};
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
var Subject = Rx.Subject = (function (__super__) {
function subscribe(observer) {
checkDisposed(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
return disposableEmpty;
}
observer.onCompleted();
return disposableEmpty;
}
inherits(Subject, __super__);
/**
* Creates a subject.
*/
function Subject() {
__super__.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.observers = [];
this.hasError = false;
}
addProperties(Subject.prototype, Observer.prototype, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () { return this.observers.length > 0; },
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers.length = 0;
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
this.error = error;
this.hasError = true;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers.length = 0;
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed(this);
if (!this.isStopped) {
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
/**
* Creates a subject from the specified observer and observable.
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
Subject.create = function (observer, observable) {
return new AnonymousSubject(observer, observable);
};
return Subject;
}(Observable));
/**
* Represents the result of an asynchronous operation.
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
*/
var AsyncSubject = Rx.AsyncSubject = (function (__super__) {
function subscribe(observer) {
checkDisposed(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
} else if (this.hasValue) {
observer.onNext(this.value);
observer.onCompleted();
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(AsyncSubject, __super__);
/**
* Creates a subject that can only receive one value and that value is cached for all future observations.
* @constructor
*/
function AsyncSubject() {
__super__.call(this, subscribe);
this.isDisposed = false;
this.isStopped = false;
this.hasValue = false;
this.observers = [];
this.hasError = false;
}
addProperties(AsyncSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
checkDisposed(this);
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
*/
onCompleted: function () {
var i, len;
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
var os = cloneArray(this.observers), len = os.length;
if (this.hasValue) {
for (i = 0; i < len; i++) {
var o = os[i];
o.onNext(this.value);
o.onCompleted();
}
} else {
for (i = 0; i < len; i++) {
os[i].onCompleted();
}
}
this.observers.length = 0;
}
},
/**
* Notifies all subscribed observers about the error.
* @param {Mixed} error The Error to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
this.hasError = true;
this.error = error;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers.length = 0;
}
},
/**
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
* @param {Mixed} value The value to store in the subject.
*/
onNext: function (value) {
checkDisposed(this);
if (this.isStopped) { return; }
this.value = value;
this.hasValue = true;
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.exception = null;
this.value = null;
}
});
return AsyncSubject;
}(Observable));
var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {
inherits(AnonymousSubject, __super__);
function subscribe(observer) {
return this.observable.subscribe(observer);
}
function AnonymousSubject(observer, observable) {
this.observer = observer;
this.observable = observable;
__super__.call(this, subscribe);
}
addProperties(AnonymousSubject.prototype, Observer.prototype, {
onCompleted: function () {
this.observer.onCompleted();
},
onError: function (error) {
this.observer.onError(error);
},
onNext: function (value) {
this.observer.onNext(value);
}
});
return AnonymousSubject;
}(Observable));
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
root.Rx = Rx;
define(function() {
return Rx;
});
} else if (freeExports && freeModule) {
// in Node.js or RingoJS
if (moduleExports) {
(freeModule.exports = Rx).Rx = Rx;
} else {
freeExports.Rx = Rx;
}
} else {
// in a browser or Rhino
root.Rx = Rx;
}
// All code before this point will be filtered from stack traces.
var rEndingLine = captureLine();
}.call(this));
|
src/ListItem/__tests__/ListItemAction_test.js | react-fabric/react-fabric | import React from 'react'
import { render } from 'enzyme'
import test from 'tape'
import ListItemAction from '../ListItemAction.js'
test('ListItemAction', t => {
t.ok(ListItemAction, 'export')
t.end()
})
test('ListItem#render - simple', t => {
const container = render(
<ListItemAction glyph="star" />
).contents()
t.assert(container.is('div.ms-ListItem-action', 'container'))
t.equal(container.find('.ms-ListItem-action .ms-Icon--star').length, 1)
t.end()
})
|
examples/03 Nesting/Drag Sources/Container.js | longlho/react-dnd | import React, { Component } from 'react';
import SourceBox from './SourceBox';
import TargetBox from './TargetBox';
import Colors from './Colors';
import { DragDropContext } from 'react-dnd';
import HTML5Backend from 'react-dnd-html5-backend';
@DragDropContext(HTML5Backend)
export default class Container extends Component {
render() {
return (
<div style={{ overflow: 'hidden', clear: 'both', margin: '-.5rem' }}>
<div style={{ float: 'left' }}>
<SourceBox color={Colors.BLUE}>
<SourceBox color={Colors.YELLOW}>
<SourceBox color={Colors.YELLOW} />
<SourceBox color={Colors.BLUE} />
</SourceBox>
<SourceBox color={Colors.BLUE}>
<SourceBox color={Colors.YELLOW} />
</SourceBox>
</SourceBox>
</div>
<div style={{ float: 'left', marginLeft: '5rem', marginTop: '.5rem' }}>
<TargetBox />
</div>
</div>
);
}
} |
node_modules/react-icons/fa/long-arrow-up.js | bengimbel/Solstice-React-Contacts-Project |
import React from 'react'
import Icon from 'react-icon-base'
const FaLongArrowUp = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m28.6 11q-0.2 0.4-0.7 0.4h-5v27.9q0 0.3-0.2 0.5t-0.5 0.2h-4.3q-0.3 0-0.5-0.2t-0.2-0.5v-27.9h-5q-0.5 0-0.6-0.4t0.1-0.8l7.8-8.6q0.2-0.2 0.5-0.2 0.3 0 0.5 0.2l8 8.6q0.3 0.4 0.1 0.8z"/></g>
</Icon>
)
export default FaLongArrowUp
|
ajax/libs/handsontable/0.15.0/handsontable.full.js | hanbyul-here/cdnjs | /*!
* Handsontable 0.15.0
* Handsontable is a JavaScript library for editable tables with basic copy-paste compatibility with Excel and Google Docs
*
* Copyright (c) 2012-2014 Marcin Warpechowski
* Copyright 2015 Handsoncode sp. z o.o. <[email protected]>
* Licensed under the MIT license.
* http://handsontable.com/
*
* Date: Fri Jun 19 2015 09:15:37 GMT+0200 (CEST)
*/
/*jslint white: true, browser: true, plusplus: true, indent: 4, maxerr: 50 */
window.Handsontable = {
version: '0.15.0',
buildDate: 'Fri Jun 19 2015 09:15:37 GMT+0200 (CEST)'
};
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Handsontable = f()}})(function(){var define,module,exports;return (function init(modules, cache, entry) {
(function outer (modules, cache, entry) {
// Save the require from previous bundle to this closure if any
var previousRequire = typeof require == "function" && require;
var globalNS = JSON.parse('{"zeroclipboard":"ZeroClipboard","copyPaste":"copyPaste","SheetClip":"SheetClip","jsonpatch":"jsonpatch","moment":"moment","numeral":"numeral","pikaday":"Pikaday","autoResize":"autoResize"}') || {};
function newRequire(name, jumped){
if(!cache[name]) {
if(!modules[name]) {
// if we cannot find the the module within our internal map or
// cache jump to the current global require ie. the last bundle
// that was added to the page.
var currentRequire = typeof require == "function" && require;
if (!jumped && currentRequire) return currentRequire(name, true);
// If there are other bundles on this page the require from the
// previous one is saved to 'previousRequire'. Repeat this as
// many times as there are bundles until the module is found or
// we exhaust the require chain.
if (previousRequire) return previousRequire(name, true);
// Try find module from global scope
if (globalNS[name] && typeof window[globalNS[name]] !== 'undefined') {
return window[globalNS[name]];
}
var err = new Error('Cannot find module \'' + name + '\'');
err.code = 'MODULE_NOT_FOUND';
throw err;
}
var m = cache[name] = {exports:{}};
modules[name][0].call(m.exports, function(x){
var id = modules[name][1][x];
return newRequire(id ? id : x);
},m,m.exports,outer,modules,cache,entry);
}
return cache[name].exports;
}
for(var i=0;i<entry.length;i++) newRequire(entry[i]);
// Override the current require with this new one
return newRequire;
})(modules, cache, entry);
return function() {
return Handsontable;
};
})
({1:[function(require,module,exports){
"use strict";
if (window.jQuery) {
(function(window, $, Handsontable) {
$.fn.handsontable = function(action) {
var i,
ilen,
args,
output,
userSettings,
$this = this.first(),
instance = $this.data('handsontable');
if (typeof action !== 'string') {
userSettings = action || {};
if (instance) {
instance.updateSettings(userSettings);
} else {
instance = new Handsontable.Core($this[0], userSettings);
$this.data('handsontable', instance);
instance.init();
}
return $this;
} else {
args = [];
if (arguments.length > 1) {
for (i = 1, ilen = arguments.length; i < ilen; i++) {
args.push(arguments[i]);
}
}
if (instance) {
if (typeof instance[action] !== 'undefined') {
output = instance[action].apply(instance, args);
if (action === 'destroy') {
$this.removeData();
}
} else {
throw new Error('Handsontable do not provide action: ' + action);
}
}
return output;
}
};
})(window, jQuery, Handsontable);
}
//#
},{}],2:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableBorder: {get: function() {
return WalkontableBorder;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47__46__46__47_eventManager_46_js__,
$__cell_47_coords_46_js__;
var dom = ($___46__46__47__46__46__47__46__46__47_dom_46_js__ = require("./../../../dom.js"), $___46__46__47__46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47__46__46__47_dom_46_js__});
var eventManagerObject = ($___46__46__47__46__46__47__46__46__47_eventManager_46_js__ = require("./../../../eventManager.js"), $___46__46__47__46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47__46__46__47_eventManager_46_js__}).eventManager;
var WalkontableCellCoords = ($__cell_47_coords_46_js__ = require("./cell/coords.js"), $__cell_47_coords_46_js__ && $__cell_47_coords_46_js__.__esModule && $__cell_47_coords_46_js__ || {default: $__cell_47_coords_46_js__}).WalkontableCellCoords;
function WalkontableBorder(instance, settings) {
var style;
var createMultipleSelectorHandles = function() {
this.selectionHandles = {
topLeft: document.createElement('DIV'),
topLeftHitArea: document.createElement('DIV'),
bottomRight: document.createElement('DIV'),
bottomRightHitArea: document.createElement('DIV')
};
var width = 10,
hitAreaWidth = 40;
this.selectionHandles.topLeft.className = 'topLeftSelectionHandle';
this.selectionHandles.topLeftHitArea.className = 'topLeftSelectionHandle-HitArea';
this.selectionHandles.bottomRight.className = 'bottomRightSelectionHandle';
this.selectionHandles.bottomRightHitArea.className = 'bottomRightSelectionHandle-HitArea';
this.selectionHandles.styles = {
topLeft: this.selectionHandles.topLeft.style,
topLeftHitArea: this.selectionHandles.topLeftHitArea.style,
bottomRight: this.selectionHandles.bottomRight.style,
bottomRightHitArea: this.selectionHandles.bottomRightHitArea.style
};
var hitAreaStyle = {
'position': 'absolute',
'height': hitAreaWidth + 'px',
'width': hitAreaWidth + 'px',
'border-radius': parseInt(hitAreaWidth / 1.5, 10) + 'px'
};
for (var prop in hitAreaStyle) {
if (hitAreaStyle.hasOwnProperty(prop)) {
this.selectionHandles.styles.bottomRightHitArea[prop] = hitAreaStyle[prop];
this.selectionHandles.styles.topLeftHitArea[prop] = hitAreaStyle[prop];
}
}
var handleStyle = {
'position': 'absolute',
'height': width + 'px',
'width': width + 'px',
'border-radius': parseInt(width / 1.5, 10) + 'px',
'background': '#F5F5FF',
'border': '1px solid #4285c8'
};
for (var prop in handleStyle) {
if (handleStyle.hasOwnProperty(prop)) {
this.selectionHandles.styles.bottomRight[prop] = handleStyle[prop];
this.selectionHandles.styles.topLeft[prop] = handleStyle[prop];
}
}
this.main.appendChild(this.selectionHandles.topLeft);
this.main.appendChild(this.selectionHandles.bottomRight);
this.main.appendChild(this.selectionHandles.topLeftHitArea);
this.main.appendChild(this.selectionHandles.bottomRightHitArea);
};
if (!settings) {
return;
}
var eventManager = eventManagerObject(instance);
this.instance = instance;
this.settings = settings;
this.main = document.createElement("div");
style = this.main.style;
style.position = 'absolute';
style.top = 0;
style.left = 0;
var borderDivs = ['top', 'left', 'bottom', 'right', 'corner'];
for (var i = 0; i < 5; i++) {
var position = borderDivs[i];
var DIV = document.createElement('DIV');
DIV.className = 'wtBorder ' + (this.settings.className || '');
if (this.settings[position] && this.settings[position].hide) {
DIV.className += " hidden";
}
style = DIV.style;
style.backgroundColor = (this.settings[position] && this.settings[position].color) ? this.settings[position].color : settings.border.color;
style.height = (this.settings[position] && this.settings[position].width) ? this.settings[position].width + 'px' : settings.border.width + 'px';
style.width = (this.settings[position] && this.settings[position].width) ? this.settings[position].width + 'px' : settings.border.width + 'px';
this.main.appendChild(DIV);
}
this.top = this.main.childNodes[0];
this.left = this.main.childNodes[1];
this.bottom = this.main.childNodes[2];
this.right = this.main.childNodes[3];
this.topStyle = this.top.style;
this.leftStyle = this.left.style;
this.bottomStyle = this.bottom.style;
this.rightStyle = this.right.style;
this.cornerDefaultStyle = {
width: '5px',
height: '5px',
borderWidth: '2px',
borderStyle: 'solid',
borderColor: '#FFF'
};
this.corner = this.main.childNodes[4];
this.corner.className += ' corner';
this.cornerStyle = this.corner.style;
this.cornerStyle.width = this.cornerDefaultStyle.width;
this.cornerStyle.height = this.cornerDefaultStyle.height;
this.cornerStyle.border = [this.cornerDefaultStyle.borderWidth, this.cornerDefaultStyle.borderStyle, this.cornerDefaultStyle.borderColor].join(' ');
if (Handsontable.mobileBrowser) {
createMultipleSelectorHandles.call(this);
}
this.disappear();
if (!instance.wtTable.bordersHolder) {
instance.wtTable.bordersHolder = document.createElement('div');
instance.wtTable.bordersHolder.className = 'htBorders';
instance.wtTable.spreader.appendChild(instance.wtTable.bordersHolder);
}
instance.wtTable.bordersHolder.insertBefore(this.main, instance.wtTable.bordersHolder.firstChild);
var down = false;
eventManager.addEventListener(document.body, 'mousedown', function() {
down = true;
});
eventManager.addEventListener(document.body, 'mouseup', function() {
down = false;
});
for (var c = 0,
len = this.main.childNodes.length; c < len; c++) {
eventManager.addEventListener(this.main.childNodes[c], 'mouseenter', function(event) {
if (!down || !instance.getSetting('hideBorderOnMouseDownOver')) {
return;
}
event.preventDefault();
event.stopImmediatePropagation();
var bounds = this.getBoundingClientRect();
this.style.display = 'none';
var isOutside = function(event) {
if (event.clientY < Math.floor(bounds.top)) {
return true;
}
if (event.clientY > Math.ceil(bounds.top + bounds.height)) {
return true;
}
if (event.clientX < Math.floor(bounds.left)) {
return true;
}
if (event.clientX > Math.ceil(bounds.left + bounds.width)) {
return true;
}
};
var handler = function(event) {
if (isOutside(event)) {
eventManager.removeEventListener(document.body, 'mousemove', handler);
this.style.display = 'block';
}
};
eventManager.addEventListener(document.body, 'mousemove', handler);
});
}
}
WalkontableBorder.prototype.appear = function(corners) {
if (this.disabled) {
return;
}
var instance = this.instance;
var isMultiple,
fromTD,
toTD,
fromOffset,
toOffset,
containerOffset,
top,
minTop,
left,
minLeft,
height,
width,
fromRow,
fromColumn,
toRow,
toColumn,
i,
ilen,
s;
var isPartRange = function() {
if (this.instance.selections.area.cellRange) {
if (toRow != this.instance.selections.area.cellRange.to.row || toColumn != this.instance.selections.area.cellRange.to.col) {
return true;
}
}
return false;
};
var updateMultipleSelectionHandlesPosition = function(top, left, width, height) {
var handleWidth = parseInt(this.selectionHandles.styles.topLeft.width, 10),
hitAreaWidth = parseInt(this.selectionHandles.styles.topLeftHitArea.width, 10);
this.selectionHandles.styles.topLeft.top = parseInt(top - handleWidth, 10) + "px";
this.selectionHandles.styles.topLeft.left = parseInt(left - handleWidth, 10) + "px";
this.selectionHandles.styles.topLeftHitArea.top = parseInt(top - (hitAreaWidth / 4) * 3, 10) + "px";
this.selectionHandles.styles.topLeftHitArea.left = parseInt(left - (hitAreaWidth / 4) * 3, 10) + "px";
this.selectionHandles.styles.bottomRight.top = parseInt(top + height, 10) + "px";
this.selectionHandles.styles.bottomRight.left = parseInt(left + width, 10) + "px";
this.selectionHandles.styles.bottomRightHitArea.top = parseInt(top + height - hitAreaWidth / 4, 10) + "px";
this.selectionHandles.styles.bottomRightHitArea.left = parseInt(left + width - hitAreaWidth / 4, 10) + "px";
if (this.settings.border.multipleSelectionHandlesVisible && this.settings.border.multipleSelectionHandlesVisible()) {
this.selectionHandles.styles.topLeft.display = "block";
this.selectionHandles.styles.topLeftHitArea.display = "block";
if (!isPartRange.call(this)) {
this.selectionHandles.styles.bottomRight.display = "block";
this.selectionHandles.styles.bottomRightHitArea.display = "block";
} else {
this.selectionHandles.styles.bottomRight.display = "none";
this.selectionHandles.styles.bottomRightHitArea.display = "none";
}
} else {
this.selectionHandles.styles.topLeft.display = "none";
this.selectionHandles.styles.bottomRight.display = "none";
this.selectionHandles.styles.topLeftHitArea.display = "none";
this.selectionHandles.styles.bottomRightHitArea.display = "none";
}
if (fromRow == this.instance.wtSettings.getSetting('fixedRowsTop') || fromColumn == this.instance.wtSettings.getSetting('fixedColumnsLeft')) {
this.selectionHandles.styles.topLeft.zIndex = "9999";
this.selectionHandles.styles.topLeftHitArea.zIndex = "9999";
} else {
this.selectionHandles.styles.topLeft.zIndex = "";
this.selectionHandles.styles.topLeftHitArea.zIndex = "";
}
};
if (instance.cloneOverlay instanceof WalkontableTopOverlay || instance.cloneOverlay instanceof WalkontableCornerOverlay) {
ilen = instance.getSetting('fixedRowsTop');
} else {
ilen = instance.wtTable.getRenderedRowsCount();
}
for (i = 0; i < ilen; i++) {
s = instance.wtTable.rowFilter.renderedToSource(i);
if (s >= corners[0] && s <= corners[2]) {
fromRow = s;
break;
}
}
for (i = ilen - 1; i >= 0; i--) {
s = instance.wtTable.rowFilter.renderedToSource(i);
if (s >= corners[0] && s <= corners[2]) {
toRow = s;
break;
}
}
ilen = instance.wtTable.getRenderedColumnsCount();
for (i = 0; i < ilen; i++) {
s = instance.wtTable.columnFilter.renderedToSource(i);
if (s >= corners[1] && s <= corners[3]) {
fromColumn = s;
break;
}
}
for (i = ilen - 1; i >= 0; i--) {
s = instance.wtTable.columnFilter.renderedToSource(i);
if (s >= corners[1] && s <= corners[3]) {
toColumn = s;
break;
}
}
if (fromRow !== void 0 && fromColumn !== void 0) {
isMultiple = (fromRow !== toRow || fromColumn !== toColumn);
fromTD = instance.wtTable.getCell(new WalkontableCellCoords(fromRow, fromColumn));
toTD = isMultiple ? instance.wtTable.getCell(new WalkontableCellCoords(toRow, toColumn)) : fromTD;
fromOffset = dom.offset(fromTD);
toOffset = isMultiple ? dom.offset(toTD) : fromOffset;
containerOffset = dom.offset(instance.wtTable.TABLE);
minTop = fromOffset.top;
height = toOffset.top + dom.outerHeight(toTD) - minTop;
minLeft = fromOffset.left;
width = toOffset.left + dom.outerWidth(toTD) - minLeft;
top = minTop - containerOffset.top - 1;
left = minLeft - containerOffset.left - 1;
var style = dom.getComputedStyle(fromTD);
if (parseInt(style.borderTopWidth, 10) > 0) {
top += 1;
height = height > 0 ? height - 1 : 0;
}
if (parseInt(style.borderLeftWidth, 10) > 0) {
left += 1;
width = width > 0 ? width - 1 : 0;
}
} else {
this.disappear();
return;
}
this.topStyle.top = top + 'px';
this.topStyle.left = left + 'px';
this.topStyle.width = width + 'px';
this.topStyle.display = 'block';
this.leftStyle.top = top + 'px';
this.leftStyle.left = left + 'px';
this.leftStyle.height = height + 'px';
this.leftStyle.display = 'block';
var delta = Math.floor(this.settings.border.width / 2);
this.bottomStyle.top = top + height - delta + 'px';
this.bottomStyle.left = left + 'px';
this.bottomStyle.width = width + 'px';
this.bottomStyle.display = 'block';
this.rightStyle.top = top + 'px';
this.rightStyle.left = left + width - delta + 'px';
this.rightStyle.height = height + 1 + 'px';
this.rightStyle.display = 'block';
if (Handsontable.mobileBrowser || (!this.hasSetting(this.settings.border.cornerVisible) || isPartRange.call(this))) {
this.cornerStyle.display = 'none';
} else {
this.cornerStyle.top = top + height - 4 + 'px';
this.cornerStyle.left = left + width - 4 + 'px';
this.cornerStyle.borderRightWidth = this.cornerDefaultStyle.borderWidth;
this.cornerStyle.width = this.cornerDefaultStyle.width;
this.cornerStyle.display = 'block';
if (toColumn === this.instance.getSetting('totalColumns') - 1) {
var trimmingContainer = dom.getTrimmingContainer(instance.wtTable.TABLE),
cornerOverlappingContainer = toTD.offsetLeft + dom.outerWidth(toTD) >= dom.innerWidth(trimmingContainer);
if (cornerOverlappingContainer) {
this.cornerStyle.left = Math.floor(left + width - 3 - parseInt(this.cornerDefaultStyle.width) / 2) + "px";
this.cornerStyle.borderRightWidth = 0;
}
}
}
if (Handsontable.mobileBrowser) {
updateMultipleSelectionHandlesPosition.call(this, top, left, width, height);
}
};
WalkontableBorder.prototype.disappear = function() {
this.topStyle.display = 'none';
this.leftStyle.display = 'none';
this.bottomStyle.display = 'none';
this.rightStyle.display = 'none';
this.cornerStyle.display = 'none';
if (Handsontable.mobileBrowser) {
this.selectionHandles.styles.topLeft.display = 'none';
this.selectionHandles.styles.bottomRight.display = 'none';
}
};
WalkontableBorder.prototype.hasSetting = function(setting) {
if (typeof setting === 'function') {
return setting();
}
return !!setting;
};
;
window.WalkontableBorder = WalkontableBorder;
//#
},{"./../../../dom.js":27,"./../../../eventManager.js":41,"./cell/coords.js":5}],3:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableViewportColumnsCalculator: {get: function() {
return WalkontableViewportColumnsCalculator;
}},
__esModule: {value: true}
});
var privatePool = new WeakMap();
var WalkontableViewportColumnsCalculator = function WalkontableViewportColumnsCalculator(viewportWidth, scrollOffset, totalColumns, columnWidthFn, overrideFn, onlyFullyVisible, stretchH) {
privatePool.set(this, {
viewportWidth: viewportWidth,
scrollOffset: scrollOffset,
totalColumns: totalColumns,
columnWidthFn: columnWidthFn,
overrideFn: overrideFn,
onlyFullyVisible: onlyFullyVisible
});
this.count = 0;
this.startColumn = null;
this.endColumn = null;
this.startPosition = null;
this.stretchAllRatio = 0;
this.stretchLastWidth = 0;
this.stretch = stretchH;
this.totalTargetWidth = 0;
this.needVerifyLastColumnWidth = true;
this.stretchAllColumnsWidth = [];
this.calculate();
};
var $WalkontableViewportColumnsCalculator = WalkontableViewportColumnsCalculator;
($traceurRuntime.createClass)(WalkontableViewportColumnsCalculator, {
calculate: function() {
var sum = 0;
var needReverse = true;
var startPositions = [];
var columnWidth;
var priv = privatePool.get(this);
var onlyFullyVisible = priv.onlyFullyVisible;
var overrideFn = priv.overrideFn;
var scrollOffset = priv.scrollOffset;
var totalColumns = priv.totalColumns;
var viewportWidth = priv.viewportWidth;
for (var i = 0; i < totalColumns; i++) {
columnWidth = this._getColumnWidth(i);
if (sum <= scrollOffset && !onlyFullyVisible) {
this.startColumn = i;
}
if (sum >= scrollOffset && sum + columnWidth <= scrollOffset + viewportWidth) {
if (this.startColumn == null) {
this.startColumn = i;
}
this.endColumn = i;
}
startPositions.push(sum);
sum += columnWidth;
if (!onlyFullyVisible) {
this.endColumn = i;
}
if (sum >= scrollOffset + viewportWidth) {
needReverse = false;
break;
}
}
if (this.endColumn === totalColumns - 1 && needReverse) {
this.startColumn = this.endColumn;
while (this.startColumn > 0) {
var viewportSum = startPositions[this.endColumn] + columnWidth - startPositions[this.startColumn - 1];
if (viewportSum <= viewportWidth || !onlyFullyVisible) {
this.startColumn--;
}
if (viewportSum > viewportWidth) {
break;
}
}
}
if (this.startColumn !== null && overrideFn) {
overrideFn(this);
}
this.startPosition = startPositions[this.startColumn];
if (this.startPosition == void 0) {
this.startPosition = null;
}
if (this.startColumn !== null) {
this.count = this.endColumn - this.startColumn + 1;
}
},
refreshStretching: function(totalWidth) {
if (this.stretch === 'none') {
return;
}
var sumAll = 0;
var columnWidth;
var remainingSize;
var priv = privatePool.get(this);
var totalColumns = priv.totalColumns;
for (var i = 0; i < totalColumns; i++) {
columnWidth = this._getColumnWidth(i);
sumAll += columnWidth;
}
this.totalTargetWidth = totalWidth;
remainingSize = sumAll - totalWidth;
if (this.stretch === 'all' && remainingSize < 0) {
this.stretchAllRatio = totalWidth / sumAll;
this.stretchAllColumnsWidth = [];
this.needVerifyLastColumnWidth = true;
} else if (this.stretch === 'last' && totalWidth !== Infinity) {
this.stretchLastWidth = -remainingSize + this._getColumnWidth(totalColumns - 1);
}
},
getStretchedColumnWidth: function(column, baseWidth) {
var result = null;
if (this.stretch === 'all' && this.stretchAllRatio !== 0) {
result = this._getStretchedAllColumnWidth(column, baseWidth);
} else if (this.stretch === 'last' && this.stretchLastWidth !== 0) {
result = this._getStretchedLastColumnWidth(column);
}
return result;
},
_getStretchedAllColumnWidth: function(column, baseWidth) {
var sumRatioWidth = 0;
var priv = privatePool.get(this);
var totalColumns = priv.totalColumns;
if (!this.stretchAllColumnsWidth[column]) {
this.stretchAllColumnsWidth[column] = Math.round(baseWidth * this.stretchAllRatio);
}
if (this.stretchAllColumnsWidth.length === totalColumns && this.needVerifyLastColumnWidth) {
this.needVerifyLastColumnWidth = false;
for (var i = 0; i < this.stretchAllColumnsWidth.length; i++) {
sumRatioWidth += this.stretchAllColumnsWidth[i];
}
if (sumRatioWidth !== this.totalTargetWidth) {
this.stretchAllColumnsWidth[this.stretchAllColumnsWidth.length - 1] += this.totalTargetWidth - sumRatioWidth;
}
}
return this.stretchAllColumnsWidth[column];
},
_getStretchedLastColumnWidth: function(column) {
var priv = privatePool.get(this);
var totalColumns = priv.totalColumns;
if (column === totalColumns - 1) {
return this.stretchLastWidth;
}
return null;
},
_getColumnWidth: function(column) {
var width = privatePool.get(this).columnWidthFn(column);
if (width === undefined) {
width = $WalkontableViewportColumnsCalculator.DEFAULT_WIDTH;
}
return width;
}
}, {get DEFAULT_WIDTH() {
return 50;
}});
;
window.WalkontableViewportColumnsCalculator = WalkontableViewportColumnsCalculator;
//#
},{}],4:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableViewportRowsCalculator: {get: function() {
return WalkontableViewportRowsCalculator;
}},
__esModule: {value: true}
});
var privatePool = new WeakMap();
var WalkontableViewportRowsCalculator = function WalkontableViewportRowsCalculator(viewportHeight, scrollOffset, totalRows, rowHeightFn, overrideFn, onlyFullyVisible) {
privatePool.set(this, {
viewportHeight: viewportHeight,
scrollOffset: scrollOffset,
totalRows: totalRows,
rowHeightFn: rowHeightFn,
overrideFn: overrideFn,
onlyFullyVisible: onlyFullyVisible
});
this.count = 0;
this.startRow = null;
this.endRow = null;
this.startPosition = null;
this.calculate();
};
var $WalkontableViewportRowsCalculator = WalkontableViewportRowsCalculator;
($traceurRuntime.createClass)(WalkontableViewportRowsCalculator, {calculate: function() {
var sum = 0;
var needReverse = true;
var startPositions = [];
var priv = privatePool.get(this);
var onlyFullyVisible = priv.onlyFullyVisible;
var overrideFn = priv.overrideFn;
var rowHeightFn = priv.rowHeightFn;
var scrollOffset = priv.scrollOffset;
var totalRows = priv.totalRows;
var viewportHeight = priv.viewportHeight;
for (var i = 0; i < totalRows; i++) {
var rowHeight = rowHeightFn(i);
if (rowHeight === undefined) {
rowHeight = $WalkontableViewportRowsCalculator.DEFAULT_HEIGHT;
}
if (sum <= scrollOffset && !onlyFullyVisible) {
this.startRow = i;
}
if (sum >= scrollOffset && sum + rowHeight <= scrollOffset + viewportHeight) {
if (this.startRow === null) {
this.startRow = i;
}
this.endRow = i;
}
startPositions.push(sum);
sum += rowHeight;
if (!onlyFullyVisible) {
this.endRow = i;
}
if (sum >= scrollOffset + viewportHeight) {
needReverse = false;
break;
}
}
if (this.endRow === totalRows - 1 && needReverse) {
this.startRow = this.endRow;
while (this.startRow > 0) {
var viewportSum = startPositions[this.endRow] + rowHeight - startPositions[this.startRow - 1];
if (viewportSum <= viewportHeight || !onlyFullyVisible) {
this.startRow--;
}
if (viewportSum >= viewportHeight) {
break;
}
}
}
if (this.startRow !== null && overrideFn) {
overrideFn(this);
}
this.startPosition = startPositions[this.startRow];
if (this.startPosition == void 0) {
this.startPosition = null;
}
if (this.startRow !== null) {
this.count = this.endRow - this.startRow + 1;
}
}}, {get DEFAULT_HEIGHT() {
return 23;
}});
;
window.WalkontableViewportRowsCalculator = WalkontableViewportRowsCalculator;
//#
},{}],5:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableCellCoords: {get: function() {
return WalkontableCellCoords;
}},
__esModule: {value: true}
});
var WalkontableCellCoords = function WalkontableCellCoords(row, col) {
if (typeof row !== 'undefined' && typeof col !== 'undefined') {
this.row = row;
this.col = col;
} else {
this.row = null;
this.col = null;
}
};
($traceurRuntime.createClass)(WalkontableCellCoords, {
isValid: function(wotInstance) {
if (this.row < 0 || this.col < 0) {
return false;
}
if (this.row >= wotInstance.getSetting('totalRows') || this.col >= wotInstance.getSetting('totalColumns')) {
return false;
}
return true;
},
isEqual: function(cellCoords) {
if (cellCoords === this) {
return true;
}
return this.row === cellCoords.row && this.col === cellCoords.col;
},
isSouthEastOf: function(testedCoords) {
return this.row >= testedCoords.row && this.col >= testedCoords.col;
},
isNorthWestOf: function(testedCoords) {
return this.row <= testedCoords.row && this.col <= testedCoords.col;
},
isSouthWestOf: function(testedCoords) {
return this.row >= testedCoords.row && this.col <= testedCoords.col;
},
isNorthEastOf: function(testedCoords) {
return this.row <= testedCoords.row && this.col >= testedCoords.col;
}
}, {});
;
window.WalkontableCellCoords = WalkontableCellCoords;
//#
},{}],6:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableCellRange: {get: function() {
return WalkontableCellRange;
}},
__esModule: {value: true}
});
var $___46__46__47_cell_47_coords_46_js__;
var WalkontableCellCoords = ($___46__46__47_cell_47_coords_46_js__ = require("./../cell/coords.js"), $___46__46__47_cell_47_coords_46_js__ && $___46__46__47_cell_47_coords_46_js__.__esModule && $___46__46__47_cell_47_coords_46_js__ || {default: $___46__46__47_cell_47_coords_46_js__}).WalkontableCellCoords;
var WalkontableCellRange = function WalkontableCellRange(highlight, from, to) {
this.highlight = highlight;
this.from = from;
this.to = to;
};
var $WalkontableCellRange = WalkontableCellRange;
($traceurRuntime.createClass)(WalkontableCellRange, {
isValid: function(wotInstance) {
return this.from.isValid(wotInstance) && this.to.isValid(wotInstance);
},
isSingle: function() {
return this.from.row === this.to.row && this.from.col === this.to.col;
},
getHeight: function() {
return Math.max(this.from.row, this.to.row) - Math.min(this.from.row, this.to.row) + 1;
},
getWidth: function() {
return Math.max(this.from.col, this.to.col) - Math.min(this.from.col, this.to.col) + 1;
},
includes: function(cellCoords) {
var topLeft = this.getTopLeftCorner();
var bottomRight = this.getBottomRightCorner();
if (cellCoords.row < 0) {
cellCoords.row = 0;
}
if (cellCoords.col < 0) {
cellCoords.col = 0;
}
return topLeft.row <= cellCoords.row && bottomRight.row >= cellCoords.row && topLeft.col <= cellCoords.col && bottomRight.col >= cellCoords.col;
},
includesRange: function(testedRange) {
return this.includes(testedRange.getTopLeftCorner()) && this.includes(testedRange.getBottomRightCorner());
},
isEqual: function(testedRange) {
return (Math.min(this.from.row, this.to.row) == Math.min(testedRange.from.row, testedRange.to.row)) && (Math.max(this.from.row, this.to.row) == Math.max(testedRange.from.row, testedRange.to.row)) && (Math.min(this.from.col, this.to.col) == Math.min(testedRange.from.col, testedRange.to.col)) && (Math.max(this.from.col, this.to.col) == Math.max(testedRange.from.col, testedRange.to.col));
},
overlaps: function(testedRange) {
return testedRange.isSouthEastOf(this.getTopLeftCorner()) && testedRange.isNorthWestOf(this.getBottomRightCorner());
},
isSouthEastOf: function(testedCoords) {
return this.getTopLeftCorner().isSouthEastOf(testedCoords) || this.getBottomRightCorner().isSouthEastOf(testedCoords);
},
isNorthWestOf: function(testedCoords) {
return this.getTopLeftCorner().isNorthWestOf(testedCoords) || this.getBottomRightCorner().isNorthWestOf(testedCoords);
},
expand: function(cellCoords) {
var topLeft = this.getTopLeftCorner();
var bottomRight = this.getBottomRightCorner();
if (cellCoords.row < topLeft.row || cellCoords.col < topLeft.col || cellCoords.row > bottomRight.row || cellCoords.col > bottomRight.col) {
this.from = new WalkontableCellCoords(Math.min(topLeft.row, cellCoords.row), Math.min(topLeft.col, cellCoords.col));
this.to = new WalkontableCellCoords(Math.max(bottomRight.row, cellCoords.row), Math.max(bottomRight.col, cellCoords.col));
return true;
}
return false;
},
expandByRange: function(expandingRange) {
if (this.includesRange(expandingRange) || !this.overlaps(expandingRange)) {
return false;
}
var topLeft = this.getTopLeftCorner();
var bottomRight = this.getBottomRightCorner();
var topRight = this.getTopRightCorner();
var bottomLeft = this.getBottomLeftCorner();
var expandingTopLeft = expandingRange.getTopLeftCorner();
var expandingBottomRight = expandingRange.getBottomRightCorner();
var resultTopRow = Math.min(topLeft.row, expandingTopLeft.row);
var resultTopCol = Math.min(topLeft.col, expandingTopLeft.col);
var resultBottomRow = Math.max(bottomRight.row, expandingBottomRight.row);
var resultBottomCol = Math.max(bottomRight.col, expandingBottomRight.col);
var finalFrom = new WalkontableCellCoords(resultTopRow, resultTopCol),
finalTo = new WalkontableCellCoords(resultBottomRow, resultBottomCol);
var isCorner = new $WalkontableCellRange(finalFrom, finalFrom, finalTo).isCorner(this.from, expandingRange),
onlyMerge = expandingRange.isEqual(new $WalkontableCellRange(finalFrom, finalFrom, finalTo));
if (isCorner && !onlyMerge) {
if (this.from.col > finalFrom.col) {
finalFrom.col = resultBottomCol;
finalTo.col = resultTopCol;
}
if (this.from.row > finalFrom.row) {
finalFrom.row = resultBottomRow;
finalTo.row = resultTopRow;
}
}
this.from = finalFrom;
this.to = finalTo;
return true;
},
getDirection: function() {
if (this.from.isNorthWestOf(this.to)) {
return 'NW-SE';
} else if (this.from.isNorthEastOf(this.to)) {
return 'NE-SW';
} else if (this.from.isSouthEastOf(this.to)) {
return 'SE-NW';
} else if (this.from.isSouthWestOf(this.to)) {
return 'SW-NE';
}
},
setDirection: function(direction) {
switch (direction) {
case 'NW-SE':
this.from = this.getTopLeftCorner();
this.to = this.getBottomRightCorner();
break;
case 'NE-SW':
this.from = this.getTopRightCorner();
this.to = this.getBottomLeftCorner();
break;
case 'SE-NW':
this.from = this.getBottomRightCorner();
this.to = this.getTopLeftCorner();
break;
case 'SW-NE':
this.from = this.getBottomLeftCorner();
this.to = this.getTopRightCorner();
break;
}
},
getTopLeftCorner: function() {
return new WalkontableCellCoords(Math.min(this.from.row, this.to.row), Math.min(this.from.col, this.to.col));
},
getBottomRightCorner: function() {
return new WalkontableCellCoords(Math.max(this.from.row, this.to.row), Math.max(this.from.col, this.to.col));
},
getTopRightCorner: function() {
return new WalkontableCellCoords(Math.min(this.from.row, this.to.row), Math.max(this.from.col, this.to.col));
},
getBottomLeftCorner: function() {
return new WalkontableCellCoords(Math.max(this.from.row, this.to.row), Math.min(this.from.col, this.to.col));
},
isCorner: function(coords, expandedRange) {
if (expandedRange) {
if (expandedRange.includes(coords)) {
if (this.getTopLeftCorner().isEqual(new WalkontableCellCoords(expandedRange.from.row, expandedRange.from.col)) || this.getTopRightCorner().isEqual(new WalkontableCellCoords(expandedRange.from.row, expandedRange.to.col)) || this.getBottomLeftCorner().isEqual(new WalkontableCellCoords(expandedRange.to.row, expandedRange.from.col)) || this.getBottomRightCorner().isEqual(new WalkontableCellCoords(expandedRange.to.row, expandedRange.to.col))) {
return true;
}
}
}
return coords.isEqual(this.getTopLeftCorner()) || coords.isEqual(this.getTopRightCorner()) || coords.isEqual(this.getBottomLeftCorner()) || coords.isEqual(this.getBottomRightCorner());
},
getOppositeCorner: function(coords, expandedRange) {
if (!(coords instanceof WalkontableCellCoords)) {
return false;
}
if (expandedRange) {
if (expandedRange.includes(coords)) {
if (this.getTopLeftCorner().isEqual(new WalkontableCellCoords(expandedRange.from.row, expandedRange.from.col))) {
return this.getBottomRightCorner();
}
if (this.getTopRightCorner().isEqual(new WalkontableCellCoords(expandedRange.from.row, expandedRange.to.col))) {
return this.getBottomLeftCorner();
}
if (this.getBottomLeftCorner().isEqual(new WalkontableCellCoords(expandedRange.to.row, expandedRange.from.col))) {
return this.getTopRightCorner();
}
if (this.getBottomRightCorner().isEqual(new WalkontableCellCoords(expandedRange.to.row, expandedRange.to.col))) {
return this.getTopLeftCorner();
}
}
}
if (coords.isEqual(this.getBottomRightCorner())) {
return this.getTopLeftCorner();
} else if (coords.isEqual(this.getTopLeftCorner())) {
return this.getBottomRightCorner();
} else if (coords.isEqual(this.getTopRightCorner())) {
return this.getBottomLeftCorner();
} else if (coords.isEqual(this.getBottomLeftCorner())) {
return this.getTopRightCorner();
}
},
getBordersSharedWith: function(range) {
if (!this.includesRange(range)) {
return [];
}
var thisBorders = {
top: Math.min(this.from.row, this.to.row),
bottom: Math.max(this.from.row, this.to.row),
left: Math.min(this.from.col, this.to.col),
right: Math.max(this.from.col, this.to.col)
};
var rangeBorders = {
top: Math.min(range.from.row, range.to.row),
bottom: Math.max(range.from.row, range.to.row),
left: Math.min(range.from.col, range.to.col),
right: Math.max(range.from.col, range.to.col)
};
var result = [];
if (thisBorders.top == rangeBorders.top) {
result.push('top');
}
if (thisBorders.right == rangeBorders.right) {
result.push('right');
}
if (thisBorders.bottom == rangeBorders.bottom) {
result.push('bottom');
}
if (thisBorders.left == rangeBorders.left) {
result.push('left');
}
return result;
},
getInner: function() {
var topLeft = this.getTopLeftCorner();
var bottomRight = this.getBottomRightCorner();
var out = [];
for (var r = topLeft.row; r <= bottomRight.row; r++) {
for (var c = topLeft.col; c <= bottomRight.col; c++) {
if (!(this.from.row === r && this.from.col === c) && !(this.to.row === r && this.to.col === c)) {
out.push(new WalkontableCellCoords(r, c));
}
}
}
return out;
},
getAll: function() {
var topLeft = this.getTopLeftCorner();
var bottomRight = this.getBottomRightCorner();
var out = [];
for (var r = topLeft.row; r <= bottomRight.row; r++) {
for (var c = topLeft.col; c <= bottomRight.col; c++) {
if (topLeft.row === r && topLeft.col === c) {
out.push(topLeft);
} else if (bottomRight.row === r && bottomRight.col === c) {
out.push(bottomRight);
} else {
out.push(new WalkontableCellCoords(r, c));
}
}
}
return out;
},
forAll: function(callback) {
var topLeft = this.getTopLeftCorner();
var bottomRight = this.getBottomRightCorner();
for (var r = topLeft.row; r <= bottomRight.row; r++) {
for (var c = topLeft.col; c <= bottomRight.col; c++) {
var breakIteration = callback(r, c);
if (breakIteration === false) {
return;
}
}
}
}
}, {});
;
window.WalkontableCellRange = WalkontableCellRange;
//#
},{"./../cell/coords.js":5}],7:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
Walkontable: {get: function() {
return Walkontable;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47__46__46__47_helpers_46_js__,
$__event_46_js__,
$__overlays_46_js__,
$__scroll_46_js__,
$__settings_46_js__,
$__table_46_js__,
$__viewport_46_js__;
var dom = ($___46__46__47__46__46__47__46__46__47_dom_46_js__ = require("./../../../dom.js"), $___46__46__47__46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47__46__46__47_dom_46_js__});
var randomString = ($___46__46__47__46__46__47__46__46__47_helpers_46_js__ = require("./../../../helpers.js"), $___46__46__47__46__46__47__46__46__47_helpers_46_js__ && $___46__46__47__46__46__47__46__46__47_helpers_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47_helpers_46_js__ || {default: $___46__46__47__46__46__47__46__46__47_helpers_46_js__}).randomString;
var WalkontableEvent = ($__event_46_js__ = require("./event.js"), $__event_46_js__ && $__event_46_js__.__esModule && $__event_46_js__ || {default: $__event_46_js__}).WalkontableEvent;
var WalkontableOverlays = ($__overlays_46_js__ = require("./overlays.js"), $__overlays_46_js__ && $__overlays_46_js__.__esModule && $__overlays_46_js__ || {default: $__overlays_46_js__}).WalkontableOverlays;
var WalkontableScroll = ($__scroll_46_js__ = require("./scroll.js"), $__scroll_46_js__ && $__scroll_46_js__.__esModule && $__scroll_46_js__ || {default: $__scroll_46_js__}).WalkontableScroll;
var WalkontableSettings = ($__settings_46_js__ = require("./settings.js"), $__settings_46_js__ && $__settings_46_js__.__esModule && $__settings_46_js__ || {default: $__settings_46_js__}).WalkontableSettings;
var WalkontableTable = ($__table_46_js__ = require("./table.js"), $__table_46_js__ && $__table_46_js__.__esModule && $__table_46_js__ || {default: $__table_46_js__}).WalkontableTable;
var WalkontableViewport = ($__viewport_46_js__ = require("./viewport.js"), $__viewport_46_js__ && $__viewport_46_js__.__esModule && $__viewport_46_js__ || {default: $__viewport_46_js__}).WalkontableViewport;
var Walkontable = function Walkontable(settings) {
var originalHeaders = [];
this.guid = 'wt_' + randomString();
if (settings.cloneSource) {
this.cloneSource = settings.cloneSource;
this.cloneOverlay = settings.cloneOverlay;
this.wtSettings = settings.cloneSource.wtSettings;
this.wtTable = new WalkontableTable(this, settings.table, settings.wtRootElement);
this.wtScroll = new WalkontableScroll(this);
this.wtViewport = settings.cloneSource.wtViewport;
this.wtEvent = new WalkontableEvent(this);
this.selections = this.cloneSource.selections;
} else {
this.wtSettings = new WalkontableSettings(this, settings);
this.wtTable = new WalkontableTable(this, settings.table);
this.wtScroll = new WalkontableScroll(this);
this.wtViewport = new WalkontableViewport(this);
this.wtEvent = new WalkontableEvent(this);
this.selections = this.getSetting('selections');
this.wtOverlays = new WalkontableOverlays(this);
}
if (this.wtTable.THEAD.childNodes.length && this.wtTable.THEAD.childNodes[0].childNodes.length) {
for (var c = 0,
clen = this.wtTable.THEAD.childNodes[0].childNodes.length; c < clen; c++) {
originalHeaders.push(this.wtTable.THEAD.childNodes[0].childNodes[c].innerHTML);
}
if (!this.getSetting('columnHeaders').length) {
this.update('columnHeaders', [function(column, TH) {
dom.fastInnerText(TH, originalHeaders[column]);
}]);
}
}
this.drawn = false;
this.drawInterrupted = false;
};
($traceurRuntime.createClass)(Walkontable, {
draw: function() {
var fastDraw = arguments[0] !== (void 0) ? arguments[0] : false;
this.drawInterrupted = false;
if (!fastDraw && !dom.isVisible(this.wtTable.TABLE)) {
this.drawInterrupted = true;
} else {
this.wtTable.draw(fastDraw);
}
return this;
},
getCell: function(coords) {
var topmost = arguments[1] !== (void 0) ? arguments[1] : false;
if (!topmost) {
return this.wtTable.getCell(coords);
}
var fixedRows = this.wtSettings.getSetting('fixedRowsTop');
var fixedColumns = this.wtSettings.getSetting('fixedColumnsLeft');
if (coords.row < fixedRows && coords.col < fixedColumns) {
return this.wtOverlays.topLeftCornerOverlay.clone.wtTable.getCell(coords);
} else if (coords.row < fixedRows) {
return this.wtOverlays.topOverlay.clone.wtTable.getCell(coords);
} else if (coords.col < fixedColumns) {
return this.wtOverlays.leftOverlay.clone.wtTable.getCell(coords);
}
return this.wtTable.getCell(coords);
},
update: function(settings, value) {
return this.wtSettings.update(settings, value);
},
scrollVertical: function(row) {
this.wtOverlays.topOverlay.scrollTo(row);
this.getSetting('onScrollVertically');
return this;
},
scrollHorizontal: function(column) {
this.wtOverlays.leftOverlay.scrollTo(column);
this.getSetting('onScrollHorizontally');
return this;
},
scrollViewport: function(coords) {
this.wtScroll.scrollViewport(coords);
return this;
},
getViewport: function() {
return [this.wtTable.getFirstVisibleRow(), this.wtTable.getFirstVisibleColumn(), this.wtTable.getLastVisibleRow(), this.wtTable.getLastVisibleColumn()];
},
getOverlayName: function() {
return this.cloneOverlay ? this.cloneOverlay.type : 'master';
},
getSetting: function(key, param1, param2, param3, param4) {
return this.wtSettings.getSetting(key, param1, param2, param3, param4);
},
hasSetting: function(key) {
return this.wtSettings.has(key);
},
destroy: function() {
this.wtOverlays.destroy();
if (this.wtEvent) {
this.wtEvent.destroy();
}
}
}, {});
;
window.Walkontable = Walkontable;
//#
},{"./../../../dom.js":27,"./../../../helpers.js":42,"./event.js":8,"./overlays.js":16,"./scroll.js":17,"./settings.js":19,"./table.js":20,"./viewport.js":22}],8:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableEvent: {get: function() {
return WalkontableEvent;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47__46__46__47_eventManager_46_js__;
var dom = ($___46__46__47__46__46__47__46__46__47_dom_46_js__ = require("./../../../dom.js"), $___46__46__47__46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47__46__46__47_dom_46_js__});
var eventManagerObject = ($___46__46__47__46__46__47__46__46__47_eventManager_46_js__ = require("./../../../eventManager.js"), $___46__46__47__46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47__46__46__47_eventManager_46_js__}).eventManager;
function WalkontableEvent(instance) {
var that = this;
var eventManager = eventManagerObject(instance);
this.instance = instance;
var dblClickOrigin = [null, null];
this.dblClickTimeout = [null, null];
var onMouseDown = function(event) {
var cell = that.parentCell(event.realTarget);
if (dom.hasClass(event.realTarget, 'corner')) {
that.instance.getSetting('onCellCornerMouseDown', event, event.realTarget);
} else if (cell.TD) {
if (that.instance.hasSetting('onCellMouseDown')) {
that.instance.getSetting('onCellMouseDown', event, cell.coords, cell.TD, that.instance);
}
}
if (event.button !== 2) {
if (cell.TD) {
dblClickOrigin[0] = cell.TD;
clearTimeout(that.dblClickTimeout[0]);
that.dblClickTimeout[0] = setTimeout(function() {
dblClickOrigin[0] = null;
}, 1000);
}
}
};
var onTouchMove = function(event) {
that.instance.touchMoving = true;
};
var longTouchTimeout;
var onTouchStart = function(event) {
var container = this;
eventManager.addEventListener(this, 'touchmove', onTouchMove);
that.checkIfTouchMove = setTimeout(function() {
if (that.instance.touchMoving === true) {
that.instance.touchMoving = void 0;
eventManager.removeEventListener("touchmove", onTouchMove, false);
return;
} else {
onMouseDown(event);
}
}, 30);
};
var lastMouseOver;
var onMouseOver = function(event) {
var table,
td;
if (that.instance.hasSetting('onCellMouseOver')) {
table = that.instance.wtTable.TABLE;
td = dom.closest(event.realTarget, ['TD', 'TH'], table);
if (td && td !== lastMouseOver && dom.isChildOf(td, table)) {
lastMouseOver = td;
that.instance.getSetting('onCellMouseOver', event, that.instance.wtTable.getCoords(td), td, that.instance);
}
}
};
var onMouseUp = function(event) {
if (event.button !== 2) {
var cell = that.parentCell(event.realTarget);
if (cell.TD === dblClickOrigin[0] && cell.TD === dblClickOrigin[1]) {
if (dom.hasClass(event.realTarget, 'corner')) {
that.instance.getSetting('onCellCornerDblClick', event, cell.coords, cell.TD, that.instance);
} else {
that.instance.getSetting('onCellDblClick', event, cell.coords, cell.TD, that.instance);
}
dblClickOrigin[0] = null;
dblClickOrigin[1] = null;
} else if (cell.TD === dblClickOrigin[0]) {
dblClickOrigin[1] = cell.TD;
clearTimeout(that.dblClickTimeout[1]);
that.dblClickTimeout[1] = setTimeout(function() {
dblClickOrigin[1] = null;
}, 500);
}
}
};
var onTouchEnd = function(event) {
clearTimeout(longTouchTimeout);
event.preventDefault();
onMouseUp(event);
};
eventManager.addEventListener(this.instance.wtTable.holder, 'mousedown', onMouseDown);
eventManager.addEventListener(this.instance.wtTable.TABLE, 'mouseover', onMouseOver);
eventManager.addEventListener(this.instance.wtTable.holder, 'mouseup', onMouseUp);
if (this.instance.wtTable.holder.parentNode.parentNode && Handsontable.mobileBrowser && !that.instance.wtTable.isWorkingOnClone()) {
var classSelector = "." + this.instance.wtTable.holder.parentNode.className.split(" ").join(".");
eventManager.addEventListener(this.instance.wtTable.holder, 'touchstart', function(event) {
that.instance.touchApplied = true;
if (dom.isChildOf(event.target, classSelector)) {
onTouchStart.call(event.target, event);
}
});
eventManager.addEventListener(this.instance.wtTable.holder, 'touchend', function(event) {
that.instance.touchApplied = false;
if (dom.isChildOf(event.target, classSelector)) {
onTouchEnd.call(event.target, event);
}
});
if (!that.instance.momentumScrolling) {
that.instance.momentumScrolling = {};
}
eventManager.addEventListener(this.instance.wtTable.holder, 'scroll', function(event) {
clearTimeout(that.instance.momentumScrolling._timeout);
if (!that.instance.momentumScrolling.ongoing) {
that.instance.getSetting('onBeforeTouchScroll');
}
that.instance.momentumScrolling.ongoing = true;
that.instance.momentumScrolling._timeout = setTimeout(function() {
if (!that.instance.touchApplied) {
that.instance.momentumScrolling.ongoing = false;
that.instance.getSetting('onAfterMomentumScroll');
}
}, 200);
});
}
eventManager.addEventListener(window, 'resize', function() {
if (that.instance.getSetting('stretchH') !== 'none') {
that.instance.draw();
}
});
this.destroy = function() {
clearTimeout(this.dblClickTimeout[0]);
clearTimeout(this.dblClickTimeout[1]);
eventManager.clear();
};
}
WalkontableEvent.prototype.parentCell = function(elem) {
var cell = {};
var TABLE = this.instance.wtTable.TABLE;
var TD = dom.closest(elem, ['TD', 'TH'], TABLE);
if (TD && dom.isChildOf(TD, TABLE)) {
cell.coords = this.instance.wtTable.getCoords(TD);
cell.TD = TD;
} else if (dom.hasClass(elem, 'wtBorder') && dom.hasClass(elem, 'current')) {
cell.coords = this.instance.selections.current.cellRange.highlight;
cell.TD = this.instance.wtTable.getCell(cell.coords);
} else if (dom.hasClass(elem, 'wtBorder') && dom.hasClass(elem, 'area')) {
if (this.instance.selections.area.cellRange) {
cell.coords = this.instance.selections.area.cellRange.to;
cell.TD = this.instance.wtTable.getCell(cell.coords);
}
}
return cell;
};
;
window.WalkontableEvent = WalkontableEvent;
//#
},{"./../../../dom.js":27,"./../../../eventManager.js":41}],9:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableColumnFilter: {get: function() {
return WalkontableColumnFilter;
}},
__esModule: {value: true}
});
var WalkontableColumnFilter = function WalkontableColumnFilter(offset, total, countTH) {
this.offset = offset;
this.total = total;
this.countTH = countTH;
};
($traceurRuntime.createClass)(WalkontableColumnFilter, {
offsetted: function(index) {
return index + this.offset;
},
unOffsetted: function(index) {
return index - this.offset;
},
renderedToSource: function(index) {
return this.offsetted(index);
},
sourceToRendered: function(index) {
return this.unOffsetted(index);
},
offsettedTH: function(index) {
return index - this.countTH;
},
unOffsettedTH: function(index) {
return index + this.countTH;
},
visibleRowHeadedColumnToSourceColumn: function(index) {
return this.renderedToSource(this.offsettedTH(index));
},
sourceColumnToVisibleRowHeadedColumn: function(index) {
return this.unOffsettedTH(this.sourceToRendered(index));
}
}, {});
;
window.WalkontableColumnFilter = WalkontableColumnFilter;
//#
},{}],10:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableRowFilter: {get: function() {
return WalkontableRowFilter;
}},
__esModule: {value: true}
});
var WalkontableRowFilter = function WalkontableRowFilter(offset, total, countTH) {
this.offset = offset;
this.total = total;
this.countTH = countTH;
};
($traceurRuntime.createClass)(WalkontableRowFilter, {
offsetted: function(index) {
return index + this.offset;
},
unOffsetted: function(index) {
return index - this.offset;
},
renderedToSource: function(index) {
return this.offsetted(index);
},
sourceToRendered: function(index) {
return this.unOffsetted(index);
},
offsettedTH: function(index) {
return index - this.countTH;
},
unOffsettedTH: function(index) {
return index + this.countTH;
},
visibleColHeadedRowToSourceRow: function(index) {
return this.renderedToSource(this.offsettedTH(index));
},
sourceRowToVisibleColHeadedRow: function(index) {
return this.unOffsettedTH(this.sourceToRendered(index));
}
}, {});
;
window.WalkontableRowFilter = WalkontableRowFilter;
//#
},{}],11:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableOverlay: {get: function() {
return WalkontableOverlay;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47__46__46__47__46__46__47_helpers_46_js__,
$___46__46__47__46__46__47__46__46__47__46__46__47_eventManager_46_js__;
var dom = ($___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__ = require("./../../../../dom.js"), $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__});
var defineGetter = ($___46__46__47__46__46__47__46__46__47__46__46__47_helpers_46_js__ = require("./../../../../helpers.js"), $___46__46__47__46__46__47__46__46__47__46__46__47_helpers_46_js__ && $___46__46__47__46__46__47__46__46__47__46__46__47_helpers_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47__46__46__47_helpers_46_js__ || {default: $___46__46__47__46__46__47__46__46__47__46__46__47_helpers_46_js__}).defineGetter;
var eventManagerObject = ($___46__46__47__46__46__47__46__46__47__46__46__47_eventManager_46_js__ = require("./../../../../eventManager.js"), $___46__46__47__46__46__47__46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47__46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47__46__46__47__46__46__47_eventManager_46_js__}).eventManager;
var WalkontableOverlay = function WalkontableOverlay(wotInstance) {
defineGetter(this, 'wot', wotInstance, {writable: false});
this.instance = this.wot;
this.type = '';
this.TABLE = this.wot.wtTable.TABLE;
this.hider = this.wot.wtTable.hider;
this.spreader = this.wot.wtTable.spreader;
this.holder = this.wot.wtTable.holder;
this.wtRootElement = this.wot.wtTable.wtRootElement;
this.trimmingContainer = dom.getTrimmingContainer(this.hider.parentNode.parentNode);
this.mainTableScrollableElement = dom.getScrollableElement(this.wot.wtTable.TABLE);
this.needFullRender = this.shouldBeRendered();
this.isElementSizesAdjusted = false;
};
var $WalkontableOverlay = WalkontableOverlay;
($traceurRuntime.createClass)(WalkontableOverlay, {
shouldBeRendered: function() {
return true;
},
makeClone: function(direction) {
if ($WalkontableOverlay.CLONE_TYPES.indexOf(direction) === -1) {
throw new Error('Clone type "' + direction + '" is not supported.');
}
var clone = document.createElement('DIV');
var clonedTable = document.createElement('TABLE');
clone.className = 'ht_clone_' + direction + ' handsontable';
clone.style.position = 'absolute';
clone.style.top = 0;
clone.style.left = 0;
clone.style.overflow = 'hidden';
clonedTable.className = this.wot.wtTable.TABLE.className;
clone.appendChild(clonedTable);
this.type = direction;
this.wot.wtTable.wtRootElement.parentNode.appendChild(clone);
return new Walkontable({
cloneSource: this.wot,
cloneOverlay: this,
table: clonedTable
});
},
refresh: function() {
var fastDraw = arguments[0] !== (void 0) ? arguments[0] : false;
var nextCycleRenderFlag = this.shouldBeRendered();
if (this.clone && (this.needFullRender || nextCycleRenderFlag)) {
this.clone.draw(fastDraw);
}
this.needFullRender = nextCycleRenderFlag;
},
destroy: function() {
eventManagerObject(this.clone).clear();
}
}, {
get CLONE_TOP() {
return 'top';
},
get CLONE_LEFT() {
return 'left';
},
get CLONE_CORNER() {
return 'corner';
},
get CLONE_DEBUG() {
return 'debug';
},
get CLONE_TYPES() {
return [$WalkontableOverlay.CLONE_TOP, $WalkontableOverlay.CLONE_LEFT, $WalkontableOverlay.CLONE_CORNER, $WalkontableOverlay.CLONE_DEBUG];
}
});
;
window.WalkontableOverlay = WalkontableOverlay;
//#
},{"./../../../../dom.js":27,"./../../../../eventManager.js":41,"./../../../../helpers.js":42}],12:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableCornerOverlay: {get: function() {
return WalkontableCornerOverlay;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__,
$___95_base_46_js__;
var dom = ($___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__ = require("./../../../../dom.js"), $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__});
var WalkontableOverlay = ($___95_base_46_js__ = require("./_base.js"), $___95_base_46_js__ && $___95_base_46_js__.__esModule && $___95_base_46_js__ || {default: $___95_base_46_js__}).WalkontableOverlay;
var WalkontableCornerOverlay = function WalkontableCornerOverlay(wotInstance) {
$traceurRuntime.superConstructor($WalkontableCornerOverlay).call(this, wotInstance);
this.clone = this.makeClone(WalkontableOverlay.CLONE_CORNER);
};
var $WalkontableCornerOverlay = WalkontableCornerOverlay;
($traceurRuntime.createClass)(WalkontableCornerOverlay, {
shouldBeRendered: function() {
return (this.wot.getSetting('fixedRowsTop') || this.wot.getSetting('columnHeaders').length) && (this.wot.getSetting('fixedColumnsLeft') || this.wot.getSetting('rowHeaders').length) ? true : false;
},
resetFixedPosition: function() {
if (!this.wot.wtTable.holder.parentNode) {
return;
}
var overlayRoot = this.clone.wtTable.holder.parentNode;
var tableHeight = dom.outerHeight(this.clone.wtTable.TABLE);
var tableWidth = dom.outerWidth(this.clone.wtTable.TABLE);
if (this.trimmingContainer === window) {
var box = this.wot.wtTable.hider.getBoundingClientRect();
var top = Math.ceil(box.top);
var left = Math.ceil(box.left);
var bottom = Math.ceil(box.bottom);
var right = Math.ceil(box.right);
var finalLeft;
var finalTop;
if (left < 0 && (right - overlayRoot.offsetWidth) > 0) {
finalLeft = -left + 'px';
} else {
finalLeft = '0';
}
if (top < 0 && (bottom - overlayRoot.offsetHeight) > 0) {
finalTop = -top + 'px';
} else {
finalTop = '0';
}
dom.setOverlayPosition(overlayRoot, finalLeft, finalTop);
}
overlayRoot.style.height = (tableHeight === 0 ? tableHeight : tableHeight + 4) + 'px';
overlayRoot.style.width = (tableWidth === 0 ? tableWidth : tableWidth + 4) + 'px';
}
}, {}, WalkontableOverlay);
;
window.WalkontableCornerOverlay = WalkontableCornerOverlay;
//#
},{"./../../../../dom.js":27,"./_base.js":11}],13:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableDebugOverlay: {get: function() {
return WalkontableDebugOverlay;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__,
$___95_base_46_js__;
var dom = ($___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__ = require("./../../../../dom.js"), $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__});
var WalkontableOverlay = ($___95_base_46_js__ = require("./_base.js"), $___95_base_46_js__ && $___95_base_46_js__.__esModule && $___95_base_46_js__ || {default: $___95_base_46_js__}).WalkontableOverlay;
var WalkontableDebugOverlay = function WalkontableDebugOverlay(wotInstance) {
$traceurRuntime.superConstructor($WalkontableDebugOverlay).call(this, wotInstance);
this.clone = this.makeClone(WalkontableOverlay.CLONE_DEBUG);
this.clone.wtTable.holder.style.opacity = 0.4;
this.clone.wtTable.holder.style.textShadow = '0 0 2px #ff0000';
dom.addClass(this.clone.wtTable.holder.parentNode, 'wtDebugVisible');
};
var $WalkontableDebugOverlay = WalkontableDebugOverlay;
($traceurRuntime.createClass)(WalkontableDebugOverlay, {}, {}, WalkontableOverlay);
;
window.WalkontableDebugOverlay = WalkontableDebugOverlay;
//#
},{"./../../../../dom.js":27,"./_base.js":11}],14:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableLeftOverlay: {get: function() {
return WalkontableLeftOverlay;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__,
$___95_base_46_js__;
var dom = ($___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__ = require("./../../../../dom.js"), $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__});
var WalkontableOverlay = ($___95_base_46_js__ = require("./_base.js"), $___95_base_46_js__ && $___95_base_46_js__.__esModule && $___95_base_46_js__ || {default: $___95_base_46_js__}).WalkontableOverlay;
var WalkontableLeftOverlay = function WalkontableLeftOverlay(wotInstance) {
$traceurRuntime.superConstructor($WalkontableLeftOverlay).call(this, wotInstance);
this.clone = this.makeClone(WalkontableOverlay.CLONE_LEFT);
};
var $WalkontableLeftOverlay = WalkontableLeftOverlay;
($traceurRuntime.createClass)(WalkontableLeftOverlay, {
shouldBeRendered: function() {
return this.wot.getSetting('fixedColumnsLeft') || this.wot.getSetting('rowHeaders').length ? true : false;
},
resetFixedPosition: function() {
if (!this.needFullRender || !this.wot.wtTable.holder.parentNode) {
return;
}
var overlayRoot = this.clone.wtTable.holder.parentNode;
var headerPosition = 0;
if (this.trimmingContainer === window) {
var box = this.wot.wtTable.hider.getBoundingClientRect();
var left = Math.ceil(box.left);
var right = Math.ceil(box.right);
var finalLeft;
var finalTop;
finalTop = this.wot.wtTable.hider.style.top;
finalTop = finalTop === '' ? 0 : finalTop;
if (left < 0 && (right - overlayRoot.offsetWidth) > 0) {
finalLeft = -left;
} else {
finalLeft = 0;
}
headerPosition = finalLeft;
finalLeft = finalLeft + 'px';
dom.setOverlayPosition(overlayRoot, finalLeft, finalTop);
} else {
headerPosition = this.getScrollPosition();
}
this.adjustHeaderBordersPosition(headerPosition);
},
setScrollPosition: function(pos) {
if (this.mainTableScrollableElement === window) {
window.scrollTo(pos, dom.getWindowScrollTop());
} else {
this.mainTableScrollableElement.scrollLeft = pos;
}
},
onScroll: function() {
this.wot.getSetting('onScrollHorizontally');
},
sumCellSizes: function(from, to) {
var sum = 0;
var defaultColumnWidth = this.wot.wtSettings.defaultColumnWidth;
while (from < to) {
sum += this.wot.wtTable.getStretchedColumnWidth(from) || defaultColumnWidth;
from++;
}
return sum;
},
adjustElementsSize: function() {
var force = arguments[0] !== (void 0) ? arguments[0] : false;
if (this.needFullRender || force) {
this.adjustRootElementSize();
this.adjustRootChildsSize();
if (!force) {
this.isElementSizesAdjusted = true;
}
}
},
adjustRootElementSize: function() {
var masterHolder = this.wot.wtTable.holder;
var scrollbarHeight = masterHolder.clientHeight !== masterHolder.offsetHeight ? dom.getScrollbarWidth() : 0;
var overlayRoot = this.clone.wtTable.holder.parentNode;
var overlayRootStyle = overlayRoot.style;
var tableWidth;
if (this.trimmingContainer !== window) {
overlayRootStyle.height = this.wot.wtViewport.getWorkspaceHeight() - scrollbarHeight + 'px';
}
this.clone.wtTable.holder.style.height = overlayRootStyle.height;
tableWidth = dom.outerWidth(this.clone.wtTable.TABLE);
overlayRootStyle.width = (tableWidth === 0 ? tableWidth : tableWidth + 4) + 'px';
},
adjustRootChildsSize: function() {
var scrollbarWidth = dom.getScrollbarWidth();
this.clone.wtTable.hider.style.height = this.hider.style.height;
this.clone.wtTable.holder.style.height = this.clone.wtTable.holder.parentNode.style.height;
if (scrollbarWidth === 0) {
scrollbarWidth = 30;
}
this.clone.wtTable.holder.style.width = parseInt(this.clone.wtTable.holder.parentNode.style.width, 10) + scrollbarWidth + 'px';
},
applyToDOM: function() {
var total = this.wot.getSetting('totalColumns');
if (!this.isElementSizesAdjusted) {
this.adjustElementsSize();
}
if (typeof this.wot.wtViewport.columnsRenderCalculator.startPosition === 'number') {
this.spreader.style.left = this.wot.wtViewport.columnsRenderCalculator.startPosition + 'px';
} else if (total === 0) {
this.spreader.style.left = '0';
} else {
throw new Error('Incorrect value of the columnsRenderCalculator');
}
this.spreader.style.right = '';
if (this.needFullRender) {
this.syncOverlayOffset();
}
},
syncOverlayOffset: function() {
if (typeof this.wot.wtViewport.rowsRenderCalculator.startPosition === 'number') {
this.clone.wtTable.spreader.style.top = this.wot.wtViewport.rowsRenderCalculator.startPosition + 'px';
} else {
this.clone.wtTable.spreader.style.top = '';
}
},
scrollTo: function(sourceCol, beyondRendered) {
var newX = this.getTableParentOffset();
var sourceInstance = this.wot.cloneSource ? this.wot.cloneSource : this.wot;
var mainHolder = sourceInstance.wtTable.holder;
var scrollbarCompensation = 0;
if (beyondRendered && mainHolder.offsetWidth !== mainHolder.clientWidth) {
scrollbarCompensation = dom.getScrollbarWidth();
}
if (beyondRendered) {
newX += this.sumCellSizes(0, sourceCol + 1);
newX -= this.wot.wtViewport.getViewportWidth();
} else {
newX += this.sumCellSizes(this.wot.getSetting('fixedColumnsLeft'), sourceCol);
}
newX += scrollbarCompensation;
this.setScrollPosition(newX);
},
getTableParentOffset: function() {
if (this.trimmingContainer === window) {
return this.wot.wtTable.holderOffset.left;
} else {
return 0;
}
},
getScrollPosition: function() {
return dom.getScrollLeft(this.mainTableScrollableElement);
},
adjustHeaderBordersPosition: function(position) {
if (this.wot.getSetting('fixedColumnsLeft') === 0 && this.wot.getSetting('rowHeaders').length > 0) {
var masterParent = this.wot.wtTable.holder.parentNode;
var previousState = dom.hasClass(masterParent, 'innerBorderLeft');
if (position) {
dom.addClass(masterParent, 'innerBorderLeft');
} else {
dom.removeClass(masterParent, 'innerBorderLeft');
}
if (!previousState && position || previousState && !position) {
this.wot.wtOverlays.adjustElementsSize();
}
}
}
}, {}, WalkontableOverlay);
;
window.WalkontableLeftOverlay = WalkontableLeftOverlay;
//#
},{"./../../../../dom.js":27,"./_base.js":11}],15:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableTopOverlay: {get: function() {
return WalkontableTopOverlay;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__,
$___95_base_46_js__;
var dom = ($___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__ = require("./../../../../dom.js"), $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47__46__46__47__46__46__47_dom_46_js__});
var WalkontableOverlay = ($___95_base_46_js__ = require("./_base.js"), $___95_base_46_js__ && $___95_base_46_js__.__esModule && $___95_base_46_js__ || {default: $___95_base_46_js__}).WalkontableOverlay;
var WalkontableTopOverlay = function WalkontableTopOverlay(wotInstance) {
$traceurRuntime.superConstructor($WalkontableTopOverlay).call(this, wotInstance);
this.clone = this.makeClone(WalkontableOverlay.CLONE_TOP);
};
var $WalkontableTopOverlay = WalkontableTopOverlay;
($traceurRuntime.createClass)(WalkontableTopOverlay, {
shouldBeRendered: function() {
return this.wot.getSetting('fixedRowsTop') || this.wot.getSetting('columnHeaders').length ? true : false;
},
resetFixedPosition: function() {
if (!this.needFullRender || !this.wot.wtTable.holder.parentNode) {
return;
}
var overlayRoot = this.clone.wtTable.holder.parentNode;
var headerPosition = 0;
if (this.wot.wtOverlays.leftOverlay.trimmingContainer === window) {
var box = this.wot.wtTable.hider.getBoundingClientRect();
var top = Math.ceil(box.top);
var bottom = Math.ceil(box.bottom);
var finalLeft;
var finalTop;
finalLeft = this.wot.wtTable.hider.style.left;
finalLeft = finalLeft === '' ? 0 : finalLeft;
if (top < 0 && (bottom - overlayRoot.offsetHeight) > 0) {
finalTop = -top;
} else {
finalTop = 0;
}
headerPosition = finalTop;
finalTop = finalTop + 'px';
dom.setOverlayPosition(overlayRoot, finalLeft, finalTop);
} else {
headerPosition = this.getScrollPosition();
}
this.adjustHeaderBordersPosition(headerPosition);
},
setScrollPosition: function(pos) {
if (this.mainTableScrollableElement === window) {
window.scrollTo(dom.getWindowScrollLeft(), pos);
} else {
this.mainTableScrollableElement.scrollTop = pos;
}
},
onScroll: function() {
this.wot.getSetting('onScrollVertically');
},
sumCellSizes: function(from, to) {
var sum = 0;
var defaultRowHeight = this.wot.wtSettings.settings.defaultRowHeight;
while (from < to) {
sum += this.wot.wtTable.getRowHeight(from) || defaultRowHeight;
from++;
}
return sum;
},
adjustElementsSize: function() {
var force = arguments[0] !== (void 0) ? arguments[0] : false;
if (this.needFullRender || force) {
this.adjustRootElementSize();
this.adjustRootChildsSize();
if (!force) {
this.isElementSizesAdjusted = true;
}
}
},
adjustRootElementSize: function() {
var masterHolder = this.wot.wtTable.holder;
var scrollbarWidth = masterHolder.clientWidth !== masterHolder.offsetWidth ? dom.getScrollbarWidth() : 0;
var overlayRoot = this.clone.wtTable.holder.parentNode;
var overlayRootStyle = overlayRoot.style;
var tableHeight;
if (this.trimmingContainer !== window) {
overlayRootStyle.width = this.wot.wtViewport.getWorkspaceWidth() - scrollbarWidth + 'px';
}
this.clone.wtTable.holder.style.width = overlayRootStyle.width;
tableHeight = dom.outerHeight(this.clone.wtTable.TABLE);
overlayRootStyle.height = (tableHeight === 0 ? tableHeight : tableHeight + 4) + 'px';
},
adjustRootChildsSize: function() {
var scrollbarWidth = dom.getScrollbarWidth();
this.clone.wtTable.hider.style.width = this.hider.style.width;
this.clone.wtTable.holder.style.width = this.clone.wtTable.holder.parentNode.style.width;
if (scrollbarWidth === 0) {
scrollbarWidth = 30;
}
this.clone.wtTable.holder.style.height = parseInt(this.clone.wtTable.holder.parentNode.style.height, 10) + scrollbarWidth + 'px';
},
applyToDOM: function() {
var total = this.wot.getSetting('totalRows');
if (!this.isElementSizesAdjusted) {
this.adjustElementsSize();
}
if (typeof this.wot.wtViewport.rowsRenderCalculator.startPosition === 'number') {
this.spreader.style.top = this.wot.wtViewport.rowsRenderCalculator.startPosition + 'px';
} else if (total === 0) {
this.spreader.style.top = '0';
} else {
throw new Error("Incorrect value of the rowsRenderCalculator");
}
this.spreader.style.bottom = '';
if (this.needFullRender) {
this.syncOverlayOffset();
}
},
syncOverlayOffset: function() {
if (typeof this.wot.wtViewport.columnsRenderCalculator.startPosition === 'number') {
this.clone.wtTable.spreader.style.left = this.wot.wtViewport.columnsRenderCalculator.startPosition + 'px';
} else {
this.clone.wtTable.spreader.style.left = '';
}
},
scrollTo: function(sourceRow, bottomEdge) {
var newY = this.getTableParentOffset();
var sourceInstance = this.wot.cloneSource ? this.wot.cloneSource : this.wot;
var mainHolder = sourceInstance.wtTable.holder;
var scrollbarCompensation = 0;
if (bottomEdge && mainHolder.offsetHeight !== mainHolder.clientHeight) {
scrollbarCompensation = dom.getScrollbarWidth();
}
if (bottomEdge) {
newY += this.sumCellSizes(0, sourceRow + 1);
newY -= this.wot.wtViewport.getViewportHeight();
newY += 1;
} else {
newY += this.sumCellSizes(this.wot.getSetting('fixedRowsTop'), sourceRow);
}
newY += scrollbarCompensation;
this.setScrollPosition(newY);
},
getTableParentOffset: function() {
if (this.mainTableScrollableElement === window) {
return this.wot.wtTable.holderOffset.top;
} else {
return 0;
}
},
getScrollPosition: function() {
return dom.getScrollTop(this.mainTableScrollableElement);
},
adjustHeaderBordersPosition: function(position) {
if (this.wot.getSetting('fixedRowsTop') === 0 && this.wot.getSetting('columnHeaders').length > 0) {
var masterParent = this.wot.wtTable.holder.parentNode;
var previousState = dom.hasClass(masterParent, 'innerBorderTop');
if (position) {
dom.addClass(masterParent, 'innerBorderTop');
} else {
dom.removeClass(masterParent, 'innerBorderTop');
}
if (!previousState && position || previousState && !position) {
this.wot.wtOverlays.adjustElementsSize();
}
}
if (this.wot.getSetting('rowHeaders').length === 0) {
var secondHeaderCell = this.clone.wtTable.THEAD.querySelector('th:nth-of-type(2)');
if (secondHeaderCell) {
secondHeaderCell.style['border-left-width'] = 0;
}
}
}
}, {}, WalkontableOverlay);
;
window.WalkontableTopOverlay = WalkontableTopOverlay;
//#
},{"./../../../../dom.js":27,"./_base.js":11}],16:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableOverlays: {get: function() {
return WalkontableOverlays;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47__46__46__47_eventManager_46_js__,
$__overlay_47_corner_46_js__,
$__overlay_47_debug_46_js__,
$__overlay_47_left_46_js__,
$__overlay_47_top_46_js__;
var dom = ($___46__46__47__46__46__47__46__46__47_dom_46_js__ = require("./../../../dom.js"), $___46__46__47__46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47__46__46__47_dom_46_js__});
var EventManager = ($___46__46__47__46__46__47__46__46__47_eventManager_46_js__ = require("./../../../eventManager.js"), $___46__46__47__46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47__46__46__47_eventManager_46_js__}).EventManager;
var WalkontableCornerOverlay = ($__overlay_47_corner_46_js__ = require("./overlay/corner.js"), $__overlay_47_corner_46_js__ && $__overlay_47_corner_46_js__.__esModule && $__overlay_47_corner_46_js__ || {default: $__overlay_47_corner_46_js__}).WalkontableCornerOverlay;
var WalkontableDebugOverlay = ($__overlay_47_debug_46_js__ = require("./overlay/debug.js"), $__overlay_47_debug_46_js__ && $__overlay_47_debug_46_js__.__esModule && $__overlay_47_debug_46_js__ || {default: $__overlay_47_debug_46_js__}).WalkontableDebugOverlay;
var WalkontableLeftOverlay = ($__overlay_47_left_46_js__ = require("./overlay/left.js"), $__overlay_47_left_46_js__ && $__overlay_47_left_46_js__.__esModule && $__overlay_47_left_46_js__ || {default: $__overlay_47_left_46_js__}).WalkontableLeftOverlay;
var WalkontableTopOverlay = ($__overlay_47_top_46_js__ = require("./overlay/top.js"), $__overlay_47_top_46_js__ && $__overlay_47_top_46_js__.__esModule && $__overlay_47_top_46_js__ || {default: $__overlay_47_top_46_js__}).WalkontableTopOverlay;
var WalkontableOverlays = function WalkontableOverlays(wotInstance) {
this.wot = wotInstance;
this.instance = this.wot;
this.eventManager = new EventManager(this.wot);
this.wot.update('scrollbarWidth', dom.getScrollbarWidth());
this.wot.update('scrollbarHeight', dom.getScrollbarWidth());
this.mainTableScrollableElement = dom.getScrollableElement(this.wot.wtTable.TABLE);
this.topOverlay = new WalkontableTopOverlay(this.wot);
this.leftOverlay = new WalkontableLeftOverlay(this.wot);
if (this.topOverlay.needFullRender && this.leftOverlay.needFullRender) {
this.topLeftCornerOverlay = new WalkontableCornerOverlay(this.wot);
}
if (this.wot.getSetting('debug')) {
this.debug = new WalkontableDebugOverlay(this.wot);
}
this.destroyed = false;
this.keyPressed = false;
this.spreaderLastSize = {
width: null,
height: null
};
this.overlayScrollPositions = {
'master': {
top: 0,
left: 0
},
'top': {
top: null,
left: 0
},
'left': {
top: 0,
left: null
}
};
this.registerListeners();
};
($traceurRuntime.createClass)(WalkontableOverlays, {
refreshAll: function() {
if (!this.wot.drawn) {
return;
}
if (!this.wot.wtTable.holder.parentNode) {
this.destroy();
return;
}
this.wot.draw(true);
this.topOverlay.onScroll();
this.leftOverlay.onScroll();
},
registerListeners: function() {
var $__5 = this;
this.eventManager.addEventListener(document.documentElement, 'keydown', (function() {
return $__5.onKeyDown();
}));
this.eventManager.addEventListener(document.documentElement, 'keyup', (function() {
return $__5.onKeyUp();
}));
this.eventManager.addEventListener(this.mainTableScrollableElement, 'scroll', (function(event) {
return $__5.onTableScroll(event);
}));
if (this.topOverlay.needFullRender) {
this.eventManager.addEventListener(this.topOverlay.clone.wtTable.holder, 'scroll', (function(event) {
return $__5.onTableScroll(event);
}));
this.eventManager.addEventListener(this.topOverlay.clone.wtTable.holder, 'wheel', (function(event) {
return $__5.onTableScroll(event);
}));
}
if (this.leftOverlay.needFullRender) {
this.eventManager.addEventListener(this.leftOverlay.clone.wtTable.holder, 'scroll', (function(event) {
return $__5.onTableScroll(event);
}));
this.eventManager.addEventListener(this.leftOverlay.clone.wtTable.holder, 'wheel', (function(event) {
return $__5.onTableScroll(event);
}));
}
if (this.topOverlay.trimmingContainer !== window && this.leftOverlay.trimmingContainer !== window) {
this.eventManager.addEventListener(window, 'wheel', (function(event) {
var overlay;
var deltaY = event.wheelDeltaY || event.deltaY;
var deltaX = event.wheelDeltaX || event.deltaX;
if ($__5.topOverlay.clone.wtTable.holder.contains(event.target)) {
overlay = 'top';
} else if ($__5.leftOverlay.clone.wtTable.holder.contains(event.target)) {
overlay = 'left';
}
if (overlay == 'top' && deltaY !== 0) {
event.preventDefault();
} else if (overlay == 'left' && deltaX !== 0) {
event.preventDefault();
}
}));
}
},
onTableScroll: function(event) {
if (Handsontable.mobileBrowser) {
return;
}
if (this.keyPressed && this.mainTableScrollableElement !== window && !event.target.contains(this.mainTableScrollableElement)) {
return;
}
if (event.type === 'scroll') {
this.syncScrollPositions(event);
} else {
this.translateMouseWheelToScroll(event);
}
},
onKeyDown: function() {
this.keyPressed = true;
},
onKeyUp: function() {
this.keyPressed = false;
},
translateMouseWheelToScroll: function(event) {
var topOverlay = this.topOverlay.clone.wtTable.holder;
var leftOverlay = this.leftOverlay.clone.wtTable.holder;
var eventMockup = {type: 'wheel'};
var tempElem = event.target;
var deltaY = event.wheelDeltaY || (-1) * event.deltaY;
var deltaX = event.wheelDeltaX || (-1) * event.deltaX;
var parentHolder;
while (tempElem != document && tempElem != null) {
if (tempElem.className.indexOf('wtHolder') > -1) {
parentHolder = tempElem;
break;
}
tempElem = tempElem.parentNode;
}
eventMockup.target = parentHolder;
if (parentHolder == topOverlay) {
this.syncScrollPositions(eventMockup, (-0.2) * deltaY);
} else if (parentHolder == leftOverlay) {
this.syncScrollPositions(eventMockup, (-0.2) * deltaX);
}
return false;
},
syncScrollPositions: function(event) {
var fakeScrollValue = arguments[1] !== (void 0) ? arguments[1] : null;
if (this.destroyed) {
return;
}
if (arguments.length === 0) {
this.syncScrollWithMaster();
return;
}
var master = this.mainTableScrollableElement;
var target = event.target;
var tempScrollValue = 0;
var scrollValueChanged = false;
var topOverlay;
var leftOverlay;
if (this.topOverlay.needFullRender) {
topOverlay = this.topOverlay.clone.wtTable.holder;
}
if (this.leftOverlay.needFullRender) {
leftOverlay = this.leftOverlay.clone.wtTable.holder;
}
if (target === document) {
target = window;
}
if (target === master) {
tempScrollValue = dom.getScrollLeft(target);
if (this.overlayScrollPositions.master.left !== tempScrollValue) {
this.overlayScrollPositions.master.left = tempScrollValue;
scrollValueChanged = true;
if (topOverlay) {
topOverlay.scrollLeft = tempScrollValue;
}
}
tempScrollValue = dom.getScrollTop(target);
if (this.overlayScrollPositions.master.top !== tempScrollValue) {
this.overlayScrollPositions.master.top = tempScrollValue;
scrollValueChanged = true;
if (leftOverlay) {
leftOverlay.scrollTop = tempScrollValue;
}
}
} else if (target === topOverlay) {
tempScrollValue = dom.getScrollLeft(target);
if (this.overlayScrollPositions.top.left !== tempScrollValue) {
this.overlayScrollPositions.top.left = tempScrollValue;
scrollValueChanged = true;
master.scrollLeft = tempScrollValue;
}
if (fakeScrollValue !== null) {
scrollValueChanged = true;
master.scrollTop += fakeScrollValue;
}
} else if (target === leftOverlay) {
tempScrollValue = dom.getScrollTop(target);
if (this.overlayScrollPositions.left.top !== tempScrollValue) {
this.overlayScrollPositions.left.top = tempScrollValue;
scrollValueChanged = true;
master.scrollTop = tempScrollValue;
}
if (fakeScrollValue !== null) {
scrollValueChanged = true;
master.scrollLeft += fakeScrollValue;
}
}
if (!this.keyPressed && scrollValueChanged && event.type === 'scroll') {
this.refreshAll();
}
},
syncScrollWithMaster: function() {
var master = this.topOverlay.mainTableScrollableElement;
if (this.topOverlay.needFullRender) {
this.topOverlay.clone.wtTable.holder.scrollLeft = master.scrollLeft;
}
if (this.leftOverlay.needFullRender) {
this.leftOverlay.clone.wtTable.holder.scrollTop = master.scrollTop;
}
},
destroy: function() {
this.eventManager.clear();
this.topOverlay.destroy();
this.leftOverlay.destroy();
if (this.topLeftCornerOverlay) {
this.topLeftCornerOverlay.destroy();
}
if (this.debug) {
this.debug.destroy();
}
this.destroyed = true;
},
refresh: function() {
var fastDraw = arguments[0] !== (void 0) ? arguments[0] : false;
if (this.topOverlay.isElementSizesAdjusted && this.leftOverlay.isElementSizesAdjusted) {
var container = this.wot.wtTable.wtRootElement.parentNode || this.wot.wtTable.wtRootElement;
var width = container.clientWidth;
var height = container.clientHeight;
if (width !== this.spreaderLastSize.width || height !== this.spreaderLastSize.height) {
this.spreaderLastSize.width = width;
this.spreaderLastSize.height = height;
this.adjustElementsSize();
}
}
this.leftOverlay.refresh(fastDraw);
this.topOverlay.refresh(fastDraw);
if (this.topLeftCornerOverlay) {
this.topLeftCornerOverlay.refresh(fastDraw);
}
if (this.debug) {
this.debug.refresh(fastDraw);
}
},
adjustElementsSize: function() {
var force = arguments[0] !== (void 0) ? arguments[0] : false;
var totalColumns = this.wot.getSetting('totalColumns');
var totalRows = this.wot.getSetting('totalRows');
var headerRowSize = this.wot.wtViewport.getRowHeaderWidth();
var headerColumnSize = this.wot.wtViewport.getColumnHeaderHeight();
var hiderStyle = this.wot.wtTable.hider.style;
hiderStyle.width = (headerRowSize + this.leftOverlay.sumCellSizes(0, totalColumns)) + 'px';
hiderStyle.height = (headerColumnSize + this.topOverlay.sumCellSizes(0, totalRows) + 1) + 'px';
this.topOverlay.adjustElementsSize(force);
this.leftOverlay.adjustElementsSize(force);
},
applyToDOM: function() {
if (!this.topOverlay.isElementSizesAdjusted || !this.leftOverlay.isElementSizesAdjusted) {
this.adjustElementsSize();
}
this.topOverlay.applyToDOM();
this.leftOverlay.applyToDOM();
}
}, {});
;
window.WalkontableOverlays = WalkontableOverlays;
//#
},{"./../../../dom.js":27,"./../../../eventManager.js":41,"./overlay/corner.js":12,"./overlay/debug.js":13,"./overlay/left.js":14,"./overlay/top.js":15}],17:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableScroll: {get: function() {
return WalkontableScroll;
}},
__esModule: {value: true}
});
var WalkontableScroll = function WalkontableScroll(wotInstance) {
this.wot = wotInstance;
this.instance = wotInstance;
};
($traceurRuntime.createClass)(WalkontableScroll, {scrollViewport: function(coords) {
if (!this.wot.drawn) {
return;
}
var totalRows = this.wot.getSetting('totalRows');
var totalColumns = this.wot.getSetting('totalColumns');
if (coords.row < 0 || coords.row > totalRows - 1) {
throw new Error('row ' + coords.row + ' does not exist');
}
if (coords.col < 0 || coords.col > totalColumns - 1) {
throw new Error('column ' + coords.col + ' does not exist');
}
if (coords.row > this.instance.wtTable.getLastVisibleRow()) {
this.wot.wtOverlays.topOverlay.scrollTo(coords.row, true);
} else if (coords.row >= this.instance.getSetting('fixedRowsTop') && coords.row < this.instance.wtTable.getFirstVisibleRow()) {
this.wot.wtOverlays.topOverlay.scrollTo(coords.row);
}
if (coords.col > this.instance.wtTable.getLastVisibleColumn()) {
this.wot.wtOverlays.leftOverlay.scrollTo(coords.col, true);
} else if (coords.col >= this.instance.getSetting('fixedColumnsLeft') && coords.col < this.instance.wtTable.getFirstVisibleColumn()) {
this.wot.wtOverlays.leftOverlay.scrollTo(coords.col);
}
}}, {});
;
window.WalkontableScroll = WalkontableScroll;
//#
},{}],18:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableSelection: {get: function() {
return WalkontableSelection;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47__46__46__47_dom_46_js__,
$__border_46_js__,
$__cell_47_coords_46_js__,
$__cell_47_range_46_js__;
var dom = ($___46__46__47__46__46__47__46__46__47_dom_46_js__ = require("./../../../dom.js"), $___46__46__47__46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47__46__46__47_dom_46_js__});
var WalkontableBorder = ($__border_46_js__ = require("./border.js"), $__border_46_js__ && $__border_46_js__.__esModule && $__border_46_js__ || {default: $__border_46_js__}).WalkontableBorder;
var WalkontableCellCoords = ($__cell_47_coords_46_js__ = require("./cell/coords.js"), $__cell_47_coords_46_js__ && $__cell_47_coords_46_js__.__esModule && $__cell_47_coords_46_js__ || {default: $__cell_47_coords_46_js__}).WalkontableCellCoords;
var WalkontableCellRange = ($__cell_47_range_46_js__ = require("./cell/range.js"), $__cell_47_range_46_js__ && $__cell_47_range_46_js__.__esModule && $__cell_47_range_46_js__ || {default: $__cell_47_range_46_js__}).WalkontableCellRange;
var WalkontableSelection = function WalkontableSelection(settings, cellRange) {
this.settings = settings;
this.cellRange = cellRange || null;
this.instanceBorders = {};
};
($traceurRuntime.createClass)(WalkontableSelection, {
getBorder: function(wotInstance) {
if (this.instanceBorders[wotInstance.guid]) {
return this.instanceBorders[wotInstance.guid];
}
this.instanceBorders[wotInstance.guid] = new WalkontableBorder(wotInstance, this.settings);
},
isEmpty: function() {
return this.cellRange === null;
},
add: function(coords) {
if (this.isEmpty()) {
this.cellRange = new WalkontableCellRange(coords, coords, coords);
} else {
this.cellRange.expand(coords);
}
},
replace: function(oldCoords, newCoords) {
if (!this.isEmpty()) {
if (this.cellRange.from.isEqual(oldCoords)) {
this.cellRange.from = newCoords;
return true;
}
if (this.cellRange.to.isEqual(oldCoords)) {
this.cellRange.to = newCoords;
return true;
}
}
return false;
},
clear: function() {
this.cellRange = null;
},
getCorners: function() {
var topLeft = this.cellRange.getTopLeftCorner();
var bottomRight = this.cellRange.getBottomRightCorner();
return [topLeft.row, topLeft.col, bottomRight.row, bottomRight.col];
},
addClassAtCoords: function(wotInstance, sourceRow, sourceColumn, className) {
var TD = wotInstance.wtTable.getCell(new WalkontableCellCoords(sourceRow, sourceColumn));
if (typeof TD === 'object') {
dom.addClass(TD, className);
}
},
draw: function(wotInstance) {
if (this.isEmpty()) {
if (this.settings.border) {
var border = this.getBorder(wotInstance);
if (border) {
border.disappear();
}
}
return;
}
var renderedRows = wotInstance.wtTable.getRenderedRowsCount();
var renderedColumns = wotInstance.wtTable.getRenderedColumnsCount();
var corners = this.getCorners();
var sourceRow,
sourceCol,
TH;
for (var column = 0; column < renderedColumns; column++) {
sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(column);
if (sourceCol >= corners[1] && sourceCol <= corners[3]) {
TH = wotInstance.wtTable.getColumnHeader(sourceCol);
if (TH && this.settings.highlightColumnClassName) {
dom.addClass(TH, this.settings.highlightColumnClassName);
}
}
}
for (var row = 0; row < renderedRows; row++) {
sourceRow = wotInstance.wtTable.rowFilter.renderedToSource(row);
if (sourceRow >= corners[0] && sourceRow <= corners[2]) {
TH = wotInstance.wtTable.getRowHeader(sourceRow);
if (TH && this.settings.highlightRowClassName) {
dom.addClass(TH, this.settings.highlightRowClassName);
}
}
for (var column$__4 = 0; column$__4 < renderedColumns; column$__4++) {
sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(column$__4);
if (sourceRow >= corners[0] && sourceRow <= corners[2] && sourceCol >= corners[1] && sourceCol <= corners[3]) {
if (this.settings.className) {
this.addClassAtCoords(wotInstance, sourceRow, sourceCol, this.settings.className);
}
} else if (sourceRow >= corners[0] && sourceRow <= corners[2]) {
if (this.settings.highlightRowClassName) {
this.addClassAtCoords(wotInstance, sourceRow, sourceCol, this.settings.highlightRowClassName);
}
} else if (sourceCol >= corners[1] && sourceCol <= corners[3]) {
if (this.settings.highlightColumnClassName) {
this.addClassAtCoords(wotInstance, sourceRow, sourceCol, this.settings.highlightColumnClassName);
}
}
}
}
wotInstance.getSetting('onBeforeDrawBorders', corners, this.settings.className);
if (this.settings.border) {
var border$__5 = this.getBorder(wotInstance);
if (border$__5) {
border$__5.appear(corners);
}
}
}
}, {});
;
window.WalkontableSelection = WalkontableSelection;
//#
},{"./../../../dom.js":27,"./border.js":2,"./cell/coords.js":5,"./cell/range.js":6}],19:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableSettings: {get: function() {
return WalkontableSettings;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47__46__46__47_dom_46_js__;
var dom = ($___46__46__47__46__46__47__46__46__47_dom_46_js__ = require("./../../../dom.js"), $___46__46__47__46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47__46__46__47_dom_46_js__});
var WalkontableSettings = function WalkontableSettings(wotInstance, settings) {
var $__0 = this;
this.wot = wotInstance;
this.instance = wotInstance;
this.defaults = {
table: void 0,
debug: false,
stretchH: 'none',
currentRowClassName: null,
currentColumnClassName: null,
data: void 0,
fixedColumnsLeft: 0,
fixedRowsTop: 0,
rowHeaders: function() {
return [];
},
columnHeaders: function() {
return [];
},
totalRows: void 0,
totalColumns: void 0,
cellRenderer: (function(row, column, TD) {
var cellData = $__0.getSetting('data', row, column);
dom.fastInnerText(TD, cellData === void 0 || cellData === null ? '' : cellData);
}),
columnWidth: function(col) {
return;
},
rowHeight: function(row) {
return;
},
defaultRowHeight: 23,
defaultColumnWidth: 50,
selections: null,
hideBorderOnMouseDownOver: false,
viewportRowCalculatorOverride: null,
viewportColumnCalculatorOverride: null,
onCellMouseDown: null,
onCellMouseOver: null,
onCellDblClick: null,
onCellCornerMouseDown: null,
onCellCornerDblClick: null,
beforeDraw: null,
onDraw: null,
onBeforeDrawBorders: null,
onScrollVertically: null,
onScrollHorizontally: null,
onBeforeTouchScroll: null,
onAfterMomentumScroll: null,
scrollbarWidth: 10,
scrollbarHeight: 10,
renderAllRows: false,
groups: false
};
this.settings = {};
for (var i in this.defaults) {
if (this.defaults.hasOwnProperty(i)) {
if (settings[i] !== void 0) {
this.settings[i] = settings[i];
} else if (this.defaults[i] === void 0) {
throw new Error('A required setting "' + i + '" was not provided');
} else {
this.settings[i] = this.defaults[i];
}
}
}
};
($traceurRuntime.createClass)(WalkontableSettings, {
update: function(settings, value) {
if (value === void 0) {
for (var i in settings) {
if (settings.hasOwnProperty(i)) {
this.settings[i] = settings[i];
}
}
} else {
this.settings[settings] = value;
}
return this.wot;
},
getSetting: function(key, param1, param2, param3, param4) {
if (typeof this.settings[key] === 'function') {
return this.settings[key](param1, param2, param3, param4);
} else if (param1 !== void 0 && Array.isArray(this.settings[key])) {
return this.settings[key][param1];
} else {
return this.settings[key];
}
},
has: function(key) {
return !!this.settings[key];
}
}, {});
;
window.WalkontableSettings = WalkontableSettings;
//#
},{"./../../../dom.js":27}],20:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableTable: {get: function() {
return WalkontableTable;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47__46__46__47_dom_46_js__,
$__cell_47_coords_46_js__,
$__cell_47_range_46_js__,
$__filter_47_column_46_js__,
$__overlay_47_corner_46_js__,
$__overlay_47_debug_46_js__,
$__overlay_47_left_46_js__,
$__filter_47_row_46_js__,
$__tableRenderer_46_js__,
$__overlay_47_top_46_js__;
var dom = ($___46__46__47__46__46__47__46__46__47_dom_46_js__ = require("./../../../dom.js"), $___46__46__47__46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47__46__46__47_dom_46_js__});
var WalkontableCellCoords = ($__cell_47_coords_46_js__ = require("./cell/coords.js"), $__cell_47_coords_46_js__ && $__cell_47_coords_46_js__.__esModule && $__cell_47_coords_46_js__ || {default: $__cell_47_coords_46_js__}).WalkontableCellCoords;
var WalkontableCellRange = ($__cell_47_range_46_js__ = require("./cell/range.js"), $__cell_47_range_46_js__ && $__cell_47_range_46_js__.__esModule && $__cell_47_range_46_js__ || {default: $__cell_47_range_46_js__}).WalkontableCellRange;
var WalkontableColumnFilter = ($__filter_47_column_46_js__ = require("./filter/column.js"), $__filter_47_column_46_js__ && $__filter_47_column_46_js__.__esModule && $__filter_47_column_46_js__ || {default: $__filter_47_column_46_js__}).WalkontableColumnFilter;
var WalkontableCornerOverlay = ($__overlay_47_corner_46_js__ = require("./overlay/corner.js"), $__overlay_47_corner_46_js__ && $__overlay_47_corner_46_js__.__esModule && $__overlay_47_corner_46_js__ || {default: $__overlay_47_corner_46_js__}).WalkontableCornerOverlay;
var WalkontableDebugOverlay = ($__overlay_47_debug_46_js__ = require("./overlay/debug.js"), $__overlay_47_debug_46_js__ && $__overlay_47_debug_46_js__.__esModule && $__overlay_47_debug_46_js__ || {default: $__overlay_47_debug_46_js__}).WalkontableDebugOverlay;
var WalkontableLeftOverlay = ($__overlay_47_left_46_js__ = require("./overlay/left.js"), $__overlay_47_left_46_js__ && $__overlay_47_left_46_js__.__esModule && $__overlay_47_left_46_js__ || {default: $__overlay_47_left_46_js__}).WalkontableLeftOverlay;
var WalkontableRowFilter = ($__filter_47_row_46_js__ = require("./filter/row.js"), $__filter_47_row_46_js__ && $__filter_47_row_46_js__.__esModule && $__filter_47_row_46_js__ || {default: $__filter_47_row_46_js__}).WalkontableRowFilter;
var WalkontableTableRenderer = ($__tableRenderer_46_js__ = require("./tableRenderer.js"), $__tableRenderer_46_js__ && $__tableRenderer_46_js__.__esModule && $__tableRenderer_46_js__ || {default: $__tableRenderer_46_js__}).WalkontableTableRenderer;
var WalkontableTopOverlay = ($__overlay_47_top_46_js__ = require("./overlay/top.js"), $__overlay_47_top_46_js__ && $__overlay_47_top_46_js__.__esModule && $__overlay_47_top_46_js__ || {default: $__overlay_47_top_46_js__}).WalkontableTopOverlay;
function WalkontableTable(instance, table) {
this.instance = instance;
this.TABLE = table;
dom.removeTextNodes(this.TABLE);
var parent = this.TABLE.parentNode;
if (!parent || parent.nodeType !== 1 || !dom.hasClass(parent, 'wtHolder')) {
var spreader = document.createElement('DIV');
spreader.className = 'wtSpreader';
if (parent) {
parent.insertBefore(spreader, this.TABLE);
}
spreader.appendChild(this.TABLE);
}
this.spreader = this.TABLE.parentNode;
this.spreader.style.position = 'relative';
parent = this.spreader.parentNode;
if (!parent || parent.nodeType !== 1 || !dom.hasClass(parent, 'wtHolder')) {
var hider = document.createElement('DIV');
hider.className = 'wtHider';
if (parent) {
parent.insertBefore(hider, this.spreader);
}
hider.appendChild(this.spreader);
}
this.hider = this.spreader.parentNode;
parent = this.hider.parentNode;
if (!parent || parent.nodeType !== 1 || !dom.hasClass(parent, 'wtHolder')) {
var holder = document.createElement('DIV');
holder.style.position = 'relative';
holder.className = 'wtHolder';
if (parent) {
parent.insertBefore(holder, this.hider);
}
if (!instance.cloneSource) {
holder.parentNode.className += 'ht_master handsontable';
}
holder.appendChild(this.hider);
}
this.holder = this.hider.parentNode;
this.wtRootElement = this.holder.parentNode;
this.alignOverlaysWithTrimmingContainer();
this.TBODY = this.TABLE.getElementsByTagName('TBODY')[0];
if (!this.TBODY) {
this.TBODY = document.createElement('TBODY');
this.TABLE.appendChild(this.TBODY);
}
this.THEAD = this.TABLE.getElementsByTagName('THEAD')[0];
if (!this.THEAD) {
this.THEAD = document.createElement('THEAD');
this.TABLE.insertBefore(this.THEAD, this.TBODY);
}
this.COLGROUP = this.TABLE.getElementsByTagName('COLGROUP')[0];
if (!this.COLGROUP) {
this.COLGROUP = document.createElement('COLGROUP');
this.TABLE.insertBefore(this.COLGROUP, this.THEAD);
}
if (this.instance.getSetting('columnHeaders').length) {
if (!this.THEAD.childNodes.length) {
var TR = document.createElement('TR');
this.THEAD.appendChild(TR);
}
}
this.colgroupChildrenLength = this.COLGROUP.childNodes.length;
this.theadChildrenLength = this.THEAD.firstChild ? this.THEAD.firstChild.childNodes.length : 0;
this.tbodyChildrenLength = this.TBODY.childNodes.length;
this.rowFilter = null;
this.columnFilter = null;
}
WalkontableTable.prototype.alignOverlaysWithTrimmingContainer = function() {
var trimmingElement = dom.getTrimmingContainer(this.wtRootElement);
if (!this.isWorkingOnClone()) {
this.holder.parentNode.style.position = 'relative';
if (trimmingElement !== window) {
this.holder.style.width = dom.getStyle(trimmingElement, 'width');
this.holder.style.height = dom.getStyle(trimmingElement, 'height');
this.holder.style.overflow = '';
} else {
this.holder.style.overflow = 'visible';
this.wtRootElement.style.overflow = 'visible';
}
}
};
WalkontableTable.prototype.isWorkingOnClone = function() {
return !!this.instance.cloneSource;
};
WalkontableTable.prototype.draw = function(fastDraw) {
if (!this.isWorkingOnClone()) {
this.holderOffset = dom.offset(this.holder);
fastDraw = this.instance.wtViewport.createRenderCalculators(fastDraw);
}
if (!fastDraw) {
if (this.isWorkingOnClone()) {
this.tableOffset = this.instance.cloneSource.wtTable.tableOffset;
} else {
this.tableOffset = dom.offset(this.TABLE);
}
var startRow;
if (this.instance.cloneOverlay instanceof WalkontableDebugOverlay || this.instance.cloneOverlay instanceof WalkontableTopOverlay || this.instance.cloneOverlay instanceof WalkontableCornerOverlay) {
startRow = 0;
} else {
startRow = this.instance.wtViewport.rowsRenderCalculator.startRow;
}
var startColumn;
if (this.instance.cloneOverlay instanceof WalkontableDebugOverlay || this.instance.cloneOverlay instanceof WalkontableLeftOverlay || this.instance.cloneOverlay instanceof WalkontableCornerOverlay) {
startColumn = 0;
} else {
startColumn = this.instance.wtViewport.columnsRenderCalculator.startColumn;
}
this.rowFilter = new WalkontableRowFilter(startRow, this.instance.getSetting('totalRows'), this.instance.getSetting('columnHeaders').length);
this.columnFilter = new WalkontableColumnFilter(startColumn, this.instance.getSetting('totalColumns'), this.instance.getSetting('rowHeaders').length);
this._doDraw();
this.alignOverlaysWithTrimmingContainer();
} else {
if (!this.isWorkingOnClone()) {
this.instance.wtViewport.createVisibleCalculators();
}
if (this.instance.wtOverlays) {
this.instance.wtOverlays.refresh(true);
}
}
this.refreshSelections(fastDraw);
if (!this.isWorkingOnClone()) {
this.instance.wtOverlays.topOverlay.resetFixedPosition();
this.instance.wtOverlays.leftOverlay.resetFixedPosition();
if (this.instance.wtOverlays.topLeftCornerOverlay) {
this.instance.wtOverlays.topLeftCornerOverlay.resetFixedPosition();
}
}
this.instance.drawn = true;
return this;
};
WalkontableTable.prototype._doDraw = function() {
var wtRenderer = new WalkontableTableRenderer(this);
wtRenderer.render();
};
WalkontableTable.prototype.removeClassFromCells = function(className) {
var nodes = this.TABLE.querySelectorAll('.' + className);
for (var i = 0,
ilen = nodes.length; i < ilen; i++) {
dom.removeClass(nodes[i], className);
}
};
WalkontableTable.prototype.refreshSelections = function(fastDraw) {
var i,
len;
if (!this.instance.selections) {
return;
}
len = this.instance.selections.length;
if (fastDraw) {
for (i = 0; i < len; i++) {
if (this.instance.selections[i].settings.className) {
this.removeClassFromCells(this.instance.selections[i].settings.className);
}
if (this.instance.selections[i].settings.highlightRowClassName) {
this.removeClassFromCells(this.instance.selections[i].settings.highlightRowClassName);
}
if (this.instance.selections[i].settings.highlightColumnClassName) {
this.removeClassFromCells(this.instance.selections[i].settings.highlightColumnClassName);
}
}
}
for (i = 0; i < len; i++) {
this.instance.selections[i].draw(this.instance, fastDraw);
}
};
WalkontableTable.prototype.getCell = function(coords) {
if (this.isRowBeforeRenderedRows(coords.row)) {
return -1;
} else if (this.isRowAfterRenderedRows(coords.row)) {
return -2;
}
var TR = this.TBODY.childNodes[this.rowFilter.sourceToRendered(coords.row)];
if (TR) {
return TR.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(coords.col)];
}
};
WalkontableTable.prototype.getColumnHeader = function(col, level) {
if (!level) {
level = 0;
}
var TR = this.THEAD.childNodes[level];
if (TR) {
return TR.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(col)];
}
};
WalkontableTable.prototype.getRowHeader = function(row) {
if (this.columnFilter.sourceColumnToVisibleRowHeadedColumn(0) === 0) {
return null;
}
var TR = this.TBODY.childNodes[this.rowFilter.sourceToRendered(row)];
if (TR) {
return TR.childNodes[0];
}
};
WalkontableTable.prototype.getCoords = function(TD) {
var TR = TD.parentNode;
var row = dom.index(TR);
if (TR.parentNode === this.THEAD) {
row = this.rowFilter.visibleColHeadedRowToSourceRow(row);
} else {
row = this.rowFilter.renderedToSource(row);
}
return new WalkontableCellCoords(row, this.columnFilter.visibleRowHeadedColumnToSourceColumn(TD.cellIndex));
};
WalkontableTable.prototype.getTrForRow = function(row) {
return this.TBODY.childNodes[this.rowFilter.sourceToRendered(row)];
};
WalkontableTable.prototype.getFirstRenderedRow = function() {
return this.instance.wtViewport.rowsRenderCalculator.startRow;
};
WalkontableTable.prototype.getFirstVisibleRow = function() {
return this.instance.wtViewport.rowsVisibleCalculator.startRow;
};
WalkontableTable.prototype.getFirstRenderedColumn = function() {
return this.instance.wtViewport.columnsRenderCalculator.startColumn;
};
WalkontableTable.prototype.getFirstVisibleColumn = function() {
return this.instance.wtViewport.columnsVisibleCalculator.startColumn;
};
WalkontableTable.prototype.getLastRenderedRow = function() {
return this.instance.wtViewport.rowsRenderCalculator.endRow;
};
WalkontableTable.prototype.getLastVisibleRow = function() {
return this.instance.wtViewport.rowsVisibleCalculator.endRow;
};
WalkontableTable.prototype.getLastRenderedColumn = function() {
return this.instance.wtViewport.columnsRenderCalculator.endColumn;
};
WalkontableTable.prototype.getLastVisibleColumn = function() {
return this.instance.wtViewport.columnsVisibleCalculator.endColumn;
};
WalkontableTable.prototype.isRowBeforeRenderedRows = function(r) {
return (this.rowFilter.sourceToRendered(r) < 0 && r >= 0);
};
WalkontableTable.prototype.isRowAfterViewport = function(r) {
return (r > this.getLastVisibleRow());
};
WalkontableTable.prototype.isRowAfterRenderedRows = function(r) {
return (r > this.getLastRenderedRow());
};
WalkontableTable.prototype.isColumnBeforeViewport = function(c) {
return (this.columnFilter.sourceToRendered(c) < 0 && c >= 0);
};
WalkontableTable.prototype.isColumnAfterViewport = function(c) {
return (c > this.getLastVisibleColumn());
};
WalkontableTable.prototype.isLastRowFullyVisible = function() {
return (this.getLastVisibleRow() === this.getLastRenderedRow());
};
WalkontableTable.prototype.isLastColumnFullyVisible = function() {
return (this.getLastVisibleColumn() === this.getLastRenderedColumn);
};
WalkontableTable.prototype.getRenderedColumnsCount = function() {
if (this.instance.cloneOverlay instanceof WalkontableDebugOverlay) {
return this.instance.getSetting('totalColumns');
} else if (this.instance.cloneOverlay instanceof WalkontableLeftOverlay || this.instance.cloneOverlay instanceof WalkontableCornerOverlay) {
return this.instance.getSetting('fixedColumnsLeft');
} else {
return this.instance.wtViewport.columnsRenderCalculator.count;
}
};
WalkontableTable.prototype.getRenderedRowsCount = function() {
if (this.instance.cloneOverlay instanceof WalkontableDebugOverlay) {
return this.instance.getSetting('totalRows');
} else if (this.instance.cloneOverlay instanceof WalkontableTopOverlay || this.instance.cloneOverlay instanceof WalkontableCornerOverlay) {
return this.instance.getSetting('fixedRowsTop');
}
return this.instance.wtViewport.rowsRenderCalculator.count;
};
WalkontableTable.prototype.getVisibleRowsCount = function() {
return this.instance.wtViewport.rowsVisibleCalculator.count;
};
WalkontableTable.prototype.allRowsInViewport = function() {
return this.instance.getSetting('totalRows') == this.getVisibleRowsCount();
};
WalkontableTable.prototype.getRowHeight = function(sourceRow) {
var height = this.instance.wtSettings.settings.rowHeight(sourceRow),
oversizedHeight = this.instance.wtViewport.oversizedRows[sourceRow];
if (oversizedHeight !== void 0) {
height = height ? Math.max(height, oversizedHeight) : oversizedHeight;
}
return height;
};
WalkontableTable.prototype.getColumnHeaderHeight = function(level) {
var height = this.instance.wtSettings.settings.defaultRowHeight,
oversizedHeight = this.instance.wtViewport.oversizedColumnHeaders[level];
if (oversizedHeight !== void 0) {
height = height ? Math.max(height, oversizedHeight) : oversizedHeight;
}
return height;
};
WalkontableTable.prototype.getVisibleColumnsCount = function() {
return this.instance.wtViewport.columnsVisibleCalculator.count;
};
WalkontableTable.prototype.allColumnsInViewport = function() {
return this.instance.getSetting('totalColumns') == this.getVisibleColumnsCount();
};
WalkontableTable.prototype.getColumnWidth = function(sourceColumn) {
var width = this.instance.wtSettings.settings.columnWidth;
if (typeof width === 'function') {
width = width(sourceColumn);
} else if (typeof width === 'object') {
width = width[sourceColumn];
}
var oversizedWidth = this.instance.wtViewport.oversizedCols[sourceColumn];
if (oversizedWidth !== void 0) {
width = width ? Math.max(width, oversizedWidth) : oversizedWidth;
}
return width;
};
WalkontableTable.prototype.getStretchedColumnWidth = function(sourceColumn) {
var width = this.getColumnWidth(sourceColumn) || this.instance.wtSettings.settings.defaultColumnWidth,
calculator = this.instance.wtViewport.columnsRenderCalculator,
stretchedWidth;
if (calculator) {
stretchedWidth = calculator.getStretchedColumnWidth(sourceColumn, width);
if (stretchedWidth) {
width = stretchedWidth;
}
}
return width;
};
;
window.WalkontableTable = WalkontableTable;
//#
},{"./../../../dom.js":27,"./cell/coords.js":5,"./cell/range.js":6,"./filter/column.js":9,"./filter/row.js":10,"./overlay/corner.js":12,"./overlay/debug.js":13,"./overlay/left.js":14,"./overlay/top.js":15,"./tableRenderer.js":21}],21:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableTableRenderer: {get: function() {
return WalkontableTableRenderer;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47__46__46__47_dom_46_js__;
var dom = ($___46__46__47__46__46__47__46__46__47_dom_46_js__ = require("./../../../dom.js"), $___46__46__47__46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47__46__46__47_dom_46_js__});
var isRenderedColumnHeaders = {};
var WalkontableTableRenderer = function WalkontableTableRenderer(wtTable) {
this.wtTable = wtTable;
this.wot = wtTable.instance;
this.instance = wtTable.instance;
this.rowFilter = wtTable.rowFilter;
this.columnFilter = wtTable.columnFilter;
this.TABLE = wtTable.TABLE;
this.THEAD = wtTable.THEAD;
this.TBODY = wtTable.TBODY;
this.COLGROUP = wtTable.COLGROUP;
this.rowHeaders = [];
this.rowHeaderCount = 0;
this.columnHeaders = [];
this.columnHeaderCount = 0;
this.fixedRowsTop = 0;
};
($traceurRuntime.createClass)(WalkontableTableRenderer, {
render: function() {
if (!this.wtTable.isWorkingOnClone()) {
this.wot.getSetting('beforeDraw', true);
}
this.rowHeaders = this.wot.getSetting('rowHeaders');
this.rowHeaderCount = this.rowHeaders.length;
this.fixedRowsTop = this.wot.getSetting('fixedRowsTop');
this.columnHeaders = this.wot.getSetting('columnHeaders');
this.columnHeaderCount = this.columnHeaders.length;
var columnsToRender = this.wtTable.getRenderedColumnsCount();
var rowsToRender = this.wtTable.getRenderedRowsCount();
var totalColumns = this.wot.getSetting('totalColumns');
var totalRows = this.wot.getSetting('totalRows');
var workspaceWidth;
var adjusted = false;
if (totalColumns > 0) {
this.adjustAvailableNodes();
adjusted = true;
this.renderColGroups();
this.renderColumnHeaders();
this.renderRows(totalRows, rowsToRender, columnsToRender);
if (!this.wtTable.isWorkingOnClone()) {
workspaceWidth = this.wot.wtViewport.getWorkspaceWidth();
this.wot.wtViewport.containerWidth = null;
} else {
this.adjustColumnHeaderHeights();
}
this.adjustColumnWidths(columnsToRender);
}
if (!adjusted) {
this.adjustAvailableNodes();
}
this.removeRedundantRows(rowsToRender);
if (!this.wtTable.isWorkingOnClone()) {
this.markOversizedRows();
this.wot.wtViewport.createVisibleCalculators();
this.wot.wtOverlays.refresh(false);
this.wot.wtOverlays.applyToDOM();
if (workspaceWidth !== this.wot.wtViewport.getWorkspaceWidth()) {
this.wot.wtViewport.containerWidth = null;
var firstRendered = this.wtTable.getFirstRenderedColumn();
var lastRendered = this.wtTable.getLastRenderedColumn();
for (var i = firstRendered; i < lastRendered; i++) {
var width = this.wtTable.getStretchedColumnWidth(i);
var renderedIndex = this.columnFilter.sourceToRendered(i);
this.COLGROUP.childNodes[renderedIndex + this.rowHeaderCount].style.width = width + 'px';
}
}
this.wot.getSetting('onDraw', true);
}
},
removeRedundantRows: function(renderedRowsCount) {
while (this.wtTable.tbodyChildrenLength > renderedRowsCount) {
this.TBODY.removeChild(this.TBODY.lastChild);
this.wtTable.tbodyChildrenLength--;
}
},
renderRows: function(totalRows, rowsToRender, columnsToRender) {
var lastTD,
TR;
var visibleRowIndex = 0;
var sourceRowIndex = this.rowFilter.renderedToSource(visibleRowIndex);
var isWorkingOnClone = this.wtTable.isWorkingOnClone();
while (sourceRowIndex < totalRows && sourceRowIndex >= 0) {
if (visibleRowIndex > 1000) {
throw new Error('Security brake: Too much TRs. Please define height for your table, which will enforce scrollbars.');
}
if (rowsToRender !== void 0 && visibleRowIndex === rowsToRender) {
break;
}
TR = this.getOrCreateTrForRow(visibleRowIndex, TR);
this.renderRowHeaders(sourceRowIndex, TR);
this.adjustColumns(TR, columnsToRender + this.rowHeaderCount);
lastTD = this.renderCells(sourceRowIndex, TR, columnsToRender);
if (!isWorkingOnClone) {
this.resetOversizedRow(sourceRowIndex);
}
if (TR.firstChild) {
var height = this.wot.wtTable.getRowHeight(sourceRowIndex);
if (height) {
TR.firstChild.style.height = height + 'px';
} else {
TR.firstChild.style.height = '';
}
}
visibleRowIndex++;
sourceRowIndex = this.rowFilter.renderedToSource(visibleRowIndex);
}
},
resetOversizedRow: function(sourceRow) {
if (this.wot.wtViewport.oversizedRows && this.wot.wtViewport.oversizedRows[sourceRow]) {
this.wot.wtViewport.oversizedRows[sourceRow] = void 0;
}
},
markOversizedRows: function() {
var rowCount = this.instance.wtTable.TBODY.childNodes.length;
var expectedTableHeight = rowCount * this.instance.wtSettings.settings.defaultRowHeight;
var actualTableHeight = dom.innerHeight(this.instance.wtTable.TBODY) - 1;
var previousRowHeight;
var rowInnerHeight;
var sourceRowIndex;
var currentTr;
var rowHeader;
if (expectedTableHeight === actualTableHeight) {
return;
}
while (rowCount) {
rowCount--;
sourceRowIndex = this.instance.wtTable.rowFilter.renderedToSource(rowCount);
previousRowHeight = this.instance.wtTable.getRowHeight(sourceRowIndex);
currentTr = this.instance.wtTable.getTrForRow(sourceRowIndex);
rowHeader = currentTr.querySelector('th');
if (rowHeader) {
rowInnerHeight = dom.innerHeight(rowHeader);
} else {
rowInnerHeight = dom.innerHeight(currentTr) - 1;
}
if ((!previousRowHeight && this.instance.wtSettings.settings.defaultRowHeight < rowInnerHeight || previousRowHeight < rowInnerHeight)) {
this.instance.wtViewport.oversizedRows[sourceRowIndex] = rowInnerHeight;
}
}
},
adjustColumnHeaderHeights: function() {
var columnHeaders = this.wot.getSetting('columnHeaders');
var childs = this.wot.wtTable.THEAD.childNodes;
var oversizedCols = this.wot.wtViewport.oversizedColumnHeaders;
for (var i = 0,
len = columnHeaders.length; i < len; i++) {
if (oversizedCols[i]) {
if (childs[i].childNodes.length === 0) {
return;
}
childs[i].childNodes[0].style.height = oversizedCols[i] + 'px';
}
}
},
markIfOversizedColumnHeader: function(col) {
var level = this.wot.getSetting('columnHeaders').length;
var defaultRowHeight = this.wot.wtSettings.settings.defaultRowHeight;
var sourceColIndex;
var previousColHeaderHeight;
var currentHeader;
var currentHeaderHeight;
sourceColIndex = this.wot.wtTable.columnFilter.renderedToSource(col);
while (level) {
level--;
previousColHeaderHeight = this.wot.wtTable.getColumnHeaderHeight(level);
currentHeader = this.wot.wtTable.getColumnHeader(sourceColIndex, level);
if (!currentHeader) {
continue;
}
currentHeaderHeight = dom.innerHeight(currentHeader);
if (!previousColHeaderHeight && defaultRowHeight < currentHeaderHeight || previousColHeaderHeight < currentHeaderHeight) {
this.wot.wtViewport.oversizedColumnHeaders[level] = currentHeaderHeight;
}
}
},
renderCells: function(sourceRowIndex, TR, columnsToRender) {
var TD;
var sourceColIndex;
for (var visibleColIndex = 0; visibleColIndex < columnsToRender; visibleColIndex++) {
sourceColIndex = this.columnFilter.renderedToSource(visibleColIndex);
if (visibleColIndex === 0) {
TD = TR.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(sourceColIndex)];
} else {
TD = TD.nextSibling;
}
if (TD.nodeName == 'TH') {
TD = replaceThWithTd(TD, TR);
}
if (!dom.hasClass(TD, 'hide')) {
TD.className = '';
}
TD.removeAttribute('style');
this.wot.wtSettings.settings.cellRenderer(sourceRowIndex, sourceColIndex, TD);
}
return TD;
},
adjustColumnWidths: function(columnsToRender) {
var scrollbarCompensation = 0;
var sourceInstance = this.wot.cloneSource ? this.wot.cloneSource : this.wot;
var mainHolder = sourceInstance.wtTable.holder;
if (mainHolder.offsetHeight < mainHolder.scrollHeight) {
scrollbarCompensation = dom.getScrollbarWidth();
}
this.wot.wtViewport.columnsRenderCalculator.refreshStretching(this.wot.wtViewport.getViewportWidth() - scrollbarCompensation);
for (var renderedColIndex = 0; renderedColIndex < columnsToRender; renderedColIndex++) {
var width = this.wtTable.getStretchedColumnWidth(this.columnFilter.renderedToSource(renderedColIndex));
this.COLGROUP.childNodes[renderedColIndex + this.rowHeaderCount].style.width = width + 'px';
}
},
appendToTbody: function(TR) {
this.TBODY.appendChild(TR);
this.wtTable.tbodyChildrenLength++;
},
getOrCreateTrForRow: function(rowIndex, currentTr) {
var TR;
if (rowIndex >= this.wtTable.tbodyChildrenLength) {
TR = this.createRow();
this.appendToTbody(TR);
} else if (rowIndex === 0) {
TR = this.TBODY.firstChild;
} else {
TR = currentTr.nextSibling;
}
return TR;
},
createRow: function() {
var TR = document.createElement('TR');
for (var visibleColIndex = 0; visibleColIndex < this.rowHeaderCount; visibleColIndex++) {
TR.appendChild(document.createElement('TH'));
}
return TR;
},
renderRowHeader: function(row, col, TH) {
TH.className = '';
TH.removeAttribute('style');
this.rowHeaders[col](row, TH, col);
},
renderRowHeaders: function(row, TR) {
for (var TH = TR.firstChild,
visibleColIndex = 0; visibleColIndex < this.rowHeaderCount; visibleColIndex++) {
if (!TH) {
TH = document.createElement('TH');
TR.appendChild(TH);
} else if (TH.nodeName == 'TD') {
TH = replaceTdWithTh(TH, TR);
}
this.renderRowHeader(row, visibleColIndex, TH);
TH = TH.nextSibling;
}
},
adjustAvailableNodes: function() {
this.adjustColGroups();
this.adjustThead();
},
renderColumnHeaders: function() {
var overlayName = this.wot.getOverlayName();
if (!this.columnHeaderCount) {
return;
}
var columnCount = this.wtTable.getRenderedColumnsCount();
for (var i = 0; i < this.columnHeaderCount; i++) {
var TR = this.getTrForColumnHeaders(i);
for (var renderedColumnIndex = (-1) * this.rowHeaderCount; renderedColumnIndex < columnCount; renderedColumnIndex++) {
var sourceCol = this.columnFilter.renderedToSource(renderedColumnIndex);
this.renderColumnHeader(i, sourceCol, TR.childNodes[renderedColumnIndex + this.rowHeaderCount]);
if (!isRenderedColumnHeaders[overlayName] && !this.wtTable.isWorkingOnClone()) {
this.markIfOversizedColumnHeader(renderedColumnIndex);
}
}
}
isRenderedColumnHeaders[overlayName] = true;
},
adjustColGroups: function() {
var columnCount = this.wtTable.getRenderedColumnsCount();
while (this.wtTable.colgroupChildrenLength < columnCount + this.rowHeaderCount) {
this.COLGROUP.appendChild(document.createElement('COL'));
this.wtTable.colgroupChildrenLength++;
}
while (this.wtTable.colgroupChildrenLength > columnCount + this.rowHeaderCount) {
this.COLGROUP.removeChild(this.COLGROUP.lastChild);
this.wtTable.colgroupChildrenLength--;
}
},
adjustThead: function() {
var columnCount = this.wtTable.getRenderedColumnsCount();
var TR = this.THEAD.firstChild;
if (this.columnHeaders.length) {
for (var i = 0,
len = this.columnHeaders.length; i < len; i++) {
TR = this.THEAD.childNodes[i];
if (!TR) {
TR = document.createElement('TR');
this.THEAD.appendChild(TR);
}
this.theadChildrenLength = TR.childNodes.length;
while (this.theadChildrenLength < columnCount + this.rowHeaderCount) {
TR.appendChild(document.createElement('TH'));
this.theadChildrenLength++;
}
while (this.theadChildrenLength > columnCount + this.rowHeaderCount) {
TR.removeChild(TR.lastChild);
this.theadChildrenLength--;
}
}
var theadChildrenLength = this.THEAD.childNodes.length;
if (theadChildrenLength > this.columnHeaders.length) {
for (var i$__1 = this.columnHeaders.length; i$__1 < theadChildrenLength; i$__1++) {
this.THEAD.removeChild(this.THEAD.lastChild);
}
}
} else if (TR) {
dom.empty(TR);
}
},
getTrForColumnHeaders: function(index) {
return this.THEAD.childNodes[index];
},
renderColumnHeader: function(row, col, TH) {
TH.className = '';
TH.removeAttribute('style');
return this.columnHeaders[row](col, TH, row);
},
renderColGroups: function() {
for (var colIndex = 0; colIndex < this.wtTable.colgroupChildrenLength; colIndex++) {
if (colIndex < this.rowHeaderCount) {
dom.addClass(this.COLGROUP.childNodes[colIndex], 'rowHeader');
} else {
dom.removeClass(this.COLGROUP.childNodes[colIndex], 'rowHeader');
}
}
},
adjustColumns: function(TR, desiredCount) {
var count = TR.childNodes.length;
while (count < desiredCount) {
var TD = document.createElement('TD');
TR.appendChild(TD);
count++;
}
while (count > desiredCount) {
TR.removeChild(TR.lastChild);
count--;
}
},
removeRedundantColumns: function(columnsToRender) {
while (this.wtTable.tbodyChildrenLength > columnsToRender) {
this.TBODY.removeChild(this.TBODY.lastChild);
this.wtTable.tbodyChildrenLength--;
}
}
}, {});
function replaceTdWithTh(TD, TR) {
var TH = document.createElement('TH');
TR.insertBefore(TH, TD);
TR.removeChild(TD);
return TH;
}
function replaceThWithTd(TH, TR) {
var TD = document.createElement('TD');
TR.insertBefore(TD, TH);
TR.removeChild(TH);
return TD;
}
;
window.WalkontableTableRenderer = WalkontableTableRenderer;
//#
},{"./../../../dom.js":27}],22:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
WalkontableViewport: {get: function() {
return WalkontableViewport;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47__46__46__47_eventManager_46_js__,
$__calculator_47_viewportColumns_46_js__,
$__calculator_47_viewportRows_46_js__;
var dom = ($___46__46__47__46__46__47__46__46__47_dom_46_js__ = require("./../../../dom.js"), $___46__46__47__46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47__46__46__47_dom_46_js__});
var eventManagerObject = ($___46__46__47__46__46__47__46__46__47_eventManager_46_js__ = require("./../../../eventManager.js"), $___46__46__47__46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47__46__46__47_eventManager_46_js__}).eventManager;
var WalkontableViewportColumnsCalculator = ($__calculator_47_viewportColumns_46_js__ = require("./calculator/viewportColumns.js"), $__calculator_47_viewportColumns_46_js__ && $__calculator_47_viewportColumns_46_js__.__esModule && $__calculator_47_viewportColumns_46_js__ || {default: $__calculator_47_viewportColumns_46_js__}).WalkontableViewportColumnsCalculator;
var WalkontableViewportRowsCalculator = ($__calculator_47_viewportRows_46_js__ = require("./calculator/viewportRows.js"), $__calculator_47_viewportRows_46_js__ && $__calculator_47_viewportRows_46_js__.__esModule && $__calculator_47_viewportRows_46_js__ || {default: $__calculator_47_viewportRows_46_js__}).WalkontableViewportRowsCalculator;
var WalkontableViewport = function WalkontableViewport(wotInstance) {
var $__3 = this;
this.wot = wotInstance;
this.instance = this.wot;
this.oversizedRows = [];
this.oversizedCols = [];
this.oversizedColumnHeaders = [];
this.clientHeight = 0;
this.containerWidth = NaN;
this.rowHeaderWidth = NaN;
this.rowsVisibleCalculator = null;
this.columnsVisibleCalculator = null;
var eventManager = eventManagerObject(wotInstance);
eventManager.addEventListener(window, 'resize', (function() {
$__3.clientHeight = $__3.getWorkspaceHeight();
}));
};
($traceurRuntime.createClass)(WalkontableViewport, {
getWorkspaceHeight: function() {
var trimmingContainer = this.instance.wtOverlays.topOverlay.trimmingContainer;
var elemHeight;
var height = 0;
if (trimmingContainer === window) {
height = document.documentElement.clientHeight;
} else {
elemHeight = dom.outerHeight(trimmingContainer);
height = (elemHeight > 0 && trimmingContainer.clientHeight > 0) ? trimmingContainer.clientHeight : Infinity;
}
return height;
},
getWorkspaceWidth: function() {
var width;
var totalColumns = this.instance.getSetting("totalColumns");
var trimmingContainer = this.instance.wtOverlays.leftOverlay.trimmingContainer;
var overflow;
var stretchSetting = this.instance.getSetting('stretchH');
var docOffsetWidth = document.documentElement.offsetWidth;
if (Handsontable.freezeOverlays) {
width = Math.min(docOffsetWidth - this.getWorkspaceOffset().left, docOffsetWidth);
} else {
width = Math.min(this.getContainerFillWidth(), docOffsetWidth - this.getWorkspaceOffset().left, docOffsetWidth);
}
if (trimmingContainer === window && totalColumns > 0 && this.sumColumnWidths(0, totalColumns - 1) > width) {
return document.documentElement.clientWidth;
}
if (trimmingContainer !== window) {
overflow = dom.getStyle(this.instance.wtOverlays.leftOverlay.trimmingContainer, 'overflow');
if (overflow == "scroll" || overflow == "hidden" || overflow == "auto") {
return Math.max(width, trimmingContainer.clientWidth);
}
}
if (stretchSetting === 'none' || !stretchSetting) {
return Math.max(width, dom.outerWidth(this.instance.wtTable.TABLE));
} else {
return width;
}
},
hasVerticalScroll: function() {
return this.getWorkspaceActualHeight() > this.getWorkspaceHeight();
},
hasHorizontalScroll: function() {
return this.getWorkspaceActualWidth() > this.getWorkspaceWidth();
},
sumColumnWidths: function(from, length) {
var sum = 0;
var defaultColumnWidth = this.instance.wtSettings.defaultColumnWidth;
while (from < length) {
sum += this.wot.wtTable.getColumnWidth(from) || defaultColumnWidth;
from++;
}
return sum;
},
getContainerFillWidth: function() {
if (this.containerWidth) {
return this.containerWidth;
}
var mainContainer = this.instance.wtTable.holder;
var fillWidth;
var dummyElement;
dummyElement = document.createElement("DIV");
dummyElement.style.width = "100%";
dummyElement.style.height = "1px";
mainContainer.appendChild(dummyElement);
fillWidth = dummyElement.offsetWidth;
this.containerWidth = fillWidth;
mainContainer.removeChild(dummyElement);
return fillWidth;
},
getWorkspaceOffset: function() {
return dom.offset(this.wot.wtTable.TABLE);
},
getWorkspaceActualHeight: function() {
return dom.outerHeight(this.wot.wtTable.TABLE);
},
getWorkspaceActualWidth: function() {
return dom.outerWidth(this.wot.wtTable.TABLE) || dom.outerWidth(this.wot.wtTable.TBODY) || dom.outerWidth(this.wot.wtTable.THEAD);
},
getColumnHeaderHeight: function() {
if (isNaN(this.columnHeaderHeight)) {
this.columnHeaderHeight = dom.outerHeight(this.wot.wtTable.THEAD);
}
return this.columnHeaderHeight;
},
getViewportHeight: function() {
var containerHeight = this.getWorkspaceHeight();
var columnHeaderHeight;
if (containerHeight === Infinity) {
return containerHeight;
}
columnHeaderHeight = this.getColumnHeaderHeight();
if (columnHeaderHeight > 0) {
containerHeight -= columnHeaderHeight;
}
return containerHeight;
},
getRowHeaderWidth: function() {
if (this.wot.cloneSource) {
return this.wot.cloneSource.wtViewport.getRowHeaderWidth();
}
if (isNaN(this.rowHeaderWidth)) {
var rowHeaders = this.instance.getSetting('rowHeaders');
if (rowHeaders.length) {
var TH = this.instance.wtTable.TABLE.querySelector('TH');
this.rowHeaderWidth = 0;
for (var i = 0,
len = rowHeaders.length; i < len; i++) {
if (TH) {
this.rowHeaderWidth += dom.outerWidth(TH);
TH = TH.nextSibling;
} else {
this.rowHeaderWidth += 50;
}
}
} else {
this.rowHeaderWidth = 0;
}
}
return this.rowHeaderWidth;
},
getViewportWidth: function() {
var containerWidth = this.getWorkspaceWidth();
var rowHeaderWidth;
if (containerWidth === Infinity) {
return containerWidth;
}
rowHeaderWidth = this.getRowHeaderWidth();
if (rowHeaderWidth > 0) {
return containerWidth - rowHeaderWidth;
}
return containerWidth;
},
createRowsCalculator: function() {
var visible = arguments[0] !== (void 0) ? arguments[0] : false;
var $__3 = this;
var height;
var pos;
var fixedRowsTop;
this.rowHeaderWidth = NaN;
if (this.wot.wtSettings.settings.renderAllRows) {
height = Infinity;
} else {
height = this.getViewportHeight();
}
pos = dom.getScrollTop(this.wot.wtOverlays.mainTableScrollableElement) - this.wot.wtOverlays.topOverlay.getTableParentOffset();
if (pos < 0) {
pos = 0;
}
fixedRowsTop = this.wot.getSetting('fixedRowsTop');
if (fixedRowsTop) {
var fixedRowsHeight = this.wot.wtOverlays.topOverlay.sumCellSizes(0, fixedRowsTop);
pos += fixedRowsHeight;
height -= fixedRowsHeight;
}
return new WalkontableViewportRowsCalculator(height, pos, this.wot.getSetting('totalRows'), (function(sourceRow) {
return $__3.wot.wtTable.getRowHeight(sourceRow);
}), visible ? null : this.wot.wtSettings.settings.viewportRowCalculatorOverride, visible);
},
createColumnsCalculator: function() {
var visible = arguments[0] !== (void 0) ? arguments[0] : false;
var $__3 = this;
var width = this.getViewportWidth();
var pos;
var fixedColumnsLeft;
this.columnHeaderHeight = NaN;
pos = this.wot.wtOverlays.leftOverlay.getScrollPosition() - this.wot.wtOverlays.topOverlay.getTableParentOffset();
if (pos < 0) {
pos = 0;
}
fixedColumnsLeft = this.wot.getSetting('fixedColumnsLeft');
if (fixedColumnsLeft) {
var fixedColumnsWidth = this.wot.wtOverlays.leftOverlay.sumCellSizes(0, fixedColumnsLeft);
pos += fixedColumnsWidth;
width -= fixedColumnsWidth;
}
if (this.wot.wtTable.holder.clientWidth !== this.wot.wtTable.holder.offsetWidth) {
width -= dom.getScrollbarWidth();
}
return new WalkontableViewportColumnsCalculator(width, pos, this.wot.getSetting('totalColumns'), (function(sourceCol) {
return $__3.wot.wtTable.getColumnWidth(sourceCol);
}), visible ? null : this.wot.wtSettings.settings.viewportColumnCalculatorOverride, visible, this.wot.getSetting('stretchH'));
},
createRenderCalculators: function() {
var fastDraw = arguments[0] !== (void 0) ? arguments[0] : false;
if (fastDraw) {
var proposedRowsVisibleCalculator = this.createRowsCalculator(true);
var proposedColumnsVisibleCalculator = this.createColumnsCalculator(true);
if (!(this.areAllProposedVisibleRowsAlreadyRendered(proposedRowsVisibleCalculator) && this.areAllProposedVisibleColumnsAlreadyRendered(proposedColumnsVisibleCalculator))) {
fastDraw = false;
}
}
if (!fastDraw) {
this.rowsRenderCalculator = this.createRowsCalculator();
this.columnsRenderCalculator = this.createColumnsCalculator();
}
this.rowsVisibleCalculator = null;
this.columnsVisibleCalculator = null;
return fastDraw;
},
createVisibleCalculators: function() {
this.rowsVisibleCalculator = this.createRowsCalculator(true);
this.columnsVisibleCalculator = this.createColumnsCalculator(true);
},
areAllProposedVisibleRowsAlreadyRendered: function(proposedRowsVisibleCalculator) {
if (this.rowsVisibleCalculator) {
if (proposedRowsVisibleCalculator.startRow < this.rowsRenderCalculator.startRow || (proposedRowsVisibleCalculator.startRow === this.rowsRenderCalculator.startRow && proposedRowsVisibleCalculator.startRow > 0)) {
return false;
} else if (proposedRowsVisibleCalculator.endRow > this.rowsRenderCalculator.endRow || (proposedRowsVisibleCalculator.endRow === this.rowsRenderCalculator.endRow && proposedRowsVisibleCalculator.endRow < this.wot.getSetting('totalRows') - 1)) {
return false;
} else {
return true;
}
}
return false;
},
areAllProposedVisibleColumnsAlreadyRendered: function(proposedColumnsVisibleCalculator) {
if (this.columnsVisibleCalculator) {
if (proposedColumnsVisibleCalculator.startColumn < this.columnsRenderCalculator.startColumn || (proposedColumnsVisibleCalculator.startColumn === this.columnsRenderCalculator.startColumn && proposedColumnsVisibleCalculator.startColumn > 0)) {
return false;
} else if (proposedColumnsVisibleCalculator.endColumn > this.columnsRenderCalculator.endColumn || (proposedColumnsVisibleCalculator.endColumn === this.columnsRenderCalculator.endColumn && proposedColumnsVisibleCalculator.endColumn < this.wot.getSetting('totalColumns') - 1)) {
return false;
} else {
return true;
}
}
return false;
}
}, {});
;
window.WalkontableViewport = WalkontableViewport;
//#
},{"./../../../dom.js":27,"./../../../eventManager.js":41,"./calculator/viewportColumns.js":3,"./calculator/viewportRows.js":4}],23:[function(require,module,exports){
"use strict";
var $__shims_47_array_46_filter_46_js__,
$__shims_47_array_46_indexOf_46_js__,
$__shims_47_array_46_isArray_46_js__,
$__shims_47_classes_46_js__,
$__shims_47_object_46_keys_46_js__,
$__shims_47_string_46_trim_46_js__,
$__shims_47_weakmap_46_js__,
$__pluginHooks_46_js__,
$__core_46_js__,
$__renderers_47__95_cellDecorator_46_js__,
$__cellTypes_46_js__,
$___46__46__47_plugins_47_jqueryHandsontable_46_js__;
var version = Handsontable.version;
var buildDate = Handsontable.buildDate;
window.Handsontable = function Handsontable(rootElement, userSettings) {
var instance = new Handsontable.Core(rootElement, userSettings || {});
instance.init();
return instance;
};
Handsontable.version = version;
Handsontable.buildDate = buildDate;
($__shims_47_array_46_filter_46_js__ = require("./shims/array.filter.js"), $__shims_47_array_46_filter_46_js__ && $__shims_47_array_46_filter_46_js__.__esModule && $__shims_47_array_46_filter_46_js__ || {default: $__shims_47_array_46_filter_46_js__});
($__shims_47_array_46_indexOf_46_js__ = require("./shims/array.indexOf.js"), $__shims_47_array_46_indexOf_46_js__ && $__shims_47_array_46_indexOf_46_js__.__esModule && $__shims_47_array_46_indexOf_46_js__ || {default: $__shims_47_array_46_indexOf_46_js__});
($__shims_47_array_46_isArray_46_js__ = require("./shims/array.isArray.js"), $__shims_47_array_46_isArray_46_js__ && $__shims_47_array_46_isArray_46_js__.__esModule && $__shims_47_array_46_isArray_46_js__ || {default: $__shims_47_array_46_isArray_46_js__});
($__shims_47_classes_46_js__ = require("./shims/classes.js"), $__shims_47_classes_46_js__ && $__shims_47_classes_46_js__.__esModule && $__shims_47_classes_46_js__ || {default: $__shims_47_classes_46_js__});
($__shims_47_object_46_keys_46_js__ = require("./shims/object.keys.js"), $__shims_47_object_46_keys_46_js__ && $__shims_47_object_46_keys_46_js__.__esModule && $__shims_47_object_46_keys_46_js__ || {default: $__shims_47_object_46_keys_46_js__});
($__shims_47_string_46_trim_46_js__ = require("./shims/string.trim.js"), $__shims_47_string_46_trim_46_js__ && $__shims_47_string_46_trim_46_js__.__esModule && $__shims_47_string_46_trim_46_js__ || {default: $__shims_47_string_46_trim_46_js__});
($__shims_47_weakmap_46_js__ = require("./shims/weakmap.js"), $__shims_47_weakmap_46_js__ && $__shims_47_weakmap_46_js__.__esModule && $__shims_47_weakmap_46_js__ || {default: $__shims_47_weakmap_46_js__});
Handsontable.plugins = {};
var Hooks = ($__pluginHooks_46_js__ = require("./pluginHooks.js"), $__pluginHooks_46_js__ && $__pluginHooks_46_js__.__esModule && $__pluginHooks_46_js__ || {default: $__pluginHooks_46_js__}).Hooks;
if (!Handsontable.hooks) {
Handsontable.hooks = new Hooks();
}
($__core_46_js__ = require("./core.js"), $__core_46_js__ && $__core_46_js__.__esModule && $__core_46_js__ || {default: $__core_46_js__});
($__renderers_47__95_cellDecorator_46_js__ = require("./renderers/_cellDecorator.js"), $__renderers_47__95_cellDecorator_46_js__ && $__renderers_47__95_cellDecorator_46_js__.__esModule && $__renderers_47__95_cellDecorator_46_js__ || {default: $__renderers_47__95_cellDecorator_46_js__});
($__cellTypes_46_js__ = require("./cellTypes.js"), $__cellTypes_46_js__ && $__cellTypes_46_js__.__esModule && $__cellTypes_46_js__ || {default: $__cellTypes_46_js__});
($___46__46__47_plugins_47_jqueryHandsontable_46_js__ = require("./../plugins/jqueryHandsontable.js"), $___46__46__47_plugins_47_jqueryHandsontable_46_js__ && $___46__46__47_plugins_47_jqueryHandsontable_46_js__.__esModule && $___46__46__47_plugins_47_jqueryHandsontable_46_js__ || {default: $___46__46__47_plugins_47_jqueryHandsontable_46_js__});
//#
},{"./../plugins/jqueryHandsontable.js":1,"./cellTypes.js":24,"./core.js":25,"./pluginHooks.js":44,"./renderers/_cellDecorator.js":71,"./shims/array.filter.js":78,"./shims/array.indexOf.js":79,"./shims/array.isArray.js":80,"./shims/classes.js":81,"./shims/object.keys.js":82,"./shims/string.trim.js":83,"./shims/weakmap.js":84}],24:[function(require,module,exports){
"use strict";
var $__helpers_46_js__,
$__editors_46_js__,
$__renderers_46_js__,
$__editors_47_autocompleteEditor_46_js__,
$__editors_47_checkboxEditor_46_js__,
$__editors_47_dateEditor_46_js__,
$__editors_47_dropdownEditor_46_js__,
$__editors_47_handsontableEditor_46_js__,
$__editors_47_mobileTextEditor_46_js__,
$__editors_47_numericEditor_46_js__,
$__editors_47_passwordEditor_46_js__,
$__editors_47_selectEditor_46_js__,
$__editors_47_textEditor_46_js__,
$__renderers_47_autocompleteRenderer_46_js__,
$__renderers_47_checkboxRenderer_46_js__,
$__renderers_47_htmlRenderer_46_js__,
$__renderers_47_numericRenderer_46_js__,
$__renderers_47_passwordRenderer_46_js__,
$__renderers_47_textRenderer_46_js__,
$__validators_47_autocompleteValidator_46_js__,
$__validators_47_dateValidator_46_js__,
$__validators_47_numericValidator_46_js__;
var helper = ($__helpers_46_js__ = require("./helpers.js"), $__helpers_46_js__ && $__helpers_46_js__.__esModule && $__helpers_46_js__ || {default: $__helpers_46_js__});
var getEditorConstructor = ($__editors_46_js__ = require("./editors.js"), $__editors_46_js__ && $__editors_46_js__.__esModule && $__editors_46_js__ || {default: $__editors_46_js__}).getEditorConstructor;
var getRenderer = ($__renderers_46_js__ = require("./renderers.js"), $__renderers_46_js__ && $__renderers_46_js__.__esModule && $__renderers_46_js__ || {default: $__renderers_46_js__}).getRenderer;
var AutocompleteEditor = ($__editors_47_autocompleteEditor_46_js__ = require("./editors/autocompleteEditor.js"), $__editors_47_autocompleteEditor_46_js__ && $__editors_47_autocompleteEditor_46_js__.__esModule && $__editors_47_autocompleteEditor_46_js__ || {default: $__editors_47_autocompleteEditor_46_js__}).AutocompleteEditor;
var CheckboxEditor = ($__editors_47_checkboxEditor_46_js__ = require("./editors/checkboxEditor.js"), $__editors_47_checkboxEditor_46_js__ && $__editors_47_checkboxEditor_46_js__.__esModule && $__editors_47_checkboxEditor_46_js__ || {default: $__editors_47_checkboxEditor_46_js__}).CheckboxEditor;
var DateEditor = ($__editors_47_dateEditor_46_js__ = require("./editors/dateEditor.js"), $__editors_47_dateEditor_46_js__ && $__editors_47_dateEditor_46_js__.__esModule && $__editors_47_dateEditor_46_js__ || {default: $__editors_47_dateEditor_46_js__}).DateEditor;
var DropdownEditor = ($__editors_47_dropdownEditor_46_js__ = require("./editors/dropdownEditor.js"), $__editors_47_dropdownEditor_46_js__ && $__editors_47_dropdownEditor_46_js__.__esModule && $__editors_47_dropdownEditor_46_js__ || {default: $__editors_47_dropdownEditor_46_js__}).DropdownEditor;
var HandsontableEditor = ($__editors_47_handsontableEditor_46_js__ = require("./editors/handsontableEditor.js"), $__editors_47_handsontableEditor_46_js__ && $__editors_47_handsontableEditor_46_js__.__esModule && $__editors_47_handsontableEditor_46_js__ || {default: $__editors_47_handsontableEditor_46_js__}).HandsontableEditor;
var MobileTextEditor = ($__editors_47_mobileTextEditor_46_js__ = require("./editors/mobileTextEditor.js"), $__editors_47_mobileTextEditor_46_js__ && $__editors_47_mobileTextEditor_46_js__.__esModule && $__editors_47_mobileTextEditor_46_js__ || {default: $__editors_47_mobileTextEditor_46_js__}).MobileTextEditor;
var NumericEditor = ($__editors_47_numericEditor_46_js__ = require("./editors/numericEditor.js"), $__editors_47_numericEditor_46_js__ && $__editors_47_numericEditor_46_js__.__esModule && $__editors_47_numericEditor_46_js__ || {default: $__editors_47_numericEditor_46_js__}).NumericEditor;
var PasswordEditor = ($__editors_47_passwordEditor_46_js__ = require("./editors/passwordEditor.js"), $__editors_47_passwordEditor_46_js__ && $__editors_47_passwordEditor_46_js__.__esModule && $__editors_47_passwordEditor_46_js__ || {default: $__editors_47_passwordEditor_46_js__}).PasswordEditor;
var SelectEditor = ($__editors_47_selectEditor_46_js__ = require("./editors/selectEditor.js"), $__editors_47_selectEditor_46_js__ && $__editors_47_selectEditor_46_js__.__esModule && $__editors_47_selectEditor_46_js__ || {default: $__editors_47_selectEditor_46_js__}).SelectEditor;
var TextEditor = ($__editors_47_textEditor_46_js__ = require("./editors/textEditor.js"), $__editors_47_textEditor_46_js__ && $__editors_47_textEditor_46_js__.__esModule && $__editors_47_textEditor_46_js__ || {default: $__editors_47_textEditor_46_js__}).TextEditor;
var AutocompleteRenderer = ($__renderers_47_autocompleteRenderer_46_js__ = require("./renderers/autocompleteRenderer.js"), $__renderers_47_autocompleteRenderer_46_js__ && $__renderers_47_autocompleteRenderer_46_js__.__esModule && $__renderers_47_autocompleteRenderer_46_js__ || {default: $__renderers_47_autocompleteRenderer_46_js__}).AutocompleteRenderer;
var CheckboxRenderer = ($__renderers_47_checkboxRenderer_46_js__ = require("./renderers/checkboxRenderer.js"), $__renderers_47_checkboxRenderer_46_js__ && $__renderers_47_checkboxRenderer_46_js__.__esModule && $__renderers_47_checkboxRenderer_46_js__ || {default: $__renderers_47_checkboxRenderer_46_js__}).CheckboxRenderer;
var HtmlRenderer = ($__renderers_47_htmlRenderer_46_js__ = require("./renderers/htmlRenderer.js"), $__renderers_47_htmlRenderer_46_js__ && $__renderers_47_htmlRenderer_46_js__.__esModule && $__renderers_47_htmlRenderer_46_js__ || {default: $__renderers_47_htmlRenderer_46_js__}).HtmlRenderer;
var NumericRenderer = ($__renderers_47_numericRenderer_46_js__ = require("./renderers/numericRenderer.js"), $__renderers_47_numericRenderer_46_js__ && $__renderers_47_numericRenderer_46_js__.__esModule && $__renderers_47_numericRenderer_46_js__ || {default: $__renderers_47_numericRenderer_46_js__}).NumericRenderer;
var PasswordRenderer = ($__renderers_47_passwordRenderer_46_js__ = require("./renderers/passwordRenderer.js"), $__renderers_47_passwordRenderer_46_js__ && $__renderers_47_passwordRenderer_46_js__.__esModule && $__renderers_47_passwordRenderer_46_js__ || {default: $__renderers_47_passwordRenderer_46_js__}).PasswordRenderer;
var TextRenderer = ($__renderers_47_textRenderer_46_js__ = require("./renderers/textRenderer.js"), $__renderers_47_textRenderer_46_js__ && $__renderers_47_textRenderer_46_js__.__esModule && $__renderers_47_textRenderer_46_js__ || {default: $__renderers_47_textRenderer_46_js__}).TextRenderer;
var AutocompleteValidator = ($__validators_47_autocompleteValidator_46_js__ = require("./validators/autocompleteValidator.js"), $__validators_47_autocompleteValidator_46_js__ && $__validators_47_autocompleteValidator_46_js__.__esModule && $__validators_47_autocompleteValidator_46_js__ || {default: $__validators_47_autocompleteValidator_46_js__}).AutocompleteValidator;
var DateValidator = ($__validators_47_dateValidator_46_js__ = require("./validators/dateValidator.js"), $__validators_47_dateValidator_46_js__ && $__validators_47_dateValidator_46_js__.__esModule && $__validators_47_dateValidator_46_js__ || {default: $__validators_47_dateValidator_46_js__}).DateValidator;
var NumericValidator = ($__validators_47_numericValidator_46_js__ = require("./validators/numericValidator.js"), $__validators_47_numericValidator_46_js__ && $__validators_47_numericValidator_46_js__.__esModule && $__validators_47_numericValidator_46_js__ || {default: $__validators_47_numericValidator_46_js__}).NumericValidator;
Handsontable.mobileBrowser = helper.isMobileBrowser();
Handsontable.AutocompleteCell = {
editor: getEditorConstructor('autocomplete'),
renderer: getRenderer('autocomplete'),
validator: Handsontable.AutocompleteValidator
};
Handsontable.CheckboxCell = {
editor: getEditorConstructor('checkbox'),
renderer: getRenderer('checkbox')
};
Handsontable.TextCell = {
editor: Handsontable.mobileBrowser ? getEditorConstructor('mobile') : getEditorConstructor('text'),
renderer: getRenderer('text')
};
Handsontable.NumericCell = {
editor: getEditorConstructor('numeric'),
renderer: getRenderer('numeric'),
validator: Handsontable.NumericValidator,
dataType: 'number'
};
Handsontable.DateCell = {
editor: getEditorConstructor('date'),
validator: Handsontable.DateValidator,
renderer: getRenderer('autocomplete')
};
Handsontable.HandsontableCell = {
editor: getEditorConstructor('handsontable'),
renderer: getRenderer('autocomplete')
};
Handsontable.PasswordCell = {
editor: getEditorConstructor('password'),
renderer: getRenderer('password'),
copyable: false
};
Handsontable.DropdownCell = {
editor: getEditorConstructor('dropdown'),
renderer: getRenderer('autocomplete'),
validator: Handsontable.AutocompleteValidator
};
Handsontable.cellTypes = {
text: Handsontable.TextCell,
date: Handsontable.DateCell,
numeric: Handsontable.NumericCell,
checkbox: Handsontable.CheckboxCell,
autocomplete: Handsontable.AutocompleteCell,
handsontable: Handsontable.HandsontableCell,
password: Handsontable.PasswordCell,
dropdown: Handsontable.DropdownCell
};
Handsontable.cellLookup = {validator: {
numeric: Handsontable.NumericValidator,
autocomplete: Handsontable.AutocompleteValidator
}};
//#
},{"./editors.js":29,"./editors/autocompleteEditor.js":31,"./editors/checkboxEditor.js":32,"./editors/dateEditor.js":33,"./editors/dropdownEditor.js":34,"./editors/handsontableEditor.js":35,"./editors/mobileTextEditor.js":36,"./editors/numericEditor.js":37,"./editors/passwordEditor.js":38,"./editors/selectEditor.js":39,"./editors/textEditor.js":40,"./helpers.js":42,"./renderers.js":70,"./renderers/autocompleteRenderer.js":72,"./renderers/checkboxRenderer.js":73,"./renderers/htmlRenderer.js":74,"./renderers/numericRenderer.js":75,"./renderers/passwordRenderer.js":76,"./renderers/textRenderer.js":77,"./validators/autocompleteValidator.js":86,"./validators/dateValidator.js":87,"./validators/numericValidator.js":88}],25:[function(require,module,exports){
"use strict";
var $__dom_46_js__,
$__helpers_46_js__,
$__numeral__,
$__dataMap_46_js__,
$__editorManager_46_js__,
$__eventManager_46_js__,
$__plugins_46_js__,
$__renderers_46_js__,
$__tableView_46_js__,
$__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__,
$__3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__,
$__3rdparty_47_walkontable_47_src_47_selection_46_js__;
var dom = ($__dom_46_js__ = require("./dom.js"), $__dom_46_js__ && $__dom_46_js__.__esModule && $__dom_46_js__ || {default: $__dom_46_js__});
var helper = ($__helpers_46_js__ = require("./helpers.js"), $__helpers_46_js__ && $__helpers_46_js__.__esModule && $__helpers_46_js__ || {default: $__helpers_46_js__});
var numeral = ($__numeral__ = require("numeral"), $__numeral__ && $__numeral__.__esModule && $__numeral__ || {default: $__numeral__}).default;
var DataMap = ($__dataMap_46_js__ = require("./dataMap.js"), $__dataMap_46_js__ && $__dataMap_46_js__.__esModule && $__dataMap_46_js__ || {default: $__dataMap_46_js__}).DataMap;
var EditorManager = ($__editorManager_46_js__ = require("./editorManager.js"), $__editorManager_46_js__ && $__editorManager_46_js__.__esModule && $__editorManager_46_js__ || {default: $__editorManager_46_js__}).EditorManager;
var eventManagerObject = ($__eventManager_46_js__ = require("./eventManager.js"), $__eventManager_46_js__ && $__eventManager_46_js__.__esModule && $__eventManager_46_js__ || {default: $__eventManager_46_js__}).eventManager;
var getPlugin = ($__plugins_46_js__ = require("./plugins.js"), $__plugins_46_js__ && $__plugins_46_js__.__esModule && $__plugins_46_js__ || {default: $__plugins_46_js__}).getPlugin;
var getRenderer = ($__renderers_46_js__ = require("./renderers.js"), $__renderers_46_js__ && $__renderers_46_js__.__esModule && $__renderers_46_js__ || {default: $__renderers_46_js__}).getRenderer;
var TableView = ($__tableView_46_js__ = require("./tableView.js"), $__tableView_46_js__ && $__tableView_46_js__.__esModule && $__tableView_46_js__ || {default: $__tableView_46_js__}).TableView;
var WalkontableCellCoords = ($__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ = require("./3rdparty/walkontable/src/cell/coords.js"), $__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ && $__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__.__esModule && $__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ || {default: $__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__}).WalkontableCellCoords;
var WalkontableCellRange = ($__3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__ = require("./3rdparty/walkontable/src/cell/range.js"), $__3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__ && $__3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__.__esModule && $__3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__ || {default: $__3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__}).WalkontableCellRange;
var WalkontableSelection = ($__3rdparty_47_walkontable_47_src_47_selection_46_js__ = require("./3rdparty/walkontable/src/selection.js"), $__3rdparty_47_walkontable_47_src_47_selection_46_js__ && $__3rdparty_47_walkontable_47_src_47_selection_46_js__.__esModule && $__3rdparty_47_walkontable_47_src_47_selection_46_js__ || {default: $__3rdparty_47_walkontable_47_src_47_selection_46_js__}).WalkontableSelection;
Handsontable.activeGuid = null;
Handsontable.Core = function Core(rootElement, userSettings) {
var priv,
datamap,
grid,
selection,
editorManager,
instance = this,
GridSettings = function() {},
eventManager = eventManagerObject(instance);
helper.extend(GridSettings.prototype, DefaultSettings.prototype);
helper.extend(GridSettings.prototype, userSettings);
helper.extend(GridSettings.prototype, expandType(userSettings));
this.rootElement = rootElement;
this.isHotTableEnv = dom.isChildOfWebComponentTable(this.rootElement);
Handsontable.eventManager.isHotTableEnv = this.isHotTableEnv;
this.container = document.createElement('DIV');
rootElement.insertBefore(this.container, rootElement.firstChild);
this.guid = 'ht_' + helper.randomString();
if (!this.rootElement.id || this.rootElement.id.substring(0, 3) === "ht_") {
this.rootElement.id = this.guid;
}
priv = {
cellSettings: [],
columnSettings: [],
columnsSettingConflicts: ['data', 'width'],
settings: new GridSettings(),
selRange: null,
isPopulated: null,
scrollable: null,
firstRun: true
};
grid = {
alter: function(action, index, amount, source, keepEmptyRows) {
var delta;
amount = amount || 1;
switch (action) {
case "insert_row":
if (instance.getSettings().maxRows === instance.countRows()) {
return;
}
delta = datamap.createRow(index, amount);
if (delta) {
if (selection.isSelected() && priv.selRange.from.row >= index) {
priv.selRange.from.row = priv.selRange.from.row + delta;
selection.transformEnd(delta, 0);
} else {
selection.refreshBorders();
}
}
break;
case "insert_col":
delta = datamap.createCol(index, amount);
if (delta) {
if (Array.isArray(instance.getSettings().colHeaders)) {
var spliceArray = [index, 0];
spliceArray.length += delta;
Array.prototype.splice.apply(instance.getSettings().colHeaders, spliceArray);
}
if (selection.isSelected() && priv.selRange.from.col >= index) {
priv.selRange.from.col = priv.selRange.from.col + delta;
selection.transformEnd(0, delta);
} else {
selection.refreshBorders();
}
}
break;
case "remove_row":
index = instance.runHooks('modifyCol', index);
datamap.removeRow(index, amount);
priv.cellSettings.splice(index, amount);
var fixedRowsTop = instance.getSettings().fixedRowsTop;
if (fixedRowsTop >= index + 1) {
instance.getSettings().fixedRowsTop -= Math.min(amount, fixedRowsTop - index);
}
grid.adjustRowsAndCols();
selection.refreshBorders();
break;
case "remove_col":
datamap.removeCol(index, amount);
for (var row = 0,
len = datamap.getAll().length; row < len; row++) {
if (row in priv.cellSettings) {
priv.cellSettings[row].splice(index, amount);
}
}
var fixedColumnsLeft = instance.getSettings().fixedColumnsLeft;
if (fixedColumnsLeft >= index + 1) {
instance.getSettings().fixedColumnsLeft -= Math.min(amount, fixedColumnsLeft - index);
}
if (Array.isArray(instance.getSettings().colHeaders)) {
if (typeof index == 'undefined') {
index = -1;
}
instance.getSettings().colHeaders.splice(index, amount);
}
grid.adjustRowsAndCols();
selection.refreshBorders();
break;
default:
throw new Error('There is no such action "' + action + '"');
break;
}
if (!keepEmptyRows) {
grid.adjustRowsAndCols();
}
},
adjustRowsAndCols: function() {
if (priv.settings.minRows) {
var rows = instance.countRows();
if (rows < priv.settings.minRows) {
for (var r = 0,
minRows = priv.settings.minRows; r < minRows - rows; r++) {
datamap.createRow(instance.countRows(), 1, true);
}
}
}
if (priv.settings.minSpareRows) {
var emptyRows = instance.countEmptyRows(true);
if (emptyRows < priv.settings.minSpareRows) {
for (; emptyRows < priv.settings.minSpareRows && instance.countRows() < priv.settings.maxRows; emptyRows++) {
datamap.createRow(instance.countRows(), 1, true);
}
}
}
{
var emptyCols;
if (priv.settings.minCols || priv.settings.minSpareCols) {
emptyCols = instance.countEmptyCols(true);
}
if (priv.settings.minCols && !priv.settings.columns && instance.countCols() < priv.settings.minCols) {
for (; instance.countCols() < priv.settings.minCols; emptyCols++) {
datamap.createCol(instance.countCols(), 1, true);
}
}
if (priv.settings.minSpareCols && !priv.settings.columns && instance.dataType === 'array' && emptyCols < priv.settings.minSpareCols) {
for (; emptyCols < priv.settings.minSpareCols && instance.countCols() < priv.settings.maxCols; emptyCols++) {
datamap.createCol(instance.countCols(), 1, true);
}
}
}
var rowCount = instance.countRows();
var colCount = instance.countCols();
if (rowCount === 0 || colCount === 0) {
selection.deselect();
}
if (selection.isSelected()) {
var selectionChanged = false;
var fromRow = priv.selRange.from.row;
var fromCol = priv.selRange.from.col;
var toRow = priv.selRange.to.row;
var toCol = priv.selRange.to.col;
if (fromRow > rowCount - 1) {
fromRow = rowCount - 1;
selectionChanged = true;
if (toRow > fromRow) {
toRow = fromRow;
}
} else if (toRow > rowCount - 1) {
toRow = rowCount - 1;
selectionChanged = true;
if (fromRow > toRow) {
fromRow = toRow;
}
}
if (fromCol > colCount - 1) {
fromCol = colCount - 1;
selectionChanged = true;
if (toCol > fromCol) {
toCol = fromCol;
}
} else if (toCol > colCount - 1) {
toCol = colCount - 1;
selectionChanged = true;
if (fromCol > toCol) {
fromCol = toCol;
}
}
if (selectionChanged) {
instance.selectCell(fromRow, fromCol, toRow, toCol);
}
}
if (instance.view) {
instance.view.wt.wtOverlays.adjustElementsSize();
}
},
populateFromArray: function(start, input, end, source, method, direction, deltas) {
var r,
rlen,
c,
clen,
setData = [],
current = {};
rlen = input.length;
if (rlen === 0) {
return false;
}
var repeatCol,
repeatRow,
cmax,
rmax;
switch (method) {
case 'shift_down':
repeatCol = end ? end.col - start.col + 1 : 0;
repeatRow = end ? end.row - start.row + 1 : 0;
input = helper.translateRowsToColumns(input);
for (c = 0, clen = input.length, cmax = Math.max(clen, repeatCol); c < cmax; c++) {
if (c < clen) {
for (r = 0, rlen = input[c].length; r < repeatRow - rlen; r++) {
input[c].push(input[c][r % rlen]);
}
input[c].unshift(start.col + c, start.row, 0);
instance.spliceCol.apply(instance, input[c]);
} else {
input[c % clen][0] = start.col + c;
instance.spliceCol.apply(instance, input[c % clen]);
}
}
break;
case 'shift_right':
repeatCol = end ? end.col - start.col + 1 : 0;
repeatRow = end ? end.row - start.row + 1 : 0;
for (r = 0, rlen = input.length, rmax = Math.max(rlen, repeatRow); r < rmax; r++) {
if (r < rlen) {
for (c = 0, clen = input[r].length; c < repeatCol - clen; c++) {
input[r].push(input[r][c % clen]);
}
input[r].unshift(start.row + r, start.col, 0);
instance.spliceRow.apply(instance, input[r]);
} else {
input[r % rlen][0] = start.row + r;
instance.spliceRow.apply(instance, input[r % rlen]);
}
}
break;
case 'overwrite':
default:
current.row = start.row;
current.col = start.col;
var iterators = {
row: 0,
col: 0
},
selected = {
row: (end && start) ? (end.row - start.row + 1) : 1,
col: (end && start) ? (end.col - start.col + 1) : 1
},
pushData = true;
if (['up', 'left'].indexOf(direction) !== -1) {
iterators = {
row: Math.ceil(selected.row / rlen) || 1,
col: Math.ceil(selected.col / input[0].length) || 1
};
} else if (['down', 'right'].indexOf(direction) !== -1) {
iterators = {
row: 1,
col: 1
};
}
for (r = 0; r < rlen; r++) {
if ((end && current.row > end.row) || (!priv.settings.allowInsertRow && current.row > instance.countRows() - 1) || (current.row >= priv.settings.maxRows)) {
break;
}
current.col = start.col;
clen = input[r] ? input[r].length : 0;
for (c = 0; c < clen; c++) {
if ((end && current.col > end.col) || (!priv.settings.allowInsertColumn && current.col > instance.countCols() - 1) || (current.col >= priv.settings.maxCols)) {
break;
}
if (!instance.getCellMeta(current.row, current.col).readOnly) {
var result,
value = input[r][c],
orgValue = instance.getDataAtCell(current.row, current.col),
index = {
row: r,
col: c
},
valueSchema,
orgValueSchema;
if (source === 'autofill') {
result = instance.runHooks('beforeAutofillInsidePopulate', index, direction, input, deltas, iterators, selected);
if (result) {
iterators = typeof(result.iterators) !== 'undefined' ? result.iterators : iterators;
value = typeof(result.value) !== 'undefined' ? result.value : value;
}
}
if (value !== null && typeof value === 'object') {
if (orgValue === null || typeof orgValue !== 'object') {
pushData = false;
} else {
orgValueSchema = Handsontable.helper.duckSchema(orgValue[0] || orgValue);
valueSchema = Handsontable.helper.duckSchema(value[0] || value);
if (Handsontable.helper.isObjectEquals(orgValueSchema, valueSchema)) {
value = Handsontable.helper.deepClone(value);
} else {
pushData = false;
}
}
} else if (orgValue !== null && typeof orgValue === 'object') {
pushData = false;
}
if (pushData) {
setData.push([current.row, current.col, value]);
}
pushData = true;
}
current.col++;
if (end && c === clen - 1) {
c = -1;
if (['down', 'right'].indexOf(direction) !== -1) {
iterators.col++;
} else if (['up', 'left'].indexOf(direction) !== -1) {
if (iterators.col > 1) {
iterators.col--;
}
}
}
}
current.row++;
iterators.col = 1;
if (end && r === rlen - 1) {
r = -1;
if (['down', 'right'].indexOf(direction) !== -1) {
iterators.row++;
} else if (['up', 'left'].indexOf(direction) !== -1) {
if (iterators.row > 1) {
iterators.row--;
}
}
}
}
instance.setDataAtCell(setData, null, null, source || 'populateFromArray');
break;
}
}
};
this.selection = selection = {
inProgress: false,
selectedHeader: {
cols: false,
rows: false
},
setSelectedHeaders: function(rows, cols) {
instance.selection.selectedHeader.rows = rows;
instance.selection.selectedHeader.cols = cols;
},
begin: function() {
instance.selection.inProgress = true;
},
finish: function() {
var sel = instance.getSelected();
Handsontable.hooks.run(instance, "afterSelectionEnd", sel[0], sel[1], sel[2], sel[3]);
Handsontable.hooks.run(instance, "afterSelectionEndByProp", sel[0], instance.colToProp(sel[1]), sel[2], instance.colToProp(sel[3]));
instance.selection.inProgress = false;
},
isInProgress: function() {
return instance.selection.inProgress;
},
setRangeStart: function(coords, keepEditorOpened) {
Handsontable.hooks.run(instance, "beforeSetRangeStart", coords);
priv.selRange = new WalkontableCellRange(coords, coords, coords);
selection.setRangeEnd(coords, null, keepEditorOpened);
},
setRangeEnd: function(coords, scrollToCell, keepEditorOpened) {
if (priv.selRange === null) {
return;
}
var disableVisualSelection;
Handsontable.hooks.run(instance, "beforeSetRangeEnd", coords);
instance.selection.begin();
priv.selRange.to = new WalkontableCellCoords(coords.row, coords.col);
if (!priv.settings.multiSelect) {
priv.selRange.from = coords;
}
instance.view.wt.selections.current.clear();
disableVisualSelection = instance.getCellMeta(priv.selRange.highlight.row, priv.selRange.highlight.col).disableVisualSelection;
if (typeof disableVisualSelection === 'string') {
disableVisualSelection = [disableVisualSelection];
}
if (disableVisualSelection === false || Array.isArray(disableVisualSelection) && disableVisualSelection.indexOf('current') === -1) {
instance.view.wt.selections.current.add(priv.selRange.highlight);
}
instance.view.wt.selections.area.clear();
if ((disableVisualSelection === false || Array.isArray(disableVisualSelection) && disableVisualSelection.indexOf('area') === -1) && selection.isMultiple()) {
instance.view.wt.selections.area.add(priv.selRange.from);
instance.view.wt.selections.area.add(priv.selRange.to);
}
if (priv.settings.currentRowClassName || priv.settings.currentColClassName) {
instance.view.wt.selections.highlight.clear();
instance.view.wt.selections.highlight.add(priv.selRange.from);
instance.view.wt.selections.highlight.add(priv.selRange.to);
}
Handsontable.hooks.run(instance, "afterSelection", priv.selRange.from.row, priv.selRange.from.col, priv.selRange.to.row, priv.selRange.to.col);
Handsontable.hooks.run(instance, "afterSelectionByProp", priv.selRange.from.row, datamap.colToProp(priv.selRange.from.col), priv.selRange.to.row, datamap.colToProp(priv.selRange.to.col));
if (scrollToCell !== false && instance.view.mainViewIsActive()) {
if (priv.selRange.from && !selection.isMultiple()) {
instance.view.scrollViewport(priv.selRange.from);
} else {
instance.view.scrollViewport(coords);
}
}
selection.refreshBorders(null, keepEditorOpened);
},
refreshBorders: function(revertOriginal, keepEditor) {
if (!keepEditor) {
editorManager.destroyEditor(revertOriginal);
}
instance.view.render();
if (selection.isSelected() && !keepEditor) {
editorManager.prepareEditor();
}
},
isMultiple: function() {
var isMultiple = !(priv.selRange.to.col === priv.selRange.from.col && priv.selRange.to.row === priv.selRange.from.row),
modifier = Handsontable.hooks.run(instance, 'afterIsMultipleSelection', isMultiple);
if (isMultiple) {
return modifier;
}
},
transformStart: function(rowDelta, colDelta, force, keepEditorOpened) {
var delta = new WalkontableCellCoords(rowDelta, colDelta),
rowTransformDir = 0,
colTransformDir = 0,
totalRows,
totalCols,
coords;
instance.runHooks('modifyTransformStart', delta);
totalRows = instance.countRows();
totalCols = instance.countCols();
if (priv.selRange.highlight.row + rowDelta > totalRows - 1) {
if (force && priv.settings.minSpareRows > 0) {
instance.alter("insert_row", totalRows);
totalRows = instance.countRows();
} else if (priv.settings.autoWrapCol) {
delta.row = 1 - totalRows;
delta.col = priv.selRange.highlight.col + delta.col == totalCols - 1 ? 1 - totalCols : 1;
}
} else if (priv.settings.autoWrapCol && priv.selRange.highlight.row + delta.row < 0 && priv.selRange.highlight.col + delta.col >= 0) {
delta.row = totalRows - 1;
delta.col = priv.selRange.highlight.col + delta.col == 0 ? totalCols - 1 : -1;
}
if (priv.selRange.highlight.col + delta.col > totalCols - 1) {
if (force && priv.settings.minSpareCols > 0) {
instance.alter("insert_col", totalCols);
totalCols = instance.countCols();
} else if (priv.settings.autoWrapRow) {
delta.row = priv.selRange.highlight.row + delta.row == totalRows - 1 ? 1 - totalRows : 1;
delta.col = 1 - totalCols;
}
} else if (priv.settings.autoWrapRow && priv.selRange.highlight.col + delta.col < 0 && priv.selRange.highlight.row + delta.row >= 0) {
delta.row = priv.selRange.highlight.row + delta.row == 0 ? totalRows - 1 : -1;
delta.col = totalCols - 1;
}
coords = new WalkontableCellCoords(priv.selRange.highlight.row + delta.row, priv.selRange.highlight.col + delta.col);
if (coords.row < 0) {
rowTransformDir = -1;
coords.row = 0;
} else if (coords.row > 0 && coords.row >= totalRows) {
rowTransformDir = 1;
coords.row = totalRows - 1;
}
if (coords.col < 0) {
colTransformDir = -1;
coords.col = 0;
} else if (coords.col > 0 && coords.col >= totalCols) {
colTransformDir = 1;
coords.col = totalCols - 1;
}
instance.runHooks('afterModifyTransformStart', coords, rowTransformDir, colTransformDir);
selection.setRangeStart(coords, keepEditorOpened);
},
transformEnd: function(rowDelta, colDelta) {
var delta = new WalkontableCellCoords(rowDelta, colDelta),
rowTransformDir = 0,
colTransformDir = 0,
totalRows,
totalCols,
coords;
instance.runHooks('modifyTransformEnd', delta);
totalRows = instance.countRows();
totalCols = instance.countCols();
coords = new WalkontableCellCoords(priv.selRange.to.row + delta.row, priv.selRange.to.col + delta.col);
if (coords.row < 0) {
rowTransformDir = -1;
coords.row = 0;
} else if (coords.row > 0 && coords.row >= totalRows) {
rowTransformDir = 1;
coords.row = totalRows - 1;
}
if (coords.col < 0) {
colTransformDir = -1;
coords.col = 0;
} else if (coords.col > 0 && coords.col >= totalCols) {
colTransformDir = 1;
coords.col = totalCols - 1;
}
instance.runHooks('afterModifyTransformEnd', coords, rowTransformDir, colTransformDir);
selection.setRangeEnd(coords, true);
},
isSelected: function() {
return (priv.selRange !== null);
},
inInSelection: function(coords) {
if (!selection.isSelected()) {
return false;
}
return priv.selRange.includes(coords);
},
deselect: function() {
if (!selection.isSelected()) {
return;
}
instance.selection.inProgress = false;
priv.selRange = null;
instance.view.wt.selections.current.clear();
instance.view.wt.selections.area.clear();
if (priv.settings.currentRowClassName || priv.settings.currentColClassName) {
instance.view.wt.selections.highlight.clear();
}
editorManager.destroyEditor();
selection.refreshBorders();
Handsontable.hooks.run(instance, 'afterDeselect');
},
selectAll: function() {
if (!priv.settings.multiSelect) {
return;
}
selection.setRangeStart(new WalkontableCellCoords(0, 0));
selection.setRangeEnd(new WalkontableCellCoords(instance.countRows() - 1, instance.countCols() - 1), false);
},
empty: function() {
if (!selection.isSelected()) {
return;
}
var topLeft = priv.selRange.getTopLeftCorner();
var bottomRight = priv.selRange.getBottomRightCorner();
var r,
c,
changes = [];
for (r = topLeft.row; r <= bottomRight.row; r++) {
for (c = topLeft.col; c <= bottomRight.col; c++) {
if (!instance.getCellMeta(r, c).readOnly) {
changes.push([r, c, '']);
}
}
}
instance.setDataAtCell(changes);
}
};
this.init = function() {
Handsontable.hooks.run(instance, 'beforeInit');
if (Handsontable.mobileBrowser) {
dom.addClass(instance.rootElement, 'mobile');
}
this.updateSettings(priv.settings, true);
this.view = new TableView(this);
editorManager = new EditorManager(instance, priv, selection, datamap);
this.forceFullRender = true;
this.view.render();
if (typeof priv.firstRun === 'object') {
Handsontable.hooks.run(instance, 'afterChange', priv.firstRun[0], priv.firstRun[1]);
priv.firstRun = false;
}
Handsontable.hooks.run(instance, 'afterInit');
};
function ValidatorsQueue() {
var resolved = false;
return {
validatorsInQueue: 0,
addValidatorToQueue: function() {
this.validatorsInQueue++;
resolved = false;
},
removeValidatorFormQueue: function() {
this.validatorsInQueue = this.validatorsInQueue - 1 < 0 ? 0 : this.validatorsInQueue - 1;
this.checkIfQueueIsEmpty();
},
onQueueEmpty: function() {},
checkIfQueueIsEmpty: function() {
if (this.validatorsInQueue == 0 && resolved == false) {
resolved = true;
this.onQueueEmpty();
}
}
};
}
function validateChanges(changes, source, callback) {
var waitingForValidator = new ValidatorsQueue();
waitingForValidator.onQueueEmpty = resolve;
for (var i = changes.length - 1; i >= 0; i--) {
if (changes[i] === null) {
changes.splice(i, 1);
} else {
var row = changes[i][0];
var col = datamap.propToCol(changes[i][1]);
var logicalCol = instance.runHooks('modifyCol', col);
var cellProperties = instance.getCellMeta(row, logicalCol);
if (cellProperties.type === 'numeric' && typeof changes[i][3] === 'string') {
if (changes[i][3].length > 0 && (/^-?[\d\s]*(\.|\,)?\d*$/.test(changes[i][3]) || cellProperties.format)) {
var len = changes[i][3].length;
if (typeof cellProperties.language == 'undefined') {
numeral.language('en');
} else if (changes[i][3].indexOf(".") === len - 3 && changes[i][3].indexOf(",") === -1) {
numeral.language('en');
} else {
numeral.language(cellProperties.language);
}
if (numeral.validate(changes[i][3])) {
changes[i][3] = numeral().unformat(changes[i][3]);
}
}
}
if (instance.getCellValidator(cellProperties)) {
waitingForValidator.addValidatorToQueue();
instance.validateCell(changes[i][3], cellProperties, (function(i, cellProperties) {
return function(result) {
if (typeof result !== 'boolean') {
throw new Error("Validation error: result is not boolean");
}
if (result === false && cellProperties.allowInvalid === false) {
changes.splice(i, 1);
cellProperties.valid = true;
--i;
}
waitingForValidator.removeValidatorFormQueue();
};
})(i, cellProperties), source);
}
}
}
waitingForValidator.checkIfQueueIsEmpty();
function resolve() {
var beforeChangeResult;
if (changes.length) {
beforeChangeResult = Handsontable.hooks.run(instance, "beforeChange", changes, source);
if (typeof beforeChangeResult === 'function') {
console.warn("Your beforeChange callback returns a function. It's not supported since Handsontable 0.12.1 (and the returned function will not be executed).");
} else if (beforeChangeResult === false) {
changes.splice(0, changes.length);
}
}
callback();
}
}
function applyChanges(changes, source) {
var i = changes.length - 1;
if (i < 0) {
return;
}
for (; 0 <= i; i--) {
if (changes[i] === null) {
changes.splice(i, 1);
continue;
}
if (changes[i][2] == null && changes[i][3] == null) {
continue;
}
if (priv.settings.allowInsertRow) {
while (changes[i][0] > instance.countRows() - 1) {
datamap.createRow();
}
}
if (instance.dataType === 'array' && priv.settings.allowInsertColumn) {
while (datamap.propToCol(changes[i][1]) > instance.countCols() - 1) {
datamap.createCol();
}
}
datamap.set(changes[i][0], changes[i][1], changes[i][3]);
}
instance.forceFullRender = true;
grid.adjustRowsAndCols();
Handsontable.hooks.run(instance, 'beforeChangeRender', changes, source);
selection.refreshBorders(null, true);
Handsontable.hooks.run(instance, 'afterChange', changes, source || 'edit');
}
this.validateCell = function(value, cellProperties, callback, source) {
var validator = instance.getCellValidator(cellProperties);
function done(valid) {
var col = cellProperties.col,
row = cellProperties.row,
td = instance.getCell(row, col, true);
if (td) {
instance.view.wt.wtSettings.settings.cellRenderer(row, col, td);
}
callback(valid);
}
if (Object.prototype.toString.call(validator) === '[object RegExp]') {
validator = (function(validator) {
return function(value, callback) {
callback(validator.test(value));
};
})(validator);
}
if (typeof validator == 'function') {
value = Handsontable.hooks.run(instance, "beforeValidate", value, cellProperties.row, cellProperties.prop, source);
instance._registerTimeout(setTimeout(function() {
validator.call(cellProperties, value, function(valid) {
valid = Handsontable.hooks.run(instance, "afterValidate", valid, value, cellProperties.row, cellProperties.prop, source);
cellProperties.valid = valid;
done(valid);
Handsontable.hooks.run(instance, "postAfterValidate", valid, value, cellProperties.row, cellProperties.prop, source);
});
}, 0));
} else {
cellProperties.valid = true;
done(cellProperties.valid);
}
};
function setDataInputToArray(row, propOrCol, value) {
if (typeof row === "object") {
return row;
} else {
return [[row, propOrCol, value]];
}
}
this.setDataAtCell = function(row, col, value, source) {
var input = setDataInputToArray(row, col, value),
i,
ilen,
changes = [],
prop;
for (i = 0, ilen = input.length; i < ilen; i++) {
if (typeof input[i] !== 'object') {
throw new Error('Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter');
}
if (typeof input[i][1] !== 'number') {
throw new Error('Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`');
}
prop = datamap.colToProp(input[i][1]);
changes.push([input[i][0], prop, datamap.get(input[i][0], prop), input[i][2]]);
}
if (!source && typeof row === "object") {
source = col;
}
validateChanges(changes, source, function() {
applyChanges(changes, source);
});
};
this.setDataAtRowProp = function(row, prop, value, source) {
var input = setDataInputToArray(row, prop, value),
i,
ilen,
changes = [];
for (i = 0, ilen = input.length; i < ilen; i++) {
changes.push([input[i][0], input[i][1], datamap.get(input[i][0], input[i][1]), input[i][2]]);
}
if (!source && typeof row === "object") {
source = prop;
}
validateChanges(changes, source, function() {
applyChanges(changes, source);
});
};
this.listen = function() {
Handsontable.activeGuid = instance.guid;
if (document.activeElement && document.activeElement !== document.body) {
document.activeElement.blur();
} else if (!document.activeElement) {
document.body.focus();
}
};
this.unlisten = function() {
Handsontable.activeGuid = null;
};
this.isListening = function() {
return Handsontable.activeGuid === instance.guid;
};
this.destroyEditor = function(revertOriginal) {
selection.refreshBorders(revertOriginal);
};
this.populateFromArray = function(row, col, input, endRow, endCol, source, method, direction, deltas) {
var c;
if (!(typeof input === 'object' && typeof input[0] === 'object')) {
throw new Error("populateFromArray parameter `input` must be an array of arrays");
}
c = typeof endRow === 'number' ? new WalkontableCellCoords(endRow, endCol) : null;
return grid.populateFromArray(new WalkontableCellCoords(row, col), input, c, source, method, direction, deltas);
};
this.spliceCol = function(col, index, amount) {
return datamap.spliceCol.apply(datamap, arguments);
};
this.spliceRow = function(row, index, amount) {
return datamap.spliceRow.apply(datamap, arguments);
};
this.getSelected = function() {
if (selection.isSelected()) {
return [priv.selRange.from.row, priv.selRange.from.col, priv.selRange.to.row, priv.selRange.to.col];
}
};
this.getSelectedRange = function() {
if (selection.isSelected()) {
return priv.selRange;
}
};
this.render = function() {
if (instance.view) {
instance.forceFullRender = true;
selection.refreshBorders(null, true);
}
};
this.loadData = function(data) {
if (typeof data === 'object' && data !== null) {
if (!(data.push && data.splice)) {
data = [data];
}
} else if (data === null) {
data = [];
var row;
for (var r = 0,
rlen = priv.settings.startRows; r < rlen; r++) {
row = [];
for (var c = 0,
clen = priv.settings.startCols; c < clen; c++) {
row.push(null);
}
data.push(row);
}
} else {
throw new Error("loadData only accepts array of objects or array of arrays (" + typeof data + " given)");
}
priv.isPopulated = false;
GridSettings.prototype.data = data;
if (Array.isArray(priv.settings.dataSchema) || Array.isArray(data[0])) {
instance.dataType = 'array';
} else if (typeof priv.settings.dataSchema === 'function') {
instance.dataType = 'function';
} else {
instance.dataType = 'object';
}
datamap = new DataMap(instance, priv, GridSettings);
clearCellSettingCache();
grid.adjustRowsAndCols();
Handsontable.hooks.run(instance, 'afterLoadData');
if (priv.firstRun) {
priv.firstRun = [null, 'loadData'];
} else {
Handsontable.hooks.run(instance, 'afterChange', null, 'loadData');
instance.render();
}
priv.isPopulated = true;
function clearCellSettingCache() {
priv.cellSettings.length = 0;
}
};
this.getData = function(r, c, r2, c2) {
if (typeof r === 'undefined') {
return datamap.getAll();
} else {
return datamap.getRange(new WalkontableCellCoords(r, c), new WalkontableCellCoords(r2, c2), datamap.DESTINATION_RENDERER);
}
};
this.getCopyableData = function(startRow, startCol, endRow, endCol) {
return datamap.getCopyableText(new WalkontableCellCoords(startRow, startCol), new WalkontableCellCoords(endRow, endCol));
};
this.getSchema = function() {
return datamap.getSchema();
};
this.updateSettings = function(settings, init) {
var i,
clen;
if (typeof settings.rows !== "undefined") {
throw new Error("'rows' setting is no longer supported. do you mean startRows, minRows or maxRows?");
}
if (typeof settings.cols !== "undefined") {
throw new Error("'cols' setting is no longer supported. do you mean startCols, minCols or maxCols?");
}
for (i in settings) {
if (i === 'data') {
continue;
} else {
if (Handsontable.hooks.getRegistered().indexOf(i) > -1) {
if (typeof settings[i] === 'function' || Array.isArray(settings[i])) {
instance.addHook(i, settings[i]);
}
} else {
if (!init && settings.hasOwnProperty(i)) {
GridSettings.prototype[i] = settings[i];
}
}
}
}
if (settings.data === void 0 && priv.settings.data === void 0) {
instance.loadData(null);
} else if (settings.data !== void 0) {
instance.loadData(settings.data);
} else if (settings.columns !== void 0) {
datamap.createMap();
}
clen = instance.countCols();
priv.cellSettings.length = 0;
if (clen > 0) {
var proto,
column;
for (i = 0; i < clen; i++) {
priv.columnSettings[i] = helper.columnFactory(GridSettings, priv.columnsSettingConflicts);
proto = priv.columnSettings[i].prototype;
if (GridSettings.prototype.columns) {
column = GridSettings.prototype.columns[i];
helper.extend(proto, column);
helper.extend(proto, expandType(column));
}
}
}
if (typeof settings.cell !== 'undefined') {
for (i in settings.cell) {
if (settings.cell.hasOwnProperty(i)) {
var cell = settings.cell[i];
instance.setCellMetaObject(cell.row, cell.col, cell);
}
}
}
Handsontable.hooks.run(instance, 'afterCellMetaReset');
if (typeof settings.className !== "undefined") {
if (GridSettings.prototype.className) {
dom.removeClass(instance.rootElement, GridSettings.prototype.className);
}
if (settings.className) {
dom.addClass(instance.rootElement, settings.className);
}
}
if (typeof settings.height != 'undefined') {
var height = settings.height;
if (typeof height == 'function') {
height = height();
}
instance.rootElement.style.height = height + 'px';
}
if (typeof settings.width != 'undefined') {
var width = settings.width;
if (typeof width == 'function') {
width = width();
}
instance.rootElement.style.width = width + 'px';
}
if (height) {
instance.rootElement.style.overflow = 'hidden';
}
if (!init) {
Handsontable.hooks.run(instance, 'afterUpdateSettings');
}
grid.adjustRowsAndCols();
if (instance.view && !priv.firstRun) {
instance.forceFullRender = true;
selection.refreshBorders(null, true);
}
};
this.getValue = function() {
var sel = instance.getSelected();
if (GridSettings.prototype.getValue) {
if (typeof GridSettings.prototype.getValue === 'function') {
return GridSettings.prototype.getValue.call(instance);
} else if (sel) {
return instance.getData()[sel[0]][GridSettings.prototype.getValue];
}
} else if (sel) {
return instance.getDataAtCell(sel[0], sel[1]);
}
};
function expandType(obj) {
if (!obj.hasOwnProperty('type')) {
return;
}
var type,
expandedType = {};
if (typeof obj.type === 'object') {
type = obj.type;
} else if (typeof obj.type === 'string') {
type = Handsontable.cellTypes[obj.type];
if (type === void 0) {
throw new Error('You declared cell type "' + obj.type + '" as a string that is not mapped to a known object. Cell type must be an object or a string mapped to an object in Handsontable.cellTypes');
}
}
for (var i in type) {
if (type.hasOwnProperty(i) && !obj.hasOwnProperty(i)) {
expandedType[i] = type[i];
}
}
return expandedType;
}
this.getSettings = function() {
return priv.settings;
};
this.clear = function() {
selection.selectAll();
selection.empty();
};
this.alter = function(action, index, amount, source, keepEmptyRows) {
grid.alter(action, index, amount, source, keepEmptyRows);
};
this.getCell = function(row, col, topmost) {
return instance.view.getCellAtCoords(new WalkontableCellCoords(row, col), topmost);
};
this.getCoords = function(elem) {
return this.view.wt.wtTable.getCoords.call(this.view.wt.wtTable, elem);
};
this.colToProp = function(col) {
return datamap.colToProp(col);
};
this.propToCol = function(prop) {
return datamap.propToCol(prop);
};
this.getDataAtCell = function(row, col) {
return datamap.get(row, datamap.colToProp(col));
};
this.getDataAtRowProp = function(row, prop) {
return datamap.get(row, prop);
};
this.getDataAtCol = function(col) {
var out = [];
return out.concat.apply(out, datamap.getRange(new WalkontableCellCoords(0, col), new WalkontableCellCoords(priv.settings.data.length - 1, col), datamap.DESTINATION_RENDERER));
};
this.getDataAtProp = function(prop) {
var out = [],
range;
range = datamap.getRange(new WalkontableCellCoords(0, datamap.propToCol(prop)), new WalkontableCellCoords(priv.settings.data.length - 1, datamap.propToCol(prop)), datamap.DESTINATION_RENDERER);
return out.concat.apply(out, range);
};
this.getSourceDataAtCol = function(col) {
var out = [],
data = priv.settings.data;
for (var i = 0; i < data.length; i++) {
out.push(data[i][col]);
}
return out;
};
this.getSourceDataAtRow = function(row) {
return priv.settings.data[row];
};
this.getDataAtRow = function(row) {
var data = datamap.getRange(new WalkontableCellCoords(row, 0), new WalkontableCellCoords(row, this.countCols() - 1), datamap.DESTINATION_RENDERER);
return data[0];
};
this.removeCellMeta = function(row, col, key) {
var cellMeta = instance.getCellMeta(row, col);
if (cellMeta[key] != undefined) {
delete priv.cellSettings[row][col][key];
}
};
this.setCellMetaObject = function(row, col, prop) {
if (typeof prop === 'object') {
for (var key in prop) {
if (prop.hasOwnProperty(key)) {
var value = prop[key];
this.setCellMeta(row, col, key, value);
}
}
}
};
this.setCellMeta = function(row, col, key, val) {
if (!priv.cellSettings[row]) {
priv.cellSettings[row] = [];
}
if (!priv.cellSettings[row][col]) {
priv.cellSettings[row][col] = new priv.columnSettings[col]();
}
priv.cellSettings[row][col][key] = val;
Handsontable.hooks.run(instance, 'afterSetCellMeta', row, col, key, val);
};
this.getCellMeta = function(row, col) {
var prop = datamap.colToProp(col),
cellProperties;
row = translateRowIndex(row);
col = translateColIndex(col);
if (!priv.columnSettings[col]) {
priv.columnSettings[col] = helper.columnFactory(GridSettings, priv.columnsSettingConflicts);
}
if (!priv.cellSettings[row]) {
priv.cellSettings[row] = [];
}
if (!priv.cellSettings[row][col]) {
priv.cellSettings[row][col] = new priv.columnSettings[col]();
}
cellProperties = priv.cellSettings[row][col];
cellProperties.row = row;
cellProperties.col = col;
cellProperties.prop = prop;
cellProperties.instance = instance;
Handsontable.hooks.run(instance, 'beforeGetCellMeta', row, col, cellProperties);
helper.extend(cellProperties, expandType(cellProperties));
if (cellProperties.cells) {
var settings = cellProperties.cells.call(cellProperties, row, col, prop);
if (settings) {
helper.extend(cellProperties, settings);
helper.extend(cellProperties, expandType(settings));
}
}
Handsontable.hooks.run(instance, 'afterGetCellMeta', row, col, cellProperties);
return cellProperties;
};
this.isColumnModificationAllowed = function() {
return !(instance.dataType === 'object' || instance.getSettings().columns);
};
function translateRowIndex(row) {
return Handsontable.hooks.run(instance, 'modifyRow', row);
}
function translateColIndex(col) {
return Handsontable.hooks.run(instance, 'modifyCol', col);
}
var rendererLookup = helper.cellMethodLookupFactory('renderer');
this.getCellRenderer = function(row, col) {
var renderer = rendererLookup.call(this, row, col);
return getRenderer(renderer);
};
this.getCellEditor = helper.cellMethodLookupFactory('editor');
this.getCellValidator = helper.cellMethodLookupFactory('validator');
this.validateCells = function(callback) {
var waitingForValidator = new ValidatorsQueue();
waitingForValidator.onQueueEmpty = callback;
var i = instance.countRows() - 1;
while (i >= 0) {
var j = instance.countCols() - 1;
while (j >= 0) {
waitingForValidator.addValidatorToQueue();
instance.validateCell(instance.getDataAtCell(i, j), instance.getCellMeta(i, j), function() {
waitingForValidator.removeValidatorFormQueue();
}, 'validateCells');
j--;
}
i--;
}
waitingForValidator.checkIfQueueIsEmpty();
};
this.getRowHeader = function(row) {
if (row === void 0) {
var out = [];
for (var i = 0,
ilen = instance.countRows(); i < ilen; i++) {
out.push(instance.getRowHeader(i));
}
return out;
} else if (Array.isArray(priv.settings.rowHeaders) && priv.settings.rowHeaders[row] !== void 0) {
return priv.settings.rowHeaders[row];
} else if (typeof priv.settings.rowHeaders === 'function') {
return priv.settings.rowHeaders(row);
} else if (priv.settings.rowHeaders && typeof priv.settings.rowHeaders !== 'string' && typeof priv.settings.rowHeaders !== 'number') {
return row + 1;
} else {
return priv.settings.rowHeaders;
}
};
this.hasRowHeaders = function() {
return !!priv.settings.rowHeaders;
};
this.hasColHeaders = function() {
if (priv.settings.colHeaders !== void 0 && priv.settings.colHeaders !== null) {
return !!priv.settings.colHeaders;
}
for (var i = 0,
ilen = instance.countCols(); i < ilen; i++) {
if (instance.getColHeader(i)) {
return true;
}
}
return false;
};
this.getColHeader = function(col) {
if (col === void 0) {
var out = [];
for (var i = 0,
ilen = instance.countCols(); i < ilen; i++) {
out.push(instance.getColHeader(i));
}
return out;
} else {
var baseCol = col;
col = Handsontable.hooks.run(instance, 'modifyCol', col);
if (priv.settings.columns && priv.settings.columns[col] && priv.settings.columns[col].title) {
return priv.settings.columns[col].title;
} else if (Array.isArray(priv.settings.colHeaders) && priv.settings.colHeaders[col] !== void 0) {
return priv.settings.colHeaders[col];
} else if (typeof priv.settings.colHeaders === 'function') {
return priv.settings.colHeaders(col);
} else if (priv.settings.colHeaders && typeof priv.settings.colHeaders !== 'string' && typeof priv.settings.colHeaders !== 'number') {
return helper.spreadsheetColumnLabel(baseCol);
} else {
return priv.settings.colHeaders;
}
}
};
this._getColWidthFromSettings = function(col) {
var cellProperties = instance.getCellMeta(0, col);
var width = cellProperties.width;
if (width === void 0 || width === priv.settings.width) {
width = cellProperties.colWidths;
}
if (width !== void 0 && width !== null) {
switch (typeof width) {
case 'object':
width = width[col];
break;
case 'function':
width = width(col);
break;
}
if (typeof width === 'string') {
width = parseInt(width, 10);
}
}
return width;
};
this.getColWidth = function(col) {
var width = instance._getColWidthFromSettings(col);
if (!width) {
width = 50;
}
width = Handsontable.hooks.run(instance, 'modifyColWidth', width, col);
return width;
};
this._getRowHeightFromSettings = function(row) {
var height = priv.settings.rowHeights;
if (height !== void 0 && height !== null) {
switch (typeof height) {
case 'object':
height = height[row];
break;
case 'function':
height = height(row);
break;
}
if (typeof height === 'string') {
height = parseInt(height, 10);
}
}
return height;
};
this.getRowHeight = function(row) {
var height = instance._getRowHeightFromSettings(row);
height = Handsontable.hooks.run(instance, 'modifyRowHeight', height, row);
return height;
};
this.countRows = function() {
return priv.settings.data.length;
};
this.countCols = function() {
if (instance.dataType === 'object' || instance.dataType === 'function') {
if (priv.settings.columns && priv.settings.columns.length) {
return priv.settings.columns.length;
} else {
return datamap.colToPropCache.length;
}
} else if (instance.dataType === 'array') {
if (priv.settings.columns && priv.settings.columns.length) {
return priv.settings.columns.length;
} else if (priv.settings.data && priv.settings.data[0] && priv.settings.data[0].length) {
return priv.settings.data[0].length;
} else {
return 0;
}
}
};
this.rowOffset = function() {
return instance.view.wt.wtTable.getFirstRenderedRow();
};
this.colOffset = function() {
return instance.view.wt.wtTable.getFirstRenderedColumn();
};
this.countRenderedRows = function() {
return instance.view.wt.drawn ? instance.view.wt.wtTable.getRenderedRowsCount() : -1;
};
this.countVisibleRows = function() {
return instance.view.wt.drawn ? instance.view.wt.wtTable.getVisibleRowsCount() : -1;
};
this.countRenderedCols = function() {
return instance.view.wt.drawn ? instance.view.wt.wtTable.getRenderedColumnsCount() : -1;
};
this.countVisibleCols = function() {
return instance.view.wt.drawn ? instance.view.wt.wtTable.getVisibleColumnsCount() : -1;
};
this.countEmptyRows = function(ending) {
var i = instance.countRows() - 1,
empty = 0,
row;
while (i >= 0) {
row = Handsontable.hooks.run(this, 'modifyRow', i);
if (instance.isEmptyRow(row)) {
empty++;
} else if (ending) {
break;
}
i--;
}
return empty;
};
this.countEmptyCols = function(ending) {
if (instance.countRows() < 1) {
return 0;
}
var i = instance.countCols() - 1,
empty = 0;
while (i >= 0) {
if (instance.isEmptyCol(i)) {
empty++;
} else if (ending) {
break;
}
i--;
}
return empty;
};
this.isEmptyRow = function(row) {
return priv.settings.isEmptyRow.call(instance, row);
};
this.isEmptyCol = function(col) {
return priv.settings.isEmptyCol.call(instance, col);
};
this.selectCell = function(row, col, endRow, endCol, scrollToCell, changeListener) {
var coords;
changeListener = typeof changeListener === 'undefined' || changeListener === true;
if (typeof row !== 'number' || row < 0 || row >= instance.countRows()) {
return false;
}
if (typeof col !== 'number' || col < 0 || col >= instance.countCols()) {
return false;
}
if (typeof endRow !== 'undefined') {
if (typeof endRow !== 'number' || endRow < 0 || endRow >= instance.countRows()) {
return false;
}
if (typeof endCol !== 'number' || endCol < 0 || endCol >= instance.countCols()) {
return false;
}
}
coords = new WalkontableCellCoords(row, col);
priv.selRange = new WalkontableCellRange(coords, coords, coords);
if (document.activeElement && document.activeElement !== document.documentElement && document.activeElement !== document.body) {
document.activeElement.blur();
}
if (changeListener) {
instance.listen();
}
if (typeof endRow === 'undefined') {
selection.setRangeEnd(priv.selRange.from, scrollToCell);
} else {
selection.setRangeEnd(new WalkontableCellCoords(endRow, endCol), scrollToCell);
}
instance.selection.finish();
return true;
};
this.selectCellByProp = function(row, prop, endRow, endProp, scrollToCell) {
arguments[1] = datamap.propToCol(arguments[1]);
if (typeof arguments[3] !== "undefined") {
arguments[3] = datamap.propToCol(arguments[3]);
}
return instance.selectCell.apply(instance, arguments);
};
this.deselectCell = function() {
selection.deselect();
};
this.destroy = function() {
instance._clearTimeouts();
if (instance.view) {
instance.view.destroy();
}
dom.empty(instance.rootElement);
eventManager.clear();
Handsontable.hooks.run(instance, 'afterDestroy');
Handsontable.hooks.destroy(instance);
for (var i in instance) {
if (instance.hasOwnProperty(i)) {
if (typeof instance[i] === "function") {
if (i !== "runHooks") {
instance[i] = postMortem;
}
} else if (i !== "guid") {
instance[i] = null;
}
}
}
priv = null;
datamap = null;
grid = null;
selection = null;
editorManager = null;
instance = null;
GridSettings = null;
};
function postMortem() {
throw new Error("This method cannot be called because this Handsontable instance has been destroyed");
}
this.getActiveEditor = function() {
return editorManager.getActiveEditor();
};
this.getPlugin = function(pluginName) {
return getPlugin(this, pluginName);
};
this.getInstance = function() {
return instance;
};
this.addHook = function(key, callback) {
Handsontable.hooks.add(key, callback, instance);
};
this.addHookOnce = function(key, callback) {
Handsontable.hooks.once(key, callback, instance);
};
this.removeHook = function(key, callback) {
Handsontable.hooks.remove(key, callback, instance);
};
this.runHooks = function(key, p1, p2, p3, p4, p5, p6) {
return Handsontable.hooks.run(instance, key, p1, p2, p3, p4, p5, p6);
};
this.timeouts = [];
this._registerTimeout = function(handle) {
this.timeouts.push(handle);
};
this._clearTimeouts = function() {
for (var i = 0,
ilen = this.timeouts.length; i < ilen; i++) {
clearTimeout(this.timeouts[i]);
}
};
this.version = Handsontable.version;
};
var DefaultSettings = function() {};
DefaultSettings.prototype = {
data: void 0,
dataSchema: void 0,
width: void 0,
height: void 0,
startRows: 5,
startCols: 5,
rowHeaders: null,
colHeaders: null,
colWidths: void 0,
columns: void 0,
cells: void 0,
cell: [],
comments: false,
customBorders: false,
minRows: 0,
minCols: 0,
maxRows: Infinity,
maxCols: Infinity,
minSpareRows: 0,
minSpareCols: 0,
allowInsertRow: true,
allowInsertColumn: true,
allowRemoveRow: true,
allowRemoveColumn: true,
multiSelect: true,
fillHandle: true,
fixedRowsTop: 0,
fixedColumnsLeft: 0,
outsideClickDeselects: true,
enterBeginsEditing: true,
enterMoves: {
row: 1,
col: 0
},
tabMoves: {
row: 0,
col: 1
},
autoWrapRow: false,
autoWrapCol: false,
copyRowsLimit: 1000,
copyColsLimit: 1000,
pasteMode: 'overwrite',
persistentState: false,
currentRowClassName: void 0,
currentColClassName: void 0,
stretchH: 'none',
isEmptyRow: function(row) {
var col,
colLen,
value,
meta;
for (col = 0, colLen = this.countCols(); col < colLen; col++) {
value = this.getDataAtCell(row, col);
if (value !== '' && value !== null && typeof value !== 'undefined') {
if (typeof value === 'object') {
meta = this.getCellMeta(row, col);
return helper.isObjectEquals(this.getSchema()[meta.prop], value);
}
return false;
}
}
return true;
},
isEmptyCol: function(col) {
var row,
rowLen,
value;
for (row = 0, rowLen = this.countRows(); row < rowLen; row++) {
value = this.getDataAtCell(row, col);
if (value !== '' && value !== null && typeof value !== 'undefined') {
return false;
}
}
return true;
},
observeDOMVisibility: true,
allowInvalid: true,
invalidCellClassName: 'htInvalid',
placeholder: false,
placeholderCellClassName: 'htPlaceholder',
readOnlyCellClassName: 'htDimmed',
renderer: void 0,
commentedCellClassName: 'htCommentCell',
fragmentSelection: false,
readOnly: false,
search: false,
type: 'text',
copyable: true,
editor: void 0,
autoComplete: void 0,
debug: false,
wordWrap: true,
noWordWrapClassName: 'htNoWrap',
contextMenu: void 0,
undo: void 0,
columnSorting: void 0,
manualColumnMove: void 0,
manualColumnResize: void 0,
manualRowMove: void 0,
manualRowResize: void 0,
mergeCells: false,
viewportRowRenderingOffset: 10,
viewportColumnRenderingOffset: 10,
groups: void 0,
validator: void 0,
disableVisualSelection: false,
sortIndicator: false,
manualColumnFreeze: void 0,
trimWhitespace: true,
settings: void 0,
source: void 0,
title: void 0,
checkedTemplate: void 0,
uncheckedTemplate: void 0,
format: void 0,
className: void 0
};
Handsontable.DefaultSettings = DefaultSettings;
//#
},{"./3rdparty/walkontable/src/cell/coords.js":5,"./3rdparty/walkontable/src/cell/range.js":6,"./3rdparty/walkontable/src/selection.js":18,"./dataMap.js":26,"./dom.js":27,"./editorManager.js":28,"./eventManager.js":41,"./helpers.js":42,"./plugins.js":45,"./renderers.js":70,"./tableView.js":85,"numeral":"numeral"}],26:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
DataMap: {get: function() {
return DataMap;
}},
__esModule: {value: true}
});
var $__helpers_46_js__,
$__multiMap_46_js__,
$__SheetClip__;
var helper = ($__helpers_46_js__ = require("./helpers.js"), $__helpers_46_js__ && $__helpers_46_js__.__esModule && $__helpers_46_js__ || {default: $__helpers_46_js__});
var MultiMap = ($__multiMap_46_js__ = require("./multiMap.js"), $__multiMap_46_js__ && $__multiMap_46_js__.__esModule && $__multiMap_46_js__ || {default: $__multiMap_46_js__}).MultiMap;
var SheetClip = ($__SheetClip__ = require("SheetClip"), $__SheetClip__ && $__SheetClip__.__esModule && $__SheetClip__ || {default: $__SheetClip__}).default;
;
Handsontable.DataMap = DataMap;
function DataMap(instance, priv, GridSettings) {
this.instance = instance;
this.priv = priv;
this.GridSettings = GridSettings;
this.dataSource = this.instance.getSettings().data;
if (this.dataSource[0]) {
this.duckSchema = this.recursiveDuckSchema(this.dataSource[0]);
} else {
this.duckSchema = {};
}
this.createMap();
}
DataMap.prototype.DESTINATION_RENDERER = 1;
DataMap.prototype.DESTINATION_CLIPBOARD_GENERATOR = 2;
DataMap.prototype.recursiveDuckSchema = function(object) {
return Handsontable.helper.duckSchema(object);
};
DataMap.prototype.recursiveDuckColumns = function(schema, lastCol, parent) {
var prop,
i;
if (typeof lastCol === 'undefined') {
lastCol = 0;
parent = '';
}
if (typeof schema === "object" && !Array.isArray(schema)) {
for (i in schema) {
if (schema.hasOwnProperty(i)) {
if (schema[i] === null) {
prop = parent + i;
this.colToPropCache.push(prop);
this.propToColCache.set(prop, lastCol);
lastCol++;
} else {
lastCol = this.recursiveDuckColumns(schema[i], lastCol, i + '.');
}
}
}
}
return lastCol;
};
DataMap.prototype.createMap = function() {
var i,
ilen,
schema = this.getSchema();
if (typeof schema === "undefined") {
throw new Error("trying to create `columns` definition but you didnt' provide `schema` nor `data`");
}
this.colToPropCache = [];
this.propToColCache = new MultiMap();
var columns = this.instance.getSettings().columns;
if (columns) {
for (i = 0, ilen = columns.length; i < ilen; i++) {
if (typeof columns[i].data != 'undefined') {
this.colToPropCache[i] = columns[i].data;
this.propToColCache.set(columns[i].data, i);
}
}
} else {
this.recursiveDuckColumns(schema);
}
};
DataMap.prototype.colToProp = function(col) {
col = Handsontable.hooks.run(this.instance, 'modifyCol', col);
if (this.colToPropCache && typeof this.colToPropCache[col] !== 'undefined') {
return this.colToPropCache[col];
}
return col;
};
DataMap.prototype.propToCol = function(prop) {
var col;
if (typeof this.propToColCache.get(prop) !== 'undefined') {
col = this.propToColCache.get(prop);
} else {
col = prop;
}
col = Handsontable.hooks.run(this.instance, 'modifyCol', col);
return col;
};
DataMap.prototype.getSchema = function() {
var schema = this.instance.getSettings().dataSchema;
if (schema) {
if (typeof schema === 'function') {
return schema();
}
return schema;
}
return this.duckSchema;
};
DataMap.prototype.createRow = function(index, amount, createdAutomatically) {
var row,
colCount = this.instance.countCols(),
numberOfCreatedRows = 0,
currentIndex;
if (!amount) {
amount = 1;
}
if (typeof index !== 'number' || index >= this.instance.countRows()) {
index = this.instance.countRows();
}
currentIndex = index;
var maxRows = this.instance.getSettings().maxRows;
while (numberOfCreatedRows < amount && this.instance.countRows() < maxRows) {
if (this.instance.dataType === 'array') {
row = [];
for (var c = 0; c < colCount; c++) {
row.push(null);
}
} else if (this.instance.dataType === 'function') {
row = this.instance.getSettings().dataSchema(index);
} else {
row = {};
helper.deepExtend(row, this.getSchema());
}
if (index === this.instance.countRows()) {
this.dataSource.push(row);
} else {
this.dataSource.splice(index, 0, row);
}
numberOfCreatedRows++;
currentIndex++;
}
Handsontable.hooks.run(this.instance, 'afterCreateRow', index, numberOfCreatedRows, createdAutomatically);
this.instance.forceFullRender = true;
return numberOfCreatedRows;
};
DataMap.prototype.createCol = function(index, amount, createdAutomatically) {
if (!this.instance.isColumnModificationAllowed()) {
throw new Error("Cannot create new column. When data source in an object, " + "you can only have as much columns as defined in first data row, data schema or in the 'columns' setting." + "If you want to be able to add new columns, you have to use array datasource.");
}
var rlen = this.instance.countRows(),
data = this.dataSource,
constructor,
numberOfCreatedCols = 0,
currentIndex;
if (!amount) {
amount = 1;
}
currentIndex = index;
var maxCols = this.instance.getSettings().maxCols;
while (numberOfCreatedCols < amount && this.instance.countCols() < maxCols) {
constructor = helper.columnFactory(this.GridSettings, this.priv.columnsSettingConflicts);
if (typeof index !== 'number' || index >= this.instance.countCols()) {
for (var r = 0; r < rlen; r++) {
if (typeof data[r] === 'undefined') {
data[r] = [];
}
data[r].push(null);
}
this.priv.columnSettings.push(constructor);
} else {
for (var r = 0; r < rlen; r++) {
data[r].splice(currentIndex, 0, null);
}
this.priv.columnSettings.splice(currentIndex, 0, constructor);
}
numberOfCreatedCols++;
currentIndex++;
}
Handsontable.hooks.run(this.instance, 'afterCreateCol', index, numberOfCreatedCols, createdAutomatically);
this.instance.forceFullRender = true;
return numberOfCreatedCols;
};
DataMap.prototype.removeRow = function(index, amount) {
if (!amount) {
amount = 1;
}
if (typeof index !== 'number') {
index = -amount;
}
index = (this.instance.countRows() + index) % this.instance.countRows();
var logicRows = this.physicalRowsToLogical(index, amount);
var actionWasNotCancelled = Handsontable.hooks.run(this.instance, 'beforeRemoveRow', index, amount);
if (actionWasNotCancelled === false) {
return;
}
var data = this.dataSource;
var newData = data.filter(function(row, index) {
return logicRows.indexOf(index) == -1;
});
data.length = 0;
Array.prototype.push.apply(data, newData);
Handsontable.hooks.run(this.instance, 'afterRemoveRow', index, amount);
this.instance.forceFullRender = true;
};
DataMap.prototype.removeCol = function(index, amount) {
if (this.instance.dataType === 'object' || this.instance.getSettings().columns) {
throw new Error("cannot remove column with object data source or columns option specified");
}
if (!amount) {
amount = 1;
}
if (typeof index !== 'number') {
index = -amount;
}
index = (this.instance.countCols() + index) % this.instance.countCols();
var actionWasNotCancelled = Handsontable.hooks.run(this.instance, 'beforeRemoveCol', index, amount);
if (actionWasNotCancelled === false) {
return;
}
var data = this.dataSource;
for (var r = 0,
rlen = this.instance.countRows(); r < rlen; r++) {
data[r].splice(index, amount);
}
this.priv.columnSettings.splice(index, amount);
Handsontable.hooks.run(this.instance, 'afterRemoveCol', index, amount);
this.instance.forceFullRender = true;
};
DataMap.prototype.spliceCol = function(col, index, amount) {
var elements = 4 <= arguments.length ? [].slice.call(arguments, 3) : [];
var colData = this.instance.getDataAtCol(col);
var removed = colData.slice(index, index + amount);
var after = colData.slice(index + amount);
helper.extendArray(elements, after);
var i = 0;
while (i < amount) {
elements.push(null);
i++;
}
helper.to2dArray(elements);
this.instance.populateFromArray(index, col, elements, null, null, 'spliceCol');
return removed;
};
DataMap.prototype.spliceRow = function(row, index, amount) {
var elements = 4 <= arguments.length ? [].slice.call(arguments, 3) : [];
var rowData = this.instance.getSourceDataAtRow(row);
var removed = rowData.slice(index, index + amount);
var after = rowData.slice(index + amount);
helper.extendArray(elements, after);
var i = 0;
while (i < amount) {
elements.push(null);
i++;
}
this.instance.populateFromArray(row, index, [elements], null, null, 'spliceRow');
return removed;
};
DataMap.prototype.get = function(row, prop) {
row = Handsontable.hooks.run(this.instance, 'modifyRow', row);
if (typeof prop === 'string' && prop.indexOf('.') > -1) {
var sliced = prop.split(".");
var out = this.dataSource[row];
if (!out) {
return null;
}
for (var i = 0,
ilen = sliced.length; i < ilen; i++) {
out = out[sliced[i]];
if (typeof out === 'undefined') {
return null;
}
}
return out;
} else if (typeof prop === 'function') {
return prop(this.dataSource.slice(row, row + 1)[0]);
} else {
return this.dataSource[row] ? this.dataSource[row][prop] : null;
}
};
var copyableLookup = helper.cellMethodLookupFactory('copyable', false);
DataMap.prototype.getCopyable = function(row, prop) {
if (copyableLookup.call(this.instance, row, this.propToCol(prop))) {
return this.get(row, prop);
}
return '';
};
DataMap.prototype.set = function(row, prop, value, source) {
row = Handsontable.hooks.run(this.instance, 'modifyRow', row, source || "datamapGet");
if (typeof prop === 'string' && prop.indexOf('.') > -1) {
var sliced = prop.split(".");
var out = this.dataSource[row];
for (var i = 0,
ilen = sliced.length - 1; i < ilen; i++) {
if (typeof out[sliced[i]] === 'undefined') {
out[sliced[i]] = {};
}
out = out[sliced[i]];
}
out[sliced[i]] = value;
} else if (typeof prop === 'function') {
prop(this.dataSource.slice(row, row + 1)[0], value);
} else {
this.dataSource[row][prop] = value;
}
};
DataMap.prototype.physicalRowsToLogical = function(index, amount) {
var totalRows = this.instance.countRows();
var physicRow = (totalRows + index) % totalRows;
var logicRows = [];
var rowsToRemove = amount;
var row;
while (physicRow < totalRows && rowsToRemove) {
row = Handsontable.hooks.run(this.instance, 'modifyRow', physicRow);
logicRows.push(row);
rowsToRemove--;
physicRow++;
}
return logicRows;
};
DataMap.prototype.clear = function() {
for (var r = 0; r < this.instance.countRows(); r++) {
for (var c = 0; c < this.instance.countCols(); c++) {
this.set(r, this.colToProp(c), '');
}
}
};
DataMap.prototype.getAll = function() {
return this.dataSource;
};
DataMap.prototype.getRange = function(start, end, destination) {
var r,
rlen,
c,
clen,
output = [],
row;
var getFn = destination === this.DESTINATION_CLIPBOARD_GENERATOR ? this.getCopyable : this.get;
rlen = Math.max(start.row, end.row);
clen = Math.max(start.col, end.col);
for (r = Math.min(start.row, end.row); r <= rlen; r++) {
row = [];
for (c = Math.min(start.col, end.col); c <= clen; c++) {
row.push(getFn.call(this, r, this.colToProp(c)));
}
output.push(row);
}
return output;
};
DataMap.prototype.getText = function(start, end) {
return SheetClip.stringify(this.getRange(start, end, this.DESTINATION_RENDERER));
};
DataMap.prototype.getCopyableText = function(start, end) {
return SheetClip.stringify(this.getRange(start, end, this.DESTINATION_CLIPBOARD_GENERATOR));
};
//#
},{"./helpers.js":42,"./multiMap.js":43,"SheetClip":"SheetClip"}],27:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
enableImmediatePropagation: {get: function() {
return enableImmediatePropagation;
}},
closest: {get: function() {
return closest;
}},
isChildOf: {get: function() {
return isChildOf;
}},
isChildOfWebComponentTable: {get: function() {
return isChildOfWebComponentTable;
}},
polymerWrap: {get: function() {
return polymerWrap;
}},
polymerUnwrap: {get: function() {
return polymerUnwrap;
}},
isWebComponentSupportedNatively: {get: function() {
return isWebComponentSupportedNatively;
}},
index: {get: function() {
return index;
}},
hasClass: {get: function() {
return hasClass;
}},
addClass: {get: function() {
return addClass;
}},
removeClass: {get: function() {
return removeClass;
}},
removeTextNodes: {get: function() {
return removeTextNodes;
}},
empty: {get: function() {
return empty;
}},
HTML_CHARACTERS: {get: function() {
return HTML_CHARACTERS;
}},
fastInnerHTML: {get: function() {
return fastInnerHTML;
}},
fastInnerText: {get: function() {
return fastInnerText;
}},
isVisible: {get: function() {
return isVisible;
}},
offset: {get: function() {
return offset;
}},
getWindowScrollTop: {get: function() {
return getWindowScrollTop;
}},
getWindowScrollLeft: {get: function() {
return getWindowScrollLeft;
}},
getScrollTop: {get: function() {
return getScrollTop;
}},
getScrollLeft: {get: function() {
return getScrollLeft;
}},
getScrollableElement: {get: function() {
return getScrollableElement;
}},
getTrimmingContainer: {get: function() {
return getTrimmingContainer;
}},
getStyle: {get: function() {
return getStyle;
}},
getComputedStyle: {get: function() {
return getComputedStyle;
}},
outerWidth: {get: function() {
return outerWidth;
}},
outerHeight: {get: function() {
return outerHeight;
}},
innerHeight: {get: function() {
return innerHeight;
}},
innerWidth: {get: function() {
return innerWidth;
}},
addEvent: {get: function() {
return addEvent;
}},
removeEvent: {get: function() {
return removeEvent;
}},
hasCaptionProblem: {get: function() {
return hasCaptionProblem;
}},
getCaretPosition: {get: function() {
return getCaretPosition;
}},
getSelectionEndPosition: {get: function() {
return getSelectionEndPosition;
}},
setCaretPosition: {get: function() {
return setCaretPosition;
}},
getScrollbarWidth: {get: function() {
return getScrollbarWidth;
}},
isIE8: {get: function() {
return isIE8;
}},
isIE9: {get: function() {
return isIE9;
}},
isSafari: {get: function() {
return isSafari;
}},
setOverlayPosition: {get: function() {
return setOverlayPosition;
}},
getCssTransform: {get: function() {
return getCssTransform;
}},
resetCssTransform: {get: function() {
return resetCssTransform;
}},
__esModule: {value: true}
});
function enableImmediatePropagation(event) {
if (event != null && event.isImmediatePropagationEnabled == null) {
event.stopImmediatePropagation = function() {
this.isImmediatePropagationEnabled = false;
this.cancelBubble = true;
};
event.isImmediatePropagationEnabled = true;
event.isImmediatePropagationStopped = function() {
return !this.isImmediatePropagationEnabled;
};
}
}
function closest(element, nodes, until) {
while (element != null && element !== until) {
if (element.nodeType === Node.ELEMENT_NODE && (nodes.indexOf(element.nodeName) > -1 || nodes.indexOf(element) > -1)) {
return element;
}
if (element.host && element.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
element = element.host;
} else {
element = element.parentNode;
}
}
return null;
}
function isChildOf(child, parent) {
var node = child.parentNode;
var queriedParents = [];
if (typeof parent === "string") {
queriedParents = Array.prototype.slice.call(document.querySelectorAll(parent), 0);
} else {
queriedParents.push(parent);
}
while (node != null) {
if (queriedParents.indexOf(node) > -1) {
return true;
}
node = node.parentNode;
}
return false;
}
function isChildOfWebComponentTable(element) {
var hotTableName = 'hot-table',
result = false,
parentNode;
parentNode = polymerWrap(element);
function isHotTable(element) {
return element.nodeType === Node.ELEMENT_NODE && element.nodeName === hotTableName.toUpperCase();
}
while (parentNode != null) {
if (isHotTable(parentNode)) {
result = true;
break;
} else if (parentNode.host && parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
result = isHotTable(parentNode.host);
if (result) {
break;
}
parentNode = parentNode.host;
}
parentNode = parentNode.parentNode;
}
return result;
}
function polymerWrap(element) {
return typeof Polymer !== 'undefined' && typeof wrap === 'function' ? wrap(element) : element;
}
function polymerUnwrap(element) {
return typeof Polymer !== 'undefined' && typeof unwrap === 'function' ? unwrap(element) : element;
}
function isWebComponentSupportedNatively() {
var test = document.createElement('div');
return test.createShadowRoot && test.createShadowRoot.toString().match(/\[native code\]/) ? true : false;
}
function index(elem) {
var i = 0;
if (elem.previousSibling) {
while (elem = elem.previousSibling) {
++i;
}
}
return i;
}
var classListSupport = document.documentElement.classList ? true : false;
var _hasClass,
_addClass,
_removeClass;
function filterEmptyClassNames(classNames) {
var len = 0,
result = [];
if (!classNames || !classNames.length) {
return result;
}
while (classNames[len]) {
result.push(classNames[len]);
len++;
}
return result;
}
if (classListSupport) {
var isSupportMultipleClassesArg = (function() {
var element = document.createElement('div');
element.classList.add('test', 'test2');
return element.classList.contains('test2');
}());
_hasClass = function _hasClass(element, className) {
if (className === '') {
return false;
}
return element.classList.contains(className);
};
_addClass = function _addClass(element, className) {
var len = 0;
if (typeof className === 'string') {
className = className.split(' ');
}
className = filterEmptyClassNames(className);
if (isSupportMultipleClassesArg) {
element.classList.add.apply(element.classList, className);
} else {
while (className && className[len]) {
element.classList.add(className[len]);
len++;
}
}
};
_removeClass = function _removeClass(element, className) {
var len = 0;
if (typeof className === 'string') {
className = className.split(' ');
}
className = filterEmptyClassNames(className);
if (isSupportMultipleClassesArg) {
element.classList.remove.apply(element.classList, className);
} else {
while (className && className[len]) {
element.classList.remove(className[len]);
len++;
}
}
};
} else {
var createClassNameRegExp = function createClassNameRegExp(className) {
return new RegExp('(\\s|^)' + className + '(\\s|$)');
};
_hasClass = function _hasClass(element, className) {
return element.className.match(createClassNameRegExp(className)) ? true : false;
};
_addClass = function _addClass(element, className) {
var len = 0,
_className = element.className;
if (typeof className === 'string') {
className = className.split(' ');
}
if (_className === '') {
_className = className.join(' ');
} else {
while (className && className[len]) {
if (!createClassNameRegExp(className[len]).test(_className)) {
_className += ' ' + className[len];
}
len++;
}
}
element.className = _className;
};
_removeClass = function _removeClass(element, className) {
var len = 0,
_className = element.className;
if (typeof className === 'string') {
className = className.split(' ');
}
while (className && className[len]) {
_className = _className.replace(createClassNameRegExp(className[len]), ' ').trim();
len++;
}
if (element.className !== _className) {
element.className = _className;
}
};
}
function hasClass(element, className) {
return _hasClass(element, className);
}
function addClass(element, className) {
return _addClass(element, className);
}
function removeClass(element, className) {
return _removeClass(element, className);
}
function removeTextNodes(elem, parent) {
if (elem.nodeType === 3) {
parent.removeChild(elem);
} else if (['TABLE', 'THEAD', 'TBODY', 'TFOOT', 'TR'].indexOf(elem.nodeName) > -1) {
var childs = elem.childNodes;
for (var i = childs.length - 1; i >= 0; i--) {
removeTextNodes(childs[i], elem);
}
}
}
function empty(element) {
var child;
while (child = element.lastChild) {
element.removeChild(child);
}
}
var HTML_CHARACTERS = /(<(.*)>|&(.*);)/;
function fastInnerHTML(element, content) {
if (HTML_CHARACTERS.test(content)) {
element.innerHTML = content;
} else {
fastInnerText(element, content);
}
}
var textContextSupport = document.createTextNode('test').textContent ? true : false;
function fastInnerText(element, content) {
var child = element.firstChild;
if (child && child.nodeType === 3 && child.nextSibling === null) {
if (textContextSupport) {
child.textContent = content;
} else {
child.data = content;
}
} else {
empty(element);
element.appendChild(document.createTextNode(content));
}
}
function isVisible(elem) {
var next = elem;
while (polymerUnwrap(next) !== document.documentElement) {
if (next === null) {
return false;
} else if (next.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
if (next.host) {
if (next.host.impl) {
return isVisible(next.host.impl);
} else if (next.host) {
return isVisible(next.host);
} else {
throw new Error("Lost in Web Components world");
}
} else {
return false;
}
} else if (next.style.display === 'none') {
return false;
}
next = next.parentNode;
}
return true;
}
function offset(elem) {
var offsetLeft,
offsetTop,
lastElem,
docElem,
box;
docElem = document.documentElement;
if (hasCaptionProblem() && elem.firstChild && elem.firstChild.nodeName === 'CAPTION') {
box = elem.getBoundingClientRect();
return {
top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),
left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0)
};
}
offsetLeft = elem.offsetLeft;
offsetTop = elem.offsetTop;
lastElem = elem;
while (elem = elem.offsetParent) {
if (elem === document.body) {
break;
}
offsetLeft += elem.offsetLeft;
offsetTop += elem.offsetTop;
lastElem = elem;
}
if (lastElem && lastElem.style.position === 'fixed') {
offsetLeft += window.pageXOffset || docElem.scrollLeft;
offsetTop += window.pageYOffset || docElem.scrollTop;
}
return {
left: offsetLeft,
top: offsetTop
};
}
function getWindowScrollTop() {
var res = window.scrollY;
if (res == void 0) {
res = document.documentElement.scrollTop;
}
return res;
}
function getWindowScrollLeft() {
var res = window.scrollX;
if (res == void 0) {
res = document.documentElement.scrollLeft;
}
return res;
}
function getScrollTop(elem) {
if (elem === window) {
return getWindowScrollTop(elem);
} else {
return elem.scrollTop;
}
}
function getScrollLeft(elem) {
if (elem === window) {
return getWindowScrollLeft(elem);
} else {
return elem.scrollLeft;
}
}
function getScrollableElement(element) {
var el = element.parentNode,
props = ['auto', 'scroll'],
overflow,
overflowX,
overflowY,
computedStyle = '',
computedOverflow = '',
computedOverflowY = '',
computedOverflowX = '';
while (el && el.style && document.body !== el) {
overflow = el.style.overflow;
overflowX = el.style.overflowX;
overflowY = el.style.overflowY;
if (overflow == 'scroll' || overflowX == 'scroll' || overflowY == 'scroll') {
return el;
} else if (window.getComputedStyle) {
computedStyle = window.getComputedStyle(el);
computedOverflow = computedStyle.getPropertyValue('overflow');
computedOverflowY = computedStyle.getPropertyValue('overflow-y');
computedOverflowX = computedStyle.getPropertyValue('overflow-x');
if (computedOverflow === 'scroll' || computedOverflowX === 'scroll' || computedOverflowY === 'scroll') {
return el;
}
}
if (el.clientHeight <= el.scrollHeight && (props.indexOf(overflowY) !== -1 || props.indexOf(overflow) !== -1 || props.indexOf(computedOverflow) !== -1 || props.indexOf(computedOverflowY) !== -1)) {
return el;
}
if (el.clientWidth <= el.scrollWidth && (props.indexOf(overflowX) !== -1 || props.indexOf(overflow) !== -1 || props.indexOf(computedOverflow) !== -1 || props.indexOf(computedOverflowX) !== -1)) {
return el;
}
el = el.parentNode;
}
return window;
}
function getTrimmingContainer(base) {
var el = base.parentNode;
while (el && el.style && document.body !== el) {
if (el.style.overflow !== 'visible' && el.style.overflow !== '') {
return el;
} else if (window.getComputedStyle) {
var computedStyle = window.getComputedStyle(el);
if (computedStyle.getPropertyValue('overflow') !== 'visible' && computedStyle.getPropertyValue('overflow') !== '') {
return el;
}
}
el = el.parentNode;
}
return window;
}
function getStyle(elem, prop) {
if (!elem) {
return;
} else if (elem === window) {
if (prop === 'width') {
return window.innerWidth + 'px';
} else if (prop === 'height') {
return window.innerHeight + 'px';
}
return;
}
var styleProp = elem.style[prop],
computedStyle;
if (styleProp !== "" && styleProp !== void 0) {
return styleProp;
} else {
computedStyle = getComputedStyle(elem);
if (computedStyle[prop] !== "" && computedStyle[prop] !== void 0) {
return computedStyle[prop];
}
return void 0;
}
}
function getComputedStyle(elem) {
return elem.currentStyle || document.defaultView.getComputedStyle(elem);
}
function outerWidth(elem) {
return elem.offsetWidth;
}
function outerHeight(elem) {
if (hasCaptionProblem() && elem.firstChild && elem.firstChild.nodeName === 'CAPTION') {
return elem.offsetHeight + elem.firstChild.offsetHeight;
} else {
return elem.offsetHeight;
}
}
function innerHeight(elem) {
return elem.clientHeight || elem.innerHeight;
}
function innerWidth(elem) {
return elem.clientWidth || elem.innerWidth;
}
function addEvent(element, event, callback) {
if (window.addEventListener) {
element.addEventListener(event, callback, false);
} else {
element.attachEvent('on' + event, callback);
}
}
function removeEvent(element, event, callback) {
if (window.removeEventListener) {
element.removeEventListener(event, callback, false);
} else {
element.detachEvent('on' + event, callback);
}
}
var _hasCaptionProblem;
function detectCaptionProblem() {
var TABLE = document.createElement('TABLE');
TABLE.style.borderSpacing = 0;
TABLE.style.borderWidth = 0;
TABLE.style.padding = 0;
var TBODY = document.createElement('TBODY');
TABLE.appendChild(TBODY);
TBODY.appendChild(document.createElement('TR'));
TBODY.firstChild.appendChild(document.createElement('TD'));
TBODY.firstChild.firstChild.innerHTML = '<tr><td>t<br>t</td></tr>';
var CAPTION = document.createElement('CAPTION');
CAPTION.innerHTML = 'c<br>c<br>c<br>c';
CAPTION.style.padding = 0;
CAPTION.style.margin = 0;
TABLE.insertBefore(CAPTION, TBODY);
document.body.appendChild(TABLE);
_hasCaptionProblem = (TABLE.offsetHeight < 2 * TABLE.lastChild.offsetHeight);
document.body.removeChild(TABLE);
}
function hasCaptionProblem() {
if (_hasCaptionProblem === void 0) {
detectCaptionProblem();
}
return _hasCaptionProblem;
}
function getCaretPosition(el) {
if (el.selectionStart) {
return el.selectionStart;
} else if (document.selection) {
el.focus();
var r = document.selection.createRange();
if (r == null) {
return 0;
}
var re = el.createTextRange();
var rc = re.duplicate();
re.moveToBookmark(r.getBookmark());
rc.setEndPoint('EndToStart', re);
return rc.text.length;
}
return 0;
}
function getSelectionEndPosition(el) {
if (el.selectionEnd) {
return el.selectionEnd;
} else if (document.selection) {
var r = document.selection.createRange();
if (r == null) {
return 0;
}
var re = el.createTextRange();
return re.text.indexOf(r.text) + r.text.length;
}
}
function setCaretPosition(el, pos, endPos) {
if (endPos === void 0) {
endPos = pos;
}
if (el.setSelectionRange) {
el.focus();
try {
el.setSelectionRange(pos, endPos);
} catch (err) {
var elementParent = el.parentNode;
var parentDisplayValue = elementParent.style.display;
elementParent.style.display = 'block';
el.setSelectionRange(pos, endPos);
elementParent.style.display = parentDisplayValue;
}
} else if (el.createTextRange) {
var range = el.createTextRange();
range.collapse(true);
range.moveEnd('character', endPos);
range.moveStart('character', pos);
range.select();
}
}
var cachedScrollbarWidth;
function walkontableCalculateScrollbarWidth() {
var inner = document.createElement('p');
inner.style.width = "100%";
inner.style.height = "200px";
var outer = document.createElement('div');
outer.style.position = "absolute";
outer.style.top = "0px";
outer.style.left = "0px";
outer.style.visibility = "hidden";
outer.style.width = "200px";
outer.style.height = "150px";
outer.style.overflow = "hidden";
outer.appendChild(inner);
(document.body || document.documentElement).appendChild(outer);
var w1 = inner.offsetWidth;
outer.style.overflow = 'scroll';
var w2 = inner.offsetWidth;
if (w1 == w2) {
w2 = outer.clientWidth;
}
(document.body || document.documentElement).removeChild(outer);
return (w1 - w2);
}
function getScrollbarWidth() {
if (cachedScrollbarWidth === void 0) {
cachedScrollbarWidth = walkontableCalculateScrollbarWidth();
}
return cachedScrollbarWidth;
}
var _isIE8 = !(document.createTextNode('test').textContent);
function isIE8() {
return isIE8;
}
var _isIE9 = !!(document.documentMode);
function isIE9() {
return _isIE9;
}
var _isSafari = (/Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor));
function isSafari() {
return _isSafari;
}
function setOverlayPosition(overlayElem, left, top) {
if (_isIE8 || _isIE9) {
overlayElem.style.top = top;
overlayElem.style.left = left;
} else if (_isSafari) {
overlayElem.style['-webkit-transform'] = 'translate3d(' + left + ',' + top + ',0)';
} else {
overlayElem.style.transform = 'translate3d(' + left + ',' + top + ',0)';
}
}
function getCssTransform(elem) {
var transform;
if (elem.style['transform'] && (transform = elem.style['transform']) !== '') {
return ['transform', transform];
} else if (elem.style['-webkit-transform'] && (transform = elem.style['-webkit-transform']) !== '') {
return ['-webkit-transform', transform];
}
return -1;
}
function resetCssTransform(elem) {
if (elem['transform'] && elem['transform'] !== '') {
elem['transform'] = '';
} else if (elem['-webkit-transform'] && elem['-webkit-transform'] !== '') {
elem['-webkit-transform'] = '';
}
}
window.Handsontable = window.Handsontable || {};
Handsontable.Dom = {
addClass: addClass,
addEvent: addEvent,
closest: closest,
empty: empty,
enableImmediatePropagation: enableImmediatePropagation,
fastInnerHTML: fastInnerHTML,
fastInnerText: fastInnerText,
getCaretPosition: getCaretPosition,
getComputedStyle: getComputedStyle,
getCssTransform: getCssTransform,
getScrollableElement: getScrollableElement,
getScrollbarWidth: getScrollbarWidth,
getScrollLeft: getScrollLeft,
getScrollTop: getScrollTop,
getStyle: getStyle,
getSelectionEndPosition: getSelectionEndPosition,
getTrimmingContainer: getTrimmingContainer,
getWindowScrollLeft: getWindowScrollLeft,
getWindowScrollTop: getWindowScrollTop,
hasCaptionProblem: hasCaptionProblem,
hasClass: hasClass,
HTML_CHARACTERS: HTML_CHARACTERS,
index: index,
innerHeight: innerHeight,
innerWidth: innerWidth,
isChildOf: isChildOf,
isChildOfWebComponentTable: isChildOfWebComponentTable,
isIE8: isIE8,
isIE9: isIE9,
isSafari: isSafari,
isVisible: isVisible,
isWebComponentSupportedNatively: isWebComponentSupportedNatively,
offset: offset,
outerHeight: outerHeight,
outerWidth: outerWidth,
polymerUnwrap: polymerUnwrap,
polymerWrap: polymerWrap,
removeClass: removeClass,
removeEvent: removeEvent,
removeTextNodes: removeTextNodes,
resetCssTransform: resetCssTransform,
setCaretPosition: setCaretPosition,
setOverlayPosition: setOverlayPosition
};
//#
},{}],28:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
EditorManager: {get: function() {
return EditorManager;
}},
__esModule: {value: true}
});
var $__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__,
$__helpers_46_js__,
$__dom_46_js__,
$__editors_46_js__,
$__eventManager_46_js__;
var WalkontableCellCoords = ($__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ = require("./3rdparty/walkontable/src/cell/coords.js"), $__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ && $__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__.__esModule && $__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ || {default: $__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__}).WalkontableCellCoords;
var helper = ($__helpers_46_js__ = require("./helpers.js"), $__helpers_46_js__ && $__helpers_46_js__.__esModule && $__helpers_46_js__ || {default: $__helpers_46_js__});
var dom = ($__dom_46_js__ = require("./dom.js"), $__dom_46_js__ && $__dom_46_js__.__esModule && $__dom_46_js__ || {default: $__dom_46_js__});
var getEditor = ($__editors_46_js__ = require("./editors.js"), $__editors_46_js__ && $__editors_46_js__.__esModule && $__editors_46_js__ || {default: $__editors_46_js__}).getEditor;
var eventManagerObject = ($__eventManager_46_js__ = require("./eventManager.js"), $__eventManager_46_js__ && $__eventManager_46_js__.__esModule && $__eventManager_46_js__ || {default: $__eventManager_46_js__}).eventManager;
;
Handsontable.EditorManager = EditorManager;
function EditorManager(instance, priv, selection) {
var _this = this,
keyCodes = helper.keyCode,
destroyed = false,
eventManager,
activeEditor;
eventManager = eventManagerObject(instance);
function moveSelectionAfterEnter(shiftKey) {
var enterMoves = typeof priv.settings.enterMoves === 'function' ? priv.settings.enterMoves(event) : priv.settings.enterMoves;
if (shiftKey) {
selection.transformStart(-enterMoves.row, -enterMoves.col);
} else {
selection.transformStart(enterMoves.row, enterMoves.col, true);
}
}
function moveSelectionUp(shiftKey) {
if (shiftKey) {
selection.transformEnd(-1, 0);
} else {
selection.transformStart(-1, 0);
}
}
function moveSelectionDown(shiftKey) {
if (shiftKey) {
selection.transformEnd(1, 0);
} else {
selection.transformStart(1, 0);
}
}
function moveSelectionRight(shiftKey) {
if (shiftKey) {
selection.transformEnd(0, 1);
} else {
selection.transformStart(0, 1);
}
}
function moveSelectionLeft(shiftKey) {
if (shiftKey) {
selection.transformEnd(0, -1);
} else {
selection.transformStart(0, -1);
}
}
function onKeyDown(event) {
var ctrlDown,
rangeModifier;
if (!instance.isListening()) {
return;
}
Handsontable.hooks.run(instance, 'beforeKeyDown', event);
if (destroyed) {
return;
}
dom.enableImmediatePropagation(event);
if (event.isImmediatePropagationStopped()) {
return;
}
priv.lastKeyCode = event.keyCode;
if (!selection.isSelected()) {
return;
}
ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey;
if (activeEditor && !activeEditor.isWaiting()) {
if (!helper.isMetaKey(event.keyCode) && !ctrlDown && !_this.isEditorOpened()) {
_this.openEditor("", event);
return;
}
}
rangeModifier = event.shiftKey ? selection.setRangeEnd : selection.setRangeStart;
switch (event.keyCode) {
case keyCodes.A:
if (!_this.isEditorOpened() && ctrlDown) {
selection.selectAll();
event.preventDefault();
helper.stopPropagation(event);
}
break;
case keyCodes.ARROW_UP:
if (_this.isEditorOpened() && !activeEditor.isWaiting()) {
_this.closeEditorAndSaveChanges(ctrlDown);
}
moveSelectionUp(event.shiftKey);
event.preventDefault();
helper.stopPropagation(event);
break;
case keyCodes.ARROW_DOWN:
if (_this.isEditorOpened() && !activeEditor.isWaiting()) {
_this.closeEditorAndSaveChanges(ctrlDown);
}
moveSelectionDown(event.shiftKey);
event.preventDefault();
helper.stopPropagation(event);
break;
case keyCodes.ARROW_RIGHT:
if (_this.isEditorOpened() && !activeEditor.isWaiting()) {
_this.closeEditorAndSaveChanges(ctrlDown);
}
moveSelectionRight(event.shiftKey);
event.preventDefault();
helper.stopPropagation(event);
break;
case keyCodes.ARROW_LEFT:
if (_this.isEditorOpened() && !activeEditor.isWaiting()) {
_this.closeEditorAndSaveChanges(ctrlDown);
}
moveSelectionLeft(event.shiftKey);
event.preventDefault();
helper.stopPropagation(event);
break;
case keyCodes.TAB:
var tabMoves = typeof priv.settings.tabMoves === 'function' ? priv.settings.tabMoves(event) : priv.settings.tabMoves;
if (event.shiftKey) {
selection.transformStart(-tabMoves.row, -tabMoves.col);
} else {
selection.transformStart(tabMoves.row, tabMoves.col, true);
}
event.preventDefault();
helper.stopPropagation(event);
break;
case keyCodes.BACKSPACE:
case keyCodes.DELETE:
selection.empty(event);
_this.prepareEditor();
event.preventDefault();
break;
case keyCodes.F2:
_this.openEditor(null, event);
event.preventDefault();
break;
case keyCodes.ENTER:
if (_this.isEditorOpened()) {
if (activeEditor && activeEditor.state !== Handsontable.EditorState.WAITING) {
_this.closeEditorAndSaveChanges(ctrlDown);
}
moveSelectionAfterEnter(event.shiftKey);
} else {
if (instance.getSettings().enterBeginsEditing) {
_this.openEditor(null, event);
} else {
moveSelectionAfterEnter(event.shiftKey);
}
}
event.preventDefault();
event.stopImmediatePropagation();
break;
case keyCodes.ESCAPE:
if (_this.isEditorOpened()) {
_this.closeEditorAndRestoreOriginalValue(ctrlDown);
}
event.preventDefault();
break;
case keyCodes.HOME:
if (event.ctrlKey || event.metaKey) {
rangeModifier(new WalkontableCellCoords(0, priv.selRange.from.col));
} else {
rangeModifier(new WalkontableCellCoords(priv.selRange.from.row, 0));
}
event.preventDefault();
helper.stopPropagation(event);
break;
case keyCodes.END:
if (event.ctrlKey || event.metaKey) {
rangeModifier(new WalkontableCellCoords(instance.countRows() - 1, priv.selRange.from.col));
} else {
rangeModifier(new WalkontableCellCoords(priv.selRange.from.row, instance.countCols() - 1));
}
event.preventDefault();
helper.stopPropagation(event);
break;
case keyCodes.PAGE_UP:
selection.transformStart(-instance.countVisibleRows(), 0);
event.preventDefault();
helper.stopPropagation(event);
break;
case keyCodes.PAGE_DOWN:
selection.transformStart(instance.countVisibleRows(), 0);
event.preventDefault();
helper.stopPropagation(event);
break;
}
}
function init() {
instance.addHook('afterDocumentKeyDown', onKeyDown);
eventManager.addEventListener(document.documentElement, 'keydown', function(event) {
instance.runHooks('afterDocumentKeyDown', event);
});
function onDblClick(event, coords, elem) {
if (elem.nodeName == "TD") {
_this.openEditor();
}
}
instance.view.wt.update('onCellDblClick', onDblClick);
instance.addHook('afterDestroy', function() {
destroyed = true;
});
}
this.destroyEditor = function(revertOriginal) {
this.closeEditor(revertOriginal);
};
this.getActiveEditor = function() {
return activeEditor;
};
this.prepareEditor = function() {
var row,
col,
prop,
td,
originalValue,
cellProperties,
editorClass;
if (activeEditor && activeEditor.isWaiting()) {
this.closeEditor(false, false, function(dataSaved) {
if (dataSaved) {
_this.prepareEditor();
}
});
return;
}
row = priv.selRange.highlight.row;
col = priv.selRange.highlight.col;
prop = instance.colToProp(col);
td = instance.getCell(row, col);
originalValue = instance.getDataAtCell(row, col);
cellProperties = instance.getCellMeta(row, col);
editorClass = instance.getCellEditor(cellProperties);
if (editorClass) {
activeEditor = Handsontable.editors.getEditor(editorClass, instance);
activeEditor.prepare(row, col, prop, td, originalValue, cellProperties);
} else {
activeEditor = void 0;
}
};
this.isEditorOpened = function() {
return activeEditor && activeEditor.isOpened();
};
this.openEditor = function(initialValue, event) {
if (activeEditor && !activeEditor.cellProperties.readOnly) {
activeEditor.beginEditing(initialValue, event);
} else if (activeEditor && activeEditor.cellProperties.readOnly) {
if (event && event.keyCode === helper.keyCode.ENTER) {
moveSelectionAfterEnter();
}
}
};
this.closeEditor = function(restoreOriginalValue, ctrlDown, callback) {
if (!activeEditor) {
if (callback) {
callback(false);
}
} else {
activeEditor.finishEditing(restoreOriginalValue, ctrlDown, callback);
}
};
this.closeEditorAndSaveChanges = function(ctrlDown) {
return this.closeEditor(false, ctrlDown);
};
this.closeEditorAndRestoreOriginalValue = function(ctrlDown) {
return this.closeEditor(true, ctrlDown);
};
init();
}
//#
},{"./3rdparty/walkontable/src/cell/coords.js":5,"./dom.js":27,"./editors.js":29,"./eventManager.js":41,"./helpers.js":42}],29:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
registerEditor: {get: function() {
return registerEditor;
}},
getEditor: {get: function() {
return getEditor;
}},
hasEditor: {get: function() {
return hasEditor;
}},
getEditorConstructor: {get: function() {
return getEditorConstructor;
}},
__esModule: {value: true}
});
var $__helpers_46_js__;
var helper = ($__helpers_46_js__ = require("./helpers.js"), $__helpers_46_js__ && $__helpers_46_js__.__esModule && $__helpers_46_js__ || {default: $__helpers_46_js__});
;
var registeredEditorNames = {},
registeredEditorClasses = new WeakMap();
Handsontable.editors = Handsontable.editors || {};
Handsontable.editors.registerEditor = registerEditor;
Handsontable.editors.getEditor = getEditor;
function RegisteredEditor(editorClass) {
var Clazz,
instances;
instances = {};
Clazz = editorClass;
this.getConstructor = function() {
return editorClass;
};
this.getInstance = function(hotInstance) {
if (!(hotInstance.guid in instances)) {
instances[hotInstance.guid] = new Clazz(hotInstance);
}
return instances[hotInstance.guid];
};
}
function registerEditor(editorName, editorClass) {
var editor = new RegisteredEditor(editorClass);
if (typeof editorName === "string") {
registeredEditorNames[editorName] = editor;
}
registeredEditorClasses.set(editorClass, editor);
}
function getEditor(editorName, hotInstance) {
var editor;
if (typeof editorName == 'function') {
if (!(registeredEditorClasses.get(editorName))) {
registerEditor(null, editorName);
}
editor = registeredEditorClasses.get(editorName);
} else if (typeof editorName == 'string') {
editor = registeredEditorNames[editorName];
} else {
throw Error('Only strings and functions can be passed as "editor" parameter ');
}
if (!editor) {
throw Error('No editor registered under name "' + editorName + '"');
}
return editor.getInstance(hotInstance);
}
function getEditorConstructor(editorName) {
var editor;
if (typeof editorName == 'string') {
editor = registeredEditorNames[editorName];
} else {
throw Error('Only strings and functions can be passed as "editor" parameter ');
}
if (!editor) {
throw Error('No editor registered under name "' + editorName + '"');
}
return editor.getConstructor();
}
function hasEditor(editorName) {
return registeredEditorNames[editorName] ? true : false;
}
//#
},{"./helpers.js":42}],30:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
BaseEditor: {get: function() {
return BaseEditor;
}},
__esModule: {value: true}
});
var $___46__46__47_helpers_46_js__,
$___46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__;
var helper = ($___46__46__47_helpers_46_js__ = require("./../helpers.js"), $___46__46__47_helpers_46_js__ && $___46__46__47_helpers_46_js__.__esModule && $___46__46__47_helpers_46_js__ || {default: $___46__46__47_helpers_46_js__});
var WalkontableCellCoords = ($___46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ = require("./../3rdparty/walkontable/src/cell/coords.js"), $___46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ && $___46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__.__esModule && $___46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ || {default: $___46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__}).WalkontableCellCoords;
;
Handsontable.editors = Handsontable.editors || {};
Handsontable.editors.BaseEditor = BaseEditor;
Handsontable.EditorState = {
VIRGIN: 'STATE_VIRGIN',
EDITING: 'STATE_EDITING',
WAITING: 'STATE_WAITING',
FINISHED: 'STATE_FINISHED'
};
function BaseEditor(instance) {
this.instance = instance;
this.state = Handsontable.EditorState.VIRGIN;
this._opened = false;
this._closeCallback = null;
this.init();
}
BaseEditor.prototype._fireCallbacks = function(result) {
if (this._closeCallback) {
this._closeCallback(result);
this._closeCallback = null;
}
};
BaseEditor.prototype.init = function() {};
BaseEditor.prototype.getValue = function() {
throw Error('Editor getValue() method unimplemented');
};
BaseEditor.prototype.setValue = function(newValue) {
throw Error('Editor setValue() method unimplemented');
};
BaseEditor.prototype.open = function() {
throw Error('Editor open() method unimplemented');
};
BaseEditor.prototype.close = function() {
throw Error('Editor close() method unimplemented');
};
BaseEditor.prototype.prepare = function(row, col, prop, td, originalValue, cellProperties) {
this.TD = td;
this.row = row;
this.col = col;
this.prop = prop;
this.originalValue = originalValue;
this.cellProperties = cellProperties;
this.state = Handsontable.EditorState.VIRGIN;
};
BaseEditor.prototype.extend = function() {
var baseClass = this.constructor;
function Editor() {
baseClass.apply(this, arguments);
}
function inherit(Child, Parent) {
function Bridge() {}
Bridge.prototype = Parent.prototype;
Child.prototype = new Bridge();
Child.prototype.constructor = Child;
return Child;
}
return inherit(Editor, baseClass);
};
BaseEditor.prototype.saveValue = function(val, ctrlDown) {
var sel,
tmp;
if (ctrlDown) {
sel = this.instance.getSelected();
if (sel[0] > sel[2]) {
tmp = sel[0];
sel[0] = sel[2];
sel[2] = tmp;
}
if (sel[1] > sel[3]) {
tmp = sel[1];
sel[1] = sel[3];
sel[3] = tmp;
}
this.instance.populateFromArray(sel[0], sel[1], val, sel[2], sel[3], 'edit');
} else {
this.instance.populateFromArray(this.row, this.col, val, null, null, 'edit');
}
};
BaseEditor.prototype.beginEditing = function(initialValue, event) {
if (this.state != Handsontable.EditorState.VIRGIN) {
return;
}
this.instance.view.scrollViewport(new WalkontableCellCoords(this.row, this.col));
this.instance.view.render();
this.state = Handsontable.EditorState.EDITING;
initialValue = typeof initialValue == 'string' ? initialValue : this.originalValue;
this.setValue(helper.stringify(initialValue));
this.open(event);
this._opened = true;
this.focus();
this.instance.view.render();
};
BaseEditor.prototype.finishEditing = function(restoreOriginalValue, ctrlDown, callback) {
var _this = this,
val;
if (callback) {
var previousCloseCallback = this._closeCallback;
this._closeCallback = function(result) {
if (previousCloseCallback) {
previousCloseCallback(result);
}
callback(result);
};
}
if (this.isWaiting()) {
return;
}
if (this.state == Handsontable.EditorState.VIRGIN) {
this.instance._registerTimeout(setTimeout(function() {
_this._fireCallbacks(true);
}, 0));
return;
}
if (this.state == Handsontable.EditorState.EDITING) {
if (restoreOriginalValue) {
this.cancelChanges();
this.instance.view.render();
return;
}
if (this.instance.getSettings().trimWhitespace) {
val = [[typeof this.getValue() === 'string' ? String.prototype.trim.call(this.getValue() || '') : this.getValue()]];
} else {
val = [[this.getValue()]];
}
this.state = Handsontable.EditorState.WAITING;
this.saveValue(val, ctrlDown);
if (this.instance.getCellValidator(this.cellProperties)) {
this.instance.addHookOnce('postAfterValidate', function(result) {
_this.state = Handsontable.EditorState.FINISHED;
_this.discardEditor(result);
});
} else {
this.state = Handsontable.EditorState.FINISHED;
this.discardEditor(true);
}
}
};
BaseEditor.prototype.cancelChanges = function() {
this.state = Handsontable.EditorState.FINISHED;
this.discardEditor();
};
BaseEditor.prototype.discardEditor = function(result) {
if (this.state !== Handsontable.EditorState.FINISHED) {
return;
}
if (result === false && this.cellProperties.allowInvalid !== true) {
this.instance.selectCell(this.row, this.col);
this.focus();
this.state = Handsontable.EditorState.EDITING;
this._fireCallbacks(false);
} else {
this.close();
this._opened = false;
this.state = Handsontable.EditorState.VIRGIN;
this._fireCallbacks(true);
}
};
BaseEditor.prototype.isOpened = function() {
return this._opened;
};
BaseEditor.prototype.isWaiting = function() {
return this.state === Handsontable.EditorState.WAITING;
};
//#
},{"./../3rdparty/walkontable/src/cell/coords.js":5,"./../helpers.js":42}],31:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
AutocompleteEditor: {get: function() {
return AutocompleteEditor;
}},
__esModule: {value: true}
});
var $___46__46__47_helpers_46_js__,
$___46__46__47_dom_46_js__,
$___46__46__47_editors_46_js__,
$__handsontableEditor_46_js__;
var helper = ($___46__46__47_helpers_46_js__ = require("./../helpers.js"), $___46__46__47_helpers_46_js__ && $___46__46__47_helpers_46_js__.__esModule && $___46__46__47_helpers_46_js__ || {default: $___46__46__47_helpers_46_js__});
var dom = ($___46__46__47_dom_46_js__ = require("./../dom.js"), $___46__46__47_dom_46_js__ && $___46__46__47_dom_46_js__.__esModule && $___46__46__47_dom_46_js__ || {default: $___46__46__47_dom_46_js__});
var $__0 = ($___46__46__47_editors_46_js__ = require("./../editors.js"), $___46__46__47_editors_46_js__ && $___46__46__47_editors_46_js__.__esModule && $___46__46__47_editors_46_js__ || {default: $___46__46__47_editors_46_js__}),
getEditorConstructor = $__0.getEditorConstructor,
registerEditor = $__0.registerEditor;
var HandsontableEditor = ($__handsontableEditor_46_js__ = require("./handsontableEditor.js"), $__handsontableEditor_46_js__ && $__handsontableEditor_46_js__.__esModule && $__handsontableEditor_46_js__ || {default: $__handsontableEditor_46_js__}).HandsontableEditor;
var AutocompleteEditor = HandsontableEditor.prototype.extend();
;
Handsontable.editors = Handsontable.editors || {};
Handsontable.editors.AutocompleteEditor = AutocompleteEditor;
AutocompleteEditor.prototype.init = function() {
HandsontableEditor.prototype.init.apply(this, arguments);
this.query = null;
this.choices = [];
};
AutocompleteEditor.prototype.createElements = function() {
HandsontableEditor.prototype.createElements.apply(this, arguments);
dom.addClass(this.htContainer, 'autocompleteEditor');
dom.addClass(this.htContainer, window.navigator.platform.indexOf('Mac') !== -1 ? 'htMacScroll' : '');
};
var skipOne = false;
function onBeforeKeyDown(event) {
skipOne = false;
var editor = this.getActiveEditor();
var keyCodes = helper.keyCode;
if (helper.isPrintableChar(event.keyCode) || event.keyCode === keyCodes.BACKSPACE || event.keyCode === keyCodes.DELETE || event.keyCode === keyCodes.INSERT) {
var timeOffset = 0;
if (event.keyCode === keyCodes.C && (event.ctrlKey || event.metaKey)) {
return;
}
if (!editor.isOpened()) {
timeOffset += 10;
}
editor.instance._registerTimeout(setTimeout(function() {
editor.queryChoices(editor.TEXTAREA.value);
skipOne = true;
}, timeOffset));
}
}
AutocompleteEditor.prototype.prepare = function() {
this.instance.addHook('beforeKeyDown', onBeforeKeyDown);
HandsontableEditor.prototype.prepare.apply(this, arguments);
};
AutocompleteEditor.prototype.open = function() {
HandsontableEditor.prototype.open.apply(this, arguments);
var choicesListHot = this.htEditor.getInstance();
var that = this;
this.TEXTAREA.style.visibility = 'visible';
this.focus();
choicesListHot.updateSettings({
'colWidths': [dom.outerWidth(this.TEXTAREA) - 2],
width: dom.outerWidth(this.TEXTAREA) + dom.getScrollbarWidth() + 2,
afterRenderer: function(TD, row, col, prop, value) {
var caseSensitive = this.getCellMeta(row, col).filteringCaseSensitive === true,
indexOfMatch,
match,
value = Handsontable.helper.stringify(value);
if (value) {
indexOfMatch = caseSensitive ? value.indexOf(this.query) : value.toLowerCase().indexOf(that.query.toLowerCase());
if (indexOfMatch != -1) {
match = value.substr(indexOfMatch, that.query.length);
TD.innerHTML = value.replace(match, '<strong>' + match + '</strong>');
}
}
}
});
this.htEditor.view.wt.wtTable.holder.parentNode.style['padding-right'] = dom.getScrollbarWidth() + 2 + 'px';
if (skipOne) {
skipOne = false;
}
that.instance._registerTimeout(setTimeout(function() {
that.queryChoices(that.TEXTAREA.value);
}, 0));
};
AutocompleteEditor.prototype.close = function() {
HandsontableEditor.prototype.close.apply(this, arguments);
};
AutocompleteEditor.prototype.queryChoices = function(query) {
this.query = query;
if (typeof this.cellProperties.source == 'function') {
var that = this;
this.cellProperties.source(query, function(choices) {
that.updateChoicesList(choices);
});
} else if (Array.isArray(this.cellProperties.source)) {
var choices;
if (!query || this.cellProperties.filter === false) {
choices = this.cellProperties.source;
} else {
var filteringCaseSensitive = this.cellProperties.filteringCaseSensitive === true;
var lowerCaseQuery = query.toLowerCase();
choices = this.cellProperties.source.filter(function(choice) {
if (filteringCaseSensitive) {
return choice.indexOf(query) != -1;
} else {
return choice.toLowerCase().indexOf(lowerCaseQuery) != -1;
}
});
}
this.updateChoicesList(choices);
} else {
this.updateChoicesList([]);
}
};
AutocompleteEditor.prototype.updateChoicesList = function(choices) {
var pos = dom.getCaretPosition(this.TEXTAREA),
endPos = dom.getSelectionEndPosition(this.TEXTAREA);
var orderByRelevance = AutocompleteEditor.sortByRelevance(this.getValue(), choices, this.cellProperties.filteringCaseSensitive);
var highlightIndex;
if (this.cellProperties.filter != false) {
var sorted = [];
for (var i = 0,
choicesCount = orderByRelevance.length; i < choicesCount; i++) {
sorted.push(choices[orderByRelevance[i]]);
}
highlightIndex = 0;
choices = sorted;
} else {
highlightIndex = orderByRelevance[0];
}
this.choices = choices;
this.htEditor.loadData(helper.pivot([choices]));
this.updateDropdownHeight();
if (this.cellProperties.strict === true) {
this.highlightBestMatchingChoice(highlightIndex);
}
this.instance.listen();
this.TEXTAREA.focus();
dom.setCaretPosition(this.TEXTAREA, pos, (pos != endPos ? endPos : void 0));
};
AutocompleteEditor.prototype.updateDropdownHeight = function() {
this.htEditor.updateSettings({height: this.getDropdownHeight()});
this.htEditor.view.wt.wtTable.alignOverlaysWithTrimmingContainer();
};
AutocompleteEditor.prototype.finishEditing = function(restoreOriginalValue) {
if (!restoreOriginalValue) {
this.instance.removeHook('beforeKeyDown', onBeforeKeyDown);
}
HandsontableEditor.prototype.finishEditing.apply(this, arguments);
};
AutocompleteEditor.prototype.highlightBestMatchingChoice = function(index) {
if (typeof index === "number") {
this.htEditor.selectCell(index, 0);
} else {
this.htEditor.deselectCell();
}
};
AutocompleteEditor.sortByRelevance = function(value, choices, caseSensitive) {
var choicesRelevance = [],
currentItem,
valueLength = value.length,
valueIndex,
charsLeft,
result = [],
i,
choicesCount;
if (valueLength === 0) {
for (i = 0, choicesCount = choices.length; i < choicesCount; i++) {
result.push(i);
}
return result;
}
for (i = 0, choicesCount = choices.length; i < choicesCount; i++) {
currentItem = Handsontable.helper.stringify(choices[i]);
if (caseSensitive) {
valueIndex = currentItem.indexOf(value);
} else {
valueIndex = currentItem.toLowerCase().indexOf(value.toLowerCase());
}
if (valueIndex == -1) {
continue;
}
charsLeft = currentItem.length - valueIndex - valueLength;
choicesRelevance.push({
baseIndex: i,
index: valueIndex,
charsLeft: charsLeft,
value: currentItem
});
}
choicesRelevance.sort(function(a, b) {
if (b.index === -1) {
return -1;
}
if (a.index === -1) {
return 1;
}
if (a.index < b.index) {
return -1;
} else if (b.index < a.index) {
return 1;
} else if (a.index === b.index) {
if (a.charsLeft < b.charsLeft) {
return -1;
} else if (a.charsLeft > b.charsLeft) {
return 1;
} else {
return 0;
}
}
});
for (i = 0, choicesCount = choicesRelevance.length; i < choicesCount; i++) {
result.push(choicesRelevance[i].baseIndex);
}
return result;
};
AutocompleteEditor.prototype.getDropdownHeight = function() {
var firstRowHeight = this.htEditor.getInstance().getRowHeight(0) || 23;
return this.choices.length >= 10 ? 10 * firstRowHeight : this.choices.length * firstRowHeight + 8;
};
registerEditor('autocomplete', AutocompleteEditor);
//#
},{"./../dom.js":27,"./../editors.js":29,"./../helpers.js":42,"./handsontableEditor.js":35}],32:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
CheckboxEditor: {get: function() {
return CheckboxEditor;
}},
__esModule: {value: true}
});
var $___46__46__47_editors_46_js__,
$___95_baseEditor_46_js__;
var registerEditor = ($___46__46__47_editors_46_js__ = require("./../editors.js"), $___46__46__47_editors_46_js__ && $___46__46__47_editors_46_js__.__esModule && $___46__46__47_editors_46_js__ || {default: $___46__46__47_editors_46_js__}).registerEditor;
var BaseEditor = ($___95_baseEditor_46_js__ = require("./_baseEditor.js"), $___95_baseEditor_46_js__ && $___95_baseEditor_46_js__.__esModule && $___95_baseEditor_46_js__ || {default: $___95_baseEditor_46_js__}).BaseEditor;
var CheckboxEditor = BaseEditor.prototype.extend();
;
Handsontable.editors = Handsontable.editors || {};
Handsontable.editors.CheckboxEditor = CheckboxEditor;
CheckboxEditor.prototype.beginEditing = function() {
var checkbox = this.TD.querySelector('input[type="checkbox"]');
if (checkbox) {
checkbox.click();
}
};
CheckboxEditor.prototype.finishEditing = function() {};
CheckboxEditor.prototype.init = function() {};
CheckboxEditor.prototype.open = function() {};
CheckboxEditor.prototype.close = function() {};
CheckboxEditor.prototype.getValue = function() {};
CheckboxEditor.prototype.setValue = function() {};
CheckboxEditor.prototype.focus = function() {};
registerEditor('checkbox', CheckboxEditor);
//#
},{"./../editors.js":29,"./_baseEditor.js":30}],33:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
DateEditor: {get: function() {
return DateEditor;
}},
__esModule: {value: true}
});
var $___46__46__47_helpers_46_js__,
$___46__46__47_dom_46_js__,
$___46__46__47_editors_46_js__,
$__textEditor_46_js__,
$___46__46__47_eventManager_46_js__,
$__moment__,
$__pikaday__;
var helper = ($___46__46__47_helpers_46_js__ = require("./../helpers.js"), $___46__46__47_helpers_46_js__ && $___46__46__47_helpers_46_js__.__esModule && $___46__46__47_helpers_46_js__ || {default: $___46__46__47_helpers_46_js__});
var dom = ($___46__46__47_dom_46_js__ = require("./../dom.js"), $___46__46__47_dom_46_js__ && $___46__46__47_dom_46_js__.__esModule && $___46__46__47_dom_46_js__ || {default: $___46__46__47_dom_46_js__});
var $__0 = ($___46__46__47_editors_46_js__ = require("./../editors.js"), $___46__46__47_editors_46_js__ && $___46__46__47_editors_46_js__.__esModule && $___46__46__47_editors_46_js__ || {default: $___46__46__47_editors_46_js__}),
getEditor = $__0.getEditor,
registerEditor = $__0.registerEditor;
var TextEditor = ($__textEditor_46_js__ = require("./textEditor.js"), $__textEditor_46_js__ && $__textEditor_46_js__.__esModule && $__textEditor_46_js__ || {default: $__textEditor_46_js__}).TextEditor;
var eventManagerObject = ($___46__46__47_eventManager_46_js__ = require("./../eventManager.js"), $___46__46__47_eventManager_46_js__ && $___46__46__47_eventManager_46_js__.__esModule && $___46__46__47_eventManager_46_js__ || {default: $___46__46__47_eventManager_46_js__}).eventManager;
var moment = ($__moment__ = require("moment"), $__moment__ && $__moment__.__esModule && $__moment__ || {default: $__moment__}).default;
var Pikaday = ($__pikaday__ = require("pikaday"), $__pikaday__ && $__pikaday__.__esModule && $__pikaday__ || {default: $__pikaday__}).default;
Handsontable.editors = Handsontable.editors || {};
Handsontable.editors.DateEditor = DateEditor;
var DateEditor = function DateEditor(hotInstance) {
this.$datePicker = null;
this.datePicker = null;
this.datePickerStyle = null;
this.defaultDateFormat = 'DD/MM/YYYY';
this.isCellEdited = false;
this.parentDestroyed = false;
$traceurRuntime.superGet(this, $DateEditor.prototype, "constructor").call(this, hotInstance);
};
var $DateEditor = DateEditor;
($traceurRuntime.createClass)(DateEditor, {
init: function() {
var $__5 = this;
if (typeof moment !== 'function') {
throw new Error("You need to include moment.js to your project.");
}
if (typeof Pikaday !== 'function') {
throw new Error("You need to include Pikaday to your project.");
}
$traceurRuntime.superGet(this, $DateEditor.prototype, "init").call(this);
this.instance.addHook('afterDestroy', (function() {
$__5.parentDestroyed = true;
$__5.destroyElements();
}));
},
createElements: function() {
var $__5 = this;
$traceurRuntime.superGet(this, $DateEditor.prototype, "createElements").call(this);
this.datePicker = document.createElement('DIV');
this.datePickerStyle = this.datePicker.style;
this.datePickerStyle.position = 'absolute';
this.datePickerStyle.top = 0;
this.datePickerStyle.left = 0;
this.datePickerStyle.zIndex = 9999;
dom.addClass(this.datePicker, 'htDatepickerHolder');
document.body.appendChild(this.datePicker);
var htInput = this.TEXTAREA;
var defaultOptions = {
format: this.defaultDateFormat,
field: htInput,
trigger: htInput,
container: this.datePicker,
reposition: false,
bound: false,
onSelect: (function(dateStr) {
if (!isNaN(dateStr.getTime())) {
dateStr = moment(dateStr).format($__5.cellProperties.dateFormat || $__5.defaultDateFormat);
}
$__5.setValue(dateStr);
$__5.hideDatepicker();
}),
onClose: (function() {
if (!$__5.parentDestroyed) {
$__5.finishEditing(false);
}
})
};
this.$datePicker = new Pikaday(defaultOptions);
var eventManager = eventManagerObject(this);
eventManager.addEventListener(this.datePicker, 'mousedown', (function(event) {
helper.stopPropagation(event);
}));
this.hideDatepicker();
},
destroyElements: function() {
this.$datePicker.destroy();
},
prepare: function(row, col, prop, td, originalValue, cellProperties) {
this._opened = false;
$traceurRuntime.superGet(this, $DateEditor.prototype, "prepare").call(this, row, col, prop, td, originalValue, cellProperties);
},
open: function() {
var event = arguments[0] !== (void 0) ? arguments[0] : null;
$traceurRuntime.superGet(this, $DateEditor.prototype, "open").call(this);
this.showDatepicker(event);
},
close: function() {
var $__5 = this;
this._opened = false;
this.instance._registerTimeout(setTimeout((function() {
$__5.instance.selection.refreshBorders();
}), 0));
$traceurRuntime.superGet(this, $DateEditor.prototype, "close").call(this);
},
finishEditing: function() {
var isCancelled = arguments[0] !== (void 0) ? arguments[0] : false;
var ctrlDown = arguments[1] !== (void 0) ? arguments[1] : false;
if (isCancelled) {
var value = this.originalValue;
if (value !== void 0) {
this.setValue(value);
}
}
this.hideDatepicker();
$traceurRuntime.superGet(this, $DateEditor.prototype, "finishEditing").call(this, isCancelled, ctrlDown);
},
showDatepicker: function(event) {
var offset = this.TD.getBoundingClientRect();
var dateFormat = this.cellProperties.dateFormat || this.defaultDateFormat;
var datePickerConfig = this.$datePicker.config();
var dateStr;
var isMouseDown = this.instance.view.isMouseDown();
var isMeta = event ? helper.isMetaKey(event.keyCode) : false;
this.datePickerStyle.top = (window.pageYOffset + offset.top + dom.outerHeight(this.TD)) + 'px';
this.datePickerStyle.left = (window.pageXOffset + offset.left) + 'px';
this.$datePicker._onInputFocus = function() {};
datePickerConfig.format = dateFormat;
if (this.originalValue) {
dateStr = this.originalValue;
if (moment(dateStr, dateFormat, true).isValid()) {
this.$datePicker.setMoment(moment(dateStr, dateFormat), true);
}
if (!isMeta && !isMouseDown) {
this.setValue('');
}
} else {
if (this.cellProperties.defaultDate) {
dateStr = this.cellProperties.defaultDate;
datePickerConfig.defaultDate = dateStr;
if (moment(dateStr, dateFormat, true).isValid()) {
this.$datePicker.setMoment(moment(dateStr, dateFormat), true);
}
if (!isMeta && !isMouseDown) {
this.setValue('');
}
} else {
this.$datePicker.gotoToday();
}
}
this.datePickerStyle.display = 'block';
this.$datePicker.show();
},
hideDatepicker: function() {
this.datePickerStyle.display = 'none';
this.$datePicker.hide();
}
}, {}, TextEditor);
;
registerEditor('date', DateEditor);
//#
},{"./../dom.js":27,"./../editors.js":29,"./../eventManager.js":41,"./../helpers.js":42,"./textEditor.js":40,"moment":"moment","pikaday":"pikaday"}],34:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
DropdownEditor: {get: function() {
return DropdownEditor;
}},
__esModule: {value: true}
});
var $___46__46__47_editors_46_js__,
$__autocompleteEditor_46_js__;
var $__0 = ($___46__46__47_editors_46_js__ = require("./../editors.js"), $___46__46__47_editors_46_js__ && $___46__46__47_editors_46_js__.__esModule && $___46__46__47_editors_46_js__ || {default: $___46__46__47_editors_46_js__}),
getEditor = $__0.getEditor,
registerEditor = $__0.registerEditor;
var AutocompleteEditor = ($__autocompleteEditor_46_js__ = require("./autocompleteEditor.js"), $__autocompleteEditor_46_js__ && $__autocompleteEditor_46_js__.__esModule && $__autocompleteEditor_46_js__ || {default: $__autocompleteEditor_46_js__}).AutocompleteEditor;
var DropdownEditor = AutocompleteEditor.prototype.extend();
;
Handsontable.editors = Handsontable.editors || {};
Handsontable.editors.DropdownEditor = DropdownEditor;
DropdownEditor.prototype.prepare = function() {
AutocompleteEditor.prototype.prepare.apply(this, arguments);
this.cellProperties.filter = false;
this.cellProperties.strict = true;
};
registerEditor('dropdown', DropdownEditor);
//#
},{"./../editors.js":29,"./autocompleteEditor.js":31}],35:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
HandsontableEditor: {get: function() {
return HandsontableEditor;
}},
__esModule: {value: true}
});
var $___46__46__47_helpers_46_js__,
$___46__46__47_dom_46_js__,
$___46__46__47_editors_46_js__,
$__textEditor_46_js__;
var helper = ($___46__46__47_helpers_46_js__ = require("./../helpers.js"), $___46__46__47_helpers_46_js__ && $___46__46__47_helpers_46_js__.__esModule && $___46__46__47_helpers_46_js__ || {default: $___46__46__47_helpers_46_js__});
var dom = ($___46__46__47_dom_46_js__ = require("./../dom.js"), $___46__46__47_dom_46_js__ && $___46__46__47_dom_46_js__.__esModule && $___46__46__47_dom_46_js__ || {default: $___46__46__47_dom_46_js__});
var $__0 = ($___46__46__47_editors_46_js__ = require("./../editors.js"), $___46__46__47_editors_46_js__ && $___46__46__47_editors_46_js__.__esModule && $___46__46__47_editors_46_js__ || {default: $___46__46__47_editors_46_js__}),
getEditor = $__0.getEditor,
registerEditor = $__0.registerEditor;
var TextEditor = ($__textEditor_46_js__ = require("./textEditor.js"), $__textEditor_46_js__ && $__textEditor_46_js__.__esModule && $__textEditor_46_js__ || {default: $__textEditor_46_js__}).TextEditor;
var HandsontableEditor = TextEditor.prototype.extend();
;
Handsontable.editors = Handsontable.editors || {};
Handsontable.editors.HandsontableEditor = HandsontableEditor;
HandsontableEditor.prototype.createElements = function() {
TextEditor.prototype.createElements.apply(this, arguments);
var DIV = document.createElement('DIV');
DIV.className = 'handsontableEditor';
this.TEXTAREA_PARENT.appendChild(DIV);
this.htContainer = DIV;
this.htEditor = new Handsontable(DIV);
this.assignHooks();
};
HandsontableEditor.prototype.prepare = function(td, row, col, prop, value, cellProperties) {
TextEditor.prototype.prepare.apply(this, arguments);
var parent = this;
var options = {
startRows: 0,
startCols: 0,
minRows: 0,
minCols: 0,
className: 'listbox',
copyPaste: false,
cells: function() {
return {readOnly: true};
},
fillHandle: false,
afterOnCellMouseDown: function() {
var value = this.getValue();
if (value !== void 0) {
parent.setValue(value);
}
parent.instance.destroyEditor();
}
};
if (this.cellProperties.handsontable) {
helper.extend(options, cellProperties.handsontable);
}
if (this.htEditor) {
this.htEditor.destroy();
}
this.htEditor = new Handsontable(this.htContainer, options);
};
var onBeforeKeyDown = function(event) {
if (event != null && event.isImmediatePropagationEnabled == null) {
event.stopImmediatePropagation = function() {
this.isImmediatePropagationEnabled = false;
this.cancelBubble = true;
};
event.isImmediatePropagationEnabled = true;
event.isImmediatePropagationStopped = function() {
return !this.isImmediatePropagationEnabled;
};
}
if (event.isImmediatePropagationStopped()) {
return;
}
var editor = this.getActiveEditor();
var innerHOT = editor.htEditor.getInstance();
var rowToSelect;
if (event.keyCode == helper.keyCode.ARROW_DOWN) {
if (!innerHOT.getSelected()) {
rowToSelect = 0;
} else {
var selectedRow = innerHOT.getSelected()[0];
var lastRow = innerHOT.countRows() - 1;
rowToSelect = Math.min(lastRow, selectedRow + 1);
}
} else if (event.keyCode == helper.keyCode.ARROW_UP) {
if (innerHOT.getSelected()) {
var selectedRow = innerHOT.getSelected()[0];
rowToSelect = selectedRow - 1;
}
}
if (rowToSelect !== void 0) {
if (rowToSelect < 0) {
innerHOT.deselectCell();
} else {
innerHOT.selectCell(rowToSelect, 0);
}
event.preventDefault();
event.stopImmediatePropagation();
editor.instance.listen();
editor.TEXTAREA.focus();
}
};
HandsontableEditor.prototype.open = function() {
this.instance.addHook('beforeKeyDown', onBeforeKeyDown);
TextEditor.prototype.open.apply(this, arguments);
this.htEditor.render();
if (this.cellProperties.strict) {
this.htEditor.selectCell(0, 0);
this.TEXTAREA.style.visibility = 'hidden';
} else {
this.htEditor.deselectCell();
this.TEXTAREA.style.visibility = 'visible';
}
dom.setCaretPosition(this.TEXTAREA, 0, this.TEXTAREA.value.length);
};
HandsontableEditor.prototype.close = function() {
this.instance.removeHook('beforeKeyDown', onBeforeKeyDown);
this.instance.listen();
TextEditor.prototype.close.apply(this, arguments);
};
HandsontableEditor.prototype.focus = function() {
this.instance.listen();
TextEditor.prototype.focus.apply(this, arguments);
};
HandsontableEditor.prototype.beginEditing = function(initialValue) {
var onBeginEditing = this.instance.getSettings().onBeginEditing;
if (onBeginEditing && onBeginEditing() === false) {
return;
}
TextEditor.prototype.beginEditing.apply(this, arguments);
};
HandsontableEditor.prototype.finishEditing = function(isCancelled, ctrlDown) {
if (this.htEditor.isListening()) {
this.instance.listen();
}
if (this.htEditor.getSelected()) {
var value = this.htEditor.getInstance().getValue();
if (value !== void 0) {
this.setValue(value);
}
}
return TextEditor.prototype.finishEditing.apply(this, arguments);
};
HandsontableEditor.prototype.assignHooks = function() {
var _this = this;
this.instance.addHook('afterDestroy', function() {
if (_this.htEditor) {
_this.htEditor.destroy();
}
});
};
registerEditor('handsontable', HandsontableEditor);
//#
},{"./../dom.js":27,"./../editors.js":29,"./../helpers.js":42,"./textEditor.js":40}],36:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
MobileTextEditor: {get: function() {
return MobileTextEditor;
}},
__esModule: {value: true}
});
var $___46__46__47_helpers_46_js__,
$___46__46__47_dom_46_js__,
$___46__46__47_editors_46_js__,
$___95_baseEditor_46_js__,
$___46__46__47_eventManager_46_js__;
var helper = ($___46__46__47_helpers_46_js__ = require("./../helpers.js"), $___46__46__47_helpers_46_js__ && $___46__46__47_helpers_46_js__.__esModule && $___46__46__47_helpers_46_js__ || {default: $___46__46__47_helpers_46_js__});
var dom = ($___46__46__47_dom_46_js__ = require("./../dom.js"), $___46__46__47_dom_46_js__ && $___46__46__47_dom_46_js__.__esModule && $___46__46__47_dom_46_js__ || {default: $___46__46__47_dom_46_js__});
var $__0 = ($___46__46__47_editors_46_js__ = require("./../editors.js"), $___46__46__47_editors_46_js__ && $___46__46__47_editors_46_js__.__esModule && $___46__46__47_editors_46_js__ || {default: $___46__46__47_editors_46_js__}),
getEditor = $__0.getEditor,
registerEditor = $__0.registerEditor;
var BaseEditor = ($___95_baseEditor_46_js__ = require("./_baseEditor.js"), $___95_baseEditor_46_js__ && $___95_baseEditor_46_js__.__esModule && $___95_baseEditor_46_js__ || {default: $___95_baseEditor_46_js__}).BaseEditor;
var eventManagerObject = ($___46__46__47_eventManager_46_js__ = require("./../eventManager.js"), $___46__46__47_eventManager_46_js__ && $___46__46__47_eventManager_46_js__.__esModule && $___46__46__47_eventManager_46_js__ || {default: $___46__46__47_eventManager_46_js__}).eventManager;
var MobileTextEditor = BaseEditor.prototype.extend(),
domDimensionsCache = {};
;
Handsontable.editors = Handsontable.editors || {};
Handsontable.editors.MobileTextEditor = MobileTextEditor;
var createControls = function() {
this.controls = {};
this.controls.leftButton = document.createElement('DIV');
this.controls.leftButton.className = 'leftButton';
this.controls.rightButton = document.createElement('DIV');
this.controls.rightButton.className = 'rightButton';
this.controls.upButton = document.createElement('DIV');
this.controls.upButton.className = 'upButton';
this.controls.downButton = document.createElement('DIV');
this.controls.downButton.className = 'downButton';
for (var button in this.controls) {
if (this.controls.hasOwnProperty(button)) {
this.positionControls.appendChild(this.controls[button]);
}
}
};
MobileTextEditor.prototype.valueChanged = function() {
return this.initValue != this.getValue();
};
MobileTextEditor.prototype.init = function() {
var that = this;
this.eventManager = eventManagerObject(this.instance);
this.createElements();
this.bindEvents();
this.instance.addHook('afterDestroy', function() {
that.destroy();
});
};
MobileTextEditor.prototype.getValue = function() {
return this.TEXTAREA.value;
};
MobileTextEditor.prototype.setValue = function(newValue) {
this.initValue = newValue;
this.TEXTAREA.value = newValue;
};
MobileTextEditor.prototype.createElements = function() {
this.editorContainer = document.createElement('DIV');
this.editorContainer.className = "htMobileEditorContainer";
this.cellPointer = document.createElement('DIV');
this.cellPointer.className = "cellPointer";
this.moveHandle = document.createElement('DIV');
this.moveHandle.className = "moveHandle";
this.inputPane = document.createElement('DIV');
this.inputPane.className = "inputs";
this.positionControls = document.createElement('DIV');
this.positionControls.className = "positionControls";
this.TEXTAREA = document.createElement('TEXTAREA');
dom.addClass(this.TEXTAREA, 'handsontableInput');
this.inputPane.appendChild(this.TEXTAREA);
this.editorContainer.appendChild(this.cellPointer);
this.editorContainer.appendChild(this.moveHandle);
this.editorContainer.appendChild(this.inputPane);
this.editorContainer.appendChild(this.positionControls);
createControls.call(this);
document.body.appendChild(this.editorContainer);
};
MobileTextEditor.prototype.onBeforeKeyDown = function(event) {
var instance = this;
var that = instance.getActiveEditor();
dom.enableImmediatePropagation(event);
if (event.target !== that.TEXTAREA || event.isImmediatePropagationStopped()) {
return;
}
var keyCodes = helper.keyCode;
switch (event.keyCode) {
case keyCodes.ENTER:
that.close();
event.preventDefault();
break;
case keyCodes.BACKSPACE:
event.stopImmediatePropagation();
break;
}
};
MobileTextEditor.prototype.open = function() {
this.instance.addHook('beforeKeyDown', this.onBeforeKeyDown);
dom.addClass(this.editorContainer, 'active');
dom.removeClass(this.cellPointer, 'hidden');
this.updateEditorPosition();
};
MobileTextEditor.prototype.focus = function() {
this.TEXTAREA.focus();
dom.setCaretPosition(this.TEXTAREA, this.TEXTAREA.value.length);
};
MobileTextEditor.prototype.close = function() {
this.TEXTAREA.blur();
this.instance.removeHook('beforeKeyDown', this.onBeforeKeyDown);
dom.removeClass(this.editorContainer, 'active');
};
MobileTextEditor.prototype.scrollToView = function() {
var coords = this.instance.getSelectedRange().highlight;
this.instance.view.scrollViewport(coords);
};
MobileTextEditor.prototype.hideCellPointer = function() {
if (!dom.hasClass(this.cellPointer, 'hidden')) {
dom.addClass(this.cellPointer, 'hidden');
}
};
MobileTextEditor.prototype.updateEditorPosition = function(x, y) {
if (x && y) {
x = parseInt(x, 10);
y = parseInt(y, 10);
this.editorContainer.style.top = y + "px";
this.editorContainer.style.left = x + "px";
} else {
var selection = this.instance.getSelected(),
selectedCell = this.instance.getCell(selection[0], selection[1]);
if (!domDimensionsCache.cellPointer) {
domDimensionsCache.cellPointer = {
height: dom.outerHeight(this.cellPointer),
width: dom.outerWidth(this.cellPointer)
};
}
if (!domDimensionsCache.editorContainer) {
domDimensionsCache.editorContainer = {width: dom.outerWidth(this.editorContainer)};
}
if (selectedCell !== undefined) {
var scrollLeft = this.instance.view.wt.wtOverlays.leftOverlay.trimmingContainer == window ? 0 : dom.getScrollLeft(this.instance.view.wt.wtOverlays.leftOverlay.holder);
var scrollTop = this.instance.view.wt.wtOverlays.topOverlay.trimmingContainer == window ? 0 : dom.getScrollTop(this.instance.view.wt.wtOverlays.topOverlay.holder);
var selectedCellOffset = dom.offset(selectedCell),
selectedCellWidth = dom.outerWidth(selectedCell),
currentScrollPosition = {
x: scrollLeft,
y: scrollTop
};
this.editorContainer.style.top = parseInt(selectedCellOffset.top + dom.outerHeight(selectedCell) - currentScrollPosition.y + domDimensionsCache.cellPointer.height, 10) + "px";
this.editorContainer.style.left = parseInt((window.innerWidth / 2) - (domDimensionsCache.editorContainer.width / 2), 10) + "px";
if (selectedCellOffset.left + selectedCellWidth / 2 > parseInt(this.editorContainer.style.left, 10) + domDimensionsCache.editorContainer.width) {
this.editorContainer.style.left = window.innerWidth - domDimensionsCache.editorContainer.width + "px";
} else if (selectedCellOffset.left + selectedCellWidth / 2 < parseInt(this.editorContainer.style.left, 10) + 20) {
this.editorContainer.style.left = 0 + "px";
}
this.cellPointer.style.left = parseInt(selectedCellOffset.left - (domDimensionsCache.cellPointer.width / 2) - dom.offset(this.editorContainer).left + (selectedCellWidth / 2) - currentScrollPosition.x, 10) + "px";
}
}
};
MobileTextEditor.prototype.updateEditorData = function() {
var selected = this.instance.getSelected(),
selectedValue = this.instance.getDataAtCell(selected[0], selected[1]);
this.row = selected[0];
this.col = selected[1];
this.setValue(selectedValue);
this.updateEditorPosition();
};
MobileTextEditor.prototype.prepareAndSave = function() {
var val;
if (!this.valueChanged()) {
return true;
}
if (this.instance.getSettings().trimWhitespace) {
val = [[String.prototype.trim.call(this.getValue())]];
} else {
val = [[this.getValue()]];
}
this.saveValue(val);
};
MobileTextEditor.prototype.bindEvents = function() {
var that = this;
this.eventManager.addEventListener(this.controls.leftButton, "touchend", function(event) {
that.prepareAndSave();
that.instance.selection.transformStart(0, -1, null, true);
that.updateEditorData();
event.preventDefault();
});
this.eventManager.addEventListener(this.controls.rightButton, "touchend", function(event) {
that.prepareAndSave();
that.instance.selection.transformStart(0, 1, null, true);
that.updateEditorData();
event.preventDefault();
});
this.eventManager.addEventListener(this.controls.upButton, "touchend", function(event) {
that.prepareAndSave();
that.instance.selection.transformStart(-1, 0, null, true);
that.updateEditorData();
event.preventDefault();
});
this.eventManager.addEventListener(this.controls.downButton, "touchend", function(event) {
that.prepareAndSave();
that.instance.selection.transformStart(1, 0, null, true);
that.updateEditorData();
event.preventDefault();
});
this.eventManager.addEventListener(this.moveHandle, "touchstart", function(event) {
if (event.touches.length == 1) {
var touch = event.touches[0],
onTouchPosition = {
x: that.editorContainer.offsetLeft,
y: that.editorContainer.offsetTop
},
onTouchOffset = {
x: touch.pageX - onTouchPosition.x,
y: touch.pageY - onTouchPosition.y
};
that.eventManager.addEventListener(this, "touchmove", function(event) {
var touch = event.touches[0];
that.updateEditorPosition(touch.pageX - onTouchOffset.x, touch.pageY - onTouchOffset.y);
that.hideCellPointer();
event.preventDefault();
});
}
});
this.eventManager.addEventListener(document.body, "touchend", function(event) {
if (!dom.isChildOf(event.target, that.editorContainer) && !dom.isChildOf(event.target, that.instance.rootElement)) {
that.close();
}
});
this.eventManager.addEventListener(this.instance.view.wt.wtOverlays.leftOverlay.holder, "scroll", function(event) {
if (that.instance.view.wt.wtOverlays.leftOverlay.trimmingContainer != window) {
that.hideCellPointer();
}
});
this.eventManager.addEventListener(this.instance.view.wt.wtOverlays.topOverlay.holder, "scroll", function(event) {
if (that.instance.view.wt.wtOverlays.topOverlay.trimmingContainer != window) {
that.hideCellPointer();
}
});
};
MobileTextEditor.prototype.destroy = function() {
this.eventManager.clear();
this.editorContainer.parentNode.removeChild(this.editorContainer);
};
registerEditor('mobile', MobileTextEditor);
//#
},{"./../dom.js":27,"./../editors.js":29,"./../eventManager.js":41,"./../helpers.js":42,"./_baseEditor.js":30}],37:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
NumericEditor: {get: function() {
return NumericEditor;
}},
__esModule: {value: true}
});
var $__numeral__,
$___46__46__47_editors_46_js__,
$__textEditor_46_js__;
var numeral = ($__numeral__ = require("numeral"), $__numeral__ && $__numeral__.__esModule && $__numeral__ || {default: $__numeral__}).default;
var $__1 = ($___46__46__47_editors_46_js__ = require("./../editors.js"), $___46__46__47_editors_46_js__ && $___46__46__47_editors_46_js__.__esModule && $___46__46__47_editors_46_js__ || {default: $___46__46__47_editors_46_js__}),
getEditor = $__1.getEditor,
registerEditor = $__1.registerEditor;
var TextEditor = ($__textEditor_46_js__ = require("./textEditor.js"), $__textEditor_46_js__ && $__textEditor_46_js__.__esModule && $__textEditor_46_js__ || {default: $__textEditor_46_js__}).TextEditor;
Handsontable.editors = Handsontable.editors || {};
Handsontable.editors.NumericEditor = NumericEditor;
var NumericEditor = function NumericEditor() {
$traceurRuntime.superConstructor($NumericEditor).apply(this, arguments);
};
var $NumericEditor = NumericEditor;
($traceurRuntime.createClass)(NumericEditor, {beginEditing: function(initialValue) {
if (typeof(initialValue) === 'undefined' && this.originalValue) {
if (typeof this.cellProperties.language !== 'undefined') {
numeral.language(this.cellProperties.language);
}
var decimalDelimiter = numeral.languageData().delimiters.decimal;
initialValue = ('' + this.originalValue).replace('.', decimalDelimiter);
}
$traceurRuntime.superGet(this, $NumericEditor.prototype, "beginEditing").call(this, initialValue);
}}, {}, TextEditor);
;
registerEditor('numeric', NumericEditor);
//#
},{"./../editors.js":29,"./textEditor.js":40,"numeral":"numeral"}],38:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
PasswordEditor: {get: function() {
return PasswordEditor;
}},
__esModule: {value: true}
});
var $___46__46__47_dom_46_js__,
$___46__46__47_editors_46_js__,
$__textEditor_46_js__;
var dom = ($___46__46__47_dom_46_js__ = require("./../dom.js"), $___46__46__47_dom_46_js__ && $___46__46__47_dom_46_js__.__esModule && $___46__46__47_dom_46_js__ || {default: $___46__46__47_dom_46_js__});
var $__0 = ($___46__46__47_editors_46_js__ = require("./../editors.js"), $___46__46__47_editors_46_js__ && $___46__46__47_editors_46_js__.__esModule && $___46__46__47_editors_46_js__ || {default: $___46__46__47_editors_46_js__}),
getEditor = $__0.getEditor,
registerEditor = $__0.registerEditor;
var TextEditor = ($__textEditor_46_js__ = require("./textEditor.js"), $__textEditor_46_js__ && $__textEditor_46_js__.__esModule && $__textEditor_46_js__ || {default: $__textEditor_46_js__}).TextEditor;
var PasswordEditor = TextEditor.prototype.extend();
;
Handsontable.editors = Handsontable.editors || {};
Handsontable.editors.PasswordEditor = PasswordEditor;
PasswordEditor.prototype.createElements = function() {
TextEditor.prototype.createElements.apply(this, arguments);
this.TEXTAREA = document.createElement('input');
this.TEXTAREA.setAttribute('type', 'password');
this.TEXTAREA.className = 'handsontableInput';
this.textareaStyle = this.TEXTAREA.style;
this.textareaStyle.width = 0;
this.textareaStyle.height = 0;
dom.empty(this.TEXTAREA_PARENT);
this.TEXTAREA_PARENT.appendChild(this.TEXTAREA);
};
registerEditor('password', PasswordEditor);
//#
},{"./../dom.js":27,"./../editors.js":29,"./textEditor.js":40}],39:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
SelectEditor: {get: function() {
return SelectEditor;
}},
__esModule: {value: true}
});
var $___46__46__47_dom_46_js__,
$___46__46__47_helpers_46_js__,
$___46__46__47_editors_46_js__,
$___95_baseEditor_46_js__;
var dom = ($___46__46__47_dom_46_js__ = require("./../dom.js"), $___46__46__47_dom_46_js__ && $___46__46__47_dom_46_js__.__esModule && $___46__46__47_dom_46_js__ || {default: $___46__46__47_dom_46_js__});
var helper = ($___46__46__47_helpers_46_js__ = require("./../helpers.js"), $___46__46__47_helpers_46_js__ && $___46__46__47_helpers_46_js__.__esModule && $___46__46__47_helpers_46_js__ || {default: $___46__46__47_helpers_46_js__});
var $__0 = ($___46__46__47_editors_46_js__ = require("./../editors.js"), $___46__46__47_editors_46_js__ && $___46__46__47_editors_46_js__.__esModule && $___46__46__47_editors_46_js__ || {default: $___46__46__47_editors_46_js__}),
getEditor = $__0.getEditor,
registerEditor = $__0.registerEditor;
var BaseEditor = ($___95_baseEditor_46_js__ = require("./_baseEditor.js"), $___95_baseEditor_46_js__ && $___95_baseEditor_46_js__.__esModule && $___95_baseEditor_46_js__ || {default: $___95_baseEditor_46_js__}).BaseEditor;
var SelectEditor = BaseEditor.prototype.extend();
;
Handsontable.editors = Handsontable.editors || {};
Handsontable.editors.SelectEditor = SelectEditor;
SelectEditor.prototype.init = function() {
this.select = document.createElement('SELECT');
dom.addClass(this.select, 'htSelectEditor');
this.select.style.display = 'none';
this.instance.rootElement.appendChild(this.select);
};
SelectEditor.prototype.prepare = function() {
BaseEditor.prototype.prepare.apply(this, arguments);
var selectOptions = this.cellProperties.selectOptions;
var options;
if (typeof selectOptions == 'function') {
options = this.prepareOptions(selectOptions(this.row, this.col, this.prop));
} else {
options = this.prepareOptions(selectOptions);
}
dom.empty(this.select);
for (var option in options) {
if (options.hasOwnProperty(option)) {
var optionElement = document.createElement('OPTION');
optionElement.value = option;
dom.fastInnerHTML(optionElement, options[option]);
this.select.appendChild(optionElement);
}
}
};
SelectEditor.prototype.prepareOptions = function(optionsToPrepare) {
var preparedOptions = {};
if (Array.isArray(optionsToPrepare)) {
for (var i = 0,
len = optionsToPrepare.length; i < len; i++) {
preparedOptions[optionsToPrepare[i]] = optionsToPrepare[i];
}
} else if (typeof optionsToPrepare == 'object') {
preparedOptions = optionsToPrepare;
}
return preparedOptions;
};
SelectEditor.prototype.getValue = function() {
return this.select.value;
};
SelectEditor.prototype.setValue = function(value) {
this.select.value = value;
};
var onBeforeKeyDown = function(event) {
var instance = this;
var editor = instance.getActiveEditor();
if (event != null && event.isImmediatePropagationEnabled == null) {
event.stopImmediatePropagation = function() {
this.isImmediatePropagationEnabled = false;
};
event.isImmediatePropagationEnabled = true;
event.isImmediatePropagationStopped = function() {
return !this.isImmediatePropagationEnabled;
};
}
switch (event.keyCode) {
case helper.keyCode.ARROW_UP:
var previousOptionIndex = editor.select.selectedIndex - 1;
if (previousOptionIndex >= 0) {
editor.select[previousOptionIndex].selected = true;
}
event.stopImmediatePropagation();
event.preventDefault();
break;
case helper.keyCode.ARROW_DOWN:
var nextOptionIndex = editor.select.selectedIndex + 1;
if (nextOptionIndex <= editor.select.length - 1) {
editor.select[nextOptionIndex].selected = true;
}
event.stopImmediatePropagation();
event.preventDefault();
break;
}
};
SelectEditor.prototype.checkEditorSection = function() {
if (this.row < this.instance.getSettings().fixedRowsTop) {
if (this.col < this.instance.getSettings().fixedColumnsLeft) {
return 'corner';
} else {
return 'top';
}
} else {
if (this.col < this.instance.getSettings().fixedColumnsLeft) {
return 'left';
}
}
};
SelectEditor.prototype.open = function() {
var width = dom.outerWidth(this.TD);
var height = dom.outerHeight(this.TD);
var rootOffset = dom.offset(this.instance.rootElement);
var tdOffset = dom.offset(this.TD);
var editorSection = this.checkEditorSection();
var cssTransformOffset;
switch (editorSection) {
case 'top':
cssTransformOffset = dom.getCssTransform(this.instance.view.wt.wtOverlays.topOverlay.clone.wtTable.holder.parentNode);
break;
case 'left':
cssTransformOffset = dom.getCssTransform(this.instance.view.wt.wtOverlays.leftOverlay.clone.wtTable.holder.parentNode);
break;
case 'corner':
cssTransformOffset = dom.getCssTransform(this.instance.view.wt.wtOverlays.topLeftCornerOverlay.clone.wtTable.holder.parentNode);
break;
}
var selectStyle = this.select.style;
if (cssTransformOffset && cssTransformOffset != -1) {
selectStyle[cssTransformOffset[0]] = cssTransformOffset[1];
} else {
dom.resetCssTransform(this.select);
}
selectStyle.height = height + 'px';
selectStyle.minWidth = width + 'px';
selectStyle.top = tdOffset.top - rootOffset.top + 'px';
selectStyle.left = tdOffset.left - rootOffset.left + 'px';
selectStyle.margin = '0px';
selectStyle.display = '';
this.instance.addHook('beforeKeyDown', onBeforeKeyDown);
};
SelectEditor.prototype.close = function() {
this.select.style.display = 'none';
this.instance.removeHook('beforeKeyDown', onBeforeKeyDown);
};
SelectEditor.prototype.focus = function() {
this.select.focus();
};
registerEditor('select', SelectEditor);
//#
},{"./../dom.js":27,"./../editors.js":29,"./../helpers.js":42,"./_baseEditor.js":30}],40:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
TextEditor: {get: function() {
return TextEditor;
}},
__esModule: {value: true}
});
var $___46__46__47_dom_46_js__,
$___46__46__47_helpers_46_js__,
$__autoResize__,
$___95_baseEditor_46_js__,
$___46__46__47_eventManager_46_js__,
$___46__46__47_editors_46_js__;
var dom = ($___46__46__47_dom_46_js__ = require("./../dom.js"), $___46__46__47_dom_46_js__ && $___46__46__47_dom_46_js__.__esModule && $___46__46__47_dom_46_js__ || {default: $___46__46__47_dom_46_js__});
var helper = ($___46__46__47_helpers_46_js__ = require("./../helpers.js"), $___46__46__47_helpers_46_js__ && $___46__46__47_helpers_46_js__.__esModule && $___46__46__47_helpers_46_js__ || {default: $___46__46__47_helpers_46_js__});
var autoResize = ($__autoResize__ = require("autoResize"), $__autoResize__ && $__autoResize__.__esModule && $__autoResize__ || {default: $__autoResize__}).default;
var BaseEditor = ($___95_baseEditor_46_js__ = require("./_baseEditor.js"), $___95_baseEditor_46_js__ && $___95_baseEditor_46_js__.__esModule && $___95_baseEditor_46_js__ || {default: $___95_baseEditor_46_js__}).BaseEditor;
var eventManagerObject = ($___46__46__47_eventManager_46_js__ = require("./../eventManager.js"), $___46__46__47_eventManager_46_js__ && $___46__46__47_eventManager_46_js__.__esModule && $___46__46__47_eventManager_46_js__ || {default: $___46__46__47_eventManager_46_js__}).eventManager;
var $__3 = ($___46__46__47_editors_46_js__ = require("./../editors.js"), $___46__46__47_editors_46_js__ && $___46__46__47_editors_46_js__.__esModule && $___46__46__47_editors_46_js__ || {default: $___46__46__47_editors_46_js__}),
getEditor = $__3.getEditor,
registerEditor = $__3.registerEditor;
var TextEditor = BaseEditor.prototype.extend();
;
Handsontable.editors = Handsontable.editors || {};
Handsontable.editors.TextEditor = TextEditor;
TextEditor.prototype.init = function() {
var that = this;
this.createElements();
this.eventManager = eventManagerObject(this);
this.bindEvents();
this.autoResize = autoResize();
this.instance.addHook('afterDestroy', function() {
that.destroy();
});
};
TextEditor.prototype.getValue = function() {
return this.TEXTAREA.value;
};
TextEditor.prototype.setValue = function(newValue) {
this.TEXTAREA.value = newValue;
};
var onBeforeKeyDown = function onBeforeKeyDown(event) {
var instance = this,
that = instance.getActiveEditor(),
keyCodes,
ctrlDown;
keyCodes = helper.keyCode;
ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey;
dom.enableImmediatePropagation(event);
if (event.target !== that.TEXTAREA || event.isImmediatePropagationStopped()) {
return;
}
if (event.keyCode === 17 || event.keyCode === 224 || event.keyCode === 91 || event.keyCode === 93) {
event.stopImmediatePropagation();
return;
}
switch (event.keyCode) {
case keyCodes.ARROW_RIGHT:
case keyCodes.ARROW_LEFT:
case keyCodes.ARROW_UP:
case keyCodes.ARROW_DOWN:
if (!that.isWaiting()) {
event.stopImmediatePropagation();
}
break;
case keyCodes.ENTER:
var selected = that.instance.getSelected();
var isMultipleSelection = !(selected[0] === selected[2] && selected[1] === selected[3]);
if ((ctrlDown && !isMultipleSelection) || event.altKey) {
if (that.isOpened()) {
var caretPosition = dom.getCaretPosition(that.TEXTAREA),
value = that.getValue();
var newValue = value.slice(0, caretPosition) + '\n' + value.slice(caretPosition);
that.setValue(newValue);
dom.setCaretPosition(that.TEXTAREA, caretPosition + 1);
} else {
that.beginEditing(that.originalValue + '\n');
}
event.stopImmediatePropagation();
}
event.preventDefault();
break;
case keyCodes.A:
case keyCodes.X:
case keyCodes.C:
case keyCodes.V:
if (ctrlDown) {
event.stopImmediatePropagation();
}
break;
case keyCodes.BACKSPACE:
case keyCodes.DELETE:
case keyCodes.HOME:
case keyCodes.END:
event.stopImmediatePropagation();
break;
}
that.autoResize.resize(String.fromCharCode(event.keyCode));
};
TextEditor.prototype.open = function() {
this.refreshDimensions();
this.instance.addHook('beforeKeyDown', onBeforeKeyDown);
};
TextEditor.prototype.close = function() {
this.textareaParentStyle.display = 'none';
this.autoResize.unObserve();
if (document.activeElement === this.TEXTAREA) {
this.instance.listen();
}
this.instance.removeHook('beforeKeyDown', onBeforeKeyDown);
};
TextEditor.prototype.focus = function() {
this.TEXTAREA.focus();
dom.setCaretPosition(this.TEXTAREA, this.TEXTAREA.value.length);
};
TextEditor.prototype.createElements = function() {
this.TEXTAREA = document.createElement('TEXTAREA');
dom.addClass(this.TEXTAREA, 'handsontableInput');
this.textareaStyle = this.TEXTAREA.style;
this.textareaStyle.width = 0;
this.textareaStyle.height = 0;
this.TEXTAREA_PARENT = document.createElement('DIV');
dom.addClass(this.TEXTAREA_PARENT, 'handsontableInputHolder');
this.textareaParentStyle = this.TEXTAREA_PARENT.style;
this.textareaParentStyle.top = 0;
this.textareaParentStyle.left = 0;
this.textareaParentStyle.display = 'none';
this.TEXTAREA_PARENT.appendChild(this.TEXTAREA);
this.instance.rootElement.appendChild(this.TEXTAREA_PARENT);
var that = this;
this.instance._registerTimeout(setTimeout(function() {
that.refreshDimensions();
}, 0));
};
TextEditor.prototype.checkEditorSection = function() {
if (this.row < this.instance.getSettings().fixedRowsTop) {
if (this.col < this.instance.getSettings().fixedColumnsLeft) {
return 'corner';
} else {
return 'top';
}
} else {
if (this.col < this.instance.getSettings().fixedColumnsLeft) {
return 'left';
}
}
};
TextEditor.prototype.getEditedCell = function() {
var editorSection = this.checkEditorSection(),
editedCell;
switch (editorSection) {
case 'top':
editedCell = this.instance.view.wt.wtOverlays.topOverlay.clone.wtTable.getCell({
row: this.row,
col: this.col
});
this.textareaParentStyle.zIndex = 101;
break;
case 'corner':
editedCell = this.instance.view.wt.wtOverlays.topLeftCornerOverlay.clone.wtTable.getCell({
row: this.row,
col: this.col
});
this.textareaParentStyle.zIndex = 103;
break;
case 'left':
editedCell = this.instance.view.wt.wtOverlays.leftOverlay.clone.wtTable.getCell({
row: this.row,
col: this.col
});
this.textareaParentStyle.zIndex = 102;
break;
default:
editedCell = this.instance.getCell(this.row, this.col);
this.textareaParentStyle.zIndex = "";
break;
}
return editedCell != -1 && editedCell != -2 ? editedCell : void 0;
};
TextEditor.prototype.refreshDimensions = function() {
if (this.state !== Handsontable.EditorState.EDITING) {
return;
}
this.TD = this.getEditedCell();
if (!this.TD) {
return;
}
var currentOffset = dom.offset(this.TD),
containerOffset = dom.offset(this.instance.rootElement),
scrollableContainer = dom.getScrollableElement(this.TD),
editTop = currentOffset.top - containerOffset.top - 1 - (scrollableContainer.scrollTop || 0),
editLeft = currentOffset.left - containerOffset.left - 1 - (scrollableContainer.scrollLeft || 0),
settings = this.instance.getSettings(),
rowHeadersCount = settings.rowHeaders ? 1 : 0,
colHeadersCount = settings.colHeaders ? 1 : 0,
editorSection = this.checkEditorSection(),
backgroundColor = this.TD.style.backgroundColor,
cssTransformOffset;
switch (editorSection) {
case 'top':
cssTransformOffset = dom.getCssTransform(this.instance.view.wt.wtOverlays.topOverlay.clone.wtTable.holder.parentNode);
break;
case 'left':
cssTransformOffset = dom.getCssTransform(this.instance.view.wt.wtOverlays.leftOverlay.clone.wtTable.holder.parentNode);
break;
case 'corner':
cssTransformOffset = dom.getCssTransform(this.instance.view.wt.wtOverlays.topLeftCornerOverlay.clone.wtTable.holder.parentNode);
break;
}
if (editTop < 0) {
editTop = 0;
}
if (editLeft < 0) {
editLeft = 0;
}
if (colHeadersCount && this.instance.getSelected()[0] === 0) {
editTop += 1;
}
if (rowHeadersCount && this.instance.getSelected()[1] === 0) {
editLeft += 1;
}
if (cssTransformOffset && cssTransformOffset != -1) {
this.textareaParentStyle[cssTransformOffset[0]] = cssTransformOffset[1];
} else {
dom.resetCssTransform(this.textareaParentStyle);
}
this.textareaParentStyle.top = editTop + 'px';
this.textareaParentStyle.left = editLeft + 'px';
var cellTopOffset = this.TD.offsetTop - this.instance.view.wt.wtOverlays.topOverlay.getScrollPosition(),
cellLeftOffset = this.TD.offsetLeft - this.instance.view.wt.wtOverlays.leftOverlay.getScrollPosition();
var width = dom.innerWidth(this.TD) - 8,
maxWidth = this.instance.view.maximumVisibleElementWidth(cellLeftOffset) - 10,
height = this.TD.scrollHeight + 1,
maxHeight = this.instance.view.maximumVisibleElementHeight(cellTopOffset) - 2;
if (parseInt(this.TD.style.borderTopWidth, 10) > 0) {
height -= 1;
}
if (parseInt(this.TD.style.borderLeftWidth, 10) > 0) {
if (rowHeadersCount > 0) {
width -= 1;
}
}
this.TEXTAREA.style.fontSize = dom.getComputedStyle(this.TD).fontSize;
this.TEXTAREA.style.fontFamily = dom.getComputedStyle(this.TD).fontFamily;
this.TEXTAREA.style.backgroundColor = '';
this.TEXTAREA.style.backgroundColor = backgroundColor ? backgroundColor : dom.getComputedStyle(this.TEXTAREA).backgroundColor;
this.autoResize.init(this.TEXTAREA, {
minHeight: Math.min(height, maxHeight),
maxHeight: maxHeight,
minWidth: Math.min(width, maxWidth),
maxWidth: maxWidth
}, true);
this.textareaParentStyle.display = 'block';
};
TextEditor.prototype.bindEvents = function() {
var editor = this;
this.eventManager.addEventListener(this.TEXTAREA, 'cut', function(event) {
helper.stopPropagation(event);
});
this.eventManager.addEventListener(this.TEXTAREA, 'paste', function(event) {
helper.stopPropagation(event);
});
this.instance.addHook('afterScrollVertically', function() {
editor.refreshDimensions();
});
this.instance.addHook('afterColumnResize', function() {
editor.refreshDimensions();
editor.focus();
});
this.instance.addHook('afterRowResize', function() {
editor.refreshDimensions();
editor.focus();
});
this.instance.addHook('afterDestroy', function() {
editor.eventManager.clear();
});
};
TextEditor.prototype.destroy = function() {
this.eventManager.clear();
};
registerEditor('text', TextEditor);
//#
},{"./../dom.js":27,"./../editors.js":29,"./../eventManager.js":41,"./../helpers.js":42,"./_baseEditor.js":30,"autoResize":"autoResize"}],41:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
EventManager: {get: function() {
return EventManager;
}},
eventManager: {get: function() {
return eventManager;
}},
__esModule: {value: true}
});
var $__dom_46_js__;
var dom = ($__dom_46_js__ = require("./dom.js"), $__dom_46_js__ && $__dom_46_js__.__esModule && $__dom_46_js__ || {default: $__dom_46_js__});
var EventManager = function EventManager() {
var context = arguments[0] !== (void 0) ? arguments[0] : null;
this.context = context || this;
if (!this.context.eventListeners) {
this.context.eventListeners = [];
}
};
($traceurRuntime.createClass)(EventManager, {
addEventListener: function(element, eventName, callback) {
var $__0 = this;
var context = this.context;
function callbackProxy(event) {
if (event.target == void 0 && event.srcElement != void 0) {
if (event.definePoperty) {
event.definePoperty('target', {value: event.srcElement});
} else {
event.target = event.srcElement;
}
}
if (event.preventDefault == void 0) {
if (event.definePoperty) {
event.definePoperty('preventDefault', {value: function() {
this.returnValue = false;
}});
} else {
event.preventDefault = function() {
this.returnValue = false;
};
}
}
event = extendEvent(context, event);
callback.call(this, event);
}
this.context.eventListeners.push({
element: element,
event: eventName,
callback: callback,
callbackProxy: callbackProxy
});
if (window.addEventListener) {
element.addEventListener(eventName, callbackProxy, false);
} else {
element.attachEvent('on' + eventName, callbackProxy);
}
Handsontable.countEventManagerListeners++;
return (function() {
$__0.removeEventListener(element, eventName, callback);
});
},
removeEventListener: function(element, eventName, callback) {
var len = this.context.eventListeners.length;
var tmpEvent;
while (len--) {
tmpEvent = this.context.eventListeners[len];
if (tmpEvent.event == eventName && tmpEvent.element == element) {
if (callback && callback != tmpEvent.callback) {
continue;
}
this.context.eventListeners.splice(len, 1);
if (tmpEvent.element.removeEventListener) {
tmpEvent.element.removeEventListener(tmpEvent.event, tmpEvent.callbackProxy, false);
} else {
tmpEvent.element.detachEvent('on' + tmpEvent.event, tmpEvent.callbackProxy);
}
Handsontable.countEventManagerListeners--;
}
}
},
clearEvents: function() {
var len = this.context.eventListeners.length;
while (len--) {
var event = this.context.eventListeners[len];
if (event) {
this.removeEventListener(event.element, event.event, event.callback);
}
}
},
clear: function() {
this.clearEvents();
},
fireEvent: function(element, eventName) {
var options = {
bubbles: true,
cancelable: (eventName !== 'mousemove'),
view: window,
detail: 0,
screenX: 0,
screenY: 0,
clientX: 1,
clientY: 1,
ctrlKey: false,
altKey: false,
shiftKey: false,
metaKey: false,
button: 0,
relatedTarget: undefined
};
var event;
if (document.createEvent) {
event = document.createEvent('MouseEvents');
event.initMouseEvent(eventName, options.bubbles, options.cancelable, options.view, options.detail, options.screenX, options.screenY, options.clientX, options.clientY, options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, options.relatedTarget || document.body.parentNode);
} else {
event = document.createEventObject();
}
if (element.dispatchEvent) {
element.dispatchEvent(event);
} else {
element.fireEvent('on' + eventName, event);
}
}
}, {});
function extendEvent(context, event) {
var componentName = 'HOT-TABLE';
var isHotTableSpotted;
var fromElement;
var realTarget;
var target;
var len;
event.isTargetWebComponent = false;
event.realTarget = event.target;
if (!Handsontable.eventManager.isHotTableEnv) {
return event;
}
event = dom.polymerWrap(event);
len = event.path ? event.path.length : 0;
while (len--) {
if (event.path[len].nodeName === componentName) {
isHotTableSpotted = true;
} else if (isHotTableSpotted && event.path[len].shadowRoot) {
target = event.path[len];
break;
}
if (len === 0 && !target) {
target = event.path[len];
}
}
if (!target) {
target = event.target;
}
event.isTargetWebComponent = true;
if (dom.isWebComponentSupportedNatively()) {
event.realTarget = event.srcElement || event.toElement;
} else if (context instanceof Handsontable.Core || context instanceof Walkontable) {
if (context instanceof Handsontable.Core) {
fromElement = context.view.wt.wtTable.TABLE;
} else if (context instanceof Walkontable) {
fromElement = context.wtTable.TABLE.parentNode.parentNode;
}
realTarget = dom.closest(event.target, [componentName], fromElement);
if (realTarget) {
event.realTarget = fromElement.querySelector(componentName) || event.target;
} else {
event.realTarget = event.target;
}
}
Object.defineProperty(event, 'target', {
get: function() {
return dom.polymerWrap(target);
},
enumerable: true,
configurable: true
});
return event;
}
;
window.Handsontable = window.Handsontable || {};
Handsontable.countEventManagerListeners = 0;
Handsontable.eventManager = eventManager;
function eventManager(context) {
return new EventManager(context);
}
//#
},{"./dom.js":27}],42:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
isPrintableChar: {get: function() {
return isPrintableChar;
}},
isMetaKey: {get: function() {
return isMetaKey;
}},
isCtrlKey: {get: function() {
return isCtrlKey;
}},
stringify: {get: function() {
return stringify;
}},
toUpperCaseFirst: {get: function() {
return toUpperCaseFirst;
}},
equalsIgnoreCase: {get: function() {
return equalsIgnoreCase;
}},
duckSchema: {get: function() {
return duckSchema;
}},
spreadsheetColumnLabel: {get: function() {
return spreadsheetColumnLabel;
}},
createSpreadsheetData: {get: function() {
return createSpreadsheetData;
}},
createSpreadsheetObjectData: {get: function() {
return createSpreadsheetObjectData;
}},
isNumeric: {get: function() {
return isNumeric;
}},
randomString: {get: function() {
return randomString;
}},
inherit: {get: function() {
return inherit;
}},
extend: {get: function() {
return extend;
}},
deepExtend: {get: function() {
return deepExtend;
}},
deepClone: {get: function() {
return deepClone;
}},
isObjectEquals: {get: function() {
return isObjectEquals;
}},
getPrototypeOf: {get: function() {
return getPrototypeOf;
}},
columnFactory: {get: function() {
return columnFactory;
}},
translateRowsToColumns: {get: function() {
return translateRowsToColumns;
}},
to2dArray: {get: function() {
return to2dArray;
}},
extendArray: {get: function() {
return extendArray;
}},
isInput: {get: function() {
return isInput;
}},
isOutsideInput: {get: function() {
return isOutsideInput;
}},
keyCode: {get: function() {
return keyCode;
}},
isObject: {get: function() {
return isObject;
}},
pivot: {get: function() {
return pivot;
}},
proxy: {get: function() {
return proxy;
}},
cellMethodLookupFactory: {get: function() {
return cellMethodLookupFactory;
}},
isMobileBrowser: {get: function() {
return isMobileBrowser;
}},
isTouchSupported: {get: function() {
return isTouchSupported;
}},
stopPropagation: {get: function() {
return stopPropagation;
}},
pageX: {get: function() {
return pageX;
}},
pageY: {get: function() {
return pageY;
}},
defineGetter: {get: function() {
return defineGetter;
}},
requestAnimationFrame: {get: function() {
return requestAnimationFrame;
}},
cancelAnimationFrame: {get: function() {
return cancelAnimationFrame;
}},
__esModule: {value: true}
});
var $__dom_46_js__;
var dom = ($__dom_46_js__ = require("./dom.js"), $__dom_46_js__ && $__dom_46_js__.__esModule && $__dom_46_js__ || {default: $__dom_46_js__});
function isPrintableChar(keyCode) {
return ((keyCode == 32) || (keyCode >= 48 && keyCode <= 57) || (keyCode >= 96 && keyCode <= 111) || (keyCode >= 186 && keyCode <= 192) || (keyCode >= 219 && keyCode <= 222) || keyCode >= 226 || (keyCode >= 65 && keyCode <= 90));
}
function isMetaKey(_keyCode) {
var metaKeys = [keyCode.ARROW_DOWN, keyCode.ARROW_UP, keyCode.ARROW_LEFT, keyCode.ARROW_RIGHT, keyCode.HOME, keyCode.END, keyCode.DELETE, keyCode.BACKSPACE, keyCode.F1, keyCode.F2, keyCode.F3, keyCode.F4, keyCode.F5, keyCode.F6, keyCode.F7, keyCode.F8, keyCode.F9, keyCode.F10, keyCode.F11, keyCode.F12, keyCode.TAB, keyCode.PAGE_DOWN, keyCode.PAGE_UP, keyCode.ENTER, keyCode.ESCAPE, keyCode.SHIFT, keyCode.CAPS_LOCK, keyCode.ALT];
return metaKeys.indexOf(_keyCode) != -1;
}
function isCtrlKey(_keyCode) {
return [keyCode.CONTROL_LEFT, 224, keyCode.COMMAND_LEFT, keyCode.COMMAND_RIGHT].indexOf(_keyCode) != -1;
}
function stringify(value) {
switch (typeof value) {
case 'string':
case 'number':
return value + '';
case 'object':
if (value === null) {
return '';
} else {
return value.toString();
}
break;
case 'undefined':
return '';
default:
return value.toString();
}
}
function toUpperCaseFirst(string) {
return string[0].toUpperCase() + string.substr(1);
}
function equalsIgnoreCase() {
for (var strings = [],
$__0 = 0; $__0 < arguments.length; $__0++)
strings[$__0] = arguments[$__0];
var unique = [];
var length = strings.length;
while (length--) {
var string = stringify(strings[length]).toLowerCase();
if (unique.indexOf(string) === -1) {
unique.push(string);
}
}
return unique.length === 1;
}
function duckSchema(object) {
var schema;
if (Array.isArray(object)) {
schema = [];
} else {
schema = {};
for (var i in object) {
if (object.hasOwnProperty(i)) {
if (object[i] && typeof object[i] === 'object' && !Array.isArray(object[i])) {
schema[i] = duckSchema(object[i]);
} else if (Array.isArray(object[i])) {
if (object[i].length && typeof object[i][0] === 'object' && !Array.isArray(object[i][0])) {
schema[i] = [duckSchema(object[i][0])];
} else {
schema[i] = [];
}
} else {
schema[i] = null;
}
}
}
}
return schema;
}
function spreadsheetColumnLabel(index) {
var dividend = index + 1;
var columnLabel = '';
var modulo;
while (dividend > 0) {
modulo = (dividend - 1) % 26;
columnLabel = String.fromCharCode(65 + modulo) + columnLabel;
dividend = parseInt((dividend - modulo) / 26, 10);
}
return columnLabel;
}
function createSpreadsheetData(rowCount, colCount) {
rowCount = typeof rowCount === 'number' ? rowCount : 100;
colCount = typeof colCount === 'number' ? colCount : 4;
var rows = [],
i,
j;
for (i = 0; i < rowCount; i++) {
var row = [];
for (j = 0; j < colCount; j++) {
row.push(spreadsheetColumnLabel(j) + (i + 1));
}
rows.push(row);
}
return rows;
}
function createSpreadsheetObjectData(rowCount, colCount) {
rowCount = typeof rowCount === 'number' ? rowCount : 100;
colCount = typeof colCount === 'number' ? colCount : 4;
var rows = [],
i,
j;
for (i = 0; i < rowCount; i++) {
var row = {};
for (j = 0; j < colCount; j++) {
row['prop' + j] = spreadsheetColumnLabel(j) + (i + 1);
}
rows.push(row);
}
return rows;
}
function isNumeric(n) {
var t = typeof n;
return t == 'number' ? !isNaN(n) && isFinite(n) : t == 'string' ? !n.length ? false : n.length == 1 ? /\d/.test(n) : /^\s*[+-]?\s*(?:(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?)|(?:0x[a-f\d]+))\s*$/i.test(n) : t == 'object' ? !!n && typeof n.valueOf() == "number" && !(n instanceof Date) : false;
}
function randomString() {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
}
return s4() + s4() + s4() + s4();
}
function inherit(Child, Parent) {
Parent.prototype.constructor = Parent;
Child.prototype = new Parent();
Child.prototype.constructor = Child;
return Child;
}
function extend(target, extension) {
for (var i in extension) {
if (extension.hasOwnProperty(i)) {
target[i] = extension[i];
}
}
}
function deepExtend(target, extension) {
for (var key in extension) {
if (extension.hasOwnProperty(key)) {
if (extension[key] && typeof extension[key] === 'object') {
if (!target[key]) {
if (Array.isArray(extension[key])) {
target[key] = [];
} else {
target[key] = {};
}
}
deepExtend(target[key], extension[key]);
} else {
target[key] = extension[key];
}
}
}
}
function deepClone(obj) {
if (typeof obj === "object") {
return JSON.parse(JSON.stringify(obj));
} else {
return obj;
}
}
function isObjectEquals(object1, object2) {
return JSON.stringify(object1) === JSON.stringify(object2);
}
function getPrototypeOf(obj) {
var prototype;
if (typeof obj.__proto__ == "object") {
prototype = obj.__proto__;
} else {
var oldConstructor,
constructor = obj.constructor;
if (typeof obj.constructor == "function") {
oldConstructor = constructor;
if (delete obj.constructor) {
constructor = obj.constructor;
obj.constructor = oldConstructor;
}
}
prototype = constructor ? constructor.prototype : null;
}
return prototype;
}
function columnFactory(GridSettings, conflictList) {
function ColumnSettings() {}
inherit(ColumnSettings, GridSettings);
for (var i = 0,
len = conflictList.length; i < len; i++) {
ColumnSettings.prototype[conflictList[i]] = void 0;
}
return ColumnSettings;
}
function translateRowsToColumns(input) {
var i,
ilen,
j,
jlen,
output = [],
olen = 0;
for (i = 0, ilen = input.length; i < ilen; i++) {
for (j = 0, jlen = input[i].length; j < jlen; j++) {
if (j == olen) {
output.push([]);
olen++;
}
output[j].push(input[i][j]);
}
}
return output;
}
function to2dArray(arr) {
var i = 0,
ilen = arr.length;
while (i < ilen) {
arr[i] = [arr[i]];
i++;
}
}
function extendArray(arr, extension) {
var i = 0,
ilen = extension.length;
while (i < ilen) {
arr.push(extension[i]);
i++;
}
}
function isInput(element) {
var inputs = ['INPUT', 'SELECT', 'TEXTAREA'];
return inputs.indexOf(element.nodeName) > -1 || element.contentEditable === 'true';
}
function isOutsideInput(element) {
return isInput(element) && element.className.indexOf('handsontableInput') == -1 && element.className.indexOf('copyPaste') == -1;
}
var keyCode = {
MOUSE_LEFT: 1,
MOUSE_RIGHT: 3,
MOUSE_MIDDLE: 2,
BACKSPACE: 8,
COMMA: 188,
INSERT: 45,
DELETE: 46,
END: 35,
ENTER: 13,
ESCAPE: 27,
CONTROL_LEFT: 91,
COMMAND_LEFT: 17,
COMMAND_RIGHT: 93,
ALT: 18,
HOME: 36,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
SPACE: 32,
SHIFT: 16,
CAPS_LOCK: 20,
TAB: 9,
ARROW_RIGHT: 39,
ARROW_LEFT: 37,
ARROW_UP: 38,
ARROW_DOWN: 40,
F1: 112,
F2: 113,
F3: 114,
F4: 115,
F5: 116,
F6: 117,
F7: 118,
F8: 119,
F9: 120,
F10: 121,
F11: 122,
F12: 123,
A: 65,
X: 88,
C: 67,
V: 86
};
function isObject(obj) {
return Object.prototype.toString.call(obj) == '[object Object]';
}
function pivot(arr) {
var pivotedArr = [];
if (!arr || arr.length === 0 || !arr[0] || arr[0].length === 0) {
return pivotedArr;
}
var rowCount = arr.length;
var colCount = arr[0].length;
for (var i = 0; i < rowCount; i++) {
for (var j = 0; j < colCount; j++) {
if (!pivotedArr[j]) {
pivotedArr[j] = [];
}
pivotedArr[j][i] = arr[i][j];
}
}
return pivotedArr;
}
function proxy(fun, context) {
return function() {
return fun.apply(context, arguments);
};
}
function cellMethodLookupFactory(methodName, allowUndefined) {
allowUndefined = typeof allowUndefined == 'undefined' ? true : allowUndefined;
return function cellMethodLookup(row, col) {
return (function getMethodFromProperties(properties) {
if (!properties) {
return;
} else if (properties.hasOwnProperty(methodName) && properties[methodName] !== void 0) {
return properties[methodName];
} else if (properties.hasOwnProperty('type') && properties.type) {
var type;
if (typeof properties.type != 'string') {
throw new Error('Cell type must be a string ');
}
type = translateTypeNameToObject(properties.type);
if (type.hasOwnProperty(methodName)) {
return type[methodName];
} else if (allowUndefined) {
return;
}
}
return getMethodFromProperties(getPrototypeOf(properties));
})(typeof row == 'number' ? this.getCellMeta(row, col) : row);
};
function translateTypeNameToObject(typeName) {
var type = Handsontable.cellTypes[typeName];
if (typeof type == 'undefined') {
throw new Error('You declared cell type "' + typeName + '" as a string that is not mapped to a known object. ' + 'Cell type must be an object or a string mapped to an object in Handsontable.cellTypes');
}
return type;
}
}
function isMobileBrowser(userAgent) {
if (!userAgent) {
userAgent = navigator.userAgent;
}
return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent));
}
function isTouchSupported() {
return ('ontouchstart' in window);
}
function stopPropagation(event) {
if (typeof(event.stopPropagation) === 'function') {
event.stopPropagation();
} else {
event.cancelBubble = true;
}
}
function pageX(event) {
if (event.pageX) {
return event.pageX;
}
var scrollLeft = dom.getWindowScrollLeft();
var cursorX = event.clientX + scrollLeft;
return cursorX;
}
function pageY(event) {
if (event.pageY) {
return event.pageY;
}
var scrollTop = dom.getWindowScrollTop();
var cursorY = event.clientY + scrollTop;
return cursorY;
}
function defineGetter(object, property, value, options) {
options.value = value;
options.writable = options.writable === false ? false : true;
options.enumerable = options.enumerable === false ? false : true;
options.configurable = options.configurable === false ? false : true;
Object.defineProperty(object, property, options);
}
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
var _requestAnimationFrame = window.requestAnimationFrame;
var _cancelAnimationFrame = window.cancelAnimationFrame;
for (var x = 0; x < vendors.length && !_requestAnimationFrame; ++x) {
_requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
_cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame'];
}
if (!_requestAnimationFrame) {
_requestAnimationFrame = function(callback) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function() {
callback(currTime + timeToCall);
}, timeToCall);
lastTime = currTime + timeToCall;
return id;
};
}
if (!_cancelAnimationFrame) {
_cancelAnimationFrame = function(id) {
clearTimeout(id);
};
}
function requestAnimationFrame(callback) {
return _requestAnimationFrame.call(window, callback);
}
function cancelAnimationFrame(id) {
_cancelAnimationFrame.call(window, id);
}
window.Handsontable = window.Handsontable || {};
Handsontable.helper = {
cancelAnimationFrame: cancelAnimationFrame,
cellMethodLookupFactory: cellMethodLookupFactory,
columnFactory: columnFactory,
createSpreadsheetData: createSpreadsheetData,
createSpreadsheetObjectData: createSpreadsheetObjectData,
deepClone: deepClone,
deepExtend: deepExtend,
defineGetter: defineGetter,
duckSchema: duckSchema,
equalsIgnoreCase: equalsIgnoreCase,
extend: extend,
extendArray: extendArray,
getPrototypeOf: getPrototypeOf,
inherit: inherit,
isCtrlKey: isCtrlKey,
isInput: isInput,
isMetaKey: isMetaKey,
isMobileBrowser: isMobileBrowser,
isNumeric: isNumeric,
isObject: isObject,
isObjectEquals: isObjectEquals,
isOutsideInput: isOutsideInput,
isPrintableChar: isPrintableChar,
isTouchSupported: isTouchSupported,
keyCode: keyCode,
pageX: pageX,
pageY: pageY,
pivot: pivot,
proxy: proxy,
randomString: randomString,
requestAnimationFrame: requestAnimationFrame,
spreadsheetColumnLabel: spreadsheetColumnLabel,
stopPropagation: stopPropagation,
stringify: stringify,
to2dArray: to2dArray,
toUpperCaseFirst: toUpperCaseFirst,
translateRowsToColumns: translateRowsToColumns
};
//#
},{"./dom.js":27}],43:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
MultiMap: {get: function() {
return MultiMap;
}},
__esModule: {value: true}
});
;
window.MultiMap = MultiMap;
function MultiMap() {
var map = {
arrayMap: [],
weakMap: new WeakMap()
};
return {
'get': function(key) {
if (canBeAnArrayMapKey(key)) {
return map.arrayMap[key];
} else if (canBeAWeakMapKey(key)) {
return map.weakMap.get(key);
}
},
'set': function(key, value) {
if (canBeAnArrayMapKey(key)) {
map.arrayMap[key] = value;
} else if (canBeAWeakMapKey(key)) {
map.weakMap.set(key, value);
} else {
throw new Error('Invalid key type');
}
},
'delete': function(key) {
if (canBeAnArrayMapKey(key)) {
delete map.arrayMap[key];
} else if (canBeAWeakMapKey(key)) {
map.weakMap['delete'](key);
}
}
};
function canBeAnArrayMapKey(obj) {
return obj !== null && !isNaNSymbol(obj) && (typeof obj == 'string' || typeof obj == 'number');
}
function canBeAWeakMapKey(obj) {
return obj !== null && (typeof obj == 'object' || typeof obj == 'function');
}
function isNaNSymbol(obj) {
return obj !== obj;
}
}
//#
},{}],44:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
Hooks: {get: function() {
return Hooks;
}},
__esModule: {value: true}
});
var $__eventManager_46_js__;
var REGISTERED_HOOKS = ["afterCellMetaReset", "afterChange", "afterChangesObserved", "afterColumnMove", "afterColumnResize", "afterContextMenuDefaultOptions", "afterContextMenuHide", "afterContextMenuShow", "afterCopyLimit", "afterCreateCol", "afterCreateRow", "afterDeselect", "afterDestroy", "afterDocumentKeyDown", "afterGetCellMeta", "afterGetColHeader", "afterGetRowHeader", "afterInit", "afterIsMultipleSelectionCheck", "afterLoadData", "afterMomentumScroll", "afterOnCellCornerMouseDown", "afterOnCellMouseDown", "afterOnCellMouseOver", "afterRemoveCol", "afterRemoveRow", "afterRender", "afterRenderer", "afterRowMove", "afterRowResize", "afterScrollHorizontally", "afterScrollVertically", "afterSelection", "afterSelectionByProp", "afterSelectionEnd", "afterSelectionEndByProp", "afterSetCellMeta", "afterUpdateSettings", "afterValidate", "beforeAutofill", "beforeCellAlignment", "beforeChange", "beforeChangeRender", "beforeDrawBorders", "beforeGetCellMeta", "beforeInit", "beforeInitWalkontable", "beforeKeyDown", "beforeOnCellMouseDown", "beforeRemoveCol", "beforeRemoveRow", "beforeRender", "beforeSetRangeEnd", "beforeTouchScroll", "beforeValidate", "modifyCol", "modifyColWidth", "modifyRow", "modifyRowHeight", "persistentStateLoad", "persistentStateReset", "persistentStateSave"];
var EventManager = ($__eventManager_46_js__ = require("./eventManager.js"), $__eventManager_46_js__ && $__eventManager_46_js__.__esModule && $__eventManager_46_js__ || {default: $__eventManager_46_js__}).EventManager;
var Hooks = function Hooks() {
this.globalBucket = this.createEmptyBucket();
};
($traceurRuntime.createClass)(Hooks, {
createEmptyBucket: function() {
var handler = Object.create(null);
for (var i = 0,
len = REGISTERED_HOOKS.length; i < len; i++) {
handler[REGISTERED_HOOKS[i]] = [];
}
return handler;
},
getBucket: function() {
var context = arguments[0] !== (void 0) ? arguments[0] : null;
if (context) {
if (!context.pluginHookBucket) {
context.pluginHookBucket = this.createEmptyBucket();
}
return context.pluginHookBucket;
}
return this.globalBucket;
},
add: function(key, callback) {
var context = arguments[2] !== (void 0) ? arguments[2] : null;
if (Array.isArray(callback)) {
for (var i = 0,
len = callback.length; i < len; i++) {
this.add(key, callback[i]);
}
} else {
var bucket = this.getBucket(context);
if (typeof bucket[key] === 'undefined') {
this.register(key);
bucket[key] = [];
}
callback.skip = false;
if (bucket[key].indexOf(callback) === -1) {
bucket[key].push(callback);
}
}
return this;
},
once: function(key, callback) {
var context = arguments[2] !== (void 0) ? arguments[2] : null;
if (Array.isArray(callback)) {
for (var i = 0,
len = callback.length; i < len; i++) {
callback[i].runOnce = true;
this.add(key, callback[i], context);
}
} else {
callback.runOnce = true;
this.add(key, callback, context);
}
},
remove: function(key, callback) {
var context = arguments[2] !== (void 0) ? arguments[2] : null;
var bucket = this.getBucket(context);
if (typeof bucket[key] !== 'undefined') {
if (bucket[key].indexOf(callback) >= 0) {
callback.skip = true;
return true;
}
}
return false;
},
run: function(context, key, p1, p2, p3, p4, p5, p6) {
{
var globalHandlers = this.globalBucket[key];
var len = globalHandlers ? globalHandlers.length : 0;
for (var i = 0; i < len; i++) {
if (globalHandlers[i].skip) {
continue;
}
var res = globalHandlers[i].call(context, p1, p2, p3, p4, p5, p6);
if (res !== void 0) {
p1 = res;
}
if (globalHandlers[i].runOnce) {
this.remove(key, globalHandlers[i]);
}
}
}
{
var localHandlers = this.getBucket(context)[key];
var len$__2 = localHandlers ? localHandlers.length : 0;
for (var i$__3 = 0; i$__3 < len$__2; i$__3++) {
if (localHandlers[i$__3].skip) {
continue;
}
var res$__4 = localHandlers[i$__3].call(context, p1, p2, p3, p4, p5, p6);
if (res$__4 !== void 0) {
p1 = res$__4;
}
if (localHandlers[i$__3].runOnce) {
this.remove(key, localHandlers[i$__3], context);
}
}
}
return p1;
},
destroy: function() {
var context = arguments[0] !== (void 0) ? arguments[0] : null;
var bucket = this.getBucket(context);
for (var key in bucket) {
for (var i = 0,
len = bucket[key].length; i < len; i++) {
this.remove(key, bucket[key], context);
}
}
},
register: function(key) {
if (!this.isRegistered(key)) {
REGISTERED_HOOKS.push(key);
}
},
deregister: function(key) {
if (this.isRegistered(key)) {
REGISTERED_HOOKS.splice(REGISTERED_HOOKS.indexOf(key), 1);
}
},
isRegistered: function(key) {
return REGISTERED_HOOKS.indexOf(key) >= 0;
},
getRegistered: function() {
return REGISTERED_HOOKS;
}
}, {});
;
//#
},{"./eventManager.js":41}],45:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
registerPlugin: {get: function() {
return registerPlugin;
}},
getPlugin: {get: function() {
return getPlugin;
}},
__esModule: {value: true}
});
;
var registeredPlugins = new WeakMap();
function registerPlugin(pluginName, PluginClass) {
Handsontable.hooks.add('beforeInit', function() {
var holder;
pluginName = pluginName.toLowerCase();
if (!registeredPlugins.has(this)) {
registeredPlugins.set(this, {});
}
holder = registeredPlugins.get(this);
if (!holder[pluginName]) {
holder[pluginName] = new PluginClass(this);
}
});
Handsontable.hooks.add('afterDestroy', function() {
var i,
pluginsHolder;
if (registeredPlugins.has(this)) {
pluginsHolder = registeredPlugins.get(this);
for (i in pluginsHolder) {
if (pluginsHolder.hasOwnProperty(i)) {
pluginsHolder[i].destroy();
}
}
registeredPlugins.delete(this);
}
});
}
function getPlugin(instance, pluginName) {
if (typeof pluginName != 'string') {
throw Error('Only strings can be passed as "plugin" parameter');
}
var _pluginName = pluginName.toLowerCase();
if (!registeredPlugins.has(instance) || !registeredPlugins.get(instance)[_pluginName]) {
throw Error('No plugin registered under name "' + pluginName + '"');
}
return registeredPlugins.get(instance)[_pluginName];
}
//#
},{}],46:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
default: {get: function() {
return $__default;
}},
__esModule: {value: true}
});
var $___46__46__47_helpers_46_js__;
var defineGetter = ($___46__46__47_helpers_46_js__ = require("./../helpers.js"), $___46__46__47_helpers_46_js__ && $___46__46__47_helpers_46_js__.__esModule && $___46__46__47_helpers_46_js__ || {default: $___46__46__47_helpers_46_js__}).defineGetter;
var BasePlugin = function BasePlugin(hotInstance) {
defineGetter(this, 'hot', hotInstance, {writable: false});
};
($traceurRuntime.createClass)(BasePlugin, {destroy: function() {
delete this.hot;
}}, {});
var $__default = BasePlugin;
//#
},{"./../helpers.js":42}],47:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
AutoColumnSize: {get: function() {
return AutoColumnSize;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_helpers_46_js__,
$___46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47_plugins_46_js__;
var helper = ($___46__46__47__46__46__47_helpers_46_js__ = require("./../../helpers.js"), $___46__46__47__46__46__47_helpers_46_js__ && $___46__46__47__46__46__47_helpers_46_js__.__esModule && $___46__46__47__46__46__47_helpers_46_js__ || {default: $___46__46__47__46__46__47_helpers_46_js__});
var dom = ($___46__46__47__46__46__47_dom_46_js__ = require("./../../dom.js"), $___46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47_dom_46_js__});
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
;
function AutoColumnSize() {
var plugin = this,
sampleCount = 5;
this.beforeInit = function() {
var instance = this;
instance.autoColumnWidths = [];
if (instance.getSettings().autoColumnSize !== false) {
if (!instance.autoColumnSizeTmp) {
instance.autoColumnSizeTmp = {
table: null,
tableStyle: null,
theadTh: null,
tbody: null,
container: null,
containerStyle: null,
determineBeforeNextRender: true
};
instance.addHook('beforeRender', htAutoColumnSize.determineIfChanged);
instance.addHook('modifyColWidth', htAutoColumnSize.modifyColWidth);
instance.addHook('afterDestroy', htAutoColumnSize.afterDestroy);
instance.determineColumnWidth = plugin.determineColumnWidth;
}
} else {
if (instance.autoColumnSizeTmp) {
instance.removeHook('beforeRender', htAutoColumnSize.determineIfChanged);
instance.removeHook('modifyColWidth', htAutoColumnSize.modifyColWidth);
instance.removeHook('afterDestroy', htAutoColumnSize.afterDestroy);
delete instance.determineColumnWidth;
plugin.afterDestroy.call(instance);
}
}
};
this.determineIfChanged = function(force) {
if (force) {
htAutoColumnSize.determineColumnsWidth.apply(this, arguments);
}
};
this.determineColumnWidth = function(col) {
var instance = this,
tmp = instance.autoColumnSizeTmp;
if (!tmp.container) {
createTmpContainer.call(tmp, instance);
}
tmp.container.className = instance.rootElement.className + ' htAutoColumnSize';
tmp.table.className = instance.table.className;
var rows = instance.countRows();
var samples = {};
for (var r = 0; r < rows; r++) {
var value = instance.getDataAtCell(r, col);
if (!Array.isArray(value)) {
value = helper.stringify(value);
}
var len = value.length;
if (!samples[len]) {
samples[len] = {
needed: sampleCount,
strings: []
};
}
if (samples[len].needed) {
samples[len].strings.push({
value: value,
row: r
});
samples[len].needed--;
}
}
var settings = instance.getSettings();
if (settings.colHeaders) {
instance.view.appendColHeader(col, tmp.theadTh);
}
dom.empty(tmp.tbody);
for (var i in samples) {
if (samples.hasOwnProperty(i)) {
for (var j = 0,
jlen = samples[i].strings.length; j < jlen; j++) {
var row = samples[i].strings[j].row;
var cellProperties = instance.getCellMeta(row, col);
cellProperties.col = col;
cellProperties.row = row;
var renderer = instance.getCellRenderer(cellProperties);
var tr = document.createElement('tr');
var td = document.createElement('td');
renderer(instance, td, row, col, instance.colToProp(col), samples[i].strings[j].value, cellProperties);
r++;
tr.appendChild(td);
tmp.tbody.appendChild(tr);
}
}
}
var parent = instance.rootElement.parentNode;
parent.appendChild(tmp.container);
var width = dom.outerWidth(tmp.table);
parent.removeChild(tmp.container);
return width;
};
this.determineColumnsWidth = function() {
var instance = this;
var settings = this.getSettings();
if (settings.autoColumnSize || !settings.colWidths) {
var cols = this.countCols();
for (var c = 0; c < cols; c++) {
if (!instance._getColWidthFromSettings(c)) {
this.autoColumnWidths[c] = plugin.determineColumnWidth.call(instance, c);
}
}
}
if (this.view.wt) {
this.view.wt.wtOverlays.adjustElementsSize(true);
}
};
this.modifyColWidth = function(width, col) {
if (this.autoColumnWidths[col] && this.autoColumnWidths[col] > width) {
return this.autoColumnWidths[col];
}
return width;
};
this.afterDestroy = function() {
var instance = this;
if (instance.autoColumnSizeTmp && instance.autoColumnSizeTmp.container && instance.autoColumnSizeTmp.container.parentNode) {
instance.autoColumnSizeTmp.container.parentNode.removeChild(instance.autoColumnSizeTmp.container);
}
instance.autoColumnSizeTmp = null;
};
function createTmpContainer(instance) {
var d = document,
tmp = this;
tmp.table = d.createElement('table');
tmp.theadTh = d.createElement('th');
tmp.table.appendChild(d.createElement('thead')).appendChild(d.createElement('tr')).appendChild(tmp.theadTh);
tmp.tableStyle = tmp.table.style;
tmp.tableStyle.tableLayout = 'auto';
tmp.tableStyle.width = 'auto';
tmp.tbody = d.createElement('tbody');
tmp.table.appendChild(tmp.tbody);
tmp.container = d.createElement('div');
tmp.container.className = instance.rootElement.className + ' hidden';
tmp.containerStyle = tmp.container.style;
tmp.container.appendChild(tmp.table);
}
}
var htAutoColumnSize = new AutoColumnSize();
Handsontable.hooks.add('beforeInit', htAutoColumnSize.beforeInit);
Handsontable.hooks.add('afterUpdateSettings', htAutoColumnSize.beforeInit);
//#
},{"./../../dom.js":27,"./../../helpers.js":42,"./../../plugins.js":45}],48:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
Autofill: {get: function() {
return Autofill;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47_eventManager_46_js__,
$___46__46__47__46__46__47_plugins_46_js__,
$___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__;
var dom = ($___46__46__47__46__46__47_dom_46_js__ = require("./../../dom.js"), $___46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47_dom_46_js__});
var eventManagerObject = ($___46__46__47__46__46__47_eventManager_46_js__ = require("./../../eventManager.js"), $___46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47_eventManager_46_js__}).eventManager;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
var WalkontableCellCoords = ($___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ = require("./../../3rdparty/walkontable/src/cell/coords.js"), $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__.__esModule && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ || {default: $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__}).WalkontableCellCoords;
;
function getDeltas(start, end, data, direction) {
var rlength = data.length,
clength = data ? data[0].length : 0,
deltas = [],
arr = [],
diffRow,
diffCol,
startValue,
endValue,
delta;
diffRow = end.row - start.row;
diffCol = end.col - start.col;
if (['down', 'up'].indexOf(direction) !== -1) {
for (var col = 0; col <= diffCol; col++) {
startValue = parseInt(data[0][col], 10);
endValue = parseInt(data[rlength - 1][col], 10);
delta = (direction === 'down' ? (endValue - startValue) : (startValue - endValue)) / (rlength - 1) || 0;
arr.push(delta);
}
deltas.push(arr);
}
if (['right', 'left'].indexOf(direction) !== -1) {
for (var row = 0; row <= diffRow; row++) {
startValue = parseInt(data[row][0], 10);
endValue = parseInt(data[row][clength - 1], 10);
delta = (direction === 'right' ? (endValue - startValue) : (startValue - endValue)) / (clength - 1) || 0;
arr = [];
arr.push(delta);
deltas.push(arr);
}
}
return deltas;
}
function Autofill(instance) {
var _this = this,
mouseDownOnCellCorner = false,
wtOnCellCornerMouseDown,
wtOnCellMouseOver,
eventManager;
this.instance = instance;
this.addingStarted = false;
eventManager = eventManagerObject(instance);
function mouseUpCallback(event) {
if (!instance.autofill) {
return true;
}
if (instance.autofill.handle && instance.autofill.handle.isDragged) {
if (instance.autofill.handle.isDragged > 1) {
instance.autofill.apply();
}
instance.autofill.handle.isDragged = 0;
mouseDownOnCellCorner = false;
}
}
function mouseMoveCallback(event) {
var tableBottom,
tableRight;
if (!_this.instance.autofill) {
return false;
}
tableBottom = dom.offset(_this.instance.table).top - (window.pageYOffset || document.documentElement.scrollTop) + dom.outerHeight(_this.instance.table);
tableRight = dom.offset(_this.instance.table).left - (window.pageXOffset || document.documentElement.scrollLeft) + dom.outerWidth(_this.instance.table);
if (_this.addingStarted === false && _this.instance.autofill.handle.isDragged > 0 && event.clientY > tableBottom && event.clientX <= tableRight) {
_this.instance.mouseDragOutside = true;
_this.addingStarted = true;
} else {
_this.instance.mouseDragOutside = false;
}
if (_this.instance.mouseDragOutside) {
setTimeout(function() {
_this.addingStarted = false;
_this.instance.alter('insert_row');
}, 200);
}
}
eventManager.addEventListener(document, 'mouseup', mouseUpCallback);
eventManager.addEventListener(document, 'mousemove', mouseMoveCallback);
wtOnCellCornerMouseDown = this.instance.view.wt.wtSettings.settings.onCellCornerMouseDown;
this.instance.view.wt.wtSettings.settings.onCellCornerMouseDown = function(event) {
instance.autofill.handle.isDragged = 1;
mouseDownOnCellCorner = true;
wtOnCellCornerMouseDown(event);
};
wtOnCellMouseOver = this.instance.view.wt.wtSettings.settings.onCellMouseOver;
this.instance.view.wt.wtSettings.settings.onCellMouseOver = function(event, coords, TD, wt) {
if (instance.autofill && mouseDownOnCellCorner && !instance.view.isMouseDown() && instance.autofill.handle && instance.autofill.handle.isDragged) {
instance.autofill.handle.isDragged++;
instance.autofill.showBorder(coords);
instance.autofill.checkIfNewRowNeeded();
}
wtOnCellMouseOver(event, coords, TD, wt);
};
this.instance.view.wt.wtSettings.settings.onCellCornerDblClick = function() {
instance.autofill.selectAdjacent();
};
}
Autofill.prototype.init = function() {
this.handle = {};
};
Autofill.prototype.disable = function() {
this.handle.disabled = true;
};
Autofill.prototype.selectAdjacent = function() {
var select,
data,
r,
maxR,
c;
if (this.instance.selection.isMultiple()) {
select = this.instance.view.wt.selections.area.getCorners();
} else {
select = this.instance.view.wt.selections.current.getCorners();
}
data = this.instance.getData();
rows: for (r = select[2] + 1; r < this.instance.countRows(); r++) {
for (c = select[1]; c <= select[3]; c++) {
if (data[r][c]) {
break rows;
}
}
if (!!data[r][select[1] - 1] || !!data[r][select[3] + 1]) {
maxR = r;
}
}
if (maxR) {
this.instance.view.wt.selections.fill.clear();
this.instance.view.wt.selections.fill.add(new WalkontableCellCoords(select[0], select[1]));
this.instance.view.wt.selections.fill.add(new WalkontableCellCoords(maxR, select[3]));
this.apply();
}
};
Autofill.prototype.apply = function() {
var drag,
select,
start,
end,
_data,
direction,
deltas,
selRange;
this.handle.isDragged = 0;
drag = this.instance.view.wt.selections.fill.getCorners();
if (!drag) {
return;
}
this.instance.view.wt.selections.fill.clear();
if (this.instance.selection.isMultiple()) {
select = this.instance.view.wt.selections.area.getCorners();
} else {
select = this.instance.view.wt.selections.current.getCorners();
}
Handsontable.hooks.run(this.instance, 'afterAutofillApplyValues', select, drag);
if (drag[0] === select[0] && drag[1] < select[1]) {
direction = 'left';
start = new WalkontableCellCoords(drag[0], drag[1]);
end = new WalkontableCellCoords(drag[2], select[1] - 1);
} else if (drag[0] === select[0] && drag[3] > select[3]) {
direction = 'right';
start = new WalkontableCellCoords(drag[0], select[3] + 1);
end = new WalkontableCellCoords(drag[2], drag[3]);
} else if (drag[0] < select[0] && drag[1] === select[1]) {
direction = 'up';
start = new WalkontableCellCoords(drag[0], drag[1]);
end = new WalkontableCellCoords(select[0] - 1, drag[3]);
} else if (drag[2] > select[2] && drag[1] === select[1]) {
direction = 'down';
start = new WalkontableCellCoords(select[2] + 1, drag[1]);
end = new WalkontableCellCoords(drag[2], drag[3]);
}
if (start && start.row > -1 && start.col > -1) {
selRange = {
from: this.instance.getSelectedRange().from,
to: this.instance.getSelectedRange().to
};
_data = this.instance.getData(selRange.from.row, selRange.from.col, selRange.to.row, selRange.to.col);
deltas = getDeltas(start, end, _data, direction);
Handsontable.hooks.run(this.instance, 'beforeAutofill', start, end, _data);
this.instance.populateFromArray(start.row, start.col, _data, end.row, end.col, 'autofill', null, direction, deltas);
this.instance.selection.setRangeStart(new WalkontableCellCoords(drag[0], drag[1]));
this.instance.selection.setRangeEnd(new WalkontableCellCoords(drag[2], drag[3]));
} else {
this.instance.selection.refreshBorders();
}
};
Autofill.prototype.showBorder = function(coords) {
var topLeft = this.instance.getSelectedRange().getTopLeftCorner(),
bottomRight = this.instance.getSelectedRange().getBottomRightCorner();
if (this.instance.getSettings().fillHandle !== 'horizontal' && (bottomRight.row < coords.row || topLeft.row > coords.row)) {
coords = new WalkontableCellCoords(coords.row, bottomRight.col);
} else if (this.instance.getSettings().fillHandle !== 'vertical') {
coords = new WalkontableCellCoords(bottomRight.row, coords.col);
} else {
return;
}
this.instance.view.wt.selections.fill.clear();
this.instance.view.wt.selections.fill.add(this.instance.getSelectedRange().from);
this.instance.view.wt.selections.fill.add(this.instance.getSelectedRange().to);
this.instance.view.wt.selections.fill.add(coords);
this.instance.view.render();
};
Autofill.prototype.checkIfNewRowNeeded = function() {
var fillCorners,
selection,
tableRows = this.instance.countRows(),
that = this;
if (this.instance.view.wt.selections.fill.cellRange && this.addingStarted === false) {
selection = this.instance.getSelected();
fillCorners = this.instance.view.wt.selections.fill.getCorners();
if (selection[2] < tableRows - 1 && fillCorners[2] === tableRows - 1) {
this.addingStarted = true;
this.instance._registerTimeout(setTimeout(function() {
that.instance.alter('insert_row');
that.addingStarted = false;
}, 200));
}
}
};
Handsontable.hooks.add('afterInit', function() {
var autofill = new Autofill(this);
if (typeof this.getSettings().fillHandle !== 'undefined') {
if (autofill.handle && this.getSettings().fillHandle === false) {
autofill.disable();
} else if (!autofill.handle && this.getSettings().fillHandle !== false) {
this.autofill = autofill;
this.autofill.init();
}
}
});
Handsontable.Autofill = Autofill;
//#
},{"./../../3rdparty/walkontable/src/cell/coords.js":5,"./../../dom.js":27,"./../../eventManager.js":41,"./../../plugins.js":45}],49:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
default: {get: function() {
return $__default;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47_eventManager_46_js__,
$___46__46__47__95_base_46_js__,
$___46__46__47__46__46__47_plugins_46_js__;
var dom = ($___46__46__47__46__46__47_dom_46_js__ = require("./../../dom.js"), $___46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47_dom_46_js__});
var eventManagerObject = ($___46__46__47__46__46__47_eventManager_46_js__ = require("./../../eventManager.js"), $___46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47_eventManager_46_js__}).eventManager;
var BasePlugin = ($___46__46__47__95_base_46_js__ = require("./../_base.js"), $___46__46__47__95_base_46_js__ && $___46__46__47__95_base_46_js__.__esModule && $___46__46__47__95_base_46_js__ || {default: $___46__46__47__95_base_46_js__}).default;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
var ColumnSorting = function ColumnSorting(hotInstance) {
var $__3 = this;
$traceurRuntime.superConstructor($ColumnSorting).call(this, hotInstance);
var _this = this;
this.sortIndicators = [];
this.hot.addHook('afterInit', (function() {
return $__3.init.call($__3, 'afterInit');
}));
this.hot.addHook('afterUpdateSettings', (function() {
return $__3.init.call($__3, 'afterUpdateSettings');
}));
this.hot.addHook('modifyRow', function() {
return _this.translateRow.apply(_this, arguments);
});
this.hot.addHook('afterGetColHeader', function() {
return _this.getColHeader.apply(_this, arguments);
});
Handsontable.hooks.register('beforeColumnSort');
Handsontable.hooks.register('afterColumnSort');
};
var $ColumnSorting = ColumnSorting;
($traceurRuntime.createClass)(ColumnSorting, {
init: function(source) {
var sortingSettings = this.hot.getSettings().columnSorting,
_this = this;
this.hot.sortingEnabled = !!(sortingSettings);
if (this.hot.sortingEnabled) {
this.hot.sortIndex = [];
var loadedSortingState = this.loadSortingState(),
sortingColumn,
sortingOrder;
if (typeof loadedSortingState != 'undefined') {
sortingColumn = loadedSortingState.sortColumn;
sortingOrder = loadedSortingState.sortOrder;
} else {
sortingColumn = sortingSettings.column;
sortingOrder = sortingSettings.sortOrder;
}
this.sortByColumn(sortingColumn, sortingOrder);
this.hot.sort = function() {
var args = Array.prototype.slice.call(arguments);
return _this.sortByColumn.apply(_this, args);
};
if (typeof this.hot.getSettings().observeChanges == 'undefined') {
this.enableObserveChangesPlugin();
}
if (source == 'afterInit') {
this.bindColumnSortingAfterClick();
this.hot.addHook('afterCreateRow', function() {
_this.afterCreateRow.apply(_this, arguments);
});
this.hot.addHook('afterRemoveRow', function() {
_this.afterRemoveRow.apply(_this, arguments);
});
this.hot.addHook('afterLoadData', function() {
_this.init.apply(_this, arguments);
});
}
} else {
this.hot.sort = void 0;
this.hot.removeHook('afterCreateRow', this.afterCreateRow);
this.hot.removeHook('afterRemoveRow', this.afterRemoveRow);
this.hot.removeHook('afterLoadData', this.init);
}
},
setSortingColumn: function(col, order) {
if (typeof col == 'undefined') {
this.hot.sortColumn = void 0;
this.hot.sortOrder = void 0;
return;
} else if (this.hot.sortColumn === col && typeof order == 'undefined') {
if (this.hot.sortOrder === false) {
this.hot.sortOrder = void 0;
} else {
this.hot.sortOrder = !this.hot.sortOrder;
}
} else {
this.hot.sortOrder = typeof order != 'undefined' ? order : true;
}
this.hot.sortColumn = col;
},
sortByColumn: function(col, order) {
this.setSortingColumn(col, order);
if (typeof this.hot.sortColumn == 'undefined') {
return;
}
Handsontable.hooks.run(this.hot, 'beforeColumnSort', this.hot.sortColumn, this.hot.sortOrder);
this.sort();
this.hot.render();
this.saveSortingState();
Handsontable.hooks.run(this.hot, 'afterColumnSort', this.hot.sortColumn, this.hot.sortOrder);
},
saveSortingState: function() {
var sortingState = {};
if (typeof this.hot.sortColumn != 'undefined') {
sortingState.sortColumn = this.hot.sortColumn;
}
if (typeof this.hot.sortOrder != 'undefined') {
sortingState.sortOrder = this.hot.sortOrder;
}
if (sortingState.hasOwnProperty('sortColumn') || sortingState.hasOwnProperty('sortOrder')) {
Handsontable.hooks.run(this.hot, 'persistentStateSave', 'columnSorting', sortingState);
}
},
loadSortingState: function() {
var storedState = {};
Handsontable.hooks.run(this.hot, 'persistentStateLoad', 'columnSorting', storedState);
return storedState.value;
},
bindColumnSortingAfterClick: function() {
var eventManager = eventManagerObject(this.hot),
_this = this;
eventManager.addEventListener(this.hot.rootElement, 'click', function(e) {
if (dom.hasClass(e.target, 'columnSorting')) {
var col = getColumn(e.target);
if (col !== this.lastSortedColumn) {
_this.sortOrderClass = 'ascending';
} else {
switch (_this.hot.sortOrder) {
case void 0:
_this.sortOrderClass = 'ascending';
break;
case true:
_this.sortOrderClass = 'descending';
break;
case false:
_this.sortOrderClass = void 0;
}
}
this.lastSortedColumn = col;
_this.sortByColumn(col);
}
});
function countRowHeaders() {
var THs = _this.hot.view.TBODY.querySelector('tr').querySelectorAll('th');
return THs.length;
}
function getColumn(target) {
var TH = dom.closest(target, 'TH');
return dom.index(TH) - countRowHeaders();
}
},
enableObserveChangesPlugin: function() {
var _this = this;
this.hot._registerTimeout(setTimeout(function() {
_this.hot.updateSettings({observeChanges: true});
}, 0));
},
defaultSort: function(sortOrder) {
return function(a, b) {
if (typeof a[1] == "string") {
a[1] = a[1].toLowerCase();
}
if (typeof b[1] == "string") {
b[1] = b[1].toLowerCase();
}
if (a[1] === b[1]) {
return 0;
}
if (a[1] === null || a[1] === "") {
return 1;
}
if (b[1] === null || b[1] === "") {
return -1;
}
if (a[1] < b[1]) {
return sortOrder ? -1 : 1;
}
if (a[1] > b[1]) {
return sortOrder ? 1 : -1;
}
return 0;
};
},
dateSort: function(sortOrder) {
return function(a, b) {
if (a[1] === b[1]) {
return 0;
}
if (a[1] === null) {
return 1;
}
if (b[1] === null) {
return -1;
}
var aDate = new Date(a[1]);
var bDate = new Date(b[1]);
if (aDate < bDate) {
return sortOrder ? -1 : 1;
}
if (aDate > bDate) {
return sortOrder ? 1 : -1;
}
return 0;
};
},
sort: function() {
if (typeof this.hot.sortOrder == 'undefined') {
return;
}
var colMeta,
sortFunction;
this.hot.sortingEnabled = false;
this.hot.sortIndex.length = 0;
var colOffset = this.hot.colOffset();
for (var i = 0,
ilen = this.hot.countRows() - this.hot.getSettings().minSpareRows; i < ilen; i++) {
this.hot.sortIndex.push([i, this.hot.getDataAtCell(i, this.hot.sortColumn + colOffset)]);
}
colMeta = this.hot.getCellMeta(0, this.hot.sortColumn);
this.sortIndicators[this.hot.sortColumn] = colMeta.sortIndicator;
switch (colMeta.type) {
case 'date':
sortFunction = this.dateSort;
break;
default:
sortFunction = this.defaultSort;
}
this.hot.sortIndex.sort(sortFunction(this.hot.sortOrder));
for (var i = this.hot.sortIndex.length; i < this.hot.countRows(); i++) {
this.hot.sortIndex.push([i, this.hot.getDataAtCell(i, this.hot.sortColumn + colOffset)]);
}
this.hot.sortingEnabled = true;
},
translateRow: function(row) {
if (this.hot.sortingEnabled && (typeof this.hot.sortOrder !== 'undefined') && this.hot.sortIndex && this.hot.sortIndex.length && this.hot.sortIndex[row]) {
return this.hot.sortIndex[row][0];
}
return row;
},
untranslateRow: function(row) {
if (this.hot.sortingEnabled && this.hot.sortIndex && this.hot.sortIndex.length) {
for (var i = 0; i < this.hot.sortIndex.length; i++) {
if (this.hot.sortIndex[i][0] == row) {
return i;
}
}
}
},
getColHeader: function(col, TH) {
var headerLink = TH.querySelector('.colHeader');
if (this.hot.getSettings().columnSorting && col >= 0) {
dom.addClass(headerLink, 'columnSorting');
}
dom.removeClass(headerLink, 'descending');
dom.removeClass(headerLink, 'ascending');
if (this.sortIndicators[col]) {
if (col === this.hot.sortColumn) {
if (this.sortOrderClass === 'ascending') {
dom.addClass(headerLink, 'ascending');
} else if (this.sortOrderClass === 'descending') {
dom.addClass(headerLink, 'descending');
}
}
}
},
isSorted: function() {
return typeof this.hot.sortColumn != 'undefined';
},
afterCreateRow: function(index, amount) {
if (!this.isSorted()) {
return;
}
for (var i = 0; i < this.hot.sortIndex.length; i++) {
if (this.hot.sortIndex[i][0] >= index) {
this.hot.sortIndex[i][0] += amount;
}
}
for (var i = 0; i < amount; i++) {
this.hot.sortIndex.splice(index + i, 0, [index + i, this.hot.getData()[index + i][this.hot.sortColumn + this.hot.colOffset()]]);
}
this.saveSortingState();
},
afterRemoveRow: function(index, amount) {
if (!this.isSorted()) {
return;
}
var physicalRemovedIndex = this.translateRow(index);
this.hot.sortIndex.splice(index, amount);
for (var i = 0; i < this.hot.sortIndex.length; i++) {
if (this.hot.sortIndex[i][0] > physicalRemovedIndex) {
this.hot.sortIndex[i][0] -= amount;
}
}
this.saveSortingState();
}
}, {}, BasePlugin);
var $__default = ColumnSorting;
registerPlugin('columnSorting', ColumnSorting);
//#
},{"./../../dom.js":27,"./../../eventManager.js":41,"./../../plugins.js":45,"./../_base.js":46}],50:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
CommentEditor: {get: function() {
return CommentEditor;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_dom_46_js__;
var dom = ($___46__46__47__46__46__47_dom_46_js__ = require("./../../dom.js"), $___46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47_dom_46_js__});
var CommentEditor = function CommentEditor() {
this.editor = this.createEditor();
this.editorStyle = this.editor.style;
this.editorStyle.position = 'absolute';
this.editorStyle.zIndex = 100;
this.hide();
};
var $CommentEditor = CommentEditor;
($traceurRuntime.createClass)(CommentEditor, {
setPosition: function(x, y) {
this.editorStyle.left = x + 'px';
this.editorStyle.top = y + 'px';
},
show: function() {
this.editorStyle.display = 'block';
},
hide: function() {
this.editorStyle.display = 'none';
},
isVisible: function() {
return this.editorStyle.display === 'block';
},
setValue: function() {
var value = arguments[0] !== (void 0) ? arguments[0] : '';
value = value || '';
this.getInputElement().value = value;
},
getValue: function() {
return this.getInputElement().value;
},
isFocused: function() {
return document.activeElement === this.getInputElement();
},
focus: function() {
this.getInputElement().focus();
},
createEditor: function() {
var container = document.querySelector('.' + $CommentEditor.CLASS_EDITOR_CONTAINER);
var editor;
var textArea;
if (!container) {
container = document.createElement('div');
dom.addClass(container, $CommentEditor.CLASS_EDITOR_CONTAINER);
document.body.appendChild(container);
}
editor = document.createElement('div');
dom.addClass(editor, $CommentEditor.CLASS_EDITOR);
textArea = document.createElement('textarea');
dom.addClass(textArea, $CommentEditor.CLASS_INPUT);
editor.appendChild(textArea);
container.appendChild(editor);
return editor;
},
getInputElement: function() {
return this.editor.querySelector('.' + $CommentEditor.CLASS_INPUT);
},
destroy: function() {
this.editor.parentNode.removeChild(this.editor);
this.editor = null;
this.editorStyle = null;
}
}, {
get CLASS_EDITOR_CONTAINER() {
return 'htCommentsContainer';
},
get CLASS_EDITOR() {
return 'htComments';
},
get CLASS_INPUT() {
return 'htCommentTextArea';
},
get CLASS_CELL() {
return 'htCommentCell';
}
});
;
//#
},{"./../../dom.js":27}],51:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
Comments: {get: function() {
return Comments;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47_eventManager_46_js__,
$___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__,
$___46__46__47__46__46__47_plugins_46_js__,
$___46__46__47__95_base_46_js__,
$__commentEditor_46_js__;
var dom = ($___46__46__47__46__46__47_dom_46_js__ = require("./../../dom.js"), $___46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47_dom_46_js__});
var EventManager = ($___46__46__47__46__46__47_eventManager_46_js__ = require("./../../eventManager.js"), $___46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47_eventManager_46_js__}).EventManager;
var WalkontableCellCoords = ($___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ = require("./../../3rdparty/walkontable/src/cell/coords.js"), $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__.__esModule && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ || {default: $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__}).WalkontableCellCoords;
var $__2 = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}),
registerPlugin = $__2.registerPlugin,
getPlugin = $__2.getPlugin;
var BasePlugin = ($___46__46__47__95_base_46_js__ = require("./../_base.js"), $___46__46__47__95_base_46_js__ && $___46__46__47__95_base_46_js__.__esModule && $___46__46__47__95_base_46_js__ || {default: $___46__46__47__95_base_46_js__}).default;
var CommentEditor = ($__commentEditor_46_js__ = require("./commentEditor.js"), $__commentEditor_46_js__ && $__commentEditor_46_js__.__esModule && $__commentEditor_46_js__ || {default: $__commentEditor_46_js__}).CommentEditor;
var Comments = function Comments(hotInstance) {
var $__5 = this;
$traceurRuntime.superConstructor($Comments).call(this, hotInstance);
if (!this.hot.getSettings().comments) {
return;
}
this.editor = new CommentEditor();
this.eventManager = new EventManager(this);
this.range = {};
this.mouseDown = false;
this.contextMenuEvent = false;
this.timer = null;
this.hot.addHook('afterInit', (function() {
return $__5.registerListeners();
}));
this.hot.addHook('afterContextMenuDefaultOptions', (function(options) {
return $__5.addToContextMenu(options);
}));
this.hot.addHook('afterRenderer', (function(TD, row, col, prop, value, cellProperties) {
return $__5.onAfterRenderer(TD, cellProperties);
}));
this.hot.addHook('afterScrollVertically', (function() {
return $__5.refreshEditorPosition();
}));
this.hot.addHook('afterColumnResize', (function() {
return $__5.refreshEditorPosition();
}));
this.hot.addHook('afterRowResize', (function() {
return $__5.refreshEditorPosition();
}));
};
var $Comments = Comments;
($traceurRuntime.createClass)(Comments, {
registerListeners: function() {
var $__5 = this;
this.eventManager.addEventListener(document, 'mouseover', (function(event) {
return $__5.onMouseOver(event);
}));
this.eventManager.addEventListener(document, 'mousedown', (function(event) {
return $__5.onMouseDown(event);
}));
this.eventManager.addEventListener(document, 'mousemove', (function(event) {
return $__5.onMouseMove(event);
}));
this.eventManager.addEventListener(document, 'mouseup', (function(event) {
return $__5.onMouseUp(event);
}));
this.eventManager.addEventListener(this.editor.getInputElement(), 'blur', (function(event) {
return $__5.onEditorBlur(event);
}));
},
setRange: function(range) {
this.range = range;
},
clearRange: function() {
this.range = {};
},
targetIsCellWithComment: function(event) {
return dom.hasClass(event.target, 'htCommentCell') && dom.closest(event.target, [this.hot.rootElement]) ? true : false;
},
targetIsCommentTextArea: function(event) {
return this.editor.getInputElement() === event.target;
},
saveComment: function() {
if (!this.range.from) {
throw new Error('Before using this method, first set cell range (hot.getPlugin("comment").setRange())');
}
var comment = this.editor.getValue();
var row = this.range.from.row;
var col = this.range.from.col;
this.hot.setCellMeta(row, col, 'comment', comment);
this.hot.render();
},
saveCommentAtCell: function(row, col) {
this.setRange({from: new WalkontableCellCoords(row, col)});
this.saveComment();
},
removeComment: function() {
if (!this.range.from) {
throw new Error('Before using this method, first set cell range (hot.getPlugin("comment").setRange())');
}
this.hot.removeCellMeta(this.range.from.row, this.range.from.col, 'comment');
this.hot.render();
this.hide();
},
removeCommentAtCell: function(row, col) {
this.setRange({from: new WalkontableCellCoords(row, col)});
this.removeComment();
},
show: function() {
if (!this.range.from) {
throw new Error('Before using this method, first set cell range (hot.getPlugin("comment").setRange())');
}
var meta = this.hot.getCellMeta(this.range.from.row, this.range.from.col);
this.refreshEditorPosition(true);
this.editor.setValue(meta.comment || '');
this.editor.show();
return true;
},
showAtCell: function(row, col) {
this.setRange({from: new WalkontableCellCoords(row, col)});
return this.show();
},
hide: function() {
this.editor.hide();
},
refreshEditorPosition: function() {
var force = arguments[0] !== (void 0) ? arguments[0] : false;
if (!force && (!this.range.from || !this.editor.isVisible())) {
return;
}
var TD = this.hot.view.wt.wtTable.getCell(this.range.from);
var offset = dom.offset(TD);
var lastColWidth = this.hot.getColWidth(this.range.from.col);
var cellTopOffset = offset.top;
var cellLeftOffset = offset.left;
var verticalCompensation = 0;
var horizontalCompensation = 0;
if (this.hot.view.wt.wtViewport.hasVerticalScroll()) {
cellTopOffset = cellTopOffset - this.hot.view.wt.wtOverlays.topOverlay.getScrollPosition();
verticalCompensation = 20;
}
if (this.hot.view.wt.wtViewport.hasHorizontalScroll()) {
cellLeftOffset = cellLeftOffset - this.hot.view.wt.wtOverlays.leftOverlay.getScrollPosition();
horizontalCompensation = 20;
}
var x = cellLeftOffset + lastColWidth;
var y = cellTopOffset;
var rect = this.hot.view.wt.wtTable.holder.getBoundingClientRect();
var holderPos = {
left: rect.left + dom.getWindowScrollLeft() + horizontalCompensation,
right: rect.right + dom.getWindowScrollLeft() - 15,
top: rect.top + dom.getWindowScrollTop() + verticalCompensation,
bottom: rect.bottom + dom.getWindowScrollTop()
};
if (x <= holderPos.left || x > holderPos.right || y <= holderPos.top || y > holderPos.bottom) {
this.hide();
} else {
this.editor.setPosition(x, y);
}
},
onMouseDown: function(event) {
this.mouseDown = true;
if (!this.hot.view || !this.hot.view.wt) {
return;
}
if (!this.contextMenuEvent && !this.targetIsCommentTextArea(event) && !this.targetIsCellWithComment(event)) {
this.hide();
}
this.contextMenuEvent = false;
},
onMouseOver: function(event) {
if (this.mouseDown || this.editor.isFocused()) {
return;
}
if (this.targetIsCellWithComment(event)) {
var coordinates = this.hot.view.wt.wtTable.getCoords(event.target);
var range = {from: new WalkontableCellCoords(coordinates.row, coordinates.col)};
this.setRange(range);
this.show();
} else if (!this.targetIsCommentTextArea(event) && !this.editor.isFocused()) {
this.hide();
}
},
onMouseMove: function(event) {
var $__5 = this;
if (this.targetIsCommentTextArea(event)) {
this.mouseDown = true;
clearTimeout(this.timer);
this.timer = setTimeout((function() {
$__5.mouseDown = false;
}), 200);
}
},
onMouseUp: function(event) {
this.mouseDown = false;
},
onAfterRenderer: function(TD, cellProperties) {
if (cellProperties.comment) {
dom.addClass(TD, cellProperties.commentedCellClassName);
}
},
onEditorBlur: function(event) {
this.saveComment();
},
checkSelectionCommentsConsistency: function() {
var hasComment = false;
var cell = this.hot.getSelectedRange().from;
if (this.hot.getCellMeta(cell.row, cell.col).comment) {
hasComment = true;
}
return hasComment;
},
onContextMenuAddComment: function() {
var $__5 = this;
var coords = this.hot.getSelectedRange();
this.contextMenuEvent = true;
this.setRange({from: coords.from});
this.show();
setTimeout((function() {
if ($__5.hot) {
$__5.hot.deselectCell();
$__5.editor.focus();
}
}), 10);
},
onContextMenuRemoveComment: function(key, selection) {
this.contextMenuEvent = true;
this.removeCommentAtCell(selection.start.row, selection.start.col);
},
addToContextMenu: function(defaultOptions) {
var $__5 = this;
defaultOptions.items.push(Handsontable.ContextMenu.SEPARATOR, {
key: 'commentsAddEdit',
name: (function() {
return $__5.checkSelectionCommentsConsistency() ? 'Edit Comment' : 'Add Comment';
}),
callback: (function() {
return $__5.onContextMenuAddComment();
}),
disabled: function() {
return false;
}
}, {
key: 'commentsRemove',
name: function() {
return 'Delete Comment';
},
callback: (function(key, selection) {
return $__5.onContextMenuRemoveComment(key, selection);
}),
disabled: (function() {
return !$__5.checkSelectionCommentsConsistency();
})
});
},
destroy: function() {
if (this.eventManager) {
this.eventManager.clear();
}
if (this.editor) {
this.editor.destroy();
}
$traceurRuntime.superGet(this, $Comments.prototype, "destroy").call(this);
}
}, {}, BasePlugin);
;
registerPlugin('comments', Comments);
//#
},{"./../../3rdparty/walkontable/src/cell/coords.js":5,"./../../dom.js":27,"./../../eventManager.js":41,"./../../plugins.js":45,"./../_base.js":46,"./commentEditor.js":50}],52:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
ContextMenu: {get: function() {
return ContextMenu;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_helpers_46_js__,
$___46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47_eventManager_46_js__,
$___46__46__47__46__46__47_plugins_46_js__;
var helper = ($___46__46__47__46__46__47_helpers_46_js__ = require("./../../helpers.js"), $___46__46__47__46__46__47_helpers_46_js__ && $___46__46__47__46__46__47_helpers_46_js__.__esModule && $___46__46__47__46__46__47_helpers_46_js__ || {default: $___46__46__47__46__46__47_helpers_46_js__});
var dom = ($___46__46__47__46__46__47_dom_46_js__ = require("./../../dom.js"), $___46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47_dom_46_js__});
var eventManagerObject = ($___46__46__47__46__46__47_eventManager_46_js__ = require("./../../eventManager.js"), $___46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47_eventManager_46_js__}).eventManager;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
;
function ContextMenu(instance, customOptions) {
this.instance = instance;
var contextMenu = this;
contextMenu.menus = [];
contextMenu.htMenus = {};
contextMenu.triggerRows = [];
contextMenu.eventManager = eventManagerObject(contextMenu);
this.enabled = true;
this.instance.addHook('afterDestroy', function() {
contextMenu.destroy();
});
this.defaultOptions = {items: [{
key: 'row_above',
name: 'Insert row above',
callback: function(key, selection) {
this.alter("insert_row", selection.start.row);
},
disabled: function() {
var selected = this.getSelected(),
entireColumnSelection = [0, selected[1], this.countRows() - 1, selected[1]],
columnSelected = entireColumnSelection.join(',') == selected.join(',');
return selected[0] < 0 || this.countRows() >= this.getSettings().maxRows || columnSelected;
}
}, {
key: 'row_below',
name: 'Insert row below',
callback: function(key, selection) {
this.alter("insert_row", selection.end.row + 1);
},
disabled: function() {
var selected = this.getSelected(),
entireColumnSelection = [0, selected[1], this.countRows() - 1, selected[1]],
columnSelected = entireColumnSelection.join(',') == selected.join(',');
return this.getSelected()[0] < 0 || this.countRows() >= this.getSettings().maxRows || columnSelected;
}
}, ContextMenu.SEPARATOR, {
key: 'col_left',
name: 'Insert column on the left',
callback: function(key, selection) {
this.alter("insert_col", selection.start.col);
},
disabled: function() {
if (!this.isColumnModificationAllowed()) {
return true;
}
var selected = this.getSelected(),
entireRowSelection = [selected[0], 0, selected[0], this.countCols() - 1],
rowSelected = entireRowSelection.join(',') == selected.join(',');
return this.getSelected()[1] < 0 || this.countCols() >= this.getSettings().maxCols || rowSelected;
}
}, {
key: 'col_right',
name: 'Insert column on the right',
callback: function(key, selection) {
this.alter("insert_col", selection.end.col + 1);
},
disabled: function() {
if (!this.isColumnModificationAllowed()) {
return true;
}
var selected = this.getSelected(),
entireRowSelection = [selected[0], 0, selected[0], this.countCols() - 1],
rowSelected = entireRowSelection.join(',') == selected.join(',');
return selected[1] < 0 || this.countCols() >= this.getSettings().maxCols || rowSelected;
}
}, ContextMenu.SEPARATOR, {
key: 'remove_row',
name: 'Remove row',
callback: function(key, selection) {
var amount = selection.end.row - selection.start.row + 1;
this.alter("remove_row", selection.start.row, amount);
},
disabled: function() {
var selected = this.getSelected(),
entireColumnSelection = [0, selected[1], this.countRows() - 1, selected[1]],
columnSelected = entireColumnSelection.join(',') == selected.join(',');
return (selected[0] < 0 || columnSelected);
}
}, {
key: 'remove_col',
name: 'Remove column',
callback: function(key, selection) {
var amount = selection.end.col - selection.start.col + 1;
this.alter("remove_col", selection.start.col, amount);
},
disabled: function() {
if (!this.isColumnModificationAllowed()) {
return true;
}
var selected = this.getSelected(),
entireRowSelection = [selected[0], 0, selected[0], this.countCols() - 1],
rowSelected = entireRowSelection.join(',') == selected.join(',');
return (selected[1] < 0 || rowSelected);
}
}, ContextMenu.SEPARATOR, {
key: 'undo',
name: 'Undo',
callback: function() {
this.undo();
},
disabled: function() {
return this.undoRedo && !this.undoRedo.isUndoAvailable();
}
}, {
key: 'redo',
name: 'Redo',
callback: function() {
this.redo();
},
disabled: function() {
return this.undoRedo && !this.undoRedo.isRedoAvailable();
}
}, ContextMenu.SEPARATOR, {
key: 'make_read_only',
name: function() {
var label = "Read only";
var atLeastOneReadOnly = contextMenu.checkSelectionReadOnlyConsistency(this);
if (atLeastOneReadOnly) {
label = contextMenu.markSelected(label);
}
return label;
},
callback: function() {
var atLeastOneReadOnly = contextMenu.checkSelectionReadOnlyConsistency(this);
var that = this;
this.getSelectedRange().forAll(function(r, c) {
that.getCellMeta(r, c).readOnly = atLeastOneReadOnly ? false : true;
});
this.render();
}
}, ContextMenu.SEPARATOR, {
key: 'alignment',
name: 'Alignment',
submenu: {items: [{
name: function() {
var label = "Left";
var hasClass = contextMenu.checkSelectionAlignment(this, 'htLeft');
if (hasClass) {
label = contextMenu.markSelected(label);
}
return label;
},
callback: function() {
align.call(this, this.getSelectedRange(), 'horizontal', 'htLeft');
},
disabled: false
}, {
name: function() {
var label = "Center";
var hasClass = contextMenu.checkSelectionAlignment(this, 'htCenter');
if (hasClass) {
label = contextMenu.markSelected(label);
}
return label;
},
callback: function() {
align.call(this, this.getSelectedRange(), 'horizontal', 'htCenter');
},
disabled: false
}, {
name: function() {
var label = "Right";
var hasClass = contextMenu.checkSelectionAlignment(this, 'htRight');
if (hasClass) {
label = contextMenu.markSelected(label);
}
return label;
},
callback: function() {
align.call(this, this.getSelectedRange(), 'horizontal', 'htRight');
},
disabled: false
}, {
name: function() {
var label = "Justify";
var hasClass = contextMenu.checkSelectionAlignment(this, 'htJustify');
if (hasClass) {
label = contextMenu.markSelected(label);
}
return label;
},
callback: function() {
align.call(this, this.getSelectedRange(), 'horizontal', 'htJustify');
},
disabled: false
}, ContextMenu.SEPARATOR, {
name: function() {
var label = "Top";
var hasClass = contextMenu.checkSelectionAlignment(this, 'htTop');
if (hasClass) {
label = contextMenu.markSelected(label);
}
return label;
},
callback: function() {
align.call(this, this.getSelectedRange(), 'vertical', 'htTop');
},
disabled: false
}, {
name: function() {
var label = "Middle";
var hasClass = contextMenu.checkSelectionAlignment(this, 'htMiddle');
if (hasClass) {
label = contextMenu.markSelected(label);
}
return label;
},
callback: function() {
align.call(this, this.getSelectedRange(), 'vertical', 'htMiddle');
},
disabled: false
}, {
name: function() {
var label = "Bottom";
var hasClass = contextMenu.checkSelectionAlignment(this, 'htBottom');
if (hasClass) {
label = contextMenu.markSelected(label);
}
return label;
},
callback: function() {
align.call(this, this.getSelectedRange(), 'vertical', 'htBottom');
},
disabled: false
}]}
}]};
contextMenu.options = {};
helper.extend(contextMenu.options, this.options);
this.bindMouseEvents();
this.markSelected = function(label) {
return "<span class='selected'>" + String.fromCharCode(10003) + "</span>" + label;
};
this.checkSelectionAlignment = function(hot, className) {
var hasAlignment = false;
hot.getSelectedRange().forAll(function(r, c) {
var metaClassName = hot.getCellMeta(r, c).className;
if (metaClassName && metaClassName.indexOf(className) != -1) {
hasAlignment = true;
return false;
}
});
return hasAlignment;
};
if (!this.instance.getSettings().allowInsertRow) {
var rowAboveIndex = findIndexByKey(this.defaultOptions.items, 'row_above');
this.defaultOptions.items.splice(rowAboveIndex, 1);
var rowBelowIndex = findIndexByKey(this.defaultOptions.items, 'row_above');
this.defaultOptions.items.splice(rowBelowIndex, 1);
this.defaultOptions.items.splice(rowBelowIndex, 1);
}
if (!this.instance.getSettings().allowInsertColumn) {
var colLeftIndex = findIndexByKey(this.defaultOptions.items, 'col_left');
this.defaultOptions.items.splice(colLeftIndex, 1);
var colRightIndex = findIndexByKey(this.defaultOptions.items, 'col_right');
this.defaultOptions.items.splice(colRightIndex, 1);
this.defaultOptions.items.splice(colRightIndex, 1);
}
var removeRow = false;
var removeCol = false;
var removeRowIndex,
removeColumnIndex;
if (!this.instance.getSettings().allowRemoveRow) {
removeRowIndex = findIndexByKey(this.defaultOptions.items, 'remove_row');
this.defaultOptions.items.splice(removeRowIndex, 1);
removeRow = true;
}
if (!this.instance.getSettings().allowRemoveColumn) {
removeColumnIndex = findIndexByKey(this.defaultOptions.items, 'remove_col');
this.defaultOptions.items.splice(removeColumnIndex, 1);
removeCol = true;
}
if (removeRow && removeCol) {
this.defaultOptions.items.splice(removeColumnIndex, 1);
}
this.checkSelectionReadOnlyConsistency = function(hot) {
var atLeastOneReadOnly = false;
hot.getSelectedRange().forAll(function(r, c) {
if (hot.getCellMeta(r, c).readOnly) {
atLeastOneReadOnly = true;
return false;
}
});
return atLeastOneReadOnly;
};
Handsontable.hooks.run(instance, 'afterContextMenuDefaultOptions', this.defaultOptions);
}
ContextMenu.prototype.createMenu = function(menuName, row) {
if (menuName) {
menuName = menuName.replace(/ /g, '_');
menuName = 'htContextSubMenu_' + menuName;
}
var menu;
if (menuName) {
menu = document.querySelector('.htContextMenu.' + menuName);
} else {
menu = document.querySelector('.htContextMenu');
}
if (!menu) {
menu = document.createElement('DIV');
dom.addClass(menu, 'htContextMenu');
if (menuName) {
dom.addClass(menu, menuName);
}
document.getElementsByTagName('body')[0].appendChild(menu);
}
if (this.menus.indexOf(menu) < 0) {
this.menus.push(menu);
row = row || 0;
this.triggerRows.push(row);
}
return menu;
};
ContextMenu.prototype.bindMouseEvents = function() {
function contextMenuOpenListener(event) {
var settings = this.instance.getSettings(),
showRowHeaders = this.instance.getSettings().rowHeaders,
showColHeaders = this.instance.getSettings().colHeaders,
containsCornerHeader,
element,
items,
menu;
function isValidElement(element) {
return element.nodeName === 'TD' || element.parentNode.nodeName === 'TD';
}
element = event.realTarget;
this.closeAll();
event.preventDefault();
helper.stopPropagation(event);
if (!(showRowHeaders || showColHeaders)) {
if (!isValidElement(element) && !(dom.hasClass(element, 'current') && dom.hasClass(element, 'wtBorder'))) {
return;
}
} else if (showRowHeaders && showColHeaders) {
containsCornerHeader = element.parentNode.querySelectorAll('.cornerHeader').length > 0;
if (containsCornerHeader) {
return;
}
}
menu = this.createMenu();
items = this.getItems(settings.contextMenu);
this.show(menu, items);
this.setMenuPosition(event, menu);
this.eventManager.addEventListener(document.documentElement, 'mousedown', helper.proxy(ContextMenu.prototype.closeAll, this));
}
var eventManager = eventManagerObject(this.instance);
eventManager.addEventListener(this.instance.rootElement, 'contextmenu', helper.proxy(contextMenuOpenListener, this));
};
ContextMenu.prototype.bindTableEvents = function() {
this._afterScrollCallback = function() {};
this.instance.addHook('afterScrollVertically', this._afterScrollCallback);
this.instance.addHook('afterScrollHorizontally', this._afterScrollCallback);
};
ContextMenu.prototype.unbindTableEvents = function() {
if (this._afterScrollCallback) {
this.instance.removeHook('afterScrollVertically', this._afterScrollCallback);
this.instance.removeHook('afterScrollHorizontally', this._afterScrollCallback);
this._afterScrollCallback = null;
}
};
ContextMenu.prototype.performAction = function(event, hot) {
var contextMenu = this;
var selectedItemIndex = hot.getSelected()[0];
var selectedItem = hot.getData()[selectedItemIndex];
if (selectedItem.disabled === true || (typeof selectedItem.disabled == 'function' && selectedItem.disabled.call(this.instance) === true)) {
return;
}
if (!selectedItem.hasOwnProperty('submenu')) {
if (typeof selectedItem.callback != 'function') {
return;
}
var selRange = this.instance.getSelectedRange();
var normalizedSelection = ContextMenu.utils.normalizeSelection(selRange);
selectedItem.callback.call(this.instance, selectedItem.key, normalizedSelection, event);
contextMenu.closeAll();
}
};
ContextMenu.prototype.unbindMouseEvents = function() {
this.eventManager.clear();
var eventManager = eventManagerObject(this.instance);
eventManager.removeEventListener(this.instance.rootElement, 'contextmenu');
};
ContextMenu.prototype.show = function(menu, items) {
var that = this;
menu.removeAttribute('style');
menu.style.display = 'block';
var settings = {
data: items,
colHeaders: false,
colWidths: [200],
readOnly: true,
copyPaste: false,
columns: [{
data: 'name',
renderer: helper.proxy(this.renderer, this)
}],
renderAllRows: true,
beforeKeyDown: function(event) {
that.onBeforeKeyDown(event, htContextMenu);
},
afterOnCellMouseOver: function(event, coords, TD) {
that.onCellMouseOver(event, coords, TD, htContextMenu);
}
};
var htContextMenu = new Handsontable(menu, settings);
htContextMenu.isHotTableEnv = this.instance.isHotTableEnv;
Handsontable.eventManager.isHotTableEnv = this.instance.isHotTableEnv;
this.eventManager.removeEventListener(menu, 'mousedown');
this.eventManager.addEventListener(menu, 'mousedown', function(event) {
that.performAction(event, htContextMenu);
});
this.bindTableEvents();
htContextMenu.listen();
this.htMenus[htContextMenu.guid] = htContextMenu;
Handsontable.hooks.run(this.instance, 'afterContextMenuShow', htContextMenu);
};
ContextMenu.prototype.close = function(menu) {
this.hide(menu);
this.eventManager.clear();
this.unbindTableEvents();
this.instance.listen();
};
ContextMenu.prototype.closeAll = function() {
while (this.menus.length > 0) {
var menu = this.menus.pop();
if (menu) {
this.close(menu);
}
}
this.triggerRows = [];
};
ContextMenu.prototype.closeLastOpenedSubMenu = function() {
var menu = this.menus.pop();
if (menu) {
this.hide(menu);
}
};
ContextMenu.prototype.hide = function(menu) {
menu.style.display = 'none';
var instance = this.htMenus[menu.id];
Handsontable.hooks.run(this.instance, 'afterContextMenuHide', instance);
instance.destroy();
delete this.htMenus[menu.id];
};
ContextMenu.prototype.renderer = function(instance, TD, row, col, prop, value) {
var contextMenu = this;
var item = instance.getData()[row];
var wrapper = document.createElement('DIV');
if (typeof value === 'function') {
value = value.call(this.instance);
}
dom.empty(TD);
TD.appendChild(wrapper);
if (itemIsSeparator(item)) {
dom.addClass(TD, 'htSeparator');
} else {
dom.fastInnerHTML(wrapper, value);
}
if (itemIsDisabled(item)) {
dom.addClass(TD, 'htDisabled');
this.eventManager.addEventListener(wrapper, 'mouseenter', function() {
instance.deselectCell();
});
} else {
if (isSubMenu(item)) {
dom.addClass(TD, 'htSubmenu');
this.eventManager.addEventListener(wrapper, 'mouseenter', function() {
instance.selectCell(row, col);
});
} else {
dom.removeClass(TD, 'htSubmenu');
dom.removeClass(TD, 'htDisabled');
this.eventManager.addEventListener(wrapper, 'mouseenter', function() {
instance.selectCell(row, col);
});
}
}
function isSubMenu(item) {
return item.hasOwnProperty('submenu');
}
function itemIsSeparator(item) {
return new RegExp(ContextMenu.SEPARATOR.name, 'i').test(item.name);
}
function itemIsDisabled(item) {
return item.disabled === true || (typeof item.disabled == 'function' && item.disabled.call(contextMenu.instance) === true);
}
};
ContextMenu.prototype.onCellMouseOver = function(event, coords, TD, hot) {
var menusLength = this.menus.length;
if (menusLength > 0) {
var lastMenu = this.menus[menusLength - 1];
if (lastMenu.id != hot.guid) {
this.closeLastOpenedSubMenu();
}
} else {
this.closeLastOpenedSubMenu();
}
if (TD.className.indexOf('htSubmenu') != -1) {
var selectedItem = hot.getData()[coords.row];
var items = this.getItems(selectedItem.submenu);
var subMenu = this.createMenu(selectedItem.name, coords.row);
var tdCoords = TD.getBoundingClientRect();
this.show(subMenu, items);
this.setSubMenuPosition(tdCoords, subMenu);
}
};
ContextMenu.prototype.onBeforeKeyDown = function(event, instance) {
dom.enableImmediatePropagation(event);
var contextMenu = this;
var selection = instance.getSelected();
switch (event.keyCode) {
case helper.keyCode.ESCAPE:
contextMenu.closeAll();
event.preventDefault();
event.stopImmediatePropagation();
break;
case helper.keyCode.ENTER:
if (selection) {
contextMenu.performAction(event, instance);
}
break;
case helper.keyCode.ARROW_DOWN:
if (!selection) {
selectFirstCell(instance, contextMenu);
} else {
selectNextCell(selection[0], selection[1], instance, contextMenu);
}
event.preventDefault();
event.stopImmediatePropagation();
break;
case helper.keyCode.ARROW_UP:
if (!selection) {
selectLastCell(instance, contextMenu);
} else {
selectPrevCell(selection[0], selection[1], instance, contextMenu);
}
event.preventDefault();
event.stopImmediatePropagation();
break;
case helper.keyCode.ARROW_RIGHT:
if (selection) {
var row = selection[0];
var cell = instance.getCell(selection[0], 0);
if (ContextMenu.utils.hasSubMenu(cell)) {
openSubMenu(instance, contextMenu, cell, row);
}
}
event.preventDefault();
event.stopImmediatePropagation();
break;
case helper.keyCode.ARROW_LEFT:
if (selection) {
if (instance.rootElement.className.indexOf('htContextSubMenu_') != -1) {
contextMenu.closeLastOpenedSubMenu();
var index = contextMenu.menus.length;
if (index > 0) {
var menu = contextMenu.menus[index - 1];
var triggerRow = contextMenu.triggerRows.pop();
instance = this.htMenus[menu.id];
instance.selectCell(triggerRow, 0);
}
}
event.preventDefault();
event.stopImmediatePropagation();
}
break;
}
function selectFirstCell(instance) {
var firstCell = instance.getCell(0, 0);
if (ContextMenu.utils.isSeparator(firstCell) || ContextMenu.utils.isDisabled(firstCell)) {
selectNextCell(0, 0, instance);
} else {
instance.selectCell(0, 0);
}
}
function selectLastCell(instance) {
var lastRow = instance.countRows() - 1;
var lastCell = instance.getCell(lastRow, 0);
if (ContextMenu.utils.isSeparator(lastCell) || ContextMenu.utils.isDisabled(lastCell)) {
selectPrevCell(lastRow, 0, instance);
} else {
instance.selectCell(lastRow, 0);
}
}
function selectNextCell(row, col, instance) {
var nextRow = row + 1;
var nextCell = nextRow < instance.countRows() ? instance.getCell(nextRow, col) : null;
if (!nextCell) {
return;
}
if (ContextMenu.utils.isSeparator(nextCell) || ContextMenu.utils.isDisabled(nextCell)) {
selectNextCell(nextRow, col, instance);
} else {
instance.selectCell(nextRow, col);
}
}
function selectPrevCell(row, col, instance) {
var prevRow = row - 1;
var prevCell = prevRow >= 0 ? instance.getCell(prevRow, col) : null;
if (!prevCell) {
return;
}
if (ContextMenu.utils.isSeparator(prevCell) || ContextMenu.utils.isDisabled(prevCell)) {
selectPrevCell(prevRow, col, instance);
} else {
instance.selectCell(prevRow, col);
}
}
function openSubMenu(instance, contextMenu, cell, row) {
var selectedItem = instance.getData()[row];
var items = contextMenu.getItems(selectedItem.submenu);
var subMenu = contextMenu.createMenu(selectedItem.name, row);
var coords = cell.getBoundingClientRect();
var subMenuInstance = contextMenu.show(subMenu, items);
contextMenu.setSubMenuPosition(coords, subMenu);
subMenuInstance.selectCell(0, 0);
}
};
function findByKey(items, key) {
for (var i = 0,
ilen = items.length; i < ilen; i++) {
if (items[i].key === key) {
return items[i];
}
}
}
function findIndexByKey(items, key) {
for (var i = 0,
ilen = items.length; i < ilen; i++) {
if (items[i].key === key) {
return i;
}
}
}
ContextMenu.prototype.getItems = function(items) {
var menu,
item;
function ContextMenuItem(rawItem) {
if (typeof rawItem == 'string') {
this.name = rawItem;
} else {
helper.extend(this, rawItem);
}
}
ContextMenuItem.prototype = items;
if (items && items.items) {
items = items.items;
}
if (items === true) {
items = this.defaultOptions.items;
}
if (1 == 1) {
menu = [];
for (var key in items) {
if (items.hasOwnProperty(key)) {
if (typeof items[key] === 'string') {
item = findByKey(this.defaultOptions.items, items[key]);
} else {
item = findByKey(this.defaultOptions.items, key);
}
if (!item) {
item = items[key];
}
item = new ContextMenuItem(item);
if (typeof items[key] === 'object') {
helper.extend(item, items[key]);
}
if (!item.key) {
item.key = key;
}
menu.push(item);
}
}
}
return menu;
};
ContextMenu.prototype.setSubMenuPosition = function(coords, menu) {
var scrollTop = dom.getWindowScrollTop();
var scrollLeft = dom.getWindowScrollLeft();
var cursor = {
top: scrollTop + coords.top,
topRelative: coords.top,
left: coords.left,
leftRelative: coords.left - scrollLeft,
scrollTop: scrollTop,
scrollLeft: scrollLeft,
cellHeight: coords.height,
cellWidth: coords.width
};
if (this.menuFitsBelowCursor(cursor, menu, document.body.clientWidth)) {
this.positionMenuBelowCursor(cursor, menu, true);
} else {
if (this.menuFitsAboveCursor(cursor, menu)) {
this.positionMenuAboveCursor(cursor, menu, true);
} else {
this.positionMenuBelowCursor(cursor, menu, true);
}
}
if (this.menuFitsOnRightOfCursor(cursor, menu, document.body.clientWidth)) {
this.positionMenuOnRightOfCursor(cursor, menu, true);
} else {
this.positionMenuOnLeftOfCursor(cursor, menu, true);
}
};
ContextMenu.prototype.setMenuPosition = function(event, menu) {
var scrollTop = dom.getWindowScrollTop();
var scrollLeft = dom.getWindowScrollLeft();
var cursorY = event.pageY || (event.clientY + scrollTop);
var cursorX = event.pageX || (event.clientX + scrollLeft);
var cursor = {
top: cursorY,
topRelative: cursorY - scrollTop,
left: cursorX,
leftRelative: cursorX - scrollLeft,
scrollTop: scrollTop,
scrollLeft: scrollLeft,
cellHeight: event.target.clientHeight,
cellWidth: event.target.clientWidth
};
if (this.menuFitsBelowCursor(cursor, menu, document.body.clientHeight)) {
this.positionMenuBelowCursor(cursor, menu);
} else {
if (this.menuFitsAboveCursor(cursor, menu)) {
this.positionMenuAboveCursor(cursor, menu);
} else {
this.positionMenuBelowCursor(cursor, menu);
}
}
if (this.menuFitsOnRightOfCursor(cursor, menu, document.body.clientWidth)) {
this.positionMenuOnRightOfCursor(cursor, menu);
} else {
this.positionMenuOnLeftOfCursor(cursor, menu);
}
};
ContextMenu.prototype.menuFitsAboveCursor = function(cursor, menu) {
return cursor.topRelative >= menu.offsetHeight;
};
ContextMenu.prototype.menuFitsBelowCursor = function(cursor, menu, viewportHeight) {
return cursor.topRelative + menu.offsetHeight <= viewportHeight;
};
ContextMenu.prototype.menuFitsOnRightOfCursor = function(cursor, menu, viewportHeight) {
return cursor.leftRelative + menu.offsetWidth <= viewportHeight;
};
ContextMenu.prototype.positionMenuBelowCursor = function(cursor, menu) {
menu.style.top = cursor.top + 'px';
};
ContextMenu.prototype.positionMenuAboveCursor = function(cursor, menu, subMenu) {
if (subMenu) {
menu.style.top = (cursor.top + cursor.cellHeight - menu.offsetHeight) + 'px';
} else {
menu.style.top = (cursor.top - menu.offsetHeight) + 'px';
}
};
ContextMenu.prototype.positionMenuOnRightOfCursor = function(cursor, menu, subMenu) {
if (subMenu) {
menu.style.left = 1 + cursor.left + cursor.cellWidth + 'px';
} else {
menu.style.left = 1 + cursor.left + 'px';
}
};
ContextMenu.prototype.positionMenuOnLeftOfCursor = function(cursor, menu, subMenu) {
if (subMenu) {
menu.style.left = (cursor.left - menu.offsetWidth) + 'px';
} else {
menu.style.left = (cursor.left - menu.offsetWidth) + 'px';
}
};
ContextMenu.utils = {};
ContextMenu.utils.normalizeSelection = function(selRange) {
return {
start: selRange.getTopLeftCorner(),
end: selRange.getBottomRightCorner()
};
};
ContextMenu.utils.isSeparator = function(cell) {
return dom.hasClass(cell, 'htSeparator');
};
ContextMenu.utils.hasSubMenu = function(cell) {
return dom.hasClass(cell, 'htSubmenu');
};
ContextMenu.utils.isDisabled = function(cell) {
return dom.hasClass(cell, 'htDisabled');
};
ContextMenu.prototype.enable = function() {
if (!this.enabled) {
this.enabled = true;
this.bindMouseEvents();
}
};
ContextMenu.prototype.disable = function() {
if (this.enabled) {
this.enabled = false;
this.closeAll();
this.unbindMouseEvents();
this.unbindTableEvents();
}
};
ContextMenu.prototype.destroy = function() {
this.closeAll();
while (this.menus.length > 0) {
var menu = this.menus.pop();
this.triggerRows.pop();
if (menu) {
this.close(menu);
if (!this.isMenuEnabledByOtherHotInstance()) {
this.removeMenu(menu);
}
}
}
this.unbindMouseEvents();
this.unbindTableEvents();
};
ContextMenu.prototype.isMenuEnabledByOtherHotInstance = function() {
var hotContainers = document.querySelectorAll('.handsontable');
var menuEnabled = false;
for (var i = 0,
len = hotContainers.length; i < len; i++) {
var instance = this.htMenus[hotContainers[i].id];
if (instance && instance.getSettings().contextMenu) {
menuEnabled = true;
break;
}
}
return menuEnabled;
};
ContextMenu.prototype.removeMenu = function(menu) {
if (menu.parentNode) {
this.menu.parentNode.removeChild(menu);
}
};
ContextMenu.prototype.align = function(range, type, alignment) {
align.call(this, range, type, alignment);
};
ContextMenu.SEPARATOR = {name: "---------"};
function updateHeight() {
if (this.rootElement.className.indexOf('htContextMenu')) {
return;
}
var realSeparatorHeight = 0,
realEntrySize = 0,
dataSize = this.getSettings().data.length,
currentHiderWidth = parseInt(this.view.wt.wtTable.hider.style.width, 10);
for (var i = 0; i < dataSize; i++) {
if (this.getSettings().data[i].name == ContextMenu.SEPARATOR.name) {
realSeparatorHeight += 1;
} else {
realEntrySize += 26;
}
}
this.view.wt.wtTable.holder.style.width = currentHiderWidth + 22 + "px";
this.view.wt.wtTable.holder.style.height = realEntrySize + realSeparatorHeight + 4 + "px";
}
function prepareVerticalAlignClass(className, alignment) {
if (className.indexOf(alignment) != -1) {
return className;
}
className = className.replace('htTop', '').replace('htMiddle', '').replace('htBottom', '').replace(' ', '');
className += " " + alignment;
return className;
}
function prepareHorizontalAlignClass(className, alignment) {
if (className.indexOf(alignment) != -1) {
return className;
}
className = className.replace('htLeft', '').replace('htCenter', '').replace('htRight', '').replace('htJustify', '').replace(' ', '');
className += " " + alignment;
return className;
}
function getAlignmentClasses(range) {
var classesArray = {};
for (var row = range.from.row; row <= range.to.row; row++) {
for (var col = range.from.col; col <= range.to.col; col++) {
if (!classesArray[row]) {
classesArray[row] = [];
}
classesArray[row][col] = this.getCellMeta(row, col).className;
}
}
return classesArray;
}
function doAlign(row, col, type, alignment) {
var cellMeta = this.getCellMeta(row, col),
className = alignment;
if (cellMeta.className) {
if (type === 'vertical') {
className = prepareVerticalAlignClass(cellMeta.className, alignment);
} else {
className = prepareHorizontalAlignClass(cellMeta.className, alignment);
}
}
this.setCellMeta(row, col, 'className', className);
}
function align(range, type, alignment) {
var stateBefore = getAlignmentClasses.call(this, range);
this.runHooks('beforeCellAlignment', stateBefore, range, type, alignment);
if (range.from.row == range.to.row && range.from.col == range.to.col) {
doAlign.call(this, range.from.row, range.from.col, type, alignment);
} else {
for (var row = range.from.row; row <= range.to.row; row++) {
for (var col = range.from.col; col <= range.to.col; col++) {
doAlign.call(this, row, col, type, alignment);
}
}
}
this.render();
}
function init() {
var instance = this;
var contextMenuSetting = instance.getSettings().contextMenu;
var customOptions = helper.isObject(contextMenuSetting) ? contextMenuSetting : {};
if (contextMenuSetting) {
if (!instance.contextMenu) {
instance.contextMenu = new ContextMenu(instance, customOptions);
}
instance.contextMenu.enable();
} else if (instance.contextMenu) {
instance.contextMenu.destroy();
delete instance.contextMenu;
}
}
Handsontable.hooks.add('afterInit', init);
Handsontable.hooks.add('afterUpdateSettings', init);
Handsontable.hooks.add('afterInit', updateHeight);
Handsontable.hooks.register('afterContextMenuDefaultOptions');
Handsontable.hooks.register('afterContextMenuShow');
Handsontable.hooks.register('afterContextMenuHide');
Handsontable.ContextMenu = ContextMenu;
//#
},{"./../../dom.js":27,"./../../eventManager.js":41,"./../../helpers.js":42,"./../../plugins.js":45}],53:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
ContextMenuCopyPaste: {get: function() {
return ContextMenuCopyPaste;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47_eventManager_46_js__,
$___46__46__47__46__46__47_plugins_46_js__,
$___46__46__47__95_base_46_js__,
$__zeroclipboard__;
var dom = ($___46__46__47__46__46__47_dom_46_js__ = require("./../../dom.js"), $___46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47_dom_46_js__});
var eventManagerObject = ($___46__46__47__46__46__47_eventManager_46_js__ = require("./../../eventManager.js"), $___46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47_eventManager_46_js__}).eventManager;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
var BasePlugin = ($___46__46__47__95_base_46_js__ = require("./../_base.js"), $___46__46__47__95_base_46_js__ && $___46__46__47__95_base_46_js__.__esModule && $___46__46__47__95_base_46_js__ || {default: $___46__46__47__95_base_46_js__}).default;
var ZeroClipboard = ($__zeroclipboard__ = require("zeroclipboard"), $__zeroclipboard__ && $__zeroclipboard__.__esModule && $__zeroclipboard__ || {default: $__zeroclipboard__}).default;
var ContextMenuCopyPaste = function ContextMenuCopyPaste(hotInstance) {
var $__4 = this;
$traceurRuntime.superConstructor($ContextMenuCopyPaste).call(this, hotInstance);
this.swfPath = null;
this.hotContextMenu = null;
this.outsideClickDeselectsCache = null;
this.hot.addHook('afterContextMenuShow', (function(htContextMenu) {
return $__4.setupZeroClipboard(htContextMenu);
}));
this.hot.addHook('afterInit', (function() {
return $__4.afterInit();
}));
this.hot.addHook('afterContextMenuDefaultOptions', (function(options) {
return $__4.addToContextMenu(options);
}));
};
var $ContextMenuCopyPaste = ContextMenuCopyPaste;
($traceurRuntime.createClass)(ContextMenuCopyPaste, {
afterInit: function() {
if (!this.hot.getSettings().contextMenuCopyPaste) {
return;
} else if (typeof this.hot.getSettings().contextMenuCopyPaste == 'object') {
this.swfPath = this.hot.getSettings().contextMenuCopyPaste.swfPath;
}
if (typeof ZeroClipboard === 'undefined') {
throw new Error("To be able to use the Copy/Paste feature from the context menu, you need to manualy include ZeroClipboard.js file to your website.");
}
try {
new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
} catch (exception) {
if ('undefined' == typeof navigator.mimeTypes['application/x-shockwave-flash']) {
throw new Error("To be able to use the Copy/Paste feature from the context menu, your browser needs to have Flash Plugin installed.");
}
}
this.prepareZeroClipboard();
},
prepareZeroClipboard: function() {
if (this.swfPath) {
ZeroClipboard.config({swfPath: this.swfPath});
}
},
getCopyValue: function() {
this.hot.copyPaste.setCopyableText();
return this.hot.copyPaste.copyPasteInstance.elTextarea.value;
},
addToContextMenu: function(defaultOptions) {
if (!this.hot.getSettings().contextMenuCopyPaste) {
return;
}
defaultOptions.items.unshift({
key: 'copy',
name: 'Copy'
}, {
key: 'paste',
name: 'Paste',
callback: function() {
this.copyPaste.triggerPaste();
}
}, Handsontable.ContextMenu.SEPARATOR);
},
setupZeroClipboard: function(hotContextMenu) {
var $__4 = this;
var data,
zeroClipboardInstance;
if (!this.hot.getSettings().contextMenuCopyPaste) {
return;
}
this.hotContextMenu = hotContextMenu;
data = this.hotContextMenu.getData();
for (var i = 0,
ilen = data.length; i < ilen; i++) {
if (data[i].key === 'copy') {
zeroClipboardInstance = new ZeroClipboard(this.hotContextMenu.getCell(i, 0));
zeroClipboardInstance.off();
zeroClipboardInstance.on('copy', (function(event) {
var clipboard = event.clipboardData;
clipboard.setData('text/plain', $__4.getCopyValue());
$__4.hot.getSettings().outsideClickDeselects = $__4.outsideClickDeselectsCache;
}));
this.bindEvents();
break;
}
}
},
removeCurrentClass: function() {
if (this.hotContextMenu.rootElement) {
var element = this.hotContextMenu.rootElement.querySelector('td.current');
if (element) {
dom.removeClass(element, 'current');
}
}
this.outsideClickDeselectsCache = this.hot.getSettings().outsideClickDeselects;
this.hot.getSettings().outsideClickDeselects = false;
},
removeZeroClipboardClass: function() {
if (this.hotContextMenu.rootElement) {
var element = this.hotContextMenu.rootElement.querySelector('td.zeroclipboard-is-hover');
if (element) {
dom.removeClass(element, 'zeroclipboard-is-hover');
}
}
this.hot.getSettings().outsideClickDeselects = this.outsideClickDeselectsCache;
},
bindEvents: function() {
var $__4 = this;
var eventManager = eventManagerObject(this.hotContextMenu);
eventManager.addEventListener(document, 'mouseenter', (function() {
return $__4.removeCurrentClass();
}));
eventManager.addEventListener(document, 'mouseleave', (function() {
return $__4.removeZeroClipboardClass();
}));
}
}, {}, BasePlugin);
;
registerPlugin('contextMenuCopyPaste', ContextMenuCopyPaste);
//#
},{"./../../dom.js":27,"./../../eventManager.js":41,"./../../plugins.js":45,"./../_base.js":46,"zeroclipboard":"zeroclipboard"}],54:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
CopyPaste: {get: function() {
return CopyPaste;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_helpers_46_js__,
$__copyPaste__,
$__SheetClip__,
$___46__46__47__46__46__47_plugins_46_js__,
$___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__,
$___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__;
var helper = ($___46__46__47__46__46__47_helpers_46_js__ = require("./../../helpers.js"), $___46__46__47__46__46__47_helpers_46_js__ && $___46__46__47__46__46__47_helpers_46_js__.__esModule && $___46__46__47__46__46__47_helpers_46_js__ || {default: $___46__46__47__46__46__47_helpers_46_js__});
var copyPaste = ($__copyPaste__ = require("copyPaste"), $__copyPaste__ && $__copyPaste__.__esModule && $__copyPaste__ || {default: $__copyPaste__}).default;
var SheetClip = ($__SheetClip__ = require("SheetClip"), $__SheetClip__ && $__SheetClip__.__esModule && $__SheetClip__ || {default: $__SheetClip__}).default;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
var WalkontableCellCoords = ($___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ = require("./../../3rdparty/walkontable/src/cell/coords.js"), $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__.__esModule && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ || {default: $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__}).WalkontableCellCoords;
var WalkontableCellRange = ($___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__ = require("./../../3rdparty/walkontable/src/cell/range.js"), $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__ && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__.__esModule && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__ || {default: $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__}).WalkontableCellRange;
;
function CopyPastePlugin(instance) {
var _this = this;
this.copyPasteInstance = copyPaste();
this.copyPasteInstance.onCut(onCut);
this.copyPasteInstance.onPaste(onPaste);
instance.addHook('beforeKeyDown', onBeforeKeyDown);
function onCut() {
if (!instance.isListening()) {
return;
}
instance.selection.empty();
}
function onPaste(str) {
var input,
inputArray,
selected,
coordsFrom,
coordsTo,
cellRange,
topLeftCorner,
bottomRightCorner,
areaStart,
areaEnd;
if (!instance.isListening() || !instance.selection.isSelected()) {
return;
}
input = str;
inputArray = SheetClip.parse(input);
selected = instance.getSelected();
coordsFrom = new WalkontableCellCoords(selected[0], selected[1]);
coordsTo = new WalkontableCellCoords(selected[2], selected[3]);
cellRange = new WalkontableCellRange(coordsFrom, coordsFrom, coordsTo);
topLeftCorner = cellRange.getTopLeftCorner();
bottomRightCorner = cellRange.getBottomRightCorner();
areaStart = topLeftCorner;
areaEnd = new WalkontableCellCoords(Math.max(bottomRightCorner.row, inputArray.length - 1 + topLeftCorner.row), Math.max(bottomRightCorner.col, inputArray[0].length - 1 + topLeftCorner.col));
instance.addHookOnce('afterChange', function(changes, source) {
if (changes && changes.length) {
this.selectCell(areaStart.row, areaStart.col, areaEnd.row, areaEnd.col);
}
});
instance.populateFromArray(areaStart.row, areaStart.col, inputArray, areaEnd.row, areaEnd.col, 'paste', instance.getSettings().pasteMode);
}
function onBeforeKeyDown(event) {
var ctrlDown;
if (instance.getSelected() && instance.getActiveEditor() && !instance.getActiveEditor().isOpened()) {
if (helper.isCtrlKey(event.keyCode)) {
_this.setCopyableText();
event.stopImmediatePropagation();
return;
}
ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey;
if (event.keyCode == helper.keyCode.A && ctrlDown) {
instance._registerTimeout(setTimeout(helper.proxy(_this.setCopyableText, _this), 0));
}
}
}
this.destroy = function() {
this.copyPasteInstance.removeCallback(onCut);
this.copyPasteInstance.removeCallback(onPaste);
this.copyPasteInstance.destroy();
instance.removeHook('beforeKeyDown', onBeforeKeyDown);
};
instance.addHook('afterDestroy', helper.proxy(this.destroy, this));
this.triggerPaste = helper.proxy(this.copyPasteInstance.triggerPaste, this.copyPasteInstance);
this.triggerCut = helper.proxy(this.copyPasteInstance.triggerCut, this.copyPasteInstance);
this.setCopyableText = function() {
var settings = instance.getSettings();
var copyRowsLimit = settings.copyRowsLimit;
var copyColsLimit = settings.copyColsLimit;
var selRange = instance.getSelectedRange();
var topLeft = selRange.getTopLeftCorner();
var bottomRight = selRange.getBottomRightCorner();
var startRow = topLeft.row;
var startCol = topLeft.col;
var endRow = bottomRight.row;
var endCol = bottomRight.col;
var finalEndRow = Math.min(endRow, startRow + copyRowsLimit - 1);
var finalEndCol = Math.min(endCol, startCol + copyColsLimit - 1);
instance.copyPaste.copyPasteInstance.copyable(instance.getCopyableData(startRow, startCol, finalEndRow, finalEndCol));
if (endRow !== finalEndRow || endCol !== finalEndCol) {
Handsontable.hooks.run(instance, "afterCopyLimit", endRow - startRow + 1, endCol - startCol + 1, copyRowsLimit, copyColsLimit);
}
};
}
function init() {
var instance = this,
pluginEnabled = instance.getSettings().copyPaste !== false;
if (pluginEnabled && !instance.copyPaste) {
instance.copyPaste = new CopyPastePlugin(instance);
} else if (!pluginEnabled && instance.copyPaste) {
instance.copyPaste.destroy();
delete instance.copyPaste;
}
}
Handsontable.hooks.add('afterInit', init);
Handsontable.hooks.add('afterUpdateSettings', init);
Handsontable.hooks.register('afterCopyLimit');
//#
},{"./../../3rdparty/walkontable/src/cell/coords.js":5,"./../../3rdparty/walkontable/src/cell/range.js":6,"./../../helpers.js":42,"./../../plugins.js":45,"SheetClip":"SheetClip","copyPaste":"copyPaste"}],55:[function(require,module,exports){
"use strict";
var $___46__46__47__46__46__47_plugins_46_js__,
$___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__,
$___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_selection_46_js__;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
var WalkontableCellRange = ($___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__ = require("./../../3rdparty/walkontable/src/cell/range.js"), $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__ && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__.__esModule && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__ || {default: $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__}).WalkontableCellRange;
var WalkontableSelection = ($___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_selection_46_js__ = require("./../../3rdparty/walkontable/src/selection.js"), $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_selection_46_js__ && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_selection_46_js__.__esModule && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_selection_46_js__ || {default: $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_selection_46_js__}).WalkontableSelection;
function CustomBorders() {}
var instance;
var checkEnable = function(customBorders) {
if (typeof customBorders === "boolean") {
if (customBorders === true) {
return true;
}
}
if (typeof customBorders === "object") {
if (customBorders.length > 0) {
return true;
}
}
return false;
};
var init = function() {
if (checkEnable(this.getSettings().customBorders)) {
if (!this.customBorders) {
instance = this;
this.customBorders = new CustomBorders();
}
}
};
var getSettingIndex = function(className) {
for (var i = 0; i < instance.view.wt.selections.length; i++) {
if (instance.view.wt.selections[i].settings.className == className) {
return i;
}
}
return -1;
};
var insertBorderIntoSettings = function(border) {
var coordinates = {
row: border.row,
col: border.col
};
var selection = new WalkontableSelection(border, new WalkontableCellRange(coordinates, coordinates, coordinates));
var index = getSettingIndex(border.className);
if (index >= 0) {
instance.view.wt.selections[index] = selection;
} else {
instance.view.wt.selections.push(selection);
}
};
var prepareBorderFromCustomAdded = function(row, col, borderObj) {
var border = createEmptyBorders(row, col);
border = extendDefaultBorder(border, borderObj);
this.setCellMeta(row, col, 'borders', border);
insertBorderIntoSettings(border);
};
var prepareBorderFromCustomAddedRange = function(rowObj) {
var range = rowObj.range;
for (var row = range.from.row; row <= range.to.row; row++) {
for (var col = range.from.col; col <= range.to.col; col++) {
var border = createEmptyBorders(row, col);
var add = 0;
if (row == range.from.row) {
add++;
if (rowObj.hasOwnProperty('top')) {
border.top = rowObj.top;
}
}
if (row == range.to.row) {
add++;
if (rowObj.hasOwnProperty('bottom')) {
border.bottom = rowObj.bottom;
}
}
if (col == range.from.col) {
add++;
if (rowObj.hasOwnProperty('left')) {
border.left = rowObj.left;
}
}
if (col == range.to.col) {
add++;
if (rowObj.hasOwnProperty('right')) {
border.right = rowObj.right;
}
}
if (add > 0) {
this.setCellMeta(row, col, 'borders', border);
insertBorderIntoSettings(border);
}
}
}
};
var createClassName = function(row, col) {
return "border_row" + row + "col" + col;
};
var createDefaultCustomBorder = function() {
return {
width: 1,
color: '#000'
};
};
var createSingleEmptyBorder = function() {
return {hide: true};
};
var createDefaultHtBorder = function() {
return {
width: 1,
color: '#000',
cornerVisible: false
};
};
var createEmptyBorders = function(row, col) {
return {
className: createClassName(row, col),
border: createDefaultHtBorder(),
row: row,
col: col,
top: createSingleEmptyBorder(),
right: createSingleEmptyBorder(),
bottom: createSingleEmptyBorder(),
left: createSingleEmptyBorder()
};
};
var extendDefaultBorder = function(defaultBorder, customBorder) {
if (customBorder.hasOwnProperty('border')) {
defaultBorder.border = customBorder.border;
}
if (customBorder.hasOwnProperty('top')) {
defaultBorder.top = customBorder.top;
}
if (customBorder.hasOwnProperty('right')) {
defaultBorder.right = customBorder.right;
}
if (customBorder.hasOwnProperty('bottom')) {
defaultBorder.bottom = customBorder.bottom;
}
if (customBorder.hasOwnProperty('left')) {
defaultBorder.left = customBorder.left;
}
return defaultBorder;
};
var removeBordersFromDom = function(borderClassName) {
var borders = document.querySelectorAll("." + borderClassName);
for (var i = 0; i < borders.length; i++) {
if (borders[i]) {
if (borders[i].nodeName != 'TD') {
var parent = borders[i].parentNode;
if (parent.parentNode) {
parent.parentNode.removeChild(parent);
}
}
}
}
};
var removeAllBorders = function(row, col) {
var borderClassName = createClassName(row, col);
removeBordersFromDom(borderClassName);
this.removeCellMeta(row, col, 'borders');
};
var setBorder = function(row, col, place, remove) {
var bordersMeta = this.getCellMeta(row, col).borders;
if (!bordersMeta || bordersMeta.border == undefined) {
bordersMeta = createEmptyBorders(row, col);
}
if (remove) {
bordersMeta[place] = createSingleEmptyBorder();
} else {
bordersMeta[place] = createDefaultCustomBorder();
}
this.setCellMeta(row, col, 'borders', bordersMeta);
var borderClassName = createClassName(row, col);
removeBordersFromDom(borderClassName);
insertBorderIntoSettings(bordersMeta);
this.render();
};
var prepareBorder = function(range, place, remove) {
if (range.from.row == range.to.row && range.from.col == range.to.col) {
if (place == "noBorders") {
removeAllBorders.call(this, range.from.row, range.from.col);
} else {
setBorder.call(this, range.from.row, range.from.col, place, remove);
}
} else {
switch (place) {
case "noBorders":
for (var column = range.from.col; column <= range.to.col; column++) {
for (var row = range.from.row; row <= range.to.row; row++) {
removeAllBorders.call(this, row, column);
}
}
break;
case "top":
for (var topCol = range.from.col; topCol <= range.to.col; topCol++) {
setBorder.call(this, range.from.row, topCol, place, remove);
}
break;
case "right":
for (var rowRight = range.from.row; rowRight <= range.to.row; rowRight++) {
setBorder.call(this, rowRight, range.to.col, place);
}
break;
case "bottom":
for (var bottomCol = range.from.col; bottomCol <= range.to.col; bottomCol++) {
setBorder.call(this, range.to.row, bottomCol, place);
}
break;
case "left":
for (var rowLeft = range.from.row; rowLeft <= range.to.row; rowLeft++) {
setBorder.call(this, rowLeft, range.from.col, place);
}
break;
}
}
};
var checkSelectionBorders = function(hot, direction) {
var atLeastOneHasBorder = false;
hot.getSelectedRange().forAll(function(r, c) {
var metaBorders = hot.getCellMeta(r, c).borders;
if (metaBorders) {
if (direction) {
if (!metaBorders[direction].hasOwnProperty('hide')) {
atLeastOneHasBorder = true;
return false;
}
} else {
atLeastOneHasBorder = true;
return false;
}
}
});
return atLeastOneHasBorder;
};
var markSelected = function(label) {
return "<span class='selected'>" + String.fromCharCode(10003) + "</span>" + label;
};
var addBordersOptionsToContextMenu = function(defaultOptions) {
if (!this.getSettings().customBorders) {
return;
}
defaultOptions.items.push(Handsontable.ContextMenu.SEPARATOR);
defaultOptions.items.push({
key: 'borders',
name: 'Borders',
submenu: {items: {
top: {
name: function() {
var label = "Top";
var hasBorder = checkSelectionBorders(this, 'top');
if (hasBorder) {
label = markSelected(label);
}
return label;
},
callback: function() {
var hasBorder = checkSelectionBorders(this, 'top');
prepareBorder.call(this, this.getSelectedRange(), 'top', hasBorder);
},
disabled: false
},
right: {
name: function() {
var label = 'Right';
var hasBorder = checkSelectionBorders(this, 'right');
if (hasBorder) {
label = markSelected(label);
}
return label;
},
callback: function() {
var hasBorder = checkSelectionBorders(this, 'right');
prepareBorder.call(this, this.getSelectedRange(), 'right', hasBorder);
},
disabled: false
},
bottom: {
name: function() {
var label = 'Bottom';
var hasBorder = checkSelectionBorders(this, 'bottom');
if (hasBorder) {
label = markSelected(label);
}
return label;
},
callback: function() {
var hasBorder = checkSelectionBorders(this, 'bottom');
prepareBorder.call(this, this.getSelectedRange(), 'bottom', hasBorder);
},
disabled: false
},
left: {
name: function() {
var label = 'Left';
var hasBorder = checkSelectionBorders(this, 'left');
if (hasBorder) {
label = markSelected(label);
}
return label;
},
callback: function() {
var hasBorder = checkSelectionBorders(this, 'left');
prepareBorder.call(this, this.getSelectedRange(), 'left', hasBorder);
},
disabled: false
},
remove: {
name: 'Remove border(s)',
callback: function() {
prepareBorder.call(this, this.getSelectedRange(), 'noBorders');
},
disabled: function() {
return !checkSelectionBorders(this);
}
}
}}
});
};
Handsontable.hooks.add('beforeInit', init);
Handsontable.hooks.add('afterContextMenuDefaultOptions', addBordersOptionsToContextMenu);
Handsontable.hooks.add('afterInit', function() {
var customBorders = this.getSettings().customBorders;
if (customBorders) {
for (var i = 0; i < customBorders.length; i++) {
if (customBorders[i].range) {
prepareBorderFromCustomAddedRange.call(this, customBorders[i]);
} else {
prepareBorderFromCustomAdded.call(this, customBorders[i].row, customBorders[i].col, customBorders[i]);
}
}
this.render();
this.view.wt.draw(true);
}
});
Handsontable.CustomBorders = CustomBorders;
//#
},{"./../../3rdparty/walkontable/src/cell/range.js":6,"./../../3rdparty/walkontable/src/selection.js":18,"./../../plugins.js":45}],56:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
DragToScroll: {get: function() {
return DragToScroll;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_eventManager_46_js__,
$___46__46__47__46__46__47_plugins_46_js__;
var eventManagerObject = ($___46__46__47__46__46__47_eventManager_46_js__ = require("./../../eventManager.js"), $___46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47_eventManager_46_js__}).eventManager;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
;
Handsontable.plugins.DragToScroll = DragToScroll;
function DragToScroll() {
this.boundaries = null;
this.callback = null;
}
DragToScroll.prototype.setBoundaries = function(boundaries) {
this.boundaries = boundaries;
};
DragToScroll.prototype.setCallback = function(callback) {
this.callback = callback;
};
DragToScroll.prototype.check = function(x, y) {
var diffX = 0;
var diffY = 0;
if (y < this.boundaries.top) {
diffY = y - this.boundaries.top;
} else if (y > this.boundaries.bottom) {
diffY = y - this.boundaries.bottom;
}
if (x < this.boundaries.left) {
diffX = x - this.boundaries.left;
} else if (x > this.boundaries.right) {
diffX = x - this.boundaries.right;
}
this.callback(diffX, diffY);
};
var dragToScroll;
var instance;
if (typeof Handsontable !== 'undefined') {
var setupListening = function(instance) {
instance.dragToScrollListening = false;
var scrollHandler = instance.view.wt.wtTable.holder;
dragToScroll = new DragToScroll();
if (scrollHandler === window) {
return;
} else {
dragToScroll.setBoundaries(scrollHandler.getBoundingClientRect());
}
dragToScroll.setCallback(function(scrollX, scrollY) {
if (scrollX < 0) {
scrollHandler.scrollLeft -= 50;
} else if (scrollX > 0) {
scrollHandler.scrollLeft += 50;
}
if (scrollY < 0) {
scrollHandler.scrollTop -= 20;
} else if (scrollY > 0) {
scrollHandler.scrollTop += 20;
}
});
instance.dragToScrollListening = true;
};
}
Handsontable.hooks.add('afterInit', function() {
var instance = this;
var eventManager = eventManagerObject(this);
eventManager.addEventListener(document, 'mouseup', function() {
instance.dragToScrollListening = false;
});
eventManager.addEventListener(document, 'mousemove', function(event) {
if (instance.dragToScrollListening) {
dragToScroll.check(event.clientX, event.clientY);
}
});
});
Handsontable.hooks.add('afterDestroy', function() {
eventManagerObject(this).clear();
});
Handsontable.hooks.add('afterOnCellMouseDown', function() {
setupListening(this);
});
Handsontable.hooks.add('afterOnCellCornerMouseDown', function() {
setupListening(this);
});
Handsontable.plugins.DragToScroll = DragToScroll;
//#
},{"./../../eventManager.js":41,"./../../plugins.js":45}],57:[function(require,module,exports){
"use strict";
var $___46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47_plugins_46_js__;
var dom = ($___46__46__47__46__46__47_dom_46_js__ = require("./../../dom.js"), $___46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47_dom_46_js__});
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
function Grouping(instance) {
var groups = [];
var item = {
id: '',
level: 0,
hidden: 0,
rows: [],
cols: []
};
var counters = {
rows: 0,
cols: 0
};
var levels = {
rows: 0,
cols: 0
};
var hiddenRows = [];
var hiddenCols = [];
var classes = {
'groupIndicatorContainer': 'htGroupIndicatorContainer',
'groupIndicator': function(direction) {
return 'ht' + direction + 'Group';
},
'groupStart': 'htGroupStart',
'collapseButton': 'htCollapseButton',
'expandButton': 'htExpandButton',
'collapseGroupId': function(id) {
return 'htCollapse-' + id;
},
'collapseFromLevel': function(direction, level) {
return 'htCollapse' + direction + 'FromLevel-' + level;
},
'clickable': 'clickable',
'levelTrigger': 'htGroupLevelTrigger'
};
var compare = function(property, orderDirection) {
return function(item1, item2) {
return typeof(orderDirection) === 'undefined' || orderDirection === 'asc' ? item1[property] - item2[property] : item2[property] - item1[property];
};
};
var range = function(from, to) {
var arr = [];
while (from <= to) {
arr.push(from++);
}
return arr;
};
var getRangeGroups = function(dataType, from, to) {
var cells = [],
cell = {
row: null,
col: null
};
if (dataType == "cols") {
while (from <= to) {
cell = {
row: -1,
col: from++
};
cells.push(cell);
}
} else {
while (from <= to) {
cell = {
row: from++,
col: -1
};
cells.push(cell);
}
}
var cellsGroups = getCellsGroups(cells),
totalRows = 0,
totalCols = 0;
for (var i = 0; i < cellsGroups.length; i++) {
totalRows += cellsGroups[i].filter(function(item) {
return item['rows'];
}).length;
totalCols += cellsGroups[i].filter(function(item) {
return item['cols'];
}).length;
}
return {
total: {
rows: totalRows,
cols: totalCols
},
groups: cellsGroups
};
};
var getCellsGroups = function(cells) {
var _groups = [];
for (var i = 0; i < cells.length; i++) {
_groups.push(getCellGroups(cells[i]));
}
return _groups;
};
var getCellGroups = function(coords, groupLevel, groupType) {
var row = coords.row,
col = coords.col;
var tmpRow = (row === -1 ? 0 : row),
tmpCol = (col === -1 ? 0 : col);
var _groups = [];
for (var i = 0; i < groups.length; i++) {
var group = groups[i],
id = group['id'],
level = group['level'],
rows = group['rows'] || [],
cols = group['cols'] || [];
if (_groups.indexOf(id) === -1) {
if (rows.indexOf(tmpRow) !== -1 || cols.indexOf(tmpCol) !== -1) {
_groups.push(group);
}
}
}
if (col === -1) {
_groups = _groups.concat(getColGroups());
} else if (row === -1) {
_groups = _groups.concat(getRowGroups());
}
if (groupLevel) {
_groups = _groups.filter(function(item) {
return item['level'] === groupLevel;
});
}
if (groupType) {
if (groupType === 'cols') {
_groups = _groups.filter(function(item) {
return item['cols'];
});
} else if (groupType === 'rows') {
_groups = _groups.filter(function(item) {
return item['rows'];
});
}
}
var tmp = [];
return _groups.filter(function(item) {
if (tmp.indexOf(item.id) === -1) {
tmp.push(item.id);
return item;
}
});
};
var getGroupById = function(id) {
for (var i = 0,
groupsLength = groups.length; i < groupsLength; i++) {
if (groups[i].id == id) {
return groups[i];
}
}
return false;
};
var getGroupByRowAndLevel = function(row, level) {
for (var i = 0,
groupsLength = groups.length; i < groupsLength; i++) {
if (groups[i].level == level && groups[i].rows && groups[i].rows.indexOf(row) > -1) {
return groups[i];
}
}
return false;
};
var getGroupByColAndLevel = function(col, level) {
for (var i = 0,
groupsLength = groups.length; i < groupsLength; i++) {
if (groups[i].level == level && groups[i].cols && groups[i].cols.indexOf(col) > -1) {
return groups[i];
}
}
return false;
};
var getColGroups = function() {
var result = [];
for (var i = 0,
groupsLength = groups.length; i < groupsLength; i++) {
if (Array.isArray(groups[i]['cols'])) {
result.push(groups[i]);
}
}
return result;
};
var getColGroupsByLevel = function(level) {
var result = [];
for (var i = 0,
groupsLength = groups.length; i < groupsLength; i++) {
if (groups[i]['cols'] && groups[i]['level'] === level) {
result.push(groups[i]);
}
}
return result;
};
var getRowGroups = function() {
var result = [];
for (var i = 0,
groupsLength = groups.length; i < groupsLength; i++) {
if (Array.isArray(groups[i]['rows'])) {
result.push(groups[i]);
}
}
return result;
};
var getRowGroupsByLevel = function(level) {
var result = [];
for (var i = 0,
groupsLength = groups.length; i < groupsLength; i++) {
if (groups[i]['rows'] && groups[i]['level'] === level) {
result.push(groups[i]);
}
}
return result;
};
var getLastLevelColsInRange = function(rangeGroups) {
var level = 0;
if (rangeGroups.length) {
rangeGroups.forEach(function(items) {
items = items.filter(function(item) {
return item['cols'];
});
if (items.length) {
var sortedGroup = items.sort(compare('level', 'desc')),
lastLevel = sortedGroup[0].level;
if (level < lastLevel) {
level = lastLevel;
}
}
});
}
return level;
};
var getLastLevelRowsInRange = function(rangeGroups) {
var level = 0;
if (rangeGroups.length) {
rangeGroups.forEach(function(items) {
items = items.filter(function(item) {
return item['rows'];
});
if (items.length) {
var sortedGroup = items.sort(compare('level', 'desc')),
lastLevel = sortedGroup[0].level;
if (level < lastLevel) {
level = lastLevel;
}
}
});
}
return level;
};
var groupCols = function(from, to) {
var rangeGroups = getRangeGroups("cols", from, to),
lastLevel = getLastLevelColsInRange(rangeGroups.groups);
if (lastLevel === levels.cols) {
levels.cols++;
} else if (lastLevel > levels.cols) {
levels.cols = lastLevel + 1;
}
if (!counters.cols) {
counters.cols = getColGroups().length;
}
counters.cols++;
groups.push({
id: 'c' + counters.cols,
level: lastLevel + 1,
cols: range(from, to),
hidden: 0
});
};
var groupRows = function(from, to) {
var rangeGroups = getRangeGroups("rows", from, to),
lastLevel = getLastLevelRowsInRange(rangeGroups.groups);
levels.rows = Math.max(levels.rows, lastLevel + 1);
if (!counters.rows) {
counters.rows = getRowGroups().length;
}
counters.rows++;
groups.push({
id: 'r' + counters.rows,
level: lastLevel + 1,
rows: range(from, to),
hidden: 0
});
};
var showHideGroups = function(hidden, groups) {
var level;
for (var i = 0,
groupsLength = groups.length; i < groupsLength; i++) {
groups[i].hidden = hidden;
level = groups[i].level;
if (!hiddenRows[level]) {
hiddenRows[level] = [];
}
if (!hiddenCols[level]) {
hiddenCols[level] = [];
}
if (groups[i].rows) {
for (var j = 0,
rowsLength = groups[i].rows.length; j < rowsLength; j++) {
if (hidden > 0) {
hiddenRows[level][groups[i].rows[j]] = true;
} else {
hiddenRows[level][groups[i].rows[j]] = void 0;
}
}
} else if (groups[i].cols) {
for (var j = 0,
colsLength = groups[i].cols.length; j < colsLength; j++) {
if (hidden > 0) {
hiddenCols[level][groups[i].cols[j]] = true;
} else {
hiddenCols[level][groups[i].cols[j]] = void 0;
}
}
}
}
};
var nextIndexSharesLevel = function(dimension, currentPosition, level, currentGroupId) {
var nextCellGroupId,
levelsByOrder;
switch (dimension) {
case 'rows':
nextCellGroupId = getGroupByRowAndLevel(currentPosition + 1, level).id;
levelsByOrder = Handsontable.Grouping.getGroupLevelsByRows();
break;
case 'cols':
nextCellGroupId = getGroupByColAndLevel(currentPosition + 1, level).id;
levelsByOrder = Handsontable.Grouping.getGroupLevelsByCols();
break;
}
return !!(levelsByOrder[currentPosition + 1] && levelsByOrder[currentPosition + 1].indexOf(level) > -1 && currentGroupId == nextCellGroupId);
};
var previousIndexSharesLevel = function(dimension, currentPosition, level, currentGroupId) {
var previousCellGroupId,
levelsByOrder;
switch (dimension) {
case 'rows':
previousCellGroupId = getGroupByRowAndLevel(currentPosition - 1, level).id;
levelsByOrder = Handsontable.Grouping.getGroupLevelsByRows();
break;
case 'cols':
previousCellGroupId = getGroupByColAndLevel(currentPosition - 1, level).id;
levelsByOrder = Handsontable.Grouping.getGroupLevelsByCols();
break;
}
return !!(levelsByOrder[currentPosition - 1] && levelsByOrder[currentPosition - 1].indexOf(level) > -1 && currentGroupId == previousCellGroupId);
};
var isLastIndexOfTheLine = function(dimension, index, level, currentGroupId) {
if (index === 0) {
return false;
}
var levelsByOrder,
entriesLength,
previousSharesLevel = previousIndexSharesLevel(dimension, index, level, currentGroupId),
nextSharesLevel = nextIndexSharesLevel(dimension, index, level, currentGroupId),
nextIsHidden = false;
switch (dimension) {
case 'rows':
levelsByOrder = Handsontable.Grouping.getGroupLevelsByRows();
entriesLength = instance.countRows();
for (var i = 0; i <= levels.rows; i++) {
if (hiddenRows[i] && hiddenRows[i][index + 1]) {
nextIsHidden = true;
break;
}
}
break;
case 'cols':
levelsByOrder = Handsontable.Grouping.getGroupLevelsByCols();
entriesLength = instance.countCols();
for (var i = 0; i <= levels.cols; i++) {
if (hiddenCols[i] && hiddenCols[i][index + 1]) {
nextIsHidden = true;
break;
}
}
break;
}
if (previousSharesLevel) {
if (index == entriesLength - 1) {
return true;
} else if (!nextSharesLevel || (nextSharesLevel && nextIsHidden)) {
return true;
} else if (!levelsByOrder[index + 1]) {
return true;
}
}
return false;
};
var isLastHidden = function(dataType) {
var levelAmount;
switch (dataType) {
case 'rows':
levelAmount = levels.rows;
for (var j = 0; j <= levelAmount; j++) {
if (hiddenRows[j] && hiddenRows[j][instance.countRows() - 1]) {
return true;
}
}
break;
case 'cols':
levelAmount = levels.cols;
for (var j = 0; j <= levelAmount; j++) {
if (hiddenCols[j] && hiddenCols[j][instance.countCols() - 1]) {
return true;
}
}
break;
}
return false;
};
var isFirstIndexOfTheLine = function(dimension, index, level, currentGroupId) {
var levelsByOrder,
entriesLength,
currentGroup = getGroupById(currentGroupId),
previousAreHidden = false,
arePreviousHidden = function(dimension) {
var hidden = false,
hiddenArr = dimension == 'rows' ? hiddenRows : hiddenCols;
for (var i = 0; i <= levels[dimension]; i++) {
tempInd = index;
while (currentGroup[dimension].indexOf(tempInd) > -1) {
hidden = !!(hiddenArr[i] && hiddenArr[i][tempInd]);
tempInd--;
}
if (hidden) {
break;
}
}
return hidden;
},
previousSharesLevel = previousIndexSharesLevel(dimension, index, level, currentGroupId),
nextSharesLevel = nextIndexSharesLevel(dimension, index, level, currentGroupId),
tempInd;
switch (dimension) {
case 'rows':
levelsByOrder = Handsontable.Grouping.getGroupLevelsByRows();
entriesLength = instance.countRows();
previousAreHidden = arePreviousHidden(dimension);
break;
case 'cols':
levelsByOrder = Handsontable.Grouping.getGroupLevelsByCols();
entriesLength = instance.countCols();
previousAreHidden = arePreviousHidden(dimension);
break;
}
if (index == entriesLength - 1) {
return false;
} else if (index === 0) {
if (nextSharesLevel) {
return true;
}
} else if (!previousSharesLevel || (previousSharesLevel && previousAreHidden)) {
if (nextSharesLevel) {
return true;
}
} else if (!levelsByOrder[index - 1]) {
if (nextSharesLevel) {
return true;
}
}
return false;
};
var addGroupExpander = function(dataType, index, level, id, elem) {
var previousIndexGroupId;
switch (dataType) {
case 'rows':
previousIndexGroupId = getGroupByRowAndLevel(index - 1, level).id;
break;
case 'cols':
previousIndexGroupId = getGroupByColAndLevel(index - 1, level).id;
break;
}
if (!previousIndexGroupId) {
return null;
}
if (index > 0) {
if (previousIndexSharesLevel(dataType, index - 1, level, previousIndexGroupId) && previousIndexGroupId != id) {
var expanderButton = document.createElement('DIV');
dom.addClass(expanderButton, classes.expandButton);
expanderButton.id = 'htExpand-' + previousIndexGroupId;
expanderButton.appendChild(document.createTextNode('+'));
expanderButton.setAttribute('data-level', level);
expanderButton.setAttribute('data-type', dataType);
expanderButton.setAttribute('data-hidden', "1");
elem.appendChild(expanderButton);
return expanderButton;
}
}
return null;
};
var isCollapsed = function(currentPosition) {
var rowGroups = getRowGroups(),
colGroups = getColGroups();
for (var i = 0,
rowGroupsCount = rowGroups.length; i < rowGroupsCount; i++) {
if (rowGroups[i].rows.indexOf(currentPosition.row) > -1 && rowGroups[i].hidden) {
return true;
}
}
if (currentPosition.col === null) {
return false;
}
for (var i = 0,
colGroupsCount = colGroups.length; i < colGroupsCount; i++) {
if (colGroups[i].cols.indexOf(currentPosition.col) > -1 && colGroups[i].hidden) {
return true;
}
}
return false;
};
return {
getGroups: function() {
return groups;
},
getLevels: function() {
return levels;
},
instance: instance,
baseSpareRows: instance.getSettings().minSpareRows,
baseSpareCols: instance.getSettings().minSpareCols,
getRowGroups: getRowGroups,
getColGroups: getColGroups,
init: function() {
var groupsSetting = instance.getSettings().groups;
if (groupsSetting) {
if (Array.isArray(groupsSetting)) {
Handsontable.Grouping.initGroups(groupsSetting);
}
}
},
initGroups: function(initialGroups) {
var that = this;
groups = [];
initialGroups.forEach(function(item) {
var _group = [],
isRow = false,
isCol = false;
if (Array.isArray(item.rows)) {
_group = item.rows;
isRow = true;
} else if (Array.isArray(item.cols)) {
_group = item.cols;
isCol = true;
}
var from = _group[0],
to = _group[_group.length - 1];
if (isRow) {
groupRows(from, to);
} else if (isCol) {
groupCols(from, to);
}
});
},
resetGroups: function() {
groups = [];
counters = {
rows: 0,
cols: 0
};
levels = {
rows: 0,
cols: 0
};
var allOccurrences;
for (var i in classes) {
if (typeof classes[i] != 'function') {
allOccurrences = document.querySelectorAll('.' + classes[i]);
for (var j = 0,
occurrencesLength = allOccurrences.length; j < occurrencesLength; j++) {
dom.removeClass(allOccurrences[j], classes[i]);
}
}
}
var otherClasses = ['htGroupColClosest', 'htGroupCol'];
for (var i = 0,
otherClassesLength = otherClasses.length; i < otherClassesLength; i++) {
allOccurrences = document.querySelectorAll('.' + otherClasses[i]);
for (var j = 0,
occurrencesLength = allOccurrences.length; j < occurrencesLength; j++) {
dom.removeClass(allOccurrences[j], otherClasses[i]);
}
}
},
updateGroups: function() {
var groupSettings = this.getSettings().groups;
Handsontable.Grouping.resetGroups();
Handsontable.Grouping.initGroups(groupSettings);
},
afterGetRowHeader: function(row, TH) {
var currentRowHidden = false;
for (var i = 0,
levels = hiddenRows.length; i < levels; i++) {
if (hiddenRows[i] && hiddenRows[i][row] === true) {
currentRowHidden = true;
}
}
if (currentRowHidden) {
dom.addClass(TH.parentNode, 'hidden');
} else if (!currentRowHidden && dom.hasClass(TH.parentNode, 'hidden')) {
dom.removeClass(TH.parentNode, 'hidden');
}
},
afterGetColHeader: function(col, TH) {
var rowHeaders = this.view.wt.wtSettings.getSetting('rowHeaders').length,
thisColgroup = instance.rootElement.querySelectorAll('colgroup col:nth-child(' + parseInt(col + rowHeaders + 1, 10) + ')');
if (thisColgroup.length === 0) {
return;
}
var currentColHidden = false;
for (var i = 0,
levels = hiddenCols.length; i < levels; i++) {
if (hiddenCols[i] && hiddenCols[i][col] === true) {
currentColHidden = true;
}
}
if (currentColHidden) {
for (var i = 0,
colsAmount = thisColgroup.length; i < colsAmount; i++) {
dom.addClass(thisColgroup[i], 'hidden');
}
} else if (!currentColHidden && dom.hasClass(thisColgroup[0], 'hidden')) {
for (var i = 0,
colsAmount = thisColgroup.length; i < colsAmount; i++) {
dom.removeClass(thisColgroup[i], 'hidden');
}
}
},
groupIndicatorsFactory: function(renderersArr, direction) {
var groupsLevelsList,
getCurrentLevel,
getCurrentGroupId,
dataType,
getGroupByIndexAndLevel,
headersType,
currentHeaderModifier,
createLevelTriggers;
switch (direction) {
case 'horizontal':
groupsLevelsList = Handsontable.Grouping.getGroupLevelsByCols();
getCurrentLevel = function(elem) {
return Array.prototype.indexOf.call(elem.parentNode.parentNode.childNodes, elem.parentNode) + 1;
};
getCurrentGroupId = function(col, level) {
return getGroupByColAndLevel(col, level).id;
};
dataType = 'cols';
getGroupByIndexAndLevel = function(col, level) {
return getGroupByColAndLevel(col - 1, level);
};
headersType = "columnHeaders";
currentHeaderModifier = function(headerRenderers) {
if (headerRenderers.length === 1) {
var oldFn = headerRenderers[0];
headerRenderers[0] = function(index, elem, level) {
if (index < -1) {
makeGroupIndicatorsForLevel()(index, elem, level);
} else {
dom.removeClass(elem, classes.groupIndicatorContainer);
oldFn(index, elem, level);
}
};
}
return function() {
return headerRenderers;
};
};
createLevelTriggers = true;
break;
case 'vertical':
groupsLevelsList = Handsontable.Grouping.getGroupLevelsByRows();
getCurrentLevel = function(elem) {
return dom.index(elem) + 1;
};
getCurrentGroupId = function(row, level) {
return getGroupByRowAndLevel(row, level).id;
};
dataType = 'rows';
getGroupByIndexAndLevel = function(row, level) {
return getGroupByRowAndLevel(row - 1, level);
};
headersType = "rowHeaders";
currentHeaderModifier = function(headerRenderers) {
return headerRenderers;
};
break;
}
var createButton = function(parent) {
var button = document.createElement('div');
parent.appendChild(button);
return {
button: button,
addClass: function(className) {
dom.addClass(button, className);
}
};
};
var makeGroupIndicatorsForLevel = function() {
var directionClassname = direction.charAt(0).toUpperCase() + direction.slice(1);
return function(index, elem, level) {
level++;
var child,
collapseButton;
while (child = elem.lastChild) {
elem.removeChild(child);
}
dom.addClass(elem, classes.groupIndicatorContainer);
var currentGroupId = getCurrentGroupId(index, level);
if (index > -1 && (groupsLevelsList[index] && groupsLevelsList[index].indexOf(level) > -1)) {
collapseButton = createButton(elem);
collapseButton.addClass(classes.groupIndicator(directionClassname));
if (isFirstIndexOfTheLine(dataType, index, level, currentGroupId)) {
collapseButton.addClass(classes.groupStart);
}
if (isLastIndexOfTheLine(dataType, index, level, currentGroupId)) {
collapseButton.button.appendChild(document.createTextNode('-'));
collapseButton.addClass(classes.collapseButton);
collapseButton.button.id = classes.collapseGroupId(currentGroupId);
collapseButton.button.setAttribute('data-level', level);
collapseButton.button.setAttribute('data-type', dataType);
}
}
if (createLevelTriggers) {
var rowInd = dom.index(elem.parentNode);
if (index === -1 || (index < -1 && rowInd === Handsontable.Grouping.getLevels().cols + 1) || (rowInd === 0 && Handsontable.Grouping.getLevels().cols === 0)) {
collapseButton = createButton(elem);
collapseButton.addClass(classes.levelTrigger);
if (index === -1) {
collapseButton.button.id = classes.collapseFromLevel("Cols", level);
collapseButton.button.appendChild(document.createTextNode(level));
} else if (index < -1 && rowInd === Handsontable.Grouping.getLevels().cols + 1 || (rowInd === 0 && Handsontable.Grouping.getLevels().cols === 0)) {
var colInd = dom.index(elem) + 1;
collapseButton.button.id = classes.collapseFromLevel("Rows", colInd);
collapseButton.button.appendChild(document.createTextNode(colInd));
}
}
}
var expanderButton = addGroupExpander(dataType, index, level, currentGroupId, elem);
if (index > 0) {
var previousGroupObj = getGroupByIndexAndLevel(index - 1, level);
if (expanderButton && previousGroupObj.hidden) {
dom.addClass(expanderButton, classes.clickable);
}
}
updateHeaderWidths();
};
};
renderersArr = currentHeaderModifier(renderersArr);
if (counters[dataType] > 0) {
for (var i = 0; i < levels[dataType] + 1; i++) {
if (!Array.isArray(renderersArr)) {
renderersArr = typeof renderersArr === 'function' ? renderersArr() : new Array(renderersArr);
}
renderersArr.unshift(makeGroupIndicatorsForLevel());
}
}
},
getGroupLevelsByRows: function() {
var rowGroups = getRowGroups(),
result = [];
for (var i = 0,
groupsLength = rowGroups.length; i < groupsLength; i++) {
if (rowGroups[i].rows) {
for (var j = 0,
groupRowsLength = rowGroups[i].rows.length; j < groupRowsLength; j++) {
if (!result[rowGroups[i].rows[j]]) {
result[rowGroups[i].rows[j]] = [];
}
result[rowGroups[i].rows[j]].push(rowGroups[i].level);
}
}
}
return result;
},
getGroupLevelsByCols: function() {
var colGroups = getColGroups(),
result = [];
for (var i = 0,
groupsLength = colGroups.length; i < groupsLength; i++) {
if (colGroups[i].cols) {
for (var j = 0,
groupColsLength = colGroups[i].cols.length; j < groupColsLength; j++) {
if (!result[colGroups[i].cols[j]]) {
result[colGroups[i].cols[j]] = [];
}
result[colGroups[i].cols[j]].push(colGroups[i].level);
}
}
}
return result;
},
toggleGroupVisibility: function(event, coords, TD) {
if (dom.hasClass(event.target, classes.expandButton) || dom.hasClass(event.target, classes.collapseButton) || dom.hasClass(event.target, classes.levelTrigger)) {
var element = event.target,
elemIdSplit = element.id.split('-');
var groups = [],
id,
level,
type,
hidden;
var prepareGroupData = function(componentElement) {
if (componentElement) {
element = componentElement;
}
elemIdSplit = element.id.split('-');
id = elemIdSplit[1];
level = parseInt(element.getAttribute('data-level'), 10);
type = element.getAttribute('data-type');
hidden = parseInt(element.getAttribute('data-hidden'));
if (isNaN(hidden)) {
hidden = 1;
} else {
hidden = (hidden ? 0 : 1);
}
element.setAttribute('data-hidden', hidden.toString());
groups.push(getGroupById(id));
};
if (element.className.indexOf(classes.levelTrigger) > -1) {
var groupsInLevel,
groupsToExpand = [],
groupsToCollapse = [],
levelType = element.id.indexOf("Rows") > -1 ? "rows" : "cols";
for (var i = 1,
levelsCount = levels[levelType]; i <= levelsCount; i++) {
groupsInLevel = levelType == "rows" ? getRowGroupsByLevel(i) : getColGroupsByLevel(i);
if (i >= parseInt(elemIdSplit[1], 10)) {
for (var j = 0,
groupCount = groupsInLevel.length; j < groupCount; j++) {
groupsToCollapse.push(groupsInLevel[j]);
}
} else {
for (var j = 0,
groupCount = groupsInLevel.length; j < groupCount; j++) {
groupsToExpand.push(groupsInLevel[j]);
}
}
}
showHideGroups(true, groupsToCollapse);
showHideGroups(false, groupsToExpand);
} else {
prepareGroupData();
showHideGroups(hidden, groups);
}
type = type || levelType;
var lastHidden = isLastHidden(type),
typeUppercase = type.charAt(0).toUpperCase() + type.slice(1),
spareElements = Handsontable.Grouping['baseSpare' + typeUppercase];
if (lastHidden) {
if (spareElements == 0) {
instance.alter('insert_' + type.slice(0, -1), instance['count' + typeUppercase]());
Handsontable.Grouping["dummy" + type.slice(0, -1)] = true;
}
} else {
if (spareElements == 0) {
if (Handsontable.Grouping["dummy" + type.slice(0, -1)]) {
instance.alter('remove_' + type.slice(0, -1), instance['count' + typeUppercase]() - 1);
Handsontable.Grouping["dummy" + type.slice(0, -1)] = false;
}
}
}
instance.render();
event.stopImmediatePropagation();
}
},
modifySelectionFactory: function(position) {
var instance = this.instance;
var currentlySelected,
nextPosition = new WalkontableCellCoords(0, 0),
nextVisible = function(direction, currentPosition) {
var updateDelta = 0;
switch (direction) {
case 'down':
while (isCollapsed(currentPosition)) {
updateDelta++;
currentPosition.row += 1;
}
break;
case 'up':
while (isCollapsed(currentPosition)) {
updateDelta--;
currentPosition.row -= 1;
}
break;
case 'right':
while (isCollapsed(currentPosition)) {
updateDelta++;
currentPosition.col += 1;
}
break;
case 'left':
while (isCollapsed(currentPosition)) {
updateDelta--;
currentPosition.col -= 1;
}
break;
}
return updateDelta;
},
updateDelta = function(delta, nextPosition) {
if (delta.row > 0) {
if (isCollapsed(nextPosition)) {
delta.row += nextVisible('down', nextPosition);
}
} else if (delta.row < 0) {
if (isCollapsed(nextPosition)) {
delta.row += nextVisible('up', nextPosition);
}
}
if (delta.col > 0) {
if (isCollapsed(nextPosition)) {
delta.col += nextVisible('right', nextPosition);
}
} else if (delta.col < 0) {
if (isCollapsed(nextPosition)) {
delta.col += nextVisible('left', nextPosition);
}
}
};
switch (position) {
case 'start':
return function(delta) {
currentlySelected = instance.getSelected();
nextPosition.row = currentlySelected[0] + delta.row;
nextPosition.col = currentlySelected[1] + delta.col;
updateDelta(delta, nextPosition);
};
break;
case 'end':
return function(delta) {
currentlySelected = instance.getSelected();
nextPosition.row = currentlySelected[2] + delta.row;
nextPosition.col = currentlySelected[3] + delta.col;
updateDelta(delta, nextPosition);
};
break;
}
},
modifyRowHeight: function(height, row) {
if (instance.view.wt.wtTable.rowFilter && isCollapsed({
row: row,
col: null
})) {
return 0;
}
},
validateGroups: function() {
var areRangesOverlapping = function(a, b) {
if ((a[0] < b[0] && a[1] < b[1] && b[0] <= a[1]) || (a[0] > b[0] && b[1] < a[1] && a[0] <= b[1])) {
return true;
}
};
var configGroups = instance.getSettings().groups,
cols = [],
rows = [];
for (var i = 0,
groupsLength = configGroups.length; i < groupsLength; i++) {
if (configGroups[i].rows) {
if (configGroups[i].rows.length === 1) {
throw new Error("Grouping error: Group {" + configGroups[i].rows[0] + "} is invalid. Cannot define single-entry groups.");
return false;
} else if (configGroups[i].rows.length === 0) {
throw new Error("Grouping error: Cannot define empty groups.");
return false;
}
rows.push(configGroups[i].rows);
for (var j = 0,
rowsLength = rows.length; j < rowsLength; j++) {
if (areRangesOverlapping(configGroups[i].rows, rows[j])) {
throw new Error("Grouping error: ranges {" + configGroups[i].rows[0] + ", " + configGroups[i].rows[1] + "} and {" + rows[j][0] + ", " + rows[j][1] + "} are overlapping.");
return false;
}
}
} else if (configGroups[i].cols) {
if (configGroups[i].cols.length === 1) {
throw new Error("Grouping error: Group {" + configGroups[i].cols[0] + "} is invalid. Cannot define single-entry groups.");
return false;
} else if (configGroups[i].cols.length === 0) {
throw new Error("Grouping error: Cannot define empty groups.");
return false;
}
cols.push(configGroups[i].cols);
for (var j = 0,
colsLength = cols.length; j < colsLength; j++) {
if (areRangesOverlapping(configGroups[i].cols, cols[j])) {
throw new Error("Grouping error: ranges {" + configGroups[i].cols[0] + ", " + configGroups[i].cols[1] + "} and {" + cols[j][0] + ", " + cols[j][1] + "} are overlapping.");
return false;
}
}
}
}
return true;
},
afterGetRowHeaderRenderers: function(arr) {
Handsontable.Grouping.groupIndicatorsFactory(arr, 'vertical');
},
afterGetColumnHeaderRenderers: function(arr) {
Handsontable.Grouping.groupIndicatorsFactory(arr, 'horizontal');
},
hookProxy: function(fn, arg) {
return function() {
if (instance.getSettings().groups) {
return arg ? Handsontable.Grouping[fn](arg).apply(this, arguments) : Handsontable.Grouping[fn].apply(this, arguments);
} else {
return void 0;
}
};
}
};
}
Grouping.prototype.beforeInit = function() {};
var init = function() {
var instance = this,
groupingSetting = !!(instance.getSettings().groups);
if (groupingSetting) {
var headerUpdates = {};
Handsontable.Grouping = new Grouping(instance);
if (!instance.getSettings().rowHeaders) {
headerUpdates.rowHeaders = true;
}
if (!instance.getSettings().colHeaders) {
headerUpdates.colHeaders = true;
}
if (headerUpdates.colHeaders || headerUpdates.rowHeaders) {
instance.updateSettings(headerUpdates);
}
var groupConfigValid = Handsontable.Grouping.validateGroups();
if (!groupConfigValid) {
return;
}
instance.addHook('beforeInit', Handsontable.Grouping.hookProxy('init'));
instance.addHook('afterUpdateSettings', Handsontable.Grouping.hookProxy('updateGroups'));
instance.addHook('afterGetColumnHeaderRenderers', Handsontable.Grouping.hookProxy('afterGetColumnHeaderRenderers'));
instance.addHook('afterGetRowHeaderRenderers', Handsontable.Grouping.hookProxy('afterGetRowHeaderRenderers'));
instance.addHook('afterGetRowHeader', Handsontable.Grouping.hookProxy('afterGetRowHeader'));
instance.addHook('afterGetColHeader', Handsontable.Grouping.hookProxy('afterGetColHeader'));
instance.addHook('beforeOnCellMouseDown', Handsontable.Grouping.hookProxy('toggleGroupVisibility'));
instance.addHook('modifyTransformStart', Handsontable.Grouping.hookProxy('modifySelectionFactory', 'start'));
instance.addHook('modifyTransformEnd', Handsontable.Grouping.hookProxy('modifySelectionFactory', 'end'));
instance.addHook('modifyRowHeight', Handsontable.Grouping.hookProxy('modifyRowHeight'));
}
};
var updateHeaderWidths = function() {
var colgroups = document.querySelectorAll('colgroup');
for (var i = 0,
colgroupsLength = colgroups.length; i < colgroupsLength; i++) {
var rowHeaders = colgroups[i].querySelectorAll('col.rowHeader');
if (rowHeaders.length === 0) {
return;
}
for (var j = 0,
rowHeadersLength = rowHeaders.length + 1; j < rowHeadersLength; j++) {
if (rowHeadersLength == 2) {
return;
}
if (j < Handsontable.Grouping.getLevels().rows + 1) {
if (j == Handsontable.Grouping.getLevels().rows) {
dom.addClass(rowHeaders[j], 'htGroupColClosest');
} else {
dom.addClass(rowHeaders[j], 'htGroupCol');
}
}
}
}
};
Handsontable.hooks.add('beforeInit', init);
Handsontable.hooks.add('afterUpdateSettings', function() {
if (this.getSettings().groups && !Handsontable.Grouping) {
init.call(this, arguments);
} else if (!this.getSettings().groups && Handsontable.Grouping) {
Handsontable.Grouping.resetGroups();
Handsontable.Grouping = void 0;
}
});
Handsontable.plugins.Grouping = Grouping;
//#
},{"./../../dom.js":27,"./../../plugins.js":45}],58:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
ManualColumnFreeze: {get: function() {
return ManualColumnFreeze;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_plugins_46_js__;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
;
function ManualColumnFreeze(instance) {
var fixedColumnsCount = instance.getSettings().fixedColumnsLeft;
var init = function() {
if (typeof instance.manualColumnPositionsPluginUsages !== 'undefined') {
instance.manualColumnPositionsPluginUsages.push('manualColumnFreeze');
} else {
instance.manualColumnPositionsPluginUsages = ['manualColumnFreeze'];
}
bindHooks();
};
function addContextMenuEntry(defaultOptions) {
defaultOptions.items.push(Handsontable.ContextMenu.SEPARATOR, {
key: 'freeze_column',
name: function() {
var selectedColumn = instance.getSelected()[1];
if (selectedColumn > fixedColumnsCount - 1) {
return 'Freeze this column';
} else {
return 'Unfreeze this column';
}
},
disabled: function() {
var selection = instance.getSelected();
return selection[1] !== selection[3];
},
callback: function() {
var selectedColumn = instance.getSelected()[1];
if (selectedColumn > fixedColumnsCount - 1) {
freezeColumn(selectedColumn);
} else {
unfreezeColumn(selectedColumn);
}
}
});
}
function addFixedColumn() {
instance.updateSettings({fixedColumnsLeft: fixedColumnsCount + 1});
fixedColumnsCount++;
}
function removeFixedColumn() {
instance.updateSettings({fixedColumnsLeft: fixedColumnsCount - 1});
fixedColumnsCount--;
}
function checkPositionData(col) {
if (!instance.manualColumnPositions || instance.manualColumnPositions.length === 0) {
if (!instance.manualColumnPositions) {
instance.manualColumnPositions = [];
}
}
if (col) {
if (!instance.manualColumnPositions[col]) {
createPositionData(col + 1);
}
} else {
createPositionData(instance.countCols());
}
}
function createPositionData(len) {
if (instance.manualColumnPositions.length < len) {
for (var i = instance.manualColumnPositions.length; i < len; i++) {
instance.manualColumnPositions[i] = i;
}
}
}
function modifyColumnOrder(col, actualCol, returnCol, action) {
if (returnCol == null) {
returnCol = col;
}
if (action === 'freeze') {
instance.manualColumnPositions.splice(fixedColumnsCount, 0, instance.manualColumnPositions.splice(actualCol, 1)[0]);
} else if (action === 'unfreeze') {
instance.manualColumnPositions.splice(returnCol, 0, instance.manualColumnPositions.splice(actualCol, 1)[0]);
}
}
function getBestColumnReturnPosition(col) {
var i = fixedColumnsCount,
j = getModifiedColumnIndex(i),
initialCol = getModifiedColumnIndex(col);
while (j < initialCol) {
i++;
j = getModifiedColumnIndex(i);
}
return i - 1;
}
function freezeColumn(col) {
if (col <= fixedColumnsCount - 1) {
return;
}
var modifiedColumn = getModifiedColumnIndex(col) || col;
checkPositionData(modifiedColumn);
modifyColumnOrder(modifiedColumn, col, null, 'freeze');
addFixedColumn();
instance.view.wt.wtOverlays.leftOverlay.refresh();
instance.view.wt.wtOverlays.adjustElementsSize();
}
function unfreezeColumn(col) {
if (col > fixedColumnsCount - 1) {
return;
}
var returnCol = getBestColumnReturnPosition(col);
var modifiedColumn = getModifiedColumnIndex(col) || col;
checkPositionData(modifiedColumn);
modifyColumnOrder(modifiedColumn, col, returnCol, 'unfreeze');
removeFixedColumn();
instance.view.wt.wtOverlays.leftOverlay.refresh();
}
function getModifiedColumnIndex(col) {
return instance.manualColumnPositions[col];
}
function onModifyCol(col) {
if (this.manualColumnPositionsPluginUsages.length > 1) {
return col;
}
return getModifiedColumnIndex(col);
}
function bindHooks() {
instance.addHook('modifyCol', onModifyCol);
instance.addHook('afterContextMenuDefaultOptions', addContextMenuEntry);
}
return {
init: init,
freezeColumn: freezeColumn,
unfreezeColumn: unfreezeColumn,
helpers: {
addFixedColumn: addFixedColumn,
removeFixedColumn: removeFixedColumn,
checkPositionData: checkPositionData,
modifyColumnOrder: modifyColumnOrder,
getBestColumnReturnPosition: getBestColumnReturnPosition
}
};
}
var init = function init() {
if (!this.getSettings().manualColumnFreeze) {
return;
}
var mcfPlugin;
Handsontable.plugins.manualColumnFreeze = ManualColumnFreeze;
this.manualColumnFreeze = new ManualColumnFreeze(this);
mcfPlugin = this.manualColumnFreeze;
mcfPlugin.init.call(this);
};
Handsontable.hooks.add('beforeInit', init);
//#
},{"./../../plugins.js":45}],59:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
ManualColumnMove: {get: function() {
return ManualColumnMove;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_helpers_46_js__,
$___46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47_eventManager_46_js__,
$___46__46__47__46__46__47_plugins_46_js__;
var helper = ($___46__46__47__46__46__47_helpers_46_js__ = require("./../../helpers.js"), $___46__46__47__46__46__47_helpers_46_js__ && $___46__46__47__46__46__47_helpers_46_js__.__esModule && $___46__46__47__46__46__47_helpers_46_js__ || {default: $___46__46__47__46__46__47_helpers_46_js__});
var dom = ($___46__46__47__46__46__47_dom_46_js__ = require("./../../dom.js"), $___46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47_dom_46_js__});
var eventManagerObject = ($___46__46__47__46__46__47_eventManager_46_js__ = require("./../../eventManager.js"), $___46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47_eventManager_46_js__}).eventManager;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
;
function ManualColumnMove() {
var startCol,
endCol,
startX,
startOffset,
currentCol,
instance,
currentTH,
handle = document.createElement('DIV'),
guide = document.createElement('DIV'),
eventManager = eventManagerObject(this);
handle.className = 'manualColumnMover';
guide.className = 'manualColumnMoverGuide';
var saveManualColumnPositions = function() {
var instance = this;
Handsontable.hooks.run(instance, 'persistentStateSave', 'manualColumnPositions', instance.manualColumnPositions);
};
var loadManualColumnPositions = function() {
var instance = this;
var storedState = {};
Handsontable.hooks.run(instance, 'persistentStateLoad', 'manualColumnPositions', storedState);
return storedState.value;
};
function setupHandlePosition(TH) {
instance = this;
currentTH = TH;
var col = this.view.wt.wtTable.getCoords(TH).col;
if (col >= 0) {
currentCol = col;
var box = currentTH.getBoundingClientRect();
startOffset = box.left;
handle.style.top = box.top + 'px';
handle.style.left = startOffset + 'px';
instance.rootElement.appendChild(handle);
}
}
function refreshHandlePosition(TH, delta) {
var box = TH.getBoundingClientRect();
var handleWidth = 6;
if (delta > 0) {
handle.style.left = (box.left + box.width - handleWidth) + 'px';
} else {
handle.style.left = box.left + 'px';
}
}
function setupGuidePosition() {
var instance = this;
dom.addClass(handle, 'active');
dom.addClass(guide, 'active');
var box = currentTH.getBoundingClientRect();
guide.style.width = box.width + 'px';
guide.style.height = instance.view.maximumVisibleElementHeight(0) + 'px';
guide.style.top = handle.style.top;
guide.style.left = startOffset + 'px';
instance.rootElement.appendChild(guide);
}
function refreshGuidePosition(diff) {
guide.style.left = startOffset + diff + 'px';
}
function hideHandleAndGuide() {
dom.removeClass(handle, 'active');
dom.removeClass(guide, 'active');
}
var checkColumnHeader = function(element) {
if (element.tagName != 'BODY') {
if (element.parentNode.tagName == 'THEAD') {
return true;
} else {
element = element.parentNode;
return checkColumnHeader(element);
}
}
return false;
};
var getTHFromTargetElement = function(element) {
if (element.tagName != 'TABLE') {
if (element.tagName == 'TH') {
return element;
} else {
return getTHFromTargetElement(element.parentNode);
}
}
return null;
};
var bindEvents = function() {
var instance = this;
var pressed;
eventManager.addEventListener(instance.rootElement, 'mouseover', function(e) {
if (checkColumnHeader(e.target)) {
var th = getTHFromTargetElement(e.target);
if (th) {
if (pressed) {
var col = instance.view.wt.wtTable.getCoords(th).col;
if (col >= 0) {
endCol = col;
refreshHandlePosition(e.target, endCol - startCol);
}
} else {
setupHandlePosition.call(instance, th);
}
}
}
});
eventManager.addEventListener(instance.rootElement, 'mousedown', function(e) {
if (dom.hasClass(e.target, 'manualColumnMover')) {
startX = helper.pageX(e);
setupGuidePosition.call(instance);
pressed = instance;
startCol = currentCol;
endCol = currentCol;
}
});
eventManager.addEventListener(window, 'mousemove', function(e) {
if (pressed) {
refreshGuidePosition(helper.pageX(e) - startX);
}
});
eventManager.addEventListener(window, 'mouseup', function(e) {
if (pressed) {
hideHandleAndGuide();
pressed = false;
createPositionData(instance.manualColumnPositions, instance.countCols());
instance.manualColumnPositions.splice(endCol, 0, instance.manualColumnPositions.splice(startCol, 1)[0]);
instance.forceFullRender = true;
instance.view.render();
saveManualColumnPositions.call(instance);
Handsontable.hooks.run(instance, 'afterColumnMove', startCol, endCol);
setupHandlePosition.call(instance, currentTH);
}
});
instance.addHook('afterDestroy', unbindEvents);
};
var unbindEvents = function() {
eventManager.clear();
};
var createPositionData = function(positionArr, len) {
if (positionArr.length < len) {
for (var i = positionArr.length; i < len; i++) {
positionArr[i] = i;
}
}
};
this.beforeInit = function() {
this.manualColumnPositions = [];
};
this.init = function(source) {
var instance = this;
var manualColMoveEnabled = !!(this.getSettings().manualColumnMove);
if (manualColMoveEnabled) {
var initialManualColumnPositions = this.getSettings().manualColumnMove;
var loadedManualColumnPositions = loadManualColumnPositions.call(instance);
if (typeof loadedManualColumnPositions != 'undefined') {
this.manualColumnPositions = loadedManualColumnPositions;
} else if (Array.isArray(initialManualColumnPositions)) {
this.manualColumnPositions = initialManualColumnPositions;
} else {
this.manualColumnPositions = [];
}
if (source == 'afterInit') {
if (typeof instance.manualColumnPositionsPluginUsages != 'undefined') {
instance.manualColumnPositionsPluginUsages.push('manualColumnMove');
} else {
instance.manualColumnPositionsPluginUsages = ['manualColumnMove'];
}
bindEvents.call(this);
if (this.manualColumnPositions.length > 0) {
this.forceFullRender = true;
this.render();
}
}
} else {
var pluginUsagesIndex = instance.manualColumnPositionsPluginUsages ? instance.manualColumnPositionsPluginUsages.indexOf('manualColumnMove') : -1;
if (pluginUsagesIndex > -1) {
unbindEvents.call(this);
this.manualColumnPositions = [];
instance.manualColumnPositionsPluginUsages[pluginUsagesIndex] = void 0;
}
}
};
this.modifyCol = function(col) {
if (this.getSettings().manualColumnMove) {
if (typeof this.manualColumnPositions[col] === 'undefined') {
createPositionData(this.manualColumnPositions, col + 1);
}
return this.manualColumnPositions[col];
}
return col;
};
this.afterRemoveCol = function(index, amount) {
if (!this.getSettings().manualColumnMove) {
return;
}
var rmindx,
colpos = this.manualColumnPositions;
rmindx = colpos.splice(index, amount);
colpos = colpos.map(function(colpos) {
var i,
newpos = colpos;
for (i = 0; i < rmindx.length; i++) {
if (colpos > rmindx[i]) {
newpos--;
}
}
return newpos;
});
this.manualColumnPositions = colpos;
};
this.afterCreateCol = function(index, amount) {
if (!this.getSettings().manualColumnMove) {
return;
}
var colpos = this.manualColumnPositions;
if (!colpos.length) {
return;
}
var addindx = [];
for (var i = 0; i < amount; i++) {
addindx.push(index + i);
}
if (index >= colpos.length) {
colpos.concat(addindx);
} else {
colpos = colpos.map(function(colpos) {
return (colpos >= index) ? (colpos + amount) : colpos;
});
colpos.splice.apply(colpos, [index, 0].concat(addindx));
}
this.manualColumnPositions = colpos;
};
}
var htManualColumnMove = new ManualColumnMove();
Handsontable.hooks.add('beforeInit', htManualColumnMove.beforeInit);
Handsontable.hooks.add('afterInit', function() {
htManualColumnMove.init.call(this, 'afterInit');
});
Handsontable.hooks.add('afterUpdateSettings', function() {
htManualColumnMove.init.call(this, 'afterUpdateSettings');
});
Handsontable.hooks.add('modifyCol', htManualColumnMove.modifyCol);
Handsontable.hooks.add('afterRemoveCol', htManualColumnMove.afterRemoveCol);
Handsontable.hooks.add('afterCreateCol', htManualColumnMove.afterCreateCol);
Handsontable.hooks.register('afterColumnMove');
//#
},{"./../../dom.js":27,"./../../eventManager.js":41,"./../../helpers.js":42,"./../../plugins.js":45}],60:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
ManualColumnResize: {get: function() {
return ManualColumnResize;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_helpers_46_js__,
$___46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47_eventManager_46_js__,
$___46__46__47__46__46__47_plugins_46_js__;
var helper = ($___46__46__47__46__46__47_helpers_46_js__ = require("./../../helpers.js"), $___46__46__47__46__46__47_helpers_46_js__ && $___46__46__47__46__46__47_helpers_46_js__.__esModule && $___46__46__47__46__46__47_helpers_46_js__ || {default: $___46__46__47__46__46__47_helpers_46_js__});
var dom = ($___46__46__47__46__46__47_dom_46_js__ = require("./../../dom.js"), $___46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47_dom_46_js__});
var eventManagerObject = ($___46__46__47__46__46__47_eventManager_46_js__ = require("./../../eventManager.js"), $___46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47_eventManager_46_js__}).eventManager;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
;
function ManualColumnResize() {
var currentTH,
currentCol,
currentWidth,
instance,
newSize,
startX,
startWidth,
startOffset,
handle = document.createElement('DIV'),
guide = document.createElement('DIV'),
eventManager = eventManagerObject(this);
handle.className = 'manualColumnResizer';
guide.className = 'manualColumnResizerGuide';
var saveManualColumnWidths = function() {
var instance = this;
Handsontable.hooks.run(instance, 'persistentStateSave', 'manualColumnWidths', instance.manualColumnWidths);
};
var loadManualColumnWidths = function() {
var instance = this;
var storedState = {};
Handsontable.hooks.run(instance, 'persistentStateLoad', 'manualColumnWidths', storedState);
return storedState.value;
};
function setupHandlePosition(TH) {
instance = this;
currentTH = TH;
var col = this.view.wt.wtTable.getCoords(TH).col;
if (col >= 0) {
currentCol = col;
var box = currentTH.getBoundingClientRect();
startOffset = box.left - 6;
startWidth = parseInt(box.width, 10);
handle.style.top = box.top + 'px';
handle.style.left = startOffset + startWidth + 'px';
instance.rootElement.appendChild(handle);
}
}
function refreshHandlePosition() {
handle.style.left = startOffset + currentWidth + 'px';
}
function setupGuidePosition() {
var instance = this;
dom.addClass(handle, 'active');
dom.addClass(guide, 'active');
guide.style.top = handle.style.top;
guide.style.left = handle.style.left;
guide.style.height = instance.view.maximumVisibleElementHeight(0) + 'px';
instance.rootElement.appendChild(guide);
}
function refreshGuidePosition() {
guide.style.left = handle.style.left;
}
function hideHandleAndGuide() {
dom.removeClass(handle, 'active');
dom.removeClass(guide, 'active');
}
var checkColumnHeader = function(element) {
if (element.tagName != 'BODY') {
if (element.parentNode.tagName == 'THEAD') {
return true;
} else {
element = element.parentNode;
return checkColumnHeader(element);
}
}
return false;
};
var getTHFromTargetElement = function(element) {
if (element.tagName != 'TABLE') {
if (element.tagName == 'TH') {
return element;
} else {
return getTHFromTargetElement(element.parentNode);
}
}
return null;
};
var bindEvents = function() {
var instance = this;
var pressed;
var dblclick = 0;
var autoresizeTimeout = null;
eventManager.addEventListener(instance.rootElement, 'mouseover', function(e) {
if (checkColumnHeader(e.target)) {
var th = getTHFromTargetElement(e.target);
if (th) {
if (!pressed) {
setupHandlePosition.call(instance, th);
}
}
}
});
eventManager.addEventListener(instance.rootElement, 'mousedown', function(e) {
if (dom.hasClass(e.target, 'manualColumnResizer')) {
setupGuidePosition.call(instance);
pressed = instance;
if (autoresizeTimeout == null) {
autoresizeTimeout = setTimeout(function() {
if (dblclick >= 2) {
newSize = instance.determineColumnWidth.call(instance, currentCol);
setManualSize(currentCol, newSize);
instance.forceFullRender = true;
instance.view.render();
Handsontable.hooks.run(instance, 'afterColumnResize', currentCol, newSize);
}
dblclick = 0;
autoresizeTimeout = null;
}, 500);
instance._registerTimeout(autoresizeTimeout);
}
dblclick++;
startX = helper.pageX(e);
newSize = startWidth;
}
});
eventManager.addEventListener(window, 'mousemove', function(e) {
if (pressed) {
currentWidth = startWidth + (helper.pageX(e) - startX);
newSize = setManualSize(currentCol, currentWidth);
refreshHandlePosition();
refreshGuidePosition();
}
});
eventManager.addEventListener(window, 'mouseup', function() {
if (pressed) {
hideHandleAndGuide();
pressed = false;
if (newSize != startWidth) {
instance.forceFullRender = true;
instance.view.render();
instance.view.wt.wtOverlays.adjustElementsSize();
saveManualColumnWidths.call(instance);
Handsontable.hooks.run(instance, 'afterColumnResize', currentCol, newSize);
}
setupHandlePosition.call(instance, currentTH);
}
});
instance.addHook('afterDestroy', unbindEvents);
};
var unbindEvents = function() {
eventManager.clear();
};
this.beforeInit = function() {
this.manualColumnWidths = [];
};
this.init = function(source) {
var instance = this;
var manualColumnWidthEnabled = !!(this.getSettings().manualColumnResize);
if (manualColumnWidthEnabled) {
var initialColumnWidths = this.getSettings().manualColumnResize;
var loadedManualColumnWidths = loadManualColumnWidths.call(instance);
if (typeof instance.manualColumnWidthsPluginUsages != 'undefined') {
instance.manualColumnWidthsPluginUsages.push('manualColumnResize');
} else {
instance.manualColumnWidthsPluginUsages = ['manualColumnResize'];
}
if (typeof loadedManualColumnWidths != 'undefined') {
this.manualColumnWidths = loadedManualColumnWidths;
} else if (Array.isArray(initialColumnWidths)) {
this.manualColumnWidths = initialColumnWidths;
} else {
this.manualColumnWidths = [];
}
if (source == 'afterInit') {
bindEvents.call(this);
if (this.manualColumnWidths.length > 0) {
this.forceFullRender = true;
this.render();
}
}
} else {
var pluginUsagesIndex = instance.manualColumnWidthsPluginUsages ? instance.manualColumnWidthsPluginUsages.indexOf('manualColumnResize') : -1;
if (pluginUsagesIndex > -1) {
unbindEvents.call(this);
this.manualColumnWidths = [];
}
}
};
var setManualSize = function(col, width) {
width = Math.max(width, 20);
col = Handsontable.hooks.run(instance, 'modifyCol', col);
instance.manualColumnWidths[col] = width;
return width;
};
this.modifyColWidth = function(width, col) {
col = this.runHooks('modifyCol', col);
if (this.getSettings().manualColumnResize && this.manualColumnWidths[col]) {
return this.manualColumnWidths[col];
}
return width;
};
}
var htManualColumnResize = new ManualColumnResize();
Handsontable.hooks.add('beforeInit', htManualColumnResize.beforeInit);
Handsontable.hooks.add('afterInit', function() {
htManualColumnResize.init.call(this, 'afterInit');
});
Handsontable.hooks.add('afterUpdateSettings', function() {
htManualColumnResize.init.call(this, 'afterUpdateSettings');
});
Handsontable.hooks.add('modifyColWidth', htManualColumnResize.modifyColWidth);
Handsontable.hooks.register('afterColumnResize');
//#
},{"./../../dom.js":27,"./../../eventManager.js":41,"./../../helpers.js":42,"./../../plugins.js":45}],61:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
ManualRowMove: {get: function() {
return ManualRowMove;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_helpers_46_js__,
$___46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47_eventManager_46_js__,
$___46__46__47__46__46__47_plugins_46_js__;
var helper = ($___46__46__47__46__46__47_helpers_46_js__ = require("./../../helpers.js"), $___46__46__47__46__46__47_helpers_46_js__ && $___46__46__47__46__46__47_helpers_46_js__.__esModule && $___46__46__47__46__46__47_helpers_46_js__ || {default: $___46__46__47__46__46__47_helpers_46_js__});
var dom = ($___46__46__47__46__46__47_dom_46_js__ = require("./../../dom.js"), $___46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47_dom_46_js__});
var eventManagerObject = ($___46__46__47__46__46__47_eventManager_46_js__ = require("./../../eventManager.js"), $___46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47_eventManager_46_js__}).eventManager;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
;
function ManualRowMove() {
var startRow,
endRow,
startY,
startOffset,
currentRow,
currentTH,
handle = document.createElement('DIV'),
guide = document.createElement('DIV'),
eventManager = eventManagerObject(this);
handle.className = 'manualRowMover';
guide.className = 'manualRowMoverGuide';
var saveManualRowPositions = function() {
var instance = this;
Handsontable.hooks.run(instance, 'persistentStateSave', 'manualRowPositions', instance.manualRowPositions);
};
var loadManualRowPositions = function() {
var instance = this,
storedState = {};
Handsontable.hooks.run(instance, 'persistentStateLoad', 'manualRowPositions', storedState);
return storedState.value;
};
function setupHandlePosition(TH) {
var instance = this;
currentTH = TH;
var row = this.view.wt.wtTable.getCoords(TH).row;
if (row >= 0) {
currentRow = row;
var box = currentTH.getBoundingClientRect();
startOffset = box.top;
handle.style.top = startOffset + 'px';
handle.style.left = box.left + 'px';
instance.rootElement.appendChild(handle);
}
}
function refreshHandlePosition(TH, delta) {
var box = TH.getBoundingClientRect();
var handleHeight = 6;
if (delta > 0) {
handle.style.top = (box.top + box.height - handleHeight) + 'px';
} else {
handle.style.top = box.top + 'px';
}
}
function setupGuidePosition() {
var instance = this;
dom.addClass(handle, 'active');
dom.addClass(guide, 'active');
var box = currentTH.getBoundingClientRect();
guide.style.width = instance.view.maximumVisibleElementWidth(0) + 'px';
guide.style.height = box.height + 'px';
guide.style.top = startOffset + 'px';
guide.style.left = handle.style.left;
instance.rootElement.appendChild(guide);
}
function refreshGuidePosition(diff) {
guide.style.top = startOffset + diff + 'px';
}
function hideHandleAndGuide() {
dom.removeClass(handle, 'active');
dom.removeClass(guide, 'active');
}
var checkRowHeader = function(element) {
if (element.tagName != 'BODY') {
if (element.parentNode.tagName == 'TBODY') {
return true;
} else {
element = element.parentNode;
return checkRowHeader(element);
}
}
return false;
};
var getTHFromTargetElement = function(element) {
if (element.tagName != 'TABLE') {
if (element.tagName == 'TH') {
return element;
} else {
return getTHFromTargetElement(element.parentNode);
}
}
return null;
};
var bindEvents = function() {
var instance = this;
var pressed;
eventManager.addEventListener(instance.rootElement, 'mouseover', function(e) {
if (checkRowHeader(e.target)) {
var th = getTHFromTargetElement(e.target);
if (th) {
if (pressed) {
endRow = instance.view.wt.wtTable.getCoords(th).row;
refreshHandlePosition(th, endRow - startRow);
} else {
setupHandlePosition.call(instance, th);
}
}
}
});
eventManager.addEventListener(instance.rootElement, 'mousedown', function(e) {
if (dom.hasClass(e.target, 'manualRowMover')) {
startY = helper.pageY(e);
setupGuidePosition.call(instance);
pressed = instance;
startRow = currentRow;
endRow = currentRow;
}
});
eventManager.addEventListener(window, 'mousemove', function(e) {
if (pressed) {
refreshGuidePosition(helper.pageY(e) - startY);
}
});
eventManager.addEventListener(window, 'mouseup', function(e) {
if (pressed) {
hideHandleAndGuide();
pressed = false;
createPositionData(instance.manualRowPositions, instance.countRows());
instance.manualRowPositions.splice(endRow, 0, instance.manualRowPositions.splice(startRow, 1)[0]);
instance.forceFullRender = true;
instance.view.render();
saveManualRowPositions.call(instance);
Handsontable.hooks.run(instance, 'afterRowMove', startRow, endRow);
setupHandlePosition.call(instance, currentTH);
}
});
instance.addHook('afterDestroy', unbindEvents);
};
var unbindEvents = function() {
eventManager.clear();
};
var createPositionData = function(positionArr, len) {
if (positionArr.length < len) {
for (var i = positionArr.length; i < len; i++) {
positionArr[i] = i;
}
}
};
this.beforeInit = function() {
this.manualRowPositions = [];
};
this.init = function(source) {
var instance = this;
var manualRowMoveEnabled = !!(instance.getSettings().manualRowMove);
if (manualRowMoveEnabled) {
var initialManualRowPositions = instance.getSettings().manualRowMove;
var loadedManualRowPostions = loadManualRowPositions.call(instance);
if (typeof instance.manualRowPositionsPluginUsages != 'undefined') {
instance.manualRowPositionsPluginUsages.push('manualColumnMove');
} else {
instance.manualRowPositionsPluginUsages = ['manualColumnMove'];
}
if (typeof loadedManualRowPostions != 'undefined') {
this.manualRowPositions = loadedManualRowPostions;
} else if (Array.isArray(initialManualRowPositions)) {
this.manualRowPositions = initialManualRowPositions;
} else {
this.manualRowPositions = [];
}
if (source === 'afterInit') {
bindEvents.call(this);
if (this.manualRowPositions.length > 0) {
instance.forceFullRender = true;
instance.render();
}
}
} else {
var pluginUsagesIndex = instance.manualRowPositionsPluginUsages ? instance.manualRowPositionsPluginUsages.indexOf('manualColumnMove') : -1;
if (pluginUsagesIndex > -1) {
unbindEvents.call(this);
instance.manualRowPositions = [];
instance.manualRowPositionsPluginUsages[pluginUsagesIndex] = void 0;
}
}
};
this.modifyRow = function(row) {
var instance = this;
if (instance.getSettings().manualRowMove) {
if (typeof instance.manualRowPositions[row] === 'undefined') {
createPositionData(this.manualRowPositions, row + 1);
}
return instance.manualRowPositions[row];
}
return row;
};
}
var htManualRowMove = new ManualRowMove();
Handsontable.hooks.add('beforeInit', htManualRowMove.beforeInit);
Handsontable.hooks.add('afterInit', function() {
htManualRowMove.init.call(this, 'afterInit');
});
Handsontable.hooks.add('afterUpdateSettings', function() {
htManualRowMove.init.call(this, 'afterUpdateSettings');
});
Handsontable.hooks.add('modifyRow', htManualRowMove.modifyRow);
Handsontable.hooks.register('afterRowMove');
//#
},{"./../../dom.js":27,"./../../eventManager.js":41,"./../../helpers.js":42,"./../../plugins.js":45}],62:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
ManualRowResize: {get: function() {
return ManualRowResize;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_helpers_46_js__,
$___46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47_eventManager_46_js__,
$___46__46__47__46__46__47_plugins_46_js__;
var helper = ($___46__46__47__46__46__47_helpers_46_js__ = require("./../../helpers.js"), $___46__46__47__46__46__47_helpers_46_js__ && $___46__46__47__46__46__47_helpers_46_js__.__esModule && $___46__46__47__46__46__47_helpers_46_js__ || {default: $___46__46__47__46__46__47_helpers_46_js__});
var dom = ($___46__46__47__46__46__47_dom_46_js__ = require("./../../dom.js"), $___46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47_dom_46_js__});
var eventManagerObject = ($___46__46__47__46__46__47_eventManager_46_js__ = require("./../../eventManager.js"), $___46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47_eventManager_46_js__}).eventManager;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
;
function ManualRowResize() {
var currentTH,
currentRow,
currentHeight,
instance,
newSize,
startY,
startHeight,
startOffset,
handle = document.createElement('DIV'),
guide = document.createElement('DIV'),
eventManager = eventManagerObject(this);
handle.className = 'manualRowResizer';
guide.className = 'manualRowResizerGuide';
var saveManualRowHeights = function() {
var instance = this;
Handsontable.hooks.run(instance, 'persistentStateSave', 'manualRowHeights', instance.manualRowHeights);
};
var loadManualRowHeights = function() {
var instance = this,
storedState = {};
Handsontable.hooks.run(instance, 'persistentStateLoad', 'manualRowHeights', storedState);
return storedState.value;
};
function setupHandlePosition(TH) {
instance = this;
currentTH = TH;
var row = this.view.wt.wtTable.getCoords(TH).row;
if (row >= 0) {
currentRow = row;
var box = currentTH.getBoundingClientRect();
startOffset = box.top - 6;
startHeight = parseInt(box.height, 10);
handle.style.left = box.left + 'px';
handle.style.top = startOffset + startHeight + 'px';
instance.rootElement.appendChild(handle);
}
}
function refreshHandlePosition() {
handle.style.top = startOffset + currentHeight + 'px';
}
function setupGuidePosition() {
var instance = this;
dom.addClass(handle, 'active');
dom.addClass(guide, 'active');
guide.style.top = handle.style.top;
guide.style.left = handle.style.left;
guide.style.width = instance.view.maximumVisibleElementWidth(0) + 'px';
instance.rootElement.appendChild(guide);
}
function refreshGuidePosition() {
guide.style.top = handle.style.top;
}
function hideHandleAndGuide() {
dom.removeClass(handle, 'active');
dom.removeClass(guide, 'active');
}
var checkRowHeader = function(element) {
if (element.tagName != 'BODY') {
if (element.parentNode.tagName == 'TBODY') {
return true;
} else {
element = element.parentNode;
return checkRowHeader(element);
}
}
return false;
};
var getTHFromTargetElement = function(element) {
if (element.tagName != 'TABLE') {
if (element.tagName == 'TH') {
return element;
} else {
return getTHFromTargetElement(element.parentNode);
}
}
return null;
};
var bindEvents = function() {
var instance = this;
var pressed;
var dblclick = 0;
var autoresizeTimeout = null;
eventManager.addEventListener(instance.rootElement, 'mouseover', function(e) {
if (checkRowHeader(e.target)) {
var th = getTHFromTargetElement(e.target);
if (th) {
if (!pressed) {
setupHandlePosition.call(instance, th);
}
}
}
});
eventManager.addEventListener(instance.rootElement, 'mousedown', function(e) {
if (dom.hasClass(e.target, 'manualRowResizer')) {
setupGuidePosition.call(instance);
pressed = instance;
if (autoresizeTimeout == null) {
autoresizeTimeout = setTimeout(function() {
if (dblclick >= 2) {
setManualSize(currentRow, null);
instance.forceFullRender = true;
instance.view.render();
Handsontable.hooks.run(instance, 'afterRowResize', currentRow, newSize);
}
dblclick = 0;
autoresizeTimeout = null;
}, 500);
instance._registerTimeout(autoresizeTimeout);
}
dblclick++;
startY = helper.pageY(e);
newSize = startHeight;
}
});
eventManager.addEventListener(window, 'mousemove', function(e) {
if (pressed) {
currentHeight = startHeight + (helper.pageY(e) - startY);
newSize = setManualSize(currentRow, currentHeight);
refreshHandlePosition();
refreshGuidePosition();
}
});
eventManager.addEventListener(window, 'mouseup', function(e) {
if (pressed) {
hideHandleAndGuide();
pressed = false;
if (newSize != startHeight) {
instance.forceFullRender = true;
instance.view.render();
saveManualRowHeights.call(instance);
Handsontable.hooks.run(instance, 'afterRowResize', currentRow, newSize);
}
setupHandlePosition.call(instance, currentTH);
}
});
instance.addHook('afterDestroy', unbindEvents);
};
var unbindEvents = function() {
eventManager.clear();
};
this.beforeInit = function() {
this.manualRowHeights = [];
};
this.init = function(source) {
var instance = this;
var manualColumnHeightEnabled = !!(this.getSettings().manualRowResize);
if (manualColumnHeightEnabled) {
var initialRowHeights = this.getSettings().manualRowResize;
var loadedManualRowHeights = loadManualRowHeights.call(instance);
if (typeof instance.manualRowHeightsPluginUsages != 'undefined') {
instance.manualRowHeightsPluginUsages.push('manualRowResize');
} else {
instance.manualRowHeightsPluginUsages = ['manualRowResize'];
}
if (typeof loadedManualRowHeights != 'undefined') {
this.manualRowHeights = loadedManualRowHeights;
} else if (Array.isArray(initialRowHeights)) {
this.manualRowHeights = initialRowHeights;
} else {
this.manualRowHeights = [];
}
if (source === 'afterInit') {
bindEvents.call(this);
if (this.manualRowHeights.length > 0) {
this.forceFullRender = true;
this.render();
}
} else {
this.forceFullRender = true;
this.render();
}
} else {
var pluginUsagesIndex = instance.manualRowHeightsPluginUsages ? instance.manualRowHeightsPluginUsages.indexOf('manualRowResize') : -1;
if (pluginUsagesIndex > -1) {
unbindEvents.call(this);
this.manualRowHeights = [];
instance.manualRowHeightsPluginUsages[pluginUsagesIndex] = void 0;
}
}
};
var setManualSize = function(row, height) {
row = Handsontable.hooks.run(instance, 'modifyRow', row);
instance.manualRowHeights[row] = height;
return height;
};
this.modifyRowHeight = function(height, row) {
if (this.getSettings().manualRowResize) {
row = this.runHooks('modifyRow', row);
if (this.manualRowHeights[row] !== void 0) {
return this.manualRowHeights[row];
}
}
return height;
};
}
var htManualRowResize = new ManualRowResize();
Handsontable.hooks.add('beforeInit', htManualRowResize.beforeInit);
Handsontable.hooks.add('afterInit', function() {
htManualRowResize.init.call(this, 'afterInit');
});
Handsontable.hooks.add('afterUpdateSettings', function() {
htManualRowResize.init.call(this, 'afterUpdateSettings');
});
Handsontable.hooks.add('modifyRowHeight', htManualRowResize.modifyRowHeight);
Handsontable.hooks.register('afterRowResize');
//#
},{"./../../dom.js":27,"./../../eventManager.js":41,"./../../helpers.js":42,"./../../plugins.js":45}],63:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
MergeCells: {get: function() {
return MergeCells;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_plugins_46_js__,
$___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__,
$___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__,
$___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_table_46_js__;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
var WalkontableCellCoords = ($___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ = require("./../../3rdparty/walkontable/src/cell/coords.js"), $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__.__esModule && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ || {default: $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__}).WalkontableCellCoords;
var WalkontableCellRange = ($___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__ = require("./../../3rdparty/walkontable/src/cell/range.js"), $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__ && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__.__esModule && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__ || {default: $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_range_46_js__}).WalkontableCellRange;
var WalkontableTable = ($___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_table_46_js__ = require("./../../3rdparty/walkontable/src/table.js"), $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_table_46_js__ && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_table_46_js__.__esModule && $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_table_46_js__ || {default: $___46__46__47__46__46__47_3rdparty_47_walkontable_47_src_47_table_46_js__}).WalkontableTable;
;
function CellInfoCollection() {
var collection = [];
collection.getInfo = function(row, col) {
for (var i = 0,
ilen = this.length; i < ilen; i++) {
if (this[i].row <= row && this[i].row + this[i].rowspan - 1 >= row && this[i].col <= col && this[i].col + this[i].colspan - 1 >= col) {
return this[i];
}
}
};
collection.setInfo = function(info) {
for (var i = 0,
ilen = this.length; i < ilen; i++) {
if (this[i].row === info.row && this[i].col === info.col) {
this[i] = info;
return;
}
}
this.push(info);
};
collection.removeInfo = function(row, col) {
for (var i = 0,
ilen = this.length; i < ilen; i++) {
if (this[i].row === row && this[i].col === col) {
this.splice(i, 1);
break;
}
}
};
return collection;
}
function MergeCells(mergeCellsSetting) {
this.mergedCellInfoCollection = new CellInfoCollection();
if (Array.isArray(mergeCellsSetting)) {
for (var i = 0,
ilen = mergeCellsSetting.length; i < ilen; i++) {
this.mergedCellInfoCollection.setInfo(mergeCellsSetting[i]);
}
}
}
MergeCells.prototype.canMergeRange = function(cellRange) {
return !cellRange.isSingle();
};
MergeCells.prototype.mergeRange = function(cellRange) {
if (!this.canMergeRange(cellRange)) {
return;
}
var topLeft = cellRange.getTopLeftCorner();
var bottomRight = cellRange.getBottomRightCorner();
var mergeParent = {};
mergeParent.row = topLeft.row;
mergeParent.col = topLeft.col;
mergeParent.rowspan = bottomRight.row - topLeft.row + 1;
mergeParent.colspan = bottomRight.col - topLeft.col + 1;
this.mergedCellInfoCollection.setInfo(mergeParent);
};
MergeCells.prototype.mergeOrUnmergeSelection = function(cellRange) {
var info = this.mergedCellInfoCollection.getInfo(cellRange.from.row, cellRange.from.col);
if (info) {
this.unmergeSelection(cellRange.from);
} else {
this.mergeSelection(cellRange);
}
};
MergeCells.prototype.mergeSelection = function(cellRange) {
this.mergeRange(cellRange);
};
MergeCells.prototype.unmergeSelection = function(cellRange) {
var info = this.mergedCellInfoCollection.getInfo(cellRange.row, cellRange.col);
this.mergedCellInfoCollection.removeInfo(info.row, info.col);
};
MergeCells.prototype.applySpanProperties = function(TD, row, col) {
var info = this.mergedCellInfoCollection.getInfo(row, col);
if (info) {
if (info.row === row && info.col === col) {
TD.setAttribute('rowspan', info.rowspan);
TD.setAttribute('colspan', info.colspan);
} else {
TD.removeAttribute('rowspan');
TD.removeAttribute('colspan');
TD.style.display = "none";
}
} else {
TD.removeAttribute('rowspan');
TD.removeAttribute('colspan');
}
};
MergeCells.prototype.modifyTransform = function(hook, currentSelectedRange, delta) {
var sameRowspan = function(merged, coords) {
if (coords.row >= merged.row && coords.row <= (merged.row + merged.rowspan - 1)) {
return true;
}
return false;
},
sameColspan = function(merged, coords) {
if (coords.col >= merged.col && coords.col <= (merged.col + merged.colspan - 1)) {
return true;
}
return false;
},
getNextPosition = function(newDelta) {
return new WalkontableCellCoords(currentSelectedRange.to.row + newDelta.row, currentSelectedRange.to.col + newDelta.col);
};
var newDelta = {
row: delta.row,
col: delta.col
};
if (hook == 'modifyTransformStart') {
if (!this.lastDesiredCoords) {
this.lastDesiredCoords = new WalkontableCellCoords(null, null);
}
var currentPosition = new WalkontableCellCoords(currentSelectedRange.highlight.row, currentSelectedRange.highlight.col),
mergedParent = this.mergedCellInfoCollection.getInfo(currentPosition.row, currentPosition.col),
currentRangeContainsMerge;
for (var i = 0,
mergesLength = this.mergedCellInfoCollection.length; i < mergesLength; i++) {
var range = this.mergedCellInfoCollection[i];
range = new WalkontableCellCoords(range.row + range.rowspan - 1, range.col + range.colspan - 1);
if (currentSelectedRange.includes(range)) {
currentRangeContainsMerge = true;
break;
}
}
if (mergedParent) {
var mergeTopLeft = new WalkontableCellCoords(mergedParent.row, mergedParent.col),
mergeBottomRight = new WalkontableCellCoords(mergedParent.row + mergedParent.rowspan - 1, mergedParent.col + mergedParent.colspan - 1),
mergeRange = new WalkontableCellRange(mergeTopLeft, mergeTopLeft, mergeBottomRight);
if (!mergeRange.includes(this.lastDesiredCoords)) {
this.lastDesiredCoords = new WalkontableCellCoords(null, null);
}
newDelta.row = this.lastDesiredCoords.row ? this.lastDesiredCoords.row - currentPosition.row : newDelta.row;
newDelta.col = this.lastDesiredCoords.col ? this.lastDesiredCoords.col - currentPosition.col : newDelta.col;
if (delta.row > 0) {
newDelta.row = mergedParent.row + mergedParent.rowspan - 1 - currentPosition.row + delta.row;
} else if (delta.row < 0) {
newDelta.row = currentPosition.row - mergedParent.row + delta.row;
}
if (delta.col > 0) {
newDelta.col = mergedParent.col + mergedParent.colspan - 1 - currentPosition.col + delta.col;
} else if (delta.col < 0) {
newDelta.col = currentPosition.col - mergedParent.col + delta.col;
}
}
var nextPosition = new WalkontableCellCoords(currentSelectedRange.highlight.row + newDelta.row, currentSelectedRange.highlight.col + newDelta.col),
nextParentIsMerged = this.mergedCellInfoCollection.getInfo(nextPosition.row, nextPosition.col);
if (nextParentIsMerged) {
this.lastDesiredCoords = nextPosition;
newDelta = {
row: nextParentIsMerged.row - currentPosition.row,
col: nextParentIsMerged.col - currentPosition.col
};
}
} else if (hook == 'modifyTransformEnd') {
for (var i = 0,
mergesLength = this.mergedCellInfoCollection.length; i < mergesLength; i++) {
var currentMerge = this.mergedCellInfoCollection[i],
mergeTopLeft = new WalkontableCellCoords(currentMerge.row, currentMerge.col),
mergeBottomRight = new WalkontableCellCoords(currentMerge.row + currentMerge.rowspan - 1, currentMerge.col + currentMerge.colspan - 1),
mergedRange = new WalkontableCellRange(mergeTopLeft, mergeTopLeft, mergeBottomRight),
sharedBorders = currentSelectedRange.getBordersSharedWith(mergedRange);
if (mergedRange.isEqual(currentSelectedRange)) {
currentSelectedRange.setDirection("NW-SE");
} else if (sharedBorders.length > 0) {
var mergeHighlighted = (currentSelectedRange.highlight.isEqual(mergedRange.from));
if (sharedBorders.indexOf('top') > -1) {
if (currentSelectedRange.to.isSouthEastOf(mergedRange.from) && mergeHighlighted) {
currentSelectedRange.setDirection("NW-SE");
} else if (currentSelectedRange.to.isSouthWestOf(mergedRange.from) && mergeHighlighted) {
currentSelectedRange.setDirection("NE-SW");
}
} else if (sharedBorders.indexOf('bottom') > -1) {
if (currentSelectedRange.to.isNorthEastOf(mergedRange.from) && mergeHighlighted) {
currentSelectedRange.setDirection("SW-NE");
} else if (currentSelectedRange.to.isNorthWestOf(mergedRange.from) && mergeHighlighted) {
currentSelectedRange.setDirection("SE-NW");
}
}
}
var nextPosition = getNextPosition(newDelta),
withinRowspan = sameRowspan(currentMerge, nextPosition),
withinColspan = sameColspan(currentMerge, nextPosition);
if (currentSelectedRange.includesRange(mergedRange) && (mergedRange.includes(nextPosition) || withinRowspan || withinColspan)) {
if (withinRowspan) {
if (newDelta.row < 0) {
newDelta.row -= currentMerge.rowspan - 1;
} else if (newDelta.row > 0) {
newDelta.row += currentMerge.rowspan - 1;
}
}
if (withinColspan) {
if (newDelta.col < 0) {
newDelta.col -= currentMerge.colspan - 1;
} else if (newDelta.col > 0) {
newDelta.col += currentMerge.colspan - 1;
}
}
}
}
}
if (newDelta.row !== 0) {
delta.row = newDelta.row;
}
if (newDelta.col !== 0) {
delta.col = newDelta.col;
}
};
var beforeInit = function() {
var instance = this;
var mergeCellsSetting = instance.getSettings().mergeCells;
if (mergeCellsSetting) {
if (!instance.mergeCells) {
instance.mergeCells = new MergeCells(mergeCellsSetting);
}
}
};
var afterInit = function() {
var instance = this;
if (instance.mergeCells) {
instance.view.wt.wtTable.getCell = function(coords) {
if (instance.getSettings().mergeCells) {
var mergeParent = instance.mergeCells.mergedCellInfoCollection.getInfo(coords.row, coords.col);
if (mergeParent) {
coords = mergeParent;
}
}
return WalkontableTable.prototype.getCell.call(this, coords);
};
}
};
var onBeforeKeyDown = function(event) {
if (!this.mergeCells) {
return;
}
var ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey;
if (ctrlDown) {
if (event.keyCode === 77) {
this.mergeCells.mergeOrUnmergeSelection(this.getSelectedRange());
this.render();
event.stopImmediatePropagation();
}
}
};
var addMergeActionsToContextMenu = function(defaultOptions) {
if (!this.getSettings().mergeCells) {
return;
}
defaultOptions.items.push(Handsontable.ContextMenu.SEPARATOR);
defaultOptions.items.push({
key: 'mergeCells',
name: function() {
var sel = this.getSelected();
var info = this.mergeCells.mergedCellInfoCollection.getInfo(sel[0], sel[1]);
if (info) {
return 'Unmerge cells';
} else {
return 'Merge cells';
}
},
callback: function() {
this.mergeCells.mergeOrUnmergeSelection(this.getSelectedRange());
this.render();
},
disabled: function() {
return false;
}
});
};
var afterRenderer = function(TD, row, col, prop, value, cellProperties) {
if (this.mergeCells) {
this.mergeCells.applySpanProperties(TD, row, col);
}
};
var modifyTransformFactory = function(hook) {
return function(delta) {
var mergeCellsSetting = this.getSettings().mergeCells;
if (mergeCellsSetting) {
var currentSelectedRange = this.getSelectedRange();
this.mergeCells.modifyTransform(hook, currentSelectedRange, delta);
if (hook === "modifyTransformEnd") {
var totalRows = this.countRows();
var totalCols = this.countCols();
if (currentSelectedRange.from.row < 0) {
currentSelectedRange.from.row = 0;
} else if (currentSelectedRange.from.row > 0 && currentSelectedRange.from.row >= totalRows) {
currentSelectedRange.from.row = currentSelectedRange.from - 1;
}
if (currentSelectedRange.from.col < 0) {
currentSelectedRange.from.col = 0;
} else if (currentSelectedRange.from.col > 0 && currentSelectedRange.from.col >= totalCols) {
currentSelectedRange.from.col = totalCols - 1;
}
}
}
};
};
var beforeSetRangeEnd = function(coords) {
this.lastDesiredCoords = null;
var mergeCellsSetting = this.getSettings().mergeCells;
if (mergeCellsSetting) {
var selRange = this.getSelectedRange();
selRange.highlight = new WalkontableCellCoords(selRange.highlight.row, selRange.highlight.col);
selRange.to = coords;
var rangeExpanded = false;
do {
rangeExpanded = false;
for (var i = 0,
ilen = this.mergeCells.mergedCellInfoCollection.length; i < ilen; i++) {
var cellInfo = this.mergeCells.mergedCellInfoCollection[i];
var mergedCellTopLeft = new WalkontableCellCoords(cellInfo.row, cellInfo.col);
var mergedCellBottomRight = new WalkontableCellCoords(cellInfo.row + cellInfo.rowspan - 1, cellInfo.col + cellInfo.colspan - 1);
var mergedCellRange = new WalkontableCellRange(mergedCellTopLeft, mergedCellTopLeft, mergedCellBottomRight);
if (selRange.expandByRange(mergedCellRange)) {
coords.row = selRange.to.row;
coords.col = selRange.to.col;
rangeExpanded = true;
}
}
} while (rangeExpanded);
}
};
var beforeDrawAreaBorders = function(corners, className) {
if (className && className == 'area') {
var mergeCellsSetting = this.getSettings().mergeCells;
if (mergeCellsSetting) {
var selRange = this.getSelectedRange();
var startRange = new WalkontableCellRange(selRange.from, selRange.from, selRange.from);
var stopRange = new WalkontableCellRange(selRange.to, selRange.to, selRange.to);
for (var i = 0,
ilen = this.mergeCells.mergedCellInfoCollection.length; i < ilen; i++) {
var cellInfo = this.mergeCells.mergedCellInfoCollection[i];
var mergedCellTopLeft = new WalkontableCellCoords(cellInfo.row, cellInfo.col);
var mergedCellBottomRight = new WalkontableCellCoords(cellInfo.row + cellInfo.rowspan - 1, cellInfo.col + cellInfo.colspan - 1);
var mergedCellRange = new WalkontableCellRange(mergedCellTopLeft, mergedCellTopLeft, mergedCellBottomRight);
if (startRange.expandByRange(mergedCellRange)) {
corners[0] = startRange.from.row;
corners[1] = startRange.from.col;
}
if (stopRange.expandByRange(mergedCellRange)) {
corners[2] = stopRange.from.row;
corners[3] = stopRange.from.col;
}
}
}
}
};
var afterGetCellMeta = function(row, col, cellProperties) {
var mergeCellsSetting = this.getSettings().mergeCells;
if (mergeCellsSetting) {
var mergeParent = this.mergeCells.mergedCellInfoCollection.getInfo(row, col);
if (mergeParent && (mergeParent.row != row || mergeParent.col != col)) {
cellProperties.copyable = false;
}
}
};
var afterViewportRowCalculatorOverride = function(calc) {
var mergeCellsSetting = this.getSettings().mergeCells;
if (mergeCellsSetting) {
var colCount = this.countCols();
var mergeParent;
for (var c = 0; c < colCount; c++) {
mergeParent = this.mergeCells.mergedCellInfoCollection.getInfo(calc.startRow, c);
if (mergeParent) {
if (mergeParent.row < calc.startRow) {
calc.startRow = mergeParent.row;
return afterViewportRowCalculatorOverride.call(this, calc);
}
}
mergeParent = this.mergeCells.mergedCellInfoCollection.getInfo(calc.endRow, c);
if (mergeParent) {
var mergeEnd = mergeParent.row + mergeParent.rowspan - 1;
if (mergeEnd > calc.endRow) {
calc.endRow = mergeEnd;
return afterViewportRowCalculatorOverride.call(this, calc);
}
}
}
}
};
var afterViewportColumnCalculatorOverride = function(calc) {
var mergeCellsSetting = this.getSettings().mergeCells;
if (mergeCellsSetting) {
var rowCount = this.countRows();
var mergeParent;
for (var r = 0; r < rowCount; r++) {
mergeParent = this.mergeCells.mergedCellInfoCollection.getInfo(r, calc.startColumn);
if (mergeParent) {
if (mergeParent.col < calc.startColumn) {
calc.startColumn = mergeParent.col;
return afterViewportColumnCalculatorOverride.call(this, calc);
}
}
mergeParent = this.mergeCells.mergedCellInfoCollection.getInfo(r, calc.endColumn);
if (mergeParent) {
var mergeEnd = mergeParent.col + mergeParent.colspan - 1;
if (mergeEnd > calc.endColumn) {
calc.endColumn = mergeEnd;
return afterViewportColumnCalculatorOverride.call(this, calc);
}
}
}
}
};
var isMultipleSelection = function(isMultiple) {
if (isMultiple && this.mergeCells) {
var mergedCells = this.mergeCells.mergedCellInfoCollection,
selectionRange = this.getSelectedRange();
for (var group in mergedCells) {
if (selectionRange.highlight.row == mergedCells[group].row && selectionRange.highlight.col == mergedCells[group].col && selectionRange.to.row == mergedCells[group].row + mergedCells[group].rowspan - 1 && selectionRange.to.col == mergedCells[group].col + mergedCells[group].colspan - 1) {
return false;
}
}
}
return isMultiple;
};
function afterAutofillApplyValues(select, drag) {
var mergeCellsSetting = this.getSettings().mergeCells;
if (!mergeCellsSetting || this.selection.isMultiple()) {
return;
}
var info = this.mergeCells.mergedCellInfoCollection.getInfo(select[0], select[1]);
if (info) {
select[0] = info.row;
select[1] = info.col;
select[2] = info.row + info.rowspan - 1;
select[3] = info.col + info.colspan - 1;
}
}
Handsontable.hooks.add('beforeInit', beforeInit);
Handsontable.hooks.add('afterInit', afterInit);
Handsontable.hooks.add('beforeKeyDown', onBeforeKeyDown);
Handsontable.hooks.add('modifyTransformStart', modifyTransformFactory('modifyTransformStart'));
Handsontable.hooks.add('modifyTransformEnd', modifyTransformFactory('modifyTransformEnd'));
Handsontable.hooks.add('beforeSetRangeEnd', beforeSetRangeEnd);
Handsontable.hooks.add('beforeDrawBorders', beforeDrawAreaBorders);
Handsontable.hooks.add('afterIsMultipleSelection', isMultipleSelection);
Handsontable.hooks.add('afterRenderer', afterRenderer);
Handsontable.hooks.add('afterContextMenuDefaultOptions', addMergeActionsToContextMenu);
Handsontable.hooks.add('afterGetCellMeta', afterGetCellMeta);
Handsontable.hooks.add('afterViewportRowCalculatorOverride', afterViewportRowCalculatorOverride);
Handsontable.hooks.add('afterViewportColumnCalculatorOverride', afterViewportColumnCalculatorOverride);
Handsontable.hooks.add('afterAutofillApplyValues', afterAutofillApplyValues);
Handsontable.MergeCells = MergeCells;
//#
},{"./../../3rdparty/walkontable/src/cell/coords.js":5,"./../../3rdparty/walkontable/src/cell/range.js":6,"./../../3rdparty/walkontable/src/table.js":20,"./../../plugins.js":45}],64:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
default: {get: function() {
return $__default;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_dom_46_js__,
$___46__46__47__95_base_46_js__,
$___46__46__47__46__46__47_eventManager_46_js__,
$___46__46__47__46__46__47_plugins_46_js__;
var dom = ($___46__46__47__46__46__47_dom_46_js__ = require("./../../dom.js"), $___46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47_dom_46_js__});
var BasePlugin = ($___46__46__47__95_base_46_js__ = require("./../_base.js"), $___46__46__47__95_base_46_js__ && $___46__46__47__95_base_46_js__.__esModule && $___46__46__47__95_base_46_js__ || {default: $___46__46__47__95_base_46_js__}).default;
var eventManagerObject = ($___46__46__47__46__46__47_eventManager_46_js__ = require("./../../eventManager.js"), $___46__46__47__46__46__47_eventManager_46_js__ && $___46__46__47__46__46__47_eventManager_46_js__.__esModule && $___46__46__47__46__46__47_eventManager_46_js__ || {default: $___46__46__47__46__46__47_eventManager_46_js__}).eventManager;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
var MultipleSelectionHandles = function MultipleSelectionHandles(hotInstance) {
var $__3 = this;
$traceurRuntime.superConstructor($MultipleSelectionHandles).call(this, hotInstance);
this.dragged = [];
this.eventManager = eventManagerObject(this.hot);
this.bindTouchEvents();
this.hot.addHook('afterInit', (function() {
return $__3.init();
}));
};
var $MultipleSelectionHandles = MultipleSelectionHandles;
($traceurRuntime.createClass)(MultipleSelectionHandles, {
init: function() {
this.lastSetCell = null;
Handsontable.plugins.multipleSelectionHandles = new $MultipleSelectionHandles(this.hot);
},
bindTouchEvents: function() {
var _this = this;
function removeFromDragged(query) {
if (_this.dragged.length === 1) {
_this.dragged.splice(0, _this.dragged.length);
return true;
}
var entryPosition = _this.dragged.indexOf(query);
if (entryPosition == -1) {
return false;
} else if (entryPosition === 0) {
_this.dragged = _this.dragged.slice(0, 1);
} else if (entryPosition == 1) {
_this.dragged = _this.dragged.slice(-1);
}
}
this.eventManager.addEventListener(this.hot.rootElement, 'touchstart', function(event) {
var selectedRange;
if (dom.hasClass(event.target, "topLeftSelectionHandle-HitArea")) {
selectedRange = _this.hot.getSelectedRange();
_this.dragged.push("topLeft");
_this.touchStartRange = {
width: selectedRange.getWidth(),
height: selectedRange.getHeight(),
direction: selectedRange.getDirection()
};
event.preventDefault();
return false;
} else if (dom.hasClass(event.target, "bottomRightSelectionHandle-HitArea")) {
selectedRange = _this.hot.getSelectedRange();
_this.dragged.push("bottomRight");
_this.touchStartRange = {
width: selectedRange.getWidth(),
height: selectedRange.getHeight(),
direction: selectedRange.getDirection()
};
event.preventDefault();
return false;
}
});
this.eventManager.addEventListener(this.hot.rootElement, 'touchend', function(event) {
if (dom.hasClass(event.target, "topLeftSelectionHandle-HitArea")) {
removeFromDragged.call(_this, "topLeft");
_this.touchStartRange = void 0;
event.preventDefault();
return false;
} else if (dom.hasClass(event.target, "bottomRightSelectionHandle-HitArea")) {
removeFromDragged.call(_this, "bottomRight");
_this.touchStartRange = void 0;
event.preventDefault();
return false;
}
});
this.eventManager.addEventListener(this.hot.rootElement, 'touchmove', function(event) {
var scrollTop = dom.getWindowScrollTop(),
scrollLeft = dom.getWindowScrollLeft(),
endTarget,
targetCoords,
selectedRange,
rangeWidth,
rangeHeight,
rangeDirection,
newRangeCoords;
if (_this.dragged.length === 0) {
return;
}
endTarget = document.elementFromPoint(event.touches[0].screenX - scrollLeft, event.touches[0].screenY - scrollTop);
if (!endTarget || endTarget === _this.lastSetCell) {
return;
}
if (endTarget.nodeName == "TD" || endTarget.nodeName == "TH") {
targetCoords = _this.hot.getCoords(endTarget);
if (targetCoords.col == -1) {
targetCoords.col = 0;
}
selectedRange = _this.hot.getSelectedRange();
rangeWidth = selectedRange.getWidth();
rangeHeight = selectedRange.getHeight();
rangeDirection = selectedRange.getDirection();
if (rangeWidth == 1 && rangeHeight == 1) {
_this.hot.selection.setRangeEnd(targetCoords);
}
newRangeCoords = _this.getCurrentRangeCoords(selectedRange, targetCoords, _this.touchStartRange.direction, rangeDirection, _this.dragged[0]);
if (newRangeCoords.start !== null) {
_this.hot.selection.setRangeStart(newRangeCoords.start);
}
_this.hot.selection.setRangeEnd(newRangeCoords.end);
_this.lastSetCell = endTarget;
}
event.preventDefault();
});
},
getCurrentRangeCoords: function(selectedRange, currentTouch, touchStartDirection, currentDirection, draggedHandle) {
var topLeftCorner = selectedRange.getTopLeftCorner(),
bottomRightCorner = selectedRange.getBottomRightCorner(),
bottomLeftCorner = selectedRange.getBottomLeftCorner(),
topRightCorner = selectedRange.getTopRightCorner();
var newCoords = {
start: null,
end: null
};
switch (touchStartDirection) {
case "NE-SW":
switch (currentDirection) {
case "NE-SW":
case "NW-SE":
if (draggedHandle == "topLeft") {
newCoords = {
start: new WalkontableCellCoords(currentTouch.row, selectedRange.highlight.col),
end: new WalkontableCellCoords(bottomLeftCorner.row, currentTouch.col)
};
} else {
newCoords = {
start: new WalkontableCellCoords(selectedRange.highlight.row, currentTouch.col),
end: new WalkontableCellCoords(currentTouch.row, topLeftCorner.col)
};
}
break;
case "SE-NW":
if (draggedHandle == "bottomRight") {
newCoords = {
start: new WalkontableCellCoords(bottomRightCorner.row, currentTouch.col),
end: new WalkontableCellCoords(currentTouch.row, topLeftCorner.col)
};
}
break;
}
break;
case "NW-SE":
switch (currentDirection) {
case "NE-SW":
if (draggedHandle == "topLeft") {
newCoords = {
start: currentTouch,
end: bottomLeftCorner
};
} else {
newCoords.end = currentTouch;
}
break;
case "NW-SE":
if (draggedHandle == "topLeft") {
newCoords = {
start: currentTouch,
end: bottomRightCorner
};
} else {
newCoords.end = currentTouch;
}
break;
case "SE-NW":
if (draggedHandle == "topLeft") {
newCoords = {
start: currentTouch,
end: topLeftCorner
};
} else {
newCoords.end = currentTouch;
}
break;
case "SW-NE":
if (draggedHandle == "topLeft") {
newCoords = {
start: currentTouch,
end: topRightCorner
};
} else {
newCoords.end = currentTouch;
}
break;
}
break;
case "SW-NE":
switch (currentDirection) {
case "NW-SE":
if (draggedHandle == "bottomRight") {
newCoords = {
start: new WalkontableCellCoords(currentTouch.row, topLeftCorner.col),
end: new WalkontableCellCoords(bottomLeftCorner.row, currentTouch.col)
};
} else {
newCoords = {
start: new WalkontableCellCoords(topLeftCorner.row, currentTouch.col),
end: new WalkontableCellCoords(currentTouch.row, bottomRightCorner.col)
};
}
break;
case "SW-NE":
if (draggedHandle == "topLeft") {
newCoords = {
start: new WalkontableCellCoords(selectedRange.highlight.row, currentTouch.col),
end: new WalkontableCellCoords(currentTouch.row, bottomRightCorner.col)
};
} else {
newCoords = {
start: new WalkontableCellCoords(currentTouch.row, topLeftCorner.col),
end: new WalkontableCellCoords(topLeftCorner.row, currentTouch.col)
};
}
break;
case "SE-NW":
if (draggedHandle == "bottomRight") {
newCoords = {
start: new WalkontableCellCoords(currentTouch.row, topRightCorner.col),
end: new WalkontableCellCoords(topLeftCorner.row, currentTouch.col)
};
} else if (draggedHandle == "topLeft") {
newCoords = {
start: bottomLeftCorner,
end: currentTouch
};
}
break;
}
break;
case "SE-NW":
switch (currentDirection) {
case "NW-SE":
case "NE-SW":
case "SW-NE":
if (draggedHandle == "topLeft") {
newCoords.end = currentTouch;
}
break;
case "SE-NW":
if (draggedHandle == "topLeft") {
newCoords.end = currentTouch;
} else {
newCoords = {
start: currentTouch,
end: topLeftCorner
};
}
break;
}
break;
}
return newCoords;
},
isDragged: function() {
return this.dragged.length > 0;
}
}, {}, BasePlugin);
var $__default = MultipleSelectionHandles;
registerPlugin('multipleSelectionHandles', MultipleSelectionHandles);
//#
},{"./../../dom.js":27,"./../../eventManager.js":41,"./../../plugins.js":45,"./../_base.js":46}],65:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
ObserveChanges: {get: function() {
return ObserveChanges;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_plugins_46_js__,
$__jsonpatch__;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
var jsonpatch = ($__jsonpatch__ = require("jsonpatch"), $__jsonpatch__ && $__jsonpatch__.__esModule && $__jsonpatch__ || {default: $__jsonpatch__}).default;
;
function ObserveChanges() {}
Handsontable.hooks.add('afterLoadData', init);
Handsontable.hooks.add('afterUpdateSettings', init);
Handsontable.hooks.register('afterChangesObserved');
function init() {
var instance = this;
var pluginEnabled = instance.getSettings().observeChanges;
if (pluginEnabled) {
if (instance.observer) {
destroy.call(instance);
}
createObserver.call(instance);
bindEvents.call(instance);
} else if (!pluginEnabled) {
destroy.call(instance);
}
}
function createObserver() {
var instance = this;
instance.observeChangesActive = true;
instance.pauseObservingChanges = function() {
instance.observeChangesActive = false;
};
instance.resumeObservingChanges = function() {
instance.observeChangesActive = true;
};
instance.observedData = instance.getData();
instance.observer = jsonpatch.observe(instance.observedData, function(patches) {
if (instance.observeChangesActive) {
runHookForOperation.call(instance, patches);
instance.render();
}
instance.runHooks('afterChangesObserved');
});
}
function runHookForOperation(rawPatches) {
var instance = this;
var patches = cleanPatches(rawPatches);
for (var i = 0,
len = patches.length; i < len; i++) {
var patch = patches[i];
var parsedPath = parsePath(patch.path);
switch (patch.op) {
case 'add':
if (isNaN(parsedPath.col)) {
instance.runHooks('afterCreateRow', parsedPath.row);
} else {
instance.runHooks('afterCreateCol', parsedPath.col);
}
break;
case 'remove':
if (isNaN(parsedPath.col)) {
instance.runHooks('afterRemoveRow', parsedPath.row, 1);
} else {
instance.runHooks('afterRemoveCol', parsedPath.col, 1);
}
break;
case 'replace':
instance.runHooks('afterChange', [parsedPath.row, parsedPath.col, null, patch.value], 'external');
break;
}
}
function cleanPatches(rawPatches) {
var patches;
patches = removeLengthRelatedPatches(rawPatches);
patches = removeMultipleAddOrRemoveColPatches(patches);
return patches;
}
function removeMultipleAddOrRemoveColPatches(rawPatches) {
var newOrRemovedColumns = [];
return rawPatches.filter(function(patch) {
var parsedPath = parsePath(patch.path);
if (['add', 'remove'].indexOf(patch.op) != -1 && !isNaN(parsedPath.col)) {
if (newOrRemovedColumns.indexOf(parsedPath.col) != -1) {
return false;
} else {
newOrRemovedColumns.push(parsedPath.col);
}
}
return true;
});
}
function removeLengthRelatedPatches(rawPatches) {
return rawPatches.filter(function(patch) {
return !/[/]length/ig.test(patch.path);
});
}
function parsePath(path) {
var match = path.match(/^\/(\d+)\/?(.*)?$/);
return {
row: parseInt(match[1], 10),
col: /^\d*$/.test(match[2]) ? parseInt(match[2], 10) : match[2]
};
}
}
function destroy() {
var instance = this;
if (instance.observer) {
destroyObserver.call(instance);
unbindEvents.call(instance);
}
}
function destroyObserver() {
var instance = this;
jsonpatch.unobserve(instance.observedData, instance.observer);
delete instance.observeChangesActive;
delete instance.pauseObservingChanges;
delete instance.resumeObservingChanges;
}
function bindEvents() {
var instance = this;
instance.addHook('afterDestroy', destroy);
instance.addHook('afterCreateRow', afterTableAlter);
instance.addHook('afterRemoveRow', afterTableAlter);
instance.addHook('afterCreateCol', afterTableAlter);
instance.addHook('afterRemoveCol', afterTableAlter);
instance.addHook('afterChange', function(changes, source) {
if (source != 'loadData') {
afterTableAlter.call(this);
}
});
}
function unbindEvents() {
var instance = this;
instance.removeHook('afterDestroy', destroy);
instance.removeHook('afterCreateRow', afterTableAlter);
instance.removeHook('afterRemoveRow', afterTableAlter);
instance.removeHook('afterCreateCol', afterTableAlter);
instance.removeHook('afterRemoveCol', afterTableAlter);
instance.removeHook('afterChange', afterTableAlter);
}
function afterTableAlter() {
var instance = this;
instance.pauseObservingChanges();
instance.addHookOnce('afterChangesObserved', function() {
instance.resumeObservingChanges();
});
}
//#
},{"./../../plugins.js":45,"jsonpatch":"jsonpatch"}],66:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
HandsontablePersistentState: {get: function() {
return HandsontablePersistentState;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_plugins_46_js__;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
;
function Storage(prefix) {
var savedKeys;
var saveSavedKeys = function() {
window.localStorage[prefix + '__' + 'persistentStateKeys'] = JSON.stringify(savedKeys);
};
var loadSavedKeys = function() {
var keysJSON = window.localStorage[prefix + '__' + 'persistentStateKeys'];
var keys = typeof keysJSON == 'string' ? JSON.parse(keysJSON) : void 0;
savedKeys = keys ? keys : [];
};
var clearSavedKeys = function() {
savedKeys = [];
saveSavedKeys();
};
loadSavedKeys();
this.saveValue = function(key, value) {
window.localStorage[prefix + '_' + key] = JSON.stringify(value);
if (savedKeys.indexOf(key) == -1) {
savedKeys.push(key);
saveSavedKeys();
}
};
this.loadValue = function(key, defaultValue) {
key = typeof key != 'undefined' ? key : defaultValue;
var value = window.localStorage[prefix + '_' + key];
return typeof value == "undefined" ? void 0 : JSON.parse(value);
};
this.reset = function(key) {
window.localStorage.removeItem(prefix + '_' + key);
};
this.resetAll = function() {
for (var index = 0; index < savedKeys.length; index++) {
window.localStorage.removeItem(prefix + '_' + savedKeys[index]);
}
clearSavedKeys();
};
}
function HandsontablePersistentState() {
var plugin = this;
this.init = function() {
var instance = this,
pluginSettings = instance.getSettings().persistentState;
plugin.enabled = !!(pluginSettings);
if (!plugin.enabled) {
removeHooks.call(instance);
return;
}
if (!instance.storage) {
instance.storage = new Storage(instance.rootElement.id);
}
instance.resetState = plugin.resetValue;
addHooks.call(instance);
};
this.saveValue = function(key, value) {
var instance = this;
instance.storage.saveValue(key, value);
};
this.loadValue = function(key, saveTo) {
var instance = this;
saveTo.value = instance.storage.loadValue(key);
};
this.resetValue = function(key) {
var instance = this;
if (typeof key != 'undefined') {
instance.storage.reset(key);
} else {
instance.storage.resetAll();
}
};
var hooks = {
'persistentStateSave': plugin.saveValue,
'persistentStateLoad': plugin.loadValue,
'persistentStateReset': plugin.resetValue
};
for (var hookName in hooks) {
if (hooks.hasOwnProperty(hookName)) {
Handsontable.hooks.register(hookName);
}
}
function addHooks() {
var instance = this;
for (var hookName in hooks) {
if (hooks.hasOwnProperty(hookName)) {
instance.addHook(hookName, hooks[hookName]);
}
}
}
function removeHooks() {
var instance = this;
for (var hookName in hooks) {
if (hooks.hasOwnProperty(hookName)) {
instance.removeHook(hookName, hooks[hookName]);
}
}
}
}
var htPersistentState = new HandsontablePersistentState();
Handsontable.hooks.add('beforeInit', htPersistentState.init);
Handsontable.hooks.add('afterUpdateSettings', htPersistentState.init);
//#
},{"./../../plugins.js":45}],67:[function(require,module,exports){
"use strict";
var $___46__46__47__46__46__47_dom_46_js__,
$___46__46__47__46__46__47_renderers_46_js__;
var dom = ($___46__46__47__46__46__47_dom_46_js__ = require("./../../dom.js"), $___46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47_dom_46_js__});
var $__0 = ($___46__46__47__46__46__47_renderers_46_js__ = require("./../../renderers.js"), $___46__46__47__46__46__47_renderers_46_js__ && $___46__46__47__46__46__47_renderers_46_js__.__esModule && $___46__46__47__46__46__47_renderers_46_js__ || {default: $___46__46__47__46__46__47_renderers_46_js__}),
registerRenderer = $__0.registerRenderer,
getRenderer = $__0.getRenderer;
Handsontable.Search = function Search(instance) {
this.query = function(queryStr, callback, queryMethod) {
var rowCount = instance.countRows();
var colCount = instance.countCols();
var queryResult = [];
if (!callback) {
callback = Handsontable.Search.global.getDefaultCallback();
}
if (!queryMethod) {
queryMethod = Handsontable.Search.global.getDefaultQueryMethod();
}
for (var rowIndex = 0; rowIndex < rowCount; rowIndex++) {
for (var colIndex = 0; colIndex < colCount; colIndex++) {
var cellData = instance.getDataAtCell(rowIndex, colIndex);
var cellProperties = instance.getCellMeta(rowIndex, colIndex);
var cellCallback = cellProperties.search.callback || callback;
var cellQueryMethod = cellProperties.search.queryMethod || queryMethod;
var testResult = cellQueryMethod(queryStr, cellData);
if (testResult) {
var singleResult = {
row: rowIndex,
col: colIndex,
data: cellData
};
queryResult.push(singleResult);
}
if (cellCallback) {
cellCallback(instance, rowIndex, colIndex, cellData, testResult);
}
}
}
return queryResult;
};
};
Handsontable.Search.DEFAULT_CALLBACK = function(instance, row, col, data, testResult) {
instance.getCellMeta(row, col).isSearchResult = testResult;
};
Handsontable.Search.DEFAULT_QUERY_METHOD = function(query, value) {
if (typeof query == 'undefined' || query == null || !query.toLowerCase || query.length === 0) {
return false;
}
if (typeof value == 'undefined' || value == null) {
return false;
}
return value.toString().toLowerCase().indexOf(query.toLowerCase()) != -1;
};
Handsontable.Search.DEFAULT_SEARCH_RESULT_CLASS = 'htSearchResult';
Handsontable.Search.global = (function() {
var defaultCallback = Handsontable.Search.DEFAULT_CALLBACK;
var defaultQueryMethod = Handsontable.Search.DEFAULT_QUERY_METHOD;
var defaultSearchResultClass = Handsontable.Search.DEFAULT_SEARCH_RESULT_CLASS;
return {
getDefaultCallback: function() {
return defaultCallback;
},
setDefaultCallback: function(newDefaultCallback) {
defaultCallback = newDefaultCallback;
},
getDefaultQueryMethod: function() {
return defaultQueryMethod;
},
setDefaultQueryMethod: function(newDefaultQueryMethod) {
defaultQueryMethod = newDefaultQueryMethod;
},
getDefaultSearchResultClass: function() {
return defaultSearchResultClass;
},
setDefaultSearchResultClass: function(newSearchResultClass) {
defaultSearchResultClass = newSearchResultClass;
}
};
})();
Handsontable.SearchCellDecorator = function(instance, TD, row, col, prop, value, cellProperties) {
var searchResultClass = (cellProperties.search !== null && typeof cellProperties.search == 'object' && cellProperties.search.searchResultClass) || Handsontable.Search.global.getDefaultSearchResultClass();
if (cellProperties.isSearchResult) {
dom.addClass(TD, searchResultClass);
} else {
dom.removeClass(TD, searchResultClass);
}
};
var originalBaseRenderer = getRenderer('base');
registerRenderer('base', function(instance, TD, row, col, prop, value, cellProperties) {
originalBaseRenderer.apply(this, arguments);
Handsontable.SearchCellDecorator.apply(this, arguments);
});
function init() {
var instance = this;
var pluginEnabled = !!instance.getSettings().search;
if (pluginEnabled) {
instance.search = new Handsontable.Search(instance);
} else {
delete instance.search;
}
}
Handsontable.hooks.add('afterInit', init);
Handsontable.hooks.add('afterUpdateSettings', init);
//#
},{"./../../dom.js":27,"./../../renderers.js":70}],68:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
TouchScroll: {get: function() {
return TouchScroll;
}},
__esModule: {value: true}
});
var $___46__46__47__46__46__47_dom_46_js__,
$___46__46__47__95_base_46_js__,
$___46__46__47__46__46__47_plugins_46_js__;
var dom = ($___46__46__47__46__46__47_dom_46_js__ = require("./../../dom.js"), $___46__46__47__46__46__47_dom_46_js__ && $___46__46__47__46__46__47_dom_46_js__.__esModule && $___46__46__47__46__46__47_dom_46_js__ || {default: $___46__46__47__46__46__47_dom_46_js__});
var BasePlugin = ($___46__46__47__95_base_46_js__ = require("./../_base.js"), $___46__46__47__95_base_46_js__ && $___46__46__47__95_base_46_js__.__esModule && $___46__46__47__95_base_46_js__ || {default: $___46__46__47__95_base_46_js__}).default;
var registerPlugin = ($___46__46__47__46__46__47_plugins_46_js__ = require("./../../plugins.js"), $___46__46__47__46__46__47_plugins_46_js__ && $___46__46__47__46__46__47_plugins_46_js__.__esModule && $___46__46__47__46__46__47_plugins_46_js__ || {default: $___46__46__47__46__46__47_plugins_46_js__}).registerPlugin;
var TouchScroll = function TouchScroll(hotInstance) {
var $__2 = this;
$traceurRuntime.superConstructor($TouchScroll).call(this, hotInstance);
this.hot.addHook('afterInit', (function() {
return $__2.init();
}));
this.hot.addHook('afterUpdateSettings', (function() {
return $__2.onAfterUpdateSettings();
}));
this.scrollbars = [];
this.clones = [];
};
var $TouchScroll = TouchScroll;
($traceurRuntime.createClass)(TouchScroll, {
init: function() {
this.registerEvents();
this.onAfterUpdateSettings();
},
onAfterUpdateSettings: function() {
var _this = this;
this.hot.addHookOnce('afterRender', function() {
var wtOverlays = _this.hot.view.wt.wtOverlays;
_this.scrollbars = [];
_this.scrollbars.push(wtOverlays.topOverlay);
_this.scrollbars.push(wtOverlays.leftOverlay);
if (wtOverlays.topLeftCornerOverlay) {
_this.scrollbars.push(wtOverlays.topLeftCornerOverlay);
}
_this.clones = [];
if (wtOverlays.topOverlay.needFullRender) {
_this.clones.push(wtOverlays.topOverlay.clone.wtTable.holder.parentNode);
}
if (wtOverlays.leftOverlay.needFullRender) {
_this.clones.push(wtOverlays.leftOverlay.clone.wtTable.holder.parentNode);
}
if (wtOverlays.topLeftCornerOverlay) {
_this.clones.push(wtOverlays.topLeftCornerOverlay.clone.wtTable.holder.parentNode);
}
});
},
registerEvents: function() {
var $__2 = this;
this.hot.addHook('beforeTouchScroll', (function() {
return $__2.onBeforeTouchScroll();
}));
this.hot.addHook('afterMomentumScroll', (function() {
return $__2.onAfterMomentumScroll();
}));
},
onBeforeTouchScroll: function() {
Handsontable.freezeOverlays = true;
for (var i = 0,
cloneCount = this.clones.length; i < cloneCount; i++) {
dom.addClass(this.clones[i], 'hide-tween');
}
},
onAfterMomentumScroll: function() {
Handsontable.freezeOverlays = false;
var _that = this;
for (var i = 0,
cloneCount = this.clones.length; i < cloneCount; i++) {
dom.removeClass(this.clones[i], 'hide-tween');
}
for (var i$__4 = 0,
cloneCount$__5 = this.clones.length; i$__4 < cloneCount$__5; i$__4++) {
dom.addClass(this.clones[i$__4], 'show-tween');
}
setTimeout(function() {
for (var i = 0,
cloneCount = _that.clones.length; i < cloneCount; i++) {
dom.removeClass(_that.clones[i], 'show-tween');
}
}, 400);
for (var i$__6 = 0,
cloneCount$__7 = this.scrollbars.length; i$__6 < cloneCount$__7; i$__6++) {
this.scrollbars[i$__6].refresh();
this.scrollbars[i$__6].resetFixedPosition();
}
this.hot.view.wt.wtOverlays.syncScrollWithMaster();
}
}, {}, BasePlugin);
;
registerPlugin('touchScroll', TouchScroll);
//#
},{"./../../dom.js":27,"./../../plugins.js":45,"./../_base.js":46}],69:[function(require,module,exports){
"use strict";
var $___46__46__47__46__46__47_helpers_46_js__;
var helper = ($___46__46__47__46__46__47_helpers_46_js__ = require("./../../helpers.js"), $___46__46__47__46__46__47_helpers_46_js__ && $___46__46__47__46__46__47_helpers_46_js__.__esModule && $___46__46__47__46__46__47_helpers_46_js__ || {default: $___46__46__47__46__46__47_helpers_46_js__});
Handsontable.UndoRedo = function(instance) {
var plugin = this;
this.instance = instance;
this.doneActions = [];
this.undoneActions = [];
this.ignoreNewActions = false;
instance.addHook("afterChange", function(changes, origin) {
if (changes) {
var action = new Handsontable.UndoRedo.ChangeAction(changes);
plugin.done(action);
}
});
instance.addHook("afterCreateRow", function(index, amount, createdAutomatically) {
if (createdAutomatically) {
return;
}
var action = new Handsontable.UndoRedo.CreateRowAction(index, amount);
plugin.done(action);
});
instance.addHook("beforeRemoveRow", function(index, amount) {
var originalData = plugin.instance.getData();
index = (originalData.length + index) % originalData.length;
var removedData = originalData.slice(index, index + amount);
var action = new Handsontable.UndoRedo.RemoveRowAction(index, removedData);
plugin.done(action);
});
instance.addHook("afterCreateCol", function(index, amount, createdAutomatically) {
if (createdAutomatically) {
return;
}
var action = new Handsontable.UndoRedo.CreateColumnAction(index, amount);
plugin.done(action);
});
instance.addHook("beforeRemoveCol", function(index, amount) {
var originalData = plugin.instance.getData();
index = (plugin.instance.countCols() + index) % plugin.instance.countCols();
var removedData = [];
for (var i = 0,
len = originalData.length; i < len; i++) {
removedData[i] = originalData[i].slice(index, index + amount);
}
var headers;
if (Array.isArray(instance.getSettings().colHeaders)) {
headers = instance.getSettings().colHeaders.slice(index, index + removedData.length);
}
var action = new Handsontable.UndoRedo.RemoveColumnAction(index, removedData, headers);
plugin.done(action);
});
instance.addHook("beforeCellAlignment", function(stateBefore, range, type, alignment) {
var action = new Handsontable.UndoRedo.CellAlignmentAction(stateBefore, range, type, alignment);
plugin.done(action);
});
};
Handsontable.UndoRedo.prototype.done = function(action) {
if (!this.ignoreNewActions) {
this.doneActions.push(action);
this.undoneActions.length = 0;
}
};
Handsontable.UndoRedo.prototype.undo = function() {
if (this.isUndoAvailable()) {
var action = this.doneActions.pop();
this.ignoreNewActions = true;
var that = this;
action.undo(this.instance, function() {
that.ignoreNewActions = false;
that.undoneActions.push(action);
});
}
};
Handsontable.UndoRedo.prototype.redo = function() {
if (this.isRedoAvailable()) {
var action = this.undoneActions.pop();
this.ignoreNewActions = true;
var that = this;
action.redo(this.instance, function() {
that.ignoreNewActions = false;
that.doneActions.push(action);
});
}
};
Handsontable.UndoRedo.prototype.isUndoAvailable = function() {
return this.doneActions.length > 0;
};
Handsontable.UndoRedo.prototype.isRedoAvailable = function() {
return this.undoneActions.length > 0;
};
Handsontable.UndoRedo.prototype.clear = function() {
this.doneActions.length = 0;
this.undoneActions.length = 0;
};
Handsontable.UndoRedo.Action = function() {};
Handsontable.UndoRedo.Action.prototype.undo = function() {};
Handsontable.UndoRedo.Action.prototype.redo = function() {};
Handsontable.UndoRedo.ChangeAction = function(changes) {
this.changes = changes;
};
helper.inherit(Handsontable.UndoRedo.ChangeAction, Handsontable.UndoRedo.Action);
Handsontable.UndoRedo.ChangeAction.prototype.undo = function(instance, undoneCallback) {
var data = helper.deepClone(this.changes),
emptyRowsAtTheEnd = instance.countEmptyRows(true),
emptyColsAtTheEnd = instance.countEmptyCols(true);
for (var i = 0,
len = data.length; i < len; i++) {
data[i].splice(3, 1);
}
instance.addHookOnce('afterChange', undoneCallback);
instance.setDataAtRowProp(data, null, null, 'undo');
for (var i = 0,
len = data.length; i < len; i++) {
if (instance.getSettings().minSpareRows && data[i][0] + 1 + instance.getSettings().minSpareRows === instance.countRows() && emptyRowsAtTheEnd == instance.getSettings().minSpareRows) {
instance.alter('remove_row', parseInt(data[i][0] + 1, 10), instance.getSettings().minSpareRows);
instance.undoRedo.doneActions.pop();
}
if (instance.getSettings().minSpareCols && data[i][1] + 1 + instance.getSettings().minSpareCols === instance.countCols() && emptyColsAtTheEnd == instance.getSettings().minSpareCols) {
instance.alter('remove_col', parseInt(data[i][1] + 1, 10), instance.getSettings().minSpareCols);
instance.undoRedo.doneActions.pop();
}
}
};
Handsontable.UndoRedo.ChangeAction.prototype.redo = function(instance, onFinishCallback) {
var data = helper.deepClone(this.changes);
for (var i = 0,
len = data.length; i < len; i++) {
data[i].splice(2, 1);
}
instance.addHookOnce('afterChange', onFinishCallback);
instance.setDataAtRowProp(data, null, null, 'redo');
};
Handsontable.UndoRedo.CreateRowAction = function(index, amount) {
this.index = index;
this.amount = amount;
};
helper.inherit(Handsontable.UndoRedo.CreateRowAction, Handsontable.UndoRedo.Action);
Handsontable.UndoRedo.CreateRowAction.prototype.undo = function(instance, undoneCallback) {
var rowCount = instance.countRows(),
minSpareRows = instance.getSettings().minSpareRows;
if (this.index >= rowCount && this.index - minSpareRows < rowCount) {
this.index -= minSpareRows;
}
instance.addHookOnce('afterRemoveRow', undoneCallback);
instance.alter('remove_row', this.index, this.amount);
};
Handsontable.UndoRedo.CreateRowAction.prototype.redo = function(instance, redoneCallback) {
instance.addHookOnce('afterCreateRow', redoneCallback);
instance.alter('insert_row', this.index + 1, this.amount);
};
Handsontable.UndoRedo.RemoveRowAction = function(index, data) {
this.index = index;
this.data = data;
};
helper.inherit(Handsontable.UndoRedo.RemoveRowAction, Handsontable.UndoRedo.Action);
Handsontable.UndoRedo.RemoveRowAction.prototype.undo = function(instance, undoneCallback) {
var spliceArgs = [this.index, 0];
Array.prototype.push.apply(spliceArgs, this.data);
Array.prototype.splice.apply(instance.getData(), spliceArgs);
instance.addHookOnce('afterRender', undoneCallback);
instance.render();
};
Handsontable.UndoRedo.RemoveRowAction.prototype.redo = function(instance, redoneCallback) {
instance.addHookOnce('afterRemoveRow', redoneCallback);
instance.alter('remove_row', this.index, this.data.length);
};
Handsontable.UndoRedo.CreateColumnAction = function(index, amount) {
this.index = index;
this.amount = amount;
};
helper.inherit(Handsontable.UndoRedo.CreateColumnAction, Handsontable.UndoRedo.Action);
Handsontable.UndoRedo.CreateColumnAction.prototype.undo = function(instance, undoneCallback) {
instance.addHookOnce('afterRemoveCol', undoneCallback);
instance.alter('remove_col', this.index, this.amount);
};
Handsontable.UndoRedo.CreateColumnAction.prototype.redo = function(instance, redoneCallback) {
instance.addHookOnce('afterCreateCol', redoneCallback);
instance.alter('insert_col', this.index + 1, this.amount);
};
Handsontable.UndoRedo.CellAlignmentAction = function(stateBefore, range, type, alignment) {
this.stateBefore = stateBefore;
this.range = range;
this.type = type;
this.alignment = alignment;
};
Handsontable.UndoRedo.CellAlignmentAction.prototype.undo = function(instance, undoneCallback) {
if (!instance.contextMenu) {
return;
}
for (var row = this.range.from.row; row <= this.range.to.row; row++) {
for (var col = this.range.from.col; col <= this.range.to.col; col++) {
instance.setCellMeta(row, col, 'className', this.stateBefore[row][col] || ' htLeft');
}
}
instance.addHookOnce('afterRender', undoneCallback);
instance.render();
};
Handsontable.UndoRedo.CellAlignmentAction.prototype.redo = function(instance, undoneCallback) {
if (!instance.contextMenu) {
return;
}
for (var row = this.range.from.row; row <= this.range.to.row; row++) {
for (var col = this.range.from.col; col <= this.range.to.col; col++) {
instance.contextMenu.align.call(instance, this.range, this.type, this.alignment);
}
}
instance.addHookOnce('afterRender', undoneCallback);
instance.render();
};
Handsontable.UndoRedo.RemoveColumnAction = function(index, data, headers) {
this.index = index;
this.data = data;
this.amount = this.data[0].length;
this.headers = headers;
};
helper.inherit(Handsontable.UndoRedo.RemoveColumnAction, Handsontable.UndoRedo.Action);
Handsontable.UndoRedo.RemoveColumnAction.prototype.undo = function(instance, undoneCallback) {
var row,
spliceArgs;
for (var i = 0,
len = instance.getData().length; i < len; i++) {
row = instance.getSourceDataAtRow(i);
spliceArgs = [this.index, 0];
Array.prototype.push.apply(spliceArgs, this.data[i]);
Array.prototype.splice.apply(row, spliceArgs);
}
if (typeof this.headers != 'undefined') {
spliceArgs = [this.index, 0];
Array.prototype.push.apply(spliceArgs, this.headers);
Array.prototype.splice.apply(instance.getSettings().colHeaders, spliceArgs);
}
instance.addHookOnce('afterRender', undoneCallback);
instance.render();
};
Handsontable.UndoRedo.RemoveColumnAction.prototype.redo = function(instance, redoneCallback) {
instance.addHookOnce('afterRemoveCol', redoneCallback);
instance.alter('remove_col', this.index, this.amount);
};
function init() {
var instance = this;
var pluginEnabled = typeof instance.getSettings().undo == 'undefined' || instance.getSettings().undo;
if (pluginEnabled) {
if (!instance.undoRedo) {
instance.undoRedo = new Handsontable.UndoRedo(instance);
exposeUndoRedoMethods(instance);
instance.addHook('beforeKeyDown', onBeforeKeyDown);
instance.addHook('afterChange', onAfterChange);
}
} else {
if (instance.undoRedo) {
delete instance.undoRedo;
removeExposedUndoRedoMethods(instance);
instance.removeHook('beforeKeyDown', onBeforeKeyDown);
instance.removeHook('afterChange', onAfterChange);
}
}
}
function onBeforeKeyDown(event) {
var instance = this;
var ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey;
if (ctrlDown) {
if (event.keyCode === 89 || (event.shiftKey && event.keyCode === 90)) {
instance.undoRedo.redo();
event.stopImmediatePropagation();
} else if (event.keyCode === 90) {
instance.undoRedo.undo();
event.stopImmediatePropagation();
}
}
}
function onAfterChange(changes, source) {
var instance = this;
if (source == 'loadData') {
return instance.undoRedo.clear();
}
}
function exposeUndoRedoMethods(instance) {
instance.undo = function() {
return instance.undoRedo.undo();
};
instance.redo = function() {
return instance.undoRedo.redo();
};
instance.isUndoAvailable = function() {
return instance.undoRedo.isUndoAvailable();
};
instance.isRedoAvailable = function() {
return instance.undoRedo.isRedoAvailable();
};
instance.clearUndo = function() {
return instance.undoRedo.clear();
};
}
function removeExposedUndoRedoMethods(instance) {
delete instance.undo;
delete instance.redo;
delete instance.isUndoAvailable;
delete instance.isRedoAvailable;
delete instance.clearUndo;
}
Handsontable.hooks.add('afterInit', init);
Handsontable.hooks.add('afterUpdateSettings', init);
//#
},{"./../../helpers.js":42}],70:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
registerRenderer: {get: function() {
return registerRenderer;
}},
getRenderer: {get: function() {
return getRenderer;
}},
hasRenderer: {get: function() {
return hasRenderer;
}},
__esModule: {value: true}
});
var $__helpers_46_js__;
var helper = ($__helpers_46_js__ = require("./helpers.js"), $__helpers_46_js__ && $__helpers_46_js__.__esModule && $__helpers_46_js__ || {default: $__helpers_46_js__});
;
var registeredRenderers = {};
Handsontable.renderers = Handsontable.renderers || {};
Handsontable.renderers.registerRenderer = registerRenderer;
Handsontable.renderers.getRenderer = getRenderer;
function registerRenderer(rendererName, rendererFunction) {
var registerName;
registeredRenderers[rendererName] = rendererFunction;
registerName = helper.toUpperCaseFirst(rendererName) + 'Renderer';
Handsontable.renderers[registerName] = rendererFunction;
Handsontable[registerName] = rendererFunction;
}
function getRenderer(rendererName) {
if (typeof rendererName == 'function') {
return rendererName;
}
if (typeof rendererName != 'string') {
throw Error('Only strings and functions can be passed as "renderer" parameter');
}
if (!(rendererName in registeredRenderers)) {
throw Error('No editor registered under name "' + rendererName + '"');
}
return registeredRenderers[rendererName];
}
function hasRenderer(rendererName) {
return rendererName in registeredRenderers;
}
//#
},{"./helpers.js":42}],71:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
cellDecorator: {get: function() {
return cellDecorator;
}},
__esModule: {value: true}
});
var $___46__46__47_dom_46_js__,
$___46__46__47_renderers_46_js__;
var dom = ($___46__46__47_dom_46_js__ = require("./../dom.js"), $___46__46__47_dom_46_js__ && $___46__46__47_dom_46_js__.__esModule && $___46__46__47_dom_46_js__ || {default: $___46__46__47_dom_46_js__});
var registerRenderer = ($___46__46__47_renderers_46_js__ = require("./../renderers.js"), $___46__46__47_renderers_46_js__ && $___46__46__47_renderers_46_js__.__esModule && $___46__46__47_renderers_46_js__ || {default: $___46__46__47_renderers_46_js__}).registerRenderer;
;
registerRenderer('base', cellDecorator);
Handsontable.renderers.cellDecorator = cellDecorator;
function cellDecorator(instance, TD, row, col, prop, value, cellProperties) {
if (cellProperties.className) {
if (TD.className) {
TD.className = TD.className + " " + cellProperties.className;
} else {
TD.className = cellProperties.className;
}
}
if (cellProperties.readOnly) {
dom.addClass(TD, cellProperties.readOnlyCellClassName);
}
if (cellProperties.valid === false && cellProperties.invalidCellClassName) {
dom.addClass(TD, cellProperties.invalidCellClassName);
} else {
dom.removeClass(TD, cellProperties.invalidCellClassName);
}
if (cellProperties.wordWrap === false && cellProperties.noWordWrapClassName) {
dom.addClass(TD, cellProperties.noWordWrapClassName);
}
if (!value && cellProperties.placeholder) {
dom.addClass(TD, cellProperties.placeholderCellClassName);
}
}
//#
},{"./../dom.js":27,"./../renderers.js":70}],72:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
autocompleteRenderer: {get: function() {
return autocompleteRenderer;
}},
__esModule: {value: true}
});
var $___46__46__47_dom_46_js__,
$___46__46__47_eventManager_46_js__,
$___46__46__47_renderers_46_js__,
$___46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__;
var dom = ($___46__46__47_dom_46_js__ = require("./../dom.js"), $___46__46__47_dom_46_js__ && $___46__46__47_dom_46_js__.__esModule && $___46__46__47_dom_46_js__ || {default: $___46__46__47_dom_46_js__});
var eventManagerObject = ($___46__46__47_eventManager_46_js__ = require("./../eventManager.js"), $___46__46__47_eventManager_46_js__ && $___46__46__47_eventManager_46_js__.__esModule && $___46__46__47_eventManager_46_js__ || {default: $___46__46__47_eventManager_46_js__}).eventManager;
var $__1 = ($___46__46__47_renderers_46_js__ = require("./../renderers.js"), $___46__46__47_renderers_46_js__ && $___46__46__47_renderers_46_js__.__esModule && $___46__46__47_renderers_46_js__ || {default: $___46__46__47_renderers_46_js__}),
getRenderer = $__1.getRenderer,
registerRenderer = $__1.registerRenderer;
var WalkontableCellCoords = ($___46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ = require("./../3rdparty/walkontable/src/cell/coords.js"), $___46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ && $___46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__.__esModule && $___46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ || {default: $___46__46__47_3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__}).WalkontableCellCoords;
;
var clonableWRAPPER = document.createElement('DIV');
clonableWRAPPER.className = 'htAutocompleteWrapper';
var clonableARROW = document.createElement('DIV');
clonableARROW.className = 'htAutocompleteArrow';
clonableARROW.appendChild(document.createTextNode(String.fromCharCode(9660)));
var wrapTdContentWithWrapper = function(TD, WRAPPER) {
WRAPPER.innerHTML = TD.innerHTML;
dom.empty(TD);
TD.appendChild(WRAPPER);
};
registerRenderer('autocomplete', autocompleteRenderer);
function autocompleteRenderer(instance, TD, row, col, prop, value, cellProperties) {
var WRAPPER = clonableWRAPPER.cloneNode(true);
var ARROW = clonableARROW.cloneNode(true);
getRenderer('text')(instance, TD, row, col, prop, value, cellProperties);
TD.appendChild(ARROW);
dom.addClass(TD, 'htAutocomplete');
if (!TD.firstChild) {
TD.appendChild(document.createTextNode(String.fromCharCode(160)));
}
if (!instance.acArrowListener) {
var eventManager = eventManagerObject(instance);
instance.acArrowListener = function(event) {
if (dom.hasClass(event.target, 'htAutocompleteArrow')) {
instance.view.wt.getSetting('onCellDblClick', null, new WalkontableCellCoords(row, col), TD);
}
};
eventManager.addEventListener(instance.rootElement, 'mousedown', instance.acArrowListener);
instance.addHookOnce('afterDestroy', function() {
eventManager.clear();
});
}
}
//#
},{"./../3rdparty/walkontable/src/cell/coords.js":5,"./../dom.js":27,"./../eventManager.js":41,"./../renderers.js":70}],73:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
checkboxRenderer: {get: function() {
return checkboxRenderer;
}},
__esModule: {value: true}
});
var $___46__46__47_dom_46_js__,
$___46__46__47_helpers_46_js__,
$___46__46__47_eventManager_46_js__,
$___46__46__47_renderers_46_js__;
var dom = ($___46__46__47_dom_46_js__ = require("./../dom.js"), $___46__46__47_dom_46_js__ && $___46__46__47_dom_46_js__.__esModule && $___46__46__47_dom_46_js__ || {default: $___46__46__47_dom_46_js__});
var helper = ($___46__46__47_helpers_46_js__ = require("./../helpers.js"), $___46__46__47_helpers_46_js__ && $___46__46__47_helpers_46_js__.__esModule && $___46__46__47_helpers_46_js__ || {default: $___46__46__47_helpers_46_js__});
var EventManager = ($___46__46__47_eventManager_46_js__ = require("./../eventManager.js"), $___46__46__47_eventManager_46_js__ && $___46__46__47_eventManager_46_js__.__esModule && $___46__46__47_eventManager_46_js__ || {default: $___46__46__47_eventManager_46_js__}).EventManager;
var $__1 = ($___46__46__47_renderers_46_js__ = require("./../renderers.js"), $___46__46__47_renderers_46_js__ && $___46__46__47_renderers_46_js__.__esModule && $___46__46__47_renderers_46_js__ || {default: $___46__46__47_renderers_46_js__}),
getRenderer = $__1.getRenderer,
registerRenderer = $__1.registerRenderer;
var clonableINPUT = document.createElement('INPUT');
clonableINPUT.className = 'htCheckboxRendererInput';
clonableINPUT.type = 'checkbox';
clonableINPUT.setAttribute('autocomplete', 'off');
var isListeningKeyDownEvent = new WeakMap();
function checkboxRenderer(instance, TD, row, col, prop, value, cellProperties) {
var eventManager = new EventManager(instance);
var input = clonableINPUT.cloneNode(false);
if (typeof cellProperties.checkedTemplate === 'undefined') {
cellProperties.checkedTemplate = true;
}
if (typeof cellProperties.uncheckedTemplate === 'undefined') {
cellProperties.uncheckedTemplate = false;
}
dom.empty(TD);
if (value === cellProperties.checkedTemplate || helper.equalsIgnoreCase(value, cellProperties.checkedTemplate)) {
input.checked = true;
TD.appendChild(input);
} else if (value === cellProperties.uncheckedTemplate || helper.equalsIgnoreCase(value, cellProperties.uncheckedTemplate)) {
TD.appendChild(input);
} else if (value === null) {
dom.addClass(input, 'noValue');
TD.appendChild(input);
} else {
dom.fastInnerText(TD, '#bad value#');
}
if (cellProperties.readOnly) {
eventManager.addEventListener(input, 'click', preventDefault);
} else {
eventManager.addEventListener(input, 'mousedown', stopPropagation);
eventManager.addEventListener(input, 'mouseup', stopPropagation);
eventManager.addEventListener(input, 'change', (function(event) {
instance.setDataAtRowProp(row, prop, event.target.checked ? cellProperties.checkedTemplate : cellProperties.uncheckedTemplate);
}));
}
if (!isListeningKeyDownEvent.has(instance)) {
isListeningKeyDownEvent.set(instance, true);
instance.addHook('beforeKeyDown', onBeforeKeyDown);
}
function onBeforeKeyDown(event) {
var allowedKeys = [helper.keyCode.SPACE, helper.keyCode.ENTER, helper.keyCode.DELETE, helper.keyCode.BACKSPACE];
dom.enableImmediatePropagation(event);
if (allowedKeys.indexOf(event.keyCode) !== -1 && !event.isImmediatePropagationStopped()) {
eachSelectedCheckboxCell(function() {
event.stopImmediatePropagation();
event.preventDefault();
});
}
if (event.keyCode == helper.keyCode.SPACE || event.keyCode == helper.keyCode.ENTER) {
toggleSelected();
}
if (event.keyCode == helper.keyCode.DELETE || event.keyCode == helper.keyCode.BACKSPACE) {
toggleSelected(false);
}
}
function toggleSelected() {
var checked = arguments[0] !== (void 0) ? arguments[0] : null;
eachSelectedCheckboxCell(function(checkboxes) {
for (var i = 0,
len = checkboxes.length; i < len; i++) {
toggleCheckbox(checkboxes[i], checked);
}
});
}
function toggleCheckbox(checkbox) {
var checked = arguments[1] !== (void 0) ? arguments[1] : null;
if (checked === null) {
checkbox.checked = !checkbox.checked;
} else {
checkbox.checked = checked;
}
eventManager.fireEvent(checkbox, 'change');
}
function eachSelectedCheckboxCell(callback) {
var selRange = instance.getSelectedRange();
var topLeft = selRange.getTopLeftCorner();
var bottomRight = selRange.getBottomRightCorner();
for (var row = topLeft.row; row <= bottomRight.row; row++) {
for (var col = topLeft.col; col <= bottomRight.col; col++) {
var cell = instance.getCell(row, col);
var cellProperties$__2 = instance.getCellMeta(row, col);
var checkboxes = cell.querySelectorAll('input[type=checkbox]');
if (checkboxes.length > 0 && !cellProperties$__2.readOnly) {
callback(checkboxes);
}
}
}
}
function preventDefault(event) {
event.preventDefault();
}
function stopPropagation(event) {
helper.stopPropagation(event);
}
}
;
registerRenderer('checkbox', checkboxRenderer);
//#
},{"./../dom.js":27,"./../eventManager.js":41,"./../helpers.js":42,"./../renderers.js":70}],74:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
htmlRenderer: {get: function() {
return htmlRenderer;
}},
__esModule: {value: true}
});
var $___46__46__47_dom_46_js__,
$___46__46__47_renderers_46_js__;
var dom = ($___46__46__47_dom_46_js__ = require("./../dom.js"), $___46__46__47_dom_46_js__ && $___46__46__47_dom_46_js__.__esModule && $___46__46__47_dom_46_js__ || {default: $___46__46__47_dom_46_js__});
var $__0 = ($___46__46__47_renderers_46_js__ = require("./../renderers.js"), $___46__46__47_renderers_46_js__ && $___46__46__47_renderers_46_js__.__esModule && $___46__46__47_renderers_46_js__ || {default: $___46__46__47_renderers_46_js__}),
getRenderer = $__0.getRenderer,
registerRenderer = $__0.registerRenderer;
;
registerRenderer('html', htmlRenderer);
function htmlRenderer(instance, TD, row, col, prop, value, cellProperties) {
getRenderer('base').apply(this, arguments);
dom.fastInnerHTML(TD, value);
}
//#
},{"./../dom.js":27,"./../renderers.js":70}],75:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
numericRenderer: {get: function() {
return numericRenderer;
}},
__esModule: {value: true}
});
var $___46__46__47_dom_46_js__,
$___46__46__47_helpers_46_js__,
$__numeral__,
$___46__46__47_renderers_46_js__;
var dom = ($___46__46__47_dom_46_js__ = require("./../dom.js"), $___46__46__47_dom_46_js__ && $___46__46__47_dom_46_js__.__esModule && $___46__46__47_dom_46_js__ || {default: $___46__46__47_dom_46_js__});
var helper = ($___46__46__47_helpers_46_js__ = require("./../helpers.js"), $___46__46__47_helpers_46_js__ && $___46__46__47_helpers_46_js__.__esModule && $___46__46__47_helpers_46_js__ || {default: $___46__46__47_helpers_46_js__});
var numeral = ($__numeral__ = require("numeral"), $__numeral__ && $__numeral__.__esModule && $__numeral__ || {default: $__numeral__}).default;
var $__1 = ($___46__46__47_renderers_46_js__ = require("./../renderers.js"), $___46__46__47_renderers_46_js__ && $___46__46__47_renderers_46_js__.__esModule && $___46__46__47_renderers_46_js__ || {default: $___46__46__47_renderers_46_js__}),
getRenderer = $__1.getRenderer,
registerRenderer = $__1.registerRenderer;
;
registerRenderer('numeric', numericRenderer);
function numericRenderer(instance, TD, row, col, prop, value, cellProperties) {
if (helper.isNumeric(value)) {
if (typeof cellProperties.language !== 'undefined') {
numeral.language(cellProperties.language);
}
value = numeral(value).format(cellProperties.format || '0');
dom.addClass(TD, 'htNumeric');
}
getRenderer('text')(instance, TD, row, col, prop, value, cellProperties);
}
//#
},{"./../dom.js":27,"./../helpers.js":42,"./../renderers.js":70,"numeral":"numeral"}],76:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
passwordRenderer: {get: function() {
return passwordRenderer;
}},
__esModule: {value: true}
});
var $___46__46__47_dom_46_js__,
$___46__46__47_renderers_46_js__;
var dom = ($___46__46__47_dom_46_js__ = require("./../dom.js"), $___46__46__47_dom_46_js__ && $___46__46__47_dom_46_js__.__esModule && $___46__46__47_dom_46_js__ || {default: $___46__46__47_dom_46_js__});
var $__0 = ($___46__46__47_renderers_46_js__ = require("./../renderers.js"), $___46__46__47_renderers_46_js__ && $___46__46__47_renderers_46_js__.__esModule && $___46__46__47_renderers_46_js__ || {default: $___46__46__47_renderers_46_js__}),
getRenderer = $__0.getRenderer,
registerRenderer = $__0.registerRenderer;
;
registerRenderer('password', passwordRenderer);
function passwordRenderer(instance, TD, row, col, prop, value, cellProperties) {
getRenderer('text').apply(this, arguments);
value = TD.innerHTML;
var hash;
var hashLength = cellProperties.hashLength || value.length;
var hashSymbol = cellProperties.hashSymbol || '*';
for (hash = ''; hash.split(hashSymbol).length - 1 < hashLength; hash += hashSymbol) {}
dom.fastInnerHTML(TD, hash);
}
//#
},{"./../dom.js":27,"./../renderers.js":70}],77:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
textRenderer: {get: function() {
return textRenderer;
}},
__esModule: {value: true}
});
var $___46__46__47_dom_46_js__,
$___46__46__47_helpers_46_js__,
$___46__46__47_renderers_46_js__;
var dom = ($___46__46__47_dom_46_js__ = require("./../dom.js"), $___46__46__47_dom_46_js__ && $___46__46__47_dom_46_js__.__esModule && $___46__46__47_dom_46_js__ || {default: $___46__46__47_dom_46_js__});
var helper = ($___46__46__47_helpers_46_js__ = require("./../helpers.js"), $___46__46__47_helpers_46_js__ && $___46__46__47_helpers_46_js__.__esModule && $___46__46__47_helpers_46_js__ || {default: $___46__46__47_helpers_46_js__});
var $__0 = ($___46__46__47_renderers_46_js__ = require("./../renderers.js"), $___46__46__47_renderers_46_js__ && $___46__46__47_renderers_46_js__.__esModule && $___46__46__47_renderers_46_js__ || {default: $___46__46__47_renderers_46_js__}),
getRenderer = $__0.getRenderer,
registerRenderer = $__0.registerRenderer;
;
registerRenderer('text', textRenderer);
function textRenderer(instance, TD, row, col, prop, value, cellProperties) {
getRenderer('base').apply(this, arguments);
if (!value && cellProperties.placeholder) {
value = cellProperties.placeholder;
}
var escaped = helper.stringify(value);
if (!instance.getSettings().trimWhitespace) {
escaped = escaped.replace(/ /g, String.fromCharCode(160));
}
if (cellProperties.rendererTemplate) {
dom.empty(TD);
var TEMPLATE = document.createElement('TEMPLATE');
TEMPLATE.setAttribute('bind', '{{}}');
TEMPLATE.innerHTML = cellProperties.rendererTemplate;
HTMLTemplateElement.decorate(TEMPLATE);
TEMPLATE.model = instance.getSourceDataAtRow(row);
TD.appendChild(TEMPLATE);
} else {
dom.fastInnerText(TD, escaped);
}
}
//#
},{"./../dom.js":27,"./../helpers.js":42,"./../renderers.js":70}],78:[function(require,module,exports){
"use strict";
if (!Array.prototype.filter) {
Array.prototype.filter = function(fun, thisp) {
"use strict";
if (typeof this === "undefined" || this === null) {
throw new TypeError();
}
if (typeof fun !== "function") {
throw new TypeError();
}
thisp = thisp || this;
if (isNodeList(thisp)) {
thisp = convertNodeListToArray(thisp);
}
var len = thisp.length,
res = [],
i,
val;
for (i = 0; i < len; i += 1) {
if (thisp.hasOwnProperty(i)) {
val = thisp[i];
if (fun.call(thisp, val, i, thisp)) {
res.push(val);
}
}
}
return res;
function isNodeList(object) {
return /NodeList/i.test(object.item);
}
function convertNodeListToArray(nodeList) {
var array = [];
for (var i = 0,
len = nodeList.length; i < len; i++) {
array[i] = nodeList[i];
}
return array;
}
};
}
//#
},{}],79:[function(require,module,exports){
"use strict";
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(elt) {
var len = this.length >>> 0;
var from = Number(arguments[1]) || 0;
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
if (from < 0) {
from += len;
}
for (; from < len; from++) {
if (from in this && this[from] === elt) {
return from;
}
}
return -1;
};
}
//#
},{}],80:[function(require,module,exports){
"use strict";
if (!Array.isArray) {
Array.isArray = function(obj) {
return Object.prototype.toString.call(obj) == '[object Array]';
};
}
//#
},{}],81:[function(require,module,exports){
"use strict";
(function(global) {
'use strict';
if (global.$traceurRuntime) {
return;
}
var $Object = Object;
var $TypeError = TypeError;
var $create = $Object.create;
var $defineProperties = $Object.defineProperties;
var $defineProperty = $Object.defineProperty;
var $freeze = $Object.freeze;
var $getOwnPropertyDescriptor = $Object.getOwnPropertyDescriptor;
var $getOwnPropertyNames = $Object.getOwnPropertyNames;
var $keys = $Object.keys;
var $hasOwnProperty = $Object.prototype.hasOwnProperty;
var $toString = $Object.prototype.toString;
var $preventExtensions = Object.preventExtensions;
var $seal = Object.seal;
var $isExtensible = Object.isExtensible;
function nonEnum(value) {
return {
configurable: true,
enumerable: false,
value: value,
writable: true
};
}
var method = nonEnum;
var counter = 0;
function newUniqueString() {
return '__$' + Math.floor(Math.random() * 1e9) + '$' + ++counter + '$__';
}
var symbolInternalProperty = newUniqueString();
var symbolDescriptionProperty = newUniqueString();
var symbolDataProperty = newUniqueString();
var symbolValues = $create(null);
var privateNames = $create(null);
function isPrivateName(s) {
return privateNames[s];
}
function createPrivateName() {
var s = newUniqueString();
privateNames[s] = true;
return s;
}
function isShimSymbol(symbol) {
return typeof symbol === 'object' && symbol instanceof SymbolValue;
}
function typeOf(v) {
if (isShimSymbol(v))
return 'symbol';
return typeof v;
}
function Symbol(description) {
var value = new SymbolValue(description);
if (!(this instanceof Symbol))
return value;
throw new TypeError('Symbol cannot be new\'ed');
}
$defineProperty(Symbol.prototype, 'constructor', nonEnum(Symbol));
$defineProperty(Symbol.prototype, 'toString', method(function() {
var symbolValue = this[symbolDataProperty];
if (!getOption('symbols'))
return symbolValue[symbolInternalProperty];
if (!symbolValue)
throw TypeError('Conversion from symbol to string');
var desc = symbolValue[symbolDescriptionProperty];
if (desc === undefined)
desc = '';
return 'Symbol(' + desc + ')';
}));
$defineProperty(Symbol.prototype, 'valueOf', method(function() {
var symbolValue = this[symbolDataProperty];
if (!symbolValue)
throw TypeError('Conversion from symbol to string');
if (!getOption('symbols'))
return symbolValue[symbolInternalProperty];
return symbolValue;
}));
function SymbolValue(description) {
var key = newUniqueString();
$defineProperty(this, symbolDataProperty, {value: this});
$defineProperty(this, symbolInternalProperty, {value: key});
$defineProperty(this, symbolDescriptionProperty, {value: description});
freeze(this);
symbolValues[key] = this;
}
$defineProperty(SymbolValue.prototype, 'constructor', nonEnum(Symbol));
$defineProperty(SymbolValue.prototype, 'toString', {
value: Symbol.prototype.toString,
enumerable: false
});
$defineProperty(SymbolValue.prototype, 'valueOf', {
value: Symbol.prototype.valueOf,
enumerable: false
});
var hashProperty = createPrivateName();
var hashPropertyDescriptor = {value: undefined};
var hashObjectProperties = {
hash: {value: undefined},
self: {value: undefined}
};
var hashCounter = 0;
function getOwnHashObject(object) {
var hashObject = object[hashProperty];
if (hashObject && hashObject.self === object)
return hashObject;
if ($isExtensible(object)) {
hashObjectProperties.hash.value = hashCounter++;
hashObjectProperties.self.value = object;
hashPropertyDescriptor.value = $create(null, hashObjectProperties);
$defineProperty(object, hashProperty, hashPropertyDescriptor);
return hashPropertyDescriptor.value;
}
return undefined;
}
function freeze(object) {
getOwnHashObject(object);
return $freeze.apply(this, arguments);
}
function preventExtensions(object) {
getOwnHashObject(object);
return $preventExtensions.apply(this, arguments);
}
function seal(object) {
getOwnHashObject(object);
return $seal.apply(this, arguments);
}
freeze(SymbolValue.prototype);
function isSymbolString(s) {
return symbolValues[s] || privateNames[s];
}
function toProperty(name) {
if (isShimSymbol(name))
return name[symbolInternalProperty];
return name;
}
function removeSymbolKeys(array) {
var rv = [];
for (var i = 0; i < array.length; i++) {
if (!isSymbolString(array[i])) {
rv.push(array[i]);
}
}
return rv;
}
function getOwnPropertyNames(object) {
return removeSymbolKeys($getOwnPropertyNames(object));
}
function keys(object) {
return removeSymbolKeys($keys(object));
}
function getOwnPropertySymbols(object) {
var rv = [];
var names = $getOwnPropertyNames(object);
for (var i = 0; i < names.length; i++) {
var symbol = symbolValues[names[i]];
if (symbol) {
rv.push(symbol);
}
}
return rv;
}
function getOwnPropertyDescriptor(object, name) {
return $getOwnPropertyDescriptor(object, toProperty(name));
}
function hasOwnProperty(name) {
return $hasOwnProperty.call(this, toProperty(name));
}
function getOption(name) {
return global.traceur && global.traceur.options[name];
}
function defineProperty(object, name, descriptor) {
if (isShimSymbol(name)) {
name = name[symbolInternalProperty];
}
$defineProperty(object, name, descriptor);
return object;
}
function polyfillObject(Object) {
$defineProperty(Object, 'defineProperty', {value: defineProperty});
$defineProperty(Object, 'getOwnPropertyNames', {value: getOwnPropertyNames});
$defineProperty(Object, 'getOwnPropertyDescriptor', {value: getOwnPropertyDescriptor});
$defineProperty(Object.prototype, 'hasOwnProperty', {value: hasOwnProperty});
$defineProperty(Object, 'freeze', {value: freeze});
$defineProperty(Object, 'preventExtensions', {value: preventExtensions});
$defineProperty(Object, 'seal', {value: seal});
$defineProperty(Object, 'keys', {value: keys});
}
function exportStar(object) {
for (var i = 1; i < arguments.length; i++) {
var names = $getOwnPropertyNames(arguments[i]);
for (var j = 0; j < names.length; j++) {
var name = names[j];
if (isSymbolString(name))
continue;
(function(mod, name) {
$defineProperty(object, name, {
get: function() {
return mod[name];
},
enumerable: true
});
})(arguments[i], names[j]);
}
}
return object;
}
function isObject(x) {
return x != null && (typeof x === 'object' || typeof x === 'function');
}
function toObject(x) {
if (x == null)
throw $TypeError();
return $Object(x);
}
function checkObjectCoercible(argument) {
if (argument == null) {
throw new TypeError('Value cannot be converted to an Object');
}
return argument;
}
function polyfillSymbol(global, Symbol) {
if (!global.Symbol) {
global.Symbol = Symbol;
Object.getOwnPropertySymbols = getOwnPropertySymbols;
}
if (!global.Symbol.iterator) {
global.Symbol.iterator = Symbol('Symbol.iterator');
}
}
function setupGlobals(global) {
polyfillSymbol(global, Symbol);
global.Reflect = global.Reflect || {};
global.Reflect.global = global.Reflect.global || global;
polyfillObject(global.Object);
}
setupGlobals(global);
global.$traceurRuntime = {
checkObjectCoercible: checkObjectCoercible,
createPrivateName: createPrivateName,
defineProperties: $defineProperties,
defineProperty: $defineProperty,
exportStar: exportStar,
getOwnHashObject: getOwnHashObject,
getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
getOwnPropertyNames: $getOwnPropertyNames,
isObject: isObject,
isPrivateName: isPrivateName,
isSymbolString: isSymbolString,
keys: $keys,
setupGlobals: setupGlobals,
toObject: toObject,
toProperty: toProperty,
typeof: typeOf
};
})(window);
(function() {
'use strict';
var path;
function relativeRequire(callerPath, requiredPath) {
path = path || typeof require !== 'undefined' && require('path');
function isDirectory(path) {
return path.slice(-1) === '/';
}
function isAbsolute(path) {
return path[0] === '/';
}
function isRelative(path) {
return path[0] === '.';
}
if (isDirectory(requiredPath) || isAbsolute(requiredPath))
return;
return isRelative(requiredPath) ? require(path.resolve(path.dirname(callerPath), requiredPath)) : require(requiredPath);
}
$traceurRuntime.require = relativeRequire;
})();
(function() {
'use strict';
function spread() {
var rv = [],
j = 0,
iterResult;
for (var i = 0; i < arguments.length; i++) {
var valueToSpread = $traceurRuntime.checkObjectCoercible(arguments[i]);
if (typeof valueToSpread[$traceurRuntime.toProperty(Symbol.iterator)] !== 'function') {
throw new TypeError('Cannot spread non-iterable object.');
}
var iter = valueToSpread[$traceurRuntime.toProperty(Symbol.iterator)]();
while (!(iterResult = iter.next()).done) {
rv[j++] = iterResult.value;
}
}
return rv;
}
$traceurRuntime.spread = spread;
})();
(function() {
'use strict';
var $Object = Object;
var $TypeError = TypeError;
var $create = $Object.create;
var $defineProperties = $traceurRuntime.defineProperties;
var $defineProperty = $traceurRuntime.defineProperty;
var $getOwnPropertyDescriptor = $traceurRuntime.getOwnPropertyDescriptor;
var $getOwnPropertyNames = $traceurRuntime.getOwnPropertyNames;
var $getPrototypeOf = Object.getPrototypeOf;
var $__0 = Object,
getOwnPropertyNames = $__0.getOwnPropertyNames,
getOwnPropertySymbols = $__0.getOwnPropertySymbols;
function superDescriptor(homeObject, name) {
var proto = $getPrototypeOf(homeObject);
do {
var result = $getOwnPropertyDescriptor(proto, name);
if (result)
return result;
proto = $getPrototypeOf(proto);
} while (proto);
return undefined;
}
function superConstructor(ctor) {
return ctor.__proto__;
}
function superCall(self, homeObject, name, args) {
return superGet(self, homeObject, name).apply(self, args);
}
function superGet(self, homeObject, name) {
var descriptor = superDescriptor(homeObject, name);
if (descriptor) {
if (!descriptor.get)
return descriptor.value;
return descriptor.get.call(self);
}
return undefined;
}
function superSet(self, homeObject, name, value) {
var descriptor = superDescriptor(homeObject, name);
if (descriptor && descriptor.set) {
descriptor.set.call(self, value);
return value;
}
throw $TypeError(("super has no setter '" + name + "'."));
}
function getDescriptors(object) {
var descriptors = {};
var names = getOwnPropertyNames(object);
for (var i = 0; i < names.length; i++) {
var name = names[i];
descriptors[name] = $getOwnPropertyDescriptor(object, name);
}
var symbols = getOwnPropertySymbols(object);
for (var i = 0; i < symbols.length; i++) {
var symbol = symbols[i];
descriptors[$traceurRuntime.toProperty(symbol)] = $getOwnPropertyDescriptor(object, $traceurRuntime.toProperty(symbol));
}
return descriptors;
}
function createClass(ctor, object, staticObject, superClass) {
$defineProperty(object, 'constructor', {
value: ctor,
configurable: true,
enumerable: false,
writable: true
});
if (arguments.length > 3) {
if (typeof superClass === 'function')
ctor.__proto__ = superClass;
ctor.prototype = $create(getProtoParent(superClass), getDescriptors(object));
} else {
ctor.prototype = object;
}
$defineProperty(ctor, 'prototype', {
configurable: false,
writable: false
});
return $defineProperties(ctor, getDescriptors(staticObject));
}
function getProtoParent(superClass) {
if (typeof superClass === 'function') {
var prototype = superClass.prototype;
if ($Object(prototype) === prototype || prototype === null)
return superClass.prototype;
throw new $TypeError('super prototype must be an Object or null');
}
if (superClass === null)
return null;
throw new $TypeError(("Super expression must either be null or a function, not " + typeof superClass + "."));
}
function defaultSuperCall(self, homeObject, args) {
if ($getPrototypeOf(homeObject) !== null)
superCall(self, homeObject, 'constructor', args);
}
$traceurRuntime.createClass = createClass;
$traceurRuntime.defaultSuperCall = defaultSuperCall;
$traceurRuntime.superCall = superCall;
$traceurRuntime.superConstructor = superConstructor;
$traceurRuntime.superGet = superGet;
$traceurRuntime.superSet = superSet;
})();
//#
},{"path":undefined}],82:[function(require,module,exports){
"use strict";
if (!Object.keys) {
Object.keys = (function() {
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty,
hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),
dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'],
dontEnumsLength = dontEnums.length;
return function(obj) {
if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {
throw new TypeError('Object.keys called on non-object');
}
var result = [],
prop,
i;
for (prop in obj) {
if (hasOwnProperty.call(obj, prop)) {
result.push(prop);
}
}
if (hasDontEnumBug) {
for (i = 0; i < dontEnumsLength; i++) {
if (hasOwnProperty.call(obj, dontEnums[i])) {
result.push(dontEnums[i]);
}
}
}
return result;
};
}());
}
//#
},{}],83:[function(require,module,exports){
"use strict";
if (!String.prototype.trim) {
var trimRegex = /^\s+|\s+$/g;
String.prototype.trim = function() {
return this.replace(trimRegex, '');
};
}
//#
},{}],84:[function(require,module,exports){
"use strict";
if (typeof WeakMap === 'undefined') {
(function() {
var defineProperty = Object.defineProperty;
try {
var properDefineProperty = true;
defineProperty(function() {}, 'foo', {});
} catch (e) {
properDefineProperty = false;
}
var counter = +(new Date) % 1e9;
var WeakMap = function() {
this.name = '__st' + (Math.random() * 1e9 >>> 0) + (counter++ + '__');
if (!properDefineProperty) {
this._wmCache = [];
}
};
if (properDefineProperty) {
WeakMap.prototype = {
set: function(key, value) {
var entry = key[this.name];
if (entry && entry[0] === key)
entry[1] = value;
else
defineProperty(key, this.name, {
value: [key, value],
writable: true
});
},
get: function(key) {
var entry;
return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
},
has: function(key) {
return this.get(key) ? true : false;
},
'delete': function(key) {
this.set(key, undefined);
}
};
} else {
WeakMap.prototype = {
set: function(key, value) {
if (typeof key == 'undefined' || typeof value == 'undefined')
return;
for (var i = 0,
len = this._wmCache.length; i < len; i++) {
if (this._wmCache[i].key == key) {
this._wmCache[i].value = value;
return;
}
}
this._wmCache.push({
key: key,
value: value
});
},
get: function(key) {
if (typeof key == 'undefined')
return;
for (var i = 0,
len = this._wmCache.length; i < len; i++) {
if (this._wmCache[i].key == key) {
return this._wmCache[i].value;
}
}
return void 0;
},
has: function(key) {
return this.get(key) ? true : false;
},
'delete': function(key) {
if (typeof key == 'undefined')
return;
for (var i = 0,
len = this._wmCache.length; i < len; i++) {
if (this._wmCache[i].key == key) {
Array.prototype.slice.call(this._wmCache, i, 1);
}
}
}
};
}
window.WeakMap = WeakMap;
})();
}
//#
},{}],85:[function(require,module,exports){
"use strict";
Object.defineProperties(exports, {
TableView: {get: function() {
return TableView;
}},
__esModule: {value: true}
});
var $__dom_46_js__,
$__helpers_46_js__,
$__eventManager_46_js__,
$__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__,
$__3rdparty_47_walkontable_47_src_47_selection_46_js__,
$__3rdparty_47_walkontable_47_src_47_core_46_js__;
var dom = ($__dom_46_js__ = require("./dom.js"), $__dom_46_js__ && $__dom_46_js__.__esModule && $__dom_46_js__ || {default: $__dom_46_js__});
var helper = ($__helpers_46_js__ = require("./helpers.js"), $__helpers_46_js__ && $__helpers_46_js__.__esModule && $__helpers_46_js__ || {default: $__helpers_46_js__});
var eventManagerObject = ($__eventManager_46_js__ = require("./eventManager.js"), $__eventManager_46_js__ && $__eventManager_46_js__.__esModule && $__eventManager_46_js__ || {default: $__eventManager_46_js__}).eventManager;
var WalkontableCellCoords = ($__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ = require("./3rdparty/walkontable/src/cell/coords.js"), $__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ && $__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__.__esModule && $__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__ || {default: $__3rdparty_47_walkontable_47_src_47_cell_47_coords_46_js__}).WalkontableCellCoords;
var WalkontableSelection = ($__3rdparty_47_walkontable_47_src_47_selection_46_js__ = require("./3rdparty/walkontable/src/selection.js"), $__3rdparty_47_walkontable_47_src_47_selection_46_js__ && $__3rdparty_47_walkontable_47_src_47_selection_46_js__.__esModule && $__3rdparty_47_walkontable_47_src_47_selection_46_js__ || {default: $__3rdparty_47_walkontable_47_src_47_selection_46_js__}).WalkontableSelection;
var Walkontable = ($__3rdparty_47_walkontable_47_src_47_core_46_js__ = require("./3rdparty/walkontable/src/core.js"), $__3rdparty_47_walkontable_47_src_47_core_46_js__ && $__3rdparty_47_walkontable_47_src_47_core_46_js__.__esModule && $__3rdparty_47_walkontable_47_src_47_core_46_js__ || {default: $__3rdparty_47_walkontable_47_src_47_core_46_js__}).Walkontable;
Handsontable.TableView = TableView;
function TableView(instance) {
var that = this;
this.eventManager = eventManagerObject(instance);
this.instance = instance;
this.settings = instance.getSettings();
var originalStyle = instance.rootElement.getAttribute('style');
if (originalStyle) {
instance.rootElement.setAttribute('data-originalstyle', originalStyle);
}
dom.addClass(instance.rootElement, 'handsontable');
var table = document.createElement('TABLE');
table.className = 'htCore';
this.THEAD = document.createElement('THEAD');
table.appendChild(this.THEAD);
this.TBODY = document.createElement('TBODY');
table.appendChild(this.TBODY);
instance.table = table;
instance.container.insertBefore(table, instance.container.firstChild);
this.eventManager.addEventListener(instance.rootElement, 'mousedown', function(event) {
if (!that.isTextSelectionAllowed(event.target)) {
clearTextSelection();
event.preventDefault();
window.focus();
}
});
this.eventManager.addEventListener(document.documentElement, 'keyup', function(event) {
if (instance.selection.isInProgress() && !event.shiftKey) {
instance.selection.finish();
}
});
var isMouseDown;
this.isMouseDown = function() {
return isMouseDown;
};
this.eventManager.addEventListener(document.documentElement, 'mouseup', function(event) {
if (instance.selection.isInProgress() && event.which === 1) {
instance.selection.finish();
}
isMouseDown = false;
if (helper.isOutsideInput(document.activeElement)) {
instance.unlisten();
}
});
this.eventManager.addEventListener(document.documentElement, 'mousedown', function(event) {
var next = event.target;
var eventX = event.x || event.clientX;
var eventY = event.y || event.clientY;
if (isMouseDown) {
return;
}
if (next !== instance.view.wt.wtTable.holder) {
while (next !== document.documentElement) {
if (next === null) {
if (event.isTargetWebComponent) {
break;
}
return;
}
if (next === instance.rootElement) {
return;
}
next = next.parentNode;
}
} else {
var scrollbarWidth = Handsontable.Dom.getScrollbarWidth();
if (document.elementFromPoint(eventX + scrollbarWidth, eventY) !== instance.view.wt.wtTable.holder || document.elementFromPoint(eventX, eventY + scrollbarWidth) !== instance.view.wt.wtTable.holder) {
return;
}
}
if (that.settings.outsideClickDeselects) {
instance.deselectCell();
} else {
instance.destroyEditor();
}
});
this.eventManager.addEventListener(table, 'selectstart', function(event) {
if (that.settings.fragmentSelection) {
return;
}
event.preventDefault();
});
var clearTextSelection = function() {
if (window.getSelection) {
if (window.getSelection().empty) {
window.getSelection().empty();
} else if (window.getSelection().removeAllRanges) {
window.getSelection().removeAllRanges();
}
} else if (document.selection) {
document.selection.empty();
}
};
var selections = [new WalkontableSelection({
className: 'current',
border: {
width: 2,
color: '#5292F7',
cornerVisible: function() {
return that.settings.fillHandle && !that.isCellEdited() && !instance.selection.isMultiple();
},
multipleSelectionHandlesVisible: function() {
return !that.isCellEdited() && !instance.selection.isMultiple();
}
}
}), new WalkontableSelection({
className: 'area',
border: {
width: 1,
color: '#89AFF9',
cornerVisible: function() {
return that.settings.fillHandle && !that.isCellEdited() && instance.selection.isMultiple();
},
multipleSelectionHandlesVisible: function() {
return !that.isCellEdited() && instance.selection.isMultiple();
}
}
}), new WalkontableSelection({
className: 'highlight',
highlightRowClassName: that.settings.currentRowClassName,
highlightColumnClassName: that.settings.currentColClassName
}), new WalkontableSelection({
className: 'fill',
border: {
width: 1,
color: 'red'
}
})];
selections.current = selections[0];
selections.area = selections[1];
selections.highlight = selections[2];
selections.fill = selections[3];
var walkontableConfig = {
debug: function() {
return that.settings.debug;
},
table: table,
stretchH: this.settings.stretchH,
data: instance.getDataAtCell,
totalRows: instance.countRows,
totalColumns: instance.countCols,
fixedColumnsLeft: function() {
return that.settings.fixedColumnsLeft;
},
fixedRowsTop: function() {
return that.settings.fixedRowsTop;
},
renderAllRows: that.settings.renderAllRows,
rowHeaders: function() {
var arr = [];
if (instance.hasRowHeaders()) {
arr.push(function(index, TH) {
that.appendRowHeader(index, TH);
});
}
Handsontable.hooks.run(instance, 'afterGetRowHeaderRenderers', arr);
return arr;
},
columnHeaders: function() {
var arr = [];
if (instance.hasColHeaders()) {
arr.push(function(index, TH) {
that.appendColHeader(index, TH);
});
}
Handsontable.hooks.run(instance, 'afterGetColumnHeaderRenderers', arr);
return arr;
},
columnWidth: instance.getColWidth,
rowHeight: instance.getRowHeight,
cellRenderer: function(row, col, TD) {
var prop = that.instance.colToProp(col),
cellProperties = that.instance.getCellMeta(row, col),
renderer = that.instance.getCellRenderer(cellProperties);
var value = that.instance.getDataAtRowProp(row, prop);
renderer(that.instance, TD, row, col, prop, value, cellProperties);
Handsontable.hooks.run(that.instance, 'afterRenderer', TD, row, col, prop, value, cellProperties);
},
selections: selections,
hideBorderOnMouseDownOver: function() {
return that.settings.fragmentSelection;
},
onCellMouseDown: function(event, coords, TD, wt) {
instance.listen();
that.activeWt = wt;
isMouseDown = true;
dom.enableImmediatePropagation(event);
Handsontable.hooks.run(instance, 'beforeOnCellMouseDown', event, coords, TD);
if (!event.isImmediatePropagationStopped()) {
if (event.button === 2 && instance.selection.inInSelection(coords)) {} else if (event.shiftKey) {
if (coords.row >= 0 && coords.col >= 0) {
instance.selection.setRangeEnd(coords);
}
} else {
if ((coords.row < 0 || coords.col < 0) && (coords.row >= 0 || coords.col >= 0)) {
if (coords.row < 0) {
instance.selectCell(0, coords.col, instance.countRows() - 1, coords.col);
instance.selection.setSelectedHeaders(false, true);
}
if (coords.col < 0) {
instance.selectCell(coords.row, 0, coords.row, instance.countCols() - 1);
instance.selection.setSelectedHeaders(true, false);
}
} else {
coords.row = coords.row < 0 ? 0 : coords.row;
coords.col = coords.col < 0 ? 0 : coords.col;
instance.selection.setRangeStart(coords);
}
}
Handsontable.hooks.run(instance, 'afterOnCellMouseDown', event, coords, TD);
that.activeWt = that.wt;
}
},
onCellMouseOver: function(event, coords, TD, wt) {
that.activeWt = wt;
if (coords.row >= 0 && coords.col >= 0) {
if (isMouseDown) {
instance.selection.setRangeEnd(coords);
}
} else {
if (isMouseDown) {
if (coords.row < 0) {
instance.selection.setRangeEnd(new WalkontableCellCoords(instance.countRows() - 1, coords.col));
instance.selection.setSelectedHeaders(false, true);
}
if (coords.col < 0) {
instance.selection.setRangeEnd(new WalkontableCellCoords(coords.row, instance.countCols() - 1));
instance.selection.setSelectedHeaders(true, false);
}
}
}
Handsontable.hooks.run(instance, 'afterOnCellMouseOver', event, coords, TD);
that.activeWt = that.wt;
},
onCellCornerMouseDown: function(event) {
event.preventDefault();
Handsontable.hooks.run(instance, 'afterOnCellCornerMouseDown', event);
},
beforeDraw: function(force) {
that.beforeRender(force);
},
onDraw: function(force) {
that.onDraw(force);
},
onScrollVertically: function() {
instance.runHooks('afterScrollVertically');
},
onScrollHorizontally: function() {
instance.runHooks('afterScrollHorizontally');
},
onBeforeDrawBorders: function(corners, borderClassName) {
instance.runHooks('beforeDrawBorders', corners, borderClassName);
},
onBeforeTouchScroll: function() {
instance.runHooks('beforeTouchScroll');
},
onAfterMomentumScroll: function() {
instance.runHooks('afterMomentumScroll');
},
viewportRowCalculatorOverride: function(calc) {
if (that.settings.viewportRowRenderingOffset) {
calc.startRow = Math.max(calc.startRow - that.settings.viewportRowRenderingOffset, 0);
calc.endRow = Math.min(calc.endRow + that.settings.viewportRowRenderingOffset, instance.countRows() - 1);
}
instance.runHooks('afterViewportRowCalculatorOverride', calc);
},
viewportColumnCalculatorOverride: function(calc) {
if (that.settings.viewportColumnRenderingOffset) {
calc.startColumn = Math.max(calc.startColumn - that.settings.viewportColumnRenderingOffset, 0);
calc.endColumn = Math.min(calc.endColumn + that.settings.viewportColumnRenderingOffset, instance.countCols() - 1);
}
instance.runHooks('afterViewportColumnCalculatorOverride', calc);
}
};
Handsontable.hooks.run(instance, 'beforeInitWalkontable', walkontableConfig);
this.wt = new Walkontable(walkontableConfig);
this.activeWt = this.wt;
this.eventManager.addEventListener(that.wt.wtTable.spreader, 'mousedown', function(event) {
if (event.target === that.wt.wtTable.spreader && event.which === 3) {
helper.stopPropagation(event);
}
});
this.eventManager.addEventListener(that.wt.wtTable.spreader, 'contextmenu', function(event) {
if (event.target === that.wt.wtTable.spreader && event.which === 3) {
helper.stopPropagation(event);
}
});
this.eventManager.addEventListener(document.documentElement, 'click', function() {
if (that.settings.observeDOMVisibility) {
if (that.wt.drawInterrupted) {
that.instance.forceFullRender = true;
that.render();
}
}
});
}
TableView.prototype.isTextSelectionAllowed = function(el) {
if (helper.isInput(el)) {
return true;
}
if (this.settings.fragmentSelection && dom.isChildOf(el, this.TBODY)) {
return true;
}
return false;
};
TableView.prototype.isCellEdited = function() {
var activeEditor = this.instance.getActiveEditor();
return activeEditor && activeEditor.isOpened();
};
TableView.prototype.beforeRender = function(force) {
if (force) {
Handsontable.hooks.run(this.instance, 'beforeRender', this.instance.forceFullRender);
}
};
TableView.prototype.onDraw = function(force) {
if (force) {
Handsontable.hooks.run(this.instance, 'afterRender', this.instance.forceFullRender);
}
};
TableView.prototype.render = function() {
this.wt.draw(!this.instance.forceFullRender);
this.instance.forceFullRender = false;
};
TableView.prototype.getCellAtCoords = function(coords, topmost) {
var td = this.wt.getCell(coords, topmost);
if (td < 0) {
return null;
} else {
return td;
}
};
TableView.prototype.scrollViewport = function(coords) {
this.wt.scrollViewport(coords);
};
TableView.prototype.appendRowHeader = function(row, TH) {
if (TH.firstChild) {
var container = TH.firstChild;
if (!dom.hasClass(container, 'relative')) {
dom.empty(TH);
this.appendRowHeader(row, TH);
return;
}
this.updateCellHeader(container.firstChild, row, this.instance.getRowHeader);
} else {
var div = document.createElement('div');
var span = document.createElement('span');
div.className = 'relative';
span.className = 'colHeader';
this.updateCellHeader(span, row, this.instance.getRowHeader);
div.appendChild(span);
TH.appendChild(div);
}
Handsontable.hooks.run(this.instance, 'afterGetRowHeader', row, TH);
};
TableView.prototype.appendColHeader = function(col, TH) {
if (TH.firstChild) {
var container = TH.firstChild;
if (!dom.hasClass(container, 'relative')) {
dom.empty(TH);
this.appendRowHeader(col, TH);
return;
}
this.updateCellHeader(container.firstChild, col, this.instance.getColHeader);
} else {
var div = document.createElement('div');
var span = document.createElement('span');
div.className = 'relative';
span.className = 'colHeader';
this.updateCellHeader(span, col, this.instance.getColHeader);
div.appendChild(span);
TH.appendChild(div);
}
Handsontable.hooks.run(this.instance, 'afterGetColHeader', col, TH);
};
TableView.prototype.updateCellHeader = function(element, index, content) {
if (index > -1) {
dom.fastInnerHTML(element, content(index));
} else {
dom.fastInnerText(element, String.fromCharCode(160));
dom.addClass(element, 'cornerHeader');
}
};
TableView.prototype.maximumVisibleElementWidth = function(leftOffset) {
var workspaceWidth = this.wt.wtViewport.getWorkspaceWidth();
var maxWidth = workspaceWidth - leftOffset;
return maxWidth > 0 ? maxWidth : 0;
};
TableView.prototype.maximumVisibleElementHeight = function(topOffset) {
var workspaceHeight = this.wt.wtViewport.getWorkspaceHeight();
var maxHeight = workspaceHeight - topOffset;
return maxHeight > 0 ? maxHeight : 0;
};
TableView.prototype.mainViewIsActive = function() {
return this.wt === this.activeWt;
};
TableView.prototype.destroy = function() {
this.wt.destroy();
this.eventManager.clear();
};
;
//#
},{"./3rdparty/walkontable/src/cell/coords.js":5,"./3rdparty/walkontable/src/core.js":7,"./3rdparty/walkontable/src/selection.js":18,"./dom.js":27,"./eventManager.js":41,"./helpers.js":42}],86:[function(require,module,exports){
"use strict";
var process = function(value, callback) {
var originalVal = value;
var lowercaseVal = typeof originalVal === 'string' ? originalVal.toLowerCase() : null;
return function(source) {
var found = false;
for (var s = 0,
slen = source.length; s < slen; s++) {
if (originalVal === source[s]) {
found = true;
break;
} else if (lowercaseVal === Handsontable.helper.stringify(source[s]).toLowerCase()) {
found = true;
break;
}
}
callback(found);
};
};
Handsontable.AutocompleteValidator = function(value, callback) {
if (this.strict && this.source) {
if (typeof this.source === 'function') {
this.source(value, process(value, callback));
} else {
process(value, callback)(this.source);
}
} else {
callback(true);
}
};
//#
},{}],87:[function(require,module,exports){
"use strict";
var $__moment__,
$___46__46__47_editors_46_js__;
var moment = ($__moment__ = require("moment"), $__moment__ && $__moment__.__esModule && $__moment__ || {default: $__moment__}).default;
var getEditor = ($___46__46__47_editors_46_js__ = require("./../editors.js"), $___46__46__47_editors_46_js__ && $___46__46__47_editors_46_js__.__esModule && $___46__46__47_editors_46_js__ || {default: $___46__46__47_editors_46_js__}).getEditor;
Handsontable.DateValidator = function(value, callback) {
var valid = true;
var dateEditor = getEditor('date', this.instance);
if (value === null) {
value = '';
}
var isValidDate = moment(new Date(value)).isValid();
var isValidFormat = moment(value, this.dateFormat || dateEditor.defaultDateFormat, true).isValid();
if (!isValidDate) {
valid = false;
}
if (!isValidDate && isValidFormat) {
valid = true;
}
if (isValidDate && !isValidFormat) {
if (this.correctFormat === true) {
var correctedValue = correctFormat(value, this.dateFormat);
this.instance.setDataAtCell(this.row, this.col, correctedValue, 'dateValidator');
valid = true;
} else {
valid = false;
}
}
callback(valid);
};
var correctFormat = function correctFormat(value, dateFormat) {
var date = moment(new Date(value));
if (date.format('YYYY').length > 4) {
date.year((date.year() + '').substr(0, 4));
}
return date.format(dateFormat);
};
//#
},{"./../editors.js":29,"moment":"moment"}],88:[function(require,module,exports){
"use strict";
Handsontable.NumericValidator = function(value, callback) {
if (value === null) {
value = '';
}
callback(/^-?\d*(\.|\,)?\d*$/.test(value));
};
//#
},{}],"SheetClip":[function(require,module,exports){
"use strict";
(function(global) {
"use strict";
function countQuotes(str) {
return str.split('"').length - 1;
}
var SheetClip = {
parse: function(str) {
var r,
rLen,
rows,
arr = [],
a = 0,
c,
cLen,
multiline,
last;
rows = str.split('\n');
if (rows.length > 1 && rows[rows.length - 1] === '') {
rows.pop();
}
for (r = 0, rLen = rows.length; r < rLen; r += 1) {
rows[r] = rows[r].split('\t');
for (c = 0, cLen = rows[r].length; c < cLen; c += 1) {
if (!arr[a]) {
arr[a] = [];
}
if (multiline && c === 0) {
last = arr[a].length - 1;
arr[a][last] = arr[a][last] + '\n' + rows[r][0];
if (multiline && (countQuotes(rows[r][0]) & 1)) {
multiline = false;
arr[a][last] = arr[a][last].substring(0, arr[a][last].length - 1).replace(/""/g, '"');
}
} else {
if (c === cLen - 1 && rows[r][c].indexOf('"') === 0 && (countQuotes(rows[r][c]) & 1)) {
arr[a].push(rows[r][c].substring(1).replace(/""/g, '"'));
multiline = true;
} else {
arr[a].push(rows[r][c].replace(/""/g, '"'));
multiline = false;
}
}
}
if (!multiline) {
a += 1;
}
}
return arr;
},
stringify: function(arr) {
var r,
rLen,
c,
cLen,
str = '',
val;
for (r = 0, rLen = arr.length; r < rLen; r += 1) {
cLen = arr[r].length;
for (c = 0; c < cLen; c += 1) {
if (c > 0) {
str += '\t';
}
val = arr[r][c];
if (typeof val === 'string') {
if (val.indexOf('\n') > -1) {
str += '"' + val.replace(/"/g, '""') + '"';
} else {
str += val;
}
} else if (val === null || val === void 0) {
str += '';
} else {
str += val;
}
}
str += '\n';
}
return str;
}
};
if (typeof exports !== 'undefined') {
exports.parse = SheetClip.parse;
exports.stringify = SheetClip.stringify;
} else {
global.SheetClip = SheetClip;
}
}(window));
//#
},{}],"autoResize":[function(require,module,exports){
"use strict";
function autoResize() {
var defaults = {
minHeight: 200,
maxHeight: 300,
minWidth: 100,
maxWidth: 300
},
el,
body = document.body,
text = document.createTextNode(''),
span = document.createElement('SPAN'),
observe = function(element, event, handler) {
if (window.attachEvent) {
element.attachEvent('on' + event, handler);
} else {
element.addEventListener(event, handler, false);
}
},
unObserve = function(element, event, handler) {
if (window.removeEventListener) {
element.removeEventListener(event, handler, false);
} else {
element.detachEvent('on' + event, handler);
}
},
resize = function(newChar) {
var width,
scrollHeight;
if (!newChar) {
newChar = "";
} else if (!/^[a-zA-Z \.,\\\/\|0-9]$/.test(newChar)) {
newChar = ".";
}
if (text.textContent !== void 0) {
text.textContent = el.value + newChar;
} else {
text.data = el.value + newChar;
}
span.style.fontSize = Handsontable.Dom.getComputedStyle(el).fontSize;
span.style.fontFamily = Handsontable.Dom.getComputedStyle(el).fontFamily;
span.style.whiteSpace = "pre";
body.appendChild(span);
width = span.clientWidth + 2;
body.removeChild(span);
el.style.height = defaults.minHeight + 'px';
if (defaults.minWidth > width) {
el.style.width = defaults.minWidth + 'px';
} else if (width > defaults.maxWidth) {
el.style.width = defaults.maxWidth + 'px';
} else {
el.style.width = width + 'px';
}
scrollHeight = el.scrollHeight ? el.scrollHeight - 1 : 0;
if (defaults.minHeight > scrollHeight) {
el.style.height = defaults.minHeight + 'px';
} else if (defaults.maxHeight < scrollHeight) {
el.style.height = defaults.maxHeight + 'px';
el.style.overflowY = 'visible';
} else {
el.style.height = scrollHeight + 'px';
}
},
delayedResize = function() {
window.setTimeout(resize, 0);
},
extendDefaults = function(config) {
if (config && config.minHeight) {
if (config.minHeight == 'inherit') {
defaults.minHeight = el.clientHeight;
} else {
var minHeight = parseInt(config.minHeight);
if (!isNaN(minHeight)) {
defaults.minHeight = minHeight;
}
}
}
if (config && config.maxHeight) {
if (config.maxHeight == 'inherit') {
defaults.maxHeight = el.clientHeight;
} else {
var maxHeight = parseInt(config.maxHeight);
if (!isNaN(maxHeight)) {
defaults.maxHeight = maxHeight;
}
}
}
if (config && config.minWidth) {
if (config.minWidth == 'inherit') {
defaults.minWidth = el.clientWidth;
} else {
var minWidth = parseInt(config.minWidth);
if (!isNaN(minWidth)) {
defaults.minWidth = minWidth;
}
}
}
if (config && config.maxWidth) {
if (config.maxWidth == 'inherit') {
defaults.maxWidth = el.clientWidth;
} else {
var maxWidth = parseInt(config.maxWidth);
if (!isNaN(maxWidth)) {
defaults.maxWidth = maxWidth;
}
}
}
if (!span.firstChild) {
span.className = "autoResize";
span.style.display = 'inline-block';
span.appendChild(text);
}
},
init = function(el_, config, doObserve) {
el = el_;
extendDefaults(config);
if (el.nodeName == 'TEXTAREA') {
el.style.resize = 'none';
el.style.overflowY = '';
el.style.height = defaults.minHeight + 'px';
el.style.minWidth = defaults.minWidth + 'px';
el.style.maxWidth = defaults.maxWidth + 'px';
el.style.overflowY = 'hidden';
}
if (doObserve) {
observe(el, 'change', resize);
observe(el, 'cut', delayedResize);
observe(el, 'paste', delayedResize);
observe(el, 'drop', delayedResize);
observe(el, 'keydown', delayedResize);
}
resize();
};
return {
init: function(el_, config, doObserve) {
init(el_, config, doObserve);
},
unObserve: function() {
unObserve(el, 'change', resize);
unObserve(el, 'cut', delayedResize);
unObserve(el, 'paste', delayedResize);
unObserve(el, 'drop', delayedResize);
unObserve(el, 'keydown', delayedResize);
},
resize: resize
};
}
if (typeof exports !== 'undefined') {
module.exports = autoResize;
}
//#
},{}],"copyPaste":[function(require,module,exports){
"use strict";
var instance;
function copyPaste() {
if (!instance) {
instance = new CopyPasteClass();
} else if (instance.hasBeenDestroyed()) {
instance.init();
}
instance.refCounter++;
return instance;
}
if (typeof exports !== 'undefined') {
module.exports = copyPaste;
}
function CopyPasteClass() {
this.refCounter = 0;
this.init();
}
CopyPasteClass.prototype.init = function() {
var style,
parent;
this.copyCallbacks = [];
this.cutCallbacks = [];
this.pasteCallbacks = [];
parent = document.body;
if (document.getElementById('CopyPasteDiv')) {
this.elDiv = document.getElementById('CopyPasteDiv');
this.elTextarea = this.elDiv.firstChild;
} else {
this.elDiv = document.createElement('div');
this.elDiv.id = 'CopyPasteDiv';
style = this.elDiv.style;
style.position = 'fixed';
style.top = '-10000px';
style.left = '-10000px';
parent.appendChild(this.elDiv);
this.elTextarea = document.createElement('textarea');
this.elTextarea.className = 'copyPaste';
this.elTextarea.onpaste = function(event) {
var clipboardContents,
temp;
if ('WebkitAppearance' in document.documentElement.style) {
clipboardContents = event.clipboardData.getData("Text");
if (navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1) {
temp = clipboardContents.split('\n');
temp.pop();
clipboardContents = temp.join('\n');
}
this.value = clipboardContents;
return false;
}
};
style = this.elTextarea.style;
style.width = '10000px';
style.height = '10000px';
style.overflow = 'hidden';
this.elDiv.appendChild(this.elTextarea);
if (typeof style.opacity !== 'undefined') {
style.opacity = 0;
}
}
this.onKeyDownRef = this.onKeyDown.bind(this);
document.documentElement.addEventListener('keydown', this.onKeyDownRef, false);
};
CopyPasteClass.prototype.onKeyDown = function(event) {
var _this = this,
isCtrlDown = false;
function isActiveElementEditable() {
var element = document.activeElement;
if (element.shadowRoot && element.shadowRoot.activeElement) {
element = element.shadowRoot.activeElement;
}
return ['INPUT', 'SELECT', 'TEXTAREA'].indexOf(element.nodeName) > -1 || element.contentEditable === 'true';
}
if (event.metaKey) {
isCtrlDown = true;
} else if (event.ctrlKey && navigator.userAgent.indexOf('Mac') === -1) {
isCtrlDown = true;
}
if (isCtrlDown) {
if (document.activeElement !== this.elTextarea && (this.getSelectionText() !== '' || isActiveElementEditable())) {
return;
}
this.selectNodeText(this.elTextarea);
setTimeout(function() {
if (document.activeElement !== _this.elTextarea) {
_this.selectNodeText(_this.elTextarea);
}
}, 0);
}
if (isCtrlDown && (event.keyCode === 67 || event.keyCode === 86 || event.keyCode === 88)) {
if (event.keyCode === 88) {
setTimeout(function() {
_this.triggerCut(event);
}, 0);
} else if (event.keyCode === 86) {
setTimeout(function() {
_this.triggerPaste(event);
}, 0);
}
}
};
CopyPasteClass.prototype.selectNodeText = function(element) {
if (element) {
element.select();
}
};
CopyPasteClass.prototype.getSelectionText = function() {
var text = '';
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type !== 'Control') {
text = document.selection.createRange().text;
}
return text;
};
CopyPasteClass.prototype.copyable = function(string) {
if (typeof string !== 'string' && string.toString === void 0) {
throw new Error('copyable requires string parameter');
}
this.elTextarea.value = string;
this.selectNodeText(this.elTextarea);
};
CopyPasteClass.prototype.onCut = function(callback) {
this.cutCallbacks.push(callback);
};
CopyPasteClass.prototype.onPaste = function(callback) {
this.pasteCallbacks.push(callback);
};
CopyPasteClass.prototype.removeCallback = function(callback) {
var i,
len;
for (i = 0, len = this.copyCallbacks.length; i < len; i++) {
if (this.copyCallbacks[i] === callback) {
this.copyCallbacks.splice(i, 1);
return true;
}
}
for (i = 0, len = this.cutCallbacks.length; i < len; i++) {
if (this.cutCallbacks[i] === callback) {
this.cutCallbacks.splice(i, 1);
return true;
}
}
for (i = 0, len = this.pasteCallbacks.length; i < len; i++) {
if (this.pasteCallbacks[i] === callback) {
this.pasteCallbacks.splice(i, 1);
return true;
}
}
return false;
};
CopyPasteClass.prototype.triggerCut = function(event) {
var _this = this;
if (_this.cutCallbacks) {
setTimeout(function() {
for (var i = 0,
len = _this.cutCallbacks.length; i < len; i++) {
_this.cutCallbacks[i](event);
}
}, 50);
}
};
CopyPasteClass.prototype.triggerPaste = function(event, string) {
var _this = this;
if (_this.pasteCallbacks) {
setTimeout(function() {
var val = string || _this.elTextarea.value;
for (var i = 0,
len = _this.pasteCallbacks.length; i < len; i++) {
_this.pasteCallbacks[i](val, event);
}
}, 50);
}
};
CopyPasteClass.prototype.destroy = function() {
if (!this.hasBeenDestroyed() && --this.refCounter === 0) {
if (this.elDiv && this.elDiv.parentNode) {
this.elDiv.parentNode.removeChild(this.elDiv);
this.elDiv = null;
this.elTextarea = null;
}
document.documentElement.removeEventListener('keydown', this.onKeyDownRef);
}
};
CopyPasteClass.prototype.hasBeenDestroyed = function() {
return !this.refCounter;
};
//#
},{}],"jsonpatch":[function(require,module,exports){
"use strict";
var jsonpatch;
(function(jsonpatch) {
var objOps = {
add: function(obj, key) {
obj[key] = this.value;
return true;
},
remove: function(obj, key) {
delete obj[key];
return true;
},
replace: function(obj, key) {
obj[key] = this.value;
return true;
},
move: function(obj, key, tree) {
var temp = {
op: "_get",
path: this.from
};
apply(tree, [temp]);
apply(tree, [{
op: "remove",
path: this.from
}]);
apply(tree, [{
op: "add",
path: this.path,
value: temp.value
}]);
return true;
},
copy: function(obj, key, tree) {
var temp = {
op: "_get",
path: this.from
};
apply(tree, [temp]);
apply(tree, [{
op: "add",
path: this.path,
value: temp.value
}]);
return true;
},
test: function(obj, key) {
return (JSON.stringify(obj[key]) === JSON.stringify(this.value));
},
_get: function(obj, key) {
this.value = obj[key];
}
};
var arrOps = {
add: function(arr, i) {
arr.splice(i, 0, this.value);
return true;
},
remove: function(arr, i) {
arr.splice(i, 1);
return true;
},
replace: function(arr, i) {
arr[i] = this.value;
return true;
},
move: objOps.move,
copy: objOps.copy,
test: objOps.test,
_get: objOps._get
};
var observeOps = {
add: function(patches, path) {
var patch = {
op: "add",
path: path + escapePathComponent(this.name),
value: this.object[this.name]
};
patches.push(patch);
},
'delete': function(patches, path) {
var patch = {
op: "remove",
path: path + escapePathComponent(this.name)
};
patches.push(patch);
},
update: function(patches, path) {
var patch = {
op: "replace",
path: path + escapePathComponent(this.name),
value: this.object[this.name]
};
patches.push(patch);
}
};
function escapePathComponent(str) {
if (str.indexOf('/') === -1 && str.indexOf('~') === -1) {
return str;
}
return str.replace(/~/g, '~0').replace(/\//g, '~1');
}
function _getPathRecursive(root, obj) {
var found;
for (var key in root) {
if (root.hasOwnProperty(key)) {
if (root[key] === obj) {
return escapePathComponent(key) + '/';
} else if (typeof root[key] === 'object') {
found = _getPathRecursive(root[key], obj);
if (found != '') {
return escapePathComponent(key) + '/' + found;
}
}
}
}
return '';
}
function getPath(root, obj) {
if (root === obj) {
return '/';
}
var path = _getPathRecursive(root, obj);
if (path === '') {
throw new Error("Object not found in root");
}
return '/' + path;
}
var beforeDict = [];
jsonpatch.intervals;
var Mirror = (function() {
function Mirror(obj) {
this.observers = [];
this.obj = obj;
}
return Mirror;
})();
var ObserverInfo = (function() {
function ObserverInfo(callback, observer) {
this.callback = callback;
this.observer = observer;
}
return ObserverInfo;
})();
function getMirror(obj) {
for (var i = 0,
ilen = beforeDict.length; i < ilen; i++) {
if (beforeDict[i].obj === obj) {
return beforeDict[i];
}
}
}
function getObserverFromMirror(mirror, callback) {
for (var j = 0,
jlen = mirror.observers.length; j < jlen; j++) {
if (mirror.observers[j].callback === callback) {
return mirror.observers[j].observer;
}
}
}
function removeObserverFromMirror(mirror, observer) {
for (var j = 0,
jlen = mirror.observers.length; j < jlen; j++) {
if (mirror.observers[j].observer === observer) {
mirror.observers.splice(j, 1);
return;
}
}
}
function unobserve(root, observer) {
generate(observer);
if (Object.observe) {
_unobserve(observer, root);
} else {
clearTimeout(observer.next);
}
var mirror = getMirror(root);
removeObserverFromMirror(mirror, observer);
}
jsonpatch.unobserve = unobserve;
function observe(obj, callback) {
var patches = [];
var root = obj;
var observer;
var mirror = getMirror(obj);
if (!mirror) {
mirror = new Mirror(obj);
beforeDict.push(mirror);
} else {
observer = getObserverFromMirror(mirror, callback);
}
if (observer) {
return observer;
}
if (Object.observe) {
observer = function(arr) {
_unobserve(observer, obj);
_observe(observer, obj);
var a = 0,
alen = arr.length;
while (a < alen) {
if (!(arr[a].name === 'length' && _isArray(arr[a].object)) && !(arr[a].name === '__Jasmine_been_here_before__')) {
var type = arr[a].type;
switch (type) {
case 'new':
type = 'add';
break;
case 'deleted':
type = 'delete';
break;
case 'updated':
type = 'update';
break;
}
observeOps[type].call(arr[a], patches, getPath(root, arr[a].object));
}
a++;
}
if (patches) {
if (callback) {
callback(patches);
}
}
observer.patches = patches;
patches = [];
};
} else {
observer = {};
mirror.value = JSON.parse(JSON.stringify(obj));
if (callback) {
observer.callback = callback;
observer.next = null;
var intervals = this.intervals || [100, 1000, 10000, 60000];
var currentInterval = 0;
var dirtyCheck = function() {
generate(observer);
};
var fastCheck = function() {
clearTimeout(observer.next);
observer.next = setTimeout(function() {
dirtyCheck();
currentInterval = 0;
observer.next = setTimeout(slowCheck, intervals[currentInterval++]);
}, 0);
};
var slowCheck = function() {
dirtyCheck();
if (currentInterval == intervals.length) {
currentInterval = intervals.length - 1;
}
observer.next = setTimeout(slowCheck, intervals[currentInterval++]);
};
if (typeof window !== 'undefined') {
if (window.addEventListener) {
window.addEventListener('mousedown', fastCheck);
window.addEventListener('mouseup', fastCheck);
window.addEventListener('keydown', fastCheck);
} else {
window.attachEvent('onmousedown', fastCheck);
window.attachEvent('onmouseup', fastCheck);
window.attachEvent('onkeydown', fastCheck);
}
}
observer.next = setTimeout(slowCheck, intervals[currentInterval++]);
}
}
observer.patches = patches;
observer.object = obj;
mirror.observers.push(new ObserverInfo(callback, observer));
return _observe(observer, obj);
}
jsonpatch.observe = observe;
function _observe(observer, obj) {
if (Object.observe) {
Object.observe(obj, observer);
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
var v = obj[key];
if (v && typeof(v) === "object") {
_observe(observer, v);
}
}
}
}
return observer;
}
function _unobserve(observer, obj) {
if (Object.observe) {
Object.unobserve(obj, observer);
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
var v = obj[key];
if (v && typeof(v) === "object") {
_unobserve(observer, v);
}
}
}
}
return observer;
}
function generate(observer) {
if (Object.observe) {
Object.deliverChangeRecords(observer);
} else {
var mirror;
for (var i = 0,
ilen = beforeDict.length; i < ilen; i++) {
if (beforeDict[i].obj === observer.object) {
mirror = beforeDict[i];
break;
}
}
_generate(mirror.value, observer.object, observer.patches, "");
}
var temp = observer.patches;
if (temp.length > 0) {
observer.patches = [];
if (observer.callback) {
observer.callback(temp);
}
}
return temp;
}
jsonpatch.generate = generate;
var _objectKeys;
if (Object.keys) {
_objectKeys = Object.keys;
} else {
_objectKeys = function(obj) {
var keys = [];
for (var o in obj) {
if (obj.hasOwnProperty(o)) {
keys.push(o);
}
}
return keys;
};
}
function _generate(mirror, obj, patches, path) {
var newKeys = _objectKeys(obj);
var oldKeys = _objectKeys(mirror);
var changed = false;
var deleted = false;
for (var t = oldKeys.length - 1; t >= 0; t--) {
var key = oldKeys[t];
var oldVal = mirror[key];
if (obj.hasOwnProperty(key)) {
var newVal = obj[key];
if (oldVal instanceof Object) {
_generate(oldVal, newVal, patches, path + "/" + escapePathComponent(key));
} else {
if (oldVal != newVal) {
changed = true;
patches.push({
op: "replace",
path: path + "/" + escapePathComponent(key),
value: newVal
});
mirror[key] = newVal;
}
}
} else {
patches.push({
op: "remove",
path: path + "/" + escapePathComponent(key)
});
delete mirror[key];
deleted = true;
}
}
if (!deleted && newKeys.length == oldKeys.length) {
return;
}
for (var t = 0; t < newKeys.length; t++) {
var key = newKeys[t];
if (!mirror.hasOwnProperty(key)) {
patches.push({
op: "add",
path: path + "/" + escapePathComponent(key),
value: obj[key]
});
mirror[key] = JSON.parse(JSON.stringify(obj[key]));
}
}
}
var _isArray;
if (Array.isArray) {
_isArray = Array.isArray;
} else {
_isArray = function(obj) {
return obj.push && typeof obj.length === 'number';
};
}
function apply(tree, patches) {
var result = false,
p = 0,
plen = patches.length,
patch;
while (p < plen) {
patch = patches[p];
var keys = patch.path.split('/');
var obj = tree;
var t = 1;
var len = keys.length;
while (true) {
if (_isArray(obj)) {
var index = parseInt(keys[t], 10);
t++;
if (t >= len) {
result = arrOps[patch.op].call(patch, obj, index, tree);
break;
}
obj = obj[index];
} else {
var key = keys[t];
if (key.indexOf('~') != -1) {
key = key.replace(/~1/g, '/').replace(/~0/g, '~');
}
t++;
if (t >= len) {
result = objOps[patch.op].call(patch, obj, key, tree);
break;
}
obj = obj[key];
}
}
p++;
}
return result;
}
jsonpatch.apply = apply;
})(jsonpatch || (jsonpatch = {}));
if (typeof exports !== "undefined") {
exports.apply = jsonpatch.apply;
exports.observe = jsonpatch.observe;
exports.unobserve = jsonpatch.unobserve;
exports.generate = jsonpatch.generate;
}
//#
},{}],"moment":[function(require,module,exports){
//! moment.js
//! version : 2.10.3
//! 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(factory) :
global.moment = factory()
}(this, function () { 'use strict';
var hookCallback;
function utils_hooks__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 Object.prototype.toString.call(input) === '[object Array]';
}
function isDate(input) {
return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
}
function map(arr, fn) {
var res = [], i;
for (i = 0; i < arr.length; ++i) {
res.push(fn(arr[i], i));
}
return res;
}
function hasOwnProp(a, b) {
return Object.prototype.hasOwnProperty.call(a, b);
}
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 create_utc__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,
invalidMonth : null,
invalidFormat : false,
userInvalidated : false,
iso : false
};
}
function getParsingFlags(m) {
if (m._pf == null) {
m._pf = defaultParsingFlags();
}
return m._pf;
}
function valid__isValid(m) {
if (m._isValid == null) {
var flags = getParsingFlags(m);
m._isValid = !isNaN(m._d.getTime()) &&
flags.overflow < 0 &&
!flags.empty &&
!flags.invalidMonth &&
!flags.nullInput &&
!flags.invalidFormat &&
!flags.userInvalidated;
if (m._strict) {
m._isValid = m._isValid &&
flags.charsLeftOver === 0 &&
flags.unusedTokens.length === 0 &&
flags.bigHour === undefined;
}
}
return m._isValid;
}
function valid__createInvalid (flags) {
var m = create_utc__createUTC(NaN);
if (flags != null) {
extend(getParsingFlags(m), flags);
}
else {
getParsingFlags(m).userInvalidated = true;
}
return m;
}
var momentProperties = utils_hooks__hooks.momentProperties = [];
function copyConfig(to, from) {
var i, prop, val;
if (typeof from._isAMomentObject !== 'undefined') {
to._isAMomentObject = from._isAMomentObject;
}
if (typeof from._i !== 'undefined') {
to._i = from._i;
}
if (typeof from._f !== 'undefined') {
to._f = from._f;
}
if (typeof from._l !== 'undefined') {
to._l = from._l;
}
if (typeof from._strict !== 'undefined') {
to._strict = from._strict;
}
if (typeof from._tzm !== 'undefined') {
to._tzm = from._tzm;
}
if (typeof from._isUTC !== 'undefined') {
to._isUTC = from._isUTC;
}
if (typeof from._offset !== 'undefined') {
to._offset = from._offset;
}
if (typeof from._pf !== 'undefined') {
to._pf = getParsingFlags(from);
}
if (typeof from._locale !== 'undefined') {
to._locale = from._locale;
}
if (momentProperties.length > 0) {
for (i in momentProperties) {
prop = momentProperties[i];
val = from[prop];
if (typeof val !== 'undefined') {
to[prop] = val;
}
}
}
return to;
}
var updateInProgress = false;
// Moment prototype object
function Moment(config) {
copyConfig(this, config);
this._d = new Date(+config._d);
// Prevent infinite loop in case updateOffset creates new moment
// objects.
if (updateInProgress === false) {
updateInProgress = true;
utils_hooks__hooks.updateOffset(this);
updateInProgress = false;
}
}
function isMoment (obj) {
return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
}
function toInt(argumentForCoercion) {
var coercedNumber = +argumentForCoercion,
value = 0;
if (coercedNumber !== 0 && isFinite(coercedNumber)) {
if (coercedNumber >= 0) {
value = Math.floor(coercedNumber);
} else {
value = Math.ceil(coercedNumber);
}
}
return value;
}
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;
}
function Locale() {
}
var locales = {};
var globalLocale;
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 && compareArrays(split, next, true) >= j - 1) {
//the next array item is better than a shallower substring of this one
break;
}
j--;
}
i++;
}
return null;
}
function loadLocale(name) {
var oldLocale = null;
// TODO: Find a better way to register and load all the locales in Node
if (!locales[name] && typeof module !== 'undefined' &&
module && module.exports) {
try {
oldLocale = globalLocale._abbr;
require('./locale/' + name);
// because defineLocale currently also sets the global locale, we
// want to undo that for lazy loaded locales
locale_locales__getSetGlobalLocale(oldLocale);
} catch (e) { }
}
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 locale_locales__getSetGlobalLocale (key, values) {
var data;
if (key) {
if (typeof values === 'undefined') {
data = locale_locales__getLocale(key);
}
else {
data = defineLocale(key, values);
}
if (data) {
// moment.duration._locale = moment._locale = data;
globalLocale = data;
}
}
return globalLocale._abbr;
}
function defineLocale (name, values) {
if (values !== null) {
values.abbr = name;
if (!locales[name]) {
locales[name] = new Locale();
}
locales[name].set(values);
// backwards compat for now: also set the locale
locale_locales__getSetGlobalLocale(name);
return locales[name];
} else {
// useful for testing
delete locales[name];
return null;
}
}
// returns locale data
function locale_locales__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);
}
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;
}
function makeGetSet (unit, keepTime) {
return function (value) {
if (value != null) {
get_set__set(this, unit, value);
utils_hooks__hooks.updateOffset(this, keepTime);
return this;
} else {
return get_set__get(this, unit);
}
};
}
function get_set__get (mom, unit) {
return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]();
}
function get_set__set (mom, unit, value) {
return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
}
// MOMENTS
function getSet (units, value) {
var unit;
if (typeof units === 'object') {
for (unit in units) {
this.set(unit, units[unit]);
}
} else {
units = normalizeUnits(units);
if (typeof this[units] === 'function') {
return this[units](value);
}
}
return this;
}
function zeroFill(number, targetLength, forceSign) {
var output = '' + Math.abs(number),
sign = number >= 0;
while (output.length < targetLength) {
output = '0' + output;
}
return (sign ? (forceSign ? '+' : '') : '-') + output;
}
var formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g;
var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
var formatFunctions = {};
var 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 = '';
for (i = 0; i < length; i++) {
output += array[i] instanceof Function ? 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());
if (!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 match1 = /\d/; // 0 - 9
var match2 = /\d\d/; // 00 - 99
var match3 = /\d{3}/; // 000 - 999
var match4 = /\d{4}/; // 0000 - 9999
var match6 = /[+-]?\d{6}/; // -999999 - 999999
var match1to2 = /\d\d?/; // 0 - 99
var match1to3 = /\d{1,3}/; // 0 - 999
var match1to4 = /\d{1,4}/; // 0 - 9999
var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
var matchUnsigned = /\d+/; // 0 - inf
var matchSigned = /[+-]?\d+/; // -inf - inf
var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
// any word (or two) characters or numbers including two/three word month in arabic.
var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
var regexes = {};
function addRegexToken (token, regex, strictRegex) {
regexes[token] = typeof regex === 'function' ? regex : function (isStrict) {
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 s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
return p1 || p2 || p3 || p4;
}).replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
}
var tokens = {};
function addParseToken (token, callback) {
var i, func = callback;
if (typeof token === 'string') {
token = [token];
}
if (typeof callback === 'number') {
func = function (input, array) {
array[callback] = toInt(input);
};
}
for (i = 0; i < token.length; 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;
var MONTH = 1;
var DATE = 2;
var HOUR = 3;
var MINUTE = 4;
var SECOND = 5;
var MILLISECOND = 6;
function daysInMonth(year, month) {
return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
}
// 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');
// PARSING
addRegexToken('M', match1to2);
addRegexToken('MM', match1to2, match2);
addRegexToken('MMM', matchWord);
addRegexToken('MMMM', matchWord);
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('_');
function localeMonths (m) {
return this._months[m.month()];
}
var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
function localeMonthsShort (m) {
return this._monthsShort[m.month()];
}
function localeMonthsParse (monthName, format, strict) {
var i, mom, regex;
if (!this._monthsParse) {
this._monthsParse = [];
this._longMonthsParse = [];
this._shortMonthsParse = [];
}
for (i = 0; i < 12; i++) {
// make the regex if we don't have it already
mom = create_utc__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;
// TODO: Move this out of here!
if (typeof value === 'string') {
value = mom.localeData().monthsParse(value);
// TODO: Another silent failure?
if (typeof value !== 'number') {
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);
utils_hooks__hooks.updateOffset(this, true);
return this;
} else {
return get_set__get(this, 'Month');
}
}
function getDaysInMonth () {
return daysInMonth(this.year(), this.month());
}
function checkOverflow (m) {
var overflow;
var 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;
}
getParsingFlags(m).overflow = overflow;
}
return m;
}
function warn(msg) {
if (utils_hooks__hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) {
console.warn('Deprecation warning: ' + msg);
}
}
function deprecate(msg, fn) {
var firstTime = true,
msgWithStack = msg + '\n' + (new Error()).stack;
return extend(function () {
if (firstTime) {
warn(msgWithStack);
firstTime = false;
}
return fn.apply(this, arguments);
}, fn);
}
var deprecations = {};
function deprecateSimple(name, msg) {
if (!deprecations[name]) {
warn(msg);
deprecations[name] = true;
}
}
utils_hooks__hooks.suppressDeprecationWarnings = false;
var from_string__isoRegex = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
var isoDates = [
['YYYYYY-MM-DD', /[+-]\d{6}-\d{2}-\d{2}/],
['YYYY-MM-DD', /\d{4}-\d{2}-\d{2}/],
['GGGG-[W]WW-E', /\d{4}-W\d{2}-\d/],
['GGGG-[W]WW', /\d{4}-W\d{2}/],
['YYYY-DDD', /\d{4}-\d{3}/]
];
// iso time formats and regexes
var isoTimes = [
['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/],
['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/],
['HH:mm', /(T| )\d\d:\d\d/],
['HH', /(T| )\d\d/]
];
var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
// date from iso format
function configFromISO(config) {
var i, l,
string = config._i,
match = from_string__isoRegex.exec(string);
if (match) {
getParsingFlags(config).iso = true;
for (i = 0, l = isoDates.length; i < l; i++) {
if (isoDates[i][1].exec(string)) {
// match[5] should be 'T' or undefined
config._f = isoDates[i][0] + (match[6] || ' ');
break;
}
}
for (i = 0, l = isoTimes.length; i < l; i++) {
if (isoTimes[i][1].exec(string)) {
config._f += isoTimes[i][0];
break;
}
}
if (string.match(matchOffset)) {
config._f += 'Z';
}
configFromStringAndFormat(config);
} else {
config._isValid = false;
}
}
// date from iso format or fallback
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;
utils_hooks__hooks.createFromInputFallback(config);
}
}
utils_hooks__hooks.createFromInputFallback = deprecate(
'moment construction falls back to js Date. This is ' +
'discouraged and will be removed in upcoming major ' +
'release. Please refer to ' +
'https://github.com/moment/moment/issues/1407 for more info.',
function (config) {
config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
}
);
function createDate (y, m, d, h, M, s, ms) {
//can't just apply() to create a date:
//http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
var date = new Date(y, m, d, h, M, s, ms);
//the date constructor doesn't accept years < 1970
if (y < 1970) {
date.setFullYear(y);
}
return date;
}
function createUTCDate (y) {
var date = new Date(Date.UTC.apply(null, arguments));
if (y < 1970) {
date.setUTCFullYear(y);
}
return date;
}
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');
// PARSING
addRegexToken('Y', matchSigned);
addRegexToken('YY', match1to2, match2);
addRegexToken('YYYY', match1to4, match4);
addRegexToken('YYYYY', match1to6, match6);
addRegexToken('YYYYYY', match1to6, match6);
addParseToken(['YYYY', 'YYYYY', 'YYYYYY'], YEAR);
addParseToken('YY', function (input, array) {
array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input);
});
// HELPERS
function daysInYear(year) {
return isLeapYear(year) ? 366 : 365;
}
function isLeapYear(year) {
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
}
// HOOKS
utils_hooks__hooks.parseTwoDigitYear = function (input) {
return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
};
// MOMENTS
var getSetYear = makeGetSet('FullYear', false);
function getIsLeapYear () {
return isLeapYear(this.year());
}
addFormatToken('w', ['ww', 2], 'wo', 'week');
addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
// ALIASES
addUnitAlias('week', 'w');
addUnitAlias('isoWeek', 'W');
// 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
// firstDayOfWeek 0 = sun, 6 = sat
// the day of the week that starts the week
// (usually sunday or monday)
// firstDayOfWeekOfYear 0 = sun, 6 = sat
// the first week is the week that contains the first
// of this day of the week
// (eg. ISO weeks use thursday (4))
function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {
var end = firstDayOfWeekOfYear - firstDayOfWeek,
daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),
adjustedMoment;
if (daysToDayOfWeek > end) {
daysToDayOfWeek -= 7;
}
if (daysToDayOfWeek < end - 7) {
daysToDayOfWeek += 7;
}
adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');
return {
week: Math.ceil(adjustedMoment.dayOfYear() / 7),
year: adjustedMoment.year()
};
}
// 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 1st 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');
}
addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
// ALIASES
addUnitAlias('dayOfYear', 'DDD');
// PARSING
addRegexToken('DDD', match1to3);
addRegexToken('DDDD', match3);
addParseToken(['DDD', 'DDDD'], function (input, array, config) {
config._dayOfYear = toInt(input);
});
// HELPERS
//http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) {
var d = createUTCDate(year, 0, 1).getUTCDay();
var daysToAdd;
var dayOfYear;
d = d === 0 ? 7 : d;
weekday = weekday != null ? weekday : firstDayOfWeek;
daysToAdd = firstDayOfWeek - d + (d > firstDayOfWeekOfYear ? 7 : 0) - (d < firstDayOfWeek ? 7 : 0);
dayOfYear = 7 * (week - 1) + (weekday - firstDayOfWeek) + daysToAdd + 1;
return {
year : dayOfYear > 0 ? year : year - 1,
dayOfYear : dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear
};
}
// 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');
}
// 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) {
var now = new Date();
if (config._useUTC) {
return [now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()];
}
return [now.getFullYear(), now.getMonth(), now.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, 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) {
yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
if (config._dayOfYear > daysInYear(yearToUse)) {
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);
// 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;
}
}
function dayOfYearFromWeekInfo(config) {
var w, weekYear, week, weekday, dow, doy, temp;
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(local__createLocal(), 1, 4).year);
week = defaults(w.W, 1);
weekday = defaults(w.E, 1);
} else {
dow = config._locale._week.dow;
doy = config._locale._week.doy;
weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year);
week = defaults(w.w, 1);
if (w.d != null) {
// weekday -- low day numbers are considered next week
weekday = w.d;
if (weekday < dow) {
++week;
}
} else if (w.e != null) {
// local weekday -- counting starts from begining of week
weekday = w.e + dow;
} else {
// default to begining of week
weekday = dow;
}
}
temp = dayOfYearFromWeeks(weekYear, week, weekday, doy, dow);
config._a[YEAR] = temp.year;
config._dayOfYear = temp.dayOfYear;
}
utils_hooks__hooks.ISO_8601 = 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 === utils_hooks__hooks.ISO_8601) {
configFromISO(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;
tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
for (i = 0; i < tokens.length; 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 (getParsingFlags(config).bigHour === true &&
config._a[HOUR] <= 12 &&
config._a[HOUR] > 0) {
getParsingFlags(config).bigHour = undefined;
}
// handle meridiem
config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
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;
}
}
function configFromStringAndArray(config) {
var tempConfig,
bestMoment,
scoreToBeat,
i,
currentScore;
if (config._f.length === 0) {
getParsingFlags(config).invalidFormat = true;
config._d = new Date(NaN);
return;
}
for (i = 0; i < config._f.length; i++) {
currentScore = 0;
tempConfig = copyConfig({}, config);
if (config._useUTC != null) {
tempConfig._useUTC = config._useUTC;
}
tempConfig._f = config._f[i];
configFromStringAndFormat(tempConfig);
if (!valid__isValid(tempConfig)) {
continue;
}
// 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 (scoreToBeat == null || currentScore < scoreToBeat) {
scoreToBeat = currentScore;
bestMoment = tempConfig;
}
}
extend(config, bestMoment || tempConfig);
}
function configFromObject(config) {
if (config._d) {
return;
}
var i = normalizeObjectUnits(config._i);
config._a = [i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond];
configFromArray(config);
}
function createFromConfig (config) {
var input = config._i,
format = config._f,
res;
config._locale = config._locale || locale_locales__getLocale(config._l);
if (input === null || (format === undefined && input === '')) {
return valid__createInvalid({nullInput: true});
}
if (typeof input === 'string') {
config._i = input = config._locale.preparse(input);
}
if (isMoment(input)) {
return new Moment(checkOverflow(input));
} else if (isArray(format)) {
configFromStringAndArray(config);
} else if (format) {
configFromStringAndFormat(config);
} else if (isDate(input)) {
config._d = input;
} else {
configFromInput(config);
}
res = new Moment(checkOverflow(config));
if (res._nextDay) {
// Adding is smart enough around DST
res.add(1, 'd');
res._nextDay = undefined;
}
return res;
}
function configFromInput(config) {
var input = config._i;
if (input === undefined) {
config._d = new Date();
} else if (isDate(input)) {
config._d = new Date(+input);
} 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 (typeof(input) === 'object') {
configFromObject(config);
} else if (typeof(input) === 'number') {
// from milliseconds
config._d = new Date(input);
} else {
utils_hooks__hooks.createFromInputFallback(config);
}
}
function createLocalOrUTC (input, format, locale, strict, isUTC) {
var c = {};
if (typeof(locale) === 'boolean') {
strict = locale;
locale = 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 local__createLocal (input, format, locale, strict) {
return createLocalOrUTC(input, format, locale, strict, false);
}
var prototypeMin = deprecate(
'moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548',
function () {
var other = local__createLocal.apply(null, arguments);
return other < this ? this : other;
}
);
var prototypeMax = deprecate(
'moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548',
function () {
var other = local__createLocal.apply(null, arguments);
return other > this ? this : other;
}
);
// 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 local__createLocal();
}
res = moments[0];
for (i = 1; i < moments.length; ++i) {
if (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);
}
function Duration (duration) {
var normalizedInput = normalizeObjectUnits(duration),
years = normalizedInput.year || 0,
quarters = normalizedInput.quarter || 0,
months = normalizedInput.month || 0,
weeks = normalizedInput.week || 0,
days = normalizedInput.day || 0,
hours = normalizedInput.hour || 0,
minutes = normalizedInput.minute || 0,
seconds = normalizedInput.second || 0,
milliseconds = normalizedInput.millisecond || 0;
// representation for dateAddRemove
this._milliseconds = +milliseconds +
seconds * 1e3 + // 1000
minutes * 6e4 + // 1000 * 60
hours * 36e5; // 1000 * 60 * 60
// 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 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 = locale_locales__getLocale();
this._bubble();
}
function isDuration (obj) {
return obj instanceof Duration;
}
function offset (token, separator) {
addFormatToken(token, 0, 0, function () {
var offset = this.utcOffset();
var 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', matchOffset);
addRegexToken('ZZ', matchOffset);
addParseToken(['Z', 'ZZ'], function (input, array, config) {
config._useUTC = true;
config._tzm = offsetFromString(input);
});
// HELPERS
// timezone chunker
// '+10:00' > ['10', '00']
// '-1530' > ['-15', '30']
var chunkOffset = /([\+\-]|\d\d)/gi;
function offsetFromString(string) {
var matches = ((string || '').match(matchOffset) || []);
var chunk = matches[matches.length - 1] || [];
var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
var minutes = +(parts[1] * 60) + toInt(parts[2]);
return 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 : +local__createLocal(input)) - (+res);
// Use low-level api, because this fn is low-level api.
res._d.setTime(+res._d + diff);
utils_hooks__hooks.updateOffset(res, false);
return res;
} else {
return local__createLocal(input).local();
}
return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__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() / 15) * 15;
}
// HOOKS
// This function will be called whenever a moment is mutated.
// It is intended to keep the offset in sync with the timezone.
utils_hooks__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) {
var offset = this._offset || 0,
localAdjust;
if (input != null) {
if (typeof input === 'string') {
input = offsetFromString(input);
}
if (Math.abs(input) < 16) {
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) {
add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false);
} else if (!this._changeInProgress) {
this._changeInProgress = true;
utils_hooks__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) {
this.utcOffset(this._tzm);
} else if (typeof this._i === 'string') {
this.utcOffset(offsetFromString(this._i));
}
return this;
}
function hasAlignedHourOffset (input) {
if (!input) {
input = 0;
}
else {
input = local__createLocal(input).utcOffset();
}
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 (this._a) {
var other = this._isUTC ? create_utc__createUTC(this._a) : local__createLocal(this._a);
return this.isValid() && compareArrays(this._a, other.toArray()) > 0;
}
return false;
}
function isLocal () {
return !this._isUTC;
}
function isUtcOffset () {
return this._isUTC;
}
function isUtc () {
return this._isUTC && this._offset === 0;
}
var aspNetRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/;
// 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
var create__isoRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;
function create__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 (typeof input === 'number') {
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(match[MILLISECOND]) * sign
};
} else if (!!(match = create__isoRegex.exec(input))) {
sign = (match[1] === '-') ? -1 : 1;
duration = {
y : parseIso(match[2], sign),
M : parseIso(match[3], sign),
d : parseIso(match[4], sign),
h : parseIso(match[5], sign),
m : parseIso(match[6], sign),
s : parseIso(match[7], sign),
w : 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(local__createLocal(duration.from), local__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;
}
return ret;
}
create__createDuration.fn = Duration.prototype;
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 = {milliseconds: 0, months: 0};
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;
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;
}
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).');
tmp = val; val = period; period = tmp;
}
val = typeof val === 'string' ? +val : val;
dur = create__createDuration(val, period);
add_subtract__addSubtract(this, dur, direction);
return this;
};
}
function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) {
var milliseconds = duration._milliseconds,
days = duration._days,
months = duration._months;
updateOffset = updateOffset == null ? true : updateOffset;
if (milliseconds) {
mom._d.setTime(+mom._d + milliseconds * isAdding);
}
if (days) {
get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding);
}
if (months) {
setMonth(mom, get_set__get(mom, 'Month') + months * isAdding);
}
if (updateOffset) {
utils_hooks__hooks.updateOffset(mom, days || months);
}
}
var add_subtract__add = createAdder(1, 'add');
var add_subtract__subtract = createAdder(-1, 'subtract');
function moment_calendar__calendar (time) {
// 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 || local__createLocal(),
sod = cloneWithOffset(now, this).startOf('day'),
diff = this.diff(sod, 'days', true),
format = diff < -6 ? 'sameElse' :
diff < -1 ? 'lastWeek' :
diff < 0 ? 'lastDay' :
diff < 1 ? 'sameDay' :
diff < 2 ? 'nextDay' :
diff < 7 ? 'nextWeek' : 'sameElse';
return this.format(this.localeData().calendar(format, this, local__createLocal(now)));
}
function clone () {
return new Moment(this);
}
function isAfter (input, units) {
var inputMs;
units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
if (units === 'millisecond') {
input = isMoment(input) ? input : local__createLocal(input);
return +this > +input;
} else {
inputMs = isMoment(input) ? +input : +local__createLocal(input);
return inputMs < +this.clone().startOf(units);
}
}
function isBefore (input, units) {
var inputMs;
units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
if (units === 'millisecond') {
input = isMoment(input) ? input : local__createLocal(input);
return +this < +input;
} else {
inputMs = isMoment(input) ? +input : +local__createLocal(input);
return +this.clone().endOf(units) < inputMs;
}
}
function isBetween (from, to, units) {
return this.isAfter(from, units) && this.isBefore(to, units);
}
function isSame (input, units) {
var inputMs;
units = normalizeUnits(units || 'millisecond');
if (units === 'millisecond') {
input = isMoment(input) ? input : local__createLocal(input);
return +this === +input;
} else {
inputMs = +local__createLocal(input);
return +(this.clone().startOf(units)) <= inputMs && inputMs <= +(this.clone().endOf(units));
}
}
function absFloor (number) {
if (number < 0) {
return Math.ceil(number);
} else {
return Math.floor(number);
}
}
function diff (input, units, asFloat) {
var that = cloneWithOffset(input, this),
zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4,
delta, output;
units = normalizeUnits(units);
if (units === 'year' || units === 'month' || units === 'quarter') {
output = monthDiff(this, that);
if (units === 'quarter') {
output = output / 3;
} else if (units === 'year') {
output = output / 12;
}
} else {
delta = this - that;
output = units === 'second' ? delta / 1e3 : // 1000
units === 'minute' ? delta / 6e4 : // 1000 * 60
units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60
units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
delta;
}
return asFloat ? output : absFloor(output);
}
function monthDiff (a, b) {
// 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);
}
return -(wholeMonthDiff + adjust);
}
utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
function toString () {
return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
}
function moment_format__toISOString () {
var m = this.clone().utc();
if (0 < m.year() && m.year() <= 9999) {
if ('function' === typeof Date.prototype.toISOString) {
// native implementation is ~50x faster, use it when we can
return this.toDate().toISOString();
} else {
return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
}
} else {
return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
}
}
function format (inputString) {
var output = formatMoment(this, inputString || utils_hooks__hooks.defaultFormat);
return this.localeData().postformat(output);
}
function from (time, withoutSuffix) {
if (!this.isValid()) {
return this.localeData().invalidDate();
}
return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
}
function fromNow (withoutSuffix) {
return this.from(local__createLocal(), withoutSuffix);
}
function to (time, withoutSuffix) {
if (!this.isValid()) {
return this.localeData().invalidDate();
}
return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
}
function toNow (withoutSuffix) {
return this.to(local__createLocal(), withoutSuffix);
}
function locale (key) {
var newLocaleData;
if (key === undefined) {
return this._locale._abbr;
} else {
newLocaleData = locale_locales__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;
}
function startOf (units) {
units = normalizeUnits(units);
// the following switch intentionally omits break keywords
// to utilize falling through the cases.
switch (units) {
case 'year':
this.month(0);
/* falls through */
case 'quarter':
case 'month':
this.date(1);
/* falls through */
case 'week':
case 'isoWeek':
case 'day':
this.hours(0);
/* falls through */
case 'hour':
this.minutes(0);
/* falls through */
case 'minute':
this.seconds(0);
/* falls through */
case 'second':
this.milliseconds(0);
}
// weeks are a special case
if (units === 'week') {
this.weekday(0);
}
if (units === 'isoWeek') {
this.isoWeekday(1);
}
// quarters are also special
if (units === 'quarter') {
this.month(Math.floor(this.month() / 3) * 3);
}
return this;
}
function endOf (units) {
units = normalizeUnits(units);
if (units === undefined || units === 'millisecond') {
return this;
}
return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
}
function to_type__valueOf () {
return +this._d - ((this._offset || 0) * 60000);
}
function unix () {
return Math.floor(+this / 1000);
}
function toDate () {
return this._offset ? new Date(+this) : this._d;
}
function toArray () {
var m = this;
return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
}
function moment_valid__isValid () {
return valid__isValid(this);
}
function parsingFlags () {
return extend({}, getParsingFlags(this));
}
function invalidAt () {
return getParsingFlags(this).overflow;
}
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');
// 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] = utils_hooks__hooks.parseTwoDigitYear(input);
});
// HELPERS
function weeksInYear(year, dow, doy) {
return weekOfYear(local__createLocal([year, 11, 31 + dow - doy]), dow, doy).week;
}
// MOMENTS
function getSetWeekYear (input) {
var year = weekOfYear(this, this.localeData()._week.dow, this.localeData()._week.doy).year;
return input == null ? year : this.add((input - year), 'y');
}
function getSetISOWeekYear (input) {
var year = weekOfYear(this, 1, 4).year;
return input == null ? year : this.add((input - year), 'y');
}
function getISOWeeksInYear () {
return weeksInYear(this.year(), 1, 4);
}
function getWeeksInYear () {
var weekInfo = this.localeData()._week;
return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
}
addFormatToken('Q', 0, 0, 'quarter');
// ALIASES
addUnitAlias('quarter', 'Q');
// 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);
}
addFormatToken('D', ['DD', 2], 'Do', 'date');
// ALIASES
addUnitAlias('date', 'D');
// PARSING
addRegexToken('D', match1to2);
addRegexToken('DD', match1to2, match2);
addRegexToken('Do', function (isStrict, locale) {
return isStrict ? locale._ordinalParse : locale._ordinalParseLenient;
});
addParseToken(['D', 'DD'], DATE);
addParseToken('Do', function (input, array) {
array[DATE] = toInt(input.match(match1to2)[0], 10);
});
// MOMENTS
var getSetDayOfMonth = makeGetSet('Date', true);
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');
// PARSING
addRegexToken('d', match1to2);
addRegexToken('e', match1to2);
addRegexToken('E', match1to2);
addRegexToken('dd', matchWord);
addRegexToken('ddd', matchWord);
addRegexToken('dddd', matchWord);
addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config) {
var weekday = config._locale.weekdaysParse(input);
// 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') {
if (!isNaN(input)) {
input = parseInt(input, 10);
}
else {
input = locale.weekdaysParse(input);
if (typeof input !== 'number') {
return null;
}
}
}
return input;
}
// LOCALES
var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
function localeWeekdays (m) {
return this._weekdays[m.day()];
}
var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
function localeWeekdaysShort (m) {
return this._weekdaysShort[m.day()];
}
var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
function localeWeekdaysMin (m) {
return this._weekdaysMin[m.day()];
}
function localeWeekdaysParse (weekdayName) {
var i, mom, regex;
if (!this._weekdaysParse) {
this._weekdaysParse = [];
}
for (i = 0; i < 7; i++) {
// make the regex if we don't have it already
if (!this._weekdaysParse[i]) {
mom = local__createLocal([2000, 1]).day(i);
regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
}
// test the regex
if (this._weekdaysParse[i].test(weekdayName)) {
return i;
}
}
}
// MOMENTS
function getSetDayOfWeek (input) {
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) {
var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
return input == null ? weekday : this.add(input - weekday, 'd');
}
function getSetISODayOfWeek (input) {
// 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.
return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
}
addFormatToken('H', ['HH', 2], 0, 'hour');
addFormatToken('h', ['hh', 2], 0, function () {
return this.hours() % 12 || 12;
});
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');
// PARSING
function matchMeridiem (isStrict, locale) {
return locale._meridiemParse;
}
addRegexToken('a', matchMeridiem);
addRegexToken('A', matchMeridiem);
addRegexToken('H', match1to2);
addRegexToken('h', match1to2);
addRegexToken('HH', match1to2, match2);
addRegexToken('hh', match1to2, match2);
addParseToken(['H', 'HH'], HOUR);
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;
});
// 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;
function localeMeridiem (hours, minutes, isLower) {
if (hours > 11) {
return isLower ? 'pm' : 'PM';
} else {
return isLower ? 'am' : 'AM';
}
}
// MOMENTS
// Setting the hour should keep the time, because the user explicitly
// specified which hour he wants. So trying to maintain the same hour (in
// a new timezone) makes sense. Adding/subtracting hours does not follow
// this rule.
var getSetHour = makeGetSet('Hours', true);
addFormatToken('m', ['mm', 2], 0, 'minute');
// ALIASES
addUnitAlias('minute', 'm');
// PARSING
addRegexToken('m', match1to2);
addRegexToken('mm', match1to2, match2);
addParseToken(['m', 'mm'], MINUTE);
// MOMENTS
var getSetMinute = makeGetSet('Minutes', false);
addFormatToken('s', ['ss', 2], 0, 'second');
// ALIASES
addUnitAlias('second', 's');
// PARSING
addRegexToken('s', match1to2);
addRegexToken('ss', match1to2, match2);
addParseToken(['s', 'ss'], SECOND);
// MOMENTS
var getSetSecond = makeGetSet('Seconds', false);
addFormatToken('S', 0, 0, function () {
return ~~(this.millisecond() / 100);
});
addFormatToken(0, ['SS', 2], 0, function () {
return ~~(this.millisecond() / 10);
});
function millisecond__milliseconds (token) {
addFormatToken(0, [token, 3], 0, 'millisecond');
}
millisecond__milliseconds('SSS');
millisecond__milliseconds('SSSS');
// ALIASES
addUnitAlias('millisecond', 'ms');
// PARSING
addRegexToken('S', match1to3, match1);
addRegexToken('SS', match1to3, match2);
addRegexToken('SSS', match1to3, match3);
addRegexToken('SSSS', matchUnsigned);
addParseToken(['S', 'SS', 'SSS', 'SSSS'], function (input, array) {
array[MILLISECOND] = toInt(('0.' + input) * 1000);
});
// MOMENTS
var getSetMillisecond = makeGetSet('Milliseconds', false);
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 momentPrototype__proto = Moment.prototype;
momentPrototype__proto.add = add_subtract__add;
momentPrototype__proto.calendar = moment_calendar__calendar;
momentPrototype__proto.clone = clone;
momentPrototype__proto.diff = diff;
momentPrototype__proto.endOf = endOf;
momentPrototype__proto.format = format;
momentPrototype__proto.from = from;
momentPrototype__proto.fromNow = fromNow;
momentPrototype__proto.to = to;
momentPrototype__proto.toNow = toNow;
momentPrototype__proto.get = getSet;
momentPrototype__proto.invalidAt = invalidAt;
momentPrototype__proto.isAfter = isAfter;
momentPrototype__proto.isBefore = isBefore;
momentPrototype__proto.isBetween = isBetween;
momentPrototype__proto.isSame = isSame;
momentPrototype__proto.isValid = moment_valid__isValid;
momentPrototype__proto.lang = lang;
momentPrototype__proto.locale = locale;
momentPrototype__proto.localeData = localeData;
momentPrototype__proto.max = prototypeMax;
momentPrototype__proto.min = prototypeMin;
momentPrototype__proto.parsingFlags = parsingFlags;
momentPrototype__proto.set = getSet;
momentPrototype__proto.startOf = startOf;
momentPrototype__proto.subtract = add_subtract__subtract;
momentPrototype__proto.toArray = toArray;
momentPrototype__proto.toDate = toDate;
momentPrototype__proto.toISOString = moment_format__toISOString;
momentPrototype__proto.toJSON = moment_format__toISOString;
momentPrototype__proto.toString = toString;
momentPrototype__proto.unix = unix;
momentPrototype__proto.valueOf = to_type__valueOf;
// Year
momentPrototype__proto.year = getSetYear;
momentPrototype__proto.isLeapYear = getIsLeapYear;
// Week Year
momentPrototype__proto.weekYear = getSetWeekYear;
momentPrototype__proto.isoWeekYear = getSetISOWeekYear;
// Quarter
momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter;
// Month
momentPrototype__proto.month = getSetMonth;
momentPrototype__proto.daysInMonth = getDaysInMonth;
// Week
momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek;
momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek;
momentPrototype__proto.weeksInYear = getWeeksInYear;
momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear;
// Day
momentPrototype__proto.date = getSetDayOfMonth;
momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek;
momentPrototype__proto.weekday = getSetLocaleDayOfWeek;
momentPrototype__proto.isoWeekday = getSetISODayOfWeek;
momentPrototype__proto.dayOfYear = getSetDayOfYear;
// Hour
momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour;
// Minute
momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute;
// Second
momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond;
// Millisecond
momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond;
// Offset
momentPrototype__proto.utcOffset = getSetOffset;
momentPrototype__proto.utc = setOffsetToUTC;
momentPrototype__proto.local = setOffsetToLocal;
momentPrototype__proto.parseZone = setOffsetToParsedOffset;
momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset;
momentPrototype__proto.isDST = isDaylightSavingTime;
momentPrototype__proto.isDSTShifted = isDaylightSavingTimeShifted;
momentPrototype__proto.isLocal = isLocal;
momentPrototype__proto.isUtcOffset = isUtcOffset;
momentPrototype__proto.isUtc = isUtc;
momentPrototype__proto.isUTC = isUtc;
// Timezone
momentPrototype__proto.zoneAbbr = getZoneAbbr;
momentPrototype__proto.zoneName = getZoneName;
// Deprecations
momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779', getSetZone);
var momentPrototype = momentPrototype__proto;
function moment__createUnix (input) {
return local__createLocal(input * 1000);
}
function moment__createInZone () {
return local__createLocal.apply(null, arguments).parseZone();
}
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 locale_calendar__calendar (key, mom, now) {
var output = this._calendar[key];
return typeof output === 'function' ? output.call(mom, now) : output;
}
var defaultLongDateFormat = {
LTS : 'h:mm:ss A',
LT : 'h:mm A',
L : 'MM/DD/YYYY',
LL : 'MMMM D, YYYY',
LLL : 'MMMM D, YYYY LT',
LLLL : 'dddd, MMMM D, YYYY LT'
};
function longDateFormat (key) {
var output = this._longDateFormat[key];
if (!output && this._longDateFormat[key.toUpperCase()]) {
output = this._longDateFormat[key.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (val) {
return val.slice(1);
});
this._longDateFormat[key] = output;
}
return output;
}
var defaultInvalidDate = 'Invalid date';
function invalidDate () {
return this._invalidDate;
}
var defaultOrdinal = '%d';
var defaultOrdinalParse = /\d{1,2}/;
function ordinal (number) {
return this._ordinal.replace('%d', number);
}
function preParsePostFormat (string) {
return string;
}
var defaultRelativeTime = {
future : 'in %s',
past : '%s ago',
s : 'a few seconds',
m : 'a minute',
mm : '%d minutes',
h : 'an hour',
hh : '%d hours',
d : 'a day',
dd : '%d days',
M : 'a month',
MM : '%d months',
y : 'a year',
yy : '%d years'
};
function relative__relativeTime (number, withoutSuffix, string, isFuture) {
var output = this._relativeTime[string];
return (typeof output === 'function') ?
output(number, withoutSuffix, string, isFuture) :
output.replace(/%d/i, number);
}
function pastFuture (diff, output) {
var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
return typeof format === 'function' ? format(output) : format.replace(/%s/i, output);
}
function locale_set__set (config) {
var prop, i;
for (i in config) {
prop = config[i];
if (typeof prop === 'function') {
this[i] = prop;
} else {
this['_' + i] = prop;
}
}
// Lenient ordinal parsing accepts just a number in addition to
// number + (possibly) stuff coming from _ordinalParseLenient.
this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source);
}
var prototype__proto = Locale.prototype;
prototype__proto._calendar = defaultCalendar;
prototype__proto.calendar = locale_calendar__calendar;
prototype__proto._longDateFormat = defaultLongDateFormat;
prototype__proto.longDateFormat = longDateFormat;
prototype__proto._invalidDate = defaultInvalidDate;
prototype__proto.invalidDate = invalidDate;
prototype__proto._ordinal = defaultOrdinal;
prototype__proto.ordinal = ordinal;
prototype__proto._ordinalParse = defaultOrdinalParse;
prototype__proto.preparse = preParsePostFormat;
prototype__proto.postformat = preParsePostFormat;
prototype__proto._relativeTime = defaultRelativeTime;
prototype__proto.relativeTime = relative__relativeTime;
prototype__proto.pastFuture = pastFuture;
prototype__proto.set = locale_set__set;
// Month
prototype__proto.months = localeMonths;
prototype__proto._months = defaultLocaleMonths;
prototype__proto.monthsShort = localeMonthsShort;
prototype__proto._monthsShort = defaultLocaleMonthsShort;
prototype__proto.monthsParse = localeMonthsParse;
// Week
prototype__proto.week = localeWeek;
prototype__proto._week = defaultLocaleWeek;
prototype__proto.firstDayOfYear = localeFirstDayOfYear;
prototype__proto.firstDayOfWeek = localeFirstDayOfWeek;
// Day of Week
prototype__proto.weekdays = localeWeekdays;
prototype__proto._weekdays = defaultLocaleWeekdays;
prototype__proto.weekdaysMin = localeWeekdaysMin;
prototype__proto._weekdaysMin = defaultLocaleWeekdaysMin;
prototype__proto.weekdaysShort = localeWeekdaysShort;
prototype__proto._weekdaysShort = defaultLocaleWeekdaysShort;
prototype__proto.weekdaysParse = localeWeekdaysParse;
// Hours
prototype__proto.isPM = localeIsPM;
prototype__proto._meridiemParse = defaultLocaleMeridiemParse;
prototype__proto.meridiem = localeMeridiem;
function lists__get (format, index, field, setter) {
var locale = locale_locales__getLocale();
var utc = create_utc__createUTC().set(setter, index);
return locale[field](utc, format);
}
function list (format, index, field, count, setter) {
if (typeof format === 'number') {
index = format;
format = undefined;
}
format = format || '';
if (index != null) {
return lists__get(format, index, field, setter);
}
var i;
var out = [];
for (i = 0; i < count; i++) {
out[i] = lists__get(format, i, field, setter);
}
return out;
}
function lists__listMonths (format, index) {
return list(format, index, 'months', 12, 'month');
}
function lists__listMonthsShort (format, index) {
return list(format, index, 'monthsShort', 12, 'month');
}
function lists__listWeekdays (format, index) {
return list(format, index, 'weekdays', 7, 'day');
}
function lists__listWeekdaysShort (format, index) {
return list(format, index, 'weekdaysShort', 7, 'day');
}
function lists__listWeekdaysMin (format, index) {
return list(format, index, 'weekdaysMin', 7, 'day');
}
locale_locales__getSetGlobalLocale('en', {
ordinalParse: /\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
utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale);
utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale);
var mathAbs = Math.abs;
function duration_abs__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 duration_add_subtract__addSubtract (duration, input, value, direction) {
var other = create__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 duration_add_subtract__add (input, value) {
return duration_add_subtract__addSubtract(this, input, value, 1);
}
// supports only 2.0-style subtract(1, 's') or subtract(duration)
function duration_add_subtract__subtract (input, value) {
return duration_add_subtract__addSubtract(this, input, value, -1);
}
function bubble () {
var milliseconds = this._milliseconds;
var days = this._days;
var months = this._months;
var data = this._data;
var seconds, minutes, hours, years = 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);
// Accurately convert days to years, assume start from year 0.
years = absFloor(daysToYears(days));
days -= absFloor(yearsToDays(years));
// 30 days to a month
// TODO (iskren): Use anchor date (like 1st Jan) to compute this.
months += absFloor(days / 30);
days %= 30;
// 12 months -> 1 year
years += absFloor(months / 12);
months %= 12;
data.days = days;
data.months = months;
data.years = years;
return this;
}
function daysToYears (days) {
// 400 years have 146097 days (taking into account leap year rules)
return days * 400 / 146097;
}
function yearsToDays (years) {
// years * 365 + absFloor(years / 4) -
// absFloor(years / 100) + absFloor(years / 400);
return years * 146097 / 400;
}
function as (units) {
var days;
var months;
var milliseconds = this._milliseconds;
units = normalizeUnits(units);
if (units === 'month' || units === 'year') {
days = this._days + milliseconds / 864e5;
months = this._months + daysToYears(days) * 12;
return units === 'month' ? months : months / 12;
} else {
// handle milliseconds separately because of floating point math errors (issue #1867)
days = this._days + Math.round(yearsToDays(this._months / 12));
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 duration_as__valueOf () {
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');
var asSeconds = makeAs('s');
var asMinutes = makeAs('m');
var asHours = makeAs('h');
var asDays = makeAs('d');
var asWeeks = makeAs('w');
var asMonths = makeAs('M');
var asYears = makeAs('y');
function duration_get__get (units) {
units = normalizeUnits(units);
return this[units + 's']();
}
function makeGetter(name) {
return function () {
return this._data[name];
};
}
var duration_get__milliseconds = makeGetter('milliseconds');
var seconds = makeGetter('seconds');
var minutes = makeGetter('minutes');
var hours = makeGetter('hours');
var days = makeGetter('days');
var months = makeGetter('months');
var years = makeGetter('years');
function weeks () {
return absFloor(this.days() / 7);
}
var round = Math.round;
var thresholds = {
s: 45, // seconds to minute
m: 45, // minutes to hour
h: 22, // hours to day
d: 26, // days 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 duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) {
var duration = create__createDuration(posNegDuration).abs();
var seconds = round(duration.as('s'));
var minutes = round(duration.as('m'));
var hours = round(duration.as('h'));
var days = round(duration.as('d'));
var months = round(duration.as('M'));
var years = round(duration.as('y'));
var a = seconds < thresholds.s && ['s', 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] ||
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 a threshold for relative time strings
function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) {
if (thresholds[threshold] === undefined) {
return false;
}
if (limit === undefined) {
return thresholds[threshold];
}
thresholds[threshold] = limit;
return true;
}
function humanize (withSuffix) {
var locale = this.localeData();
var output = duration_humanize__relativeTime(this, !withSuffix, locale);
if (withSuffix) {
output = locale.pastFuture(+this, output);
}
return locale.postformat(output);
}
var iso_string__abs = Math.abs;
function iso_string__toISOString() {
// inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
var Y = iso_string__abs(this.years());
var M = iso_string__abs(this.months());
var D = iso_string__abs(this.days());
var h = iso_string__abs(this.hours());
var m = iso_string__abs(this.minutes());
var s = iso_string__abs(this.seconds() + this.milliseconds() / 1000);
var total = this.asSeconds();
if (!total) {
// this is the same as C#'s (Noda) and python (isodate)...
// but not other JS (goog.date)
return 'P0D';
}
return (total < 0 ? '-' : '') +
'P' +
(Y ? Y + 'Y' : '') +
(M ? M + 'M' : '') +
(D ? D + 'D' : '') +
((h || m || s) ? 'T' : '') +
(h ? h + 'H' : '') +
(m ? m + 'M' : '') +
(s ? s + 'S' : '');
}
var duration_prototype__proto = Duration.prototype;
duration_prototype__proto.abs = duration_abs__abs;
duration_prototype__proto.add = duration_add_subtract__add;
duration_prototype__proto.subtract = duration_add_subtract__subtract;
duration_prototype__proto.as = as;
duration_prototype__proto.asMilliseconds = asMilliseconds;
duration_prototype__proto.asSeconds = asSeconds;
duration_prototype__proto.asMinutes = asMinutes;
duration_prototype__proto.asHours = asHours;
duration_prototype__proto.asDays = asDays;
duration_prototype__proto.asWeeks = asWeeks;
duration_prototype__proto.asMonths = asMonths;
duration_prototype__proto.asYears = asYears;
duration_prototype__proto.valueOf = duration_as__valueOf;
duration_prototype__proto._bubble = bubble;
duration_prototype__proto.get = duration_get__get;
duration_prototype__proto.milliseconds = duration_get__milliseconds;
duration_prototype__proto.seconds = seconds;
duration_prototype__proto.minutes = minutes;
duration_prototype__proto.hours = hours;
duration_prototype__proto.days = days;
duration_prototype__proto.weeks = weeks;
duration_prototype__proto.months = months;
duration_prototype__proto.years = years;
duration_prototype__proto.humanize = humanize;
duration_prototype__proto.toISOString = iso_string__toISOString;
duration_prototype__proto.toString = iso_string__toISOString;
duration_prototype__proto.toJSON = iso_string__toISOString;
duration_prototype__proto.locale = locale;
duration_prototype__proto.localeData = localeData;
// Deprecations
duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString);
duration_prototype__proto.lang = lang;
// Side effect imports
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, 10) * 1000);
});
addParseToken('x', function (input, array, config) {
config._d = new Date(toInt(input));
});
// Side effect imports
utils_hooks__hooks.version = '2.10.3';
setHookCallback(local__createLocal);
utils_hooks__hooks.fn = momentPrototype;
utils_hooks__hooks.min = min;
utils_hooks__hooks.max = max;
utils_hooks__hooks.utc = create_utc__createUTC;
utils_hooks__hooks.unix = moment__createUnix;
utils_hooks__hooks.months = lists__listMonths;
utils_hooks__hooks.isDate = isDate;
utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale;
utils_hooks__hooks.invalid = valid__createInvalid;
utils_hooks__hooks.duration = create__createDuration;
utils_hooks__hooks.isMoment = isMoment;
utils_hooks__hooks.weekdays = lists__listWeekdays;
utils_hooks__hooks.parseZone = moment__createInZone;
utils_hooks__hooks.localeData = locale_locales__getLocale;
utils_hooks__hooks.isDuration = isDuration;
utils_hooks__hooks.monthsShort = lists__listMonthsShort;
utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin;
utils_hooks__hooks.defineLocale = defineLocale;
utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort;
utils_hooks__hooks.normalizeUnits = normalizeUnits;
utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold;
var _moment = utils_hooks__hooks;
return _moment;
}));
},{}],"numeral":[function(require,module,exports){
"use strict";
(function() {
var numeral,
VERSION = '1.5.3',
languages = {},
currentLanguage = 'en',
zeroFormat = null,
defaultFormat = '0,0',
hasModule = (typeof module !== 'undefined' && module.exports);
function Numeral(number) {
this._value = number;
}
function toFixed(value, precision, roundingFunction, optionals) {
var power = Math.pow(10, precision),
optionalsRegExp,
output;
output = (roundingFunction(value * power) / power).toFixed(precision);
if (optionals) {
optionalsRegExp = new RegExp('0{1,' + optionals + '}$');
output = output.replace(optionalsRegExp, '');
}
return output;
}
function formatNumeral(n, format, roundingFunction) {
var output;
if (format.indexOf('$') > -1) {
output = formatCurrency(n, format, roundingFunction);
} else if (format.indexOf('%') > -1) {
output = formatPercentage(n, format, roundingFunction);
} else if (format.indexOf(':') > -1) {
output = formatTime(n, format);
} else {
output = formatNumber(n._value, format, roundingFunction);
}
return output;
}
function unformatNumeral(n, string) {
var stringOriginal = string,
thousandRegExp,
millionRegExp,
billionRegExp,
trillionRegExp,
suffixes = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
bytesMultiplier = false,
power;
if (string.indexOf(':') > -1) {
n._value = unformatTime(string);
} else {
if (string === zeroFormat) {
n._value = 0;
} else {
if (languages[currentLanguage].delimiters.decimal !== '.') {
string = string.replace(/\./g, '').replace(languages[currentLanguage].delimiters.decimal, '.');
}
thousandRegExp = new RegExp('[^a-zA-Z]' + languages[currentLanguage].abbreviations.thousand + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$');
millionRegExp = new RegExp('[^a-zA-Z]' + languages[currentLanguage].abbreviations.million + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$');
billionRegExp = new RegExp('[^a-zA-Z]' + languages[currentLanguage].abbreviations.billion + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$');
trillionRegExp = new RegExp('[^a-zA-Z]' + languages[currentLanguage].abbreviations.trillion + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$');
for (power = 0; power <= suffixes.length; power++) {
bytesMultiplier = (string.indexOf(suffixes[power]) > -1) ? Math.pow(1024, power + 1) : false;
if (bytesMultiplier) {
break;
}
}
n._value = ((bytesMultiplier) ? bytesMultiplier : 1) * ((stringOriginal.match(thousandRegExp)) ? Math.pow(10, 3) : 1) * ((stringOriginal.match(millionRegExp)) ? Math.pow(10, 6) : 1) * ((stringOriginal.match(billionRegExp)) ? Math.pow(10, 9) : 1) * ((stringOriginal.match(trillionRegExp)) ? Math.pow(10, 12) : 1) * ((string.indexOf('%') > -1) ? 0.01 : 1) * (((string.split('-').length + Math.min(string.split('(').length - 1, string.split(')').length - 1)) % 2) ? 1 : -1) * Number(string.replace(/[^0-9\.]+/g, ''));
n._value = (bytesMultiplier) ? Math.ceil(n._value) : n._value;
}
}
return n._value;
}
function formatCurrency(n, format, roundingFunction) {
var symbolIndex = format.indexOf('$'),
openParenIndex = format.indexOf('('),
minusSignIndex = format.indexOf('-'),
space = '',
spliceIndex,
output;
if (format.indexOf(' $') > -1) {
space = ' ';
format = format.replace(' $', '');
} else if (format.indexOf('$ ') > -1) {
space = ' ';
format = format.replace('$ ', '');
} else {
format = format.replace('$', '');
}
output = formatNumber(n._value, format, roundingFunction);
if (symbolIndex <= 1) {
if (output.indexOf('(') > -1 || output.indexOf('-') > -1) {
output = output.split('');
spliceIndex = 1;
if (symbolIndex < openParenIndex || symbolIndex < minusSignIndex) {
spliceIndex = 0;
}
output.splice(spliceIndex, 0, languages[currentLanguage].currency.symbol + space);
output = output.join('');
} else {
output = languages[currentLanguage].currency.symbol + space + output;
}
} else {
if (output.indexOf(')') > -1) {
output = output.split('');
output.splice(-1, 0, space + languages[currentLanguage].currency.symbol);
output = output.join('');
} else {
output = output + space + languages[currentLanguage].currency.symbol;
}
}
return output;
}
function formatPercentage(n, format, roundingFunction) {
var space = '',
output,
value = n._value * 100;
if (format.indexOf(' %') > -1) {
space = ' ';
format = format.replace(' %', '');
} else {
format = format.replace('%', '');
}
output = formatNumber(value, format, roundingFunction);
if (output.indexOf(')') > -1) {
output = output.split('');
output.splice(-1, 0, space + '%');
output = output.join('');
} else {
output = output + space + '%';
}
return output;
}
function formatTime(n) {
var hours = Math.floor(n._value / 60 / 60),
minutes = Math.floor((n._value - (hours * 60 * 60)) / 60),
seconds = Math.round(n._value - (hours * 60 * 60) - (minutes * 60));
return hours + ':' + ((minutes < 10) ? '0' + minutes : minutes) + ':' + ((seconds < 10) ? '0' + seconds : seconds);
}
function unformatTime(string) {
var timeArray = string.split(':'),
seconds = 0;
if (timeArray.length === 3) {
seconds = seconds + (Number(timeArray[0]) * 60 * 60);
seconds = seconds + (Number(timeArray[1]) * 60);
seconds = seconds + Number(timeArray[2]);
} else if (timeArray.length === 2) {
seconds = seconds + (Number(timeArray[0]) * 60);
seconds = seconds + Number(timeArray[1]);
}
return Number(seconds);
}
function formatNumber(value, format, roundingFunction) {
var negP = false,
signed = false,
optDec = false,
abbr = '',
abbrK = false,
abbrM = false,
abbrB = false,
abbrT = false,
abbrForce = false,
bytes = '',
ord = '',
abs = Math.abs(value),
suffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
min,
max,
power,
w,
precision,
thousands,
d = '',
neg = false;
if (value === 0 && zeroFormat !== null) {
return zeroFormat;
} else {
if (format.indexOf('(') > -1) {
negP = true;
format = format.slice(1, -1);
} else if (format.indexOf('+') > -1) {
signed = true;
format = format.replace(/\+/g, '');
}
if (format.indexOf('a') > -1) {
abbrK = format.indexOf('aK') >= 0;
abbrM = format.indexOf('aM') >= 0;
abbrB = format.indexOf('aB') >= 0;
abbrT = format.indexOf('aT') >= 0;
abbrForce = abbrK || abbrM || abbrB || abbrT;
if (format.indexOf(' a') > -1) {
abbr = ' ';
format = format.replace(' a', '');
} else {
format = format.replace('a', '');
}
if (abs >= Math.pow(10, 12) && !abbrForce || abbrT) {
abbr = abbr + languages[currentLanguage].abbreviations.trillion;
value = value / Math.pow(10, 12);
} else if (abs < Math.pow(10, 12) && abs >= Math.pow(10, 9) && !abbrForce || abbrB) {
abbr = abbr + languages[currentLanguage].abbreviations.billion;
value = value / Math.pow(10, 9);
} else if (abs < Math.pow(10, 9) && abs >= Math.pow(10, 6) && !abbrForce || abbrM) {
abbr = abbr + languages[currentLanguage].abbreviations.million;
value = value / Math.pow(10, 6);
} else if (abs < Math.pow(10, 6) && abs >= Math.pow(10, 3) && !abbrForce || abbrK) {
abbr = abbr + languages[currentLanguage].abbreviations.thousand;
value = value / Math.pow(10, 3);
}
}
if (format.indexOf('b') > -1) {
if (format.indexOf(' b') > -1) {
bytes = ' ';
format = format.replace(' b', '');
} else {
format = format.replace('b', '');
}
for (power = 0; power <= suffixes.length; power++) {
min = Math.pow(1024, power);
max = Math.pow(1024, power + 1);
if (value >= min && value < max) {
bytes = bytes + suffixes[power];
if (min > 0) {
value = value / min;
}
break;
}
}
}
if (format.indexOf('o') > -1) {
if (format.indexOf(' o') > -1) {
ord = ' ';
format = format.replace(' o', '');
} else {
format = format.replace('o', '');
}
ord = ord + languages[currentLanguage].ordinal(value);
}
if (format.indexOf('[.]') > -1) {
optDec = true;
format = format.replace('[.]', '.');
}
w = value.toString().split('.')[0];
precision = format.split('.')[1];
thousands = format.indexOf(',');
if (precision) {
if (precision.indexOf('[') > -1) {
precision = precision.replace(']', '');
precision = precision.split('[');
d = toFixed(value, (precision[0].length + precision[1].length), roundingFunction, precision[1].length);
} else {
d = toFixed(value, precision.length, roundingFunction);
}
w = d.split('.')[0];
if (d.split('.')[1].length) {
d = languages[currentLanguage].delimiters.decimal + d.split('.')[1];
} else {
d = '';
}
if (optDec && Number(d.slice(1)) === 0) {
d = '';
}
} else {
w = toFixed(value, null, roundingFunction);
}
if (w.indexOf('-') > -1) {
w = w.slice(1);
neg = true;
}
if (thousands > -1) {
w = w.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' + languages[currentLanguage].delimiters.thousands);
}
if (format.indexOf('.') === 0) {
w = '';
}
return ((negP && neg) ? '(' : '') + ((!negP && neg) ? '-' : '') + ((!neg && signed) ? '+' : '') + w + d + ((ord) ? ord : '') + ((abbr) ? abbr : '') + ((bytes) ? bytes : '') + ((negP && neg) ? ')' : '');
}
}
numeral = function(input) {
if (numeral.isNumeral(input)) {
input = input.value();
} else if (input === 0 || typeof input === 'undefined') {
input = 0;
} else if (!Number(input)) {
input = numeral.fn.unformat(input);
}
return new Numeral(Number(input));
};
numeral.version = VERSION;
numeral.isNumeral = function(obj) {
return obj instanceof Numeral;
};
numeral.language = function(key, values) {
if (!key) {
return currentLanguage;
}
if (key && !values) {
if (!languages[key]) {
throw new Error('Unknown language : ' + key);
}
currentLanguage = key;
}
if (values || !languages[key]) {
loadLanguage(key, values);
}
return numeral;
};
numeral.languageData = function(key) {
if (!key) {
return languages[currentLanguage];
}
if (!languages[key]) {
throw new Error('Unknown language : ' + key);
}
return languages[key];
};
numeral.language('en', {
delimiters: {
thousands: ',',
decimal: '.'
},
abbreviations: {
thousand: 'k',
million: 'm',
billion: 'b',
trillion: 't'
},
ordinal: function(number) {
var b = number % 10;
return (~~(number % 100 / 10) === 1) ? 'th' : (b === 1) ? 'st' : (b === 2) ? 'nd' : (b === 3) ? 'rd' : 'th';
},
currency: {symbol: '$'}
});
numeral.zeroFormat = function(format) {
zeroFormat = typeof(format) === 'string' ? format : null;
};
numeral.defaultFormat = function(format) {
defaultFormat = typeof(format) === 'string' ? format : '0.0';
};
numeral.validate = function(val, culture) {
var _decimalSep,
_thousandSep,
_currSymbol,
_valArray,
_abbrObj,
_thousandRegEx,
languageData,
temp;
if (typeof val !== 'string') {
val += '';
if (console.warn) {
console.warn('Numeral.js: Value is not string. It has been co-erced to: ', val);
}
}
val = val.trim();
if (val === '') {
return false;
}
val = val.replace(/^[+-]?/, '');
try {
languageData = numeral.languageData(culture);
} catch (e) {
languageData = numeral.languageData(numeral.language());
}
_currSymbol = languageData.currency.symbol;
_abbrObj = languageData.abbreviations;
_decimalSep = languageData.delimiters.decimal;
if (languageData.delimiters.thousands === '.') {
_thousandSep = '\\.';
} else {
_thousandSep = languageData.delimiters.thousands;
}
temp = val.match(/^[^\d\.\,]+/);
if (temp !== null) {
val = val.substr(1);
if (temp[0] !== _currSymbol) {
return false;
}
}
temp = val.match(/[^\d]+$/);
if (temp !== null) {
val = val.slice(0, -1);
if (temp[0] !== _abbrObj.thousand && temp[0] !== _abbrObj.million && temp[0] !== _abbrObj.billion && temp[0] !== _abbrObj.trillion) {
return false;
}
}
if (!!val.match(/^\d+$/)) {
return true;
}
_thousandRegEx = new RegExp(_thousandSep + '{2}');
if (!val.match(/[^\d.,]/g)) {
_valArray = val.split(_decimalSep);
if (_valArray.length > 2) {
return false;
} else {
if (_valArray.length < 2) {
return (!!_valArray[0].match(/^\d+.*\d$/) && !_valArray[0].match(_thousandRegEx));
} else {
if (_valArray[0] === '') {
return (!_valArray[0].match(_thousandRegEx) && !!_valArray[1].match(/^\d+$/));
} else if (_valArray[0].length === 1) {
return (!!_valArray[0].match(/^\d+$/) && !_valArray[0].match(_thousandRegEx) && !!_valArray[1].match(/^\d+$/));
} else {
return (!!_valArray[0].match(/^\d+.*\d$/) && !_valArray[0].match(_thousandRegEx) && !!_valArray[1].match(/^\d+$/));
}
}
}
}
return false;
};
function loadLanguage(key, values) {
languages[key] = values;
}
if ('function' !== typeof Array.prototype.reduce) {
Array.prototype.reduce = function(callback, opt_initialValue) {
'use strict';
if (null === this || 'undefined' === typeof this) {
throw new TypeError('Array.prototype.reduce called on null or undefined');
}
if ('function' !== typeof callback) {
throw new TypeError(callback + ' is not a function');
}
var index,
value,
length = this.length >>> 0,
isValueSet = false;
if (1 < arguments.length) {
value = opt_initialValue;
isValueSet = true;
}
for (index = 0; length > index; ++index) {
if (this.hasOwnProperty(index)) {
if (isValueSet) {
value = callback(value, this[index], index, this);
} else {
value = this[index];
isValueSet = true;
}
}
}
if (!isValueSet) {
throw new TypeError('Reduce of empty array with no initial value');
}
return value;
};
}
function multiplier(x) {
var parts = x.toString().split('.');
if (parts.length < 2) {
return 1;
}
return Math.pow(10, parts[1].length);
}
function correctionFactor() {
var args = Array.prototype.slice.call(arguments);
return args.reduce(function(prev, next) {
var mp = multiplier(prev),
mn = multiplier(next);
return mp > mn ? mp : mn;
}, -Infinity);
}
numeral.fn = Numeral.prototype = {
clone: function() {
return numeral(this);
},
format: function(inputString, roundingFunction) {
return formatNumeral(this, inputString ? inputString : defaultFormat, (roundingFunction !== undefined) ? roundingFunction : Math.round);
},
unformat: function(inputString) {
if (Object.prototype.toString.call(inputString) === '[object Number]') {
return inputString;
}
return unformatNumeral(this, inputString ? inputString : defaultFormat);
},
value: function() {
return this._value;
},
valueOf: function() {
return this._value;
},
set: function(value) {
this._value = Number(value);
return this;
},
add: function(value) {
var corrFactor = correctionFactor.call(null, this._value, value);
function cback(accum, curr, currI, O) {
return accum + corrFactor * curr;
}
this._value = [this._value, value].reduce(cback, 0) / corrFactor;
return this;
},
subtract: function(value) {
var corrFactor = correctionFactor.call(null, this._value, value);
function cback(accum, curr, currI, O) {
return accum - corrFactor * curr;
}
this._value = [value].reduce(cback, this._value * corrFactor) / corrFactor;
return this;
},
multiply: function(value) {
function cback(accum, curr, currI, O) {
var corrFactor = correctionFactor(accum, curr);
return (accum * corrFactor) * (curr * corrFactor) / (corrFactor * corrFactor);
}
this._value = [this._value, value].reduce(cback, 1);
return this;
},
divide: function(value) {
function cback(accum, curr, currI, O) {
var corrFactor = correctionFactor(accum, curr);
return (accum * corrFactor) / (curr * corrFactor);
}
this._value = [this._value, value].reduce(cback);
return this;
},
difference: function(value) {
return Math.abs(numeral(this._value).subtract(value).value());
}
};
if (hasModule) {
module.exports = numeral;
}
if (typeof ender === 'undefined') {
this['numeral'] = numeral;
}
if (typeof define === 'function' && define.amd) {
define([], function() {
return numeral;
});
}
}).call(window);
//#
},{}],"pikaday":[function(require,module,exports){
/*!
* Pikaday
*
* Copyright © 2014 David Bushell | BSD & MIT license | https://github.com/dbushell/Pikaday
*/
(function (root, factory)
{
'use strict';
var moment;
if (typeof exports === 'object') {
// CommonJS module
// Load moment.js as an optional dependency
try { moment = require('moment'); } catch (e) {}
module.exports = factory(moment);
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(function (req)
{
// Load moment.js as an optional dependency
var id = 'moment';
try { moment = req(id); } catch (e) {}
return factory(moment);
});
} else {
root.Pikaday = factory(root.moment);
}
}(this, function (moment)
{
'use strict';
/**
* feature detection and helper functions
*/
var hasMoment = typeof moment === 'function',
hasEventListeners = !!window.addEventListener,
document = window.document,
sto = window.setTimeout,
addEvent = function(el, e, callback, capture)
{
if (hasEventListeners) {
el.addEventListener(e, callback, !!capture);
} else {
el.attachEvent('on' + e, callback);
}
},
removeEvent = function(el, e, callback, capture)
{
if (hasEventListeners) {
el.removeEventListener(e, callback, !!capture);
} else {
el.detachEvent('on' + e, callback);
}
},
fireEvent = function(el, eventName, data)
{
var ev;
if (document.createEvent) {
ev = document.createEvent('HTMLEvents');
ev.initEvent(eventName, true, false);
ev = extend(ev, data);
el.dispatchEvent(ev);
} else if (document.createEventObject) {
ev = document.createEventObject();
ev = extend(ev, data);
el.fireEvent('on' + eventName, ev);
}
},
trim = function(str)
{
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g,'');
},
hasClass = function(el, cn)
{
return (' ' + el.className + ' ').indexOf(' ' + cn + ' ') !== -1;
},
addClass = function(el, cn)
{
if (!hasClass(el, cn)) {
el.className = (el.className === '') ? cn : el.className + ' ' + cn;
}
},
removeClass = function(el, cn)
{
el.className = trim((' ' + el.className + ' ').replace(' ' + cn + ' ', ' '));
},
isArray = function(obj)
{
return (/Array/).test(Object.prototype.toString.call(obj));
},
isDate = function(obj)
{
return (/Date/).test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime());
},
isWeekend = function(date)
{
var day = date.getDay();
return day === 0 || day === 6;
},
isLeapYear = function(year)
{
// solution by Matti Virkkunen: http://stackoverflow.com/a/4881951
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
},
getDaysInMonth = function(year, month)
{
return [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
},
setToStartOfDay = function(date)
{
if (isDate(date)) date.setHours(0,0,0,0);
},
compareDates = function(a,b)
{
// weak date comparison (use setToStartOfDay(date) to ensure correct result)
return a.getTime() === b.getTime();
},
extend = function(to, from, overwrite)
{
var prop, hasProp;
for (prop in from) {
hasProp = to[prop] !== undefined;
if (hasProp && typeof from[prop] === 'object' && from[prop] !== null && from[prop].nodeName === undefined) {
if (isDate(from[prop])) {
if (overwrite) {
to[prop] = new Date(from[prop].getTime());
}
}
else if (isArray(from[prop])) {
if (overwrite) {
to[prop] = from[prop].slice(0);
}
} else {
to[prop] = extend({}, from[prop], overwrite);
}
} else if (overwrite || !hasProp) {
to[prop] = from[prop];
}
}
return to;
},
adjustCalendar = function(calendar) {
if (calendar.month < 0) {
calendar.year -= Math.ceil(Math.abs(calendar.month)/12);
calendar.month += 12;
}
if (calendar.month > 11) {
calendar.year += Math.floor(Math.abs(calendar.month)/12);
calendar.month -= 12;
}
return calendar;
},
/**
* defaults and localisation
*/
defaults = {
// bind the picker to a form field
field: null,
// automatically show/hide the picker on `field` focus (default `true` if `field` is set)
bound: undefined,
// position of the datepicker, relative to the field (default to bottom & left)
// ('bottom' & 'left' keywords are not used, 'top' & 'right' are modifier on the bottom/left position)
position: 'bottom left',
// automatically fit in the viewport even if it means repositioning from the position option
reposition: true,
// the default output format for `.toString()` and `field` value
format: 'YYYY-MM-DD',
// the initial date to view when first opened
defaultDate: null,
// make the `defaultDate` the initial selected value
setDefaultDate: false,
// first day of week (0: Sunday, 1: Monday etc)
firstDay: 0,
// the minimum/earliest date that can be selected
minDate: null,
// the maximum/latest date that can be selected
maxDate: null,
// number of years either side, or array of upper/lower range
yearRange: 10,
// show week numbers at head of row
showWeekNumber: false,
// used internally (don't config outside)
minYear: 0,
maxYear: 9999,
minMonth: undefined,
maxMonth: undefined,
isRTL: false,
// Additional text to append to the year in the calendar title
yearSuffix: '',
// Render the month after year in the calendar title
showMonthAfterYear: false,
// how many months are visible
numberOfMonths: 1,
// when numberOfMonths is used, this will help you to choose where the main calendar will be (default `left`, can be set to `right`)
// only used for the first display or when a selected date is not visible
mainCalendar: 'left',
// Specify a DOM element to render the calendar in
container: undefined,
// internationalization
i18n: {
previousMonth : 'Previous Month',
nextMonth : 'Next Month',
months : ['January','February','March','April','May','June','July','August','September','October','November','December'],
weekdays : ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
weekdaysShort : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
},
// callback function
onSelect: null,
onOpen: null,
onClose: null,
onDraw: null
},
/**
* templating functions to abstract HTML rendering
*/
renderDayName = function(opts, day, abbr)
{
day += opts.firstDay;
while (day >= 7) {
day -= 7;
}
return abbr ? opts.i18n.weekdaysShort[day] : opts.i18n.weekdays[day];
},
renderDay = function(d, m, y, isSelected, isToday, isDisabled, isEmpty)
{
if (isEmpty) {
return '<td class="is-empty"></td>';
}
var arr = [];
if (isDisabled) {
arr.push('is-disabled');
}
if (isToday) {
arr.push('is-today');
}
if (isSelected) {
arr.push('is-selected');
}
return '<td data-day="' + d + '" class="' + arr.join(' ') + '">' +
'<button class="pika-button pika-day" type="button" ' +
'data-pika-year="' + y + '" data-pika-month="' + m + '" data-pika-day="' + d + '">' +
d +
'</button>' +
'</td>';
},
renderWeek = function (d, m, y) {
// Lifted from http://javascript.about.com/library/blweekyear.htm, lightly modified.
var onejan = new Date(y, 0, 1),
weekNum = Math.ceil((((new Date(y, m, d) - onejan) / 86400000) + onejan.getDay()+1)/7);
return '<td class="pika-week">' + weekNum + '</td>';
},
renderRow = function(days, isRTL)
{
return '<tr>' + (isRTL ? days.reverse() : days).join('') + '</tr>';
},
renderBody = function(rows)
{
return '<tbody>' + rows.join('') + '</tbody>';
},
renderHead = function(opts)
{
var i, arr = [];
if (opts.showWeekNumber) {
arr.push('<th></th>');
}
for (i = 0; i < 7; i++) {
arr.push('<th scope="col"><abbr title="' + renderDayName(opts, i) + '">' + renderDayName(opts, i, true) + '</abbr></th>');
}
return '<thead>' + (opts.isRTL ? arr.reverse() : arr).join('') + '</thead>';
},
renderTitle = function(instance, c, year, month, refYear)
{
var i, j, arr,
opts = instance._o,
isMinYear = year === opts.minYear,
isMaxYear = year === opts.maxYear,
html = '<div class="pika-title">',
monthHtml,
yearHtml,
prev = true,
next = true;
for (arr = [], i = 0; i < 12; i++) {
arr.push('<option value="' + (year === refYear ? i - c : 12 + i - c) + '"' +
(i === month ? ' selected': '') +
((isMinYear && i < opts.minMonth) || (isMaxYear && i > opts.maxMonth) ? 'disabled' : '') + '>' +
opts.i18n.months[i] + '</option>');
}
monthHtml = '<div class="pika-label">' + opts.i18n.months[month] + '<select class="pika-select pika-select-month">' + arr.join('') + '</select></div>';
if (isArray(opts.yearRange)) {
i = opts.yearRange[0];
j = opts.yearRange[1] + 1;
} else {
i = year - opts.yearRange;
j = 1 + year + opts.yearRange;
}
for (arr = []; i < j && i <= opts.maxYear; i++) {
if (i >= opts.minYear) {
arr.push('<option value="' + i + '"' + (i === year ? ' selected': '') + '>' + (i) + '</option>');
}
}
yearHtml = '<div class="pika-label">' + year + opts.yearSuffix + '<select class="pika-select pika-select-year">' + arr.join('') + '</select></div>';
if (opts.showMonthAfterYear) {
html += yearHtml + monthHtml;
} else {
html += monthHtml + yearHtml;
}
if (isMinYear && (month === 0 || opts.minMonth >= month)) {
prev = false;
}
if (isMaxYear && (month === 11 || opts.maxMonth <= month)) {
next = false;
}
if (c === 0) {
html += '<button class="pika-prev' + (prev ? '' : ' is-disabled') + '" type="button">' + opts.i18n.previousMonth + '</button>';
}
if (c === (instance._o.numberOfMonths - 1) ) {
html += '<button class="pika-next' + (next ? '' : ' is-disabled') + '" type="button">' + opts.i18n.nextMonth + '</button>';
}
return html += '</div>';
},
renderTable = function(opts, data)
{
return '<table cellpadding="0" cellspacing="0" class="pika-table">' + renderHead(opts) + renderBody(data) + '</table>';
},
/**
* Pikaday constructor
*/
Pikaday = function(options)
{
var self = this,
opts = self.config(options);
self._onMouseDown = function(e)
{
if (!self._v) {
return;
}
e = e || window.event;
var target = e.target || e.srcElement;
if (!target) {
return;
}
if (!hasClass(target, 'is-disabled')) {
if (hasClass(target, 'pika-button') && !hasClass(target, 'is-empty')) {
self.setDate(new Date(target.getAttribute('data-pika-year'), target.getAttribute('data-pika-month'), target.getAttribute('data-pika-day')));
if (opts.bound) {
sto(function() {
self.hide();
if (opts.field) {
opts.field.blur();
}
}, 100);
}
return;
}
else if (hasClass(target, 'pika-prev')) {
self.prevMonth();
}
else if (hasClass(target, 'pika-next')) {
self.nextMonth();
}
}
if (!hasClass(target, 'pika-select')) {
if (e.preventDefault) {
e.preventDefault();
} else {
e.returnValue = false;
return false;
}
} else {
self._c = true;
}
};
self._onChange = function(e)
{
e = e || window.event;
var target = e.target || e.srcElement;
if (!target) {
return;
}
if (hasClass(target, 'pika-select-month')) {
self.gotoMonth(target.value);
}
else if (hasClass(target, 'pika-select-year')) {
self.gotoYear(target.value);
}
};
self._onInputChange = function(e)
{
var date;
if (e.firedBy === self) {
return;
}
if (hasMoment) {
date = moment(opts.field.value, opts.format);
date = (date && date.isValid()) ? date.toDate() : null;
}
else {
date = new Date(Date.parse(opts.field.value));
}
self.setDate(isDate(date) ? date : null);
if (!self._v) {
self.show();
}
};
self._onInputFocus = function()
{
self.show();
};
self._onInputClick = function()
{
self.show();
};
self._onInputBlur = function()
{
// IE allows pika div to gain focus; catch blur the input field
var pEl = document.activeElement;
do {
if (hasClass(pEl, 'pika-single')) {
return;
}
}
while ((pEl = pEl.parentNode));
if (!self._c) {
self._b = sto(function() {
self.hide();
}, 50);
}
self._c = false;
};
self._onClick = function(e)
{
e = e || window.event;
var target = e.target || e.srcElement,
pEl = target;
if (!target) {
return;
}
if (!hasEventListeners && hasClass(target, 'pika-select')) {
if (!target.onchange) {
target.setAttribute('onchange', 'return;');
addEvent(target, 'change', self._onChange);
}
}
do {
if (hasClass(pEl, 'pika-single') || pEl === opts.trigger) {
return;
}
}
while ((pEl = pEl.parentNode));
if (self._v && target !== opts.trigger && pEl !== opts.trigger) {
self.hide();
}
};
self.el = document.createElement('div');
self.el.className = 'pika-single' + (opts.isRTL ? ' is-rtl' : '');
addEvent(self.el, 'mousedown', self._onMouseDown, true);
addEvent(self.el, 'change', self._onChange);
if (opts.field) {
if (opts.container) {
opts.container.appendChild(self.el);
} else if (opts.bound) {
document.body.appendChild(self.el);
} else {
opts.field.parentNode.insertBefore(self.el, opts.field.nextSibling);
}
addEvent(opts.field, 'change', self._onInputChange);
if (!opts.defaultDate) {
if (hasMoment && opts.field.value) {
opts.defaultDate = moment(opts.field.value, opts.format).toDate();
} else {
opts.defaultDate = new Date(Date.parse(opts.field.value));
}
opts.setDefaultDate = true;
}
}
var defDate = opts.defaultDate;
if (isDate(defDate)) {
if (opts.setDefaultDate) {
self.setDate(defDate, true);
} else {
self.gotoDate(defDate);
}
} else {
self.gotoDate(new Date());
}
if (opts.bound) {
this.hide();
self.el.className += ' is-bound';
addEvent(opts.trigger, 'click', self._onInputClick);
addEvent(opts.trigger, 'focus', self._onInputFocus);
addEvent(opts.trigger, 'blur', self._onInputBlur);
} else {
this.show();
}
};
/**
* public Pikaday API
*/
Pikaday.prototype = {
/**
* configure functionality
*/
config: function(options)
{
if (!this._o) {
this._o = extend({}, defaults, true);
}
var opts = extend(this._o, options, true);
opts.isRTL = !!opts.isRTL;
opts.field = (opts.field && opts.field.nodeName) ? opts.field : null;
opts.bound = !!(opts.bound !== undefined ? opts.field && opts.bound : opts.field);
opts.trigger = (opts.trigger && opts.trigger.nodeName) ? opts.trigger : opts.field;
opts.disableWeekends = !!opts.disableWeekends;
opts.disableDayFn = (typeof opts.disableDayFn) == "function" ? opts.disableDayFn : null;
var nom = parseInt(opts.numberOfMonths, 10) || 1;
opts.numberOfMonths = nom > 4 ? 4 : nom;
if (!isDate(opts.minDate)) {
opts.minDate = false;
}
if (!isDate(opts.maxDate)) {
opts.maxDate = false;
}
if ((opts.minDate && opts.maxDate) && opts.maxDate < opts.minDate) {
opts.maxDate = opts.minDate = false;
}
if (opts.minDate) {
setToStartOfDay(opts.minDate);
opts.minYear = opts.minDate.getFullYear();
opts.minMonth = opts.minDate.getMonth();
}
if (opts.maxDate) {
setToStartOfDay(opts.maxDate);
opts.maxYear = opts.maxDate.getFullYear();
opts.maxMonth = opts.maxDate.getMonth();
}
if (isArray(opts.yearRange)) {
var fallback = new Date().getFullYear() - 10;
opts.yearRange[0] = parseInt(opts.yearRange[0], 10) || fallback;
opts.yearRange[1] = parseInt(opts.yearRange[1], 10) || fallback;
} else {
opts.yearRange = Math.abs(parseInt(opts.yearRange, 10)) || defaults.yearRange;
if (opts.yearRange > 100) {
opts.yearRange = 100;
}
}
return opts;
},
/**
* return a formatted string of the current selection (using Moment.js if available)
*/
toString: function(format)
{
return !isDate(this._d) ? '' : hasMoment ? moment(this._d).format(format || this._o.format) : this._d.toDateString();
},
/**
* return a Moment.js object of the current selection (if available)
*/
getMoment: function()
{
return hasMoment ? moment(this._d) : null;
},
/**
* set the current selection from a Moment.js object (if available)
*/
setMoment: function(date, preventOnSelect)
{
if (hasMoment && moment.isMoment(date)) {
this.setDate(date.toDate(), preventOnSelect);
}
},
/**
* return a Date object of the current selection
*/
getDate: function()
{
return isDate(this._d) ? new Date(this._d.getTime()) : null;
},
/**
* set the current selection
*/
setDate: function(date, preventOnSelect)
{
if (!date) {
this._d = null;
if (this._o.field) {
this._o.field.value = '';
fireEvent(this._o.field, 'change', { firedBy: this });
}
return this.draw();
}
if (typeof date === 'string') {
date = new Date(Date.parse(date));
}
if (!isDate(date)) {
return;
}
var min = this._o.minDate,
max = this._o.maxDate;
if (isDate(min) && date < min) {
date = min;
} else if (isDate(max) && date > max) {
date = max;
}
this._d = new Date(date.getTime());
setToStartOfDay(this._d);
this.gotoDate(this._d);
if (this._o.field) {
this._o.field.value = this.toString();
fireEvent(this._o.field, 'change', { firedBy: this });
}
if (!preventOnSelect && typeof this._o.onSelect === 'function') {
this._o.onSelect.call(this, this.getDate());
}
},
/**
* change view to a specific date
*/
gotoDate: function(date)
{
var newCalendar = true;
if (!isDate(date)) {
return;
}
if (this.calendars) {
var firstVisibleDate = new Date(this.calendars[0].year, this.calendars[0].month, 1),
lastVisibleDate = new Date(this.calendars[this.calendars.length-1].year, this.calendars[this.calendars.length-1].month, 1),
visibleDate = date.getTime();
// get the end of the month
lastVisibleDate.setMonth(lastVisibleDate.getMonth()+1);
lastVisibleDate.setDate(lastVisibleDate.getDate()-1);
newCalendar = (visibleDate < firstVisibleDate.getTime() || lastVisibleDate.getTime() < visibleDate);
}
if (newCalendar) {
this.calendars = [{
month: date.getMonth(),
year: date.getFullYear()
}];
if (this._o.mainCalendar === 'right') {
this.calendars[0].month += 1 - this._o.numberOfMonths;
}
}
this.adjustCalendars();
},
adjustCalendars: function() {
this.calendars[0] = adjustCalendar(this.calendars[0]);
for (var c = 1; c < this._o.numberOfMonths; c++) {
this.calendars[c] = adjustCalendar({
month: this.calendars[0].month + c,
year: this.calendars[0].year
});
}
this.draw();
},
gotoToday: function()
{
this.gotoDate(new Date());
},
/**
* change view to a specific month (zero-index, e.g. 0: January)
*/
gotoMonth: function(month)
{
if (!isNaN(month)) {
this.calendars[0].month = parseInt(month, 10);
this.adjustCalendars();
}
},
nextMonth: function()
{
this.calendars[0].month++;
this.adjustCalendars();
},
prevMonth: function()
{
this.calendars[0].month--;
this.adjustCalendars();
},
/**
* change view to a specific full year (e.g. "2012")
*/
gotoYear: function(year)
{
if (!isNaN(year)) {
this.calendars[0].year = parseInt(year, 10);
this.adjustCalendars();
}
},
/**
* change the minDate
*/
setMinDate: function(value)
{
this._o.minDate = value;
},
/**
* change the maxDate
*/
setMaxDate: function(value)
{
this._o.maxDate = value;
},
/**
* refresh the HTML
*/
draw: function(force)
{
if (!this._v && !force) {
return;
}
var opts = this._o,
minYear = opts.minYear,
maxYear = opts.maxYear,
minMonth = opts.minMonth,
maxMonth = opts.maxMonth,
html = '';
if (this._y <= minYear) {
this._y = minYear;
if (!isNaN(minMonth) && this._m < minMonth) {
this._m = minMonth;
}
}
if (this._y >= maxYear) {
this._y = maxYear;
if (!isNaN(maxMonth) && this._m > maxMonth) {
this._m = maxMonth;
}
}
for (var c = 0; c < opts.numberOfMonths; c++) {
html += '<div class="pika-lendar">' + renderTitle(this, c, this.calendars[c].year, this.calendars[c].month, this.calendars[0].year) + this.render(this.calendars[c].year, this.calendars[c].month) + '</div>';
}
this.el.innerHTML = html;
if (opts.bound) {
if(opts.field.type !== 'hidden') {
sto(function() {
opts.trigger.focus();
}, 1);
}
}
if (typeof this._o.onDraw === 'function') {
var self = this;
sto(function() {
self._o.onDraw.call(self);
}, 0);
}
},
adjustPosition: function()
{
if (this._o.container) return;
var field = this._o.trigger, pEl = field,
width = this.el.offsetWidth, height = this.el.offsetHeight,
viewportWidth = window.innerWidth || document.documentElement.clientWidth,
viewportHeight = window.innerHeight || document.documentElement.clientHeight,
scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop,
left, top, clientRect;
if (typeof field.getBoundingClientRect === 'function') {
clientRect = field.getBoundingClientRect();
left = clientRect.left + window.pageXOffset;
top = clientRect.bottom + window.pageYOffset;
} else {
left = pEl.offsetLeft;
top = pEl.offsetTop + pEl.offsetHeight;
while((pEl = pEl.offsetParent)) {
left += pEl.offsetLeft;
top += pEl.offsetTop;
}
}
// default position is bottom & left
if ((this._o.reposition && left + width > viewportWidth) ||
(
this._o.position.indexOf('right') > -1 &&
left - width + field.offsetWidth > 0
)
) {
left = left - width + field.offsetWidth;
}
if ((this._o.reposition && top + height > viewportHeight + scrollTop) ||
(
this._o.position.indexOf('top') > -1 &&
top - height - field.offsetHeight > 0
)
) {
top = top - height - field.offsetHeight;
}
this.el.style.cssText = [
'position: absolute',
'left: ' + left + 'px',
'top: ' + top + 'px'
].join(';');
},
/**
* render HTML for a particular month
*/
render: function(year, month)
{
var opts = this._o,
now = new Date(),
days = getDaysInMonth(year, month),
before = new Date(year, month, 1).getDay(),
data = [],
row = [];
setToStartOfDay(now);
if (opts.firstDay > 0) {
before -= opts.firstDay;
if (before < 0) {
before += 7;
}
}
var cells = days + before,
after = cells;
while(after > 7) {
after -= 7;
}
cells += 7 - after;
for (var i = 0, r = 0; i < cells; i++)
{
var day = new Date(year, month, 1 + (i - before)),
isSelected = isDate(this._d) ? compareDates(day, this._d) : false,
isToday = compareDates(day, now),
isEmpty = i < before || i >= (days + before),
isDisabled = (opts.minDate && day < opts.minDate) ||
(opts.maxDate && day > opts.maxDate) ||
(opts.disableWeekends && isWeekend(day)) ||
(opts.disableDayFn && opts.disableDayFn(day));
row.push(renderDay(1 + (i - before), month, year, isSelected, isToday, isDisabled, isEmpty));
if (++r === 7) {
if (opts.showWeekNumber) {
row.unshift(renderWeek(i - before, month, year));
}
data.push(renderRow(row, opts.isRTL));
row = [];
r = 0;
}
}
return renderTable(opts, data);
},
isVisible: function()
{
return this._v;
},
show: function()
{
if (!this._v) {
removeClass(this.el, 'is-hidden');
this._v = true;
this.draw();
if (this._o.bound) {
addEvent(document, 'click', this._onClick);
this.adjustPosition();
}
if (typeof this._o.onOpen === 'function') {
this._o.onOpen.call(this);
}
}
},
hide: function()
{
var v = this._v;
if (v !== false) {
if (this._o.bound) {
removeEvent(document, 'click', this._onClick);
}
this.el.style.cssText = '';
addClass(this.el, 'is-hidden');
this._v = false;
if (v !== undefined && typeof this._o.onClose === 'function') {
this._o.onClose.call(this);
}
}
},
/**
* GAME OVER
*/
destroy: function()
{
this.hide();
removeEvent(this.el, 'mousedown', this._onMouseDown, true);
removeEvent(this.el, 'change', this._onChange);
if (this._o.field) {
removeEvent(this._o.field, 'change', this._onInputChange);
if (this._o.bound) {
removeEvent(this._o.trigger, 'click', this._onInputClick);
removeEvent(this._o.trigger, 'focus', this._onInputFocus);
removeEvent(this._o.trigger, 'blur', this._onInputBlur);
}
}
if (this.el.parentNode) {
this.el.parentNode.removeChild(this.el);
}
}
};
return Pikaday;
}));
},{"moment":"moment"}],"zeroclipboard":[function(require,module,exports){
/*!
* ZeroClipboard
* The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
* Copyright (c) 2009-2014 Jon Rohan, James M. Greene
* Licensed MIT
* http://zeroclipboard.org/
* v2.2.0
*/
(function(window, undefined) {
"use strict";
/**
* Store references to critically important global functions that may be
* overridden on certain web pages.
*/
var _window = window, _document = _window.document, _navigator = _window.navigator, _setTimeout = _window.setTimeout, _clearTimeout = _window.clearTimeout, _setInterval = _window.setInterval, _clearInterval = _window.clearInterval, _getComputedStyle = _window.getComputedStyle, _encodeURIComponent = _window.encodeURIComponent, _ActiveXObject = _window.ActiveXObject, _Error = _window.Error, _parseInt = _window.Number.parseInt || _window.parseInt, _parseFloat = _window.Number.parseFloat || _window.parseFloat, _isNaN = _window.Number.isNaN || _window.isNaN, _now = _window.Date.now, _keys = _window.Object.keys, _defineProperty = _window.Object.defineProperty, _hasOwn = _window.Object.prototype.hasOwnProperty, _slice = _window.Array.prototype.slice, _unwrap = function() {
var unwrapper = function(el) {
return el;
};
if (typeof _window.wrap === "function" && typeof _window.unwrap === "function") {
try {
var div = _document.createElement("div");
var unwrappedDiv = _window.unwrap(div);
if (div.nodeType === 1 && unwrappedDiv && unwrappedDiv.nodeType === 1) {
unwrapper = _window.unwrap;
}
} catch (e) {}
}
return unwrapper;
}();
/**
* Convert an `arguments` object into an Array.
*
* @returns The arguments as an Array
* @private
*/
var _args = function(argumentsObj) {
return _slice.call(argumentsObj, 0);
};
/**
* Shallow-copy the owned, enumerable properties of one object over to another, similar to jQuery's `$.extend`.
*
* @returns The target object, augmented
* @private
*/
var _extend = function() {
var i, len, arg, prop, src, copy, args = _args(arguments), target = args[0] || {};
for (i = 1, len = args.length; i < len; i++) {
if ((arg = args[i]) != null) {
for (prop in arg) {
if (_hasOwn.call(arg, prop)) {
src = target[prop];
copy = arg[prop];
if (target !== copy && copy !== undefined) {
target[prop] = copy;
}
}
}
}
}
return target;
};
/**
* Return a deep copy of the source object or array.
*
* @returns Object or Array
* @private
*/
var _deepCopy = function(source) {
var copy, i, len, prop;
if (typeof source !== "object" || source == null || typeof source.nodeType === "number") {
copy = source;
} else if (typeof source.length === "number") {
copy = [];
for (i = 0, len = source.length; i < len; i++) {
if (_hasOwn.call(source, i)) {
copy[i] = _deepCopy(source[i]);
}
}
} else {
copy = {};
for (prop in source) {
if (_hasOwn.call(source, prop)) {
copy[prop] = _deepCopy(source[prop]);
}
}
}
return copy;
};
/**
* Makes a shallow copy of `obj` (like `_extend`) but filters its properties based on a list of `keys` to keep.
* The inverse of `_omit`, mostly. The big difference is that these properties do NOT need to be enumerable to
* be kept.
*
* @returns A new filtered object.
* @private
*/
var _pick = function(obj, keys) {
var newObj = {};
for (var i = 0, len = keys.length; i < len; i++) {
if (keys[i] in obj) {
newObj[keys[i]] = obj[keys[i]];
}
}
return newObj;
};
/**
* Makes a shallow copy of `obj` (like `_extend`) but filters its properties based on a list of `keys` to omit.
* The inverse of `_pick`.
*
* @returns A new filtered object.
* @private
*/
var _omit = function(obj, keys) {
var newObj = {};
for (var prop in obj) {
if (keys.indexOf(prop) === -1) {
newObj[prop] = obj[prop];
}
}
return newObj;
};
/**
* Remove all owned, enumerable properties from an object.
*
* @returns The original object without its owned, enumerable properties.
* @private
*/
var _deleteOwnProperties = function(obj) {
if (obj) {
for (var prop in obj) {
if (_hasOwn.call(obj, prop)) {
delete obj[prop];
}
}
}
return obj;
};
/**
* Determine if an element is contained within another element.
*
* @returns Boolean
* @private
*/
var _containedBy = function(el, ancestorEl) {
if (el && el.nodeType === 1 && el.ownerDocument && ancestorEl && (ancestorEl.nodeType === 1 && ancestorEl.ownerDocument && ancestorEl.ownerDocument === el.ownerDocument || ancestorEl.nodeType === 9 && !ancestorEl.ownerDocument && ancestorEl === el.ownerDocument)) {
do {
if (el === ancestorEl) {
return true;
}
el = el.parentNode;
} while (el);
}
return false;
};
/**
* Get the URL path's parent directory.
*
* @returns String or `undefined`
* @private
*/
var _getDirPathOfUrl = function(url) {
var dir;
if (typeof url === "string" && url) {
dir = url.split("#")[0].split("?")[0];
dir = url.slice(0, url.lastIndexOf("/") + 1);
}
return dir;
};
/**
* Get the current script's URL by throwing an `Error` and analyzing it.
*
* @returns String or `undefined`
* @private
*/
var _getCurrentScriptUrlFromErrorStack = function(stack) {
var url, matches;
if (typeof stack === "string" && stack) {
matches = stack.match(/^(?:|[^:@]*@|.+\)@(?=http[s]?|file)|.+?\s+(?: at |@)(?:[^:\(]+ )*[\(]?)((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/);
if (matches && matches[1]) {
url = matches[1];
} else {
matches = stack.match(/\)@((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/);
if (matches && matches[1]) {
url = matches[1];
}
}
}
return url;
};
/**
* Get the current script's URL by throwing an `Error` and analyzing it.
*
* @returns String or `undefined`
* @private
*/
var _getCurrentScriptUrlFromError = function() {
var url, err;
try {
throw new _Error();
} catch (e) {
err = e;
}
if (err) {
url = err.sourceURL || err.fileName || _getCurrentScriptUrlFromErrorStack(err.stack);
}
return url;
};
/**
* Get the current script's URL.
*
* @returns String or `undefined`
* @private
*/
var _getCurrentScriptUrl = function() {
var jsPath, scripts, i;
if (_document.currentScript && (jsPath = _document.currentScript.src)) {
return jsPath;
}
scripts = _document.getElementsByTagName("script");
if (scripts.length === 1) {
return scripts[0].src || undefined;
}
if ("readyState" in scripts[0]) {
for (i = scripts.length; i--; ) {
if (scripts[i].readyState === "interactive" && (jsPath = scripts[i].src)) {
return jsPath;
}
}
}
if (_document.readyState === "loading" && (jsPath = scripts[scripts.length - 1].src)) {
return jsPath;
}
if (jsPath = _getCurrentScriptUrlFromError()) {
return jsPath;
}
return undefined;
};
/**
* Get the unanimous parent directory of ALL script tags.
* If any script tags are either (a) inline or (b) from differing parent
* directories, this method must return `undefined`.
*
* @returns String or `undefined`
* @private
*/
var _getUnanimousScriptParentDir = function() {
var i, jsDir, jsPath, scripts = _document.getElementsByTagName("script");
for (i = scripts.length; i--; ) {
if (!(jsPath = scripts[i].src)) {
jsDir = null;
break;
}
jsPath = _getDirPathOfUrl(jsPath);
if (jsDir == null) {
jsDir = jsPath;
} else if (jsDir !== jsPath) {
jsDir = null;
break;
}
}
return jsDir || undefined;
};
/**
* Get the presumed location of the "ZeroClipboard.swf" file, based on the location
* of the executing JavaScript file (e.g. "ZeroClipboard.js", etc.).
*
* @returns String
* @private
*/
var _getDefaultSwfPath = function() {
var jsDir = _getDirPathOfUrl(_getCurrentScriptUrl()) || _getUnanimousScriptParentDir() || "";
return jsDir + "ZeroClipboard.swf";
};
/**
* Keep track of if the page is framed (in an `iframe`). This can never change.
* @private
*/
var _pageIsFramed = function() {
return window.opener == null && (!!window.top && window != window.top || !!window.parent && window != window.parent);
}();
/**
* Keep track of the state of the Flash object.
* @private
*/
var _flashState = {
bridge: null,
version: "0.0.0",
pluginType: "unknown",
disabled: null,
outdated: null,
sandboxed: null,
unavailable: null,
degraded: null,
deactivated: null,
overdue: null,
ready: null
};
/**
* The minimum Flash Player version required to use ZeroClipboard completely.
* @readonly
* @private
*/
var _minimumFlashVersion = "11.0.0";
/**
* The ZeroClipboard library version number, as reported by Flash, at the time the SWF was compiled.
*/
var _zcSwfVersion;
/**
* Keep track of all event listener registrations.
* @private
*/
var _handlers = {};
/**
* Keep track of the currently activated element.
* @private
*/
var _currentElement;
/**
* Keep track of the element that was activated when a `copy` process started.
* @private
*/
var _copyTarget;
/**
* Keep track of data for the pending clipboard transaction.
* @private
*/
var _clipData = {};
/**
* Keep track of data formats for the pending clipboard transaction.
* @private
*/
var _clipDataFormatMap = null;
/**
* Keep track of the Flash availability check timeout.
* @private
*/
var _flashCheckTimeout = 0;
/**
* Keep track of SWF network errors interval polling.
* @private
*/
var _swfFallbackCheckInterval = 0;
/**
* The `message` store for events
* @private
*/
var _eventMessages = {
ready: "Flash communication is established",
error: {
"flash-disabled": "Flash is disabled or not installed. May also be attempting to run Flash in a sandboxed iframe, which is impossible.",
"flash-outdated": "Flash is too outdated to support ZeroClipboard",
"flash-sandboxed": "Attempting to run Flash in a sandboxed iframe, which is impossible",
"flash-unavailable": "Flash is unable to communicate bidirectionally with JavaScript",
"flash-degraded": "Flash is unable to preserve data fidelity when communicating with JavaScript",
"flash-deactivated": "Flash is too outdated for your browser and/or is configured as click-to-activate.\nThis may also mean that the ZeroClipboard SWF object could not be loaded, so please check your `swfPath` configuration and/or network connectivity.\nMay also be attempting to run Flash in a sandboxed iframe, which is impossible.",
"flash-overdue": "Flash communication was established but NOT within the acceptable time limit",
"version-mismatch": "ZeroClipboard JS version number does not match ZeroClipboard SWF version number",
"clipboard-error": "At least one error was thrown while ZeroClipboard was attempting to inject your data into the clipboard",
"config-mismatch": "ZeroClipboard configuration does not match Flash's reality",
"swf-not-found": "The ZeroClipboard SWF object could not be loaded, so please check your `swfPath` configuration and/or network connectivity"
}
};
/**
* The `name`s of `error` events that can only occur is Flash has at least
* been able to load the SWF successfully.
* @private
*/
var _errorsThatOnlyOccurAfterFlashLoads = [ "flash-unavailable", "flash-degraded", "flash-overdue", "version-mismatch", "config-mismatch", "clipboard-error" ];
/**
* The `name`s of `error` events that should likely result in the `_flashState`
* variable's property values being updated.
* @private
*/
var _flashStateErrorNames = [ "flash-disabled", "flash-outdated", "flash-sandboxed", "flash-unavailable", "flash-degraded", "flash-deactivated", "flash-overdue" ];
/**
* A RegExp to match the `name` property of `error` events related to Flash.
* @private
*/
var _flashStateErrorNameMatchingRegex = new RegExp("^flash-(" + _flashStateErrorNames.map(function(errorName) {
return errorName.replace(/^flash-/, "");
}).join("|") + ")$");
/**
* A RegExp to match the `name` property of `error` events related to Flash,
* which is enabled.
* @private
*/
var _flashStateEnabledErrorNameMatchingRegex = new RegExp("^flash-(" + _flashStateErrorNames.slice(1).map(function(errorName) {
return errorName.replace(/^flash-/, "");
}).join("|") + ")$");
/**
* ZeroClipboard configuration defaults for the Core module.
* @private
*/
var _globalConfig = {
swfPath: _getDefaultSwfPath(),
trustedDomains: window.location.host ? [ window.location.host ] : [],
cacheBust: true,
forceEnhancedClipboard: false,
flashLoadTimeout: 3e4,
autoActivate: true,
bubbleEvents: true,
containerId: "global-zeroclipboard-html-bridge",
containerClass: "global-zeroclipboard-container",
swfObjectId: "global-zeroclipboard-flash-bridge",
hoverClass: "zeroclipboard-is-hover",
activeClass: "zeroclipboard-is-active",
forceHandCursor: false,
title: null,
zIndex: 999999999
};
/**
* The underlying implementation of `ZeroClipboard.config`.
* @private
*/
var _config = function(options) {
if (typeof options === "object" && options !== null) {
for (var prop in options) {
if (_hasOwn.call(options, prop)) {
if (/^(?:forceHandCursor|title|zIndex|bubbleEvents)$/.test(prop)) {
_globalConfig[prop] = options[prop];
} else if (_flashState.bridge == null) {
if (prop === "containerId" || prop === "swfObjectId") {
if (_isValidHtml4Id(options[prop])) {
_globalConfig[prop] = options[prop];
} else {
throw new Error("The specified `" + prop + "` value is not valid as an HTML4 Element ID");
}
} else {
_globalConfig[prop] = options[prop];
}
}
}
}
}
if (typeof options === "string" && options) {
if (_hasOwn.call(_globalConfig, options)) {
return _globalConfig[options];
}
return;
}
return _deepCopy(_globalConfig);
};
/**
* The underlying implementation of `ZeroClipboard.state`.
* @private
*/
var _state = function() {
_detectSandbox();
return {
browser: _pick(_navigator, [ "userAgent", "platform", "appName" ]),
flash: _omit(_flashState, [ "bridge" ]),
zeroclipboard: {
version: ZeroClipboard.version,
config: ZeroClipboard.config()
}
};
};
/**
* The underlying implementation of `ZeroClipboard.isFlashUnusable`.
* @private
*/
var _isFlashUnusable = function() {
return !!(_flashState.disabled || _flashState.outdated || _flashState.sandboxed || _flashState.unavailable || _flashState.degraded || _flashState.deactivated);
};
/**
* The underlying implementation of `ZeroClipboard.on`.
* @private
*/
var _on = function(eventType, listener) {
var i, len, events, added = {};
if (typeof eventType === "string" && eventType) {
events = eventType.toLowerCase().split(/\s+/);
} else if (typeof eventType === "object" && eventType && typeof listener === "undefined") {
for (i in eventType) {
if (_hasOwn.call(eventType, i) && typeof i === "string" && i && typeof eventType[i] === "function") {
ZeroClipboard.on(i, eventType[i]);
}
}
}
if (events && events.length) {
for (i = 0, len = events.length; i < len; i++) {
eventType = events[i].replace(/^on/, "");
added[eventType] = true;
if (!_handlers[eventType]) {
_handlers[eventType] = [];
}
_handlers[eventType].push(listener);
}
if (added.ready && _flashState.ready) {
ZeroClipboard.emit({
type: "ready"
});
}
if (added.error) {
for (i = 0, len = _flashStateErrorNames.length; i < len; i++) {
if (_flashState[_flashStateErrorNames[i].replace(/^flash-/, "")] === true) {
ZeroClipboard.emit({
type: "error",
name: _flashStateErrorNames[i]
});
break;
}
}
if (_zcSwfVersion !== undefined && ZeroClipboard.version !== _zcSwfVersion) {
ZeroClipboard.emit({
type: "error",
name: "version-mismatch",
jsVersion: ZeroClipboard.version,
swfVersion: _zcSwfVersion
});
}
}
}
return ZeroClipboard;
};
/**
* The underlying implementation of `ZeroClipboard.off`.
* @private
*/
var _off = function(eventType, listener) {
var i, len, foundIndex, events, perEventHandlers;
if (arguments.length === 0) {
events = _keys(_handlers);
} else if (typeof eventType === "string" && eventType) {
events = eventType.split(/\s+/);
} else if (typeof eventType === "object" && eventType && typeof listener === "undefined") {
for (i in eventType) {
if (_hasOwn.call(eventType, i) && typeof i === "string" && i && typeof eventType[i] === "function") {
ZeroClipboard.off(i, eventType[i]);
}
}
}
if (events && events.length) {
for (i = 0, len = events.length; i < len; i++) {
eventType = events[i].toLowerCase().replace(/^on/, "");
perEventHandlers = _handlers[eventType];
if (perEventHandlers && perEventHandlers.length) {
if (listener) {
foundIndex = perEventHandlers.indexOf(listener);
while (foundIndex !== -1) {
perEventHandlers.splice(foundIndex, 1);
foundIndex = perEventHandlers.indexOf(listener, foundIndex);
}
} else {
perEventHandlers.length = 0;
}
}
}
}
return ZeroClipboard;
};
/**
* The underlying implementation of `ZeroClipboard.handlers`.
* @private
*/
var _listeners = function(eventType) {
var copy;
if (typeof eventType === "string" && eventType) {
copy = _deepCopy(_handlers[eventType]) || null;
} else {
copy = _deepCopy(_handlers);
}
return copy;
};
/**
* The underlying implementation of `ZeroClipboard.emit`.
* @private
*/
var _emit = function(event) {
var eventCopy, returnVal, tmp;
event = _createEvent(event);
if (!event) {
return;
}
if (_preprocessEvent(event)) {
return;
}
if (event.type === "ready" && _flashState.overdue === true) {
return ZeroClipboard.emit({
type: "error",
name: "flash-overdue"
});
}
eventCopy = _extend({}, event);
_dispatchCallbacks.call(this, eventCopy);
if (event.type === "copy") {
tmp = _mapClipDataToFlash(_clipData);
returnVal = tmp.data;
_clipDataFormatMap = tmp.formatMap;
}
return returnVal;
};
/**
* The underlying implementation of `ZeroClipboard.create`.
* @private
*/
var _create = function() {
var previousState = _flashState.sandboxed;
_detectSandbox();
if (typeof _flashState.ready !== "boolean") {
_flashState.ready = false;
}
if (_flashState.sandboxed !== previousState && _flashState.sandboxed === true) {
_flashState.ready = false;
ZeroClipboard.emit({
type: "error",
name: "flash-sandboxed"
});
} else if (!ZeroClipboard.isFlashUnusable() && _flashState.bridge === null) {
var maxWait = _globalConfig.flashLoadTimeout;
if (typeof maxWait === "number" && maxWait >= 0) {
_flashCheckTimeout = _setTimeout(function() {
if (typeof _flashState.deactivated !== "boolean") {
_flashState.deactivated = true;
}
if (_flashState.deactivated === true) {
ZeroClipboard.emit({
type: "error",
name: "flash-deactivated"
});
}
}, maxWait);
}
_flashState.overdue = false;
_embedSwf();
}
};
/**
* The underlying implementation of `ZeroClipboard.destroy`.
* @private
*/
var _destroy = function() {
ZeroClipboard.clearData();
ZeroClipboard.blur();
ZeroClipboard.emit("destroy");
_unembedSwf();
ZeroClipboard.off();
};
/**
* The underlying implementation of `ZeroClipboard.setData`.
* @private
*/
var _setData = function(format, data) {
var dataObj;
if (typeof format === "object" && format && typeof data === "undefined") {
dataObj = format;
ZeroClipboard.clearData();
} else if (typeof format === "string" && format) {
dataObj = {};
dataObj[format] = data;
} else {
return;
}
for (var dataFormat in dataObj) {
if (typeof dataFormat === "string" && dataFormat && _hasOwn.call(dataObj, dataFormat) && typeof dataObj[dataFormat] === "string" && dataObj[dataFormat]) {
_clipData[dataFormat] = dataObj[dataFormat];
}
}
};
/**
* The underlying implementation of `ZeroClipboard.clearData`.
* @private
*/
var _clearData = function(format) {
if (typeof format === "undefined") {
_deleteOwnProperties(_clipData);
_clipDataFormatMap = null;
} else if (typeof format === "string" && _hasOwn.call(_clipData, format)) {
delete _clipData[format];
}
};
/**
* The underlying implementation of `ZeroClipboard.getData`.
* @private
*/
var _getData = function(format) {
if (typeof format === "undefined") {
return _deepCopy(_clipData);
} else if (typeof format === "string" && _hasOwn.call(_clipData, format)) {
return _clipData[format];
}
};
/**
* The underlying implementation of `ZeroClipboard.focus`/`ZeroClipboard.activate`.
* @private
*/
var _focus = function(element) {
if (!(element && element.nodeType === 1)) {
return;
}
if (_currentElement) {
_removeClass(_currentElement, _globalConfig.activeClass);
if (_currentElement !== element) {
_removeClass(_currentElement, _globalConfig.hoverClass);
}
}
_currentElement = element;
_addClass(element, _globalConfig.hoverClass);
var newTitle = element.getAttribute("title") || _globalConfig.title;
if (typeof newTitle === "string" && newTitle) {
var htmlBridge = _getHtmlBridge(_flashState.bridge);
if (htmlBridge) {
htmlBridge.setAttribute("title", newTitle);
}
}
var useHandCursor = _globalConfig.forceHandCursor === true || _getStyle(element, "cursor") === "pointer";
_setHandCursor(useHandCursor);
_reposition();
};
/**
* The underlying implementation of `ZeroClipboard.blur`/`ZeroClipboard.deactivate`.
* @private
*/
var _blur = function() {
var htmlBridge = _getHtmlBridge(_flashState.bridge);
if (htmlBridge) {
htmlBridge.removeAttribute("title");
htmlBridge.style.left = "0px";
htmlBridge.style.top = "-9999px";
htmlBridge.style.width = "1px";
htmlBridge.style.height = "1px";
}
if (_currentElement) {
_removeClass(_currentElement, _globalConfig.hoverClass);
_removeClass(_currentElement, _globalConfig.activeClass);
_currentElement = null;
}
};
/**
* The underlying implementation of `ZeroClipboard.activeElement`.
* @private
*/
var _activeElement = function() {
return _currentElement || null;
};
/**
* Check if a value is a valid HTML4 `ID` or `Name` token.
* @private
*/
var _isValidHtml4Id = function(id) {
return typeof id === "string" && id && /^[A-Za-z][A-Za-z0-9_:\-\.]*$/.test(id);
};
/**
* Create or update an `event` object, based on the `eventType`.
* @private
*/
var _createEvent = function(event) {
var eventType;
if (typeof event === "string" && event) {
eventType = event;
event = {};
} else if (typeof event === "object" && event && typeof event.type === "string" && event.type) {
eventType = event.type;
}
if (!eventType) {
return;
}
eventType = eventType.toLowerCase();
if (!event.target && (/^(copy|aftercopy|_click)$/.test(eventType) || eventType === "error" && event.name === "clipboard-error")) {
event.target = _copyTarget;
}
_extend(event, {
type: eventType,
target: event.target || _currentElement || null,
relatedTarget: event.relatedTarget || null,
currentTarget: _flashState && _flashState.bridge || null,
timeStamp: event.timeStamp || _now() || null
});
var msg = _eventMessages[event.type];
if (event.type === "error" && event.name && msg) {
msg = msg[event.name];
}
if (msg) {
event.message = msg;
}
if (event.type === "ready") {
_extend(event, {
target: null,
version: _flashState.version
});
}
if (event.type === "error") {
if (_flashStateErrorNameMatchingRegex.test(event.name)) {
_extend(event, {
target: null,
minimumVersion: _minimumFlashVersion
});
}
if (_flashStateEnabledErrorNameMatchingRegex.test(event.name)) {
_extend(event, {
version: _flashState.version
});
}
}
if (event.type === "copy") {
event.clipboardData = {
setData: ZeroClipboard.setData,
clearData: ZeroClipboard.clearData
};
}
if (event.type === "aftercopy") {
event = _mapClipResultsFromFlash(event, _clipDataFormatMap);
}
if (event.target && !event.relatedTarget) {
event.relatedTarget = _getRelatedTarget(event.target);
}
return _addMouseData(event);
};
/**
* Get a relatedTarget from the target's `data-clipboard-target` attribute
* @private
*/
var _getRelatedTarget = function(targetEl) {
var relatedTargetId = targetEl && targetEl.getAttribute && targetEl.getAttribute("data-clipboard-target");
return relatedTargetId ? _document.getElementById(relatedTargetId) : null;
};
/**
* Add element and position data to `MouseEvent` instances
* @private
*/
var _addMouseData = function(event) {
if (event && /^_(?:click|mouse(?:over|out|down|up|move))$/.test(event.type)) {
var srcElement = event.target;
var fromElement = event.type === "_mouseover" && event.relatedTarget ? event.relatedTarget : undefined;
var toElement = event.type === "_mouseout" && event.relatedTarget ? event.relatedTarget : undefined;
var pos = _getElementPosition(srcElement);
var screenLeft = _window.screenLeft || _window.screenX || 0;
var screenTop = _window.screenTop || _window.screenY || 0;
var scrollLeft = _document.body.scrollLeft + _document.documentElement.scrollLeft;
var scrollTop = _document.body.scrollTop + _document.documentElement.scrollTop;
var pageX = pos.left + (typeof event._stageX === "number" ? event._stageX : 0);
var pageY = pos.top + (typeof event._stageY === "number" ? event._stageY : 0);
var clientX = pageX - scrollLeft;
var clientY = pageY - scrollTop;
var screenX = screenLeft + clientX;
var screenY = screenTop + clientY;
var moveX = typeof event.movementX === "number" ? event.movementX : 0;
var moveY = typeof event.movementY === "number" ? event.movementY : 0;
delete event._stageX;
delete event._stageY;
_extend(event, {
srcElement: srcElement,
fromElement: fromElement,
toElement: toElement,
screenX: screenX,
screenY: screenY,
pageX: pageX,
pageY: pageY,
clientX: clientX,
clientY: clientY,
x: clientX,
y: clientY,
movementX: moveX,
movementY: moveY,
offsetX: 0,
offsetY: 0,
layerX: 0,
layerY: 0
});
}
return event;
};
/**
* Determine if an event's registered handlers should be execute synchronously or asynchronously.
*
* @returns {boolean}
* @private
*/
var _shouldPerformAsync = function(event) {
var eventType = event && typeof event.type === "string" && event.type || "";
return !/^(?:(?:before)?copy|destroy)$/.test(eventType);
};
/**
* Control if a callback should be executed asynchronously or not.
*
* @returns `undefined`
* @private
*/
var _dispatchCallback = function(func, context, args, async) {
if (async) {
_setTimeout(function() {
func.apply(context, args);
}, 0);
} else {
func.apply(context, args);
}
};
/**
* Handle the actual dispatching of events to client instances.
*
* @returns `undefined`
* @private
*/
var _dispatchCallbacks = function(event) {
if (!(typeof event === "object" && event && event.type)) {
return;
}
var async = _shouldPerformAsync(event);
var wildcardTypeHandlers = _handlers["*"] || [];
var specificTypeHandlers = _handlers[event.type] || [];
var handlers = wildcardTypeHandlers.concat(specificTypeHandlers);
if (handlers && handlers.length) {
var i, len, func, context, eventCopy, originalContext = this;
for (i = 0, len = handlers.length; i < len; i++) {
func = handlers[i];
context = originalContext;
if (typeof func === "string" && typeof _window[func] === "function") {
func = _window[func];
}
if (typeof func === "object" && func && typeof func.handleEvent === "function") {
context = func;
func = func.handleEvent;
}
if (typeof func === "function") {
eventCopy = _extend({}, event);
_dispatchCallback(func, context, [ eventCopy ], async);
}
}
}
return this;
};
/**
* Check an `error` event's `name` property to see if Flash has
* already loaded, which rules out possible `iframe` sandboxing.
* @private
*/
var _getSandboxStatusFromErrorEvent = function(event) {
var isSandboxed = null;
if (_pageIsFramed === false || event && event.type === "error" && event.name && _errorsThatOnlyOccurAfterFlashLoads.indexOf(event.name) !== -1) {
isSandboxed = false;
}
return isSandboxed;
};
/**
* Preprocess any special behaviors, reactions, or state changes after receiving this event.
* Executes only once per event emitted, NOT once per client.
* @private
*/
var _preprocessEvent = function(event) {
var element = event.target || _currentElement || null;
var sourceIsSwf = event._source === "swf";
delete event._source;
switch (event.type) {
case "error":
var isSandboxed = event.name === "flash-sandboxed" || _getSandboxStatusFromErrorEvent(event);
if (typeof isSandboxed === "boolean") {
_flashState.sandboxed = isSandboxed;
}
if (_flashStateErrorNames.indexOf(event.name) !== -1) {
_extend(_flashState, {
disabled: event.name === "flash-disabled",
outdated: event.name === "flash-outdated",
unavailable: event.name === "flash-unavailable",
degraded: event.name === "flash-degraded",
deactivated: event.name === "flash-deactivated",
overdue: event.name === "flash-overdue",
ready: false
});
} else if (event.name === "version-mismatch") {
_zcSwfVersion = event.swfVersion;
_extend(_flashState, {
disabled: false,
outdated: false,
unavailable: false,
degraded: false,
deactivated: false,
overdue: false,
ready: false
});
}
_clearTimeoutsAndPolling();
break;
case "ready":
_zcSwfVersion = event.swfVersion;
var wasDeactivated = _flashState.deactivated === true;
_extend(_flashState, {
disabled: false,
outdated: false,
sandboxed: false,
unavailable: false,
degraded: false,
deactivated: false,
overdue: wasDeactivated,
ready: !wasDeactivated
});
_clearTimeoutsAndPolling();
break;
case "beforecopy":
_copyTarget = element;
break;
case "copy":
var textContent, htmlContent, targetEl = event.relatedTarget;
if (!(_clipData["text/html"] || _clipData["text/plain"]) && targetEl && (htmlContent = targetEl.value || targetEl.outerHTML || targetEl.innerHTML) && (textContent = targetEl.value || targetEl.textContent || targetEl.innerText)) {
event.clipboardData.clearData();
event.clipboardData.setData("text/plain", textContent);
if (htmlContent !== textContent) {
event.clipboardData.setData("text/html", htmlContent);
}
} else if (!_clipData["text/plain"] && event.target && (textContent = event.target.getAttribute("data-clipboard-text"))) {
event.clipboardData.clearData();
event.clipboardData.setData("text/plain", textContent);
}
break;
case "aftercopy":
_queueEmitClipboardErrors(event);
ZeroClipboard.clearData();
if (element && element !== _safeActiveElement() && element.focus) {
element.focus();
}
break;
case "_mouseover":
ZeroClipboard.focus(element);
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
if (element && element !== event.relatedTarget && !_containedBy(event.relatedTarget, element)) {
_fireMouseEvent(_extend({}, event, {
type: "mouseenter",
bubbles: false,
cancelable: false
}));
}
_fireMouseEvent(_extend({}, event, {
type: "mouseover"
}));
}
break;
case "_mouseout":
ZeroClipboard.blur();
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
if (element && element !== event.relatedTarget && !_containedBy(event.relatedTarget, element)) {
_fireMouseEvent(_extend({}, event, {
type: "mouseleave",
bubbles: false,
cancelable: false
}));
}
_fireMouseEvent(_extend({}, event, {
type: "mouseout"
}));
}
break;
case "_mousedown":
_addClass(element, _globalConfig.activeClass);
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
_fireMouseEvent(_extend({}, event, {
type: event.type.slice(1)
}));
}
break;
case "_mouseup":
_removeClass(element, _globalConfig.activeClass);
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
_fireMouseEvent(_extend({}, event, {
type: event.type.slice(1)
}));
}
break;
case "_click":
_copyTarget = null;
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
_fireMouseEvent(_extend({}, event, {
type: event.type.slice(1)
}));
}
break;
case "_mousemove":
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
_fireMouseEvent(_extend({}, event, {
type: event.type.slice(1)
}));
}
break;
}
if (/^_(?:click|mouse(?:over|out|down|up|move))$/.test(event.type)) {
return true;
}
};
/**
* Check an "aftercopy" event for clipboard errors and emit a corresponding "error" event.
* @private
*/
var _queueEmitClipboardErrors = function(aftercopyEvent) {
if (aftercopyEvent.errors && aftercopyEvent.errors.length > 0) {
var errorEvent = _deepCopy(aftercopyEvent);
_extend(errorEvent, {
type: "error",
name: "clipboard-error"
});
delete errorEvent.success;
_setTimeout(function() {
ZeroClipboard.emit(errorEvent);
}, 0);
}
};
/**
* Dispatch a synthetic MouseEvent.
*
* @returns `undefined`
* @private
*/
var _fireMouseEvent = function(event) {
if (!(event && typeof event.type === "string" && event)) {
return;
}
var e, target = event.target || null, doc = target && target.ownerDocument || _document, defaults = {
view: doc.defaultView || _window,
canBubble: true,
cancelable: true,
detail: event.type === "click" ? 1 : 0,
button: typeof event.which === "number" ? event.which - 1 : typeof event.button === "number" ? event.button : doc.createEvent ? 0 : 1
}, args = _extend(defaults, event);
if (!target) {
return;
}
if (doc.createEvent && target.dispatchEvent) {
args = [ args.type, args.canBubble, args.cancelable, args.view, args.detail, args.screenX, args.screenY, args.clientX, args.clientY, args.ctrlKey, args.altKey, args.shiftKey, args.metaKey, args.button, args.relatedTarget ];
e = doc.createEvent("MouseEvents");
if (e.initMouseEvent) {
e.initMouseEvent.apply(e, args);
e._source = "js";
target.dispatchEvent(e);
}
}
};
/**
* Continuously poll the DOM until either:
* (a) the fallback content becomes visible, or
* (b) we receive an event from SWF (handled elsewhere)
*
* IMPORTANT:
* This is NOT a necessary check but it can result in significantly faster
* detection of bad `swfPath` configuration and/or network/server issues [in
* supported browsers] than waiting for the entire `flashLoadTimeout` duration
* to elapse before detecting that the SWF cannot be loaded. The detection
* duration can be anywhere from 10-30 times faster [in supported browsers] by
* using this approach.
*
* @returns `undefined`
* @private
*/
var _watchForSwfFallbackContent = function() {
var maxWait = _globalConfig.flashLoadTimeout;
if (typeof maxWait === "number" && maxWait >= 0) {
var pollWait = Math.min(1e3, maxWait / 10);
var fallbackContentId = _globalConfig.swfObjectId + "_fallbackContent";
_swfFallbackCheckInterval = _setInterval(function() {
var el = _document.getElementById(fallbackContentId);
if (_isElementVisible(el)) {
_clearTimeoutsAndPolling();
_flashState.deactivated = null;
ZeroClipboard.emit({
type: "error",
name: "swf-not-found"
});
}
}, pollWait);
}
};
/**
* Create the HTML bridge element to embed the Flash object into.
* @private
*/
var _createHtmlBridge = function() {
var container = _document.createElement("div");
container.id = _globalConfig.containerId;
container.className = _globalConfig.containerClass;
container.style.position = "absolute";
container.style.left = "0px";
container.style.top = "-9999px";
container.style.width = "1px";
container.style.height = "1px";
container.style.zIndex = "" + _getSafeZIndex(_globalConfig.zIndex);
return container;
};
/**
* Get the HTML element container that wraps the Flash bridge object/element.
* @private
*/
var _getHtmlBridge = function(flashBridge) {
var htmlBridge = flashBridge && flashBridge.parentNode;
while (htmlBridge && htmlBridge.nodeName === "OBJECT" && htmlBridge.parentNode) {
htmlBridge = htmlBridge.parentNode;
}
return htmlBridge || null;
};
/**
* Create the SWF object.
*
* @returns The SWF object reference.
* @private
*/
var _embedSwf = function() {
var len, flashBridge = _flashState.bridge, container = _getHtmlBridge(flashBridge);
if (!flashBridge) {
var allowScriptAccess = _determineScriptAccess(_window.location.host, _globalConfig);
var allowNetworking = allowScriptAccess === "never" ? "none" : "all";
var flashvars = _vars(_extend({
jsVersion: ZeroClipboard.version
}, _globalConfig));
var swfUrl = _globalConfig.swfPath + _cacheBust(_globalConfig.swfPath, _globalConfig);
container = _createHtmlBridge();
var divToBeReplaced = _document.createElement("div");
container.appendChild(divToBeReplaced);
_document.body.appendChild(container);
var tmpDiv = _document.createElement("div");
var usingActiveX = _flashState.pluginType === "activex";
tmpDiv.innerHTML = '<object id="' + _globalConfig.swfObjectId + '" name="' + _globalConfig.swfObjectId + '" ' + 'width="100%" height="100%" ' + (usingActiveX ? 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' : 'type="application/x-shockwave-flash" data="' + swfUrl + '"') + ">" + (usingActiveX ? '<param name="movie" value="' + swfUrl + '"/>' : "") + '<param name="allowScriptAccess" value="' + allowScriptAccess + '"/>' + '<param name="allowNetworking" value="' + allowNetworking + '"/>' + '<param name="menu" value="false"/>' + '<param name="wmode" value="transparent"/>' + '<param name="flashvars" value="' + flashvars + '"/>' + '<div id="' + _globalConfig.swfObjectId + '_fallbackContent"> </div>' + "</object>";
flashBridge = tmpDiv.firstChild;
tmpDiv = null;
_unwrap(flashBridge).ZeroClipboard = ZeroClipboard;
container.replaceChild(flashBridge, divToBeReplaced);
_watchForSwfFallbackContent();
}
if (!flashBridge) {
flashBridge = _document[_globalConfig.swfObjectId];
if (flashBridge && (len = flashBridge.length)) {
flashBridge = flashBridge[len - 1];
}
if (!flashBridge && container) {
flashBridge = container.firstChild;
}
}
_flashState.bridge = flashBridge || null;
return flashBridge;
};
/**
* Destroy the SWF object.
* @private
*/
var _unembedSwf = function() {
var flashBridge = _flashState.bridge;
if (flashBridge) {
var htmlBridge = _getHtmlBridge(flashBridge);
if (htmlBridge) {
if (_flashState.pluginType === "activex" && "readyState" in flashBridge) {
flashBridge.style.display = "none";
(function removeSwfFromIE() {
if (flashBridge.readyState === 4) {
for (var prop in flashBridge) {
if (typeof flashBridge[prop] === "function") {
flashBridge[prop] = null;
}
}
if (flashBridge.parentNode) {
flashBridge.parentNode.removeChild(flashBridge);
}
if (htmlBridge.parentNode) {
htmlBridge.parentNode.removeChild(htmlBridge);
}
} else {
_setTimeout(removeSwfFromIE, 10);
}
})();
} else {
if (flashBridge.parentNode) {
flashBridge.parentNode.removeChild(flashBridge);
}
if (htmlBridge.parentNode) {
htmlBridge.parentNode.removeChild(htmlBridge);
}
}
}
_clearTimeoutsAndPolling();
_flashState.ready = null;
_flashState.bridge = null;
_flashState.deactivated = null;
_zcSwfVersion = undefined;
}
};
/**
* Map the data format names of the "clipData" to Flash-friendly names.
*
* @returns A new transformed object.
* @private
*/
var _mapClipDataToFlash = function(clipData) {
var newClipData = {}, formatMap = {};
if (!(typeof clipData === "object" && clipData)) {
return;
}
for (var dataFormat in clipData) {
if (dataFormat && _hasOwn.call(clipData, dataFormat) && typeof clipData[dataFormat] === "string" && clipData[dataFormat]) {
switch (dataFormat.toLowerCase()) {
case "text/plain":
case "text":
case "air:text":
case "flash:text":
newClipData.text = clipData[dataFormat];
formatMap.text = dataFormat;
break;
case "text/html":
case "html":
case "air:html":
case "flash:html":
newClipData.html = clipData[dataFormat];
formatMap.html = dataFormat;
break;
case "application/rtf":
case "text/rtf":
case "rtf":
case "richtext":
case "air:rtf":
case "flash:rtf":
newClipData.rtf = clipData[dataFormat];
formatMap.rtf = dataFormat;
break;
default:
break;
}
}
}
return {
data: newClipData,
formatMap: formatMap
};
};
/**
* Map the data format names from Flash-friendly names back to their original "clipData" names (via a format mapping).
*
* @returns A new transformed object.
* @private
*/
var _mapClipResultsFromFlash = function(clipResults, formatMap) {
if (!(typeof clipResults === "object" && clipResults && typeof formatMap === "object" && formatMap)) {
return clipResults;
}
var newResults = {};
for (var prop in clipResults) {
if (_hasOwn.call(clipResults, prop)) {
if (prop === "errors") {
newResults[prop] = clipResults[prop] ? clipResults[prop].slice() : [];
for (var i = 0, len = newResults[prop].length; i < len; i++) {
newResults[prop][i].format = formatMap[newResults[prop][i].format];
}
} else if (prop !== "success" && prop !== "data") {
newResults[prop] = clipResults[prop];
} else {
newResults[prop] = {};
var tmpHash = clipResults[prop];
for (var dataFormat in tmpHash) {
if (dataFormat && _hasOwn.call(tmpHash, dataFormat) && _hasOwn.call(formatMap, dataFormat)) {
newResults[prop][formatMap[dataFormat]] = tmpHash[dataFormat];
}
}
}
}
}
return newResults;
};
/**
* Will look at a path, and will create a "?noCache={time}" or "&noCache={time}"
* query param string to return. Does NOT append that string to the original path.
* This is useful because ExternalInterface often breaks when a Flash SWF is cached.
*
* @returns The `noCache` query param with necessary "?"/"&" prefix.
* @private
*/
var _cacheBust = function(path, options) {
var cacheBust = options == null || options && options.cacheBust === true;
if (cacheBust) {
return (path.indexOf("?") === -1 ? "?" : "&") + "noCache=" + _now();
} else {
return "";
}
};
/**
* Creates a query string for the FlashVars param.
* Does NOT include the cache-busting query param.
*
* @returns FlashVars query string
* @private
*/
var _vars = function(options) {
var i, len, domain, domains, str = "", trustedOriginsExpanded = [];
if (options.trustedDomains) {
if (typeof options.trustedDomains === "string") {
domains = [ options.trustedDomains ];
} else if (typeof options.trustedDomains === "object" && "length" in options.trustedDomains) {
domains = options.trustedDomains;
}
}
if (domains && domains.length) {
for (i = 0, len = domains.length; i < len; i++) {
if (_hasOwn.call(domains, i) && domains[i] && typeof domains[i] === "string") {
domain = _extractDomain(domains[i]);
if (!domain) {
continue;
}
if (domain === "*") {
trustedOriginsExpanded.length = 0;
trustedOriginsExpanded.push(domain);
break;
}
trustedOriginsExpanded.push.apply(trustedOriginsExpanded, [ domain, "//" + domain, _window.location.protocol + "//" + domain ]);
}
}
}
if (trustedOriginsExpanded.length) {
str += "trustedOrigins=" + _encodeURIComponent(trustedOriginsExpanded.join(","));
}
if (options.forceEnhancedClipboard === true) {
str += (str ? "&" : "") + "forceEnhancedClipboard=true";
}
if (typeof options.swfObjectId === "string" && options.swfObjectId) {
str += (str ? "&" : "") + "swfObjectId=" + _encodeURIComponent(options.swfObjectId);
}
if (typeof options.jsVersion === "string" && options.jsVersion) {
str += (str ? "&" : "") + "jsVersion=" + _encodeURIComponent(options.jsVersion);
}
return str;
};
/**
* Extract the domain (e.g. "github.com") from an origin (e.g. "https://github.com") or
* URL (e.g. "https://github.com/zeroclipboard/zeroclipboard/").
*
* @returns the domain
* @private
*/
var _extractDomain = function(originOrUrl) {
if (originOrUrl == null || originOrUrl === "") {
return null;
}
originOrUrl = originOrUrl.replace(/^\s+|\s+$/g, "");
if (originOrUrl === "") {
return null;
}
var protocolIndex = originOrUrl.indexOf("//");
originOrUrl = protocolIndex === -1 ? originOrUrl : originOrUrl.slice(protocolIndex + 2);
var pathIndex = originOrUrl.indexOf("/");
originOrUrl = pathIndex === -1 ? originOrUrl : protocolIndex === -1 || pathIndex === 0 ? null : originOrUrl.slice(0, pathIndex);
if (originOrUrl && originOrUrl.slice(-4).toLowerCase() === ".swf") {
return null;
}
return originOrUrl || null;
};
/**
* Set `allowScriptAccess` based on `trustedDomains` and `window.location.host` vs. `swfPath`.
*
* @returns The appropriate script access level.
* @private
*/
var _determineScriptAccess = function() {
var _extractAllDomains = function(origins) {
var i, len, tmp, resultsArray = [];
if (typeof origins === "string") {
origins = [ origins ];
}
if (!(typeof origins === "object" && origins && typeof origins.length === "number")) {
return resultsArray;
}
for (i = 0, len = origins.length; i < len; i++) {
if (_hasOwn.call(origins, i) && (tmp = _extractDomain(origins[i]))) {
if (tmp === "*") {
resultsArray.length = 0;
resultsArray.push("*");
break;
}
if (resultsArray.indexOf(tmp) === -1) {
resultsArray.push(tmp);
}
}
}
return resultsArray;
};
return function(currentDomain, configOptions) {
var swfDomain = _extractDomain(configOptions.swfPath);
if (swfDomain === null) {
swfDomain = currentDomain;
}
var trustedDomains = _extractAllDomains(configOptions.trustedDomains);
var len = trustedDomains.length;
if (len > 0) {
if (len === 1 && trustedDomains[0] === "*") {
return "always";
}
if (trustedDomains.indexOf(currentDomain) !== -1) {
if (len === 1 && currentDomain === swfDomain) {
return "sameDomain";
}
return "always";
}
}
return "never";
};
}();
/**
* Get the currently active/focused DOM element.
*
* @returns the currently active/focused element, or `null`
* @private
*/
var _safeActiveElement = function() {
try {
return _document.activeElement;
} catch (err) {
return null;
}
};
/**
* Add a class to an element, if it doesn't already have it.
*
* @returns The element, with its new class added.
* @private
*/
var _addClass = function(element, value) {
var c, cl, className, classNames = [];
if (typeof value === "string" && value) {
classNames = value.split(/\s+/);
}
if (element && element.nodeType === 1 && classNames.length > 0) {
if (element.classList) {
for (c = 0, cl = classNames.length; c < cl; c++) {
element.classList.add(classNames[c]);
}
} else if (element.hasOwnProperty("className")) {
className = " " + element.className + " ";
for (c = 0, cl = classNames.length; c < cl; c++) {
if (className.indexOf(" " + classNames[c] + " ") === -1) {
className += classNames[c] + " ";
}
}
element.className = className.replace(/^\s+|\s+$/g, "");
}
}
return element;
};
/**
* Remove a class from an element, if it has it.
*
* @returns The element, with its class removed.
* @private
*/
var _removeClass = function(element, value) {
var c, cl, className, classNames = [];
if (typeof value === "string" && value) {
classNames = value.split(/\s+/);
}
if (element && element.nodeType === 1 && classNames.length > 0) {
if (element.classList && element.classList.length > 0) {
for (c = 0, cl = classNames.length; c < cl; c++) {
element.classList.remove(classNames[c]);
}
} else if (element.className) {
className = (" " + element.className + " ").replace(/[\r\n\t]/g, " ");
for (c = 0, cl = classNames.length; c < cl; c++) {
className = className.replace(" " + classNames[c] + " ", " ");
}
element.className = className.replace(/^\s+|\s+$/g, "");
}
}
return element;
};
/**
* Attempt to interpret the element's CSS styling. If `prop` is `"cursor"`,
* then we assume that it should be a hand ("pointer") cursor if the element
* is an anchor element ("a" tag).
*
* @returns The computed style property.
* @private
*/
var _getStyle = function(el, prop) {
var value = _getComputedStyle(el, null).getPropertyValue(prop);
if (prop === "cursor") {
if (!value || value === "auto") {
if (el.nodeName === "A") {
return "pointer";
}
}
}
return value;
};
/**
* Get the absolutely positioned coordinates of a DOM element.
*
* @returns Object containing the element's position, width, and height.
* @private
*/
var _getElementPosition = function(el) {
var pos = {
left: 0,
top: 0,
width: 0,
height: 0
};
if (el.getBoundingClientRect) {
var elRect = el.getBoundingClientRect();
var pageXOffset = _window.pageXOffset;
var pageYOffset = _window.pageYOffset;
var leftBorderWidth = _document.documentElement.clientLeft || 0;
var topBorderWidth = _document.documentElement.clientTop || 0;
var leftBodyOffset = 0;
var topBodyOffset = 0;
if (_getStyle(_document.body, "position") === "relative") {
var bodyRect = _document.body.getBoundingClientRect();
var htmlRect = _document.documentElement.getBoundingClientRect();
leftBodyOffset = bodyRect.left - htmlRect.left || 0;
topBodyOffset = bodyRect.top - htmlRect.top || 0;
}
pos.left = elRect.left + pageXOffset - leftBorderWidth - leftBodyOffset;
pos.top = elRect.top + pageYOffset - topBorderWidth - topBodyOffset;
pos.width = "width" in elRect ? elRect.width : elRect.right - elRect.left;
pos.height = "height" in elRect ? elRect.height : elRect.bottom - elRect.top;
}
return pos;
};
/**
* Determine is an element is visible somewhere within the document (page).
*
* @returns Boolean
* @private
*/
var _isElementVisible = function(el) {
if (!el) {
return false;
}
var styles = _getComputedStyle(el, null);
var hasCssHeight = _parseFloat(styles.height) > 0;
var hasCssWidth = _parseFloat(styles.width) > 0;
var hasCssTop = _parseFloat(styles.top) >= 0;
var hasCssLeft = _parseFloat(styles.left) >= 0;
var cssKnows = hasCssHeight && hasCssWidth && hasCssTop && hasCssLeft;
var rect = cssKnows ? null : _getElementPosition(el);
var isVisible = styles.display !== "none" && styles.visibility !== "collapse" && (cssKnows || !!rect && (hasCssHeight || rect.height > 0) && (hasCssWidth || rect.width > 0) && (hasCssTop || rect.top >= 0) && (hasCssLeft || rect.left >= 0));
return isVisible;
};
/**
* Clear all existing timeouts and interval polling delegates.
*
* @returns `undefined`
* @private
*/
var _clearTimeoutsAndPolling = function() {
_clearTimeout(_flashCheckTimeout);
_flashCheckTimeout = 0;
_clearInterval(_swfFallbackCheckInterval);
_swfFallbackCheckInterval = 0;
};
/**
* Reposition the Flash object to cover the currently activated element.
*
* @returns `undefined`
* @private
*/
var _reposition = function() {
var htmlBridge;
if (_currentElement && (htmlBridge = _getHtmlBridge(_flashState.bridge))) {
var pos = _getElementPosition(_currentElement);
_extend(htmlBridge.style, {
width: pos.width + "px",
height: pos.height + "px",
top: pos.top + "px",
left: pos.left + "px",
zIndex: "" + _getSafeZIndex(_globalConfig.zIndex)
});
}
};
/**
* Sends a signal to the Flash object to display the hand cursor if `true`.
*
* @returns `undefined`
* @private
*/
var _setHandCursor = function(enabled) {
if (_flashState.ready === true) {
if (_flashState.bridge && typeof _flashState.bridge.setHandCursor === "function") {
_flashState.bridge.setHandCursor(enabled);
} else {
_flashState.ready = false;
}
}
};
/**
* Get a safe value for `zIndex`
*
* @returns an integer, or "auto"
* @private
*/
var _getSafeZIndex = function(val) {
if (/^(?:auto|inherit)$/.test(val)) {
return val;
}
var zIndex;
if (typeof val === "number" && !_isNaN(val)) {
zIndex = val;
} else if (typeof val === "string") {
zIndex = _getSafeZIndex(_parseInt(val, 10));
}
return typeof zIndex === "number" ? zIndex : "auto";
};
/**
* Attempt to detect if ZeroClipboard is executing inside of a sandboxed iframe.
* If it is, Flash Player cannot be used, so ZeroClipboard is dead in the water.
*
* @see {@link http://lists.w3.org/Archives/Public/public-whatwg-archive/2014Dec/0002.html}
* @see {@link https://github.com/zeroclipboard/zeroclipboard/issues/511}
* @see {@link http://zeroclipboard.org/test-iframes.html}
*
* @returns `true` (is sandboxed), `false` (is not sandboxed), or `null` (uncertain)
* @private
*/
var _detectSandbox = function(doNotReassessFlashSupport) {
var effectiveScriptOrigin, frame, frameError, previousState = _flashState.sandboxed, isSandboxed = null;
doNotReassessFlashSupport = doNotReassessFlashSupport === true;
if (_pageIsFramed === false) {
isSandboxed = false;
} else {
try {
frame = window.frameElement || null;
} catch (e) {
frameError = {
name: e.name,
message: e.message
};
}
if (frame && frame.nodeType === 1 && frame.nodeName === "IFRAME") {
try {
isSandboxed = frame.hasAttribute("sandbox");
} catch (e) {
isSandboxed = null;
}
} else {
try {
effectiveScriptOrigin = document.domain || null;
} catch (e) {
effectiveScriptOrigin = null;
}
if (effectiveScriptOrigin === null || frameError && frameError.name === "SecurityError" && /(^|[\s\(\[@])sandbox(es|ed|ing|[\s\.,!\)\]@]|$)/.test(frameError.message.toLowerCase())) {
isSandboxed = true;
}
}
}
_flashState.sandboxed = isSandboxed;
if (previousState !== isSandboxed && !doNotReassessFlashSupport) {
_detectFlashSupport(_ActiveXObject);
}
return isSandboxed;
};
/**
* Detect the Flash Player status, version, and plugin type.
*
* @see {@link https://code.google.com/p/doctype-mirror/wiki/ArticleDetectFlash#The_code}
* @see {@link http://stackoverflow.com/questions/12866060/detecting-pepper-ppapi-flash-with-javascript}
*
* @returns `undefined`
* @private
*/
var _detectFlashSupport = function(ActiveXObject) {
var plugin, ax, mimeType, hasFlash = false, isActiveX = false, isPPAPI = false, flashVersion = "";
/**
* Derived from Apple's suggested sniffer.
* @param {String} desc e.g. "Shockwave Flash 7.0 r61"
* @returns {String} "7.0.61"
* @private
*/
function parseFlashVersion(desc) {
var matches = desc.match(/[\d]+/g);
matches.length = 3;
return matches.join(".");
}
function isPepperFlash(flashPlayerFileName) {
return !!flashPlayerFileName && (flashPlayerFileName = flashPlayerFileName.toLowerCase()) && (/^(pepflashplayer\.dll|libpepflashplayer\.so|pepperflashplayer\.plugin)$/.test(flashPlayerFileName) || flashPlayerFileName.slice(-13) === "chrome.plugin");
}
function inspectPlugin(plugin) {
if (plugin) {
hasFlash = true;
if (plugin.version) {
flashVersion = parseFlashVersion(plugin.version);
}
if (!flashVersion && plugin.description) {
flashVersion = parseFlashVersion(plugin.description);
}
if (plugin.filename) {
isPPAPI = isPepperFlash(plugin.filename);
}
}
}
if (_navigator.plugins && _navigator.plugins.length) {
plugin = _navigator.plugins["Shockwave Flash"];
inspectPlugin(plugin);
if (_navigator.plugins["Shockwave Flash 2.0"]) {
hasFlash = true;
flashVersion = "2.0.0.11";
}
} else if (_navigator.mimeTypes && _navigator.mimeTypes.length) {
mimeType = _navigator.mimeTypes["application/x-shockwave-flash"];
plugin = mimeType && mimeType.enabledPlugin;
inspectPlugin(plugin);
} else if (typeof ActiveXObject !== "undefined") {
isActiveX = true;
try {
ax = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
hasFlash = true;
flashVersion = parseFlashVersion(ax.GetVariable("$version"));
} catch (e1) {
try {
ax = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
hasFlash = true;
flashVersion = "6.0.21";
} catch (e2) {
try {
ax = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
hasFlash = true;
flashVersion = parseFlashVersion(ax.GetVariable("$version"));
} catch (e3) {
isActiveX = false;
}
}
}
}
_flashState.disabled = hasFlash !== true;
_flashState.outdated = flashVersion && _parseFloat(flashVersion) < _parseFloat(_minimumFlashVersion);
_flashState.version = flashVersion || "0.0.0";
_flashState.pluginType = isPPAPI ? "pepper" : isActiveX ? "activex" : hasFlash ? "netscape" : "unknown";
};
/**
* Invoke the Flash detection algorithms immediately upon inclusion so we're not waiting later.
*/
_detectFlashSupport(_ActiveXObject);
/**
* Always assess the `sandboxed` state of the page at important Flash-related moments.
*/
_detectSandbox(true);
/**
* A shell constructor for `ZeroClipboard` client instances.
*
* @constructor
*/
var ZeroClipboard = function() {
if (!(this instanceof ZeroClipboard)) {
return new ZeroClipboard();
}
if (typeof ZeroClipboard._createClient === "function") {
ZeroClipboard._createClient.apply(this, _args(arguments));
}
};
/**
* The ZeroClipboard library's version number.
*
* @static
* @readonly
* @property {string}
*/
_defineProperty(ZeroClipboard, "version", {
value: "2.2.0",
writable: false,
configurable: true,
enumerable: true
});
/**
* Update or get a copy of the ZeroClipboard global configuration.
* Returns a copy of the current/updated configuration.
*
* @returns Object
* @static
*/
ZeroClipboard.config = function() {
return _config.apply(this, _args(arguments));
};
/**
* Diagnostic method that describes the state of the browser, Flash Player, and ZeroClipboard.
*
* @returns Object
* @static
*/
ZeroClipboard.state = function() {
return _state.apply(this, _args(arguments));
};
/**
* Check if Flash is unusable for any reason: disabled, outdated, deactivated, etc.
*
* @returns Boolean
* @static
*/
ZeroClipboard.isFlashUnusable = function() {
return _isFlashUnusable.apply(this, _args(arguments));
};
/**
* Register an event listener.
*
* @returns `ZeroClipboard`
* @static
*/
ZeroClipboard.on = function() {
return _on.apply(this, _args(arguments));
};
/**
* Unregister an event listener.
* If no `listener` function/object is provided, it will unregister all listeners for the provided `eventType`.
* If no `eventType` is provided, it will unregister all listeners for every event type.
*
* @returns `ZeroClipboard`
* @static
*/
ZeroClipboard.off = function() {
return _off.apply(this, _args(arguments));
};
/**
* Retrieve event listeners for an `eventType`.
* If no `eventType` is provided, it will retrieve all listeners for every event type.
*
* @returns array of listeners for the `eventType`; if no `eventType`, then a map/hash object of listeners for all event types; or `null`
*/
ZeroClipboard.handlers = function() {
return _listeners.apply(this, _args(arguments));
};
/**
* Event emission receiver from the Flash object, forwarding to any registered JavaScript event listeners.
*
* @returns For the "copy" event, returns the Flash-friendly "clipData" object; otherwise `undefined`.
* @static
*/
ZeroClipboard.emit = function() {
return _emit.apply(this, _args(arguments));
};
/**
* Create and embed the Flash object.
*
* @returns The Flash object
* @static
*/
ZeroClipboard.create = function() {
return _create.apply(this, _args(arguments));
};
/**
* Self-destruct and clean up everything, including the embedded Flash object.
*
* @returns `undefined`
* @static
*/
ZeroClipboard.destroy = function() {
return _destroy.apply(this, _args(arguments));
};
/**
* Set the pending data for clipboard injection.
*
* @returns `undefined`
* @static
*/
ZeroClipboard.setData = function() {
return _setData.apply(this, _args(arguments));
};
/**
* Clear the pending data for clipboard injection.
* If no `format` is provided, all pending data formats will be cleared.
*
* @returns `undefined`
* @static
*/
ZeroClipboard.clearData = function() {
return _clearData.apply(this, _args(arguments));
};
/**
* Get a copy of the pending data for clipboard injection.
* If no `format` is provided, a copy of ALL pending data formats will be returned.
*
* @returns `String` or `Object`
* @static
*/
ZeroClipboard.getData = function() {
return _getData.apply(this, _args(arguments));
};
/**
* Sets the current HTML object that the Flash object should overlay. This will put the global
* Flash object on top of the current element; depending on the setup, this may also set the
* pending clipboard text data as well as the Flash object's wrapping element's title attribute
* based on the underlying HTML element and ZeroClipboard configuration.
*
* @returns `undefined`
* @static
*/
ZeroClipboard.focus = ZeroClipboard.activate = function() {
return _focus.apply(this, _args(arguments));
};
/**
* Un-overlays the Flash object. This will put the global Flash object off-screen; depending on
* the setup, this may also unset the Flash object's wrapping element's title attribute based on
* the underlying HTML element and ZeroClipboard configuration.
*
* @returns `undefined`
* @static
*/
ZeroClipboard.blur = ZeroClipboard.deactivate = function() {
return _blur.apply(this, _args(arguments));
};
/**
* Returns the currently focused/"activated" HTML element that the Flash object is wrapping.
*
* @returns `HTMLElement` or `null`
* @static
*/
ZeroClipboard.activeElement = function() {
return _activeElement.apply(this, _args(arguments));
};
/**
* Keep track of the ZeroClipboard client instance counter.
*/
var _clientIdCounter = 0;
/**
* Keep track of the state of the client instances.
*
* Entry structure:
* _clientMeta[client.id] = {
* instance: client,
* elements: [],
* handlers: {}
* };
*/
var _clientMeta = {};
/**
* Keep track of the ZeroClipboard clipped elements counter.
*/
var _elementIdCounter = 0;
/**
* Keep track of the state of the clipped element relationships to clients.
*
* Entry structure:
* _elementMeta[element.zcClippingId] = [client1.id, client2.id];
*/
var _elementMeta = {};
/**
* Keep track of the state of the mouse event handlers for clipped elements.
*
* Entry structure:
* _mouseHandlers[element.zcClippingId] = {
* mouseover: function(event) {},
* mouseout: function(event) {},
* mouseenter: function(event) {},
* mouseleave: function(event) {},
* mousemove: function(event) {}
* };
*/
var _mouseHandlers = {};
/**
* Extending the ZeroClipboard configuration defaults for the Client module.
*/
_extend(_globalConfig, {
autoActivate: true
});
/**
* The real constructor for `ZeroClipboard` client instances.
* @private
*/
var _clientConstructor = function(elements) {
var client = this;
client.id = "" + _clientIdCounter++;
_clientMeta[client.id] = {
instance: client,
elements: [],
handlers: {}
};
if (elements) {
client.clip(elements);
}
ZeroClipboard.on("*", function(event) {
return client.emit(event);
});
ZeroClipboard.on("destroy", function() {
client.destroy();
});
ZeroClipboard.create();
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.on`.
* @private
*/
var _clientOn = function(eventType, listener) {
var i, len, events, added = {}, meta = _clientMeta[this.id], handlers = meta && meta.handlers;
if (!meta) {
throw new Error("Attempted to add new listener(s) to a destroyed ZeroClipboard client instance");
}
if (typeof eventType === "string" && eventType) {
events = eventType.toLowerCase().split(/\s+/);
} else if (typeof eventType === "object" && eventType && typeof listener === "undefined") {
for (i in eventType) {
if (_hasOwn.call(eventType, i) && typeof i === "string" && i && typeof eventType[i] === "function") {
this.on(i, eventType[i]);
}
}
}
if (events && events.length) {
for (i = 0, len = events.length; i < len; i++) {
eventType = events[i].replace(/^on/, "");
added[eventType] = true;
if (!handlers[eventType]) {
handlers[eventType] = [];
}
handlers[eventType].push(listener);
}
if (added.ready && _flashState.ready) {
this.emit({
type: "ready",
client: this
});
}
if (added.error) {
for (i = 0, len = _flashStateErrorNames.length; i < len; i++) {
if (_flashState[_flashStateErrorNames[i].replace(/^flash-/, "")]) {
this.emit({
type: "error",
name: _flashStateErrorNames[i],
client: this
});
break;
}
}
if (_zcSwfVersion !== undefined && ZeroClipboard.version !== _zcSwfVersion) {
this.emit({
type: "error",
name: "version-mismatch",
jsVersion: ZeroClipboard.version,
swfVersion: _zcSwfVersion
});
}
}
}
return this;
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.off`.
* @private
*/
var _clientOff = function(eventType, listener) {
var i, len, foundIndex, events, perEventHandlers, meta = _clientMeta[this.id], handlers = meta && meta.handlers;
if (!handlers) {
return this;
}
if (arguments.length === 0) {
events = _keys(handlers);
} else if (typeof eventType === "string" && eventType) {
events = eventType.split(/\s+/);
} else if (typeof eventType === "object" && eventType && typeof listener === "undefined") {
for (i in eventType) {
if (_hasOwn.call(eventType, i) && typeof i === "string" && i && typeof eventType[i] === "function") {
this.off(i, eventType[i]);
}
}
}
if (events && events.length) {
for (i = 0, len = events.length; i < len; i++) {
eventType = events[i].toLowerCase().replace(/^on/, "");
perEventHandlers = handlers[eventType];
if (perEventHandlers && perEventHandlers.length) {
if (listener) {
foundIndex = perEventHandlers.indexOf(listener);
while (foundIndex !== -1) {
perEventHandlers.splice(foundIndex, 1);
foundIndex = perEventHandlers.indexOf(listener, foundIndex);
}
} else {
perEventHandlers.length = 0;
}
}
}
}
return this;
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.handlers`.
* @private
*/
var _clientListeners = function(eventType) {
var copy = null, handlers = _clientMeta[this.id] && _clientMeta[this.id].handlers;
if (handlers) {
if (typeof eventType === "string" && eventType) {
copy = handlers[eventType] ? handlers[eventType].slice(0) : [];
} else {
copy = _deepCopy(handlers);
}
}
return copy;
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.emit`.
* @private
*/
var _clientEmit = function(event) {
if (_clientShouldEmit.call(this, event)) {
if (typeof event === "object" && event && typeof event.type === "string" && event.type) {
event = _extend({}, event);
}
var eventCopy = _extend({}, _createEvent(event), {
client: this
});
_clientDispatchCallbacks.call(this, eventCopy);
}
return this;
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.clip`.
* @private
*/
var _clientClip = function(elements) {
if (!_clientMeta[this.id]) {
throw new Error("Attempted to clip element(s) to a destroyed ZeroClipboard client instance");
}
elements = _prepClip(elements);
for (var i = 0; i < elements.length; i++) {
if (_hasOwn.call(elements, i) && elements[i] && elements[i].nodeType === 1) {
if (!elements[i].zcClippingId) {
elements[i].zcClippingId = "zcClippingId_" + _elementIdCounter++;
_elementMeta[elements[i].zcClippingId] = [ this.id ];
if (_globalConfig.autoActivate === true) {
_addMouseHandlers(elements[i]);
}
} else if (_elementMeta[elements[i].zcClippingId].indexOf(this.id) === -1) {
_elementMeta[elements[i].zcClippingId].push(this.id);
}
var clippedElements = _clientMeta[this.id] && _clientMeta[this.id].elements;
if (clippedElements.indexOf(elements[i]) === -1) {
clippedElements.push(elements[i]);
}
}
}
return this;
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.unclip`.
* @private
*/
var _clientUnclip = function(elements) {
var meta = _clientMeta[this.id];
if (!meta) {
return this;
}
var clippedElements = meta.elements;
var arrayIndex;
if (typeof elements === "undefined") {
elements = clippedElements.slice(0);
} else {
elements = _prepClip(elements);
}
for (var i = elements.length; i--; ) {
if (_hasOwn.call(elements, i) && elements[i] && elements[i].nodeType === 1) {
arrayIndex = 0;
while ((arrayIndex = clippedElements.indexOf(elements[i], arrayIndex)) !== -1) {
clippedElements.splice(arrayIndex, 1);
}
var clientIds = _elementMeta[elements[i].zcClippingId];
if (clientIds) {
arrayIndex = 0;
while ((arrayIndex = clientIds.indexOf(this.id, arrayIndex)) !== -1) {
clientIds.splice(arrayIndex, 1);
}
if (clientIds.length === 0) {
if (_globalConfig.autoActivate === true) {
_removeMouseHandlers(elements[i]);
}
delete elements[i].zcClippingId;
}
}
}
}
return this;
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.elements`.
* @private
*/
var _clientElements = function() {
var meta = _clientMeta[this.id];
return meta && meta.elements ? meta.elements.slice(0) : [];
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.destroy`.
* @private
*/
var _clientDestroy = function() {
if (!_clientMeta[this.id]) {
return;
}
this.unclip();
this.off();
delete _clientMeta[this.id];
};
/**
* Inspect an Event to see if the Client (`this`) should honor it for emission.
* @private
*/
var _clientShouldEmit = function(event) {
if (!(event && event.type)) {
return false;
}
if (event.client && event.client !== this) {
return false;
}
var meta = _clientMeta[this.id];
var clippedEls = meta && meta.elements;
var hasClippedEls = !!clippedEls && clippedEls.length > 0;
var goodTarget = !event.target || hasClippedEls && clippedEls.indexOf(event.target) !== -1;
var goodRelTarget = event.relatedTarget && hasClippedEls && clippedEls.indexOf(event.relatedTarget) !== -1;
var goodClient = event.client && event.client === this;
if (!meta || !(goodTarget || goodRelTarget || goodClient)) {
return false;
}
return true;
};
/**
* Handle the actual dispatching of events to a client instance.
*
* @returns `undefined`
* @private
*/
var _clientDispatchCallbacks = function(event) {
var meta = _clientMeta[this.id];
if (!(typeof event === "object" && event && event.type && meta)) {
return;
}
var async = _shouldPerformAsync(event);
var wildcardTypeHandlers = meta && meta.handlers["*"] || [];
var specificTypeHandlers = meta && meta.handlers[event.type] || [];
var handlers = wildcardTypeHandlers.concat(specificTypeHandlers);
if (handlers && handlers.length) {
var i, len, func, context, eventCopy, originalContext = this;
for (i = 0, len = handlers.length; i < len; i++) {
func = handlers[i];
context = originalContext;
if (typeof func === "string" && typeof _window[func] === "function") {
func = _window[func];
}
if (typeof func === "object" && func && typeof func.handleEvent === "function") {
context = func;
func = func.handleEvent;
}
if (typeof func === "function") {
eventCopy = _extend({}, event);
_dispatchCallback(func, context, [ eventCopy ], async);
}
}
}
};
/**
* Prepares the elements for clipping/unclipping.
*
* @returns An Array of elements.
* @private
*/
var _prepClip = function(elements) {
if (typeof elements === "string") {
elements = [];
}
return typeof elements.length !== "number" ? [ elements ] : elements;
};
/**
* Add a `mouseover` handler function for a clipped element.
*
* @returns `undefined`
* @private
*/
var _addMouseHandlers = function(element) {
if (!(element && element.nodeType === 1)) {
return;
}
var _suppressMouseEvents = function(event) {
if (!(event || (event = _window.event))) {
return;
}
if (event._source !== "js") {
event.stopImmediatePropagation();
event.preventDefault();
}
delete event._source;
};
var _elementMouseOver = function(event) {
if (!(event || (event = _window.event))) {
return;
}
_suppressMouseEvents(event);
ZeroClipboard.focus(element);
};
element.addEventListener("mouseover", _elementMouseOver, false);
element.addEventListener("mouseout", _suppressMouseEvents, false);
element.addEventListener("mouseenter", _suppressMouseEvents, false);
element.addEventListener("mouseleave", _suppressMouseEvents, false);
element.addEventListener("mousemove", _suppressMouseEvents, false);
_mouseHandlers[element.zcClippingId] = {
mouseover: _elementMouseOver,
mouseout: _suppressMouseEvents,
mouseenter: _suppressMouseEvents,
mouseleave: _suppressMouseEvents,
mousemove: _suppressMouseEvents
};
};
/**
* Remove a `mouseover` handler function for a clipped element.
*
* @returns `undefined`
* @private
*/
var _removeMouseHandlers = function(element) {
if (!(element && element.nodeType === 1)) {
return;
}
var mouseHandlers = _mouseHandlers[element.zcClippingId];
if (!(typeof mouseHandlers === "object" && mouseHandlers)) {
return;
}
var key, val, mouseEvents = [ "move", "leave", "enter", "out", "over" ];
for (var i = 0, len = mouseEvents.length; i < len; i++) {
key = "mouse" + mouseEvents[i];
val = mouseHandlers[key];
if (typeof val === "function") {
element.removeEventListener(key, val, false);
}
}
delete _mouseHandlers[element.zcClippingId];
};
/**
* Creates a new ZeroClipboard client instance.
* Optionally, auto-`clip` an element or collection of elements.
*
* @constructor
*/
ZeroClipboard._createClient = function() {
_clientConstructor.apply(this, _args(arguments));
};
/**
* Register an event listener to the client.
*
* @returns `this`
*/
ZeroClipboard.prototype.on = function() {
return _clientOn.apply(this, _args(arguments));
};
/**
* Unregister an event handler from the client.
* If no `listener` function/object is provided, it will unregister all handlers for the provided `eventType`.
* If no `eventType` is provided, it will unregister all handlers for every event type.
*
* @returns `this`
*/
ZeroClipboard.prototype.off = function() {
return _clientOff.apply(this, _args(arguments));
};
/**
* Retrieve event listeners for an `eventType` from the client.
* If no `eventType` is provided, it will retrieve all listeners for every event type.
*
* @returns array of listeners for the `eventType`; if no `eventType`, then a map/hash object of listeners for all event types; or `null`
*/
ZeroClipboard.prototype.handlers = function() {
return _clientListeners.apply(this, _args(arguments));
};
/**
* Event emission receiver from the Flash object for this client's registered JavaScript event listeners.
*
* @returns For the "copy" event, returns the Flash-friendly "clipData" object; otherwise `undefined`.
*/
ZeroClipboard.prototype.emit = function() {
return _clientEmit.apply(this, _args(arguments));
};
/**
* Register clipboard actions for new element(s) to the client.
*
* @returns `this`
*/
ZeroClipboard.prototype.clip = function() {
return _clientClip.apply(this, _args(arguments));
};
/**
* Unregister the clipboard actions of previously registered element(s) on the page.
* If no elements are provided, ALL registered elements will be unregistered.
*
* @returns `this`
*/
ZeroClipboard.prototype.unclip = function() {
return _clientUnclip.apply(this, _args(arguments));
};
/**
* Get all of the elements to which this client is clipped.
*
* @returns array of clipped elements
*/
ZeroClipboard.prototype.elements = function() {
return _clientElements.apply(this, _args(arguments));
};
/**
* Self-destruct and clean up everything for a single client.
* This will NOT destroy the embedded Flash object.
*
* @returns `undefined`
*/
ZeroClipboard.prototype.destroy = function() {
return _clientDestroy.apply(this, _args(arguments));
};
/**
* Stores the pending plain text to inject into the clipboard.
*
* @returns `this`
*/
ZeroClipboard.prototype.setText = function(text) {
if (!_clientMeta[this.id]) {
throw new Error("Attempted to set pending clipboard data from a destroyed ZeroClipboard client instance");
}
ZeroClipboard.setData("text/plain", text);
return this;
};
/**
* Stores the pending HTML text to inject into the clipboard.
*
* @returns `this`
*/
ZeroClipboard.prototype.setHtml = function(html) {
if (!_clientMeta[this.id]) {
throw new Error("Attempted to set pending clipboard data from a destroyed ZeroClipboard client instance");
}
ZeroClipboard.setData("text/html", html);
return this;
};
/**
* Stores the pending rich text (RTF) to inject into the clipboard.
*
* @returns `this`
*/
ZeroClipboard.prototype.setRichText = function(richText) {
if (!_clientMeta[this.id]) {
throw new Error("Attempted to set pending clipboard data from a destroyed ZeroClipboard client instance");
}
ZeroClipboard.setData("application/rtf", richText);
return this;
};
/**
* Stores the pending data to inject into the clipboard.
*
* @returns `this`
*/
ZeroClipboard.prototype.setData = function() {
if (!_clientMeta[this.id]) {
throw new Error("Attempted to set pending clipboard data from a destroyed ZeroClipboard client instance");
}
ZeroClipboard.setData.apply(this, _args(arguments));
return this;
};
/**
* Clears the pending data to inject into the clipboard.
* If no `format` is provided, all pending data formats will be cleared.
*
* @returns `this`
*/
ZeroClipboard.prototype.clearData = function() {
if (!_clientMeta[this.id]) {
throw new Error("Attempted to clear pending clipboard data from a destroyed ZeroClipboard client instance");
}
ZeroClipboard.clearData.apply(this, _args(arguments));
return this;
};
/**
* Gets a copy of the pending data to inject into the clipboard.
* If no `format` is provided, a copy of ALL pending data formats will be returned.
*
* @returns `String` or `Object`
*/
ZeroClipboard.prototype.getData = function() {
if (!_clientMeta[this.id]) {
throw new Error("Attempted to get pending clipboard data from a destroyed ZeroClipboard client instance");
}
return ZeroClipboard.getData.apply(this, _args(arguments));
};
if (typeof define === "function" && define.amd) {
define(function() {
return ZeroClipboard;
});
} else if (typeof module === "object" && module && typeof module.exports === "object" && module.exports) {
module.exports = ZeroClipboard;
} else {
window.ZeroClipboard = ZeroClipboard;
}
})(function() {
return this || window;
}());
},{}]},{},[23,47,48,49,65,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,66,67,68,69,86,87,88,72,73,74,75,76,77,31,35,32,33,40,34,36,37,38,39])("zeroclipboard")
}); |
jqueryui/external/jquery/jquery.js | xinbenlv-just-learning/DaysBetween | /*!
* jQuery JavaScript Library v1.10.2
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2013-07-03T13:48Z
*/
(function( window, undefined ) {
// Can't do this because several apps including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if
// you try to trace through "use strict" call chains. (#13335)
// Support: Firefox 18+
//"use strict";
var
// The deferred used on DOM ready
readyList,
// A central reference to the root jQuery(document)
rootjQuery,
// Support: IE<10
// For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
core_strundefined = typeof undefined,
// Use the correct document accordingly with window argument (sandbox)
location = window.location,
document = window.document,
docElem = document.documentElement,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// [[Class]] -> type pairs
class2type = {},
// List of deleted data cache ids, so we can reuse them
core_deletedIds = [],
core_version = "1.10.2",
// Save a reference to some core methods
core_concat = core_deletedIds.concat,
core_push = core_deletedIds.push,
core_slice = core_deletedIds.slice,
core_indexOf = core_deletedIds.indexOf,
core_toString = class2type.toString,
core_hasOwn = class2type.hasOwnProperty,
core_trim = core_version.trim,
// Define a local copy of jQuery
jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Used for matching numbers
core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
// Used for splitting on whitespace
core_rnotwhite = /\S+/g,
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Strict HTML recognition (#11290: must start with <)
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
},
// The ready event handler
completed = function( event ) {
// readyState === "complete" is good enough for us to call the dom ready in oldIE
if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
detach();
jQuery.ready();
}
},
// Clean-up method for dom ready events
detach = function() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", completed, false );
window.removeEventListener( "load", completed, false );
} else {
document.detachEvent( "onreadystatechange", completed );
window.detachEvent( "onload", completed );
}
};
jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used
jquery: core_version,
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem;
// HANDLE: $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = rquickExpr.exec( selector );
}
// Match html or make sure no context is specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
// scripts is true for back-compat
jQuery.merge( this, jQuery.parseHTML(
match[1],
context && context.nodeType ? context.ownerDocument || context : document,
true
) );
// HANDLE: $(html, props)
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
for ( match in context ) {
// Properties of context are called as methods if possible
if ( jQuery.isFunction( this[ match ] ) ) {
this[ match ]( context[ match ] );
// ...and otherwise set as attributes
} else {
this.attr( match, context[ match ] );
}
}
}
return this;
// HANDLE: $(#id)
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return ( context || rootjQuery ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(DOMElement)
} else if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The default length of a jQuery object is 0
length: 0,
toArray: function() {
return core_slice.call( this );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
( num < 0 ? this[ this.length + num ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems ) {
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Add the callback
jQuery.ready.promise().done( fn );
return this;
},
slice: function() {
return this.pushStack( core_slice.apply( this, arguments ) );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
eq: function( i ) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: core_push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
var src, copyIsArray, copy, name, options, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// extend jQuery itself if only one argument is passed
if ( length === i ) {
target = this;
--i;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {
// Abort if there are pending holds or we're already ready
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
return;
}
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready );
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger("ready").off("ready");
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
isWindow: function( obj ) {
/* jshint eqeqeq: false */
return obj != null && obj == obj.window;
},
isNumeric: function( obj ) {
return !isNaN( parseFloat(obj) ) && isFinite( obj );
},
type: function( obj ) {
if ( obj == null ) {
return String( obj );
}
return typeof obj === "object" || typeof obj === "function" ?
class2type[ core_toString.call(obj) ] || "object" :
typeof obj;
},
isPlainObject: function( obj ) {
var key;
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
try {
// Not own constructor property must be Object
if ( obj.constructor &&
!core_hasOwn.call(obj, "constructor") &&
!core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Support: IE<9
// Handle iteration over inherited properties before own properties.
if ( jQuery.support.ownLast ) {
for ( key in obj ) {
return core_hasOwn.call( obj, key );
}
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
for ( key in obj ) {}
return key === undefined || core_hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw new Error( msg );
},
// data: string of html
// context (optional): If specified, the fragment will be created in this context, defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
parseHTML: function( data, context, keepScripts ) {
if ( !data || typeof data !== "string" ) {
return null;
}
if ( typeof context === "boolean" ) {
keepScripts = context;
context = false;
}
context = context || document;
var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && [];
// Single tag
if ( parsed ) {
return [ context.createElement( parsed[1] ) ];
}
parsed = jQuery.buildFragment( [ data ], context, scripts );
if ( scripts ) {
jQuery( scripts ).remove();
}
return jQuery.merge( [], parsed.childNodes );
},
parseJSON: function( data ) {
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
if ( data === null ) {
return data;
}
if ( typeof data === "string" ) {
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
if ( data ) {
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
}
}
jQuery.error( "Invalid JSON: " + data );
},
// Cross-browser xml parsing
parseXML: function( data ) {
var xml, tmp;
if ( !data || typeof data !== "string" ) {
return null;
}
try {
if ( window.DOMParser ) { // Standard
tmp = new DOMParser();
xml = tmp.parseFromString( data , "text/xml" );
} else { // IE
xml = new ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
},
noop: function() {},
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && jQuery.trim( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
// args is for internal usage only
each: function( obj, callback, args ) {
var value,
i = 0,
length = obj.length,
isArray = isArraylike( obj );
if ( args ) {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
}
}
return obj;
},
// Use native String.trim function wherever possible
trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
function( text ) {
return text == null ?
"" :
core_trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makeArray: function( arr, results ) {
var ret = results || [];
if ( arr != null ) {
if ( isArraylike( Object(arr) ) ) {
jQuery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
);
} else {
core_push.call( ret, arr );
}
}
return ret;
},
inArray: function( elem, arr, i ) {
var len;
if ( arr ) {
if ( core_indexOf ) {
return core_indexOf.call( arr, elem, i );
}
len = arr.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var l = second.length,
i = first.length,
j = 0;
if ( typeof l === "number" ) {
for ( ; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var retVal,
ret = [],
i = 0,
length = elems.length;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value,
i = 0,
length = elems.length,
isArray = isArraylike( elems ),
ret = [];
// Go through the array, translating each of the items to their
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
// Go through every key on the object,
} else {
for ( i in elems ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return core_concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var args, proxy, tmp;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = core_slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0,
length = elems.length,
bulk = key == null;
// Sets many values
if ( jQuery.type( key ) === "object" ) {
chainable = true;
for ( i in key ) {
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
}
// Sets one value
} else if ( value !== undefined ) {
chainable = true;
if ( !jQuery.isFunction( value ) ) {
raw = true;
}
if ( bulk ) {
// Bulk operations run against the entire set
if ( raw ) {
fn.call( elems, value );
fn = null;
// ...except when executing function values
} else {
bulk = fn;
fn = function( elem, key, value ) {
return bulk.call( jQuery( elem ), value );
};
}
}
if ( fn ) {
for ( ; i < length; i++ ) {
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
}
}
}
return chainable ?
elems :
// Gets
bulk ?
fn.call( elems ) :
length ? fn( elems[0], key ) : emptyGet;
},
now: function() {
return ( new Date() ).getTime();
},
// A method for quickly swapping in/out CSS properties to get correct calculations.
// Note: this method belongs to the css module but it's needed here for the support module.
// If support gets modularized, this method should be moved back to the css module.
swap: function( elem, options, callback, args ) {
var ret, name,
old = {};
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
}
});
jQuery.ready.promise = function( obj ) {
if ( !readyList ) {
readyList = jQuery.Deferred();
// Catch cases where $(document).ready() is called after the browser event has already occurred.
// we once tried to use readyState "interactive" here, but it caused issues like the one
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout( jQuery.ready );
// Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed, false );
// If IE event model is used
} else {
// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", completed );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", completed );
// If IE and not a frame
// continually check to see if the document is ready
var top = false;
try {
top = window.frameElement == null && document.documentElement;
} catch(e) {}
if ( top && top.doScroll ) {
(function doScrollCheck() {
if ( !jQuery.isReady ) {
try {
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top.doScroll("left");
} catch(e) {
return setTimeout( doScrollCheck, 50 );
}
// detach all dom ready events
detach();
// and execute any waiting functions
jQuery.ready();
}
})();
}
}
}
return readyList.promise( obj );
};
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
function isArraylike( obj ) {
var length = obj.length,
type = jQuery.type( obj );
if ( jQuery.isWindow( obj ) ) {
return false;
}
if ( obj.nodeType === 1 && length ) {
return true;
}
return type === "array" || type !== "function" &&
( length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj );
}
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
/*!
* Sizzle CSS Selector Engine v1.10.2
* http://sizzlejs.com/
*
* Copyright 2013 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2013-07-03
*/
(function( window, undefined ) {
var i,
support,
cachedruns,
Expr,
getText,
isXML,
compile,
outermostContext,
sortInput,
// Local document vars
setDocument,
document,
docElem,
documentIsHTML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
// Instance-specific data
expando = "sizzle" + -(new Date()),
preferredDoc = window.document,
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
hasDuplicate = false,
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
return 0;
},
// General-purpose constants
strundefined = typeof undefined,
MAX_NEGATIVE = 1 << 31,
// Instance methods
hasOwn = ({}).hasOwnProperty,
arr = [],
pop = arr.pop,
push_native = arr.push,
push = arr.push,
slice = arr.slice,
// Use a stripped-down indexOf if we can't use a native one
indexOf = arr.indexOf || function( elem ) {
var i = 0,
len = this.length;
for ( ; i < len; i++ ) {
if ( this[i] === elem ) {
return i;
}
}
return -1;
},
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
// Regular expressions
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
// Loosely modeled on CSS identifier characters
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = characterEncoding.replace( "w", "w#" ),
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
"*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
// Prefer arguments quoted,
// then not containing pseudos/brackets,
// then attribute selectors/non-parenthetical expressions,
// then anything else
// These preferences are here to reduce the number of selectors
// needing tokenize in the PSEUDO preFilter
pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
rsibling = new RegExp( whitespace + "*[+~]" ),
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ),
rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = {
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
},
rnative = /^[^{]+\{\s*\[native \w/,
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rescape = /'|\\/g,
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
funescape = function( _, escaped, escapedWhitespace ) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
// Support: Firefox
// Workaround erroneous numeric interpretation of +"0x"
return high !== high || escapedWhitespace ?
escaped :
// BMP codepoint
high < 0 ?
String.fromCharCode( high + 0x10000 ) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
};
// Optimize for push.apply( _, NodeList )
try {
push.apply(
(arr = slice.call( preferredDoc.childNodes )),
preferredDoc.childNodes
);
// Support: Android<4.0
// Detect silently failing push.apply
arr[ preferredDoc.childNodes.length ].nodeType;
} catch ( e ) {
push = { apply: arr.length ?
// Leverage slice if possible
function( target, els ) {
push_native.apply( target, slice.call(els) );
} :
// Support: IE<9
// Otherwise append directly
function( target, els ) {
var j = target.length,
i = 0;
// Can't trust NodeList.length
while ( (target[j++] = els[i++]) ) {}
target.length = j - 1;
}
};
}
function Sizzle( selector, context, results, seed ) {
var match, elem, m, nodeType,
// QSA vars
i, groups, old, nid, newContext, newSelector;
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
setDocument( context );
}
context = context || document;
results = results || [];
if ( !selector || typeof selector !== "string" ) {
return results;
}
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
return [];
}
if ( documentIsHTML && !seed ) {
// Shortcuts
if ( (match = rquickExpr.exec( selector )) ) {
// Speed-up: Sizzle("#ID")
if ( (m = match[1]) ) {
if ( nodeType === 9 ) {
elem = context.getElementById( m );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE, Opera, and Webkit return items
// by name instead of ID
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
} else {
// Context is not a document
if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
contains( context, elem ) && elem.id === m ) {
results.push( elem );
return results;
}
}
// Speed-up: Sizzle("TAG")
} else if ( match[2] ) {
push.apply( results, context.getElementsByTagName( selector ) );
return results;
// Speed-up: Sizzle(".CLASS")
} else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
push.apply( results, context.getElementsByClassName( m ) );
return results;
}
}
// QSA path
if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
nid = old = expando;
newContext = context;
newSelector = nodeType === 9 && selector;
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
groups = tokenize( selector );
if ( (old = context.getAttribute("id")) ) {
nid = old.replace( rescape, "\\$&" );
} else {
context.setAttribute( "id", nid );
}
nid = "[id='" + nid + "'] ";
i = groups.length;
while ( i-- ) {
groups[i] = nid + toSelector( groups[i] );
}
newContext = rsibling.test( selector ) && context.parentNode || context;
newSelector = groups.join(",");
}
if ( newSelector ) {
try {
push.apply( results,
newContext.querySelectorAll( newSelector )
);
return results;
} catch(qsaError) {
} finally {
if ( !old ) {
context.removeAttribute("id");
}
}
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed );
}
/**
* Create key-value caches of limited size
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
* deleting the oldest entry
*/
function createCache() {
var keys = [];
function cache( key, value ) {
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
if ( keys.push( key += " " ) > Expr.cacheLength ) {
// Only keep the most recent entries
delete cache[ keys.shift() ];
}
return (cache[ key ] = value);
}
return cache;
}
/**
* Mark a function for special use by Sizzle
* @param {Function} fn The function to mark
*/
function markFunction( fn ) {
fn[ expando ] = true;
return fn;
}
/**
* Support testing using an element
* @param {Function} fn Passed the created div and expects a boolean result
*/
function assert( fn ) {
var div = document.createElement("div");
try {
return !!fn( div );
} catch (e) {
return false;
} finally {
// Remove from its parent by default
if ( div.parentNode ) {
div.parentNode.removeChild( div );
}
// release memory in IE
div = null;
}
}
/**
* Adds the same handler for all of the specified attrs
* @param {String} attrs Pipe-separated list of attributes
* @param {Function} handler The method that will be applied
*/
function addHandle( attrs, handler ) {
var arr = attrs.split("|"),
i = attrs.length;
while ( i-- ) {
Expr.attrHandle[ arr[i] ] = handler;
}
}
/**
* Checks document order of two siblings
* @param {Element} a
* @param {Element} b
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
*/
function siblingCheck( a, b ) {
var cur = b && a,
diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
( ~b.sourceIndex || MAX_NEGATIVE ) -
( ~a.sourceIndex || MAX_NEGATIVE );
// Use IE sourceIndex if available on both nodes
if ( diff ) {
return diff;
}
// Check if b follows a
if ( cur ) {
while ( (cur = cur.nextSibling) ) {
if ( cur === b ) {
return -1;
}
}
}
return a ? 1 : -1;
}
/**
* Returns a function to use in pseudos for input types
* @param {String} type
*/
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for buttons
* @param {String} type
*/
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for positionals
* @param {Function} fn
*/
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Detect xml
* @param {Element|Object} elem An element or a document
*/
isXML = Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
// Expose support vars for convenience
support = Sizzle.support = {};
/**
* Sets document-related variables once based on the current document
* @param {Element|Object} [doc] An element or document object to use to set the document
* @returns {Object} Returns the current document
*/
setDocument = Sizzle.setDocument = function( node ) {
var doc = node ? node.ownerDocument || node : preferredDoc,
parent = doc.defaultView;
// If no document and documentElement is available, return
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
return document;
}
// Set our document
document = doc;
docElem = doc.documentElement;
// Support tests
documentIsHTML = !isXML( doc );
// Support: IE>8
// If iframe document is assigned to "document" variable and if iframe has been reloaded,
// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
// IE6-8 do not support the defaultView property so parent will be undefined
if ( parent && parent.attachEvent && parent !== parent.top ) {
parent.attachEvent( "onbeforeunload", function() {
setDocument();
});
}
/* Attributes
---------------------------------------------------------------------- */
// Support: IE<8
// Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
support.attributes = assert(function( div ) {
div.className = "i";
return !div.getAttribute("className");
});
/* getElement(s)By*
---------------------------------------------------------------------- */
// Check if getElementsByTagName("*") returns only elements
support.getElementsByTagName = assert(function( div ) {
div.appendChild( doc.createComment("") );
return !div.getElementsByTagName("*").length;
});
// Check if getElementsByClassName can be trusted
support.getElementsByClassName = assert(function( div ) {
div.innerHTML = "<div class='a'></div><div class='a i'></div>";
// Support: Safari<4
// Catch class over-caching
div.firstChild.className = "i";
// Support: Opera<10
// Catch gEBCN failure to find non-leading classes
return div.getElementsByClassName("i").length === 2;
});
// Support: IE<10
// Check if getElementById returns elements by name
// The broken getElementById methods don't pick up programatically-set names,
// so use a roundabout getElementsByName test
support.getById = assert(function( div ) {
docElem.appendChild( div ).id = expando;
return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
});
// ID find and filter
if ( support.getById ) {
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
var m = context.getElementById( id );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
};
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
return elem.getAttribute("id") === attrId;
};
};
} else {
// Support: IE6/7
// getElementById is not reliable as a find shortcut
delete Expr.find["ID"];
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
return node && node.value === attrId;
};
};
}
// Tag
Expr.find["TAG"] = support.getElementsByTagName ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== strundefined ) {
return context.getElementsByTagName( tag );
}
} :
function( tag, context ) {
var elem,
tmp = [],
i = 0,
results = context.getElementsByTagName( tag );
// Filter out possible comments
if ( tag === "*" ) {
while ( (elem = results[i++]) ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
};
// Class
Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
return context.getElementsByClassName( className );
}
};
/* QSA/matchesSelector
---------------------------------------------------------------------- */
// QSA and matchesSelector support
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
rbuggyMatches = [];
// qSa(:focus) reports false when true (Chrome 21)
// We allow this because of a bug in IE8/9 that throws an error
// whenever `document.activeElement` is accessed on an iframe
// So, we allow :focus to pass through QSA all the time to avoid the IE error
// See http://bugs.jquery.com/ticket/13378
rbuggyQSA = [];
if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function( div ) {
// Select is set to empty string on purpose
// This is to test IE's treatment of not explicitly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
div.innerHTML = "<select><option selected=''></option></select>";
// Support: IE8
// Boolean attributes and "value" are not treated correctly
if ( !div.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked");
}
});
assert(function( div ) {
// Support: Opera 10-12/IE8
// ^= $= *= and empty values
// Should not select anything
// Support: Windows 8 Native Apps
// The type attribute is restricted during .innerHTML assignment
var input = doc.createElement("input");
input.setAttribute( "type", "hidden" );
div.appendChild( input ).setAttribute( "t", "" );
if ( div.querySelectorAll("[t^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":enabled").length ) {
rbuggyQSA.push( ":enabled", ":disabled" );
}
// Opera 10-11 does not throw on post-comma invalid pseudos
div.querySelectorAll("*,:x");
rbuggyQSA.push(",.*:");
});
}
if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||
docElem.mozMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector) )) ) {
assert(function( div ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
support.disconnectedMatch = matches.call( div, "div" );
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( div, "[s!='']:x" );
rbuggyMatches.push( "!=", pseudos );
});
}
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
/* Contains
---------------------------------------------------------------------- */
// Element contains another
// Purposefully does not implement inclusive descendent
// As in, an element does not contain itself
contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && (
adown.contains ?
adown.contains( bup ) :
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
));
} :
function( a, b ) {
if ( b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
}
return false;
};
/* Sorting
---------------------------------------------------------------------- */
// Document order sorting
sortOrder = docElem.compareDocumentPosition ?
function( a, b ) {
// Flag for duplicate removal
if ( a === b ) {
hasDuplicate = true;
return 0;
}
var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );
if ( compare ) {
// Disconnected nodes
if ( compare & 1 ||
(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
// Choose the first element that is related to our preferred document
if ( a === doc || contains(preferredDoc, a) ) {
return -1;
}
if ( b === doc || contains(preferredDoc, b) ) {
return 1;
}
// Maintain original order
return sortInput ?
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
0;
}
return compare & 4 ? -1 : 1;
}
// Not directly comparable, sort on existence of method
return a.compareDocumentPosition ? -1 : 1;
} :
function( a, b ) {
var cur,
i = 0,
aup = a.parentNode,
bup = b.parentNode,
ap = [ a ],
bp = [ b ];
// Exit early if the nodes are identical
if ( a === b ) {
hasDuplicate = true;
return 0;
// Parentless nodes are either documents or disconnected
} else if ( !aup || !bup ) {
return a === doc ? -1 :
b === doc ? 1 :
aup ? -1 :
bup ? 1 :
sortInput ?
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
0;
// If the nodes are siblings, we can do a quick check
} else if ( aup === bup ) {
return siblingCheck( a, b );
}
// Otherwise we need full lists of their ancestors for comparison
cur = a;
while ( (cur = cur.parentNode) ) {
ap.unshift( cur );
}
cur = b;
while ( (cur = cur.parentNode) ) {
bp.unshift( cur );
}
// Walk down the tree looking for a discrepancy
while ( ap[i] === bp[i] ) {
i++;
}
return i ?
// Do a sibling check if the nodes have a common ancestor
siblingCheck( ap[i], bp[i] ) :
// Otherwise nodes in our document sort first
ap[i] === preferredDoc ? -1 :
bp[i] === preferredDoc ? 1 :
0;
};
return doc;
};
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
if ( support.matchesSelector && documentIsHTML &&
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
try {
var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || support.disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch(e) {}
}
return Sizzle( expr, document, null, [elem] ).length > 0;
};
Sizzle.contains = function( context, elem ) {
// Set document vars if needed
if ( ( context.ownerDocument || context ) !== document ) {
setDocument( context );
}
return contains( context, elem );
};
Sizzle.attr = function( elem, name ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
var fn = Expr.attrHandle[ name.toLowerCase() ],
// Don't get fooled by Object.prototype properties (jQuery #13807)
val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
fn( elem, name, !documentIsHTML ) :
undefined;
return val === undefined ?
support.attributes || !documentIsHTML ?
elem.getAttribute( name ) :
(val = elem.getAttributeNode(name)) && val.specified ?
val.value :
null :
val;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
/**
* Document sorting and removing duplicates
* @param {ArrayLike} results
*/
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
j = 0,
i = 0;
// Unless we *know* we can detect duplicates, assume their presence
hasDuplicate = !support.detectDuplicates;
sortInput = !support.sortStable && results.slice( 0 );
results.sort( sortOrder );
if ( hasDuplicate ) {
while ( (elem = results[i++]) ) {
if ( elem === results[ i ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
return results;
};
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( !nodeType ) {
// If no nodeType, this is expected to be an array
for ( ; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
ret += getText( node );
}
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (see #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
return ret;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
attrHandle: {},
find: {},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
"ATTR": function( match ) {
match[1] = match[1].replace( runescape, funescape );
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"CHILD": function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 what (child|of-type)
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4 xn-component of xn+y argument ([+-]?\d*n|)
5 sign of xn-component
6 x of xn-component
7 sign of y-component
8 y of y-component
*/
match[1] = match[1].toLowerCase();
if ( match[1].slice( 0, 3 ) === "nth" ) {
// nth-* requires argument
if ( !match[3] ) {
Sizzle.error( match[0] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
// other types prohibit arguments
} else if ( match[3] ) {
Sizzle.error( match[0] );
}
return match;
},
"PSEUDO": function( match ) {
var excess,
unquoted = !match[5] && match[2];
if ( matchExpr["CHILD"].test( match[0] ) ) {
return null;
}
// Accept quoted arguments as-is
if ( match[3] && match[4] !== undefined ) {
match[2] = match[4];
// Strip excess characters from unquoted arguments
} else if ( unquoted && rpseudo.test( unquoted ) &&
// Get excess from tokenize (recursively)
(excess = tokenize( unquoted, true )) &&
// advance to the next closing parenthesis
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
// excess is a negative index
match[0] = match[0].slice( 0, excess );
match[2] = unquoted.slice( 0, excess );
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"TAG": function( nodeNameSelector ) {
var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
return nodeNameSelector === "*" ?
function() { return true; } :
function( elem ) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function( className ) {
var pattern = classCache[ className + " " ];
return pattern ||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
classCache( className, function( elem ) {
return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
});
},
"ATTR": function( name, operator, check ) {
return function( elem ) {
var result = Sizzle.attr( elem, name );
if ( result == null ) {
return operator === "!=";
}
if ( !operator ) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexOf( check ) === 0 :
operator === "*=" ? check && result.indexOf( check ) > -1 :
operator === "$=" ? check && result.slice( -check.length ) === check :
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
false;
};
},
"CHILD": function( type, what, argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last",
ofType = what === "of-type";
return first === 1 && last === 0 ?
// Shortcut for :nth-*(n)
function( elem ) {
return !!elem.parentNode;
} :
function( elem, context, xml ) {
var cache, outerCache, node, diff, nodeIndex, start,
dir = simple !== forward ? "nextSibling" : "previousSibling",
parent = elem.parentNode,
name = ofType && elem.nodeName.toLowerCase(),
useCache = !xml && !ofType;
if ( parent ) {
// :(first|last|only)-(child|of-type)
if ( simple ) {
while ( dir ) {
node = elem;
while ( (node = node[ dir ]) ) {
if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
return false;
}
}
// Reverse direction for :only-* (if we haven't yet done so)
start = dir = type === "only" && !start && "nextSibling";
}
return true;
}
start = [ forward ? parent.firstChild : parent.lastChild ];
// non-xml :nth-child(...) stores cache data on `parent`
if ( forward && useCache ) {
// Seek `elem` from a previously-cached index
outerCache = parent[ expando ] || (parent[ expando ] = {});
cache = outerCache[ type ] || [];
nodeIndex = cache[0] === dirruns && cache[1];
diff = cache[0] === dirruns && cache[2];
node = nodeIndex && parent.childNodes[ nodeIndex ];
while ( (node = ++nodeIndex && node && node[ dir ] ||
// Fallback to seeking `elem` from the start
(diff = nodeIndex = 0) || start.pop()) ) {
// When found, cache indexes on `parent` and break
if ( node.nodeType === 1 && ++diff && node === elem ) {
outerCache[ type ] = [ dirruns, nodeIndex, diff ];
break;
}
}
// Use previously-cached element index if available
} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
diff = cache[1];
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
} else {
// Use the same loop as above to seek `elem` from the start
while ( (node = ++nodeIndex && node && node[ dir ] ||
(diff = nodeIndex = 0) || start.pop()) ) {
if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
// Cache the index of each encountered element
if ( useCache ) {
(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
}
if ( node === elem ) {
break;
}
}
}
}
// Incorporate the offset, then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
}
};
},
"PSEUDO": function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
Sizzle.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if ( fn[ expando ] ) {
return fn( argument );
}
// But maintain support for old signatures
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
markFunction(function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
idx = indexOf.call( seed, matched[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] );
}
}) :
function( elem ) {
return fn( elem, 0, args );
};
}
return fn;
}
},
pseudos: {
// Potentially complex pseudos
"not": markFunction(function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
markFunction(function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// Match elements unmatched by `matcher`
while ( i-- ) {
if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function( elem, context, xml ) {
input[0] = elem;
matcher( input, null, xml, results );
return !results.pop();
};
}),
"has": markFunction(function( selector ) {
return function( elem ) {
return Sizzle( selector, elem ).length > 0;
};
}),
"contains": markFunction(function( text ) {
return function( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
};
}),
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier C,
// or beginning with the identifier C immediately followed by "-".
// The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name."
// http://www.w3.org/TR/selectors/#lang-pseudo
"lang": markFunction( function( lang ) {
// lang value must be a valid identifier
if ( !ridentifier.test(lang || "") ) {
Sizzle.error( "unsupported lang: " + lang );
}
lang = lang.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
var elemLang;
do {
if ( (elemLang = documentIsHTML ?
elem.lang :
elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
}
} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
return false;
};
}),
// Miscellaneous
"target": function( elem ) {
var hash = window.location && window.location.hash;
return hash && hash.slice( 1 ) === elem.id;
},
"root": function( elem ) {
return elem === docElem;
},
"focus": function( elem ) {
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
// Boolean properties
"enabled": function( elem ) {
return elem.disabled === false;
},
"disabled": function( elem ) {
return elem.disabled === true;
},
"checked": function( elem ) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"selected": function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
// Contents
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
// not comment, processing instructions, or others
// Thanks to Diego Perini for the nodeName shortcut
// Greater than "@" means alpha characters (specifically not starting with "#" or "?")
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
return false;
}
}
return true;
},
"parent": function( elem ) {
return !Expr.pseudos["empty"]( elem );
},
// Element/input types
"header": function( elem ) {
return rheader.test( elem.nodeName );
},
"input": function( elem ) {
return rinputs.test( elem.nodeName );
},
"button": function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"text": function( elem ) {
var attr;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" &&
elem.type === "text" &&
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
},
// Position-in-collection
"first": createPositionalPseudo(function() {
return [ 0 ];
}),
"last": createPositionalPseudo(function( matchIndexes, length ) {
return [ length - 1 ];
}),
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
}),
"even": createPositionalPseudo(function( matchIndexes, length ) {
var i = 0;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function( matchIndexes, length ) {
var i = 1;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
})
}
};
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
Expr.pseudos[ i ] = createInputPseudo( i );
}
for ( i in { submit: true, reset: true } ) {
Expr.pseudos[ i ] = createButtonPseudo( i );
}
// Easy API for creating new setFilters
function setFilters() {}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();
function tokenize( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ selector + " " ];
if ( cached ) {
return parseOnly ? 0 : cached.slice( 0 );
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while ( soFar ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
// Don't consume trailing commas as valid
soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( tokens = [] );
}
matched = false;
// Combinators
if ( (match = rcombinators.exec( soFar )) ) {
matched = match.shift();
tokens.push({
value: matched,
// Cast descendant combinators to space
type: match[0].replace( rtrim, " " )
});
soFar = soFar.slice( matched.length );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
matched = match.shift();
tokens.push({
value: matched,
type: type,
matches: match
});
soFar = soFar.slice( matched.length );
}
}
if ( !matched ) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error( selector ) :
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
}
function toSelector( tokens ) {
var i = 0,
len = tokens.length,
selector = "";
for ( ; i < len; i++ ) {
selector += tokens[i].value;
}
return selector;
}
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checkNonElements = base && dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
return matcher( elem, context, xml );
}
}
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
var data, cache, outerCache,
dirkey = dirruns + " " + doneName;
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if ( xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
if ( matcher( elem, context, xml ) ) {
return true;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
outerCache = elem[ expando ] || (elem[ expando ] = {});
if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
if ( (data = cache[1]) === true || data === cachedruns ) {
return data === true;
}
} else {
cache = outerCache[ dir ] = [ dirkey ];
cache[1] = matcher( elem, context, xml ) || cachedruns;
if ( cache[1] === true ) {
return true;
}
}
}
}
}
};
}
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
}
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
}
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
}
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf.call( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && toSelector(
// If the preceding token was a descendant combinator, insert an implicit any-element `*`
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
).replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && toSelector( tokens )
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
// A counter to specify which element is currently being matched
var matcherCachedRuns = 0,
bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, expandContext ) {
var elem, j, matcher,
setMatched = [],
matchedCount = 0,
i = "0",
unmatched = seed && [],
outermost = expandContext != null,
contextBackup = outermostContext,
// We must always have either seed elements or context
elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
if ( outermost ) {
outermostContext = context !== document && context;
cachedruns = matcherCachedRuns;
}
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
for ( ; (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
cachedruns = ++matcherCachedRuns;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if ( bySet && i !== matchedCount ) {
j = 0;
while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ?
markFunction( superMatcher ) :
superMatcher;
}
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ selector + " " ];
if ( !cached ) {
// Generate a function of recursive functions that can be used to check each element
if ( !group ) {
group = tokenize( selector );
}
i = group.length;
while ( i-- ) {
cached = matcherFromTokens( group[i] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
elementMatchers.push( cached );
}
}
// Cache the compiled function
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
}
return cached;
};
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}
function select( selector, context, results, seed ) {
var i, tokens, token, type, find,
match = tokenize( selector );
if ( !seed ) {
// Try to minimize operations if there is only one group
if ( match.length === 1 ) {
// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
support.getById && context.nodeType === 9 && documentIsHTML &&
Expr.relative[ tokens[1].type ] ) {
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
if ( !context ) {
return results;
}
selector = selector.slice( tokens.shift().value.length );
}
// Fetch a seed set for right-to-left matching
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
while ( i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( runescape, funescape ),
rsibling.test( tokens[0].type ) && context.parentNode || context
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && toSelector( tokens );
if ( !selector ) {
push.apply( results, seed );
return results;
}
break;
}
}
}
}
}
// Compile and execute a filtering function
// Provide `match` to avoid retokenization if we modified the selector above
compile( selector, match )(
seed,
context,
!documentIsHTML,
results,
rsibling.test( selector )
);
return results;
}
// One-time assignments
// Sort stability
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
// Support: Chrome<14
// Always assume duplicates if they aren't passed to the comparison function
support.detectDuplicates = hasDuplicate;
// Initialize against the default document
setDocument();
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
// Detached nodes confoundingly follow *each other*
support.sortDetached = assert(function( div1 ) {
// Should return 1, but returns 4 (following)
return div1.compareDocumentPosition( document.createElement("div") ) & 1;
});
// Support: IE<8
// Prevent attribute/property "interpolation"
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !assert(function( div ) {
div.innerHTML = "<a href='#'></a>";
return div.firstChild.getAttribute("href") === "#" ;
}) ) {
addHandle( "type|href|height|width", function( elem, name, isXML ) {
if ( !isXML ) {
return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
}
});
}
// Support: IE<9
// Use defaultValue in place of getAttribute("value")
if ( !support.attributes || !assert(function( div ) {
div.innerHTML = "<input/>";
div.firstChild.setAttribute( "value", "" );
return div.firstChild.getAttribute( "value" ) === "";
}) ) {
addHandle( "value", function( elem, name, isXML ) {
if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
return elem.defaultValue;
}
});
}
// Support: IE<9
// Use getAttributeNode to fetch booleans when getAttribute lies
if ( !assert(function( div ) {
return div.getAttribute("disabled") == null;
}) ) {
addHandle( booleans, function( elem, name, isXML ) {
var val;
if ( !isXML ) {
return (val = elem.getAttributeNode( name )) && val.specified ?
val.value :
elem[ name ] === true ? name.toLowerCase() : null;
}
});
}
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.pseudos;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})( window );
// String to Object options format cache
var optionsCache = {};
// Convert String-formatted options into Object-formatted ones and store in cache
function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true;
});
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
( optionsCache[ options ] || createOptions( options ) ) :
jQuery.extend( {}, options );
var // Flag to know if list is currently firing
firing,
// Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// First callback to fire (used internally by add and fireWith)
firingStart,
// Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [],
// Fire callbacks
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
firing = true;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
memory = false; // To prevent further calls using add
break;
}
}
firing = false;
if ( list ) {
if ( stack ) {
if ( stack.length ) {
fire( stack.shift() );
}
} else if ( memory ) {
list = [];
} else {
self.disable();
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// First, we save the current length
var start = list.length;
(function add( args ) {
jQuery.each( args, function( _, arg ) {
var type = jQuery.type( arg );
if ( type === "function" ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && type !== "string" ) {
// Inspect recursively
add( arg );
}
});
})( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away
} else if ( memory ) {
firingStart = start;
fire( memory );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
jQuery.each( arguments, function( _, arg ) {
var index;
while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// Handle firing indexes
if ( firing ) {
if ( index <= firingLength ) {
firingLength--;
}
if ( index <= firingIndex ) {
firingIndex--;
}
}
}
});
}
return this;
},
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function( fn ) {
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
},
// Remove all callbacks from the list
empty: function() {
list = [];
firingLength = 0;
return this;
},
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function() {
return !list;
},
// Lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory ) {
self.disable();
}
return this;
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
if ( list && ( !fired || stack ) ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
if ( firing ) {
stack.push( args );
} else {
fire( args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self;
};
jQuery.extend({
Deferred: function( func ) {
var tuples = [
// action, add listener, listener list, final state
[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
[ "notify", "progress", jQuery.Callbacks("memory") ]
],
state = "pending",
promise = {
state: function() {
return state;
},
always: function() {
deferred.done( arguments ).fail( arguments );
return this;
},
then: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
return jQuery.Deferred(function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var action = tuple[ 0 ],
fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
// deferred[ done | fail | progress ] for forwarding actions to newDefer
deferred[ tuple[1] ](function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.done( newDefer.resolve )
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
}
});
});
fns = null;
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
return obj != null ? jQuery.extend( obj, promise ) : promise;
}
},
deferred = {};
// Keep pipe for back-compat
promise.pipe = promise.then;
// Add list-specific methods
jQuery.each( tuples, function( i, tuple ) {
var list = tuple[ 2 ],
stateString = tuple[ 3 ];
// promise[ done | fail | progress ] = list.add
promise[ tuple[1] ] = list.add;
// Handle state
if ( stateString ) {
list.add(function() {
// state = [ resolved | rejected ]
state = stateString;
// [ reject_list | resolve_list ].disable; progress_list.lock
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
}
// deferred[ resolve | reject | notify ]
deferred[ tuple[0] ] = function() {
deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
return this;
};
deferred[ tuple[0] + "With" ] = list.fireWith;
});
// Make the deferred a promise
promise.promise( deferred );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( subordinate /* , ..., subordinateN */ ) {
var i = 0,
resolveValues = core_slice.call( arguments ),
length = resolveValues.length,
// the count of uncompleted subordinates
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
// Update function for both resolve and progress values
updateFunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
if( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
}
};
},
progressValues, progressContexts, resolveContexts;
// add listeners to Deferred subordinates; treat others as resolved
if ( length > 1 ) {
progressValues = new Array( length );
progressContexts = new Array( length );
resolveContexts = new Array( length );
for ( ; i < length; i++ ) {
if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
resolveValues[ i ].promise()
.done( updateFunc( i, resolveContexts, resolveValues ) )
.fail( deferred.reject )
.progress( updateFunc( i, progressContexts, progressValues ) );
} else {
--remaining;
}
}
}
// if we're not waiting on anything, resolve the master
if ( !remaining ) {
deferred.resolveWith( resolveContexts, resolveValues );
}
return deferred.promise();
}
});
jQuery.support = (function( support ) {
var all, a, input, select, fragment, opt, eventName, isSupported, i,
div = document.createElement("div");
// Setup
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
// Finish early in limited (non-browser) environments
all = div.getElementsByTagName("*") || [];
a = div.getElementsByTagName("a")[ 0 ];
if ( !a || !a.style || !all.length ) {
return support;
}
// First batch of tests
select = document.createElement("select");
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName("input")[ 0 ];
a.style.cssText = "top:1px;float:left;opacity:.5";
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
support.getSetAttribute = div.className !== "t";
// IE strips leading whitespace when .innerHTML is used
support.leadingWhitespace = div.firstChild.nodeType === 3;
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
support.tbody = !div.getElementsByTagName("tbody").length;
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
support.htmlSerialize = !!div.getElementsByTagName("link").length;
// Get the style information from getAttribute
// (IE uses .cssText instead)
support.style = /top/.test( a.getAttribute("style") );
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
support.hrefNormalized = a.getAttribute("href") === "/a";
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
support.opacity = /^0.5/.test( a.style.opacity );
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
support.cssFloat = !!a.style.cssFloat;
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
support.checkOn = !!input.value;
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
support.optSelected = opt.selected;
// Tests for enctype support on a form (#6743)
support.enctype = !!document.createElement("form").enctype;
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>";
// Will be defined later
support.inlineBlockNeedsLayout = false;
support.shrinkWrapBlocks = false;
support.pixelPosition = false;
support.deleteExpando = true;
support.noCloneEvent = true;
support.reliableMarginRight = true;
support.boxSizingReliable = true;
// Make sure checked status is properly cloned
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Support: IE<9
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
// Check if we can trust getAttribute("value")
input = document.createElement("input");
input.setAttribute( "value", "" );
support.input = input.getAttribute( "value" ) === "";
// Check if an input maintains its value after becoming a radio
input.value = "t";
input.setAttribute( "type", "radio" );
support.radioValue = input.value === "t";
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute( "checked", "t" );
input.setAttribute( "name", "t" );
fragment = document.createDocumentFragment();
fragment.appendChild( input );
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Support: IE<9
// Opera does not clone events (and typeof div.attachEvent === undefined).
// IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
if ( div.attachEvent ) {
div.attachEvent( "onclick", function() {
support.noCloneEvent = false;
});
div.cloneNode( true ).click();
}
// Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
for ( i in { submit: true, change: true, focusin: true }) {
div.setAttribute( eventName = "on" + i, "t" );
support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
}
div.style.backgroundClip = "content-box";
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
// Support: IE<9
// Iteration over object's inherited properties before its own.
for ( i in jQuery( support ) ) {
break;
}
support.ownLast = i !== "0";
// Run tests that need a body at doc ready
jQuery(function() {
var container, marginDiv, tds,
divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
return;
}
container = document.createElement("div");
container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
body.appendChild( container ).appendChild( div );
// Support: IE8
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
tds = div.getElementsByTagName("td");
tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Support: IE8
// Check if empty table cells still have offsetWidth/Height
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// Check box-sizing and margin behavior.
div.innerHTML = "";
div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
// Workaround failing boxSizing test due to offsetWidth returning wrong value
// with some non-1 values of body zoom, ticket #13543
jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
support.boxSizing = div.offsetWidth === 4;
});
// Use window.getComputedStyle because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. (#3333)
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
marginDiv = div.appendChild( document.createElement("div") );
marginDiv.style.cssText = div.style.cssText = divReset;
marginDiv.style.marginRight = marginDiv.style.width = "0";
div.style.width = "1px";
support.reliableMarginRight =
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
}
if ( typeof div.style.zoom !== core_strundefined ) {
// Support: IE<8
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
div.innerHTML = "";
div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
// Support: IE6
// Check if elements with layout shrink-wrap their children
div.style.display = "block";
div.innerHTML = "<div></div>";
div.firstChild.style.width = "5px";
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
if ( support.inlineBlockNeedsLayout ) {
// Prevent IE 6 from affecting layout for positioned elements #11048
// Prevent IE from shrinking the body in IE 7 mode #12869
// Support: IE<8
body.style.zoom = 1;
}
}
body.removeChild( container );
// Null elements to avoid leaks in IE
container = div = tds = marginDiv = null;
});
// Null elements to avoid leaks in IE
all = select = fragment = opt = a = input = null;
return support;
})({});
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
rmultiDash = /([A-Z])/g;
function internalData( elem, name, data, pvt /* Internal Use Only */ ){
if ( !jQuery.acceptData( elem ) ) {
return;
}
var ret, thisCache,
internalKey = jQuery.expando,
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
// Avoid exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( typeof name === "string" ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
}
function internalRemoveData( elem, name, pvt ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split(" ");
}
}
} else {
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
// Since there is no way to tell _how_ a key was added, remove
// both plain key and camelCase key. #12786
// This will only penalize the array argument path.
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
}
i = name.length;
while ( i-- ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject( cache[ id ] ) ) {
return;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
/* jshint eqeqeq: false */
} else if ( jQuery.support.deleteExpando || cache != cache.window ) {
/* jshint eqeqeq: true */
delete cache[ id ];
// When all else fails, null
} else {
cache[ id ] = null;
}
}
jQuery.extend({
cache: {},
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"applet": true,
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data ) {
return internalData( elem, name, data );
},
removeData: function( elem, name ) {
return internalRemoveData( elem, name );
},
// For internal use only.
_data: function( elem, name, data ) {
return internalData( elem, name, data, true );
},
_removeData: function( elem, name ) {
return internalRemoveData( elem, name, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
// Do not set data on non-element because it will not be cleared (#8335).
if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
return false;
}
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
// nodes accept data unless otherwise specified; rejection can be conditional
return !noData || noData !== true && elem.getAttribute("classid") === noData;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var attrs, name,
data = null,
i = 0,
elem = this[0];
// Special expections of .data basically thwart jQuery.access,
// so implement the relevant behavior ourselves
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attrs = elem.attributes;
for ( ; i < attrs.length; i++ ) {
name = attrs[i].name;
if ( name.indexOf("data-") === 0 ) {
name = jQuery.camelCase( name.slice(5) );
dataAttr( elem, name, data[ name ] );
}
}
jQuery._data( elem, "parsedAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
return arguments.length > 1 ?
// Sets one value
this.each(function() {
jQuery.data( this, key, value );
}) :
// Gets one value
// Try to fetch any internally stored data first
elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
var name;
for ( name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
jQuery.extend({
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray(data) ) {
queue = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
queue.push( data );
}
}
return queue || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
jQuery.dequeue( elem, type );
};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startLength--;
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
// clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}
if ( !startLength && hooks ) {
hooks.empty.fire();
}
},
// not intended for public consumption - generates a queueHooks object, or returns the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, {
empty: jQuery.Callbacks("once memory").add(function() {
jQuery._removeData( elem, type + "queue" );
jQuery._removeData( elem, key );
})
});
}
});
jQuery.fn.extend({
queue: function( type, data ) {
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jQuery.queue( this[0], type );
}
return data === undefined ?
this :
this.each(function() {
var queue = jQuery.queue( this, type, data );
// ensure a hooks for this queue
jQuery._queueHooks( this, type );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
type = type || "fx";
return this.queue( type, function( next, hooks ) {
var timeout = setTimeout( next, time );
hooks.stop = function() {
clearTimeout( timeout );
};
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, obj ) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
};
if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";
while( i-- ) {
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}
}
resolve();
return defer.promise( obj );
}
});
var nodeHook, boolHook,
rclass = /[\t\r\n\f]/g,
rreturn = /\r/g,
rfocusable = /^(?:input|select|textarea|button|object)$/i,
rclickable = /^(?:a|area)$/i,
ruseDefault = /^(?:checked|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute,
getSetInput = jQuery.support.input;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call( this, j, this.className ) );
});
}
if ( proceed ) {
// The disjunction here is for better compressibility (see removeClass)
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
" "
);
if ( cur ) {
j = 0;
while ( (clazz = classes[j++]) ) {
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
cur += clazz + " ";
}
}
elem.className = jQuery.trim( cur );
}
}
}
return this;
},
removeClass: function( value ) {
var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = arguments.length === 0 || typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call( this, j, this.className ) );
});
}
if ( proceed ) {
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
// This expression is here for better compressibility (see addClass)
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
""
);
if ( cur ) {
j = 0;
while ( (clazz = classes[j++]) ) {
// Remove *all* instances
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
cur = cur.replace( " " + clazz + " ", " " );
}
}
elem.className = value ? jQuery.trim( cur ) : "";
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value;
if ( typeof stateVal === "boolean" && type === "string" ) {
return stateVal ? this.addClass( value ) : this.removeClass( value );
}
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
classNames = value.match( core_rnotwhite ) || [];
while ( (className = classNames[ i++ ]) ) {
// check each className given, space separated list
if ( self.hasClass( className ) ) {
self.removeClass( className );
} else {
self.addClass( className );
}
}
// Toggle whole class name
} else if ( type === core_strundefined || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// If the element has a class name or if we're passed "false",
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ",
i = 0,
l = this.length;
for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
return true;
}
}
return false;
},
val: function( value ) {
var ret, hooks, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, jQuery( this ).val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
// Use proper attribute retrieval(#6932, #12072)
var val = jQuery.find.attr( elem, "value" );
return val != null ?
val :
elem.text;
}
},
select: {
get: function( elem ) {
var value, option,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one" || index < 0,
values = one ? null : [],
max = one ? index + 1 : options.length,
i = index < 0 ?
max :
one ? index : 0;
// Loop through all the selected options
for ( ; i < max; i++ ) {
option = options[ i ];
// oldIE doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
return values;
},
set: function( elem, value ) {
var optionSet, option,
options = elem.options,
values = jQuery.makeArray( value ),
i = options.length;
while ( i-- ) {
option = options[ i ];
if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {
optionSet = true;
}
}
// force browsers to behave consistently when non-matching value is set
if ( !optionSet ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
attr: function( elem, name, value ) {
var hooks, ret,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === core_strundefined ) {
return jQuery.prop( elem, name, value );
}
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] ||
( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
} else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, value + "" );
return value;
}
} else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
ret = jQuery.find.attr( elem, name );
// Non-existent attributes return null, we normalize to undefined
return ret == null ?
undefined :
ret;
}
},
removeAttr: function( elem, value ) {
var name, propName,
i = 0,
attrNames = value && value.match( core_rnotwhite );
if ( attrNames && elem.nodeType === 1 ) {
while ( (name = attrNames[i++]) ) {
propName = jQuery.propFix[ name ] || name;
// Boolean attributes get special treatment (#10870)
if ( jQuery.expr.match.bool.test( name ) ) {
// Set corresponding property to false
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
elem[ propName ] = false;
// Support: IE<9
// Also clear defaultChecked/defaultSelected (if appropriate)
} else {
elem[ jQuery.camelCase( "default-" + name ) ] =
elem[ propName ] = false;
}
// See #9699 for explanation of this approach (setting first, then removal)
} else {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to default in case type is set after value during creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
}
},
propFix: {
"for": "htmlFor",
"class": "className"
},
prop: function( elem, name, value ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
ret :
( elem[ name ] = value );
} else {
return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
ret :
elem[ name ];
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
// Use proper attribute retrieval(#12072)
var tabindex = jQuery.find.attr( elem, "tabindex" );
return tabindex ?
parseInt( tabindex, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
-1;
}
}
}
});
// Hooks for boolean attributes
boolHook = {
set: function( elem, value, name ) {
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
// IE<8 needs the *property* name
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
// Use defaultChecked and defaultSelected for oldIE
} else {
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
}
return name;
}
};
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr;
jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?
function( elem, name, isXML ) {
var fn = jQuery.expr.attrHandle[ name ],
ret = isXML ?
undefined :
/* jshint eqeqeq: false */
(jQuery.expr.attrHandle[ name ] = undefined) !=
getter( elem, name, isXML ) ?
name.toLowerCase() :
null;
jQuery.expr.attrHandle[ name ] = fn;
return ret;
} :
function( elem, name, isXML ) {
return isXML ?
undefined :
elem[ jQuery.camelCase( "default-" + name ) ] ?
name.toLowerCase() :
null;
};
});
// fix oldIE attroperties
if ( !getSetInput || !getSetAttribute ) {
jQuery.attrHooks.value = {
set: function( elem, value, name ) {
if ( jQuery.nodeName( elem, "input" ) ) {
// Does not return so that setAttribute is also used
elem.defaultValue = value;
} else {
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
return nodeHook && nodeHook.set( elem, value, name );
}
}
};
}
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = {
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
elem.setAttributeNode(
(ret = elem.ownerDocument.createAttribute( name ))
);
}
ret.value = value += "";
// Break association with cloned elements by also using setAttribute (#9646)
return name === "value" || value === elem.getAttribute( name ) ?
value :
undefined;
}
};
jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords =
// Some attributes are constructed with empty-string values when not defined
function( elem, name, isXML ) {
var ret;
return isXML ?
undefined :
(ret = elem.getAttributeNode( name )) && ret.value !== "" ?
ret.value :
null;
};
jQuery.valHooks.button = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
return ret && ret.specified ?
ret.value :
undefined;
},
set: nodeHook.set
};
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
set: function( elem, value, name ) {
nodeHook.set( elem, value === "" ? false : value, name );
}
};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
};
});
}
// Some attributes require a special call on IE
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !jQuery.support.hrefNormalized ) {
// href/src property should get the full normalized URL (#10299/#12915)
jQuery.each([ "href", "src" ], function( i, name ) {
jQuery.propHooks[ name ] = {
get: function( elem ) {
return elem.getAttribute( name, 4 );
}
};
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Note: IE uppercases css property names, but if we were to .toLowerCase()
// .cssText, that would destroy case senstitivity in URL's, like in "background"
return elem.style.cssText || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = value + "" );
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
};
}
jQuery.each([
"tabIndex",
"readOnly",
"maxLength",
"cellSpacing",
"cellPadding",
"rowSpan",
"colSpan",
"useMap",
"frameBorder",
"contentEditable"
], function() {
jQuery.propFix[ this.toLowerCase() ] = this;
});
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
};
if ( !jQuery.support.checkOn ) {
jQuery.valHooks[ this ].get = function( elem ) {
// Support: Webkit
// "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
};
}
});
var rformElems = /^(?:input|select|textarea)$/i,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
function safeActiveElement() {
try {
return document.activeElement;
} catch ( err ) { }
}
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
global: {},
add: function( elem, types, handler, data, selector ) {
var tmp, events, t, handleObjIn,
special, eventHandle, handleObj,
handlers, type, namespaces, origType,
elemData = jQuery._data( elem );
// Don't attach events to noData or text/comment nodes (but allow plain objects)
if ( !elemData ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
if ( !(events = elemData.events) ) {
events = elemData.events = {};
}
if ( !(eventHandle = elemData.handle) ) {
eventHandle = elemData.handle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem = elem;
}
// Handle multiple events separated by a space
types = ( types || "" ).match( core_rnotwhite ) || [""];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split( "." ).sort();
// There *must* be a type, no attaching namespace-only handlers
if ( !type ) {
continue;
}
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: origType,
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
namespace: namespaces.join(".")
}, handleObjIn );
// Init the event handler queue if we're the first
if ( !(handlers = events[ type ]) ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegateCount++, 0, handleObj );
} else {
handlers.push( handleObj );
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var j, handleObj, tmp,
origCount, t, events,
special, handlers, type,
namespaces, origType,
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = ( types || "" ).match( core_rnotwhite ) || [""];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split( "." ).sort();
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jQuery.event.special[ type ] || {};
type = ( selector ? special.delegateType : special.bindType ) || type;
handlers = events[ type ] || [];
tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
// Remove matching events
origCount = j = handlers.length;
while ( j-- ) {
handleObj = handlers[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
handlers.splice( j, 1 );
if ( handleObj.selector ) {
handlers.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( origCount && !handlers.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
delete elemData.handle;
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery._removeData( elem, "events" );
}
},
trigger: function( event, data, elem, onlyHandlers ) {
var handle, ontype, cur,
bubbleType, special, tmp, i,
eventPath = [ elem || document ],
type = core_hasOwn.call( event, "type" ) ? event.type : event,
namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
cur = tmp = elem = elem || document;
// Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf(".") >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexOf(":") < 0 && "on" + type;
// Caller can pass in a jQuery.Event object, Object, or just an event type string
event = event[ jQuery.expando ] ?
event :
new jQuery.Event( type, typeof event === "object" && event );
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
event.isTrigger = onlyHandlers ? 2 : 3;
event.namespace = namespaces.join(".");
event.namespace_re = event.namespace ?
new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
null;
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data == null ?
[ event ] :
jQuery.makeArray( data, [ event ] );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
if ( !rfocusMorph.test( bubbleType + type ) ) {
cur = cur.parentNode;
}
for ( ; cur; cur = cur.parentNode ) {
eventPath.push( cur );
tmp = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( tmp === (elem.ownerDocument || document) ) {
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
}
}
// Fire handlers on the event path
i = 0;
while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
event.type = i > 1 ?
bubbleType :
special.bindType || type;
// jQuery handler
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Native handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
event.preventDefault();
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
tmp = elem[ ontype ];
if ( tmp ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
try {
elem[ type ]();
} catch ( e ) {
// IE<9 dies on focus/blur to hidden element (#1486,#12518)
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
}
jQuery.event.triggered = undefined;
if ( tmp ) {
elem[ ontype ] = tmp;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event );
var i, ret, handleObj, matched, j,
handlerQueue = [],
args = core_slice.call( arguments ),
handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
special = jQuery.event.special[ event.type ] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers
handlerQueue = jQuery.event.handlers.call( this, event, handlers );
// Run delegates first; they may want to stop propagation beneath us
i = 0;
while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
event.currentTarget = matched.elem;
j = 0;
while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
// Triggered event must either 1) have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
event.handleObj = handleObj;
event.data = handleObj.data;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
if ( (event.result = ret) === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
handlers: function( event, handlers ) {
var sel, handleObj, matches, i,
handlerQueue = [],
delegateCount = handlers.delegateCount,
cur = event.target;
// Find delegate handlers
// Black-hole SVG <use> instance trees (#13180)
// Avoid non-left-click bubbling in Firefox (#3861)
if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
/* jshint eqeqeq: false */
for ( ; cur != this; cur = cur.parentNode || this ) {
/* jshint eqeqeq: true */
// Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
// Don't conflict with Object.prototype properties (#13203)
sel = handleObj.selector + " ";
if ( matches[ sel ] === undefined ) {
matches[ sel ] = handleObj.needsContext ?
jQuery( sel, this ).index( cur ) >= 0 :
jQuery.find( sel, this, null, [ cur ] ).length;
}
if ( matches[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, handlers: matches });
}
}
}
}
// Add the remaining (directly-bound) handlers
if ( delegateCount < handlers.length ) {
handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
}
return handlerQueue;
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop, copy,
type = event.type,
originalEvent = event,
fixHook = this.fixHooks[ type ];
if ( !fixHook ) {
this.fixHooks[ type ] = fixHook =
rmouseEvent.test( type ) ? this.mouseHooks :
rkeyEvent.test( type ) ? this.keyHooks :
{};
}
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = new jQuery.Event( originalEvent );
i = copy.length;
while ( i-- ) {
prop = copy[ i ];
event[ prop ] = originalEvent[ prop ];
}
// Support: IE<9
// Fix target property (#1925)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Support: Chrome 23+, Safari?
// Target should not be a text node (#504, #13143)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// Support: IE<9
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
event.metaKey = !!event.metaKey;
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
},
// Includes some event props shared by KeyEvent and MouseEvent
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function( event, original ) {
// Add which for key events
if ( event.which == null ) {
event.which = original.charCode != null ? original.charCode : original.keyCode;
}
return event;
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function( event, original ) {
var body, eventDoc, doc,
button = original.button,
fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
}
return event;
}
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
// Fire native event if possible so blur/focus sequence is correct
trigger: function() {
if ( this !== safeActiveElement() && this.focus ) {
try {
this.focus();
return false;
} catch ( e ) {
// Support: IE<9
// If we error on focus to hidden element (#1486, #12518),
// let .trigger() run the handlers
}
}
},
delegateType: "focusin"
},
blur: {
trigger: function() {
if ( this === safeActiveElement() && this.blur ) {
this.blur();
return false;
}
},
delegateType: "focusout"
},
click: {
// For checkbox, fire native event so checked state will be right
trigger: function() {
if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
this.click();
return false;
}
},
// For cross-browser consistency, don't fire native .click() on links
_default: function( event ) {
return jQuery.nodeName( event.target, "a" );
}
},
beforeunload: {
postDispatch: function( event ) {
// Even when returnValue equals to undefined Firefox will still show alert
if ( event.result !== undefined ) {
event.originalEvent.returnValue = event.result;
}
}
}
},
simulate: function( type, elem, event, bubble ) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e = jQuery.extend(
new jQuery.Event(),
event,
{
type: type,
isSimulated: true,
originalEvent: {}
}
);
if ( bubble ) {
jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
}
};
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
var name = "on" + type;
if ( elem.detachEvent ) {
// #8545, #7054, preventing memory leaks for custom events in IE6-8
// detachEvent needed property on element, by name of that event, to properly expose it to GC
if ( typeof elem[ name ] === core_strundefined ) {
elem[ name ] = null;
}
elem.detachEvent( name, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !(this instanceof jQuery.Event) ) {
return new jQuery.Event( src, props );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if ( props ) {
jQuery.extend( this, props );
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse,
preventDefault: function() {
var e = this.originalEvent;
this.isDefaultPrevented = returnTrue;
if ( !e ) {
return;
}
// If preventDefault exists, run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// Support: IE
// Otherwise set the returnValue property of the original event to false
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
var e = this.originalEvent;
this.isPropagationStopped = returnTrue;
if ( !e ) {
return;
}
// If stopPropagation exists, run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// Support: IE
// Set the cancelBubble property of the original event to true
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
}
};
// Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = fix;
}
return ret;
}
};
});
// IE submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !jQuery._data( form, "submitBubbles" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true;
});
jQuery._data( form, "submitBubbles", true );
}
});
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) {
delete event._submit_bubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
}
},
teardown: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" );
}
};
}
// IE change delegation and checkbox/radio fix
if ( !jQuery.support.changeBubbles ) {
jQuery.event.special.change = {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true;
}
});
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) {
this._just_changed = false;
}
// Allow triggered, simulated change events (#11500)
jQuery.event.simulate( "change", this, event, true );
});
}
return false;
}
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add( this, "beforeactivate._change", function( e ) {
var elem = e.target;
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
jQuery._data( elem, "changeBubbles", true );
}
});
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
return event.handleObj.handler.apply( this, arguments );
}
},
teardown: function() {
jQuery.event.remove( this, "._change" );
return !rformElems.test( this.nodeName );
}
};
}
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0,
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
};
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
});
}
jQuery.fn.extend({
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
var type, origFn;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) {
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one );
}
return this;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
},
one: function( types, selector, data, fn ) {
return this.on( types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each(function() {
jQuery.event.remove( this, types, fn, selector );
});
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
var elem = this[0];
if ( elem ) {
return jQuery.event.trigger( type, data, elem, true );
}
}
});
var isSimple = /^.[^:#\[\.,]*$/,
rparentsprev = /^(?:parents|prev(?:Until|All))/,
rneedsContext = jQuery.expr.match.needsContext,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
find: function( selector ) {
var i,
ret = [],
self = this,
len = self.length;
if ( typeof selector !== "string" ) {
return this.pushStack( jQuery( selector ).filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
}) );
}
for ( i = 0; i < len; i++ ) {
jQuery.find( selector, self[ i ], ret );
}
// Needed because $( selector, context ) becomes $( context ).find( selector )
ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
ret.selector = this.selector ? this.selector + " " + selector : selector;
return ret;
},
has: function( target ) {
var i,
targets = jQuery( target, this ),
len = targets.length;
return this.filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector || [], true) );
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector || [], false) );
},
is: function( selector ) {
return !!winnow(
this,
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
typeof selector === "string" && rneedsContext.test( selector ) ?
jQuery( selector ) :
selector || [],
false
).length;
},
closest: function( selectors, context ) {
var cur,
i = 0,
l = this.length,
ret = [],
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( ; i < l; i++ ) {
for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
// Always skip document fragments
if ( cur.nodeType < 11 && (pos ?
pos.index(cur) > -1 :
// Don't pass non-elements to Sizzle
cur.nodeType === 1 &&
jQuery.find.matchesSelector(cur, selectors)) ) {
cur = ret.push( cur );
break;
}
}
}
return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
}
// index in selector
if ( typeof elem === "string" ) {
return jQuery.inArray( this[0], jQuery( elem ) );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context ) :
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( jQuery.unique(all) );
},
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter(selector)
);
}
});
function sibling( cur, dir ) {
do {
cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 );
return cur;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return sibling( elem, "nextSibling" );
},
prev: function( elem ) {
return sibling( elem, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.merge( [], elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
ret = jQuery.unique( ret );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushStack( ret );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
var elem = elems[ 0 ];
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 && elem.nodeType === 1 ?
jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
return elem.nodeType === 1;
}));
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, not ) {
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep( elements, function( elem, i ) {
/* jshint -W018 */
return !!qualifier.call( elem, i, elem ) !== not;
});
}
if ( qualifier.nodeType ) {
return jQuery.grep( elements, function( elem ) {
return ( elem === qualifier ) !== not;
});
}
if ( typeof qualifier === "string" ) {
if ( isSimple.test( qualifier ) ) {
return jQuery.filter( qualifier, elements, not );
}
qualifier = jQuery.filter( qualifier, elements );
}
return jQuery.grep( elements, function( elem ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;
});
}
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /^$|\/(?:java|ecma)script/i,
rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
// We have to close these tags to support XHTML (#13200)
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
area: [ 1, "<map>", "</map>" ],
param: [ 1, "<object>", "</object>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
// unless wrapped in a div with non-breaking characters in front of it.
_default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
},
safeFragment = createSafeFragment( document ),
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
jQuery.fn.extend({
text: function( value ) {
return jQuery.access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
}, null, value, arguments.length );
},
append: function() {
return this.domManip( arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
var target = manipulationTarget( this, elem );
target.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip( arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
var target = manipulationTarget( this, elem );
target.insertBefore( elem, target.firstChild );
}
});
},
before: function() {
return this.domManip( arguments, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this );
}
});
},
after: function() {
return this.domManip( arguments, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this.nextSibling );
}
});
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
var elem,
elems = selector ? jQuery.filter( selector, this ) : this,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem ) );
}
if ( elem.parentNode ) {
if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
setGlobalEval( getAll( elem, "script" ) );
}
elem.parentNode.removeChild( elem );
}
}
return this;
},
empty: function() {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
// If this is a select, ensure that it displays empty (#12336)
// Support: IE<9
if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
elem.options.length = 0;
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
return jQuery.access( this, function( value ) {
var elem = this[0] || {},
i = 0,
l = this.length;
if ( value === undefined ) {
return elem.nodeType === 1 ?
elem.innerHTML.replace( rinlinejQuery, "" ) :
undefined;
}
// See if we can take a shortcut and just use innerHTML
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
!wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
value = value.replace( rxhtmlTag, "<$1></$2>" );
try {
for (; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
elem = this[i] || {};
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch(e) {}
}
if ( elem ) {
this.empty().append( value );
}
}, null, value, arguments.length );
},
replaceWith: function() {
var
// Snapshot the DOM in case .domManip sweeps something relevant into its fragment
args = jQuery.map( this, function( elem ) {
return [ elem.nextSibling, elem.parentNode ];
}),
i = 0;
// Make the changes, replacing each context element with the new content
this.domManip( arguments, function( elem ) {
var next = args[ i++ ],
parent = args[ i++ ];
if ( parent ) {
// Don't use the snapshot next if it has moved (#13810)
if ( next && next.parentNode !== parent ) {
next = this.nextSibling;
}
jQuery( this ).remove();
parent.insertBefore( elem, next );
}
// Allow new content to include elements from the context set
}, true );
// Force removal if there was no new content (e.g., from empty arguments)
return i ? this : this.remove();
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, callback, allowIntersection ) {
// Flatten any nested arrays
args = core_concat.apply( [], args );
var first, node, hasScripts,
scripts, doc, fragment,
i = 0,
l = this.length,
set = this,
iNoClone = l - 1,
value = args[0],
isFunction = jQuery.isFunction( value );
// We can't cloneNode fragments that contain checked, in WebKit
if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
return this.each(function( index ) {
var self = set.eq( index );
if ( isFunction ) {
args[0] = value.call( this, index, self.html() );
}
self.domManip( args, callback, allowIntersection );
});
}
if ( l ) {
fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this );
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
if ( first ) {
scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
hasScripts = scripts.length;
// Use the original fragment for the last item instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
for ( ; i < l; i++ ) {
node = fragment;
if ( i !== iNoClone ) {
node = jQuery.clone( node, true, true );
// Keep references to cloned scripts for later restoration
if ( hasScripts ) {
jQuery.merge( scripts, getAll( node, "script" ) );
}
}
callback.call( this[i], node, i );
}
if ( hasScripts ) {
doc = scripts[ scripts.length - 1 ].ownerDocument;
// Reenable scripts
jQuery.map( scripts, restoreScript );
// Evaluate executable scripts on first document insertion
for ( i = 0; i < hasScripts; i++ ) {
node = scripts[ i ];
if ( rscriptType.test( node.type || "" ) &&
!jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
if ( node.src ) {
// Hope ajax is available...
jQuery._evalUrl( node.src );
} else {
jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
}
}
}
}
// Fix #11809: Avoid leaking memory
fragment = first = null;
}
}
return this;
}
});
// Support: IE<8
// Manipulating tables requires a tbody
function manipulationTarget( elem, content ) {
return jQuery.nodeName( elem, "table" ) &&
jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ?
elem.getElementsByTagName("tbody")[0] ||
elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
elem;
}
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type;
return elem;
}
function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type );
if ( match ) {
elem.type = match[1];
} else {
elem.removeAttribute("type");
}
return elem;
}
// Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
var elem,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
}
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function fixCloneNodeIssues( src, dest ) {
var nodeName, e, data;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 copies events bound via attachEvent when using cloneNode.
if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
data = jQuery._data( dest );
for ( e in data.events ) {
jQuery.removeEvent( dest, e, data.handle );
}
// Event data gets referenced instead of copied if the expando gets copied too
dest.removeAttribute( jQuery.expando );
}
// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
if ( nodeName === "script" && dest.text !== src.text ) {
disableScript( dest ).text = src.text;
restoreScript( dest );
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
} else if ( nodeName === "object" ) {
if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML;
}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
dest.innerHTML = src.innerHTML;
}
} else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
dest.defaultChecked = dest.checked = src.checked;
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.defaultSelected = dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
}
}
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var elems,
i = 0,
ret = [],
insert = jQuery( selector ),
last = insert.length - 1;
for ( ; i <= last; i++ ) {
elems = i === last ? this : this.clone(true);
jQuery( insert[i] )[ original ]( elems );
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
core_push.apply( ret, elems.get() );
}
return this.pushStack( ret );
};
});
function getAll( context, tag ) {
var elems, elem,
i = 0,
found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
undefined;
if ( !found ) {
for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
if ( !tag || jQuery.nodeName( elem, tag ) ) {
found.push( elem );
} else {
jQuery.merge( found, getAll( elem, tag ) );
}
}
}
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
jQuery.merge( [ context ], found ) :
found;
}
// Used in buildFragment, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( manipulation_rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var destElements, node, clone, i, srcElements,
inPage = jQuery.contains( elem.ownerDocument, elem );
if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
clone = elem.cloneNode( true );
// IE<=8 does not properly clone detached, unknown element nodes
} else {
fragmentDiv.innerHTML = elem.outerHTML;
fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
}
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone );
srcElements = getAll( elem );
// Fix all IE cloning issues
for ( i = 0; (node = srcElements[i]) != null; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) {
fixCloneNodeIssues( node, destElements[i] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
if ( deepDataAndEvents ) {
srcElements = srcElements || getAll( elem );
destElements = destElements || getAll( clone );
for ( i = 0; (node = srcElements[i]) != null; i++ ) {
cloneCopyEvent( node, destElements[i] );
}
} else {
cloneCopyEvent( elem, clone );
}
}
// Preserve script evaluation history
destElements = getAll( clone, "script" );
if ( destElements.length > 0 ) {
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
}
destElements = srcElements = node = null;
// Return the cloned set
return clone;
},
buildFragment: function( elems, context, scripts, selection ) {
var j, elem, contains,
tmp, tag, tbody, wrap,
l = elems.length,
// Ensure a safe fragment
safe = createSafeFragment( context ),
nodes = [],
i = 0;
for ( ; i < l; i++ ) {
elem = elems[ i ];
if ( elem || elem === 0 ) {
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
// Convert non-html into a text node
} else if ( !rhtml.test( elem ) ) {
nodes.push( context.createTextNode( elem ) );
// Convert html into DOM nodes
} else {
tmp = tmp || safe.appendChild( context.createElement("div") );
// Deserialize a standard representation
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
// Descend through wrappers to the right content
j = wrap[0];
while ( j-- ) {
tmp = tmp.lastChild;
}
// Manually add leading whitespace removed by IE
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
elem = tag === "table" && !rtbody.test( elem ) ?
tmp.firstChild :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !rtbody.test( elem ) ?
tmp :
0;
j = elem && elem.childNodes.length;
while ( j-- ) {
if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
elem.removeChild( tbody );
}
}
}
jQuery.merge( nodes, tmp.childNodes );
// Fix #12392 for WebKit and IE > 9
tmp.textContent = "";
// Fix #12392 for oldIE
while ( tmp.firstChild ) {
tmp.removeChild( tmp.firstChild );
}
// Remember the top-level container for proper cleanup
tmp = safe.lastChild;
}
}
}
// Fix #11356: Clear elements from fragment
if ( tmp ) {
safe.removeChild( tmp );
}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if ( !jQuery.support.appendChecked ) {
jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
}
i = 0;
while ( (elem = nodes[ i++ ]) ) {
// #4087 - If origin and destination elements are the same, and this is
// that element, do not do anything
if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
continue;
}
contains = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment
tmp = getAll( safe.appendChild( elem ), "script" );
// Preserve script evaluation history
if ( contains ) {
setGlobalEval( tmp );
}
// Capture executables
if ( scripts ) {
j = 0;
while ( (elem = tmp[ j++ ]) ) {
if ( rscriptType.test( elem.type || "" ) ) {
scripts.push( elem );
}
}
}
}
tmp = null;
return safe;
},
cleanData: function( elems, /* internal */ acceptData ) {
var elem, type, id, data,
i = 0,
internalKey = jQuery.expando,
cache = jQuery.cache,
deleteExpando = jQuery.support.deleteExpando,
special = jQuery.event.special;
for ( ; (elem = elems[i]) != null; i++ ) {
if ( acceptData || jQuery.acceptData( elem ) ) {
id = elem[ internalKey ];
data = id && cache[ id ];
if ( data ) {
if ( data.events ) {
for ( type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
}
// Remove cache only if it was not already removed by jQuery.event.remove
if ( cache[ id ] ) {
delete cache[ id ];
// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if ( deleteExpando ) {
delete elem[ internalKey ];
} else if ( typeof elem.removeAttribute !== core_strundefined ) {
elem.removeAttribute( internalKey );
} else {
elem[ internalKey ] = null;
}
core_deletedIds.push( id );
}
}
}
}
},
_evalUrl: function( url ) {
return jQuery.ajax({
url: url,
type: "GET",
dataType: "script",
async: false,
global: false,
"throws": true
});
}
});
jQuery.fn.extend({
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
var isFunction = jQuery.isFunction( html );
return this.each(function(i) {
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
}
});
var iframe, getStyles, curCSS,
ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity\s*=\s*([^)]*)/,
rposition = /^(top|right|bottom|left)$/,
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rmargin = /^margin/,
rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
elemdisplay = { BODY: "block" },
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
letterSpacing: 0,
fontWeight: 400
},
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
// return a css property mapped to a potentially vendor prefixed property
function vendorPropName( style, name ) {
// shortcut for names that are not vendor prefixed
if ( name in style ) {
return name;
}
// check for vendor prefixed names
var capName = name.charAt(0).toUpperCase() + name.slice(1),
origName = name,
i = cssPrefixes.length;
while ( i-- ) {
name = cssPrefixes[ i ] + capName;
if ( name in style ) {
return name;
}
}
return origName;
}
function isHidden( elem, el ) {
// isHidden might be called from jQuery#filter function;
// in that case, element will be second argument
elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
}
function showHide( elements, show ) {
var display, elem, hidden,
values = [],
index = 0,
length = elements.length;
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
values[ index ] = jQuery._data( elem, "olddisplay" );
display = elem.style.display;
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && display === "none" ) {
elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( elem.style.display === "" && isHidden( elem ) ) {
values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
}
} else {
if ( !values[ index ] ) {
hidden = isHidden( elem );
if ( display && display !== "none" || !hidden ) {
jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
}
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( index = 0; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
elem.style.display = show ? values[ index ] || "" : "none";
}
}
return elements;
}
jQuery.fn.extend({
css: function( name, value ) {
return jQuery.access( this, function( elem, name, value ) {
var len, styles,
map = {},
i = 0;
if ( jQuery.isArray( name ) ) {
styles = getStyles( elem );
len = name.length;
for ( ; i < len; i++ ) {
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
}
return map;
}
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
}, name, value, arguments.length > 1 );
},
show: function() {
return showHide( this, true );
},
hide: function() {
return showHide( this );
},
toggle: function( state ) {
if ( typeof state === "boolean" ) {
return state ? this.show() : this.hide();
}
return this.each(function() {
if ( isHidden( this ) ) {
jQuery( this ).show();
} else {
jQuery( this ).hide();
}
});
}
});
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity" );
return ret === "" ? "1" : ret;
}
}
}
},
// Don't automatically add "px" to these possibly-unitless properties
cssNumber: {
"columnCount": true,
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"order": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, type, hooks,
origName = jQuery.camelCase( name ),
style = elem.style;
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
// Fixes bug #9237
type = "number";
}
// Make sure that NaN and null values aren't set. See: #7116
if ( value == null || type === "number" && isNaN( value ) ) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
value += "px";
}
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
// but it would mean to define eight (for every problematic property) identical functions
if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
style[ name ] = "inherit";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try {
style[ name ] = value;
} catch(e) {}
}
} else {
// If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
return ret;
}
// Otherwise just get the value from the style object
return style[ name ];
}
},
css: function( elem, name, extra, styles ) {
var num, val, hooks,
origName = jQuery.camelCase( name );
// Make sure that we're working with the right name
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks ) {
val = hooks.get( elem, true, extra );
}
// Otherwise, if a way to get the computed value exists, use that
if ( val === undefined ) {
val = curCSS( elem, name, styles );
}
//convert "normal" to computed value
if ( val === "normal" && name in cssNormalTransform ) {
val = cssNormalTransform[ name ];
}
// Return, converting to number if forced or a qualifier was provided and val looks numeric
if ( extra === "" || extra ) {
num = parseFloat( val );
return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
}
return val;
}
});
// NOTE: we've included the "window" in window.getComputedStyle
// because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
getStyles = function( elem ) {
return window.getComputedStyle( elem, null );
};
curCSS = function( elem, name, _computed ) {
var width, minWidth, maxWidth,
computed = _computed || getStyles( elem ),
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
style = elem.style;
if ( computed ) {
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
// A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
return ret;
};
} else if ( document.documentElement.currentStyle ) {
getStyles = function( elem ) {
return elem.currentStyle;
};
curCSS = function( elem, name, _computed ) {
var left, rs, rsLeft,
computed = _computed || getStyles( elem ),
ret = computed ? computed[ name ] : undefined,
style = elem.style;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && style[ name ] ) {
ret = style[ name ];
}
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
// but not position css attributes, as those are proportional to the parent element instead
// and we can't measure the parent instead because it might trigger a "stacking dolls" problem
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
// Remember the original values
left = style.left;
rs = elem.runtimeStyle;
rsLeft = rs && rs.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
rs.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
rs.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
function setPositiveNumber( elem, value, subtract ) {
var matches = rnumsplit.exec( value );
return matches ?
// Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
value;
}
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
var i = extra === ( isBorderBox ? "border" : "content" ) ?
// If we already have the right measurement, avoid augmentation
4 :
// Otherwise initialize for horizontal or vertical properties
name === "width" ? 1 : 0,
val = 0;
for ( ; i < 4; i += 2 ) {
// both box models exclude margin, so add it if we want it
if ( extra === "margin" ) {
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
}
if ( isBorderBox ) {
// border-box includes padding, so remove it if we want content
if ( extra === "content" ) {
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
}
// at this point, extra isn't border nor margin, so remove border
if ( extra !== "margin" ) {
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
} else {
// at this point, extra isn't content, so add padding
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
// at this point, extra isn't content nor padding, so add border
if ( extra !== "padding" ) {
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
}
}
return val;
}
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value
var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles( elem ),
isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if ( val <= 0 || val == null ) {
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, styles );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test(val) ) {
return val;
}
// we need the check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
}
// use the active box-sizing model to add/subtract irrelevant styles
return ( val +
augmentWidthOrHeight(
elem,
name,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox,
styles
)
) + "px";
}
// Try to determine the default display value of an element
function css_defaultDisplay( nodeName ) {
var doc = document,
display = elemdisplay[ nodeName ];
if ( !display ) {
display = actualDisplay( nodeName, doc );
// If the simple way fails, read from inside an iframe
if ( display === "none" || !display ) {
// Use the already-created iframe if possible
iframe = ( iframe ||
jQuery("<iframe frameborder='0' width='0' height='0'/>")
.css( "cssText", "display:block !important" )
).appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
doc.write("<!doctype html><html><body>");
doc.close();
display = actualDisplay( nodeName, doc );
iframe.detach();
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return display;
}
// Called ONLY from within css_defaultDisplay
function actualDisplay( name, doc ) {
var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
display = jQuery.css( elem[0], "display" );
elem.remove();
return display;
}
jQuery.each([ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
// certain elements can have dimension info if we invisibly show them
// however, it must have a current display style that would benefit from this
return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
jQuery.swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
}) :
getWidthOrHeight( elem, name, extra );
}
},
set: function( elem, value, extra ) {
var styles = extra && getStyles( elem );
return setPositiveNumber( elem, value, extra ?
augmentWidthOrHeight(
elem,
name,
extra,
jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
styles
) : 0
);
}
};
});
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
computed ? "1" : "";
},
set: function( elem, value ) {
var style = elem.style,
currentStyle = elem.currentStyle,
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
filter = currentStyle && currentStyle.filter || style.filter || "";
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
// if value === "", then remove inline opacity #12685
if ( ( value >= 1 || value === "" ) &&
jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
style.removeAttribute ) {
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// if "filter:" is present at all, clearType is disabled, we want to avoid this
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" );
// if there is no filter style applied in a css rule or unset inline opacity, we are done
if ( value === "" || currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
// These hooks cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
jQuery(function() {
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
if ( computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
return jQuery.swap( elem, { "display": "inline-block" },
curCSS, [ elem, "marginRight" ] );
}
}
};
}
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// getComputedStyle returns percent when specified for top/left/bottom/right
// rather than make the css module depend on the offset module, we just check for it here
if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
jQuery.each( [ "top", "left" ], function( i, prop ) {
jQuery.cssHooks[ prop ] = {
get: function( elem, computed ) {
if ( computed ) {
computed = curCSS( elem, prop );
// if curCSS returns percentage, fallback to offset
return rnumnonpx.test( computed ) ?
jQuery( elem ).position()[ prop ] + "px" :
computed;
}
}
};
});
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
// Support: Opera <= 12.12
// Opera reports offsetWidths and offsetHeights less than zero on some elements
return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
(!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
// These hooks are used by animate to expand properties
jQuery.each({
margin: "",
padding: "",
border: "Width"
}, function( prefix, suffix ) {
jQuery.cssHooks[ prefix + suffix ] = {
expand: function( value ) {
var i = 0,
expanded = {},
// assumes a single number if not a string
parts = typeof value === "string" ? value.split(" ") : [ value ];
for ( ; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
}
return expanded;
}
};
if ( !rmargin.test( prefix ) ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
}
});
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
rsubmittable = /^(?:input|select|textarea|keygen)/i;
jQuery.fn.extend({
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map(function(){
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop( this, "elements" );
return elements ? jQuery.makeArray( elements ) : this;
})
.filter(function(){
var type = this.type;
// Use .is(":disabled") so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !manipulation_rcheckableType.test( type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
});
//Serialize an array of form elements or a set of
//key/values into a query string
jQuery.param = function( a, traditional ) {
var prefix,
s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
};
function buildParams( prefix, obj, traditional, add ) {
var name;
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// Item is non-scalar (array or object), encode its numeric index.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
});
jQuery.fn.extend({
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
}
});
var
// Document location
ajaxLocParts,
ajaxLocation,
ajax_nonce = jQuery.now(),
ajax_rquery = /\?/,
rhash = /#.*$/,
rts = /([?&])_=[^&]*/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
// Keep a copy of the old load method
_load = jQuery.fn.load,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat("*");
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
ajaxLocation.href = "";
ajaxLocation = ajaxLocation.href;
}
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType,
i = 0,
dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression
while ( (dataType = dataTypes[i++]) ) {
// Prepend if requested
if ( dataType[0] === "+" ) {
dataType = dataType.slice( 1 ) || "*";
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
// Otherwise append
} else {
(structure[ dataType ] = structure[ dataType ] || []).push( func );
}
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
var inspected = {},
seekingTransport = ( structure === transports );
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
});
return selected;
}
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var deep, key,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
return target;
}
jQuery.fn.load = function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
}
var selector, response, type,
self = this,
off = url.indexOf(" ");
if ( off >= 0 ) {
selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( params && typeof params === "object" ) {
type = "POST";
}
// If we have elements to modify, make the request
if ( self.length > 0 ) {
jQuery.ajax({
url: url,
// if "type" variable is undefined, then "GET" method will be used
type: type,
dataType: "html",
data: params
}).done(function( responseText ) {
// Save response for use in complete callback
response = arguments;
self.html( selector ?
// If a selector was specified, locate the right elements in a dummy div
// Exclude scripts to avoid IE 'Permission Denied' errors
jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
// Otherwise use the full result
responseText );
}).complete( callback && function( jqXHR, status ) {
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
});
}
return this;
};
// Attach a bunch of functions for handling common AJAX events
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
jQuery.fn[ type ] = function( fn ){
return this.on( type, fn );
};
});
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {},
ajaxSettings: {
url: ajaxLocation,
type: "GET",
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
processData: true,
async: true,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
"*": allTypes,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText",
json: "responseJSON"
},
// Data converters
// Keys separate source (or catchall "*") and destination types with a single space
converters: {
// Convert anything to text
"* text": String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": jQuery.parseJSON,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
url: true,
context: true
}
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
return settings ?
// Building a settings object
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
// Extending ajaxSettings
ajaxExtend( jQuery.ajaxSettings, target );
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var // Cross-domain detection vars
parts,
// Loop variable
i,
// URL without anti-cache param
cacheURL,
// Response headers as string
responseHeadersString,
// timeout handle
timeoutTimer,
// To know if global events are to be dispatched
fireGlobals,
transport,
// Response headers
responseHeaders,
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks("once memory"),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// The jqXHR state
state = 0,
// Default abort message
strAbort = "canceled",
// Fake xhr
jqXHR = {
readyState: 0,
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( state === 2 ) {
if ( !responseHeaders ) {
responseHeaders = {};
while ( (match = rheaders.exec( responseHeadersString )) ) {
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
}
return match == null ? null : match;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Caches the header
setRequestHeader: function( name, value ) {
var lname = name.toLowerCase();
if ( !state ) {
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Status-dependent callbacks
statusCode: function( map ) {
var code;
if ( map ) {
if ( state < 2 ) {
for ( code in map ) {
// Lazy-add the new callback in a way that preserves old ones
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
}
} else {
// Execute the appropriate callbacks
jqXHR.always( map[ jqXHR.status ] );
}
}
return this;
},
// Cancel the request
abort: function( statusText ) {
var finalText = statusText || strAbort;
if ( transport ) {
transport.abort( finalText );
}
done( 0, finalText );
return this;
}
};
// Attach deferreds
deferred.promise( jqXHR ).complete = completeDeferred.add;
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
// A cross-domain request is in order when we have a protocol:host:port mismatch
if ( s.crossDomain == null ) {
parts = rurl.exec( s.url.toLowerCase() );
s.crossDomain = !!( parts &&
( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
);
}
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Apply prefilters
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefilter, stop there
if ( state === 2 ) {
return jqXHR;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger("ajaxStart");
}
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Save the URL in case we're toying with the If-Modified-Since
// and/or If-None-Match header later on
cacheURL = s.url;
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Add anti-cache in url if needed
if ( s.cache === false ) {
s.url = rts.test( cacheURL ) ?
// If there is already a '_' parameter, set its value
cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
// Otherwise add one to the end
cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
}
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( jQuery.lastModified[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
}
if ( jQuery.etag[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
// Abort if not done already and return
return jqXHR.abort();
}
// aborting is no longer a cancellation
strAbort = "abort";
// Install callbacks on deferreds
for ( i in { success: 1, error: 1, complete: 1 } ) {
jqXHR[ i ]( s[ i ] );
}
// Get transport
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = setTimeout(function() {
jqXHR.abort("timeout");
}, s.timeout );
}
try {
state = 1;
transport.send( requestHeaders, done );
} catch ( e ) {
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
throw e;
}
}
}
// Callback for when everything is done
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
// Determine if successful
isSuccess = status >= 200 && status < 300 || status === 304;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// Convert no matter what (that way responseXXX fields are always set)
response = ajaxConvert( s, response, jqXHR, isSuccess );
// If successful, handle type chaining
if ( isSuccess ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
modified = jqXHR.getResponseHeader("Last-Modified");
if ( modified ) {
jQuery.lastModified[ cacheURL ] = modified;
}
modified = jqXHR.getResponseHeader("etag");
if ( modified ) {
jQuery.etag[ cacheURL ] = modified;
}
}
// if no content
if ( status === 204 || s.type === "HEAD" ) {
statusText = "nocontent";
// if not modified
} else if ( status === 304 ) {
statusText = "notmodified";
// If we have data, let's convert it
} else {
statusText = response.state;
success = response.data;
error = response.error;
isSuccess = !error;
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( status || !statusText ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger("ajaxStop");
}
}
}
return jqXHR;
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
}
});
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
return jQuery.ajax({
url: url,
type: method,
dataType: type,
data: data,
success: callback
});
};
});
/* Handles responses to an ajax request:
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var firstDataType, ct, finalDataType, type,
contents = s.contents,
dataTypes = s.dataTypes;
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
/* Chain conversions given the request and the original response
* Also sets the responseXXX fields on the jqXHR instance
*/
function ajaxConvert( s, response, jqXHR, isSuccess ) {
var conv2, current, conv, tmp, prev,
converters = {},
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice();
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
current = dataTypes.shift();
// Convert to each sequential dataType
while ( current ) {
if ( s.responseFields[ current ] ) {
jqXHR[ s.responseFields[ current ] ] = response;
}
// Apply the dataFilter if provided
if ( !prev && isSuccess && s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
prev = current;
current = dataTypes.shift();
if ( current ) {
// There's only work to do if current dataType is non-auto
if ( current === "*" ) {
current = prev;
// Convert response if prev dataType is non-auto and differs from current
} else if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
if ( !conv ) {
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split( " " );
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
current = tmp[ 0 ];
dataTypes.unshift( tmp[ 1 ] );
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
if ( conv && s[ "throws" ] ) {
response = conv( response );
} else {
try {
response = conv( response );
} catch ( e ) {
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
}
}
}
}
}
}
return { state: "success", data: response };
}
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /(?:java|ecma)script/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
});
// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
s.global = false;
}
});
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script,
head = document.head || jQuery("head")[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement("script");
script.async = true;
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( script.parentNode ) {
script.parentNode.removeChild( script );
}
// Dereference the script
script = null;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
// Use native DOM manipulation to avoid our domManip AJAX trickery
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( undefined, true );
}
}
};
}
});
var oldCallbacks = [],
rjsonp = /(=)\?(?=&|$)|\?\?/;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
this[ callback ] = true;
return callback;
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
"url" :
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
);
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
// Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
s.jsonpCallback() :
s.jsonpCallback;
// Insert callback into url or form data
if ( jsonProp ) {
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
} else if ( s.jsonp !== false ) {
s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
}
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( callbackName + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Install callback
overwritten = window[ callbackName ];
window[ callbackName ] = function() {
responseContainer = arguments;
};
// Clean-up function (fires after converters)
jqXHR.always(function() {
// Restore preexisting value
window[ callbackName ] = overwritten;
// Save back as free
if ( s[ callbackName ] ) {
// make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback;
// save the callback name for future use
oldCallbacks.push( callbackName );
}
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
overwritten( responseContainer[ 0 ] );
}
responseContainer = overwritten = undefined;
});
// Delegate to script
return "script";
}
});
var xhrCallbacks, xhrSupported,
xhrId = 0,
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject && function() {
// Abort all pending requests
var key;
for ( key in xhrCallbacks ) {
xhrCallbacks[ key ]( undefined, true );
}
};
// Functions to create xhrs
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject("Microsoft.XMLHTTP");
} catch( e ) {}
}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
xhrSupported = jQuery.ajaxSettings.xhr();
jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
xhrSupported = jQuery.support.ajax = !!xhrSupported;
// Create transport if the browser can provide an xhr
if ( xhrSupported ) {
jQuery.ajaxTransport(function( s ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !s.crossDomain || jQuery.support.cors ) {
var callback;
return {
send: function( headers, complete ) {
// Get a new xhr
var handle, i,
xhr = s.xhr();
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open( s.type, s.url, s.async, s.username, s.password );
} else {
xhr.open( s.type, s.url, s.async );
}
// Apply custom fields if provided
if ( s.xhrFields ) {
for ( i in s.xhrFields ) {
xhr[ i ] = s.xhrFields[ i ];
}
}
// Override mime type if needed
if ( s.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( s.mimeType );
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
headers["X-Requested-With"] = "XMLHttpRequest";
}
// Need an extra try/catch for cross domain requests in Firefox 3
try {
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
} catch( err ) {}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( s.hasContent && s.data ) || null );
// Listener
callback = function( _, isAbort ) {
var status, responseHeaders, statusText, responses;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occurred
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
try {
// Was never called and is aborted or complete
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// Only called once
callback = undefined;
// Do not keep as active anymore
if ( handle ) {
xhr.onreadystatechange = jQuery.noop;
if ( xhrOnUnloadAbort ) {
delete xhrCallbacks[ handle ];
}
}
// If it's an abort
if ( isAbort ) {
// Abort it manually if needed
if ( xhr.readyState !== 4 ) {
xhr.abort();
}
} else {
responses = {};
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
// When requesting binary data, IE6-9 will throw an exception
// on any attempt to access responseText (#11426)
if ( typeof xhr.responseText === "string" ) {
responses.text = xhr.responseText;
}
// Firefox throws an exception when accessing
// statusText for faulty cross-domain requests
try {
statusText = xhr.statusText;
} catch( e ) {
// We normalize with Webkit giving an empty statusText
statusText = "";
}
// Filter status for non standard behaviors
// If the request is local and we have data: assume a success
// (success with no data won't get notified, that's the best we
// can do given current implementations)
if ( !status && s.isLocal && !s.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
}
}
} catch( firefoxAccessException ) {
if ( !isAbort ) {
complete( -1, firefoxAccessException );
}
}
// Call complete if needed
if ( responses ) {
complete( status, statusText, responses, responseHeaders );
}
};
if ( !s.async ) {
// if we're in sync mode we fire the callback
callback();
} else if ( xhr.readyState === 4 ) {
// (IE6 & IE7) if it's in cache and has been
// retrieved directly we need to fire the callback
setTimeout( callback );
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
xhr.onreadystatechange = callback;
}
},
abort: function() {
if ( callback ) {
callback( undefined, true );
}
}
};
}
});
}
var fxNow, timerId,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
rrun = /queueHooks$/,
animationPrefilters = [ defaultPrefilter ],
tweeners = {
"*": [function( prop, value ) {
var tween = this.createTween( prop, value ),
target = tween.cur(),
parts = rfxnum.exec( value ),
unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
// Starting value computation is required for potential unit mismatches
start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
rfxnum.exec( jQuery.css( tween.elem, prop ) ),
scale = 1,
maxIterations = 20;
if ( start && start[ 3 ] !== unit ) {
// Trust units reported by jQuery.css
unit = unit || start[ 3 ];
// Make sure we update the tween properties later on
parts = parts || [];
// Iteratively approximate from a nonzero starting point
start = +target || 1;
do {
// If previous iteration zeroed out, double until we get *something*
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
scale = scale || ".5";
// Adjust and apply
start = start / scale;
jQuery.style( tween.elem, prop, start + unit );
// Update scale, tolerating zero or NaN from tween.cur()
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
}
// Update tween properties
if ( parts ) {
start = tween.start = +start || +target || 0;
tween.unit = unit;
// If a +=/-= token was provided, we're doing a relative animation
tween.end = parts[ 1 ] ?
start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
+parts[ 2 ];
}
return tween;
}]
};
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout(function() {
fxNow = undefined;
});
return ( fxNow = jQuery.now() );
}
function createTween( value, prop, animation ) {
var tween,
collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
index = 0,
length = collection.length;
for ( ; index < length; index++ ) {
if ( (tween = collection[ index ].call( animation, prop, value )) ) {
// we're done with this property
return tween;
}
}
}
function Animation( elem, properties, options ) {
var result,
stopped,
index = 0,
length = animationPrefilters.length,
deferred = jQuery.Deferred().always( function() {
// don't match elem in the :animated selector
delete tick.elem;
}),
tick = function() {
if ( stopped ) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( percent );
}
deferred.notifyWith( elem, [ animation, percent, remaining ]);
if ( percent < 1 && length ) {
return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
}
},
animation = deferred.promise({
elem: elem,
props: jQuery.extend( {}, properties ),
opts: jQuery.extend( true, { specialEasing: {} }, options ),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function( prop, end ) {
var tween = jQuery.Tween( elem, animation.opts, prop, end,
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.tweens.push( tween );
return tween;
},
stop: function( gotoEnd ) {
var index = 0,
// if we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
if ( stopped ) {
return this;
}
stopped = true;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( 1 );
}
// resolve when we played the last frame
// otherwise, reject
if ( gotoEnd ) {
deferred.resolveWith( elem, [ animation, gotoEnd ] );
} else {
deferred.rejectWith( elem, [ animation, gotoEnd ] );
}
return this;
}
}),
props = animation.props;
propFilter( props, animation.opts.specialEasing );
for ( ; index < length ; index++ ) {
result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
if ( result ) {
return result;
}
}
jQuery.map( props, createTween, animation );
if ( jQuery.isFunction( animation.opts.start ) ) {
animation.opts.start.call( elem, animation );
}
jQuery.fx.timer(
jQuery.extend( tick, {
elem: elem,
anim: animation,
queue: animation.opts.queue
})
);
// attach callbacks from options
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
}
function propFilter( props, specialEasing ) {
var index, name, easing, value, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( jQuery.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
if ( index !== name ) {
props[ name ] = value;
delete props[ index ];
}
hooks = jQuery.cssHooks[ name ];
if ( hooks && "expand" in hooks ) {
value = hooks.expand( value );
delete props[ name ];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'index' from above because we have the correct "name"
for ( index in value ) {
if ( !( index in props ) ) {
props[ index ] = value[ index ];
specialEasing[ index ] = easing;
}
}
} else {
specialEasing[ name ] = easing;
}
}
}
jQuery.Animation = jQuery.extend( Animation, {
tweener: function( props, callback ) {
if ( jQuery.isFunction( props ) ) {
callback = props;
props = [ "*" ];
} else {
props = props.split(" ");
}
var prop,
index = 0,
length = props.length;
for ( ; index < length ; index++ ) {
prop = props[ index ];
tweeners[ prop ] = tweeners[ prop ] || [];
tweeners[ prop ].unshift( callback );
}
},
prefilter: function( callback, prepend ) {
if ( prepend ) {
animationPrefilters.unshift( callback );
} else {
animationPrefilters.push( callback );
}
}
});
function defaultPrefilter( elem, props, opts ) {
/* jshint validthis: true */
var prop, value, toggle, tween, hooks, oldfire,
anim = this,
orig = {},
style = elem.style,
hidden = elem.nodeType && isHidden( elem ),
dataShow = jQuery._data( elem, "fxshow" );
// handle queue: false promises
if ( !opts.queue ) {
hooks = jQuery._queueHooks( elem, "fx" );
if ( hooks.unqueued == null ) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function() {
if ( !hooks.unqueued ) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always(function() {
// doing this makes sure that the complete handler will be called
// before this completes
anim.always(function() {
hooks.unqueued--;
if ( !jQuery.queue( elem, "fx" ).length ) {
hooks.empty.fire();
}
});
});
}
// height/width overflow pass
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if ( jQuery.css( elem, "display" ) === "inline" &&
jQuery.css( elem, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
style.display = "inline-block";
} else {
style.zoom = 1;
}
}
}
if ( opts.overflow ) {
style.overflow = "hidden";
if ( !jQuery.support.shrinkWrapBlocks ) {
anim.always(function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
});
}
}
// show/hide pass
for ( prop in props ) {
value = props[ prop ];
if ( rfxtypes.exec( value ) ) {
delete props[ prop ];
toggle = toggle || value === "toggle";
if ( value === ( hidden ? "hide" : "show" ) ) {
continue;
}
orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
}
}
if ( !jQuery.isEmptyObject( orig ) ) {
if ( dataShow ) {
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
} else {
dataShow = jQuery._data( elem, "fxshow", {} );
}
// store state if its toggle - enables .stop().toggle() to "reverse"
if ( toggle ) {
dataShow.hidden = !hidden;
}
if ( hidden ) {
jQuery( elem ).show();
} else {
anim.done(function() {
jQuery( elem ).hide();
});
}
anim.done(function() {
var prop;
jQuery._removeData( elem, "fxshow" );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
});
for ( prop in orig ) {
tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
if ( !( prop in dataShow ) ) {
dataShow[ prop ] = tween.start;
if ( hidden ) {
tween.end = tween.start;
tween.start = prop === "width" || prop === "height" ? 1 : 0;
}
}
}
}
}
function Tween( elem, options, prop, end, easing ) {
return new Tween.prototype.init( elem, options, prop, end, easing );
}
jQuery.Tween = Tween;
Tween.prototype = {
constructor: Tween,
init: function( elem, options, prop, end, easing, unit ) {
this.elem = elem;
this.prop = prop;
this.easing = easing || "swing";
this.options = options;
this.start = this.now = this.cur();
this.end = end;
this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
},
cur: function() {
var hooks = Tween.propHooks[ this.prop ];
return hooks && hooks.get ?
hooks.get( this ) :
Tween.propHooks._default.get( this );
},
run: function( percent ) {
var eased,
hooks = Tween.propHooks[ this.prop ];
if ( this.options.duration ) {
this.pos = eased = jQuery.easing[ this.easing ](
percent, this.options.duration * percent, 0, 1, this.options.duration
);
} else {
this.pos = eased = percent;
}
this.now = ( this.end - this.start ) * eased + this.start;
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
if ( hooks && hooks.set ) {
hooks.set( this );
} else {
Tween.propHooks._default.set( this );
}
return this;
}
};
Tween.prototype.init.prototype = Tween.prototype;
Tween.propHooks = {
_default: {
get: function( tween ) {
var result;
if ( tween.elem[ tween.prop ] != null &&
(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
return tween.elem[ tween.prop ];
}
// passing an empty string as a 3rd parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails
// so, simple values such as "10px" are parsed to Float.
// complex values such as "rotate(1rad)" are returned as is.
result = jQuery.css( tween.elem, tween.prop, "" );
// Empty strings, null, undefined and "auto" are converted to 0.
return !result || result === "auto" ? 0 : result;
},
set: function( tween ) {
// use step hook for back compat - use cssHook if its there - use .style if its
// available and use plain properties where available
if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
} else {
tween.elem[ tween.prop ] = tween.now;
}
}
}
};
// Support: IE <=9
// Panic based approach to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function( tween ) {
if ( tween.elem.nodeType && tween.elem.parentNode ) {
tween.elem[ tween.prop ] = tween.now;
}
}
};
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
var cssFn = jQuery.fn[ name ];
jQuery.fn[ name ] = function( speed, easing, callback ) {
return speed == null || typeof speed === "boolean" ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};
});
jQuery.fn.extend({
fadeTo: function( speed, to, easing, callback ) {
// show any hidden elements after setting opacity to 0
return this.filter( isHidden ).css( "opacity", 0 ).show()
// animate to the value specified
.end().animate({ opacity: to }, speed, easing, callback );
},
animate: function( prop, speed, easing, callback ) {
var empty = jQuery.isEmptyObject( prop ),
optall = jQuery.speed( speed, easing, callback ),
doAnimation = function() {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
// Empty animations, or finishing resolves immediately
if ( empty || jQuery._data( this, "finish" ) ) {
anim.stop( true );
}
};
doAnimation.finish = doAnimation;
return empty || optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
var stopQueue = function( hooks ) {
var stop = hooks.stop;
delete hooks.stop;
stop( gotoEnd );
};
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each(function() {
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
data = jQuery._data( this );
if ( index ) {
if ( data[ index ] && data[ index ].stop ) {
stopQueue( data[ index ] );
}
} else {
for ( index in data ) {
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
stopQueue( data[ index ] );
}
}
}
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
timers[ index ].anim.stop( gotoEnd );
dequeue = false;
timers.splice( index, 1 );
}
}
// start the next in the queue if the last step wasn't forced
// timers currently will call their complete callbacks, which will dequeue
// but only if they were gotoEnd
if ( dequeue || !gotoEnd ) {
jQuery.dequeue( this, type );
}
});
},
finish: function( type ) {
if ( type !== false ) {
type = type || "fx";
}
return this.each(function() {
var index,
data = jQuery._data( this ),
queue = data[ type + "queue" ],
hooks = data[ type + "queueHooks" ],
timers = jQuery.timers,
length = queue ? queue.length : 0;
// enable finishing flag on private data
data.finish = true;
// empty the queue first
jQuery.queue( this, type, [] );
if ( hooks && hooks.stop ) {
hooks.stop.call( this, true );
}
// look for any active animations, and finish them
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
timers[ index ].anim.stop( true );
timers.splice( index, 1 );
}
}
// look for any animations in the old queue and finish them
for ( index = 0; index < length; index++ ) {
if ( queue[ index ] && queue[ index ].finish ) {
queue[ index ].finish.call( this );
}
}
// turn off finishing flag
delete data.finish;
});
}
});
// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
var which,
attrs = { height: type },
i = 0;
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
includeWidth = includeWidth? 1 : 0;
for( ; i < 4 ; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
}
if ( includeWidth ) {
attrs.opacity = attrs.width = type;
}
return attrs;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx("show"),
slideUp: genFx("hide"),
slideToggle: genFx("toggle"),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
});
jQuery.speed = function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
// normalize opt.queue - true/undefined/null -> "fx"
if ( opt.queue == null || opt.queue === true ) {
opt.queue = "fx";
}
// Queueing
opt.old = opt.complete;
opt.complete = function() {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
}
};
return opt;
};
jQuery.easing = {
linear: function( p ) {
return p;
},
swing: function( p ) {
return 0.5 - Math.cos( p*Math.PI ) / 2;
}
};
jQuery.timers = [];
jQuery.fx = Tween.prototype.init;
jQuery.fx.tick = function() {
var timer,
timers = jQuery.timers,
i = 0;
fxNow = jQuery.now();
for ( ; i < timers.length; i++ ) {
timer = timers[ i ];
// Checks the timer has not already been removed
if ( !timer() && timers[ i ] === timer ) {
timers.splice( i--, 1 );
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
fxNow = undefined;
};
jQuery.fx.timer = function( timer ) {
if ( timer() && jQuery.timers.push( timer ) ) {
jQuery.fx.start();
}
};
jQuery.fx.interval = 13;
jQuery.fx.start = function() {
if ( !timerId ) {
timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
}
};
jQuery.fx.stop = function() {
clearInterval( timerId );
timerId = null;
};
jQuery.fx.speeds = {
slow: 600,
fast: 200,
// Default speed
_default: 400
};
// Back Compat <1.8 extension point
jQuery.fx.step = {};
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
var docElem, win,
box = { top: 0, left: 0 },
elem = this[ 0 ],
doc = elem && elem.ownerDocument;
if ( !doc ) {
return;
}
docElem = doc.documentElement;
// Make sure it's not a disconnected DOM node
if ( !jQuery.contains( docElem, elem ) ) {
return box;
}
// If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
box = elem.getBoundingClientRect();
}
win = getWindow( doc );
return {
top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
};
};
jQuery.offset = {
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
props = {}, curPosition = {}, curTop, curLeft;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
if ( options.top != null ) {
props.top = ( options.top - curOffset.top ) + curTop;
}
if ( options.left != null ) {
props.left = ( options.left - curOffset.left ) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend({
position: function() {
if ( !this[ 0 ] ) {
return;
}
var offsetParent, offset,
parentOffset = { top: 0, left: 0 },
elem = this[ 0 ];
// fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
if ( jQuery.css( elem, "position" ) === "fixed" ) {
// we assume that getBoundingClientRect is available when computed position is fixed
offset = elem.getBoundingClientRect();
} else {
// Get *real* offsetParent
offsetParent = this.offsetParent();
// Get correct offsets
offset = this.offset();
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
parentOffset = offsetParent.offset();
}
// Add offsetParent borders
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
}
// Subtract parent offsets and element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
return {
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || docElem;
while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || docElem;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
var top = /Y/.test( prop );
jQuery.fn[ method ] = function( val ) {
return jQuery.access( this, function( elem, method, val ) {
var win = getWindow( elem );
if ( val === undefined ) {
return win ? (prop in win) ? win[ prop ] :
win.document.documentElement[ method ] :
elem[ method ];
}
if ( win ) {
win.scrollTo(
!top ? val : jQuery( win ).scrollLeft(),
top ? val : jQuery( win ).scrollTop()
);
} else {
elem[ method ] = val;
}
}, method, val, arguments.length, null );
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
// margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return jQuery.access( this, function( elem, type, value ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return elem.document.documentElement[ "client" + name ];
}
// Get document width or height
if ( elem.nodeType === 9 ) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ],
doc[ "client" + name ]
);
}
return value === undefined ?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css( elem, type, extra ) :
// Set width or height on the element
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable, null );
};
});
});
// Limit scope pollution from any deprecated API
// (function() {
// The number of elements contained in the matched element set
jQuery.fn.size = function() {
return this.length;
};
jQuery.fn.andSelf = jQuery.fn.addBack;
// })();
if ( typeof module === "object" && module && typeof module.exports === "object" ) {
// Expose jQuery as module.exports in loaders that implement the Node
// module pattern (including browserify). Do not create the global, since
// the user will be storing it themselves locally, and globals are frowned
// upon in the Node module world.
module.exports = jQuery;
} else {
// Otherwise expose jQuery to the global object as usual
window.jQuery = window.$ = jQuery;
// Register as a named AMD module, since jQuery can be concatenated with other
// files that may use define, but not via a proper concatenation script that
// understands anonymous AMD modules. A named AMD is safest and most robust
// way to register. Lowercase jquery is used because AMD module names are
// derived from file names, and jQuery is normally delivered in a lowercase
// file name. Do this after creating the global so that if an AMD module wants
// to call noConflict to hide this version of jQuery, it will work.
if ( typeof define === "function" && define.amd ) {
define( "jquery", [], function () { return jQuery; } );
}
}
})( window );
|
cdap-ui/app/cdap/services/WizardConfigs/AddNamespaceWizardConfig.js | caskdata/cdap | /*
* Copyright © 2016 Cask Data, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
import React from 'react';
import GeneralInfoStep from 'components/CaskWizards/AddNamespace/GeneralInfoStep';
import MappingStep from 'components/CaskWizards/AddNamespace/MappingStep';
import SecurityStep from 'components/CaskWizards/AddNamespace/SecurityStep';
import PreferencesStep from 'components/CaskWizards/AddNamespace/PreferencesStep';
import T from 'i18n-react';
const AddNamespaceWizardConfig = {
steps: [
{
id: 'general',
shorttitle: T.translate('features.Wizard.Add-Namespace.Step1.ssd-label'),
title: T.translate('features.Wizard.Add-Namespace.Step1.ssd-label'),
description: T.translate('features.Wizard.Add-Namespace.Step1.sld-desc'),
content: (<GeneralInfoStep />),
requiredFields: ['name']
},
{
id: 'mapping',
shorttitle: T.translate('features.Wizard.Add-Namespace.Step2.ssd-label'),
title: T.translate('features.Wizard.Add-Namespace.Step2.ssd-label'),
description: T.translate('features.Wizard.Add-Namespace.Step2.sld-label'),
content: (<MappingStep />)
},
{
id: 'security',
shorttitle: T.translate('features.Wizard.Add-Namespace.Step3.ssd-label'),
title: T.translate('features.Wizard.Add-Namespace.Step3.ssd-label'),
description: T.translate('features.Wizard.Add-Namespace.Step3.sld-label'),
content: (<SecurityStep />)
},
{
id: 'preferences',
shorttitle: T.translate('features.Wizard.Add-Namespace.Step4.ssd-label'),
title: T.translate('features.Wizard.Add-Namespace.Step4.ssd-label'),
description: T.translate('features.Wizard.Add-Namespace.Step4.sld-label'),
content: (<PreferencesStep />)
}
]
};
export default AddNamespaceWizardConfig;
|
src/components/topic/summary/TopicStoryStats.js | mitmedialab/MediaCloud-Web-Tools | import PropTypes from 'prop-types';
import React from 'react';
import { injectIntl } from 'react-intl';
import StatBar from '../../common/statbar/StatBar';
import messages from '../../../resources/messages';
const localMessages = {
storyCount: { id: 'topic.summary.timespanInfo.storyCount', defaultMessage: 'Total Stories' },
storyCountHelp: { id: 'topic.summary.timespanInfo.storyCount.help', defaultMessage: 'This the total number of stories within this topic that match the timespan you\'ve selected and the filters you have in place. This includes the seed stories and any stories we found via the "spidering" process that follows links form those see stories iteratively to discover more stories about your topic.' },
mediumCount: { id: 'topic.summary.timespanInfo.mediumCount', defaultMessage: 'Media Sources' },
mediumCountHelp: { id: 'topic.summary.timespanInfo.mediumCount.help', defaultMessage: 'The number of unique media sources that published any stories within this timespan that match the filters you have in place. If you are filtering by a search query we can\'t easily compute this number.' },
storyLinkCount: { id: 'topic.summary.timespanInfo.storyLinkCount', defaultMessage: 'Story Links' },
storyLinkCountHelp: { id: 'topic.summary.timespanInfo.storyLinkCount.help', defaultMessage: 'The number of links between stories within this timespan that match the filters you have in place. A story link is a hyperlink from one story to another. For example, if there was only one Chicago Tribune story linked to and it was linked to by 3 New York times stories and 2 Boston Globe stories, then the story links count would be 5. If you are filtering by a search query we can\'t easily compute this number.' },
mediumLinkCount: { id: 'topic.summary.timespanInfo.mediumLinkCount', defaultMessage: 'Media Links' },
mediumLinkCountHelp: { id: 'topic.summary.timespanInfo.mediumLinkCount.help', defaultMessage: 'The number of links between media sources with stories within this timespan that match the filters you have in place. A media link is when one media source links any number of times to another media source. For example, if there was only one Chicago Tribune story linked to and it was linked to by 3 New York times stories and 2 Boston Globe stories, then the story links count would be 2 (because only two unqiue media sources linked to the Chicago Tribune story). If you are filtering by a search query we can\'t easily compute this number.' },
};
const TopicStoryStats = (props) => {
const { timespan, filters } = props;
const { formatNumber, formatMessage } = props.intl;
if ((timespan === null) || (timespan === undefined)) {
return null;
}
let stats;
if (filters.q) {
// if there is a query filter in place, then we can't get many of these stats easily :-(
stats = [
{ message: localMessages.storyCount, data: formatMessage(messages.unknown) },
{ message: localMessages.mediumCount, data: formatMessage(messages.unknown) },
{ message: localMessages.storyLinkCount, data: formatMessage(messages.unknown) },
{ message: localMessages.mediumLinkCount, data: formatMessage(messages.unknown) },
];
} else {
stats = [
{ message: localMessages.storyCount, data: formatNumber(timespan.story_count), helpTitleMsg: localMessages.storyCount, helpContentMsg: localMessages.storyCountHelp },
{ message: localMessages.mediumCount, data: formatNumber(timespan.medium_count), helpTitleMsg: localMessages.mediumCount, helpContentMsg: localMessages.mediumCountHelp },
{ message: localMessages.storyLinkCount, data: formatNumber(timespan.story_link_count), helpTitleMsg: localMessages.storyLinkCount, helpContentMsg: localMessages.storyLinkCountHelp },
{ message: localMessages.mediumLinkCount, data: formatNumber(timespan.medium_link_count), helpTitleMsg: localMessages.mediumLinkCount, helpContentMsg: localMessages.mediumLinkCountHelp },
];
}
return (
<>
<StatBar
columnWidth={3}
stats={stats}
/>
</>
);
};
TopicStoryStats.propTypes = {
// from parent
timespan: PropTypes.object,
topicId: PropTypes.number.isRequired,
filters: PropTypes.object.isRequired,
// from composition chain
intl: PropTypes.object.isRequired,
};
export default injectIntl(TopicStoryStats);
|
examples/huge-apps/routes/Grades/components/Grades.js | hgezim/react-router | import React from 'react';
class Grades extends React.Component {
render () {
return (
<div>
<h2>Grades</h2>
</div>
);
}
}
export default Grades;
|
docs/app/Examples/elements/Button/Content/ButtonExampleMultipleConditionals.js | ben174/Semantic-UI-React | import React from 'react'
import { Button } from 'semantic-ui-react'
const ButtonExampleMultipleConditionals = () => (
<Button.Group>
<Button>One</Button>
<Button.Or />
<Button>Two</Button>
<Button.Or />
<Button>Three</Button>
</Button.Group>
)
export default ButtonExampleMultipleConditionals
|
client/src/components/common/Header.js | natalie-elizabeth/doczy | import React from 'react';
import { Link } from 'react-router-dom';
class LoggedInView extends React.Component {
constructor(props) {
super(props);
this.logout = this.logout.bind(this);
}
logout() {
window.localStorage.removeItem('token');
this.context.router.history.push('/');
};
render() {
return (
<ul className="nav navbar-nav pull-xs-right">
<li className="nav-item">
<Link to="/" className="nav-link">
Home
</Link>
</li>
<li className="nav-item">
<Link to="documents" className="nav-link">
<i className="ion-compose"></i> Documents
</Link>
</li>
<li className="nav-item">
<Link to="dashboard" className="nav-link">
<i className="ion-compose"></i> Dashboard
</Link>
</li>
<li className="nav-item">
<Link to="settings" className="nav-link">
<i className="ion-gear-a"></i> Settings
</Link>
</li>
<li className="nav-item">
<Link to="/" className="nav-link" onClick={this.logout}>
<button> <i className="ion-gear-a"></i> Logout </button>
</Link>
</li>
</ul>
);
}
};
const LoggedOutView = props => {
return (
<div className="card-header danger-color-dark ">
<ul className="nav navbar-nav pull-xs-right">
<li className="nav-item">
<Link to="/" className="nav-link">
Home
</Link>
</li>
<li className="nav-item">
<Link to="/login" className="nav-link">
Sign in
</Link>
</li>
<li className="nav-item">
<Link to="/signup" className="nav-link">
Sign up
</Link>
</li>
</ul>
</div>
);
};
class Header extends React.Component {
render() {
let token = window.localStorage.getItem('token');
console.log('Token>>>>>>>>>>>>>', token);
return (
<nav className="navbar navbar-inverse">
<div className="container">
<Link to="/" className="navbar-brand">
{this.props.appName}
</Link>
{
token ? <LoggedInView currentUser={this.props.currentUser} /> : <LoggedOutView currentUser={this.props.currentUser} />
}
</div>
</nav>
);
}
}
export default Header;
|
src/Button/Button.js | Detaysoft/react-chat-elements | import React from 'react';
import './Button.css';
const classNames = require('classnames');
function Button(props) {
return (
<button
ref={props.buttonRef}
title={props.title}
className={classNames('rce-button', props.type, props.className)}
style={{
backgroundColor: props.backgroundColor,
color: props.color,
borderColor: props.backgroundColor
}}
disabled={props.disabled}
onClick={props.onClick}>
{
props.icon ?
<span className='rce-button-icon--container'>
{(props.icon.float === 'right' || !props.icon.float) && <span>{props.text}</span>}
<span style={{ float: props.icon.float, fontSize: props.icon.size || 12 }} className='rce-button-icon'>{props.icon.component}</span>
{props.icon.float === 'left' && <span>{props.text}</span>}
</span>
: <span>{props.text}</span>
}
</button>
);
}
Button.defaultProps = {
text: '',
disabled: false,
type: null,
icon: null,
backgroundColor: '#3979aa',
color: 'white',
className: null,
buttonRef: null,
title: null,
};
export default Button;
|
node_modules/rc-pagination/es/Pager.js | yhx0634/foodshopfront | import React from 'react';
import PropTypes from 'prop-types';
var Pager = function Pager(props) {
var prefixCls = props.rootPrefixCls + '-item';
var cls = prefixCls + ' ' + prefixCls + '-' + props.page;
if (props.active) {
cls = cls + ' ' + prefixCls + '-active';
}
if (props.className) {
cls = cls + ' ' + props.className;
}
var handleClick = function handleClick() {
props.onClick(props.page);
};
var handleKeyPress = function handleKeyPress(e) {
props.onKeyPress(e, props.onClick, props.page);
};
return React.createElement(
'li',
{
title: props.showTitle ? props.page : null,
className: cls,
onClick: handleClick,
onKeyPress: handleKeyPress,
tabIndex: '0'
},
props.itemRender(props.page, 'page')
);
};
Pager.propTypes = {
page: PropTypes.number,
active: PropTypes.bool,
last: PropTypes.bool,
locale: PropTypes.object,
className: PropTypes.string,
showTitle: PropTypes.bool,
rootPrefixCls: PropTypes.string,
onClick: PropTypes.func,
onKeyPress: PropTypes.func,
itemRender: PropTypes.func
};
export default Pager; |
ajax/libs/antd-mobile/1.0.0-alpha.18/antd-mobile.min.js | dlueth/cdnjs | /*!
* antd-mobile v1.0.0-alpha.18
*
* Copyright 2015-present, Alipay, Inc.
* All rights reserved.
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports["antd-mobile"]=t(require("react"),require("react-dom")):e["antd-mobile"]=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var n=t.slice(1),i=e[t[0]];return function(e,t,r){i.apply(this,[e,t,r].concat(n))}}(e[t]);break;default:e[t]=e[e[t]]}return e}([function(e,t,n){e.exports=n(125)},function(t,n){t.exports=e},function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var r=n(222),o=i(r),a=n(219),s=i(a),l=n(34),u=i(l);t["default"]=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":(0,u["default"])(t)));e.prototype=(0,s["default"])(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(o["default"]?(0,o["default"])(e,t):e.__proto__=t)}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var r=n(34),o=i(r);t["default"]=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":(0,o["default"])(t))&&"function"!=typeof t?e:t}},function(e,t,n){var i,r;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var i=arguments[t];if(i){var r=typeof i;if("string"===r||"number"===r)e.push(i);else if(Array.isArray(i))e.push(n.apply(null,i));else if("object"===r)for(var a in i)o.call(i,a)&&i[a]&&e.push(a)}}return e.join(" ")}var o={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=n:(i=[],r=function(){return n}.apply(t,i),!(void 0!==r&&(e.exports=r)))}()},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var r=n(220),o=i(r);t["default"]=function(e,t,n){return t in e?(0,o["default"])(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var r=n(218),o=i(r);t["default"]=o["default"]||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}},function(e,t,n){"use strict";n(324),n(313)},function(e,n){e.exports=t},function(e,t){"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function i(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==i.join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(o){return!1}}var r=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;e.exports=i()?Object.assign:function(e,t){for(var i,a,s=n(e),l=1;l<arguments.length;l++){i=Object(arguments[l]);for(var u in i)r.call(i,u)&&(s[u]=i[u]);if(Object.getOwnPropertySymbols){a=Object.getOwnPropertySymbols(i);for(var c=0;c<a.length;c++)o.call(i,a[c])&&(s[a[c]]=i[a[c]])}}return s}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t,n){var i=n(63)("wks"),r=n(43),o=n(18).Symbol,a="function"==typeof o,s=e.exports=function(e){return i[e]||(i[e]=a&&o[e]||(a?o:r)("Symbol."+e))};s.store=i},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),a=r(o),s=n(2),l=r(s),u=n(4),c=r(u),d=n(3),f=r(d),p=n(1),h=i(p),m=n(5),y=r(m),v=function(e){function t(){(0,l["default"])(this,t);var i=(0,c["default"])(this,e.apply(this,arguments));return i.renderSvg=function(){var e=void 0;try{e=n(121)("./"+i.props.type+".svg")}finally{return e}},i}return(0,f["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.type,i=t.className,r=t.style,o=t.size,s=void 0===o?"md":o,l=this.renderSvg();l=l?"#"+n:n;var u=(0,y["default"])((e={"am-icon":!0},(0,a["default"])(e,"am-icon-"+n,!0),(0,a["default"])(e,"am-icon-"+s,!0),(0,a["default"])(e,i,!!i),e));return h.createElement("svg",{className:u,style:r},h.createElement("use",{xlinkHref:l}))},t}(h.Component);t["default"]=v,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var r=n(217),o=i(r),a=n(216),s=i(a);t["default"]=function(){function e(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,l=(0,s["default"])(e);!(i=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(u){r=!0,o=u}finally{try{!i&&l["return"]&&l["return"]()}finally{if(r)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if((0,o["default"])(Object(t)))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()},function(e,t){"use strict";function n(e,t){var n={},i={};return Object.keys(e).forEach(function(r){t.indexOf(r)!==-1?n[r]=e[r]:i[r]=e[r]}),[n,i]}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";n(291)},function(e,t,n){var i=n(18),r=n(11),o=n(55),a=n(28),s="prototype",l=function(e,t,n){var u,c,d,f=e&l.F,p=e&l.G,h=e&l.S,m=e&l.P,y=e&l.B,v=e&l.W,g=p?r:r[t]||(r[t]={}),b=g[s],M=p?i:h?i[t]:(i[t]||{})[s];p&&(n=t);for(u in n)c=!f&&M&&void 0!==M[u],c&&u in g||(d=c?M[u]:n[u],g[u]=p&&"function"!=typeof M[u]?n[u]:y&&c?o(d,i):v&&M[u]==d?function(e){var t=function(t,n,i){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,i)}return e.apply(this,arguments)};return t[s]=e[s],t}(d):m&&"function"==typeof d?o(Function.call,d):d,m&&((g.virtual||(g.virtual={}))[u]=d,e&l.R&&b&&!b[u]&&a(b,u,d)))};l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var i=n(21),r=n(93),o=n(65),a=Object.defineProperty;t.f=n(22)?Object.defineProperty:function(e,t,n){if(i(e),t=o(t,!0),i(n),r)try{return a(e,t,n)}catch(s){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},[451,295],function(e,t,n){var i=n(35);e.exports=function(e){if(!i(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){e.exports=!n(27)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var i=n(94),r=n(56);e.exports=function(e){return i(r(e))}},function(e,t){"use strict";function n(e){var t={};return Object.keys(e).forEach(function(n){0===n.indexOf("data-")&&(t[n]=e[n])}),t}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(158),m=i(h),y=n(5),v=i(y),g=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,i=t.children,r=t.className,a=t.style,s=t.renderHeader,l=t.renderFooter,u=(0,v["default"])((e={},(0,o["default"])(e,n,!0),(0,o["default"])(e,r,r),e));return p["default"].createElement("div",{className:u,style:a},s?p["default"].createElement("div",{className:n+"-header"},s()):null,i?p["default"].createElement("div",{className:n+"-body"},i):null,l?p["default"].createElement("div",{className:n+"-footer"},l()):null)},t}(p["default"].Component);t["default"]=g,g.Item=m["default"],g.defaultProps={prefixCls:"am-list"},e.exports=t["default"]},function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t,n){var i=n(19),r=n(36);e.exports=n(22)?function(e,t,n){return i.f(e,t,r(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){e.exports={}},function(e,t,n){var i=n(98),r=n(57);e.exports=Object.keys||function(e){return i(e,r)}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=l["default"].createClass({displayName:"TouchableFeedbackComponent",statics:{myName:t||"TouchableFeedbackComponent"},getDefaultProps:function(){return{activeStyle:{}}},getInitialState:function(){return{touchFeedback:!1}},onTouchStart:function(e){this.props.onTouchStart&&this.props.onTouchStart(e),this.setTouchFeedbackState(!0)},onTouchEnd:function(e){this.props.onTouchEnd&&this.props.onTouchEnd(e),this.setTouchFeedbackState(!1)},onTouchCancel:function(e){this.props.onTouchCancel&&this.props.onTouchCancel(e),this.setTouchFeedbackState(!1)},onMouseDown:function(e){this.props.onTouchStart&&this.props.onTouchStart(e),this.setTouchFeedbackState(!0)},onMouseUp:function(e){this.props.onTouchEnd&&this.props.onTouchEnd(e),this.setTouchFeedbackState(!1)},setTouchFeedbackState:function(e){this.setState({touchFeedback:e})},render:function(){var t={};return this.props.activeStyle&&(t=u?{onTouchStart:this.onTouchStart,onTouchEnd:this.onTouchEnd,onTouchCancel:this.onTouchCancel}:{onMouseDown:this.onMouseDown,onMouseUp:this.state.touchFeedback?this.onMouseUp:void 0,onMouseLeave:this.state.touchFeedback?this.onMouseUp:void 0}),l["default"].createElement(e,(0,a["default"])({},this.props,{touchFeedback:this.state.touchFeedback},t))}});return n}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),a=i(o);t["default"]=r;var s=n(1),l=i(s),u="undefined"!=typeof window&&"ontouchstart"in window;e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(147),o=i(r),a=n(148),s=i(a);o["default"].Item=s["default"],t["default"]=o["default"],e.exports=t["default"]},[451,289],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var r=n(224),o=i(r),a=n(223),s=i(a),l="function"==typeof s["default"]&&"symbol"==typeof o["default"]?function(e){return typeof e}:function(e){return e&&"function"==typeof s["default"]&&e.constructor===s["default"]&&e!==s["default"].prototype?"symbol":typeof e};t["default"]="function"==typeof s["default"]&&"symbol"===l(o["default"])?function(e){return"undefined"==typeof e?"undefined":l(e)}:function(e){return e&&"function"==typeof s["default"]&&e.constructor===s["default"]&&e!==s["default"].prototype?"symbol":"undefined"==typeof e?"undefined":l(e)}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";function i(e,t){return e+t}function r(e,t,n){var i=n;{if("object"!==("undefined"==typeof t?"undefined":w(t)))return"undefined"!=typeof i?("number"==typeof i&&(i+="px"),void(e.style[t]=i)):E(e,t);for(var o in t)t.hasOwnProperty(o)&&r(e,o,t[o])}}function o(e){var t=void 0,n=void 0,i=void 0,r=e.ownerDocument,o=r.body,a=r&&r.documentElement;return t=e.getBoundingClientRect(),n=t.left,i=t.top,n-=a.clientLeft||o.clientLeft||0,i-=a.clientTop||o.clientTop||0,{left:n,top:i}}function a(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],i="scroll"+(t?"Top":"Left");if("number"!=typeof n){var r=e.document;n=r.documentElement[i],"number"!=typeof n&&(n=r.body[i])}return n}function s(e){return a(e)}function l(e){return a(e,!0)}function u(e){var t=o(e),n=e.ownerDocument,i=n.defaultView||n.parentWindow;return t.left+=s(i),t.top+=l(i),t}function c(e,t,n){var i=n,r="",o=e.ownerDocument;return i=i||o.defaultView.getComputedStyle(e,null),i&&(r=i.getPropertyValue(t)||i[t]),r}function d(e,t){var n=e[I]&&e[I][t];if(P.test(n)&&!D.test(t)){var i=e.style,r=i[j],o=e[L][j];e[L][j]=e[I][j],i[j]="fontSize"===t?"1em":n||0,n=i.pixelLeft+k,i[j]=r,e[L][j]=o}return""===n?"auto":n}function f(e,t){return"left"===e?t.useCssRight?"right":e:t.useCssBottom?"bottom":e}function p(e){return"left"===e?"right":"right"===e?"left":"top"===e?"bottom":"bottom"===e?"top":void 0}function h(e,t,n){"static"===r(e,"position")&&(e.style.position="relative");var o=-999,a=-999,s=f("left",n),l=f("top",n),c=p(s),d=p(l);"left"!==s&&(o=999),"top"!==l&&(a=999);var h="",m=u(e);("left"in t||"top"in t)&&(h=(0,S.getTransitionProperty)(e)||"",(0,S.setTransitionProperty)(e,"none")),"left"in t&&(e.style[c]="",e.style[s]=o+"px"),"top"in t&&(e.style[d]="",e.style[l]=a+"px");var y=u(e),v={};for(var g in t)if(t.hasOwnProperty(g)){var b=f(g,n),M="left"===g?o:a,T=m[g]-y[g];b===g?v[b]=M+T:v[b]=M-T}r(e,v),i(e.offsetTop,e.offsetLeft),("left"in t||"top"in t)&&(0,S.setTransitionProperty)(e,h);var x={};for(var C in t)if(t.hasOwnProperty(C)){var _=f(C,n),w=t[C]-m[C];C===_?x[_]=v[_]+w:x[_]=v[_]-w}r(e,x)}function m(e,t){var n=u(e),i=(0,S.getTransformXY)(e),r={x:i.x,y:i.y};"left"in t&&(r.x=i.x+t.left-n.left),"top"in t&&(r.y=i.y+t.top-n.top),(0,S.setTransformXY)(e,r)}function y(e,t,n){n.useCssRight||n.useCssBottom?h(e,t,n):n.useCssTransform&&(0,S.getTransformName)()in document.body.style?m(e,t,n):h(e,t,n)}function v(e,t){for(var n=0;n<e.length;n++)t(e[n])}function g(e){return"border-box"===E(e,"boxSizing")}function b(e,t,n){var i={},r=e.style,o=void 0;for(o in t)t.hasOwnProperty(o)&&(i[o]=r[o],r[o]=t[o]);n.call(e);for(o in t)t.hasOwnProperty(o)&&(r[o]=i[o])}function M(e,t,n){var i=0,r=void 0,o=void 0,a=void 0;for(o=0;o<t.length;o++)if(r=t[o])for(a=0;a<n.length;a++){var s=void 0;s="border"===r?""+r+n[a]+"Width":r+n[a],i+=parseFloat(E(e,s))||0}return i}function T(e){return null!==e&&void 0!==e&&e==e.window}function x(e,t,n){var i=n;if(T(e))return"width"===t?Y.viewportWidth(e):Y.viewportHeight(e);if(9===e.nodeType)return"width"===t?Y.docWidth(e):Y.docHeight(e);var r="width"===t?["Left","Right"]:["Top","Bottom"],o="width"===t?e.offsetWidth:e.offsetHeight,a=E(e),s=g(e,a),l=0;(null===o||void 0===o||o<=0)&&(o=void 0,l=E(e,t),(null===l||void 0===l||Number(l)<0)&&(l=e.style[t]||0),l=parseFloat(l)||0),void 0===i&&(i=s?R:A);var u=void 0!==o||s,c=o||l;return i===A?u?c-M(e,["border","padding"],r,a):l:u?i===R?c:c+(i===z?-M(e,["border"],r,a):M(e,["margin"],r,a)):l+M(e,O.slice(i),r,a)}function C(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var i=void 0,r=t[0];return 0!==r.offsetWidth?i=x.apply(void 0,t):b(r,H,function(){i=x.apply(void 0,t)}),i}function _(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}Object.defineProperty(t,"__esModule",{value:!0});var w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},S=n(278),N=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,E=void 0,P=new RegExp("^("+N+")(?!px)[a-z%]+$","i"),D=/^(top|right|bottom|left)$/,I="currentStyle",L="runtimeStyle",j="left",k="px";"undefined"!=typeof window&&(E=window.getComputedStyle?c:d);var O=["margin","border","padding"],A=-1,z=2,R=1,W=0,Y={};v(["Width","Height"],function(e){Y["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],Y["viewport"+e](n))},Y["viewport"+e]=function(t){var n="client"+e,i=t.document,r=i.body,o=i.documentElement,a=o[n];return"CSS1Compat"===i.compatMode&&a||r&&r[n]||a}});var H={position:"absolute",visibility:"hidden",display:"block"};v(["width","height"],function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);Y["outer"+t]=function(t,n){return t&&C(t,e,n?W:R)};var n="width"===e?["Left","Right"]:["Top","Bottom"];Y[e]=function(t,i){var o=i;{if(void 0===o)return t&&C(t,e,A);if(t){var a=E(t),s=g(t);return s&&(o+=M(t,["padding","border"],n,a)),r(t,e,o)}}}});var B={getWindow:function(e){if(e&&e.document&&e.setTimeout)return e;var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},offset:function(e,t,n){return"undefined"==typeof t?u(e):void y(e,t,n||{})},isWindow:T,each:v,css:r,clone:function(e){var t=void 0,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);var i=e.overflow;if(i)for(t in e)e.hasOwnProperty(t)&&(n.overflow[t]=e.overflow[t]);return n},mix:_,getWindowScrollLeft:function(e){return s(e)},getWindowScrollTop:function(e){return l(e)},merge:function(){for(var e={},t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];for(var r=0;r<n.length;r++)B.mix(e,n[r]);return e},viewportWidth:0,viewportHeight:0};_(B,Y),t["default"]=B,e.exports=t["default"]},function(e,t,n){"use strict";var i=n(10);e.exports=function(e,t){for(var n=i({},e),r=0;r<t.length;r++){var o=t[r];delete n[o]}return n}},function(e,t,n){"use strict";var i=n(335);e.exports=function(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var a=i(e),s=i(t),l=a.length;if(l!==s.length)return!1;r=r||null;for(var u=Object.prototype.hasOwnProperty.bind(t),c=0;c<l;c++){var d=a[c];if(!u(d))return!1;var f=e[d],p=t[d],h=n?n.call(r,f,p,d):void 0;if(h===!1||void 0===h&&f!==p)return!1}return!0}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n){function i(t){var i=new a["default"](t);n.call(e,i)}return e.addEventListener?(e.addEventListener(t,i,!1),{remove:function(){e.removeEventListener(t,i,!1)}}):e.attachEvent?(e.attachEvent("on"+t,i),{remove:function(){e.detachEvent("on"+t,i)}}):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r;var o=n(123),a=i(o);e.exports=t["default"]},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var i=n(56);e.exports=function(e){return Object(i(e))}},function(e,t){var n=0,i=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+i).toString(36))}},function(e,t,n){"use strict";var i=n(256)(!0);n(95)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=i(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){"use strict";e.exports=n(345)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(354),s=i(a),l=n(357),u=i(l),c=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},d=o["default"].createClass({displayName:"DialogWrap",mixins:[(0,u["default"])({isVisible:function(e){return e.props.visible},autoDestroy:!1,getComponent:function(e,t){return o["default"].createElement(s["default"],c({},e.props,t,{key:"dialog"}))}})],getDefaultProps:function(){return{visible:!1}},shouldComponentUpdate:function(e){var t=e.visible;return!(!this.props.visible&&!t)},componentWillUnmount:function(){this.props.visible?this.renderComponent({afterClose:this.removeContainer,onClose:function(){},visible:!1}):this.removeContainer()},getElement:function(e){return this._component.getElement(e)},render:function(){return null}});t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){return"string"==typeof e}function o(e){return r(e.type)&&I(e.props.children)?b["default"].cloneElement(e,{},e.props.children.split("").join(" ")):r(e)?(I(e)&&(e=e.split("").join(" ")),b["default"].createElement("span",null,e)):e}Object.defineProperty(t,"__esModule",{value:!0});var a=n(7),s=i(a),l=n(6),u=i(l),c=n(14),d=i(c),f=n(2),p=i(f),h=n(4),m=i(h),y=n(3),v=i(y),g=n(1),b=i(g),M=n(5),T=i(M),x=n(10),C=i(x),_=n(13),w=i(_),S=n(15),N=i(S),E=n(31),P=i(E),D=/^[\u4e00-\u9fa5]{2}$/,I=D.test.bind(D),L=function(e){function t(){return(0,p["default"])(this,t),(0,m["default"])(this,e.apply(this,arguments))}return(0,v["default"])(t,e),t.prototype.render=function(){var e,t=(0,N["default"])(this.props,["children","className","prefixCls","type","size","inline","across","disabled","htmlType","icon","loading","touchFeedback","activeStyle"]),n=(0,d["default"])(t,2),i=n[0],r=i.children,a=i.className,l=i.prefixCls,c=i.type,f=i.size,p=i.inline,h=i.across,m=i.disabled,y=i.htmlType,v=i.icon,g=i.loading,M=i.touchFeedback,x=i.activeStyle,_=n[1],S=(e={},(0,u["default"])(e,a,a),(0,u["default"])(e,l,!0),(0,u["default"])(e,l+"-primary","primary"===c),(0,u["default"])(e,l+"-ghost","ghost"===c),(0,u["default"])(e,l+"-warning","warning"===c),(0,u["default"])(e,l+"-small","small"===f),(0,u["default"])(e,l+"-inline",p),(0,u["default"])(e,l+"-across",h),(0,u["default"])(e,l+"-disabled",m),(0,u["default"])(e,l+"-loading",g),e),E=(0,C["default"])({},this.props.style);M&&(E=(0,C["default"])(E,x),S[l+"-active"]=!0);var P=g?"loading":v,D=b["default"].Children.map(r,o);return P&&(S[l+"-icon"]=!0),b["default"].createElement("button",(0,s["default"])({},_,{style:E,type:y||"button",className:(0,T["default"])(S),disabled:m}),P?b["default"].createElement(w["default"],{type:P}):null,D)},t}(b["default"].Component);L.defaultProps={prefixCls:"am-button",size:"large",inline:!1,across:!1,disabled:!1,loading:!1},t["default"]=(0,P["default"])(L),e.exports=t["default"]},[452,284],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(2),o=i(r),a=n(4),s=i(a),l=n(3),u=i(l),c=n(1),d=i(c),f=n(108),p=i(f),h=function(e){function t(){return(0,o["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.render=function(){return d["default"].createElement(p["default"],this.props)},t}(d["default"].Component);t["default"]=h,h.defaultProps={prefixCls:"am-checkbox"},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(7),o=i(r),a=n(6),s=i(a),l=n(2),u=i(l),c=n(4),d=i(c),f=n(3),p=i(f),h=n(1),m=i(h),y=n(46),v=i(y),g=n(5),b=i(g),M=n(10),T=i(M),x=n(162),C=i(x),_=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.isInModal=function(e){var t=this.props.prefixCls,n=function(e){for(;e.parentNode&&e.parentNode!==document.body;){if(e.classList.contains(t))return e;e=e.parentNode}}(e.target);return n||e.preventDefault(),!0},t.prototype.render=function(){var e,t=this,n=this.props,i=n.prefixCls,r=n.className,a=n.transparent,l=n.animated,u=n.transitionName,c=n.maskTransitionName,d=n.style,f=n.footer,p=void 0===f?[]:f,h=(0,b["default"])((e={},(0,s["default"])(e,r,!!r),(0,s["default"])(e,i+"-transparent",a),e)),y=u||(l?a?"am-fade":"am-slide-up":null),g=c||(l?a?"am-fade":"am-slide-up":null),M=i+"-button-group-"+(2===p.length?"h":"v"),x=p.length?[m["default"].createElement("div",{key:"footer",className:M},p.map(function(e,t){return m["default"].createElement(C["default"],{prefixCls:i,button:e,key:t})}))]:null,_=a?(0,T["default"])({width:"5.4rem",height:"auto"},d):(0,T["default"])({width:"100%",height:"100%"},d),w=(0,T["default"])({},this.props);["prefixCls","className","transparent","animated","transitionName","maskTransitionName","style","footer","touchFeedback","wrapProps"].forEach(function(e){w.hasOwnProperty(e)&&delete w[e]});var S=new RegExp("\\biPhone\\b|\\biPod\\b","i").test(window.navigator.userAgent),N=S?{onTouchStart:function(e){return t.isInModal(e)}}:{};return m["default"].createElement(v["default"],(0,o["default"])({prefixCls:i,className:h,transitionName:y,maskTransitionName:g,style:_,footer:x,wrapProps:N},w))},t}(m["default"].Component);t["default"]=_,_.defaultProps={prefixCls:"am-modal",transparent:!1,animated:!0,style:{},onShow:function(){},footer:[]},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(7),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(108),m=i(h),y=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){return p["default"].createElement(m["default"],(0,o["default"])({},this.props,{type:"radio"}))},t}(p["default"].Component);t["default"]=y,y.defaultProps={prefixCls:"am-radio"},e.exports=t["default"]},function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var r=n(215),o=i(r);t["default"]=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return(0,o["default"])(e)}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var i=n(236);e.exports=function(e,t,n){if(i(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,i){return e.call(t,n,i)};case 3:return function(n,i,r){return e.call(t,n,i,r)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t){e.exports=!0},function(e,t,n){var i=n(21),r=n(251),o=n(57),a=n(62)("IE_PROTO"),s=function(){},l="prototype",u=function(){var e,t=n(92)("iframe"),i=o.length,r="<",a=">";for(t.style.display="none",n(241).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(r+"script"+a+"document.F=Object"+r+"/script"+a),e.close(),u=e.F;i--;)delete u[l][o[i]];return u()};e.exports=Object.create||function(e,t){var n;return null!==e?(s[l]=i(e),n=new s,s[l]=null,n[a]=e):n=u(),void 0===t?n:r(n,t)}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var i=n(19).f,r=n(23),o=n(12)("toStringTag");e.exports=function(e,t,n){e&&!r(e=n?e:e.prototype,o)&&i(e,o,{configurable:!0,value:t})}},function(e,t,n){var i=n(63)("keys"),r=n(43);e.exports=function(e){return i[e]||(i[e]=r(e))}},function(e,t,n){var i=n(18),r="__core-js_shared__",o=i[r]||(i[r]={});e.exports=function(e){return o[e]||(o[e]={})}},function(e,t){var n=Math.ceil,i=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?i:n)(e)}},function(e,t,n){var i=n(35);e.exports=function(e,t){if(!i(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!i(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!i(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!i(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var i=n(18),r=n(11),o=n(58),a=n(67),s=n(19).f;e.exports=function(e){var t=r.Symbol||(r.Symbol=o?{}:i.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:a.f(e)})}},function(e,t,n){t.f=n(12)},function(e,t,n){n(261);for(var i=n(18),r=n(28),o=n(29),a=n(12)("toStringTag"),s=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],l=0;l<5;l++){var u=s[l],c=i[u],d=c&&c.prototype;d&&!d[a]&&r(d,a,u),o[u]=o.Array}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=i(r),a=n(6),s=i(a),l=n(1),u=i(l),c=n(5),d=i(c),f=n(70),p=u["default"].createClass({displayName:"TabContent",propTypes:{animated:l.PropTypes.bool,prefixCls:l.PropTypes.string,children:l.PropTypes.any,activeKey:l.PropTypes.string,style:l.PropTypes.any,tabBarPosition:l.PropTypes.string},getDefaultProps:function(){return{animated:!0}},getTabPanes:function(){var e=this.props,t=e.activeKey,n=e.children,i=[];return u["default"].Children.forEach(n,function(n){if(n){var r=n.key,o=t===r;i.push(u["default"].cloneElement(n,{active:o,destroyInactiveTabPane:e.destroyInactiveTabPane,rootPrefixCls:e.prefixCls}))}}),i},render:function(){var e,t=this.props,n=t.prefixCls,i=t.children,r=t.activeKey,a=t.tabBarPosition,l=t.animated,c=t.style,p=(0,d["default"])((e={},(0,s["default"])(e,n+"-content",!0),(0,s["default"])(e,l?n+"-content-animated":n+"-content-no-animated",!0),e));if(l){var h=(0,f.getActiveIndex)(i,r);c=h!==-1?(0,o["default"])({},c,(0,f.getTransformPropValue)((0,f.getTransformByIndex)(h,a))):(0,o["default"])({},c,{display:"none"})}return u["default"].createElement("div",{className:p,style:c},this.getTabPanes())}});t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){if(Array.isArray(e))return e.filter(function(e){return!!e});var t=[];return h["default"].Children.forEach(e,function(e){e&&t.push(e)}),t}function o(e,t){var n=-1;return h["default"].Children.forEach(e,function(e,i){e.key===t&&(n=i)}),n}function a(e,t){var n=r(e);return n[t].key}function s(e,t){e.transform=t,e.webkitTransform=t,e.mozTransform=t}function l(e){return"transform"in e||"webkitTransform"in e||"MozTransform"in e}function u(e,t){e.transition=t,e.webkitTransition=t,e.MozTransition=t}function c(e){return{transform:e,WebkitTransform:e,MozTransform:e}}function d(e){return"left"===e||"right"===e}function f(e,t){var n=d(t)?"translateY":"translateX";return n+"("+100*-e+"%) translateZ(0)"}Object.defineProperty(t,"__esModule",{value:!0}),t.toArray=r,t.getActiveIndex=o,t.getActiveKey=a,t.setTransform=s,t.isTransformSupported=l,t.setTransition=u,t.getTransformPropValue=c,t.isVertical=d,t.getTransformByIndex=f;var p=n(1),h=i(p)},function(e,t,n){function i(e,t){t.hasOwnProperty("vertical")&&console.warn("vertical is deprecated, please use `direction` instead");var n=t.direction;(n||t.hasOwnProperty("vertical"))&&(direction=n?n:t.vertical?"DIRECTION_ALL":"DIRECTION_HORIZONTAL",e.get("pan").set({direction:a[direction]}),e.get("swipe").set({direction:a[direction]})),t.options&&Object.keys(t.options).forEach(function(n){if("recognizers"===n)Object.keys(t.options.recognizers).forEach(function(n){var i=e.get(n);i.set(t.options.recognizers[n])},this);else{var i=n,r={};r[i]=t.options[n],e.set(r)}},this),t.recognizeWith&&Object.keys(t.recognizeWith).forEach(function(n){var i=e.get(n);i.recognizeWith(t.recognizeWith[n])},this),Object.keys(t).forEach(function(n){var i=l[n];i&&(e.off(i),e.on(i,t[n]))})}var r=n(1),o=n(9),a="undefined"!=typeof window?n(329):void 0,s={children:!0,direction:!0,options:!0,recognizeWith:!0,vertical:!0},l={action:"tap press",onDoubleTap:"doubletap",onPan:"pan",onPanCancel:"pancancel",onPanEnd:"panend",onPanStart:"panstart",onPinch:"pinch",onPinchCancel:"pinchcancel",onPinchEnd:"pinchend",onPinchIn:"pinchin",onPinchOut:"pinchout",onPinchStart:"pinchstart",onPress:"press",onPressUp:"pressup",onRotate:"rotate",onRotateCancel:"rotatecancel",onRotateEnd:"rotateend",onRotateMove:"rotatemove",onRotateStart:"rotatestart",onSwipe:"swipe",onTap:"tap"};Object.keys(l).forEach(function(e){s[e]=!0});var u=r.createClass({displayName:"Hammer",propTypes:{className:r.PropTypes.string},componentDidMount:function(){this.hammer=new a(o.findDOMNode(this)),i(this.hammer,this.props)},componentDidUpdate:function(){this.hammer&&i(this.hammer,this.props)},componentWillUnmount:function(){this.hammer&&(this.hammer.stop(),this.hammer.destroy()),this.hammer=null},render:function(){var e={};return Object.keys(this.props).forEach(function(t){s[t]||(e[t]=this.props[t])},this),r.cloneElement(r.Children.only(this.props.children),e)}});e.exports=u},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(116),o=i(r),a=n(418),s=i(a),l=n(421),u=i(l);o["default"].IndexedList=s["default"],o["default"].RefreshControl=u["default"],t["default"]=o["default"],e.exports=t["default"]},function(e,t){"use strict";function n(e){var t=0;do isNaN(e.offsetTop)||(t+=e.offsetTop);while(e=e.offsetParent);return t}function i(e){return e.touches&&e.touches.length?e.touches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}function r(e,t){var n=!0;return function(i){n&&(n=!1,setTimeout(function(){n=!0},t),e(i))}}Object.defineProperty(t,"__esModule",{value:!0}),t.getOffsetTop=n,t._event=i,t.throttle=r},function(e,t){function n(e,t,n){n=n||{},n.childrenKeyName=n.childrenKeyName||"children";var i,r=e||[],o=[],a=0;do{var i=r.filter(function(e){return t(e,a)})[0];if(!i)break;o.push(i),r=i[n.childrenKeyName]||[],a+=1}while(r.length>0);return o}e.exports=n},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),
t.prototype.render=function(){var e,t,n=this.props,i=n.text,r=n.prefixCls,a=n.overflowCount,s=n.className,l=n.style,u=n.children,c=this.props.dot,d=this.props.size,f=this.props.corner;i=i>a?a+"+":i,c&&(i="");var h=!(i&&"0"!==i||c),y=(0,m["default"])((e={},(0,o["default"])(e,r+"-dot",c),(0,o["default"])(e,r+"-dot-large",c&&"large"===d),(0,o["default"])(e,r+"-text",!c&&!f),(0,o["default"])(e,r+"-corner",f),(0,o["default"])(e,r+"-corner-large",f&&"large"===d),e)),v=(0,m["default"])((t={},(0,o["default"])(t,s,!!s),(0,o["default"])(t,r,!0),(0,o["default"])(t,r+"-not-a-wrapper",!u),(0,o["default"])(t,r+"-corner-wrapper",f),(0,o["default"])(t,r+"-corner-wrapper-large",f&&"large"===d),t));return p["default"].createElement("span",{className:v,title:i},u,!h&&p["default"].createElement("sup",{className:y,style:l},i))},t}(p["default"].Component);t["default"]=y,y.defaultProps={prefixCls:"am-badge",text:null,dot:!1,corner:!1,overflowCount:99,size:null},e.exports=t["default"]},[451,283],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(7),o=i(r),a=n(6),s=i(a),l=n(2),u=i(l),c=n(4),d=i(c),f=n(3),p=i(f),h=n(1),m=i(h),y=n(5),v=i(y),g=n(336),b=i(g),M=n(10),T=i(M),x=function(e){function t(n){(0,u["default"])(this,t);var i=(0,d["default"])(this,e.call(this,n));return i.state={selectedIndex:i.props.selectedIndex},i.onChange=i.onChange.bind(i),i}return(0,p["default"])(t,e),t.prototype.onChange=function(e){this.setState({selectedIndex:e})},t.prototype.render=function(){var e=this.props,t=e.prefixCls,n=e.children,i=this.state.selectedIndex,r=void 0;if(!n)return null;var a=(0,T["default"])({},this.props);a.infinite&&(a.wrapAround=!0),a.selectedIndex&&(a.slideIndex=a.selectedIndex),a.beforeChange&&(a.beforeSlide=a.beforeChange),a.afterChange&&(a.afterSlide=a.afterChange),a.vertical&&(r=a.prefixCls+" "+a.prefixCls+"-vertical");var l=[];return a.dots&&(l=[{component:m["default"].createClass({displayName:"component",render:function(){var e=this,n=this.getIndexes(e.props.slideCount,e.props.slidesToScroll);return m["default"].createElement("div",{className:t+"-wrap"},n.map(function(e){var n,r=(0,v["default"])((n={},(0,s["default"])(n,t+"-wrap-dot",!0),(0,s["default"])(n,t+"-wrap-dot-active",e===i),n));return m["default"].createElement("div",{className:r,key:e},m["default"].createElement("span",null))}))},getIndexes:function(e,t){for(var n=[],i=0;i<e;i+=t)n.push(i);return n}}),position:"BottomCenter"}]),m["default"].createElement("div",{className:r},m["default"].createElement(b["default"],(0,o["default"])({},a,{decorators:l,afterSlide:this.onChange})))},t}(m["default"].Component);t["default"]=x,x.defaultProps={prefixCls:"am-carousel",dots:!0,arrows:!1,autoplay:!1,infinite:!1,edgeEasing:"linear",cellAlign:"center",selectedIndex:0},e.exports=t["default"]},[451,286],[453,287],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){var n=(0,c["default"])(e,["renderHeader","renderFooter","renderSectionHeader","renderRow"]),i=(0,a["default"])(n,2),r=i[0],o=r.renderHeader,s=r.renderFooter,u=r.renderSectionHeader,d=r.renderRow,f=i[1],h=e.listPrefixCls,m={renderHeader:null,renderFooter:null,renderSectionHeader:null,renderBodyComponent:function(){return l["default"].createElement("div",{className:h+"-body"})},renderRow:d};return o&&(m.renderHeader=function(){return l["default"].createElement("div",{className:h+"-header"},o())}),s&&(m.renderFooter=function(){return l["default"].createElement("div",{className:h+"-footer"},s())}),u&&(m.renderSectionHeader=t?function(e,t){return l["default"].createElement("div",null,l["default"].createElement(p,null,u(e,t)))}:function(e,t){return l["default"].createElement(p,null,u(e,t))}),{restProps:f,extraProps:m}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(14),a=i(o);t["default"]=r;var s=n(1),l=i(s),u=n(15),c=i(u),d=n(26),f=i(d),p=f["default"].Item;e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(50),o=i(r),a=n(163),s=i(a),l=n(164),u=i(l);o["default"].alert=s["default"],o["default"].prompt=u["default"],t["default"]=o["default"],e.exports=t["default"]},[451,297],[451,301],[453,305],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){return f=u["default"].newInstance({prefixCls:p,style:{top:0},transitionName:"am-fade"})}function o(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,i=arguments[3],o={info:"",success:"check-circle-o",fail:"cross-circle-o",offline:"frown",loading:"loading"}[t];"function"==typeof n&&(i=n,n=3);var a=r();a.notice({duration:n,style:{},content:o?s["default"].createElement("div",{className:p+"-text "+p+"-text-icon"},s["default"].createElement(d["default"],{type:o,size:"lg"}),s["default"].createElement("div",{className:p+"-text-info"},e)):s["default"].createElement("div",{className:p+"-text"},s["default"].createElement("div",null,e)),onClose:function(){i&&i(),a.destroy(),a=null,f=null}})}Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),s=i(a),l=n(367),u=i(l),c=n(13),d=i(c),f=void 0,p="am-toast";t["default"]={SHORT:3,LONG:8,show:function(e,t){return o(e,"info",t,function(){})},info:function(e,t,n){return o(e,"info",t,n)},success:function(e,t,n){return o(e,"success",t,n)},fail:function(e,t,n){return o(e,"fail",t,n)},offline:function(e,t,n){return o(e,"offline",t,n)},loading:function(e,t,n){return o(e,"loading",t,n)},hide:function(){f&&(f.destroy(),f=null)}},e.exports=t["default"]},[452,321],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(2),o=i(r),a=n(4),s=i(a),l=n(3),u=i(l),c=n(1),d=i(c),f=n(10),p=i(f),h=function(e){function t(){return(0,o["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.render=function(){var e=(0,p["default"])({},this.props);Array.isArray(e.style)&&!function(){var t={};e.style.forEach(function(e){(0,p["default"])(t,e)}),e.style=t}();var t=e.Component;return d["default"].createElement(t,e)},t}(d["default"].Component);t["default"]=h,h.defaultProps={Component:"div"},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,i=t.size,r=t.className,a=t.children,s=t.style,l=(0,m["default"])((e={},(0,o["default"])(e,""+n,!0),(0,o["default"])(e,n+"-"+i,!0),(0,o["default"])(e,r,!!r),e));return p["default"].createElement("div",{className:l,style:s},a)},t}(p["default"].Component);t["default"]=y,y.defaultProps={prefixCls:"am-wingblank",size:"lg"},e.exports=t["default"]},[451,323],function(e,t){e.exports=function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}},function(e,t,n){var i=n(54),r=n(12)("toStringTag"),o="Arguments"==i(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(n){}};e.exports=function(e){var t,n,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=a(t=Object(e),r))?n:o?i(t):"Object"==(s=i(t))&&"function"==typeof t.callee?"Arguments":s}},function(e,t,n){var i=n(35),r=n(18).document,o=i(r)&&i(r.createElement);e.exports=function(e){return o?r.createElement(e):{}}},function(e,t,n){e.exports=!n(22)&&!n(27)(function(){return 7!=Object.defineProperty(n(92)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var i=n(54);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==i(e)?e.split(""):Object(e)}},function(e,t,n){"use strict";var i=n(58),r=n(17),o=n(99),a=n(28),s=n(23),l=n(29),u=n(245),c=n(61),d=n(253),f=n(12)("iterator"),p=!([].keys&&"next"in[].keys()),h="@@iterator",m="keys",y="values",v=function(){return this};e.exports=function(e,t,n,g,b,M,T){u(n,t,g);var x,C,_,w=function(e){if(!p&&e in P)return P[e];switch(e){case m:return function(){return new n(this,e)};case y:return function(){return new n(this,e)}}return function(){return new n(this,e)}},S=t+" Iterator",N=b==y,E=!1,P=e.prototype,D=P[f]||P[h]||b&&P[b],I=D||w(b),L=b?N?w("entries"):I:void 0,j="Array"==t?P.entries||D:D;if(j&&(_=d(j.call(new e)),_!==Object.prototype&&(c(_,S,!0),i||s(_,f)||a(_,f,v))),N&&D&&D.name!==y&&(E=!0,I=function(){return D.call(this)}),i&&!T||!p&&!E&&P[f]||a(P,f,I),l[t]=I,l[S]=v,b)if(x={values:N?I:w(y),keys:M?I:w(m),entries:L},T)for(C in x)C in P||o(P,C,x[C]);else r(r.P+r.F*(p||E),t,x);return x}},function(e,t,n){var i=n(41),r=n(36),o=n(24),a=n(65),s=n(23),l=n(93),u=Object.getOwnPropertyDescriptor;t.f=n(22)?u:function(e,t){if(e=o(e),t=a(t,!0),l)try{return u(e,t)}catch(n){}if(s(e,t))return r(!i.f.call(e,t),e[t])}},function(e,t,n){var i=n(98),r=n(57).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return i(e,r)}},function(e,t,n){var i=n(23),r=n(24),o=n(238)(!1),a=n(62)("IE_PROTO");e.exports=function(e,t){var n,s=r(e),l=0,u=[];for(n in s)n!=a&&i(s,n)&&u.push(n);for(;t.length>l;)i(s,n=t[l++])&&(~o(u,n)||u.push(n));return u}},function(e,t,n){e.exports=n(28)},function(e,t,n){var i=n(64),r=Math.min;e.exports=function(e){return e>0?r(i(e),9007199254740991):0}},function(e,t,n){var i=n(91),r=n(12)("iterator"),o=n(29);e.exports=n(11).getIteratorMethod=function(e){if(void 0!=e)return e[r]||e["@@iterator"]||o[i(e)]}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){for(var n=window.getComputedStyle(e),i="",r=0;r<h.length&&!(i=n.getPropertyValue(h[r]+t));r++);return i}function o(e){if(f){var t=parseFloat(r(e,"transition-delay"))||0,n=parseFloat(r(e,"transition-duration"))||0,i=parseFloat(r(e,"animation-delay"))||0,o=parseFloat(r(e,"animation-duration"))||0,a=Math.max(n+t,o+i);e.rcEndAnimTimeout=setTimeout(function(){e.rcEndAnimTimeout=null,e.rcEndListener&&e.rcEndListener()},1e3*a+200)}}function a(e){e.rcEndAnimTimeout&&(clearTimeout(e.rcEndAnimTimeout),e.rcEndAnimTimeout=null)}Object.defineProperty(t,"__esModule",{value:!0});var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},l=n(271),u=i(l),c=n(225),d=i(c),f=0!==u["default"].endEvents.length,p=["Webkit","Moz","O","ms"],h=["-webkit-","-moz-","-o-","ms-",""],m=function(e,t,n){var i="object"===("undefined"==typeof t?"undefined":s(t)),r=i?t.name:t,l=i?t.active:t+"-active",c=n,f=void 0,p=void 0,h=(0,d["default"])(e);return n&&"[object Object]"===Object.prototype.toString.call(n)&&(c=n.end,f=n.start,p=n.active),e.rcEndListener&&e.rcEndListener(),e.rcEndListener=function(t){t&&t.target!==e||(e.rcAnimTimeout&&(clearTimeout(e.rcAnimTimeout),e.rcAnimTimeout=null),a(e),h.remove(r),h.remove(l),u["default"].removeEndEventListener(e,e.rcEndListener),e.rcEndListener=null,c&&c())},u["default"].addEndEventListener(e,e.rcEndListener),f&&f(),h.add(r),e.rcAnimTimeout=setTimeout(function(){e.rcAnimTimeout=null,h.add(l),p&&setTimeout(p,0),o(e)},30),{stop:function(){e.rcEndListener&&e.rcEndListener()}}};m.style=function(e,t,n){e.rcEndListener&&e.rcEndListener(),e.rcEndListener=function(t){t&&t.target!==e||(e.rcAnimTimeout&&(clearTimeout(e.rcAnimTimeout),e.rcAnimTimeout=null),a(e),u["default"].removeEndEventListener(e,e.rcEndListener),e.rcEndListener=null,n&&n())},u["default"].addEndEventListener(e,e.rcEndListener),e.rcAnimTimeout=setTimeout(function(){for(var n in t)t.hasOwnProperty(n)&&(e.style[n]=t[n]);e.rcAnimTimeout=null,o(e)},0)},m.setTransition=function(e,t,n){var i=t,r=n;void 0===n&&(r=i,i=""),i=i||"",p.forEach(function(t){e.style[t+"Transition"+i]=r})},m.isCssAnimationSupported=f,t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){var t=e.ownerDocument,n=t.body,i=void 0,r=a["default"].css(e,"position"),o="fixed"===r||"absolute"===r;if(!o)return"html"===e.nodeName.toLowerCase()?null:e.parentNode;for(i=e.parentNode;i&&i!==n;i=i.parentNode)if(r=a["default"].css(i,"position"),"static"!==r)return i;return null}Object.defineProperty(t,"__esModule",{value:!0});var o=n(37),a=i(o);t["default"]=r,e.exports=t["default"]},function(e,t,n){"use strict";function i(e,t,n,i,r,o,a,s){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,i,r,o,a,s],c=0;l=new Error(t.replace(/%s/g,function(){return u[c++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}e.exports=i},function(e,t,n){"use strict";var i=n(325),r=i;e.exports=r},function(e,t){!function(n,i){"object"==typeof t&&"undefined"!=typeof e?e.exports=i():"function"==typeof define&&define.amd?define(i):n.moment=i()}(this,function(){"use strict";function t(){return hi.apply(null,arguments)}function n(e){hi=e}function i(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function r(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function o(e){var t;for(t in e)return!1;return!0}function a(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function s(e,t){var n,i=[];for(n=0;n<e.length;++n)i.push(t(e[n],n));return i}function l(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function u(e,t){for(var n in t)l(t,n)&&(e[n]=t[n]);return l(t,"toString")&&(e.toString=t.toString),l(t,"valueOf")&&(e.valueOf=t.valueOf),e}function c(e,t,n,i){return vt(e,t,n,i,!0).utc()}function d(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}}function f(e){return null==e._pf&&(e._pf=d()),e._pf}function p(e){if(null==e._isValid){var t=f(e),n=mi.call(t.parsedDateParts,function(e){return null!=e}),i=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(i=i&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return i;e._isValid=i}return e._isValid}function h(e){var t=c(NaN);return null!=e?u(f(t),e):f(t).userInvalidated=!0,t}function m(e){return void 0===e}function y(e,t){var n,i,r;if(m(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),m(t._i)||(e._i=t._i),m(t._f)||(e._f=t._f),m(t._l)||(e._l=t._l),m(t._strict)||(e._strict=t._strict),m(t._tzm)||(e._tzm=t._tzm),m(t._isUTC)||(e._isUTC=t._isUTC),m(t._offset)||(e._offset=t._offset),m(t._pf)||(e._pf=f(t)),m(t._locale)||(e._locale=t._locale),yi.length>0)for(n in yi)i=yi[n],r=t[i],m(r)||(e[i]=r);return e}function v(e){y(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),vi===!1&&(vi=!0,t.updateOffset(this),vi=!1)}function g(e){return e instanceof v||null!=e&&null!=e._isAMomentObject}function b(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function M(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=b(t)),n}function T(e,t,n){var i,r=Math.min(e.length,t.length),o=Math.abs(e.length-t.length),a=0;for(i=0;i<r;i++)(n&&e[i]!==t[i]||!n&&M(e[i])!==M(t[i]))&&a++;return a+o}function x(e){t.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function C(e,n){var i=!0;return u(function(){if(null!=t.deprecationHandler&&t.deprecationHandler(null,e),i){for(var r,o=[],a=0;a<arguments.length;a++){if(r="","object"==typeof arguments[a]){r+="\n["+a+"] ";for(var s in arguments[0])r+=s+": "+arguments[0][s]+", ";r=r.slice(0,-2)}else r=arguments[a];o.push(r)}x(e+"\nArguments: "+Array.prototype.slice.call(o).join("")+"\n"+(new Error).stack),i=!1}return n.apply(this,arguments)},n)}function _(e,n){null!=t.deprecationHandler&&t.deprecationHandler(e,n),gi[e]||(x(n),gi[e]=!0)}function w(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function S(e){var t,n;for(n in e)t=e[n],w(t)?this[n]=t:this["_"+n]=t;this._config=e,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function N(e,t){var n,i=u({},e);for(n in t)l(t,n)&&(r(e[n])&&r(t[n])?(i[n]={},u(i[n],e[n]),u(i[n],t[n])):null!=t[n]?i[n]=t[n]:delete i[n]);for(n in e)l(e,n)&&!l(t,n)&&r(e[n])&&(i[n]=u({},i[n]));return i}function E(e){null!=e&&this.set(e)}function P(e,t,n){var i=this._calendar[e]||this._calendar.sameElse;return w(i)?i.call(t,n):i}function D(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])}function I(){return this._invalidDate}function L(e){return this._ordinal.replace("%d",e)}function j(e,t,n,i){var r=this._relativeTime[n];return w(r)?r(e,t,n,i):r.replace(/%d/i,e)}function k(e,t){var n=this._relativeTime[e>0?"future":"past"];return w(n)?n(t):n.replace(/%s/i,t)}function O(e,t){var n=e.toLowerCase();Ni[n]=Ni[n+"s"]=Ni[t]=e}function A(e){return"string"==typeof e?Ni[e]||Ni[e.toLowerCase()]:void 0}function z(e){var t,n,i={};for(n in e)l(e,n)&&(t=A(n),t&&(i[t]=e[n]));return i}function R(e,t){Ei[e]=t}function W(e){var t=[];for(var n in e)t.push({unit:n,priority:Ei[n]});return t.sort(function(e,t){return e.priority-t.priority}),t}function Y(e,n){return function(i){return null!=i?(B(this,e,i),t.updateOffset(this,n),this):H(this,e)}}function H(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function B(e,t,n){e.isValid()&&e._d["set"+(e._isUTC?"UTC":"")+t](n)}function U(e){return e=A(e),w(this[e])?this[e]():this}function F(e,t){if("object"==typeof e){e=z(e);for(var n=W(e),i=0;i<n.length;i++)this[n[i].unit](e[n[i].unit])}else if(e=A(e),w(this[e]))return this[e](t);return this}function V(e,t,n){var i=""+Math.abs(e),r=t-i.length,o=e>=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,r)).toString().substr(1)+i}function Q(e,t,n,i){var r=i;"string"==typeof i&&(r=function(){return this[i]()}),e&&(Li[e]=r),t&&(Li[t[0]]=function(){return V(r.apply(this,arguments),t[1],t[2])}),n&&(Li[n]=function(){return this.localeData().ordinal(r.apply(this,arguments),e)})}function G(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function Z(e){var t,n,i=e.match(Pi);for(t=0,n=i.length;t<n;t++)Li[i[t]]?i[t]=Li[i[t]]:i[t]=G(i[t]);return function(t){var r,o="";for(r=0;r<n;r++)o+=i[r]instanceof Function?i[r].call(t,e):i[r];return o}}function X(e,t){return e.isValid()?(t=J(t,e.localeData()),Ii[t]=Ii[t]||Z(t),Ii[t](e)):e.localeData().invalidDate()}function J(e,t){function n(e){return t.longDateFormat(e)||e}var i=5;for(Di.lastIndex=0;i>=0&&Di.test(e);)e=e.replace(Di,n),Di.lastIndex=0,i-=1;return e}function K(e,t,n){Ji[e]=w(t)?t:function(e,i){return e&&n?n:t}}function q(e,t){return l(Ji,e)?Ji[e](t._strict,t._locale):new RegExp($(e))}function $(e){return ee(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,i,r){return t||n||i||r}))}function ee(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function te(e,t){var n,i=t;for("string"==typeof e&&(e=[e]),"number"==typeof t&&(i=function(e,n){n[t]=M(e)}),n=0;n<e.length;n++)Ki[e[n]]=i}function ne(e,t){te(e,function(e,n,i,r){i._w=i._w||{},t(e,i._w,i,r)})}function ie(e,t,n){null!=t&&l(Ki,e)&&Ki[e](t,n._a,n,e)}function re(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}function oe(e,t){return e?i(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||sr).test(t)?"format":"standalone"][e.month()]:this._months}function ae(e,t){return e?i(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[sr.test(t)?"format":"standalone"][e.month()]:this._monthsShort}function se(e,t,n){var i,r,o,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],i=0;i<12;++i)o=c([2e3,i]),this._shortMonthsParse[i]=this.monthsShort(o,"").toLocaleLowerCase(),this._longMonthsParse[i]=this.months(o,"").toLocaleLowerCase();return n?"MMM"===t?(r=Mi.call(this._shortMonthsParse,a),r!==-1?r:null):(r=Mi.call(this._longMonthsParse,a),r!==-1?r:null):"MMM"===t?(r=Mi.call(this._shortMonthsParse,a),r!==-1?r:(r=Mi.call(this._longMonthsParse,a),r!==-1?r:null)):(r=Mi.call(this._longMonthsParse,a),r!==-1?r:(r=Mi.call(this._shortMonthsParse,a),r!==-1?r:null))}function le(e,t,n){var i,r,o;if(this._monthsParseExact)return se.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),i=0;i<12;i++){if(r=c([2e3,i]),n&&!this._longMonthsParse[i]&&(this._longMonthsParse[i]=new RegExp("^"+this.months(r,"").replace(".","")+"$","i"),this._shortMonthsParse[i]=new RegExp("^"+this.monthsShort(r,"").replace(".","")+"$","i")),n||this._monthsParse[i]||(o="^"+this.months(r,"")+"|^"+this.monthsShort(r,""),this._monthsParse[i]=new RegExp(o.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[i].test(e))return i;if(n&&"MMM"===t&&this._shortMonthsParse[i].test(e))return i;if(!n&&this._monthsParse[i].test(e))return i}}function ue(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=M(t);else if(t=e.localeData().monthsParse(t),"number"!=typeof t)return e;return n=Math.min(e.date(),re(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function ce(e){return null!=e?(ue(this,e),t.updateOffset(this,!0),this):H(this,"Month")}function de(){return re(this.year(),this.month())}function fe(e){return this._monthsParseExact?(l(this,"_monthsRegex")||he.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(l(this,"_monthsShortRegex")||(this._monthsShortRegex=cr),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)}function pe(e){return this._monthsParseExact?(l(this,"_monthsRegex")||he.call(this),e?this._monthsStrictRegex:this._monthsRegex):(l(this,"_monthsRegex")||(this._monthsRegex=dr),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)}function he(){function e(e,t){return t.length-e.length}var t,n,i=[],r=[],o=[];for(t=0;t<12;t++)n=c([2e3,t]),i.push(this.monthsShort(n,"")),r.push(this.months(n,"")),o.push(this.months(n,"")),o.push(this.monthsShort(n,""));for(i.sort(e),r.sort(e),o.sort(e),t=0;t<12;t++)i[t]=ee(i[t]),r[t]=ee(r[t]);for(t=0;t<24;t++)o[t]=ee(o[t]);this._monthsRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+i.join("|")+")","i")}function me(e){return ye(e)?366:365}function ye(e){return e%4===0&&e%100!==0||e%400===0}function ve(){return ye(this.year())}function ge(e,t,n,i,r,o,a){var s=new Date(e,t,n,i,r,o,a);return e<100&&e>=0&&isFinite(s.getFullYear())&&s.setFullYear(e),s}function be(e){var t=new Date(Date.UTC.apply(null,arguments));return e<100&&e>=0&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function Me(e,t,n){var i=7+t-n,r=(7+be(e,0,i).getUTCDay()-t)%7;return-r+i-1}function Te(e,t,n,i,r){var o,a,s=(7+n-i)%7,l=Me(e,i,r),u=1+7*(t-1)+s+l;return u<=0?(o=e-1,a=me(o)+u):u>me(e)?(o=e+1,a=u-me(e)):(o=e,a=u),{year:o,dayOfYear:a}}function xe(e,t,n){var i,r,o=Me(e.year(),t,n),a=Math.floor((e.dayOfYear()-o-1)/7)+1;return a<1?(r=e.year()-1,i=a+Ce(r,t,n)):a>Ce(e.year(),t,n)?(i=a-Ce(e.year(),t,n),r=e.year()+1):(r=e.year(),i=a),{week:i,year:r}}function Ce(e,t,n){var i=Me(e,t,n),r=Me(e+1,t,n);return(me(e)-i+r)/7}function _e(e){return xe(e,this._week.dow,this._week.doy).week}function we(){return this._week.dow}function Se(){return this._week.doy}function Ne(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")}function Ee(e){var t=xe(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")}function Pe(e,t){return"string"!=typeof e?e:isNaN(e)?(e=t.weekdaysParse(e),"number"==typeof e?e:null):parseInt(e,10)}function De(e,t){return"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Ie(e,t){return e?i(this._weekdays)?this._weekdays[e.day()]:this._weekdays[this._weekdays.isFormat.test(t)?"format":"standalone"][e.day()]:this._weekdays}function Le(e){return e?this._weekdaysShort[e.day()]:this._weekdaysShort}function je(e){return e?this._weekdaysMin[e.day()]:this._weekdaysMin}function ke(e,t,n){var i,r,o,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],i=0;i<7;++i)o=c([2e3,1]).day(i),this._minWeekdaysParse[i]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[i]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[i]=this.weekdays(o,"").toLocaleLowerCase();return n?"dddd"===t?(r=Mi.call(this._weekdaysParse,a),r!==-1?r:null):"ddd"===t?(r=Mi.call(this._shortWeekdaysParse,a),r!==-1?r:null):(r=Mi.call(this._minWeekdaysParse,a),r!==-1?r:null):"dddd"===t?(r=Mi.call(this._weekdaysParse,a),r!==-1?r:(r=Mi.call(this._shortWeekdaysParse,a),r!==-1?r:(r=Mi.call(this._minWeekdaysParse,a),r!==-1?r:null))):"ddd"===t?(r=Mi.call(this._shortWeekdaysParse,a),r!==-1?r:(r=Mi.call(this._weekdaysParse,a),r!==-1?r:(r=Mi.call(this._minWeekdaysParse,a),r!==-1?r:null))):(r=Mi.call(this._minWeekdaysParse,a),r!==-1?r:(r=Mi.call(this._weekdaysParse,a),r!==-1?r:(r=Mi.call(this._shortWeekdaysParse,a),r!==-1?r:null)))}function Oe(e,t,n){var i,r,o;if(this._weekdaysParseExact)return ke.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),i=0;i<7;i++){if(r=c([2e3,1]).day(i),n&&!this._fullWeekdaysParse[i]&&(this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(r,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(r,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(r,"").replace(".",".?")+"$","i")),this._weekdaysParse[i]||(o="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,""),this._weekdaysParse[i]=new RegExp(o.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[i].test(e))return i;if(n&&"ddd"===t&&this._shortWeekdaysParse[i].test(e))return i;if(n&&"dd"===t&&this._minWeekdaysParse[i].test(e))return i;if(!n&&this._weekdaysParse[i].test(e))return i}}function Ae(e){if(!this.isValid())return null!=e?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=Pe(e,this.localeData()),this.add(e-t,"d")):t}function ze(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")}function Re(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=De(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7}function We(e){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Be.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(l(this,"_weekdaysRegex")||(this._weekdaysRegex=vr),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function Ye(e){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Be.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(l(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=gr),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function He(e){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Be.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(l(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=br),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Be(){function e(e,t){return t.length-e.length}var t,n,i,r,o,a=[],s=[],l=[],u=[];for(t=0;t<7;t++)n=c([2e3,1]).day(t),i=this.weekdaysMin(n,""),r=this.weekdaysShort(n,""),o=this.weekdays(n,""),a.push(i),s.push(r),l.push(o),u.push(i),u.push(r),u.push(o);for(a.sort(e),s.sort(e),l.sort(e),u.sort(e),t=0;t<7;t++)s[t]=ee(s[t]),l[t]=ee(l[t]),u[t]=ee(u[t]);this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Ue(){return this.hours()%12||12}function Fe(){return this.hours()||24}function Ve(e,t){Q(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function Qe(e,t){return t._meridiemParse}function Ge(e){return"p"===(e+"").toLowerCase().charAt(0)}function Ze(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"}function Xe(e){return e?e.toLowerCase().replace("_","-"):e}function Je(e){for(var t,n,i,r,o=0;o<e.length;){for(r=Xe(e[o]).split("-"),t=r.length,n=Xe(e[o+1]),n=n?n.split("-"):null;t>0;){if(i=Ke(r.slice(0,t).join("-")))return i;if(n&&n.length>=t&&T(r,n,!0)>=t-1)break;t--}o++}return null}function Ke(t){var n=null;if(!_r[t]&&"undefined"!=typeof e&&e&&e.exports)try{n=Mr._abbr,require("./locale/"+t),qe(n)}catch(i){}return _r[t]}function qe(e,t){var n;return e&&(n=m(t)?tt(e):$e(e,t),n&&(Mr=n)),Mr._abbr}function $e(e,t){if(null!==t){var n=Cr;return t.abbr=e,null!=_r[e]?(_("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."),n=_r[e]._config):null!=t.parentLocale&&(null!=_r[t.parentLocale]?n=_r[t.parentLocale]._config:_("parentLocaleUndefined","specified parentLocale is not defined yet. See http://momentjs.com/guides/#/warnings/parent-locale/")),_r[e]=new E(N(n,t)),qe(e),_r[e]}return delete _r[e],null}function et(e,t){if(null!=t){var n,i=Cr;null!=_r[e]&&(i=_r[e]._config),t=N(i,t),n=new E(t),n.parentLocale=_r[e],_r[e]=n,qe(e)}else null!=_r[e]&&(null!=_r[e].parentLocale?_r[e]=_r[e].parentLocale:null!=_r[e]&&delete _r[e]);return _r[e]}function tt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return Mr;if(!i(e)){if(t=Ke(e))return t;e=[e]}return Je(e)}function nt(){return bi(_r)}function it(e){var t,n=e._a;return n&&f(e).overflow===-2&&(t=n[$i]<0||n[$i]>11?$i:n[er]<1||n[er]>re(n[qi],n[$i])?er:n[tr]<0||n[tr]>24||24===n[tr]&&(0!==n[nr]||0!==n[ir]||0!==n[rr])?tr:n[nr]<0||n[nr]>59?nr:n[ir]<0||n[ir]>59?ir:n[rr]<0||n[rr]>999?rr:-1,f(e)._overflowDayOfYear&&(t<qi||t>er)&&(t=er),f(e)._overflowWeeks&&t===-1&&(t=or),f(e)._overflowWeekday&&t===-1&&(t=ar),f(e).overflow=t),e}function rt(e){var t,n,i,r,o,a,s=e._i,l=wr.exec(s)||Sr.exec(s);if(l){for(f(e).iso=!0,t=0,n=Er.length;t<n;t++)if(Er[t][1].exec(l[1])){r=Er[t][0],i=Er[t][2]!==!1;break}if(null==r)return void(e._isValid=!1);if(l[3]){for(t=0,n=Pr.length;t<n;t++)if(Pr[t][1].exec(l[3])){o=(l[2]||" ")+Pr[t][0];break}if(null==o)return void(e._isValid=!1)}if(!i&&null!=o)return void(e._isValid=!1);if(l[4]){if(!Nr.exec(l[4]))return void(e._isValid=!1);a="Z"}e._f=r+(o||"")+(a||""),ct(e)}else e._isValid=!1}function ot(e){var n=Dr.exec(e._i);return null!==n?void(e._d=new Date((+n[1]))):(rt(e),void(e._isValid===!1&&(delete e._isValid,t.createFromInputFallback(e))))}function at(e,t,n){return null!=e?e:null!=t?t:n}function st(e){var n=new Date(t.now());return e._useUTC?[n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()]:[n.getFullYear(),n.getMonth(),n.getDate()]}function lt(e){var t,n,i,r,o=[];if(!e._d){for(i=st(e),e._w&&null==e._a[er]&&null==e._a[$i]&&ut(e),e._dayOfYear&&(r=at(e._a[qi],i[qi]),e._dayOfYear>me(r)&&(f(e)._overflowDayOfYear=!0),n=be(r,0,e._dayOfYear),e._a[$i]=n.getUTCMonth(),e._a[er]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=o[t]=i[t];for(;t<7;t++)e._a[t]=o[t]=null==e._a[t]?2===t?1:0:e._a[t];
24===e._a[tr]&&0===e._a[nr]&&0===e._a[ir]&&0===e._a[rr]&&(e._nextDay=!0,e._a[tr]=0),e._d=(e._useUTC?be:ge).apply(null,o),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[tr]=24)}}function ut(e){var t,n,i,r,o,a,s,l;t=e._w,null!=t.GG||null!=t.W||null!=t.E?(o=1,a=4,n=at(t.GG,e._a[qi],xe(gt(),1,4).year),i=at(t.W,1),r=at(t.E,1),(r<1||r>7)&&(l=!0)):(o=e._locale._week.dow,a=e._locale._week.doy,n=at(t.gg,e._a[qi],xe(gt(),o,a).year),i=at(t.w,1),null!=t.d?(r=t.d,(r<0||r>6)&&(l=!0)):null!=t.e?(r=t.e+o,(t.e<0||t.e>6)&&(l=!0)):r=o),i<1||i>Ce(n,o,a)?f(e)._overflowWeeks=!0:null!=l?f(e)._overflowWeekday=!0:(s=Te(n,i,r,o,a),e._a[qi]=s.year,e._dayOfYear=s.dayOfYear)}function ct(e){if(e._f===t.ISO_8601)return void rt(e);e._a=[],f(e).empty=!0;var n,i,r,o,a,s=""+e._i,l=s.length,u=0;for(r=J(e._f,e._locale).match(Pi)||[],n=0;n<r.length;n++)o=r[n],i=(s.match(q(o,e))||[])[0],i&&(a=s.substr(0,s.indexOf(i)),a.length>0&&f(e).unusedInput.push(a),s=s.slice(s.indexOf(i)+i.length),u+=i.length),Li[o]?(i?f(e).empty=!1:f(e).unusedTokens.push(o),ie(o,i,e)):e._strict&&!i&&f(e).unusedTokens.push(o);f(e).charsLeftOver=l-u,s.length>0&&f(e).unusedInput.push(s),e._a[tr]<=12&&f(e).bigHour===!0&&e._a[tr]>0&&(f(e).bigHour=void 0),f(e).parsedDateParts=e._a.slice(0),f(e).meridiem=e._meridiem,e._a[tr]=dt(e._locale,e._a[tr],e._meridiem),lt(e),it(e)}function dt(e,t,n){var i;return null==n?t:null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?(i=e.isPM(n),i&&t<12&&(t+=12),i||12!==t||(t=0),t):t}function ft(e){var t,n,i,r,o;if(0===e._f.length)return f(e).invalidFormat=!0,void(e._d=new Date(NaN));for(r=0;r<e._f.length;r++)o=0,t=y({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[r],ct(t),p(t)&&(o+=f(t).charsLeftOver,o+=10*f(t).unusedTokens.length,f(t).score=o,(null==i||o<i)&&(i=o,n=t));u(e,n||t)}function pt(e){if(!e._d){var t=z(e._i);e._a=s([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),lt(e)}}function ht(e){var t=new v(it(mt(e)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function mt(e){var t=e._i,n=e._f;return e._locale=e._locale||tt(e._l),null===t||void 0===n&&""===t?h({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),g(t)?new v(it(t)):(i(n)?ft(e):a(t)?e._d=t:n?ct(e):yt(e),p(e)||(e._d=null),e))}function yt(e){var n=e._i;void 0===n?e._d=new Date(t.now()):a(n)?e._d=new Date(n.valueOf()):"string"==typeof n?ot(e):i(n)?(e._a=s(n.slice(0),function(e){return parseInt(e,10)}),lt(e)):"object"==typeof n?pt(e):"number"==typeof n?e._d=new Date(n):t.createFromInputFallback(e)}function vt(e,t,n,a,s){var l={};return"boolean"==typeof n&&(a=n,n=void 0),(r(e)&&o(e)||i(e)&&0===e.length)&&(e=void 0),l._isAMomentObject=!0,l._useUTC=l._isUTC=s,l._l=n,l._i=e,l._f=t,l._strict=a,ht(l)}function gt(e,t,n,i){return vt(e,t,n,i,!1)}function bt(e,t){var n,r;if(1===t.length&&i(t[0])&&(t=t[0]),!t.length)return gt();for(n=t[0],r=1;r<t.length;++r)t[r].isValid()&&!t[r][e](n)||(n=t[r]);return n}function Mt(){var e=[].slice.call(arguments,0);return bt("isBefore",e)}function Tt(){var e=[].slice.call(arguments,0);return bt("isAfter",e)}function xt(e){var t=z(e),n=t.year||0,i=t.quarter||0,r=t.month||0,o=t.week||0,a=t.day||0,s=t.hour||0,l=t.minute||0,u=t.second||0,c=t.millisecond||0;this._milliseconds=+c+1e3*u+6e4*l+1e3*s*60*60,this._days=+a+7*o,this._months=+r+3*i+12*n,this._data={},this._locale=tt(),this._bubble()}function Ct(e){return e instanceof xt}function _t(e){return e<0?Math.round(-1*e)*-1:Math.round(e)}function wt(e,t){Q(e,0,0,function(){var e=this.utcOffset(),n="+";return e<0&&(e=-e,n="-"),n+V(~~(e/60),2)+t+V(~~e%60,2)})}function St(e,t){var n=(t||"").match(e)||[],i=n[n.length-1]||[],r=(i+"").match(kr)||["-",0,0],o=+(60*r[1])+M(r[2]);return"+"===r[0]?o:-o}function Nt(e,n){var i,r;return n._isUTC?(i=n.clone(),r=(g(e)||a(e)?e.valueOf():gt(e).valueOf())-i.valueOf(),i._d.setTime(i._d.valueOf()+r),t.updateOffset(i,!1),i):gt(e).local()}function Et(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Pt(e,n){var i,r=this._offset||0;return this.isValid()?null!=e?("string"==typeof e?e=St(Gi,e):Math.abs(e)<16&&(e=60*e),!this._isUTC&&n&&(i=Et(this)),this._offset=e,this._isUTC=!0,null!=i&&this.add(i,"m"),r!==e&&(!n||this._changeInProgress?Vt(this,Yt(e-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?r:Et(this):null!=e?this:NaN}function Dt(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}function It(e){return this.utcOffset(0,e)}function Lt(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Et(this),"m")),this}function jt(){if(this._tzm)this.utcOffset(this._tzm);else if("string"==typeof this._i){var e=St(Qi,this._i);0===e?this.utcOffset(0,!0):this.utcOffset(St(Qi,this._i))}return this}function kt(e){return!!this.isValid()&&(e=e?gt(e).utcOffset():0,(this.utcOffset()-e)%60===0)}function Ot(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function At(){if(!m(this._isDSTShifted))return this._isDSTShifted;var e={};if(y(e,this),e=mt(e),e._a){var t=e._isUTC?c(e._a):gt(e._a);this._isDSTShifted=this.isValid()&&T(e._a,t.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function zt(){return!!this.isValid()&&!this._isUTC}function Rt(){return!!this.isValid()&&this._isUTC}function Wt(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Yt(e,t){var n,i,r,o=e,a=null;return Ct(e)?o={ms:e._milliseconds,d:e._days,M:e._months}:"number"==typeof e?(o={},t?o[t]=e:o.milliseconds=e):(a=Or.exec(e))?(n="-"===a[1]?-1:1,o={y:0,d:M(a[er])*n,h:M(a[tr])*n,m:M(a[nr])*n,s:M(a[ir])*n,ms:M(_t(1e3*a[rr]))*n}):(a=Ar.exec(e))?(n="-"===a[1]?-1:1,o={y:Ht(a[2],n),M:Ht(a[3],n),w:Ht(a[4],n),d:Ht(a[5],n),h:Ht(a[6],n),m:Ht(a[7],n),s:Ht(a[8],n)}):null==o?o={}:"object"==typeof o&&("from"in o||"to"in o)&&(r=Ut(gt(o.from),gt(o.to)),o={},o.ms=r.milliseconds,o.M=r.months),i=new xt(o),Ct(e)&&l(e,"_locale")&&(i._locale=e._locale),i}function Ht(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function Bt(e,t){var n={milliseconds:0,months:0};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function Ut(e,t){var n;return e.isValid()&&t.isValid()?(t=Nt(t,e),e.isBefore(t)?n=Bt(e,t):(n=Bt(t,e),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function Ft(e,t){return function(n,i){var r,o;return null===i||isNaN(+i)||(_(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=n,n=i,i=o),n="string"==typeof n?+n:n,r=Yt(n,i),Vt(this,r,e),this}}function Vt(e,n,i,r){var o=n._milliseconds,a=_t(n._days),s=_t(n._months);e.isValid()&&(r=null==r||r,o&&e._d.setTime(e._d.valueOf()+o*i),a&&B(e,"Date",H(e,"Date")+a*i),s&&ue(e,H(e,"Month")+s*i),r&&t.updateOffset(e,a||s))}function Qt(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function Gt(e,n){var i=e||gt(),r=Nt(i,this).startOf("day"),o=t.calendarFormat(this,r)||"sameElse",a=n&&(w(n[o])?n[o].call(this,i):n[o]);return this.format(a||this.localeData().calendar(o,this,gt(i)))}function Zt(){return new v(this)}function Xt(e,t){var n=g(e)?e:gt(e);return!(!this.isValid()||!n.isValid())&&(t=A(m(t)?"millisecond":t),"millisecond"===t?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())}function Jt(e,t){var n=g(e)?e:gt(e);return!(!this.isValid()||!n.isValid())&&(t=A(m(t)?"millisecond":t),"millisecond"===t?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())}function Kt(e,t,n,i){return i=i||"()",("("===i[0]?this.isAfter(e,n):!this.isBefore(e,n))&&(")"===i[1]?this.isBefore(t,n):!this.isAfter(t,n))}function qt(e,t){var n,i=g(e)?e:gt(e);return!(!this.isValid()||!i.isValid())&&(t=A(t||"millisecond"),"millisecond"===t?this.valueOf()===i.valueOf():(n=i.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))}function $t(e,t){return this.isSame(e,t)||this.isAfter(e,t)}function en(e,t){return this.isSame(e,t)||this.isBefore(e,t)}function tn(e,t,n){var i,r,o,a;return this.isValid()?(i=Nt(e,this),i.isValid()?(r=6e4*(i.utcOffset()-this.utcOffset()),t=A(t),"year"===t||"month"===t||"quarter"===t?(a=nn(this,i),"quarter"===t?a/=3:"year"===t&&(a/=12)):(o=this-i,a="second"===t?o/1e3:"minute"===t?o/6e4:"hour"===t?o/36e5:"day"===t?(o-r)/864e5:"week"===t?(o-r)/6048e5:o),n?a:b(a)):NaN):NaN}function nn(e,t){var n,i,r=12*(t.year()-e.year())+(t.month()-e.month()),o=e.clone().add(r,"months");return t-o<0?(n=e.clone().add(r-1,"months"),i=(t-o)/(o-n)):(n=e.clone().add(r+1,"months"),i=(t-o)/(n-o)),-(r+i)||0}function rn(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function on(){var e=this.clone().utc();return 0<e.year()&&e.year()<=9999?w(Date.prototype.toISOString)?this.toDate().toISOString():X(e,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):X(e,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function an(e){e||(e=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var n=X(this,e);return this.localeData().postformat(n)}function sn(e,t){return this.isValid()&&(g(e)&&e.isValid()||gt(e).isValid())?Yt({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function ln(e){return this.from(gt(),e)}function un(e,t){return this.isValid()&&(g(e)&&e.isValid()||gt(e).isValid())?Yt({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function cn(e){return this.to(gt(),e)}function dn(e){var t;return void 0===e?this._locale._abbr:(t=tt(e),null!=t&&(this._locale=t),this)}function fn(){return this._locale}function pn(e){switch(e=A(e)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===e&&this.weekday(0),"isoWeek"===e&&this.isoWeekday(1),"quarter"===e&&this.month(3*Math.floor(this.month()/3)),this}function hn(e){return e=A(e),void 0===e||"millisecond"===e?this:("date"===e&&(e="day"),this.startOf(e).add(1,"isoWeek"===e?"week":e).subtract(1,"ms"))}function mn(){return this._d.valueOf()-6e4*(this._offset||0)}function yn(){return Math.floor(this.valueOf()/1e3)}function vn(){return new Date(this.valueOf())}function gn(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function bn(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function Mn(){return this.isValid()?this.toISOString():null}function Tn(){return p(this)}function xn(){return u({},f(this))}function Cn(){return f(this).overflow}function _n(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function wn(e,t){Q(0,[e,e.length],0,t)}function Sn(e){return Dn.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Nn(e){return Dn.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)}function En(){return Ce(this.year(),1,4)}function Pn(){var e=this.localeData()._week;return Ce(this.year(),e.dow,e.doy)}function Dn(e,t,n,i,r){var o;return null==e?xe(this,i,r).year:(o=Ce(e,i,r),t>o&&(t=o),In.call(this,e,t,n,i,r))}function In(e,t,n,i,r){var o=Te(e,t,n,i,r),a=be(o.year,0,o.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}function Ln(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)}function jn(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")}function kn(e,t){t[rr]=M(1e3*("0."+e))}function On(){return this._isUTC?"UTC":""}function An(){return this._isUTC?"Coordinated Universal Time":""}function zn(e){return gt(1e3*e)}function Rn(){return gt.apply(null,arguments).parseZone()}function Wn(e){return e}function Yn(e,t,n,i){var r=tt(),o=c().set(i,t);return r[n](o,e)}function Hn(e,t,n){if("number"==typeof e&&(t=e,e=void 0),e=e||"",null!=t)return Yn(e,t,n,"month");var i,r=[];for(i=0;i<12;i++)r[i]=Yn(e,i,n,"month");return r}function Bn(e,t,n,i){"boolean"==typeof e?("number"==typeof t&&(n=t,t=void 0),t=t||""):(t=e,n=t,e=!1,"number"==typeof t&&(n=t,t=void 0),t=t||"");var r=tt(),o=e?r._week.dow:0;if(null!=n)return Yn(t,(n+o)%7,i,"day");var a,s=[];for(a=0;a<7;a++)s[a]=Yn(t,(a+o)%7,i,"day");return s}function Un(e,t){return Hn(e,t,"months")}function Fn(e,t){return Hn(e,t,"monthsShort")}function Vn(e,t,n){return Bn(e,t,n,"weekdays")}function Qn(e,t,n){return Bn(e,t,n,"weekdaysShort")}function Gn(e,t,n){return Bn(e,t,n,"weekdaysMin")}function Zn(){var e=this._data;return this._milliseconds=Zr(this._milliseconds),this._days=Zr(this._days),this._months=Zr(this._months),e.milliseconds=Zr(e.milliseconds),e.seconds=Zr(e.seconds),e.minutes=Zr(e.minutes),e.hours=Zr(e.hours),e.months=Zr(e.months),e.years=Zr(e.years),this}function Xn(e,t,n,i){var r=Yt(t,n);return e._milliseconds+=i*r._milliseconds,e._days+=i*r._days,e._months+=i*r._months,e._bubble()}function Jn(e,t){return Xn(this,e,t,1)}function Kn(e,t){return Xn(this,e,t,-1)}function qn(e){return e<0?Math.floor(e):Math.ceil(e)}function $n(){var e,t,n,i,r,o=this._milliseconds,a=this._days,s=this._months,l=this._data;return o>=0&&a>=0&&s>=0||o<=0&&a<=0&&s<=0||(o+=864e5*qn(ti(s)+a),a=0,s=0),l.milliseconds=o%1e3,e=b(o/1e3),l.seconds=e%60,t=b(e/60),l.minutes=t%60,n=b(t/60),l.hours=n%24,a+=b(n/24),r=b(ei(a)),s+=r,a-=qn(ti(r)),i=b(s/12),s%=12,l.days=a,l.months=s,l.years=i,this}function ei(e){return 4800*e/146097}function ti(e){return 146097*e/4800}function ni(e){var t,n,i=this._milliseconds;if(e=A(e),"month"===e||"year"===e)return t=this._days+i/864e5,n=this._months+ei(t),"month"===e?n:n/12;switch(t=this._days+Math.round(ti(this._months)),e){case"week":return t/7+i/6048e5;case"day":return t+i/864e5;case"hour":return 24*t+i/36e5;case"minute":return 1440*t+i/6e4;case"second":return 86400*t+i/1e3;case"millisecond":return Math.floor(864e5*t)+i;default:throw new Error("Unknown unit "+e)}}function ii(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*M(this._months/12)}function ri(e){return function(){return this.as(e)}}function oi(e){return e=A(e),this[e+"s"]()}function ai(e){return function(){return this._data[e]}}function si(){return b(this.days()/7)}function li(e,t,n,i,r){return r.relativeTime(t||1,!!n,e,i)}function ui(e,t,n){var i=Yt(e).abs(),r=co(i.as("s")),o=co(i.as("m")),a=co(i.as("h")),s=co(i.as("d")),l=co(i.as("M")),u=co(i.as("y")),c=r<fo.s&&["s",r]||o<=1&&["m"]||o<fo.m&&["mm",o]||a<=1&&["h"]||a<fo.h&&["hh",a]||s<=1&&["d"]||s<fo.d&&["dd",s]||l<=1&&["M"]||l<fo.M&&["MM",l]||u<=1&&["y"]||["yy",u];return c[2]=t,c[3]=+e>0,c[4]=n,li.apply(null,c)}function ci(e){return void 0===e?co:"function"==typeof e&&(co=e,!0)}function di(e,t){return void 0!==fo[e]&&(void 0===t?fo[e]:(fo[e]=t,!0))}function fi(e){var t=this.localeData(),n=ui(this,!e,t);return e&&(n=t.pastFuture(+this,n)),t.postformat(n)}function pi(){var e,t,n,i=po(this._milliseconds)/1e3,r=po(this._days),o=po(this._months);e=b(i/60),t=b(e/60),i%=60,e%=60,n=b(o/12),o%=12;var a=n,s=o,l=r,u=t,c=e,d=i,f=this.asSeconds();return f?(f<0?"-":"")+"P"+(a?a+"Y":"")+(s?s+"M":"")+(l?l+"D":"")+(u||c||d?"T":"")+(u?u+"H":"")+(c?c+"M":"")+(d?d+"S":""):"P0D"}var hi,mi;mi=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,i=0;i<n;i++)if(i in t&&e.call(this,t[i],i,t))return!0;return!1};var yi=t.momentProperties=[],vi=!1,gi={};t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;var bi;bi=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)l(e,t)&&n.push(t);return n};var Mi,Ti={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},xi={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"},Ci="Invalid date",_i="%d",wi=/\d{1,2}/,Si={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Ni={},Ei={},Pi=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Di=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ii={},Li={},ji=/\d/,ki=/\d\d/,Oi=/\d{3}/,Ai=/\d{4}/,zi=/[+-]?\d{6}/,Ri=/\d\d?/,Wi=/\d\d\d\d?/,Yi=/\d\d\d\d\d\d?/,Hi=/\d{1,3}/,Bi=/\d{1,4}/,Ui=/[+-]?\d{1,6}/,Fi=/\d+/,Vi=/[+-]?\d+/,Qi=/Z|[+-]\d\d:?\d\d/gi,Gi=/Z|[+-]\d\d(?::?\d\d)?/gi,Zi=/[+-]?\d+(\.\d{1,3})?/,Xi=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Ji={},Ki={},qi=0,$i=1,er=2,tr=3,nr=4,ir=5,rr=6,or=7,ar=8;Mi=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},Q("M",["MM",2],"Mo",function(){return this.month()+1}),Q("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),Q("MMMM",0,0,function(e){return this.localeData().months(this,e)}),O("month","M"),R("month",8),K("M",Ri),K("MM",Ri,ki),K("MMM",function(e,t){return t.monthsShortRegex(e)}),K("MMMM",function(e,t){return t.monthsRegex(e)}),te(["M","MM"],function(e,t){t[$i]=M(e)-1}),te(["MMM","MMMM"],function(e,t,n,i){var r=n._locale.monthsParse(e,i,n._strict);null!=r?t[$i]=r:f(n).invalidMonth=e});var sr=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,lr="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ur="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),cr=Xi,dr=Xi;Q("Y",0,0,function(){var e=this.year();return e<=9999?""+e:"+"+e}),Q(0,["YY",2],0,function(){return this.year()%100}),Q(0,["YYYY",4],0,"year"),Q(0,["YYYYY",5],0,"year"),Q(0,["YYYYYY",6,!0],0,"year"),O("year","y"),R("year",1),K("Y",Vi),K("YY",Ri,ki),K("YYYY",Bi,Ai),K("YYYYY",Ui,zi),K("YYYYYY",Ui,zi),te(["YYYYY","YYYYYY"],qi),te("YYYY",function(e,n){n[qi]=2===e.length?t.parseTwoDigitYear(e):M(e)}),te("YY",function(e,n){n[qi]=t.parseTwoDigitYear(e)}),te("Y",function(e,t){t[qi]=parseInt(e,10)}),t.parseTwoDigitYear=function(e){return M(e)+(M(e)>68?1900:2e3)};var fr=Y("FullYear",!0);Q("w",["ww",2],"wo","week"),Q("W",["WW",2],"Wo","isoWeek"),O("week","w"),O("isoWeek","W"),R("week",5),R("isoWeek",5),K("w",Ri),K("ww",Ri,ki),K("W",Ri),K("WW",Ri,ki),ne(["w","ww","W","WW"],function(e,t,n,i){t[i.substr(0,1)]=M(e)});var pr={dow:0,doy:6};Q("d",0,"do","day"),Q("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),Q("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),Q("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),Q("e",0,0,"weekday"),Q("E",0,0,"isoWeekday"),O("day","d"),O("weekday","e"),O("isoWeekday","E"),R("day",11),R("weekday",11),R("isoWeekday",11),K("d",Ri),K("e",Ri),K("E",Ri),K("dd",function(e,t){return t.weekdaysMinRegex(e)}),K("ddd",function(e,t){return t.weekdaysShortRegex(e)}),K("dddd",function(e,t){return t.weekdaysRegex(e)}),ne(["dd","ddd","dddd"],function(e,t,n,i){var r=n._locale.weekdaysParse(e,i,n._strict);null!=r?t.d=r:f(n).invalidWeekday=e}),ne(["d","e","E"],function(e,t,n,i){t[i]=M(e)});var hr="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),mr="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),yr="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),vr=Xi,gr=Xi,br=Xi;Q("H",["HH",2],0,"hour"),Q("h",["hh",2],0,Ue),Q("k",["kk",2],0,Fe),Q("hmm",0,0,function(){return""+Ue.apply(this)+V(this.minutes(),2)}),Q("hmmss",0,0,function(){return""+Ue.apply(this)+V(this.minutes(),2)+V(this.seconds(),2)}),Q("Hmm",0,0,function(){return""+this.hours()+V(this.minutes(),2)}),Q("Hmmss",0,0,function(){return""+this.hours()+V(this.minutes(),2)+V(this.seconds(),2)}),Ve("a",!0),Ve("A",!1),O("hour","h"),R("hour",13),K("a",Qe),K("A",Qe),K("H",Ri),K("h",Ri),K("HH",Ri,ki),K("hh",Ri,ki),K("hmm",Wi),K("hmmss",Yi),K("Hmm",Wi),K("Hmmss",Yi),te(["H","HH"],tr),te(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),te(["h","hh"],function(e,t,n){t[tr]=M(e),f(n).bigHour=!0}),te("hmm",function(e,t,n){var i=e.length-2;t[tr]=M(e.substr(0,i)),t[nr]=M(e.substr(i)),f(n).bigHour=!0}),te("hmmss",function(e,t,n){var i=e.length-4,r=e.length-2;t[tr]=M(e.substr(0,i)),t[nr]=M(e.substr(i,2)),t[ir]=M(e.substr(r)),f(n).bigHour=!0}),te("Hmm",function(e,t,n){var i=e.length-2;t[tr]=M(e.substr(0,i)),t[nr]=M(e.substr(i))}),te("Hmmss",function(e,t,n){var i=e.length-4,r=e.length-2;t[tr]=M(e.substr(0,i)),t[nr]=M(e.substr(i,2)),t[ir]=M(e.substr(r))});var Mr,Tr=/[ap]\.?m?\.?/i,xr=Y("Hours",!0),Cr={calendar:Ti,longDateFormat:xi,invalidDate:Ci,ordinal:_i,ordinalParse:wi,relativeTime:Si,months:lr,monthsShort:ur,week:pr,weekdays:hr,weekdaysMin:yr,weekdaysShort:mr,meridiemParse:Tr},_r={},wr=/^\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)?)?/,Sr=/^\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)?)?/,Nr=/Z|[+-]\d\d(?::?\d\d)?/,Er=[["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/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Pr=[["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/]],Dr=/^\/?Date\((\-?\d+)/i;t.createFromInputFallback=C("value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),t.ISO_8601=function(){};var Ir=C("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=gt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:h()}),Lr=C("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=gt.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:h()}),jr=function(){return Date.now?Date.now():+new Date};wt("Z",":"),wt("ZZ",""),K("Z",Gi),K("ZZ",Gi),te(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=St(Gi,e)});var kr=/([\+\-]|\d\d)/gi;t.updateOffset=function(){};var Or=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Ar=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Yt.fn=xt.prototype;var zr=Ft(1,"add"),Rr=Ft(-1,"subtract");t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Wr=C("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});Q(0,["gg",2],0,function(){return this.weekYear()%100}),Q(0,["GG",2],0,function(){return this.isoWeekYear()%100}),wn("gggg","weekYear"),wn("ggggg","weekYear"),wn("GGGG","isoWeekYear"),wn("GGGGG","isoWeekYear"),O("weekYear","gg"),O("isoWeekYear","GG"),R("weekYear",1),R("isoWeekYear",1),K("G",Vi),K("g",Vi),K("GG",Ri,ki),K("gg",Ri,ki),K("GGGG",Bi,Ai),K("gggg",Bi,Ai),K("GGGGG",Ui,zi),K("ggggg",Ui,zi),ne(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,i){t[i.substr(0,2)]=M(e)}),ne(["gg","GG"],function(e,n,i,r){n[r]=t.parseTwoDigitYear(e)}),Q("Q",0,"Qo","quarter"),O("quarter","Q"),R("quarter",7),K("Q",ji),te("Q",function(e,t){t[$i]=3*(M(e)-1)}),Q("D",["DD",2],"Do","date"),O("date","D"),R("date",9),K("D",Ri),K("DD",Ri,ki),K("Do",function(e,t){return e?t._ordinalParse:t._ordinalParseLenient}),te(["D","DD"],er),te("Do",function(e,t){t[er]=M(e.match(Ri)[0],10)});var Yr=Y("Date",!0);Q("DDD",["DDDD",3],"DDDo","dayOfYear"),O("dayOfYear","DDD"),R("dayOfYear",4),K("DDD",Hi),K("DDDD",Oi),te(["DDD","DDDD"],function(e,t,n){n._dayOfYear=M(e)}),Q("m",["mm",2],0,"minute"),O("minute","m"),R("minute",14),K("m",Ri),K("mm",Ri,ki),te(["m","mm"],nr);var Hr=Y("Minutes",!1);Q("s",["ss",2],0,"second"),O("second","s"),R("second",15),K("s",Ri),K("ss",Ri,ki),te(["s","ss"],ir);var Br=Y("Seconds",!1);Q("S",0,0,function(){return~~(this.millisecond()/100)}),Q(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Q(0,["SSS",3],0,"millisecond"),Q(0,["SSSS",4],0,function(){return 10*this.millisecond()}),Q(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),Q(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),Q(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),Q(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),Q(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),O("millisecond","ms"),R("millisecond",16),K("S",Hi,ji),K("SS",Hi,ki),K("SSS",Hi,Oi);var Ur;for(Ur="SSSS";Ur.length<=9;Ur+="S")K(Ur,Fi);for(Ur="S";Ur.length<=9;Ur+="S")te(Ur,kn);var Fr=Y("Milliseconds",!1);Q("z",0,0,"zoneAbbr"),Q("zz",0,0,"zoneName");var Vr=v.prototype;Vr.add=zr,Vr.calendar=Gt,Vr.clone=Zt,Vr.diff=tn,Vr.endOf=hn,Vr.format=an,Vr.from=sn,Vr.fromNow=ln,Vr.to=un,Vr.toNow=cn,Vr.get=U,Vr.invalidAt=Cn,Vr.isAfter=Xt,Vr.isBefore=Jt,Vr.isBetween=Kt,Vr.isSame=qt,Vr.isSameOrAfter=$t,Vr.isSameOrBefore=en,Vr.isValid=Tn,Vr.lang=Wr,Vr.locale=dn,Vr.localeData=fn,Vr.max=Lr,Vr.min=Ir,Vr.parsingFlags=xn,Vr.set=F,Vr.startOf=pn,Vr.subtract=Rr,Vr.toArray=gn,Vr.toObject=bn,Vr.toDate=vn,Vr.toISOString=on,Vr.toJSON=Mn,Vr.toString=rn,Vr.unix=yn,Vr.valueOf=mn,Vr.creationData=_n,Vr.year=fr,Vr.isLeapYear=ve,Vr.weekYear=Sn,Vr.isoWeekYear=Nn,Vr.quarter=Vr.quarters=Ln,Vr.month=ce,Vr.daysInMonth=de,Vr.week=Vr.weeks=Ne,Vr.isoWeek=Vr.isoWeeks=Ee,Vr.weeksInYear=Pn,Vr.isoWeeksInYear=En,Vr.date=Yr,Vr.day=Vr.days=Ae,Vr.weekday=ze,Vr.isoWeekday=Re,Vr.dayOfYear=jn,Vr.hour=Vr.hours=xr,Vr.minute=Vr.minutes=Hr,Vr.second=Vr.seconds=Br,Vr.millisecond=Vr.milliseconds=Fr,Vr.utcOffset=Pt,Vr.utc=It,Vr.local=Lt,Vr.parseZone=jt,Vr.hasAlignedHourOffset=kt,Vr.isDST=Ot,Vr.isLocal=zt,Vr.isUtcOffset=Rt,Vr.isUtc=Wt,Vr.isUTC=Wt,Vr.zoneAbbr=On,Vr.zoneName=An,Vr.dates=C("dates accessor is deprecated. Use date instead.",Yr),Vr.months=C("months accessor is deprecated. Use month instead",ce),Vr.years=C("years accessor is deprecated. Use year instead",fr),Vr.zone=C("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Dt),Vr.isDSTShifted=C("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",At);var Qr=Vr,Gr=E.prototype;Gr.calendar=P,Gr.longDateFormat=D,Gr.invalidDate=I,Gr.ordinal=L,Gr.preparse=Wn,Gr.postformat=Wn,Gr.relativeTime=j,Gr.pastFuture=k,Gr.set=S,Gr.months=oe,Gr.monthsShort=ae,Gr.monthsParse=le,Gr.monthsRegex=pe,Gr.monthsShortRegex=fe,Gr.week=_e,Gr.firstDayOfYear=Se,Gr.firstDayOfWeek=we,Gr.weekdays=Ie,Gr.weekdaysMin=je,Gr.weekdaysShort=Le,Gr.weekdaysParse=Oe,Gr.weekdaysRegex=We,Gr.weekdaysShortRegex=Ye,Gr.weekdaysMinRegex=He,Gr.isPM=Ge,Gr.meridiem=Ze,qe("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,n=1===M(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+n}}),t.lang=C("moment.lang is deprecated. Use moment.locale instead.",qe),t.langData=C("moment.langData is deprecated. Use moment.localeData instead.",tt);var Zr=Math.abs,Xr=ri("ms"),Jr=ri("s"),Kr=ri("m"),qr=ri("h"),$r=ri("d"),eo=ri("w"),to=ri("M"),no=ri("y"),io=ai("milliseconds"),ro=ai("seconds"),oo=ai("minutes"),ao=ai("hours"),so=ai("days"),lo=ai("months"),uo=ai("years"),co=Math.round,fo={s:45,m:45,h:22,d:26,M:11},po=Math.abs,ho=xt.prototype;ho.abs=Zn,ho.add=Jn,ho.subtract=Kn,ho.as=ni,ho.asMilliseconds=Xr,ho.asSeconds=Jr,ho.asMinutes=Kr,ho.asHours=qr,ho.asDays=$r,ho.asWeeks=eo,ho.asMonths=to,ho.asYears=no,ho.valueOf=ii,ho._bubble=$n,ho.get=oi,ho.milliseconds=io,ho.seconds=ro,ho.minutes=oo,ho.hours=ao,ho.days=so,ho.weeks=si,ho.months=lo,ho.years=uo,ho.humanize=fi,ho.toISOString=pi,ho.toString=pi,ho.toJSON=pi,ho.locale=dn,ho.localeData=fn,ho.toIsoString=C("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",pi),ho.lang=Wr,Q("X",0,0,"unix"),Q("x",0,0,"valueOf"),K("x",Vi),K("X",Zi),te("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),te("x",function(e,t,n){n._d=new Date(M(e))}),t.version="2.15.2",n(gt),t.fn=Qr,t.min=Mt,t.max=Tt,t.now=jr,t.utc=c,t.unix=zn,t.months=Un,t.isDate=a,t.locale=qe,t.invalid=h,t.duration=Yt,t.isMoment=g,t.weekdays=Vn,t.parseZone=Rn,t.localeData=tt,t.isDuration=Ct,t.monthsShort=Fn,t.weekdaysMin=Gn,t.defineLocale=$e,t.updateLocale=et,t.locales=nt,t.weekdaysShort=Qn,t.normalizeUnits=A,t.relativeTimeRounding=ci,t.relativeTimeThreshold=di,t.calendarFormat=Qt,t.prototype=Qr;var mo=t;return mo})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={isAppearSupported:function(e){return e.transitionName&&e.transitionAppear||e.animation.appear},isEnterSupported:function(e){return e.transitionName&&e.transitionEnter||e.animation.enter},isLeaveSupported:function(e){return e.transitionName&&e.transitionLeave||e.animation.leave},allowAppearCallback:function(e){return e.transitionAppear||e.animation.appear},allowEnterCallback:function(e){return e.transitionEnter||e.animation.enter},allowLeaveCallback:function(e){return e.transitionLeave||e.animation.leave}};t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";e.exports=n(348)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(39),s=i(a),l=o["default"].createClass({displayName:"ExpandIcon",propTypes:{record:r.PropTypes.object,prefixCls:r.PropTypes.string,expandable:r.PropTypes.any,expanded:r.PropTypes.bool,needIndentSpaced:r.PropTypes.bool,onExpand:r.PropTypes.func},shouldComponentUpdate:function(e){return!(0,s["default"])(e,this.props)},render:function(){var e=this.props,t=e.expandable,n=e.prefixCls,i=e.onExpand,r=e.needIndentSpaced,a=e.expanded,s=e.record;if(t){var l=a?"expanded":"collapsed";return o["default"].createElement("span",{className:n+"-expand-icon "+n+"-"+l,onClick:function(e){return i(!a,s,e)}})}return r?o["default"].createElement("span",{className:n+"-expand-icon "+n+"-spaced"}):null}});t["default"]=l,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=i(r),a=n(7),s=i(a),l=n(1),u=i(l),c=n(5),d=i(c),f={"float":"right"};t["default"]={getDefaultProps:function(){return{styles:{}}},onTabClick:function(e){this.props.onTabClick(e)},getTabs:function(){var e=this,t=this.props,n=t.panels,i=t.activeKey,r=[],o=t.prefixCls;return u["default"].Children.forEach(n,function(t){if(t){var n=t.key,a=i===n?o+"-tab-active":"";a+=" "+o+"-tab";var l={};t.props.disabled?a+=" "+o+"-tab-disabled":l={onClick:e.onTabClick.bind(e,n)};var c={};i===n&&(c.ref="activeTab"),r.push(u["default"].createElement("div",(0,s["default"])({role:"tab","aria-disabled":t.props.disabled?"true":"false","aria-selected":i===n?"true":"false"},l,{className:a,key:n},c),t.props.tab))}}),r},getRootNode:function(e){var t,n=this.props,i=n.prefixCls,r=n.onKeyDown,a=n.className,s=n.extraContent,l=n.style,c=(0,
d["default"])((t={},(0,o["default"])(t,i+"-bar",1),(0,o["default"])(t,a,!!a),t));return u["default"].createElement("div",{role:"tablist",className:c,tabIndex:"0",ref:"root",onKeyDown:r,style:l},s?u["default"].createElement("div",{style:f,key:"extra"},s):null,e)}},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=i(r),a=n(1),s=i(a),l=n(5),u=i(l),c=s["default"].createClass({displayName:"TabPane",propTypes:{className:a.PropTypes.string,active:a.PropTypes.bool,style:a.PropTypes.any,destroyInactiveTabPane:a.PropTypes.bool,forceRender:a.PropTypes.bool,placeholder:a.PropTypes.node},getDefaultProps:function(){return{placeholder:null}},render:function(){var e,t=this.props,n=t.className,i=t.destroyInactiveTabPane,r=t.active,a=t.forceRender;this._isActived=this._isActived||r;var l=t.rootPrefixCls+"-tabpane",c=(0,u["default"])((e={},(0,o["default"])(e,l,1),(0,o["default"])(e,l+"-inactive",!r),(0,o["default"])(e,l+"-active",r),(0,o["default"])(e,n,n),e)),d=i?r:this._isActived;return s["default"].createElement("div",{style:t.style,role:"tabpanel","aria-hidden":t.active?"false":"true",className:c},d||a?t.children:t.placeholder)}});t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.TabPane=t["default"]=void 0;var r=n(393),o=i(r),a=n(111),s=i(a);t["default"]=o["default"],t.TabPane=s["default"]},function(e,t,n){"use strict";e.exports=n(394)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(52),o=i(r),a=n(1),s=i(a),l=s["default"].createClass({displayName:"LazyRenderBox",propTypes:{children:a.PropTypes.any,className:a.PropTypes.string,visible:a.PropTypes.bool,hiddenClassName:a.PropTypes.string},shouldComponentUpdate:function(e){return e.hiddenClassName||e.visible},render:function(){var e=this.props,t=e.hiddenClassName,n=e.visible,i=(0,o["default"])(e,["hiddenClassName","visible"]);return t||s["default"].Children.count(i.children)>1?(!n&&t&&(i.className+=" "+t),s["default"].createElement("div",i)):s["default"].Children.only(i.children)}});t["default"]=l,e.exports=t["default"]},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function r(e){n(this,r);var t=[];e=e||{},this.subscribe=function(e){t.push(e)},this.unsubscribe=function(e){var n=t.indexOf(e);n!==-1&&t.splice(n,1)},this.update=function(n){n&&n(e),t.forEach(function(t){return t(e)})}};t["default"]=i,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=i(r),a=n(52),s=i(a),l=n(2),u=i(l),c=n(4),d=i(c),f=n(3),p=i(f),h=n(1),m=i(h),y=n(9),v=i(y),g=n(419),b=i(g),M=n(423),T=i(M),x=n(422),C=i(x),_=n(424),w=i(_),S=n(409),N=i(S),E=n(10),P=i(E),D=n(405),I=i(D),L=n(124),j=i(L),k=n(407),O=n(73),A=n(420),z=i(A),R=1,W=10,Y=1e3,H=1e3,B=50,U="listviewscroll",F=function(e){function t(){var n,i,r;(0,u["default"])(this,t);for(var o=arguments.length,a=Array(o),s=0;s<o;s++)a[s]=arguments[s];return n=i=(0,d["default"])(this,e.call.apply(e,[this].concat(a))),i.state={curRenderedRowsCount:i.props.initialListSize,highlightedRow:{}},i.stickyRefs={},r=n,(0,d["default"])(i,r)}return(0,p["default"])(t,e),t.prototype.getMetrics=function(){return{contentLength:this.scrollProperties.contentLength,totalRows:this.props.dataSource.getRowCount(),renderedRows:this.state.curRenderedRowsCount,visibleRows:Object.keys(this._visibleRows).length}},t.prototype.getScrollResponder=function(){return this.refs[U]&&this.refs[U].getScrollResponder&&this.refs[U].getScrollResponder()},t.prototype.scrollTo=function(){var e;this.refs[U]&&this.refs[U].scrollTo&&(e=this.refs[U]).scrollTo.apply(e,arguments)},t.prototype.setNativeProps=function(e){this.refs[U]&&this.refs[U].setNativeProps(e)},t.prototype.getInnerViewNode=function(){return this.refs[U].getInnerViewNode()},t.prototype.componentWillMount=function(){this.scrollProperties={visibleLength:null,contentLength:null,offset:0},this._childFrames=[],this._visibleRows={},this._prevRenderedRowsCount=0,this._sentEndForContentLength=null},t.prototype.componentDidMount=function(){(this.props.stickyHeader||this.props.useBodyScroll)&&(this.__onScroll=(0,O.throttle)(this._onScroll,this.props.scrollEventThrottle),window.addEventListener("scroll",this.__onScroll))},t.prototype.componentWillReceiveProps=function(e){var t=this;this.props.dataSource===e.dataSource&&this.props.initialListSize===e.initialListSize||this.setState(function(e,n){return t._prevRenderedRowsCount=0,{curRenderedRowsCount:Math.min(Math.max(e.curRenderedRowsCount,n.initialListSize),n.dataSource.getRowCount())}},function(){return t._renderMoreRowsIfNeeded()})},t.prototype.componentWillUnmount=function(){(this.props.stickyHeader||this.props.useBodyScroll)&&window.removeEventListener("scroll",this.__onScroll)},t.prototype.onRowHighlighted=function(e,t){this.setState({highlightedRow:{sectionID:e,rowID:t}})},t.prototype.render=function(){var e=this,t=[],n=this.props.dataSource,i=n.rowIdentities,r=0,a=[],l=this.props.renderHeader&&this.props.renderHeader(),u=this.props.renderFooter&&this.props.renderFooter(),c=l?1:0,d=function(s){var l=n.sectionIdentities[s],u=i[s];if(0===u.length)return"continue";if(e.props.renderSectionHeader){var d=r>=e._prevRenderedRowsCount&&n.sectionHeaderShouldUpdate(s),f=m["default"].createElement(w["default"],{key:"s_"+l,shouldUpdate:!!d,render:e.props.renderSectionHeader.bind(null,n.getSectionHeaderData(s),l)});e.props.stickyHeader&&(f=m["default"].createElement(k.Sticky,(0,o["default"])({},e.props.stickyProps,{key:"s_"+l,ref:function(t){e.stickyRefs[l]=t}}),f)),t.push(f),a.push(c++)}for(var p=[],h=0;h<u.length;h++){var y=u[h],v=l+"_"+y,g=r>=e._prevRenderedRowsCount&&n.rowShouldUpdate(s,h),b=m["default"].createElement(w["default"],{key:"r_"+v,shouldUpdate:!!g,render:e.props.renderRow.bind(null,n.getRowData(s,h),l,y,e.onRowHighlighted)});if(p.push(b),c++,e.props.renderSeparator&&(h!==u.length-1||s===i.length-1)){var M=e.state.highlightedRow.sectionID===l&&(e.state.highlightedRow.rowID===y||e.state.highlightedRow.rowID===u[h+1]),T=e.props.renderSeparator(l,y,M);T&&(p.push(T),c++)}if(++r===e.state.curRenderedRowsCount)break}return t.push(m["default"].cloneElement(e.props.renderSectionBodyWrapper(l),{className:e.props.sectionBodyClassName},p)),r>=e.state.curRenderedRowsCount?"break":void 0};e:for(var f=0;f<i.length;f++){var p=d(f);switch(p){case"continue":continue;case"break":break e}}var h=this.props,y=h.renderScrollComponent,v=(0,s["default"])(h,["renderScrollComponent"]);return t=m["default"].cloneElement(v.renderBodyComponent(),{},t),v.stickyHeader&&(t=m["default"].createElement(k.StickyContainer,v.stickyContainerProps,t)),(0,P["default"])(v,{onScroll:this._onScroll}),(v.stickyHeader||v.useBodyScroll)&&delete v.onScroll,this._sc=m["default"].cloneElement(y(v),{ref:U,onContentSizeChange:this._onContentSizeChange,onLayout:v.stickyHeader||v.useBodyScroll?function(t){e.props.onLayout&&e.props.onLayout(t)}:this._onLayout},l,t,u,v.children),this._sc},t.prototype._measureAndUpdateScrollProps=function(){var e=this.getScrollResponder();!e||!e.getInnerViewNode},t.prototype._onContentSizeChange=function(e,t){var n=this.props.horizontal?e:t;n!==this.scrollProperties.contentLength&&(this.scrollProperties.contentLength=n,this._updateVisibleRows(),this._renderMoreRowsIfNeeded()),this.props.onContentSizeChange&&this.props.onContentSizeChange(e,t)},t.prototype._onLayout=function(e){var t=e.nativeEvent.layout,n=t.width,i=t.height,r=this.props.horizontal?n:i;r!==this.scrollProperties.visibleLength&&(this.scrollProperties.visibleLength=r,this._updateVisibleRows(),this._renderMoreRowsIfNeeded()),this.props.onLayout&&this.props.onLayout(e)},t.prototype._maybeCallOnEndReached=function(e){return!!(this.props.onEndReached&&this._getDistanceFromEnd(this.scrollProperties)<this.props.onEndReachedThreshold&&this.state.curRenderedRowsCount===this.props.dataSource.getRowCount())&&(this._sentEndForContentLength=this.scrollProperties.contentLength,this.props.onEndReached(e),!0)},t.prototype._renderMoreRowsIfNeeded=function(){if(null===this.scrollProperties.contentLength||null===this.scrollProperties.visibleLength||this.state.curRenderedRowsCount===this.props.dataSource.getRowCount())return void this._maybeCallOnEndReached();var e=this._getDistanceFromEnd(this.scrollProperties);e<this.props.scrollRenderAheadDistance&&this._pageInNewRows()},t.prototype._pageInNewRows=function(){var e=this;this.setState(function(t,n){var i=Math.min(t.curRenderedRowsCount+n.pageSize,n.dataSource.getRowCount());return e._prevRenderedRowsCount=t.curRenderedRowsCount,{curRenderedRowsCount:i}},function(){e._measureAndUpdateScrollProps(),e._prevRenderedRowsCount=e.state.curRenderedRowsCount})},t.prototype._getDistanceFromEnd=function(e){return e.contentLength-e.visibleLength-e.offset},t.prototype._updateVisibleRows=function(e){},t.prototype._onScroll=function(e){var t=!this.props.horizontal,n=e,i=v["default"].findDOMNode(this.refs[U]);if(this.props.stickyHeader||this.props.useBodyScroll)this.scrollProperties.visibleLength=window[t?"innerHeight":"innerWidth"],this.scrollProperties.contentLength=i[t?"scrollHeight":"scrollWidth"],this.scrollProperties.offset=window.document.body[t?"scrollTop":"scrollLeft"];else if(this.props.useZscroller){var r=this.refs[U].domScroller;n=r,this.scrollProperties.visibleLength=r.container[t?"clientHeight":"clientWidth"],this.scrollProperties.contentLength=r.content[t?"offsetHeight":"offsetWidth"],this.scrollProperties.offset=r.scroller.getValues()[t?"top":"left"]}else this.scrollProperties.visibleLength=i[t?"offsetHeight":"offsetWidth"],this.scrollProperties.contentLength=i[t?"scrollHeight":"scrollWidth"],this.scrollProperties.offset=i[t?"scrollTop":"scrollLeft"];this._maybeCallOnEndReached(n)||this._renderMoreRowsIfNeeded(),this.props.onEndReached&&this._getDistanceFromEnd(this.scrollProperties)>this.props.onEndReachedThreshold&&(this._sentEndForContentLength=null),this.props.onScroll&&this.props.onScroll(n)},t}(m["default"].Component);F.DataSource=b["default"],F.propTypes=(0,o["default"])({},T["default"].propTypes,{dataSource:h.PropTypes.instanceOf(b["default"]).isRequired,renderSeparator:h.PropTypes.func,renderRow:h.PropTypes.func.isRequired,initialListSize:h.PropTypes.number,onEndReached:h.PropTypes.func,onEndReachedThreshold:h.PropTypes.number,pageSize:h.PropTypes.number,renderFooter:h.PropTypes.func,renderHeader:h.PropTypes.func,renderSectionHeader:h.PropTypes.func,renderScrollComponent:m["default"].PropTypes.func.isRequired,scrollRenderAheadDistance:m["default"].PropTypes.number,onChangeVisibleRows:m["default"].PropTypes.func,scrollEventThrottle:m["default"].PropTypes.number,renderBodyComponent:h.PropTypes.func,renderSectionBodyWrapper:h.PropTypes.func,sectionBodyClassName:h.PropTypes.string,useZscroller:h.PropTypes.bool,useBodyScroll:h.PropTypes.bool,stickyHeader:h.PropTypes.bool,stickyProps:h.PropTypes.object,stickyContainerProps:h.PropTypes.object}),F.defaultProps={initialListSize:W,pageSize:R,renderScrollComponent:function(e){return m["default"].createElement(T["default"],e)},renderBodyComponent:function(){return m["default"].createElement("div",null)},renderSectionBodyWrapper:function(e){return m["default"].createElement("div",{key:e})},sectionBodyClassName:"list-view-section-body",scrollRenderAheadDistance:Y,onEndReachedThreshold:H,scrollEventThrottle:B,stickyProps:{},stickyContainerProps:{}},(0,I["default"])(F.prototype,C["default"].Mixin),(0,I["default"])(F.prototype,N["default"]),(0,I["default"])(F.prototype,z["default"]),(0,j["default"])(F),F.isReactNativeComponent=!0,t["default"]=F,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),a=r(o),s=n(1),l=i(s),u=n(5),c=r(u),d=n(427),f=r(d),p=n(119),h=r(p),m=l.createClass({displayName:"Picker",getDefaultProps:function(){return{prefixCls:"rmc-picker",pure:!0,onValueChange:function(){}}},getInitialState:function(){var e=void 0,t=this.props,n=t.selectedValue,i=t.defaultSelectedValue,r=t.children;return void 0!==n?e=n:void 0!==i?e=i:r.length&&(e=r[0].value),{selectedValue:e}},componentDidMount:function(){this.itemHeight=this.refs.indicator.offsetHeight,this.refs.content.style.padding=3*this.itemHeight+"px 0",this.zscroller=new h["default"](this.refs.content,{scrollingX:!1,snapping:!0,penetrationDeceleration:.1,minVelocityToKeepDecelerating:.5,scrollingComplete:this.scrollingComplete}),this.zscroller.setDisabled(this.props.disabled),this.zscroller.scroller.setSnapSize(0,this.itemHeight),this.select(this.state.selectedValue)},componentWillReceiveProps:function(e){"selectedValue"in e&&this.setState({selectedValue:e.selectedValue}),this.zscroller.setDisabled(e.disabled)},shouldComponentUpdate:function(e,t){return this.state.selectedValue!==t.selectedValue||!(0,f["default"])(this.props.children,e.children,this.props.pure)},componentDidUpdate:function(){this.zscroller.reflow(),this.select(this.state.selectedValue)},componentWillUnmount:function(){this.zscroller.destroy()},selectByIndex:function(e){e<0||e>=this.props.children.length||this.zscroller.scroller.scrollTo(0,e*this.itemHeight)},select:function(e){for(var t=this.props.children,n=0,i=t.length;n<i;n++)if(t[n].value===e)return void this.selectByIndex(n);this.selectByIndex(0)},fireValueChange:function(e){e!==this.state.selectedValue&&("selectedValue"in this.props||this.setState({selectedValue:e}),this.props.onValueChange(e))},scrollingComplete:function(){var e=this.zscroller.scroller.getValues(),t=e.top,n=Math.round((t-this.itemHeight/2)/this.itemHeight),i=this.props.children[n];i&&this.fireValueChange(i.value)},render:function(){var e,t=this.props,n=t.children,i=t.prefixCls,r=t.className,o=t.itemStyle,s=this.state.selectedValue,u=i+"-item",d=u+" "+i+"-item-selected",f=n.map(function(e){return l.createElement("div",{style:o,className:s===e.value?d:u,key:e.value},e.label)}),p=(e={},(0,a["default"])(e,r,!!r),(0,a["default"])(e,i,!0),e);return l.createElement("div",{className:(0,c["default"])(p)},l.createElement("div",{className:i+"-mask"}),l.createElement("div",{className:i+"-indicator",ref:"indicator"}),l.createElement("div",{className:i+"-content",ref:"content"},f))}});t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=r(o),s=n(46),l=i(s),u=n(425),c=i(u),d=a.createClass({displayName:"PopupPicker",mixins:[c["default"]],getDefaultProps:function(){return{prefixCls:"rmc-picker-popup",triggerType:"onClick",WrapComponent:"span"}},getModal:function(){var e=this.props;return this.state.visible?a.createElement(l["default"],{prefixCls:""+e.prefixCls,className:e.className||"",visible:!0,closable:!1,transitionName:e.transitionName||e.popupTransitionName,maskTransitionName:e.maskTransitionName,onClose:this.hide,style:e.style},a.createElement("div",null,a.createElement("div",{className:e.prefixCls+"-header"},a.createElement("div",{className:e.prefixCls+"-item "+e.prefixCls+"-header-left",onClick:this.onDismiss},e.dismissText),a.createElement("div",{className:e.prefixCls+"-item "+e.prefixCls+"-title"},e.title),a.createElement("div",{className:e.prefixCls+"-item "+e.prefixCls+"-header-right",onClick:this.onOk},e.okText)),this.props.content)):null},render:function(){return this.getRender()}});t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";function i(e,t){e.transform=t,e.webkitTransform=t,e.MozTransform=t}function r(e,t){e.transformOrigin=t,e.webkitTransformOrigin=t,e.MozTransformOrigin=t}function o(e){var t=this,n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=void 0,u=void 0,c=void 0,d=void 0,f=void 0,p=void 0,h=void 0,m=void 0;this.content=e,this.container=e.parentNode,this.options=a({},n,{scrollingComplete:function(){t.clearScrollbarTimer(),t.timer=setTimeout(function(){n.scrollingComplete&&n.scrollingComplete(),o&&["x","y"].forEach(function(e){o[e]&&t.setScrollbarOpacity(e,0)})},0)}}),this.options.scrollbars&&(o=this.scrollbars={},u=this.indicators={},c=this.indicatorsSize={},d=this.scrollbarsSize={},f=this.indicatorsPos={},p=this.scrollbarsOpacity={},h=this.contentSize={},m=this.clientSize={},["x","y"].forEach(function(e){var n="x"===e?"scrollingX":"scrollingY";t.options[n]!==!1&&(o[e]=document.createElement("div"),o[e].className="zscroller-scrollbar-"+e,u[e]=document.createElement("div"),u[e].className="zscroller-indicator-"+e,o[e].appendChild(u[e]),c[e]=-1,p[e]=0,f[e]=0,t.container.appendChild(o[e]))}));var y=!0,v=e.style;this.scroller=new s(function(e,r,a){!y&&n.onScroll&&n.onScroll(),i(v,"translate3d("+-e+"px,"+-r+"px,0) scale("+a+")"),o&&["x","y"].forEach(function(n){if(o[n]){var i="x"===n?e:r;if(m[n]>=h[n])t.setScrollbarOpacity(n,0);else{y||t.setScrollbarOpacity(n,1);var a=m[n]/h[n]*d[n],s=a,u=void 0;i<0?(s=Math.max(a+i,l),u=0):i>h[n]-m[n]?(s=Math.max(a+h[n]-m[n]-i,l),u=d[n]-s):u=i/h[n]*d[n],t.setIndicatorSize(n,s),t.setIndicatorPos(n,u)}}}),y=!1},this.options),this.bindEvents(),r(e.style,"left top"),this.reflow()}var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},s=n(450),l=8;o.prototype.setDisabled=function(e){this.disabled=e},o.prototype.clearScrollbarTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},o.prototype.setScrollbarOpacity=function(e,t){this.scrollbarsOpacity[e]!==t&&(this.scrollbars[e].style.opacity=t,this.scrollbarsOpacity[e]=t)},o.prototype.setIndicatorPos=function(e,t){this.indicatorsPos[e]!==t&&("x"===e?i(this.indicators[e].style,"translate3d("+t+"px,0,0)"):i(this.indicators[e].style,"translate3d(0, "+t+"px,0)"),this.indicatorsPos[e]=t)},o.prototype.setIndicatorSize=function(e,t){this.indicatorsSize[e]!==t&&(this.indicators[e].style["x"===e?"width":"height"]=t+"px",this.indicatorsSize[e]=t)},o.prototype.reflow=function(){this.scrollbars&&(this.contentSize.x=this.content.offsetWidth,this.contentSize.y=this.content.offsetHeight,this.clientSize.x=this.container.clientWidth,this.clientSize.y=this.container.clientHeight,this.scrollbars.x&&(this.scrollbarsSize.x=this.scrollbars.x.offsetWidth),this.scrollbars.y&&(this.scrollbarsSize.y=this.scrollbars.y.offsetHeight)),this.scroller.setDimensions(this.container.clientWidth,this.container.clientHeight,this.content.offsetWidth,this.content.offsetHeight);var e=this.container.getBoundingClientRect();this.scroller.setPosition(e.x+this.container.clientLeft,e.y+this.container.clientTop)},o.prototype.destroy=function(){window.removeEventListener("resize",this.onResize,!1),this.container.removeEventListener("touchstart",this.onTouchStart,!1),this.container.removeEventListener("touchmove",this.onTouchMove,!1),this.container.removeEventListener("touchend",this.onTouchEnd,!1),this.container.removeEventListener("touchcancel",this.onTouchCancel,!1),this.container.removeEventListener("mousedown",this.onMouseDown,!1),document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),this.container.removeEventListener("mousewheel",this.onMouseWheel,!1)},o.prototype.bindEvents=function(){var e=this,t=this;window.addEventListener("resize",this.onResize=function(){t.reflow()},!1),"ontouchstart"in window?(this.container.addEventListener("touchstart",this.onTouchStart=function(n){n.touches[0]&&n.touches[0].target&&n.touches[0].target.tagName.match(/input|textarea|select/i)||e.disabled||(e.clearScrollbarTimer(),t.reflow(),t.scroller.doTouchStart(n.touches,n.timeStamp))},!1),this.container.addEventListener("touchmove",this.onTouchMove=function(e){e.preventDefault(),t.scroller.doTouchMove(e.touches,e.timeStamp,e.scale)},!1),this.container.addEventListener("touchend",this.onTouchEnd=function(e){t.scroller.doTouchEnd(e.timeStamp)},!1),this.container.addEventListener("touchcancel",this.onTouchCancel=function(e){t.scroller.doTouchEnd(e.timeStamp)},!1)):!function(){var n=!1;e.container.addEventListener("mousedown",e.onMouseDown=function(i){i.target.tagName.match(/input|textarea|select/i)||e.disabled||(e.clearScrollbarTimer(),t.scroller.doTouchStart([{pageX:i.pageX,pageY:i.pageY}],i.timeStamp),n=!0,t.reflow(),i.preventDefault())},!1),document.addEventListener("mousemove",e.onMouseMove=function(e){n&&(t.scroller.doTouchMove([{pageX:e.pageX,pageY:e.pageY}],e.timeStamp),n=!0)},!1),document.addEventListener("mouseup",e.onMouseUp=function(e){n&&(t.scroller.doTouchEnd(e.timeStamp),n=!1)},!1),e.container.addEventListener("mousewheel",e.onMouseWheel=function(e){t.options.zooming&&(t.scroller.doMouseZoom(e.wheelDelta,e.timeStamp,e.pageX,e.pageY),e.preventDefault())},!1)}()},e.exports=o},function(e,t,n){function i(e){return n(r(e))}function r(e){return o[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var o={"./accordion/index.web.tsx":126,"./accordion/style/index.web.tsx":127,"./action-sheet/index.web.tsx":129,"./action-sheet/style/index.web.tsx":130,"./activity-indicator/index.web.tsx":131,"./activity-indicator/style/index.web.tsx":132,"./badge/index.web.tsx":75,"./badge/style/index.web.tsx":76,"./button/index.web.tsx":47,"./button/style/index.web.tsx":48,"./card/index.web.tsx":136,"./card/style/index.web.tsx":137,"./carousel/index.web.tsx":77,"./carousel/style/index.web.tsx":78,"./checkbox/index.web.tsx":140,"./checkbox/style/index.web.tsx":79,"./date-picker/index.web.tsx":141,"./date-picker/style/index.web.tsx":143,"./drawer/index.web.tsx":145,"./drawer/style/index.web.tsx":146,"./flex/index.web.tsx":32,"./flex/style/index.web.tsx":33,"./grid/index.web.tsx":149,"./grid/style/index.web.tsx":150,"./icon/index.web.tsx":13,"./icon/style/index.web.tsx":16,"./image-picker/index.web.tsx":151,"./image-picker/style/index.web.tsx":152,"./input-item/index.web.tsx":153,"./input-item/style/index.web.tsx":154,"./list-view/index.web.tsx":156,"./list-view/style/index.web.tsx":157,"./list/index.web.tsx":26,"./list/style/index.web.tsx":20,"./menu/index.web.tsx":160,"./menu/style/index.web.tsx":161,"./modal/index.web.tsx":81,"./modal/style/index.web.tsx":82,"./nav-bar/index.web.tsx":165,"./nav-bar/style/index.web.tsx":166,"./notice-bar/index.web.tsx":167,"./notice-bar/style/index.web.tsx":168,"./pagination/index.web.tsx":169,"./pagination/style/index.web.tsx":170,"./picker/index.web.tsx":171,"./picker/style/index.web.tsx":83,"./popover/index.web.tsx":172,"./popover/style/index.web.tsx":174,"./popup/index.web.tsx":175,"./popup/style/index.web.tsx":176,"./progress/index.web.tsx":177,"./progress/style/index.web.tsx":178,"./radio/index.web.tsx":180,"./radio/style/index.web.tsx":84,"./refresh-control/index.web.tsx":181,"./refresh-control/style/index.web.tsx":182,"./result/index.web.tsx":183,"./result/style/index.web.tsx":184,"./search-bar/index.web.tsx":186,"./search-bar/style/index.web.tsx":187,"./segmented-control/index.web.tsx":189,"./segmented-control/style/index.web.tsx":190,"./slider/index.web.tsx":191,"./slider/style/index.web.tsx":192,"./stepper/index.web.tsx":193,"./stepper/style/index.web.tsx":194,"./steps/index.web.tsx":195,"./steps/style/index.web.tsx":196,"./style/index.web.tsx":8,"./swipe-action/index.web.tsx":197,"./swipe-action/style/index.web.tsx":198,"./switch/index.web.tsx":199,"./switch/style/index.web.tsx":200,"./tab-bar/index.web.tsx":202,"./tab-bar/style/index.web.tsx":203,"./table/index.web.tsx":204,"./table/style/index.web.tsx":205,"./tabs/index.web.tsx":206,"./tabs/style/index.web.tsx":207,"./tag/index.web.tsx":208,"./tag/style/index.web.tsx":209,"./text/index.web.tsx":210,"./textarea-item/index.web.tsx":211,"./textarea-item/style/index.web.tsx":212,"./toast/index.web.tsx":85,"./toast/style/index.web.tsx":86,"./view/index.web.tsx":87,"./white-space/index.web.tsx":213,"./white-space/style/index.web.tsx":214,"./wing-blank/index.web.tsx":88,"./wing-blank/style/index.web.tsx":89};i.keys=function(){return Object.keys(o)},i.resolve=r,e.exports=i,i.id=120},function(e,t,n){function i(e){return n(r(e))}function r(e){return o[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var o={"./check-circle-o.svg":429,"./check-circle.svg":430,"./check.svg":431,"./cross-circle-o.svg":432,"./cross-circle.svg":433,"./cross.svg":434,"./down.svg":435,"./ellipsis-circle.svg":436,"./ellipsis.svg":437,"./exclamation-circle.svg":438,"./info-circle.svg":439,"./koubei-o.svg":440,"./koubei.svg":441,"./left.svg":442,"./loading-o.svg":443,"./loading.svg":444,"./question-circle.svg":445,"./right.svg":446,"./search.svg":447};i.keys=function(){return Object.keys(o)},i.resolve=r,e.exports=i,i.id=121},function(e,t){"use strict";function n(){return!1}function i(){return!0}function r(){this.timeStamp=Date.now(),this.target=void 0,this.currentTarget=void 0}Object.defineProperty(t,"__esModule",{value:!0}),r.prototype={isEventObject:1,constructor:r,isDefaultPrevented:n,isPropagationStopped:n,isImmediatePropagationStopped:n,preventDefault:function(){this.isDefaultPrevented=i},stopPropagation:function(){this.isPropagationStopped=i},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=i,this.stopPropagation()},halt:function(e){e?this.stopImmediatePropagation():this.stopPropagation(),this.preventDefault()}},t["default"]=r,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){return null===e||void 0===e}function o(){return f}function a(){return p}function s(e){var t=e.type,n="function"==typeof e.stopPropagation||"boolean"==typeof e.cancelBubble;u["default"].call(this),this.nativeEvent=e;var i=a;"defaultPrevented"in e?i=e.defaultPrevented?o:a:"getPreventDefault"in e?i=e.getPreventDefault()?o:a:"returnValue"in e&&(i=e.returnValue===p?o:a),this.isDefaultPrevented=i;var r=[],s=void 0,l=void 0,c=void 0,d=h.concat();for(m.forEach(function(e){t.match(e.reg)&&(d=d.concat(e.props),e.fix&&r.push(e.fix))}),l=d.length;l;)c=d[--l],this[c]=e[c];for(!this.target&&n&&(this.target=e.srcElement||document),this.target&&3===this.target.nodeType&&(this.target=this.target.parentNode),l=r.length;l;)(s=r[--l])(this,e);this.timeStamp=e.timeStamp||Date.now()}Object.defineProperty(t,"__esModule",{value:!0});var l=n(122),u=i(l),c=n(10),d=i(c),f=!0,p=!1,h=["altKey","bubbles","cancelable","ctrlKey","currentTarget","eventPhase","metaKey","shiftKey","target","timeStamp","view","type"],m=[{reg:/^key/,props:["char","charCode","key","keyCode","which"],fix:function(e,t){r(e.which)&&(e.which=r(t.charCode)?t.keyCode:t.charCode),void 0===e.metaKey&&(e.metaKey=e.ctrlKey)}},{reg:/^touch/,props:["touches","changedTouches","targetTouches"]},{reg:/^hashchange$/,props:["newURL","oldURL"]},{reg:/^gesturechange$/i,props:["rotation","scale"]},{reg:/^(mousewheel|DOMMouseScroll)$/,props:[],fix:function(e,t){var n=void 0,i=void 0,r=void 0,o=t.wheelDelta,a=t.axis,s=t.wheelDeltaY,l=t.wheelDeltaX,u=t.detail;o&&(r=o/120),u&&(r=0-(u%3===0?u/3:u)),void 0!==a&&(a===e.HORIZONTAL_AXIS?(i=0,n=0-r):a===e.VERTICAL_AXIS&&(n=0,i=r)),void 0!==s&&(i=s/120),void 0!==l&&(n=-1*l/120),n||i||(i=r),void 0!==n&&(e.deltaX=n),void 0!==i&&(e.deltaY=i),void 0!==r&&(e.delta=r)}},{reg:/^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,props:["buttons","clientX","clientY","button","offsetX","relatedTarget","which","fromElement","toElement","offsetY","pageX","pageY","screenX","screenY"],fix:function(e,t){var n=void 0,i=void 0,o=void 0,a=e.target,s=t.button;return a&&r(e.pageX)&&!r(t.clientX)&&(n=a.ownerDocument||document,i=n.documentElement,o=n.body,e.pageX=t.clientX+(i&&i.scrollLeft||o&&o.scrollLeft||0)-(i&&i.clientLeft||o&&o.clientLeft||0),e.pageY=t.clientY+(i&&i.scrollTop||o&&o.scrollTop||0)-(i&&i.clientTop||o&&o.clientTop||0)),e.which||void 0===s||(1&s?e.which=1:2&s?e.which=3:4&s?e.which=2:e.which=0),!e.relatedTarget&&e.fromElement&&(e.relatedTarget=e.fromElement===a?e.toElement:e.fromElement),e}}],y=u["default"].prototype;(0,d["default"])(s.prototype,y,{constructor:s,preventDefault:function(){var e=this.nativeEvent;e.preventDefault?e.preventDefault():e.returnValue=p,y.preventDefault.call(this)},stopPropagation:function(){var e=this.nativeEvent;e.stopPropagation?e.stopPropagation():e.cancelBubble=f,y.stopPropagation.call(this)}}),t["default"]=s,e.exports=t["default"]},function(e,t){"use strict";function n(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return 1===t.length?i.apply(void 0,t):r.apply(void 0,t)}function i(e){var t=void 0;return"undefined"!=typeof Reflect&&"function"==typeof Reflect.ownKeys?t=Reflect.ownKeys(e.prototype):(t=Object.getOwnPropertyNames(e.prototype),"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(e.prototype)))),t.forEach(function(t){if("constructor"!==t){var n=Object.getOwnPropertyDescriptor(e.prototype,t);"function"==typeof n.value&&Object.defineProperty(e.prototype,t,r(e,t,n))}}),e}function r(e,t,n){var i=n.value;if("function"!=typeof i)throw new Error("@autobind decorator can only be applied to methods not: "+typeof i);var r=!1;return{configurable:!0,get:function(){if(r||this===e.prototype||this.hasOwnProperty(t))return i;var n=i.bind(this);return r=!0,Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),r=!1,n}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e.charAt(0).toUpperCase()+e.slice(1).replace(/-(\w)/g,function(e,t){return t.toUpperCase()})}var r=n(120);r.keys().forEach(function(e){var n=r(e);n&&n["default"]&&(n=n["default"]);var o=e.match(/^\.\/([^_][\w-]+)\/index\.web\.tsx?$/);o&&o[1]&&(t[i(o[1])]=n)}),"undefined"!=typeof console&&console.warn&&console.warn("you are using prebuild antd-mobile,\nplease use https://github.com/ant-design/babel-plugin-import to reduce app bundle size.")},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(2),o=i(r),a=n(4),s=i(a),l=n(3),u=i(l),c=n(1),d=i(c),f=n(352),p=i(f),h=function(e){function t(){return(0,o["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.render=function(){return d["default"].createElement(p["default"],this.props)},t}(d["default"].Component);t["default"]=h,h.Panel=f.Panel,h.defaultProps={prefixCls:"am-accordion"},e.exports=t["default"]},[451,280],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=i(r),a=n(14),s=i(a),l=n(2),u=i(l),c=n(4),d=i(c),f=n(3),p=i(f),h=n(1),m=i(h),y=n(10),v=i(y),g=n(15),b=i(g),M=n(31),T=i(M),x=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){var e=(0,b["default"])(this.props,["children","className","prefixCls","onClick","touchFeedback","activeStyle"]),t=(0,s["default"])(e,2),n=t[0],i=n.children,r=n.className,a=n.prefixCls,l=n.onClick,u=n.touchFeedback,c=n.activeStyle,d=t[1],f=(0,v["default"])({},this.props.style);return u&&(f=(0,v["default"])(f,c)),m["default"].createElement("div",(0,o["default"])({},d,{style:f,className:u?r+" "+a+"-active":""+r,onClick:l}),i)},t}(m["default"].Component);t["default"]=(0,T["default"])(x),
e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){}function o(e,t,n){function i(){if(M){d["default"].unmountComponentAtNode(M),M.parentNode.removeChild(M),M=null;var e=S.indexOf(i);e!==-1&&S.splice(e,1)}}function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=n(e,t);r&&r.then?r.then(function(){i()}):i()}var o,a=(0,b["default"])({},{prefixCls:"am-action-sheet",cancelButtonText:"\u53d6\u6d88"},t),l=a.prefixCls,c=a.className,f=a.transitionName,h=a.maskTransitionName,y=a.maskClosable,g=void 0===y||y,M=document.createElement("div");document.body.appendChild(M),S.push(i);var x=a.title,N=a.message,E=a.options,P=a.destructiveButtonIndex,D=a.cancelButtonIndex,I=a.cancelButtonText,L=[x?u["default"].createElement("h3",{key:"0",className:l+"-title"},x):null,N?u["default"].createElement("div",{key:"1",className:l+"-message"},N):null],j=null,k="normal";!function(){switch(e){case _:k="normal",j=u["default"].createElement("div",(0,T["default"])(a),L,u["default"].createElement("div",{className:l+"-button-list"},E.map(function(e,t){var n,i=(n={},(0,s["default"])(n,l+"-button-list-item",!0),(0,s["default"])(n,l+"-destructive-button",P===t),(0,s["default"])(n,l+"-cancel-button",D===t),n),o={key:t,prefixCls:l+"-button-list-item",className:(0,m["default"])(i),onClick:function(){return r(t)}},a=u["default"].createElement(C["default"],o,e);return D!==t&&P!==t||(a=u["default"].createElement(C["default"],o,e,D===t?u["default"].createElement("span",{className:l+"-cancel-button-mask"}):null)),a})));break;case w:k="share";var t=E.length&&Array.isArray(E[0])||!1,n=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return u["default"].createElement("div",{className:l+"-share-list-item",key:t,onClick:function(){return r(t,n)}},u["default"].createElement("div",{className:l+"-share-list-item-icon"},e.iconName?u["default"].createElement(v["default"],{type:e.iconName}):e.icon),u["default"].createElement("div",{className:l+"-share-list-item-title"},e.title))};j=u["default"].createElement("div",(0,T["default"])(a),L,u["default"].createElement("div",{className:l+"-share"},t?E.map(function(e,t){return u["default"].createElement("div",{key:t,className:l+"-share-list"},e.map(function(e,i){return n(e,i,t)}))}):u["default"].createElement("div",{className:l+"-share-list"},E.map(function(e,t){return n(e,t)})),u["default"].createElement(C["default"],{prefixCls:l+"-share-cancel-button",className:l+"-share-cancel-button",onClick:function(){return r(-1)}},I)))}}();var O=(0,m["default"])((o={},(0,s["default"])(o,c,!!c),(0,s["default"])(o,l+"-"+k,!0),o));return d["default"].render(u["default"].createElement(p["default"],{visible:!0,title:"",footer:"",prefixCls:l,className:O,transitionName:f||"am-slide-up",maskTransitionName:h||"am-fade",onClose:i,maskClosable:g,wrapProps:a.wrapProps||{}},j),M),{close:i}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=i(a),l=n(1),u=i(l),c=n(9),d=i(c),f=n(46),p=i(f),h=n(5),m=i(h),y=n(13),v=i(y),g=n(10),b=i(g),M=n(25),T=i(M),x=n(128),C=i(x),_="NORMAL",w="SHARE",S=[];t["default"]={showActionSheetWithOptions:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;o(_,e,t)},showShareActionSheetWithOptions:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;o(w,e,t)},close:function(){S.forEach(function(e){return e()})}},e.exports=t["default"]},[452,281],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t,n=this.props,i=n.prefixCls,r=n.className,a=n.animating,s=n.toast,l=n.size,u=n.color,c=n.text,d=(0,m["default"])((e={},(0,o["default"])(e,""+i,!0),(0,o["default"])(e,i+"-lg","large"===l),(0,o["default"])(e,i+"-sm","small"===l),(0,o["default"])(e,r,!!r),(0,o["default"])(e,i+"-toast",!!s),e)),f=(0,m["default"])((t={},(0,o["default"])(t,i+"-spinner",!0),(0,o["default"])(t,i+"-spinner-lg",!!s||"large"===l),(0,o["default"])(t,i+"-spinner-white",!!s||"white"===u),t));return a?s?p["default"].createElement("div",{className:d},p["default"].createElement("div",{className:i+"-content"},p["default"].createElement("span",{className:f}),c&&p["default"].createElement("span",{className:i+"-toast"},c))):p["default"].createElement("div",{className:d},p["default"].createElement("span",{className:f}),c&&p["default"].createElement("span",{className:i+"-tip"},c)):null},t}(p["default"].Component);t["default"]=y,y.defaultProps={prefixCls:"am-activity-indicator",animating:!0,size:"small",color:"gray",panelColor:"rgba(34,34,34,0.6)",toast:!1},e.exports=t["default"]},[451,282],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,i=t.children,r=t.className,a=(0,m["default"])((e={},(0,o["default"])(e,n+"-body",!0),(0,o["default"])(e,r,r),e));return p["default"].createElement("div",{className:a},i)},t}(p["default"].Component);t["default"]=y,y.defaultProps={prefixCls:"am-card"},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,i=t.content,r=t.className,a=t.extra,s=(0,m["default"])((e={},(0,o["default"])(e,n+"-footer",!0),(0,o["default"])(e,r,r),e));return p["default"].createElement("div",{className:s},p["default"].createElement("div",{className:n+"-footer-content"},i),a?p["default"].createElement("div",{className:n+"-footer-extra"},a):null)},t}(p["default"].Component);t["default"]=y,y.defaultProps={prefixCls:"am-card"},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,i=t.className,r=t.title,a=t.thumb,s=t.thumbStyle,l=t.extra,u=(0,m["default"])((e={},(0,o["default"])(e,n+"-header",!0),(0,o["default"])(e,i,i),e));return p["default"].createElement("div",{className:u},p["default"].createElement("div",{className:n+"-header-content"},a?p["default"].createElement("img",{style:s,src:a}):null,r),l?p["default"].createElement("div",{className:n+"-header-extra"},l):null)},t}(p["default"].Component);t["default"]=y,y.defaultProps={prefixCls:"am-card",thumbStyle:{}},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=n(135),v=i(y),g=n(133),b=i(g),M=n(134),T=i(M),x=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,i=t.full,r=t.children,a=t.className,s=(0,m["default"])((e={},(0,o["default"])(e,n,!0),(0,o["default"])(e,n+"-full",i),(0,o["default"])(e,a,a),e));return p["default"].createElement("div",{className:s},r)},t}(p["default"].Component);t["default"]=x,x.defaultProps={prefixCls:"am-card",full:!1},x.Header=v["default"],x.Body=b["default"],x.Footer=T["default"],e.exports=t["default"]},[451,285],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(7),o=i(r),a=n(6),s=i(a),l=n(2),u=i(l),c=n(4),d=i(c),f=n(3),p=i(f),h=n(1),m=i(h),y=n(5),v=i(y),g=n(49),b=i(g),M=n(25),T=i(M),x=n(38),C=i(x),_=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,i=t.style,r=t.className,a=t.name,l=t.children,u=(0,v["default"])((e={},(0,s["default"])(e,n+"-agree",!0),(0,s["default"])(e,r,r),e)),c=(0,C["default"])(this.props,["style","className"]);return m["default"].createElement("div",(0,o["default"])({},(0,T["default"])(this.props),{className:u,style:i}),m["default"].createElement("label",{className:n+"-agree-label",htmlFor:a},m["default"].createElement(b["default"],c),l))},t}(m["default"].Component);t["default"]=_,_.defaultProps={prefixCls:"am-checkbox"},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),a=i(o),s=n(6),l=i(s),u=n(2),c=i(u),d=n(4),f=i(d),p=n(3),h=i(p),m=n(1),y=i(m),v=n(5),g=i(v),b=n(26),M=i(b),T=n(49),x=i(T),C=n(38),_=i(C),w=M["default"].Item,S=function(e){function t(){return(0,c["default"])(this,t),(0,f["default"])(this,e.apply(this,arguments))}return(0,h["default"])(t,e),t.prototype.render=function(){var e,t=this,n=this.props,i=n.prefixCls,o=n.listPrefixCls,s=n.className,u=n.children,c=n.disabled,d=n.checkboxProps,f=void 0===d?{}:d,p=(0,g["default"])((e={},(0,l["default"])(e,i+"-item",!0),(0,l["default"])(e,i+"-item-disabled",c===!0),(0,l["default"])(e,s,s),e)),h=(0,_["default"])(this.props,["listPrefixCls","disabled","checkboxProps"]);c?delete h.onClick:h.onClick=h.onClick||r;var m={};return["name","defaultChecked","checked","onChange","disabled"].forEach(function(e){e in t.props&&(m[e]=t.props[e])}),y["default"].createElement(w,(0,a["default"])({},h,{prefixCls:o,className:p,thumb:y["default"].createElement(x["default"],(0,a["default"])({},f,m))}),u)},t}(y["default"].Component);t["default"]=S,S.defaultProps={prefixCls:"am-checkbox",listPrefixCls:"am-list"},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(49),o=i(r),a=n(139),s=i(a),l=n(138),u=i(l);o["default"].CheckboxItem=s["default"],o["default"].AgreeItem=u["default"],t["default"]=o["default"],e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){return(0,T["default"])({prefixCls:"am-picker",pickerPrefixCls:"am-picker-col",popupPrefixCls:"am-picker-popup"},(0,b.getProps)())}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),a=i(o),s=n(2),l=i(s),u=n(4),c=i(u),d=n(3),f=i(d),p=n(1),h=i(p),m=n(415),y=i(m),v=n(413),g=i(v),b=n(144),M=n(10),T=i(M),x=function(e){function t(){return(0,l["default"])(this,t),(0,c["default"])(this,e.apply(this,arguments))}return(0,f["default"])(t,e),t.prototype.render=function(){var e=this.props,t=e.children,n=e.value,i=e.defaultDate,r=e.extra,o=e.okText,s=e.dismissText,l=e.popupPrefixCls,u={extra:n?(0,b.formatFn)(this,n):r},c=h["default"].createElement(g["default"],{locale:e.locale,minDate:e.minDate,maxDate:e.maxDate,mode:e.mode,pickerPrefixCls:e.pickerPrefixCls,prefixCls:e.prefixCls,defaultDate:n||i});return h["default"].createElement(y["default"],(0,a["default"])({datePicker:c,WrapComponent:"div",transitionName:"am-slide-up",maskTransitionName:"am-fade"},e,{prefixCls:l,date:n||i,dismissText:h["default"].createElement("span",{className:l+"-header-cancel-button"},s),okText:h["default"].createElement("span",{className:l+"-header-ok-button"},o)}),h["default"].cloneElement(t,t.type&&"ListItem"===t.type.myName?u:{}))},t}(h["default"].Component);t["default"]=x,x.defaultProps=r(),e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(417);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i(r)["default"]}}),e.exports=t["default"]},function(e,t,n){"use strict";n(83)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){var t=void 0;return t="time"===e?"HH:mm":"datetime"===e?"YYYY-MM-DD HH:mm":"YYYY-MM-DD"}function o(e,t){var n=e.props.format,i="undefined"==typeof n?"undefined":(0,l["default"])(n);return"string"===i?t.format(i):"function"===i?n(t):t.format(r(e.props.mode))}function a(){return{mode:"datetime",locale:c["default"],extra:"\u8bf7\u9009\u62e9",defaultDate:(0,f["default"])(),onChange:function(){},okText:"\u786e\u5b9a",dismissText:"\u53d6\u6d88",title:""}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(34),l=i(s);t.formatFn=o,t.getProps=a;var u=n(142),c=i(u),d=n(106),f=i(d)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(7),o=i(r),a=n(14),s=i(a),l=n(2),u=i(l),c=n(4),d=i(c),f=n(3),p=i(f),h=n(1),m=i(h),y=n(360),v=i(y),g=n(15),b=i(g),M=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){var e=(0,b["default"])(this.props,["prefixCls","children"]),t=(0,s["default"])(e,2),n=t[0],i=n.prefixCls,r=n.children,a=t[1];return m["default"].createElement(v["default"],(0,o["default"])({prefixCls:i},a),r)},t}(m["default"].Component);t["default"]=M,M.defaultProps={prefixCls:"am-drawer",enableDragHandle:!1},e.exports=t["default"]},[451,288],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.direction,i=t.wrap,r=t.justify,a=t.align,s=t.alignContent,l=t.className,u=t.children,c=t.prefixCls,d=t.style,f=t.onClick,h=(0,m["default"])((e={},(0,o["default"])(e,c,!0),(0,o["default"])(e,c+"-dir-row","row"===n),(0,o["default"])(e,c+"-dir-row-reverse","row-reverse"===n),(0,o["default"])(e,c+"-dir-column","column"===n),(0,o["default"])(e,c+"-dir-column-reverse","column-reverse"===n),(0,o["default"])(e,c+"-nowrap","nowrap"===i),(0,o["default"])(e,c+"-wrap","wrap"===i),(0,o["default"])(e,c+"-wrap-reverse","wrap-reverse"===i),(0,o["default"])(e,c+"-justify-start","start"===r),(0,o["default"])(e,c+"-justify-end","end"===r),(0,o["default"])(e,c+"-justify-center","center"===r),(0,o["default"])(e,c+"-justify-between","between"===r),(0,o["default"])(e,c+"-justify-around","around"===r),(0,o["default"])(e,c+"-align-top","top"===a||"start"===a),(0,o["default"])(e,c+"-align-middle","middle"===a||"center"===a),(0,o["default"])(e,c+"-align-bottom","bottom"===a||"end"===a),(0,o["default"])(e,c+"-align-baseline","baseline"===a),(0,o["default"])(e,c+"-align-stretch","stretch"===a),(0,o["default"])(e,c+"-align-content-start","start"===s),(0,o["default"])(e,c+"-align-content-end","end"===s),(0,o["default"])(e,c+"-align-content-center","center"===s),(0,o["default"])(e,c+"-align-content-between","between"===s),(0,o["default"])(e,c+"-align-content-around","around"===s),(0,o["default"])(e,c+"-align-content-stretch","stretch"===s),(0,o["default"])(e,l,l),e));return p["default"].createElement("div",{className:h,style:d,onClick:f},u)},t}(p["default"].Component);t["default"]=y,y.defaultProps={prefixCls:"am-flexbox",align:"center",onClick:function(){}},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.children,i=t.className,r=t.prefixCls,a=t.style,s=t.onClick,l=(0,m["default"])((e={},(0,o["default"])(e,r+"-item",!0),(0,o["default"])(e,i,i),e));return p["default"].createElement("div",{className:l,style:a,onClick:s},n)},t}(p["default"].Component);t["default"]=y,y.defaultProps={prefixCls:"am-flexbox"},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=n(32),v=i(y),g=n(77),b=i(g),M=function(e){function t(){(0,s["default"])(this,t);var n=(0,u["default"])(this,e.apply(this,arguments));return n.clientWidth=document.documentElement.clientWidth,n}return(0,d["default"])(t,e),t.prototype.render=function(){for(var e,t=this,n=this.props,i=n.prefixCls,r=n.className,a=n.data,s=n.hasLine,l=n.columnNum,u=n.isCarousel,c=n.carouselMaxRow,d=n.onClick,f=void 0===d?function(){}:d,h=a&&a.length||0,y=Math.ceil(h/l),g=this.props.renderItem||function(e){return p["default"].createElement("div",{className:i+"-item-contain column-num-"+l,style:{height:t.clientWidth/l+"px"}},p["default"].createElement("img",{className:i+"-icon",src:e.icon}),p["default"].createElement("div",{className:i+"-text"},e.text))},M=[],T=0;T<y;T++){for(var x=[],C=function(e){var t=T*l+e;t<h?!function(){var e=a&&a[t];x.push(p["default"].createElement(v["default"].Item,{key:"griditem-"+t,className:i+"-item",onClick:function(){return f(e,t)}},g(e,t)))}():x.push(p["default"].createElement(v["default"].Item,{key:"griditem-"+t}))},_=0;_<l;_++)C(_);M.push(p["default"].createElement(v["default"],{justify:"center",align:"stretch",key:"gridline-"+T},x))}var w=Math.ceil(y/c),S=[];if(u&&w>1)for(var N=0;N<w;N++){for(var E=[],P=0;P<c;P++){var D=N*c+P;D<y?E.push(M[D]):E.push(p["default"].createElement("div",{key:"gridline-"+D}))}S.push(p["default"].createElement("div",{key:"pageitem-"+N,className:i+"-carousel-page"},E))}return p["default"].createElement("div",{className:(0,m["default"])((e={},(0,o["default"])(e,i,!0),(0,o["default"])(e,i+"-line",s),(0,o["default"])(e,r,r),e))},u&&w>1?p["default"].createElement(b["default"],null,S):M)},t}(p["default"].Component);t["default"]=M,M.defaultProps={data:[],hasLine:!0,isCarousel:!1,columnNum:4,carouselMaxRow:2,prefixCls:"am-grid"},e.exports=t["default"]},function(e,t,n){"use strict";n(8),n(33),n(78),n(290)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),a=i(o),s=n(2),l=i(s),u=n(4),c=i(u),d=n(3),f=i(d),p=n(1),h=i(p),m=n(5),y=i(m),v=n(88),g=i(v),b=n(32),M=i(b),T=n(85),x=i(T),C=function(e){function t(){(0,l["default"])(this,t);var n=(0,c["default"])(this,e.apply(this,arguments));return n.getOrientation=function(e,t){if(/iphone|ipad/i.test(navigator.userAgent)){var n=new FileReader;n.onload=function(e){var n=new DataView(e.target.result);if(65496!==n.getUint16(0,!1))return t(-2);for(var i=n.byteLength,r=2;r<i;){var o=n.getUint16(r,!1);if(r+=2,65505===o){var a=n.getUint32(r+=2,!1);if(1165519206!==a)return t(-1);var s=18761===n.getUint16(r+=6,!1);r+=n.getUint32(r+4,s);var l=n.getUint16(r,s);r+=2;for(var u=0;u<l;u++)if(274===n.getUint16(r+12*u,s))return t(n.getUint16(r+12*u+8,s))}else{if(65280!==(65280&o))break;r+=n.getUint16(r,!1)}}return t(-1)},n.readAsArrayBuffer(e.slice(0,65536))}else t("-1")},n.removeImage=function(e){var t=[],i=n.props.files,r=void 0===i?[]:i;r.forEach(function(n,i){e!==i&&t.push(n)}),n.props.onChange&&n.props.onChange(t,"remove",e)},n.addImage=function(e){var t=n.props.files,i=void 0===t?[]:t,r=i.concat(e);n.props.onChange&&n.props.onChange(r,"add")},n.onImageClick=function(e){n.props.onImageClick&&n.props.onImageClick(e,n.props.files)},n.onFileChange=function(){var e=n.refs.fileSelectorInput;e.files&&e.files.length&&!function(){var t=e.files[0],i=new FileReader;i.onload=function(i){var r=i.target.result;if(!r)return void x["default"].fail("\u56fe\u7247\u83b7\u53d6\u5931\u8d25");var o=1;n.getOrientation(t,function(i){i>0&&(o=i),n.addImage({url:r,orientation:o,file:t}),e.value=""})},i.readAsDataURL(t)}()},n}return(0,f["default"])(t,e),t.prototype.render=function(){var e,t=this,n=this.props,i=n.prefixCls,r=n.style,o=n.className,s=n.files,l=void 0===s?[]:s,u=n.selectable,c=n.onAddImageClick,d=window.devicePixelRatio||1,f=[],p=(document.documentElement.clientWidth-18*d-6*d*3)/4,m=(0,y["default"])((e={},(0,a["default"])(e,""+i,!0),(0,a["default"])(e,o,o),e)),v={width:p+"px",height:p+"px"};return l.forEach(function(e,n){f.push(h["default"].createElement("div",{key:n,className:i+"-item",style:v},h["default"].createElement("div",{className:i+"-item-remove",onClick:function(){t.removeImage(n)}}),h["default"].createElement("div",{className:i+"-item-content",onClick:function(){t.onImageClick(n)},style:{backgroundImage:"url("+e.url+")"}})))}),h["default"].createElement("div",{className:m,style:r},h["default"].createElement("div",{className:i+"-list"},h["default"].createElement(g["default"],{size:"md"},h["default"].createElement(M["default"],{wrap:"wrap"},f,u&&h["default"].createElement("div",{className:i+"-item "+i+"-upload-btn",style:v,onClick:function(){c&&c()}},c?null:h["default"].createElement("input",{style:v,ref:"fileSelectorInput",type:"file",accept:"image/jpg,image/jpeg,image/png,image/gif",onChange:function(){t.onFileChange()}}))))))},t}(h["default"].Component);t["default"]=C,C.defaultProps={prefixCls:"am-image-picker",files:[],onChange:r,onImageClick:r,selectable:!0},e.exports=t["default"]},function(e,t,n){"use strict";n(8),n(89),n(33),n(86),n(292)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){}function o(e){return"undefined"==typeof e||null===e?"":e}Object.defineProperty(t,"__esModule",{value:!0});var a=n(7),s=i(a),l=n(6),u=i(l),c=n(2),d=i(c),f=n(4),p=i(f),h=n(3),m=i(h),y=n(1),v=i(y),g=n(5),b=i(g),M=n(38),T=i(M),x=function(e){function t(n){(0,d["default"])(this,t);var i=(0,p["default"])(this,e.call(this,n));return i.onInputChange=function(e){var t=e.target.value,n=i.props,r=n.onChange,o=n.type;switch(o){case"text":break;case"bankCard":t=t.replace(/\D/g,""),t=t.replace(/\D/g,"").replace(/(....)(?=.)/g,"$1 ");break;case"phone":t=t.replace(/\D/g,"").substring(0,11);var a=t.length;a>3&&a<8?t=t.substr(0,3)+" "+t.substr(3):a>=8&&(t=t.substr(0,3)+" "+t.substr(3,4)+" "+t.substr(7));break;case"number":t=t.replace(/\D/g,"");break;case"password":}r&&r(t)},i.onInputBlur=function(e){i.debounceTimeout=setTimeout(function(){i.setState({focus:!1})},300);var t=e.target.value;i.props.onBlur&&i.props.onBlur(t)},i.onInputFocus=function(e){i.setState({focus:!0});var t=e.target.value;i.props.onFocus&&i.props.onFocus(t)},i.onExtraClick=function(e){i.props.onExtraClick&&i.props.onExtraClick(e)},i.onErrorClick=function(e){i.props.onErrorClick&&i.props.onErrorClick(e)},i.clearInput=function(){"password"!==i.props.type&&i.props.updatePlaceholder&&i.setState({placeholder:i.props.value}),i.props.onChange&&i.props.onChange("")},i.state={focus:!1,placeholder:i.props.placeholder},i}return(0,m["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){"placeholder"in e&&this.state.placeholder!==e.placeholder&&this.setState({placeholder:e.placeholder})},t.prototype.componentWillUnmount=function(){this.debounceTimeout&&clearTimeout(this.debounceTimeout)},t.prototype.render=function(){var e,t,n=this.props,i=n.prefixCls,r=n.prefixListCls,a=n.type,l=n.value,c=n.defaultValue,d=n.name,f=n.editable,p=n.disabled,h=n.style,m=n.clear,y=n.children,g=n.error,M=n.className,x=n.extra,C=n.labelNumber,_=n.maxLength,w=(0,T["default"])(this.props,["prefixCls","prefixListCls","editable","style","clear","children","error","className","extra","labelNumber","onExtraClick","onErrorClick","updatePlaceholder"]),S=this.state,N=S.focus,E=S.placeholder,P=(0,b["default"])((e={},(0,u["default"])(e,r+"-item",!0),(0,u["default"])(e,i+"-item",!0),(0,u["default"])(e,i+"-disabled",p),(0,u["default"])(e,i+"-error",g),(0,u["default"])(e,i+"-focus",N),(0,u["default"])(e,M,M),e)),D=(0,b["default"])((t={},(0,u["default"])(t,i+"-label",!0),(0,u["default"])(t,i+"-label-2",2===C),(0,u["default"])(t,i+"-label-3",3===C),(0,u["default"])(t,i+"-label-4",4===C),(0,u["default"])(t,i+"-label-5",5===C),(0,u["default"])(t,i+"-label-6",6===C),(0,u["default"])(t,i+"-label-7",7===C),t)),I="text";"bankCard"===a||"phone"===a?I="tel":"password"===a&&(I="password");var L=void 0;L="value"in this.props?{value:o(l)}:{defaultValue:c};var j=void 0;return"number"===a&&(j={pattern:"[0-9]*"}),v["default"].createElement("div",{className:P,style:h},y?v["default"].createElement("div",{className:D},y):null,v["default"].createElement("div",{className:i+"-control"},v["default"].createElement("input",(0,s["default"])({ref:"input"},j,w,L,{type:I,maxLength:_,name:d,placeholder:E,onChange:this.onInputChange,onBlur:this.onInputBlur,onFocus:this.onInputFocus,readOnly:!f,disabled:p}))),m&&f&&!p&&l&&l.length>0?v["default"].createElement("div",{className:i+"-clear",onClick:this.clearInput}):null,g?v["default"].createElement("div",{className:i+"-error-extra",onClick:this.onErrorClick}):null,""!==x?v["default"].createElement("div",{className:i+"-extra",onClick:this.onExtraClick},x):null)},t}(v["default"].Component);x.defaultProps={prefixCls:"am-input",prefixListCls:"am-list",type:"text",editable:!0,disabled:!1,placeholder:"",clear:!1,onChange:r,onBlur:r,onFocus:r,extra:"",onExtraClick:r,error:!1,onErrorClick:r,labelNumber:4,updatePlaceholder:!1},t["default"]=x,e.exports=t["default"]},[453,293],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(7),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(72),m=i(h),y=n(80),v=i(y),g=m["default"].IndexedList,b=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e=(0,v["default"])(this.props,!0),t=e.restProps,n=e.extraProps;return p["default"].createElement(g,(0,o["default"])({ref:"indexedList",sectionHeaderClassName:"am-indexed-list-section-header am-list-body",sectionBodyClassName:"am-indexed-list-section-body am-list-body"},t,n),this.props.children)},t}(p["default"].Component);t["default"]=b,b.defaultProps={prefixCls:"am-indexed-list",listPrefixCls:"am-list",listViewPrefixCls:"am-list-view"},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(7),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(72),m=i(h),y=n(80),v=i(y),g=n(155),b=i(g),M=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e=(0,v["default"])(this.props,!1),t=e.restProps,n=e.extraProps,i=this.props,r=i.useZscroller,a=i.refreshControl;return a&&(r=!0),p["default"].createElement(m["default"],(0,o["default"])({ref:"listview"},t,n,{useZscroller:r}))},t}(p["default"].Component);t["default"]=M,M.defaultProps={prefixCls:"am-list-view",listPrefixCls:"am-list"},M.DataSource=m["default"].DataSource,M.IndexedList=b["default"],e.exports=t["default"]},[453,294],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=t.Brief=void 0;var r=n(7),o=i(r),a=n(6),s=i(a),l=n(2),u=i(l),c=n(4),d=i(c),f=n(3),p=i(f),h=n(1),m=i(h),y=n(5),v=i(y),g=n(25),b=i(g),M=t.Brief=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){return m["default"].createElement("div",{className:"am-list-brief",style:this.props.style},this.props.children)},t}(m["default"].Component),T=function(e){function t(n){(0,u["default"])(this,t);var i=(0,d["default"])(this,e.call(this,n));return i.onClick=function(e){i.props.onClick&&i.props.onClick(e)},i.onTouchStart=function(){i.props.onClick&&i.setState({hover:!0})},i.onTouchEnd=function(){i.props.onClick&&i.setState({hover:!1})},i.state={hover:!1},i}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t,n,i=this.props,r=i.prefixCls,a=i.thumb,l=i.arrow,u=i.error,c=i.children,d=i.extra,f=i.className,p=i.align,h=i.multipleLine,y=i.wrap,g=i.style,M=this.state.hover,T=void 0,x=void 0,C=(0,v["default"])((e={},(0,s["default"])(e,r+"-item",!0),(0,s["default"])(e,r+"-item-error",u),(0,s["default"])(e,r+"-item-top","top"===p),(0,s["default"])(e,r+"-item-middle","middle"===p),(0,s["default"])(e,r+"-item-bottom","bottom"===p),(0,s["default"])(e,r+"-item-hover",M),(0,s["default"])(e,f,f),e)),_=(0,v["default"])((t={},(0,s["default"])(t,r+"-line",!0),(0,s["default"])(t,r+"-line-multiple",h),(0,s["default"])(t,r+"-line-wrap",y),t)),w=(0,v["default"])((n={},(0,s["default"])(n,r+"-arrow",!0),(0,s["default"])(n,r+"-arrow-horizontal","horizontal"===l),(0,s["default"])(n,r+"-arrow-vertical","down"===l||"up"===l),(0,s["default"])(n,r+"-arrow-vertical-up","up"===l),n));return a&&(T="string"==typeof a?m["default"].createElement("div",{className:r+"-thumb"},m["default"].createElement("img",{src:a})):m["default"].createElement("div",{className:r+"-thumb"},a)),x=""!==l?m["default"].createElement("div",{className:w}):null,m["default"].createElement("div",(0,o["default"])({},(0,b["default"])(this.props),{className:C,onClick:this.onClick,onTouchStart:this.onTouchStart,onTouchEnd:this.onTouchEnd,onTouchCancel:this.onTouchEnd,style:g}),T,m["default"].createElement("div",{className:_},""!==c?m["default"].createElement("div",{className:r+"-content"},c):null,""!==d?m["default"].createElement("div",{className:r+"-extra"},d):null,x))},t}(m["default"].Component);t["default"]=T,T.Brief=M,T.defaultProps={prefixCls:"am-list",thumb:"",arrow:"",children:"",extra:"",error:!1,multipleLine:!1,align:"middle",wrap:!1},T.myName="ListItem"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=n(26),v=i(y),g=n(51),b=i(g),M=function(e){function t(n){(0,s["default"])(this,t);var i=(0,u["default"])(this,e.call(this,n));return i.onClick=function(e){i.setState({value:[e]}),i.props.onChange&&i.props.onChange(e)},i.state={value:i.props.value,data:i.props.data},i}return(0,d["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){"data"in e&&this.setState({data:e.data})},t.prototype.render=function(){var e,t=this,n=this.state,i=n.value,r=void 0===i?[]:i,a=n.data,s=void 0===a?[]:a,l=this.props,u=l.className,c=l.prefixCls,d=l.radioPrefixCls,f=(0,m["default"])((e={},(0,o["default"])(e,""+c,!0),(0,o["default"])(e,u,u),e)),h=[];return s.forEach(function(e,n){var i,a=(0,m["default"])((i={},(0,o["default"])(i,d+"-item",!0),(0,o["default"])(i,c+"-item-selected",r.length>0&&r[0].value===e.value),(0,o["default"])(i,c+"-item-disabled",e.disabled),i));h.push(p["default"].createElement(v["default"].Item,{className:a,key:n,extra:p["default"].createElement(b["default"],{
checked:r.length>0&&r[0].value===e.value,disabled:e.disabled,onChange:t.onClick.bind(t,e)})},e.label))}),p["default"].createElement(v["default"],{style:{paddingTop:0},className:f},h)},t}(p["default"].Component);t["default"]=M,M.defaultProps={prefixCls:"am-sub-menu",radioPrefixCls:"am-radio",value:[],data:[],onChange:function(){}},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=n(10),v=i(y),g=n(159),b=i(g),M=n(26),T=i(M),x=n(32),C=i(x),_=function(e){function t(n){(0,s["default"])(this,t);var i=(0,u["default"])(this,e.call(this,n));i.onClickListItem=function(e){e.isLeaf===!0&&i.setState({firstValue:e.value,SubMenuData:[]},function(){i.props.onChange&&i.props.onChange([e.value])}),i.setState({firstValue:e.value,SubMenuData:e.children||[]})},i.onClickSubMenuItem=function(e){var t=i.props,n=t.level,r=t.onChange;setTimeout(function(){r&&r(2===n?[i.state.firstValue,e.value]:[e.value])},300)};var r=n.data,o=n.value,a=n.level;if(2!==a)return i.state={SubMenuData:r},(0,u["default"])(i);if(o.length>0){var l=r.filter(function(e){return e.value===(o.length>0&&o[0]||null)})[0].children||[];return i.state={SubMenuData:l,firstValue:o[0]||""},(0,u["default"])(i)}var c=r[0].children||[];return r[0].isLeaf?i.state={SubMenuData:[],firstValue:""}:i.state={SubMenuData:c,firstValue:r[0].value},i}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this,n=this.props,i=n.className,r=n.data,a=void 0===r?[]:r,s=n.prefixCls,l=n.value,u=void 0===l?[]:l,c=n.level,d=n.style,f=this.props.height;f||(f=document.documentElement.clientHeight/2);var h={height:Math.round(f)+"px",overflowY:"scroll"},y=this.state,g=y.SubMenuData,M=y.firstValue,x=(0,m["default"])((e={},(0,o["default"])(e,s,!0),(0,o["default"])(e,i,!!i),e)),_=a.map(function(e,n){return p["default"].createElement(T["default"].Item,{className:e.value===M?s+"-selected":"",onClick:t.onClickListItem.bind(t,e),key:"listitem-1-"+n},e.label)});return p["default"].createElement("div",{className:x,style:(0,v["default"])({},d,h)},p["default"].createElement(C["default"],{align:"top"},2===c?p["default"].createElement(C["default"].Item,{style:h},p["default"].createElement(T["default"],null,_)):null,p["default"].createElement(C["default"].Item,{style:h},p["default"].createElement(b["default"],{value:g.filter(function(e){return e.value===(u.length&&u[u.length-1])}),data:g,onChange:this.onClickSubMenuItem}))))},t}(p["default"].Component);t["default"]=_,_.defaultProps={prefixCls:"am-menu",value:[],data:[],level:2,onChange:function(){}},e.exports=t["default"]},function(e,t,n){"use strict";n(8),n(79),n(33),n(20),n(84),n(296)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=i(r),a=n(6),s=i(a),l=n(2),u=i(l),c=n(4),d=i(c),f=n(3),p=i(f),h=n(1),m=i(h),y=n(5),v=i(y),g=n(10),b=i(g),M=n(31),T=i(M),x=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.button,i=t.prefixCls,r=t.touchFeedback,a=(0,b["default"])({},this.props);["button","prefixCls","touchFeedback","activeStyle"].forEach(function(e){a.hasOwnProperty(e)&&delete a[e]});var l=(0,v["default"])((e={},(0,s["default"])(e,i+"-button",!0),(0,s["default"])(e,i+"-button-active",r),e)),u={};if(n.style&&(u=n.style,"string"==typeof u)){var c={cancel:{fontWeight:"bold"},"default":{},destructive:{color:"red"}};u=c[u]||{}}return m["default"].createElement("a",(0,o["default"])({className:l,style:u,href:"#",onClick:function(e){e.preventDefault(),n.onPress&&n.onPress()}},a),n.text||"Button")},t}(m["default"].Component);t["default"]=(0,T["default"])(x),e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(){function e(){s["default"].unmountComponentAtNode(a),a.parentNode.removeChild(a)}var t=arguments.length<=0?void 0:arguments[0],n=arguments.length<=1?void 0:arguments[1],i=(arguments.length<=2?void 0:arguments[2])||[{text:"\u786e\u5b9a"}];if(t||n){var r="am-modal",a=document.createElement("div");document.body.appendChild(a);var l=i.map(function(t){var n=t.onPress||function(){};return t.onPress=function(){n(),e()},t});s["default"].render(o["default"].createElement(u["default"],{visible:!0,transparent:!0,prefixCls:r,title:t,transitionName:"am-zoom",closable:!1,maskClosable:!1,footer:l,maskTransitionName:"am-fade"},o["default"].createElement("div",{style:{zoom:1,overflow:"hidden"}},n)),a)}};var r=n(1),o=i(r),a=n(9),s=i(a),l=n(50),u=i(l);e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(){function e(e){var t=e.target,n=t.getAttribute("type");p[n]=t.value}function t(){s["default"].unmountComponentAtNode(m),m.parentNode.removeChild(m)}function n(e){var t=p.text||"",n=p.password||"";return"login-password"===f?e(t,n):e("secure-text"===f?n:t)}for(var i=arguments.length,r=Array(i),a=0;a<i;a++)r[a]=arguments[a];if(r&&r[2]){var l="am-modal",c=r[0],d=void 0,f=r[3]||"default",p={};switch(f){case"login-password":d=o["default"].createElement("div",null,o["default"].createElement("div",{className:l+"-input"},o["default"].createElement("input",{type:"text",defaultValue:"",ref:function(e){return setTimeout(function(){e.focus()},500)},onChange:e})),o["default"].createElement("div",{className:l+"-input"},o["default"].createElement("input",{type:"password",defaultValue:"",onChange:e})));break;case"secure-text":d=o["default"].createElement("div",null,o["default"].createElement("div",{className:l+"-input"},o["default"].createElement("input",{type:"password",defaultValue:"",ref:function(e){return setTimeout(function(){e.focus()},500)},onChange:e})));break;case"plain-text":case"default":default:d=o["default"].createElement("div",null,o["default"].createElement("div",{className:l+"-input"},o["default"].createElement("input",{type:"text",defaultValue:"",ref:function(e){return setTimeout(function(){e.focus()},500)},onChange:e})))}var h=o["default"].createElement("div",null,r[1],d),m=document.createElement("div");document.body.appendChild(m);var y=void 0;y="function"==typeof r[2]?[{text:"\u53d6\u6d88"},{text:"\u786e\u5b9a",onPress:function(){n(r[2])}}]:r[2].map(function(e){return{text:e.text,onPress:function(){e.onPress&&n(e.onPress)}}});var v=y.map(function(e){var n=e.onPress||function(){};return e.onPress=function(){n(),t()},e});s["default"].render(o["default"].createElement(u["default"],{visible:!0,transparent:!0,prefixCls:l,title:c,closable:!1,maskClosable:!1,transitionName:"am-zoom",footer:v,maskTransitionName:"am-fade"},o["default"].createElement("div",{style:{zoom:1,overflow:"hidden"}},h)),m)}};var r=n(1),o=i(r),a=n(9),s=i(a),l=n(50),u=i(l);e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(7),o=i(r),a=n(6),s=i(a),l=n(14),u=i(l),c=n(2),d=i(c),f=n(4),p=i(f),h=n(3),m=i(h),y=n(1),v=i(y),g=n(5),b=i(g),M=n(13),T=i(M),x=n(15),C=i(x),_=function(e){function t(){return(0,d["default"])(this,t),(0,p["default"])(this,e.apply(this,arguments))}return(0,m["default"])(t,e),t.prototype.render=function(){var e,t=(0,C["default"])(this.props,["prefixCls","children","mode","className","iconName","leftContent","rightContent","onLeftClick"]),n=(0,u["default"])(t,2),i=n[0],r=i.prefixCls,a=i.children,l=i.mode,c=i.className,d=i.iconName,f=i.leftContent,p=i.rightContent,h=i.onLeftClick,m=n[1],y=(0,b["default"])((e={},(0,s["default"])(e,c,c),(0,s["default"])(e,r,!0),(0,s["default"])(e,r+"-"+l,!0),e));return v["default"].createElement("div",(0,o["default"])({},m,{className:y}),v["default"].createElement("div",{className:r+"-left",onClick:h},d?v["default"].createElement("span",{className:r+"-left-icon"},v["default"].createElement(T["default"],{type:d})):null,v["default"].createElement("span",{className:r+"-left-content"},f)),v["default"].createElement("div",{className:r+"-title"},a),v["default"].createElement("div",{className:r+"-right"},p))},t}(v["default"].Component);t["default"]=_,_.defaultProps={prefixCls:"am-navbar",mode:"dark",iconName:"left",onLeftClick:function(){}},e.exports=t["default"]},[452,298],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(7),o=i(r),a=n(6),s=i(a),l=n(14),u=i(l),c=n(2),d=i(c),f=n(4),p=i(f),h=n(3),m=i(h),y=n(1),v=i(y),g=n(5),b=i(g),M=n(25),T=i(M),x=n(15),C=i(x),_=n(13),w=i(_),S=function(e){function t(n){(0,d["default"])(this,t);var i=(0,p["default"])(this,e.call(this,n));return i.onClick=function(){var e=i.props,t=e.mode,n=e.onClick;n&&n(),"closable"===t&&i.setState({show:!1})},i.state={show:!0},i}return(0,m["default"])(t,e),t.prototype.render=function(){var e,t=(0,C["default"])(this.props,["mode","type","onClick","children","className","prefixCls"]),n=(0,u["default"])(t,2),i=n[0],r=i.mode,a=i.type,l=i.onClick,c=i.children,d=i.className,f=i.prefixCls,p=n[1],h={},m=null;"closable"===r?m=v["default"].createElement("div",{className:f+"-operation",onClick:this.onClick},v["default"].createElement(w["default"],{type:"cross",size:"md"})):("link"===r&&(m=v["default"].createElement("div",{className:f+"-operation"},v["default"].createElement(w["default"],{type:"right",size:"md"}))),h.onClick=l);var y={success:"check-circle",error:"cross-circle",warn:"exclamation-circle",question:"question-circle"},g=a?v["default"].createElement("div",{className:f+"-icon"},v["default"].createElement(w["default"],{type:y[a]||"info-circle",size:"xxs"})):null,M=(0,b["default"])((e={},(0,s["default"])(e,f,!0),(0,s["default"])(e,d,!!d),e));return this.state.show?v["default"].createElement("div",(0,o["default"])({},(0,T["default"])(this.props),{className:M},p,h),g,v["default"].createElement("div",{className:f+"-content"},c),m):null},t}(v["default"].Component);t["default"]=S,S.defaultProps={prefixCls:"am-notice-bar",mode:"",onClick:function(){}},e.exports=t["default"]},[452,299],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),a=i(o),s=n(2),l=i(s),u=n(4),c=i(u),d=n(3),f=i(d),p=n(1),h=i(p),m=n(5),y=i(m),v=n(47),g=i(v),b=n(32),M=i(b),T=function(e){function t(n){(0,l["default"])(this,t);var i=(0,c["default"])(this,e.call(this,n));return i.state={current:n.current},i.onPrev=i.onPrev.bind(i),i.onNext=i.onNext.bind(i),i}return(0,f["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){this.setState({current:e.current})},t.prototype._hasPrev=function(){return this.state.current>0},t.prototype._hasNext=function(){return this.state.current<this.props.total},t.prototype._handleChange=function(e){return this.setState({current:e}),this.props.onChange&&this.props.onChange(e),e},t.prototype.onPrev=function(){this._handleChange(this.state.current-1)},t.prototype.onNext=function(){this._handleChange(this.state.current+1)},t.prototype.getIndexes=function(e){for(var t=[],n=0;n<e;n++)t.push(n);return t},t.prototype.render=function(){var e=this.props,t=e.prefixCls,n=e.className,i=e.mode,r=e.total,o=e.simple,s=e.prevText,l=e.nextText,u=this.state.current,c=(0,y["default"])((0,a["default"])({className:n},t+"-wrap",!0)),d=void 0;switch(i){case"button":d=h["default"].createElement(M["default"],null,h["default"].createElement(M["default"].Item,{className:t+"-wrap-btn "+t+"-wrap-btn-prev"},h["default"].createElement(g["default"],{inline:!0,disabled:u<=0,onClick:this.onPrev},s)),this.props.children?h["default"].createElement(M["default"].Item,null,this.props.children):!o&&h["default"].createElement(M["default"].Item,{className:c},h["default"].createElement("span",{className:"active"},u+1),"/",h["default"].createElement("span",null,r)),h["default"].createElement(M["default"].Item,{className:t+"-wrap-btn "+t+"-wrap-btn-next"},h["default"].createElement(g["default"],{disabled:u>=r-1,inline:!0,onClick:this.onNext},l)));break;case"number":d=h["default"].createElement("div",{className:c},h["default"].createElement("span",{className:"active"},u+1),"/",h["default"].createElement("span",null,r));break;case"pointer":var f=this.getIndexes(r);d=h["default"].createElement("div",{className:c},f.map(function(e){var n,i=(0,y["default"])((n={},(0,a["default"])(n,t+"-wrap-dot",!0),(0,a["default"])(n,t+"-wrap-dot-active",e===u),n));return h["default"].createElement("div",{className:i,key:"dot-"+e},h["default"].createElement("span",null))}));break;default:d=!1}return h["default"].createElement("div",{className:t},d)},t}(h["default"].Component);t["default"]=T,T.defaultProps={prefixCls:"am-pagination",mode:"button",current:0,simple:!1,prevText:"Prev",nextText:"Next",onChange:r},e.exports=t["default"]},function(e,t,n){"use strict";n(8),n(48),n(33),n(300)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){var e=function(e){return e.join(",")};return{prefixCls:"am-picker",pickerPrefixCls:"am-picker-col",popupPrefixCls:"am-picker-popup",format:e,style:{left:0,bottom:0},cols:3,value:[],extra:"\u8bf7\u9009\u62e9",okText:"\u786e\u5b9a",dismissText:"\u53d6\u6d88",title:""}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),a=i(o),s=n(2),l=i(s),u=n(4),c=i(u),d=n(3),f=i(d),p=n(1),h=i(p),m=n(412),y=i(m),v=n(410),g=i(v),b=n(74),M=i(b),T=function(e){function t(){(0,l["default"])(this,t);var n=(0,c["default"])(this,e.apply(this,arguments));return n.getSel=function(){var e=n.props.value||[],t=(0,M["default"])(n.props.data,function(t,n){return t.value===e[n]});return n.props.format&&n.props.format(t.map(function(e){return e.label}))},n}return(0,f["default"])(t,e),t.prototype.render=function(){var e=this.props,t=e.children,n=e.value,i=e.extra,r=e.okText,o=e.dismissText,s=e.popupPrefixCls,l={extra:this.getSel()||i},u=h["default"].cloneElement(t,t.type&&"ListItem"===t.type.myName?l:{}),c=h["default"].createElement(g["default"],{prefixCls:e.prefixCls,pickerPrefixCls:e.pickerPrefixCls,data:e.data,cols:e.cols,onChange:e.onPickerChange});return h["default"].createElement(y["default"],(0,a["default"])({cascader:c,WrapComponent:"div",transitionName:"am-slide-up",maskTransitionName:"am-fade"},e,{prefixCls:s,value:n,dismissText:h["default"].createElement("span",{className:s+"-header-cancel-button"},o),okText:h["default"].createElement("span",{className:s+"-header-ok-button"},r)}),u)},t}(h["default"].Component);t["default"]=T,T.defaultProps=r(),e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e,t){return e};return y["default"].Children.map(e,function(e,n){var i=t(e,n);return i&&i.props&&i.props.children?y["default"].cloneElement(i,{},r(i.props.children,t)):i})}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),a=i(o),s=n(14),l=i(s),u=n(2),c=i(u),d=n(4),f=i(d),p=n(3),h=i(p),m=n(1),y=i(m),v=n(113),g=i(v),b=n(173),M=i(b),T=n(15),x=i(T),C=function(e){function t(){return(0,c["default"])(this,t),(0,f["default"])(this,e.apply(this,arguments))}return(0,h["default"])(t,e),t.prototype.render=function(){var e=(0,x["default"])(this.props,["children","prefixCls","placement","trigger","overlay","onSelect","popupAlign"]),t=(0,l["default"])(e,2),n=t[0],i=n.children,o=n.prefixCls,s=n.placement,u=n.trigger,c=n.overlay,d=n.onSelect,f=n.popupAlign,p=t[1],h=r(c,function(e,t){var n={firstItem:!1,onClick:function(){}};return e&&e.type&&"PopoverItem"===e.type.myName&&!e.props.disabled?(n.onClick=function(){d(e)},n.firstItem=0===t,y["default"].cloneElement(e,n)):e});return y["default"].createElement(g["default"],(0,a["default"])({prefixCls:o,placement:s,trigger:u,overlay:h,popupAlign:f},p),i)},t}(y["default"].Component);t["default"]=C,C.defaultProps={prefixCls:"am-popover",placement:"bottomRight",popupAlign:{overflow:{adjustY:0,adjustX:0}},trigger:["click"],onSelect:function(){}},C.Item=M["default"],e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=i(r),a=n(6),s=i(a),l=n(14),u=i(l),c=n(2),d=i(c),f=n(4),p=i(f),h=n(3),m=i(h),y=n(1),v=i(y),g=n(5),b=i(g),M=n(10),T=i(M),x=n(13),C=i(x),_=n(15),w=i(_),S=n(31),N=i(S),E=function(e){function t(){return(0,d["default"])(this,t),(0,p["default"])(this,e.apply(this,arguments))}return(0,m["default"])(t,e),t.prototype.render=function(){var e,t=(0,w["default"])(this.props,["children","className","prefixCls","iconName","disabled","touchFeedback","activeStyle","firstItem"]),n=(0,u["default"])(t,2),i=n[0],r=i.children,a=i.className,l=i.prefixCls,c=i.iconName,d=i.disabled,f=i.touchFeedback,p=i.activeStyle,h=i.firstItem,m=n[1],y=(0,T["default"])({},this.props.style);f&&(y=(0,T["default"])(y,p));var g=(e={},(0,s["default"])(e,a,!!a),(0,s["default"])(e,l+"-item",!0),(0,s["default"])(e,l+"-item-disabled",d),(0,s["default"])(e,l+"-item-active",f),(0,s["default"])(e,l+"-item-fix-active-arrow",h&&f),e);return v["default"].createElement("div",(0,o["default"])({className:(0,b["default"])(g)},m,{style:y}),c?v["default"].createElement("span",{className:l+"-item-icon"},v["default"].createElement(C["default"],{type:c})):null,v["default"].createElement("span",{className:l+"-item-content"},r))},t}(v["default"].Component);E.defaultProps={prefixCls:"am-popover",disabled:!1},t["default"]=(0,N["default"])(E,"PopoverItem"),e.exports=t["default"]},[451,302],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n){function i(){y&&(c["default"].unmountComponentAtNode(y),y.parentNode.removeChild(y),y=null),r(e)}var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){},o=(0,h["default"])({},{prefixCls:"am-popup",animationType:"slide-down"},t),a=o.prefixCls,s=o.transitionName,u=o.maskTransitionName,d=o.maskClosable,p=void 0===d||d,m=o.animationType,y=document.createElement("div");document.body.appendChild(y);var v="am-slide-down";return"slide-up"===m&&(v="am-slide-up"),c["default"].render(l["default"].createElement(f["default"],{prefixCls:a,visible:!0,title:"",footer:"",className:a+"-"+m,transitionName:s||v,maskTransitionName:u||"am-fade",onClose:i,maskClosable:p,wrapProps:o.wrapProps||{}},n),y),{instanceId:e,close:i}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(2),a=i(o),s=n(1),l=i(s),u=n(9),c=i(u),d=n(46),f=i(d),p=n(10),h=i(p),m={defaultInstance:null,instances:[]},y=1,v=function g(){(0,a["default"])(this,g)};t["default"]=v,v.newInstance=function(){var e=void 0;return{show:function(t,n){e=r(y++,n,t,function(e){for(var t=0;t<m.instances.length;t++)if(m.instances[t].instanceId===e)return void m.instances.splice(t,1)}),m.instances.push(e)},hide:function(){e.close()}}},v.show=function(e,t){m.defaultInstance=r("0",t,e,function(e){"0"===e&&(m.defaultInstance=null)})},v.hide=function(){m.defaultInstance.close()},e.exports=t["default"]},[451,303],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=n(10),v=i(y),g=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,i=t.percent,r=t.position,a=t.unfilled,s=t.style,l=void 0===s?{}:s,u={width:i+"%",height:0},c=(0,m["default"])((e={},(0,o["default"])(e,n+"-outer",!0),(0,o["default"])(e,n+"-fixed-outer","fixed"===r),(0,o["default"])(e,n+"-hide-outer","hide"===a),e));return p["default"].createElement("div",{className:c},p["default"].createElement("div",{className:n+"-bar",style:(0,v["default"])({},l,u)}))},t}(p["default"].Component);t["default"]=g,g.defaultProps={prefixCls:"am-progress",percent:0,position:"fixed",unfilled:"show"},e.exports=t["default"]},[451,304],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),a=i(o),s=n(6),l=i(s),u=n(2),c=i(u),d=n(4),f=i(d),p=n(3),h=i(p),m=n(1),y=i(m),v=n(5),g=i(v),b=n(26),M=i(b),T=n(51),x=i(T),C=n(38),_=i(C),w=M["default"].Item,S=function(e){function t(){return(0,c["default"])(this,t),(0,f["default"])(this,e.apply(this,arguments))}return(0,h["default"])(t,e),t.prototype.render=function(){var e,t=this,n=this.props,i=n.prefixCls,o=n.listPrefixCls,s=n.className,u=n.children,c=n.disabled,d=n.radioProps,f=void 0===d?{}:d,p=(0,g["default"])((e={},(0,l["default"])(e,i+"-item",!0),(0,l["default"])(e,i+"-item-disabled",c===!0),(0,l["default"])(e,s,s),e)),h=(0,_["default"])(this.props,["listPrefixCls","disabled","radioProps"]);c?delete h.onClick:h.onClick=h.onClick||r;var m={};return["name","defaultChecked","checked","onChange","disabled"].forEach(function(e){e in t.props&&(m[e]=t.props[e])}),y["default"].createElement(w,(0,a["default"])({},h,{prefixCls:o,className:p,extra:y["default"].createElement(x["default"],(0,a["default"])({},f,m))}),u)},t}(y["default"].Component);t["default"]=S,S.defaultProps={prefixCls:"am-radio",listPrefixCls:"am-list"},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(51),o=i(r),a=n(179),s=i(a);o["default"].RadioItem=s["default"],t["default"]=o["default"],e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(72),s=i(a),l=n(13),u=i(l),c=n(10),d=i(c);s["default"].RefreshControl.defaultProps=(0,d["default"])({},s["default"].RefreshControl.defaultProps,{prefixCls:"am-refresh-control",icon:o["default"].createElement("div",{style:{lineHeight:"50px"}},o["default"].createElement("div",{className:"am-refresh-control-pull"},o["default"].createElement(u["default"],{type:"arrow-down"})," \u4e0b\u62c9"),o["default"].createElement("div",{className:"am-refresh-control-release"},o["default"].createElement(u["default"],{type:"arrow-up"})," \u91ca\u653e")),loading:o["default"].createElement("div",{style:{lineHeight:"50px"}},o["default"].createElement(u["default"],{type:"loading"})),refreshing:!1}),t["default"]=s["default"].RefreshControl,e.exports=t["default"]},[452,306],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(6),a=i(o),s=n(2),l=i(s),u=n(4),c=i(u),d=n(3),f=i(d),p=n(1),h=i(p),m=n(47),y=i(m),v=n(5),g=i(v),b=function(e){function t(){return(0,l["default"])(this,t),(0,c["default"])(this,e.apply(this,arguments))}return(0,f["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,i=t.imgUrl,r=t.title,o=t.message,s=t.buttonText,l=t.buttonClick,u=t.buttonType,c=t.className,d=(0,g["default"])((e={},(0,a["default"])(e,""+n,!0),(0,a["default"])(e,c,c),e));return h["default"].createElement("div",{className:d},h["default"].createElement("div",{className:n+"-pic",style:{backgroundImage:"url("+i+")"}}),""!==r?h["default"].createElement("div",{className:n+"-title"},r):null,""!==o?h["default"].createElement("div",{className:n+"-message"},o):null,""!==s?h["default"].createElement("div",{className:n+"-button"},h["default"].createElement(y["default"],{type:u,onClick:l},s)):null)},t}(h["default"].Component);t["default"]=b,b.defaultProps={prefixCls:"am-result",imgUrl:"",title:"",message:"",buttonText:"",buttonType:"",buttonClick:r},e.exports=t["default"]},function(e,t,n){"use strict";n(8),n(48),n(307)},function(e,t){"use strict";function n(){}Object.defineProperty(t,"__esModule",{value:!0});t.defaultProps={prefixCls:"am-search",placeholder:"",onSubmit:n,onChange:n,onFocus:n,onBlur:n,onClear:n,showCancelButton:!1,cancelText:"\u53d6\u6d88",disabled:!1}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=n(185),v=function(e){function t(n){(0,s["default"])(this,t);var i=(0,u["default"])(this,e.call(this,n));i.onSubmit=function(e){e.preventDefault(),i.props.onSubmit&&i.props.onSubmit(i.state.value)},i.onChange=function(e){var t=e.target.value;"value"in i.props||i.setState({value:t}),i.props.onChange&&i.props.onChange(t)},i.onFocus=function(){i.setState({focus:!0}),i.props.onFocus&&i.props.onFocus()},i.onBlur=function(){i.setState({focus:!1}),i.props.onBlur&&i.props.onBlur()},i.onClear=function(){"value"in i.props||i.setState({value:""}),i.refs.searchInput.focus(),i.props.onClear&&i.props.onClear(""),i.props.onChange&&i.props.onChange("")},i.onCancel=function(){i.props.onCancel?i.props.onCancel(i.state.value):i.onClear(),i.refs.searchInput.blur()};var r=void 0;return r="value"in n?n.value||"":"defaultValue"in n?n.defaultValue:"",i.state={value:r,focus:!1},i}return(0,d["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){"value"in e&&this.setState({value:e.value})},t.prototype.componentDidMount=function(){/U3/i.test(navigator.userAgent)&&(this.initialInputContainerWidth=this.refs.searchInputContainer.offsetWidth,this.props.showCancelButton&&(this.refs.searchInputContainer.style.width=this.refs.searchInputContainer.offsetWidth-41*(window.devicePixelRatio||1)+"px"))},t.prototype.render=function(){var e,t,n,i=this.props,r=i.prefixCls,a=i.showCancelButton,s=i.disabled,l=i.placeholder,u=i.cancelText,c=i.className,d=this.state,f=d.value,h=d.focus,y=(0,m["default"])((e={},(0,o["default"])(e,""+r,!0),(0,o["default"])(e,r+"-start",a||h),(0,o["default"])(e,c,c),e)),v={};/U3/i.test(navigator.userAgent)&&this.initialInputContainerWidth&&(v=a||h?{width:this.initialInputContainerWidth-41*(window.devicePixelRatio||1)+"px"}:{width:this.initialInputContainerWidth+"px"});var g=(0,m["default"])((t={},(0,o["default"])(t,r+"-clear",!0),(0,o["default"])(t,r+"-clear-show",h&&f&&f.length>0),t)),b=(0,m["default"])((n={},(0,o["default"])(n,r+"-cancel",!0),(0,o["default"])(n,r+"-all-cancel",a),n));return p["default"].createElement("form",{onSubmit:this.onSubmit,className:y},p["default"].createElement("div",{ref:"searchInputContainer",className:r+"-input",style:v},p["default"].createElement("input",{type:"search",className:r+"-value",value:f,disabled:s,placeholder:l,onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur,ref:"searchInput"}),p["default"].createElement("a",{onClick:this.onClear,className:g})),p["default"].createElement("div",{className:b,onClick:this.onCancel},u))},t}(p["default"].Component);t["default"]=v,v.defaultProps=y.defaultProps,e.exports=t["default"]},[451,308],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=i(r),a=n(6),s=i(a),l=n(2),u=i(l),c=n(4),d=i(c),f=n(3),p=i(f),h=n(1),m=i(h),y=n(5),v=i(y),g=n(10),b=i(g),M=n(31),T=i(M),x=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t,n=this.props,i=n.label,r=n.prefixCls,a=n.selected,l=n.tintColor,u=n.enabled,c=n.touchFeedback,d=(0,b["default"])({},this.props);["prefixCls","label","selected","tintColor","enabled","touchFeedback","activeStyle"].forEach(function(e){d.hasOwnProperty(e)&&delete d[e]});var f=(0,v["default"])((e={},(0,s["default"])(e,r+"-item",!0),(0,s["default"])(e,r+"-item-selected",a),e)),p=(0,v["default"])((t={},(0,s["default"])(t,r+"-item-feedback",!0),(0,s["default"])(t,r+"-item-feedback-tintcolor",u&&c&&!a&&!l),t)),h=u&&c&&!a&&l?{backgroundColor:l}:{};return m["default"].createElement("div",(0,o["default"])({className:f,style:{color:a?"#fff":l,backgroundColor:a?l:"#fff",borderColor:l}},d),m["default"].createElement("div",{className:p,style:h}),i)},t}(m["default"].Component);x.defaultProps={onClick:function(){},selected:!1},t["default"]=(0,T["default"])(x),e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=n(188),v=i(y),g=function(e){function t(n){(0,s["default"])(this,t);var i=(0,u["default"])(this,e.call(this,n));return i.state={selectedIndex:n.selectedIndex},i}return(0,d["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){e.selectedIndex!==this.state.selectedIndex&&this.setState({selectedIndex:e.selectedIndex})},t.prototype.onClick=function(e,t,n){var i=this.props,r=i.enabled,o=i.onChange,a=i.onValueChange;r&&this.state.selectedIndex!==t&&(e.nativeEvent.selectedSegmentIndex=t,e.nativeEvent.value=n,o&&o(e),a&&a(n),this.setState({selectedIndex:t}))},t.prototype.render=function(){var e,t=this,n=this.props,i=n.prefixCls,r=n.style,a=n.enabled,s=n.values,l=void 0===s?[]:s,u=n.className,c=n.tintColor,d=this.state.selectedIndex,f=l.map(function(e,n){return p["default"].createElement(v["default"],{key:n,prefixCls:i,label:e,enabled:a,tintColor:c,selected:n===d,onClick:function(i){return t.onClick(i,n,e)}})}),h=(0,m["default"])((e={},(0,o["default"])(e,u,!!u),(0,o["default"])(e,""+i,!0),(0,o["default"])(e,i+"-disabled",!a),e));return p["default"].createElement("div",{className:h,style:r},f)},t}(p["default"].Component);t["default"]=g,g.defaultProps={prefixCls:"am-segment",selectedIndex:0,enabled:!0,values:[],onChange:function(){},onValueChange:function(){},style:{}},e.exports=t["default"]},[451,309],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(2),o=i(r),a=n(4),s=i(a),l=n(3),u=i(l),c=n(1),d=i(c),f=n(374),p=i(f),h=function(e){function t(){return(0,o["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.render=function(){return d["default"].createElement("div",{className:this.props.prefixCls+"-wrapper"},d["default"].createElement(p["default"],this.props))},t}(d["default"].Component);t["default"]=h,h.defaultProps={prefixCls:"am-slider",tipTransitionName:"zoom-down"},e.exports=t["default"]},[451,310],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(7),o=i(r),a=n(6),s=i(a),l=n(14),u=i(l),c=n(2),d=i(c),f=n(4),p=i(f),h=n(3),m=i(h),y=n(1),v=i(y),g=n(5),b=i(g),M=n(15),T=i(M),x=n(362),C=i(x),_=function(e){function t(){return(0,d["default"])(this,t),(0,p["default"])(this,e.apply(this,arguments))}return(0,m["default"])(t,e),t.prototype.render=function(){var e,t=(0,T["default"])(this.props,["className","showNumber"]),n=(0,u["default"])(t,2),i=n[0],r=i.className,a=i.showNumber,l=n[1],c=(0,b["default"])((e={},(0,s["default"])(e,r,!!r),(0,s["default"])(e,"showNumber",!!a),e));return v["default"].createElement(C["default"],(0,o["default"])({},l,{ref:"inputNumber",className:c}))},t}(v["default"].Component);t["default"]=_,_.defaultProps={prefixCls:"am-stepper",step:1,readOnly:!1,showNumber:!1,focusOnUpDown:!1},e.exports=t["default"]},[451,311],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){return"string"==typeof e}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=n(7),a=i(o),s=n(2),l=i(s),u=n(4),c=i(u),d=n(3),f=i(d),p=n(1),h=i(p),m=n(378),y=i(m),v=n(13),g=i(v),b=function(e){
function t(){return(0,l["default"])(this,t),(0,c["default"])(this,e.apply(this,arguments))}return(0,f["default"])(t,e),t.prototype.render=function(){var e=this,t=this.props,n=t.current,i=t.direction;return h["default"].createElement(y["default"],(0,a["default"])({},this.props,{direction:i}),this.props.children.map(function(t,i){var o=-1;if(i<e.props.children.length-1){var a=e.props.children[i+1].props.status;"error"===a&&(o=i)}var s=o>-1?"error-tail":"",l=void 0,u=void 0;return t.props.icon?(l=t.props.icon,r(l)&&(u="",i>0&&i<=n?l="check-circle":"error"===t.props.status?l="cross-circle":"process"===t.props.status&&(l="check-circle"))):(u=i<=n?"":"ellipsis-item",l=i<=n?"check-circle-o":"error"===t.props.status?"cross-circle-o":"ellipsis-circle"),u=s+" "+u,h["default"].cloneElement(t,{key:i,icon:h["default"].createElement(g["default"],{type:l}),className:u})}))},t}(h["default"].Component);t["default"]=b,b.Step=y["default"].Step,b.defaultProps={prefixCls:"am-steps",iconPrefix:"ant",labelPlacement:"vertical",current:0,direction:"vertical"},e.exports=t["default"]},[452,312],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=i(r),a=n(53),s=i(a),l=n(2),u=i(l),c=n(4),d=i(c),f=n(3),p=i(f),h=n(1),m=i(h),y=n(380),v=i(y),g=n(71),b=i(g),M=n(5),T=i(M),x=n(81),C=i(x),_=function(e){function t(n){(0,u["default"])(this,t);var i=(0,d["default"])(this,e.call(this,n));return i.onLongTap=function(){var e=i.props,t=e.disabled,n=e.onOpen;t||(n&&n(),i.setState({showModal:!0}))},i.state={showModal:!1},i}return(0,p["default"])(t,e),t.prototype.onClose=function(){this.props.onClose&&this.props.onClose(),this.setState({showModal:!1})},t.prototype.renderAndroid=function(){var e=this,t=this.props,n=t.children,i=t.title,r=t.autoClose,o=t.left,a=void 0===o?[]:o,l=t.right,u=void 0===l?[]:l,c={recognizers:{press:{time:500,threshold:50}}},d=[].concat((0,s["default"])(a),(0,s["default"])(u)).map(function(t){var n=t.onPress||function(){};return{text:t.text,style:t.style,onPress:function(){n(),r&&e.onClose()}}});return m["default"].createElement("div",null,m["default"].createElement(b["default"],{onPress:this.onLongTap,options:c},n),this.state.showModal?m["default"].createElement(C["default"],{animated:!1,title:i,transparent:!0,closable:!1,maskClosable:!0,footer:d,visible:!0}):null)},t.prototype.render=function(){var e,t=this.props,n=t.className,i=t.prefixCls,r=t.left,a=void 0===r?[]:r,s=t.right,l=void 0===s?[]:s,u=t.autoClose,c=t.disabled,d=t.onOpen,f=t.onClose,p=t.children,h=!!navigator.userAgent.match(/Android/i),y=(0,T["default"])((e={},(0,o["default"])(e,""+i,1),(0,o["default"])(e,n,!!n),e));return a.length||l.length?m["default"].createElement("div",{className:y},h?this.renderAndroid():m["default"].createElement(v["default"],{prefixCls:i,left:a,right:l,autoClose:u,disabled:c,onOpen:d,onClose:f},p)):m["default"].createElement("div",{className:y},p)},t}(m["default"].Component);_.defaultProps={prefixCls:"am-swipe",title:"\u8bf7\u786e\u8ba4\u64cd\u4f5c",autoClose:!1,disabled:!1,left:[],right:[],onOpen:function(){},onClose:function(){}},t["default"]=_,e.exports=t["default"]},function(e,t,n){"use strict";n(8),n(82),n(314)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(7),o=i(r),a=n(6),s=i(a),l=n(2),u=i(l),c=n(4),d=i(c),f=n(3),p=i(f),h=n(1),m=i(h),y=n(5),v=i(y),g=function(e){function t(){(0,u["default"])(this,t);var n=(0,d["default"])(this,e.apply(this,arguments));return n.onChange=function(e){var t=e.target.checked;n.props.onChange&&n.props.onChange(t)},n}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,i=t.style,r=t.name,a=t.checked,l=t.disabled,u=t.className,c=t.onTintColor,d=(0,v["default"])((e={},(0,s["default"])(e,""+n,!0),(0,s["default"])(e,u,u),e)),f=c?{backgroundColor:c}:{};return m["default"].createElement("label",{className:d,style:i},m["default"].createElement("input",(0,o["default"])({type:"checkbox",name:r,className:n+"-checkbox"},l?{disabled:"disabled"}:"",{checked:a,onChange:this.onChange})),m["default"].createElement("div",{className:"checkbox",style:f}))},t}(m["default"].Component);t["default"]=g,g.defaultProps={prefixCls:"am-switch",name:"",checked:!1,disabled:!1,onChange:function(){}},e.exports=t["default"]},[451,315],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=i(r),a=n(4),s=i(a),l=n(3),u=i(l),c=n(1),d=i(c),f=n(75),p=i(f),h=function(e){function t(){return(0,o["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.render=function(){var e=this.props,t=e.title,n=e.icon,i=e.selectedIcon,r=e.prefixCls,o=e.badge,a=e.selected,s=e.unselectedTintColor,l=e.tintColor,u=a?i:n,c=d["default"].isValidElement(u)?u:d["default"].createElement("img",{className:r+"-image",src:u.uri||u,alt:t}),f=a?l:s;return d["default"].createElement("div",this.props.dataAttrs,d["default"].createElement("div",{className:r+"-icon",style:{color:f}},o?d["default"].createElement(p["default"],{text:o,className:r+"-badge"},c):c),d["default"].createElement("p",{className:r+"-title",style:{color:a?l:s}},t))},t}(d["default"].Component);t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(112),s=i(a),l=n(201),u=i(l),c=n(69),d=i(c),f=n(392),p=i(f),h=n(25),m=i(h),y=o["default"].createClass({displayName:"AntTabBar",statics:{Item:function(){}},getDefaultProps:function(){return{prefixCls:"am-tab-bar",barTintColor:"white",tintColor:"#108ee9",unselectedTintColor:"#888"}},onChange:function(e){o["default"].Children.forEach(this.props.children,function(t){t.key===e&&t.props.onPress&&t.props.onPress()})},renderTabBar:function(){var e=this.props,t=e.onTabClick,n=e.barTintColor,i=e.hidden,r=e.prefixCls,a=i?r+"-bar-hidden":"";return o["default"].createElement(p["default"],{className:a,onTabClick:t,style:{backgroundColor:n}})},renderTabContent:function(){return o["default"].createElement(d["default"],{animated:!1})},render:function(){var e=this,t=void 0,n=[];o["default"].Children.forEach(this.props.children,function(e){e.props.selected&&(t=e.key),n.push(e)});var i=this.props,r=i.tintColor,l=i.unselectedTintColor,c=n.map(function(t){var n=t.props,i=o["default"].createElement(u["default"],{prefixCls:e.props.prefixCls+"-tab",badge:n.badge,selected:n.selected,icon:n.icon,selectedIcon:n.selectedIcon,title:n.title,tintColor:r,unselectedTintColor:l,dataAttrs:(0,m["default"])(n)});return o["default"].createElement(a.TabPane,{placeholder:"\u6b63\u5728\u52a0\u8f7d",tab:i,key:t.key},n.children)});return o["default"].createElement(s["default"],{renderTabBar:this.renderTabBar,renderTabContent:this.renderTabContent,tabBarPosition:"bottom",prefixCls:this.props.prefixCls,activeKey:t,onChange:this.onChange},c)}});t["default"]=y,e.exports=t["default"]},function(e,t,n){"use strict";n(8),n(316),n(76)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(7),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(10),m=i(h),y=n(385),v=i(y),g=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e=this.props,t=e.columns,n=e.dataSource,i=e.direction,r=e.scrollX,a=e.titleFixed,s=this.props,l=s.style,u=s.className,c=(0,m["default"])({},this.props);["style","className"].forEach(function(e){c.hasOwnProperty(e)&&delete c[e]});var d=void 0;return i&&"vertical"!==i?"horizon"===i?(t[0].className="am-table-horizonTitle",d=p["default"].createElement(v["default"],(0,o["default"])({},c,{columns:t,data:n,className:"am-table",showHeader:!1,scroll:{x:r}}))):"mix"===i&&(t[0].className="am-table-horizonTitle",d=p["default"].createElement(v["default"],(0,o["default"])({},c,{columns:t,data:n,className:"am-table",scroll:{x:r}}))):d=a?p["default"].createElement(v["default"],(0,o["default"])({},c,{columns:t,data:n,className:"am-table",scroll:{x:!0},showHeader:!1})):p["default"].createElement(v["default"],(0,o["default"])({},c,{columns:t,data:n,className:"am-table",scroll:{x:r}})),p["default"].createElement("div",{className:u,style:l},d)},t}(p["default"].Component);t["default"]=g,g.defaultProps={dataSource:[],prefixCls:"am-table"},e.exports=t["default"]},[451,317],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=i(r),a=n(1),s=i(a),l=n(112),u=i(l),c=n(391),d=i(c),f=n(69),p=i(f),h=n(388),m=i(h),y=s["default"].createClass({displayName:"Tabs",statics:{TabPane:l.TabPane},getDefaultProps:function(){return{prefixCls:"am-tabs",animated:!0,swipeable:!0,onChange:function(){},tabBarPosition:"top",onTabClick:function(){}}},renderTabBar:function(){var e=this.props;return s["default"].createElement(m["default"],{onTabClick:e.onTabClick,inkBarAnimated:e.animated})},renderTabContent:function(){var e=this.props,t=e.animated,n=e.swipeable;return n?s["default"].createElement(d["default"],{animated:t}):s["default"].createElement(p["default"],{animated:t})},render:function(){return s["default"].createElement(u["default"],(0,o["default"])({renderTabBar:this.renderTabBar,renderTabContent:this.renderTabContent},this.props))}});t["default"]=y,e.exports=t["default"]},[451,318],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(7),o=i(r),a=n(6),s=i(a),l=n(2),u=i(l),c=n(4),d=i(c),f=n(3),p=i(f),h=n(1),m=i(h),y=n(5),v=i(y),g=n(13),b=i(g),M=n(25),T=i(M),x=function(e){function t(n){(0,u["default"])(this,t);var i=(0,d["default"])(this,e.call(this,n));return i.onClick=function(){var e=i.props,t=e.disabled,n=e.onChange;if(!t){var r=i.state.selected;i.setState({selected:!r},function(){n&&n(!r)})}},i.onTagClose=function(){i.props.onClose&&i.props.onClose(),i.setState({closed:!0},i.props.afterClose)},i.state={selected:n.selected,closed:!1},i}return(0,p["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){this.props.selected!==e.selected&&this.setState({selected:e.selected})},t.prototype.render=function(){var e,t=this.props,n=t.children,i=t.className,r=t.prefixCls,a=t.disabled,l=t.closable,u=t.small,c=t.style,d=(0,v["default"])((e={},(0,s["default"])(e,i,!!i),(0,s["default"])(e,""+r,!0),(0,s["default"])(e,r+"-normal",!a&&(!this.state.selected||u||l)),(0,s["default"])(e,r+"-small",u),(0,s["default"])(e,r+"-active",this.state.selected&&!a&&!u&&!l),(0,s["default"])(e,r+"-disabled",a),(0,s["default"])(e,r+"-closable",l),e));return this.state.closed?null:m["default"].createElement("div",(0,o["default"])({},(0,T["default"])(this.props),{className:d,onClick:this.onClick,style:c}),m["default"].createElement("div",{className:r+"-text"},n),l&&!a&&!u&&m["default"].createElement("div",{className:r+"-close",onClick:this.onTagClose},m["default"].createElement(b["default"],{type:"cross-circle",size:"xs"})))},t}(m["default"].Component);t["default"]=x,x.defaultProps={prefixCls:"am-tag",disabled:!1,selected:!1,closable:!1,small:!1,onChange:function(){},onClose:function(){},afterClose:function(){}},e.exports=t["default"]},[452,319],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(2),o=i(r),a=n(4),s=i(a),l=n(3),u=i(l),c=n(1),d=i(c),f=n(87),p=i(f),h=function(e){function t(){return(0,o["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.render=function(){return d["default"].createElement(p["default"],this.props)},t}(d["default"].Component);t["default"]=h,h.defaultProps={Component:"span"},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){}function o(e){return"undefined"==typeof e||null===e?"":e}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var a=n(7),s=i(a),l=n(6),u=i(l),c=n(2),d=i(c),f=n(4),p=i(f),h=n(3),m=i(h),y=n(1),v=i(y),g=n(5),b=i(g),M=n(38),T=i(M),x=function(e){function t(n){(0,d["default"])(this,t);var i=(0,p["default"])(this,e.call(this,n));return i.onChange=function(e){var t=e.target.value,n=i.props.onChange;if(n&&n(t),i.props.autoHeight){var r=i.refs.textarea;r.style.height="",r.style.height=r.scrollHeight+"px"}},i.onBlur=function(e){i.debounceTimeout=setTimeout(function(){i.setState({focus:!1})},500);var t=e.target.value;i.props.onBlur&&i.props.onBlur(t)},i.onFocus=function(e){i.setState({focus:!0});var t=e.target.value;i.props.onFocus&&i.props.onFocus(t)},i.onErrorClick=function(){i.props.onErrorClick&&i.props.onErrorClick()},i.clearInput=function(){i.props.onChange&&i.props.onChange("")},i.state={focus:!1},i}return(0,m["default"])(t,e),t.prototype.shouldComponentUpdate=function(e,t){return e.value!==this.props.value||e.defaultValue!==this.props.defaultValue||e.error!==this.props.error||e.disabled!==this.props.disabled||e.editable!==this.props.editable||t.focus!==this.state.focus},t.prototype.componentWillUnmount=function(){this.debounceTimeout&&clearTimeout(this.debounceTimeout)},t.prototype.render=function(){var e,t,n=this.props,i=n.prefixCls,r=n.prefixListCls,a=n.style,l=n.title,c=n.name,d=n.value,f=n.defaultValue,p=n.placeholder,h=n.clear,m=n.rows,y=n.count,g=n.editable,M=n.disabled,x=n.error,C=n.className,_=n.labelNumber,w=n.autoHeight,S=(0,T["default"])(this.props,["prefixCls","prefixListCls","editable","style","clear","children","error","className","count","labelNumber","title","onErrorClick","autoHeight"]),N=void 0;N="value"in this.props?{value:o(d)}:{defaultValue:f};var E=this.state.focus,P=(0,b["default"])((e={},(0,u["default"])(e,r+"-item",!0),(0,u["default"])(e,i+"-item",!0),(0,u["default"])(e,i+"-disabled",M),(0,u["default"])(e,i+"-item-single-line",1===m&&!w),(0,u["default"])(e,i+"-error",x),(0,u["default"])(e,i+"-focus",E),(0,u["default"])(e,C,C),e)),D=(0,b["default"])((t={},(0,u["default"])(t,i+"-label",!0),(0,u["default"])(t,i+"-label-2",2===_),(0,u["default"])(t,i+"-label-3",3===_),(0,u["default"])(t,i+"-label-4",4===_),(0,u["default"])(t,i+"-label-5",5===_),(0,u["default"])(t,i+"-label-6",6===_),(0,u["default"])(t,i+"-label-7",7===_),t));return v["default"].createElement("div",{className:P,style:a},l?v["default"].createElement("div",{className:D},l):null,v["default"].createElement("div",{className:i+"-control"},v["default"].createElement("textarea",(0,s["default"])({},S,N,{ref:"textarea",name:c,rows:m,placeholder:p,maxLength:y,onChange:this.onChange,onBlur:this.onBlur,onFocus:this.onFocus,readOnly:!g,disabled:M}))),h&&g&&d&&d.length>0?v["default"].createElement("div",{className:i+"-clear",onClick:this.clearInput,onTouchStart:this.clearInput}):null,x?v["default"].createElement("div",{className:i+"-error-extra",onClick:this.onErrorClick}):null,y>0&&m>1?v["default"].createElement("span",{className:i+"-count"},v["default"].createElement("span",null,d&&d.length),"/",y):null)},t}(v["default"].Component);t["default"]=x,x.defaultProps={prefixCls:"am-textarea",prefixListCls:"am-list",title:"",autoHeight:!1,editable:!0,disabled:!1,placeholder:"",clear:!1,rows:1,onChange:r,onBlur:r,onFocus:r,onErrorClick:r,error:!1,labelNumber:4},e.exports=t["default"]},[453,320],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(5),m=i(h),y=function(e){function t(){return(0,s["default"])(this,t),(0,u["default"])(this,e.apply(this,arguments))}return(0,d["default"])(t,e),t.prototype.render=function(){var e,t=this.props,n=t.prefixCls,i=t.size,r=t.className,a=t.style,s=t.onClick,l=(0,m["default"])((e={},(0,o["default"])(e,""+n,!0),(0,o["default"])(e,n+"-"+i,!0),(0,o["default"])(e,r,!!r),e));return p["default"].createElement("div",{className:l,style:a,onClick:s})},t}(p["default"].Component);t["default"]=y,y.defaultProps={prefixCls:"am-whitespace",size:"md"},e.exports=t["default"]},[451,322],function(e,t,n){e.exports={"default":n(226),__esModule:!0}},function(e,t,n){e.exports={"default":n(227),__esModule:!0}},function(e,t,n){e.exports={"default":n(228),__esModule:!0}},function(e,t,n){e.exports={"default":n(229),__esModule:!0}},function(e,t,n){e.exports={"default":n(230),__esModule:!0}},function(e,t,n){e.exports={"default":n(231),__esModule:!0}},function(e,t,n){e.exports={"default":n(232),__esModule:!0}},function(e,t,n){e.exports={"default":n(233),__esModule:!0}},function(e,t,n){e.exports={"default":n(234),__esModule:!0}},function(e,t,n){e.exports={"default":n(235),__esModule:!0}},function(e,t,n){function i(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}try{var r=n(90)}catch(o){var r=n(90)}var a=/\s+/,s=Object.prototype.toString;e.exports=function(e){return new i(e)},i.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array(),n=r(t,e);return~n||t.push(e),this.el.className=t.join(" "),this},i.prototype.remove=function(e){if("[object RegExp]"==s.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=r(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},i.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},i.prototype.toggle=function(e,t){return this.list?("undefined"!=typeof t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):("undefined"!=typeof t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},i.prototype.array=function(){var e=this.el.getAttribute("class")||"",t=e.replace(/^\s+|\s+$/g,""),n=t.split(a);return""===n[0]&&n.shift(),n},i.prototype.has=i.prototype.contains=function(e){return this.list?this.list.contains(e):!!~r(this.array(),e)}},function(e,t,n){n(44),n(260),e.exports=n(11).Array.from},function(e,t,n){n(68),n(44),e.exports=n(258)},function(e,t,n){n(68),n(44),e.exports=n(259)},function(e,t,n){n(262),e.exports=n(11).Object.assign},function(e,t,n){n(263);var i=n(11).Object;e.exports=function(e,t){return i.create(e,t)}},function(e,t,n){n(264);var i=n(11).Object;e.exports=function(e,t,n){return i.defineProperty(e,t,n)}},function(e,t,n){n(265),e.exports=n(11).Object.keys},function(e,t,n){n(266),e.exports=n(11).Object.setPrototypeOf},function(e,t,n){n(268),n(267),n(269),n(270),e.exports=n(11).Symbol},function(e,t,n){n(44),n(68),e.exports=n(67).f("iterator")},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){e.exports=function(){}},function(e,t,n){var i=n(24),r=n(100),o=n(257);e.exports=function(e){return function(t,n,a){var s,l=i(t),u=r(l.length),c=o(a,u);if(e&&n!=n){for(;u>c;)if(s=l[c++],s!=s)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===n)return e||c||0;return!e&&-1}}},function(e,t,n){"use strict";var i=n(19),r=n(36);e.exports=function(e,t,n){t in e?i.f(e,t,r(0,n)):e[t]=n}},function(e,t,n){var i=n(30),r=n(60),o=n(41);e.exports=function(e){var t=i(e),n=r.f;if(n)for(var a,s=n(e),l=o.f,u=0;s.length>u;)l.call(e,a=s[u++])&&t.push(a);return t}},function(e,t,n){e.exports=n(18).document&&document.documentElement},function(e,t,n){var i=n(29),r=n(12)("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||o[r]===e)}},function(e,t,n){var i=n(54);e.exports=Array.isArray||function(e){return"Array"==i(e)}},function(e,t,n){var i=n(21);e.exports=function(e,t,n,r){try{return r?t(i(n)[0],n[1]):t(n)}catch(o){var a=e["return"];throw void 0!==a&&i(a.call(e)),o}}},function(e,t,n){"use strict";var i=n(59),r=n(36),o=n(61),a={};n(28)(a,n(12)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=i(a,{next:r(1,n)}),o(e,t+" Iterator")}},function(e,t,n){var i=n(12)("iterator"),r=!1;try{var o=[7][i]();o["return"]=function(){r=!0},Array.from(o,function(){throw 2})}catch(a){}e.exports=function(e,t){if(!t&&!r)return!1;var n=!1;try{var o=[7],a=o[i]();a.next=function(){return{done:n=!0}},o[i]=function(){return a},e(o)}catch(s){}return n}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){var i=n(30),r=n(24);e.exports=function(e,t){for(var n,o=r(e),a=i(o),s=a.length,l=0;s>l;)if(o[n=a[l++]]===t)return n}},function(e,t,n){var i=n(43)("meta"),r=n(35),o=n(23),a=n(19).f,s=0,l=Object.isExtensible||function(){return!0},u=!n(27)(function(){return l(Object.preventExtensions({}))}),c=function(e){a(e,i,{value:{i:"O"+ ++s,w:{}}})},d=function(e,t){if(!r(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,i)){if(!l(e))return"F";if(!t)return"E";c(e)}return e[i].i},f=function(e,t){if(!o(e,i)){if(!l(e))return!0;if(!t)return!1;c(e)}return e[i].w},p=function(e){return u&&h.NEED&&l(e)&&!o(e,i)&&c(e),e},h=e.exports={KEY:i,NEED:!1,fastKey:d,getWeak:f,onFreeze:p}},function(e,t,n){"use strict";var i=n(30),r=n(60),o=n(41),a=n(42),s=n(94),l=Object.assign;e.exports=!l||n(27)(function(){var e={},t={},n=Symbol(),i="abcdefghijklmnopqrst";return e[n]=7,i.split("").forEach(function(e){t[e]=e}),7!=l({},e)[n]||Object.keys(l({},t)).join("")!=i})?function(e,t){for(var n=a(e),l=arguments.length,u=1,c=r.f,d=o.f;l>u;)for(var f,p=s(arguments[u++]),h=c?i(p).concat(c(p)):i(p),m=h.length,y=0;m>y;)d.call(p,f=h[y++])&&(n[f]=p[f]);return n}:l},function(e,t,n){var i=n(19),r=n(21),o=n(30);e.exports=n(22)?Object.defineProperties:function(e,t){r(e);for(var n,a=o(t),s=a.length,l=0;s>l;)i.f(e,n=a[l++],t[n]);return e}},function(e,t,n){var i=n(24),r=n(97).f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],s=function(e){try{return r(e)}catch(t){return a.slice()}};e.exports.f=function(e){return a&&"[object Window]"==o.call(e)?s(e):r(i(e))}},function(e,t,n){var i=n(23),r=n(42),o=n(62)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=r(e),i(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},function(e,t,n){var i=n(17),r=n(11),o=n(27);e.exports=function(e,t){var n=(r.Object||{})[e]||Object[e],a={};a[e]=t(n),i(i.S+i.F*o(function(){n(1)}),"Object",a)}},function(e,t,n){var i=n(35),r=n(21),o=function(e,t){if(r(e),!i(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,i){try{i=n(55)(Function.call,n(96).f(Object.prototype,"__proto__").set,2),i(e,[]),t=!(e instanceof Array)}catch(r){t=!0}return function(e,n){return o(e,n),t?e.__proto__=n:i(e,n),e}}({},!1):void 0),check:o}},function(e,t,n){var i=n(64),r=n(56);e.exports=function(e){return function(t,n){var o,a,s=String(r(t)),l=i(n),u=s.length;return l<0||l>=u?e?"":void 0:(o=s.charCodeAt(l),o<55296||o>56319||l+1===u||(a=s.charCodeAt(l+1))<56320||a>57343?e?s.charAt(l):o:e?s.slice(l,l+2):(o-55296<<10)+(a-56320)+65536)}}},function(e,t,n){var i=n(64),r=Math.max,o=Math.min;e.exports=function(e,t){return e=i(e),e<0?r(e+t,0):o(e,t)}},function(e,t,n){var i=n(21),r=n(101);e.exports=n(11).getIterator=function(e){var t=r(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return i(t.call(e))}},function(e,t,n){var i=n(91),r=n(12)("iterator"),o=n(29);e.exports=n(11).isIterable=function(e){var t=Object(e);return void 0!==t[r]||"@@iterator"in t||o.hasOwnProperty(i(t))}},function(e,t,n){"use strict";var i=n(55),r=n(17),o=n(42),a=n(244),s=n(242),l=n(100),u=n(239),c=n(101);r(r.S+r.F*!n(246)(function(e){Array.from(e)}),"Array",{from:function(e){var t,n,r,d,f=o(e),p="function"==typeof this?this:Array,h=arguments.length,m=h>1?arguments[1]:void 0,y=void 0!==m,v=0,g=c(f);if(y&&(m=i(m,h>2?arguments[2]:void 0,2)),void 0==g||p==Array&&s(g))for(t=l(f.length),n=new p(t);t>v;v++)u(n,v,y?m(f[v],v):f[v]);else for(d=g.call(f),n=new p;!(r=d.next()).done;v++)u(n,v,y?a(d,m,[r.value,v],!0):r.value);return n.length=v,n}})},function(e,t,n){"use strict";var i=n(237),r=n(247),o=n(29),a=n(24);e.exports=n(95)(Array,"Array",function(e,t){this._t=a(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,r(1)):"keys"==t?r(0,n):"values"==t?r(0,e[n]):r(0,[n,e[n]])},"values"),o.Arguments=o.Array,i("keys"),i("values"),i("entries")},function(e,t,n){var i=n(17);i(i.S+i.F,"Object",{assign:n(250)})},function(e,t,n){var i=n(17);i(i.S,"Object",{create:n(59)})},function(e,t,n){var i=n(17);i(i.S+i.F*!n(22),"Object",{defineProperty:n(19).f})},function(e,t,n){var i=n(42),r=n(30);n(254)("keys",function(){return function(e){return r(i(e))}})},function(e,t,n){var i=n(17);i(i.S,"Object",{setPrototypeOf:n(255).set})},function(e,t){},function(e,t,n){"use strict";var i=n(18),r=n(23),o=n(22),a=n(17),s=n(99),l=n(249).KEY,u=n(27),c=n(63),d=n(61),f=n(43),p=n(12),h=n(67),m=n(66),y=n(248),v=n(240),g=n(243),b=n(21),M=n(24),T=n(65),x=n(36),C=n(59),_=n(252),w=n(96),S=n(19),N=n(30),E=w.f,P=S.f,D=_.f,I=i.Symbol,L=i.JSON,j=L&&L.stringify,k="prototype",O=p("_hidden"),A=p("toPrimitive"),z={}.propertyIsEnumerable,R=c("symbol-registry"),W=c("symbols"),Y=c("op-symbols"),H=Object[k],B="function"==typeof I,U=i.QObject,F=!U||!U[k]||!U[k].findChild,V=o&&u(function(){return 7!=C(P({},"a",{get:function(){return P(this,"a",{value:7}).a}})).a})?function(e,t,n){var i=E(H,t);i&&delete H[t],P(e,t,n),i&&e!==H&&P(H,t,i)}:P,Q=function(e){var t=W[e]=C(I[k]);return t._k=e,t},G=B&&"symbol"==typeof I.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof I},Z=function(e,t,n){return e===H&&Z(Y,t,n),b(e),t=T(t,!0),b(n),r(W,t)?(n.enumerable?(r(e,O)&&e[O][t]&&(e[O][t]=!1),n=C(n,{enumerable:x(0,!1)})):(r(e,O)||P(e,O,x(1,{})),e[O][t]=!0),V(e,t,n)):P(e,t,n)},X=function(e,t){b(e);for(var n,i=v(t=M(t)),r=0,o=i.length;o>r;)Z(e,n=i[r++],t[n]);return e},J=function(e,t){return void 0===t?C(e):X(C(e),t)},K=function(e){var t=z.call(this,e=T(e,!0));return!(this===H&&r(W,e)&&!r(Y,e))&&(!(t||!r(this,e)||!r(W,e)||r(this,O)&&this[O][e])||t)},q=function(e,t){if(e=M(e),t=T(t,!0),e!==H||!r(W,t)||r(Y,t)){var n=E(e,t);return!n||!r(W,t)||r(e,O)&&e[O][t]||(n.enumerable=!0),n}},$=function(e){for(var t,n=D(M(e)),i=[],o=0;n.length>o;)r(W,t=n[o++])||t==O||t==l||i.push(t);return i},ee=function(e){for(var t,n=e===H,i=D(n?Y:M(e)),o=[],a=0;i.length>a;)!r(W,t=i[a++])||n&&!r(H,t)||o.push(W[t]);return o};B||(I=function(){if(this instanceof I)throw TypeError("Symbol is not a constructor!");var e=f(arguments.length>0?arguments[0]:void 0),t=function(n){this===H&&t.call(Y,n),r(this,O)&&r(this[O],e)&&(this[O][e]=!1),V(this,e,x(1,n))};return o&&F&&V(H,e,{configurable:!0,set:t}),Q(e)},s(I[k],"toString",function(){return this._k}),w.f=q,S.f=Z,n(97).f=_.f=$,n(41).f=K,n(60).f=ee,o&&!n(58)&&s(H,"propertyIsEnumerable",K,!0),h.f=function(e){return Q(p(e))}),a(a.G+a.W+a.F*!B,{Symbol:I});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ne=0;te.length>ne;)p(te[ne++]);for(var te=N(p.store),ne=0;te.length>ne;)m(te[ne++]);a(a.S+a.F*!B,"Symbol",{"for":function(e){return r(R,e+="")?R[e]:R[e]=I(e)},keyFor:function(e){if(G(e))return y(R,e);throw TypeError(e+" is not a symbol!")},useSetter:function(){F=!0},useSimple:function(){F=!1}}),a(a.S+a.F*!B,"Object",{create:J,defineProperty:Z,defineProperties:X,getOwnPropertyDescriptor:q,getOwnPropertyNames:$,getOwnPropertySymbols:ee}),L&&a(a.S+a.F*(!B||u(function(){var e=I();return"[null]"!=j([e])||"{}"!=j({a:e})||"{}"!=j(Object(e))})),"JSON",{stringify:function(e){if(void 0!==e&&!G(e)){for(var t,n,i=[e],r=1;arguments.length>r;)i.push(arguments[r++]);return t=i[1],"function"==typeof t&&(n=t),!n&&g(t)||(t=function(e,t){if(n&&(t=n.call(this,e,t)),!G(t))return t}),i[1]=t,j.apply(L,i)}}}),I[k][A]||n(28)(I[k],A,I[k].valueOf),d(I,"Symbol"),d(Math,"Math",!0),d(i.JSON,"JSON",!0)},function(e,t,n){n(66)("asyncIterator")},function(e,t,n){n(66)("observable")},function(e,t){"use strict";function n(){var e=document.createElement("div"),t=e.style;"AnimationEvent"in window||delete o.animationend.animation,"TransitionEvent"in window||delete o.transitionend.transition;for(var n in o)if(o.hasOwnProperty(n)){var i=o[n];for(var r in i)if(r in t){a.push(i[r]);break}}}function i(e,t,n){e.addEventListener(t,n,!1)}function r(e,t,n){e.removeEventListener(t,n,!1)}Object.defineProperty(t,"__esModule",{value:!0});var o={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},a=[];"undefined"!=typeof window&&"undefined"!=typeof document&&n();var s={addEndEventListener:function(e,t){return 0===a.length?void window.setTimeout(t,0):void a.forEach(function(n){i(e,n,t)})},endEvents:a,removeEndEventListener:function(e,t){0!==a.length&&a.forEach(function(n){r(e,n,t)})}};t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n,i){var r=a["default"].clone(e),o={width:t.width,height:t.height};return i.adjustX&&r.left<n.left&&(r.left=n.left),i.resizeWidth&&r.left>=n.left&&r.left+o.width>n.right&&(o.width-=r.left+o.width-n.right),i.adjustX&&r.left+o.width>n.right&&(r.left=Math.max(n.right-o.width,n.left)),i.adjustY&&r.top<n.top&&(r.top=n.top),i.resizeHeight&&r.top>=n.top&&r.top+o.height>n.bottom&&(o.height-=r.top+o.height-n.bottom),i.adjustY&&r.top+o.height>n.bottom&&(r.top=Math.max(n.bottom-o.height,n.top)),a["default"].mix(r,o)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(37),a=i(o);t["default"]=r,e.exports=t["default"]},function(e,t){"use strict";function n(e,t){var n=t.charAt(0),i=t.charAt(1),r=e.width,o=e.height,a=void 0,s=void 0;return a=e.left,s=e.top,"c"===n?s+=o/2:"b"===n&&(s+=o),"c"===i?a+=r/2:"r"===i&&(a+=r),{left:a,top:s}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n,i,r){var o=void 0,s=void 0,l=void 0,u=void 0;return o={left:e.left,top:e.top},l=(0,a["default"])(t,n[1]),u=(0,a["default"])(e,n[0]),s=[u.left-l.left,u.top-l.top],{left:o.left-s[0]+i[0]-r[0],top:o.top-s[1]+i[1]-r[1]}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(273),a=i(o);t["default"]=r,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){var t=void 0,n=void 0,i=void 0;if(a["default"].isWindow(e)||9===e.nodeType){var r=a["default"].getWindow(e);t={left:a["default"].getWindowScrollLeft(r),top:a["default"].getWindowScrollTop(r)},n=a["default"].viewportWidth(r),i=a["default"].viewportHeight(r)}else t=a["default"].offset(e),n=a["default"].outerWidth(e),i=a["default"].outerHeight(e);return t.width=n,t.height=i,t}Object.defineProperty(t,"__esModule",{value:!0});var o=n(37),a=i(o);t["default"]=r,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){for(var t={left:0,right:1/0,top:0,bottom:1/0},n=(0,l["default"])(e),i=void 0,r=void 0,o=void 0,s=e.ownerDocument,u=s.defaultView||s.parentWindow,c=s.body,d=s.documentElement;n;){if(navigator.userAgent.indexOf("MSIE")!==-1&&0===n.clientWidth||n===c||n===d||"visible"===a["default"].css(n,"overflow")){if(n===c||n===d)break}else{var f=a["default"].offset(n);f.left+=n.clientLeft,f.top+=n.clientTop,t.top=Math.max(t.top,f.top),t.right=Math.min(t.right,f.left+n.clientWidth),
t.bottom=Math.min(t.bottom,f.top+n.clientHeight),t.left=Math.max(t.left,f.left)}n=(0,l["default"])(n)}return i=a["default"].getWindowScrollLeft(u),r=a["default"].getWindowScrollTop(u),t.left=Math.max(t.left,i),t.top=Math.max(t.top,r),o={width:a["default"].viewportWidth(u),height:a["default"].viewportHeight(u)},t.right=Math.min(t.right,i+o.width),t.bottom=Math.min(t.bottom,r+o.height),t.top>=0&&t.left>=0&&t.bottom>t.top&&t.right>t.left?t:null}Object.defineProperty(t,"__esModule",{value:!0});var o=n(37),a=i(o),s=n(103),l=i(s);t["default"]=r,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n){return e.left<n.left||e.left+t.width>n.right}function o(e,t,n){return e.top<n.top||e.top+t.height>n.bottom}function a(e,t,n){return e.left>n.right||e.left+t.width<n.left}function s(e,t,n){return e.top>n.bottom||e.top+t.height<n.top}function l(e,t,n){var i=[];return h["default"].each(e,function(e){i.push(e.replace(t,function(e){return n[e]}))}),i}function u(e,t){return e[t]=-e[t],e}function c(e,t){var n=void 0;return n=/%$/.test(e)?parseInt(e.substring(0,e.length-1),10)/100*t:parseInt(e,10),n||0}function d(e,t){e[0]=c(e[0],t.width),e[1]=c(e[1],t.height)}function f(e,t,n){var i=n.points,c=n.offset||[0,0],f=n.targetOffset||[0,0],p=n.overflow,m=n.target||t,y=n.source||e;c=[].concat(c),f=[].concat(f),p=p||{};var v={},b=0,T=(0,g["default"])(y),C=(0,x["default"])(y),w=(0,x["default"])(m);d(c,C),d(f,w);var S=(0,_["default"])(C,w,i,c,f),N=h["default"].merge(C,S);if(T&&(p.adjustX||p.adjustY)){if(p.adjustX&&r(S,C,T)){var E=l(i,/[lr]/gi,{l:"r",r:"l"}),P=u(c,0),D=u(f,0),I=(0,_["default"])(C,w,E,P,D);a(I,C,T)||(b=1,i=E,c=P,f=D)}if(p.adjustY&&o(S,C,T)){var L=l(i,/[tb]/gi,{t:"b",b:"t"}),j=u(c,1),k=u(f,1),O=(0,_["default"])(C,w,L,j,k);s(O,C,T)||(b=1,i=L,c=j,f=k)}b&&(S=(0,_["default"])(C,w,i,c,f),h["default"].mix(N,S)),v.adjustX=p.adjustX&&r(S,C,T),v.adjustY=p.adjustY&&o(S,C,T),(v.adjustX||v.adjustY)&&(N=(0,M["default"])(S,C,T,v))}return N.width!==C.width&&h["default"].css(y,"width",h["default"].width(y)+N.width-C.width),N.height!==C.height&&h["default"].css(y,"height",h["default"].height(y)+N.height-C.height),h["default"].offset(y,{left:N.left,top:N.top},{useCssRight:n.useCssRight,useCssBottom:n.useCssBottom,useCssTransform:n.useCssTransform}),{points:i,offset:c,targetOffset:f,overflow:v}}Object.defineProperty(t,"__esModule",{value:!0});var p=n(37),h=i(p),m=n(103),y=i(m),v=n(276),g=i(v),b=n(272),M=i(b),T=n(275),x=i(T),C=n(274),_=i(C);f.__getOffsetParent=y["default"],f.__getVisibleRectForElement=g["default"],t["default"]=f,e.exports=t["default"]},function(e,t){"use strict";function n(){if(void 0!==c)return c;c="";var e=document.createElement("p").style,t="Transform";for(var n in d)n+t in e&&(c=n);return c}function i(){return n()?n()+"TransitionProperty":"transitionProperty"}function r(){return n()?n()+"Transform":"transform"}function o(e,t){var n=i();n&&(e.style[n]=t,"transitionProperty"!==n&&(e.style.transitionProperty=t))}function a(e,t){var n=r();n&&(e.style[n]=t,"transform"!==n&&(e.style.transform=t))}function s(e){return e.style.transitionProperty||e.style[i()]}function l(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("transform")||t.getPropertyValue(r());if(n&&"none"!==n){var i=n.replace(/[^0-9\-.,]/g,"").split(",");return{x:parseFloat(i[12]||i[4],0),y:parseFloat(i[13]||i[5],0)}}return{x:0,y:0}}function u(e,t){var n=window.getComputedStyle(e,null),i=n.getPropertyValue("transform")||n.getPropertyValue(r());if(i&&"none"!==i){var o=void 0,s=i.match(f);if(s)s=s[1],o=s.split(",").map(function(e){return parseFloat(e,10)}),o[4]=t.x,o[5]=t.y,a(e,"matrix("+o.join(",")+")");else{var l=i.match(p)[1];o=l.split(",").map(function(e){return parseFloat(e,10)}),o[12]=t.x,o[13]=t.y,a(e,"matrix3d("+o.join(",")+")")}}else a(e,"translateX("+t.x+"px) translateY("+t.y+"px) translateZ(0)")}Object.defineProperty(t,"__esModule",{value:!0}),t.getTransformName=r,t.setTransitionProperty=o,t.getTransitionProperty=s,t.getTransformXY=l,t.setTransformXY=u;var c=void 0,d={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"},f=/matrix\((.*)\)/,p=/matrix3d\((.*)\)/},function(e,t,n){var i;/*!
Copyright (c) 2015 Jed Watson.
Based on code that is Copyright 2013-2015, Facebook, Inc.
All rights reserved.
*/
!function(){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen};i=function(){return o}.call(t,n,t,e),!(void 0!==i&&(e.exports=i))}()},function(e,t){},280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,function(e,t){"use strict";function n(e){return function(){return e}}var i=function(){};i.thatReturns=n,i.thatReturnsFalse=n(!1),i.thatReturnsTrue=n(!0),i.thatReturnsNull=n(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(e){return e},e.exports=i},function(e,t,n){"use strict";function i(e){if(Array.isArray(e))return 0===e.length;if("object"==typeof e){if(e){r(e)&&void 0!==e.size?o(!1):void 0;for(var t in e)return!1}return!0}return!e}function r(e){return"undefined"!=typeof Symbol&&e[Symbol.iterator]}var o=n(104);e.exports=i},function(e,t){/*!
* for-in <https://github.com/jonschlinkert/for-in>
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*/
"use strict";e.exports=function(e,t,n){for(var i in e)if(t.call(n,e[i],i,e)===!1)break}},function(e,t,n){/*!
* for-own <https://github.com/jonschlinkert/for-own>
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*/
"use strict";var i=n(327),r=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){i(e,function(i,o){if(r.call(e,o))return t.call(n,e[o],o,e)})}},function(e,t,n){var i;/*! Hammer.JS - v2.0.7 - 2016-04-22
* http://hammerjs.github.io/
*
* Copyright (c) 2016 Jorik Tangelder;
* Licensed under the MIT license */
!function(r,o,a,s){"use strict";function l(e,t,n){return setTimeout(p(e,n),t)}function u(e,t,n){return!!Array.isArray(e)&&(c(e,n[t],n),!0)}function c(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==s)for(i=0;i<e.length;)t.call(n,e[i],i,e),i++;else for(i in e)e.hasOwnProperty(i)&&t.call(n,e[i],i,e)}function d(e,t,n){var i="DEPRECATED METHOD: "+t+"\n"+n+" AT \n";return function(){var t=new Error("get-stack-trace"),n=t&&t.stack?t.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=r.console&&(r.console.warn||r.console.log);return o&&o.call(r.console,i,n),e.apply(this,arguments)}}function f(e,t,n){var i,r=t.prototype;i=e.prototype=Object.create(r),i.constructor=e,i._super=r,n&&me(i,n)}function p(e,t){return function(){return e.apply(t,arguments)}}function h(e,t){return typeof e==ge?e.apply(t?t[0]||s:s,t):e}function m(e,t){return e===s?t:e}function y(e,t,n){c(M(t),function(t){e.addEventListener(t,n,!1)})}function v(e,t,n){c(M(t),function(t){e.removeEventListener(t,n,!1)})}function g(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function b(e,t){return e.indexOf(t)>-1}function M(e){return e.trim().split(/\s+/g)}function T(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var i=0;i<e.length;){if(n&&e[i][n]==t||!n&&e[i]===t)return i;i++}return-1}function x(e){return Array.prototype.slice.call(e,0)}function C(e,t,n){for(var i=[],r=[],o=0;o<e.length;){var a=t?e[o][t]:e[o];T(r,a)<0&&i.push(e[o]),r[o]=a,o++}return n&&(i=t?i.sort(function(e,n){return e[t]>n[t]}):i.sort()),i}function _(e,t){for(var n,i,r=t[0].toUpperCase()+t.slice(1),o=0;o<ye.length;){if(n=ye[o],i=n?n+r:t,i in e)return i;o++}return s}function w(){return _e++}function S(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow||r}function N(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){h(e.options.enable,[e])&&n.handler(t)},this.init()}function E(e){var t,n=e.options.inputClass;return new(t=n?n:Ne?B:Ee?V:Se?G:H)(e,P)}function P(e,t,n){var i=n.pointers.length,r=n.changedPointers.length,o=t&ke&&i-r===0,a=t&(Ae|ze)&&i-r===0;n.isFirst=!!o,n.isFinal=!!a,o&&(e.session={}),n.eventType=t,D(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function D(e,t){var n=e.session,i=t.pointers,r=i.length;n.firstInput||(n.firstInput=j(t)),r>1&&!n.firstMultiple?n.firstMultiple=j(t):1===r&&(n.firstMultiple=!1);var o=n.firstInput,a=n.firstMultiple,s=a?a.center:o.center,l=t.center=k(i);t.timeStamp=Te(),t.deltaTime=t.timeStamp-o.timeStamp,t.angle=R(s,l),t.distance=z(s,l),I(n,t),t.offsetDirection=A(t.deltaX,t.deltaY);var u=O(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=u.x,t.overallVelocityY=u.y,t.overallVelocity=Me(u.x)>Me(u.y)?u.x:u.y,t.scale=a?Y(a.pointers,i):1,t.rotation=a?W(a.pointers,i):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,L(n,t);var c=e.element;g(t.srcEvent.target,c)&&(c=t.srcEvent.target),t.target=c}function I(e,t){var n=t.center,i=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};t.eventType!==ke&&o.eventType!==Ae||(r=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=r.x+(n.x-i.x),t.deltaY=r.y+(n.y-i.y)}function L(e,t){var n,i,r,o,a=e.lastInterval||t,l=t.timeStamp-a.timeStamp;if(t.eventType!=ze&&(l>je||a.velocity===s)){var u=t.deltaX-a.deltaX,c=t.deltaY-a.deltaY,d=O(l,u,c);i=d.x,r=d.y,n=Me(d.x)>Me(d.y)?d.x:d.y,o=A(u,c),e.lastInterval=t}else n=a.velocity,i=a.velocityX,r=a.velocityY,o=a.direction;t.velocity=n,t.velocityX=i,t.velocityY=r,t.direction=o}function j(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:be(e.pointers[n].clientX),clientY:be(e.pointers[n].clientY)},n++;return{timeStamp:Te(),pointers:t,center:k(t),deltaX:e.deltaX,deltaY:e.deltaY}}function k(e){var t=e.length;if(1===t)return{x:be(e[0].clientX),y:be(e[0].clientY)};for(var n=0,i=0,r=0;r<t;)n+=e[r].clientX,i+=e[r].clientY,r++;return{x:be(n/t),y:be(i/t)}}function O(e,t,n){return{x:t/e||0,y:n/e||0}}function A(e,t){return e===t?Re:Me(e)>=Me(t)?e<0?We:Ye:t<0?He:Be}function z(e,t,n){n||(n=Qe);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return Math.sqrt(i*i+r*r)}function R(e,t,n){n||(n=Qe);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return 180*Math.atan2(r,i)/Math.PI}function W(e,t){return R(t[1],t[0],Ge)+R(e[1],e[0],Ge)}function Y(e,t){return z(t[0],t[1],Ge)/z(e[0],e[1],Ge)}function H(){this.evEl=Xe,this.evWin=Je,this.pressed=!1,N.apply(this,arguments)}function B(){this.evEl=$e,this.evWin=et,N.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function U(){this.evTarget=nt,this.evWin=it,this.started=!1,N.apply(this,arguments)}function F(e,t){var n=x(e.touches),i=x(e.changedTouches);return t&(Ae|ze)&&(n=C(n.concat(i),"identifier",!0)),[n,i]}function V(){this.evTarget=ot,this.targetIds={},N.apply(this,arguments)}function Q(e,t){var n=x(e.touches),i=this.targetIds;if(t&(ke|Oe)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,a=x(e.changedTouches),s=[],l=this.target;if(o=n.filter(function(e){return g(e.target,l)}),t===ke)for(r=0;r<o.length;)i[o[r].identifier]=!0,r++;for(r=0;r<a.length;)i[a[r].identifier]&&s.push(a[r]),t&(Ae|ze)&&delete i[a[r].identifier],r++;return s.length?[C(o.concat(s),"identifier",!0),s]:void 0}function G(){N.apply(this,arguments);var e=p(this.handler,this);this.touch=new V(this.manager,e),this.mouse=new H(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function Z(e,t){e&ke?(this.primaryTouch=t.changedPointers[0].identifier,X.call(this,t)):e&(Ae|ze)&&X.call(this,t)}function X(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var i=this.lastTouches,r=function(){var e=i.indexOf(n);e>-1&&i.splice(e,1)};setTimeout(r,at)}}function J(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(t-r.x),a=Math.abs(n-r.y);if(o<=st&&a<=st)return!0}return!1}function K(e,t){this.manager=e,this.set(t)}function q(e){if(b(e,pt))return pt;var t=b(e,ht),n=b(e,mt);return t&&n?pt:t||n?t?ht:mt:b(e,ft)?ft:dt}function $(){if(!ut)return!1;var e={},t=r.CSS&&r.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(n){e[n]=!t||r.CSS.supports("touch-action",n)}),e}function ee(e){this.options=me({},this.defaults,e||{}),this.id=w(),this.manager=null,this.options.enable=m(this.options.enable,!0),this.state=vt,this.simultaneous={},this.requireFail=[]}function te(e){return e&xt?"cancel":e&Mt?"end":e&bt?"move":e>?"start":""}function ne(e){return e==Be?"down":e==He?"up":e==We?"left":e==Ye?"right":""}function ie(e,t){var n=t.manager;return n?n.get(e):e}function re(){ee.apply(this,arguments)}function oe(){re.apply(this,arguments),this.pX=null,this.pY=null}function ae(){re.apply(this,arguments)}function se(){ee.apply(this,arguments),this._timer=null,this._input=null}function le(){re.apply(this,arguments)}function ue(){re.apply(this,arguments)}function ce(){ee.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function de(e,t){return t=t||{},t.recognizers=m(t.recognizers,de.defaults.preset),new fe(e,t)}function fe(e,t){this.options=me({},de.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=E(this),this.touchAction=new K(this,this.options.touchAction),pe(this,!0),c(this.options.recognizers,function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])},this)}function pe(e,t){var n=e.element;if(n.style){var i;c(e.options.cssProps,function(r,o){i=_(n.style,o),t?(e.oldCssProps[i]=n.style[i],n.style[i]=r):n.style[i]=e.oldCssProps[i]||""}),t||(e.oldCssProps={})}}function he(e,t){var n=o.createEvent("Event");n.initEvent(e,!0,!0),n.gesture=t,t.target.dispatchEvent(n)}var me,ye=["","webkit","Moz","MS","ms","o"],ve=o.createElement("div"),ge="function",be=Math.round,Me=Math.abs,Te=Date.now;me="function"!=typeof Object.assign?function(e){if(e===s||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==s&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}return t}:Object.assign;var xe=d(function(e,t,n){for(var i=Object.keys(t),r=0;r<i.length;)(!n||n&&e[i[r]]===s)&&(e[i[r]]=t[i[r]]),r++;return e},"extend","Use `assign`."),Ce=d(function(e,t){return xe(e,t,!0)},"merge","Use `assign`."),_e=1,we=/mobile|tablet|ip(ad|hone|od)|android/i,Se="ontouchstart"in r,Ne=_(r,"PointerEvent")!==s,Ee=Se&&we.test(navigator.userAgent),Pe="touch",De="pen",Ie="mouse",Le="kinect",je=25,ke=1,Oe=2,Ae=4,ze=8,Re=1,We=2,Ye=4,He=8,Be=16,Ue=We|Ye,Fe=He|Be,Ve=Ue|Fe,Qe=["x","y"],Ge=["clientX","clientY"];N.prototype={handler:function(){},init:function(){this.evEl&&y(this.element,this.evEl,this.domHandler),this.evTarget&&y(this.target,this.evTarget,this.domHandler),this.evWin&&y(S(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&v(this.element,this.evEl,this.domHandler),this.evTarget&&v(this.target,this.evTarget,this.domHandler),this.evWin&&v(S(this.element),this.evWin,this.domHandler)}};var Ze={mousedown:ke,mousemove:Oe,mouseup:Ae},Xe="mousedown",Je="mousemove mouseup";f(H,N,{handler:function(e){var t=Ze[e.type];t&ke&&0===e.button&&(this.pressed=!0),t&Oe&&1!==e.which&&(t=Ae),this.pressed&&(t&Ae&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:Ie,srcEvent:e}))}});var Ke={pointerdown:ke,pointermove:Oe,pointerup:Ae,pointercancel:ze,pointerout:ze},qe={2:Pe,3:De,4:Ie,5:Le},$e="pointerdown",et="pointermove pointerup pointercancel";r.MSPointerEvent&&!r.PointerEvent&&($e="MSPointerDown",et="MSPointerMove MSPointerUp MSPointerCancel"),f(B,N,{handler:function(e){var t=this.store,n=!1,i=e.type.toLowerCase().replace("ms",""),r=Ke[i],o=qe[e.pointerType]||e.pointerType,a=o==Pe,s=T(t,e.pointerId,"pointerId");r&ke&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):r&(Ae|ze)&&(n=!0),s<0||(t[s]=e,this.callback(this.manager,r,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),n&&t.splice(s,1))}});var tt={touchstart:ke,touchmove:Oe,touchend:Ae,touchcancel:ze},nt="touchstart",it="touchstart touchmove touchend touchcancel";f(U,N,{handler:function(e){var t=tt[e.type];if(t===ke&&(this.started=!0),this.started){var n=F.call(this,e,t);t&(Ae|ze)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:Pe,srcEvent:e})}}});var rt={touchstart:ke,touchmove:Oe,touchend:Ae,touchcancel:ze},ot="touchstart touchmove touchend touchcancel";f(V,N,{handler:function(e){var t=rt[e.type],n=Q.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:Pe,srcEvent:e})}});var at=2500,st=25;f(G,N,{handler:function(e,t,n){var i=n.pointerType==Pe,r=n.pointerType==Ie;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)Z.call(this,t,n);else if(r&&J.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var lt=_(ve.style,"touchAction"),ut=lt!==s,ct="compute",dt="auto",ft="manipulation",pt="none",ht="pan-x",mt="pan-y",yt=$();K.prototype={set:function(e){e==ct&&(e=this.compute()),ut&&this.manager.element.style&&yt[e]&&(this.manager.element.style[lt]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return c(this.manager.recognizers,function(t){h(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),q(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)return void t.preventDefault();var i=this.actions,r=b(i,pt)&&!yt[pt],o=b(i,mt)&&!yt[mt],a=b(i,ht)&&!yt[ht];if(r){var s=1===e.pointers.length,l=e.distance<2,u=e.deltaTime<250;if(s&&l&&u)return}return a&&o?void 0:r||o&&n&Ue||a&&n&Fe?this.preventSrc(t):void 0},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var vt=1,gt=2,bt=4,Mt=8,Tt=Mt,xt=16,Ct=32;ee.prototype={defaults:{},set:function(e){return me(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(u(e,"recognizeWith",this))return this;var t=this.simultaneous;return e=ie(e,this),t[e.id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return u(e,"dropRecognizeWith",this)?this:(e=ie(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(u(e,"requireFailure",this))return this;var t=this.requireFail;return e=ie(e,this),T(t,e)===-1&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(u(e,"dropRequireFailure",this))return this;e=ie(e,this);var t=T(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){function t(t){n.manager.emit(t,e)}var n=this,i=this.state;i<Mt&&t(n.options.event+te(i)),t(n.options.event),e.additionalEvent&&t(e.additionalEvent),i>=Mt&&t(n.options.event+te(i))},tryEmit:function(e){return this.canEmit()?this.emit(e):void(this.state=Ct)},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(Ct|vt)))return!1;e++}return!0},recognize:function(e){var t=me({},e);return h(this.options.enable,[this,t])?(this.state&(Tt|xt|Ct)&&(this.state=vt),this.state=this.process(t),void(this.state&(gt|bt|Mt|xt)&&this.tryEmit(t))):(this.reset(),void(this.state=Ct))},process:function(e){},getTouchAction:function(){},reset:function(){}},f(re,ee,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,i=t&(gt|bt),r=this.attrTest(e);return i&&(n&ze||!r)?t|xt:i||r?n&Ae?t|Mt:t>?t|bt:gt:Ct}}),f(oe,re,{defaults:{event:"pan",threshold:10,pointers:1,direction:Ve},getTouchAction:function(){var e=this.options.direction,t=[];return e&Ue&&t.push(mt),e&Fe&&t.push(ht),t},directionTest:function(e){var t=this.options,n=!0,i=e.distance,r=e.direction,o=e.deltaX,a=e.deltaY;return r&t.direction||(t.direction&Ue?(r=0===o?Re:o<0?We:Ye,n=o!=this.pX,i=Math.abs(e.deltaX)):(r=0===a?Re:a<0?He:Be,n=a!=this.pY,i=Math.abs(e.deltaY))),e.direction=r,n&&i>t.threshold&&r&t.direction},attrTest:function(e){return re.prototype.attrTest.call(this,e)&&(this.state>||!(this.state>)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=ne(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),f(ae,re,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[pt]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state>)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),f(se,ee,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[dt]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime>t.time;if(this._input=e,!i||!n||e.eventType&(Ae|ze)&&!r)this.reset();else if(e.eventType&ke)this.reset(),this._timer=l(function(){this.state=Tt,this.tryEmit()},t.time,this);else if(e.eventType&Ae)return Tt;return Ct},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===Tt&&(e&&e.eventType&Ae?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=Te(),this.manager.emit(this.options.event,this._input)))}}),f(le,re,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[pt]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state>)}}),f(ue,re,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Ue|Fe,pointers:1},getTouchAction:function(){return oe.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(Ue|Fe)?t=e.overallVelocity:n&Ue?t=e.overallVelocityX:n&Fe&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&Me(t)>this.options.velocity&&e.eventType&Ae},emit:function(e){var t=ne(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),f(ce,ee,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ft]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime<t.time;if(this.reset(),e.eventType&ke&&0===this.count)return this.failTimeout();if(i&&r&&n){if(e.eventType!=Ae)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||z(this.pCenter,e.center)<t.posThreshold;this.pTime=e.timeStamp,this.pCenter=e.center,a&&o?this.count+=1:this.count=1,this._input=e;var s=this.count%t.taps;if(0===s)return this.hasRequireFailures()?(this._timer=l(function(){this.state=Tt,this.tryEmit()},t.interval,this),gt):Tt}return Ct},failTimeout:function(){return this._timer=l(function(){this.state=Ct},this.options.interval,this),Ct},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Tt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),de.VERSION="2.0.7",de.defaults={domEvents:!1,touchAction:ct,enable:!0,inputTarget:null,inputClass:null,preset:[[le,{enable:!1}],[ae,{enable:!1},["rotate"]],[ue,{direction:Ue}],[oe,{direction:Ue},["swipe"]],[ce],[ce,{event:"doubletap",taps:2},["tap"]],[se]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var _t=1,wt=2;fe.prototype={set:function(e){return me(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?wt:_t},recognize:function(e){var t=this.session;if(!t.stopped){this.touchAction.preventDefaults(e);var n,i=this.recognizers,r=t.curRecognizer;(!r||r&&r.state&Tt)&&(r=t.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],t.stopped===wt||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(e),!r&&n.state&(gt|bt|Mt)&&(r=t.curRecognizer=n),o++}},get:function(e){if(e instanceof ee)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(u(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(u(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=T(t,e);n!==-1&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==s&&t!==s){var n=this.handlers;return c(M(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==s){var n=this.handlers;return c(M(e),function(e){t?n[e]&&n[e].splice(T(n[e],t),1):delete n[e]}),this}},emit:function(e,t){this.options.domEvents&&he(e,t);var n=this.handlers[e]&&this.handlers[e].slice();if(n&&n.length){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var i=0;i<n.length;)n[i](t),i++}},destroy:function(){this.element&&pe(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},me(de,{INPUT_START:ke,INPUT_MOVE:Oe,INPUT_END:Ae,INPUT_CANCEL:ze,STATE_POSSIBLE:vt,STATE_BEGAN:gt,STATE_CHANGED:bt,STATE_ENDED:Mt,STATE_RECOGNIZED:Tt,STATE_CANCELLED:xt,STATE_FAILED:Ct,DIRECTION_NONE:Re,DIRECTION_LEFT:We,DIRECTION_RIGHT:Ye,DIRECTION_UP:He,DIRECTION_DOWN:Be,DIRECTION_HORIZONTAL:Ue,DIRECTION_VERTICAL:Fe,DIRECTION_ALL:Ve,Manager:fe,Input:N,TouchAction:K,TouchInput:V,MouseInput:H,PointerEventInput:B,TouchMouseInput:G,SingleTouchInput:U,Recognizer:ee,AttrRecognizer:re,Tap:ce,Pan:oe,Swipe:ue,Pinch:ae,Rotate:le,Press:se,on:y,off:v,each:c,merge:Ce,extend:xe,assign:me,inherit:f,bindFn:p,prefixed:_});var St="undefined"!=typeof r?r:"undefined"!=typeof self?self:{};St.Hammer=de,i=function(){return de}.call(t,n,t,e),!(i!==s&&(e.exports=i))}(window,document,"Hammer")},function(e,t){/*!
* is-extendable <https://github.com/jonschlinkert/is-extendable>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
"use strict";e.exports=function(e){return"undefined"!=typeof e&&null!==e&&("object"==typeof e||"function"==typeof e)}},function(e,t,n){!function(t,n){e.exports=n()}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}({0:/*!*****************!*\
!*** multi lib ***!
\*****************/
function(e,t,n){e.exports=n(/*! ./index.js */169)},5:/*!******************************!*\
!*** ./~/process/browser.js ***!
\******************************/
function(e,t){function n(){u=!1,a.length?l=a.concat(l):c=-1,l.length&&i()}function i(){if(!u){var e=setTimeout(n);u=!0;for(var t=l.length;t;){for(a=l,l=[];++c<t;)a&&a[c].run();c=-1,t=l.length}a=null,u=!1,clearTimeout(e)}}function r(e,t){this.fun=e,this.array=t}function o(){}var a,s=e.exports={},l=[],u=!1,c=-1;s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new r(e,t)),1!==l.length||u||setTimeout(i,0)},r.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=o,s.addListener=o,s.once=o,s.off=o,s.removeListener=o,s.removeAllListeners=o,s.emit=o,s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},169:/*!******************!*\
!*** ./index.js ***!
\******************/
function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(/*! tween-functions */170),o=i(r),a=n(/*! raf */171),s=i(a),l="ADDITIVE",u=r.easeInOutQuad,c=300,d=0,f={ADDITIVE:"ADDITIVE",DESTRUCTIVE:"DESTRUCTIVE"},p={_rafID:null,getInitialState:function(){return{tweenQueue:[]}},componentWillUnmount:function(){s["default"].cancel(this._rafID),this._rafID=-1},tweenState:function(e,t){var n=this,i=t.easing,r=t.duration,o=t.delay,a=t.beginValue,p=t.endValue,h=t.onEnd,m=t.stackBehavior;this.setState(function(t){var y=t,v=void 0,g=void 0;if("string"==typeof e)v=e,g=e;else{for(var b=0;b<e.length-1;b++)y=y[e[b]];v=e[e.length-1],g=e.join("|")}var M={easing:i||u,duration:null==r?c:r,delay:null==o?d:o,beginValue:null==a?y[v]:a,endValue:p,onEnd:h,stackBehavior:m||l},T=t.tweenQueue;return M.stackBehavior===f.DESTRUCTIVE&&(T=t.tweenQueue.filter(function(e){return e.pathHash!==g})),T.push({pathHash:g,config:M,initTime:Date.now()+M.delay}),y[v]=M.endValue,1===T.length&&(n._rafID=(0,s["default"])(n._rafCb)),{tweenQueue:T}})},getTweeningValue:function(e){var t=this.state,n=void 0,i=void 0;if("string"==typeof e)n=t[e],i=e;else{n=t;for(var r=0;r<e.length;r++)n=n[e[r]];i=e.join("|")}for(var o=Date.now(),r=0;r<t.tweenQueue.length;r++){var a=t.tweenQueue[r],s=a.pathHash,l=a.initTime,u=a.config;if(s===i){var c=o-l>u.duration?u.duration:Math.max(0,o-l),d=0===u.duration?u.endValue:u.easing(c,u.beginValue,u.endValue,u.duration),f=d-u.endValue;n+=f}}return n},_rafCb:function(){var e=this.state;if(0!==e.tweenQueue.length){for(var t=Date.now(),n=[],i=0;i<e.tweenQueue.length;i++){var r=e.tweenQueue[i],o=r.initTime,a=r.config;t-o<a.duration?n.push(r):a.onEnd&&a.onEnd()}this._rafID!==-1&&(this.setState({tweenQueue:n}),this._rafID=(0,s["default"])(this._rafCb))}}};t["default"]={Mixin:p,easingTypes:o["default"],stackBehavior:f},e.exports=t["default"]},170:/*!************************************!*\
!*** ./~/tween-functions/index.js ***!
\************************************/
function(e,t){"use strict";var n={linear:function(e,t,n,i){var r=n-t;return r*e/i+t},easeInQuad:function(e,t,n,i){var r=n-t;return r*(e/=i)*e+t},easeOutQuad:function(e,t,n,i){var r=n-t;return-r*(e/=i)*(e-2)+t},easeInOutQuad:function(e,t,n,i){var r=n-t;return(e/=i/2)<1?r/2*e*e+t:-r/2*(--e*(e-2)-1)+t},easeInCubic:function(e,t,n,i){var r=n-t;return r*(e/=i)*e*e+t},easeOutCubic:function(e,t,n,i){var r=n-t;return r*((e=e/i-1)*e*e+1)+t},easeInOutCubic:function(e,t,n,i){var r=n-t;return(e/=i/2)<1?r/2*e*e*e+t:r/2*((e-=2)*e*e+2)+t},easeInQuart:function(e,t,n,i){var r=n-t;return r*(e/=i)*e*e*e+t},easeOutQuart:function(e,t,n,i){var r=n-t;return-r*((e=e/i-1)*e*e*e-1)+t},easeInOutQuart:function(e,t,n,i){var r=n-t;return(e/=i/2)<1?r/2*e*e*e*e+t:-r/2*((e-=2)*e*e*e-2)+t},easeInQuint:function(e,t,n,i){var r=n-t;return r*(e/=i)*e*e*e*e+t},easeOutQuint:function(e,t,n,i){var r=n-t;return r*((e=e/i-1)*e*e*e*e+1)+t},easeInOutQuint:function(e,t,n,i){var r=n-t;return(e/=i/2)<1?r/2*e*e*e*e*e+t:r/2*((e-=2)*e*e*e*e+2)+t},easeInSine:function(e,t,n,i){var r=n-t;return-r*Math.cos(e/i*(Math.PI/2))+r+t},easeOutSine:function(e,t,n,i){var r=n-t;return r*Math.sin(e/i*(Math.PI/2))+t},easeInOutSine:function(e,t,n,i){var r=n-t;return-r/2*(Math.cos(Math.PI*e/i)-1)+t},easeInExpo:function(e,t,n,i){var r=n-t;return 0==e?t:r*Math.pow(2,10*(e/i-1))+t},easeOutExpo:function(e,t,n,i){var r=n-t;return e==i?t+r:r*(-Math.pow(2,-10*e/i)+1)+t},easeInOutExpo:function(e,t,n,i){var r=n-t;return 0===e?t:e===i?t+r:(e/=i/2)<1?r/2*Math.pow(2,10*(e-1))+t:r/2*(-Math.pow(2,-10*--e)+2)+t},easeInCirc:function(e,t,n,i){var r=n-t;return-r*(Math.sqrt(1-(e/=i)*e)-1)+t},easeOutCirc:function(e,t,n,i){var r=n-t;return r*Math.sqrt(1-(e=e/i-1)*e)+t},easeInOutCirc:function(e,t,n,i){var r=n-t;return(e/=i/2)<1?-r/2*(Math.sqrt(1-e*e)-1)+t:r/2*(Math.sqrt(1-(e-=2)*e)+1)+t},easeInElastic:function(e,t,n,i){var r,o,a,s=n-t;return a=1.70158,o=0,r=s,0===e?t:1===(e/=i)?t+s:(o||(o=.3*i),r<Math.abs(s)?(r=s,a=o/4):a=o/(2*Math.PI)*Math.asin(s/r),-(r*Math.pow(2,10*(e-=1))*Math.sin((e*i-a)*(2*Math.PI)/o))+t)},easeOutElastic:function(e,t,n,i){var r,o,a,s=n-t;return a=1.70158,o=0,r=s,0===e?t:1===(e/=i)?t+s:(o||(o=.3*i),r<Math.abs(s)?(r=s,a=o/4):a=o/(2*Math.PI)*Math.asin(s/r),r*Math.pow(2,-10*e)*Math.sin((e*i-a)*(2*Math.PI)/o)+s+t)},easeInOutElastic:function(e,t,n,i){var r,o,a,s=n-t;return a=1.70158,o=0,r=s,0===e?t:2===(e/=i/2)?t+s:(o||(o=i*(.3*1.5)),r<Math.abs(s)?(r=s,a=o/4):a=o/(2*Math.PI)*Math.asin(s/r),e<1?-.5*(r*Math.pow(2,10*(e-=1))*Math.sin((e*i-a)*(2*Math.PI)/o))+t:r*Math.pow(2,-10*(e-=1))*Math.sin((e*i-a)*(2*Math.PI)/o)*.5+s+t)},easeInBack:function(e,t,n,i,r){var o=n-t;return void 0===r&&(r=1.70158),o*(e/=i)*e*((r+1)*e-r)+t},easeOutBack:function(e,t,n,i,r){var o=n-t;return void 0===r&&(r=1.70158),o*((e=e/i-1)*e*((r+1)*e+r)+1)+t},easeInOutBack:function(e,t,n,i,r){var o=n-t;return void 0===r&&(r=1.70158),(e/=i/2)<1?o/2*(e*e*(((r*=1.525)+1)*e-r))+t:o/2*((e-=2)*e*(((r*=1.525)+1)*e+r)+2)+t},easeInBounce:function(e,t,i,r){var o,a=i-t;return o=n.easeOutBounce(r-e,0,a,r),a-o+t},easeOutBounce:function(e,t,n,i){var r=n-t;return(e/=i)<1/2.75?r*(7.5625*e*e)+t:e<2/2.75?r*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?r*(7.5625*(e-=2.25/2.75)*e+.9375)+t:r*(7.5625*(e-=2.625/2.75)*e+.984375)+t},easeInOutBounce:function(e,t,i,r){var o,a=i-t;return e<r/2?(o=n.easeInBounce(2*e,0,a,r),.5*o+t):(o=n.easeOutBounce(2*e-r,0,a,r),.5*o+.5*a+t)}};e.exports=n},171:/*!************************!*\
!*** ./~/raf/index.js ***!
\************************/
function(e,t,n){(function(t){for(var i=n(/*! performance-now */172),r="undefined"==typeof window?t:window,o=["moz","webkit"],a="AnimationFrame",s=r["request"+a],l=r["cancel"+a]||r["cancelRequest"+a],u=0;!s&&u<o.length;u++)s=r[o[u]+"Request"+a],l=r[o[u]+"Cancel"+a]||r[o[u]+"CancelRequest"+a];if(!s||!l){var c=0,d=0,f=[],p=1e3/60;s=function(e){if(0===f.length){var t=i(),n=Math.max(0,p-(t-c));c=n+t,setTimeout(function(){var e=f.slice(0);f.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(c)}catch(n){setTimeout(function(){throw n},0)}},Math.round(n))}return f.push({handle:++d,callback:e,cancelled:!1}),d},l=function(e){for(var t=0;t<f.length;t++)f[t].handle===e&&(f[t].cancelled=!0)}}e.exports=function(e){return s.call(r,e)},e.exports.cancel=function(){l.apply(r,arguments)},e.exports.polyfill=function(){r.requestAnimationFrame=s,r.cancelAnimationFrame=l}}).call(t,function(){return this}())},172:/*!**************************************************!*\
!*** ./~/performance-now/lib/performance-now.js ***!
\**************************************************/
function(e,t,n){(function(t){(function(){var n,i,r;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof t&&null!==t&&t.hrtime?(e.exports=function(){return(n()-r)/1e6},i=t.hrtime,n=function(){var e;return e=i(),1e9*e[0]+e[1]},r=n()):Date.now?(e.exports=function(){return Date.now()-r},r=Date.now()):(e.exports=function(){return(new Date).getTime()-r},r=(new Date).getTime())}).call(this)}).call(t,n(/*! ./~/process/browser.js */5))}})})},function(e,t){function n(e){return!!e&&"object"==typeof e}function i(e,t){var n=null==e?void 0:e[t];return a(n)?n:void 0}function r(e){return o(e)&&f.call(e)==s}function o(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function a(e){return null!=e&&(r(e)?p.test(c.call(e)):n(e)&&l.test(e))}var s="[object Function]",l=/^\[object .+?Constructor\]$/,u=Object.prototype,c=Function.prototype.toString,d=u.hasOwnProperty,f=u.toString,p=RegExp("^"+c.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=i},function(e,t){function n(e){return r(e)&&h.call(e,"callee")&&(!y.call(e,"callee")||m.call(e)==c)}function i(e){return null!=e&&a(e.length)&&!o(e)}function r(e){return l(e)&&i(e)}function o(e){var t=s(e)?m.call(e):"";return t==d||t==f}function a(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function s(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function l(e){return!!e&&"object"==typeof e}var u=9007199254740991,c="[object Arguments]",d="[object Function]",f="[object GeneratorFunction]",p=Object.prototype,h=p.hasOwnProperty,m=p.toString,y=p.propertyIsEnumerable;e.exports=n},function(e,t){function n(e){return!!e&&"object"==typeof e}function i(e,t){var n=null==e?void 0:e[t];return s(n)?n:void 0}function r(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=v}function o(e){return a(e)&&h.call(e)==u}function a(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function s(e){return null!=e&&(o(e)?m.test(f.call(e)):n(e)&&c.test(e))}var l="[object Array]",u="[object Function]",c=/^\[object .+?Constructor\]$/,d=Object.prototype,f=Function.prototype.toString,p=d.hasOwnProperty,h=d.toString,m=RegExp("^"+f.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),y=i(Array,"isArray"),v=9007199254740991,g=y||function(e){return n(e)&&r(e.length)&&h.call(e)==l};e.exports=g},function(e,t,n){function i(e){return function(t){return null==t?void 0:t[e]}}function r(e){return null!=e&&a(g(e))}function o(e,t){return e="number"==typeof e||p.test(e)?+e:-1,t=null==t?v:t,e>-1&&e%1==0&&e<t}function a(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=v}function s(e){for(var t=u(e),n=t.length,i=n&&e.length,r=!!i&&a(i)&&(f(e)||d(e)),s=-1,l=[];++s<n;){var c=t[s];(r&&o(c,i)||m.call(e,c))&&l.push(c)}return l}function l(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function u(e){if(null==e)return[];l(e)||(e=Object(e));var t=e.length;t=t&&a(t)&&(f(e)||d(e))&&t||0;for(var n=e.constructor,i=-1,r="function"==typeof n&&n.prototype===e,s=Array(t),u=t>0;++i<t;)s[i]=i+"";for(var c in e)u&&o(c,t)||"constructor"==c&&(r||!m.call(e,c))||s.push(c);return s}var c=n(332),d=n(333),f=n(334),p=/^\d+$/,h=Object.prototype,m=h.hasOwnProperty,y=c(Object,"keys"),v=9007199254740991,g=i("length"),b=y?function(e){var t=null==e?void 0:e.constructor;return"function"==typeof t&&t.prototype===e||"function"!=typeof e&&r(e)?s(e):l(e)?y(e):[]}:s;e.exports=b},function(e,t,n){"use strict";var i=n(337);e.exports=i},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o=n(1),a=i(o),s=n(9),l=(i(s),n(331)),u=i(l),c=n(338),d=i(c),f=n(10),p=i(f),h=n(279),m=i(h),y=function(e,t,n){null!==e&&"undefined"!=typeof e&&(e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n)},v=function(e,t,n){null!==e&&"undefined"!=typeof e&&(e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null)},g=a["default"].createClass({displayName:"Carousel",mixins:[u["default"].Mixin],propTypes:{afterSlide:a["default"].PropTypes.func,autoplay:a["default"].PropTypes.bool,autoplayInterval:a["default"].PropTypes.number,beforeSlide:a["default"].PropTypes.func,cellAlign:a["default"].PropTypes.oneOf(["left","center","right"]),cellSpacing:a["default"].PropTypes.number,data:a["default"].PropTypes.func,decorators:a["default"].PropTypes.arrayOf(a["default"].PropTypes.shape({component:a["default"].PropTypes.func,position:a["default"].PropTypes.oneOf(["TopLeft","TopCenter","TopRight","CenterLeft","CenterCenter","CenterRight","BottomLeft","BottomCenter","BottomRight"]),style:a["default"].PropTypes.object})),dragging:a["default"].PropTypes.bool,easing:a["default"].PropTypes.string,edgeEasing:a["default"].PropTypes.string,framePadding:a["default"].PropTypes.string,frameOverflow:a["default"].PropTypes.string,initialSlideHeight:a["default"].PropTypes.number,initialSlideWidth:a["default"].PropTypes.number,slideIndex:a["default"].PropTypes.number,slidesToShow:a["default"].PropTypes.number,slidesToScroll:a["default"].PropTypes.oneOfType([a["default"].PropTypes.number,a["default"].PropTypes.oneOf(["auto"])]),slideWidth:a["default"].PropTypes.oneOfType([a["default"].PropTypes.string,a["default"].PropTypes.number]),speed:a["default"].PropTypes.number,vertical:a["default"].PropTypes.bool,width:a["default"].PropTypes.string,wrapAround:a["default"].PropTypes.bool},getDefaultProps:function(){return{afterSlide:function(){},autoplay:!1,autoplayInterval:3e3,beforeSlide:function(){},cellAlign:"left",cellSpacing:0,data:function(){},decorators:d["default"],dragging:!0,easing:"easeOutCirc",edgeEasing:"easeOutElastic",framePadding:"0px",frameOverflow:"hidden",slideIndex:0,slidesToScroll:1,slidesToShow:1,slideWidth:1,speed:500,vertical:!1,width:"100%",wrapAround:!1}},getInitialState:function(){return{currentSlide:this.props.slideIndex,dragging:!1,frameWidth:0,left:0,slideCount:0,slidesToScroll:this.props.slidesToScroll,slideWidth:0,top:0}},componentWillMount:function(){this.setInitialDimensions()},componentDidMount:function(){this.setDimensions(),this.bindEvents(),this.setExternalData(),this.props.autoplay&&this.startAutoplay()},componentWillReceiveProps:function(e){this.setState({slideCount:e.children.length}),this.setDimensions(e),this.props.slideIndex!==e.slideIndex&&e.slideIndex!==this.state.currentSlide&&this.goToSlide(e.slideIndex),this.props.autoplay!==e.autoplay&&(e.autoplay?this.startAutoplay():this.stopAutoplay())},componentWillUnmount:function(){this.unbindEvents(),this.stopAutoplay()},render:function(){var e=this,t=a["default"].Children.count(this.props.children)>1?this.formatChildren(this.props.children):this.props.children;return a["default"].createElement("div",{className:["slider",this.props.className||""].join(" "),ref:"slider",style:(0,p["default"])(this.getSliderStyles(),this.props.style||{})},a["default"].createElement("div",r({className:"slider-frame",ref:"frame",style:this.getFrameStyles()},this.getTouchEvents(),this.getMouseEvents(),{onClick:this.handleClick}),a["default"].createElement("ul",{className:"slider-list",ref:"list",style:this.getListStyles()},t)),this.props.decorators?this.props.decorators.map(function(t,n){return a["default"].createElement("div",{style:(0,p["default"])(e.getDecoratorStyles(t.position),t.style||{}),className:"slider-decorator-"+n,key:n},a["default"].createElement(t.component,{currentSlide:e.state.currentSlide,slideCount:e.state.slideCount,frameWidth:e.state.frameWidth,slideWidth:e.state.slideWidth,slidesToScroll:e.state.slidesToScroll,cellSpacing:e.props.cellSpacing,slidesToShow:e.props.slidesToShow,wrapAround:e.props.wrapAround,nextSlide:e.nextSlide,previousSlide:e.previousSlide,goToSlide:e.goToSlide}))}):null,a["default"].createElement("style",{type:"text/css",dangerouslySetInnerHTML:{__html:e.getStyleTagStyles()}}))},touchObject:{},getTouchEvents:function(){var e=this;return{onTouchStart:function(t){e.touchObject={startX:t.touches[0].pageX,startY:t.touches[0].pageY},e.handleMouseOver()},onTouchMove:function(t){var n=e.swipeDirection(e.touchObject.startX,t.touches[0].pageX,e.touchObject.startY,t.touches[0].pageY);0!==n&&t.preventDefault();var i=e.props.vertical?Math.round(Math.sqrt(Math.pow(t.touches[0].pageY-e.touchObject.startY,2))):Math.round(Math.sqrt(Math.pow(t.touches[0].pageX-e.touchObject.startX,2)));e.touchObject={startX:e.touchObject.startX,startY:e.touchObject.startY,endX:t.touches[0].pageX,endY:t.touches[0].pageY,length:i,direction:n},e.setState({left:e.props.vertical?0:e.getTargetLeft(e.touchObject.length*e.touchObject.direction),top:e.props.vertical?e.getTargetLeft(e.touchObject.length*e.touchObject.direction):0})},onTouchEnd:function(t){e.handleSwipe(t),e.handleMouseOut()},onTouchCancel:function(t){e.handleSwipe(t)}}},clickSafe:!0,getMouseEvents:function(){var e=this;return this.props.dragging===!1?null:{onMouseOver:function(){e.handleMouseOver()},onMouseOut:function(){e.handleMouseOut()},onMouseDown:function(t){e.touchObject={startX:t.clientX,startY:t.clientY},e.setState({dragging:!0})},onMouseMove:function(t){if(e.state.dragging){var n=e.swipeDirection(e.touchObject.startX,t.clientX,e.touchObject.startY,t.clientY);0!==n&&t.preventDefault();var i=e.props.vertical?Math.round(Math.sqrt(Math.pow(t.clientY-e.touchObject.startY,2))):Math.round(Math.sqrt(Math.pow(t.clientX-e.touchObject.startX,2)));e.touchObject={startX:e.touchObject.startX,startY:e.touchObject.startY,endX:t.clientX,endY:t.clientY,length:i,direction:n},e.setState({left:e.props.vertical?0:e.getTargetLeft(e.touchObject.length*e.touchObject.direction),top:e.props.vertical?e.getTargetLeft(e.touchObject.length*e.touchObject.direction):0})}},onMouseUp:function(t){e.state.dragging&&e.handleSwipe(t)},onMouseLeave:function(t){e.state.dragging&&e.handleSwipe(t)}}},handleMouseOver:function(){this.props.autoplay&&(this.autoplayPaused=!0,this.stopAutoplay())},handleMouseOut:function(){this.props.autoplay&&this.autoplayPaused&&(this.startAutoplay(),this.autoplayPaused=null)},handleClick:function(e){this.clickSafe===!0&&(e.preventDefault(),e.stopPropagation(),e.nativeEvent&&e.nativeEvent.stopPropagation())},handleSwipe:function(e){"undefined"!=typeof this.touchObject.length&&this.touchObject.length>44?this.clickSafe=!0:this.clickSafe=!1;var t=this.props.slidesToShow;"auto"===this.props.slidesToScroll&&(t=this.state.slidesToScroll),this.touchObject.length>this.state.slideWidth/t/5?1===this.touchObject.direction?this.state.currentSlide>=a["default"].Children.count(this.props.children)-t&&!this.props.wrapAround?this.animateSlide(u["default"].easingTypes[this.props.edgeEasing]):this.nextSlide():this.touchObject.direction===-1&&(this.state.currentSlide<=0&&!this.props.wrapAround?this.animateSlide(u["default"].easingTypes[this.props.edgeEasing]):this.previousSlide()):this.goToSlide(this.state.currentSlide),this.touchObject={},this.setState({dragging:!1})},swipeDirection:function(e,t,n,i){var r,o,a,s;return r=e-t,o=n-i,a=Math.atan2(o,r),s=Math.round(180*a/Math.PI),s<0&&(s=360-Math.abs(s)),s<=45&&s>=0?1:s<=360&&s>=315?1:s>=135&&s<=225?-1:this.props.vertical===!0?s>=35&&s<=135?1:-1:0},autoplayIterator:function(){return this.props.wrapAround?this.nextSlide():void(this.state.currentSlide!==this.state.slideCount-this.state.slidesToShow?this.nextSlide():this.stopAutoplay())},startAutoplay:function(){this.autoplayID=setInterval(this.autoplayIterator,this.props.autoplayInterval)},resetAutoplay:function(){this.props.autoplay&&!this.autoplayPaused&&(this.stopAutoplay(),this.startAutoplay())},stopAutoplay:function(){this.autoplayID&&clearInterval(this.autoplayID)},goToSlide:function(e){var t=this;if(e>=a["default"].Children.count(this.props.children)||e<0){if(!this.props.wrapAround)return;if(e>=a["default"].Children.count(this.props.children))return this.props.beforeSlide(this.state.currentSlide,0),this.setState({currentSlide:0},function(){t.animateSlide(null,null,t.getTargetLeft(null,e),function(){t.animateSlide(null,.01),t.props.afterSlide(0),t.resetAutoplay(),t.setExternalData()})});var n=a["default"].Children.count(this.props.children)-this.state.slidesToScroll;return this.props.beforeSlide(this.state.currentSlide,n),this.setState({currentSlide:n},function(){t.animateSlide(null,null,t.getTargetLeft(null,e),function(){t.animateSlide(null,.01),t.props.afterSlide(n),t.resetAutoplay(),t.setExternalData()})})}this.props.beforeSlide(this.state.currentSlide,e),this.setState({currentSlide:e},function(){t.animateSlide(),this.props.afterSlide(e),t.resetAutoplay(),t.setExternalData()})},nextSlide:function(){var e=a["default"].Children.count(this.props.children),t=this.props.slidesToShow;if("auto"===this.props.slidesToScroll&&(t=this.state.slidesToScroll),!(this.state.currentSlide>=e-t)||this.props.wrapAround)if(this.props.wrapAround)this.goToSlide(this.state.currentSlide+this.state.slidesToScroll);else{if(1!==this.props.slideWidth)return this.goToSlide(this.state.currentSlide+this.state.slidesToScroll);this.goToSlide(Math.min(this.state.currentSlide+this.state.slidesToScroll,e-t))}},previousSlide:function(){this.state.currentSlide<=0&&!this.props.wrapAround||(this.props.wrapAround?this.goToSlide(this.state.currentSlide-this.state.slidesToScroll):this.goToSlide(Math.max(0,this.state.currentSlide-this.state.slidesToScroll)))},animateSlide:function(e,t,n,i){this.tweenState(this.props.vertical?"top":"left",{easing:e||u["default"].easingTypes[this.props.easing],duration:t||this.props.speed,endValue:n||this.getTargetLeft(),onEnd:i||null})},getTargetLeft:function(e,t){var n,i=t||this.state.currentSlide;switch(this.props.cellAlign){case"left":n=0,n-=this.props.cellSpacing*i;break;case"center":n=(this.state.frameWidth-this.state.slideWidth)/2,n-=this.props.cellSpacing*i;break;case"right":n=this.state.frameWidth-this.state.slideWidth,n-=this.props.cellSpacing*i}var r=this.state.slideWidth*i,o=this.state.currentSlide>0&&i+this.state.slidesToScroll>=this.state.slideCount;return o&&1!==this.props.slideWidth&&!this.props.wrapAround&&"auto"===this.props.slidesToScroll&&(r=this.state.slideWidth*this.state.slideCount-this.state.frameWidth,n=0,n-=this.props.cellSpacing*(this.state.slideCount-1)),n-=e||0,(r-n)*-1},bindEvents:function(){var e=this;m["default"].canUseDOM&&(y(window,"resize",e.onResize),y(document,"readystatechange",e.onReadyStateChange))},onResize:function(){this.setDimensions()},onReadyStateChange:function(){this.setDimensions()},unbindEvents:function(){var e=this;m["default"].canUseDOM&&(v(window,"resize",e.onResize),v(document,"readystatechange",e.onReadyStateChange))},formatChildren:function(e){var t=this,n=this.props.vertical?this.getTweeningValue("top"):this.getTweeningValue("left");return a["default"].Children.map(e,function(e,i){return a["default"].createElement("li",{className:"slider-slide",style:t.getSlideStyles(i,n),key:i},e)})},setInitialDimensions:function(){var e,t,n,i=this;e=this.props.vertical?this.props.initialSlideHeight||0:this.props.initialSlideWidth||0,n=this.props.initialSlideHeight?this.props.initialSlideHeight*this.props.slidesToShow:0,t=n+this.props.cellSpacing*(this.props.slidesToShow-1),this.setState({slideHeight:n,frameWidth:this.props.vertical?t:"100%",slideCount:a["default"].Children.count(this.props.children),slideWidth:e},function(){i.setLeft(),i.setExternalData()})},setDimensions:function(e){e=e||this.props;var t,n,i,r,o,a,s,l=this;n=e.slidesToScroll,r=this.refs.frame,i=r.childNodes[0].childNodes[0],i?(i.style.height="auto",s=this.props.vertical?i.offsetHeight*e.slidesToShow:i.offsetHeight):s=100,t="number"!=typeof e.slideWidth?parseInt(e.slideWidth):e.vertical?s/e.slidesToShow*e.slideWidth:r.offsetWidth/e.slidesToShow*e.slideWidth,e.vertical||(t-=e.cellSpacing*((100-100/e.slidesToShow)/100)),a=s+e.cellSpacing*(e.slidesToShow-1),o=e.vertical?a:r.offsetWidth,"auto"===e.slidesToScroll&&(n=Math.floor(o/(t+e.cellSpacing))),this.setState({slideHeight:s,frameWidth:o,slideWidth:t,slidesToScroll:n,left:e.vertical?0:this.getTargetLeft(),top:e.vertical?this.getTargetLeft():0},function(){l.setLeft()})},setLeft:function(){this.setState({left:this.props.vertical?0:this.getTargetLeft(),top:this.props.vertical?this.getTargetLeft():0})},setExternalData:function(){this.props.data&&this.props.data()},getListStyles:function(){var e=this.state.slideWidth*a["default"].Children.count(this.props.children),t=this.props.cellSpacing*a["default"].Children.count(this.props.children),n="translate3d("+this.getTweeningValue("left")+"px, "+this.getTweeningValue("top")+"px, 0)";return{transform:n,WebkitTransform:n,msTransform:"translate("+this.getTweeningValue("left")+"px, "+this.getTweeningValue("top")+"px)",position:"relative",display:"block",margin:this.props.vertical?this.props.cellSpacing/2*-1+"px 0px":"0px "+this.props.cellSpacing/2*-1+"px",padding:0,height:this.props.vertical?e+t:this.state.slideHeight,width:this.props.vertical?"auto":e+t,cursor:this.state.dragging===!0?"pointer":"inherit",boxSizing:"border-box",MozBoxSizing:"border-box"}},getFrameStyles:function(){return{position:"relative",display:"block",overflow:this.props.frameOverflow,height:this.props.vertical?this.state.frameWidth||"initial":"auto",margin:this.props.framePadding,padding:0,transform:"translate3d(0, 0, 0)",WebkitTransform:"translate3d(0, 0, 0)",msTransform:"translate(0, 0)",boxSizing:"border-box",MozBoxSizing:"border-box"}},getSlideStyles:function(e,t){var n=this.getSlideTargetPosition(e,t);return{position:"absolute",left:this.props.vertical?0:n,top:this.props.vertical?n:0,display:this.props.vertical?"block":"inline-block",listStyleType:"none",verticalAlign:"top",width:this.props.vertical?"100%":this.state.slideWidth,height:"auto",boxSizing:"border-box",MozBoxSizing:"border-box",marginLeft:this.props.vertical?"auto":this.props.cellSpacing/2,marginRight:this.props.vertical?"auto":this.props.cellSpacing/2,marginTop:this.props.vertical?this.props.cellSpacing/2:"auto",marginBottom:this.props.vertical?this.props.cellSpacing/2:"auto"}},getSlideTargetPosition:function(e,t){var n=this.state.frameWidth/this.state.slideWidth,i=(this.state.slideWidth+this.props.cellSpacing)*e,r=(this.state.slideWidth+this.props.cellSpacing)*n*-1;if(this.props.wrapAround){var o=Math.ceil(t/this.state.slideWidth);if(this.state.slideCount-o<=e)return(this.state.slideWidth+this.props.cellSpacing)*(this.state.slideCount-e)*-1;var a=Math.ceil((Math.abs(t)-Math.abs(r))/this.state.slideWidth);if(1!==this.state.slideWidth&&(a=Math.ceil((Math.abs(t)-this.state.slideWidth)/this.state.slideWidth)),e<=a-1)return(this.state.slideWidth+this.props.cellSpacing)*(this.state.slideCount+e)}return i},getSliderStyles:function(){return{position:"relative",display:"block",width:this.props.width,height:"auto",boxSizing:"border-box",MozBoxSizing:"border-box",visibility:this.state.slideWidth?"visible":"hidden"}},getStyleTagStyles:function(){return".slider-slide > img {width: 100%; display: block;}"},getDecoratorStyles:function(e){switch(e){case"TopLeft":return{position:"absolute",top:0,left:0};case"TopCenter":return{position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",WebkitTransform:"translateX(-50%)",msTransform:"translateX(-50%)"};case"TopRight":return{position:"absolute",top:0,right:0};case"CenterLeft":return{position:"absolute",top:"50%",left:0,transform:"translateY(-50%)",WebkitTransform:"translateY(-50%)",msTransform:"translateY(-50%)"};case"CenterCenter":return{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%,-50%)",WebkitTransform:"translate(-50%, -50%)",msTransform:"translate(-50%, -50%)"};case"CenterRight":return{position:"absolute",top:"50%",right:0,transform:"translateY(-50%)",WebkitTransform:"translateY(-50%)",msTransform:"translateY(-50%)"};case"BottomLeft":return{position:"absolute",bottom:0,left:0};case"BottomCenter":return{position:"absolute",bottom:0,left:"50%",transform:"translateX(-50%)",WebkitTransform:"translateX(-50%)",msTransform:"translateX(-50%)"};case"BottomRight":return{position:"absolute",bottom:0,right:0};default:return{position:"absolute",top:0,left:0}}}});g.ControllerMixin={getInitialState:function(){return{carousels:{}}},setCarouselData:function(e){var t=this.state.carousels;t[e]=this.refs[e],this.setState({carousels:t})}},t["default"]=g,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=[{component:o["default"].createClass({displayName:"component",render:function(){return o["default"].createElement("button",{style:this.getButtonStyles(0===this.props.currentSlide&&!this.props.wrapAround),onClick:this.handleClick},"PREV")},handleClick:function(e){e.preventDefault(),this.props.previousSlide()},getButtonStyles:function(e){return{border:0,background:"rgba(0,0,0,0.4)",color:"white",padding:10,outline:0,opacity:e?.3:1,cursor:"pointer"}}}),position:"CenterLeft"},{component:o["default"].createClass({displayName:"component",render:function(){return o["default"].createElement("button",{style:this.getButtonStyles(this.props.currentSlide+this.props.slidesToScroll>=this.props.slideCount&&!this.props.wrapAround),onClick:this.handleClick},"NEXT")},handleClick:function(e){e.preventDefault(),this.props.nextSlide()},getButtonStyles:function(e){return{border:0,background:"rgba(0,0,0,0.4)",color:"white",padding:10,outline:0,opacity:e?.3:1,cursor:"pointer"}}}),position:"CenterRight"},{component:o["default"].createClass({displayName:"component",render:function(){var e=this,t=this.getIndexes(e.props.slideCount,e.props.slidesToScroll);return o["default"].createElement("ul",{style:e.getListStyles()},t.map(function(t){return o["default"].createElement("li",{style:e.getListItemStyles(),key:t},o["default"].createElement("button",{style:e.getButtonStyles(e.props.currentSlide===t),onClick:e.props.goToSlide.bind(null,t)},"\u2022"))}))},getIndexes:function(e,t){for(var n=[],i=0;i<e;i+=t)n.push(i);return n},getListStyles:function(){return{position:"relative",margin:0,top:-10,padding:0}},getListItemStyles:function(){return{listStyleType:"none",display:"inline-block"}},getButtonStyles:function(e){return{border:0,background:"transparent",color:"black",cursor:"pointer",padding:10,outline:0,fontSize:24,opacity:e?1:.5}}}),position:"BottomCenter"}];t["default"]=a,e.exports=t["default"]},function(e,t,n){var i,r,o;!function(n,a){"use strict";"object"==typeof e&&"object"==typeof e.exports?e.exports=a():(r=[],i=a,o="function"==typeof i?i.apply(t,r):i,!(void 0!==o&&(e.exports=o)))}(this,function(){"use strict";function e(e,t){return null!=e&&Object.prototype.hasOwnProperty.call(e,t)}function t(t){if(!t)return!0;if(l(t)&&0===t.length)return!0;if("string"!=typeof t){for(var n in t)if(e(t,n))return!1;return!0}return!1}function n(e){return s.call(e)}function i(e){return"object"==typeof e&&"[object Object]"===n(e)}function r(e){return"boolean"==typeof e||"[object Boolean]"===n(e)}function o(e){var t=parseInt(e);return t.toString()===e?t:e}function a(n){function a(t,i){if(n.includeInheritedProps||"number"==typeof i&&Array.isArray(t)||e(t,i))return t[i]}function s(e,t,n,i){if("number"==typeof t&&(t=[t]),!t||0===t.length)return e;if("string"==typeof t)return s(e,t.split(".").map(o),n,i);var r=t[0],l=a(e,r);return 1===t.length?(void 0!==l&&i||(e[r]=n),l):(void 0===l&&("number"==typeof t[1]?e[r]=[]:e[r]={}),s(e[r],t.slice(1),n,i))}n=n||{};var u=function(e){return Object.keys(u).reduce(function(t,n){return"create"===n?t:("function"==typeof u[n]&&(t[n]=u[n].bind(u,e)),t)},{})};return u.has=function(t,i){if("number"==typeof i?i=[i]:"string"==typeof i&&(i=i.split(".")),!i||0===i.length)return!!t;for(var r=0;r<i.length;r++){var a=o(i[r]);if(!("number"==typeof a&&l(t)&&a<t.length||(n.includeInheritedProps?a in Object(t):e(t,a))))return!1;t=t[a]}return!0},u.ensureExists=function(e,t,n){return s(e,t,n,!0)},u.set=function(e,t,n,i){return s(e,t,n,i)},u.insert=function(e,t,n,i){var r=u.get(e,t);i=~~i,l(r)||(r=[],u.set(e,t,r)),r.splice(i,0,n)},u.empty=function(n,o){if(!t(o)&&null!=n){var a,s;if(a=u.get(n,o)){if("string"==typeof a)return u.set(n,o,"");if(r(a))return u.set(n,o,!1);if("number"==typeof a)return u.set(n,o,0);if(l(a))a.length=0;else{if(!i(a))return u.set(n,o,null);for(s in a)e(a,s)&&delete a[s]}}}},u.push=function(e,t){var n=u.get(e,t);l(n)||(n=[],u.set(e,t,n)),n.push.apply(n,Array.prototype.slice.call(arguments,2))},u.coalesce=function(e,t,n){for(var i,r=0,o=t.length;r<o;r++)if(void 0!==(i=u.get(e,t[r])))return i;return n},u.get=function(e,t,n){if("number"==typeof t&&(t=[t]),!t||0===t.length)return e;if(null==e)return n;if("string"==typeof t)return u.get(e,t.split("."),n);var i=o(t[0]),r=a(e,i);return void 0===r?n:1===t.length?r:u.get(e[i],t.slice(1),n)},u.del=function(e,n){if("number"==typeof n&&(n=[n]),null==e)return e;if(t(n))return e;if("string"==typeof n)return u.del(e,n.split("."));var i=o(n[0]),r=a(e,i);if(null==r)return r;if(1===n.length)l(e)?e.splice(i,1):delete e[i];else if(void 0!==e[i])return u.del(e[i],n.slice(1));return e},u}var s=Object.prototype.toString,l=Array.isArray||function(e){return"[object Array]"===s.call(e)},u=a();return u.create=a,u.withInheritedProps=a({includeInheritedProps:!0}),u})},function(e,t,n){/*!
* object.omit <https://github.com/jonschlinkert/object.omit>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
"use strict";var i=n(330),r=n(328);e.exports=function(e,t){if(!i(e))return{};t=[].concat.apply([],[].slice.call(arguments,1));var n,o=t[t.length-1],a={};"function"==typeof o&&(n=t.pop());var s="function"==typeof n;return t.length||s?(r(e,function(i,r){t.indexOf(r)===-1&&(s?n(i,r,e)&&(a[r]=i):a[r]=i)}),a):e}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){function n(){r&&(clearTimeout(r),r=null)}function i(){n(),r=setTimeout(e,t)}var r=void 0;return i.clear=n,i}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=i(o),s=n(9),l=i(s),u=n(277),c=i(u),d=n(344),f=i(d),p=n(343),h=i(p),m=a["default"].createClass({displayName:"Align",propTypes:{childrenProps:o.PropTypes.object,align:o.PropTypes.object.isRequired,target:o.PropTypes.func,onAlign:o.PropTypes.func,monitorBufferTime:o.PropTypes.number,monitorWindowResize:o.PropTypes.bool,disabled:o.PropTypes.bool,children:o.PropTypes.any},getDefaultProps:function(){return{target:function(){return window},onAlign:function(){},monitorBufferTime:50,monitorWindowResize:!1,disabled:!1}},componentDidMount:function(){var e=this.props;this.forceAlign(),!e.disabled&&e.monitorWindowResize&&this.startMonitorWindowResize()},componentDidUpdate:function(e){var t=!1,n=this.props;if(!n.disabled)if(e.disabled||e.align!==n.align)t=!0;else{var i=e.target(),r=n.target();(0,h["default"])(i)&&(0,h["default"])(r)?t=!1:i!==r&&(t=!0)}t&&this.forceAlign(),n.monitorWindowResize&&!n.disabled?this.startMonitorWindowResize():this.stopMonitorWindowResize()},componentWillUnmount:function(){this.stopMonitorWindowResize()},startMonitorWindowResize:function(){this.resizeHandler||(this.bufferMonitor=r(this.forceAlign,this.props.monitorBufferTime),this.resizeHandler=(0,f["default"])(window,"resize",this.bufferMonitor))},stopMonitorWindowResize:function(){this.resizeHandler&&(this.bufferMonitor.clear(),this.resizeHandler.remove(),this.resizeHandler=null)},forceAlign:function(){var e=this.props;if(!e.disabled){var t=l["default"].findDOMNode(this);e.onAlign(t,(0,c["default"])(t,e.target(),e.align))}},render:function(){var e=this.props,t=e.childrenProps,n=e.children,i=a["default"].Children.only(n);if(t){var r={};for(var o in t)t.hasOwnProperty(o)&&(r[o]=this.props[t[o]]);return a["default"].cloneElement(i,r)}return i}});t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(341),o=i(r);t["default"]=o["default"],e.exports=t["default"]},function(e,t){"use strict";function n(e){return null!=e&&e==e.window}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n){var i=l["default"].unstable_batchedUpdates?function(e){l["default"].unstable_batchedUpdates(n,e)}:n;return(0,a["default"])(e,t,i)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r;var o=n(40),a=i(o),s=n(9),l=i(s);e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){var t=e.children;return l["default"].isValidElement(t)&&!t.key?l["default"].cloneElement(t,{key:h}):t}function a(){}Object.defineProperty(t,"__esModule",{value:!0});var s=n(1),l=i(s),u=n(347),c=n(346),d=i(c),f=n(107),p=i(f),h="rc_animate_"+Date.now(),m=l["default"].createClass({displayName:"Animate",propTypes:{component:l["default"].PropTypes.any,animation:l["default"].PropTypes.object,transitionName:l["default"].PropTypes.oneOfType([l["default"].PropTypes.string,l["default"].PropTypes.object]),transitionEnter:l["default"].PropTypes.bool,transitionAppear:l["default"].PropTypes.bool,exclusive:l["default"].PropTypes.bool,transitionLeave:l["default"].PropTypes.bool,onEnd:l["default"].PropTypes.func,onEnter:l["default"].PropTypes.func,onLeave:l["default"].PropTypes.func,onAppear:l["default"].PropTypes.func,showProp:l["default"].PropTypes.string},getDefaultProps:function(){return{animation:{},component:"span",transitionEnter:!0,transitionLeave:!0,transitionAppear:!1,onEnd:a,onEnter:a,onLeave:a,onAppear:a}},getInitialState:function(){return this.currentlyAnimatingKeys={},this.keysToEnter=[],this.keysToLeave=[],{children:(0,u.toArrayChildren)(o(this.props))}},componentDidMount:function(){var e=this,t=this.props.showProp,n=this.state.children;t&&(n=n.filter(function(e){return!!e.props[t]})),n.forEach(function(t){t&&e.performAppear(t.key)})},componentWillReceiveProps:function(e){var t=this;this.nextProps=e;var n=(0,u.toArrayChildren)(o(e)),i=this.props;i.exclusive&&Object.keys(this.currentlyAnimatingKeys).forEach(function(e){t.stop(e)});var a=i.showProp,s=this.currentlyAnimatingKeys,c=i.exclusive?(0,u.toArrayChildren)(o(i)):this.state.children,d=[];a?(c.forEach(function(e){var t=e&&(0,u.findChildInChildrenByKey)(n,e.key),i=void 0;i=t&&t.props[a]||!e.props[a]?t:l["default"].cloneElement(t||e,r({},a,!0)),i&&d.push(i)}),n.forEach(function(e){e&&(0,u.findChildInChildrenByKey)(c,e.key)||d.push(e)})):d=(0,u.mergeChildren)(c,n),this.setState({children:d}),n.forEach(function(e){var n=e&&e.key;if(!e||!s[n]){var i=e&&(0,u.findChildInChildrenByKey)(c,n);if(a){var r=e.props[a];if(i){var o=(0,u.findShownChildInChildrenByKey)(c,n,a);!o&&r&&t.keysToEnter.push(n)}else r&&t.keysToEnter.push(n)}else i||t.keysToEnter.push(n)}}),c.forEach(function(e){var i=e&&e.key;if(!e||!s[i]){var r=e&&(0,u.findChildInChildrenByKey)(n,i);if(a){var o=e.props[a];if(r){var l=(0,u.findShownChildInChildrenByKey)(n,i,a);!l&&o&&t.keysToLeave.push(i)}else o&&t.keysToLeave.push(i)}else r||t.keysToLeave.push(i)}})},componentDidUpdate:function(){var e=this.keysToEnter;this.keysToEnter=[],e.forEach(this.performEnter);var t=this.keysToLeave;this.keysToLeave=[],t.forEach(this.performLeave)},performEnter:function(e){this.refs[e]&&(this.currentlyAnimatingKeys[e]=!0,this.refs[e].componentWillEnter(this.handleDoneAdding.bind(this,e,"enter")))},performAppear:function(e){this.refs[e]&&(this.currentlyAnimatingKeys[e]=!0,this.refs[e].componentWillAppear(this.handleDoneAdding.bind(this,e,"appear")))},handleDoneAdding:function(e,t){var n=this.props;if(delete this.currentlyAnimatingKeys[e],!n.exclusive||n===this.nextProps){var i=(0,u.toArrayChildren)(o(n));this.isValidChildByKey(i,e)?"appear"===t?p["default"].allowAppearCallback(n)&&(n.onAppear(e),n.onEnd(e,!0)):p["default"].allowEnterCallback(n)&&(n.onEnter(e),n.onEnd(e,!0)):this.performLeave(e)}},performLeave:function(e){this.refs[e]&&(this.currentlyAnimatingKeys[e]=!0,this.refs[e].componentWillLeave(this.handleDoneLeaving.bind(this,e)))},handleDoneLeaving:function(e){var t=this.props;if(delete this.currentlyAnimatingKeys[e],!t.exclusive||t===this.nextProps){var n=(0,u.toArrayChildren)(o(t));if(this.isValidChildByKey(n,e))this.performEnter(e);else{var i=function(){p["default"].allowLeaveCallback(t)&&(t.onLeave(e),t.onEnd(e,!1))};this.isMounted()&&!(0,u.isSameChildren)(this.state.children,n,t.showProp)?this.setState({children:n},i):i()}}},isValidChildByKey:function(e,t){var n=this.props.showProp;return n?(0,u.findShownChildInChildrenByKey)(e,t,n):(0,u.findChildInChildrenByKey)(e,t)},stop:function(e){delete this.currentlyAnimatingKeys[e];var t=this.refs[e];t&&t.stop()},render:function(){var e=this.props;this.nextProps=e;var t=this.state.children,n=null;t&&(n=t.map(function(t){if(null===t||void 0===t)return t;if(!t.key)throw new Error("must set key for <rc-animate> children");return l["default"].createElement(d["default"],{key:t.key,ref:t.key,animation:e.animation,transitionName:e.transitionName,transitionEnter:e.transitionEnter,transitionAppear:e.transitionAppear,transitionLeave:e.transitionLeave},t)}));var i=e.component;if(i){var r=e;return"string"==typeof i&&(r={className:e.className,style:e.style}),l["default"].createElement(i,r,n)}return n[0]||null}});t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=n(1),a=i(o),s=n(9),l=i(s),u=n(102),c=i(u),d=n(107),f=i(d),p={enter:"transitionEnter",appear:"transitionAppear",leave:"transitionLeave"},h=a["default"].createClass({displayName:"AnimateChild",propTypes:{children:a["default"].PropTypes.any},componentWillUnmount:function(){this.stop()},componentWillEnter:function(e){f["default"].isEnterSupported(this.props)?this.transition("enter",e):e()},componentWillAppear:function(e){f["default"].isAppearSupported(this.props)?this.transition("appear",e):e()},componentWillLeave:function(e){f["default"].isLeaveSupported(this.props)?this.transition("leave",e):e()},transition:function(e,t){var n=this,i=l["default"].findDOMNode(this),o=this.props,a=o.transitionName,s="object"===("undefined"==typeof a?"undefined":r(a));this.stop();var d=function(){n.stopper=null,t()};if((u.isCssAnimationSupported||!o.animation[e])&&a&&o[p[e]]){var f=s?a[e]:a+"-"+e,h=f+"-active";s&&a[e+"Active"]&&(h=a[e+"Active"]),this.stopper=(0,c["default"])(i,{name:f,active:h},d)}else this.stopper=o.animation[e](i,d)},stop:function(){var e=this.stopper;e&&(this.stopper=null,e.stop())},render:function(){return this.props.children}});t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){var t=[];return d["default"].Children.forEach(e,function(e){t.push(e)}),t}function o(e,t){var n=null;return e&&e.forEach(function(e){n||e&&e.key===t&&(n=e)}),n}function a(e,t,n){var i=null;return e&&e.forEach(function(e){if(e&&e.key===t&&e.props[n]){if(i)throw new Error("two child with same key for <rc-animate> children");i=e}}),i}function s(e,t,n){var i=0;return e&&e.forEach(function(e){i||(i=e&&e.key===t&&!e.props[n])}),i}function l(e,t,n){var i=e.length===t.length;return i&&e.forEach(function(e,r){var o=t[r];e&&o&&(e&&!o||!e&&o?i=!1:e.key!==o.key?i=!1:n&&e.props[n]!==o.props[n]&&(i=!1))}),i}function u(e,t){var n=[],i={},r=[];return e.forEach(function(e){e&&o(t,e.key)?r.length&&(i[e.key]=r,r=[]):r.push(e)}),t.forEach(function(e){e&&i.hasOwnProperty(e.key)&&(n=n.concat(i[e.key])),n.push(e)}),n=n.concat(r)}Object.defineProperty(t,"__esModule",{value:!0}),t.toArrayChildren=r,t.findChildInChildrenByKey=o,t.findShownChildInChildrenByKey=a,t.findHiddenChildInChildrenByKey=s,t.isSameChildren=l,t.mergeChildren=u;var c=n(1),d=i(c)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){for(var n=Object.getOwnPropertyNames(t),i=0;i<n.length;i++){var r=n[i],o=Object.getOwnPropertyDescriptor(t,r);o&&o.configurable&&void 0===e[r]&&Object.defineProperty(e,r,o)}return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):r(e,t))}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},c=n(1),d=i(c),f=n(404),p=i(f),h=n(5),m=i(h),y=function(e){function t(n){a(this,t);var i=s(this,e.call(this,n));i.handleFocus=function(e){i.setState({focus:!0}),i.props.onFocus(e)},i.handleBlur=function(e){i.setState({focus:!1}),i.props.onBlur(e)},i.handleChange=function(e){"checked"in i.props||i.setState({checked:e.target.checked}),i.props.onChange({target:u({},i.props,{checked:e.target.checked}),stopPropagation:function(){e.stopPropagation()},preventDefault:function(){e.preventDefault()}})};var r=!1;return r="checked"in n?n.checked:n.defaultChecked,i.state={checked:r,focus:!1},i}return l(t,e),t.prototype.componentWillReceiveProps=function(e){"checked"in e&&this.setState({checked:e.checked})},t.prototype.shouldComponentUpdate=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return p["default"].shouldComponentUpdate.apply(this,t)},t.prototype.render=function(){var e,t=u({},this.props);delete t.defaultChecked;var n=this.state,i=t.prefixCls,r=n.checked;"boolean"==typeof r&&(r=r?1:0);var a=(0,m["default"])((e={},o(e,t.className,!!t.className),o(e,i,1),o(e,i+"-checked",r),o(e,i+"-checked-"+r,!!r),o(e,i+"-focused",n.focus),o(e,i+"-disabled",t.disabled),e));return d["default"].createElement("span",{className:a,style:t.style},d["default"].createElement("span",{className:i+"-inner"}),d["default"].createElement("input",{name:t.name,type:t.type,readOnly:t.readOnly,disabled:t.disabled,tabIndex:t.tabIndex,className:i+"-input",checked:!!r,onClick:this.props.onClick,onFocus:this.handleFocus,onBlur:this.handleBlur,onChange:this.handleChange}))},t}(d["default"].Component);y.propTypes={name:d["default"].PropTypes.string,prefixCls:d["default"].PropTypes.string,style:d["default"].PropTypes.object,type:d["default"].PropTypes.string,className:d["default"].PropTypes.string,defaultChecked:d["default"].PropTypes.oneOfType([d["default"].PropTypes.number,d["default"].PropTypes.bool]),checked:d["default"].PropTypes.oneOfType([d["default"].PropTypes.number,d["default"].PropTypes.bool]),onFocus:d["default"].PropTypes.func,onBlur:d["default"].PropTypes.func,onChange:d["default"].PropTypes.func,onClick:d["default"].PropTypes.func},y.defaultProps={prefixCls:"rc-checkbox",style:{},type:"checkbox",className:"",defaultChecked:!1,onFocus:function(){},onBlur:function(){},onChange:function(){}},t["default"]=y,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function a(e){var t=e;return Array.isArray(t)||(t=t?[t]:[]),t}Object.defineProperty(t,"__esModule",{value:!0});var s=n(1),l=i(s),u=n(350),c=i(u),d=n(353),f=i(d),p=n(5),h=i(p),m=l["default"].createClass({displayName:"Collapse",propTypes:{children:s.PropTypes.any,prefixCls:s.PropTypes.string,activeKey:s.PropTypes.oneOfType([s.PropTypes.string,s.PropTypes.arrayOf(s.PropTypes.string)]),defaultActiveKey:s.PropTypes.oneOfType([s.PropTypes.string,s.PropTypes.arrayOf(s.PropTypes.string)]),openAnimation:s.PropTypes.object,onChange:s.PropTypes.func,accordion:s.PropTypes.bool,className:s.PropTypes.string,style:s.PropTypes.object},statics:{Panel:c["default"]},getDefaultProps:function(){return{prefixCls:"rc-collapse",onChange:function(){},accordion:!1}},getInitialState:function(){var e=this.props,t=e.activeKey,n=e.defaultActiveKey,i=n;return"activeKey"in this.props&&(i=t),{openAnimation:this.props.openAnimation||(0,f["default"])(this.props.prefixCls),activeKey:a(i)}},componentWillReceiveProps:function(e){"activeKey"in e&&this.setState({activeKey:a(e.activeKey)}),"openAnimation"in e&&this.setState({openAnimation:e.openAnimation})},onClickItem:function(e){var t=this;return function(){var n=t.state.activeKey;if(t.props.accordion)n=n[0]===e?[]:[e];else{n=[].concat(o(n));var i=n.indexOf(e),r=i>-1;r?n.splice(i,1):n.push(e)}t.setActiveKey(n)}},getItems:function(){var e=this,t=this.state.activeKey,n=this.props,i=n.prefixCls,r=n.accordion;return s.Children.map(this.props.children,function(n,o){var a=n.key||String(o),s=n.props.header,u=!1;u=r?t[0]===a:t.indexOf(a)>-1;var c={key:a,header:s,isActive:u,prefixCls:i,openAnimation:e.state.openAnimation,children:n.props.children,onItemClick:e.onClickItem(a).bind(e)};return l["default"].cloneElement(n,c)})},setActiveKey:function(e){"activeKey"in this.props||this.setState({activeKey:e}),this.props.onChange(this.props.accordion?e[0]:e)},render:function(){var e,t=this.props,n=t.prefixCls,i=t.className,o=t.style,a=(0,h["default"])((e={},r(e,n,!0),r(e,i,!!i),e));return l["default"].createElement("div",{className:a,style:o},this.getItems())}});t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=i(o),s=n(5),l=i(s),u=n(351),c=i(u),d=n(45),f=i(d),p=a["default"].createClass({displayName:"CollapsePanel",propTypes:{className:o.PropTypes.oneOfType([o.PropTypes.string,o.PropTypes.object]),children:o.PropTypes.any,openAnimation:o.PropTypes.object,prefixCls:o.PropTypes.string,header:o.PropTypes.oneOfType([o.PropTypes.string,o.PropTypes.number,o.PropTypes.node]),isActive:o.PropTypes.bool,onItemClick:o.PropTypes.func},getDefaultProps:function(){return{isActive:!1,onItemClick:function(){}}},handleItemClick:function(){this.props.onItemClick()},render:function(){var e,t=this.props,n=t.className,i=t.prefixCls,o=t.header,s=t.children,u=t.isActive,d=i+"-header",p=(0,l["default"])((e={},r(e,i+"-item",!0),r(e,i+"-item-active",u),r(e,n,n),e));return a["default"].createElement("div",{className:p},a["default"].createElement("div",{className:d,onClick:this.handleItemClick,role:"tab","aria-expanded":u},a["default"].createElement("i",{className:"arrow"}),o),a["default"].createElement(f["default"],{showProp:"isActive",exclusive:!0,component:"",animation:this.props.openAnimation},a["default"].createElement(c["default"],{prefixCls:i,isActive:u},s)))}});t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=i(o),s=n(5),l=i(s),u=a["default"].createClass({displayName:"PanelContent",propTypes:{prefixCls:o.PropTypes.string,isActive:o.PropTypes.bool,children:o.PropTypes.any},shouldComponentUpdate:function(e){return this.props.isActive||e.isActive},render:function(){var e;if(this._isActived=this._isActived||this.props.isActive,!this._isActived)return null;var t=this.props,n=t.prefixCls,i=t.isActive,o=t.children,s=(0,l["default"])((e={},r(e,n+"-content",!0),r(e,n+"-content-active",i),r(e,n+"-content-inactive",!i),e));return a["default"].createElement("div",{className:s,role:"tabpanel"},a["default"].createElement("div",{className:n+"-content-box"},o))}});t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(349),o=i(r);t["default"]=o["default"],e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n,i){var r=void 0;return(0,s["default"])(e,n,{start:function(){t?(r=e.offsetHeight,e.style.height=0):e.style.height=e.offsetHeight+"px"},active:function(){e.style.height=(t?r:0)+"px"},end:function(){e.style.height="",i()}})}function o(e){return{enter:function(t,n){return r(t,!0,e+"-anim",n)},leave:function(t,n){return r(t,!1,e+"-anim",n)}}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(102),s=i(a);t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){}function o(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],i="scroll"+(t?"Top":"Left");if("number"!=typeof n){var r=e.document;n=r.documentElement[i],"number"!=typeof n&&(n=r.body[i])}return n}function a(e,t){var n=e.style;["Webkit","Moz","Ms","ms"].forEach(function(e){n[e+"TransformOrigin"]=t}),n.transformOrigin=t}function s(e){var t=e.getBoundingClientRect(),n={left:t.left,top:t.top},i=e.ownerDocument,r=i.defaultView||i.parentWindow;return n.left+=o(r),n.top+=o(r,!0),n}Object.defineProperty(t,"__esModule",{value:!0});var l=n(1),u=i(l),c=n(9),d=i(c),f=n(356),p=i(f),h=n(45),m=i(h),y=n(355),v=i(y),g=n(358),b=i(g),M=n(10),T=i(M),x=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},C=0,_=0,w=u["default"].createClass({displayName:"Dialog",getDefaultProps:function(){return{afterClose:r,className:"",mask:!0,visible:!1,keyboard:!0,closable:!0,maskClosable:!0,prefixCls:"rc-dialog",onClose:r}},componentWillMount:function(){this.titleId="rcDialogTitle"+C++},componentDidMount:function(){this.componentDidUpdate({})},componentDidUpdate:function(e){var t=this.props,n=this.props.mousePosition;if(t.visible){if(!e.visible){this.lastOutSideFocusNode=document.activeElement,this.addScrollingEffect(),this.refs.wrap.focus();var i=d["default"].findDOMNode(this.refs.dialog);if(n){var r=s(i);a(i,n.x-r.left+"px "+(n.y-r.top)+"px")}else a(i,"")}}else if(e.visible&&t.mask&&this.lastOutSideFocusNode){try{this.lastOutSideFocusNode.focus()}catch(o){this.lastOutSideFocusNode=null}this.lastOutSideFocusNode=null}},onAnimateLeave:function(){this.refs.wrap&&(this.refs.wrap.style.display="none"),this.removeScrollingEffect(),this.props.afterClose()},onMaskClick:function(e){e.target===e.currentTarget&&this.props.maskClosable&&this.close(e)},onKeyDown:function(e){var t=this.props;if(t.keyboard&&e.keyCode===p["default"].ESC&&this.close(e),t.visible&&e.keyCode===p["default"].TAB){var n=document.activeElement,i=this.refs.wrap,r=this.refs.sentinel;e.shiftKey?n===i&&r.focus():n===this.refs.sentinel&&i.focus()}},getDialogElement:function(){var e=this.props,t=e.closable,n=e.prefixCls,i={};void 0!==e.width&&(i.width=e.width),void 0!==e.height&&(i.height=e.height);var r=void 0;e.footer&&(r=u["default"].createElement("div",{className:n+"-footer",ref:"footer"},e.footer));var o=void 0;e.title&&(o=u["default"].createElement("div",{className:n+"-header",ref:"header"},u["default"].createElement("div",{className:n+"-title",id:this.titleId},e.title)));var a=void 0;t&&(a=u["default"].createElement("button",{onClick:this.close,"aria-label":"Close",className:n+"-close"},u["default"].createElement("span",{className:n+"-close-x"})));var s=(0,T["default"])({},e.style,i),l=this.getTransitionName(),c=u["default"].createElement(v["default"],{role:"document",ref:"dialog",style:s,className:n+" "+(e.className||""),visible:e.visible},u["default"].createElement("div",{className:n+"-content"},a,o,u["default"].createElement("div",x({className:n+"-body",style:e.bodyStyle,ref:"body"},e.bodyProps),e.children),r),u["default"].createElement("div",{tabIndex:0,ref:"sentinel",style:{width:0,height:0,overflow:"hidden"}},"sentinel"));return u["default"].createElement(m["default"],{key:"dialog",showProp:"visible",onLeave:this.onAnimateLeave,transitionName:l,component:"",transitionAppear:!0},c)},getZIndexStyle:function(){var e={},t=this.props;return void 0!==t.zIndex&&(e.zIndex=t.zIndex),e},getWrapStyle:function(){return(0,T["default"])({},this.getZIndexStyle(),this.props.wrapStyle)},getMaskStyle:function(){return(0,T["default"])({},this.getZIndexStyle(),this.props.maskStyle)},getMaskElement:function(){var e=this.props,t=void 0;if(e.mask){var n=this.getMaskTransitionName();t=u["default"].createElement(v["default"],{style:this.getMaskStyle(),key:"mask",className:e.prefixCls+"-mask",hiddenClassName:e.prefixCls+"-mask-hidden",visible:e.visible}),n&&(t=u["default"].createElement(m["default"],{key:"mask",showProp:"visible",transitionAppear:!0,component:"",transitionName:n},t))}return t},getMaskTransitionName:function(){var e=this.props,t=e.maskTransitionName,n=e.maskAnimation;return!t&&n&&(t=e.prefixCls+"-"+n),t},getTransitionName:function(){var e=this.props,t=e.transitionName,n=e.animation;return!t&&n&&(t=e.prefixCls+"-"+n),t},getElement:function(e){return this.refs[e]},setScrollbar:function(){this.bodyIsOverflowing&&void 0!==this.scrollbarWidth&&(document.body.style.paddingRight=this.scrollbarWidth+"px")},addScrollingEffect:function(){_++,1===_&&(this.checkScrollbar(),this.setScrollbar(),document.body.style.overflow="hidden")},removeScrollingEffect:function(){_--,0===_&&(document.body.style.overflow="",this.resetScrollbar())},close:function(e){this.props.onClose(e)},checkScrollbar:function(){var e=window.innerWidth;if(!e){var t=document.documentElement.getBoundingClientRect();e=t.right-Math.abs(t.left)}this.bodyIsOverflowing=document.body.clientWidth<e,this.bodyIsOverflowing&&(this.scrollbarWidth=(0,b["default"])())},resetScrollbar:function(){document.body.style.paddingRight=""},adjustDialog:function(){if(this.refs.wrap&&void 0!==this.scrollbarWidth){var e=this.refs.wrap.scrollHeight>document.documentElement.clientHeight;this.refs.wrap.style.paddingLeft=(!this.bodyIsOverflowing&&e?this.scrollbarWidth:"")+"px",this.refs.wrap.style.paddingRight=(this.bodyIsOverflowing&&!e?this.scrollbarWidth:"")+"px"}},resetAdjustments:function(){this.refs.wrap&&(this.refs.wrap.style.paddingLeft=this.refs.wrap.style.paddingLeft="")},render:function(){var e=this.props,t=e.prefixCls,n=this.getWrapStyle();return e.visible&&(n.display=null),u["default"].createElement("div",null,this.getMaskElement(),u["default"].createElement("div",x({tabIndex:-1,onKeyDown:this.onKeyDown,className:t+"-wrap "+(e.wrapClassName||""),ref:"wrap",onClick:this.onMaskClick,role:"dialog","aria-labelledby":e.title?this.titleId:null,style:n},e.wrapProps),this.getDialogElement()))}});t["default"]=w,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(10),s=i(a),l=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},u=o["default"].createClass({displayName:"LazyRenderBox",shouldComponentUpdate:function(e){return!!e.hiddenClassName||!!e.visible},render:function(){var e=this.props.className;this.props.hiddenClassName&&!this.props.visible&&(e+=" "+this.props.hiddenClassName);var t=(0,s["default"])({},this.props);return delete t.hiddenClassName,delete t.visible,t.className=e,o["default"].createElement("div",l({},t))}});t["default"]=u,e.exports=t["default"]},function(e,t){"use strict";var n={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229};n.isTextModifyingKeyEvent=function(e){var t=e.keyCode;if(e.altKey&&!e.ctrlKey||e.metaKey||t>=n.F1&&t<=n.F12)return!1;switch(t){case n.ALT:case n.CAPS_LOCK:case n.CONTEXT_MENU:case n.CTRL:case n.DOWN:case n.END:case n.ESC:case n.HOME:case n.INSERT:case n.LEFT:case n.MAC_FF_META:case n.META:case n.NUMLOCK:case n.NUM_CENTER:case n.PAGE_DOWN:case n.PAGE_UP:case n.PAUSE:case n.PRINT_SCREEN:case n.RIGHT:case n.SHIFT:case n.UP:case n.WIN_KEY:case n.WIN_KEY_RIGHT:return!1;default:return!0}},n.isCharacterKey=function(e){if(e>=n.ZERO&&e<=n.NINE)return!0;if(e>=n.NUM_ZERO&&e<=n.NUM_MULTIPLY)return!0;if(e>=n.A&&e<=n.Z)return!0;if(window.navigation.userAgent.indexOf("WebKit")!==-1&&0===e)return!0;switch(e){case n.SPACE:case n.QUESTION_MARK:case n.NUM_PLUS:case n.NUM_MINUS:case n.NUM_PERIOD:case n.NUM_DIVISION:case n.SEMICOLON:case n.DASH:case n.EQUALS:case n.COMMA:case n.PERIOD:case n.SLASH:case n.APOSTROPHE:case n.SINGLE_QUOTE:case n.OPEN_SQUARE_BRACKET:case n.BACKSLASH:case n.CLOSE_SQUARE_BRACKET:return!0;default:return!1}},e.exports=n},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){var e=document.createElement("div");return document.body.appendChild(e),e}function o(e){function t(e,t,n){(!c||e._component||c(e))&&(e._container||(e._container=p(e)),l["default"].unstable_renderSubtreeIntoContainer(e,d(e,t),e._container,function(){e._component=this,n&&n.call(this)}))}function n(e){if(e._container){var t=e._container;l["default"].unmountComponentAtNode(t),t.parentNode.removeChild(t),e._container=null}}var i=e.autoMount,o=void 0===i||i,s=e.autoDestroy,u=void 0===s||s,c=e.isVisible,d=e.getComponent,f=e.getContainer,p=void 0===f?r:f,h=void 0;return o&&(h=a({},h,{componentDidMount:function(){t(this)},componentDidUpdate:function(){t(this)}})),o&&u||(h=a({},h,{renderComponent:function(e,n){t(this,e,n)}})),h=u?a({},h,{componentWillUnmount:function(){n(this)}}):a({},h,{removeContainer:function(){n(this)}})}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t["default"]=o;var s=n(9),l=i(s);e.exports=t["default"]},function(e,t){"use strict";function n(e){if(e||void 0===i){var t=document.createElement("div");t.style.width="100%",t.style.height="200px";var n=document.createElement("div"),r=n.style;r.position="absolute",r.top=0,r.left=0,r.pointerEvents="none",r.visibility="hidden",r.width="200px",r.height="150px",r.overflow="hidden",n.appendChild(t),document.body.appendChild(n);var o=t.offsetWidth;n.style.overflow="scroll";var a=t.offsetWidth;o===a&&(a=n.clientWidth),document.body.removeChild(n),i=o-a}return i}var i=void 0;e.exports=n},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){for(var t=e,n=0,i=0;t&&!isNaN(t.offsetLeft)&&!isNaN(t.offsetTop);)n+=t.offsetLeft-t.scrollLeft,i+=t.offsetTop-t.scrollTop,t=t.offsetParent;return{top:i,left:n}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),a=i(o),s=n(7),l=i(s),u=n(34),c=i(u),d=n(2),f=i(d),p=n(4),h=i(p),m=n(3),y=i(m),v=n(1),g=i(v),b=n(9),M=i(b),T=n(5),x=i(T),C=20,_=function(e){function t(n){(0,f["default"])(this,t);var i=(0,h["default"])(this,e.call(this,n));return i.onOverlayClicked=function(){i.props.open&&i.props.onOpenChange(!1,{overlayClicked:!0})},i.onTouchStart=function(e){if(!i.isTouching()){var t=e.targetTouches[0];i.setState({touchIdentifier:i.notTouch?null:t.identifier,touchStartX:t.clientX,touchStartY:t.clientY,touchCurrentX:t.clientX,touchCurrentY:t.clientY})}},i.onTouchMove=function(e){if(i.isTouching())for(var t=0;t<e.targetTouches.length;t++)if(e.targetTouches[t].identifier===i.state.touchIdentifier){i.setState({touchCurrentX:e.targetTouches[t].clientX,touchCurrentY:e.targetTouches[t].clientY});break}},i.onTouchEnd=function(){if(i.notTouch=!1,i.isTouching()){var e=i.touchSidebarWidth();(i.props.open&&e<i.state.sidebarWidth-i.props.dragToggleDistance||!i.props.open&&e>i.props.dragToggleDistance)&&i.props.onOpenChange(!i.props.open);var t=i.touchSidebarHeight();(i.props.open&&t<i.state.sidebarHeight-i.props.dragToggleDistance||!i.props.open&&t>i.props.dragToggleDistance)&&i.props.onOpenChange(!i.props.open),
i.setState({touchIdentifier:null,touchStartX:null,touchStartY:null,touchCurrentX:null,touchCurrentY:null})}},i.onScroll=function(){i.isTouching()&&i.inCancelDistanceOnScroll()&&i.setState({touchIdentifier:null,touchStartX:null,touchStartY:null,touchCurrentX:null,touchCurrentY:null})},i.inCancelDistanceOnScroll=function(){var e=void 0;switch(i.props.position){case"right":e=Math.abs(i.state.touchCurrentX-i.state.touchStartX)<C;break;case"bottom":e=Math.abs(i.state.touchCurrentY-i.state.touchStartY)<C;break;case"top":e=Math.abs(i.state.touchStartY-i.state.touchCurrentY)<C;break;case"left":default:e=Math.abs(i.state.touchStartX-i.state.touchCurrentX)<C}return e},i.isTouching=function(){return null!==i.state.touchIdentifier},i.saveSidebarSize=function(){var e=M["default"].findDOMNode(i.refs.sidebar),t=e.offsetWidth,n=e.offsetHeight,o=r(M["default"].findDOMNode(i.refs.sidebar)).top,a=r(M["default"].findDOMNode(i.refs.dragHandle)).top;t!==i.state.sidebarWidth&&i.setState({sidebarWidth:t}),n!==i.state.sidebarHeight&&i.setState({sidebarHeight:n}),o!==i.state.sidebarTop&&i.setState({sidebarTop:o}),a!==i.state.dragHandleTop&&i.setState({dragHandleTop:a})},i.touchSidebarWidth=function(){return"right"===i.props.position?i.props.open&&window.innerWidth-i.state.touchStartX<i.state.sidebarWidth?i.state.touchCurrentX>i.state.touchStartX?i.state.sidebarWidth+i.state.touchStartX-i.state.touchCurrentX:i.state.sidebarWidth:Math.min(window.innerWidth-i.state.touchCurrentX,i.state.sidebarWidth):"left"===i.props.position?i.props.open&&i.state.touchStartX<i.state.sidebarWidth?i.state.touchCurrentX>i.state.touchStartX?i.state.sidebarWidth:i.state.sidebarWidth-i.state.touchStartX+i.state.touchCurrentX:Math.min(i.state.touchCurrentX,i.state.sidebarWidth):void 0},i.touchSidebarHeight=function(){if("bottom"===i.props.position)return i.props.open&&window.innerHeight-i.state.touchStartY<i.state.sidebarHeight?i.state.touchCurrentY>i.state.touchStartY?i.state.sidebarHeight+i.state.touchStartY-i.state.touchCurrentY:i.state.sidebarHeight:Math.min(window.innerHeight-i.state.touchCurrentY,i.state.sidebarHeight);if("top"===i.props.position){var e=i.state.touchStartY-i.state.sidebarTop;return i.props.open&&e<i.state.sidebarHeight?i.state.touchCurrentY>i.state.touchStartY?i.state.sidebarHeight:i.state.sidebarHeight-i.state.touchStartY+i.state.touchCurrentY:Math.min(i.state.touchCurrentY-i.state.dragHandleTop,i.state.sidebarHeight)}},i.renderStyle=function(e){var t=e.sidebarStyle,n=e.isTouching,r=e.overlayStyle,o=e.contentStyle;if("right"===i.props.position||"left"===i.props.position){if(t.transform="translateX(0%)",t.WebkitTransform="translateX(0%)",n){var a=i.touchSidebarWidth()/i.state.sidebarWidth;"right"===i.props.position&&(t.transform="translateX("+100*(1-a)+"%)",t.WebkitTransform="translateX("+100*(1-a)+"%)"),"left"===i.props.position&&(t.transform="translateX(-"+100*(1-a)+"%)",t.WebkitTransform="translateX(-"+100*(1-a)+"%)"),r.opacity=a,r.visibility="visible"}o&&(o[i.props.position]=i.state.sidebarWidth+"px")}if("top"===i.props.position||"bottom"===i.props.position){if(t.transform="translateY(0%)",t.WebkitTransform="translateY(0%)",n){var s=i.touchSidebarHeight()/i.state.sidebarHeight;"bottom"===i.props.position&&(t.transform="translateY("+100*(1-s)+"%)",t.WebkitTransform="translateY("+100*(1-s)+"%)"),"top"===i.props.position&&(t.transform="translateY(-"+100*(1-s)+"%)",t.WebkitTransform="translateY(-"+100*(1-s)+"%)"),r.opacity=s,r.visibility="visible"}o&&(o[i.props.position]=i.state.sidebarHeight+"px")}},i.state={sidebarWidth:0,sidebarHeight:0,sidebarTop:0,dragHandleTop:0,touchIdentifier:null,touchStartX:null,touchStartY:null,touchCurrentX:null,touchCurrentY:null,touchSupported:"object"===("undefined"==typeof window?"undefined":(0,c["default"])(window))&&"ontouchstart"in window},i}return(0,y["default"])(t,e),t.prototype.componentDidMount=function(){this.saveSidebarSize()},t.prototype.componentDidUpdate=function(){this.isTouching()||this.saveSidebarSize()},t.prototype.render=function(){var e,t=this,n=this.props,i=n.className,r=n.style,o=n.prefixCls,s=n.position,u=n.transitions,c=n.touch,d=n.enableDragHandle,f=n.sidebar,p=n.children,h=n.docked,m=n.open,y=(0,l["default"])({},this.props.sidebarStyle),v=(0,l["default"])({},this.props.contentStyle),b=(0,l["default"])({},this.props.overlayStyle),M=(e={},(0,a["default"])(e,i,!!i),(0,a["default"])(e,o,!0),(0,a["default"])(e,o+"-"+s,!0),e),T={style:r},C=this.isTouching();C?this.renderStyle({sidebarStyle:y,isTouching:!0,overlayStyle:b}):h?0!==this.state.sidebarWidth&&(M[o+"-docked"]=!0,this.renderStyle({sidebarStyle:y,contentStyle:v})):m&&(M[o+"-open"]=!0,this.renderStyle({sidebarStyle:y}),b.opacity=1,b.visibility="visible"),!C&&u||(y.transition="none",y.WebkitTransition="none",v.transition="none",b.transition="none");var _=null;return this.state.touchSupported&&c&&(m?(T.onTouchStart=function(e){t.notTouch=!0,t.onTouchStart(e)},T.onTouchMove=this.onTouchMove,T.onTouchEnd=this.onTouchEnd,T.onTouchCancel=this.onTouchEnd,T.onScroll=this.onScroll):d&&(_=g["default"].createElement("div",{className:o+"-draghandle",style:this.props.dragHandleStyle,onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd,onTouchCancel:this.onTouchEnd,ref:"dragHandle"}))),g["default"].createElement("div",(0,l["default"])({className:(0,x["default"])(M)},T),g["default"].createElement("div",{className:o+"-sidebar",style:y,ref:"sidebar"},f),g["default"].createElement("div",{className:o+"-overlay",style:b,role:"presentation",tabIndex:"0",ref:"overlay",onClick:this.onOverlayClicked}),g["default"].createElement("div",{className:o+"-content",style:v,ref:"content"},_,p))},t}(g["default"].Component);_.propTypes={prefixCls:g["default"].PropTypes.string,className:g["default"].PropTypes.string,children:g["default"].PropTypes.node.isRequired,style:g["default"].PropTypes.object,sidebarStyle:g["default"].PropTypes.object,contentStyle:g["default"].PropTypes.object,overlayStyle:g["default"].PropTypes.object,dragHandleStyle:g["default"].PropTypes.object,sidebar:g["default"].PropTypes.node.isRequired,docked:g["default"].PropTypes.bool,open:g["default"].PropTypes.bool,transitions:g["default"].PropTypes.bool,touch:g["default"].PropTypes.bool,enableDragHandle:g["default"].PropTypes.bool,position:g["default"].PropTypes.oneOf(["left","right","top","bottom"]),dragToggleDistance:g["default"].PropTypes.number,onOpenChange:g["default"].PropTypes.func},_.defaultProps={prefixCls:"rc-drawer",sidebarStyle:{},contentStyle:{},overlayStyle:{},dragHandleStyle:{},docked:!1,open:!1,transitions:!0,touch:!0,enableDragHandle:!0,position:"left",dragToggleDistance:30,onOpenChange:function(){}},t["default"]=_,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(359),o=i(r);t["default"]=o["default"],e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=i(r),a=n(7),s=i(a),l=n(2),u=i(l),c=n(4),d=i(c),f=n(3),p=i(f),h=n(1),m=i(h),y=n(5),v=i(y),g=n(364),b=i(g),M=function(e){function t(){return(0,u["default"])(this,t),(0,d["default"])(this,e.apply(this,arguments))}return(0,p["default"])(t,e),t.prototype.render=function(){var e,t=(0,s["default"])({},this.props),n=t.prefixCls,i=(0,v["default"])((e={},(0,o["default"])(e,""+t.className,!0),(0,o["default"])(e,n+"-handler-active",!t.disabled&&t.touchFeedback),e));return["prefixCls","touchFeedback"].forEach(function(e){t.hasOwnProperty(e)&&delete t[e]}),m["default"].createElement("span",(0,s["default"])({},t,{className:i}),t.children)},t}(h.Component);M.defaultProps={prefixCls:"am-stepper"},t["default"]=(0,b["default"])(M,"InputHandler"),e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){}function o(e){e.preventDefault()}Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=i(a),l=n(7),u=i(l),c=n(1),d=i(c),f=n(5),p=i(f),h=n(363),m=i(h),y=n(361),v=i(y),g=d["default"].createClass({displayName:"InputNumber",propTypes:{focusOnUpDown:c.PropTypes.bool,onChange:c.PropTypes.func,onKeyDown:c.PropTypes.func,prefixCls:c.PropTypes.string,disabled:c.PropTypes.bool,onFocus:c.PropTypes.func,onBlur:c.PropTypes.func,readOnly:c.PropTypes.bool,max:c.PropTypes.number,min:c.PropTypes.number,step:c.PropTypes.oneOfType([c.PropTypes.number,c.PropTypes.string])},mixins:[m["default"]],getDefaultProps:function(){return{focusOnUpDown:!0,prefixCls:"rc-input-number"}},componentDidMount:function(){this.componentDidUpdate()},componentDidUpdate:function(){this.props.focusOnUpDown&&this.state.focused&&document.activeElement!==this.refs.input&&this.focus()},onKeyDown:function(e){var t;38===e.keyCode?this.up(e):40===e.keyCode&&this.down(e);for(var n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];(t=this.props).onKeyDown.apply(t,[e].concat(i))},getValueFromEvent:function(e){return e.target.value},focus:function(){this.refs.input.focus()},render:function(){var e,t=(0,u["default"])({},this.props),n=t.prefixCls,i=t.disabled,a=t.readOnly,l=(0,p["default"])((e={},(0,s["default"])(e,n,!0),(0,s["default"])(e,t.className,!!t.className),(0,s["default"])(e,n+"-disabled",i),(0,s["default"])(e,n+"-focused",this.state.focused),e)),c="",f="",h=this.state.value;if(isNaN(h))c=n+"-handler-up-disabled",f=n+"-handler-down-disabled";else{var m=Number(h);m>=t.max&&(c=n+"-handler-up-disabled"),m<=t.min&&(f=n+"-handler-down-disabled")}var y=!t.readOnly&&!t.disabled,g=void 0;return g=this.state.focused?this.state.inputValue:this.state.value,void 0===g&&(g=""),d["default"].createElement("div",{className:l,style:t.style},d["default"].createElement("div",{className:n+"-handler-wrap"},d["default"].createElement(v["default"],{ref:"up",disabled:!!c||i||a,prefixCls:n,unselectable:"unselectable",onTouchStart:y&&!c?this.up:r,onTouchEnd:this.stop,onMouseDown:y&&!c?this.up:r,onMouseUp:this.stop,onMouseLeave:this.stop,className:n+"-handler "+n+"-handler-up "+c},d["default"].createElement("span",{unselectable:"unselectable",className:n+"-handler-up-inner",onClick:o})),d["default"].createElement(v["default"],{ref:"down",disabled:!!f||i||a,prefixCls:n,unselectable:"unselectable",onTouchStart:y&&!f?this.down:r,onTouchEnd:this.stop,onMouseDown:y&&!f?this.down:r,onMouseUp:this.stop,onMouseLeave:this.stop,className:n+"-handler "+n+"-handler-down "+f},d["default"].createElement("span",{unselectable:"unselectable",className:n+"-handler-down-inner",onClick:o}))),d["default"].createElement("div",{className:n+"-input-wrap"},d["default"].createElement("input",{placeholder:t.placeholder,onClick:t.onClick,className:n+"-input",autoComplete:"off",onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onKeyUp:this.stop,autoFocus:t.autoFocus,readOnly:t.readOnly,disabled:t.disabled,max:t.max,min:t.min,name:t.name,onChange:this.onChange,ref:"input",value:g})))}});t["default"]=g,e.exports=t["default"]},function(e,t){"use strict";function n(){}Object.defineProperty(t,"__esModule",{value:!0});var i=50,r=600;t["default"]={getDefaultProps:function(){return{max:1/0,min:-(1/0),step:1,style:{},defaultValue:null,onChange:n,onKeyDown:n,onFocus:n,onBlur:n}},getInitialState:function(){var e=void 0,t=this.props;return e="value"in t?t.value:t.defaultValue,e=this.toPrecisionAsStep(e),{inputValue:e,value:e,focused:t.autoFocus}},componentWillReceiveProps:function(e){if("value"in e){var t=this.toPrecisionAsStep(e.value);this.setState({inputValue:t,value:t})}},componentWillUnmount:function(){this.stop()},onChange:function(e){this.setInputValue(this.getValueFromEvent(e).trim())},onFocus:function(){var e;this.setState({focused:!0}),(e=this.props).onFocus.apply(e,arguments)},onBlur:function(e){var t;this.setState({focused:!1});var n=this.getCurrentValidValue(this.getValueFromEvent(e).trim());this.setValue(n);for(var i=arguments.length,r=Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];(t=this.props).onBlur.apply(t,[e].concat(r))},getCurrentValidValue:function(e){var t=e,n=this.props;return""===t?t="":isNaN(t)?t=this.state.value:(t=Number(t),t<n.min&&(t=n.min),t>n.max&&(t=n.max)),this.toPrecisionAsStep(t)},setValue:function(e){"value"in this.props||this.setState({value:e,inputValue:e});var t=isNaN(e)||""===e?void 0:e;t!==this.state.value?this.props.onChange(t):this.setState({inputValue:this.state.value})},setInputValue:function(e){this.setState({inputValue:e})},getPrecision:function(){var e=this.props,t=e.step.toString();if(t.indexOf("e-")>=0)return parseInt(t.slice(t.indexOf("e-")+1),10);var n=0;return t.indexOf(".")>=0&&(n=t.length-t.indexOf(".")-1),n},getPrecisionFactor:function(){var e=this.getPrecision();return Math.pow(10,e)},toPrecisionAsStep:function(e){if(isNaN(e)||""===e)return e;var t=this.getPrecision();return Number(Number(e).toFixed(Math.abs(t)))},upStep:function(e){var t=this.props,n=t.step,i=t.min,r=this.getPrecisionFactor(),o=void 0;return o="number"==typeof e?(r*e+r*n)/r:i===-(1/0)?n:i,this.toPrecisionAsStep(o)},downStep:function(e){var t=this.props,n=t.step,i=t.min,r=this.getPrecisionFactor(),o=void 0;return o="number"==typeof e?(r*e-r*n)/r:i===-(1/0)?-n:i,this.toPrecisionAsStep(o)},step:function(e,t){t&&t.preventDefault();var n=this.props;if(!n.disabled){var i=this.getCurrentValidValue(this.state.inputValue);if(this.setState({value:i}),!isNaN(i)){var r=this[e+"Step"](i);r>n.max||r<n.min||(this.setValue(r),this.setState({focused:!0}))}}},stop:function(){this.autoStepTimer&&clearTimeout(this.autoStepTimer)},down:function(e,t){var n=this;e.persist&&e.persist(),this.stop(),this.step("down",e),this.autoStepTimer=setTimeout(function(){n.down(e,!0)},t?i:r)},up:function(e,t){var n=this;e.persist&&e.persist(),this.stop(),this.step("up",e),this.autoStepTimer=setTimeout(function(){n.up(e,!0)},t?i:r)}},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){var t=arguments.length<=1||void 0===arguments[1]?"":arguments[1],n=l["default"].createClass({displayName:"TouchableFeedbackComponent",propTypes:{onTouchStart:s.PropTypes.func,onTouchEnd:s.PropTypes.func,onTouchCancel:s.PropTypes.func},statics:{myName:t||"TouchableFeedbackComponent"},getInitialState:function(){return{touchFeedback:!1}},onTouchStart:function(e){this.props.onTouchStart&&this.props.onTouchStart(e),this.setTouchFeedbackState(!0)},onTouchEnd:function(e){this.props.onTouchEnd&&this.props.onTouchEnd(e),this.setTouchFeedbackState(!1)},onTouchCancel:function(e){this.props.onTouchCancel&&this.props.onTouchCancel(e),this.setTouchFeedbackState(!1)},onMouseDown:function(e){this.props.onTouchStart&&this.props.onTouchStart(e),this.setTouchFeedbackState(!0)},onMouseUp:function(e){this.props.onTouchEnd&&this.props.onTouchEnd(e),this.setTouchFeedbackState(!1)},setTouchFeedbackState:function(e){this.setState({touchFeedback:e})},render:function(){var t=u?{onTouchStart:this.onTouchStart,onTouchEnd:this.onTouchEnd,onTouchCancel:this.onTouchCancel}:{onMouseDown:this.onMouseDown,onMouseUp:this.state.touchFeedback?this.onMouseUp:void 0,onMouseLeave:this.state.touchFeedback?this.onMouseUp:void 0};return l["default"].createElement(e,(0,a["default"])({},this.props,{touchFeedback:this.state.touchFeedback},t))}});return n}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),a=i(o);t["default"]=r;var s=n(1),l=i(s),u="undefined"!=typeof window&&"ontouchstart"in window;e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=i(o),s=n(5),l=i(s),u=a["default"].createClass({displayName:"Notice",propTypes:{duration:o.PropTypes.number,onClose:o.PropTypes.func,children:o.PropTypes.any},getDefaultProps:function(){return{onEnd:function(){},onClose:function(){},duration:1.5,style:{right:"50%"}}},componentDidMount:function(){var e=this;this.props.duration&&(this.closeTimer=setTimeout(function(){e.close()},1e3*this.props.duration))},componentWillUnmount:function(){this.clearCloseTimer()},clearCloseTimer:function(){this.closeTimer&&(clearTimeout(this.closeTimer),this.closeTimer=null)},close:function(){this.clearCloseTimer(),this.props.onClose()},render:function(){var e,t=this.props,n=t.prefixCls+"-notice",i=(e={},r(e,""+n,1),r(e,n+"-closable",t.closable),r(e,t.className,!!t.className),e);return a["default"].createElement("div",{className:(0,l["default"])(i),style:t.style},a["default"].createElement("div",{className:n+"-content"},t.children),t.closable?a["default"].createElement("a",{tabIndex:"0",onClick:this.close,className:n+"-close"},a["default"].createElement("span",{className:n+"-close-x"})):null)}});t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){return"rcNotification_"+M+"_"+b++}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},s=n(1),l=i(s),u=n(9),c=i(u),d=n(45),f=i(d),p=n(368),h=i(p),m=n(5),y=i(m),v=n(365),g=i(v),b=0,M=Date.now(),T=l["default"].createClass({displayName:"Notification",propTypes:{prefixCls:s.PropTypes.string,transitionName:s.PropTypes.string,animation:s.PropTypes.oneOfType([s.PropTypes.string,s.PropTypes.object]),style:s.PropTypes.object},getDefaultProps:function(){return{prefixCls:"rc-notification",animation:"fade",style:{top:65,left:"50%"}}},getInitialState:function(){return{notices:[]}},getTransitionName:function(){var e=this.props,t=e.transitionName;return!t&&e.animation&&(t=e.prefixCls+"-"+e.animation),t},add:function(e){var t=e.key=e.key||o();this.setState(function(n){var i=n.notices;if(!i.filter(function(e){return e.key===t}).length)return{notices:i.concat(e)}})},remove:function(e){this.setState(function(t){return{notices:t.notices.filter(function(t){return t.key!==e})}})},render:function(){var e,t=this,n=this.props,i=this.state.notices.map(function(e){var i=(0,h["default"])(t.remove.bind(t,e.key),e.onClose);return l["default"].createElement(g["default"],a({prefixCls:n.prefixCls},e,{onClose:i}),e.content)}),o=(e={},r(e,n.prefixCls,1),r(e,n.className,!!n.className),e);return l["default"].createElement("div",{className:(0,y["default"])(o),style:n.style},l["default"].createElement(f["default"],{transitionName:this.getTransitionName()},i))}});T.newInstance=function(e){var t=e||{},n=document.createElement("div");document.body.appendChild(n);var i=c["default"].render(l["default"].createElement(T,t),n);return{notice:function(e){i.add(e)},removeNotice:function(e){i.remove(e)},component:i,destroy:function(){c["default"].unmountComponentAtNode(n),document.body.removeChild(n)}}},t["default"]=T,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(366),o=i(r);t["default"]=o["default"],e.exports=t["default"]},function(e,t){"use strict";function n(){var e=arguments;return function(){for(var t=0;t<e.length;t++)e[t]&&e[t].apply&&e[t].apply(this,arguments)}}e.exports=n},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=i(r),a=n(4),s=i(a),l=n(3),u=i(l),c=n(1),d=i(c),f=n(113),p=i(f),h=function(e){function t(n){(0,o["default"])(this,t);var i=(0,s["default"])(this,e.call(this,n));return i.state={isTooltipVisible:!1},i}return(0,u["default"])(t,e),t.prototype.showTooltip=function(){this.setState({isTooltipVisible:!0})},t.prototype.hideTooltip=function(){this.setState({isTooltipVisible:!1})},t.prototype.render=function(){var e=this.props,t=e.prefixCls,n=e.className,i=e.tipTransitionName,r=e.tipFormatter,o=e.vertical,a=e.offset,s=e.value,l=e.dragging,u=e.noTip,c=o?{bottom:a+"%"}:{left:a+"%"},f=d["default"].createElement("div",{className:n,style:c,onMouseUp:this.showTooltip.bind(this),onMouseEnter:this.showTooltip.bind(this),onMouseLeave:this.hideTooltip.bind(this)});if(u)return f;var h=l||this.state.isTooltipVisible;return d["default"].createElement(p["default"],{prefixCls:t.replace("slider","tooltip"),placement:"top",visible:h,overlay:d["default"].createElement("span",null,r(s)),delay:0,transitionName:i},f)},t}(d["default"].Component);t["default"]=h,h.propTypes={prefixCls:d["default"].PropTypes.string,className:d["default"].PropTypes.string,vertical:d["default"].PropTypes.bool,offset:d["default"].PropTypes.number,tipTransitionName:d["default"].PropTypes.string,tipFormatter:d["default"].PropTypes.func,value:d["default"].PropTypes.number,dragging:d["default"].PropTypes.bool,noTip:d["default"].PropTypes.bool},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=i(r),a=n(34),s=i(a),l=n(6),u=i(l),c=n(1),d=i(c),f=n(5),p=i(f),h=function(e){var t=e.className,n=e.vertical,i=e.marks,r=e.included,a=e.upperBound,l=e.lowerBound,c=e.max,f=e.min,h=Object.keys(i),m=h.length,y=100/(m-1),v=.9*y,g=c-f,b=h.map(parseFloat).sort(function(e,t){return e-t}).map(function(e){var c,h=!r&&e===a||r&&e<=a&&e>=l,m=(0,p["default"])((c={},(0,u["default"])(c,t+"-text",!0),(0,u["default"])(c,t+"-text-active",h),c)),y={marginBottom:"-200%",bottom:(e-f)/g*100+"%"},b={width:v+"%",marginLeft:-v/2+"%",left:(e-f)/g*100+"%"},M=n?y:b,T=i[e],x="object"===("undefined"==typeof T?"undefined":(0,s["default"])(T))&&!d["default"].isValidElement(T),C=x?T.label:T,_=x?(0,o["default"])({},M,T.style):M;return d["default"].createElement("span",{className:m,style:_,key:e},C)});return d["default"].createElement("div",{className:t},b)};t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){}function o(e){return e.touches.length>1||"touchend"===e.type.toLowerCase()&&e.touches.length>0}function a(e,t){return e?t.touches[0].clientY:t.touches[0].pageX}function s(e,t){return e?t.clientY:t.pageX}function l(e){e.stopPropagation(),e.preventDefault()}Object.defineProperty(t,"__esModule",{value:!0});var u=n(6),c=i(u),d=n(53),f=i(d),p=n(7),h=i(p),m=n(2),y=i(m),v=n(4),g=i(v),b=n(3),M=i(b),T=n(1),x=i(T),C=n(375),_=i(C),w=n(5),S=i(w),N=n(373),E=i(N),P=n(369),D=i(P),I=n(372),L=i(I),j=n(370),k=i(j),O=function(e){function t(n){(0,y["default"])(this,t);var i=(0,g["default"])(this,e.call(this,n)),r=n.range,o=n.min,a=n.max,s=r?Array.apply(null,Array(r+1)).map(function(){return o}):o,l="defaultValue"in n?n.defaultValue:s,u=void 0!==n.value?n.value:l,c=(r?u:[o,u]).map(function(e){return i.trimAlignValue(e)}),d=void 0;return d=r&&c[0]===c[c.length-1]&&c[0]===a?0:c.length-1,i.state={handle:null,recent:d,bounds:c},i}return(0,M["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){var t=this;if("value"in e||"min"in e||"max"in e){var n=this.state.bounds;if(e.range){var i=e.value||n,r=i.map(function(n){return t.trimAlignValue(n,e)});if(r.every(function(e,t){return e===n[t]}))return;this.setState({bounds:r}),n.some(function(n){return t.isValueOutOfBounds(n,e)})&&this.props.onChange(r)}else{var o=void 0!==e.value?e.value:n[1],a=this.trimAlignValue(o,e);if(a===n[1]&&n[0]===e.min)return;this.setState({bounds:[e.min,a]}),this.isValueOutOfBounds(n[1],e)&&this.props.onChange(a)}}},t.prototype.onChange=function(e){var t=this.props,n=!("value"in t);n?this.setState(e):e.handle&&this.setState({handle:e.handle});var i=(0,h["default"])({},this.state,e),r=t.range?i.bounds:i.bounds[1];t.onChange(r)},t.prototype.onMouseMove=function(e){var t=s(this.props.vertical,e);this.onMove(e,t)},t.prototype.onTouchMove=function(e){if(o(e))return void this.end("touch");var t=a(this.props.vertical,e);this.onMove(e,t)},t.prototype.onMove=function(e,t){l(e);var n=this.props,i=this.state,r=t-this.startPosition;r=this.props.vertical?-r:r;var o=r/this.getSliderLength()*(n.max-n.min),a=this.trimAlignValue(this.startValue+o),s=i[i.handle];if(a!==s){var u=[].concat((0,f["default"])(i.bounds));u[i.handle]=a;var c=i.handle;if(n.pushable!==!1){var d=i.bounds[c];this.pushSurroundingHandles(u,c,d)}else n.allowCross&&(u.sort(function(e,t){return e-t}),c=u.indexOf(a));this.onChange({handle:c,bounds:u})}},t.prototype.onTouchStart=function(e){if(!o(e)){var t=a(this.props.vertical,e);this.onStart(t),this.addDocumentEvents("touch"),l(e)}},t.prototype.onMouseDown=function(e){if(0===e.button){var t=s(this.props.vertical,e);this.onStart(t),this.addDocumentEvents("mouse"),l(e)}},t.prototype.onStart=function(e){var t=this.props;t.onBeforeChange(this.getValue());var n=this.calcValueByPos(e);this.startValue=n,this.startPosition=e;var i=this.state,r=i.bounds,o=1;if(this.props.range){for(var a=0,s=1;s<r.length-1;++s)n>r[s]&&(a=s);Math.abs(r[a+1]-n)<Math.abs(r[a]-n)&&(a+=1),o=a;var l=r[a+1]===r[a];l&&(o=i.recent),l&&n!==r[a+1]&&(o=n<r[a+1]?a:a+1)}this.setState({handle:o,recent:o});var u=i.bounds[o];if(n!==u){var c=[].concat((0,f["default"])(i.bounds));c[o]=n,this.onChange({bounds:c})}},t.prototype.getValue=function(){var e=this.state.bounds;return this.props.range?e:e[1]},t.prototype.getSliderLength=function(){var e=this.refs.slider;return e?this.props.vertical?e.clientHeight:e.clientWidth:0},t.prototype.getSliderStart=function(){var e=this.refs.slider,t=e.getBoundingClientRect();return this.props.vertical?t.top:t.left},t.prototype.getPrecision=function(e){var t=e.toString(),n=0;return t.indexOf(".")>=0&&(n=t.length-t.indexOf(".")-1),n},t.prototype.getPoints=function(){var e=this.props,t=e.marks,n=e.step,i=e.min,r=e.max,o=this._getPointsCache;if(!o||o.marks!==t||o.step!==n){var a=(0,h["default"])({},t);if(null!==n)for(var s=i;s<=r;s+=n)a[s]=s;var l=Object.keys(a).map(parseFloat);l.sort(function(e,t){return e-t}),this._getPointsCache={marks:t,step:n,points:l}}return this._getPointsCache.points},t.prototype.isValueOutOfBounds=function(e,t){return e<t.min||e>t.max},t.prototype.trimAlignValue=function(e,t){var n=this.state||{},i=n.handle,r=n.bounds,o=(0,h["default"])({},this.props,t||{}),a=o.marks,s=o.step,l=o.min,u=o.max,c=o.allowCross,d=e;d<=l&&(d=l),d>=u&&(d=u),!c&&null!=i&&i>0&&d<=r[i-1]&&(d=r[i-1]),!c&&null!=i&&i<r.length-1&&d>=r[i+1]&&(d=r[i+1]);var f=Object.keys(a).map(parseFloat);if(null!==s){var p=Math.round((d-l)/s)*s+l;f.push(p)}var m=f.map(function(e){return Math.abs(d-e)}),y=f[m.indexOf(Math.min.apply(Math,m))];return null!==s?parseFloat(y.toFixed(this.getPrecision(s))):y},t.prototype.pushHandleOnePoint=function(e,t,n){var i=this.getPoints(),r=i.indexOf(e[t]),o=r+n;if(o>=i.length||o<0)return!1;var a=t+n,s=i[o],l=this.props.pushable,u=n*(e[a]-s);return!!this.pushHandle(e,a,n,l-u)&&(e[t]=s,!0)},t.prototype.pushHandle=function(e,t,n,i){for(var r=e[t],o=e[t];n*(o-r)<i;){if(!this.pushHandleOnePoint(e,t,n))return e[t]=r,!1;o=e[t]}return!0},t.prototype.pushSurroundingHandles=function(e,t,n){var i=this.props.pushable,r=e[t],o=0;if(e[t+1]-r<i?o=1:r-e[t-1]<i&&(o=-1),0!==o){var a=t+o,s=o*(e[a]-r);this.pushHandle(e,a,o,i-s)||(e[t]=n)}},t.prototype.calcOffset=function(e){var t=this.props,n=t.min,i=t.max,r=(e-n)/(i-n);return 100*r},t.prototype.calcValue=function(e){var t=this.props,n=t.vertical,i=t.min,r=t.max,o=Math.abs(e/this.getSliderLength()),a=n?(1-o)*(r-i)+i:o*(r-i)+i;return a},t.prototype.calcValueByPos=function(e){var t=e-this.getSliderStart(),n=this.trimAlignValue(this.calcValue(t));return n},t.prototype.addDocumentEvents=function(e){"touch"===e?(this.onTouchMoveListener=(0,_["default"])(document,"touchmove",this.onTouchMove.bind(this)),this.onTouchUpListener=(0,_["default"])(document,"touchend",this.end.bind(this,"touch"))):"mouse"===e&&(this.onMouseMoveListener=(0,_["default"])(document,"mousemove",this.onMouseMove.bind(this)),this.onMouseUpListener=(0,_["default"])(document,"mouseup",this.end.bind(this,"mouse")))},t.prototype.removeEvents=function(e){"touch"===e?(this.onTouchMoveListener.remove(),this.onTouchUpListener.remove()):"mouse"===e&&(this.onMouseMoveListener.remove(),this.onMouseUpListener.remove())},t.prototype.end=function(e){this.removeEvents(e),this.props.onAfterChange(this.getValue()),this.setState({handle:null})},t.prototype.render=function(){var e,t=this,n=this.state,i=n.handle,o=n.bounds,a=this.props,s=a.className,l=a.prefixCls,u=a.disabled,d=a.vertical,f=a.dots,p=a.included,m=a.range,y=a.step,v=a.marks,g=a.max,b=a.min,M=a.tipTransitionName,C=a.tipFormatter,_=a.children,w=this.props.handle,N=o.map(function(e){return t.calcOffset(e)}),P=l+"-handle",D=o.map(function(e,t){var n;return(0,S["default"])((n={},(0,c["default"])(n,P,!0),(0,c["default"])(n,P+"-"+(t+1),!0),(0,c["default"])(n,P+"-lower",0===t),(0,c["default"])(n,P+"-upper",t===o.length-1),n))}),I=null===y||null===C,j={prefixCls:l,noTip:I,tipTransitionName:M,tipFormatter:C,vertical:d},O=o.map(function(e,t){return(0,T.cloneElement)(w,(0,h["default"])({},j,{className:D[t],value:e,offset:N[t],dragging:i===t,key:t}))});m||O.shift();for(var A=p||m,z=[],R=1;R<o.length;++R){var W,Y=(0,S["default"])((W={},(0,c["default"])(W,l+"-track",!0),(0,c["default"])(W,l+"-track-"+R,!0),W));z.push(x["default"].createElement(E["default"],{className:Y,vertical:d,included:A,offset:N[R-1],length:N[R]-N[R-1],key:R}))}var H=(0,S["default"])((e={},(0,c["default"])(e,l,!0),(0,c["default"])(e,l+"-disabled",u),(0,c["default"])(e,s,!!s),(0,c["default"])(e,l+"-vertical",this.props.vertical),e));return x["default"].createElement("div",{ref:"slider",className:H,onTouchStart:u?r:this.onTouchStart.bind(this),onMouseDown:u?r:this.onMouseDown.bind(this)},z,x["default"].createElement(L["default"],{prefixCls:l,vertical:d,marks:v,dots:f,step:y,included:A,lowerBound:o[0],upperBound:o[o.length-1],max:g,min:b}),O,x["default"].createElement(k["default"],{className:l+"-mark",vertical:d,marks:v,included:A,lowerBound:o[0],upperBound:o[o.length-1],max:g,min:b}),_)},t}(x["default"].Component);O.propTypes={min:x["default"].PropTypes.number,max:x["default"].PropTypes.number,step:x["default"].PropTypes.number,defaultValue:x["default"].PropTypes.oneOfType([x["default"].PropTypes.number,x["default"].PropTypes.arrayOf(x["default"].PropTypes.number)]),value:x["default"].PropTypes.oneOfType([x["default"].PropTypes.number,x["default"].PropTypes.arrayOf(x["default"].PropTypes.number)]),marks:x["default"].PropTypes.object,included:x["default"].PropTypes.bool,className:x["default"].PropTypes.string,prefixCls:x["default"].PropTypes.string,disabled:x["default"].PropTypes.bool,children:x["default"].PropTypes.any,onBeforeChange:x["default"].PropTypes.func,onChange:x["default"].PropTypes.func,onAfterChange:x["default"].PropTypes.func,handle:x["default"].PropTypes.element,tipTransitionName:x["default"].PropTypes.string,tipFormatter:x["default"].PropTypes.func,dots:x["default"].PropTypes.bool,range:x["default"].PropTypes.oneOfType([x["default"].PropTypes.bool,x["default"].PropTypes.number]),vertical:x["default"].PropTypes.bool,allowCross:x["default"].PropTypes.bool,pushable:x["default"].PropTypes.oneOfType([x["default"].PropTypes.bool,x["default"].PropTypes.number])},O.defaultProps={prefixCls:"rc-slider",className:"",tipTransitionName:"",min:0,max:100,step:1,marks:{},handle:x["default"].createElement(D["default"],null),onBeforeChange:r,onChange:r,onAfterChange:r,tipFormatter:function(e){return e},included:!0,disabled:!1,dots:!1,range:!1,vertical:!1,allowCross:!0,pushable:!1},t["default"]=O,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n,i,r,o){(0,f["default"])(!n||i>0,"`Slider[step]` should be a positive number in order to make Slider[dots] work.");var a=Object.keys(t).map(parseFloat);if(n)for(var s=r;s<=o;s+=i)a.indexOf(s)>=0||a.push(s);
return a}Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),a=i(o),s=n(1),l=i(s),u=n(5),c=i(u),d=n(448),f=i(d),p=function(e){var t=e.prefixCls,n=e.vertical,i=e.marks,o=e.dots,s=e.step,u=e.included,d=e.lowerBound,f=e.upperBound,p=e.max,h=e.min,m=p-h,y=r(n,i,o,s,h,p).map(function(e){var i,r=Math.abs(e-h)/m*100+"%",o=n?{bottom:r}:{left:r},s=!u&&e===f||u&&e<=f&&e>=d,p=(0,c["default"])((i={},(0,a["default"])(i,t+"-dot",!0),(0,a["default"])(i,t+"-dot-active",s),i));return l["default"].createElement("span",{className:p,style:o,key:e})});return l["default"].createElement("div",{className:t+"-step"},y)};t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=function(e){var t=e.className,n=e.included,i=e.vertical,r=e.offset,a=e.length,s={visibility:n?"visible":"hidden"};return i?(s.bottom=r+"%",s.height=a+"%"):(s.left=r+"%",s.width=a+"%"),o["default"].createElement("div",{className:t,style:s})};t["default"]=a,e.exports=t["default"]},function(e,t,n){"use strict";e.exports=n(371)},344,function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function a(e){return"string"==typeof e}function s(e){var t,n,i=e.className,s=e.prefixCls,u=e.style,d=e.tailWidth,p=e.status,h=void 0===p?"wait":p,m=e.iconPrefix,y=e.icon,v=e.wrapperStyle,g=e.adjustMarginRight,b=e.stepLast,M=e.stepNumber,T=e.description,x=e.title,C=o(e,["className","prefixCls","style","tailWidth","status","iconPrefix","icon","wrapperStyle","adjustMarginRight","stepLast","stepNumber","description","title"]),_=(0,f["default"])((t={},r(t,s+"-icon",!0),r(t,m+"icon",!0),r(t,m+"icon-"+y,y&&a(y)),r(t,m+"icon-check",!y&&"finish"===h),r(t,m+"icon-cross",!y&&"error"===h),t)),w=void 0;w=y&&!a(y)?c["default"].createElement("span",{className:s+"-icon"},y):y||"finish"===h||"error"===h?c["default"].createElement("span",{className:_}):c["default"].createElement("span",{className:s+"-icon"},M);var S=(0,f["default"])((n={},r(n,s+"-item",!0),r(n,s+"-item-last",b),r(n,s+"-status-"+h,!0),r(n,s+"-custom",y),r(n,i,!!i),n));return c["default"].createElement("div",l({},C,{className:S,style:l({width:d,marginRight:g},u)}),b?"":c["default"].createElement("div",{className:s+"-tail"},c["default"].createElement("i",null)),c["default"].createElement("div",{className:s+"-step"},c["default"].createElement("div",{className:s+"-head",style:{background:v.background||v.backgroundColor}},c["default"].createElement("div",{className:s+"-head-inner"},w)),c["default"].createElement("div",{className:s+"-main"},c["default"].createElement("div",{className:s+"-title",style:{background:v.background||v.backgroundColor}},x),T?c["default"].createElement("div",{className:s+"-description"},T):"")))}var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},u=n(1),c=i(u),d=n(5),f=i(d);s.propTypes={className:u.PropTypes.string,prefixCls:u.PropTypes.string,style:u.PropTypes.object,wrapperStyle:u.PropTypes.object,tailWidth:u.PropTypes.oneOfType([u.PropTypes.number,u.PropTypes.string]),status:u.PropTypes.string,iconPrefix:u.PropTypes.string,icon:u.PropTypes.node,adjustMarginRight:u.PropTypes.oneOfType([u.PropTypes.number,u.PropTypes.string]),stepLast:u.PropTypes.bool,stepNumber:u.PropTypes.string,description:u.PropTypes.any,title:u.PropTypes.any},e.exports=s},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){for(var n=Object.getOwnPropertyNames(t),i=0;i<n.length;i++){var r=n[i],o=Object.getOwnPropertyDescriptor(t,r);o&&o.configurable&&void 0===e[r]&&Object.defineProperty(e,r,o)}return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):r(e,t))}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},d=n(1),f=i(d),p=n(9),h=i(p),m=n(5),y=i(m),v=function(e){function t(n){s(this,t);var i=l(this,e.call(this,n));return i.culcLastStepOffsetWidth=function(){var e=h["default"].findDOMNode(i);e.children.length>0&&(i.culcTimeout=setTimeout(function(){var t=e.lastChild.offsetWidth+1;i.state.lastStepOffsetWidth!==t&&i.setState({lastStepOffsetWidth:t})}))},i.state={lastStepOffsetWidth:0},i}return u(t,e),t.prototype.componentDidMount=function(){this.culcLastStepOffsetWidth()},t.prototype.componentDidUpdate=function(){this.culcLastStepOffsetWidth()},t.prototype.componentWillUnmount=function(){this.culcTimeout&&clearTimeout(this.culcTimeout)},t.prototype.render=function(){var e,t=this,n=this.props,i=n.prefixCls,r=n.style,s=void 0===r?{}:r,l=n.className,u=n.children,d=n.direction,p=n.labelPlacement,h=n.iconPrefix,m=n.status,v=n.size,g=n.current,b=a(n,["prefixCls","style","className","children","direction","labelPlacement","iconPrefix","status","size","current"]),M=u.length-1,T=this.state.lastStepOffsetWidth>0,x=(0,y["default"])((e={},o(e,i,!0),o(e,i+"-"+v,v),o(e,i+"-"+d,!0),o(e,i+"-label-"+p,"horizontal"===d),o(e,i+"-hidden",!T),o(e,l,l),e));return f["default"].createElement("div",c({className:x,style:s},b),f["default"].Children.map(u,function(e,r){var o="vertical"!==d&&r!==M&&T?100/M+"%":null,a="vertical"===d||r===M?null:-(t.state.lastStepOffsetWidth/M+1),l={stepNumber:(r+1).toString(),stepLast:r===M,tailWidth:o,adjustMarginRight:a,prefixCls:i,iconPrefix:h,wrapperStyle:s};return"error"===m&&r===g-1&&(l.className=n.prefixCls+"-next-error"),e.props.status||(r===g?l.status=m:r<g?l.status="finish":l.status="wait"),f["default"].cloneElement(e,l)},this))},t}(f["default"].Component);t["default"]=v,v.propTypes={prefixCls:d.PropTypes.string,iconPrefix:d.PropTypes.string,direction:d.PropTypes.string,labelPlacement:d.PropTypes.string,children:d.PropTypes.any,status:d.PropTypes.string,size:d.PropTypes.string},v.defaultProps={prefixCls:"rc-steps",iconPrefix:"rc",direction:"horizontal",labelPlacement:"horizontal",current:0,status:"process",size:""},e.exports=t["default"]},function(e,t,n){"use strict";var i=n(377);i.Step=n(376),e.exports=i},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=i(r),a=n(14),s=i(a),l=n(2),u=i(l),c=n(4),d=i(c),f=n(3),p=i(f),h=n(1),m=i(h),y=n(71),v=i(y),g=n(340),b=i(g),M=n(381),T=i(M),x=function(e){function t(n){(0,u["default"])(this,t);var i=(0,d["default"])(this,e.call(this,n));return i.onPanStart=i.onPanStart.bind(i),i.onPan=i.onPan.bind(i),i.onPanEnd=i.onPanEnd.bind(i),i.onTap=i.onTap.bind(i),i.openedLeft=!1,i.openedRight=!1,i}return(0,p["default"])(t,e),t.prototype.componentDidMount=function(){var e=this.props,t=e.left,n=e.right,i=this.refs.content.offsetWidth;this.contentWidth=i,this.btnsLeftWidth=t?i/5*t.length:0,this.btnsRightWidth=n?i/5*n.length:0},t.prototype.onPanStart=function(e){this.props.disabled||(this.panStartX=e.deltaX)},t.prototype.onPan=function(e){if(!this.props.disabled){var t=e.deltaX-this.panStartX;this.openedRight?t-=this.btnsRightWidth:this.openedLeft&&(t+=this.btnsLeftWidth),t<0&&this.props.right?this._setStyle(Math.min(t,0)):t>0&&this.props.left&&this._setStyle(Math.max(t,0))}},t.prototype.onPanEnd=function(e){if(!this.props.disabled){var t=e.deltaX-this.panStartX,n=this.contentWidth,i=this.btnsLeftWidth,r=this.btnsRightWidth,o=.33*n,a=t>o||t>i/2,s=t<-o||t<-r/2;this.openedRight&&(s=t-o<-o),this.openedLeft&&(a=t+o>o),s&&t<0?this.open(-r,!1,!0):a&&t>0?this.open(i,!0,!1):this.close()}},t.prototype.onTap=function(e){(this.openedLeft||this.openedRight)&&(e.preventDefault(),this.close())},t.prototype.onBtnClick=function(e){var t=e.onPress;t&&t(),this.props.autoClose&&this.close()},t.prototype._getContentEasing=function(e,t){return e<0&&e<t?t-Math.pow(t-e,.85):e>0&&e>t?t+Math.pow(e-t,.85):e},t.prototype._setStyle=function(e){var t=this.props,n=t.left,i=t.right,r=e>0?this.btnsLeftWidth:-this.btnsRightWidth,o=this._getContentEasing(e,r);if(this.refs.content.style.left=o+"px",n.length){var a=Math.max(Math.min(e,Math.abs(r)),0);this.refs.left.style.width=a+"px"}if(i.length){var s=Math.max(Math.min(-e,Math.abs(r)),0);this.refs.right.style.width=s+"px"}},t.prototype.open=function(e,t,n){this.openedLeft||this.openedRight||this.props.onOpen(),this.openedLeft=t,this.openedRight=n,this._setStyle(e)},t.prototype.close=function(){(this.openedLeft||this.openedRight)&&this.props.onClose(),this.openedLeft=!1,this.openedRight=!1,this._setStyle(0)},t.prototype.renderButtons=function(e,t){var n=this,i=this.props.prefixCls;return e&&e.length?m["default"].createElement("div",{className:i+"-actions "+i+"-actions-"+t,ref:t},e.map(function(e,t){return m["default"].createElement("div",{key:t,className:i+"-btn",style:e.style,onClick:function(){return n.onBtnClick(e)}},m["default"].createElement("div",{className:i+"-text"},e.text||"Click"))})):null},t.prototype.render=function(){var e=(0,T["default"])(this.props,["prefixCls","left","right","children"]),t=(0,s["default"])(e,2),n=t[0],i=n.prefixCls,r=n.left,a=n.right,l=n.children,u=t[1],c=(0,b["default"])(u,["disabled","autoClose","onOpen","onClose"]),d="DIRECTION_HORIZONTAL";return r.length&&0===a.length&&(d="DIRECTION_RIGHT"),a.length&&0===r.length&&(d="DIRECTION_LEFT"),r.length||a.length?m["default"].createElement("div",(0,o["default"])({className:""+i},c),m["default"].createElement(v["default"],{direction:d,onPanStart:this.onPanStart,onPan:this.onPan,onPanEnd:this.onPanEnd,onTap:this.onTap},m["default"].createElement("div",{className:i+"-content",ref:"content"},l)),this.renderButtons(r,"left"),this.renderButtons(a,"right")):m["default"].createElement("div",(0,o["default"])({ref:"content"},c),l)},t}(m["default"].Component);x.propTypes={prefixCls:h.PropTypes.string,autoClose:h.PropTypes.bool,disabled:h.PropTypes.bool,left:h.PropTypes.arrayOf(h.PropTypes.object),right:h.PropTypes.arrayOf(h.PropTypes.object),onOpen:h.PropTypes.func,onClose:h.PropTypes.func,children:h.PropTypes.any},x.defaultProps={prefixCls:"rc-swipeout",autoClose:!1,disabled:!1,left:[],right:[],onOpen:function(){},onClose:function(){}},t["default"]=x,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(379);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i(r)["default"]}}),e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){var n={},i={};return(0,a["default"])(e).forEach(function(r){t.indexOf(r)!==-1?n[r]=e[r]:i[r]=e[r]}),[n,i]}Object.defineProperty(t,"__esModule",{value:!0});var o=n(221),a=i(o);t["default"]=r,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},a=n(1),s=i(a),l=n(384),u=i(l),c=n(386),d=n(39),f=i(d),p=n(387),h=i(p),m=s["default"].createClass({displayName:"Table",propTypes:{data:a.PropTypes.array,expandIconAsCell:a.PropTypes.bool,defaultExpandAllRows:a.PropTypes.bool,expandedRowKeys:a.PropTypes.array,defaultExpandedRowKeys:a.PropTypes.array,useFixedHeader:a.PropTypes.bool,columns:a.PropTypes.array,prefixCls:a.PropTypes.string,bodyStyle:a.PropTypes.object,style:a.PropTypes.object,rowKey:a.PropTypes.oneOfType([a.PropTypes.string,a.PropTypes.func]),rowClassName:a.PropTypes.func,expandedRowClassName:a.PropTypes.func,childrenColumnName:a.PropTypes.string,onExpand:a.PropTypes.func,onExpandedRowsChange:a.PropTypes.func,indentSize:a.PropTypes.number,onRowClick:a.PropTypes.func,columnsPageRange:a.PropTypes.array,columnsPageSize:a.PropTypes.number,expandIconColumnIndex:a.PropTypes.number,showHeader:a.PropTypes.bool,title:a.PropTypes.func,footer:a.PropTypes.func,emptyText:a.PropTypes.func,scroll:a.PropTypes.object,rowRef:a.PropTypes.func,getBodyWrapper:a.PropTypes.func},getDefaultProps:function(){return{data:[],useFixedHeader:!1,expandIconAsCell:!1,columns:[],defaultExpandAllRows:!1,defaultExpandedRowKeys:[],rowKey:"key",rowClassName:function(){return""},expandedRowClassName:function(){return""},onExpand:function(){},onExpandedRowsChange:function(){},prefixCls:"rc-table",bodyStyle:{},style:{},childrenColumnName:"children",indentSize:15,columnsPageSize:5,expandIconColumnIndex:0,showHeader:!0,scroll:{},rowRef:function(){return null},getBodyWrapper:function(e){return e},emptyText:function(){return"No Data"}}},getInitialState:function(){var e=this.props,t=[],n=[].concat(r(e.data));if(e.defaultExpandAllRows)for(var i=0;i<n.length;i++){var o=n[i];t.push(this.getRowKey(o)),n=n.concat(o[e.childrenColumnName]||[])}else t=e.expandedRowKeys||e.defaultExpandedRowKeys;return{expandedRowKeys:t,data:e.data,currentColumnsPage:0,currentHoverKey:null,scrollPosition:"left",fixedColumnsHeadRowsHeight:[],fixedColumnsBodyRowsHeight:[]}},componentDidMount:function(){this.resetScrollY();var e=this.isAnyColumnsFixed();e&&(this.syncFixedTableRowHeight(),this.resizeEvent=(0,h["default"])(window,"resize",(0,c.debounce)(this.syncFixedTableRowHeight,150)))},componentWillReceiveProps:function(e){"data"in e&&(this.setState({data:e.data}),e.data&&0!==e.data.length||this.resetScrollY()),"expandedRowKeys"in e&&this.setState({expandedRowKeys:e.expandedRowKeys}),e.columns!==this.props.columns&&(delete this.isAnyColumnsFixedCache,delete this.isAnyColumnsLeftFixedCache,delete this.isAnyColumnsRightFixedCache)},componentDidUpdate:function(){this.syncFixedTableRowHeight()},componentWillUnmount:function(){clearTimeout(this.timer),this.resizeEvent&&this.resizeEvent.remove()},onExpandedRowsChange:function(e){this.props.expandedRowKeys||this.setState({expandedRowKeys:e}),this.props.onExpandedRowsChange(e)},onExpanded:function(e,t,n){n&&(n.preventDefault(),n.stopPropagation());var i=this.findExpandedRow(t);if("undefined"==typeof i||e){if(!i&&e){var r=this.getExpandedRows().concat();r.push(this.getRowKey(t)),this.onExpandedRowsChange(r)}}else this.onRowDestroy(t);this.props.onExpand(e,t)},onRowDestroy:function(e){var t=this.getExpandedRows().concat(),n=this.getRowKey(e),i=-1;t.forEach(function(e,t){e===n&&(i=t)}),i!==-1&&t.splice(i,1),this.onExpandedRowsChange(t)},getRowKey:function(e,t){var n=this.props.rowKey;return"function"==typeof n?n(e,t):"undefined"!=typeof e[n]?e[n]:t},getExpandedRows:function(){return this.props.expandedRowKeys||this.state.expandedRowKeys},getHeader:function(e,t){var n=this.props,i=n.showHeader,r=n.expandIconAsCell,o=n.prefixCls,a=[];r&&"right"!==t&&a.push({key:"rc-table-expandIconAsCell",className:o+"-expand-icon-th",title:""}),a=a.concat(e||this.getCurrentColumns()).map(function(e){if(0!==e.colSpan)return s["default"].createElement("th",{key:e.key,colSpan:e.colSpan,className:e.className||""},e.title)});var l=this.state.fixedColumnsHeadRowsHeight,u=l[0]&&e?{height:l[0]}:null;return i?s["default"].createElement("thead",{className:o+"-thead"},s["default"].createElement("tr",{style:u},a)):null},getExpandedRow:function(e,t,n,i,r){var o=this.props.prefixCls;return s["default"].createElement("tr",{key:e+"-extra-row",style:{display:n?"":"none"},className:o+"-expanded-row "+i},this.props.expandIconAsCell&&"right"!==r?s["default"].createElement("td",{key:"rc-table-expand-icon-placeholder"}):null,s["default"].createElement("td",{colSpan:this.props.columns.length},"right"!==r?t:" "))},getRowsByData:function(e,t,n,i,r){for(var a=this.props,l=a.childrenColumnName,c=a.expandedRowRender,d=a.expandRowByClick,f=this.state.fixedColumnsBodyRowsHeight,p=[],h=a.rowClassName,m=a.rowRef,y=a.expandedRowClassName,v=a.data.some(function(e){return e[l]}),g=a.onRowClick,b=this.isAnyColumnsFixed(),M="right"!==r&&a.expandIconAsCell,T="right"!==r?a.expandIconColumnIndex:-1,x=0;x<e.length;x++){var C=e[x],_=this.getRowKey(C,x),w=C[l],S=this.isRowExpanded(C),N=void 0;c&&S&&(N=c(C,x,n));var E=h(C,x,n);this.state.currentHoverKey===_&&(E+=" "+a.prefixCls+"-row-hover");var P={};b&&(P.onHover=this.handleRowHover);var D=r&&f[x]?{height:f[x]}:{};p.push(s["default"].createElement(u["default"],o({indent:n,indentSize:a.indentSize,needIndentSpaced:v,className:E,record:C,expandIconAsCell:M,onDestroy:this.onRowDestroy,index:x,visible:t,expandRowByClick:d,onExpand:this.onExpanded,expandable:w||c,expanded:S,prefixCls:a.prefixCls+"-row",childrenColumnName:l,columns:i||this.getCurrentColumns(),expandIconColumnIndex:T,onRowClick:g,style:D},P,{key:_,hoverKey:_,ref:m(C,x,n)})));var I=t&&S;N&&S&&p.push(this.getExpandedRow(_,N,I,y(C,x,n),r)),w&&(p=p.concat(this.getRowsByData(w,I,n+1,i,r)))}return p},getRows:function(e,t){return this.getRowsByData(this.state.data,!0,0,e,t)},getColGroup:function(e,t){var n=[];return this.props.expandIconAsCell&&"right"!==t&&n.push(s["default"].createElement("col",{className:this.props.prefixCls+"-expand-icon-col",key:"rc-table-expand-icon-col"})),n=n.concat((e||this.props.columns).map(function(e){return s["default"].createElement("col",{key:e.key,style:{width:e.width,minWidth:e.width}})})),s["default"].createElement("colgroup",null,n)},getCurrentColumns:function(){var e=this,t=this.props,n=t.columns,i=t.columnsPageRange,r=t.columnsPageSize,a=t.prefixCls,s=this.state.currentColumnsPage;return!i||i[0]>i[1]?n:n.map(function(t,n){var l=o({},t);if(n>=i[0]&&n<=i[1]){var u=i[0]+s*r,c=i[0]+(s+1)*r-1;c>i[1]&&(c=i[1]),(n<u||n>c)&&(l.className=l.className||"",l.className+=" "+a+"-column-hidden"),l=e.wrapPageColumn(l,n===u,n===c)}return l})},getLeftFixedTable:function(){var e=this.props.columns,t=e.filter(function(e){return"left"===e.fixed||e.fixed===!0});return this.getTable({columns:t,fixed:"left"})},getRightFixedTable:function(){var e=this.props.columns,t=e.filter(function(e){return"right"===e.fixed});return this.getTable({columns:t,fixed:"right"})},getTable:function(){var e=this,t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=t.columns,i=t.fixed,r=this.props,a=r.prefixCls,l=r.scroll,u=void 0===l?{}:l,d=r.getBodyWrapper,f=this.props.useFixedHeader,p=o({},this.props.bodyStyle),h={},m="";if((u.x||n)&&(m=a+"-fixed",p.overflowX=p.overflowX||"auto"),u.y){i?p.height=p.height||u.y:p.maxHeight=p.maxHeight||u.y,p.overflowY=p.overflowY||"scroll",f=!0;var y=(0,c.measureScrollbar)();y>0&&((i?p:h).marginBottom="-"+y+"px",(i?p:h).paddingBottom="0px")}var v=function(){var t=arguments.length<=0||void 0===arguments[0]||arguments[0],r=arguments.length<=1||void 0===arguments[1]||arguments[1],o={};!n&&u.x&&(u.x===!0?o.tableLayout="fixed":o.width=u.x);var l=r?d(s["default"].createElement("tbody",{className:a+"-tbody"},e.getRows(n,i))):null;return s["default"].createElement("table",{className:m,style:o},e.getColGroup(n,i),t?e.getHeader(n,i):null,l)},g=void 0;f&&(g=s["default"].createElement("div",{className:a+"-header",ref:n?null:"headTable",style:h,onMouseOver:this.detectScrollTarget,onTouchStart:this.detectScrollTarget,onScroll:this.handleBodyScroll},v(!0,!1)));var b=s["default"].createElement("div",{className:a+"-body",style:p,ref:"bodyTable",onMouseOver:this.detectScrollTarget,onTouchStart:this.detectScrollTarget,onScroll:this.handleBodyScroll},v(!f));if(n&&n.length){var M=void 0;"left"===n[0].fixed||n[0].fixed===!0?M="fixedColumnsBodyLeft":"right"===n[0].fixed&&(M="fixedColumnsBodyRight"),delete p.overflowX,delete p.overflowY,b=s["default"].createElement("div",{className:a+"-body-outer",style:o({},p)},s["default"].createElement("div",{className:a+"-body-inner",ref:M,onMouseOver:this.detectScrollTarget,onTouchStart:this.detectScrollTarget,onScroll:this.handleBodyScroll},v(!f)))}return s["default"].createElement("span",null,g,b)},getTitle:function(){var e=this.props,t=e.title,n=e.prefixCls;return t?s["default"].createElement("div",{className:n+"-title"},t(this.state.data)):null},getFooter:function(){var e=this.props,t=e.footer,n=e.prefixCls;return t?s["default"].createElement("div",{className:n+"-footer"},t(this.state.data)):null},getEmptyText:function(){var e=this.props,t=e.emptyText,n=e.prefixCls,i=e.data;return i.length?null:s["default"].createElement("div",{className:n+"-placeholder"},t())},getMaxColumnsPage:function(){var e=this.props,t=e.columnsPageRange,n=e.columnsPageSize;return Math.ceil((t[1]-t[0]+1)/n)-1},goToColumnsPage:function(e){var t=this.getMaxColumnsPage(),n=e;n<0&&(n=0),n>t&&(n=t),this.setState({currentColumnsPage:n})},syncFixedTableRowHeight:function(){var e=this,t=this.props.prefixCls,n=this.refs.headTable?this.refs.headTable.querySelectorAll("tr"):[],i=this.refs.bodyTable.querySelectorAll("."+t+"-row")||[],r=[].map.call(n,function(e){return e.getBoundingClientRect().height||"auto"}),o=[].map.call(i,function(e){return e.getBoundingClientRect().height||"auto"});(0,f["default"])(this.state.fixedColumnsHeadRowsHeight,r)&&(0,f["default"])(this.state.fixedColumnsBodyRowsHeight,o)||(this.timer=setTimeout(function(){e.setState({fixedColumnsHeadRowsHeight:r,fixedColumnsBodyRowsHeight:o})}))},resetScrollY:function(){this.refs.headTable&&(this.refs.headTable.scrollLeft=0),this.refs.bodyTable&&(this.refs.bodyTable.scrollLeft=0)},prevColumnsPage:function(){this.goToColumnsPage(this.state.currentColumnsPage-1)},nextColumnsPage:function(){this.goToColumnsPage(this.state.currentColumnsPage+1)},wrapPageColumn:function(e,t,n){var i=this.props.prefixCls,r=this.state.currentColumnsPage,o=this.getMaxColumnsPage(),a=i+"-prev-columns-page";0===r&&(a+=" "+i+"-prev-columns-page-disabled");var l=s["default"].createElement("span",{className:a,onClick:this.prevColumnsPage}),u=i+"-next-columns-page";r===o&&(u+=" "+i+"-next-columns-page-disabled");var c=s["default"].createElement("span",{className:u,onClick:this.nextColumnsPage});return t&&(e.title=s["default"].createElement("span",null,l,e.title),e.className=(e.className||"")+" "+i+"-column-has-prev"),n&&(e.title=s["default"].createElement("span",null,e.title,c),e.className=(e.className||"")+" "+i+"-column-has-next"),e},findExpandedRow:function(e){var t=this,n=this.getExpandedRows().filter(function(n){return n===t.getRowKey(e)});return n[0]},isRowExpanded:function(e){return"undefined"!=typeof this.findExpandedRow(e)},detectScrollTarget:function(e){this.scrollTarget!==e.currentTarget&&(this.scrollTarget=e.currentTarget)},isAnyColumnsFixed:function(){return"isAnyColumnsFixedCache"in this?this.isAnyColumnsFixedCache:(this.isAnyColumnsFixedCache=this.getCurrentColumns().some(function(e){return!!e.fixed}),this.isAnyColumnsFixedCache)},isAnyColumnsLeftFixed:function(){return"isAnyColumnsLeftFixedCache"in this?this.isAnyColumnsLeftFixedCache:(this.isAnyColumnsLeftFixedCache=this.getCurrentColumns().some(function(e){return"left"===e.fixed||e.fixed===!0}),this.isAnyColumnsLeftFixedCache)},isAnyColumnsRightFixed:function(){return"isAnyColumnsRightFixedCache"in this?this.isAnyColumnsRightFixedCache:(this.isAnyColumnsRightFixedCache=this.getCurrentColumns().some(function(e){return"right"===e.fixed}),this.isAnyColumnsRightFixedCache)},handleBodyScroll:function(e){if(e.target===this.scrollTarget){var t=this.props.scroll,n=void 0===t?{}:t,i=this.refs,r=i.headTable,o=i.bodyTable,a=i.fixedColumnsBodyLeft,s=i.fixedColumnsBodyRight;n.x&&(e.target===o&&r?r.scrollLeft=e.target.scrollLeft:e.target===r&&o&&(o.scrollLeft=e.target.scrollLeft),0===e.target.scrollLeft?this.setState({scrollPosition:"left"}):e.target.scrollLeft+1>=e.target.children[0].getBoundingClientRect().width-e.target.getBoundingClientRect().width?this.setState({scrollPosition:"right"}):"middle"!==this.state.scrollPosition&&this.setState({scrollPosition:"middle"})),n.y&&(a&&e.target!==a&&(a.scrollTop=e.target.scrollTop),s&&e.target!==s&&(s.scrollTop=e.target.scrollTop),o&&e.target!==o&&(o.scrollTop=e.target.scrollTop))}},handleRowHover:function(e,t){this.setState({currentHoverKey:e?t:null})},render:function(){var e=this.props,t=e.prefixCls,n=e.prefixCls;e.className&&(n+=" "+e.className),e.columnsPageRange&&(n+=" "+t+"-columns-paging"),(e.useFixedHeader||e.scroll&&e.scroll.y)&&(n+=" "+t+"-fixed-header"),n+=" "+t+"-scroll-position-"+this.state.scrollPosition;var i=this.isAnyColumnsFixed()||e.scroll.x||e.scroll.y;return s["default"].createElement("div",{className:n,style:e.style},this.getTitle(),s["default"].createElement("div",{className:t+"-content"},this.isAnyColumnsLeftFixed()&&s["default"].createElement("div",{className:t+"-fixed-left"},this.getLeftFixedTable()),s["default"].createElement("div",{className:i?t+"-scroll":""},this.getTable(),this.getEmptyText(),this.getFooter()),this.isAnyColumnsRightFixed()&&s["default"].createElement("div",{className:t+"-fixed-right"},this.getRightFixedTable())))}});t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(339),s=i(a),l=n(39),u=i(l),c=n(109),d=i(c),f=o["default"].createClass({displayName:"TableCell",propTypes:{record:r.PropTypes.object,prefixCls:r.PropTypes.string,isColumnHaveExpandIcon:r.PropTypes.bool,index:r.PropTypes.number,expanded:r.PropTypes.bool,expandable:r.PropTypes.any,onExpand:r.PropTypes.func,needIndentSpaced:r.PropTypes.bool,indent:r.PropTypes.number,indentSize:r.PropTypes.number,column:r.PropTypes.object},shouldComponentUpdate:function(e){return!(0,u["default"])(e,this.props)},isInvalidRenderCellText:function(e){return e&&!o["default"].isValidElement(e)&&"[object Object]"===Object.prototype.toString.call(e)},render:function p(){var e=this.props,t=e.record,n=e.indentSize,i=e.prefixCls,r=e.indent,a=e.isColumnHaveExpandIcon,l=e.index,u=e.expandable,c=e.onExpand,f=e.needIndentSpaced,h=e.expanded,m=e.column,y=m.dataIndex,p=m.render,v=m.className,g=s["default"].get(t,y),b=void 0,M=void 0,T=void 0;p&&(g=p(g,t,l),this.isInvalidRenderCellText(g)&&(b=g.props||{},T=b.rowSpan,M=b.colSpan,g=g.children)),this.isInvalidRenderCellText(g)&&(g=null);var x=o["default"].createElement(d["default"],{expandable:u,prefixCls:i,onExpand:c,needIndentSpaced:f,expanded:h,record:t}),C=o["default"].createElement("span",{style:{paddingLeft:n*r+"px"},className:i+"-indent indent-level-"+r});return 0===T||0===M?null:o["default"].createElement("td",{colSpan:M,rowSpan:T,className:v||""},a?C:null,a?x:null,g)}});t["default"]=f,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o=n(1),a=i(o),s=n(39),l=i(s),u=n(383),c=i(u),d=n(109),f=i(d),p=a["default"].createClass({displayName:"TableRow",propTypes:{onDestroy:o.PropTypes.func,onRowClick:o.PropTypes.func,record:o.PropTypes.object,prefixCls:o.PropTypes.string,expandIconColumnIndex:o.PropTypes.number,onHover:o.PropTypes.func,columns:o.PropTypes.array,style:o.PropTypes.object,visible:o.PropTypes.bool,index:o.PropTypes.number,hoverKey:o.PropTypes.any,expanded:o.PropTypes.bool,expandable:o.PropTypes.any,onExpand:o.PropTypes.func,needIndentSpaced:o.PropTypes.bool,className:o.PropTypes.string,indent:o.PropTypes.number,indentSize:o.PropTypes.number,expandIconAsCell:o.PropTypes.bool,expandRowByClick:o.PropTypes.bool},getDefaultProps:function(){return{onRowClick:function(){},onDestroy:function(){},expandIconColumnIndex:0,expandRowByClick:!1,onHover:function(){}}},shouldComponentUpdate:function(e){return!(0,l["default"])(e,this.props)},componentWillUnmount:function(){this.props.onDestroy(this.props.record)},onRowClick:function h(e){var t=this.props,n=t.record,i=t.index,h=t.onRowClick,r=t.expandable,o=t.expandRowByClick,a=t.expanded,s=t.onExpand;r&&o&&s(!a,n),h(n,i,e)},onMouseEnter:function(){var e=this.props,t=e.onHover,n=e.hoverKey;t(!0,n)},onMouseLeave:function(){var e=this.props,t=e.onHover,n=e.hoverKey;t(!1,n)},render:function(){for(var e=this.props,t=e.prefixCls,n=e.columns,i=e.record,o=e.style,s=e.visible,l=e.index,u=e.expandIconColumnIndex,d=e.expandIconAsCell,p=e.expanded,h=e.expandRowByClick,m=e.expandable,y=e.onExpand,v=e.needIndentSpaced,g=e.className,b=e.indent,M=e.indentSize,T=[],x=0;x<n.length;x++){d&&0===x&&T.push(a["default"].createElement("td",{className:t+"-expand-icon-cell",key:"rc-table-expand-icon-cell"},a["default"].createElement(f["default"],{expandable:m,prefixCls:t,onExpand:y,needIndentSpaced:v,expanded:p,record:i})));var C=!d&&!h&&x===u;T.push(a["default"].createElement(c["default"],{prefixCls:t,record:i,indentSize:M,indent:b,index:l,expandable:m,onExpand:y,needIndentSpaced:v,expanded:p,isColumnHaveExpandIcon:C,column:n[x],key:n[x].key}))}return a["default"].createElement("tr",{onClick:this.onRowClick,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,className:t+" "+g+" "+t+"-level-"+b,style:s?o:r({},o,{display:"none"})},T)}});t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";e.exports=n(382)},function(e,t){"use strict";function n(){if("undefined"==typeof document||"undefined"==typeof window)return 0;if(r)return r;var e=document.createElement("div");for(var t in o)o.hasOwnProperty(t)&&(e.style[t]=o[t]);document.body.appendChild(e);var n=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),r=n}function i(e,t,n){var i=void 0;return function(){var r=this,o=arguments;o[0]&&o[0].persist&&o[0].persist();var a=function(){i=null,n||e.apply(r,o)},s=n&&!i;clearTimeout(i),i=setTimeout(a,t),s&&e.apply(r,o)}}Object.defineProperty(t,"__esModule",{value:!0}),t.measureScrollbar=n,t.debounce=i;var r=void 0,o={position:"absolute",top:"-9999px",width:"50px",height:"50px",overflow:"scroll"}},344,function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(389),s=i(a),l=n(110),u=i(l),c=o["default"].createClass({displayName:"InkTabBar",mixins:[u["default"],s["default"]],render:function(){var e=this.getInkBarNode(),t=this.getTabs();return this.getRootNode([e,t])}});t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],i="scroll"+(t?"Top":"Left");if("number"!=typeof n){var r=e.document;n=r.documentElement[i],"number"!=typeof n&&(n=r.body[i])}return n}function o(e){var t=void 0,n=void 0,i=void 0,o=e.ownerDocument,a=o.body,s=o&&o.documentElement;t=e.getBoundingClientRect(),n=t.left,i=t.top,n-=s.clientLeft||a.clientLeft||0,i-=s.clientTop||a.clientTop||0;var l=o.defaultView||o.parentWindow;return n+=r(l),i+=r(l,!0),{left:n,top:i}}function a(e,t){var n=e.refs,i=n.nav||n.root,r=o(i),a=n.inkBar,s=n.activeTab,l=a.style,c=e.props.tabBarPosition;if(t&&(l.display="none"),s){var d=s,f=o(d),p=(0,u.isTransformSupported)(l);if("top"===c||"bottom"===c){
var h=f.left-r.left;p?((0,u.setTransform)(l,"translate3d("+h+"px,0,0)"),l.width=d.offsetWidth+"px",l.height=""):(l.left=h+"px",l.top="",l.bottom="",l.right=i.offsetWidth-h-d.offsetWidth+"px")}else{var m=f.top-r.top;p?((0,u.setTransform)(l,"translate3d(0,"+m+"px,0)"),l.height=d.offsetHeight+"px",l.width=""):(l.left="",l.right="",l.top=m+"px",l.bottom=i.offsetHeight-m-d.offsetHeight+"px")}}l.display=s?"block":"none"}Object.defineProperty(t,"__esModule",{value:!0});var s=n(6),l=i(s);t.getScroll=r;var u=n(70),c=n(1),d=i(c),f=n(5),p=i(f);t["default"]={getDefaultProps:function(){return{inkBarAnimated:!0}},componentDidUpdate:function(){a(this)},componentDidMount:function(){a(this,!0)},getInkBarNode:function(){var e,t=this.props,n=t.prefixCls,i=t.styles,r=t.inkBarAnimated,o=n+"-ink-bar",a=(0,p["default"])((e={},(0,l["default"])(e,o,!0),(0,l["default"])(e,r?o+"-animated":o+"-no-animated",!0),e));return d["default"].createElement("div",{style:i.inkBar,className:a,key:"inkBar",ref:"inkBar"})}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={LEFT:37,UP:38,RIGHT:39,DOWN:40},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e){var t=e.maxIndex,n=e.startIndex,i=e.delta,r=e.viewSize,o=n+-i/r;return o<0?o=Math.exp(o*v)-1:o>t&&(o=t+1-Math.exp((t-o)*v)),o}function o(e){var t=(0,y.isVertical)(this.props.tabBarPosition)?e.deltaY:e.deltaX,n=r({maxIndex:this.maxIndex,viewSize:this.viewSize,startIndex:this.startIndex,delta:t}),i=t<0?Math.floor(n+1):Math.floor(n);if(i<0?i=0:i>this.maxIndex&&(i=this.maxIndex),!this.children[i].props.disabled)return n}Object.defineProperty(t,"__esModule",{value:!0});var a=n(7),s=i(a),l=n(69),u=i(l),c=n(1),d=i(c),f=n(71),p=i(f),h=n(9),m=i(h),y=n(70),v=.6,g=d["default"].createClass({displayName:"SwipeableTabContent",propTypes:{tabBarPosition:c.PropTypes.string,onChange:c.PropTypes.func,children:c.PropTypes.any,hammerOptions:c.PropTypes.any,animated:c.PropTypes.bool,activeKey:c.PropTypes.string},getDefaultProps:function(){return{animated:!0}},componentDidMount:function(){this.rootNode=m["default"].findDOMNode(this)},onPanStart:function(){var e=this.props,t=e.tabBarPosition,n=e.children,i=e.activeKey,r=e.animated,o=this.startIndex=(0,y.getActiveIndex)(n,i);o!==-1&&(r&&(0,y.setTransition)(this.rootNode.style,"none"),this.startDrag=!0,this.children=(0,y.toArray)(n),this.maxIndex=this.children.length-1,this.viewSize=(0,y.isVertical)(t)?this.rootNode.offsetHeight:this.rootNode.offsetWidth)},onPan:function(e){if(this.startDrag){var t=this.props.tabBarPosition,n=o.call(this,e);void 0!==n&&(0,y.setTransform)(this.rootNode.style,(0,y.getTransformByIndex)(n,t))}},onPanEnd:function(e){this.startDrag&&this.end(e)},onSwipe:function(e){this.end(e,!0)},end:function(e,t){var n=this.props,i=n.tabBarPosition,r=n.animated;this.startDrag=!1,r&&(0,y.setTransition)(this.rootNode.style,"");var a=o.call(this,e),s=this.startIndex;if(void 0!==a)if(a<0)s=0;else if(a>this.maxIndex)s=this.maxIndex;else if(t){var l=(0,y.isVertical)(i)?e.deltaY:e.deltaX;s=l<0?Math.ceil(a):Math.floor(a)}else{var u=Math.floor(a);s=a-u>.6?u+1:u}this.children[s].props.disabled||(this.startIndex===s?r&&(0,y.setTransform)(this.rootNode.style,(0,y.getTransformByIndex)(s,this.props.tabBarPosition)):this.props.onChange((0,y.getActiveKey)(this.props.children,s)))},render:function(){var e=this.props,t=e.tabBarPosition,n=e.hammerOptions,i=e.animated,r={};(0,y.isVertical)(t)&&(r={vertical:!0});var o={onSwipe:this.onSwipe,onPanStart:this.onPanStart};return i!==!1&&(o=(0,s["default"])({},o,{onPan:this.onPan,onPanEnd:this.onPanEnd})),d["default"].createElement(p["default"],(0,s["default"])({},o,r,{options:n}),d["default"].createElement(u["default"],this.props))}});t["default"]=g,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(110),s=i(a),l=o["default"].createClass({displayName:"TabBar",mixins:[s["default"]],render:function(){var e=this.getTabs();return this.getRootNode(e)}});t["default"]=l,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){}function o(e){var t=void 0;return u["default"].Children.forEach(e.children,function(e){!e||t||e.props.disabled||(t=e.key)}),t}Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=i(a),l=n(1),u=i(l),c=n(390),d=i(c),f=n(111),p=i(f),h=n(5),m=i(h),y=u["default"].createClass({displayName:"Tabs",propTypes:{destroyInactiveTabPane:l.PropTypes.bool,renderTabBar:l.PropTypes.func.isRequired,renderTabContent:l.PropTypes.func.isRequired,onChange:l.PropTypes.func,children:l.PropTypes.any,prefixCls:l.PropTypes.string,className:l.PropTypes.string,tabBarPosition:l.PropTypes.string,style:l.PropTypes.object},getDefaultProps:function(){return{prefixCls:"rc-tabs",destroyInactiveTabPane:!1,onChange:r,tabBarPosition:"top",style:{}}},getInitialState:function(){var e=this.props,t=void 0;return t="activeKey"in e?e.activeKey:"defaultActiveKey"in e?e.defaultActiveKey:o(e),{activeKey:t}},componentWillReceiveProps:function(e){"activeKey"in e&&this.setState({activeKey:e.activeKey})},onTabClick:function(e){this.tabBar.props.onTabClick&&this.tabBar.props.onTabClick(e),this.setActiveKey(e)},onNavKeyDown:function(e){var t=e.keyCode;if(t===d["default"].RIGHT||t===d["default"].DOWN){e.preventDefault();var n=this.getNextActiveKey(!0);this.onTabClick(n)}else if(t===d["default"].LEFT||t===d["default"].UP){e.preventDefault();var i=this.getNextActiveKey(!1);this.onTabClick(i)}},setActiveKey:function(e){this.state.activeKey!==e&&("activeKey"in this.props||this.setState({activeKey:e}),this.props.onChange(e))},getNextActiveKey:function(e){var t=this.state.activeKey,n=[];u["default"].Children.forEach(this.props.children,function(t){t&&!t.props.disabled&&(e?n.push(t):n.unshift(t))});var i=n.length,r=i&&n[0].key;return n.forEach(function(e,o){e.key===t&&(r=o===i-1?n[0].key:n[o+1].key)}),r},render:function(){var e,t=this.props,n=t.prefixCls,i=t.tabBarPosition,r=t.className,o=t.renderTabContent,a=t.renderTabBar,l=(0,m["default"])((e={},(0,s["default"])(e,n,1),(0,s["default"])(e,n+"-"+i,1),(0,s["default"])(e,r,!!r),e));this.tabBar=a();var c=[u["default"].cloneElement(this.tabBar,{prefixCls:n,key:"tabBar",onKeyDown:this.onNavKeyDown,tabBarPosition:i,onTabClick:this.onTabClick,panels:t.children,activeKey:this.state.activeKey}),u["default"].cloneElement(o(),{prefixCls:n,tabBarPosition:i,activeKey:this.state.activeKey,destroyInactiveTabPane:t.destroyInactiveTabPane,children:t.children,onChange:this.setActiveKey,key:"tabContent"})];return"bottom"===i&&c.reverse(),u["default"].createElement("div",{className:l,style:t.style},c)}});y.TabPane=p["default"],t["default"]=y,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},a=n(1),s=i(a),l=n(395),u=n(399),c=i(u),d=s["default"].createClass({displayName:"Tooltip",propTypes:{trigger:a.PropTypes.any,children:a.PropTypes.any,defaultVisible:a.PropTypes.bool,visible:a.PropTypes.bool,placement:a.PropTypes.string,transitionName:a.PropTypes.string,animation:a.PropTypes.any,onVisibleChange:a.PropTypes.func,afterVisibleChange:a.PropTypes.func,overlay:a.PropTypes.oneOfType([s["default"].PropTypes.node,s["default"].PropTypes.func]).isRequired,overlayStyle:a.PropTypes.object,overlayClassName:a.PropTypes.string,prefixCls:a.PropTypes.string,mouseEnterDelay:a.PropTypes.number,mouseLeaveDelay:a.PropTypes.number,getTooltipContainer:a.PropTypes.func,destroyTooltipOnHide:a.PropTypes.bool,align:a.PropTypes.object,arrowContent:a.PropTypes.any},getDefaultProps:function(){return{prefixCls:"rc-tooltip",mouseEnterDelay:0,destroyTooltipOnHide:!1,mouseLeaveDelay:.1,align:{},placement:"right",trigger:["hover"],arrowContent:null}},getPopupElement:function(){var e=this.props,t=e.arrowContent,n=e.overlay,i=e.prefixCls;return[s["default"].createElement("div",{className:i+"-arrow",key:"arrow"},t),s["default"].createElement("div",{className:i+"-inner",key:"content"},"function"==typeof n?n():n)]},getPopupDomNode:function(){return this.refs.trigger.getPopupDomNode()},render:function(){var e=this.props,t=e.overlayClassName,n=e.trigger,i=e.mouseEnterDelay,a=e.mouseLeaveDelay,u=e.overlayStyle,d=e.prefixCls,f=e.children,p=e.onVisibleChange,h=e.transitionName,m=e.animation,y=e.placement,v=e.align,g=e.destroyTooltipOnHide,b=e.defaultVisible,M=e.getTooltipContainer,T=r(e,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer"]),x=o({},T);return"visible"in this.props&&(x.popupVisible=this.props.visible),s["default"].createElement(c["default"],o({popupClassName:t,ref:"trigger",prefixCls:d,popup:this.getPopupElement,action:n,builtinPlacements:l.placements,popupPlacement:y,popupAlign:v,getPopupContainer:M,onPopupVisibleChange:p,popupTransitionName:h,popupAnimation:m,defaultPopupVisible:b,destroyPopupOnHide:g,mouseLeaveDelay:a,popupStyle:u,mouseEnterDelay:i},x),f)}});t["default"]=d,e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={adjustX:1,adjustY:1},i=[0,0],r=t.placements={left:{points:["cr","cl"],overflow:n,offset:[-4,0],targetOffset:i},right:{points:["cl","cr"],overflow:n,offset:[4,0],targetOffset:i},top:{points:["bc","tc"],overflow:n,offset:[0,-4],targetOffset:i},bottom:{points:["tc","bc"],overflow:n,offset:[0,4],targetOffset:i},topLeft:{points:["bl","tl"],overflow:n,offset:[0,-4],targetOffset:i},leftTop:{points:["tr","tl"],overflow:n,offset:[-4,0],targetOffset:i},topRight:{points:["br","tr"],overflow:n,offset:[0,-4],targetOffset:i},rightTop:{points:["tl","tr"],overflow:n,offset:[4,0],targetOffset:i},bottomRight:{points:["tr","br"],overflow:n,offset:[0,4],targetOffset:i},rightBottom:{points:["bl","br"],overflow:n,offset:[4,0],targetOffset:i},bottomLeft:{points:["tl","bl"],overflow:n,offset:[0,4],targetOffset:i},leftBottom:{points:["br","bl"],overflow:n,offset:[-4,0],targetOffset:i}};t["default"]=r},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=i(r),a=n(1),s=i(a),l=n(9),u=i(l),c=n(342),d=i(c),f=n(45),p=i(f),h=n(397),m=i(h),y=n(114),v=i(y),g=s["default"].createClass({displayName:"Popup",propTypes:{visible:a.PropTypes.bool,style:a.PropTypes.object,getClassNameFromAlign:a.PropTypes.func,onAlign:a.PropTypes.func,getRootDomNode:a.PropTypes.func,onMouseEnter:a.PropTypes.func,align:a.PropTypes.any,destroyPopupOnHide:a.PropTypes.bool,className:a.PropTypes.string,prefixCls:a.PropTypes.string,onMouseLeave:a.PropTypes.func},componentDidMount:function(){this.rootNode=this.getPopupDomNode()},onAlign:function(e,t){var n=this.props,i=n.getClassNameFromAlign(n.align),r=n.getClassNameFromAlign(t);i!==r&&(this.currentAlignClassName=r,e.className=this.getClassName(r)),n.onAlign(e,t)},getPopupDomNode:function(){return u["default"].findDOMNode(this.refs.popup)},getTarget:function(){return this.props.getRootDomNode()},getMaskTransitionName:function(){var e=this.props,t=e.maskTransitionName,n=e.maskAnimation;return!t&&n&&(t=e.prefixCls+"-"+n),t},getTransitionName:function(){var e=this.props,t=e.transitionName;return!t&&e.animation&&(t=e.prefixCls+"-"+e.animation),t},getClassName:function(e){return this.props.prefixCls+" "+this.props.className+" "+e},getPopupElement:function(){var e=this.props,t=e.align,n=e.style,i=e.visible,r=e.prefixCls,a=e.destroyPopupOnHide,l=this.getClassName(this.currentAlignClassName||e.getClassNameFromAlign(t)),u=r+"-hidden";i||(this.currentAlignClassName=null);var c=(0,o["default"])({},n,this.getZIndexStyle()),f={className:l,prefixCls:r,ref:"popup",onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,style:c};return a?s["default"].createElement(p["default"],{component:"",exclusive:!0,transitionAppear:!0,transitionName:this.getTransitionName()},i?s["default"].createElement(d["default"],{target:this.getTarget,key:"popup",ref:this.saveAlign,monitorWindowResize:!0,align:t,onAlign:this.onAlign},s["default"].createElement(m["default"],(0,o["default"])({visible:!0},f),e.children)):null):s["default"].createElement(p["default"],{component:"",exclusive:!0,transitionAppear:!0,transitionName:this.getTransitionName(),showProp:"xVisible"},s["default"].createElement(d["default"],{target:this.getTarget,key:"popup",ref:this.saveAlign,monitorWindowResize:!0,xVisible:i,childrenProps:{visible:"xVisible"},disabled:!i,align:t,onAlign:this.onAlign},s["default"].createElement(m["default"],(0,o["default"])({hiddenClassName:u},f),e.children)))},getZIndexStyle:function(){var e={},t=this.props;return void 0!==t.zIndex&&(e.zIndex=t.zIndex),e},getMaskElement:function(){var e=this.props,t=void 0;if(e.mask){var n=this.getMaskTransitionName();t=s["default"].createElement(v["default"],{style:this.getZIndexStyle(),key:"mask",className:e.prefixCls+"-mask",hiddenClassName:e.prefixCls+"-mask-hidden",visible:e.visible}),n&&(t=s["default"].createElement(p["default"],{key:"mask",showProp:"visible",transitionAppear:!0,component:"",transitionName:n},t))}return t},saveAlign:function(e){this.alignInstance=e},render:function(){return s["default"].createElement("div",null,this.getMaskElement(),this.getPopupElement())}});t["default"]=g,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(114),s=i(a),l=o["default"].createClass({displayName:"PopupInner",propTypes:{hiddenClassName:r.PropTypes.string,className:r.PropTypes.string,prefixCls:r.PropTypes.string,onMouseEnter:r.PropTypes.func,onMouseLeave:r.PropTypes.func,children:r.PropTypes.any},render:function(){var e=this.props,t=e.className;return e.visible||(t+=" "+e.hiddenClassName),o["default"].createElement("div",{className:t,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,style:e.style},o["default"].createElement(s["default"],{className:e.prefixCls+"-content",visible:e.visible},e.children))}});t["default"]=l,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){}function o(){return""}Object.defineProperty(t,"__esModule",{value:!0});var a=n(7),s=i(a),l=n(1),u=i(l),c=n(9),d=i(c),f=n(402),p=i(f),h=n(401),m=i(h),y=n(396),v=i(y),g=n(400),b=n(403),M=i(b),T=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"],x=u["default"].createClass({displayName:"Trigger",propTypes:{children:l.PropTypes.any,action:l.PropTypes.oneOfType([l.PropTypes.string,l.PropTypes.arrayOf(l.PropTypes.string)]),showAction:l.PropTypes.any,hideAction:l.PropTypes.any,getPopupClassNameFromAlign:l.PropTypes.any,onPopupVisibleChange:l.PropTypes.func,afterPopupVisibleChange:l.PropTypes.func,popup:l.PropTypes.oneOfType([l.PropTypes.node,l.PropTypes.func]).isRequired,popupStyle:l.PropTypes.object,prefixCls:l.PropTypes.string,popupClassName:l.PropTypes.string,popupPlacement:l.PropTypes.string,builtinPlacements:l.PropTypes.object,popupTransitionName:l.PropTypes.string,popupAnimation:l.PropTypes.any,mouseEnterDelay:l.PropTypes.number,mouseLeaveDelay:l.PropTypes.number,zIndex:l.PropTypes.number,focusDelay:l.PropTypes.number,blurDelay:l.PropTypes.number,getPopupContainer:l.PropTypes.func,destroyPopupOnHide:l.PropTypes.bool,mask:l.PropTypes.bool,maskClosable:l.PropTypes.bool,onPopupAlign:l.PropTypes.func,popupAlign:l.PropTypes.object,popupVisible:l.PropTypes.bool,maskTransitionName:l.PropTypes.string,maskAnimation:l.PropTypes.string},mixins:[(0,M["default"])({autoMount:!1,isVisible:function(e){return e.state.popupVisible},getContainer:function(e){var t=document.createElement("div"),n=e.props.getPopupContainer?e.props.getPopupContainer((0,c.findDOMNode)(e)):document.body;return n.appendChild(t),t},getComponent:function(e){var t=e.props,n=e.state,i={};return e.isMouseEnterToShow()&&(i.onMouseEnter=e.onPopupMouseEnter),e.isMouseLeaveToHide()&&(i.onMouseLeave=e.onPopupMouseLeave),u["default"].createElement(v["default"],(0,s["default"])({prefixCls:t.prefixCls,destroyPopupOnHide:t.destroyPopupOnHide,visible:n.popupVisible,className:t.popupClassName,action:t.action,align:e.getPopupAlign(),onAlign:t.onPopupAlign,animation:t.popupAnimation,getClassNameFromAlign:e.getPopupClassNameFromAlign},i,{getRootDomNode:e.getRootDomNode,style:t.popupStyle,mask:t.mask,zIndex:t.zIndex,transitionName:t.popupTransitionName,maskAnimation:t.maskAnimation,maskTransitionName:t.maskTransitionName}),"function"==typeof t.popup?t.popup():t.popup)}})],getDefaultProps:function(){return{prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:o,onPopupVisibleChange:r,afterPopupVisibleChange:r,onPopupAlign:r,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[]}},getInitialState:function(){var e=this.props,t=void 0;return t="popupVisible"in e?!!e.popupVisible:!!e.defaultPopupVisible,{popupVisible:t}},componentWillMount:function(){var e=this;T.forEach(function(t){e["fire"+t]=function(n){e.fireEvents(t,n)}})},componentDidMount:function(){this.componentDidUpdate({},{popupVisible:this.state.popupVisible})},componentWillReceiveProps:function(e){var t=e.popupVisible;void 0!==t&&this.setState({popupVisible:t})},componentDidUpdate:function(e,t){var n=this.props,i=this.state;return this.renderComponent(null,function(){t.popupVisible!==i.popupVisible&&n.afterPopupVisibleChange(i.popupVisible)}),this.isClickToHide()&&i.popupVisible?void(this.clickOutsideHandler||(this.clickOutsideHandler=(0,m["default"])(document,"mousedown",this.onDocumentClick),this.touchOutsideHandler=(0,m["default"])(document,"touchstart",this.onDocumentClick))):void(this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.touchOutsideHandler.remove(),this.clickOutsideHandler=null,this.touchOutsideHandler=null))},componentWillUnmount:function(){this.clearDelayTimer(),this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.touchOutsideHandler.remove(),this.clickOutsideHandler=null,this.touchOutsideHandler=null)},onMouseEnter:function(e){this.fireEvents("onMouseEnter",e),this.delaySetPopupVisible(!0,this.props.mouseEnterDelay)},onMouseLeave:function(e){this.fireEvents("onMouseLeave",e),this.delaySetPopupVisible(!1,this.props.mouseLeaveDelay)},onPopupMouseEnter:function(){this.clearDelayTimer()},onPopupMouseLeave:function(e){e.relatedTarget&&!e.relatedTarget.setTimeout&&this._component&&(0,p["default"])(this._component.getPopupDomNode(),e.relatedTarget)||this.delaySetPopupVisible(!1,this.props.mouseLeaveDelay)},onFocus:function(e){this.fireEvents("onFocus",e),this.clearDelayTimer(),this.isFocusToShow()&&(this.focusTime=Date.now(),this.delaySetPopupVisible(!0,this.props.focusDelay))},onMouseDown:function(e){this.fireEvents("onMouseDown",e),this.preClickTime=Date.now()},onTouchStart:function(e){this.fireEvents("onTouchStart",e),this.preTouchTime=Date.now()},onBlur:function(e){this.fireEvents("onBlur",e),this.clearDelayTimer(),this.isBlurToHide()&&this.delaySetPopupVisible(!1,this.props.blurDelay)},onClick:function(e){if(this.fireEvents("onClick",e),this.focusTime){var t=void 0;if(this.preClickTime&&this.preTouchTime?t=Math.min(this.preClickTime,this.preTouchTime):this.preClickTime?t=this.preClickTime:this.preTouchTime&&(t=this.preTouchTime),Math.abs(t-this.focusTime)<20)return;this.focusTime=0}this.preClickTime=0,this.preTouchTime=0,e.preventDefault();var n=!this.state.popupVisible;(this.isClickToHide()&&!n||n&&this.isClickToShow())&&this.setPopupVisible(!this.state.popupVisible)},onDocumentClick:function(e){if(!this.props.mask||this.props.maskClosable){var t=e.target,n=(0,c.findDOMNode)(this),i=this.getPopupDomNode();(0,p["default"])(n,t)||(0,p["default"])(i,t)||this.close()}},getPopupDomNode:function(){return this._component&&this._component.isMounted()?this._component.getPopupDomNode():null},getRootDomNode:function(){return d["default"].findDOMNode(this)},getPopupClassNameFromAlign:function(e){var t=[],n=this.props,i=n.popupPlacement,r=n.builtinPlacements,o=n.prefixCls;return i&&r&&t.push((0,g.getPopupClassNameFromAlign)(r,o,e)),n.getPopupClassNameFromAlign&&t.push(n.getPopupClassNameFromAlign(e)),t.join(" ")},getPopupAlign:function(){var e=this.props,t=e.popupPlacement,n=e.popupAlign,i=e.builtinPlacements;return t&&i?(0,g.getAlignFromPlacement)(i,t,n):n},setPopupVisible:function(e){this.clearDelayTimer(),this.state.popupVisible!==e&&("popupVisible"in this.props||this.setState({popupVisible:e}),this.props.onPopupVisibleChange(e))},delaySetPopupVisible:function(e,t){var n=this,i=1e3*t;this.clearDelayTimer(),i?this.delayTimer=setTimeout(function(){n.setPopupVisible(e),n.clearDelayTimer()},i):this.setPopupVisible(e)},clearDelayTimer:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)},createTwoChains:function(e){var t=this.props.children.props,n=this.props;return t[e]&&n[e]?this["fire"+e]:t[e]||n[e]},isClickToShow:function(){var e=this.props,t=e.action,n=e.showAction;return t.indexOf("click")!==-1||n.indexOf("click")!==-1},isClickToHide:function(){var e=this.props,t=e.action,n=e.hideAction;return t.indexOf("click")!==-1||n.indexOf("click")!==-1},isMouseEnterToShow:function(){var e=this.props,t=e.action,n=e.showAction;return t.indexOf("hover")!==-1||n.indexOf("mouseEnter")!==-1},isMouseLeaveToHide:function(){var e=this.props,t=e.action,n=e.hideAction;return t.indexOf("hover")!==-1||n.indexOf("mouseLeave")!==-1},isFocusToShow:function(){var e=this.props,t=e.action,n=e.showAction;return t.indexOf("focus")!==-1||n.indexOf("focus")!==-1},isBlurToHide:function(){var e=this.props,t=e.action,n=e.hideAction;return t.indexOf("focus")!==-1||n.indexOf("blur")!==-1},forcePopupAlign:function(){this.state.popupVisible&&this.popupInstance&&this.popupInstance.alignInstance&&this.popupInstance.alignInstance.forceAlign()},fireEvents:function(e,t){var n=this.props.children.props[e];n&&n(t);var i=this.props[e];i&&i(t)},close:function(){this.setPopupVisible(!1)},render:function(){var e=this.props,t=e.children,n=u["default"].Children.only(t),i={};return this.isClickToHide()||this.isClickToShow()?(i.onClick=this.onClick,i.onMouseDown=this.onMouseDown,i.onTouchStart=this.onTouchStart):(i.onClick=this.createTwoChains("onClick"),i.onMouseDown=this.createTwoChains("onMouseDown"),i.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?i.onMouseEnter=this.onMouseEnter:i.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?i.onMouseLeave=this.onMouseLeave:i.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(i.onFocus=this.onFocus,i.onBlur=this.onBlur):(i.onFocus=this.createTwoChains("onFocus"),i.onBlur=this.createTwoChains("onBlur")),u["default"].cloneElement(n,i)}});t["default"]=x,e.exports=t["default"]},function(e,t,n){"use strict";e.exports=n(398)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){return e[0]===t[0]&&e[1]===t[1]}function o(e,t,n){var i=e[t]||{};return(0,l["default"])({},i,n)}function a(e,t,n){var i=n.points;for(var o in e)if(e.hasOwnProperty(o)&&r(e[o].points,i))return t+"-placement-"+o;return""}Object.defineProperty(t,"__esModule",{value:!0});var s=n(7),l=i(s);t.getAlignFromPlacement=o,t.getPopupClassNameFromAlign=a},344,function(e,t){"use strict";e.exports=function(e,t){for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}},357,function(e,t,n){"use strict";function i(e,t,n){return!r(e.props,t)||!r(e.state,n)}var r=n(39),o={shouldComponentUpdate:function(e,t){return i(this,e,t)}};e.exports=o},function(e,t,n){function i(e){var t=e.getDefaultProps;t&&(e.defaultProps=t(),delete e.getDefaultProps)}function r(e){function t(e){var t=e.state||{};s(t,n.call(e)),e.state=t}var n=e.getInitialState,i=e.componentWillMount;n&&(i?e.componentWillMount=function(){t(this),i.call(this)}:e.componentWillMount=function(){t(this)},delete e.getInitialState)}function o(e,t){i(t),r(t);var n={},s={};Object.keys(t).forEach(function(e){"mixins"!==e&&"statics"!==e&&("function"==typeof t[e]?n[e]=t[e]:s[e]=t[e])}),l(e.prototype,n);var u=function(e,t,n){if(!e)return t;if(!t)return e;var i={};return Object.keys(e).forEach(function(n){t[n]||(i[n]=e[n])}),Object.keys(t).forEach(function(n){e[n]?i[n]=function(){return t[n].apply(this,arguments)&&e[n].apply(this,arguments)}:i[n]=t[n]}),i};return a({childContextTypes:u,contextTypes:u,propTypes:a.MANY_MERGED_LOOSE,defaultProps:a.MANY_MERGED_LOOSE})(e,s),t.statics&&Object.getOwnPropertyNames(t.statics).forEach(function(n){var i=e[n],r=t.statics[n];if(void 0!==i&&void 0!==r)throw new TypeError("Cannot mixin statics because statics."+n+" and Component."+n+" are defined.");e[n]=void 0!==i?i:r}),t.mixins&&t.mixins.reverse().forEach(o.bind(null,e)),e}var a=n(428),s=n(10),l=a({componentDidMount:a.MANY,componentWillMount:a.MANY,componentWillReceiveProps:a.MANY,shouldComponentUpdate:a.ONCE,componentWillUpdate:a.MANY,componentDidUpdate:a.MANY,componentWillUnmount:a.MANY,getChildContext:a.MANY_MERGED});e.exports=function(){var e=l;return e.onClass=function(e,t){return t=s({},t),o(e,t)},e.decorate=function(t){return function(n){return e.onClass(n,t)}},e}()},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(1),u=i(l),c=n(9),d=i(c),f=n(115),p=i(f),h=function(e){function t(e){r(this,t);var n=o(this,Object.getPrototypeOf(t).call(this,e));return n.updateOffset=function(e){var t=e.inherited,i=e.offset;n.channel.update(function(e){e.inherited=t+i})},n.channel=new p["default"]({inherited:0,offset:0,node:null}),n}return a(t,e),s(t,[{key:"getChildContext",value:function(){return{"sticky-channel":this.channel}}},{key:"componentWillMount",value:function(){var e=this.context["sticky-channel"];e&&e.subscribe(this.updateOffset)}},{key:"componentDidMount",value:function(){var e=d["default"].findDOMNode(this);this.channel.update(function(t){t.node=e})}},{key:"componentWillUnmount",value:function(){this.channel.update(function(e){e.node=null});var e=this.context["sticky-channel"];e&&e.unsubscribe(this.updateOffset)}},{key:"render",value:function(){return u["default"].createElement("div",this.props,this.props.children)}}]),t}(u["default"].Component);h.contextTypes={"sticky-channel":u["default"].PropTypes.any},h.childContextTypes={"sticky-channel":u["default"].PropTypes.any},t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Channel=t.StickyContainer=t.Sticky=void 0;var r=n(408),o=i(r),a=n(406),s=i(a),l=n(115),u=i(l);t.Sticky=o["default"],t.StickyContainer=s["default"],t.Channel=u["default"],t["default"]=o["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),c=n(1),d=i(c),f=n(9),p=i(f),h=function(e){function t(e){o(this,t);var n=a(this,Object.getPrototypeOf(t).call(this,e));return n.updateContext=function(e){var t=e.inherited,i=e.node;n.containerNode=i,n.setState({containerOffset:t,distanceFromBottom:n.getDistanceFromBottom()})},n.recomputeState=function(){var e=n.isSticky(),t=n.getHeight(),i=n.getWidth(),r=n.getXOffset(),o=n.getDistanceFromBottom(),a=n.state.isSticky!==e;n.setState({isSticky:e,height:t,width:i,xOffset:r,distanceFromBottom:o}),a&&(n.channel&&n.channel.update(function(t){t.offset=e?n.state.height:0}),n.props.onStickyStateChange(e))},n.state={},n}return s(t,e),u(t,[{key:"componentWillMount",value:function(){this.channel=this.context["sticky-channel"],this.channel.subscribe(this.updateContext)}},{key:"componentDidMount",value:function(){this.on(["resize","scroll","touchstart","touchmove","touchend","pageshow","load"],this.recomputeState),this.recomputeState()}},{key:"componentWillReceiveProps",value:function(){this.recomputeState()}},{key:"componentWillUnmount",value:function(){this.off(["resize","scroll","touchstart","touchmove","touchend","pageshow","load"],this.recomputeState),this.channel.unsubscribe(this.updateContext)}},{key:"getXOffset",value:function(){return this.refs.placeholder.getBoundingClientRect().left}},{key:"getWidth",value:function(){return this.refs.placeholder.getBoundingClientRect().width}},{key:"getHeight",value:function(){return p["default"].findDOMNode(this.refs.children).getBoundingClientRect().height}},{key:"getDistanceFromTop",value:function(){return this.refs.placeholder.getBoundingClientRect().top}},{key:"getDistanceFromBottom",value:function(){return this.containerNode?this.containerNode.getBoundingClientRect().bottom:0}},{key:"isSticky",value:function(){if(!this.props.isActive)return!1;var e=this.getDistanceFromTop(),t=this.getDistanceFromBottom(),n=this.state.containerOffset-this.props.topOffset,i=this.state.containerOffset+this.props.bottomOffset;return e<=n&&t>=i}},{key:"on",value:function(e,t){e.forEach(function(e){window.addEventListener(e,t)})}},{key:"off",value:function(e,t){e.forEach(function(e){window.removeEventListener(e,t)})}},{key:"shouldComponentUpdate",value:function(e,t){var n=this,i=Object.keys(this.props);if(Object.keys(e).length!=i.length)return!0;var r=i.every(function(t){return e.hasOwnProperty(t)&&e[t]===n.props[t]});if(!r)return!0;var o=this.state;if(t.isSticky!==o.isSticky)return!0;if(o.isSticky){if(t.height!==o.height)return!0;if(t.width!==o.width)return!0;if(t.xOffset!==o.xOffset)return!0;
if(t.containerOffset!==o.containerOffset)return!0;if(t.distanceFromBottom!==o.distanceFromBottom)return!0}return!1}},{key:"render",value:function(){var e={paddingBottom:0},t=this.props.className,n=l({},{transform:"translateZ(0)"},this.props.style);if(this.state.isSticky){var i={position:"fixed",top:this.state.containerOffset,left:this.state.xOffset,width:this.state.width},o=this.state.distanceFromBottom-this.state.height-this.props.bottomOffset;this.state.containerOffset>o&&(i.top=o),e.paddingBottom=this.state.height,t+=" "+this.props.stickyClassName,n=l({},n,i,this.props.stickyStyle)}var a=this.props,s=(a.topOffset,a.isActive,a.stickyClassName,a.stickyStyle,a.bottomOffset,a.onStickyStateChange,r(a,["topOffset","isActive","stickyClassName","stickyStyle","bottomOffset","onStickyStateChange"]));return d["default"].createElement("div",null,d["default"].createElement("div",{ref:"placeholder",style:e}),d["default"].createElement("div",l({},s,{ref:"children",className:t,style:n}),this.props.children))}}]),t}(d["default"].Component);h.propTypes={isActive:d["default"].PropTypes.bool,className:d["default"].PropTypes.string,style:d["default"].PropTypes.object,stickyClassName:d["default"].PropTypes.string,stickyStyle:d["default"].PropTypes.object,topOffset:d["default"].PropTypes.number,bottomOffset:d["default"].PropTypes.number,onStickyStateChange:d["default"].PropTypes.func},h.defaultProps={isActive:!0,className:"",style:{},stickyClassName:"sticky",stickyStyle:{},topOffset:0,bottomOffset:0,onStickyStateChange:function(){}},h.contextTypes={"sticky-channel":d["default"].PropTypes.any},t["default"]=h,e.exports=t["default"]},function(e,t){(function(t){"use strict";var n="undefined"==typeof window?t:window,i=function(e,t,n){return function(i,r){var o=e(function(){t.call(this,o),i.apply(this,arguments)}.bind(this),r);return this[n]?this[n].push(o):this[n]=[o],o}},r=function(e,t){return function(n){if(this[t]){var i=this[t].indexOf(n);i!==-1&&this[t].splice(i,1)}e(n)}},o="TimerMixin_timeouts",a=r(n.clearTimeout,o),s=i(n.setTimeout,a,o),l="TimerMixin_intervals",u=r(n.clearInterval,l),c=i(n.setInterval,function(){},l),d="TimerMixin_immediates",f=r(n.clearImmediate,d),p=i(n.setImmediate,f,d),h="TimerMixin_rafs",m=r(n.cancelAnimationFrame,h),y=i(n.requestAnimationFrame,m,h),v={componentWillUnmount:function(){this[o]&&this[o].forEach(function(e){n.clearTimeout(e)}),this[o]=null,this[l]&&this[l].forEach(function(e){n.clearInterval(e)}),this[l]=null,this[d]&&this[d].forEach(function(e){n.clearImmediate(e)}),this[d]=null,this[h]&&this[h].forEach(function(e){n.cancelAnimationFrame(e)}),this[h]=null},setTimeout:s,clearTimeout:a,setInterval:c,clearInterval:u,setImmediate:p,clearImmediate:f,requestAnimationFrame:y,cancelAnimationFrame:m};e.exports=v}).call(t,function(){return this}())},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(5),s=i(a),l=n(117),u=i(l),c=n(411),d=i(c),f=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},p=o["default"].createClass({displayName:"Cascader",mixins:[d["default"]],getDefaultProps:function(){return{prefixCls:"rmc-cascader",pickerPrefixCls:"rmc-picker",data:[],disabled:!1}},render:function(){var e=this,t=this.props,n=t.prefixCls,i=t.pickerPrefixCls,r=t.className,a=t.rootNativeProps,l=t.disabled,c=t.pickerItemStyle,d=this.state.value,p=this.getChildrenTree(),h=this.getColArray().map(function(t,r){return o["default"].createElement("div",{key:r,className:n+"-item "+n+"-main-item"},o["default"].createElement(u["default"],{itemStyle:c,disabled:l,prefixCls:i,selectedValue:d[r],onValueChange:e.onValueChange.bind(e,r)},p[r]||[]))});return o["default"].createElement("div",f({},a,{className:(0,s["default"])(r,n)}),h)}});t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(74),o=i(r);t["default"]={getDefaultProps:function(){return{cols:3}},getInitialState:function(){return{value:this.getValue(this.props.data,this.props.defaultValue||this.props.value)}},componentWillReceiveProps:function(e){"value"in e&&this.setState({value:this.getValue(e.data,e.value)})},onValueChange:function(e,t){var n=this.state.value.concat();n[e]=t;var i=(0,o["default"])(this.props.data,function(t,i){return i<=e&&t.value===n[i]}),r=i[e],a=void 0;for(a=e+1;r&&r.children&&r.children.length&&a<this.props.cols;a++)r=r.children[0],n[a]=r.value;n.length=a,"value"in this.props||this.setState({value:n}),this.props.onChange(n)},getValue:function(e,t){var n=e||this.props.data,i=t||this.props.value||this.props.defaultValue;if(!i||!i.length){i=[];for(var r=0;r<this.props.cols;r++)n&&n.length?(i[r]=n[0].value,n=n[0].children):i[r]=void 0}return i},getColArray:function(){for(var e=[],t=0;t<this.props.cols;t++)e[t]=void 0;return e},getChildrenTree:function(){var e=this.props,t=e.data,n=e.cols,i=this.state.value,r=(0,o["default"])(t,function(e,t){return e.value===i[t]}).map(function(e){return e.children});return r.length=n-1,r.unshift(t),r}},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=i(o),s=n(4),l=i(s),u=n(3),c=i(u),d=n(1),f=i(d),p=n(118),h=i(p),m=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},y=function(e){function t(n){(0,a["default"])(this,t);var i=(0,l["default"])(this,e.call(this,n));return i.onPickerChange=function(e){i.setState({pickerValue:e}),i.props.cascader.props.onChange&&i.props.cascader.props.onChange(e)},i.onOk=function(){var e=i.props.onChange;e&&e(i.cascader.getValue().filter(function(e){return null!==e&&void 0!==e}))},i.saveRef=function(e){i.cascader=e},i.fireVisibleChange=function(e){if(i.state.visible!==e){"visible"in i.props||i.setVisibleState(e);var t=i.props.onVisibleChange;t&&t(e)}},i.state={pickerValue:null,visible:i.props.visible||!1},i}return(0,c["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){"visible"in e&&this.setVisibleState(e.visible)},t.prototype.setVisibleState=function(e){this.setState({visible:e}),e||this.setState({pickerValue:null})},t.prototype.render=function(){var e=f["default"].cloneElement(this.props.cascader,{value:this.state.pickerValue||this.props.value,onChange:this.onPickerChange,ref:this.saveRef,data:this.props.cascader.props.data});return f["default"].createElement(h["default"],m({},this.props,{onVisibleChange:this.fireVisibleChange,onOk:this.onOk,content:e,visible:this.state.visible}))},t}(f["default"].Component);t["default"]=y,y.defaultProps={prefixCls:"rmc-picker-popup",onVisibleChange:r,onChange:r},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=i(r),a=n(1),s=i(a),l=n(426),u=i(l),c=n(5),d=i(c),f=n(414),p=i(f),h=s["default"].createClass({displayName:"DatePickerWeb",mixins:[p["default"]],getDefaultProps:function(){return{prefixCls:"rmc-date-picker",pickerPrefixCls:"rmc-picker",disabled:!1}},render:function(){var e=this,t=this.props,n=t.prefixCls,i=t.pickerPrefixCls,r=t.className,a=t.rootNativeProps,l=t.disabled,c=this.getValueDataSource(),f=c.value,p=c.dataSource,h=p.map(function(t,r){return s["default"].createElement("div",{key:r,className:n+"-item"},s["default"].createElement(u["default"],{disabled:l,prefixCls:i,pure:!1,selectedValue:f[r],onValueChange:function(t){e.onValueChange(r,t)}},t))});return s["default"].createElement("div",(0,o["default"])({},a,{className:(0,d["default"])(r,n)}),h)}});t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n){return e.clone().year(t).month(n).endOf("month").date()}Object.defineProperty(t,"__esModule",{value:!0});var o=n(53),a=i(o),s=n(106),l=i(s),u=n(416),c=i(u),d="datetime",f="date",p="time";t["default"]={getDefaultProps:function(){return{locale:c["default"],mode:f,onDateChange:function(){}}},getInitialState:function(){return{date:this.props.date||this.props.defaultDate}},componentWillReceiveProps:function(e){"date"in e&&this.setState({date:e.date||e.defaultDate})},onValueChange:function(e,t){var n=this.props,i=this.getDate().clone();if(n.mode===d||n.mode===f)switch(e){case 0:i.year(t);break;case 1:i.month(t);break;case 2:i.date(t);break;case 3:i.hour(t);break;case 4:i.minute(t)}else switch(e){case 0:i.hour(t);break;case 1:i.minute(t)}i=this.clipDate(i),"date"in this.props||this.setState({date:i}),n.onDateChange(i)},getDefaultMinDate:function(){return this.defaultMinDate||(this.defaultMinDate=this.getGregorianCalendar([2e3,1,1,0,0,0])),this.defaultMinDate},getDefaultMaxDate:function(){return this.defaultMaxDate||(this.defaultMaxDate=this.getGregorianCalendar([2030,1,1,23,59,59])),this.defaultMaxDate},getDate:function(){return this.state.date||this.getDefaultMinDate()},getMinYear:function(){return this.getMinDate().year()},getMaxYear:function(){return this.getMaxDate().year()},getMinMonth:function(){return this.getMinDate().month()},getMaxMonth:function(){return this.getMaxDate().month()},getMinDay:function(){return this.getMinDate().date()},getMaxDay:function(){return this.getMaxDate().date()},getMinHour:function(){return this.getMinDate().hour()},getMaxHour:function(){return this.getMaxDate().hour()},getMinMinute:function(){return this.getMinDate().minute()},getMaxMinute:function(){return this.getMaxDate().minute()},getMinDate:function(){return this.props.minDate||this.getDefaultMinDate()},getMaxDate:function(){return this.props.maxDate||this.getDefaultMaxDate()},getDateData:function(){for(var e=this.props.locale,t=this.getDate(),n=t.year(),i=t.month(),o=this.getMinYear(),a=this.getMaxYear(),s=this.getMinMonth(),l=this.getMaxMonth(),u=this.getMinDay(),c=this.getMaxDay(),d=[],f=o;f<=a;f++)d.push({value:f,label:f+e.year});var p=[],h=0,m=11;o===n&&(h=s),a===n&&(m=l);for(var y=h;y<=m;y++)p.push({value:y,label:y+1+e.month});var v=[],g=1,b=r(t,n,i);o===n&&s===i&&(g=u),a===n&&l===i&&(b=c);for(var M=g;M<=b;M++)v.push({value:M,label:M+e.day});return[d,p,v]},getTimeData:function(){var e=0,t=23,n=0,i=59,r=this.props,o=r.mode,a=r.locale,s=this.getDate(),l=this.getMinMinute(),u=this.getMaxMinute(),c=this.getMinHour(),f=this.getMaxHour(),p=s.hour();if(o===d){var h=s.year(),m=s.month(),y=s.date(),v=this.getMinYear(),g=this.getMaxYear(),b=this.getMinMonth(),M=this.getMaxMonth(),T=this.getMinDay(),x=this.getMaxDay();v===h&&b===m&&T===y&&(e=c,c===p&&(n=l)),g===h&&M===m&&x===y&&(t=f,f===p&&(i=u))}else e=c,c===p&&(n=l),t=f,f===p&&(i=u);for(var C=[],_=e;_<=t;_++)C.push({value:_,label:_+a.hour});for(var w=[],S=n;S<=i;S++)w.push({value:S,label:S+a.minute});return[C,w]},getGregorianCalendar:function(e){return(0,l["default"])(e)},clipDate:function(e){var t=this.props.mode,n=this.getMinDate(),i=this.getMaxDate();if(t===d){if(e.isBefore(n))return n.clone();if(e.isAfter(i))return i.clone()}else if(t===f){if(e.isBefore(n,"day")<0)return n.clone();if(e.isAfter(i,"day")>0)return i.clone()}else{var r=i.hour(),o=i.minute(),a=n.hour(),s=n.minute(),l=e.hour(),u=e.minute();if(l<a||l===a&&u<s)return n.clone();if(l>r||l===r&&u>o)return i.clone()}return e},getValueDataSource:function(){var e=this.props.mode,t=this.getDate(),n=[],i=[];return e!==d&&e!==f||(n=[].concat((0,a["default"])(this.getDateData())),i=[t.year(),t.month(),t.date()]),e!==d&&e!==p||(n=n.concat(this.getTimeData()),i=i.concat([t.hour(),t.minute()])),{value:i,dataSource:n}}},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(){}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),a=i(o),s=n(2),l=i(s),u=n(4),c=i(u),d=n(3),f=i(d),p=n(1),h=i(p),m=n(118),y=i(m),v=function(e){function t(n){(0,l["default"])(this,t);var i=(0,c["default"])(this,e.call(this,n));return i.onPickerChange=function(e){i.setState({pickerDate:e}),i.props.datePicker.props.onDateChange&&i.props.datePicker.props.onDateChange(e)},i.onOk=function(){var e=i.props.onChange;e&&e(i.datePicker.getDate())},i.saveRef=function(e){i.datePicker=e},i.fireVisibleChange=function(e){if(i.state.visible!==e){"visible"in i.props||i.setVisibleState(e);var t=i.props.onVisibleChange;t&&t(e)}},i.state={pickerDate:null,visible:i.props.visible||!1},i}return(0,f["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){"visible"in e&&this.setVisibleState(e.visible)},t.prototype.setVisibleState=function(e){this.setState({visible:e}),e||this.setState({pickerDate:null})},t.prototype.render=function(){var e=h["default"].cloneElement(this.props.datePicker,{date:this.state.pickerDate||this.props.date,onDateChange:this.onPickerChange,ref:this.saveRef});return h["default"].createElement(y["default"],(0,a["default"])({},this.props,{onVisibleChange:this.fireVisibleChange,onOk:this.onOk,content:e,visible:this.state.visible}))},t}(h["default"].Component);t["default"]=v,v.defaultProps={onVisibleChange:r,prefixCls:"rmc-picker-popup",onChange:r,onDismiss:r,onPickerChange:r},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={year:"",month:"",day:"",hour:"",minute:""},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={year:"\u5e74",month:"\u6708",day:"\u65e5",hour:"\u65f6",minute:"\u5206"},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=i(r),a=n(6),s=i(a),l=n(52),u=i(l),c=n(2),d=i(c),f=n(4),p=i(f),h=n(3),m=i(h),y=n(1),v=i(y),g=n(9),b=i(g),M=n(5),T=i(M),x=n(116),C=i(x),_=n(73),w=function(e){function t(n){(0,d["default"])(this,t);var i=(0,p["default"])(this,e.call(this,n));return S.call(i),i.state={pageSize:n.pageSize,_delay:!1},i}return(0,m["default"])(t,e),t.prototype.componentWillReceiveProps=function(e){this.props.dataSource!==e.dataSource&&this.dataChange(e)},t.prototype.componentWillUnmount=function(){this._timer&&clearTimeout(this._timer),this._hCache=null},t.prototype.componentDidUpdate=function(){this.getQsInfo()},t.prototype.componentDidMount=function(){this.dataChange(this.props),this.getQsInfo()},t.prototype.renderQuickSearchBar=function(e,t){var n=this,i=this.props,r=i.dataSource,o=i.prefixCls,a=r.sectionIdentities.map(function(e){return{value:e,label:r._getSectionHeaderData(r._dataBlob,e)}});return v["default"].createElement("ul",{ref:"quickSearchBar",className:o+"-quick-search-bar",style:t,onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd,onTouchCancel:this.onTouchEnd},v["default"].createElement("li",{"data-qf-target":e.value,onClick:function(){return n.onQuickSearchTop(void 0,e.value)}},e.label),a.map(function(e){return v["default"].createElement("li",{key:e.value,"data-qf-target":e.value,onClick:function(){return n.onQuickSearch(e.value)}},e.label)}))},t.prototype.render=function(){var e,t=this,n=this.state,i=n._delay,r=n.pageSize,a=this.props,l=a.className,c=a.prefixCls,d=a.children,f=a.quickSearchBarTop,p=a.quickSearchBarStyle,h=a.initialListSize,m=void 0===h?Math.min(20,this.props.dataSource.getRowCount()):h,y=a.renderSectionHeader,g=a.sectionHeaderClassName,b=(0,u["default"])(a,["className","prefixCls","children","quickSearchBarTop","quickSearchBarStyle","initialListSize","renderSectionHeader","sectionHeaderClassName"]),M=(0,T["default"])((e={},(0,s["default"])(e,l,l),(0,s["default"])(e,c,!0),e));return v["default"].createElement("div",{className:c+"-container"},i&&this.props.delayActivityIndicator,v["default"].createElement(C["default"],(0,o["default"])({},b,{ref:"indexedListView",className:M,initialListSize:m,pageSize:r,renderSectionHeader:function(e,n){return v["default"].cloneElement(y(e,n),{ref:function(e){return t.sectionComponents[n]=e},className:g||c+"-section-header"})}}),d),this.renderQuickSearchBar(f,p))},t}(v["default"].Component);w.propTypes={prefixCls:y.PropTypes.string,sectionHeaderClassName:y.PropTypes.string,quickSearchBarTop:y.PropTypes.object,onQuickSearch:y.PropTypes.func},w.defaultProps={prefixCls:"rmc-indexed-list",quickSearchBarTop:{value:"#",label:"#"},onQuickSearch:function(){},delayTime:100,delayActivityIndicator:""};var S=function(){var e=this;this.getQsInfo=function(){var t=e.refs.quickSearchBar,n=t.offsetHeight,i=[];[].slice.call(t.querySelectorAll("[data-qf-target]")).forEach(function(e){i.push([e])});for(var r=n/i.length,o=0,a=0,s=i.length;a<s;a++)o=a*r,i[a][1]=[o,o+r];e._qsHeight=n,e._avgH=r,e._hCache=i},this.dataChange=function(t){var n=t.dataSource.getRowCount();n&&(e.setState({_delay:!0}),e._timer&&clearTimeout(e._timer),e._timer=setTimeout(function(){e.setState({pageSize:n,_delay:!1},function(){return e.refs.indexedListView._pageInNewRows()})},t.delayTime))},this.sectionComponents={},this.onQuickSearchTop=function(t,n){e.props.stickyHeader?window.document.body.scrollTop=0:b["default"].findDOMNode(e.refs.indexedListView.refs.listviewscroll).scrollTop=0,e.props.onQuickSearch(t,n)},this.onQuickSearch=function(t){var n=b["default"].findDOMNode(e.refs.indexedListView.refs.listviewscroll),i=b["default"].findDOMNode(e.sectionComponents[t]);if(e.props.stickyHeader){var r=e.refs.indexedListView.stickyRefs[t];r&&r.refs.placeholder&&(i=b["default"].findDOMNode(r.refs.placeholder)),window.document.body.scrollTop=i.getBoundingClientRect().top-n.getBoundingClientRect().top+(0,_.getOffsetTop)(n)}else n.scrollTop+=i.getBoundingClientRect().top-n.getBoundingClientRect().top;e.props.onQuickSearch(t)},this.onTouchStart=function(t){e._target=t.target,e._basePos=e.refs.quickSearchBar.getBoundingClientRect(),document.addEventListener("touchmove",e._disableParent,!1),document.body.className=document.body.className+" "+e.props.prefixCls+"-qsb-moving",e.updateCls(e._target)},this.onTouchMove=function(t){if(t.preventDefault(),e._target){var n=(0,_._event)(t),i=e._basePos,r=void 0;if(n.clientY>=i.top&&n.clientY<=i.top+e._qsHeight){r=Math.floor((n.clientY-i.top)/e._avgH);var o=void 0;if(r in e._hCache&&(o=e._hCache[r][0]),o){var a=o.getAttribute("data-qf-target");e._target!==o&&(e.props.quickSearchBarTop.value===a?e.onQuickSearchTop(void 0,a):e.onQuickSearch(a),e.updateCls(o)),e._target=o}}}},this.onTouchEnd=function(t){e._target&&(document.removeEventListener("touchmove",e._disableParent,!1),document.body.className=document.body.className.replace(new RegExp(e.props.prefixCls+"-qsb-moving","g"),""),e.updateCls(e._target,!0),e._target=null)},this.updateCls=function(t,n){var i=e.props.prefixCls+"-quick-search-bar-over";e._hCache.forEach(function(e){e[0].className=e[0].className.replace(i,"")}),n||(t.className=t.className+" "+i)},this._disableParent=function(e){e.preventDefault(),e.stopPropagation()}};t["default"]=w,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n){return e[t][n]}function o(e,t){return e[t]}function a(e){for(var t=0,n=0;n<e.length;n++){var i=e[n];t+=i.length}return t}function s(e){if((0,p["default"])(e))return{};for(var t={},n=0;n<e.length;n++){var i=e[n];(0,m["default"])(!t[i],"Value appears more than once in array: "+i),t[i]=!0}return t}var l=n(2),u=i(l),c=n(104),d=i(c),f=n(326),p=i(f),h=n(105),m=i(h),y=function(){function e(t){(0,u["default"])(this,e),(0,d["default"])(t&&"function"==typeof t.rowHasChanged,"Must provide a rowHasChanged function."),this._rowHasChanged=t.rowHasChanged,this._getRowData=t.getRowData||r,this._sectionHeaderHasChanged=t.sectionHeaderHasChanged,this._getSectionHeaderData=t.getSectionHeaderData||o,this._dataBlob=null,this._dirtyRows=[],this._dirtySections=[],this._cachedRowCount=0,this.rowIdentities=[],this.sectionIdentities=[]}return e.prototype.cloneWithRows=function(e,t){var n=t?[t]:null;return this._sectionHeaderHasChanged||(this._sectionHeaderHasChanged=function(){return!1}),this.cloneWithRowsAndSections({s1:e},["s1"],n)},e.prototype.cloneWithRowsAndSections=function(t,n,i){(0,d["default"])("function"==typeof this._sectionHeaderHasChanged,"Must provide a sectionHeaderHasChanged function with section data."),(0,d["default"])(!n||!i||n.length===i.length,"row and section ids lengths must be the same");var r=new e({getRowData:this._getRowData,getSectionHeaderData:this._getSectionHeaderData,rowHasChanged:this._rowHasChanged,sectionHeaderHasChanged:this._sectionHeaderHasChanged});return r._dataBlob=t,n?r.sectionIdentities=n:r.sectionIdentities=Object.keys(t),i?r.rowIdentities=i:(r.rowIdentities=[],r.sectionIdentities.forEach(function(e){r.rowIdentities.push(Object.keys(t[e]))})),r._cachedRowCount=a(r.rowIdentities),r._calculateDirtyArrays(this._dataBlob,this.sectionIdentities,this.rowIdentities),r},e.prototype.getRowCount=function(){return this._cachedRowCount},e.prototype.getRowAndSectionCount=function(){return this._cachedRowCount+this.sectionIdentities.length},e.prototype.rowShouldUpdate=function(e,t){var n=this._dirtyRows[e][t];return(0,m["default"])(void 0!==n,"missing dirtyBit for section, row: "+e+", "+t),n},e.prototype.getRowData=function(e,t){var n=this.sectionIdentities[e],i=this.rowIdentities[e][t];return(0,m["default"])(void 0!==n&&void 0!==i,"rendering invalid section, row: "+e+", "+t),this._getRowData(this._dataBlob,n,i)},e.prototype.getRowIDForFlatIndex=function(e){for(var t=e,n=0;n<this.sectionIdentities.length;n++){if(!(t>=this.rowIdentities[n].length))return this.rowIdentities[n][t];t-=this.rowIdentities[n].length}return null},e.prototype.getSectionIDForFlatIndex=function(e){for(var t=e,n=0;n<this.sectionIdentities.length;n++){if(!(t>=this.rowIdentities[n].length))return this.sectionIdentities[n];t-=this.rowIdentities[n].length}return null},e.prototype.getSectionLengths=function(){for(var e=[],t=0;t<this.sectionIdentities.length;t++)e.push(this.rowIdentities[t].length);return e},e.prototype.sectionHeaderShouldUpdate=function(e){var t=this._dirtySections[e];return(0,m["default"])(void 0!==t,"missing dirtyBit for section: "+e),t},e.prototype.getSectionHeaderData=function(e){if(!this._getSectionHeaderData)return null;var t=this.sectionIdentities[e];return(0,m["default"])(void 0!==t,"renderSection called on invalid section: "+e),this._getSectionHeaderData(this._dataBlob,t)},e.prototype._calculateDirtyArrays=function(e,t,n){for(var i=s(t),r={},o=0;o<n.length;o++){var a=t[o];(0,m["default"])(!r[a],"SectionID appears more than once: "+a),r[a]=s(n[o])}this._dirtySections=[],this._dirtyRows=[];for(var l,u=0;u<this.sectionIdentities.length;u++){var a=this.sectionIdentities[u];l=!i[a];var c=this._sectionHeaderHasChanged;!l&&c&&(l=c(this._getSectionHeaderData(e,a),this._getSectionHeaderData(this._dataBlob,a))),this._dirtySections.push(!!l),this._dirtyRows[u]=[];for(var d=0;d<this.rowIdentities[u].length;d++){var f=this.rowIdentities[u][d];l=!i[a]||!r[a][f]||this._rowHasChanged(this._getRowData(e,a,f),this._getRowData(this._dataBlob,a,f)),this._dirtyRows[u].push(!!l)}}},e}();e.exports=y},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=(i(r),n(9)),a=i(o);t["default"]={bindEvt:function(){var e=this.getEle();e.addEventListener("touchstart",this.onPullUpStart),e.addEventListener("touchmove",this.onPullUpMove),e.addEventListener("touchend",this.onPullUpEnd),e.addEventListener("touchcancel",this.onPullUpEnd)},unBindEvt:function(){var e=this.getEle();e.removeEventListener("touchstart",this.onPullUpStart),e.removeEventListener("touchmove",this.onPullUpMove),e.removeEventListener("touchend",this.onPullUpEnd),e.removeEventListener("touchcancel",this.onPullUpEnd)},getEle:function(){var e=this.props,t=e.stickyHeader,n=e.useBodyScroll,i=(e.useZscroller,void 0);return i=t||n?document.body:a["default"].findDOMNode(this.refs.listviewscroll.refs.ScrollView)},componentDidMount:function(){this.bindEvt()},componentWillUnmount:function(){this.unBindEvt()},onPullUpStart:function(e){this._pullUpStartPageY=e.touches[0].screenY,this._isPullUp=!1,this._pullUpEle=this.getEle()},onPullUpMove:function(e){e.touches[0].screenY<this._pullUpStartPageY&&this._reachBottom()&&(this._isPullUp=!0)},onPullUpEnd:function(e){this._isPullUp&&this.props.onEndReached&&this.props.onEndReached(e),this._isPullUp=!1},_reachBottom:function(){var e=this._pullUpEle;return e===document.body?e.scrollHeight-e.scrollTop===window.innerHeight:e.scrollHeight-e.scrollTop===e.clientHeight}},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=i(r),a=n(1),s=i(a),l=n(9),u=(i(l),n(5)),c=i(u);t["default"]=s["default"].createClass({displayName:"RefreshControl",propTypes:{className:a.PropTypes.string,style:a.PropTypes.object,icon:a.PropTypes.element,prefixCls:a.PropTypes.string,loading:a.PropTypes.element,distanceToRefresh:a.PropTypes.number,refreshing:a.PropTypes.bool,onRefresh:a.PropTypes.func.isRequired},getInitialState:function(){return{active:!1,loadingState:!1}},getDefaultProps:function(){return{prefixCls:"list-view-refresh-control",distanceToRefresh:50,refreshing:!1,icon:s["default"].createElement("div",{style:{lineHeight:"50px",textAlign:"center"}},s["default"].createElement("div",{className:"list-view-refresh-control-pull"},"\u2193 \u4e0b\u62c9"),s["default"].createElement("div",{className:"list-view-refresh-control-release"},"\u2191 \u91ca\u653e")),loading:s["default"].createElement("div",{style:{lineHeight:"50px",textAlign:"center"}},"loading...")}},render:function(){var e,t=this.props,n=t.prefixCls,i=t.icon,r=t.loading,a=t.className,l=void 0===a?"":a,u=t.style,d=t.refreshing,f=this.state,p=f.active,h=f.loadingState,m=(0,c["default"])((e={},(0,o["default"])(e,l,l),(0,o["default"])(e,n+"-ptr",!0),(0,o["default"])(e,n+"-active",p),(0,o["default"])(e,n+"-loading",h||d),e));return s["default"].createElement("div",{ref:"ptr",className:m,style:u},s["default"].createElement("div",{className:n+"-ptr-icon"},i),s["default"].createElement("div",{className:n+"-ptr-loading"},r))}}),e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=(i(r),n(9)),a=i(o),s=n(105),l=i(s),u=16,c={scrollResponderMixinGetInitialState:function(){return{isTouching:!1,lastMomentumScrollBeginTime:0,lastMomentumScrollEndTime:0,observedScrollSinceBecomingResponder:!1,becameResponderWhileAnimating:!1}},scrollResponderHandleScrollShouldSetResponder:function(){return this.state.isTouching},scrollResponderHandleStartShouldSetResponder:function(){return!1},scrollResponderHandleStartShouldSetResponderCapture:function(e){return this.scrollResponderIsAnimating()},scrollResponderHandleMoveShouldSetResponderCapture:function(e){return!0},scrollResponderHandleResponderReject:function(){(0,l["default"])(!1,"ScrollView doesn't take rejection well - scrolls anyway")},scrollResponderHandleTerminationRequest:function(){return!this.state.observedScrollSinceBecomingResponder},scrollResponderHandleTouchEnd:function(e){var t=e.nativeEvent;this.state.isTouching=0!==t.touches.length,this.props.onTouchEnd&&this.props.onTouchEnd(e)},scrollResponderHandleResponderRelease:function(e){this.props.onResponderRelease&&this.props.onResponderRelease(e),this.props.keyboardShouldPersistTaps||this.state.observedScrollSinceBecomingResponder||this.state.becameResponderWhileAnimating||this.props.onScrollResponderKeyboardDismissed&&this.props.onScrollResponderKeyboardDismissed(e)},scrollResponderHandleScroll:function(e){this.state.observedScrollSinceBecomingResponder=!0,this.props.onScroll&&this.props.onScroll(e)},scrollResponderHandleResponderGrant:function(e){this.state.observedScrollSinceBecomingResponder=!1,this.props.onResponderGrant&&this.props.onResponderGrant(e),this.state.becameResponderWhileAnimating=this.scrollResponderIsAnimating()},scrollResponderHandleScrollBeginDrag:function(e){this.props.onScrollBeginDrag&&this.props.onScrollBeginDrag(e)},scrollResponderHandleScrollEndDrag:function(e){this.props.onScrollEndDrag&&this.props.onScrollEndDrag(e)},scrollResponderHandleMomentumScrollBegin:function(e){this.state.lastMomentumScrollBeginTime=Date.now(),this.props.onMomentumScrollBegin&&this.props.onMomentumScrollBegin(e)},scrollResponderHandleMomentumScrollEnd:function(e){this.state.lastMomentumScrollEndTime=Date.now(),this.props.onMomentumScrollEnd&&this.props.onMomentumScrollEnd(e)},scrollResponderHandleTouchStart:function(e){this.state.isTouching=!0,this.props.onTouchStart&&this.props.onTouchStart(e)},scrollResponderHandleTouchMove:function(e){this.props.onTouchMove&&this.props.onTouchMove(e)},scrollResponderIsAnimating:function(){var e=Date.now(),t=e-this.state.lastMomentumScrollEndTime,n=t<u||this.state.lastMomentumScrollEndTime<this.state.lastMomentumScrollBeginTime;return n},scrollResponderScrollTo:function(e,t){this.scrollResponderScrollWithouthAnimationTo(e,t)},scrollResponderScrollWithouthAnimationTo:function(e,t){var n=a["default"].findDOMNode(this);n.offsetX=e,n.offsetY=t},scrollResponderZoomTo:function(e){},scrollResponderScrollNativeHandleToKeyboard:function(e,t,n){this.additionalScrollOffset=t||0,this.preventNegativeScrollOffset=!!n},scrollResponderInputMeasureAndScrollToKeyboard:function(e,t,n,i){if(this.keyboardWillOpenTo){var r=t-this.keyboardWillOpenTo.endCoordinates.screenY+i+this.additionalScrollOffset;this.preventNegativeScrollOffset&&(r=Math.max(0,r)),this.scrollResponderScrollTo(0,r)}this.additionalOffset=0,this.preventNegativeScrollOffset=!1},scrollResponderTextInputFocusError:function(e){console.error("Error measuring text field: ",e)},componentWillMount:function(){},scrollResponderKeyboardWillShow:function(e){this.keyboardWillOpenTo=e,this.props.onKeyboardWillShow&&this.props.onKeyboardWillShow(e)},scrollResponderKeyboardWillHide:function(e){this.keyboardWillOpenTo=null,this.props.onKeyboardWillHide&&this.props.onKeyboardWillHide(e)},scrollResponderKeyboardDidShow:function(e){e&&(this.keyboardWillOpenTo=e),this.props.onKeyboardDidShow&&this.props.onKeyboardDidShow(e)},scrollResponderKeyboardDidHide:function(){this.keyboardWillOpenTo=null,this.props.onKeyboardDidHide&&this.props.onKeyboardDidHide()}},d={Mixin:c};e.exports=d},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=i(r),a=n(2),s=i(a),l=n(4),u=i(l),c=n(3),d=i(c),f=n(1),p=i(f),h=n(9),m=i(h),y=n(119),v=i(y),g=n(10),b=i(g),M=n(5),T=i(M),x=n(73),C="ScrollView",_="InnerScrollView",w={contentContainerStyle:f.PropTypes.object,onScroll:f.PropTypes.func,scrollEventThrottle:f.PropTypes.number,removeClippedSubviews:f.PropTypes.bool,refreshControl:f.PropTypes.element},S={base:{position:"relative",overflow:"auto",WebkitOverflowScrolling:"touch",flex:1},zScroller:{position:"relative",overflow:"hidden",flex:1}},N=function(e){function t(){var n,i,r;(0,s["default"])(this,t);for(var o=arguments.length,a=Array(o),l=0;l<o;l++)a[l]=arguments[l];return n=i=(0,u["default"])(this,e.call.apply(e,[this].concat(a))),i.handleScroll=function(e){i.props.onScroll&&i.props.onScroll(e)},i.throttleScroll=function(){var e=function(){};return i.props.scrollEventThrottle&&i.props.onScroll&&(e=(0,x.throttle)(i.handleScroll,i.props.scrollEventThrottle)),e},r=n,(0,u["default"])(i,r)}return(0,d["default"])(t,e),t.prototype.componentDidUpdate=function(e,t){if(e.refreshControl&&this.props.refreshControl){var n=e.refreshControl.props.refreshing,i=this.props.refreshControl.props.refreshing;n&&!i&&this.refreshControlRefresh?this.refreshControlRefresh():this.manuallyRefresh||n||!i||this.domScroller.scroller.triggerPullToRefresh()}},t.prototype.componentDidMount=function(){var e=this,t=this.props,n=t.stickyHeader,i=t.useBodyScroll,r=t.useZscroller,o=t.scrollerOptions,a=t.refreshControl;
if(!n&&!i)return this.tsExec=this.throttleScroll(),r?(this.domScroller=new v["default"](m["default"].findDOMNode(this.refs[_]),(0,b["default"])({},{scrollingX:!1,onScroll:this.tsExec},o)),void(a&&!function(){var t=e.domScroller.scroller,n=a.props,i=n.distanceToRefresh,r=n.onRefresh;t.activatePullToRefresh(i,function(){e.manuallyRefresh=!0,e.refs.refreshControl.setState({active:!0})},function(){e.manuallyRefresh=!1,e.refs.refreshControl.setState({active:!1,loadingState:!1})},function(){e.refs.refreshControl.setState({loadingState:!0});var n=function(){t.finishPullToRefresh(),e.refreshControlRefresh=null};Promise.all([new Promise(function(t){r(),e.refreshControlRefresh=t}),new Promise(function(e){return setTimeout(e,1e3)})]).then(n,n)}),a.props.refreshing&&t.triggerPullToRefresh()}())):void m["default"].findDOMNode(this.refs[C]).addEventListener("scroll",this.tsExec)},t.prototype.componentWillUnmount=function(){var e=this.props,t=e.stickyHeader,n=e.useBodyScroll,i=e.useZscroller;if(!t&&!n)return i?void this.domScroller.destroy():void m["default"].findDOMNode(this.refs[C]).removeEventListener("scroll",this.tsExec)},t.prototype.render=function(){var e,t,n=this.props,i=n.children,r=n.className,a=n.prefixCls,s=void 0===a?"":a,l=n.listPrefixCls,u=void 0===l?"":l,c=n.listViewPrefixCls,d=void 0===c?"rmc-list-view":c,f=n.style,h=void 0===f?{}:f,m=n.contentContainerStyle,y=n.useZscroller,v=n.refreshControl,g=n.stickyHeader,M=n.useBodyScroll,x=S.base;g||M?x=null:y&&(x=S.zScroller);var w=s||d||"",N={ref:C,style:(0,b["default"])({},x,h),className:(0,T["default"])((e={},(0,o["default"])(e,r,!!r),(0,o["default"])(e,w+"-scrollview",!0),e))},E={ref:_,style:(0,b["default"])({},{position:"absolute",minWidth:"100%"},m),className:(0,T["default"])((t={},(0,o["default"])(t,w+"-scrollview-content",!0),(0,o["default"])(t,u,!!u),t))};return v?p["default"].createElement("div",N,p["default"].createElement("div",E,p["default"].cloneElement(v,{ref:"refreshControl"}),i)):g||M?p["default"].createElement("div",N,i):p["default"].createElement("div",N,p["default"].createElement("div",E,i))},t}(p["default"].Component);N.propTypes=w,t["default"]=N,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=i(r),a=n(4),s=i(a),l=n(3),u=i(l),c=n(1),d=i(c),f=function(e){function t(){return(0,o["default"])(this,t),(0,s["default"])(this,e.apply(this,arguments))}return(0,u["default"])(t,e),t.prototype.shouldComponentUpdate=function(e){return e.shouldUpdate},t.prototype.render=function(){return this.props.render()},t}(d["default"].Component);f.propTypes={shouldUpdate:c.PropTypes.bool.isRequired,render:c.PropTypes.func.isRequired},t["default"]=f,e.exports=t["default"]},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function r(){}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=i(o);t["default"]={getDefaultProps:function(){return{onVisibleChange:r,okText:"Ok",dismissText:"Dismiss",title:"",onOk:r,onDismiss:r}},getInitialState:function(){return{visible:this.props.visible||!1}},componentWillReceiveProps:function(e){"visible"in e&&this.setVisibleState(e.visible)},setVisibleState:function(e){this.setState({visible:e})},fireVisibleChange:function(e){this.state.visible!==e&&("visible"in this.props||this.setVisibleState(e),this.props.onVisibleChange(e))},getRender:function(){var e=this.props,t=e.children;if(!t)return this.getModal();var n=this.props,i=n.WrapComponent,r=n.disabled,o=t,s={};return r||(s[e.triggerType]=this.onTriggerClick),a.createElement(i,{style:e.wrapStyle},a.cloneElement(o,s),this.getModal())},onTriggerClick:function(e){var t=this.props.children,n=t.props||{};n[this.props.triggerType]&&n[this.props.triggerType](e),this.fireVisibleChange(!this.state.visible)},onOk:function(){this.props.onOk(),this.fireVisibleChange(!1)},onDismiss:function(){this.props.onDismiss(),this.fireVisibleChange(!1)},hide:function(){this.fireVisibleChange(!1)}},e.exports=t["default"]},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(117);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i(r)["default"]}}),e.exports=t["default"]},function(e,t){"use strict";function n(e){return!e||!e.length}function i(e,t,i){if(n(e)&&n(t))return!0;if(i)return e===t;if(e.length!==t.length)return!1;for(var r=e.length,o=0;o<r;o++)if(e[o].value!==t[o].value||e[o].label!==t[o].label)return!1;return!0}Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyArray=n,t["default"]=i},function(e,t){function n(e){return Object.prototype.toString.call(e)}function i(e){return e}function r(e){return"function"!=typeof e?e:function(){return e.apply(this,arguments)}}function o(e,t,n){t in e?e[t]=n:Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}function a(e,t,i){if(void 0!==e&&void 0!==t){var r=function(e){return e&&e.constructor&&e.constructor.name?e.constructor.name:n(e).slice(8,-1)};throw new TypeError("Cannot mixin key "+i+" because it is provided by multiple sources, and the types are "+r(e)+" and "+r(t))}return void 0===e?t:e}function s(e,t){var i=n(e);if("[object Object]"!==i){var r=e.constructor?e.constructor.name:"Unknown",o=t.constructor?t.constructor.name:"Unknown";throw new Error("cannot merge returned value of type "+r+" with an "+o)}}var l=e.exports=function(e,t){var n=t||{};return n.unknownFunction||(n.unknownFunction=l.ONCE),n.nonFunctionProperty||(n.nonFunctionProperty=a),function(t,i){Object.keys(i).forEach(function(a){var s=t[a],l=i[a],u=e[a];if(void 0!==s||void 0!==l){if(u){var c=u(s,l,a);return void o(t,a,r(c))}var d="function"==typeof s,f="function"==typeof l;return d&&void 0===l||f&&void 0===s||d&&f?void o(t,a,r(n.unknownFunction(s,l,a))):void(t[a]=n.nonFunctionProperty(s,l,a))}})}};l._mergeObjects=function(e,t){if(Array.isArray(e)&&Array.isArray(t))return e.concat(t);s(e,t),s(t,e);var n={};return Object.keys(e).forEach(function(i){if(Object.prototype.hasOwnProperty.call(t,i))throw new Error("cannot merge returns because both have the "+JSON.stringify(i)+" key");n[i]=e[i]}),Object.keys(t).forEach(function(e){n[e]=t[e]}),n},l.ONCE=function(e,t,n){if(e&&t)throw new TypeError("Cannot mixin "+n+" because it has a unique constraint.");return e||t},l.MANY=function(e,t,n){return function(){return t&&t.apply(this,arguments),e?e.apply(this,arguments):void 0}},l.MANY_MERGED_LOOSE=function(e,t,n){return e&&t?l._mergeObjects(e,t):e||t},l.MANY_MERGED=function(e,t,n){return function(){var n=t&&t.apply(this,arguments),i=e&&e.apply(this,arguments);return n&&i?l._mergeObjects(n,i):i||n}},l.REDUCE_LEFT=function(e,t,n){var r=e||i,o=t||i;return function(){return o.call(this,r.apply(this,arguments))}},l.REDUCE_RIGHT=function(e,t,n){var r=e||i,o=t||i;return function(){return r.call(this,o.apply(this,arguments))}}},function(e,t){e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4wLjIsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgd2lkdGg9IjQ0cHgiIGhlaWdodD0iNDRweCIgdmlld0JveD0iMCAwIDQ0IDQ0IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0NCA0NCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8Zz4NCgk8cGF0aCBkPSJNMjIuMDI2LDFjLTExLjU5OCwwLTIxLDkuNDAyLTIxLDIxczkuNDAyLDIxLDIxLDIxYzExLjU5OCwwLDIxLTkuNDAyLDIxLTIxUzMzLjYyNCwxLDIyLjAyNiwxeiBNMjIuMDI2LDM5Ljg2NQ0KCQlDMTIuMTYsMzkuODY1LDQuMTYxLDMxLjg2Niw0LjE2MSwyMlMxMi4xNiw0LjEzNSwyMi4wMjYsNC4xMzVjOS44NjYsMCwxNy44NjUsNy45OTgsMTcuODY1LDE3Ljg2NVMzMS44OTIsMzkuODY1LDIyLjAyNiwzOS44NjV6Ig0KCQkvPg0KCTxwb2x5Z29uIHBvaW50cz0iMTguNjI1LDI3LjE4OCAxMiwyMC41IDkuODc1LDIyLjY4OCAxOC44NzUsMzEuNTYyIDM0LjI1LDEzLjQzOCAzMiwxMS41NjIgCSIvPg0KPC9nPg0KPC9zdmc+DQo="},function(e,t){e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4wLjIsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8yIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgd2lkdGg9IjQ0cHgiIGhlaWdodD0iNDRweCIgdmlld0JveD0iMCAwIDQ0IDQ0IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0NCA0NCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTIxLjkyNiwxLjk1OGMtMTEuMDQ2LDAtMjAsOC45NTQtMjAsMjBjMCwxMS4wNDYsOC45NTQsMjAsMjAsMjANCgljMTEuMDQ2LDAsMjAtOC45NTQsMjAtMjBDNDEuOTI2LDEwLjkxMywzMi45NzIsMS45NTgsMjEuOTI2LDEuOTU4eiBNMzQuMzk2LDE1LjE4OUwyMC4xNTcsMjkuNDI4DQoJYy0wLjU5NCwwLjU5NC0xLjU1OCwwLjU5My0yLjE1My0wLjAwMmMtMC4wNzktMC4wNzktMC4xMTktMC4xNzYtMC4xNzctMC4yNjVjLTAuMDg4LTAuMDU5LTAuMTcyLTAuMTI2LTAuMjUtMC4yMDRsLTcuNDc1LTcuNDc1DQoJYy0wLjY0OS0wLjY0OS0wLjY1NS0xLjY5Ni0wLjAwMi0yLjM0OWMwLjY0OC0wLjY0OCwxLjcwMi0wLjY0NSwyLjM0OSwwLjAwMmw2Ljg0Niw2Ljg0NmwxMi45NDYtMTIuOTQ2DQoJYzAuNTk0LTAuNTk0LDEuNTU4LTAuNTkzLDIuMTUzLDAuMDAyQzM0Ljk5MywxMy42MzUsMzQuOTksMTQuNTk1LDM0LjM5NiwxNS4xODl6Ii8+DQo8L3N2Zz4NCg=="},function(e,t){e.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDQiIGhlaWdodD0iNDQiIHZpZXdCb3g9IjAgMCA0NCA0NCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+T3BlcmF0aW9uIEljb25zIENvcHkgNjwvdGl0bGU+PHBhdGggZD0iTTM0LjUzOCA4TDM4IDExLjUxOCAxNy44MDggMzIgOCAyMi4wMzNsMy40NjItMy41MTggNi4zNDYgNi40NXoiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg=="},function(e,t){e.exports="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTE5NSAxMTk1IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik02NDMuMzMzIDY0MGwxOTUtMTkxcTktMTAgOS41LTIzdC04LjUtMjNxLTEwLTktMjMtOXQtMjMgOWwtMTk2IDE5Mi0xOTYtMTkycS0xMC05LTIzLTl0LTIzIDEwcS05IDktOSAyMi41dDEwIDIyLjVsMTk1IDE5MS0xOTUgMTkxcS05IDEwLTkuNSAyM3Q4LjUgMjNxMTAgOSAyMyA5dDIzLTlsMTk2LTE5MiAxOTYgMTkycTEwIDkgMjMgOXQyMy0xMHE5LTkgOS0yMi41dC0xMC0yMi41em0tNDYtNDQ4cTkxIDAgMTc0IDM1IDgxIDM0IDE0MyA5NnQ5NiAxNDNxMzUgODMgMzUgMTc0dC0zNSAxNzRxLTM0IDgxLTk2IDE0M3QtMTQzIDk2cS04MyAzNS0xNzQgMzV0LTE3NC0zNXEtODEtMzQtMTQzLTk2dC05Ni0xNDNxLTM1LTgzLTM1LTE3NHQzNS0xNzRxMzQtODEgOTYtMTQzdDE0My05NnE4My0zNSAxNzQtMzV6bTAtNjRxLTEzOSAwLTI1NyA2OC41VDE1My44MzMgMzgzdC02OC41IDI1NyA2OC41IDI1NyAxODYuNSAxODYuNSAyNTcgNjguNSAyNTctNjguNSAxODYuNS0xODYuNSA2OC41LTI1Ny02OC41LTI1Ny0xODYuNS0xODYuNS0yNTctNjguNXoiLz48L3N2Zz4="},function(e,t){e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4wLjIsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8yIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgd2lkdGg9IjQ0cHgiIGhlaWdodD0iNDRweCIgdmlld0JveD0iMCAwIDQ0IDQ0IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0NCA0NCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTIyLDQyYzExLjA0NiwwLDIwLTguOTU0LDIwLTIwUzMzLjA0NiwyLDIyLDJTMiwxMC45NTQsMiwyMlMxMC45NTQsNDIsMjIsNDJ6DQoJIE0yMi4wNzQsMTkuNjk4bC01LjkxNy01LjkxN2MtMC42NTItMC42NTItMS43MDQtMC42NTMtMi4zNTItMC4wMDVjLTAuNjUzLDAuNjUzLTAuNjQ2LDEuNzAxLDAuMDA1LDIuMzUybDUuOTE3LDUuOTE3bC02LjA2NCw2LjA2NA0KCWMtMC41OTQsMC41OTQtMC41OTcsMS41NTQsMC4wMDIsMi4xNTNjMC41OTUsMC41OTUsMS41NTksMC41OTYsMi4xNTMsMC4wMDJsNi4wNjQtNi4wNjRsNS45NjEsNS45NjENCgljMC42NTIsMC42NTIsMS43MDQsMC42NTMsMi4zNTIsMC4wMDVjMC42NTMtMC42NTMsMC42NDYtMS43MDEtMC4wMDUtMi4zNTJsLTUuOTYxLTUuOTYxbDUuODI4LTUuODI4DQoJYzAuNTk0LTAuNTk0LDAuNTk3LTEuNTU0LTAuMDAyLTIuMTUzYy0wLjU5NS0wLjU5NS0xLjU1OS0wLjU5Ni0yLjE1My0wLjAwMkwyMi4wNzQsMTkuNjk4eiIvPg0KPC9zdmc+DQo="},function(e,t){e.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDQiIGhlaWdodD0iNDQiIHZpZXdCb3g9IjAgMCA0NCA0NCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+T3BlcmF0aW9uIEljb25zIENvcHkgMThAM3g8L3RpdGxlPjxnIGZpbGwtcnVsZT0iZXZlbm9kZCI+PHBhdGggZD0iTTI5Ljg3IDEwLjc3OGwzLjUzNiAzLjUzNi0xOS4wOTIgMTkuMDkyLTMuNTM2LTMuNTM2eiIvPjxwYXRoIGQ9Ik0zMy40MDYgMjkuODdsLTMuNTM2IDMuNTM2LTE5LjA5Mi0xOS4wOTIgMy41MzYtMy41MzZ6Ii8+PC9nPjwvc3ZnPg=="},function(e,t){e.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDQiIGhlaWdodD0iNDQiIHZpZXdCb3g9IjAgMCA0NCA0NCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+T3BlcmF0aW9uIEljb25zIENvcHkgNDwvdGl0bGU+PHBhdGggZD0iTTIyLjM1NSAyOC4yMzdsLTExLjQ4My0xMC45Yy0uNjA3LS41NzYtMS43MTQtLjM5Ni0yLjQ4LjQxbC42NzQtLjcxYy0uNzYzLjgwMi0uNzMgMi4wNzEtLjI4MiAyLjQ5NmwxMS4zNyAxMC43OTMtLjA0LjAzOSAyLjA4OCAyLjE5NiAxLjA5OC0xLjA0MyAxMi4zMDgtMTEuNjgyYy40NDctLjQyNS40OC0xLjY5NC0uMjgyLTIuNDk2bC42NzQuNzFjLS43NjYtLjgwNi0xLjg3My0uOTg2LTIuNDgtLjQxTDIyLjM1NSAyOC4yMzd6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4="},function(e,t){e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4wLjIsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl80IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgd2lkdGg9IjQ0cHgiIGhlaWdodD0iNDRweCIgdmlld0JveD0iMCAwIDQ0IDQ0IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0NCA0NCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8Zz4NCgk8cGF0aCBkPSJNMjIuMTMsMC4xMDljLTEyLjA4MSwwLTIxLjg3NSw5Ljc5NC0yMS44NzUsMjEuODc1czkuNzk0LDIxLjg3NSwyMS44NzUsMjEuODc1czIxLjg3NS05Ljc5NCwyMS44NzUtMjEuODc1DQoJCVMzNC4yMTEsMC4xMDksMjIuMTMsMC4xMDl6IE0yMi4xMywzOS4zMDljLTkuNTY4LDAtMTcuMzI1LTcuNzU3LTE3LjMyNS0xNy4zMjVjMC05LjU2OCw3Ljc1Ny0xNy4zMjUsMTcuMzI1LTE3LjMyNQ0KCQlzMTcuMzI1LDcuNzU3LDE3LjMyNSwxNy4zMjVDMzkuNDU1LDMxLjU1MiwzMS42OTgsMzkuMzA5LDIyLjEzLDM5LjMwOXoiLz4NCgk8Y2lyY2xlIGN4PSIyMS44ODgiIGN5PSIyMS43MDEiIHI9IjIuNDQ1Ii8+DQoJPGNpcmNsZSBjeD0iMTIuMjMiIGN5PSIyMS43MDEiIHI9IjIuNDQ1Ii8+DQoJPGNpcmNsZSBjeD0iMzEuNTQ2IiBjeT0iMjEuNzAxIiByPSIyLjQ0NSIvPg0KPC9nPg0KPC9zdmc+DQo="},function(e,t){e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4wLjIsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl80IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgd2lkdGg9IjQ0cHgiIGhlaWdodD0iNDRweCIgdmlld0JveD0iMCAwIDQ0IDQ0IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0NCA0NCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8Zz4NCgk8Y2lyY2xlIGN4PSIyMS44ODgiIGN5PSIyMiIgcj0iNC4wNDUiLz4NCgk8Y2lyY2xlIGN4PSI1LjkxMyIgY3k9IjIyIiByPSI0LjA0NSIvPg0KCTxjaXJjbGUgY3g9IjM3Ljg2MyIgY3k9IjIyIiByPSI0LjA0NSIvPg0KPC9nPg0KPC9zdmc+DQo="},function(e,t){e.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQiIGhlaWdodD0iNjQiIHZpZXdCb3g9IjAgMCA2NCA2NCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+U2hhcmUgSWNvbnMgQ29weSAzPC90aXRsZT48cGF0aCBkPSJNNTkuNTggNDAuODg5TDQxLjE5MyA5LjExQzM5LjEzNSA1LjM4MiAzNS43MjMgMyAzMS4zODcgM2MtMy4xMSAwLTYuNTIxIDIuMzgyLTguNTggNi4xMTFMNC40MiA0MC44OUMxLjYzMiA0NS41MjUgMS4yOTQgNDkuNyAzLjE5NSA1My4xMSA1LjAxNSA1Ni4yMDggNy41NzIgNTggMTMgNThoMzYuNzczYzUuNDI4IDAgOS4yMS0xLjc5MiAxMS4wMzEtNC44ODkgMS45LTMuNDEgMS41NjQtNy41ODQtMS4yMjUtMTIuMjIyem0tMi40NTIgMTFjLS42MzUgMS42OTUtMy44MDIgMi40NDQtNy4zNTQgMi40NDRIMTNjLTMuNTkxIDAtNS40OTMtLjc1LTYuMTI5LTIuNDQ0LTEuNzEyLTIuNDEtMS4zNzUtNS4yNjIgMC04LjU1NmwxOC4zODYtMzEuNzc3YzIuMTE2LTMuMTY4IDQuMzk0LTQuODkgNi4xMy00Ljg5IDIuOTYgMCA1LjIzOCAxLjcyMiA3LjM1NCA0Ljg5bDE4LjM4NiAzMS43NzdjMS4zNzQgMy4yOTQgMS43MTMgNi4xNDYgMCA4LjU1NnptLTI1Ljc0LTMzYy0uNDA1IDAtMS4yMjcuODM2LTEuMjI3IDIuNDQ0djE1Ljg5YzAgMS42MDguODIyIDIuNDQ0IDEuMjI2IDIuNDQ0IDEuNjI4IDAgMi40NTItLjgzNiAyLjQ1Mi0yLjQ0NVYyMS4zMzNjMC0xLjYwOC0uODI0LTIuNDQ0LTIuNDUyLTIuNDQ0em0wIDIzLjIyMmMtLjQwNSAwLTEuMjI3Ljc4OC0xLjIyNyAxLjIyMnYyLjQ0NWMwIC40MzQuODIyIDEuMjIyIDEuMjI2IDEuMjIyIDEuNjI4IDAgMi40NTItLjc4OCAyLjQ1Mi0xLjIyMnYtMi40NDVjMC0uNDM0LS44MjQtMS4yMjItMi40NTItMS4yMjJ6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4="},function(e,t){e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4wLjIsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgd2lkdGg9IjQ0cHgiIGhlaWdodD0iNDRweCIgdmlld0JveD0iMCAwIDQ0IDQ0IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0NCA0NCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8Zz4NCgk8Y2lyY2xlIGN4PSIxMy44MjgiIGN5PSIxOS42MyIgcj0iMS45MzgiLz4NCgk8Y2lyY2xlIGN4PSIyMS43NjciIGN5PSIxOS42MyIgcj0iMS45MzgiLz4NCgk8Y2lyY2xlIGN4PSIyOS43NjciIGN5PSIxOS42MyIgcj0iMS45MzgiLz4NCgk8cGF0aCBkPSJNMjIuMTAyLDQuMTYxYy05LjkxOCwwLTE3Ljk1OCw3LjE0Ni0xNy45NTgsMTUuOTYxYzAsNC45MzUsMi41MjIsOS4zNDUsNi40ODEsMTIuMjczdjUuNjY3bDAuMDM4LDAuMDEyDQoJCWMwLjE4MiwxLjI4LDEuMjcyLDIuMjY3LDIuNjAyLDIuMjY3YzAuNzQ3LDAsMS40MTktMC4zMTMsMS44OTktMC44MTJsMC4wMDIsMC4wMDFsNS4wMjYtMy41MzkNCgkJYzAuNjI4LDAuMDU5LDEuMjY1LDAuMDkzLDEuOTExLDAuMDkzYzkuOTE4LDAsMTcuOTU4LTcuMTQ2LDE3Ljk1OC0xNS45NjFDNDAuMDYsMTEuMzA3LDMyLjAyLDQuMTYxLDIyLjEwMiw0LjE2MXogTTIyLjA2MiwzNC4wNjINCgkJYy0wLjkwMiwwLTEuNzgxLTAuMDgxLTIuNjQyLTAuMjA3bC01Ljg4Miw0LjIzNGMtMC4wMjQsMC4wMjUtMC4wNTUsMC4wNC0wLjA4MywwLjA2bC0wLjAwOCwwLjAwNmwwLDANCgkJYy0wLjA4MywwLjA1NS0wLjE3NywwLjA5NS0wLjI4NCwwLjA5NWMtMC4yOSwwLTAuNTI1LTAuMjM1LTAuNTI1LTAuNTI1bDAuMDA1LTYuMzc1Yy0zLjkxLTIuNTE2LTYuNDU2LTYuNTQ0LTYuNDU2LTExLjENCgkJYzAtNy42MjgsNy4xMDctMTMuODEyLDE1Ljg3NS0xMy44MTJzMTUuODc1LDYuMTg0LDE1Ljg3NSwxMy44MTJTMzAuODMsMzQuMDYyLDIyLjA2MiwzNC4wNjJ6Ii8+DQo8L2c+DQo8L3N2Zz4NCg=="},function(e,t){e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4wLjIsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8yIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgd2lkdGg9IjQzcHgiIGhlaWdodD0iMzhweCIgdmlld0JveD0iMCAwIDQzIDM4IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0MyAzOCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8Zz4NCgk8cGF0aCBkPSJNMzcuNzUsMC4yMjdINS4yNWMtMy4xMjUsMC00LjU5LDIuNDI1LTQuNTksNC4zMTV2OC4wM2MwLDkuMzQ2LDUuNzUxLDE3LjIxMywxMy42NCwyMC4zNQ0KCQljMC4xMjksMC4wNDksMC4yNDIsMC4xMzUsMC4zMjUsMC4yNDZjMC4xNDUsMC4yMDcsMC4xMjgsMC40MDksMC4xMjgsMC40MDlsMC4wMDEsMi4wMzNjMCwwLDAuMjQxLDAuNzQzLDAuNjY3LDEuMTY3DQoJCWMwLjI1NCwwLjI1NCwwLjg5OSwwLjU0NSwxLjIwMSwwLjU3N2MwLjkyOSwwLjA5OSwyLjA1OSwwLjIyNiw0LjcxNi0wLjEyNWM0Ljg1LTAuNjQ5LDkuNDA2LTIuNzA2LDEzLjExMS01LjkxOA0KCQljNi4xNTctNS4zNDUsOC41NDktMTIuNTQ5LDguNTQ5LTE4LjczOFY0LjYyNUM0Mi45OTgsMi43MzUsNDEuNzkyLDAuMjI3LDM3Ljc1LDAuMjI3eiBNNDEuMDM3LDEzLjI3Mg0KCQljMCw1LjU4LTIuMjc3LDExLjc4NC03Ljg3LDE2LjYwM2MtMy4zNjYsMi44OTYtNy41MTEsNC44MzEtMTEuOTE3LDUuNDE3Yy0yLjQxMywwLjMxNy0zLjM0NywwLjE4Ni00LjE5MSwwLjA5Ng0KCQljLTAuMjc1LTAuMDI5LTAuNDk2LTAuMDc2LTAuMzkyLTEuMDEzYzAuMTA0LTEuOTU4LTAuMTk0LTIuMTU2LTAuMzI1LTIuMzQyYy0wLjA3Ni0wLjEtMC4yNjEtMC4yODctMC4zNzgtMC4zMzINCgkJQzguNzk3LDI4Ljg3NCwyLjU3NywyMS42OTgsMi41NzcsMTMuMjcyVjUuMjAzYzAtMS43MDMsMC4zMzUtMy4wNiwzLjE3My0zLjA2aDMxLjI5MmMzLjY3MSwwLDMuOTk1LDEuMTc0LDMuOTk1LDIuODc4VjEzLjI3MnoiLz4NCgk8cGF0aCBkPSJNMzIuNTMxLDE5LjQ0NGMtMC4zMzYsMC0wLjYyLDAuMTcxLTAuODA5LDAuNDJsLTAuMDEtMC4wMDdsLTAuMDAyLTAuMDAxDQoJCWMtMi4wODMsMy4xMzEtNS42NCw1LjE5Ni05LjY4Miw1LjE5NmMtNi40MTksMC0xMS42MjMtNS4yMDQtMTEuNjIzLTExLjYyM2gtMC4wMzhjLTAuMDItMC41NTItMC40NjctMC45OTUtMS4wMjMtMC45OTUNCgkJYy0wLjU1NiwwLTEuMDAzLDAuNDQzLTEuMDIzLDAuOTk1SDguMzE0YzAsMC4wMSwwLjAwMSwwLjAxOSwwLjAwMSwwLjAyOWMwLDAuMDAzLTAuMDAxLDAuMDA1LTAuMDAxLDAuMDA3DQoJCWMwLDAuMDA0LDAuMDAyLDAuMDA4LDAuMDAyLDAuMDEyYzAuMDI2LDcuNTUyLDYuMTU0LDEzLjY2NywxMy43MTMsMTMuNjY3YzQuNzU3LDAsOC45NDUtMi40MjMsMTEuNDA2LTYuMTAxDQoJCWMwLDAsMC4xMjctMC4zNjgsMC4xMjctMC41N0MzMy41NjEsMTkuOTA1LDMzLjEsMTkuNDQ0LDMyLjUzMSwxOS40NDR6Ii8+DQoJPGVsbGlwc2UgY3g9IjM1LjQ1NiIgY3k9IjEyLjUwNiIgcng9IjEuOTUiIHJ5PSIxLjkxOCIvPg0KPC9nPg0KPC9zdmc+DQo="},function(e,t){e.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDMiIGhlaWdodD0iMzgiIHZpZXdCb3g9IjAgMCA0MyAzOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+5Y+j56KRPC90aXRsZT48ZyBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik00LjkyMSAxLjIyN2MtMS44MTQgMC0zLjI4NCAxLjQ1Mi0zLjI4NCAzLjI0M3Y4LjQ1OWMwIDguODYgNi4wNzMgMTYuNTE3IDEzLjU4OSAxOS40OWEuNzAxLjcwMSAwIDAgMSAuMzEuMjMzYy4xMzguMTk2LjEyMi4zODguMTIyLjM4OHYyLjE0OHMtLjAxMi40NjMuMzkzLjg2NWMuMjQyLjI0MS41MDYuMzM4Ljc5NC4zNjguODg1LjA5NCAxLjk2Mi4yMTQgNC40OTMtLjExOWEyMy45NzIgMjMuOTcyIDAgMCAwIDEyLjQ5Mi01LjYxYzUuODY2LTUuMDY3IDguMTQ1LTExLjg5NiA4LjE0NS0xNy43NjNWNC41NjNjMC0xLjc5Mi0xLjQ3LTMuMzM2LTMuMjg1LTMuMzM2SDQuOTJ6IiAvPjxwYXRoIGQ9Ik0zMy41MDYgMTIuNTA2YzAtMS4wNi44NzMtMS45MTggMS45NS0xLjkxOCAxLjA3OCAwIDEuOTUuODU4IDEuOTUgMS45MTggMCAxLjA1OS0uODcyIDEuOTE4LTEuOTUgMS45MTgtMS4wNzcgMC0xLjk1LS44Ni0xLjk1LTEuOTE4eiIgZmlsbD0iI0ZGRiIvPjxwYXRoIGQ9Ik05LjEyNyAxMy40NjVjMCA2LjA4NyA1LjU2NCAxMi44NDcgMTIuNjI2IDEyLjc4NCAzLjMzNi0uMDMgOC4wMDYtMS41MjIgMTAuNzc4LTUuNzg0IiBzdHJva2U9IiNGRkYiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PC9nPjwvc3ZnPg=="},function(e,t){e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4wLjIsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgd2lkdGg9IjQ0cHgiIGhlaWdodD0iNDRweCIgdmlld0JveD0iMCAwIDQ0IDQ0IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0NCA0NCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8dGl0bGU+T3BlcmF0aW9uIEljb25zIENvcHkgNDwvdGl0bGU+DQo8Zz4NCgk8ZGVmcz4NCgkJPHJlY3QgaWQ9IlNWR0lEXzFfIiB4PSItMTI5IiB5PSItODQ1IiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiLz4NCgk8L2RlZnM+DQoJPGNsaXBQYXRoIGlkPSJTVkdJRF8yXyI+DQoJCTx1c2UgeGxpbms6aHJlZj0iI1NWR0lEXzFfIiAgb3ZlcmZsb3c9InZpc2libGUiLz4NCgk8L2NsaXBQYXRoPg0KCTxnIGNsaXAtcGF0aD0idXJsKCNTVkdJRF8yXykiPg0KCQk8ZGVmcz4NCgkJCTxyZWN0IGlkPSJTVkdJRF8zXyIgeD0iLTkwMyIgeT0iLTk0OSIgd2lkdGg9IjE4NTAiIGhlaWdodD0iMTk0NSIvPg0KCQk8L2RlZnM+DQoJCTxjbGlwUGF0aCBpZD0iU1ZHSURfNF8iPg0KCQkJPHVzZSB4bGluazpocmVmPSIjU1ZHSURfM18iICBvdmVyZmxvdz0idmlzaWJsZSIvPg0KCQk8L2NsaXBQYXRoPg0KCQk8cmVjdCB4PSItMTM0IiB5PSItODUwIiBvcGFjaXR5PSIwIiBjbGlwLXBhdGg9InVybCgjU1ZHSURfNF8pIiBmaWxsPSIjRDhEOEQ4IiB3aWR0aD0iMzQiIGhlaWdodD0iMzQiLz4NCgk8L2c+DQo8L2c+DQo8cG9seWdvbiBwb2ludHM9IjE2LjI0NywyMS4zOTkgMjguNDgsOS4xNjYgMzAuNjAxLDExLjI4NyAyMC40ODMsMjEuNDA2IDMwLjYwMSwzMS41MjQgMjguNDgsMzMuNjQ1IDE2LjI0NywyMS40MTIgMTYuMjU0LDIxLjQwNiANCgkiLz4NCjwvc3ZnPg0K"},function(e,t){e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4wLjIsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgd2lkdGg9IjQ0cHgiIGhlaWdodD0iNDRweCIgdmlld0JveD0iMCAwIDQ0IDQ0IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0NCA0NCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8cGF0aCBkPSJNMjIsMkMxMC45NTQsMiwyLDEwLjk1NCwyLDIyczguOTU0LDIwLDIwLDIwczIwLTguOTU0LDIwLTIwUzMzLjA0NiwyLDIyLDJ6IE0yOSwzMi4zMjNsLTE0Ljk2NCwwLjA4Ng0KCWMtMi4yMTgsMC4wMTItMi43OC0xLjI4NS0xLjI3NS0yLjg5OGMwLDAsMy45MzQtNC4yNDksNi4zNC02LjY1NWMwLjI2OC0wLjI2OCwwLjM5Mi0wLjc0MywwLjQ1LTEuMTExDQoJYy0wLjA1OC0wLjM2OC0wLjE4Mi0wLjg0Mi0wLjQ1LTEuMTExYy0yLjQwNi0yLjQwNS02LjM0LTYuNjU1LTYuMzQtNi42NTVjLTEuNTA1LTEuNjEzLTAuOTQzLTIuOTEsMS4yNzUtMi44OTdMMjksMTEuMTY4DQoJYzIuMjA5LDAuMDEzLDIuNzg0LDEuMzI0LDEuMjY0LDIuOTQ0YzAsMC0zLjg5OCw0LjE5My02LjI4Niw2LjU4MWMtMC4xNywwLjE3LTAuMjU4LDAuNjYtMC4zMDIsMS4wNTINCgljMC4wNDQsMC4zOTMsMC4xMzIsMC44ODMsMC4zMDIsMS4wNTNjMi4zODgsMi4zODgsNi4yODYsNi41ODEsNi4yODYsNi41ODFDMzEuNzg0LDMwLjk5OCwzMS4yMSwzMi4zMSwyOSwzMi4zMjN6Ii8+DQo8L3N2Zz4NCg=="},function(e,t){e.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDQiIGhlaWdodD0iNDQiIHZpZXdCb3g9IjAgMCA0NCA0NCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+UG9wIGRvd24gbWVudSBJY29ucyBDb3B5IDg8L3RpdGxlPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIgMikiICBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxjaXJjbGUgY3g9IjIwIiBjeT0iMjAiIHI9IjIwIi8+PHBhdGggZD0iTTIxLjY3NiAxOS43NDVjLjA0NC0uMzkyLjEzMi0uODgyLjMwMi0xLjA1MiAyLjM4OC0yLjM4OCA2LjI4Ni02LjU4MSA2LjI4Ni02LjU4MSAxLjUyLTEuNjIuOTQ1LTIuOTMxLTEuMjY0LTIuOTQ0bC0xNC45NjQtLjA4NmMtMi4yMTgtLjAxMy0yLjc4IDEuMjg0LTEuMjc1IDIuODk3IDAgMCAzLjkzNCA0LjI1IDYuMzQgNi42NTUuMjY4LjI2OS4zOTIuNzQzLjQ1IDEuMTExLS4wNTguMzY4LS4xODIuODQzLS40NSAxLjExMS0yLjQwNiAyLjQwNi02LjM0IDYuNjU1LTYuMzQgNi42NTUtMS41MDUgMS42MTMtLjk0MyAyLjkxIDEuMjc1IDIuODk4TDI3IDMwLjMyM2MyLjIxLS4wMTMgMi43ODQtMS4zMjUgMS4yNjQtMi45NDQgMCAwLTMuODk4LTQuMTkzLTYuMjg2LTYuNTgxLS4xNy0uMTctLjI1OC0uNjYtLjMwMi0xLjA1M3oiIGZpbGw9IiNGRkYiLz48cGF0aCBkPSJNMjEuNTQ4IDIzLjUxOEwyMC4xMyAyMi4xbC42NzIuNjcyYy0uMzkyLS4zOTItMS4xNTctLjcyNi0xLjcxMi0uNzQ2bC41MzkuMDJjLS41NTQtLjAyLTEuMzIuMjgtMS43MDguNjY3bC42LS41OThjLS4zODkuMzg4LTEuMDIgMS4wMjItMS40MDIgMS40MTZsLTQuMTgzIDQuNDM2Yy0uMzc2LjQwNC0uMjMyLjczLjMxMi43M2wxMi40NTQtLjAzYy41NDgtLjAwMi42NzItLjMyMy4yODgtLjcwN2wtNC40NDMtNC40NDN6IiAvPjwvZz48L3N2Zz4="},function(e,t){e.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDQiIGhlaWdodD0iNDQiIHZpZXdCb3g9IjAgMCA0NCA0NCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+T3BlcmF0aW9uIEljb25zIENvcHkgMTI8L3RpdGxlPjxnIGZpbGwtcnVsZT0iZXZlbm9kZCI+PHBhdGggZD0iTTIxLjE4NiAzQzEwLjMzMyAzIDEuODI3IDExLjUwNiAxLjgyNyAyMi4zNTggMS44MjcgMzIuNDk0IDEwLjMzMyA0MSAyMS4xODYgNDFjMTAuMTMzIDAgMTguNjQxLTguNTA2IDE4LjY0MS0xOC42NDJDMzkuODI3IDExLjUwNiAzMS4zMiAzIDIxLjE4NiAzbTE1LjY0MSAxOWMwIDguODIzLTcuMTc5IDE2LTE2IDE2LTguODIzIDAtMTYtNy4xNzctMTYtMTZzNy4xNzctMTYgMTYtMTZjOC44MjEgMCAxNiA3LjE3NyAxNiAxNnoiLz48cGF0aCBkPSJNMjIuODI3IDMxLjVhMS41IDEuNSAwIDEgMS0yLjk5OS4wMDEgMS41IDEuNSAwIDAgMSAzLS4wMDEiLz48cGF0aCBkPSJNMjYuODI3IDE2LjAyYzAgLjk1Ny0uMjAzIDEuODIyLS42MSAyLjU5My0uNDI3Ljc5Mi0xLjExNyAxLjYxMi0yLjA3MyAyLjQ1Ny0uODY3LjczNC0xLjQ1MyAxLjQzNS0xLjc1NCAyLjA5Ni0uMzAyLjctLjQ1MyAxLjY5My0uNDUzIDIuOTc5YS44MjguODI4IDAgMCAxLS44MjMuODU1LjgyOC44MjggMCAwIDEtLjU4NC0uMjIuODc3Ljg3NyAwIDAgMS0uMjQtLjYzNWMwLTEuMzA1LjE2OC0yLjM4LjUwNi0zLjIyNy4zMzYtLjg4My45My0xLjY4MiAxLjc3OS0yLjQgMS4wMS0uODgzIDEuNzEtMS42OTIgMi4xLTIuNDI4LjMzNy0uNjQ1LjUwNC0xLjM4LjUwNC0yLjIwOS0uMDE4LS45MzYtLjMtMS43LS44NS0yLjI4OS0uNjU0LS43MTctMS42Mi0xLjA3NS0yLjg5Ni0xLjA3NS0xLjUwNiAwLTIuNTk2LjUzNS0zLjI2OSAxLjYtLjQ2Ljc1NC0uNjg5IDEuNjQ1LS42ODkgMi42NzcgMCAuMjU3LS4wOS40NzctLjI2Ni42NmEuNzQ3Ljc0NyAwIDAgMS0uNTU4LjI1LjczLjczIDAgMCAxLS41ODUtLjE5NGMtLjE2LS4xNjQtLjIzOS0uMzkzLS4yMzktLjY5IDAtMS44MTkuNTg0LTMuMjcyIDEuNzU0LTQuMzU3QzE4LjY0NCAxMS40ODYgMTkuOTI3IDExIDIxLjQzMyAxMWguMjkzYzEuNDUyIDAgMi42MzguNDE0IDMuNTYxIDEuMjQxIDEuMDI3LjkwMiAxLjU0IDIuMTYyIDEuNTQgMy43OHoiIC8+PC9nPjwvc3ZnPg=="},function(e,t){e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4wLjIsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgd2lkdGg9IjQ0cHgiIGhlaWdodD0iNDRweCIgdmlld0JveD0iMCAwIDQ0IDQ0IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0NCA0NCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8dGl0bGU+T3BlcmF0aW9uIEljb25zIENvcHkgNDwvdGl0bGU+DQo8Zz4NCgk8ZGVmcz4NCgkJPHJlY3QgaWQ9IlNWR0lEXzFfIiB4PSItMTI5IiB5PSItODQ1IiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiLz4NCgk8L2RlZnM+DQoJPGNsaXBQYXRoIGlkPSJTVkdJRF8yXyI+DQoJCTx1c2UgeGxpbms6aHJlZj0iI1NWR0lEXzFfIiAgb3ZlcmZsb3c9InZpc2libGUiLz4NCgk8L2NsaXBQYXRoPg0KCTxnIGNsaXAtcGF0aD0idXJsKCNTVkdJRF8yXykiPg0KCQk8ZGVmcz4NCgkJCTxyZWN0IGlkPSJTVkdJRF8zXyIgeD0iLTkwMyIgeT0iLTk0OSIgd2lkdGg9IjE4NTAiIGhlaWdodD0iMTk0NSIvPg0KCQk8L2RlZnM+DQoJCTxjbGlwUGF0aCBpZD0iU1ZHSURfNF8iPg0KCQkJPHVzZSB4bGluazpocmVmPSIjU1ZHSURfM18iICBvdmVyZmxvdz0idmlzaWJsZSIvPg0KCQk8L2NsaXBQYXRoPg0KCQk8cmVjdCB4PSItMTM0IiB5PSItODUwIiBvcGFjaXR5PSIwIiBjbGlwLXBhdGg9InVybCgjU1ZHSURfNF8pIiBmaWxsPSIjRDhEOEQ4IiB3aWR0aD0iMzQiIGhlaWdodD0iMzQiLz4NCgk8L2c+DQo8L2c+DQo8cG9seWdvbiBwb2ludHM9IjMwLjYwMSwyMS4zOTkgMTguMzY4LDkuMTY2IDE2LjI0NywxMS4yODcgMjYuMzY1LDIxLjQwNiAxNi4yNDcsMzEuNTI0IDE4LjM2OCwzMy42NDUgMzAuNjAxLDIxLjQxMiAzMC41OTUsMjEuNDA2IA0KCSIvPg0KPC9zdmc+DQo="},function(e,t){e.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDQiIGhlaWdodD0iNDQiIHZpZXdCb3g9IjAgMCA0NCA0NCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+U3lzdGVtIEljb25zIENvcHkgODwvdGl0bGU+PHBhdGggZD0iTTMyLjk4MSAyOS4yNTVsOC45MTQgOC4yOTNMMzkuNjAzIDQwbC04Ljg1OS04LjI0MmExNS45NTIgMTUuOTUyIDAgMCAxLTEwLjc1NCA0LjE0N0MxMS4xNiAzNS45MDUgNCAyOC43NjMgNCAxOS45NTIgNCAxMS4xNDIgMTEuMTYgNCAxOS45OSA0czE1Ljk5IDcuMTQyIDE1Ljk5IDE1Ljk1MmMwIDMuNDcyLTEuMTEyIDYuNjg1LTIuOTk5IDkuMzAzem0uMDUtOS4yMWMwIDcuMTIzLTUuNzAxIDEyLjkxOC0xMi44OCAxMi45MTgtNy4xNzcgMC0xMy4wMTYtNS43OTUtMTMuMDE2LTEyLjkxOCAwLTcuMTIgNS44MzktMTIuOTE3IDEzLjAxNy0xMi45MTcgNy4xNzggMCAxMi44NzkgNS43OTcgMTIuODc5IDEyLjkxN3oiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg=="},function(e,t,n){"use strict";var i=function(){};e.exports=i},function(e,t){(function(t){var n=60,i=1e3,r={},o=1,a="undefined"!=typeof window?window:void 0;a||(a="undefined"!=typeof t?t:{});var s={requestAnimationFrame:function(){var e=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame,t=!!e;if(e&&!/requestAnimationFrame\(\)\s*\{\s*\[native code\]\s*\}/i.test(e.toString())&&(t=!1),t)return function(t,n){e(t,n)};var n=60,i={},r=0,o=1,s=null,l=+new Date;return function(e,t){var a=o++;return i[a]=e,r++,null===s&&(s=setInterval(function(){var e=+new Date,t=i;i={},r=0;for(var n in t)t.hasOwnProperty(n)&&(t[n](e),l=e);e-l>2500&&(clearInterval(s),s=null)},1e3/n)),a}}(),stop:function(e){var t=null!=r[e];return t&&(r[e]=null),t},isRunning:function(e){return null!=r[e]},start:function(e,t,a,l,u,c){var d=+new Date,f=d,p=0,h=0,m=o++;if(c||(c=document.body),m%20===0){var y={};for(var v in r)y[v]=!0;r=y}var g=function(o){var y=o!==!0,v=+new Date;if(!r[m]||t&&!t(m))return r[m]=null,void(a&&a(n-h/((v-d)/i),m,!1));if(y)for(var b=Math.round((v-f)/(i/n))-1,M=0;M<Math.min(b,4);M++)g(!0),h++;l&&(p=(v-d)/l,p>1&&(p=1));var T=u?u(p):p;e(T,v,y)!==!1&&1!==p||!y?y&&(f=v,s.requestAnimationFrame(g,c)):(r[m]=null,a&&a(n-h/((v-d)/i),m,1===p||null==l))};return r[m]=!0,s.requestAnimationFrame(g,c),m}};e.exports=s}).call(t,function(){return this}())},function(e,t,n){var i,r=n(449),o=function(){};i=function(e,t){this.__callback=e,this.options={scrollingX:!0,scrollingY:!0,animating:!0,animationDuration:250,bouncing:!0,locking:!0,paging:!1,snapping:!1,zooming:!1,minZoom:.5,maxZoom:3,speedMultiplier:1,scrollingComplete:o,penetrationDeceleration:.03,
penetrationAcceleration:.08};for(var n in t)this.options[n]=t[n]};var a=function(e){return Math.pow(e-1,3)+1},s=function(e){return(e/=.5)<1?.5*Math.pow(e,3):.5*(Math.pow(e-2,3)+2)},l={__isSingleTouch:!1,__isTracking:!1,__didDecelerationComplete:!1,__isGesturing:!1,__isDragging:!1,__isDecelerating:!1,__isAnimating:!1,__clientLeft:0,__clientTop:0,__clientWidth:0,__clientHeight:0,__contentWidth:0,__contentHeight:0,__snapWidth:100,__snapHeight:100,__refreshHeight:null,__refreshActive:!1,__refreshActivate:null,__refreshDeactivate:null,__refreshStart:null,__zoomLevel:1,__scrollLeft:0,__scrollTop:0,__maxScrollLeft:0,__maxScrollTop:0,__scheduledLeft:0,__scheduledTop:0,__scheduledZoom:0,__lastTouchLeft:null,__lastTouchTop:null,__lastTouchMove:null,__positions:null,__minDecelerationScrollLeft:null,__minDecelerationScrollTop:null,__maxDecelerationScrollLeft:null,__maxDecelerationScrollTop:null,__decelerationVelocityX:null,__decelerationVelocityY:null,setDimensions:function(e,t,n,i){var r=this;e===+e&&(r.__clientWidth=e),t===+t&&(r.__clientHeight=t),n===+n&&(r.__contentWidth=n),i===+i&&(r.__contentHeight=i),r.__computeScrollMax(),r.scrollTo(r.__scrollLeft,r.__scrollTop,!0)},setPosition:function(e,t){var n=this;n.__clientLeft=e||0,n.__clientTop=t||0},setSnapSize:function(e,t){var n=this;n.__snapWidth=e,n.__snapHeight=t},activatePullToRefresh:function(e,t,n,i){var r=this;r.__refreshHeight=e,r.__refreshActivate=t,r.__refreshDeactivate=n,r.__refreshStart=i},triggerPullToRefresh:function(){this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0),this.__refreshStart&&this.__refreshStart()},finishPullToRefresh:function(){var e=this;e.__refreshActive=!1,e.__refreshDeactivate&&e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)},getValues:function(){var e=this;return{left:e.__scrollLeft,top:e.__scrollTop,zoom:e.__zoomLevel}},getScrollMax:function(){var e=this;return{left:e.__maxScrollLeft,top:e.__maxScrollTop}},zoomTo:function(e,t,n,i,o){var a=this;if(!a.options.zooming)throw new Error("Zooming is not enabled!");o&&(a.__zoomComplete=o),a.__isDecelerating&&(r.stop(a.__isDecelerating),a.__isDecelerating=!1);var s=a.__zoomLevel;null==n&&(n=a.__clientWidth/2),null==i&&(i=a.__clientHeight/2),e=Math.max(Math.min(e,a.options.maxZoom),a.options.minZoom),a.__computeScrollMax(e);var l=(n+a.__scrollLeft)*e/s-n,u=(i+a.__scrollTop)*e/s-i;l>a.__maxScrollLeft?l=a.__maxScrollLeft:l<0&&(l=0),u>a.__maxScrollTop?u=a.__maxScrollTop:u<0&&(u=0),a.__publish(l,u,e,t)},zoomBy:function(e,t,n,i,r){var o=this;o.zoomTo(o.__zoomLevel*e,t,n,i,r)},scrollTo:function(e,t,n,i,o){var a=this;if(a.__isDecelerating&&(r.stop(a.__isDecelerating),a.__isDecelerating=!1),null!=i&&i!==a.__zoomLevel){if(!a.options.zooming)throw new Error("Zooming is not enabled!");e*=i,t*=i,a.__computeScrollMax(i)}else i=a.__zoomLevel;a.options.scrollingX?a.options.paging?e=Math.round(e/a.__clientWidth)*a.__clientWidth:a.options.snapping&&(e=Math.round(e/a.__snapWidth)*a.__snapWidth):e=a.__scrollLeft,a.options.scrollingY?a.options.paging?t=Math.round(t/a.__clientHeight)*a.__clientHeight:a.options.snapping&&(t=Math.round(t/a.__snapHeight)*a.__snapHeight):t=a.__scrollTop,e=Math.max(Math.min(a.__maxScrollLeft,e),0),t=Math.max(Math.min(a.__maxScrollTop,t),0),e===a.__scrollLeft&&t===a.__scrollTop&&(n=!1,o&&o()),a.__isTracking||a.__publish(e,t,i,n)},scrollBy:function(e,t,n){var i=this,r=i.__isAnimating?i.__scheduledLeft:i.__scrollLeft,o=i.__isAnimating?i.__scheduledTop:i.__scrollTop;i.scrollTo(r+(e||0),o+(t||0),n)},doMouseZoom:function(e,t,n,i){var r=this,o=e>0?.97:1.03;return r.zoomTo(r.__zoomLevel*o,!1,n-r.__clientLeft,i-r.__clientTop)},doTouchStart:function(e,t){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);var n=this;n.__interruptedAnimation=!0,n.__isDecelerating&&(r.stop(n.__isDecelerating),n.__isDecelerating=!1,n.__interruptedAnimation=!0),n.__isAnimating&&(r.stop(n.__isAnimating),n.__isAnimating=!1,n.__interruptedAnimation=!0);var i,o,a=1===e.length;a?(i=e[0].pageX,o=e[0].pageY):(i=Math.abs(e[0].pageX+e[1].pageX)/2,o=Math.abs(e[0].pageY+e[1].pageY)/2),n.__initialTouchLeft=i,n.__initialTouchTop=o,n.__zoomLevelStart=n.__zoomLevel,n.__lastTouchLeft=i,n.__lastTouchTop=o,n.__lastTouchMove=t,n.__lastScale=1,n.__enableScrollX=!a&&n.options.scrollingX,n.__enableScrollY=!a&&n.options.scrollingY,n.__isTracking=!0,n.__didDecelerationComplete=!1,n.__isDragging=!a,n.__isSingleTouch=a,n.__positions=[]},doTouchMove:function(e,t,n){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);var i=this;if(i.__isTracking){var r,o;2===e.length?(r=Math.abs(e[0].pageX+e[1].pageX)/2,o=Math.abs(e[0].pageY+e[1].pageY)/2):(r=e[0].pageX,o=e[0].pageY);var a=i.__positions;if(i.__isDragging){var s=r-i.__lastTouchLeft,l=o-i.__lastTouchTop,u=i.__scrollLeft,c=i.__scrollTop,d=i.__zoomLevel;if(null!=n&&i.options.zooming){var f=d;if(d=d/i.__lastScale*n,d=Math.max(Math.min(d,i.options.maxZoom),i.options.minZoom),f!==d){var p=r-i.__clientLeft,h=o-i.__clientTop;u=(p+u)*d/f-p,c=(h+c)*d/f-h,i.__computeScrollMax(d)}}if(i.__enableScrollX){u-=s*this.options.speedMultiplier;var m=i.__maxScrollLeft;(u>m||u<0)&&(i.options.bouncing?u+=s/2*this.options.speedMultiplier:u=u>m?m:0)}if(i.__enableScrollY){c-=l*this.options.speedMultiplier;var y=i.__maxScrollTop;(c>y||c<0)&&(i.options.bouncing?(c+=l/2*this.options.speedMultiplier,i.__enableScrollX||null==i.__refreshHeight||(!i.__refreshActive&&c<=-i.__refreshHeight?(i.__refreshActive=!0,i.__refreshActivate&&i.__refreshActivate()):i.__refreshActive&&c>-i.__refreshHeight&&(i.__refreshActive=!1,i.__refreshDeactivate&&i.__refreshDeactivate()))):c=c>y?y:0)}a.length>60&&a.splice(0,30),a.push(u,c,t),i.__publish(u,c,d)}else{var v=i.options.locking?3:0,g=5,b=Math.abs(r-i.__initialTouchLeft),M=Math.abs(o-i.__initialTouchTop);i.__enableScrollX=i.options.scrollingX&&b>=v,i.__enableScrollY=i.options.scrollingY&&M>=v,a.push(i.__scrollLeft,i.__scrollTop,t),i.__isDragging=(i.__enableScrollX||i.__enableScrollY)&&(b>=g||M>=g),i.__isDragging&&(i.__interruptedAnimation=!1)}i.__lastTouchLeft=r,i.__lastTouchTop=o,i.__lastTouchMove=t,i.__lastScale=n}},doTouchEnd:function(e){if(e instanceof Date&&(e=e.valueOf()),"number"!=typeof e)throw new Error("Invalid timestamp value: "+e);var t=this;if(t.__isTracking){if(t.__isTracking=!1,t.__isDragging)if(t.__isDragging=!1,t.__isSingleTouch&&t.options.animating&&e-t.__lastTouchMove<=100){for(var n=t.__positions,i=n.length-1,r=i,o=i;o>0&&n[o]>t.__lastTouchMove-100;o-=3)r=o;if(r!==i){var a=n[i]-n[r],s=t.__scrollLeft-n[r-2],l=t.__scrollTop-n[r-1];t.__decelerationVelocityX=s/a*(1e3/60),t.__decelerationVelocityY=l/a*(1e3/60);var u=t.options.paging||t.options.snapping?4:1;Math.abs(t.__decelerationVelocityX)>u||Math.abs(t.__decelerationVelocityY)>u?t.__refreshActive||t.__startDeceleration(e):t.options.scrollingComplete()}else t.options.scrollingComplete()}else e-t.__lastTouchMove>100&&t.options.scrollingComplete();t.__isDecelerating||(t.__refreshActive&&t.__refreshStart?(t.__publish(t.__scrollLeft,-t.__refreshHeight,t.__zoomLevel,!0),t.__refreshStart&&t.__refreshStart()):((t.__interruptedAnimation||t.__isDragging)&&t.options.scrollingComplete(),t.scrollTo(t.__scrollLeft,t.__scrollTop,!0,t.__zoomLevel),t.__refreshActive&&(t.__refreshActive=!1,t.__refreshDeactivate&&t.__refreshDeactivate()))),t.__positions.length=0}},__publish:function(e,t,n,i){var o=this,l=o.__isAnimating;if(l&&(r.stop(l),o.__isAnimating=!1),i&&o.options.animating){o.__scheduledLeft=e,o.__scheduledTop=t,o.__scheduledZoom=n;var u=o.__scrollLeft,c=o.__scrollTop,d=o.__zoomLevel,f=e-u,p=t-c,h=n-d,m=function(e,t,n){n&&(o.__scrollLeft=u+f*e,o.__scrollTop=c+p*e,o.__zoomLevel=d+h*e,o.__callback&&o.__callback(o.__scrollLeft,o.__scrollTop,o.__zoomLevel))},y=function(e){return o.__isAnimating===e},v=function(e,t,n){t===o.__isAnimating&&(o.__isAnimating=!1),(o.__didDecelerationComplete||n)&&o.options.scrollingComplete(),o.options.zooming&&(o.__computeScrollMax(),o.__zoomComplete&&(o.__zoomComplete(),o.__zoomComplete=null))};o.__isAnimating=r.start(m,y,v,o.options.animationDuration,l?a:s)}else o.__scheduledLeft=o.__scrollLeft=e,o.__scheduledTop=o.__scrollTop=t,o.__scheduledZoom=o.__zoomLevel=n,o.__callback&&o.__callback(e,t,n),o.options.zooming&&(o.__computeScrollMax(),o.__zoomComplete&&(o.__zoomComplete(),o.__zoomComplete=null))},__computeScrollMax:function(e){var t=this;null==e&&(e=t.__zoomLevel),t.__maxScrollLeft=Math.max(t.__contentWidth*e-t.__clientWidth,0),t.__maxScrollTop=Math.max(t.__contentHeight*e-t.__clientHeight,0)},__startDeceleration:function(e){var t=this;if(t.options.paging){var n=Math.max(Math.min(t.__scrollLeft,t.__maxScrollLeft),0),i=Math.max(Math.min(t.__scrollTop,t.__maxScrollTop),0),o=t.__clientWidth,a=t.__clientHeight;t.__minDecelerationScrollLeft=Math.floor(n/o)*o,t.__minDecelerationScrollTop=Math.floor(i/a)*a,t.__maxDecelerationScrollLeft=Math.ceil(n/o)*o,t.__maxDecelerationScrollTop=Math.ceil(i/a)*a}else t.__minDecelerationScrollLeft=0,t.__minDecelerationScrollTop=0,t.__maxDecelerationScrollLeft=t.__maxScrollLeft,t.__maxDecelerationScrollTop=t.__maxScrollTop;var s=function(e,n,i){t.__stepThroughDeceleration(i)},l=t.options.minVelocityToKeepDecelerating;l||(l=t.options.snapping?4:.001);var u=function(){var e=Math.abs(t.__decelerationVelocityX)>=l||Math.abs(t.__decelerationVelocityY)>=l;return e||(t.__didDecelerationComplete=!0),e},c=function(e,n,i){t.__isDecelerating=!1,t.scrollTo(t.__scrollLeft,t.__scrollTop,t.options.snapping,null,t.__didDecelerationComplete&&t.options.scrollingComplete)};t.__isDecelerating=r.start(s,u,c)},__stepThroughDeceleration:function(e){var t=this,n=t.__scrollLeft+t.__decelerationVelocityX,i=t.__scrollTop+t.__decelerationVelocityY;if(!t.options.bouncing){var r=Math.max(Math.min(t.__maxDecelerationScrollLeft,n),t.__minDecelerationScrollLeft);r!==n&&(n=r,t.__decelerationVelocityX=0);var o=Math.max(Math.min(t.__maxDecelerationScrollTop,i),t.__minDecelerationScrollTop);o!==i&&(i=o,t.__decelerationVelocityY=0)}if(e?t.__publish(n,i,t.__zoomLevel):(t.__scrollLeft=n,t.__scrollTop=i),!t.options.paging){var a=.95;t.__decelerationVelocityX*=a,t.__decelerationVelocityY*=a}if(t.options.bouncing){var s=0,l=0,u=t.options.penetrationDeceleration,c=t.options.penetrationAcceleration;n<t.__minDecelerationScrollLeft?s=t.__minDecelerationScrollLeft-n:n>t.__maxDecelerationScrollLeft&&(s=t.__maxDecelerationScrollLeft-n),i<t.__minDecelerationScrollTop?l=t.__minDecelerationScrollTop-i:i>t.__maxDecelerationScrollTop&&(l=t.__maxDecelerationScrollTop-i),0!==s&&(s*t.__decelerationVelocityX<=0?t.__decelerationVelocityX+=s*u:t.__decelerationVelocityX=s*c),0!==l&&(l*t.__decelerationVelocityY<=0?t.__decelerationVelocityY+=l*u:t.__decelerationVelocityY=l*c)}}};for(var u in l)i.prototype[u]=l[u];e.exports=i},function(e,t,n,i){"use strict";n(8),n(i)},function(e,t,n,i){"use strict";n(8),n(16),n(i)},function(e,t,n,i){"use strict";n(8),n(20),n(i)}]))});
//# sourceMappingURL=antd-mobile.min.js.map |
app/components/App.js | dnguyenba/cypress-workshop | import React, {Component} from 'react'
import {connect} from 'react-redux'
import Nav from './common/Nav'
class App extends Component {
render () {
return (
<div className='wrapper'>
<Nav loggedIn={this.props.data.loggedIn}
currentlySending={this.props.data.currentlySending}
history={this.props.history}
dispatch={this.props.dispatch}
location={this.props.location} />
{this.props.children}
</div>
)
}
}
App.propTypes = {
data: React.PropTypes.object,
history: React.PropTypes.object,
location: React.PropTypes.object,
children: React.PropTypes.object,
dispatch: React.PropTypes.func
}
function select (state) {
return {
data: state
}
}
export default connect(select)(App)
|
scripts/dashboard/components/ProjectForm/ProjectFormServiceList/view.js | vedranjukic/dockerino | import React from 'react'
import { Link } from 'react-router'
import { Table } from 'react-bootstrap';
function view (props, state) {
if (!props.project.services || !props.project.services.length) {
return (
<div>
No services added.
<Link to="/project/addservice">Add service to project</Link>
</div>
)
}
return (
<div>
<Table>
<thead>
<tr>
<th>Name</th>
<th>Image</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{
props.project.services.map( service => {
return (
<tr key={service.id}>
<td>{service.name}</td>
<td>{service.image}</td>
<td>
<a href="#" className="edit">Edit</a>
<a href="#" className="remove">Remove</a>
</td>
</tr>
)
})
}
</tbody>
</Table>
<Link to="/project/addservice">Add service to project</Link>
</div>
)
}
export default view |
test/components/Counter.spec.js | robogroves/bps | /* eslint-disable no-unused-expressions */
import { expect } from 'chai';
import { spy } from 'sinon';
import React from 'react';
import { shallow } from 'enzyme';
import Counter from '../../app/components/Counter';
function setup() {
const actions = {
increment: spy(),
incrementIfOdd: spy(),
incrementAsync: spy(),
decrement: spy()
};
const component = shallow(<Counter counter={1} {...actions} />);
return {
component,
actions,
buttons: component.find('button'),
p: component.find('.counter')
};
}
describe('Counter component', () => {
it('should should display count', () => {
const { p } = setup();
expect(p.text()).to.match(/^1$/);
});
it('should first button should call increment', () => {
const { buttons, actions } = setup();
buttons.at(0).simulate('click');
expect(actions.increment.called).to.be.true;
});
it('should second button should call decrement', () => {
const { buttons, actions } = setup();
buttons.at(1).simulate('click');
expect(actions.decrement.called).to.be.true;
});
it('should third button should call incrementIfOdd', () => {
const { buttons, actions } = setup();
buttons.at(2).simulate('click');
expect(actions.incrementIfOdd.called).to.be.true;
});
it('should fourth button should call incrementAsync', () => {
const { buttons, actions } = setup();
buttons.at(3).simulate('click');
expect(actions.incrementAsync.called).to.be.true;
});
});
|
ajax/libs/react-native-web/0.12.3/cjs/modules/UnimplementedView/index.min.js | cdnjs/cdnjs | "use strict";exports.__esModule=!0,exports.default=void 0;var _View=_interopRequireDefault(require("../../exports/View")),_react=_interopRequireDefault(require("react"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t}var UnimplementedView=function(e){function t(){return e.apply(this,arguments)||this}_inheritsLoose(t,e);var r=t.prototype;return r.setNativeProps=function(){},r.render=function(){return _react.default.createElement(_View.default,{style:[unimplementedViewStyles,this.props.style]},this.props.children)},t}(_react.default.Component),unimplementedViewStyles="production"!==process.env.NODE_ENV?{alignSelf:"flex-start",borderColor:"red",borderWidth:1}:{},_default=UnimplementedView;exports.default=UnimplementedView,module.exports=exports.default; |
ajax/libs/jquery/1.11.3/jquery.min.js | peteygao/cdnjs | /*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | 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=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.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(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.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||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[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,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=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=ha(),z=ha(),A=ha(),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=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),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")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=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)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){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 ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(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 ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(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 pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.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.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);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 p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",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(".#.+[+~]")}),ja(function(a){var b=g.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=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.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===g||a.ownerDocument===v&&t(v,a)?-1:b===g||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,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||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 ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.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},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.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=ga.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=ga.selectors={cacheLength:50,createPseudo:ia,match:X,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(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===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]||ga.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]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.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(ca,da).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=ga.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(Q," ")+" ").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;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(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:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(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:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).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 Z.test(a.nodeName)},input:function(a){return Y.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:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function qa(){}qa.prototype=d.filters=d.pseudos,d.setFilters=new qa,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function ra(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sa(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=[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(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(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 ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(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 wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(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=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(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=[sa(ta(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 wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.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(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.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(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(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}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(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&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.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=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;
return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.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=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.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 m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(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},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!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&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ca()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===ca()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?aa:ba):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=aa,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=aa,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=aa,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=ba;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=ba),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function da(a){var b=ea.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var ea="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fa=/ jQuery\d+="(?:null|\d+)"/g,ga=new RegExp("<(?:"+ea+")[\\s/>]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/<tbody/i,la=/<|&#?\w+;/,ma=/<(?:script|style|link)/i,na=/checked\s*(?:[^=]|=\s*.checked.)/i,oa=/^$|\/(?:java|ecma)script/i,pa=/^true\/(.*)/,qa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ra={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?"<table>"!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Ca[0].contentWindow||Ca[0].contentDocument).document,b.write(),b.close(),c=Ea(a,b),Ca.detach()),Da[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Ga=/^margin/,Ha=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ia,Ja,Ka=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ia=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Ha.test(g)&&Ga.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ia=function(a){return a.currentStyle},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ha.test(g)&&!Ka.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function La(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight),b.removeChild(i)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Ma=/alpha\([^)]*\)/i,Na=/opacity\s*=\s*([^)]*)/,Oa=/^(none|table(?!-c[ea]).+)/,Pa=new RegExp("^("+S+")(.*)$","i"),Qa=new RegExp("^([+-])=("+S+")","i"),Ra={position:"absolute",visibility:"hidden",display:"block"},Sa={letterSpacing:"0",fontWeight:"400"},Ta=["Webkit","O","Moz","ms"];function Ua(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Ta.length;while(e--)if(b=Ta[e]+c,b in a)return b;return d}function Va(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fa(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wa(a,b,c){var d=Pa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xa(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Ya(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ia(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Ja(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ha.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xa(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ja(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ua(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qa.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ua(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Ja(a,b,d)),"normal"===f&&b in Sa&&(f=Sa[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Oa.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Ra,function(){return Ya(a,b,d)}):Ya(a,b,d):void 0},set:function(a,c,d){var e=d&&Ia(a);return Wa(a,c,d?Xa(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Na.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Ma,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Ma.test(f)?f.replace(Ma,e):f+" "+e)}}),m.cssHooks.marginRight=La(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Ja,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Ga.test(a)||(m.cssHooks[a+b].set=Wa)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ia(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Va(this,!0)},hide:function(){return Va(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Za(a,b,c,d,e){
return new Za.prototype.init(a,b,c,d,e)}m.Tween=Za,Za.prototype={constructor:Za,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Za.propHooks[this.prop];return a&&a.get?a.get(this):Za.propHooks._default.get(this)},run:function(a){var b,c=Za.propHooks[this.prop];return this.options.duration?this.pos=b=m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Za.propHooks._default.set(this),this}},Za.prototype.init.prototype=Za.prototype,Za.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Za.propHooks.scrollTop=Za.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Za.prototype.init,m.fx.step={};var $a,_a,ab=/^(?:toggle|show|hide)$/,bb=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cb=/queueHooks$/,db=[ib],eb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bb.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bb.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fb(){return setTimeout(function(){$a=void 0}),$a=m.now()}function gb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hb(a,b,c){for(var d,e=(eb[b]||[]).concat(eb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ib(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fa(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fa(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ab.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fa(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hb(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jb(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kb(a,b,c){var d,e,f=0,g=db.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$a||fb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$a||fb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jb(k,j.opts.specialEasing);g>f;f++)if(d=db[f].call(j,a,k,j.opts))return d;return m.map(k,hb,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kb,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],eb[c]=eb[c]||[],eb[c].unshift(b)},prefilter:function(a,b){b?db.unshift(a):db.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kb(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gb(b,!0),a,d,e)}}),m.each({slideDown:gb("show"),slideUp:gb("hide"),slideToggle:gb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($a=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$a=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_a||(_a=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_a),_a=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lb=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lb,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mb,nb,ob=m.expr.attrHandle,pb=/^(?:checked|selected)$/i,qb=k.getSetAttribute,rb=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nb:mb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rb&&qb||!pb.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qb?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nb={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rb&&qb||!pb.test(c)?a.setAttribute(!qb&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ob[b]||m.find.attr;ob[b]=rb&&qb||!pb.test(b)?function(a,b,d){var e,f;return d||(f=ob[b],ob[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,ob[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rb&&qb||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mb&&mb.set(a,b,c)}}),qb||(mb={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},ob.id=ob.name=ob.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mb.set},m.attrHooks.contenteditable={set:function(a,b,c){mb.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sb=/^(?:input|select|textarea|button|object)$/i,tb=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sb.test(a.nodeName)||tb.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var ub=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ub," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vb=m.now(),wb=/\?/,xb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yb,zb,Ab=/#.*$/,Bb=/([?&])_=[^&]*/,Cb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Db=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Eb=/^(?:GET|HEAD)$/,Fb=/^\/\//,Gb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hb={},Ib={},Jb="*/".concat("*");try{zb=location.href}catch(Kb){zb=y.createElement("a"),zb.href="",zb=zb.href}yb=Gb.exec(zb.toLowerCase())||[];function Lb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mb(a,b,c,d){var e={},f=a===Ib;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nb(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Ob(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zb,type:"GET",isLocal:Db.test(yb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nb(Nb(a,m.ajaxSettings),b):Nb(m.ajaxSettings,a)},ajaxPrefilter:Lb(Hb),ajaxTransport:Lb(Ib),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cb.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zb)+"").replace(Ab,"").replace(Fb,yb[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gb.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yb[1]&&c[2]===yb[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yb[3]||("http:"===yb[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mb(Hb,k,b,v),2===t)return v;h=m.event&&k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Eb.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wb.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bb.test(e)?e.replace(Bb,"$1_="+vb++):e+(wb.test(e)?"&":"?")+"_="+vb++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jb+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mb(Ib,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Ob(k,v,c)),u=Pb(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qb=/%20/g,Rb=/\[\]$/,Sb=/\r?\n/g,Tb=/^(?:submit|button|image|reset|file)$/i,Ub=/^(?:input|select|textarea|keygen)/i;function Vb(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rb.test(a)?d(a,e):Vb(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vb(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vb(c,a[c],b,e);return d.join("&").replace(Qb,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Ub.test(this.nodeName)&&!Tb.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sb,"\r\n")}}):{name:b.name,value:c.replace(Sb,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zb()||$b()}:Zb;var Wb=0,Xb={},Yb=m.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Xb)Xb[a](void 0,!0)}),k.cors=!!Yb&&"withCredentials"in Yb,Yb=k.ajax=!!Yb,Yb&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xb[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xb[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zb(){try{return new a.XMLHttpRequest}catch(b){}}function $b(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _b=[],ac=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_b.pop()||m.expando+"_"+vb++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ac.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ac.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ac,"$1"+e):b.jsonp!==!1&&(b.url+=(wb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_b.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bc=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bc)return bc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cc=a.document.documentElement;function dc(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dc(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cc;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cc})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=La(k.pixelPosition,function(a,c){return c?(c=Ja(a,b),Ha.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ec=a.jQuery,fc=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fc),b&&a.jQuery===m&&(a.jQuery=ec),m},typeof b===K&&(a.jQuery=a.$=m),m});
//# sourceMappingURL=jquery.min.map |
src/Message.js | ActiveObject/chat-app | import React from 'react'
import Message from 'app/ui/Message'
export function render(msg) {
return React.createElement(Message, {
key: msg.id,
value: msg
})
}
|
ajax/libs/webshim/1.14.5-RC1/dev/shims/combos/26.js | dmsanchez86/cdnjs | /**
* mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
* v1.2.1
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*
* Date: 2014-05-14
*/
/**
* Compiled inline version. (Library mode)
*/
/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */
/*globals $code */
(function(exports, undefined) {
"use strict";
var modules = {};
function require(ids, callback) {
var module, defs = [];
for (var i = 0; i < ids.length; ++i) {
module = modules[ids[i]] || resolve(ids[i]);
if (!module) {
throw 'module definition dependecy not found: ' + ids[i];
}
defs.push(module);
}
callback.apply(null, defs);
}
function define(id, dependencies, definition) {
if (typeof id !== 'string') {
throw 'invalid module definition, module id must be defined and be a string';
}
if (dependencies === undefined) {
throw 'invalid module definition, dependencies must be specified';
}
if (definition === undefined) {
throw 'invalid module definition, definition function must be specified';
}
require(dependencies, function() {
modules[id] = definition.apply(null, arguments);
});
}
function defined(id) {
return !!modules[id];
}
function resolve(id) {
var target = exports;
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length; ++fi) {
if (!target[fragments[fi]]) {
return;
}
target = target[fragments[fi]];
}
return target;
}
function expose(ids) {
for (var i = 0; i < ids.length; i++) {
var target = exports;
var id = ids[i];
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length - 1; ++fi) {
if (target[fragments[fi]] === undefined) {
target[fragments[fi]] = {};
}
target = target[fragments[fi]];
}
target[fragments[fragments.length - 1]] = modules[id];
}
}
// Included from: src/javascript/core/utils/Basic.js
/**
* Basic.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Basic', [], function() {
/**
Gets the true type of the built-in object (better version of typeof).
@author Angus Croll (http://javascriptweblog.wordpress.com/)
@method typeOf
@for Utils
@static
@param {Object} o Object to check.
@return {String} Object [[Class]]
*/
var typeOf = function(o) {
var undef;
if (o === undef) {
return 'undefined';
} else if (o === null) {
return 'null';
} else if (o.nodeType) {
return 'node';
}
// the snippet below is awesome, however it fails to detect null, undefined and arguments types in IE lte 8
return ({}).toString.call(o).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
};
/**
Extends the specified object with another object.
@method extend
@static
@param {Object} target Object to extend.
@param {Object} [obj]* Multiple objects to extend with.
@return {Object} Same as target, the extended object.
*/
var extend = function(target) {
var undef;
each(arguments, function(arg, i) {
if (i > 0) {
each(arg, function(value, key) {
if (value !== undef) {
if (typeOf(target[key]) === typeOf(value) && !!~inArray(typeOf(value), ['array', 'object'])) {
extend(target[key], value);
} else {
target[key] = value;
}
}
});
}
});
return target;
};
/**
Executes the callback function for each item in array/object. If you return false in the
callback it will break the loop.
@method each
@static
@param {Object} obj Object to iterate.
@param {function} callback Callback function to execute for each item.
*/
var each = function(obj, callback) {
var length, key, i, undef;
if (obj) {
try {
length = obj.length;
} catch(ex) {
length = undef;
}
if (length === undef) {
// Loop object items
for (key in obj) {
if (obj.hasOwnProperty(key)) {
if (callback(obj[key], key) === false) {
return;
}
}
}
} else {
// Loop array items
for (i = 0; i < length; i++) {
if (callback(obj[i], i) === false) {
return;
}
}
}
}
};
/**
Checks if object is empty.
@method isEmptyObj
@static
@param {Object} o Object to check.
@return {Boolean}
*/
var isEmptyObj = function(obj) {
var prop;
if (!obj || typeOf(obj) !== 'object') {
return true;
}
for (prop in obj) {
return false;
}
return true;
};
/**
Recieve an array of functions (usually async) to call in sequence, each function
receives a callback as first argument that it should call, when it completes. Finally,
after everything is complete, main callback is called. Passing truthy value to the
callback as a first argument will interrupt the sequence and invoke main callback
immediately.
@method inSeries
@static
@param {Array} queue Array of functions to call in sequence
@param {Function} cb Main callback that is called in the end, or in case of error
*/
var inSeries = function(queue, cb) {
var i = 0, length = queue.length;
if (typeOf(cb) !== 'function') {
cb = function() {};
}
if (!queue || !queue.length) {
cb();
}
function callNext(i) {
if (typeOf(queue[i]) === 'function') {
queue[i](function(error) {
/*jshint expr:true */
++i < length && !error ? callNext(i) : cb(error);
});
}
}
callNext(i);
};
/**
Recieve an array of functions (usually async) to call in parallel, each function
receives a callback as first argument that it should call, when it completes. After
everything is complete, main callback is called. Passing truthy value to the
callback as a first argument will interrupt the process and invoke main callback
immediately.
@method inParallel
@static
@param {Array} queue Array of functions to call in sequence
@param {Function} cb Main callback that is called in the end, or in case of erro
*/
var inParallel = function(queue, cb) {
var count = 0, num = queue.length, cbArgs = new Array(num);
each(queue, function(fn, i) {
fn(function(error) {
if (error) {
return cb(error);
}
var args = [].slice.call(arguments);
args.shift(); // strip error - undefined or not
cbArgs[i] = args;
count++;
if (count === num) {
cbArgs.unshift(null);
cb.apply(this, cbArgs);
}
});
});
};
/**
Find an element in array and return it's index if present, otherwise return -1.
@method inArray
@static
@param {Mixed} needle Element to find
@param {Array} array
@return {Int} Index of the element, or -1 if not found
*/
var inArray = function(needle, array) {
if (array) {
if (Array.prototype.indexOf) {
return Array.prototype.indexOf.call(array, needle);
}
for (var i = 0, length = array.length; i < length; i++) {
if (array[i] === needle) {
return i;
}
}
}
return -1;
};
/**
Returns elements of first array if they are not present in second. And false - otherwise.
@private
@method arrayDiff
@param {Array} needles
@param {Array} array
@return {Array|Boolean}
*/
var arrayDiff = function(needles, array) {
var diff = [];
if (typeOf(needles) !== 'array') {
needles = [needles];
}
if (typeOf(array) !== 'array') {
array = [array];
}
for (var i in needles) {
if (inArray(needles[i], array) === -1) {
diff.push(needles[i]);
}
}
return diff.length ? diff : false;
};
/**
Find intersection of two arrays.
@private
@method arrayIntersect
@param {Array} array1
@param {Array} array2
@return {Array} Intersection of two arrays or null if there is none
*/
var arrayIntersect = function(array1, array2) {
var result = [];
each(array1, function(item) {
if (inArray(item, array2) !== -1) {
result.push(item);
}
});
return result.length ? result : null;
};
/**
Forces anything into an array.
@method toArray
@static
@param {Object} obj Object with length field.
@return {Array} Array object containing all items.
*/
var toArray = function(obj) {
var i, arr = [];
for (i = 0; i < obj.length; i++) {
arr[i] = obj[i];
}
return arr;
};
/**
Generates an unique ID. This is 99.99% unique since it takes the current time and 5 random numbers.
The only way a user would be able to get the same ID is if the two persons at the same exact milisecond manages
to get 5 the same random numbers between 0-65535 it also uses a counter so each call will be guaranteed to be page unique.
It's more probable for the earth to be hit with an ansteriod. Y
@method guid
@static
@param {String} prefix to prepend (by default 'o' will be prepended).
@method guid
@return {String} Virtually unique id.
*/
var guid = (function() {
var counter = 0;
return function(prefix) {
var guid = new Date().getTime().toString(32), i;
for (i = 0; i < 5; i++) {
guid += Math.floor(Math.random() * 65535).toString(32);
}
return (prefix || 'o_') + guid + (counter++).toString(32);
};
}());
/**
Trims white spaces around the string
@method trim
@static
@param {String} str
@return {String}
*/
var trim = function(str) {
if (!str) {
return str;
}
return String.prototype.trim ? String.prototype.trim.call(str) : str.toString().replace(/^\s*/, '').replace(/\s*$/, '');
};
/**
Parses the specified size string into a byte value. For example 10kb becomes 10240.
@method parseSizeStr
@static
@param {String/Number} size String to parse or number to just pass through.
@return {Number} Size in bytes.
*/
var parseSizeStr = function(size) {
if (typeof(size) !== 'string') {
return size;
}
var muls = {
t: 1099511627776,
g: 1073741824,
m: 1048576,
k: 1024
},
mul;
size = /^([0-9]+)([mgk]?)$/.exec(size.toLowerCase().replace(/[^0-9mkg]/g, ''));
mul = size[2];
size = +size[1];
if (muls.hasOwnProperty(mul)) {
size *= muls[mul];
}
return size;
};
return {
guid: guid,
typeOf: typeOf,
extend: extend,
each: each,
isEmptyObj: isEmptyObj,
inSeries: inSeries,
inParallel: inParallel,
inArray: inArray,
arrayDiff: arrayDiff,
arrayIntersect: arrayIntersect,
toArray: toArray,
trim: trim,
parseSizeStr: parseSizeStr
};
});
// Included from: src/javascript/core/I18n.js
/**
* I18n.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/core/I18n", [
"moxie/core/utils/Basic"
], function(Basic) {
var i18n = {};
return {
/**
* Extends the language pack object with new items.
*
* @param {Object} pack Language pack items to add.
* @return {Object} Extended language pack object.
*/
addI18n: function(pack) {
return Basic.extend(i18n, pack);
},
/**
* Translates the specified string by checking for the english string in the language pack lookup.
*
* @param {String} str String to look for.
* @return {String} Translated string or the input string if it wasn't found.
*/
translate: function(str) {
return i18n[str] || str;
},
/**
* Shortcut for translate function
*
* @param {String} str String to look for.
* @return {String} Translated string or the input string if it wasn't found.
*/
_: function(str) {
return this.translate(str);
},
/**
* Pseudo sprintf implementation - simple way to replace tokens with specified values.
*
* @param {String} str String with tokens
* @return {String} String with replaced tokens
*/
sprintf: function(str) {
var args = [].slice.call(arguments, 1);
return str.replace(/%[a-z]/g, function() {
var value = args.shift();
return Basic.typeOf(value) !== 'undefined' ? value : '';
});
}
};
});
// Included from: src/javascript/core/utils/Mime.js
/**
* Mime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/core/utils/Mime", [
"moxie/core/utils/Basic",
"moxie/core/I18n"
], function(Basic, I18n) {
var mimeData = "" +
"application/msword,doc dot," +
"application/pdf,pdf," +
"application/pgp-signature,pgp," +
"application/postscript,ps ai eps," +
"application/rtf,rtf," +
"application/vnd.ms-excel,xls xlb," +
"application/vnd.ms-powerpoint,ppt pps pot," +
"application/zip,zip," +
"application/x-shockwave-flash,swf swfl," +
"application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx," +
"application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx," +
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx," +
"application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx," +
"application/vnd.openxmlformats-officedocument.presentationml.template,potx," +
"application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx," +
"application/x-javascript,js," +
"application/json,json," +
"audio/mpeg,mp3 mpga mpega mp2," +
"audio/x-wav,wav," +
"audio/x-m4a,m4a," +
"audio/ogg,oga ogg," +
"audio/aiff,aiff aif," +
"audio/flac,flac," +
"audio/aac,aac," +
"audio/ac3,ac3," +
"audio/x-ms-wma,wma," +
"image/bmp,bmp," +
"image/gif,gif," +
"image/jpeg,jpg jpeg jpe," +
"image/photoshop,psd," +
"image/png,png," +
"image/svg+xml,svg svgz," +
"image/tiff,tiff tif," +
"text/plain,asc txt text diff log," +
"text/html,htm html xhtml," +
"text/css,css," +
"text/csv,csv," +
"text/rtf,rtf," +
"video/mpeg,mpeg mpg mpe m2v," +
"video/quicktime,qt mov," +
"video/mp4,mp4," +
"video/x-m4v,m4v," +
"video/x-flv,flv," +
"video/x-ms-wmv,wmv," +
"video/avi,avi," +
"video/webm,webm," +
"video/3gpp,3gpp 3gp," +
"video/3gpp2,3g2," +
"video/vnd.rn-realvideo,rv," +
"video/ogg,ogv," +
"video/x-matroska,mkv," +
"application/vnd.oasis.opendocument.formula-template,otf," +
"application/octet-stream,exe";
var Mime = {
mimes: {},
extensions: {},
// Parses the default mime types string into a mimes and extensions lookup maps
addMimeType: function (mimeData) {
var items = mimeData.split(/,/), i, ii, ext;
for (i = 0; i < items.length; i += 2) {
ext = items[i + 1].split(/ /);
// extension to mime lookup
for (ii = 0; ii < ext.length; ii++) {
this.mimes[ext[ii]] = items[i];
}
// mime to extension lookup
this.extensions[items[i]] = ext;
}
},
extList2mimes: function (filters, addMissingExtensions) {
var self = this, ext, i, ii, type, mimes = [];
// convert extensions to mime types list
for (i = 0; i < filters.length; i++) {
ext = filters[i].extensions.split(/\s*,\s*/);
for (ii = 0; ii < ext.length; ii++) {
// if there's an asterisk in the list, then accept attribute is not required
if (ext[ii] === '*') {
return [];
}
type = self.mimes[ext[ii]];
if (!type) {
if (addMissingExtensions && /^\w+$/.test(ext[ii])) {
mimes.push('.' + ext[ii]);
} else {
return []; // accept all
}
} else if (Basic.inArray(type, mimes) === -1) {
mimes.push(type);
}
}
}
return mimes;
},
mimes2exts: function(mimes) {
var self = this, exts = [];
Basic.each(mimes, function(mime) {
if (mime === '*') {
exts = [];
return false;
}
// check if this thing looks like mime type
var m = mime.match(/^(\w+)\/(\*|\w+)$/);
if (m) {
if (m[2] === '*') {
// wildcard mime type detected
Basic.each(self.extensions, function(arr, mime) {
if ((new RegExp('^' + m[1] + '/')).test(mime)) {
[].push.apply(exts, self.extensions[mime]);
}
});
} else if (self.extensions[mime]) {
[].push.apply(exts, self.extensions[mime]);
}
}
});
return exts;
},
mimes2extList: function(mimes) {
var accept = [], exts = [];
if (Basic.typeOf(mimes) === 'string') {
mimes = Basic.trim(mimes).split(/\s*,\s*/);
}
exts = this.mimes2exts(mimes);
accept.push({
title: I18n.translate('Files'),
extensions: exts.length ? exts.join(',') : '*'
});
// save original mimes string
accept.mimes = mimes;
return accept;
},
getFileExtension: function(fileName) {
var matches = fileName && fileName.match(/\.([^.]+)$/);
if (matches) {
return matches[1].toLowerCase();
}
return '';
},
getFileMime: function(fileName) {
return this.mimes[this.getFileExtension(fileName)] || '';
}
};
Mime.addMimeType(mimeData);
return Mime;
});
// Included from: src/javascript/core/utils/Env.js
/**
* Env.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/core/utils/Env", [
"moxie/core/utils/Basic"
], function(Basic) {
// UAParser.js v0.6.2
// Lightweight JavaScript-based User-Agent string parser
// https://github.com/faisalman/ua-parser-js
//
// Copyright © 2012-2013 Faisalman <[email protected]>
// Dual licensed under GPLv2 & MIT
var UAParser = (function (undefined) {
//////////////
// Constants
/////////////
var EMPTY = '',
UNKNOWN = '?',
FUNC_TYPE = 'function',
UNDEF_TYPE = 'undefined',
OBJ_TYPE = 'object',
MAJOR = 'major',
MODEL = 'model',
NAME = 'name',
TYPE = 'type',
VENDOR = 'vendor',
VERSION = 'version',
ARCHITECTURE= 'architecture',
CONSOLE = 'console',
MOBILE = 'mobile',
TABLET = 'tablet';
///////////
// Helper
//////////
var util = {
has : function (str1, str2) {
return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1;
},
lowerize : function (str) {
return str.toLowerCase();
}
};
///////////////
// Map helper
//////////////
var mapper = {
rgx : function () {
// loop through all regexes maps
for (var result, i = 0, j, k, p, q, matches, match, args = arguments; i < args.length; i += 2) {
var regex = args[i], // even sequence (0,2,4,..)
props = args[i + 1]; // odd sequence (1,3,5,..)
// construct object barebones
if (typeof(result) === UNDEF_TYPE) {
result = {};
for (p in props) {
q = props[p];
if (typeof(q) === OBJ_TYPE) {
result[q[0]] = undefined;
} else {
result[q] = undefined;
}
}
}
// try matching uastring with regexes
for (j = k = 0; j < regex.length; j++) {
matches = regex[j].exec(this.getUA());
if (!!matches) {
for (p = 0; p < props.length; p++) {
match = matches[++k];
q = props[p];
// check if given property is actually array
if (typeof(q) === OBJ_TYPE && q.length > 0) {
if (q.length == 2) {
if (typeof(q[1]) == FUNC_TYPE) {
// assign modified match
result[q[0]] = q[1].call(this, match);
} else {
// assign given value, ignore regex match
result[q[0]] = q[1];
}
} else if (q.length == 3) {
// check whether function or regex
if (typeof(q[1]) === FUNC_TYPE && !(q[1].exec && q[1].test)) {
// call function (usually string mapper)
result[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;
} else {
// sanitize match using given regex
result[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
}
} else if (q.length == 4) {
result[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;
}
} else {
result[q] = match ? match : undefined;
}
}
break;
}
}
if(!!matches) break; // break the loop immediately if match found
}
return result;
},
str : function (str, map) {
for (var i in map) {
// check if array
if (typeof(map[i]) === OBJ_TYPE && map[i].length > 0) {
for (var j = 0; j < map[i].length; j++) {
if (util.has(map[i][j], str)) {
return (i === UNKNOWN) ? undefined : i;
}
}
} else if (util.has(map[i], str)) {
return (i === UNKNOWN) ? undefined : i;
}
}
return str;
}
};
///////////////
// String map
//////////////
var maps = {
browser : {
oldsafari : {
major : {
'1' : ['/8', '/1', '/3'],
'2' : '/4',
'?' : '/'
},
version : {
'1.0' : '/8',
'1.2' : '/1',
'1.3' : '/3',
'2.0' : '/412',
'2.0.2' : '/416',
'2.0.3' : '/417',
'2.0.4' : '/419',
'?' : '/'
}
}
},
device : {
sprint : {
model : {
'Evo Shift 4G' : '7373KT'
},
vendor : {
'HTC' : 'APA',
'Sprint' : 'Sprint'
}
}
},
os : {
windows : {
version : {
'ME' : '4.90',
'NT 3.11' : 'NT3.51',
'NT 4.0' : 'NT4.0',
'2000' : 'NT 5.0',
'XP' : ['NT 5.1', 'NT 5.2'],
'Vista' : 'NT 6.0',
'7' : 'NT 6.1',
'8' : 'NT 6.2',
'8.1' : 'NT 6.3',
'RT' : 'ARM'
}
}
}
};
//////////////
// Regex map
/////////////
var regexes = {
browser : [[
// Presto based
/(opera\smini)\/((\d+)?[\w\.-]+)/i, // Opera Mini
/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i, // Opera Mobi/Tablet
/(opera).+version\/((\d+)?[\w\.]+)/i, // Opera > 9.80
/(opera)[\/\s]+((\d+)?[\w\.]+)/i // Opera < 9.80
], [NAME, VERSION, MAJOR], [
/\s(opr)\/((\d+)?[\w\.]+)/i // Opera Webkit
], [[NAME, 'Opera'], VERSION, MAJOR], [
// Mixed
/(kindle)\/((\d+)?[\w\.]+)/i, // Kindle
/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)*/i,
// Lunascape/Maxthon/Netfront/Jasmine/Blazer
// Trident based
/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i,
// Avant/IEMobile/SlimBrowser/Baidu
/(?:ms|\()(ie)\s((\d+)?[\w\.]+)/i, // Internet Explorer
// Webkit/KHTML based
/(rekonq)((?:\/)[\w\.]+)*/i, // Rekonq
/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron)\/((\d+)?[\w\.-]+)/i
// Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron
], [NAME, VERSION, MAJOR], [
/(trident).+rv[:\s]((\d+)?[\w\.]+).+like\sgecko/i // IE11
], [[NAME, 'IE'], VERSION, MAJOR], [
/(yabrowser)\/((\d+)?[\w\.]+)/i // Yandex
], [[NAME, 'Yandex'], VERSION, MAJOR], [
/(comodo_dragon)\/((\d+)?[\w\.]+)/i // Comodo Dragon
], [[NAME, /_/g, ' '], VERSION, MAJOR], [
/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i
// Chrome/OmniWeb/Arora/Tizen/Nokia
], [NAME, VERSION, MAJOR], [
/(dolfin)\/((\d+)?[\w\.]+)/i // Dolphin
], [[NAME, 'Dolphin'], VERSION, MAJOR], [
/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i // Chrome for Android/iOS
], [[NAME, 'Chrome'], VERSION, MAJOR], [
/((?:android.+))version\/((\d+)?[\w\.]+)\smobile\ssafari/i // Android Browser
], [[NAME, 'Android Browser'], VERSION, MAJOR], [
/version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i // Mobile Safari
], [VERSION, MAJOR, [NAME, 'Mobile Safari']], [
/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i // Safari & Safari Mobile
], [VERSION, MAJOR, NAME], [
/webkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i // Safari < 3.0
], [NAME, [MAJOR, mapper.str, maps.browser.oldsafari.major], [VERSION, mapper.str, maps.browser.oldsafari.version]], [
/(konqueror)\/((\d+)?[\w\.]+)/i, // Konqueror
/(webkit|khtml)\/((\d+)?[\w\.]+)/i
], [NAME, VERSION, MAJOR], [
// Gecko based
/(navigator|netscape)\/((\d+)?[\w\.-]+)/i // Netscape
], [[NAME, 'Netscape'], VERSION, MAJOR], [
/(swiftfox)/i, // Swiftfox
/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?((\d+)?[\w\.\+]+)/i,
// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror
/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla
// Other
/(uc\s?browser|polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|qqbrowser)[\/\s]?((\d+)?[\w\.]+)/i,
// UCBrowser/Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/QQBrowser
/(links)\s\(((\d+)?[\w\.]+)/i, // Links
/(gobrowser)\/?((\d+)?[\w\.]+)*/i, // GoBrowser
/(ice\s?browser)\/v?((\d+)?[\w\._]+)/i, // ICE Browser
/(mosaic)[\/\s]((\d+)?[\w\.]+)/i // Mosaic
], [NAME, VERSION, MAJOR]
],
engine : [[
/(presto)\/([\w\.]+)/i, // Presto
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m
/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, // KHTML/Tasman/Links
/(icab)[\/\s]([23]\.[\d\.]+)/i // iCab
], [NAME, VERSION], [
/rv\:([\w\.]+).*(gecko)/i // Gecko
], [VERSION, NAME]
],
os : [[
// Windows based
/(windows)\snt\s6\.2;\s(arm)/i, // Windows RT
/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i
], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [
/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i
], [[NAME, 'Windows'], [VERSION, mapper.str, maps.os.windows.version]], [
// Mobile/Embedded OS
/\((bb)(10);/i // BlackBerry 10
], [[NAME, 'BlackBerry'], VERSION], [
/(blackberry)\w*\/?([\w\.]+)*/i, // Blackberry
/(tizen)\/([\w\.]+)/i, // Tizen
/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i
// Android/WebOS/Palm/QNX/Bada/RIM/MeeGo
], [NAME, VERSION], [
/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian
], [[NAME, 'Symbian'], VERSION],[
/mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS
], [[NAME, 'Firefox OS'], VERSION], [
// Console
/(nintendo|playstation)\s([wids3portablevu]+)/i, // Nintendo/Playstation
// GNU/Linux based
/(mint)[\/\s\(]?(\w+)*/i, // Mint
/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)[\/\s-]?([\w\.-]+)*/i,
// Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware
// Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk
/(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux
/(gnu)\s?([\w\.]+)*/i // GNU
], [NAME, VERSION], [
/(cros)\s[\w]+\s([\w\.]+\w)/i // Chromium OS
], [[NAME, 'Chromium OS'], VERSION],[
// Solaris
/(sunos)\s?([\w\.]+\d)*/i // Solaris
], [[NAME, 'Solaris'], VERSION], [
// BSD based
/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly
], [NAME, VERSION],[
/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i // iOS
], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [
/(mac\sos\sx)\s?([\w\s\.]+\w)*/i // Mac OS
], [NAME, [VERSION, /_/g, '.']], [
// Other
/(haiku)\s(\w+)/i, // Haiku
/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX
/(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos)/i,
// Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS
/(unix)\s?([\w\.]+)*/i // UNIX
], [NAME, VERSION]
]
};
/////////////////
// Constructor
////////////////
var UAParser = function (uastring) {
var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
this.getBrowser = function () {
return mapper.rgx.apply(this, regexes.browser);
};
this.getEngine = function () {
return mapper.rgx.apply(this, regexes.engine);
};
this.getOS = function () {
return mapper.rgx.apply(this, regexes.os);
};
this.getResult = function() {
return {
ua : this.getUA(),
browser : this.getBrowser(),
engine : this.getEngine(),
os : this.getOS()
};
};
this.getUA = function () {
return ua;
};
this.setUA = function (uastring) {
ua = uastring;
return this;
};
this.setUA(ua);
};
return new UAParser().getResult();
})();
function version_compare(v1, v2, operator) {
// From: http://phpjs.org/functions
// + original by: Philippe Jausions (http://pear.php.net/user/jausions)
// + original by: Aidan Lister (http://aidanlister.com/)
// + reimplemented by: Kankrelune (http://www.webfaktory.info/)
// + improved by: Brett Zamir (http://brett-zamir.me)
// + improved by: Scott Baker
// + improved by: Theriault
// * example 1: version_compare('8.2.5rc', '8.2.5a');
// * returns 1: 1
// * example 2: version_compare('8.2.50', '8.2.52', '<');
// * returns 2: true
// * example 3: version_compare('5.3.0-dev', '5.3.0');
// * returns 3: -1
// * example 4: version_compare('4.1.0.52','4.01.0.51');
// * returns 4: 1
// Important: compare must be initialized at 0.
var i = 0,
x = 0,
compare = 0,
// vm maps textual PHP versions to negatives so they're less than 0.
// PHP currently defines these as CASE-SENSITIVE. It is important to
// leave these as negatives so that they can come before numerical versions
// and as if no letters were there to begin with.
// (1alpha is < 1 and < 1.1 but > 1dev1)
// If a non-numerical value can't be mapped to this table, it receives
// -7 as its value.
vm = {
'dev': -6,
'alpha': -5,
'a': -5,
'beta': -4,
'b': -4,
'RC': -3,
'rc': -3,
'#': -2,
'p': 1,
'pl': 1
},
// This function will be called to prepare each version argument.
// It replaces every _, -, and + with a dot.
// It surrounds any nonsequence of numbers/dots with dots.
// It replaces sequences of dots with a single dot.
// version_compare('4..0', '4.0') == 0
// Important: A string of 0 length needs to be converted into a value
// even less than an unexisting value in vm (-7), hence [-8].
// It's also important to not strip spaces because of this.
// version_compare('', ' ') == 1
prepVersion = function (v) {
v = ('' + v).replace(/[_\-+]/g, '.');
v = v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.');
return (!v.length ? [-8] : v.split('.'));
},
// This converts a version component to a number.
// Empty component becomes 0.
// Non-numerical component becomes a negative number.
// Numerical component becomes itself as an integer.
numVersion = function (v) {
return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10));
};
v1 = prepVersion(v1);
v2 = prepVersion(v2);
x = Math.max(v1.length, v2.length);
for (i = 0; i < x; i++) {
if (v1[i] == v2[i]) {
continue;
}
v1[i] = numVersion(v1[i]);
v2[i] = numVersion(v2[i]);
if (v1[i] < v2[i]) {
compare = -1;
break;
} else if (v1[i] > v2[i]) {
compare = 1;
break;
}
}
if (!operator) {
return compare;
}
// Important: operator is CASE-SENSITIVE.
// "No operator" seems to be treated as "<."
// Any other values seem to make the function return null.
switch (operator) {
case '>':
case 'gt':
return (compare > 0);
case '>=':
case 'ge':
return (compare >= 0);
case '<=':
case 'le':
return (compare <= 0);
case '==':
case '=':
case 'eq':
return (compare === 0);
case '<>':
case '!=':
case 'ne':
return (compare !== 0);
case '':
case '<':
case 'lt':
return (compare < 0);
default:
return null;
}
}
var can = (function() {
var caps = {
define_property: (function() {
/* // currently too much extra code required, not exactly worth it
try { // as of IE8, getters/setters are supported only on DOM elements
var obj = {};
if (Object.defineProperty) {
Object.defineProperty(obj, 'prop', {
enumerable: true,
configurable: true
});
return true;
}
} catch(ex) {}
if (Object.prototype.__defineGetter__ && Object.prototype.__defineSetter__) {
return true;
}*/
return false;
}()),
create_canvas: (function() {
// On the S60 and BB Storm, getContext exists, but always returns undefined
// so we actually have to call getContext() to verify
// github.com/Modernizr/Modernizr/issues/issue/97/
var el = document.createElement('canvas');
return !!(el.getContext && el.getContext('2d'));
}()),
return_response_type: function(responseType) {
try {
if (Basic.inArray(responseType, ['', 'text', 'document']) !== -1) {
return true;
} else if (window.XMLHttpRequest) {
var xhr = new XMLHttpRequest();
xhr.open('get', '/'); // otherwise Gecko throws an exception
if ('responseType' in xhr) {
xhr.responseType = responseType;
// as of 23.0.1271.64, Chrome switched from throwing exception to merely logging it to the console (why? o why?)
if (xhr.responseType !== responseType) {
return false;
}
return true;
}
}
} catch (ex) {}
return false;
},
// ideas for this heavily come from Modernizr (http://modernizr.com/)
use_data_uri: (function() {
var du = new Image();
du.onload = function() {
caps.use_data_uri = (du.width === 1 && du.height === 1);
};
setTimeout(function() {
du.src = "data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==";
}, 1);
return false;
}()),
use_data_uri_over32kb: function() { // IE8
return caps.use_data_uri && (Env.browser !== 'IE' || Env.version >= 9);
},
use_data_uri_of: function(bytes) {
return (caps.use_data_uri && bytes < 33000 || caps.use_data_uri_over32kb());
},
use_fileinput: function() {
var el = document.createElement('input');
el.setAttribute('type', 'file');
return !el.disabled;
}
};
return function(cap) {
var args = [].slice.call(arguments);
args.shift(); // shift of cap
return Basic.typeOf(caps[cap]) === 'function' ? caps[cap].apply(this, args) : !!caps[cap];
};
}());
var Env = {
can: can,
browser: UAParser.browser.name,
version: parseFloat(UAParser.browser.major),
os: UAParser.os.name, // everybody intuitively types it in a lowercase for some reason
osVersion: UAParser.os.version,
verComp: version_compare,
swf_url: "../flash/Moxie.swf",
xap_url: "../silverlight/Moxie.xap",
global_event_dispatcher: "moxie.core.EventTarget.instance.dispatchEvent"
};
// for backward compatibility
// @deprecated Use `Env.os` instead
Env.OS = Env.os;
return Env;
});
// Included from: src/javascript/core/utils/Dom.js
/**
* Dom.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Dom', ['moxie/core/utils/Env'], function(Env) {
/**
Get DOM Element by it's id.
@method get
@for Utils
@param {String} id Identifier of the DOM Element
@return {DOMElement}
*/
var get = function(id) {
if (typeof id !== 'string') {
return id;
}
return document.getElementById(id);
};
/**
Checks if specified DOM element has specified class.
@method hasClass
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Class name
*/
var hasClass = function(obj, name) {
if (!obj.className) {
return false;
}
var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)");
return regExp.test(obj.className);
};
/**
Adds specified className to specified DOM element.
@method addClass
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Class name
*/
var addClass = function(obj, name) {
if (!hasClass(obj, name)) {
obj.className = !obj.className ? name : obj.className.replace(/\s+$/, '') + ' ' + name;
}
};
/**
Removes specified className from specified DOM element.
@method removeClass
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Class name
*/
var removeClass = function(obj, name) {
if (obj.className) {
var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)");
obj.className = obj.className.replace(regExp, function($0, $1, $2) {
return $1 === ' ' && $2 === ' ' ? ' ' : '';
});
}
};
/**
Returns a given computed style of a DOM element.
@method getStyle
@static
@param {Object} obj DOM element like object.
@param {String} name Style you want to get from the DOM element
*/
var getStyle = function(obj, name) {
if (obj.currentStyle) {
return obj.currentStyle[name];
} else if (window.getComputedStyle) {
return window.getComputedStyle(obj, null)[name];
}
};
/**
Returns the absolute x, y position of an Element. The position will be returned in a object with x, y fields.
@method getPos
@static
@param {Element} node HTML element or element id to get x, y position from.
@param {Element} root Optional root element to stop calculations at.
@return {object} Absolute position of the specified element object with x, y fields.
*/
var getPos = function(node, root) {
var x = 0, y = 0, parent, doc = document, nodeRect, rootRect;
node = node;
root = root || doc.body;
// Returns the x, y cordinate for an element on IE 6 and IE 7
function getIEPos(node) {
var bodyElm, rect, x = 0, y = 0;
if (node) {
rect = node.getBoundingClientRect();
bodyElm = doc.compatMode === "CSS1Compat" ? doc.documentElement : doc.body;
x = rect.left + bodyElm.scrollLeft;
y = rect.top + bodyElm.scrollTop;
}
return {
x : x,
y : y
};
}
// Use getBoundingClientRect on IE 6 and IE 7 but not on IE 8 in standards mode
if (node && node.getBoundingClientRect && Env.browser === 'IE' && (!doc.documentMode || doc.documentMode < 8)) {
nodeRect = getIEPos(node);
rootRect = getIEPos(root);
return {
x : nodeRect.x - rootRect.x,
y : nodeRect.y - rootRect.y
};
}
parent = node;
while (parent && parent != root && parent.nodeType) {
x += parent.offsetLeft || 0;
y += parent.offsetTop || 0;
parent = parent.offsetParent;
}
parent = node.parentNode;
while (parent && parent != root && parent.nodeType) {
x -= parent.scrollLeft || 0;
y -= parent.scrollTop || 0;
parent = parent.parentNode;
}
return {
x : x,
y : y
};
};
/**
Returns the size of the specified node in pixels.
@method getSize
@static
@param {Node} node Node to get the size of.
@return {Object} Object with a w and h property.
*/
var getSize = function(node) {
return {
w : node.offsetWidth || node.clientWidth,
h : node.offsetHeight || node.clientHeight
};
};
return {
get: get,
hasClass: hasClass,
addClass: addClass,
removeClass: removeClass,
getStyle: getStyle,
getPos: getPos,
getSize: getSize
};
});
// Included from: src/javascript/core/Exceptions.js
/**
* Exceptions.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/Exceptions', [
'moxie/core/utils/Basic'
], function(Basic) {
function _findKey(obj, value) {
var key;
for (key in obj) {
if (obj[key] === value) {
return key;
}
}
return null;
}
return {
RuntimeError: (function() {
var namecodes = {
NOT_INIT_ERR: 1,
NOT_SUPPORTED_ERR: 9,
JS_ERR: 4
};
function RuntimeError(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": RuntimeError " + this.code;
}
Basic.extend(RuntimeError, namecodes);
RuntimeError.prototype = Error.prototype;
return RuntimeError;
}()),
OperationNotAllowedException: (function() {
function OperationNotAllowedException(code) {
this.code = code;
this.name = 'OperationNotAllowedException';
}
Basic.extend(OperationNotAllowedException, {
NOT_ALLOWED_ERR: 1
});
OperationNotAllowedException.prototype = Error.prototype;
return OperationNotAllowedException;
}()),
ImageError: (function() {
var namecodes = {
WRONG_FORMAT: 1,
MAX_RESOLUTION_ERR: 2
};
function ImageError(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": ImageError " + this.code;
}
Basic.extend(ImageError, namecodes);
ImageError.prototype = Error.prototype;
return ImageError;
}()),
FileException: (function() {
var namecodes = {
NOT_FOUND_ERR: 1,
SECURITY_ERR: 2,
ABORT_ERR: 3,
NOT_READABLE_ERR: 4,
ENCODING_ERR: 5,
NO_MODIFICATION_ALLOWED_ERR: 6,
INVALID_STATE_ERR: 7,
SYNTAX_ERR: 8
};
function FileException(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": FileException " + this.code;
}
Basic.extend(FileException, namecodes);
FileException.prototype = Error.prototype;
return FileException;
}()),
DOMException: (function() {
var namecodes = {
INDEX_SIZE_ERR: 1,
DOMSTRING_SIZE_ERR: 2,
HIERARCHY_REQUEST_ERR: 3,
WRONG_DOCUMENT_ERR: 4,
INVALID_CHARACTER_ERR: 5,
NO_DATA_ALLOWED_ERR: 6,
NO_MODIFICATION_ALLOWED_ERR: 7,
NOT_FOUND_ERR: 8,
NOT_SUPPORTED_ERR: 9,
INUSE_ATTRIBUTE_ERR: 10,
INVALID_STATE_ERR: 11,
SYNTAX_ERR: 12,
INVALID_MODIFICATION_ERR: 13,
NAMESPACE_ERR: 14,
INVALID_ACCESS_ERR: 15,
VALIDATION_ERR: 16,
TYPE_MISMATCH_ERR: 17,
SECURITY_ERR: 18,
NETWORK_ERR: 19,
ABORT_ERR: 20,
URL_MISMATCH_ERR: 21,
QUOTA_EXCEEDED_ERR: 22,
TIMEOUT_ERR: 23,
INVALID_NODE_TYPE_ERR: 24,
DATA_CLONE_ERR: 25
};
function DOMException(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": DOMException " + this.code;
}
Basic.extend(DOMException, namecodes);
DOMException.prototype = Error.prototype;
return DOMException;
}()),
EventException: (function() {
function EventException(code) {
this.code = code;
this.name = 'EventException';
}
Basic.extend(EventException, {
UNSPECIFIED_EVENT_TYPE_ERR: 0
});
EventException.prototype = Error.prototype;
return EventException;
}())
};
});
// Included from: src/javascript/core/EventTarget.js
/**
* EventTarget.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/EventTarget', [
'moxie/core/Exceptions',
'moxie/core/utils/Basic'
], function(x, Basic) {
/**
Parent object for all event dispatching components and objects
@class EventTarget
@constructor EventTarget
*/
function EventTarget() {
// hash of event listeners by object uid
var eventpool = {};
Basic.extend(this, {
/**
Unique id of the event dispatcher, usually overriden by children
@property uid
@type String
*/
uid: null,
/**
Can be called from within a child in order to acquire uniqie id in automated manner
@method init
*/
init: function() {
if (!this.uid) {
this.uid = Basic.guid('uid_');
}
},
/**
Register a handler to a specific event dispatched by the object
@method addEventListener
@param {String} type Type or basically a name of the event to subscribe to
@param {Function} fn Callback function that will be called when event happens
@param {Number} [priority=0] Priority of the event handler - handlers with higher priorities will be called first
@param {Object} [scope=this] A scope to invoke event handler in
*/
addEventListener: function(type, fn, priority, scope) {
var self = this, list;
type = Basic.trim(type);
if (/\s/.test(type)) {
// multiple event types were passed for one handler
Basic.each(type.split(/\s+/), function(type) {
self.addEventListener(type, fn, priority, scope);
});
return;
}
type = type.toLowerCase();
priority = parseInt(priority, 10) || 0;
list = eventpool[this.uid] && eventpool[this.uid][type] || [];
list.push({fn : fn, priority : priority, scope : scope || this});
if (!eventpool[this.uid]) {
eventpool[this.uid] = {};
}
eventpool[this.uid][type] = list;
},
/**
Check if any handlers were registered to the specified event
@method hasEventListener
@param {String} type Type or basically a name of the event to check
@return {Mixed} Returns a handler if it was found and false, if - not
*/
hasEventListener: function(type) {
return type ? !!(eventpool[this.uid] && eventpool[this.uid][type]) : !!eventpool[this.uid];
},
/**
Unregister the handler from the event, or if former was not specified - unregister all handlers
@method removeEventListener
@param {String} type Type or basically a name of the event
@param {Function} [fn] Handler to unregister
*/
removeEventListener: function(type, fn) {
type = type.toLowerCase();
var list = eventpool[this.uid] && eventpool[this.uid][type], i;
if (list) {
if (fn) {
for (i = list.length - 1; i >= 0; i--) {
if (list[i].fn === fn) {
list.splice(i, 1);
break;
}
}
} else {
list = [];
}
// delete event list if it has become empty
if (!list.length) {
delete eventpool[this.uid][type];
// and object specific entry in a hash if it has no more listeners attached
if (Basic.isEmptyObj(eventpool[this.uid])) {
delete eventpool[this.uid];
}
}
}
},
/**
Remove all event handlers from the object
@method removeAllEventListeners
*/
removeAllEventListeners: function() {
if (eventpool[this.uid]) {
delete eventpool[this.uid];
}
},
/**
Dispatch the event
@method dispatchEvent
@param {String/Object} Type of event or event object to dispatch
@param {Mixed} [...] Variable number of arguments to be passed to a handlers
@return {Boolean} true by default and false if any handler returned false
*/
dispatchEvent: function(type) {
var uid, list, args, tmpEvt, evt = {}, result = true, undef;
if (Basic.typeOf(type) !== 'string') {
// we can't use original object directly (because of Silverlight)
tmpEvt = type;
if (Basic.typeOf(tmpEvt.type) === 'string') {
type = tmpEvt.type;
if (tmpEvt.total !== undef && tmpEvt.loaded !== undef) { // progress event
evt.total = tmpEvt.total;
evt.loaded = tmpEvt.loaded;
}
evt.async = tmpEvt.async || false;
} else {
throw new x.EventException(x.EventException.UNSPECIFIED_EVENT_TYPE_ERR);
}
}
// check if event is meant to be dispatched on an object having specific uid
if (type.indexOf('::') !== -1) {
(function(arr) {
uid = arr[0];
type = arr[1];
}(type.split('::')));
} else {
uid = this.uid;
}
type = type.toLowerCase();
list = eventpool[uid] && eventpool[uid][type];
if (list) {
// sort event list by prority
list.sort(function(a, b) { return b.priority - a.priority; });
args = [].slice.call(arguments);
// first argument will be pseudo-event object
args.shift();
evt.type = type;
args.unshift(evt);
// Dispatch event to all listeners
var queue = [];
Basic.each(list, function(handler) {
// explicitly set the target, otherwise events fired from shims do not get it
args[0].target = handler.scope;
// if event is marked as async, detach the handler
if (evt.async) {
queue.push(function(cb) {
setTimeout(function() {
cb(handler.fn.apply(handler.scope, args) === false);
}, 1);
});
} else {
queue.push(function(cb) {
cb(handler.fn.apply(handler.scope, args) === false); // if handler returns false stop propagation
});
}
});
if (queue.length) {
Basic.inSeries(queue, function(err) {
result = !err;
});
}
}
return result;
},
/**
Alias for addEventListener
@method bind
@protected
*/
bind: function() {
this.addEventListener.apply(this, arguments);
},
/**
Alias for removeEventListener
@method unbind
@protected
*/
unbind: function() {
this.removeEventListener.apply(this, arguments);
},
/**
Alias for removeAllEventListeners
@method unbindAll
@protected
*/
unbindAll: function() {
this.removeAllEventListeners.apply(this, arguments);
},
/**
Alias for dispatchEvent
@method trigger
@protected
*/
trigger: function() {
return this.dispatchEvent.apply(this, arguments);
},
/**
Converts properties of on[event] type to corresponding event handlers,
is used to avoid extra hassle around the process of calling them back
@method convertEventPropsToHandlers
@private
*/
convertEventPropsToHandlers: function(handlers) {
var h;
if (Basic.typeOf(handlers) !== 'array') {
handlers = [handlers];
}
for (var i = 0; i < handlers.length; i++) {
h = 'on' + handlers[i];
if (Basic.typeOf(this[h]) === 'function') {
this.addEventListener(handlers[i], this[h]);
} else if (Basic.typeOf(this[h]) === 'undefined') {
this[h] = null; // object must have defined event properties, even if it doesn't make use of them
}
}
}
});
}
EventTarget.instance = new EventTarget();
return EventTarget;
});
// Included from: src/javascript/core/utils/Encode.js
/**
* Encode.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Encode', [], function() {
/**
Encode string with UTF-8
@method utf8_encode
@for Utils
@static
@param {String} str String to encode
@return {String} UTF-8 encoded string
*/
var utf8_encode = function(str) {
return unescape(encodeURIComponent(str));
};
/**
Decode UTF-8 encoded string
@method utf8_decode
@static
@param {String} str String to decode
@return {String} Decoded string
*/
var utf8_decode = function(str_data) {
return decodeURIComponent(escape(str_data));
};
/**
Decode Base64 encoded string (uses browser's default method if available),
from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_decode.js
@method atob
@static
@param {String} data String to decode
@return {String} Decoded string
*/
var atob = function(data, utf8) {
if (typeof(window.atob) === 'function') {
return utf8 ? utf8_decode(window.atob(data)) : window.atob(data);
}
// http://kevin.vanzonneveld.net
// + original by: Tyler Akins (http://rumkin.com)
// + improved by: Thunder.m
// + input by: Aman Gupta
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Onno Marsman
// + bugfixed by: Pellentesque Malesuada
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// * example 1: base64_decode('S2V2aW4gdmFuIFpvbm5ldmVsZA==');
// * returns 1: 'Kevin van Zonneveld'
// mozilla has this native
// - but breaks in 2.0.0.12!
//if (typeof this.window.atob == 'function') {
// return atob(data);
//}
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
ac = 0,
dec = "",
tmp_arr = [];
if (!data) {
return data;
}
data += '';
do { // unpack four hexets into three octets using index points in b64
h1 = b64.indexOf(data.charAt(i++));
h2 = b64.indexOf(data.charAt(i++));
h3 = b64.indexOf(data.charAt(i++));
h4 = b64.indexOf(data.charAt(i++));
bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;
o1 = bits >> 16 & 0xff;
o2 = bits >> 8 & 0xff;
o3 = bits & 0xff;
if (h3 == 64) {
tmp_arr[ac++] = String.fromCharCode(o1);
} else if (h4 == 64) {
tmp_arr[ac++] = String.fromCharCode(o1, o2);
} else {
tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);
}
} while (i < data.length);
dec = tmp_arr.join('');
return utf8 ? utf8_decode(dec) : dec;
};
/**
Base64 encode string (uses browser's default method if available),
from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_encode.js
@method btoa
@static
@param {String} data String to encode
@return {String} Base64 encoded string
*/
var btoa = function(data, utf8) {
if (utf8) {
utf8_encode(data);
}
if (typeof(window.btoa) === 'function') {
return window.btoa(data);
}
// http://kevin.vanzonneveld.net
// + original by: Tyler Akins (http://rumkin.com)
// + improved by: Bayron Guevara
// + improved by: Thunder.m
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Pellentesque Malesuada
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Rafał Kukawski (http://kukawski.pl)
// * example 1: base64_encode('Kevin van Zonneveld');
// * returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA=='
// mozilla has this native
// - but breaks in 2.0.0.12!
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
ac = 0,
enc = "",
tmp_arr = [];
if (!data) {
return data;
}
do { // pack three octets into four hexets
o1 = data.charCodeAt(i++);
o2 = data.charCodeAt(i++);
o3 = data.charCodeAt(i++);
bits = o1 << 16 | o2 << 8 | o3;
h1 = bits >> 18 & 0x3f;
h2 = bits >> 12 & 0x3f;
h3 = bits >> 6 & 0x3f;
h4 = bits & 0x3f;
// use hexets to index into b64, and append result to encoded string
tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
} while (i < data.length);
enc = tmp_arr.join('');
var r = data.length % 3;
return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);
};
return {
utf8_encode: utf8_encode,
utf8_decode: utf8_decode,
atob: atob,
btoa: btoa
};
});
// Included from: src/javascript/runtime/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/runtime/Runtime', [
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/EventTarget"
], function(Basic, Dom, EventTarget) {
var runtimeConstructors = {}, runtimes = {};
/**
Common set of methods and properties for every runtime instance
@class Runtime
@param {Object} options
@param {String} type Sanitized name of the runtime
@param {Object} [caps] Set of capabilities that differentiate specified runtime
@param {Object} [modeCaps] Set of capabilities that do require specific operational mode
@param {String} [preferredMode='browser'] Preferred operational mode to choose if no required capabilities were requested
*/
function Runtime(options, type, caps, modeCaps, preferredMode) {
/**
Dispatched when runtime is initialized and ready.
Results in RuntimeInit on a connected component.
@event Init
*/
/**
Dispatched when runtime fails to initialize.
Results in RuntimeError on a connected component.
@event Error
*/
var self = this
, _shim
, _uid = Basic.guid(type + '_')
, defaultMode = preferredMode || 'browser'
;
options = options || {};
// register runtime in private hash
runtimes[_uid] = this;
/**
Default set of capabilities, which can be redifined later by specific runtime
@private
@property caps
@type Object
*/
caps = Basic.extend({
// Runtime can:
// provide access to raw binary data of the file
access_binary: false,
// provide access to raw binary data of the image (image extension is optional)
access_image_binary: false,
// display binary data as thumbs for example
display_media: false,
// make cross-domain requests
do_cors: false,
// accept files dragged and dropped from the desktop
drag_and_drop: false,
// filter files in selection dialog by their extensions
filter_by_extension: true,
// resize image (and manipulate it raw data of any file in general)
resize_image: false,
// periodically report how many bytes of total in the file were uploaded (loaded)
report_upload_progress: false,
// provide access to the headers of http response
return_response_headers: false,
// support response of specific type, which should be passed as an argument
// e.g. runtime.can('return_response_type', 'blob')
return_response_type: false,
// return http status code of the response
return_status_code: true,
// send custom http header with the request
send_custom_headers: false,
// pick up the files from a dialog
select_file: false,
// select whole folder in file browse dialog
select_folder: false,
// select multiple files at once in file browse dialog
select_multiple: true,
// send raw binary data, that is generated after image resizing or manipulation of other kind
send_binary_string: false,
// send cookies with http request and therefore retain session
send_browser_cookies: true,
// send data formatted as multipart/form-data
send_multipart: true,
// slice the file or blob to smaller parts
slice_blob: false,
// upload file without preloading it to memory, stream it out directly from disk
stream_upload: false,
// programmatically trigger file browse dialog
summon_file_dialog: false,
// upload file of specific size, size should be passed as argument
// e.g. runtime.can('upload_filesize', '500mb')
upload_filesize: true,
// initiate http request with specific http method, method should be passed as argument
// e.g. runtime.can('use_http_method', 'put')
use_http_method: true
}, caps);
// default to the mode that is compatible with preferred caps
if (options.preferred_caps) {
defaultMode = Runtime.getMode(modeCaps, options.preferred_caps, defaultMode);
}
// small extension factory here (is meant to be extended with actual extensions constructors)
_shim = (function() {
var objpool = {};
return {
exec: function(uid, comp, fn, args) {
if (_shim[comp]) {
if (!objpool[uid]) {
objpool[uid] = {
context: this,
instance: new _shim[comp]()
};
}
if (objpool[uid].instance[fn]) {
return objpool[uid].instance[fn].apply(this, args);
}
}
},
removeInstance: function(uid) {
delete objpool[uid];
},
removeAllInstances: function() {
var self = this;
Basic.each(objpool, function(obj, uid) {
if (Basic.typeOf(obj.instance.destroy) === 'function') {
obj.instance.destroy.call(obj.context);
}
self.removeInstance(uid);
});
}
};
}());
// public methods
Basic.extend(this, {
/**
Specifies whether runtime instance was initialized or not
@property initialized
@type {Boolean}
@default false
*/
initialized: false, // shims require this flag to stop initialization retries
/**
Unique ID of the runtime
@property uid
@type {String}
*/
uid: _uid,
/**
Runtime type (e.g. flash, html5, etc)
@property type
@type {String}
*/
type: type,
/**
Runtime (not native one) may operate in browser or client mode.
@property mode
@private
@type {String|Boolean} current mode or false, if none possible
*/
mode: Runtime.getMode(modeCaps, (options.required_caps), defaultMode),
/**
id of the DOM container for the runtime (if available)
@property shimid
@type {String}
*/
shimid: _uid + '_container',
/**
Number of connected clients. If equal to zero, runtime can be destroyed
@property clients
@type {Number}
*/
clients: 0,
/**
Runtime initialization options
@property options
@type {Object}
*/
options: options,
/**
Checks if the runtime has specific capability
@method can
@param {String} cap Name of capability to check
@param {Mixed} [value] If passed, capability should somehow correlate to the value
@param {Object} [refCaps] Set of capabilities to check the specified cap against (defaults to internal set)
@return {Boolean} true if runtime has such capability and false, if - not
*/
can: function(cap, value) {
var refCaps = arguments[2] || caps;
// if cap var is a comma-separated list of caps, convert it to object (key/value)
if (Basic.typeOf(cap) === 'string' && Basic.typeOf(value) === 'undefined') {
cap = Runtime.parseCaps(cap);
}
if (Basic.typeOf(cap) === 'object') {
for (var key in cap) {
if (!this.can(key, cap[key], refCaps)) {
return false;
}
}
return true;
}
// check the individual cap
if (Basic.typeOf(refCaps[cap]) === 'function') {
return refCaps[cap].call(this, value);
} else {
return (value === refCaps[cap]);
}
},
/**
Returns container for the runtime as DOM element
@method getShimContainer
@return {DOMElement}
*/
getShimContainer: function() {
var container, shimContainer = Dom.get(this.shimid);
// if no container for shim, create one
if (!shimContainer) {
container = this.options.container ? Dom.get(this.options.container) : document.body;
// create shim container and insert it at an absolute position into the outer container
shimContainer = document.createElement('div');
shimContainer.id = this.shimid;
shimContainer.className = 'moxie-shim moxie-shim-' + this.type;
Basic.extend(shimContainer.style, {
position: 'absolute',
top: '0px',
left: '0px',
width: '1px',
height: '1px',
overflow: 'hidden'
});
container.appendChild(shimContainer);
container = null;
}
return shimContainer;
},
/**
Returns runtime as DOM element (if appropriate)
@method getShim
@return {DOMElement}
*/
getShim: function() {
return _shim;
},
/**
Invokes a method within the runtime itself (might differ across the runtimes)
@method shimExec
@param {Mixed} []
@protected
@return {Mixed} Depends on the action and component
*/
shimExec: function(component, action) {
var args = [].slice.call(arguments, 2);
return self.getShim().exec.call(this, this.uid, component, action, args);
},
/**
Operaional interface that is used by components to invoke specific actions on the runtime
(is invoked in the scope of component)
@method exec
@param {Mixed} []*
@protected
@return {Mixed} Depends on the action and component
*/
exec: function(component, action) { // this is called in the context of component, not runtime
var args = [].slice.call(arguments, 2);
if (self[component] && self[component][action]) {
return self[component][action].apply(this, args);
}
return self.shimExec.apply(this, arguments);
},
/**
Destroys the runtime (removes all events and deletes DOM structures)
@method destroy
*/
destroy: function() {
if (!self) {
return; // obviously already destroyed
}
var shimContainer = Dom.get(this.shimid);
if (shimContainer) {
shimContainer.parentNode.removeChild(shimContainer);
}
if (_shim) {
_shim.removeAllInstances();
}
this.unbindAll();
delete runtimes[this.uid];
this.uid = null; // mark this runtime as destroyed
_uid = self = _shim = shimContainer = null;
}
});
// once we got the mode, test against all caps
if (this.mode && options.required_caps && !this.can(options.required_caps)) {
this.mode = false;
}
}
/**
Default order to try different runtime types
@property order
@type String
@static
*/
Runtime.order = 'html5,flash,silverlight,html4';
/**
Retrieves runtime from private hash by it's uid
@method getRuntime
@private
@static
@param {String} uid Unique identifier of the runtime
@return {Runtime|Boolean} Returns runtime, if it exists and false, if - not
*/
Runtime.getRuntime = function(uid) {
return runtimes[uid] ? runtimes[uid] : false;
};
/**
Register constructor for the Runtime of new (or perhaps modified) type
@method addConstructor
@static
@param {String} type Runtime type (e.g. flash, html5, etc)
@param {Function} construct Constructor for the Runtime type
*/
Runtime.addConstructor = function(type, constructor) {
constructor.prototype = EventTarget.instance;
runtimeConstructors[type] = constructor;
};
/**
Get the constructor for the specified type.
method getConstructor
@static
@param {String} type Runtime type (e.g. flash, html5, etc)
@return {Function} Constructor for the Runtime type
*/
Runtime.getConstructor = function(type) {
return runtimeConstructors[type] || null;
};
/**
Get info about the runtime (uid, type, capabilities)
@method getInfo
@static
@param {String} uid Unique identifier of the runtime
@return {Mixed} Info object or null if runtime doesn't exist
*/
Runtime.getInfo = function(uid) {
var runtime = Runtime.getRuntime(uid);
if (runtime) {
return {
uid: runtime.uid,
type: runtime.type,
mode: runtime.mode,
can: function() {
return runtime.can.apply(runtime, arguments);
}
};
}
return null;
};
/**
Convert caps represented by a comma-separated string to the object representation.
@method parseCaps
@static
@param {String} capStr Comma-separated list of capabilities
@return {Object}
*/
Runtime.parseCaps = function(capStr) {
var capObj = {};
if (Basic.typeOf(capStr) !== 'string') {
return capStr || {};
}
Basic.each(capStr.split(','), function(key) {
capObj[key] = true; // we assume it to be - true
});
return capObj;
};
/**
Test the specified runtime for specific capabilities.
@method can
@static
@param {String} type Runtime type (e.g. flash, html5, etc)
@param {String|Object} caps Set of capabilities to check
@return {Boolean} Result of the test
*/
Runtime.can = function(type, caps) {
var runtime
, constructor = Runtime.getConstructor(type)
, mode
;
if (constructor) {
runtime = new constructor({
required_caps: caps
});
mode = runtime.mode;
runtime.destroy();
return !!mode;
}
return false;
};
/**
Figure out a runtime that supports specified capabilities.
@method thatCan
@static
@param {String|Object} caps Set of capabilities to check
@param {String} [runtimeOrder] Comma-separated list of runtimes to check against
@return {String} Usable runtime identifier or null
*/
Runtime.thatCan = function(caps, runtimeOrder) {
var types = (runtimeOrder || Runtime.order).split(/\s*,\s*/);
for (var i in types) {
if (Runtime.can(types[i], caps)) {
return types[i];
}
}
return null;
};
/**
Figure out an operational mode for the specified set of capabilities.
@method getMode
@static
@param {Object} modeCaps Set of capabilities that depend on particular runtime mode
@param {Object} [requiredCaps] Supplied set of capabilities to find operational mode for
@param {String|Boolean} [defaultMode='browser'] Default mode to use
@return {String|Boolean} Compatible operational mode
*/
Runtime.getMode = function(modeCaps, requiredCaps, defaultMode) {
var mode = null;
if (Basic.typeOf(defaultMode) === 'undefined') { // only if not specified
defaultMode = 'browser';
}
if (requiredCaps && !Basic.isEmptyObj(modeCaps)) {
// loop over required caps and check if they do require the same mode
Basic.each(requiredCaps, function(value, cap) {
if (modeCaps.hasOwnProperty(cap)) {
var capMode = modeCaps[cap](value);
// make sure we always have an array
if (typeof(capMode) === 'string') {
capMode = [capMode];
}
if (!mode) {
mode = capMode;
} else if (!(mode = Basic.arrayIntersect(mode, capMode))) {
// if cap requires conflicting mode - runtime cannot fulfill required caps
return (mode = false);
}
}
});
if (mode) {
return Basic.inArray(defaultMode, mode) !== -1 ? defaultMode : mode[0];
} else if (mode === false) {
return false;
}
}
return defaultMode;
};
/**
Capability check that always returns true
@private
@static
@return {True}
*/
Runtime.capTrue = function() {
return true;
};
/**
Capability check that always returns false
@private
@static
@return {False}
*/
Runtime.capFalse = function() {
return false;
};
/**
Evaluate the expression to boolean value and create a function that always returns it.
@private
@static
@param {Mixed} expr Expression to evaluate
@return {Function} Function returning the result of evaluation
*/
Runtime.capTest = function(expr) {
return function() {
return !!expr;
};
};
return Runtime;
});
// Included from: src/javascript/runtime/RuntimeClient.js
/**
* RuntimeClient.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/runtime/RuntimeClient', [
'moxie/core/Exceptions',
'moxie/core/utils/Basic',
'moxie/runtime/Runtime'
], function(x, Basic, Runtime) {
/**
Set of methods and properties, required by a component to acquire ability to connect to a runtime
@class RuntimeClient
*/
return function RuntimeClient() {
var runtime;
Basic.extend(this, {
/**
Connects to the runtime specified by the options. Will either connect to existing runtime or create a new one.
Increments number of clients connected to the specified runtime.
@method connectRuntime
@param {Mixed} options Can be a runtme uid or a set of key-value pairs defining requirements and pre-requisites
*/
connectRuntime: function(options) {
var comp = this, ruid;
function initialize(items) {
var type, constructor;
// if we ran out of runtimes
if (!items.length) {
comp.trigger('RuntimeError', new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));
runtime = null;
return;
}
type = items.shift();
constructor = Runtime.getConstructor(type);
if (!constructor) {
initialize(items);
return;
}
// try initializing the runtime
runtime = new constructor(options);
runtime.bind('Init', function() {
// mark runtime as initialized
runtime.initialized = true;
// jailbreak ...
setTimeout(function() {
runtime.clients++;
// this will be triggered on component
comp.trigger('RuntimeInit', runtime);
}, 1);
});
runtime.bind('Error', function() {
runtime.destroy(); // runtime cannot destroy itself from inside at a right moment, thus we do it here
initialize(items);
});
/*runtime.bind('Exception', function() { });*/
// check if runtime managed to pick-up operational mode
if (!runtime.mode) {
runtime.trigger('Error');
return;
}
runtime.init();
}
// check if a particular runtime was requested
if (Basic.typeOf(options) === 'string') {
ruid = options;
} else if (Basic.typeOf(options.ruid) === 'string') {
ruid = options.ruid;
}
if (ruid) {
runtime = Runtime.getRuntime(ruid);
if (runtime) {
runtime.clients++;
return runtime;
} else {
// there should be a runtime and there's none - weird case
throw new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR);
}
}
// initialize a fresh one, that fits runtime list and required features best
initialize((options.runtime_order || Runtime.order).split(/\s*,\s*/));
},
/**
Returns the runtime to which the client is currently connected.
@method getRuntime
@return {Runtime} Runtime or null if client is not connected
*/
getRuntime: function() {
if (runtime && runtime.uid) {
return runtime;
}
runtime = null; // make sure we do not leave zombies rambling around
return null;
},
/**
Disconnects from the runtime. Decrements number of clients connected to the specified runtime.
@method disconnectRuntime
*/
disconnectRuntime: function() {
if (runtime && --runtime.clients <= 0) {
runtime.destroy();
runtime = null;
}
}
});
};
});
// Included from: src/javascript/file/Blob.js
/**
* Blob.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/Blob', [
'moxie/core/utils/Basic',
'moxie/core/utils/Encode',
'moxie/runtime/RuntimeClient'
], function(Basic, Encode, RuntimeClient) {
var blobpool = {};
/**
@class Blob
@constructor
@param {String} ruid Unique id of the runtime, to which this blob belongs to
@param {Object} blob Object "Native" blob object, as it is represented in the runtime
*/
function Blob(ruid, blob) {
function _sliceDetached(start, end, type) {
var blob, data = blobpool[this.uid];
if (Basic.typeOf(data) !== 'string' || !data.length) {
return null; // or throw exception
}
blob = new Blob(null, {
type: type,
size: end - start
});
blob.detach(data.substr(start, blob.size));
return blob;
}
RuntimeClient.call(this);
if (ruid) {
this.connectRuntime(ruid);
}
if (!blob) {
blob = {};
} else if (Basic.typeOf(blob) === 'string') { // dataUrl or binary string
blob = { data: blob };
}
Basic.extend(this, {
/**
Unique id of the component
@property uid
@type {String}
*/
uid: blob.uid || Basic.guid('uid_'),
/**
Unique id of the connected runtime, if falsy, then runtime will have to be initialized
before this Blob can be used, modified or sent
@property ruid
@type {String}
*/
ruid: ruid,
/**
Size of blob
@property size
@type {Number}
@default 0
*/
size: blob.size || 0,
/**
Mime type of blob
@property type
@type {String}
@default ''
*/
type: blob.type || '',
/**
@method slice
@param {Number} [start=0]
*/
slice: function(start, end, type) {
if (this.isDetached()) {
return _sliceDetached.apply(this, arguments);
}
return this.getRuntime().exec.call(this, 'Blob', 'slice', this.getSource(), start, end, type);
},
/**
Returns "native" blob object (as it is represented in connected runtime) or null if not found
@method getSource
@return {Blob} Returns "native" blob object or null if not found
*/
getSource: function() {
if (!blobpool[this.uid]) {
return null;
}
return blobpool[this.uid];
},
/**
Detaches blob from any runtime that it depends on and initialize with standalone value
@method detach
@protected
@param {DOMString} [data=''] Standalone value
*/
detach: function(data) {
if (this.ruid) {
this.getRuntime().exec.call(this, 'Blob', 'destroy');
this.disconnectRuntime();
this.ruid = null;
}
data = data || '';
// if dataUrl, convert to binary string
var matches = data.match(/^data:([^;]*);base64,/);
if (matches) {
this.type = matches[1];
data = Encode.atob(data.substring(data.indexOf('base64,') + 7));
}
this.size = data.length;
blobpool[this.uid] = data;
},
/**
Checks if blob is standalone (detached of any runtime)
@method isDetached
@protected
@return {Boolean}
*/
isDetached: function() {
return !this.ruid && Basic.typeOf(blobpool[this.uid]) === 'string';
},
/**
Destroy Blob and free any resources it was using
@method destroy
*/
destroy: function() {
this.detach();
delete blobpool[this.uid];
}
});
if (blob.data) {
this.detach(blob.data); // auto-detach if payload has been passed
} else {
blobpool[this.uid] = blob;
}
}
return Blob;
});
// Included from: src/javascript/file/File.js
/**
* File.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/File', [
'moxie/core/utils/Basic',
'moxie/core/utils/Mime',
'moxie/file/Blob'
], function(Basic, Mime, Blob) {
/**
@class File
@extends Blob
@constructor
@param {String} ruid Unique id of the runtime, to which this blob belongs to
@param {Object} file Object "Native" file object, as it is represented in the runtime
*/
function File(ruid, file) {
var name, type;
if (!file) { // avoid extra errors in case we overlooked something
file = {};
}
// figure out the type
if (file.type && file.type !== '') {
type = file.type;
} else {
type = Mime.getFileMime(file.name);
}
// sanitize file name or generate new one
if (file.name) {
name = file.name.replace(/\\/g, '/');
name = name.substr(name.lastIndexOf('/') + 1);
} else {
var prefix = type.split('/')[0];
name = Basic.guid((prefix !== '' ? prefix : 'file') + '_');
if (Mime.extensions[type]) {
name += '.' + Mime.extensions[type][0]; // append proper extension if possible
}
}
Blob.apply(this, arguments);
Basic.extend(this, {
/**
File mime type
@property type
@type {String}
@default ''
*/
type: type || '',
/**
File name
@property name
@type {String}
@default UID
*/
name: name || Basic.guid('file_'),
/**
Relative path to the file inside a directory
@property relativePath
@type {String}
@default ''
*/
relativePath: '',
/**
Date of last modification
@property lastModifiedDate
@type {String}
@default now
*/
lastModifiedDate: file.lastModifiedDate || (new Date()).toLocaleString() // Thu Aug 23 2012 19:40:00 GMT+0400 (GET)
});
}
File.prototype = Blob.prototype;
return File;
});
// Included from: src/javascript/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/FileInput', [
'moxie/core/utils/Basic',
'moxie/core/utils/Mime',
'moxie/core/utils/Dom',
'moxie/core/Exceptions',
'moxie/core/EventTarget',
'moxie/core/I18n',
'moxie/file/File',
'moxie/runtime/Runtime',
'moxie/runtime/RuntimeClient'
], function(Basic, Mime, Dom, x, EventTarget, I18n, File, Runtime, RuntimeClient) {
/**
Provides a convenient way to create cross-browser file-picker. Generates file selection dialog on click,
converts selected files to _File_ objects, to be used in conjunction with _Image_, preloaded in memory
with _FileReader_ or uploaded to a server through _XMLHttpRequest_.
@class FileInput
@constructor
@extends EventTarget
@uses RuntimeClient
@param {Object|String|DOMElement} options If options is string or node, argument is considered as _browse\_button_.
@param {String|DOMElement} options.browse_button DOM Element to turn into file picker.
@param {Array} [options.accept] Array of mime types to accept. By default accepts all.
@param {String} [options.file='file'] Name of the file field (not the filename).
@param {Boolean} [options.multiple=false] Enable selection of multiple files.
@param {Boolean} [options.directory=false] Turn file input into the folder input (cannot be both at the same time).
@param {String|DOMElement} [options.container] DOM Element to use as a container for file-picker. Defaults to parentNode
for _browse\_button_.
@param {Object|String} [options.required_caps] Set of required capabilities, that chosen runtime must support.
@example
<div id="container">
<a id="file-picker" href="javascript:;">Browse...</a>
</div>
<script>
var fileInput = new mOxie.FileInput({
browse_button: 'file-picker', // or document.getElementById('file-picker')
container: 'container',
accept: [
{title: "Image files", extensions: "jpg,gif,png"} // accept only images
],
multiple: true // allow multiple file selection
});
fileInput.onchange = function(e) {
// do something to files array
console.info(e.target.files); // or this.files or fileInput.files
};
fileInput.init(); // initialize
</script>
*/
var dispatches = [
/**
Dispatched when runtime is connected and file-picker is ready to be used.
@event ready
@param {Object} event
*/
'ready',
/**
Dispatched right after [ready](#event_ready) event, and whenever [refresh()](#method_refresh) is invoked.
Check [corresponding documentation entry](#method_refresh) for more info.
@event refresh
@param {Object} event
*/
/**
Dispatched when selection of files in the dialog is complete.
@event change
@param {Object} event
*/
'change',
'cancel', // TODO: might be useful
/**
Dispatched when mouse cursor enters file-picker area. Can be used to style element
accordingly.
@event mouseenter
@param {Object} event
*/
'mouseenter',
/**
Dispatched when mouse cursor leaves file-picker area. Can be used to style element
accordingly.
@event mouseleave
@param {Object} event
*/
'mouseleave',
/**
Dispatched when functional mouse button is pressed on top of file-picker area.
@event mousedown
@param {Object} event
*/
'mousedown',
/**
Dispatched when functional mouse button is released on top of file-picker area.
@event mouseup
@param {Object} event
*/
'mouseup'
];
function FileInput(options) {
var self = this,
container, browseButton, defaults;
// if flat argument passed it should be browse_button id
if (Basic.inArray(Basic.typeOf(options), ['string', 'node']) !== -1) {
options = { browse_button : options };
}
// this will help us to find proper default container
browseButton = Dom.get(options.browse_button);
if (!browseButton) {
// browse button is required
throw new x.DOMException(x.DOMException.NOT_FOUND_ERR);
}
// figure out the options
defaults = {
accept: [{
title: I18n.translate('All Files'),
extensions: '*'
}],
name: 'file',
multiple: false,
required_caps: false,
container: browseButton.parentNode || document.body
};
options = Basic.extend({}, defaults, options);
// convert to object representation
if (typeof(options.required_caps) === 'string') {
options.required_caps = Runtime.parseCaps(options.required_caps);
}
// normalize accept option (could be list of mime types or array of title/extensions pairs)
if (typeof(options.accept) === 'string') {
options.accept = Mime.mimes2extList(options.accept);
}
container = Dom.get(options.container);
// make sure we have container
if (!container) {
container = document.body;
}
// make container relative, if it's not
if (Dom.getStyle(container, 'position') === 'static') {
container.style.position = 'relative';
}
container = browseButton = null; // IE
RuntimeClient.call(self);
Basic.extend(self, {
/**
Unique id of the component
@property uid
@protected
@readOnly
@type {String}
@default UID
*/
uid: Basic.guid('uid_'),
/**
Unique id of the connected runtime, if any.
@property ruid
@protected
@type {String}
*/
ruid: null,
/**
Unique id of the runtime container. Useful to get hold of it for various manipulations.
@property shimid
@protected
@type {String}
*/
shimid: null,
/**
Array of selected mOxie.File objects
@property files
@type {Array}
@default null
*/
files: null,
/**
Initializes the file-picker, connects it to runtime and dispatches event ready when done.
@method init
*/
init: function() {
self.convertEventPropsToHandlers(dispatches);
self.bind('RuntimeInit', function(e, runtime) {
self.ruid = runtime.uid;
self.shimid = runtime.shimid;
self.bind("Ready", function() {
self.trigger("Refresh");
}, 999);
self.bind("Change", function() {
var files = runtime.exec.call(self, 'FileInput', 'getFiles');
self.files = [];
Basic.each(files, function(file) {
// ignore empty files (IE10 for example hangs if you try to send them via XHR)
if (file.size === 0) {
return true;
}
self.files.push(new File(self.ruid, file));
});
}, 999);
// re-position and resize shim container
self.bind('Refresh', function() {
var pos, size, browseButton, shimContainer;
browseButton = Dom.get(options.browse_button);
shimContainer = Dom.get(runtime.shimid); // do not use runtime.getShimContainer(), since it will create container if it doesn't exist
if (browseButton) {
pos = Dom.getPos(browseButton, Dom.get(options.container));
size = Dom.getSize(browseButton);
if (shimContainer) {
Basic.extend(shimContainer.style, {
top : pos.y + 'px',
left : pos.x + 'px',
width : size.w + 'px',
height : size.h + 'px'
});
}
}
shimContainer = browseButton = null;
});
runtime.exec.call(self, 'FileInput', 'init', options);
});
// runtime needs: options.required_features, options.runtime_order and options.container
self.connectRuntime(Basic.extend({}, options, {
required_caps: {
select_file: true
}
}));
},
/**
Disables file-picker element, so that it doesn't react to mouse clicks.
@method disable
@param {Boolean} [state=true] Disable component if - true, enable if - false
*/
disable: function(state) {
var runtime = this.getRuntime();
if (runtime) {
runtime.exec.call(this, 'FileInput', 'disable', Basic.typeOf(state) === 'undefined' ? true : state);
}
},
/**
Reposition and resize dialog trigger to match the position and size of browse_button element.
@method refresh
*/
refresh: function() {
self.trigger("Refresh");
},
/**
Destroy component.
@method destroy
*/
destroy: function() {
var runtime = this.getRuntime();
if (runtime) {
runtime.exec.call(this, 'FileInput', 'destroy');
this.disconnectRuntime();
}
if (Basic.typeOf(this.files) === 'array') {
// no sense in leaving associated files behind
Basic.each(this.files, function(file) {
file.destroy();
});
}
this.files = null;
}
});
}
FileInput.prototype = EventTarget.instance;
return FileInput;
});
// Included from: src/javascript/runtime/RuntimeTarget.js
/**
* RuntimeTarget.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/runtime/RuntimeTarget', [
'moxie/core/utils/Basic',
'moxie/runtime/RuntimeClient',
"moxie/core/EventTarget"
], function(Basic, RuntimeClient, EventTarget) {
/**
Instance of this class can be used as a target for the events dispatched by shims,
when allowing them onto components is for either reason inappropriate
@class RuntimeTarget
@constructor
@protected
@extends EventTarget
*/
function RuntimeTarget() {
this.uid = Basic.guid('uid_');
RuntimeClient.call(this);
this.destroy = function() {
this.disconnectRuntime();
this.unbindAll();
};
}
RuntimeTarget.prototype = EventTarget.instance;
return RuntimeTarget;
});
// Included from: src/javascript/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/FileReader', [
'moxie/core/utils/Basic',
'moxie/core/utils/Encode',
'moxie/core/Exceptions',
'moxie/core/EventTarget',
'moxie/file/Blob',
'moxie/file/File',
'moxie/runtime/RuntimeTarget'
], function(Basic, Encode, x, EventTarget, Blob, File, RuntimeTarget) {
/**
Utility for preloading o.Blob/o.File objects in memory. By design closely follows [W3C FileReader](http://www.w3.org/TR/FileAPI/#dfn-filereader)
interface. Where possible uses native FileReader, where - not falls back to shims.
@class FileReader
@constructor FileReader
@extends EventTarget
@uses RuntimeClient
*/
var dispatches = [
/**
Dispatched when the read starts.
@event loadstart
@param {Object} event
*/
'loadstart',
/**
Dispatched while reading (and decoding) blob, and reporting partial Blob data (progess.loaded/progress.total).
@event progress
@param {Object} event
*/
'progress',
/**
Dispatched when the read has successfully completed.
@event load
@param {Object} event
*/
'load',
/**
Dispatched when the read has been aborted. For instance, by invoking the abort() method.
@event abort
@param {Object} event
*/
'abort',
/**
Dispatched when the read has failed.
@event error
@param {Object} event
*/
'error',
/**
Dispatched when the request has completed (either in success or failure).
@event loadend
@param {Object} event
*/
'loadend'
];
function FileReader() {
var self = this, _fr;
Basic.extend(this, {
/**
UID of the component instance.
@property uid
@type {String}
*/
uid: Basic.guid('uid_'),
/**
Contains current state of FileReader object. Can take values of FileReader.EMPTY, FileReader.LOADING
and FileReader.DONE.
@property readyState
@type {Number}
@default FileReader.EMPTY
*/
readyState: FileReader.EMPTY,
/**
Result of the successful read operation.
@property result
@type {String}
*/
result: null,
/**
Stores the error of failed asynchronous read operation.
@property error
@type {DOMError}
*/
error: null,
/**
Initiates reading of File/Blob object contents to binary string.
@method readAsBinaryString
@param {Blob|File} blob Object to preload
*/
readAsBinaryString: function(blob) {
_read.call(this, 'readAsBinaryString', blob);
},
/**
Initiates reading of File/Blob object contents to dataURL string.
@method readAsDataURL
@param {Blob|File} blob Object to preload
*/
readAsDataURL: function(blob) {
_read.call(this, 'readAsDataURL', blob);
},
/**
Initiates reading of File/Blob object contents to string.
@method readAsText
@param {Blob|File} blob Object to preload
*/
readAsText: function(blob) {
_read.call(this, 'readAsText', blob);
},
/**
Aborts preloading process.
@method abort
*/
abort: function() {
this.result = null;
if (Basic.inArray(this.readyState, [FileReader.EMPTY, FileReader.DONE]) !== -1) {
return;
} else if (this.readyState === FileReader.LOADING) {
this.readyState = FileReader.DONE;
}
if (_fr) {
_fr.getRuntime().exec.call(this, 'FileReader', 'abort');
}
this.trigger('abort');
this.trigger('loadend');
},
/**
Destroy component and release resources.
@method destroy
*/
destroy: function() {
this.abort();
if (_fr) {
_fr.getRuntime().exec.call(this, 'FileReader', 'destroy');
_fr.disconnectRuntime();
}
self = _fr = null;
}
});
function _read(op, blob) {
_fr = new RuntimeTarget();
function error(err) {
self.readyState = FileReader.DONE;
self.error = err;
self.trigger('error');
loadEnd();
}
function loadEnd() {
_fr.destroy();
_fr = null;
self.trigger('loadend');
}
function exec(runtime) {
_fr.bind('Error', function(e, err) {
error(err);
});
_fr.bind('Progress', function(e) {
self.result = runtime.exec.call(_fr, 'FileReader', 'getResult');
self.trigger(e);
});
_fr.bind('Load', function(e) {
self.readyState = FileReader.DONE;
self.result = runtime.exec.call(_fr, 'FileReader', 'getResult');
self.trigger(e);
loadEnd();
});
runtime.exec.call(_fr, 'FileReader', 'read', op, blob);
}
this.convertEventPropsToHandlers(dispatches);
if (this.readyState === FileReader.LOADING) {
return error(new x.DOMException(x.DOMException.INVALID_STATE_ERR));
}
this.readyState = FileReader.LOADING;
this.trigger('loadstart');
// if source is o.Blob/o.File
if (blob instanceof Blob) {
if (blob.isDetached()) {
var src = blob.getSource();
switch (op) {
case 'readAsText':
case 'readAsBinaryString':
this.result = src;
break;
case 'readAsDataURL':
this.result = 'data:' + blob.type + ';base64,' + Encode.btoa(src);
break;
}
this.readyState = FileReader.DONE;
this.trigger('load');
loadEnd();
} else {
exec(_fr.connectRuntime(blob.ruid));
}
} else {
error(new x.DOMException(x.DOMException.NOT_FOUND_ERR));
}
}
}
/**
Initial FileReader state
@property EMPTY
@type {Number}
@final
@static
@default 0
*/
FileReader.EMPTY = 0;
/**
FileReader switches to this state when it is preloading the source
@property LOADING
@type {Number}
@final
@static
@default 1
*/
FileReader.LOADING = 1;
/**
Preloading is complete, this is a final state
@property DONE
@type {Number}
@final
@static
@default 2
*/
FileReader.DONE = 2;
FileReader.prototype = EventTarget.instance;
return FileReader;
});
// Included from: src/javascript/core/utils/Url.js
/**
* Url.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Url', [], function() {
/**
Parse url into separate components and fill in absent parts with parts from current url,
based on https://raw.github.com/kvz/phpjs/master/functions/url/parse_url.js
@method parseUrl
@for Utils
@static
@param {String} url Url to parse (defaults to empty string if undefined)
@return {Object} Hash containing extracted uri components
*/
var parseUrl = function(url, currentUrl) {
var key = ['source', 'scheme', 'authority', 'userInfo', 'user', 'pass', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'fragment']
, i = key.length
, ports = {
http: 80,
https: 443
}
, uri = {}
, regex = /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/
, m = regex.exec(url || '')
;
while (i--) {
if (m[i]) {
uri[key[i]] = m[i];
}
}
// when url is relative, we set the origin and the path ourselves
if (!uri.scheme) {
// come up with defaults
if (!currentUrl || typeof(currentUrl) === 'string') {
currentUrl = parseUrl(currentUrl || document.location.href);
}
uri.scheme = currentUrl.scheme;
uri.host = currentUrl.host;
uri.port = currentUrl.port;
var path = '';
// for urls without trailing slash we need to figure out the path
if (/^[^\/]/.test(uri.path)) {
path = currentUrl.path;
// if path ends with a filename, strip it
if (!/(\/|\/[^\.]+)$/.test(path)) {
path = path.replace(/\/[^\/]+$/, '/');
} else {
path += '/';
}
}
uri.path = path + (uri.path || ''); // site may reside at domain.com or domain.com/subdir
}
if (!uri.port) {
uri.port = ports[uri.scheme] || 80;
}
uri.port = parseInt(uri.port, 10);
if (!uri.path) {
uri.path = "/";
}
delete uri.source;
return uri;
};
/**
Resolve url - among other things will turn relative url to absolute
@method resolveUrl
@static
@param {String} url Either absolute or relative
@return {String} Resolved, absolute url
*/
var resolveUrl = function(url) {
var ports = { // we ignore default ports
http: 80,
https: 443
}
, urlp = parseUrl(url)
;
return urlp.scheme + '://' + urlp.host + (urlp.port !== ports[urlp.scheme] ? ':' + urlp.port : '') + urlp.path + (urlp.query ? urlp.query : '');
};
/**
Check if specified url has the same origin as the current document
@method hasSameOrigin
@param {String|Object} url
@return {Boolean}
*/
var hasSameOrigin = function(url) {
function origin(url) {
return [url.scheme, url.host, url.port].join('/');
}
if (typeof url === 'string') {
url = parseUrl(url);
}
return origin(parseUrl()) === origin(url);
};
return {
parseUrl: parseUrl,
resolveUrl: resolveUrl,
hasSameOrigin: hasSameOrigin
};
});
// Included from: src/javascript/file/FileReaderSync.js
/**
* FileReaderSync.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/FileReaderSync', [
'moxie/core/utils/Basic',
'moxie/runtime/RuntimeClient',
'moxie/core/utils/Encode'
], function(Basic, RuntimeClient, Encode) {
/**
Synchronous FileReader implementation. Something like this is available in WebWorkers environment, here
it can be used to read only preloaded blobs/files and only below certain size (not yet sure what that'd be,
but probably < 1mb). Not meant to be used directly by user.
@class FileReaderSync
@private
@constructor
*/
return function() {
RuntimeClient.call(this);
Basic.extend(this, {
uid: Basic.guid('uid_'),
readAsBinaryString: function(blob) {
return _read.call(this, 'readAsBinaryString', blob);
},
readAsDataURL: function(blob) {
return _read.call(this, 'readAsDataURL', blob);
},
/*readAsArrayBuffer: function(blob) {
return _read.call(this, 'readAsArrayBuffer', blob);
},*/
readAsText: function(blob) {
return _read.call(this, 'readAsText', blob);
}
});
function _read(op, blob) {
if (blob.isDetached()) {
var src = blob.getSource();
switch (op) {
case 'readAsBinaryString':
return src;
case 'readAsDataURL':
return 'data:' + blob.type + ';base64,' + Encode.btoa(src);
case 'readAsText':
var txt = '';
for (var i = 0, length = src.length; i < length; i++) {
txt += String.fromCharCode(src[i]);
}
return txt;
}
} else {
var result = this.connectRuntime(blob.ruid).exec.call(this, 'FileReaderSync', 'read', op, blob);
this.disconnectRuntime();
return result;
}
}
};
});
// Included from: src/javascript/xhr/FormData.js
/**
* FormData.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/xhr/FormData", [
"moxie/core/Exceptions",
"moxie/core/utils/Basic",
"moxie/file/Blob"
], function(x, Basic, Blob) {
/**
FormData
@class FormData
@constructor
*/
function FormData() {
var _blob, _fields = [];
Basic.extend(this, {
/**
Append another key-value pair to the FormData object
@method append
@param {String} name Name for the new field
@param {String|Blob|Array|Object} value Value for the field
*/
append: function(name, value) {
var self = this, valueType = Basic.typeOf(value);
// according to specs value might be either Blob or String
if (value instanceof Blob) {
_blob = {
name: name,
value: value // unfortunately we can only send single Blob in one FormData
};
} else if ('array' === valueType) {
name += '[]';
Basic.each(value, function(value) {
self.append(name, value);
});
} else if ('object' === valueType) {
Basic.each(value, function(value, key) {
self.append(name + '[' + key + ']', value);
});
} else if ('null' === valueType || 'undefined' === valueType || 'number' === valueType && isNaN(value)) {
self.append(name, "false");
} else {
_fields.push({
name: name,
value: value.toString()
});
}
},
/**
Checks if FormData contains Blob.
@method hasBlob
@return {Boolean}
*/
hasBlob: function() {
return !!this.getBlob();
},
/**
Retrieves blob.
@method getBlob
@return {Object} Either Blob if found or null
*/
getBlob: function() {
return _blob && _blob.value || null;
},
/**
Retrieves blob field name.
@method getBlobName
@return {String} Either Blob field name or null
*/
getBlobName: function() {
return _blob && _blob.name || null;
},
/**
Loop over the fields in FormData and invoke the callback for each of them.
@method each
@param {Function} cb Callback to call for each field
*/
each: function(cb) {
Basic.each(_fields, function(field) {
cb(field.value, field.name);
});
if (_blob) {
cb(_blob.value, _blob.name);
}
},
destroy: function() {
_blob = null;
_fields = [];
}
});
}
return FormData;
});
// Included from: src/javascript/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/xhr/XMLHttpRequest", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/core/EventTarget",
"moxie/core/utils/Encode",
"moxie/core/utils/Url",
"moxie/runtime/Runtime",
"moxie/runtime/RuntimeTarget",
"moxie/file/Blob",
"moxie/file/FileReaderSync",
"moxie/xhr/FormData",
"moxie/core/utils/Env",
"moxie/core/utils/Mime"
], function(Basic, x, EventTarget, Encode, Url, Runtime, RuntimeTarget, Blob, FileReaderSync, FormData, Env, Mime) {
var httpCode = {
100: 'Continue',
101: 'Switching Protocols',
102: 'Processing',
200: 'OK',
201: 'Created',
202: 'Accepted',
203: 'Non-Authoritative Information',
204: 'No Content',
205: 'Reset Content',
206: 'Partial Content',
207: 'Multi-Status',
226: 'IM Used',
300: 'Multiple Choices',
301: 'Moved Permanently',
302: 'Found',
303: 'See Other',
304: 'Not Modified',
305: 'Use Proxy',
306: 'Reserved',
307: 'Temporary Redirect',
400: 'Bad Request',
401: 'Unauthorized',
402: 'Payment Required',
403: 'Forbidden',
404: 'Not Found',
405: 'Method Not Allowed',
406: 'Not Acceptable',
407: 'Proxy Authentication Required',
408: 'Request Timeout',
409: 'Conflict',
410: 'Gone',
411: 'Length Required',
412: 'Precondition Failed',
413: 'Request Entity Too Large',
414: 'Request-URI Too Long',
415: 'Unsupported Media Type',
416: 'Requested Range Not Satisfiable',
417: 'Expectation Failed',
422: 'Unprocessable Entity',
423: 'Locked',
424: 'Failed Dependency',
426: 'Upgrade Required',
500: 'Internal Server Error',
501: 'Not Implemented',
502: 'Bad Gateway',
503: 'Service Unavailable',
504: 'Gateway Timeout',
505: 'HTTP Version Not Supported',
506: 'Variant Also Negotiates',
507: 'Insufficient Storage',
510: 'Not Extended'
};
function XMLHttpRequestUpload() {
this.uid = Basic.guid('uid_');
}
XMLHttpRequestUpload.prototype = EventTarget.instance;
/**
Implementation of XMLHttpRequest
@class XMLHttpRequest
@constructor
@uses RuntimeClient
@extends EventTarget
*/
var dispatches = ['loadstart', 'progress', 'abort', 'error', 'load', 'timeout', 'loadend']; // & readystatechange (for historical reasons)
var NATIVE = 1, RUNTIME = 2;
function XMLHttpRequest() {
var self = this,
// this (together with _p() @see below) is here to gracefully upgrade to setter/getter syntax where possible
props = {
/**
The amount of milliseconds a request can take before being terminated. Initially zero. Zero means there is no timeout.
@property timeout
@type Number
@default 0
*/
timeout: 0,
/**
Current state, can take following values:
UNSENT (numeric value 0)
The object has been constructed.
OPENED (numeric value 1)
The open() method has been successfully invoked. During this state request headers can be set using setRequestHeader() and the request can be made using the send() method.
HEADERS_RECEIVED (numeric value 2)
All redirects (if any) have been followed and all HTTP headers of the final response have been received. Several response members of the object are now available.
LOADING (numeric value 3)
The response entity body is being received.
DONE (numeric value 4)
@property readyState
@type Number
@default 0 (UNSENT)
*/
readyState: XMLHttpRequest.UNSENT,
/**
True when user credentials are to be included in a cross-origin request. False when they are to be excluded
in a cross-origin request and when cookies are to be ignored in its response. Initially false.
@property withCredentials
@type Boolean
@default false
*/
withCredentials: false,
/**
Returns the HTTP status code.
@property status
@type Number
@default 0
*/
status: 0,
/**
Returns the HTTP status text.
@property statusText
@type String
*/
statusText: "",
/**
Returns the response type. Can be set to change the response type. Values are:
the empty string (default), "arraybuffer", "blob", "document", "json", and "text".
@property responseType
@type String
*/
responseType: "",
/**
Returns the document response entity body.
Throws an "InvalidStateError" exception if responseType is not the empty string or "document".
@property responseXML
@type Document
*/
responseXML: null,
/**
Returns the text response entity body.
Throws an "InvalidStateError" exception if responseType is not the empty string or "text".
@property responseText
@type String
*/
responseText: null,
/**
Returns the response entity body (http://www.w3.org/TR/XMLHttpRequest/#response-entity-body).
Can become: ArrayBuffer, Blob, Document, JSON, Text
@property response
@type Mixed
*/
response: null
},
_async = true,
_url,
_method,
_headers = {},
_user,
_password,
_encoding = null,
_mimeType = null,
// flags
_sync_flag = false,
_send_flag = false,
_upload_events_flag = false,
_upload_complete_flag = false,
_error_flag = false,
_same_origin_flag = false,
// times
_start_time,
_timeoutset_time,
_finalMime = null,
_finalCharset = null,
_options = {},
_xhr,
_responseHeaders = '',
_responseHeadersBag
;
Basic.extend(this, props, {
/**
Unique id of the component
@property uid
@type String
*/
uid: Basic.guid('uid_'),
/**
Target for Upload events
@property upload
@type XMLHttpRequestUpload
*/
upload: new XMLHttpRequestUpload(),
/**
Sets the request method, request URL, synchronous flag, request username, and request password.
Throws a "SyntaxError" exception if one of the following is true:
method is not a valid HTTP method.
url cannot be resolved.
url contains the "user:password" format in the userinfo production.
Throws a "SecurityError" exception if method is a case-insensitive match for CONNECT, TRACE or TRACK.
Throws an "InvalidAccessError" exception if one of the following is true:
Either user or password is passed as argument and the origin of url does not match the XMLHttpRequest origin.
There is an associated XMLHttpRequest document and either the timeout attribute is not zero,
the withCredentials attribute is true, or the responseType attribute is not the empty string.
@method open
@param {String} method HTTP method to use on request
@param {String} url URL to request
@param {Boolean} [async=true] If false request will be done in synchronous manner. Asynchronous by default.
@param {String} [user] Username to use in HTTP authentication process on server-side
@param {String} [password] Password to use in HTTP authentication process on server-side
*/
open: function(method, url, async, user, password) {
var urlp;
// first two arguments are required
if (!method || !url) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 2 - check if any code point in method is higher than U+00FF or after deflating method it does not match the method
if (/[\u0100-\uffff]/.test(method) || Encode.utf8_encode(method) !== method) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 3
if (!!~Basic.inArray(method.toUpperCase(), ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT', 'TRACE', 'TRACK'])) {
_method = method.toUpperCase();
}
// 4 - allowing these methods poses a security risk
if (!!~Basic.inArray(_method, ['CONNECT', 'TRACE', 'TRACK'])) {
throw new x.DOMException(x.DOMException.SECURITY_ERR);
}
// 5
url = Encode.utf8_encode(url);
// 6 - Resolve url relative to the XMLHttpRequest base URL. If the algorithm returns an error, throw a "SyntaxError".
urlp = Url.parseUrl(url);
_same_origin_flag = Url.hasSameOrigin(urlp);
// 7 - manually build up absolute url
_url = Url.resolveUrl(url);
// 9-10, 12-13
if ((user || password) && !_same_origin_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
_user = user || urlp.user;
_password = password || urlp.pass;
// 11
_async = async || true;
if (_async === false && (_p('timeout') || _p('withCredentials') || _p('responseType') !== "")) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// 14 - terminate abort()
// 15 - terminate send()
// 18
_sync_flag = !_async;
_send_flag = false;
_headers = {};
_reset.call(this);
// 19
_p('readyState', XMLHttpRequest.OPENED);
// 20
this.convertEventPropsToHandlers(['readystatechange']); // unify event handlers
this.dispatchEvent('readystatechange');
},
/**
Appends an header to the list of author request headers, or if header is already
in the list of author request headers, combines its value with value.
Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set.
Throws a "SyntaxError" exception if header is not a valid HTTP header field name or if value
is not a valid HTTP header field value.
@method setRequestHeader
@param {String} header
@param {String|Number} value
*/
setRequestHeader: function(header, value) {
var uaHeaders = [ // these headers are controlled by the user agent
"accept-charset",
"accept-encoding",
"access-control-request-headers",
"access-control-request-method",
"connection",
"content-length",
"cookie",
"cookie2",
"content-transfer-encoding",
"date",
"expect",
"host",
"keep-alive",
"origin",
"referer",
"te",
"trailer",
"transfer-encoding",
"upgrade",
"user-agent",
"via"
];
// 1-2
if (_p('readyState') !== XMLHttpRequest.OPENED || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 3
if (/[\u0100-\uffff]/.test(header) || Encode.utf8_encode(header) !== header) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 4
/* this step is seemingly bypassed in browsers, probably to allow various unicode characters in header values
if (/[\u0100-\uffff]/.test(value) || Encode.utf8_encode(value) !== value) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}*/
header = Basic.trim(header).toLowerCase();
// setting of proxy-* and sec-* headers is prohibited by spec
if (!!~Basic.inArray(header, uaHeaders) || /^(proxy\-|sec\-)/.test(header)) {
return false;
}
// camelize
// browsers lowercase header names (at least for custom ones)
// header = header.replace(/\b\w/g, function($1) { return $1.toUpperCase(); });
if (!_headers[header]) {
_headers[header] = value;
} else {
// http://tools.ietf.org/html/rfc2616#section-4.2 (last paragraph)
_headers[header] += ', ' + value;
}
return true;
},
/**
Returns all headers from the response, with the exception of those whose field name is Set-Cookie or Set-Cookie2.
@method getAllResponseHeaders
@return {String} reponse headers or empty string
*/
getAllResponseHeaders: function() {
return _responseHeaders || '';
},
/**
Returns the header field value from the response of which the field name matches header,
unless the field name is Set-Cookie or Set-Cookie2.
@method getResponseHeader
@param {String} header
@return {String} value(s) for the specified header or null
*/
getResponseHeader: function(header) {
header = header.toLowerCase();
if (_error_flag || !!~Basic.inArray(header, ['set-cookie', 'set-cookie2'])) {
return null;
}
if (_responseHeaders && _responseHeaders !== '') {
// if we didn't parse response headers until now, do it and keep for later
if (!_responseHeadersBag) {
_responseHeadersBag = {};
Basic.each(_responseHeaders.split(/\r\n/), function(line) {
var pair = line.split(/:\s+/);
if (pair.length === 2) { // last line might be empty, omit
pair[0] = Basic.trim(pair[0]); // just in case
_responseHeadersBag[pair[0].toLowerCase()] = { // simply to retain header name in original form
header: pair[0],
value: Basic.trim(pair[1])
};
}
});
}
if (_responseHeadersBag.hasOwnProperty(header)) {
return _responseHeadersBag[header].header + ': ' + _responseHeadersBag[header].value;
}
}
return null;
},
/**
Sets the Content-Type header for the response to mime.
Throws an "InvalidStateError" exception if the state is LOADING or DONE.
Throws a "SyntaxError" exception if mime is not a valid media type.
@method overrideMimeType
@param String mime Mime type to set
*/
overrideMimeType: function(mime) {
var matches, charset;
// 1
if (!!~Basic.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2
mime = Basic.trim(mime.toLowerCase());
if (/;/.test(mime) && (matches = mime.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))) {
mime = matches[1];
if (matches[2]) {
charset = matches[2];
}
}
if (!Mime.mimes[mime]) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 3-4
_finalMime = mime;
_finalCharset = charset;
},
/**
Initiates the request. The optional argument provides the request entity body.
The argument is ignored if request method is GET or HEAD.
Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set.
@method send
@param {Blob|Document|String|FormData} [data] Request entity body
@param {Object} [options] Set of requirements and pre-requisities for runtime initialization
*/
send: function(data, options) {
if (Basic.typeOf(options) === 'string') {
_options = { ruid: options };
} else if (!options) {
_options = {};
} else {
_options = options;
}
this.convertEventPropsToHandlers(dispatches);
this.upload.convertEventPropsToHandlers(dispatches);
// 1-2
if (this.readyState !== XMLHttpRequest.OPENED || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 3
// sending Blob
if (data instanceof Blob) {
_options.ruid = data.ruid;
_mimeType = data.type || 'application/octet-stream';
}
// FormData
else if (data instanceof FormData) {
if (data.hasBlob()) {
var blob = data.getBlob();
_options.ruid = blob.ruid;
_mimeType = blob.type || 'application/octet-stream';
}
}
// DOMString
else if (typeof data === 'string') {
_encoding = 'UTF-8';
_mimeType = 'text/plain;charset=UTF-8';
// data should be converted to Unicode and encoded as UTF-8
data = Encode.utf8_encode(data);
}
// if withCredentials not set, but requested, set it automatically
if (!this.withCredentials) {
this.withCredentials = (_options.required_caps && _options.required_caps.send_browser_cookies) && !_same_origin_flag;
}
// 4 - storage mutex
// 5
_upload_events_flag = (!_sync_flag && this.upload.hasEventListener()); // DSAP
// 6
_error_flag = false;
// 7
_upload_complete_flag = !data;
// 8 - Asynchronous steps
if (!_sync_flag) {
// 8.1
_send_flag = true;
// 8.2
// this.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr
// 8.3
//if (!_upload_complete_flag) {
// this.upload.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr
//}
}
// 8.5 - Return the send() method call, but continue running the steps in this algorithm.
_doXHR.call(this, data);
},
/**
Cancels any network activity.
@method abort
*/
abort: function() {
_error_flag = true;
_sync_flag = false;
if (!~Basic.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED, XMLHttpRequest.DONE])) {
_p('readyState', XMLHttpRequest.DONE);
_send_flag = false;
if (_xhr) {
_xhr.getRuntime().exec.call(_xhr, 'XMLHttpRequest', 'abort', _upload_complete_flag);
} else {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
_upload_complete_flag = true;
} else {
_p('readyState', XMLHttpRequest.UNSENT);
}
},
destroy: function() {
if (_xhr) {
if (Basic.typeOf(_xhr.destroy) === 'function') {
_xhr.destroy();
}
_xhr = null;
}
this.unbindAll();
if (this.upload) {
this.upload.unbindAll();
this.upload = null;
}
}
});
/* this is nice, but maybe too lengthy
// if supported by JS version, set getters/setters for specific properties
o.defineProperty(this, 'readyState', {
configurable: false,
get: function() {
return _p('readyState');
}
});
o.defineProperty(this, 'timeout', {
configurable: false,
get: function() {
return _p('timeout');
},
set: function(value) {
if (_sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// timeout still should be measured relative to the start time of request
_timeoutset_time = (new Date).getTime();
_p('timeout', value);
}
});
// the withCredentials attribute has no effect when fetching same-origin resources
o.defineProperty(this, 'withCredentials', {
configurable: false,
get: function() {
return _p('withCredentials');
},
set: function(value) {
// 1-2
if (!~o.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED]) || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 3-4
if (_anonymous_flag || _sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// 5
_p('withCredentials', value);
}
});
o.defineProperty(this, 'status', {
configurable: false,
get: function() {
return _p('status');
}
});
o.defineProperty(this, 'statusText', {
configurable: false,
get: function() {
return _p('statusText');
}
});
o.defineProperty(this, 'responseType', {
configurable: false,
get: function() {
return _p('responseType');
},
set: function(value) {
// 1
if (!!~o.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2
if (_sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// 3
_p('responseType', value.toLowerCase());
}
});
o.defineProperty(this, 'responseText', {
configurable: false,
get: function() {
// 1
if (!~o.inArray(_p('responseType'), ['', 'text'])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2-3
if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
return _p('responseText');
}
});
o.defineProperty(this, 'responseXML', {
configurable: false,
get: function() {
// 1
if (!~o.inArray(_p('responseType'), ['', 'document'])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2-3
if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
return _p('responseXML');
}
});
o.defineProperty(this, 'response', {
configurable: false,
get: function() {
if (!!~o.inArray(_p('responseType'), ['', 'text'])) {
if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) {
return '';
}
}
if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) {
return null;
}
return _p('response');
}
});
*/
function _p(prop, value) {
if (!props.hasOwnProperty(prop)) {
return;
}
if (arguments.length === 1) { // get
return Env.can('define_property') ? props[prop] : self[prop];
} else { // set
if (Env.can('define_property')) {
props[prop] = value;
} else {
self[prop] = value;
}
}
}
/*
function _toASCII(str, AllowUnassigned, UseSTD3ASCIIRules) {
// TODO: http://tools.ietf.org/html/rfc3490#section-4.1
return str.toLowerCase();
}
*/
function _doXHR(data) {
var self = this;
_start_time = new Date().getTime();
_xhr = new RuntimeTarget();
function loadEnd() {
if (_xhr) { // it could have been destroyed by now
_xhr.destroy();
_xhr = null;
}
self.dispatchEvent('loadend');
self = null;
}
function exec(runtime) {
_xhr.bind('LoadStart', function(e) {
_p('readyState', XMLHttpRequest.LOADING);
self.dispatchEvent('readystatechange');
self.dispatchEvent(e);
if (_upload_events_flag) {
self.upload.dispatchEvent(e);
}
});
_xhr.bind('Progress', function(e) {
if (_p('readyState') !== XMLHttpRequest.LOADING) {
_p('readyState', XMLHttpRequest.LOADING); // LoadStart unreliable (in Flash for example)
self.dispatchEvent('readystatechange');
}
self.dispatchEvent(e);
});
_xhr.bind('UploadProgress', function(e) {
if (_upload_events_flag) {
self.upload.dispatchEvent({
type: 'progress',
lengthComputable: false,
total: e.total,
loaded: e.loaded
});
}
});
_xhr.bind('Load', function(e) {
_p('readyState', XMLHttpRequest.DONE);
_p('status', Number(runtime.exec.call(_xhr, 'XMLHttpRequest', 'getStatus') || 0));
_p('statusText', httpCode[_p('status')] || "");
_p('response', runtime.exec.call(_xhr, 'XMLHttpRequest', 'getResponse', _p('responseType')));
if (!!~Basic.inArray(_p('responseType'), ['text', ''])) {
_p('responseText', _p('response'));
} else if (_p('responseType') === 'document') {
_p('responseXML', _p('response'));
}
_responseHeaders = runtime.exec.call(_xhr, 'XMLHttpRequest', 'getAllResponseHeaders');
self.dispatchEvent('readystatechange');
if (_p('status') > 0) { // status 0 usually means that server is unreachable
if (_upload_events_flag) {
self.upload.dispatchEvent(e);
}
self.dispatchEvent(e);
} else {
_error_flag = true;
self.dispatchEvent('error');
}
loadEnd();
});
_xhr.bind('Abort', function(e) {
self.dispatchEvent(e);
loadEnd();
});
_xhr.bind('Error', function(e) {
_error_flag = true;
_p('readyState', XMLHttpRequest.DONE);
self.dispatchEvent('readystatechange');
_upload_complete_flag = true;
self.dispatchEvent(e);
loadEnd();
});
runtime.exec.call(_xhr, 'XMLHttpRequest', 'send', {
url: _url,
method: _method,
async: _async,
user: _user,
password: _password,
headers: _headers,
mimeType: _mimeType,
encoding: _encoding,
responseType: self.responseType,
withCredentials: self.withCredentials,
options: _options
}, data);
}
// clarify our requirements
if (typeof(_options.required_caps) === 'string') {
_options.required_caps = Runtime.parseCaps(_options.required_caps);
}
_options.required_caps = Basic.extend({}, _options.required_caps, {
return_response_type: self.responseType
});
if (data instanceof FormData) {
_options.required_caps.send_multipart = true;
}
if (!_same_origin_flag) {
_options.required_caps.do_cors = true;
}
if (_options.ruid) { // we do not need to wait if we can connect directly
exec(_xhr.connectRuntime(_options));
} else {
_xhr.bind('RuntimeInit', function(e, runtime) {
exec(runtime);
});
_xhr.bind('RuntimeError', function(e, err) {
self.dispatchEvent('RuntimeError', err);
});
_xhr.connectRuntime(_options);
}
}
function _reset() {
_p('responseText', "");
_p('responseXML', null);
_p('response', null);
_p('status', 0);
_p('statusText', "");
_start_time = _timeoutset_time = null;
}
}
XMLHttpRequest.UNSENT = 0;
XMLHttpRequest.OPENED = 1;
XMLHttpRequest.HEADERS_RECEIVED = 2;
XMLHttpRequest.LOADING = 3;
XMLHttpRequest.DONE = 4;
XMLHttpRequest.prototype = EventTarget.instance;
return XMLHttpRequest;
});
// Included from: src/javascript/runtime/flash/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global ActiveXObject:true */
/**
Defines constructor for Flash runtime.
@class moxie/runtime/flash/Runtime
@private
*/
define("moxie/runtime/flash/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/utils/Env",
"moxie/core/utils/Dom",
"moxie/core/Exceptions",
"moxie/runtime/Runtime"
], function(Basic, Env, Dom, x, Runtime) {
var type = 'flash', extensions = {};
/**
Get the version of the Flash Player
@method getShimVersion
@private
@return {Number} Flash Player version
*/
function getShimVersion() {
var version;
try {
version = navigator.plugins['Shockwave Flash'];
version = version.description;
} catch (e1) {
try {
version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
} catch (e2) {
version = '0.0';
}
}
version = version.match(/\d+/g);
return parseFloat(version[0] + '.' + version[1]);
}
/**
Constructor for the Flash Runtime
@class FlashRuntime
@extends Runtime
*/
function FlashRuntime(options) {
var I = this, initTimer;
options = Basic.extend({ swf_url: Env.swf_url }, options);
Runtime.call(this, options, type, {
access_binary: function(value) {
return value && I.mode === 'browser';
},
access_image_binary: function(value) {
return value && I.mode === 'browser';
},
display_media: Runtime.capTrue,
do_cors: Runtime.capTrue,
drag_and_drop: false,
report_upload_progress: function() {
return I.mode === 'client';
},
resize_image: Runtime.capTrue,
return_response_headers: false,
return_response_type: function(responseType) {
if (responseType === 'json' && !!window.JSON) {
return true;
}
return !Basic.arrayDiff(responseType, ['', 'text', 'document']) || I.mode === 'browser';
},
return_status_code: function(code) {
return I.mode === 'browser' || !Basic.arrayDiff(code, [200, 404]);
},
select_file: Runtime.capTrue,
select_multiple: Runtime.capTrue,
send_binary_string: function(value) {
return value && I.mode === 'browser';
},
send_browser_cookies: function(value) {
return value && I.mode === 'browser';
},
send_custom_headers: function(value) {
return value && I.mode === 'browser';
},
send_multipart: Runtime.capTrue,
slice_blob: function(value) {
return value && I.mode === 'browser';
},
stream_upload: function(value) {
return value && I.mode === 'browser';
},
summon_file_dialog: false,
upload_filesize: function(size) {
return Basic.parseSizeStr(size) <= 2097152 || I.mode === 'client';
},
use_http_method: function(methods) {
return !Basic.arrayDiff(methods, ['GET', 'POST']);
}
}, {
// capabilities that require specific mode
access_binary: function(value) {
return value ? 'browser' : 'client';
},
access_image_binary: function(value) {
return value ? 'browser' : 'client';
},
report_upload_progress: function(value) {
return value ? 'browser' : 'client';
},
return_response_type: function(responseType) {
return Basic.arrayDiff(responseType, ['', 'text', 'json', 'document']) ? 'browser' : ['client', 'browser'];
},
return_status_code: function(code) {
return Basic.arrayDiff(code, [200, 404]) ? 'browser' : ['client', 'browser'];
},
send_binary_string: function(value) {
return value ? 'browser' : 'client';
},
send_browser_cookies: function(value) {
return value ? 'browser' : 'client';
},
send_custom_headers: function(value) {
return value ? 'browser' : 'client';
},
stream_upload: function(value) {
return value ? 'client' : 'browser';
},
upload_filesize: function(size) {
return Basic.parseSizeStr(size) >= 2097152 ? 'client' : 'browser';
}
}, 'client');
// minimal requirement for Flash Player version
if (getShimVersion() < 10) {
this.mode = false; // with falsy mode, runtime won't operable, no matter what the mode was before
}
Basic.extend(this, {
getShim: function() {
return Dom.get(this.uid);
},
shimExec: function(component, action) {
var args = [].slice.call(arguments, 2);
return I.getShim().exec(this.uid, component, action, args);
},
init: function() {
var html, el, container;
container = this.getShimContainer();
// if not the minimal height, shims are not initialized in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc)
Basic.extend(container.style, {
position: 'absolute',
top: '-8px',
left: '-8px',
width: '9px',
height: '9px',
overflow: 'hidden'
});
// insert flash object
html = '<object id="' + this.uid + '" type="application/x-shockwave-flash" data="' + options.swf_url + '" ';
if (Env.browser === 'IE') {
html += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
}
html += 'width="100%" height="100%" style="outline:0">' +
'<param name="movie" value="' + options.swf_url + '" />' +
'<param name="flashvars" value="uid=' + escape(this.uid) + '&target=' + Env.global_event_dispatcher + '" />' +
'<param name="wmode" value="transparent" />' +
'<param name="allowscriptaccess" value="always" />' +
'</object>';
if (Env.browser === 'IE') {
el = document.createElement('div');
container.appendChild(el);
el.outerHTML = html;
el = container = null; // just in case
} else {
container.innerHTML = html;
}
// Init is dispatched by the shim
initTimer = setTimeout(function() {
if (I && !I.initialized) { // runtime might be already destroyed by this moment
I.trigger("Error", new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));
}
}, 5000);
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
clearTimeout(initTimer); // initialization check might be still onwait
options = initTimer = destroy = I = null;
};
}(this.destroy))
}, extensions);
}
Runtime.addConstructor(type, FlashRuntime);
return extensions;
});
// Included from: src/javascript/runtime/flash/file/Blob.js
/**
* Blob.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/file/Blob
@private
*/
define("moxie/runtime/flash/file/Blob", [
"moxie/runtime/flash/Runtime",
"moxie/file/Blob"
], function(extensions, Blob) {
var FlashBlob = {
slice: function(blob, start, end, type) {
var self = this.getRuntime();
if (start < 0) {
start = Math.max(blob.size + start, 0);
} else if (start > 0) {
start = Math.min(start, blob.size);
}
if (end < 0) {
end = Math.max(blob.size + end, 0);
} else if (end > 0) {
end = Math.min(end, blob.size);
}
blob = self.shimExec.call(this, 'Blob', 'slice', start, end, type || '');
if (blob) {
blob = new Blob(self.uid, blob);
}
return blob;
}
};
return (extensions.Blob = FlashBlob);
});
// Included from: src/javascript/runtime/flash/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/file/FileInput
@private
*/
define("moxie/runtime/flash/file/FileInput", [
"moxie/runtime/flash/Runtime"
], function(extensions) {
var FileInput = {
init: function(options) {
this.getRuntime().shimExec.call(this, 'FileInput', 'init', {
name: options.name,
accept: options.accept,
multiple: options.multiple
});
this.trigger('ready');
}
};
return (extensions.FileInput = FileInput);
});
// Included from: src/javascript/runtime/flash/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/file/FileReader
@private
*/
define("moxie/runtime/flash/file/FileReader", [
"moxie/runtime/flash/Runtime",
"moxie/core/utils/Encode"
], function(extensions, Encode) {
var _result = '';
function _formatData(data, op) {
switch (op) {
case 'readAsText':
return Encode.atob(data, 'utf8');
case 'readAsBinaryString':
return Encode.atob(data);
case 'readAsDataURL':
return data;
}
return null;
}
var FileReader = {
read: function(op, blob) {
var target = this, self = target.getRuntime();
// special prefix for DataURL read mode
if (op === 'readAsDataURL') {
_result = 'data:' + (blob.type || '') + ';base64,';
}
target.bind('Progress', function(e, data) {
if (data) {
_result += _formatData(data, op);
}
});
return self.shimExec.call(this, 'FileReader', 'readAsBase64', blob.uid);
},
getResult: function() {
return _result;
},
destroy: function() {
_result = null;
}
};
return (extensions.FileReader = FileReader);
});
// Included from: src/javascript/runtime/flash/file/FileReaderSync.js
/**
* FileReaderSync.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/file/FileReaderSync
@private
*/
define("moxie/runtime/flash/file/FileReaderSync", [
"moxie/runtime/flash/Runtime",
"moxie/core/utils/Encode"
], function(extensions, Encode) {
function _formatData(data, op) {
switch (op) {
case 'readAsText':
return Encode.atob(data, 'utf8');
case 'readAsBinaryString':
return Encode.atob(data);
case 'readAsDataURL':
return data;
}
return null;
}
var FileReaderSync = {
read: function(op, blob) {
var result, self = this.getRuntime();
result = self.shimExec.call(this, 'FileReaderSync', 'readAsBase64', blob.uid);
if (!result) {
return null; // or throw ex
}
// special prefix for DataURL read mode
if (op === 'readAsDataURL') {
result = 'data:' + (blob.type || '') + ';base64,' + result;
}
return _formatData(result, op, blob.type);
}
};
return (extensions.FileReaderSync = FileReaderSync);
});
// Included from: src/javascript/runtime/Transporter.js
/**
* Transporter.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/runtime/Transporter", [
"moxie/core/utils/Basic",
"moxie/core/utils/Encode",
"moxie/runtime/RuntimeClient",
"moxie/core/EventTarget"
], function(Basic, Encode, RuntimeClient, EventTarget) {
function Transporter() {
var mod, _runtime, _data, _size, _pos, _chunk_size;
RuntimeClient.call(this);
Basic.extend(this, {
uid: Basic.guid('uid_'),
state: Transporter.IDLE,
result: null,
transport: function(data, type, options) {
var self = this;
options = Basic.extend({
chunk_size: 204798
}, options);
// should divide by three, base64 requires this
if ((mod = options.chunk_size % 3)) {
options.chunk_size += 3 - mod;
}
_chunk_size = options.chunk_size;
_reset.call(this);
_data = data;
_size = data.length;
if (Basic.typeOf(options) === 'string' || options.ruid) {
_run.call(self, type, this.connectRuntime(options));
} else {
// we require this to run only once
var cb = function(e, runtime) {
self.unbind("RuntimeInit", cb);
_run.call(self, type, runtime);
};
this.bind("RuntimeInit", cb);
this.connectRuntime(options);
}
},
abort: function() {
var self = this;
self.state = Transporter.IDLE;
if (_runtime) {
_runtime.exec.call(self, 'Transporter', 'clear');
self.trigger("TransportingAborted");
}
_reset.call(self);
},
destroy: function() {
this.unbindAll();
_runtime = null;
this.disconnectRuntime();
_reset.call(this);
}
});
function _reset() {
_size = _pos = 0;
_data = this.result = null;
}
function _run(type, runtime) {
var self = this;
_runtime = runtime;
//self.unbind("RuntimeInit");
self.bind("TransportingProgress", function(e) {
_pos = e.loaded;
if (_pos < _size && Basic.inArray(self.state, [Transporter.IDLE, Transporter.DONE]) === -1) {
_transport.call(self);
}
}, 999);
self.bind("TransportingComplete", function() {
_pos = _size;
self.state = Transporter.DONE;
_data = null; // clean a bit
self.result = _runtime.exec.call(self, 'Transporter', 'getAsBlob', type || '');
}, 999);
self.state = Transporter.BUSY;
self.trigger("TransportingStarted");
_transport.call(self);
}
function _transport() {
var self = this,
chunk,
bytesLeft = _size - _pos;
if (_chunk_size > bytesLeft) {
_chunk_size = bytesLeft;
}
chunk = Encode.btoa(_data.substr(_pos, _chunk_size));
_runtime.exec.call(self, 'Transporter', 'receive', chunk, _size);
}
}
Transporter.IDLE = 0;
Transporter.BUSY = 1;
Transporter.DONE = 2;
Transporter.prototype = EventTarget.instance;
return Transporter;
});
// Included from: src/javascript/runtime/flash/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/xhr/XMLHttpRequest
@private
*/
define("moxie/runtime/flash/xhr/XMLHttpRequest", [
"moxie/runtime/flash/Runtime",
"moxie/core/utils/Basic",
"moxie/file/Blob",
"moxie/file/File",
"moxie/file/FileReaderSync",
"moxie/xhr/FormData",
"moxie/runtime/Transporter"
], function(extensions, Basic, Blob, File, FileReaderSync, FormData, Transporter) {
var XMLHttpRequest = {
send: function(meta, data) {
var target = this, self = target.getRuntime();
function send() {
meta.transport = self.mode;
self.shimExec.call(target, 'XMLHttpRequest', 'send', meta, data);
}
function appendBlob(name, blob) {
self.shimExec.call(target, 'XMLHttpRequest', 'appendBlob', name, blob.uid);
data = null;
send();
}
function attachBlob(blob, cb) {
var tr = new Transporter();
tr.bind("TransportingComplete", function() {
cb(this.result);
});
tr.transport(blob.getSource(), blob.type, {
ruid: self.uid
});
}
// copy over the headers if any
if (!Basic.isEmptyObj(meta.headers)) {
Basic.each(meta.headers, function(value, header) {
self.shimExec.call(target, 'XMLHttpRequest', 'setRequestHeader', header, value.toString()); // Silverlight doesn't accept integers into the arguments of type object
});
}
// transfer over multipart params and blob itself
if (data instanceof FormData) {
var blobField;
data.each(function(value, name) {
if (value instanceof Blob) {
blobField = name;
} else {
self.shimExec.call(target, 'XMLHttpRequest', 'append', name, value);
}
});
if (!data.hasBlob()) {
data = null;
send();
} else {
var blob = data.getBlob();
if (blob.isDetached()) {
attachBlob(blob, function(attachedBlob) {
blob.destroy();
appendBlob(blobField, attachedBlob);
});
} else {
appendBlob(blobField, blob);
}
}
} else if (data instanceof Blob) {
if (data.isDetached()) {
attachBlob(data, function(attachedBlob) {
data.destroy();
data = attachedBlob.uid;
send();
});
} else {
data = data.uid;
send();
}
} else {
send();
}
},
getResponse: function(responseType) {
var frs, blob, self = this.getRuntime();
blob = self.shimExec.call(this, 'XMLHttpRequest', 'getResponseAsBlob');
if (blob) {
blob = new File(self.uid, blob);
if ('blob' === responseType) {
return blob;
}
try {
frs = new FileReaderSync();
if (!!~Basic.inArray(responseType, ["", "text"])) {
return frs.readAsText(blob);
} else if ('json' === responseType && !!window.JSON) {
return JSON.parse(frs.readAsText(blob));
}
} finally {
blob.destroy();
}
}
return null;
},
abort: function(upload_complete_flag) {
var self = this.getRuntime();
self.shimExec.call(this, 'XMLHttpRequest', 'abort');
this.dispatchEvent('readystatechange');
// this.dispatchEvent('progress');
this.dispatchEvent('abort');
//if (!upload_complete_flag) {
// this.dispatchEvent('uploadprogress');
//}
}
};
return (extensions.XMLHttpRequest = XMLHttpRequest);
});
// Included from: src/javascript/runtime/html4/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global File:true */
/**
Defines constructor for HTML4 runtime.
@class moxie/runtime/html4/Runtime
@private
*/
define("moxie/runtime/html4/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/Runtime",
"moxie/core/utils/Env"
], function(Basic, x, Runtime, Env) {
var type = 'html4', extensions = {};
function Html4Runtime(options) {
var I = this
, Test = Runtime.capTest
, True = Runtime.capTrue
;
Runtime.call(this, options, type, {
access_binary: Test(window.FileReader || window.File && File.getAsDataURL),
access_image_binary: false,
display_media: Test(extensions.Image && (Env.can('create_canvas') || Env.can('use_data_uri_over32kb'))),
do_cors: false,
drag_and_drop: false,
filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest
return (Env.browser === 'Chrome' && Env.version >= 28) || (Env.browser === 'IE' && Env.version >= 10);
}()),
resize_image: function() {
return extensions.Image && I.can('access_binary') && Env.can('create_canvas');
},
report_upload_progress: false,
return_response_headers: false,
return_response_type: function(responseType) {
if (responseType === 'json' && !!window.JSON) {
return true;
}
return !!~Basic.inArray(responseType, ['text', 'document', '']);
},
return_status_code: function(code) {
return !Basic.arrayDiff(code, [200, 404]);
},
select_file: function() {
return Env.can('use_fileinput');
},
select_multiple: false,
send_binary_string: false,
send_custom_headers: false,
send_multipart: true,
slice_blob: false,
stream_upload: function() {
return I.can('select_file');
},
summon_file_dialog: Test(function() { // yeah... some dirty sniffing here...
return (Env.browser === 'Firefox' && Env.version >= 4) ||
(Env.browser === 'Opera' && Env.version >= 12) ||
!!~Basic.inArray(Env.browser, ['Chrome', 'Safari']);
}()),
upload_filesize: True,
use_http_method: function(methods) {
return !Basic.arrayDiff(methods, ['GET', 'POST']);
}
});
Basic.extend(this, {
init : function() {
this.trigger("Init");
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
destroy = I = null;
};
}(this.destroy))
});
Basic.extend(this.getShim(), extensions);
}
Runtime.addConstructor(type, Html4Runtime);
return extensions;
});
// Included from: src/javascript/core/utils/Events.js
/**
* Events.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Events', [
'moxie/core/utils/Basic'
], function(Basic) {
var eventhash = {}, uid = 'moxie_' + Basic.guid();
// IE W3C like event funcs
function preventDefault() {
this.returnValue = false;
}
function stopPropagation() {
this.cancelBubble = true;
}
/**
Adds an event handler to the specified object and store reference to the handler
in objects internal Plupload registry (@see removeEvent).
@method addEvent
@for Utils
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Name to add event listener to.
@param {Function} callback Function to call when event occurs.
@param {String} [key] that might be used to add specifity to the event record.
*/
var addEvent = function(obj, name, callback, key) {
var func, events;
name = name.toLowerCase();
// Add event listener
if (obj.addEventListener) {
func = callback;
obj.addEventListener(name, func, false);
} else if (obj.attachEvent) {
func = function() {
var evt = window.event;
if (!evt.target) {
evt.target = evt.srcElement;
}
evt.preventDefault = preventDefault;
evt.stopPropagation = stopPropagation;
callback(evt);
};
obj.attachEvent('on' + name, func);
}
// Log event handler to objects internal mOxie registry
if (!obj[uid]) {
obj[uid] = Basic.guid();
}
if (!eventhash.hasOwnProperty(obj[uid])) {
eventhash[obj[uid]] = {};
}
events = eventhash[obj[uid]];
if (!events.hasOwnProperty(name)) {
events[name] = [];
}
events[name].push({
func: func,
orig: callback, // store original callback for IE
key: key
});
};
/**
Remove event handler from the specified object. If third argument (callback)
is not specified remove all events with the specified name.
@method removeEvent
@static
@param {Object} obj DOM element to remove event listener(s) from.
@param {String} name Name of event listener to remove.
@param {Function|String} [callback] might be a callback or unique key to match.
*/
var removeEvent = function(obj, name, callback) {
var type, undef;
name = name.toLowerCase();
if (obj[uid] && eventhash[obj[uid]] && eventhash[obj[uid]][name]) {
type = eventhash[obj[uid]][name];
} else {
return;
}
for (var i = type.length - 1; i >= 0; i--) {
// undefined or not, key should match
if (type[i].orig === callback || type[i].key === callback) {
if (obj.removeEventListener) {
obj.removeEventListener(name, type[i].func, false);
} else if (obj.detachEvent) {
obj.detachEvent('on'+name, type[i].func);
}
type[i].orig = null;
type[i].func = null;
type.splice(i, 1);
// If callback was passed we are done here, otherwise proceed
if (callback !== undef) {
break;
}
}
}
// If event array got empty, remove it
if (!type.length) {
delete eventhash[obj[uid]][name];
}
// If mOxie registry has become empty, remove it
if (Basic.isEmptyObj(eventhash[obj[uid]])) {
delete eventhash[obj[uid]];
// IE doesn't let you remove DOM object property with - delete
try {
delete obj[uid];
} catch(e) {
obj[uid] = undef;
}
}
};
/**
Remove all kind of events from the specified object
@method removeAllEvents
@static
@param {Object} obj DOM element to remove event listeners from.
@param {String} [key] unique key to match, when removing events.
*/
var removeAllEvents = function(obj, key) {
if (!obj || !obj[uid]) {
return;
}
Basic.each(eventhash[obj[uid]], function(events, name) {
removeEvent(obj, name, key);
});
};
return {
addEvent: addEvent,
removeEvent: removeEvent,
removeAllEvents: removeAllEvents
};
});
// Included from: src/javascript/runtime/html4/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/file/FileInput
@private
*/
define("moxie/runtime/html4/file/FileInput", [
"moxie/runtime/html4/Runtime",
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/utils/Events",
"moxie/core/utils/Mime",
"moxie/core/utils/Env"
], function(extensions, Basic, Dom, Events, Mime, Env) {
function FileInput() {
var _uid, _files = [], _mimes = [], _options;
function addInput() {
var comp = this, I = comp.getRuntime(), shimContainer, browseButton, currForm, form, input, uid;
uid = Basic.guid('uid_');
shimContainer = I.getShimContainer(); // we get new ref everytime to avoid memory leaks in IE
if (_uid) { // move previous form out of the view
currForm = Dom.get(_uid + '_form');
if (currForm) {
Basic.extend(currForm.style, { top: '100%' });
}
}
// build form in DOM, since innerHTML version not able to submit file for some reason
form = document.createElement('form');
form.setAttribute('id', uid + '_form');
form.setAttribute('method', 'post');
form.setAttribute('enctype', 'multipart/form-data');
form.setAttribute('encoding', 'multipart/form-data');
Basic.extend(form.style, {
overflow: 'hidden',
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: '100%'
});
input = document.createElement('input');
input.setAttribute('id', uid);
input.setAttribute('type', 'file');
input.setAttribute('name', _options.name || 'Filedata');
input.setAttribute('accept', _mimes.join(','));
Basic.extend(input.style, {
fontSize: '999px',
opacity: 0
});
form.appendChild(input);
shimContainer.appendChild(form);
// prepare file input to be placed underneath the browse_button element
Basic.extend(input.style, {
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: '100%'
});
if (Env.browser === 'IE' && Env.version < 10) {
Basic.extend(input.style, {
filter : "progid:DXImageTransform.Microsoft.Alpha(opacity=0)"
});
}
input.onchange = function() { // there should be only one handler for this
var file;
if (!this.value) {
return;
}
if (this.files) {
file = this.files[0];
} else {
file = {
name: this.value
};
}
_files = [file];
this.onchange = function() {}; // clear event handler
addInput.call(comp);
// after file is initialized as o.File, we need to update form and input ids
comp.bind('change', function onChange() {
var input = Dom.get(uid), form = Dom.get(uid + '_form'), file;
comp.unbind('change', onChange);
if (comp.files.length && input && form) {
file = comp.files[0];
input.setAttribute('id', file.uid);
form.setAttribute('id', file.uid + '_form');
// set upload target
form.setAttribute('target', file.uid + '_iframe');
}
input = form = null;
}, 998);
input = form = null;
comp.trigger('change');
};
// route click event to the input
if (I.can('summon_file_dialog')) {
browseButton = Dom.get(_options.browse_button);
Events.removeEvent(browseButton, 'click', comp.uid);
Events.addEvent(browseButton, 'click', function(e) {
if (input && !input.disabled) { // for some reason FF (up to 8.0.1 so far) lets to click disabled input[type=file]
input.click();
}
e.preventDefault();
}, comp.uid);
}
_uid = uid;
shimContainer = currForm = browseButton = null;
}
Basic.extend(this, {
init: function(options) {
var comp = this, I = comp.getRuntime(), shimContainer;
// figure out accept string
_options = options;
_mimes = options.accept.mimes || Mime.extList2mimes(options.accept, I.can('filter_by_extension'));
shimContainer = I.getShimContainer();
(function() {
var browseButton, zIndex, top;
browseButton = Dom.get(options.browse_button);
// Route click event to the input[type=file] element for browsers that support such behavior
if (I.can('summon_file_dialog')) {
if (Dom.getStyle(browseButton, 'position') === 'static') {
browseButton.style.position = 'relative';
}
zIndex = parseInt(Dom.getStyle(browseButton, 'z-index'), 10) || 1;
browseButton.style.zIndex = zIndex;
shimContainer.style.zIndex = zIndex - 1;
}
/* Since we have to place input[type=file] on top of the browse_button for some browsers,
browse_button loses interactivity, so we restore it here */
top = I.can('summon_file_dialog') ? browseButton : shimContainer;
Events.addEvent(top, 'mouseover', function() {
comp.trigger('mouseenter');
}, comp.uid);
Events.addEvent(top, 'mouseout', function() {
comp.trigger('mouseleave');
}, comp.uid);
Events.addEvent(top, 'mousedown', function() {
comp.trigger('mousedown');
}, comp.uid);
Events.addEvent(Dom.get(options.container), 'mouseup', function() {
comp.trigger('mouseup');
}, comp.uid);
browseButton = null;
}());
addInput.call(this);
shimContainer = null;
// trigger ready event asynchronously
comp.trigger({
type: 'ready',
async: true
});
},
getFiles: function() {
return _files;
},
disable: function(state) {
var input;
if ((input = Dom.get(_uid))) {
input.disabled = !!state;
}
},
destroy: function() {
var I = this.getRuntime()
, shim = I.getShim()
, shimContainer = I.getShimContainer()
;
Events.removeAllEvents(shimContainer, this.uid);
Events.removeAllEvents(_options && Dom.get(_options.container), this.uid);
Events.removeAllEvents(_options && Dom.get(_options.browse_button), this.uid);
if (shimContainer) {
shimContainer.innerHTML = '';
}
shim.removeInstance(this.uid);
_uid = _files = _mimes = _options = shimContainer = shim = null;
}
});
}
return (extensions.FileInput = FileInput);
});
// Included from: src/javascript/runtime/html5/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global File:true */
/**
Defines constructor for HTML5 runtime.
@class moxie/runtime/html5/Runtime
@private
*/
define("moxie/runtime/html5/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/Runtime",
"moxie/core/utils/Env"
], function(Basic, x, Runtime, Env) {
var type = "html5", extensions = {};
function Html5Runtime(options) {
var I = this
, Test = Runtime.capTest
, True = Runtime.capTrue
;
var caps = Basic.extend({
access_binary: Test(window.FileReader || window.File && window.File.getAsDataURL),
access_image_binary: function() {
return I.can('access_binary') && !!extensions.Image;
},
display_media: Test(Env.can('create_canvas') || Env.can('use_data_uri_over32kb')),
do_cors: Test(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),
drag_and_drop: Test(function() {
// this comes directly from Modernizr: http://www.modernizr.com/
var div = document.createElement('div');
// IE has support for drag and drop since version 5, but doesn't support dropping files from desktop
return (('draggable' in div) || ('ondragstart' in div && 'ondrop' in div)) && (Env.browser !== 'IE' || Env.version > 9);
}()),
filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest
return (Env.browser === 'Chrome' && Env.version >= 28) || (Env.browser === 'IE' && Env.version >= 10);
}()),
return_response_headers: True,
return_response_type: function(responseType) {
if (responseType === 'json' && !!window.JSON) { // we can fake this one even if it's not supported
return true;
}
return Env.can('return_response_type', responseType);
},
return_status_code: True,
report_upload_progress: Test(window.XMLHttpRequest && new XMLHttpRequest().upload),
resize_image: function() {
return I.can('access_binary') && Env.can('create_canvas');
},
select_file: function() {
return Env.can('use_fileinput') && window.File;
},
select_folder: function() {
return I.can('select_file') && Env.browser === 'Chrome' && Env.version >= 21;
},
select_multiple: function() {
// it is buggy on Safari Windows and iOS
return I.can('select_file') &&
!(Env.browser === 'Safari' && Env.os === 'Windows') &&
!(Env.os === 'iOS' && Env.verComp(Env.osVersion, "7.0.4", '<'));
},
send_binary_string: Test(window.XMLHttpRequest && (new XMLHttpRequest().sendAsBinary || (window.Uint8Array && window.ArrayBuffer))),
send_custom_headers: Test(window.XMLHttpRequest),
send_multipart: function() {
return !!(window.XMLHttpRequest && new XMLHttpRequest().upload && window.FormData) || I.can('send_binary_string');
},
slice_blob: Test(window.File && (File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice)),
stream_upload: function(){
return I.can('slice_blob') && I.can('send_multipart');
},
summon_file_dialog: Test(function() { // yeah... some dirty sniffing here...
return (Env.browser === 'Firefox' && Env.version >= 4) ||
(Env.browser === 'Opera' && Env.version >= 12) ||
(Env.browser === 'IE' && Env.version >= 10) ||
!!~Basic.inArray(Env.browser, ['Chrome', 'Safari']);
}()),
upload_filesize: True
},
arguments[2]
);
Runtime.call(this, options, (arguments[1] || type), caps);
Basic.extend(this, {
init : function() {
this.trigger("Init");
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
destroy = I = null;
};
}(this.destroy))
});
Basic.extend(this.getShim(), extensions);
}
Runtime.addConstructor(type, Html5Runtime);
return extensions;
});
// Included from: src/javascript/runtime/html5/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/file/FileReader
@private
*/
define("moxie/runtime/html5/file/FileReader", [
"moxie/runtime/html5/Runtime",
"moxie/core/utils/Encode",
"moxie/core/utils/Basic"
], function(extensions, Encode, Basic) {
function FileReader() {
var _fr, _convertToBinary = false;
Basic.extend(this, {
read: function(op, blob) {
var target = this;
_fr = new window.FileReader();
_fr.addEventListener('progress', function(e) {
target.trigger(e);
});
_fr.addEventListener('load', function(e) {
target.trigger(e);
});
_fr.addEventListener('error', function(e) {
target.trigger(e, _fr.error);
});
_fr.addEventListener('loadend', function() {
_fr = null;
});
if (Basic.typeOf(_fr[op]) === 'function') {
_convertToBinary = false;
_fr[op](blob.getSource());
} else if (op === 'readAsBinaryString') { // readAsBinaryString is depricated in general and never existed in IE10+
_convertToBinary = true;
_fr.readAsDataURL(blob.getSource());
}
},
getResult: function() {
return _fr && _fr.result ? (_convertToBinary ? _toBinary(_fr.result) : _fr.result) : null;
},
abort: function() {
if (_fr) {
_fr.abort();
}
},
destroy: function() {
_fr = null;
}
});
function _toBinary(str) {
return Encode.atob(str.substring(str.indexOf('base64,') + 7));
}
}
return (extensions.FileReader = FileReader);
});
// Included from: src/javascript/runtime/html4/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/file/FileReader
@private
*/
define("moxie/runtime/html4/file/FileReader", [
"moxie/runtime/html4/Runtime",
"moxie/runtime/html5/file/FileReader"
], function(extensions, FileReader) {
return (extensions.FileReader = FileReader);
});
// Included from: src/javascript/runtime/html4/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/xhr/XMLHttpRequest
@private
*/
define("moxie/runtime/html4/xhr/XMLHttpRequest", [
"moxie/runtime/html4/Runtime",
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/utils/Url",
"moxie/core/Exceptions",
"moxie/core/utils/Events",
"moxie/file/Blob",
"moxie/xhr/FormData"
], function(extensions, Basic, Dom, Url, x, Events, Blob, FormData) {
function XMLHttpRequest() {
var _status, _response, _iframe;
function cleanup(cb) {
var target = this, uid, form, inputs, i, hasFile = false;
if (!_iframe) {
return;
}
uid = _iframe.id.replace(/_iframe$/, '');
form = Dom.get(uid + '_form');
if (form) {
inputs = form.getElementsByTagName('input');
i = inputs.length;
while (i--) {
switch (inputs[i].getAttribute('type')) {
case 'hidden':
inputs[i].parentNode.removeChild(inputs[i]);
break;
case 'file':
hasFile = true; // flag the case for later
break;
}
}
inputs = [];
if (!hasFile) { // we need to keep the form for sake of possible retries
form.parentNode.removeChild(form);
}
form = null;
}
// without timeout, request is marked as canceled (in console)
setTimeout(function() {
Events.removeEvent(_iframe, 'load', target.uid);
if (_iframe.parentNode) { // #382
_iframe.parentNode.removeChild(_iframe);
}
// check if shim container has any other children, if - not, remove it as well
var shimContainer = target.getRuntime().getShimContainer();
if (!shimContainer.children.length) {
shimContainer.parentNode.removeChild(shimContainer);
}
shimContainer = _iframe = null;
cb();
}, 1);
}
Basic.extend(this, {
send: function(meta, data) {
var target = this, I = target.getRuntime(), uid, form, input, blob;
_status = _response = null;
function createIframe() {
var container = I.getShimContainer() || document.body
, temp = document.createElement('div')
;
// IE 6 won't be able to set the name using setAttribute or iframe.name
temp.innerHTML = '<iframe id="' + uid + '_iframe" name="' + uid + '_iframe" src="javascript:""" style="display:none"></iframe>';
_iframe = temp.firstChild;
container.appendChild(_iframe);
/* _iframe.onreadystatechange = function() {
console.info(_iframe.readyState);
};*/
Events.addEvent(_iframe, 'load', function() { // _iframe.onload doesn't work in IE lte 8
var el;
try {
el = _iframe.contentWindow.document || _iframe.contentDocument || window.frames[_iframe.id].document;
// try to detect some standard error pages
if (/^4(0[0-9]|1[0-7]|2[2346])\s/.test(el.title)) { // test if title starts with 4xx HTTP error
_status = el.title.replace(/^(\d+).*$/, '$1');
} else {
_status = 200;
// get result
_response = Basic.trim(el.body.innerHTML);
// we need to fire these at least once
target.trigger({
type: 'progress',
loaded: _response.length,
total: _response.length
});
if (blob) { // if we were uploading a file
target.trigger({
type: 'uploadprogress',
loaded: blob.size || 1025,
total: blob.size || 1025
});
}
}
} catch (ex) {
if (Url.hasSameOrigin(meta.url)) {
// if response is sent with error code, iframe in IE gets redirected to res://ieframe.dll/http_x.htm
// which obviously results to cross domain error (wtf?)
_status = 404;
} else {
cleanup.call(target, function() {
target.trigger('error');
});
return;
}
}
cleanup.call(target, function() {
target.trigger('load');
});
}, target.uid);
} // end createIframe
// prepare data to be sent and convert if required
if (data instanceof FormData && data.hasBlob()) {
blob = data.getBlob();
uid = blob.uid;
input = Dom.get(uid);
form = Dom.get(uid + '_form');
if (!form) {
throw new x.DOMException(x.DOMException.NOT_FOUND_ERR);
}
} else {
uid = Basic.guid('uid_');
form = document.createElement('form');
form.setAttribute('id', uid + '_form');
form.setAttribute('method', meta.method);
form.setAttribute('enctype', 'multipart/form-data');
form.setAttribute('encoding', 'multipart/form-data');
form.setAttribute('target', uid + '_iframe');
I.getShimContainer().appendChild(form);
}
if (data instanceof FormData) {
data.each(function(value, name) {
if (value instanceof Blob) {
if (input) {
input.setAttribute('name', name);
}
} else {
var hidden = document.createElement('input');
Basic.extend(hidden, {
type : 'hidden',
name : name,
value : value
});
// make sure that input[type="file"], if it's there, comes last
if (input) {
form.insertBefore(hidden, input);
} else {
form.appendChild(hidden);
}
}
});
}
// set destination url
form.setAttribute("action", meta.url);
createIframe();
form.submit();
target.trigger('loadstart');
},
getStatus: function() {
return _status;
},
getResponse: function(responseType) {
if ('json' === responseType) {
// strip off <pre>..</pre> tags that might be enclosing the response
if (Basic.typeOf(_response) === 'string' && !!window.JSON) {
try {
return JSON.parse(_response.replace(/^\s*<pre[^>]*>/, '').replace(/<\/pre>\s*$/, ''));
} catch (ex) {
return null;
}
}
} else if ('document' === responseType) {
}
return _response;
},
abort: function() {
var target = this;
if (_iframe && _iframe.contentWindow) {
if (_iframe.contentWindow.stop) { // FireFox/Safari/Chrome
_iframe.contentWindow.stop();
} else if (_iframe.contentWindow.document.execCommand) { // IE
_iframe.contentWindow.document.execCommand('Stop');
} else {
_iframe.src = "about:blank";
}
}
cleanup.call(this, function() {
// target.dispatchEvent('readystatechange');
target.dispatchEvent('abort');
});
}
});
}
return (extensions.XMLHttpRequest = XMLHttpRequest);
});
// Included from: src/javascript/runtime/silverlight/Runtime.js
/**
* RunTime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global ActiveXObject:true */
/**
Defines constructor for Silverlight runtime.
@class moxie/runtime/silverlight/Runtime
@private
*/
define("moxie/runtime/silverlight/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/utils/Env",
"moxie/core/utils/Dom",
"moxie/core/Exceptions",
"moxie/runtime/Runtime"
], function(Basic, Env, Dom, x, Runtime) {
var type = "silverlight", extensions = {};
function isInstalled(version) {
var isVersionSupported = false, control = null, actualVer,
actualVerArray, reqVerArray, requiredVersionPart, actualVersionPart, index = 0;
try {
try {
control = new ActiveXObject('AgControl.AgControl');
if (control.IsVersionSupported(version)) {
isVersionSupported = true;
}
control = null;
} catch (e) {
var plugin = navigator.plugins["Silverlight Plug-In"];
if (plugin) {
actualVer = plugin.description;
if (actualVer === "1.0.30226.2") {
actualVer = "2.0.30226.2";
}
actualVerArray = actualVer.split(".");
while (actualVerArray.length > 3) {
actualVerArray.pop();
}
while ( actualVerArray.length < 4) {
actualVerArray.push(0);
}
reqVerArray = version.split(".");
while (reqVerArray.length > 4) {
reqVerArray.pop();
}
do {
requiredVersionPart = parseInt(reqVerArray[index], 10);
actualVersionPart = parseInt(actualVerArray[index], 10);
index++;
} while (index < reqVerArray.length && requiredVersionPart === actualVersionPart);
if (requiredVersionPart <= actualVersionPart && !isNaN(requiredVersionPart)) {
isVersionSupported = true;
}
}
}
} catch (e2) {
isVersionSupported = false;
}
return isVersionSupported;
}
/**
Constructor for the Silverlight Runtime
@class SilverlightRuntime
@extends Runtime
*/
function SilverlightRuntime(options) {
var I = this, initTimer;
options = Basic.extend({ xap_url: Env.xap_url }, options);
Runtime.call(this, options, type, {
access_binary: Runtime.capTrue,
access_image_binary: Runtime.capTrue,
display_media: Runtime.capTrue,
do_cors: Runtime.capTrue,
drag_and_drop: false,
report_upload_progress: Runtime.capTrue,
resize_image: Runtime.capTrue,
return_response_headers: function(value) {
return value && I.mode === 'client';
},
return_response_type: function(responseType) {
if (responseType !== 'json') {
return true;
} else {
return !!window.JSON;
}
},
return_status_code: function(code) {
return I.mode === 'client' || !Basic.arrayDiff(code, [200, 404]);
},
select_file: Runtime.capTrue,
select_multiple: Runtime.capTrue,
send_binary_string: Runtime.capTrue,
send_browser_cookies: function(value) {
return value && I.mode === 'browser';
},
send_custom_headers: function(value) {
return value && I.mode === 'client';
},
send_multipart: Runtime.capTrue,
slice_blob: Runtime.capTrue,
stream_upload: true,
summon_file_dialog: false,
upload_filesize: Runtime.capTrue,
use_http_method: function(methods) {
return I.mode === 'client' || !Basic.arrayDiff(methods, ['GET', 'POST']);
}
}, {
// capabilities that require specific mode
return_response_headers: function(value) {
return value ? 'client' : 'browser';
},
return_status_code: function(code) {
return Basic.arrayDiff(code, [200, 404]) ? 'client' : ['client', 'browser'];
},
send_browser_cookies: function(value) {
return value ? 'browser' : 'client';
},
send_custom_headers: function(value) {
return value ? 'client' : 'browser';
},
use_http_method: function(methods) {
return Basic.arrayDiff(methods, ['GET', 'POST']) ? 'client' : ['client', 'browser'];
}
});
// minimal requirement
if (!isInstalled('2.0.31005.0') || Env.browser === 'Opera') {
this.mode = false;
}
Basic.extend(this, {
getShim: function() {
return Dom.get(this.uid).content.Moxie;
},
shimExec: function(component, action) {
var args = [].slice.call(arguments, 2);
return I.getShim().exec(this.uid, component, action, args);
},
init : function() {
var container;
container = this.getShimContainer();
container.innerHTML = '<object id="' + this.uid + '" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">' +
'<param name="source" value="' + options.xap_url + '"/>' +
'<param name="background" value="Transparent"/>' +
'<param name="windowless" value="true"/>' +
'<param name="enablehtmlaccess" value="true"/>' +
'<param name="initParams" value="uid=' + this.uid + ',target=' + Env.global_event_dispatcher + '"/>' +
'</object>';
// Init is dispatched by the shim
initTimer = setTimeout(function() {
if (I && !I.initialized) { // runtime might be already destroyed by this moment
I.trigger("Error", new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));
}
}, Env.OS !== 'Windows'? 10000 : 5000); // give it more time to initialize in non Windows OS (like Mac)
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
clearTimeout(initTimer); // initialization check might be still onwait
options = initTimer = destroy = I = null;
};
}(this.destroy))
}, extensions);
}
Runtime.addConstructor(type, SilverlightRuntime);
return extensions;
});
// Included from: src/javascript/runtime/silverlight/file/Blob.js
/**
* Blob.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/file/Blob
@private
*/
define("moxie/runtime/silverlight/file/Blob", [
"moxie/runtime/silverlight/Runtime",
"moxie/core/utils/Basic",
"moxie/runtime/flash/file/Blob"
], function(extensions, Basic, Blob) {
return (extensions.Blob = Basic.extend({}, Blob));
});
// Included from: src/javascript/runtime/silverlight/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/file/FileInput
@private
*/
define("moxie/runtime/silverlight/file/FileInput", [
"moxie/runtime/silverlight/Runtime"
], function(extensions) {
var FileInput = {
init: function(options) {
function toFilters(accept) {
var filter = '';
for (var i = 0; i < accept.length; i++) {
filter += (filter !== '' ? '|' : '') + accept[i].title + " | *." + accept[i].extensions.replace(/,/g, ';*.');
}
return filter;
}
this.getRuntime().shimExec.call(this, 'FileInput', 'init', toFilters(options.accept), options.name, options.multiple);
this.trigger('ready');
}
};
return (extensions.FileInput = FileInput);
});
// Included from: src/javascript/runtime/silverlight/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/file/FileReader
@private
*/
define("moxie/runtime/silverlight/file/FileReader", [
"moxie/runtime/silverlight/Runtime",
"moxie/core/utils/Basic",
"moxie/runtime/flash/file/FileReader"
], function(extensions, Basic, FileReader) {
return (extensions.FileReader = Basic.extend({}, FileReader));
});
// Included from: src/javascript/runtime/silverlight/file/FileReaderSync.js
/**
* FileReaderSync.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/file/FileReaderSync
@private
*/
define("moxie/runtime/silverlight/file/FileReaderSync", [
"moxie/runtime/silverlight/Runtime",
"moxie/core/utils/Basic",
"moxie/runtime/flash/file/FileReaderSync"
], function(extensions, Basic, FileReaderSync) {
return (extensions.FileReaderSync = Basic.extend({}, FileReaderSync));
});
// Included from: src/javascript/runtime/silverlight/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/xhr/XMLHttpRequest
@private
*/
define("moxie/runtime/silverlight/xhr/XMLHttpRequest", [
"moxie/runtime/silverlight/Runtime",
"moxie/core/utils/Basic",
"moxie/runtime/flash/xhr/XMLHttpRequest"
], function(extensions, Basic, XMLHttpRequest) {
return (extensions.XMLHttpRequest = Basic.extend({}, XMLHttpRequest));
});
expose(["moxie/core/utils/Basic","moxie/core/I18n","moxie/core/utils/Mime","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/file/File","moxie/file/FileInput","moxie/runtime/RuntimeTarget","moxie/file/FileReader","moxie/core/utils/Url","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/runtime/Transporter","moxie/core/utils/Events"]);
})(this);/**
* o.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global moxie:true */
/**
Globally exposed namespace with the most frequently used public classes and handy methods.
@class o
@static
@private
*/
(function(exports) {
"use strict";
var o = {}, inArray = exports.moxie.core.utils.Basic.inArray;
// directly add some public classes
// (we do it dynamically here, since for custom builds we cannot know beforehand what modules were included)
(function addAlias(ns) {
var name, itemType;
for (name in ns) {
itemType = typeof(ns[name]);
if (itemType === 'object' && !~inArray(name, ['Exceptions', 'Env', 'Mime'])) {
addAlias(ns[name]);
} else if (itemType === 'function') {
o[name] = ns[name];
}
}
})(exports.moxie);
// add some manually
o.Env = exports.moxie.core.utils.Env;
o.Mime = exports.moxie.core.utils.Mime;
o.Exceptions = exports.moxie.core.Exceptions;
// expose globally
exports.mOxie = o;
if (!exports.o) {
exports.o = o;
}
return o;
})(this);
;webshim.register('filereader', function($, webshim, window, document, undefined, featureOptions){
"use strict";
var mOxie, moxie, hasXDomain;
var FormData = $.noop;
var sel = 'input[type="file"].ws-filereader';
var loadMoxie = function (){
webshim.loader.loadList(['moxie']);
};
var _createFilePicker = function(){
var $input, picker, $parent, onReset;
var input = this;
if(webshim.implement(input, 'filepicker')){
input = this;
$input = $(this);
$parent = $input.parent();
onReset = function(){
if(!input.value){
$input.prop('value', '');
}
};
$input.attr('tabindex', '-1').on('mousedown.filereaderwaiting click.filereaderwaiting', false);
$parent.addClass('ws-loading');
picker = new mOxie.FileInput({
browse_button: this,
accept: $.prop(this, 'accept'),
multiple: $.prop(this, 'multiple')
});
$input.jProp('form').on('reset', function(){
setTimeout(onReset);
});
picker.onready = function(){
$input.off('.fileraderwaiting');
$parent.removeClass('ws-waiting');
};
picker.onchange = function(e){
webshim.data(input, 'fileList', e.target.files);
$input.trigger('change');
};
picker.onmouseenter = function(){
$input.trigger('mouseover');
$parent.addClass('ws-mouseenter');
};
picker.onmouseleave = function(){
$input.trigger('mouseout');
$parent.removeClass('ws-mouseenter');
};
picker.onmousedown = function(){
$input.trigger('mousedown');
$parent.addClass('ws-active');
};
picker.onmouseup = function(){
$input.trigger('mouseup');
$parent.removeClass('ws-active');
};
webshim.data(input, 'filePicker', picker);
webshim.ready('WINDOWLOAD', function(){
var lastWidth;
$input.onWSOff('updateshadowdom', function(){
var curWitdth = input.offsetWidth;
if(curWitdth && lastWidth != curWitdth){
lastWidth = curWitdth;
picker.refresh();
}
});
});
webshim.addShadowDom();
picker.init();
if(input.disabled){
picker.disable(true);
}
}
};
var getFileNames = function(file){
return file.name;
};
var createFilePicker = function(){
var elem = this;
loadMoxie();
$(elem)
.on('mousedown.filereaderwaiting click.filereaderwaiting', false)
.parent()
.addClass('ws-loading')
;
webshim.ready('moxie', function(){
createFilePicker.call(elem);
});
};
var noxhr = /^(?:script|jsonp)$/i;
var notReadyYet = function(){
loadMoxie();
webshim.error('filereader/formdata not ready yet. please wait for moxie to load `webshim.ready("moxie", callbackFn);`` or wait for the first change event on input[type="file"].ws-filereader.')
};
var inputValueDesc = webshim.defineNodeNameProperty('input', 'value', {
prop: {
get: function(){
var fileList = webshim.data(this, 'fileList');
if(fileList && fileList.map){
return fileList.map(getFileNames).join(', ');
}
return inputValueDesc.prop._supget.call(this);
}
}
}
);
var shimMoxiePath = webshim.cfg.basePath+'moxie/';
var crossXMLMessage = 'You nedd a crossdomain.xml to get all "filereader" / "XHR2" / "CORS" features to work. Or host moxie.swf/moxie.xap on your server an configure filereader options: "swfpath"/"xappath"';
var testMoxie = function(options){
return (options.wsType == 'moxie' || (options.data && options.data instanceof mOxie.FormData) || (options.crossDomain && $.support.cors !== false && hasXDomain != 'no' && !noxhr.test(options.dataType || '')));
};
var createMoxieTransport = function (options){
if(testMoxie(options)){
var ajax;
webshim.info('moxie transfer used for $.ajax');
if(hasXDomain == 'no'){
webshim.error(crossXMLMessage);
}
return {
send: function( headers, completeCallback ) {
var proressEvent = function(obj, name){
if(options[name]){
var called = false;
ajax.addEventListener('load', function(e){
if(!called){
options[name]({type: 'progress', lengthComputable: true, total: 1, loaded: 1});
} else if(called.lengthComputable && called.total > called.loaded){
options[name]({type: 'progress', lengthComputable: true, total: called.total, loaded: called.total});
}
});
obj.addEventListener('progress', function(e){
called = e;
options[name](e);
});
}
};
ajax = new moxie.xhr.XMLHttpRequest();
ajax.open(options.type, options.url, options.async, options.username, options.password);
proressEvent(ajax.upload, featureOptions.uploadprogress);
proressEvent(ajax.upload, featureOptions.progress);
ajax.addEventListener('load', function(e){
var responses = {
text: ajax.responseText,
xml: ajax.responseXML
};
completeCallback(ajax.status, ajax.statusText, responses, ajax.getAllResponseHeaders());
});
if(options.xhrFields && options.xhrFields.withCredentials){
ajax.withCredentials = true;
}
if(options.timeout){
ajax.timeout = options.timeout;
}
$.each(headers, function(name, value){
ajax.setRequestHeader(name, value);
});
ajax.send(options.data);
},
abort: function() {
if(ajax){
ajax.abort();
}
}
};
}
};
var transports = {
//based on script: https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest
xdomain: (function(){
var httpRegEx = /^https?:\/\//i;
var getOrPostRegEx = /^get|post$/i;
var sameSchemeRegEx = new RegExp('^'+location.protocol, 'i');
return function(options, userOptions, jqXHR) {
// Only continue if the request is: asynchronous, uses GET or POST method, has HTTP or HTTPS protocol, and has the same scheme as the calling page
if (!options.crossDomain || options.username || (options.xhrFields && options.xhrFields.withCredentials) || !options.async || !getOrPostRegEx.test(options.type) || !httpRegEx.test(options.url) || !sameSchemeRegEx.test(options.url) || (options.data && options.data instanceof mOxie.FormData) || noxhr.test(options.dataType || '')) {
return;
}
var xdr = null;
webshim.info('xdomain transport used.');
return {
send: function(headers, complete) {
var postData = '';
var userType = (userOptions.dataType || '').toLowerCase();
xdr = new XDomainRequest();
if (/^\d+$/.test(userOptions.timeout)) {
xdr.timeout = userOptions.timeout;
}
xdr.ontimeout = function() {
complete(500, 'timeout');
};
xdr.onload = function() {
var allResponseHeaders = 'Content-Length: ' + xdr.responseText.length + '\r\nContent-Type: ' + xdr.contentType;
var status = {
code: xdr.status || 200,
message: xdr.statusText || 'OK'
};
var responses = {
text: xdr.responseText,
xml: xdr.responseXML
};
try {
if (userType === 'html' || /text\/html/i.test(xdr.contentType)) {
responses.html = xdr.responseText;
} else if (userType === 'json' || (userType !== 'text' && /\/json/i.test(xdr.contentType))) {
try {
responses.json = $.parseJSON(xdr.responseText);
} catch(e) {
}
} else if (userType === 'xml' && !xdr.responseXML) {
var doc;
try {
doc = new ActiveXObject('Microsoft.XMLDOM');
doc.async = false;
doc.loadXML(xdr.responseText);
} catch(e) {
}
responses.xml = doc;
}
} catch(parseMessage) {}
complete(status.code, status.message, responses, allResponseHeaders);
};
// set an empty handler for 'onprogress' so requests don't get aborted
xdr.onprogress = function(){};
xdr.onerror = function() {
complete(500, 'error', {
text: xdr.responseText
});
};
if (userOptions.data) {
postData = ($.type(userOptions.data) === 'string') ? userOptions.data : $.param(userOptions.data);
}
xdr.open(options.type, options.url);
xdr.send(postData);
},
abort: function() {
if (xdr) {
xdr.abort();
}
}
};
};
})(),
moxie: function (options, originalOptions, jqXHR){
if(testMoxie(options)){
loadMoxie(options);
var ajax;
var tmpTransport = {
send: function( headers, completeCallback ) {
ajax = true;
webshim.ready('moxie', function(){
if(ajax){
ajax = createMoxieTransport(options, originalOptions, jqXHR);
tmpTransport.send = ajax.send;
tmpTransport.abort = ajax.abort;
ajax.send(headers, completeCallback);
}
});
},
abort: function() {
ajax = false;
}
};
return tmpTransport;
}
}
};
if(!featureOptions.progress){
featureOptions.progress = 'onprogress';
}
if(!featureOptions.uploadprogress){
featureOptions.uploadprogress = 'onuploadprogress';
}
if(!featureOptions.swfpath){
featureOptions.swfpath = shimMoxiePath+'flash/Moxie.min.swf';
}
if(!featureOptions.xappath){
featureOptions.xappath = shimMoxiePath+'silverlight/Moxie.min.xap';
}
if($.support.cors !== false || !window.XDomainRequest){
delete transports.xdomain;
}
$.ajaxTransport("+*", function( options, originalOptions, jqXHR ) {
var ajax, type;
if(options.wsType || transports[transports]){
ajax = transports[transports](options, originalOptions, jqXHR);
}
if(!ajax){
for(type in transports){
ajax = transports[type](options, originalOptions, jqXHR);
if(ajax){break;}
}
}
return ajax;
});
webshim.defineNodeNameProperty('input', 'files', {
prop: {
writeable: false,
get: function(){
if(this.type != 'file'){return null;}
if(!$(this).hasClass('ws-filereader')){
webshim.info("please add the 'ws-filereader' class to your input[type='file'] to implement files-property");
}
return webshim.data(this, 'fileList') || [];
}
}
}
);
webshim.reflectProperties(['input'], ['accept']);
if($('<input />').prop('multiple') == null){
webshim.defineNodeNamesBooleanProperty(['input'], ['multiple']);
}
webshim.onNodeNamesPropertyModify('input', 'disabled', function(value, boolVal, type){
var picker = webshim.data(this, 'filePicker');
if(picker){
picker.disable(boolVal);
}
});
webshim.onNodeNamesPropertyModify('input', 'value', function(value, boolVal, type){
if(value === '' && this.type == 'file' && $(this).hasClass('ws-filereader')){
webshim.data(this, 'fileList', []);
}
});
window.FileReader = notReadyYet;
window.FormData = notReadyYet;
webshim.ready('moxie', function(){
var wsMimes = 'application/xml,xml';
moxie = window.moxie;
mOxie = window.mOxie;
mOxie.Env.swf_url = featureOptions.swfpath;
mOxie.Env.xap_url = featureOptions.xappath;
window.FileReader = mOxie.FileReader;
window.FormData = function(form){
var appendData, i, len, files, fileI, fileLen, inputName;
var moxieData = new mOxie.FormData();
if(form && $.nodeName(form, 'form')){
appendData = $(form).serializeArray();
for(i = 0; i < appendData.length; i++){
if(Array.isArray(appendData[i].value)){
appendData[i].value.forEach(function(val){
moxieData.append(appendData[i].name, val);
});
} else {
moxieData.append(appendData[i].name, appendData[i].value);
}
}
appendData = form.querySelectorAll('input[type="file"][name]');
for(i = 0, len = appendData.length; i < appendData.length; i++){
inputName = appendData[i].name;
if(inputName && !$(appendData[i]).is(':disabled')){
files = $.prop(appendData[i], 'files') || [];
if(files.length){
if(files.length > 1 || (moxieData.hasBlob && moxieData.hasBlob())){
webshim.error('FormData shim can only handle one file per ajax. Use multiple ajax request. One per file.');
}
for(fileI = 0, fileLen = files.length; fileI < fileLen; fileI++){
moxieData.append(inputName, files[fileI]);
}
}
}
}
}
return moxieData;
};
FormData = window.FormData;
createFilePicker = _createFilePicker;
transports.moxie = createMoxieTransport;
featureOptions.mimeTypes = (featureOptions.mimeTypes) ? wsMimes+','+featureOptions.mimeTypes : wsMimes;
try {
mOxie.Mime.addMimeType(featureOptions.mimeTypes);
} catch(e){
webshim.warn('mimetype to moxie error: '+e);
}
});
webshim.addReady(function(context, contextElem){
$(context.querySelectorAll(sel)).add(contextElem.filter(sel)).each(createFilePicker);
});
webshim.ready('WINDOWLOAD', loadMoxie);
if(webshim.cfg.debug !== false && featureOptions.swfpath.indexOf((location.protocol+'//'+location.hostname)) && featureOptions.swfpath.indexOf(('https://'+location.hostname))){
webshim.ready('WINDOWLOAD', function(){
var printMessage = function(){
if(hasXDomain == 'no'){
webshim.error(crossXMLMessage);
}
};
try {
hasXDomain = sessionStorage.getItem('wsXdomain.xml');
} catch(e){}
printMessage();
if(hasXDomain == null){
$.ajax({
url: 'crossdomain.xml',
type: 'HEAD',
dataType: 'xml',
success: function(){
hasXDomain = 'yes';
},
error: function(){
hasXDomain = 'no';
},
complete: function(){
try {
sessionStorage.setItem('wsXdomain.xml', hasXDomain);
} catch(e){}
printMessage();
}
});
}
});
}
});
|
pollard/containers/App.js | spncrlkt/pollard | import React, { Component } from 'react';
import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
import { Provider } from 'react-redux';
import { Route, Link } from 'react-router';
import {
ReduxRouter,
routerStateReducer,
reduxReactRouter
} from 'redux-router';
import { createHistory } from 'history';
import HTML5Backend from 'react-dnd-html5-backend';
import { DragDropContext } from 'react-dnd';
import { state } from '../reducers/reducer.js';
import Pollard from './Pollard';
import SetPage from '../components/SetPage';
import AdvancedSearch from '../components/AdvancedSearch';
import LoadSchedule from '../components/LoadSchedule';
import preserveSelected from '../middleware/preserveSelected.js';
import pushToServer from '../middleware/pushToServer.js';
// TODO
// remove combine reducers call
// const store = createStore(state);
const reducer = combineReducers({
router: routerStateReducer,
state: state
});
const store = compose(
applyMiddleware(
preserveSelected,
pushToServer
),
reduxReactRouter({createHistory}),
window.devToolsExtension ? window.devToolsExtension() : f => f
)(createStore)(reducer);
class App extends Component {
render() {
return (
<Provider store={store}>
<ReduxRouter>
<Route path="/" component={ Pollard }>
<Route path="setlist" component={ SetPage } />
<Route path="setlist/:id" component={ SetPage } />
<Route path="advancedSearch" component={ AdvancedSearch } />
<Route path="loadSchedule" component={ LoadSchedule } />
</Route>
</ReduxRouter>
</Provider>
);
}
}
export default DragDropContext(HTML5Backend)(App);
|
ajax/libs/react-is/18.0.0-alpha-bc4e75112-20210815/umd/react-is.development.min.js | cdnjs/cdnjs | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).ReactIs={})}(this,function(e){"use strict";var o=60103,c=60106,a=60107,s=60108,i=60114,f=60109,u=60110,d=60112,l=60113,p=60120,y=60115,m=60116,t=60129,r=60130,n=60131;"function"==typeof Symbol&&Symbol.for&&(o=(j=Symbol.for)("react.element"),c=j("react.portal"),a=j("react.fragment"),s=j("react.strict_mode"),i=j("react.profiler"),f=j("react.provider"),u=j("react.context"),d=j("react.forward_ref"),l=j("react.suspense"),p=j("react.suspense_list"),y=j("react.memo"),m=j("react.lazy"),j("react.scope"),j("react.opaque.id"),t=j("react.debug_trace_mode"),r=j("react.offscreen"),n=j("react.legacy_hidden"),j("react.cache"));var $=0;function b(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:var r=e.type;switch(r){case a:case i:case s:case l:case p:return r;default:var n=r&&r.$$typeof;switch(n){case u:case d:case m:case y:case f:return n;default:return t}}case c:return t}}}"function"==typeof Symbol&&($=Symbol.for("react.module.reference"));var v=u,S=f,h=o,w=d,M=a,x=m,C=y,g=c,R=i,P=s,_=l,j=p,F=!1,I=!1;e.ContextConsumer=v,e.ContextProvider=S,e.Element=h,e.ForwardRef=w,e.Fragment=M,e.Lazy=x,e.Memo=C,e.Portal=g,e.Profiler=R,e.StrictMode=P,e.Suspense=_,e.SuspenseList=j,e.isAsyncMode=function(e){return F||(F=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},e.isConcurrentMode=function(e){return I||(I=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},e.isContextConsumer=function(e){return b(e)===u},e.isContextProvider=function(e){return b(e)===f},e.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},e.isForwardRef=function(e){return b(e)===d},e.isFragment=function(e){return b(e)===a},e.isLazy=function(e){return b(e)===m},e.isMemo=function(e){return b(e)===y},e.isPortal=function(e){return b(e)===c},e.isProfiler=function(e){return b(e)===i},e.isStrictMode=function(e){return b(e)===s},e.isSuspense=function(e){return b(e)===l},e.isSuspenseList=function(e){return b(e)===p},e.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||(e===a||e===i||e===t||e===s||e===l||e===p||e===n||e===r||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===y||e.$$typeof===f||e.$$typeof===u||e.$$typeof===d||e.$$typeof===$||void 0!==e.getModuleId))},e.typeOf=b}); |
docs/src/app/components/pages/components/Dialog/ExampleSimple.js | owencm/material-ui | import React from 'react';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';
/**
* Dialog with action buttons. The actions are passed in as an array of React objects,
* in this example [FlatButtons](/#/components/flat-button).
*
* You can also close this dialog by clicking outside the dialog, or with the 'Esc' key.
*/
export default class DialogExampleSimple extends React.Component {
state = {
open: false,
};
handleOpen = () => {
this.setState({open: true});
};
handleClose = () => {
this.setState({open: false});
};
render() {
const actions = [
<FlatButton
label="Cancel"
primary={true}
onTouchTap={this.handleClose}
/>,
<FlatButton
label="Submit"
primary={true}
keyboardFocused={true}
onTouchTap={this.handleClose}
/>,
];
return (
<div>
<RaisedButton label="Dialog" onTouchTap={this.handleOpen} />
<Dialog
title="Dialog With Actions"
actions={actions}
modal={false}
open={this.state.open}
onRequestClose={this.handleClose}
>
The actions in this window were passed in as an array of React objects.
</Dialog>
</div>
);
}
}
|
src/svg-icons/action/input.js | ruifortes/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionInput = (props) => (
<SvgIcon {...props}>
<path d="M21 3.01H3c-1.1 0-2 .9-2 2V9h2V4.99h18v14.03H3V15H1v4.01c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98v-14c0-1.11-.9-2-2-2zM11 16l4-4-4-4v3H1v2h10v3z"/>
</SvgIcon>
);
ActionInput = pure(ActionInput);
ActionInput.displayName = 'ActionInput';
ActionInput.muiName = 'SvgIcon';
export default ActionInput;
|
ajax/libs/backbone.radio/0.2.0/backbone.radio.js | WebReflection/cdnjs | // Backbone.Radio v0.1.0
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['backbone', 'underscore'], function(Backbone, _) {
return factory(Backbone, _);
});
}
else if (typeof exports !== 'undefined') {
var Backbone = require('backbone');
var _ = require('underscore');
module.exports = factory(Backbone, _);
}
else {
factory(root.Backbone, root._);
}
}(this, function(Backbone, _) {
'use strict';
var previousRadio = Backbone.Radio;
var Radio = Backbone.Radio = {};
Radio.VERSION = '0.1.0';
Radio.noConflict = function () {
Backbone.Radio = previousRadio;
return this;
};
/*
* Backbone.Radio
* --------------
* The 'top-level' API for working with Backbone.Radio
*
*/
_.extend(Radio, {
_channels: {},
DEBUG: false,
channel: function(channelName) {
if (!channelName) {
throw new Error('You must provide a name for the channel.');
}
return Radio._getChannel( channelName );
},
_getChannel: function(channelName) {
var channel = Radio._channels[channelName];
if(!channel) {
channel = new Radio.Channel(channelName);
Radio._channels[channelName] = channel;
}
return channel;
}
});
/*
* tune-in
* -------
* Get console logs of a channel's activity
*
*/
// Log information about the channel and event
var _log = function(channelName, eventName) {
var args = Array.prototype.slice.call(arguments, 2);
console.log('[' + channelName + '] "'+eventName+'"', args);
};
var _logs = {};
// This is to produce an identical function in both tuneIn and tuneOut,
// so that Backbone.Events unregisters it.
var _partial = function(channelName) {
return _logs[channelName] || (_logs[channelName] = _.partial(_log, channelName));
};
_.extend(Radio, {
// Logs all events on this channel to the console. It sets an
// internal value on the channel telling it we're listening,
// then sets a listener on the Backbone.Events
tuneIn: function(channelName) {
var channel = Radio.channel(channelName);
channel._tunedIn = true;
channel.on('all', _partial(channelName));
},
// Stop logging all of the activities on this channel to the console
tuneOut: function(channelName) {
var channel = Radio.channel(channelName);
channel._tunedIn = false;
channel.off('all', _partial(channelName));
delete _logs[channelName];
}
});
/*
* Backbone.Radio.Commands
* -----------------------
* A messaging system for sending orders.
*
*/
Radio.Commands = {
command: function(name) {
var args = Array.prototype.slice.call(arguments, 1);
var isChannel = this._channelName ? true : false;
// Check if we should log the request, and if so, do it
if (isChannel && this._tunedIn) {
_log.apply(this, [this._channelName, name].concat(args));
}
// If the command isn't handled, log it in DEBUG mode and exit
if (!this._commands || !this._commands[name]) {
if (Radio.DEBUG) {
var channelText = isChannel ? ' on the ' + this._channelName + ' channel' : '';
console.warn('An unhandled event was fired' + channelText + ': "' + name + '"');
}
return;
}
var handler = this._commands[name];
var cb = handler.callback;
var context = handler.context;
cb.apply(context, args);
},
react: function(name, callback, context) {
if (!this._commands) {
this._commands = {};
}
context = context || this;
this._commands[name] = {
callback: callback,
context: context
};
return this;
},
reactOnce: function(name, callback, context) {
var self = this;
var once = _.once(function() {
self.stopReacting(name);
return callback.apply(this, arguments);
});
return this.command(name, once, context);
},
stopReacting: function(name) {
if (!name) {
delete this._commands;
} else {
delete this._commands[name];
}
}
};
/*
* Backbone.Radio.Requests
* -----------------------
* A messaging system for requesting data.
*
*/
Radio.Requests = {
request: function(name) {
var args = Array.prototype.slice.call(arguments, 1);
var isChannel = this._channelName ? true : false;
// Check if we should log the request, and if so, do it
if (isChannel && this._tunedIn) {
_log.apply(this, [this._channelName, name].concat(args));
}
// If the request isn't handled, log it in DEBUG mode and exit
if (!this._requests || !this._requests[name]) {
if (Radio.DEBUG) {
var channelText = isChannel ? ' on the ' + this._channelName + ' channel' : '';
console.warn('An unhandled event was fired' + channelText + ': "' + name + '"');
}
return;
}
var handler = this._requests[name];
var cb = handler.callback;
var context = handler.context;
return cb.apply(context, args);
},
respond: function(name, callback, context) {
if (!this._requests) {
this._requests = {};
}
context = context || this;
callback = _.isFunction(callback) ? callback : _.constant(callback);
this._requests[name] = {
callback: callback,
context: context
};
return this;
},
respondOnce: function(name, callback, context) {
var self = this;
callback = _.isFunction(callback) ? callback : _.constant(callback);
var once = _.once(function() {
self.stopResponding(name);
return callback.apply(this, arguments);
});
return this.request(name, once, context);
},
stopResponding: function(name) {
if (!name) {
delete this._requests;
} else {
delete this._requests[name];
}
}
};
/*
* Backbone.Radio.Channel
* ----------------------
* A Channel is an object that extends from Backbone.Events,
* Radio.Commands, and Radio.Requests.
*
*/
Radio.Channel = function(channelName) {
this._channelName = channelName;
_.extend(this, Backbone.Events, Radio.Commands, Radio.Requests);
};
_.extend(Radio.Channel.prototype, {
// Remove all handlers from the messaging systems of this channel
reset: function() {
this.off();
this.stopListening();
this.stopReacting();
this.stopResponding();
return this;
}
});
function _connect(methodName, hash, context) {
if ( !hash ) { return; }
context = context || this;
_.each(hash, function(fn, eventName) {
this[methodName](eventName, _.bind(fn, context));
}, this);
}
var map = {
Events: 'on',
Commands: 'react',
Requests: 'respond'
};
_.each(map, function(methodName, systemName) {
var connectName = 'connect'+ systemName;
Radio.Channel.prototype[connectName] = _.partial(_connect, methodName);
});
/*
* proxy
* -----
* Supplies a top-level API.
*
*/
var channel, args, systems = [Backbone.Events, Radio.Commands, Radio.Requests];
_.each(systems, function(system) {
_.each(system, function(method, methodName) {
Radio[methodName] = function(channelName) {
args = Array.prototype.slice.call(arguments, 2);
channel = this.channel(channelName);
return channel[methodName].apply(this, args);
};
});
});
return Radio;
}));
|
app/containers/Header/MainHeader.js | klpdotorg/tada-frontend | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { HeaderBar } from '../../components/Header';
import { logoutUser, openChangeUserInfoModal, openChangePasswordModal } from '../../actions';
class Header extends Component {
componentDidMount() {
window.onclick = (event) => {
if (!event.target.matches('.show-profile-dropdown')) {
const el = document.getElementById('profile-dropdown');
if (el && el.classList.contains('show')) {
el.classList.remove('show');
}
}
};
}
openDropdown() {
const el = document.getElementById('profile-dropdown');
if (!el.classList.contains('show')) {
el.classList.add('show');
} else {
el.classList.remove('show');
}
}
render() {
return <HeaderBar {...this.props} openDropdown={this.openDropdown} />;
}
}
const mapStateToProps = (state) => {
const { firstName, lastName } = state.profile;
return {
username: `${firstName} ${lastName}`,
};
};
const MainHeader = connect(mapStateToProps, {
logoutUser,
openChangeUserInfoModal,
openChangePasswordModal,
})(Header);
export { MainHeader };
|
src/ReactBoilerplate/Scripts/containers/Manage/Index/Index.js | theonlylawislove/react-dot-net | import React, { Component } from 'react';
import { connect } from 'react-redux';
class Index extends Component {
render() {
return (
<div />
);
}
}
export default connect(
(state) => state,
{ }
)(Index);
|
saleor/static/js/components/cart.js | rodrigozn/CW-Shop | /* @flow */
import React, { Component, findDOMNode, PropTypes } from 'react'
import { connect } from 'react-redux'
import $ from 'jquery'
export class CartItemAmountOption extends Component {
render(): React.Element {
const value = this.props.value
const label = this.props.label ? this.props.label : value
return <option value={value}>{label}</option>
}
}
class CartItemAmountSelect extends Component {
static propTypes = {
className: PropTypes.string,
fieldName: PropTypes.string.isRequired,
max: PropTypes.number,
min: PropTypes.number,
options: PropTypes.arrayOf(PropTypes.number).isRequired,
thresholdValue: PropTypes.number,
value: PropTypes.number.isRequired
};
state: {
error: ?string;
lastSavedValue: number;
renderSelect: bool;
renderSubmit: bool;
result: ?string;
sending: bool;
value: number
} = {
error: null,
lastSavedValue: this.props.value,
renderSelect: false,
renderSubmit: false,
result: null,
sending: false,
value: this.props.value
};
_change = (event) => {
let newValue = event.target.value
this.setState({ result: null })
if (newValue !== this.props.thresholdValue || !this.state.renderSelect) {
this.setState({ value: newValue })
}
if (newValue >= this.props.thresholdValue) {
this.setState({ renderSelect: false })
}
if (newValue < this.props.thresholdValue && this.state.renderSelect) {
this.sendQuantity(newValue)
}
if (!this.state.renderSelect && !this.state.sending) {
this.setState({ renderSubmit: true })
}
};
_checkKey = (event) => {
if (event.key === 'Enter' && this.valueChanged()) {
this.sendQuantityWrapper()
}
};
componentDidMount() {
if (this.state.value < this.props.thresholdValue) {
this.setState({ renderSelect: true })
}
}
valueChanged() {
return this.state.lastSavedValue != this.state.value
}
sendQuantityWrapper() {
this.sendQuantity(this.state.value)
}
sendQuantity(quantity) {
this.setState({ renderSubmit: false })
this.setState({ sending: true })
$.ajax({
url: this.props.url,
method: 'post',
data: { [this.props.fieldName]: quantity },
complete: () => {
this.setState({ sending: false })
if (quantity < this.props.thresholdValue) {
this.setState({ renderSelect: true })
}
},
success: (response) => {
if (!quantity) {
if (!response.total) {
location.reload()
}
$(findDOMNode(this)).parents('tr').fadeOut(function() {
$(this).remove()
})
}
if (response.hasOwnProperty('variantId')) {
const { variantId, subtotal, total, localTotal } = response
this.props.dispatch({
type: 'UPDATE_SUBTOTAL',
variantId,
subtotal
})
this.props.dispatch({
type: 'UPDATE_TOTAL',
total,
localTotal
})
}
this.setState({
result: 'success',
lastSavedValue: quantity
})
setTimeout(() => {
this.setState({ result: null })
}, 1000)
},
error: (response) => {
this.setState({
error: response.error.quantity,
result: 'error'
})
}
})
}
removeFromCart() {
this.sendQuantity(0)
}
render() {
let classNames = [this.props.className]
switch (this.state.result) {
case ('success'):
classNames.push('has-success')
break
case ('error'):
classNames.push('has-error')
break
}
let classNamesInput = ['input-group', 'cart-item-quantity']
if (
(!this.state.renderSubmit || !this.valueChanged())
&& !(this.state.result === 'error')
) {
classNamesInput.push('no-submit')
}
const options = this.props.options.map((option) => (
<CartItemAmountOption
key={option}
label={option == this.props.thresholdValue ? `${option} +` : option}
value={option}
/>
))
const select = (
<select
className="form-control cart-item-quantity-select"
onChange={this._change}
value={this.state.value}
>
{options}
</select>
)
const input = (
<div className={classNamesInput.join(' ')}>
<input
className="form-control"
id="id_quantity"
max={this.props.max}
min={1}
name="quantity"
onChange={this._change}
onKeyUp={this._checkKey}
ref="inputQuantity"
type="number"
value={this.state.value}
/>
<span className="input-group-btn">
<button
className="btn btn-info"
onClick={this.sendQuantityWrapper.bind(this)}
type="submit"
>
Update
</button>
</span>
</div>
)
return (
<div className={classNames.join(' ')}>
{this.state.renderSelect ? select : input}
{this.state.sending && this.state.result !== 'error' ? (
<i className="glyphicon glyphicon-time"></i>
) : undefined}
{this.state.result === 'error' ? (
<span className="error text-danger">
{this.state.error}
</span>
) : undefined}
<button
className="btn btn-link btn-sm cart-item-remove"
onClick={this.removeFromCart.bind(this)}
type="submit"
>
<span className="text-muted">
Remove from cart
</span>
</button>
</div>
)
}
}
const selectQuantities = (state) => ({}) // FIXME: move quantities to store
export const CartItemAmount = connect(selectQuantities)(CartItemAmountSelect);
const renderSubtotal = ({variantId, subtotals}) => {
let value;
if (subtotals.hasOwnProperty(variantId)) {
value = subtotals[variantId]
}
return <span>{value}</span>
}
const selectSubtotals = (state) => ({
subtotals: state.subtotals
})
export const CartItemSubtotal = connect(selectSubtotals)(renderSubtotal)
const renderTotal = ({total, localTotal}) => <span>
{total}
{localTotal ? <br/> : undefined}
{localTotal ? <small className="text-info">≈ {localTotal}</small> : undefined}
</span>
const selectTotal = (state) => ({
total: state.total,
localTotal: state.localTotal
})
export const CartTotal = connect(selectTotal)(renderTotal)
|
src/features/employees/details/employee-details/index.js | fmoliveira/wannagrow-client | import React from 'react'
import { Link } from 'react-router-dom'
import { Rating } from 'components/styles/rating'
import { SectionHeader } from 'components/styles/section-header'
import AssessmentsHistory from './assessments-history'
export const EmployeeDetails = ({ details }) => {
const { userName, firstName, lastName, department, pictureUrl, assessments, rating } = details
const fullName = `${firstName} ${lastName}`
const altText = `Picture of ${fullName}`
return (
<div>
<div className='media'>
<figure className='media-left'>
<img src={pictureUrl} alt={altText} className='image is-128x128' />
</figure>
<div className='media-content'>
<div className='content'>
<strong>{fullName}</strong>
<br />
{department}
</div>
</div>
<div className='media-right'>
<Rating>{rating || '-'}</Rating>
</div>
</div>
<SectionHeader>Assessments History</SectionHeader>
<AssessmentsHistory history={assessments} />
<div className='text-right'>
<Link to={`/employees/${userName}/assessment`} className='button is-primary'>
Assess Employee
</Link>
</div>
</div>
)
}
export default EmployeeDetails
|
developers.diem.com/src/@libra-opensource/diem-docusaurus-components/src/Nav/SubNav/Mobile/index.js | libra/libra | import React from 'react';
import PropTypes from 'prop-types';
import useBaseUrl from '@docusaurus/useBaseUrl';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import CloseIcon from '../../../../img/chevron-pressed.svg';
import NavMenuIcon from '../../components/NavMenuIcon';
import OpenIcon from '../../../../img/chevron-down.svg';
import PageIndicator from '../../components/PageIndicator';
import PopupMenu from '../../components/PopupMenu';
import styles from './styles.module.css';
const SubnavMobile = ({ activePopupMenu, setPopupMenu }) => {
const {
siteConfig: {
customFields: {
navbar: { secondaryLinks },
},
},
} = useDocusaurusContext();
return (
<div className="mobile-only">
<div className={styles.mainContainer}>
<PageIndicator />
<NavMenuIcon
onClick={() => {
setPopupMenu('secondary');
}}
CloseIcon={CloseIcon}
isOpen={activePopupMenu === 'secondary'}
OpenIcon={OpenIcon}
/>
</div>
{activePopupMenu === 'secondary' && (
<PopupMenu
links={secondaryLinks}
onClick={(e) => e.stopPropagation()}
/>
)}
</div>
);
};
SubnavMobile.propTypes = {
activePopupMenu: PropTypes.string,
setPopupMenu: PropTypes.func.isRequired,
};
export default SubnavMobile;
|
test/integration/font-optimization/fixtures/with-google/pages/nonce.js | azukaru/next.js | import React from 'react'
import Head from 'next/head'
const Page = () => {
return (
<>
<Head>
<link
href="https://fonts.googleapis.com/css2?family=Modak"
rel="stylesheet"
nonce="VmVyY2Vs"
/>
</Head>
<div>Hi!</div>
</>
)
}
export default Page
|
information/blendle-frontend-react-source/app/modules/emailLogin/TokenErrorPage.js | BramscoChill/BlendleParser | import React from 'react';
import PropTypes from 'prop-types';
import { STATUS_ERROR } from 'app-constants';
import withRouter from 'react-router/lib/withRouter';
import Logo from 'components/Logo';
import Link from 'components/Link';
import { translate, translateElement } from 'instances/i18n';
function isUsedTokenError(status, message) {
return status === 403 && message === 'token already used';
}
function isExpiredTokenError(status, message) {
return status === 401 && message === 'expired token';
}
class TokenErrorPage extends React.Component {
static propTypes = {
data: PropTypes.object.isRequired,
LoginStore: PropTypes.object.isRequired,
LoginActions: PropTypes.object.isRequired,
router: PropTypes.object.isRequired,
};
// componentWillReceiveProps (nextProps) {
// const { LoginStore, LoginActions, data, router, toLoginFormOnError } = this.props;
// const newLoginError = nextProps.LoginStore.login.error;
// const currentLoginError = LoginStore.login.error;
//
// // Check for new error
// if (currentLoginError || !newLoginError) {
// return;
// }
//
// if (isExpiredTokenError(newLoginError.status, newLoginError.message) ||
// isUsedTokenError(newLoginError.status, newLoginError.message)) {
//
// if (toLoginFormOnError) {
// setTimeout(() => {
// LoginActions.setEmail(data.user_email);
// router.replace('/login');
// });
//
// return;
// }
//
// // Send new token
// LoginActions.sendLoginEmail.defer(data.user_id, data.item_id, data.redirect);
// }
// }
_renderMessage() {
return (
<div>
<img
src="/img/illustrations/magiclink.svg"
className="magic-link-illustration"
alt="Magic link illustration"
/>
<h1>{translate('app.email_login.token_error')}</h1>
{translateElement(<p />, 'app.email_login.token_resent', false)}
</div>
);
}
render() {
let message = <div />;
if (this.props.LoginStore.login.status === STATUS_ERROR) {
message = this._renderMessage();
}
return (
<div className="v-email-login-page">
<header className="header">
<Link href="/">
<Logo />
</Link>
</header>
<div className="login-error">
<div className="body">{message}</div>
</div>
</div>
);
}
}
export default withRouter(TokenErrorPage);
// WEBPACK FOOTER //
// ./src/js/app/modules/emailLogin/TokenErrorPage.js |
src/routes/add/index.js | ynu/res-track-wxe | import React from 'react';
import Add from './Add';
import { addResource } from '../../actions/add';
export default {
path: '/add',
async action({ store }) {
const add = async values => {
try {
const data = await store.dispatch(addResource(values));
window.location = `/detail/${data}`;
} catch (e) {
console.log(e);
}
};
return {
title: '添加资源',
component: <Add submitRes={add} />,
};
},
};
|
ajax/libs/primereact/7.0.0-rc.2/megamenu/megamenu.esm.js | cdnjs/cdnjs | import React, { Component } from 'react';
import { DomHandler, classNames, Ripple, ObjectUtils } from 'primereact/core';
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; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
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 _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;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized(self);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var MegaMenu = /*#__PURE__*/function (_Component) {
_inherits(MegaMenu, _Component);
var _super = _createSuper(MegaMenu);
function MegaMenu(props) {
var _this;
_classCallCheck(this, MegaMenu);
_this = _super.call(this, props);
_this.state = {
activeItem: null
};
_this.onLeafClick = _this.onLeafClick.bind(_assertThisInitialized(_this));
return _this;
}
_createClass(MegaMenu, [{
key: "onLeafClick",
value: function onLeafClick(event, item) {
if (item.disabled) {
event.preventDefault();
return;
}
if (!item.url) {
event.preventDefault();
}
if (item.command) {
item.command({
originalEvent: event,
item: item
});
}
this.setState({
activeItem: null
});
}
}, {
key: "onCategoryMouseEnter",
value: function onCategoryMouseEnter(event, item) {
if (item.disabled) {
event.preventDefault();
return;
}
if (this.state.activeItem) {
this.setState({
activeItem: item
});
}
}
}, {
key: "onCategoryClick",
value: function onCategoryClick(event, item) {
if (item.disabled) {
event.preventDefault();
return;
}
if (!item.url) {
event.preventDefault();
}
if (item.command) {
item.command({
originalEvent: event,
item: this.props.item
});
}
if (item.items) {
if (this.state.activeItem && this.state.activeItem === item) {
this.setState({
activeItem: null
});
} else {
this.setState({
activeItem: item
});
}
}
event.preventDefault();
}
}, {
key: "onCategoryKeyDown",
value: function onCategoryKeyDown(event, item) {
var listItem = event.currentTarget.parentElement;
switch (event.which) {
//down
case 40:
if (this.isHorizontal()) this.expandMenu(item);else this.navigateToNextItem(listItem);
event.preventDefault();
break;
//up
case 38:
if (this.isVertical()) this.navigateToPrevItem(listItem);else if (item.items && item === this.state.activeItem) this.collapseMenu();
event.preventDefault();
break;
//right
case 39:
if (this.isHorizontal()) this.navigateToNextItem(listItem);else this.expandMenu(item);
event.preventDefault();
break;
//left
case 37:
if (this.isHorizontal()) this.navigateToPrevItem(listItem);else if (item.items && item === this.state.activeItem) this.collapseMenu();
event.preventDefault();
break;
}
}
}, {
key: "expandMenu",
value: function expandMenu(item) {
if (item.items) {
this.setState({
activeItem: item
});
}
}
}, {
key: "collapseMenu",
value: function collapseMenu(item) {
this.setState({
activeItem: null
});
}
}, {
key: "findNextItem",
value: function findNextItem(item) {
var nextItem = item.nextElementSibling;
if (nextItem) return DomHandler.hasClass(nextItem, 'p-disabled') || !DomHandler.hasClass(nextItem, 'p-menuitem') ? this.findNextItem(nextItem) : nextItem;else return null;
}
}, {
key: "findPrevItem",
value: function findPrevItem(item) {
var prevItem = item.previousElementSibling;
if (prevItem) return DomHandler.hasClass(prevItem, 'p-disabled') || !DomHandler.hasClass(prevItem, 'p-menuitem') ? this.findPrevItem(prevItem) : prevItem;else return null;
}
}, {
key: "navigateToNextItem",
value: function navigateToNextItem(listItem) {
var nextItem = this.findNextItem(listItem);
if (nextItem) {
nextItem.children[0].focus();
}
}
}, {
key: "navigateToPrevItem",
value: function navigateToPrevItem(listItem) {
var prevItem = this.findPrevItem(listItem);
if (prevItem) {
prevItem.children[0].focus();
}
}
}, {
key: "isHorizontal",
value: function isHorizontal() {
return this.props.orientation === 'horizontal';
}
}, {
key: "isVertical",
value: function isVertical() {
return this.props.orientation === 'vertical';
}
}, {
key: "getColumnClassName",
value: function getColumnClassName(category) {
var length = category.items ? category.items.length : 0;
var columnClass;
switch (length) {
case 2:
columnClass = 'p-megamenu-col-6';
break;
case 3:
columnClass = 'p-megamenu-col-4';
break;
case 4:
columnClass = 'p-megamenu-col-3';
break;
case 6:
columnClass = 'p-megamenu-col-2';
break;
default:
columnClass = 'p-megamenu-col-12';
break;
}
return columnClass;
}
}, {
key: "componentDidMount",
value: function componentDidMount() {
var _this2 = this;
if (!this.documentClickListener) {
this.documentClickListener = function (event) {
if (_this2.container && !_this2.container.contains(event.target)) {
_this2.setState({
activeItem: null
});
}
};
document.addEventListener('click', this.documentClickListener);
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
if (this.documentClickListener) {
document.removeEventListener('click', this.documentClickListener);
this.documentClickListener = null;
}
}
}, {
key: "renderSeparator",
value: function renderSeparator(index) {
return /*#__PURE__*/React.createElement("li", {
key: 'separator_' + index,
className: "p-menu-separator",
role: "separator"
});
}
}, {
key: "renderSubmenuIcon",
value: function renderSubmenuIcon(item) {
if (item.items) {
var className = classNames('p-submenu-icon pi', {
'pi-angle-down': this.isHorizontal(),
'pi-angle-right': this.isVertical()
});
return /*#__PURE__*/React.createElement("span", {
className: className
});
}
return null;
}
}, {
key: "renderSubmenuItem",
value: function renderSubmenuItem(item, index) {
var _this3 = this;
if (item.separator) {
return this.renderSeparator(index);
} else {
var className = classNames('p-menuitem', item.className);
var linkClassName = classNames('p-menuitem-link', {
'p-disabled': item.disabled
});
var iconClassName = classNames(item.icon, 'p-menuitem-icon');
var icon = item.icon && /*#__PURE__*/React.createElement("span", {
className: iconClassName
});
var label = item.label && /*#__PURE__*/React.createElement("span", {
className: "p-menuitem-text"
}, item.label);
var content = /*#__PURE__*/React.createElement("a", {
href: item.url || '#',
className: linkClassName,
target: item.target,
onClick: function onClick(event) {
return _this3.onLeafClick(event, item);
},
role: "menuitem",
"aria-disabled": item.disabled
}, icon, label, /*#__PURE__*/React.createElement(Ripple, null));
if (item.template) {
var defaultContentOptions = {
onClick: function onClick(event) {
return _this3.onLeafClick(event, item);
},
className: linkClassName,
labelClassName: 'p-menuitem-text',
iconClassName: iconClassName,
element: content,
props: this.props
};
content = ObjectUtils.getJSXElement(item.template, item, defaultContentOptions);
}
return /*#__PURE__*/React.createElement("li", {
key: item.label + '_' + index,
className: className,
style: item.style,
role: "none"
}, content);
}
}
}, {
key: "renderSubmenu",
value: function renderSubmenu(submenu) {
var _this4 = this;
var className = classNames('p-megamenu-submenu-header', {
'p-disabled': submenu.disabled
}, submenu.className);
var items = submenu.items.map(function (item, index) {
return _this4.renderSubmenuItem(item, index);
});
return /*#__PURE__*/React.createElement(React.Fragment, {
key: submenu.label
}, /*#__PURE__*/React.createElement("li", {
className: className,
style: submenu.style,
role: "presentation",
"aria-disabled": submenu.disabled
}, submenu.label), items);
}
}, {
key: "renderSubmenus",
value: function renderSubmenus(column) {
var _this5 = this;
return column.map(function (submenu, index) {
return _this5.renderSubmenu(submenu, index);
});
}
}, {
key: "renderColumn",
value: function renderColumn(category, column, index, columnClassName) {
var submenus = this.renderSubmenus(column);
return /*#__PURE__*/React.createElement("div", {
key: category.label + '_column_' + index,
className: columnClassName
}, /*#__PURE__*/React.createElement("ul", {
className: "p-megamenu-submenu",
role: "menu"
}, submenus));
}
}, {
key: "renderColumns",
value: function renderColumns(category) {
var _this6 = this;
if (category.items) {
var columnClassName = this.getColumnClassName(category);
return category.items.map(function (column, index) {
return _this6.renderColumn(category, column, index, columnClassName);
});
}
return null;
}
}, {
key: "renderCategoryPanel",
value: function renderCategoryPanel(category) {
if (category.items) {
var columns = this.renderColumns(category);
return /*#__PURE__*/React.createElement("div", {
className: "p-megamenu-panel"
}, /*#__PURE__*/React.createElement("div", {
className: "p-megamenu-grid"
}, columns));
}
return null;
}
}, {
key: "renderCategory",
value: function renderCategory(category, index) {
var _this7 = this;
var className = classNames('p-menuitem', {
'p-menuitem-active': category === this.state.activeItem
}, category.className);
var linkClassName = classNames('p-menuitem-link', {
'p-disabled': category.disabled
});
var iconClassName = classNames('p-menuitem-icon', category.icon);
var icon = category.icon && /*#__PURE__*/React.createElement("span", {
className: iconClassName
});
var label = category.label && /*#__PURE__*/React.createElement("span", {
className: "p-menuitem-text"
}, category.label);
var itemContent = category.template ? ObjectUtils.getJSXElement(category.template, category) : null;
var submenuIcon = this.renderSubmenuIcon(category);
var panel = this.renderCategoryPanel(category);
return /*#__PURE__*/React.createElement("li", {
key: category.label + '_' + index,
className: className,
style: category.style,
onMouseEnter: function onMouseEnter(e) {
return _this7.onCategoryMouseEnter(e, category);
},
role: "none"
}, /*#__PURE__*/React.createElement("a", {
href: category.url || '#',
className: linkClassName,
target: category.target,
onClick: function onClick(e) {
return _this7.onCategoryClick(e, category);
},
onKeyDown: function onKeyDown(e) {
return _this7.onCategoryKeyDown(e, category);
},
role: "menuitem",
"aria-haspopup": category.items != null
}, icon, label, itemContent, submenuIcon, /*#__PURE__*/React.createElement(Ripple, null)), panel);
}
}, {
key: "renderMenu",
value: function renderMenu() {
var _this8 = this;
if (this.props.model) {
return this.props.model.map(function (item, index) {
return _this8.renderCategory(item, index, true);
});
}
return null;
}
}, {
key: "renderCustomContent",
value: function renderCustomContent() {
if (this.props.children) {
return /*#__PURE__*/React.createElement("div", {
className: "p-megamenu-custom"
}, this.props.children);
}
return null;
}
}, {
key: "render",
value: function render() {
var _this9 = this;
var className = classNames('p-megamenu p-component', {
'p-megamenu-horizontal': this.props.orientation === 'horizontal',
'p-megamenu-vertical': this.props.orientation === 'vertical'
}, this.props.className);
var menu = this.renderMenu();
var customContent = this.renderCustomContent();
return /*#__PURE__*/React.createElement("div", {
ref: function ref(el) {
return _this9.container = el;
},
id: this.props.id,
className: className,
style: this.props.style
}, /*#__PURE__*/React.createElement("ul", {
className: "p-megamenu-root-list",
role: "menubar"
}, menu), customContent);
}
}]);
return MegaMenu;
}(Component);
_defineProperty(MegaMenu, "defaultProps", {
id: null,
model: null,
style: null,
className: null,
orientation: 'horizontal'
});
export { MegaMenu };
|
index.android.js | jefflanzi/rn-app-template | /**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
export default class appTemplate extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.android.js
</Text>
<Text style={styles.instructions}>
Double tap R on your keyboard to reload,{'\n'}
Shake or press menu button for dev menu
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('appTemplate', () => appTemplate);
|
docs/public/static/examples/unversioned/tutorial/sharing-simple.js | exponentjs/exponent | import React from 'react';
import { Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import * as ImagePicker from 'expo-image-picker';
import * as Sharing from 'expo-sharing';
export default function App() {
let [selectedImage, setSelectedImage] = React.useState(null);
let openImagePickerAsync = async () => {
let permissionResult = await ImagePicker.requestCameraRollPermissionsAsync();
if (permissionResult.granted === false) {
alert('Permission to access camera roll is required!');
return;
}
let pickerResult = await ImagePicker.launchImageLibraryAsync();
if (pickerResult.cancelled === true) {
return;
}
setSelectedImage({ localUri: pickerResult.uri });
};
let openShareDialogAsync = async () => {
if (!(await Sharing.isAvailableAsync())) {
alert(`Uh oh, sharing isn't available on your platform`);
return;
}
await Sharing.shareAsync(selectedImage.localUri);
};
if (selectedImage !== null) {
return (
<View style={styles.container}>
<Image source={{ uri: selectedImage.localUri }} style={styles.thumbnail} />
<TouchableOpacity onPress={openShareDialogAsync} style={styles.button}>
<Text style={styles.buttonText}>Share this photo</Text>
</TouchableOpacity>
</View>
);
}
return (
<View style={styles.container}>
<Image source={{ uri: 'https://i.imgur.com/TkIrScD.png' }} style={styles.logo} />
<Text style={styles.instructions}>
To share a photo from your phone with a friend, just press the button below!
</Text>
<TouchableOpacity onPress={openImagePickerAsync} style={styles.button}>
<Text style={styles.buttonText}>Pick a photo</Text>
</TouchableOpacity>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
logo: {
width: 305,
height: 159,
marginBottom: 20,
},
instructions: {
color: '#888',
fontSize: 18,
marginHorizontal: 15,
marginBottom: 10,
},
button: {
backgroundColor: 'blue',
padding: 20,
borderRadius: 5,
},
buttonText: {
fontSize: 20,
color: '#fff',
},
thumbnail: {
width: 300,
height: 300,
resizeMode: 'contain',
},
});
|
tango_capo/static/js/site-combined-min.js | tBaxter/tango-capo | /*************************************************************
* Combines all necessary js to create site-combined-min.js
* Includes:
*
* Jquery 1.10.1
* Pickadate.js (2.0)
* Hammer.js (for touch gestures)
* Stickit
* A modified version of refineSlide (for photo galleries)
* main.js
*
**************************************************************//* **********************************************
Begin jquery.1.10.1.js
********************************************** *//*!
* jQuery JavaScript Library v1.10.1
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2013-05-30T21:49Z
*/function setExtraAssetsTop(){if(screenSize==="large"||screenSize==="x-large"){var e=$("#extra-assets"),t=$("#top_assets");e.length>0&&t.length>0&&e.css("margin-top",t.outerHeight()+"px")}}function setNavicon(){if(screenSize==="default"||screenSize==="small"){var e=$("nav[role=navigation]"),t=$('<a href="#nav-menu" id="menu-trigger" title="Menu" class="navicon">≡≡</a>'),n=$("#wrapper"),r=$("body");e.prepend(t);t.on("click",function(e){t.toggleClass("activated");r.toggleClass("nav-active");e.stopPropagation();e.preventDefault()});n.hammer().on("swipeleft",function(){t.removeClass("activated");r.removeClass("nav-active")});n.hammer().on("swiperight",function(){t.addClass("activated");r.addClass("nav-active")})}}function getYOffset(){"use strict";return typeof window.pageYOffset=="number"?window.pageYOffset:document.documentElement.scrollTop}function load_images(){"use strict";$("*[data-deferred-load]").each(function(){$(this).find("img").length===0&&$(this).prepend(function(){var e=$(this).data("deferred-load"),t=document.createElement("img");t.src=e;return t})})}function tabit(){"use strict";$(".tabs").each(function(){var e=$(this),t="",n=0;e.addClass("tabbed");e.sections=e.find("> *").not("ul");e.nav=e.find("> ul");n=e.nav.height();if(e.nav.length===0){e.nav=$(".remote-tabs-nav");n=0}if(!e.nav)return;e.navitems=e.nav.find("li");if(window.location.hash){t=window.location.hash.replace("-view","");if(e.nav){e.navitems.removeClass("active");e.nav.find("a[href="+t+"]").parent().addClass("active")}}else{t=e.nav.find("li.active a").hash;t||(t=e.navitems.eq(0).addClass("active").find("a").get(0).hash)}$(t).addClass("activeTab");e.nav.find("a:not(.no-tab)").click(function(t){t.preventDefault();var r=this.hash,i=$(r).parent().find("> *").not("ul"),s=$(this).parent(),o=s.parent().find("li");window.location.hash=r+"-view";s.addClass("active");$(o).not(s).removeClass("active");$(r).addClass("activeTab");e.css("min-height",$(r).height()+n+"px");i.not(r).removeClass("activeTab")})})}(function(e,t){function H(e){var t=e.length,n=w.type(e);return w.isWindow(e)?!1:e.nodeType===1&&t?!0:n==="array"||n!=="function"&&(t===0||typeof t=="number"&&t>0&&t-1 in e)}function j(e){var t=B[e]={};w.each(e.match(S)||[],function(e,n){t[n]=!0});return t}function q(e,n,r,i){if(!w.acceptData(e))return;var s,o,u=w.expando,a=e.nodeType,f=a?w.cache:e,l=a?e[u]:e[u]&&u;if((!l||!f[l]||!i&&!f[l].data)&&r===t&&typeof n=="string")return;l||(a?l=e[u]=c.pop()||w.guid++:l=u);f[l]||(f[l]=a?{}:{toJSON:w.noop});if(typeof n=="object"||typeof n=="function")i?f[l]=w.extend(f[l],n):f[l].data=w.extend(f[l].data,n);o=f[l];if(!i){o.data||(o.data={});o=o.data}r!==t&&(o[w.camelCase(n)]=r);if(typeof n=="string"){s=o[n];s==null&&(s=o[w.camelCase(n)])}else s=o;return s}function R(e,t,n){if(!w.acceptData(e))return;var r,i,s=e.nodeType,o=s?w.cache:e,u=s?e[w.expando]:w.expando;if(!o[u])return;if(t){r=n?o[u]:o[u].data;if(r){if(!w.isArray(t))if(t in r)t=[t];else{t=w.camelCase(t);t in r?t=[t]:t=t.split(" ")}else t=t.concat(w.map(t,w.camelCase));i=t.length;while(i--)delete r[t[i]];if(n?!z(r):!w.isEmptyObject(r))return}}if(!n){delete o[u].data;if(!z(o[u]))return}s?w.cleanData([e],!0):w.support.deleteExpando||o!=o.window?delete o[u]:o[u]=null}function U(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(I,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:F.test(r)?w.parseJSON(r):r}catch(s){}w.data(e,n,r)}else r=t}return r}function z(e){var t;for(t in e){if(t==="data"&&w.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function it(){return!0}function st(){return!1}function ot(){try{return o.activeElement}catch(e){}}function ct(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ht(e,t,n){if(w.isFunction(t))return w.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return w.grep(e,function(e){return e===t!==n});if(typeof t=="string"){if(ut.test(t))return w.filter(t,e,n);t=w.filter(t,e)}return w.grep(e,function(e){return w.inArray(e,t)>=0!==n})}function pt(e){var t=dt.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Mt(e,t){return w.nodeName(e,"table")&&w.nodeName(t.nodeType===1?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function _t(e){e.type=(w.find.attr(e,"type")!==null)+"/"+e.type;return e}function Dt(e){var t=Ct.exec(e.type);t?e.type=t[1]:e.removeAttribute("type");return e}function Pt(e,t){var n,r=0;for(;(n=e[r])!=null;r++)w._data(n,"globalEval",!t||w._data(t[r],"globalEval"))}function Ht(e,t){if(t.nodeType!==1||!w.hasData(e))return;var n,r,i,s=w._data(e),o=w._data(t,s),u=s.events;if(u){delete o.handle;o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)w.event.add(t,n,u[n][r])}o.data&&(o.data=w.extend({},o.data))}function Bt(e,t){var n,r,i;if(t.nodeType!==1)return;n=t.nodeName.toLowerCase();if(!w.support.noCloneEvent&&t[w.expando]){i=w._data(t);for(r in i.events)w.removeEvent(t,r,i.handle);t.removeAttribute(w.expando)}if(n==="script"&&t.text!==e.text){_t(t).text=e.text;Dt(t)}else if(n==="object"){t.parentNode&&(t.outerHTML=e.outerHTML);w.support.html5Clone&&e.innerHTML&&!w.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)}else if(n==="input"&&xt.test(e.type)){t.defaultChecked=t.checked=e.checked;t.value!==e.value&&(t.value=e.value)}else if(n==="option")t.defaultSelected=t.selected=e.defaultSelected;else if(n==="input"||n==="textarea")t.defaultValue=e.defaultValue}function jt(e,n){var r,s,o=0,u=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!u)for(u=[],r=e.childNodes||e;(s=r[o])!=null;o++)!n||w.nodeName(s,n)?u.push(s):w.merge(u,jt(s,n));return n===t||n&&w.nodeName(e,n)?w.merge([e],u):u}function Ft(e){xt.test(e.type)&&(e.defaultChecked=e.checked)}function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--){t=en[i]+n;if(t in e)return t}return r}function nn(e,t){e=t||e;return w.css(e,"display")==="none"||!w.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,s=[],o=0,u=e.length;for(;o<u;o++){r=e[o];if(!r.style)continue;s[o]=w._data(r,"olddisplay");n=r.style.display;if(t){!s[o]&&n==="none"&&(r.style.display="");r.style.display===""&&nn(r)&&(s[o]=w._data(r,"olddisplay",an(r.nodeName)))}else if(!s[o]){i=nn(r);(n&&n!=="none"||!i)&&w._data(r,"olddisplay",i?n:w.css(r,"display"))}}for(o=0;o<u;o++){r=e[o];if(!r.style)continue;if(!t||r.style.display==="none"||r.style.display==="")r.style.display=t?s[o]||"":"none"}return e}function sn(e,t,n){var r=$t.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function on(e,t,n,r,i){var s=n===(r?"border":"content")?4:t==="width"?1:0,o=0;for(;s<4;s+=2){n==="margin"&&(o+=w.css(e,n+Zt[s],!0,i));if(r){n==="content"&&(o-=w.css(e,"padding"+Zt[s],!0,i));n!=="margin"&&(o-=w.css(e,"border"+Zt[s]+"Width",!0,i))}else{o+=w.css(e,"padding"+Zt[s],!0,i);n!=="padding"&&(o+=w.css(e,"border"+Zt[s]+"Width",!0,i))}}return o}function un(e,t,n){var r=!0,i=t==="width"?e.offsetWidth:e.offsetHeight,s=qt(e),o=w.support.boxSizing&&w.css(e,"boxSizing",!1,s)==="border-box";if(i<=0||i==null){i=Rt(e,t,s);if(i<0||i==null)i=e.style[t];if(Jt.test(i))return i;r=o&&(w.support.boxSizingReliable||i===e.style[t]);i=parseFloat(i)||0}return i+on(e,t,n||(o?"border":"content"),r,s)+"px"}function an(e){var t=o,n=Qt[e];if(!n){n=fn(e,t);if(n==="none"||!n){It=(It||w("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement);t=(It[0].contentWindow||It[0].contentDocument).document;t.write("<!doctype html><html><body>");t.close();n=fn(e,t);It.detach()}Qt[e]=n}return n}function fn(e,t){var n=w(t.createElement(e)).appendTo(t.body),r=w.css(n[0],"display");n.remove();return r}function vn(e,t,n,r){var i;if(w.isArray(t))w.each(t,function(t,i){n||cn.test(e)?r(e,i):vn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&w.type(t)==="object")for(i in t)vn(e+"["+i+"]",t[i],n,r);else r(e,t)}function _n(e){return function(t,n){if(typeof t!="string"){n=t;t="*"}var r,i=0,s=t.toLowerCase().match(S)||[];if(w.isFunction(n))while(r=s[i++])if(r[0]==="+"){r=r.slice(1)||"*";(e[r]=e[r]||[]).unshift(n)}else(e[r]=e[r]||[]).push(n)}}function Dn(e,t,n,r){function o(u){var a;i[u]=!0;w.each(e[u]||[],function(e,u){var f=u(t,n,r);if(typeof f=="string"&&!s&&!i[f]){t.dataTypes.unshift(f);o(f);return!1}if(s)return!(a=f)});return a}var i={},s=e===An;return o(t.dataTypes[0])||!i["*"]&&o("*")}function Pn(e,n){var r,i,s=w.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((s[i]?e:r||(r={}))[i]=n[i]);r&&w.extend(!0,e,r);return e}function Hn(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes;while(f[0]==="*"){f.shift();s===t&&(s=e.mimeType||n.getResponseHeader("Content-Type"))}if(s)for(u in a)if(a[u]&&a[u].test(s)){f.unshift(u);break}if(f[0]in r)o=f[0];else{for(u in r){if(!f[0]||e.converters[u+" "+f[0]]){o=u;break}i||(i=u)}o=o||i}if(o){o!==f[0]&&f.unshift(o);return r[o]}}function Bn(e,t,n,r){var i,s,o,u,a,f={},l=e.dataTypes.slice();if(l[1])for(o in e.converters)f[o.toLowerCase()]=e.converters[o];s=l.shift();while(s){e.responseFields[s]&&(n[e.responseFields[s]]=t);!a&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType));a=s;s=l.shift();if(s)if(s==="*")s=a;else if(a!=="*"&&a!==s){o=f[a+" "+s]||f["* "+s];if(!o)for(i in f){u=i.split(" ");if(u[1]===s){o=f[a+" "+u[0]]||f["* "+u[0]];if(o){if(o===!0)o=f[i];else if(f[i]!==!0){s=u[0];l.unshift(u[1])}break}}}if(o!==!0)if(o&&e["throws"])t=o(t);else try{t=o(t)}catch(c){return{state:"parsererror",error:o?c:"No conversion from "+a+" to "+s}}}}return{state:"success",data:t}}function zn(){try{return new e.XMLHttpRequest}catch(t){}}function Wn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function Yn(){setTimeout(function(){Xn=t});return Xn=w.now()}function Zn(e,t,n){var r,i=(Gn[t]||[]).concat(Gn["*"]),s=0,o=i.length;for(;s<o;s++)if(r=i[s].call(n,t,e))return r}function er(e,t,n){var r,i,s=0,o=Qn.length,u=w.Deferred().always(function(){delete a.elem}),a=function(){if(i)return!1;var t=Xn||Yn(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,s=1-r,o=0,a=f.tweens.length;for(;o<a;o++)f.tweens[o].run(s);u.notifyWith(e,[f,s,n]);if(s<1&&a)return n;u.resolveWith(e,[f]);return!1},f=u.promise({elem:e,props:w.extend({},t),opts:w.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Yn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=w.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);f.tweens.push(r);return r},stop:function(t){var n=0,r=t?f.tweens.length:0;if(i)return this;i=!0;for(;n<r;n++)f.tweens[n].run(1);t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]);return this}}),l=f.props;tr(l,f.opts.specialEasing);for(;s<o;s++){r=Qn[s].call(f,e,l,f.opts);if(r)return r}w.map(l,Zn,f);w.isFunction(f.opts.start)&&f.opts.start.call(e,f);w.fx.timer(w.extend(a,{elem:e,anim:f,queue:f.opts.queue}));return f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function tr(e,t){var n,r,i,s,o;for(n in e){r=w.camelCase(n);i=t[r];s=e[n];if(w.isArray(s)){i=s[1];s=e[n]=s[0]}if(n!==r){e[r]=s;delete e[n]}o=w.cssHooks[r];if(o&&"expand"in o){s=o.expand(s);delete e[r];for(n in s)if(!(n in e)){e[n]=s[n];t[n]=i}}else t[r]=i}}function nr(e,t,n){var r,i,s,o,u,a,f=this,l={},c=e.style,h=e.nodeType&&nn(e),p=w._data(e,"fxshow");if(!n.queue){u=w._queueHooks(e,"fx");if(u.unqueued==null){u.unqueued=0;a=u.empty.fire;u.empty.fire=function(){u.unqueued||a()}}u.unqueued++;f.always(function(){f.always(function(){u.unqueued--;w.queue(e,"fx").length||u.empty.fire()})})}if(e.nodeType===1&&("height"in t||"width"in t)){n.overflow=[c.overflow,c.overflowX,c.overflowY];w.css(e,"display")==="inline"&&w.css(e,"float")==="none"&&(!w.support.inlineBlockNeedsLayout||an(e.nodeName)==="inline"?c.display="inline-block":c.zoom=1)}if(n.overflow){c.overflow="hidden";w.support.shrinkWrapBlocks||f.always(function(){c.overflow=n.overflow[0];c.overflowX=n.overflow[1];c.overflowY=n.overflow[2]})}for(r in t){i=t[r];if($n.exec(i)){delete t[r];s=s||i==="toggle";if(i===(h?"hide":"show"))continue;l[r]=p&&p[r]||w.style(e,r)}}if(!w.isEmptyObject(l)){p?"hidden"in p&&(h=p.hidden):p=w._data(e,"fxshow",{});s&&(p.hidden=!h);h?w(e).show():f.done(function(){w(e).hide()});f.done(function(){var t;w._removeData(e,"fxshow");for(t in l)w.style(e,t,l[t])});for(r in l){o=Zn(h?p[r]:0,r,f);if(!(r in p)){p[r]=o.start;if(h){o.end=o.start;o.start=r==="width"||r==="height"?1:0}}}}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}function ir(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t){n=Zt[i];r["margin"+n]=r["padding"+n]=e}t&&(r.opacity=r.width=e);return r}function sr(e){return w.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n,r,i=typeof t,s=e.location,o=e.document,u=o.documentElement,a=e.jQuery,f=e.$,l={},c=[],h="1.10.1",p=c.concat,d=c.push,v=c.slice,m=c.indexOf,g=l.toString,y=l.hasOwnProperty,b=h.trim,w=function(e,t){return new w.fn.init(e,t,r)},E=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,S=/\S+/g,x=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,T=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,N=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,C=/^[\],:{}\s]*$/,k=/(?:^|:|,)(?:\s*\[)+/g,L=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,O=/^-ms-/,M=/-([\da-z])/gi,_=function(e,t){return t.toUpperCase()},D=function(e){if(o.addEventListener||e.type==="load"||o.readyState==="complete"){P();w.ready()}},P=function(){if(o.addEventListener){o.removeEventListener("DOMContentLoaded",D,!1);e.removeEventListener("load",D,!1)}else{o.detachEvent("onreadystatechange",D);e.detachEvent("onload",D)}};w.fn=w.prototype={jquery:h,constructor:w,init:function(e,n,r){var i,s;if(!e)return this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?i=[null,e,null]:i=T.exec(e);if(i&&(i[1]||!n)){if(i[1]){n=n instanceof w?n[0]:n;w.merge(this,w.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0));if(N.test(i[1])&&w.isPlainObject(n))for(i in n)w.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}s=o.getElementById(i[2]);if(s&&s.parentNode){if(s.id!==i[2])return r.find(e);this.length=1;this[0]=s}this.context=o;this.selector=e;return this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}if(e.nodeType){this.context=this[0]=e;this.length=1;return this}if(w.isFunction(e))return r.ready(e);if(e.selector!==t){this.selector=e.selector;this.context=e.context}return w.makeArray(e,this)},selector:"",length:0,toArray:function(){return v.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);t.prevObject=this;t.context=this.context;return t},each:function(e,t){return w.each(this,e,t)},ready:function(e){w.ready.promise().done(e);return this},slice:function(){return this.pushStack(v.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice};w.fn.init.prototype=w.fn;w.extend=w.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;if(typeof u=="boolean"){l=u;u=arguments[1]||{};a=2}typeof u!="object"&&!w.isFunction(u)&&(u={});if(f===a){u=this;--a}for(;a<f;a++)if((s=arguments[a])!=null)for(i in s){e=u[i];r=s[i];if(u===r)continue;if(l&&r&&(w.isPlainObject(r)||(n=w.isArray(r)))){if(n){n=!1;o=e&&w.isArray(e)?e:[]}else o=e&&w.isPlainObject(e)?e:{};u[i]=w.extend(l,o,r)}else r!==t&&(u[i]=r)}return u};w.extend({expando:"jQuery"+(h+Math.random()).replace(/\D/g,""),noConflict:function(t){e.$===w&&(e.$=f);t&&e.jQuery===w&&(e.jQuery=a);return w},isReady:!1,readyWait:1,holdReady:function(e){e?w.readyWait++:w.ready(!0)},ready:function(e){if(e===!0?--w.readyWait:w.isReady)return;if(!o.body)return setTimeout(w.ready);w.isReady=!0;if(e!==!0&&--w.readyWait>0)return;n.resolveWith(o,[w]);w.fn.trigger&&w(o).trigger("ready").off("ready")},isFunction:function(e){return w.type(e)==="function"},isArray:Array.isArray||function(e){return w.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):typeof e=="object"||typeof e=="function"?l[g.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||w.type(e)!=="object"||e.nodeType||w.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(w.support.ownLast)for(n in e)return y.call(e,n);for(n in e);return n===t||y.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){if(!e||typeof e!="string")return null;if(typeof t=="boolean"){n=t;t=!1}t=t||o;var r=N.exec(e),i=!n&&[];if(r)return[t.createElement(r[1])];r=w.buildFragment([e],t,i);i&&w(i).remove();return w.merge([],r.childNodes)},parseJSON:function(t){if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(t===null)return t;if(typeof t=="string"){t=w.trim(t);if(t&&C.test(t.replace(L,"@").replace(A,"]").replace(k,"")))return(new Function("return "+t))()}w.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{if(e.DOMParser){i=new DOMParser;r=i.parseFromString(n,"text/xml")}else{r=new ActiveXObject("Microsoft.XMLDOM");r.async="false";r.loadXML(n)}}catch(s){r=t}(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&w.error("Invalid XML: "+n);return r},noop:function(){},globalEval:function(t){t&&w.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(O,"ms-").replace(M,_)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,s=e.length,o=H(e);if(n)if(o)for(;i<s;i++){r=t.apply(e[i],n);if(r===!1)break}else for(i in e){r=t.apply(e[i],n);if(r===!1)break}else if(o)for(;i<s;i++){r=t.call(e[i],i,e[i]);if(r===!1)break}else for(i in e){r=t.call(e[i],i,e[i]);if(r===!1)break}return e},trim:b&&!b.call(" ")?function(e){return e==null?"":b.call(e)}:function(e){return e==null?"":(e+"").replace(x,"")},makeArray:function(e,t){var n=t||[];e!=null&&(H(Object(e))?w.merge(n,typeof e=="string"?[e]:e):d.call(n,e));return n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);r=t.length;n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];e.length=i;return e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++){r=!!t(e[s],s);n!==r&&i.push(e[s])}return i},map:function(e,t,n){var r,i=0,s=e.length,o=H(e),u=[];if(o)for(;i<s;i++){r=t(e[i],i,n);r!=null&&(u[u.length]=r)}else for(i in e){r=t(e[i],i,n);r!=null&&(u[u.length]=r)}return p.apply([],u)},guid:1,proxy:function(e,n){var r,i,s;if(typeof n=="string"){s=e[n];n=e;e=s}if(!w.isFunction(e))return t;r=v.call(arguments,2);i=function(){return e.apply(n||this,r.concat(v.call(arguments)))};i.guid=e.guid=e.guid||w.guid++;return i},access:function(e,n,r,i,s,o,u){var a=0,f=e.length,l=r==null;if(w.type(r)==="object"){s=!0;for(a in r)w.access(e,n,a,r[a],!0,o,u)}else if(i!==t){s=!0;w.isFunction(i)||(u=!0);if(l)if(u){n.call(e,i);n=null}else{l=n;n=function(e,t,n){return l.call(w(e),n)}}if(n)for(;a<f;a++)n(e[a],r,u?i:i.call(e[a],a,n(e[a],r)))}return s?e:l?n.call(e):f?n(e[0],r):o},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,s,o={};for(s in t){o[s]=e.style[s];e.style[s]=t[s]}i=n.apply(e,r||[]);for(s in t)e.style[s]=o[s];return i}});w.ready.promise=function(t){if(!n){n=w.Deferred();if(o.readyState==="complete")setTimeout(w.ready);else if(o.addEventListener){o.addEventListener("DOMContentLoaded",D,!1);e.addEventListener("load",D,!1)}else{o.attachEvent("onreadystatechange",D);e.attachEvent("onload",D);var r=!1;try{r=e.frameElement==null&&o.documentElement}catch(i){}r&&r.doScroll&&function s(){if(!w.isReady){try{r.doScroll("left")}catch(e){return setTimeout(s,50)}P();w.ready()}}()}}return n.promise(t)};w.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});r=w(o);(function(e,t){function ot(e,t,n,i){var s,o,u,a,f,l,p,m,g,w;(t?t.ownerDocument||t:E)!==h&&c(t);t=t||h;n=n||[];if(!e||typeof e!="string")return n;if((a=t.nodeType)!==1&&a!==9)return[];if(d&&!i){if(s=Z.exec(e))if(u=s[1]){if(a===9){o=t.getElementById(u);if(!o||!o.parentNode)return n;if(o.id===u){n.push(o);return n}}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(u))&&y(t,o)&&o.id===u){n.push(o);return n}}else{if(s[2]){H.apply(n,t.getElementsByTagName(e));return n}if((u=s[3])&&r.getElementsByClassName&&t.getElementsByClassName){H.apply(n,t.getElementsByClassName(u));return n}}if(r.qsa&&(!v||!v.test(e))){m=p=b;g=t;w=a===9&&e;if(a===1&&t.nodeName.toLowerCase()!=="object"){l=bt(e);(p=t.getAttribute("id"))?m=p.replace(nt,"\\$&"):t.setAttribute("id",m);m="[id='"+m+"'] ";f=l.length;while(f--)l[f]=m+wt(l[f]);g=$.test(e)&&t.parentNode||t;w=l.join(",")}if(w)try{H.apply(n,g.querySelectorAll(w));return n}catch(S){}finally{p||t.removeAttribute("id")}}}return Lt(e.replace(W,"$1"),t,n,i)}function ut(e){return Y.test(e+"")}function at(){function t(n,r){e.push(n+=" ")>s.cacheLength&&delete t[e.shift()];return t[n]=r}var e=[];return t}function ft(e){e[b]=!0;return e}function lt(e){var t=h.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t);t=null}}function ct(e,t,n){e=e.split("|");var r,i=e.length,o=n?null:t;while(i--)if(!(r=s.attrHandle[e[i]])||r===t)s.attrHandle[e[i]]=o}function ht(e,t){var n=e.getAttributeNode(t);return n&&n.specified?n.value:e[t]===!0?t.toLowerCase():null}function pt(e,t){return e.getAttribute(t,t.toLowerCase()==="type"?1:2)}function dt(e){if(e.nodeName.toLowerCase()==="input")return e.defaultValue}function vt(e,t){var n=t&&e,r=n&&e.nodeType===1&&t.nodeType===1&&(~t.sourceIndex||O)-(~e.sourceIndex||O);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function mt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function gt(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function yt(e){return ft(function(t){t=+t;return ft(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function bt(e,t){var n,r,i,o,u,a,f,l=N[e+" "];if(l)return t?0:l.slice(0);u=e;a=[];f=s.preFilter;while(u){if(!n||(r=X.exec(u))){r&&(u=u.slice(r[0].length)||u);a.push(i=[])}n=!1;if(r=V.exec(u)){n=r.shift();i.push({value:n,type:r[0].replace(W," ")});u=u.slice(n.length)}for(o in s.filter)if((r=G[o].exec(u))&&(!f[o]||(r=f[o](r)))){n=r.shift();i.push({value:n,type:o,matches:r});u=u.slice(n.length)}if(!n)break}return t?u.length:u?ot.error(e):N(e,a).slice(0)}function wt(e){var t=0,n=e.length,r="";for(;t<n;t++)r+=e[t].value;return r}function Et(e,t,n){var r=t.dir,s=n&&r==="parentNode",o=x++;return t.first?function(t,n,i){while(t=t[r])if(t.nodeType===1||s)return e(t,n,i)}:function(t,n,u){var a,f,l,c=S+" "+o;if(u){while(t=t[r])if(t.nodeType===1||s)if(e(t,n,u))return!0}else while(t=t[r])if(t.nodeType===1||s){l=t[b]||(t[b]={});if((f=l[r])&&f[0]===c){if((a=f[1])===!0||a===i)return a===!0}else{f=l[r]=[c];f[1]=e(t,n,u)||i;if(f[1]===!0)return!0}}}}function St(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i)){o.push(s);f&&t.push(u)}return o}function Tt(e,t,n,r,i,s){r&&!r[b]&&(r=Tt(r));i&&!i[b]&&(i=Tt(i,s));return ft(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||kt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?xt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=xt(g,p);r(f,[],u,a);l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[];l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?j.call(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else{g=xt(g===o?g.splice(d,g.length):g);i?i(null,o,g,a):H.apply(o,g)}})}function Nt(e){var t,n,r,i=e.length,o=s.relative[e[0].type],u=o||s.relative[" "],a=o?1:0,l=Et(function(e){return e===t},u,!0),c=Et(function(e){return j.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==f)||((t=n).nodeType?l(e,n,r):c(e,n,r))}];for(;a<i;a++)if(n=s.relative[e[a].type])h=[Et(St(h),n)];else{n=s.filter[e[a].type].apply(null,e[a].matches);if(n[b]){r=++a;for(;r<i;r++)if(s.relative[e[r].type])break;return Tt(a>1&&St(h),a>1&&wt(e.slice(0,a-1).concat({value:e[a-2].type===" "?"*":""})).replace(W,"$1"),n,a<r&&Nt(e.slice(a,r)),r<i&&Nt(e=e.slice(r)),r<i&&wt(e))}h.push(n)}return St(h)}function Ct(e,t){var n=0,r=t.length>0,o=e.length>0,u=function(u,a,l,c,p){var d,v,m,g=[],y=0,b="0",w=u&&[],E=p!=null,x=f,T=u||o&&s.find.TAG("*",p&&a.parentNode||a),N=S+=x==null?1:Math.random()||.1;if(E){f=a!==h&&a;i=n}for(;(d=T[b])!=null;b++){if(o&&d){v=0;while(m=e[v++])if(m(d,a,l)){c.push(d);break}if(E){S=N;i=++n}}if(r){(d=!m&&d)&&y--;u&&w.push(d)}}y+=b;if(r&&b!==y){v=0;while(m=t[v++])m(w,g,a,l);if(u){if(y>0)while(b--)!w[b]&&!g[b]&&(g[b]=D.call(c));g=xt(g)}H.apply(c,g);E&&!u&&g.length>0&&y+t.length>1&&ot.uniqueSort(c)}if(E){S=N;f=x}return w};return r?ft(u):u}function kt(e,t,n){var r=0,i=t.length;for(;r<i;r++)ot(e,t[r],n);return n}function Lt(e,t,n,i){var o,u,f,l,c,h=bt(e);if(!i&&h.length===1){u=h[0]=h[0].slice(0);if(u.length>2&&(f=u[0]).type==="ID"&&r.getById&&t.nodeType===9&&d&&s.relative[u[1].type]){t=(s.find.ID(f.matches[0].replace(rt,it),t)||[])[0];if(!t)return n;e=e.slice(u.shift().value.length)}o=G.needsContext.test(e)?0:u.length;while(o--){f=u[o];if(s.relative[l=f.type])break;if(c=s.find[l])if(i=c(f.matches[0].replace(rt,it),$.test(u[0].type)&&t.parentNode||t)){u.splice(o,1);e=i.length&&wt(u);if(!e){H.apply(n,i);return n}break}}}a(e,h)(i,t,!d,n,$.test(e));return n}function At(){}var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b="sizzle"+ -(new Date),E=e.document,S=0,x=0,T=at(),N=at(),C=at(),k=!1,L=function(){return 0},A=typeof t,O=1<<31,M={}.hasOwnProperty,_=[],D=_.pop,P=_.push,H=_.push,B=_.slice,j=_.indexOf||function(e){var t=0,n=this.length;for(;t<n;t++)if(this[t]===e)return t;return-1},F="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",I="[\\x20\\t\\r\\n\\f]",q="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",R=q.replace("w","w#"),U="\\["+I+"*("+q+")"+I+"*(?:([*^$|!~]?=)"+I+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+R+")|)|)"+I+"*\\]",z=":("+q+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+U.replace(3,8)+")*)|.*)\\)|)",W=new RegExp("^"+I+"+|((?:^|[^\\\\])(?:\\\\.)*)"+I+"+$","g"),X=new RegExp("^"+I+"*,"+I+"*"),V=new RegExp("^"+I+"*([>+~]|"+I+")"+I+"*"),$=new RegExp(I+"*[+~]"),J=new RegExp("="+I+"*([^\\]'\"]*)"+I+"*\\]","g"),K=new RegExp(z),Q=new RegExp("^"+R+"$"),G={ID:new RegExp("^#("+q+")"),CLASS:new RegExp("^\\.("+q+")"),TAG:new RegExp("^("+q.replace("w","w*")+")"),ATTR:new RegExp("^"+U),PSEUDO:new RegExp("^"+z),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+I+"*(even|odd|(([+-]|)(\\d*)n|)"+I+"*(?:([+-]|)"+I+"*(\\d+)|))"+I+"*\\)|)","i"),bool:new RegExp("^(?:"+F+")$","i"),needsContext:new RegExp("^"+I+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+I+"*((?:-\\d)?\\d*)"+I+"*\\)|)(?=[^-]|$)","i")},Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=new RegExp("\\\\([\\da-f]{1,6}"+I+"?|("+I+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,r&1023|56320)};try{H.apply(_=B.call(E.childNodes),E.childNodes);_[E.childNodes.length].nodeType}catch(st){H={apply:_.length?function(e,t){P.apply(e,B.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}u=ot.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1};r=ot.support={};c=ot.setDocument=function(e){var t=e?e.ownerDocument||e:E,n=t.parentWindow;if(t===h||t.nodeType!==9||!t.documentElement)return h;h=t;p=t.documentElement;d=!u(t);n&&n.frameElement&&n.attachEvent("onbeforeunload",function(){c()});r.attributes=lt(function(e){e.innerHTML="<a href='#'></a>";ct("type|href|height|width",pt,e.firstChild.getAttribute("href")==="#");ct(F,ht,e.getAttribute("disabled")==null);e.className="i";return!e.getAttribute("className")});r.input=lt(function(e){e.innerHTML="<input>";e.firstChild.setAttribute("value","");return e.firstChild.getAttribute("value")===""});ct("value",dt,r.attributes&&r.input);r.getElementsByTagName=lt(function(e){e.appendChild(t.createComment(""));return!e.getElementsByTagName("*").length});r.getElementsByClassName=lt(function(e){e.innerHTML="<div class='a'></div><div class='a i'></div>";e.firstChild.className="i";return e.getElementsByClassName("i").length===2});r.getById=lt(function(e){p.appendChild(e).id=b;return!t.getElementsByName||!t.getElementsByName(b).length});if(r.getById){s.find.ID=function(e,t){if(typeof t.getElementById!==A&&d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}};s.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}}else{delete s.find.ID;s.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}}s.find.TAG=r.getElementsByTagName?function(e,t){if(typeof t.getElementsByTagName!==A)return t.getElementsByTagName(e)}:function(e,t){var n,r=[],i=0,s=t.getElementsByTagName(e);if(e==="*"){while(n=s[i++])n.nodeType===1&&r.push(n);return r}return s};s.find.CLASS=r.getElementsByClassName&&function(e,t){if(typeof t.getElementsByClassName!==A&&d)return t.getElementsByClassName(e)};m=[];v=[];if(r.qsa=ut(t.querySelectorAll)){lt(function(e){e.innerHTML="<select><option selected=''></option></select>";e.querySelectorAll("[selected]").length||v.push("\\["+I+"*(?:value|"+F+")");e.querySelectorAll(":checked").length||v.push(":checked")});lt(function(e){var n=t.createElement("input");n.setAttribute("type","hidden");e.appendChild(n).setAttribute("t","");e.querySelectorAll("[t^='']").length&&v.push("[*^$]="+I+"*(?:''|\"\")");e.querySelectorAll(":enabled").length||v.push(":enabled",":disabled");e.querySelectorAll("*,:x");v.push(",.*:")})}(r.matchesSelector=ut(g=p.webkitMatchesSelector||p.mozMatchesSelector||p.oMatchesSelector||p.msMatchesSelector))&<(function(e){r.disconnectedMatch=g.call(e,"div");g.call(e,"[s!='']:x");m.push("!=",z)});v=v.length&&new RegExp(v.join("|"));m=m.length&&new RegExp(m.join("|"));y=ut(p.contains)||p.compareDocumentPosition?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!r&&r.nodeType===1&&!!(n.contains?n.contains(r):e.compareDocumentPosition&&e.compareDocumentPosition(r)&16)}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1};r.sortDetached=lt(function(e){return e.compareDocumentPosition(t.createElement("div"))&1});L=p.compareDocumentPosition?function(e,n){if(e===n){k=!0;return 0}var i=n.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(n);if(i)return i&1||!r.sortDetached&&n.compareDocumentPosition(e)===i?e===t||y(E,e)?-1:n===t||y(E,n)?1:l?j.call(l,e)-j.call(l,n):0:i&4?-1:1;return e.compareDocumentPosition?-1:1}:function(e,n){var r,i=0,s=e.parentNode,o=n.parentNode,u=[e],a=[n];if(e===n){k=!0;return 0}if(!s||!o)return e===t?-1:n===t?1:s?-1:o?1:l?j.call(l,e
)-j.call(l,n):0;if(s===o)return vt(e,n);r=e;while(r=r.parentNode)u.unshift(r);r=n;while(r=r.parentNode)a.unshift(r);while(u[i]===a[i])i++;return i?vt(u[i],a[i]):u[i]===E?-1:a[i]===E?1:0};return t};ot.matches=function(e,t){return ot(e,null,null,t)};ot.matchesSelector=function(e,t){(e.ownerDocument||e)!==h&&c(e);t=t.replace(J,"='$1']");if(r.matchesSelector&&d&&(!m||!m.test(t))&&(!v||!v.test(t)))try{var n=g.call(e,t);if(n||r.disconnectedMatch||e.document&&e.document.nodeType!==11)return n}catch(i){}return ot(t,h,null,[e]).length>0};ot.contains=function(e,t){(e.ownerDocument||e)!==h&&c(e);return y(e,t)};ot.attr=function(e,n){(e.ownerDocument||e)!==h&&c(e);var i=s.attrHandle[n.toLowerCase()],o=i&&M.call(s.attrHandle,n.toLowerCase())?i(e,n,!d):t;return o===t?r.attributes||!d?e.getAttribute(n):(o=e.getAttributeNode(n))&&o.specified?o.value:null:o};ot.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};ot.uniqueSort=function(e){var t,n=[],i=0,s=0;k=!r.detectDuplicates;l=!r.sortStable&&e.slice(0);e.sort(L);if(k){while(t=e[s++])t===e[s]&&(i=n.push(s));while(i--)e.splice(n[i],1)}return e};o=ot.getText=function(e){var t,n="",r=0,i=e.nodeType;if(!i)for(;t=e[r];r++)n+=o(t);else if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(i===3||i===4)return e.nodeValue;return n};s=ot.selectors={cacheLength:50,createPseudo:ft,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){e[1]=e[1].replace(rt,it);e[3]=(e[4]||e[5]||"").replace(rt,it);e[2]==="~="&&(e[3]=" "+e[3]+" ");return e.slice(0,4)},CHILD:function(e){e[1]=e[1].toLowerCase();if(e[1].slice(0,3)==="nth"){e[3]||ot.error(e[0]);e[4]=+(e[4]?e[5]+(e[6]||1):2*(e[3]==="even"||e[3]==="odd"));e[5]=+(e[7]+e[8]||e[3]==="odd")}else e[3]&&ot.error(e[0]);return e},PSEUDO:function(e){var n,r=!e[5]&&e[2];if(G.CHILD.test(e[0]))return null;if(e[3]&&e[4]!==t)e[2]=e[4];else if(r&&K.test(r)&&(n=bt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)){e[0]=e[0].slice(0,n);e[2]=r.slice(0,n)}return e.slice(0,3)}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return e==="*"?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=T[e+" "];return t||(t=new RegExp("(^|"+I+")"+e+"("+I+"|$)"))&&T(e,function(e){return t.test(typeof e.className=="string"&&e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ot.attr(r,e);if(i==null)return t==="!=";if(!t)return!0;i+="";return t==="="?i===n:t==="!="?i!==n:t==="^="?n&&i.indexOf(n)===0:t==="*="?n&&i.indexOf(n)>-1:t==="$="?n&&i.slice(-n.length)===n:t==="~="?(" "+i+" ").indexOf(n)>-1:t==="|="?i===n||i.slice(0,n.length+1)===n+"-":!1}},CHILD:function(e,t,n,r,i){var s=e.slice(0,3)!=="nth",o=e.slice(-4)!=="last",u=t==="of-type";return r===1&&i===0?function(e){return!!e.parentNode}:function(t,n,a){var f,l,c,h,p,d,v=s!==o?"nextSibling":"previousSibling",m=t.parentNode,g=u&&t.nodeName.toLowerCase(),y=!a&&!u;if(m){if(s){while(v){c=t;while(c=c[v])if(u?c.nodeName.toLowerCase()===g:c.nodeType===1)return!1;d=v=e==="only"&&!d&&"nextSibling"}return!0}d=[o?m.firstChild:m.lastChild];if(o&&y){l=m[b]||(m[b]={});f=l[e]||[];p=f[0]===S&&f[1];h=f[0]===S&&f[2];c=p&&m.childNodes[p];while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if(c.nodeType===1&&++h&&c===t){l[e]=[S,p,h];break}}else if(y&&(f=(t[b]||(t[b]={}))[e])&&f[0]===S)h=f[1];else while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if((u?c.nodeName.toLowerCase()===g:c.nodeType===1)&&++h){y&&((c[b]||(c[b]={}))[e]=[S,h]);if(c===t)break}h-=i;return h===r||h%r===0&&h/r>=0}}},PSEUDO:function(e,t){var n,r=s.pseudos[e]||s.setFilters[e.toLowerCase()]||ot.error("unsupported pseudo: "+e);if(r[b])return r(t);if(r.length>1){n=[e,e,"",t];return s.setFilters.hasOwnProperty(e.toLowerCase())?ft(function(e,n){var i,s=r(e,t),o=s.length;while(o--){i=j.call(e,s[o]);e[i]=!(n[i]=s[o])}}):function(e){return r(e,0,n)}}return r}},pseudos:{not:ft(function(e){var t=[],n=[],r=a(e.replace(W,"$1"));return r[b]?ft(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){t[0]=e;r(t,null,s,n);return!n.pop()}}),has:ft(function(e){return function(t){return ot(e,t).length>0}}),contains:ft(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ft(function(e){Q.test(e||"")||ot.error("unsupported lang: "+e);e=e.replace(rt,it).toLowerCase();return function(t){var n;do if(n=d?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang")){n=n.toLowerCase();return n===e||n.indexOf(e+"-")===0}while((t=t.parentNode)&&t.nodeType===1);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===p},focus:function(e){return e===h.activeElement&&(!h.hasFocus||h.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){e.parentNode&&e.parentNode.selectedIndex;return e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||e.nodeType===3||e.nodeType===4)return!1;return!0},parent:function(e){return!s.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},text:function(e){var t;return e.nodeName.toLowerCase()==="input"&&e.type==="text"&&((t=e.getAttribute("type"))==null||t.toLowerCase()===e.type)},first:yt(function(){return[0]}),last:yt(function(e,t){return[t-1]}),eq:yt(function(e,t,n){return[n<0?n+t:n]}),even:yt(function(e,t){var n=0;for(;n<t;n+=2)e.push(n);return e}),odd:yt(function(e,t){var n=1;for(;n<t;n+=2)e.push(n);return e}),lt:yt(function(e,t,n){var r=n<0?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:yt(function(e,t,n){var r=n<0?n+t:n;for(;++r<t;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})s.pseudos[n]=mt(n);for(n in{submit:!0,reset:!0})s.pseudos[n]=gt(n);a=ot.compile=function(e,t){var n,r=[],i=[],s=C[e+" "];if(!s){t||(t=bt(e));n=t.length;while(n--){s=Nt(t[n]);s[b]?r.push(s):i.push(s)}s=C(e,Ct(i,r))}return s};s.pseudos.nth=s.pseudos.eq;At.prototype=s.filters=s.pseudos;s.setFilters=new At;r.sortStable=b.split("").sort(L).join("")===b;c();[0,0].sort(L);r.detectDuplicates=k;w.find=ot;w.expr=ot.selectors;w.expr[":"]=w.expr.pseudos;w.unique=ot.uniqueSort;w.text=ot.getText;w.isXMLDoc=ot.isXML;w.contains=ot.contains})(e);var B={};w.Callbacks=function(e){e=typeof e=="string"?B[e]||j(e):w.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){r=e.memory&&t;i=!0;o=u||0;u=0;s=a.length;n=!0;for(;a&&o<s;o++)if(a[o].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1;a&&(f?f.length&&l(f.shift()):r?a=[]:c.disable())},c={add:function(){if(a){var t=a.length;(function i(t){w.each(t,function(t,n){var r=w.type(n);r==="function"?(!e.unique||!c.has(n))&&a.push(n):n&&n.length&&r!=="string"&&i(n)})})(arguments);if(n)s=a.length;else if(r){u=t;l(r)}}return this},remove:function(){a&&w.each(arguments,function(e,t){var r;while((r=w.inArray(t,a,r))>-1){a.splice(r,1);if(n){r<=s&&s--;r<=o&&o--}}});return this},has:function(e){return e?w.inArray(e,a)>-1:!!a&&!!a.length},empty:function(){a=[];s=0;return this},disable:function(){a=f=r=t;return this},disabled:function(){return!a},lock:function(){f=t;r||c.disable();return this},locked:function(){return!f},fireWith:function(e,t){t=t||[];t=[e,t.slice?t.slice():t];a&&(!i||f)&&(n?f.push(t):l(t));return this},fire:function(){c.fireWith(this,arguments);return this},fired:function(){return!!i}};return c};w.extend({Deferred:function(e){var t=[["resolve","done",w.Callbacks("once memory"),"resolved"],["reject","fail",w.Callbacks("once memory"),"rejected"],["notify","progress",w.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){i.done(arguments).fail(arguments);return this},then:function(){var e=arguments;return w.Deferred(function(n){w.each(t,function(t,s){var o=s[0],u=w.isFunction(e[t])&&e[t];i[s[1]](function(){var e=u&&u.apply(this,arguments);e&&w.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[o+"With"](this===r?n.promise():this,u?[e]:arguments)})});e=null}).promise()},promise:function(e){return e!=null?w.extend(e,r):r}},i={};r.pipe=r.then;w.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add;u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock);i[s[0]]=function(){i[s[0]+"With"](this===i?r:this,arguments);return this};i[s[0]+"With"]=o.fireWith});r.promise(i);e&&e.call(i,i);return i},when:function(e){var t=0,n=v.call(arguments),r=n.length,i=r!==1||e&&w.isFunction(e.promise)?r:0,s=i===1?e:w.Deferred(),o=function(e,t,n){return function(r){t[e]=this;n[e]=arguments.length>1?v.call(arguments):r;n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r);a=new Array(r);f=new Array(r);for(;t<r;t++)n[t]&&w.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}i||s.resolveWith(f,n);return s.promise()}});w.support=function(t){var n,r,s,u,a,f,l,c,h,p=o.createElement("div");p.setAttribute("className","t");p.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";n=p.getElementsByTagName("*")||[];r=p.getElementsByTagName("a")[0];if(!r||!r.style||!n.length)return t;u=o.createElement("select");f=u.appendChild(o.createElement("option"));s=p.getElementsByTagName("input")[0];r.style.cssText="top:1px;float:left;opacity:.5";t.getSetAttribute=p.className!=="t";t.leadingWhitespace=p.firstChild.nodeType===3;t.tbody=!p.getElementsByTagName("tbody").length;t.htmlSerialize=!!p.getElementsByTagName("link").length;t.style=/top/.test(r.getAttribute("style"));t.hrefNormalized=r.getAttribute("href")==="/a";t.opacity=/^0.5/.test(r.style.opacity);t.cssFloat=!!r.style.cssFloat;t.checkOn=!!s.value;t.optSelected=f.selected;t.enctype=!!o.createElement("form").enctype;t.html5Clone=o.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>";t.inlineBlockNeedsLayout=!1;t.shrinkWrapBlocks=!1;t.pixelPosition=!1;t.deleteExpando=!0;t.noCloneEvent=!0;t.reliableMarginRight=!0;t.boxSizingReliable=!0;s.checked=!0;t.noCloneChecked=s.cloneNode(!0).checked;u.disabled=!0;t.optDisabled=!f.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}s=o.createElement("input");s.setAttribute("value","");t.input=s.getAttribute("value")==="";s.value="t";s.setAttribute("type","radio");t.radioValue=s.value==="t";s.setAttribute("checked","t");s.setAttribute("name","t");a=o.createDocumentFragment();a.appendChild(s);t.appendChecked=s.checked;t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked;if(p.attachEvent){p.attachEvent("onclick",function(){t.noCloneEvent=!1});p.cloneNode(!0).click()}for(h in{submit:!0,change:!0,focusin:!0}){p.setAttribute(l="on"+h,"t");t[h+"Bubbles"]=l in e||p.attributes[l].expando===!1}p.style.backgroundClip="content-box";p.cloneNode(!0).style.backgroundClip="";t.clearCloneStyle=p.style.backgroundClip==="content-box";for(h in w(t))break;t.ownLast=h!=="0";w(function(){var n,r,s,u="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",a=o.getElementsByTagName("body")[0];if(!a)return;n=o.createElement("div");n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";a.appendChild(n).appendChild(p);p.innerHTML="<table><tr><td></td><td>t</td></tr></table>";s=p.getElementsByTagName("td");s[0].style.cssText="padding:0;margin:0;border:0;display:none";c=s[0].offsetHeight===0;s[0].style.display="";s[1].style.display="none";t.reliableHiddenOffsets=c&&s[0].offsetHeight===0;p.innerHTML="";p.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";w.swap(a,a.style.zoom!=null?{zoom:1}:{},function(){t.boxSizing=p.offsetWidth===4});if(e.getComputedStyle){t.pixelPosition=(e.getComputedStyle(p,null)||{}).top!=="1%";t.boxSizingReliable=(e.getComputedStyle(p,null)||{width:"4px"}).width==="4px";r=p.appendChild(o.createElement("div"));r.style.cssText=p.style.cssText=u;r.style.marginRight=r.style.width="0";p.style.width="1px";t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)}if(typeof p.style.zoom!==i){p.innerHTML="";p.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1";t.inlineBlockNeedsLayout=p.offsetWidth===3;p.style.display="block";p.innerHTML="<div></div>";p.firstChild.style.width="5px";t.shrinkWrapBlocks=p.offsetWidth!==3;t.inlineBlockNeedsLayout&&(a.style.zoom=1)}a.removeChild(n);n=p=s=r=null});n=u=a=f=r=s=null;return t}({});var F=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,I=/([A-Z])/g;w.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){e=e.nodeType?w.cache[e[w.expando]]:e[w.expando];return!!e&&!z(e)},data:function(e,t,n){return q(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return q(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&e.nodeType!==1&&e.nodeType!==9)return!1;var t=e.nodeName&&w.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}});w.fn.extend({data:function(e,n){var r,i,s=null,o=0,u=this[0];if(e===t){if(this.length){s=w.data(u);if(u.nodeType===1&&!w._data(u,"parsedAttrs")){r=u.attributes;for(;o<r.length;o++){i=r[o].name;if(i.indexOf("data-")===0){i=w.camelCase(i.slice(5));U(u,i,s[i])}}w._data(u,"parsedAttrs",!0)}}return s}return typeof e=="object"?this.each(function(){w.data(this,e)}):arguments.length>1?this.each(function(){w.data(this,e,n)}):u?U(u,e,w.data(u,e)):null},removeData:function(e){return this.each(function(){w.removeData(this,e)})}});w.extend({queue:function(e,t,n){var r;if(e){t=(t||"fx")+"queue";r=w._data(e,t);n&&(!r||w.isArray(n)?r=w._data(e,t,w.makeArray(n)):r.push(n));return r||[]}},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),s=w._queueHooks(e,t),o=function(){w.dequeue(e,t)};if(i==="inprogress"){i=n.shift();r--}if(i){t==="fx"&&n.unshift("inprogress");delete s.stop;i.call(e,o,s)}!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return w._data(e,n)||w._data(e,n,{empty:w.Callbacks("once memory").add(function(){w._removeData(e,t+"queue");w._removeData(e,n)})})}});w.fn.extend({queue:function(e,n){var r=2;if(typeof e!="string"){n=e;e="fx";r--}return arguments.length<r?w.queue(this[0],e):n===t?this:this.each(function(){var t=w.queue(this,e,n);w._queueHooks(this,e);e==="fx"&&t[0]!=="inprogress"&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},delay:function(e,t){e=w.fx?w.fx.speeds[e]||e:e;t=t||"fx";return this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,s=w.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};if(typeof e!="string"){n=e;e=t}e=e||"fx";while(u--){r=w._data(o[u],e+"queueHooks");if(r&&r.empty){i++;r.empty.add(a)}}a();return s.promise(n)}});var W,X,V=/[\t\r\n\f]/g,$=/\r/g,J=/^(?:input|select|textarea|button|object)$/i,K=/^(?:a|area)$/i,Q=/^(?:checked|selected)$/i,G=w.support.getSetAttribute,Y=w.support.input;w.fn.extend({attr:function(e,t){return w.access(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})},prop:function(e,t){return w.access(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){e=w.propFix[e]||e;return this.each(function(){try{this[e]=t;delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o=0,u=this.length,a=typeof e=="string"&&e;if(w.isFunction(e))return this.each(function(t){w(this).addClass(e.call(this,t,this.className))});if(a){t=(e||"").match(S)||[];for(;o<u;o++){n=this[o];r=n.nodeType===1&&(n.className?(" "+n.className+" ").replace(V," "):" ");if(r){s=0;while(i=t[s++])r.indexOf(" "+i+" ")<0&&(r+=i+" ");n.className=w.trim(r)}}}return this},removeClass:function(e){var t,n,r,i,s,o=0,u=this.length,a=arguments.length===0||typeof e=="string"&&e;if(w.isFunction(e))return this.each(function(t){w(this).removeClass(e.call(this,t,this.className))});if(a){t=(e||"").match(S)||[];for(;o<u;o++){n=this[o];r=n.nodeType===1&&(n.className?(" "+n.className+" ").replace(V," "):"");if(r){s=0;while(i=t[s++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?w.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return w.isFunction(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var s,o=0,u=w(this),a=t,f=e.match(S)||[];while(s=f[o++]){a=r?a:!u.hasClass(s);u[a?"addClass":"removeClass"](s)}}else if(n===i||n==="boolean"){this.className&&w._data(this,"__className__",this.className);this.className=this.className||e===!1?"":w._data(this,"__className__")||""}})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(V," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s){r=w.valHooks[s.type]||w.valHooks[s.nodeName.toLowerCase()];if(r&&"get"in r&&(n=r.get(s,"value"))!==t)return n;n=s.value;return typeof n=="string"?n.replace($,""):n==null?"":n}return}i=w.isFunction(e);return this.each(function(n){var s;if(this.nodeType!==1)return;i?s=e.call(this,n,w(this).val()):s=e;s==null?s="":typeof s=="number"?s+="":w.isArray(s)&&(s=w.map(s,function(e){return e==null?"":e+""}));r=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()];if(!r||!("set"in r)||r.set(this,s,"value")===t)this.value=s})}});w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return t!=null?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(w.support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!w.nodeName(n.parentNode,"optgroup"))){t=w(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n,r,i=e.options,s=w.makeArray(t),o=i.length;while(o--){r=i[o];if(r.selected=w.inArray(w(r).val(),s)>=0)n=!0}n||(e.selectedIndex=-1);return s}}},attr:function(e,n,r){var s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;if(typeof e.getAttribute===i)return w.prop(e,n,r);if(u!==1||!w.isXMLDoc(e)){n=n.toLowerCase();s=w.attrHooks[n]||(w.expr.match.bool.test(n)?X:W)}if(r===t){if(s&&"get"in s&&(o=s.get(e,n))!==null)return o;o=w.find.attr(e,n);return o==null?t:o}if(r!==null){if(s&&"set"in s&&(o=s.set(e,r,n))!==t)return o;e.setAttribute(n,r+"");return r}w.removeAttr(e,n)},removeAttr:function(e,t){var n,r,i=0,s=t&&t.match(S);if(s&&e.nodeType===1)while(n=s[i++]){r=w.propFix[n]||n;w.expr.match.bool.test(n)?Y&&G||!Q.test(n)?e[r]=!1:e[w.camelCase("default-"+n)]=e[r]=!1:w.attr(e,n,"");e.removeAttribute(G?n:r)}},attrHooks:{type:{set:function(e,t){if(!w.support.radioValue&&t==="radio"&&w.nodeName(e,"input")){var n=e.value;e.setAttribute("type",t);n&&(e.value=n);return t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;o=u!==1||!w.isXMLDoc(e);if(o){n=w.propFix[n]||n;s=w.propHooks[n]}return r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):J.test(e.nodeName)||K.test(e.nodeName)&&e.href?0:-1}}}});X={set:function(e,t,n){t===!1?w.removeAttr(e,n):Y&&G||!Q.test(n)?e.setAttribute(!G&&w.propFix[n]||n,n):e[w.camelCase("default-"+n)]=e[n]=!0;return n}};w.each(w.expr.match.bool.source.match(/\w+/g),function(e,n){var r=w.expr.attrHandle[n]||w.find.attr;w.expr.attrHandle[n]=Y&&G||!Q.test(n)?function(e,n,i){var s=w.expr.attrHandle[n],o=i?t:(w.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;w.expr.attrHandle[n]=s;return o}:function(e,n,r){return r?t:e[w.camelCase("default-"+n)]?n.toLowerCase():null}});if(!Y||!G)w.attrHooks.value={set:function(e,t,n){if(!w.nodeName(e,"input"))return W&&W.set(e,t,n);e.defaultValue=t}};if(!G){W={set:function(e,n,r){var i=e.getAttributeNode(r);i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r));i.value=n+="";return r==="value"||n===e.getAttribute(r)?n:t}};w.expr.attrHandle.id=w.expr.attrHandle.name=w.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.value!==""?i.value:null};w.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:W.set};w.attrHooks.contenteditable={set:function(e,t,n){W.set(e,t===""?!1:t,n)}};w.each(["width","height"],function(e,t){w.attrHooks[t]={set:function(e,n){if(n===""){e.setAttribute(t,"auto");return n}}}})}w.support.hrefNormalized||w.each(["href","src"],function(e,t){w.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}});w.support.style||(w.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}});w.support.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;if(t){t.selectedIndex;t.parentNode&&t.parentNode.selectedIndex}return null}});w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});w.support.enctype||(w.propFix.enctype="encoding");w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(w.isArray(t))return e.checked=w.inArray(w(e).val(),t)>=0}};w.support.checkOn||(w.valHooks[this].get=function(e){return e.getAttribute("value")===null?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;w.event={global:{},add:function(e,n,r,s,o){var u,a,f,l,c,h,p,d,v,m,g,y=w._data(e);if(!y)return;if(r.handler){l=r;r=l.handler;o=l.selector}r.guid||(r.guid=w.guid++);(a=y.events)||(a=y.events={});if(!(h=y.handle)){h=y.handle=function(e){return typeof w===i||!!e&&w.event.triggered===e.type?t:w.event.dispatch.apply(h.elem,arguments)};h.elem=e}n=(n||"").match(S)||[""];f=n.length;while(f--){u=rt.exec(n[f])||[];v=g=u[1];m=(u[2]||"").split(".").sort();if(!v)continue;c=w.event.special[v]||{};v=(o?c.delegateType:c.bindType)||v;c=w.event.special[v]||{};p=w.extend({type:v,origType:g,data:s,handler:r,guid:r.guid,selector:o,needsContext:o&&w.expr.match.needsContext.test(o),namespace:m.join(".")},l);if(!(d=a[v])){d=a[v]=[];d.delegateCount=0;if(!c.setup||c.setup.call(e,s,m,h)===!1)e.addEventListener?e.addEventListener(v,h,!1):e.attachEvent&&e.attachEvent("on"+v,h)}if(c.add){c.add.call(e,p);p.handler.guid||(p.handler.guid=r.guid)}o?d.splice(d.delegateCount++,0,p):d.push(p);w.event.global[v]=!0}e=null},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m=w.hasData(e)&&w._data(e);if(!m||!(l=m.events))return;t=(t||"").match(S)||[""];f=t.length;while(f--){u=rt.exec(t[f])||[];p=v=u[1];d=(u[2]||"").split(".").sort();if(!p){for(p in l)w.event.remove(e,p+t[f],n,r,!0);continue}c=w.event.special[p]||{};p=(r?c.delegateType:c.bindType)||p;h=l[p]||[];u=u[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)");a=s=h.length;while(s--){o=h[s];if((i||v===o.origType)&&(!n||n.guid===o.guid)&&(!u||u.test(o.namespace))&&(!r||r===o.selector||r==="**"&&o.selector)){h.splice(s,1);o.selector&&h.delegateCount--;c.remove&&c.remove.call(e,o)}}if(a&&!h.length){(!c.teardown||c.teardown.call(e,d,m.handle)===!1)&&w.removeEvent(e,p,m.handle);delete l[p]}}if(w.isEmptyObject(l)){delete m.handle;w._removeData(e,"events")}},trigger:function(n,r,i,s){var u,a,f,l,c,h,p,d=[i||o],v=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];f=h=i=i||o;if(i.nodeType===3||i.nodeType===8)return;if(nt.test(v+w.event.triggered))return;if(v.indexOf(".")>=0){m=v.split(".");v=m.shift();m.sort()}a=v.indexOf(":")<0&&"on"+v;n=n[w.expando]?n:new w.Event(v,typeof n=="object"&&n);n.isTrigger=s?2:3;n.namespace=m.join(".");n.namespace_re=n.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null;n.result=t;n.target||(n.target=i);r=r==null?[n]:w.makeArray(r,[n]);c=w.event.special[v]||{};if(!s&&c.trigger&&c.trigger.apply(i,r)===!1)return;if(!s&&!c.noBubble&&!w.isWindow(i)){l=c.delegateType||v;nt.test(l+v)||(f=f.parentNode);for(;f;f=f.parentNode){d.push(f);h=f}h===(i.ownerDocument||o)&&d.push(h.defaultView||h.parentWindow||e)}p=0;while((f=d[p++])&&!n.isPropagationStopped()){n.type=p>1?l:c.bindType||v;u=(w._data(f,"events")||{})[n.type]&&w._data(f,"handle");u&&u.apply(f,r);u=a&&f[a];u&&w.acceptData(f)&&u.apply&&u.apply(f,r)===!1&&n.preventDefault()}n.type=v;if(!s&&!n.isDefaultPrevented()&&(!c._default||c._default.apply(d.pop(),r)===!1)&&w.acceptData(i)&&a&&i[v]&&!w.isWindow(i)){h=i[a];h&&(i[a]=null);w.event.triggered=v;try{i[v]()}catch(g){}w.event.triggered=t;h&&(i[a]=h)}return n.result},dispatch:function(e){e=w.event.fix(e);var n,r,i,s,o,u=[],a=v.call(arguments),f=(w._data(this,"events")||{})[e.type]||[],l=w.event.special[e.type]||{};a[0]=e;e.delegateTarget=this;if(l.preDispatch&&l.preDispatch.call(this,e)===!1)return;u=w.event.handlers.call(this,e,f);n=0;while((s=u[n++])&&!e.isPropagationStopped()){e.currentTarget=s.elem;o=0;while((i=s.handlers[o++])&&!e.isImmediatePropagationStopped())if(!e.namespace_re||e.namespace_re.test(i.namespace)){e.handleObj=i;e.data=i.data;r=((w.event.special[i.origType]||{}).handle||i.handler).apply(s.elem,a);if(r!==t&&(e.result=r)===!1){e.preventDefault();e.stopPropagation()}}}l.postDispatch&&l.postDispatch.call(this,e);return e.result},handlers:function(e,n){var r,i,s,o,u=[],a=n.delegateCount,f=e.target;if(a&&f.nodeType&&(!e.button||e.type!=="click"))for(;f!=this;f=f.parentNode||this)if(f.nodeType===1&&(f.disabled!==!0||e.type!=="click")){s=[];for(o=0;o<a;o++){i=n[o];r=i.selector+" ";s[r]===t&&(s[r]=i.needsContext?w(r,this).index(f)>=0:w.find(r,this,null,[f]).length);s[r]&&s.push(i)}s.length&&u.push({elem:f,handlers:s})}a<n.length&&u.push({elem:this,handlers:n.slice(a)});return u},fix:function(e){if(e[w.expando])return e;var t,n,r,i=e.type,s=e,u=this.fixHooks[i];u||(this.fixHooks[i]=u=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{});r=u.props?this.props.concat(u.props):this.props;e=new w.Event(s);t=r.length;while(t--){n=r[t];e[n]=s[n]}e.target||(e.target=s.srcElement||o);e.target.nodeType===3&&(e.target=e.target.parentNode);e.metaKey=!!e.metaKey;return u.filter?u.filter(e,s):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode);return e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,s,u=n.button,a=n.fromElement;if(e.pageX==null&&n.clientX!=null){i=e.target.ownerDocument||o;s=i.documentElement;r=i.body;e.pageX=n.clientX+(s&&s.scrollLeft||r&&r.scrollLeft||0)-(s&&s.clientLeft||r&&r.clientLeft||0);e.pageY=n.clientY+(s&&s.scrollTop||r&&r.scrollTop||0)-(s&&s.clientTop||r&&r.clientTop||0)}!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?n.toElement:a);!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0);return e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ot()&&this.focus)try{this.focus();return!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){if(this===ot()&&this.blur){this.blur();return!1}},delegateType:"focusout"},click:{trigger:function(){if(w.nodeName(this,"input")&&this.type==="checkbox"&&this.click){this.click();return!1}},_default:function(e){return w.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=w.extend(new w.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?w.event.trigger(i,null,t):w.event.dispatch.call(t,i);i.isDefaultPrevented()&&n.preventDefault()}};w.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;if(e.detachEvent){typeof e[r]===i&&(e[r]=null);e.detachEvent(r,n)}};w.Event=function(e,t){if(!(this instanceof w.Event))return new w.Event(e,t);if(e&&e.type){this.originalEvent=e;this.type=e.type;this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:st}else this.type=e;t&&w.extend(this,t);this.timeStamp=e&&e.timeStamp||w.now();this[w.expando]=!0};w.Event.prototype={isDefaultPrevented:st,isPropagationStopped:st,isImmediatePropagationStopped:st,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it;if(!e)return;e.stopPropagation&&e.stopPropagation();e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it;this.stopPropagation()}};w.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj;if(!i||i!==r&&!w.contains(r,i)){e.type=s.origType;n=s.handler.apply(this,arguments);e.type=t}return n}}});w.support.submitBubbles||(w.event.special.submit={setup:function(){if(w.nodeName(this,"form"))return!1;w.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=w.nodeName(n,"input")||w.nodeName(n,"button")?n.form:t;if(r&&!w._data(r,"submitBubbles")){w.event.add(r,"submit._submit",function(e){e._submit_bubble=!0});w._data(r,"submitBubbles",!0)}})},postDispatch:function(e){if(e._submit_bubble){delete e._submit_bubble;this.parentNode&&!e.isTrigger&&w.event.simulate("submit",this.parentNode,e,!0)}},teardown:function(){if(w.nodeName(this,"form"))return!1;w.event.remove(this,"._submit")}});w.support.changeBubbles||(w.event.special.change={setup:function(){if(Z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio"){w.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)});w.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1);w.event.simulate("change",this,e,!0)})}return!1}w.event.add(this,"beforeactivate._change",function(e){var t=e.target;if(Z.test(t.nodeName)&&!w._data(t,"changeBubbles")){w.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&w.event.simulate("change",this.parentNode,e,!0)});w._data(t,"changeBubbles",!0)}})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){w.event.remove(this,"._change");return!Z.test(this.nodeName)}});w.support.focusinBubbles||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){w.event.simulate(t,e.target,w.event.fix(e),!0)};w.event.special[t]={setup:function(){n++===0&&o.addEventListener(e,r,!0)},teardown:function(){--n===0&&o.removeEventListener(e,r,!0)}}});w.fn.extend({on:function(e,n,r,i,s){var o,u;if(typeof e=="object"){if(typeof n!="string"){r=r||n;n=t}for(o in e)this.on(o,n,r,e[o],s);return this}if(r==null&&i==null){i=n;r=n=t}else if(i==null)if(typeof n=="string"){i=r;r=t}else{i=r;r=n;n=t}if(i===!1)i=st;else if(!i)return this;if(s===1){u=i;i=function(e){w().off(e);return u.apply(this,arguments)};i.guid=u.guid||(u.guid=w.guid++)}return this.each(function(){w.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,s;if(e&&e.preventDefault&&e.handleObj){i=e.handleObj;w(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler);return this}if(typeof e=="object"){for(s in e)this.off(s,n,e[s]);return this}if(n===!1||typeof n=="function"){r=n;n=t}r===!1&&(r=st);return this.each(function(){w.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}});var ut=/^.[^:#\[\.,]*$/,at=/^(?:parents|prev(?:Until|All))/
,ft=w.expr.match.needsContext,lt={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if(typeof e!="string")return this.pushStack(w(e).filter(function(){for(t=0;t<i;t++)if(w.contains(r[t],this))return!0}));for(t=0;t<i;t++)w.find(e,r[t],n);n=this.pushStack(i>1?w.unique(n):n);n.selector=this.selector?this.selector+" "+e:e;return n},has:function(e){var t,n=w(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(w.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ht(this,e||[],!0))},filter:function(e){return this.pushStack(ht(this,e||[],!1))},is:function(e){return!!ht(this,typeof e=="string"&&ft.test(e)?w(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,s=[],o=ft.test(e)||typeof e!="string"?w(e,t||this.context):0;for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(o?o.index(n)>-1:n.nodeType===1&&w.find.matchesSelector(n,e))){n=s.push(n);break}return this.pushStack(s.length>1?w.unique(s):s)},index:function(e){return e?typeof e=="string"?w.inArray(this[0],w(e)):w.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?w(e,t):w.makeArray(e&&e.nodeType?[e]:e),r=w.merge(this.get(),n);return this.pushStack(w.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}});w.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return w.dir(e,"parentNode")},parentsUntil:function(e,t,n){return w.dir(e,"parentNode",n)},next:function(e){return ct(e,"nextSibling")},prev:function(e){return ct(e,"previousSibling")},nextAll:function(e){return w.dir(e,"nextSibling")},prevAll:function(e){return w.dir(e,"previousSibling")},nextUntil:function(e,t,n){return w.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return w.dir(e,"previousSibling",n)},siblings:function(e){return w.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return w.sibling(e.firstChild)},contents:function(e){return w.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:w.merge([],e.childNodes)}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);e.slice(-5)!=="Until"&&(r=n);r&&typeof r=="string"&&(i=w.filter(r,i));if(this.length>1){lt[e]||(i=w.unique(i));at.test(e)&&(i=i.reverse())}return this.pushStack(i)}});w.extend({filter:function(e,t,n){var r=t[0];n&&(e=":not("+e+")");return t.length===1&&r.nodeType===1?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return e.nodeType===1}))},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!w(s).is(r))){s.nodeType===1&&i.push(s);s=s[n]}return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var dt="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",vt=/ jQuery\d+="(?:null|\d+)"/g,mt=new RegExp("<(?:"+dt+")[\\s/>]","i"),gt=/^\s+/,yt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,wt=/<tbody/i,Et=/<|&#?\w+;/,St=/<(?:script|style|link)/i,xt=/^(?:checkbox|radio)$/i,Tt=/checked\s*(?:[^=]|=\s*.checked.)/i,Nt=/^$|\/(?:java|ecma)script/i,Ct=/^true\/(.*)/,kt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Lt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:w.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},At=pt(o),Ot=At.appendChild(o.createElement("div"));Lt.optgroup=Lt.option;Lt.tbody=Lt.tfoot=Lt.colgroup=Lt.caption=Lt.thead;Lt.th=Lt.td;w.fn.extend({text:function(e){return w.access(this,function(e){return e===t?w.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=Mt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=Mt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?w.filter(e,this):this,i=0;for(;(n=r[i])!=null;i++){!t&&n.nodeType===1&&w.cleanData(jt(n));if(n.parentNode){t&&w.contains(n.ownerDocument,n)&&Pt(jt(n,"script"));n.parentNode.removeChild(n)}}return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&w.cleanData(jt(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&w.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){e=e==null?!1:e;t=t==null?e:t;return this.map(function(){return w.clone(this,e,t)})},html:function(e){return w.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(vt,""):t;if(typeof e=="string"&&!St.test(e)&&(w.support.htmlSerialize||!mt.test(e))&&(w.support.leadingWhitespace||!gt.test(e))&&!Lt[(bt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(yt,"<$1></$2>");try{for(;r<i;r++){n=this[r]||{};if(n.nodeType===1){w.cleanData(jt(n,!1));n.innerHTML=e}}n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=w.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;this.domManip(arguments,function(n){var r=e[t++],i=e[t++];if(i){r&&r.parentNode!==i&&(r=this.nextSibling);w(this).remove();i.insertBefore(n,r)}},!0);return t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=p.apply([],e);var r,i,s,o,u,a,f=0,l=this.length,c=this,h=l-1,d=e[0],v=w.isFunction(d);if(v||!(l<=1||typeof d!="string"||w.support.checkClone||!Tt.test(d)))return this.each(function(r){var i=c.eq(r);v&&(e[0]=d.call(this,r,i.html()));i.domManip(e,t,n)});if(l){a=w.buildFragment(e,this[0].ownerDocument,!1,!n&&this);r=a.firstChild;a.childNodes.length===1&&(a=r);if(r){o=w.map(jt(a,"script"),_t);s=o.length;for(;f<l;f++){i=a;if(f!==h){i=w.clone(i,!0,!0);s&&w.merge(o,jt(i,"script"))}t.call(this[f],i,f)}if(s){u=o[o.length-1].ownerDocument;w.map(o,Dt);for(f=0;f<s;f++){i=o[f];Nt.test(i.type||"")&&!w._data(i,"globalEval")&&w.contains(u,i)&&(i.src?w._evalUrl(i.src):w.globalEval((i.text||i.textContent||i.innerHTML||"").replace(kt,"")))}}a=r=null}}return this}});w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){var n,r=0,i=[],s=w(e),o=s.length-1;for(;r<=o;r++){n=r===o?this:this.clone(!0);w(s[r])[t](n);d.apply(i,n.get())}return this.pushStack(i)}});w.extend({clone:function(e,t,n){var r,i,s,o,u,a=w.contains(e.ownerDocument,e);if(w.support.html5Clone||w.isXMLDoc(e)||!mt.test("<"+e.nodeName+">"))s=e.cloneNode(!0);else{Ot.innerHTML=e.outerHTML;Ot.removeChild(s=Ot.firstChild)}if((!w.support.noCloneEvent||!w.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!w.isXMLDoc(e)){r=jt(s);u=jt(e);for(o=0;(i=u[o])!=null;++o)r[o]&&Bt(i,r[o])}if(t)if(n){u=u||jt(e);r=r||jt(s);for(o=0;(i=u[o])!=null;o++)Ht(i,r[o])}else Ht(e,s);r=jt(s,"script");r.length>0&&Pt(r,!a&&jt(e,"script"));r=u=i=null;return s},buildFragment:function(e,t,n,r){var i,s,o,u,a,f,l,c=e.length,h=pt(t),p=[],d=0;for(;d<c;d++){s=e[d];if(s||s===0)if(w.type(s)==="object")w.merge(p,s.nodeType?[s]:s);else if(!Et.test(s))p.push(t.createTextNode(s));else{u=u||h.appendChild(t.createElement("div"));a=(bt.exec(s)||["",""])[1].toLowerCase();l=Lt[a]||Lt._default;u.innerHTML=l[1]+s.replace(yt,"<$1></$2>")+l[2];i=l[0];while(i--)u=u.lastChild;!w.support.leadingWhitespace&>.test(s)&&p.push(t.createTextNode(gt.exec(s)[0]));if(!w.support.tbody){s=a==="table"&&!wt.test(s)?u.firstChild:l[1]==="<table>"&&!wt.test(s)?u:0;i=s&&s.childNodes.length;while(i--)w.nodeName(f=s.childNodes[i],"tbody")&&!f.childNodes.length&&s.removeChild(f)}w.merge(p,u.childNodes);u.textContent="";while(u.firstChild)u.removeChild(u.firstChild);u=h.lastChild}}u&&h.removeChild(u);w.support.appendChecked||w.grep(jt(p,"input"),Ft);d=0;while(s=p[d++]){if(r&&w.inArray(s,r)!==-1)continue;o=w.contains(s.ownerDocument,s);u=jt(h.appendChild(s),"script");o&&Pt(u);if(n){i=0;while(s=u[i++])Nt.test(s.type||"")&&n.push(s)}}u=null;return h},cleanData:function(e,t){var n,r,s,o,u=0,a=w.expando,f=w.cache,l=w.support.deleteExpando,h=w.event.special;for(;(n=e[u])!=null;u++)if(t||w.acceptData(n)){s=n[a];o=s&&f[s];if(o){if(o.events)for(r in o.events)h[r]?w.event.remove(n,r):w.removeEvent(n,r,o.handle);if(f[s]){delete f[s];l?delete n[a]:typeof n.removeAttribute!==i?n.removeAttribute(a):n[a]=null;c.push(s)}}}},_evalUrl:function(e){return w.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}});w.fn.extend({wrapAll:function(e){if(w.isFunction(e))return this.each(function(t){w(this).wrapAll(e.call(this,t))});if(this[0]){var t=w(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]);t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return w.isFunction(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=w.isFunction(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){w.nodeName(this,"body")||w(this).replaceWith(this.childNodes)}).end()}});var It,qt,Rt,Ut=/alpha\([^)]*\)/i,zt=/opacity\s*=\s*([^)]*)/,Wt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Vt=/^margin/,$t=new RegExp("^("+E+")(.*)$","i"),Jt=new RegExp("^("+E+")(?!px)[a-z%]+$","i"),Kt=new RegExp("^([+-])=("+E+")","i"),Qt={BODY:"block"},Gt={position:"absolute",visibility:"hidden",display:"block"},Yt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];w.fn.extend({css:function(e,n){return w.access(this,function(e,n,r){var i,s,o={},u=0;if(w.isArray(n)){s=qt(e);i=n.length;for(;u<i;u++)o[n[u]]=w.css(e,n[u],!1,s);return o}return r!==t?w.style(e,n,r):w.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t=typeof e=="boolean";return this.each(function(){(t?e:nn(this))?w(this).show():w(this).hide()})}});w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Rt(e,"opacity");return n===""?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":w.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=w.camelCase(n),f=e.style;n=w.cssProps[a]||(w.cssProps[a]=tn(f,a));u=w.cssHooks[n]||w.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r;if(o==="string"&&(s=Kt.exec(r))){r=(s[1]+1)*s[2]+parseFloat(w.css(e,n));o="number"}if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!w.cssNumber[a]&&(r+="px");!w.support.clearCloneStyle&&r===""&&n.indexOf("background")===0&&(f[n]="inherit");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=w.camelCase(n);n=w.cssProps[a]||(w.cssProps[a]=tn(e.style,a));u=w.cssHooks[n]||w.cssHooks[a];u&&"get"in u&&(o=u.get(e,!0,r));o===t&&(o=Rt(e,n,i));o==="normal"&&n in Yt&&(o=Yt[n]);if(r===""||r){s=parseFloat(o);return r===!0||w.isNumeric(s)?s||0:o}return o}});if(e.getComputedStyle){qt=function(t){return e.getComputedStyle(t,null)};Rt=function(e,n,r){var i,s,o,u=r||qt(e),a=u?u.getPropertyValue(n)||u[n]:t,f=e.style;if(u){a===""&&!w.contains(e.ownerDocument,e)&&(a=w.style(e,n));if(Jt.test(a)&&Vt.test(n)){i=f.width;s=f.minWidth;o=f.maxWidth;f.minWidth=f.maxWidth=f.width=a;a=u.width;f.width=i;f.minWidth=s;f.maxWidth=o}}return a}}else if(o.documentElement.currentStyle){qt=function(e){return e.currentStyle};Rt=function(e,n,r){var i,s,o,u=r||qt(e),a=u?u[n]:t,f=e.style;a==null&&f&&f[n]&&(a=f[n]);if(Jt.test(a)&&!Wt.test(n)){i=f.left;s=e.runtimeStyle;o=s&&s.left;o&&(s.left=e.currentStyle.left);f.left=n==="fontSize"?"1em":a;a=f.pixelLeft+"px";f.left=i;o&&(s.left=o)}return a===""?"auto":a}}w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&Xt.test(w.css(e,"display"))?w.swap(e,Gt,function(){return un(e,t,r)}):un(e,t,r)},set:function(e,n,r){var i=r&&qt(e);return sn(e,n,r?on(e,t,r,w.support.boxSizing&&w.css(e,"boxSizing",!1,i)==="border-box",i):0)}}});w.support.opacity||(w.cssHooks.opacity={get:function(e,t){return zt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=w.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if((t>=1||t==="")&&w.trim(s.replace(Ut,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(t===""||r&&!r.filter)return}n.filter=Ut.test(s)?s.replace(Ut,i):s+" "+i}});w(function(){w.support.reliableMarginRight||(w.cssHooks.marginRight={get:function(e,t){if(t)return w.swap(e,{display:"inline-block"},Rt,[e,"marginRight"])}});!w.support.pixelPosition&&w.fn.position&&w.each(["top","left"],function(e,t){w.cssHooks[t]={get:function(e,n){if(n){n=Rt(e,t);return Jt.test(n)?w(e).position()[t]+"px":n}}}})});if(w.expr&&w.expr.filters){w.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0||!w.support.reliableHiddenOffsets&&(e.style&&e.style.display||w.css(e,"display"))==="none"};w.expr.filters.visible=function(e){return!w.expr.filters.hidden(e)}}w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){var r=0,i={},s=typeof n=="string"?n.split(" "):[n];for(;r<4;r++)i[e+Zt[r]+t]=s[r]||s[r-2]||s[0];return i}};Vt.test(e)||(w.cssHooks[e+t].set=sn)});var ln=/%20/g,cn=/\[\]$/,hn=/\r?\n/g,pn=/^(?:submit|button|image|reset|file)$/i,dn=/^(?:input|select|textarea|keygen)/i;w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&dn.test(this.nodeName)&&!pn.test(e)&&(this.checked||!xt.test(e))}).map(function(e,t){var n=w(this).val();return n==null?null:w.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(hn,"\r\n")}}):{name:t.name,value:n.replace(hn,"\r\n")}}).get()}});w.param=function(e,n){var r,i=[],s=function(e,t){t=w.isFunction(t)?t():t==null?"":t;i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=w.ajaxSettings&&w.ajaxSettings.traditional);if(w.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){s(this.name,this.value)});else for(r in e)vn(r,e[r],n,s);return i.join("&").replace(ln,"+")};w.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}});w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,gn,yn=w.now(),bn=/\?/,wn=/#.*$/,En=/([?&])_=[^&]*/,Sn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,xn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Tn=/^(?:GET|HEAD)$/,Nn=/^\/\//,Cn=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,kn=w.fn.load,Ln={},An={},On="*/".concat("*");try{gn=s.href}catch(Mn){gn=o.createElement("a");gn.href="";gn=gn.href}mn=Cn.exec(gn.toLowerCase())||[];w.fn.load=function(e,n,r){if(typeof e!="string"&&kn)return kn.apply(this,arguments);var i,s,o,u=this,a=e.indexOf(" ");if(a>=0){i=e.slice(a,e.length);e=e.slice(0,a)}if(w.isFunction(n)){r=n;n=t}else n&&typeof n=="object"&&(o="POST");u.length>0&&w.ajax({url:e,type:o,dataType:"html",data:n}).done(function(e){s=arguments;u.html(i?w("<div>").append(w.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){u.each(r,s||[e.responseText,t,e])});return this};w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}});w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:gn,type:"GET",isLocal:xn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":On,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":w.parseJSON,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Pn(Pn(e,w.ajaxSettings),t):Pn(w.ajaxSettings,e)},ajaxPrefilter:_n(Ln),ajaxTransport:_n(An),ajax:function(e,n){function N(e,n,r,i){var l,g,y,E,S,T=n;if(b===2)return;b=2;u&&clearTimeout(u);f=t;o=i||"";x.readyState=e>0?4:0;l=e>=200&&e<300||e===304;r&&(E=Hn(c,x,r));E=Bn(c,E,x,l);if(l){if(c.ifModified){S=x.getResponseHeader("Last-Modified");S&&(w.lastModified[s]=S);S=x.getResponseHeader("etag");S&&(w.etag[s]=S)}if(e===204||c.type==="HEAD")T="nocontent";else if(e===304)T="notmodified";else{T=E.state;g=E.data;y=E.error;l=!y}}else{y=T;if(e||!T){T="error";e<0&&(e=0)}}x.status=e;x.statusText=(n||T)+"";l?d.resolveWith(h,[g,T,x]):d.rejectWith(h,[x,T,y]);x.statusCode(m);m=t;a&&p.trigger(l?"ajaxSuccess":"ajaxError",[x,c,l?g:y]);v.fireWith(h,[x,T]);if(a){p.trigger("ajaxComplete",[x,c]);--w.active||w.event.trigger("ajaxStop")}}if(typeof e=="object"){n=e;e=t}n=n||{};var r,i,s,o,u,a,f,l,c=w.ajaxSetup({},n),h=c.context||c,p=c.context&&(h.nodeType||h.jquery)?w(h):w.event,d=w.Deferred(),v=w.Callbacks("once memory"),m=c.statusCode||{},g={},y={},b=0,E="canceled",x={readyState:0,getResponseHeader:function(e){var t;if(b===2){if(!l){l={};while(t=Sn.exec(o))l[t[1].toLowerCase()]=t[2]}t=l[e.toLowerCase()]}return t==null?null:t},getAllResponseHeaders:function(){return b===2?o:null},setRequestHeader:function(e,t){var n=e.toLowerCase();if(!b){e=y[n]=y[n]||e;g[e]=t}return this},overrideMimeType:function(e){b||(c.mimeType=e);return this},statusCode:function(e){var t;if(e)if(b<2)for(t in e)m[t]=[m[t],e[t]];else x.always(e[x.status]);return this},abort:function(e){var t=e||E;f&&f.abort(t);N(0,t);return this}};d.promise(x).complete=v.add;x.success=x.done;x.error=x.fail;c.url=((e||c.url||gn)+"").replace(wn,"").replace(Nn,mn[1]+"//");c.type=n.method||n.type||c.method||c.type;c.dataTypes=w.trim(c.dataType||"*").toLowerCase().match(S)||[""];if(c.crossDomain==null){r=Cn.exec(c.url.toLowerCase());c.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||(r[1]==="http:"?"80":"443"))===(mn[3]||(mn[1]==="http:"?"80":"443")))}c.data&&c.processData&&typeof c.data!="string"&&(c.data=w.param(c.data,c.traditional));Dn(Ln,c,n,x);if(b===2)return x;a=c.global;a&&w.active++===0&&w.event.trigger("ajaxStart");c.type=c.type.toUpperCase();c.hasContent=!Tn.test(c.type);s=c.url;if(!c.hasContent){if(c.data){s=c.url+=(bn.test(s)?"&":"?")+c.data;delete c.data}c.cache===!1&&(c.url=En.test(s)?s.replace(En,"$1_="+yn++):s+(bn.test(s)?"&":"?")+"_="+yn++)}if(c.ifModified){w.lastModified[s]&&x.setRequestHeader("If-Modified-Since",w.lastModified[s]);w.etag[s]&&x.setRequestHeader("If-None-Match",w.etag[s])}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType);x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+On+"; q=0.01":""):c.accepts["*"]);for(i in c.headers)x.setRequestHeader(i,c.headers[i]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&b!==2){E="abort";for(i in{success:1,error:1,complete:1})x[i](c[i]);f=Dn(An,c,n,x);if(!f)N(-1,"No Transport");else{x.readyState=1;a&&p.trigger("ajaxSend",[x,c]);c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{b=1;f.send(g,N)}catch(T){if(!(b<2))throw T;N(-1,T)}}return x}return x.abort()},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,n){return w.get(e,t,n,"script")}});w.each(["get","post"],function(e,n){w[n]=function(e,r,i,s){if(w.isFunction(r)){s=s||i;i=r;r=t}return w.ajax({url:e,type:n,dataType:s,data:r,success:i})}});w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){w.globalEval(e);return e}}});w.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1);if(e.crossDomain){e.type="GET";e.global=!1}});w.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||w("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script");n.async=!0;e.scriptCharset&&(n.charset=e.scriptCharset);n.src=e.url;n.onload=n.onreadystatechange=function(e,t){if(t||!n.readyState||/loaded|complete/.test(n.readyState)){n.onload=n.onreadystatechange=null;n.parentNode&&n.parentNode.removeChild(n);n=null;t||i(200,"success")}};r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var jn=[],Fn=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=jn.pop()||w.expando+"_"+yn++;this[e]=!0;return e}});w.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.jsonp!==!1&&(Fn.test(n.url)?"url":typeof n.data=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Fn.test(n.data)&&"data");if(a||n.dataTypes[0]==="jsonp"){s=n.jsonpCallback=w.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback;a?n[a]=n[a].replace(Fn,"$1"+s):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+s);n.converters["script json"]=function(){u||w.error(s+" was not called");return u[0]};n.dataTypes[0]="json";o=e[s];e[s]=function(){u=arguments};i.always(function(){e[s]=o;if(n[s]){n.jsonpCallback=r.jsonpCallback;jn.push(s)}u&&w.isFunction(o)&&o(u[0]);u=o=t});return"script"}});var In,qn,Rn=0,Un=e.ActiveXObject&&function(){var e;for(e in In)In[e](t,!0)};w.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&zn()||Wn()}:zn;qn=w.ajaxSettings.xhr();w.support.cors=!!qn&&"withCredentials"in qn;qn=w.support.ajax=!!qn;qn&&w.ajaxTransport(function(n){if(!n.crossDomain||w.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType);!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null);r=function(e,i){var u,f,l,c;try{if(r&&(i||a.readyState===4)){r=t;if(o){a.onreadystatechange=w.noop;Un&&delete In[o]}if(i)a.readyState!==4&&a.abort();else{c={};u=a.status;f=a.getAllResponseHeaders();typeof a.responseText=="string"&&(c.text=a.responseText);try{l=a.statusText}catch(h){l=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(p){i||s(-1,p)}c&&s(u,l,c,f)};if(!n.async)r();else if(a.readyState===4)setTimeout(r);else{o=++Rn;if(Un){if(!In){In={};w(e).unload(Un)}In[o]=r}a.onreadystatechange=r}},abort:function(){r&&r(t,!0)}}}});var Xn,Vn,$n=/^(?:toggle|show|hide)$/,Jn=new RegExp("^(?:([+-])=|)("+E+")([a-z%]*)$","i"),Kn=/queueHooks$/,Qn=[nr],Gn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Jn.exec(t),s=i&&i[3]||(w.cssNumber[e]?"":"px"),o=(w.cssNumber[e]||s!=="px"&&+r)&&Jn.exec(w.css(n.elem,e)),u=1,a=20;if(o&&o[3]!==s){s=s||o[3];i=i||[];o=+r||1;do{u=u||".5";o/=u;w.style(n.elem,e,o+s)}while(u!==(u=n.cur()/r)&&u!==1&&--a)}if(i){o=n.start=+o||+r||0;n.unit=s;n.end=i[1]?o+(i[1]+1)*i[2]:+i[2]}return n}]};w.Animation=w.extend(er,{tweener:function(e,t){if(w.isFunction(e)){t=e;e=["*"]}else e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++){n=e[r];Gn[n]=Gn[n]||[];Gn[n].unshift(t)}},prefilter:function(e,t){t?Qn.unshift(e):Qn.push(e)}});w.Tween=rr;rr.prototype={constructor:rr,init:function(e,t,n,r,i,s){this.elem=e;this.prop=n;this.easing=i||"swing";this.options=t;this.start=this.now=this.cur();this.end=r;this.unit=s||(w.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e;this.now=(this.end-this.start)*t+this.start;this.options.step&&this.options.step.call(this.elem,this.now,this);n&&n.set?n.set(this):rr.propHooks._default.set(this);return this}};rr.prototype.init.prototype=rr.prototype;rr.propHooks={_default:{get:function(e){var t;if(e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null){t=w.css(e.elem,e.prop,"");return!t||t==="auto"?0:t}return e.elem[e.prop]},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):e.elem.style&&(e.elem.style[w.cssProps[e.prop]]!=null||w.cssHooks[e.prop])?w.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}};rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}};w.each(["toggle","show","hide"],function(e,t){var n=w.fn[t];w.fn[t]=function(e,r,i){return e==null||typeof e=="boolean"?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}});w.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=w.isEmptyObject(e),s=w.speed(t,n,r),o=function(){var t=er(this,w.extend({},e),s);(i||w._data(this,"finish"))&&t.stop(!0)};o.finish=o;return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop;t(r)};if(typeof e!="string"){r=n;n=e;e=t}n&&e!==!1&&this.queue(e||"fx",[]);return this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=w.timers,o=w._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Kn.test(n)&&i(o[n]);for(n=s.length;n--;)if(s[n].elem===this&&(e==null||s[n].queue===e)){s[n].anim.stop(r);t=!1;s.splice(n,1)}(t||!r)&&w.dequeue(this,e)})},finish:function(e){e!==!1&&(e=e||"fx");return this.each(function(){var t,n=w._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],s=w.timers,o=r?r.length:0;n.finish=!0;w.queue(this,e,[]);i&&i.stop&&i.stop.call(this,!0);for(t=s.length;t--;)if(s[t].elem===this&&s[t].queue===e){s[t].anim.stop(!0);s.splice(t,1)}for(t=0;t<o;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});w.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){w.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}});w.speed=function(e,t,n){var r=e&&typeof e=="object"?w.extend({},e):{complete:n||!n&&t||w.isFunction(e)&&e,duration:e,easing:n&&t||t&&!w.isFunction(t)&&t};r.duration=w.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in w.fx.speeds?w.fx.speeds[r.duration]:w.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";r.old=r.complete;r.complete=function(){w.isFunction(r.old)&&r.old.call(this);r.queue&&w.dequeue(this,r.queue)};return r};w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}};w.timers=[];w.fx=rr.prototype.init;w.fx.tick=function(){var e,n=w.timers,r=0;Xn=w.now();for(;r<n.length;r++){e=n[r];!e()&&n[r]===e&&n.splice(r--,1)}n.length||w.fx.stop();Xn=t};w.fx.timer=function(e){e()&&w.timers.push(e)&&w.fx.start()};w.fx.interval=13;w.fx.start=function(){Vn||(Vn=setInterval(w.fx.tick,w.fx.interval))};w.fx.stop=function(){clearInterval(Vn);Vn=null};w.fx.speeds={slow:600,fast:200,_default:400};w.fx.step={};w.expr&&w.expr.filters&&(w.expr.filters.animated=function(e){return w.grep(w.timers,function(t){return e===t.elem}).length});w.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){w.offset.setOffset(this,e,t)});var n,r,s={top:0,left:0},o=this[0],u=o&&o.ownerDocument;if(!u)return;n=u.documentElement;if(!w.contains(n,o))return s;typeof o.getBoundingClientRect!==i&&(s=o.getBoundingClientRect());r=sr(u);return{top:s.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:s.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}};w.offset={setOffset:function(e,t,n){var r=w.css(e,"position");r==="static"&&(e.style.position="relative");var i=w(e),s=i.offset(),o=w.css(e,"top"),u=w.css(e,"left"),a=(r==="absolute"||r==="fixed")&&w.inArray("auto",[o,u])>-1,f={},l={},c,h;if(a){l=i.position();c=l.top;h=l.left}else{c=parseFloat(o)||0;h=parseFloat(u)||0}w.isFunction(t)&&(t=t.call(e,n,s));t.top!=null&&(f.top=t.top-s.top+c);t.left!=null&&(f.left=t.left-s.left+h);"using"in t?t.using.call(e,f):i.css(f)}};w.fn.extend({position:function(){if(!this[0])return;var e,t,n={top:0,left:0},r=this[0];if(w.css(r,"position")==="fixed")t=r.getBoundingClientRect();else{e=this.offsetParent();t=this.offset();w.nodeName(e[0],"html")||(n=e.offset());n.top+=w.css(e[0],"borderTopWidth",!0);n.left+=w.css(e[0],"borderLeftWidth",!0)}return{top:t.top-n.top-w.css(r,"marginTop",!0),left:t.left-n.left-w.css(r,"marginLeft",!0)}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||u;while(e&&!w.nodeName(e,"html")&&w.css(e,"position")==="static")e=e.offsetParent;return e||u})}});w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);w.fn[e]=function(i){return w.access(this,function(e,i,s){var o=sr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?w(o).scrollLeft():s,r?s:w(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}});w.each({Height:"height",Width:"width"},function(e,n){w.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){w.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return w.access(this,function(n,r,i){var s;if(w.isWindow(n))return n.document.documentElement["client"+e];if(n.nodeType===9){s=n.documentElement;return Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])}return i===t?w.css(n,r,u):w.style(n,r,i,u)},n,o?i:t,o,null)}})});w.fn.size=function(){return this.length};w.fn.andSelf=w.fn.addBack;if(typeof module=="object"&&module&&typeof module.exports=="object")module.exports=w;else{e.jQuery=e.$=w;typeof define=="function"&&define.amd&&define("jquery",[],function(){return w})}})(window);(function(e,t){"use strict";function n(){if(!r.READY){r.event.determineEventTypes();for(var e in r.gestures)r.gestures.hasOwnProperty(e)&&r.detection.register(r.gestures[e]);r.event.onTouch(r.DOCUMENT,r.EVENT_MOVE,r.detection.detect),r.event.onTouch(r.DOCUMENT,r.EVENT_END,r.detection.detect),r.READY=!0}}var r=function(e,t){return new r.Instance(e,t||{})};r.defaults={stop_browser_behavior:{userSelect:"none",touchAction:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},r.HAS_POINTEREVENTS=e.navigator.pointerEnabled||e.navigator.msPointerEnabled,r.HAS_TOUCHEVENTS="ontouchstart"in e,r.MOBILE_REGEX=/mobile|tablet|ip(ad|hone|od)|android|silk/i,r.NO_MOUSEEVENTS=r.HAS_TOUCHEVENTS&&e.navigator.userAgent.match(r.MOBILE_REGEX),r.EVENT_TYPES={},r.DIRECTION_DOWN="down",r.DIRECTION_LEFT="left",r.DIRECTION_UP="up",r.DIRECTION_RIGHT="right",r.POINTER_MOUSE="mouse",r.POINTER_TOUCH="touch",r.POINTER_PEN="pen",r.EVENT_START="start",r.EVENT_MOVE="move",r.EVENT_END="end",r.DOCUMENT=e.document,r.plugins={},r.READY=!1,r.Instance=function(e,t){var i=this;return n(),this.element=e,this.enabled=!0,this.options=r.utils.extend(r.utils.extend({},r.defaults),t||{}),this.options.stop_browser_behavior&&r.utils.stopDefaultBrowserBehavior(this.element,this.options.stop_browser_behavior),r.event.onTouch(e,r.EVENT_START,function(e){i.enabled&&r.detection.startDetect(i,e)}),this},r.Instance.prototype={on:function(e,t
){for(var n=e.split(" "),r=0;n.length>r;r++)this.element.addEventListener(n[r],t,!1);return this},off:function(e,t){for(var n=e.split(" "),r=0;n.length>r;r++)this.element.removeEventListener(n[r],t,!1);return this},trigger:function(e,t){t||(t={});var n=r.DOCUMENT.createEvent("Event");n.initEvent(e,!0,!0),n.gesture=t;var i=this.element;return r.utils.hasParent(t.target,i)&&(i=t.target),i.dispatchEvent(n),this},enable:function(e){return this.enabled=e,this}};var i=null,s=!1,o=!1;r.event={bindDom:function(e,t,n){for(var r=t.split(" "),i=0;r.length>i;i++)e.addEventListener(r[i],n,!1)},onTouch:function(e,t,n){var u=this;this.bindDom(e,r.EVENT_TYPES[t],function(f){var l=f.type.toLowerCase();if(!l.match(/mouse/)||!o){l.match(/touch/)||l.match(/pointerdown/)||l.match(/mouse/)&&1===f.which?s=!0:l.match(/mouse/)&&1!==f.which&&(s=!1),l.match(/touch|pointer/)&&(o=!0);var c=0;s&&(r.HAS_POINTEREVENTS&&t!=r.EVENT_END?c=r.PointerEvent.updatePointer(t,f):l.match(/touch/)?c=f.touches.length:o||(c=l.match(/up/)?0:1),c>0&&t==r.EVENT_END?t=r.EVENT_MOVE:c||(t=r.EVENT_END),(c||null===i)&&(i=f),n.call(r.detection,u.collectEventData(e,t,u.getTouchList(i,t),f)),r.HAS_POINTEREVENTS&&t==r.EVENT_END&&(c=r.PointerEvent.updatePointer(t,f))),c||(i=null,s=!1,o=!1,r.PointerEvent.reset())}})},determineEventTypes:function(){var e;e=r.HAS_POINTEREVENTS?r.PointerEvent.getEvents():r.NO_MOUSEEVENTS?["touchstart","touchmove","touchend touchcancel"]:["touchstart mousedown","touchmove mousemove","touchend touchcancel mouseup"],r.EVENT_TYPES[r.EVENT_START]=e[0],r.EVENT_TYPES[r.EVENT_MOVE]=e[1],r.EVENT_TYPES[r.EVENT_END]=e[2]},getTouchList:function(e){return r.HAS_POINTEREVENTS?r.PointerEvent.getTouchList():e.touches?e.touches:(e.indentifier=1,[e])},collectEventData:function(e,t,n,i){var s=r.POINTER_TOUCH;return(i.type.match(/mouse/)||r.PointerEvent.matchType(r.POINTER_MOUSE,i))&&(s=r.POINTER_MOUSE),{center:r.utils.getCenter(n),timeStamp:(new Date).getTime(),target:i.target,touches:n,eventType:t,pointerType:s,srcEvent:i,preventDefault:function(){this.srcEvent.preventManipulation&&this.srcEvent.preventManipulation(),this.srcEvent.preventDefault&&this.srcEvent.preventDefault()},stopPropagation:function(){this.srcEvent.stopPropagation()},stopDetect:function(){return r.detection.stopDetect()}}}},r.PointerEvent={pointers:{},getTouchList:function(){var e=this,t=[];return Object.keys(e.pointers).sort().forEach(function(n){t.push(e.pointers[n])}),t},updatePointer:function(e,t){return e==r.EVENT_END?this.pointers={}:(t.identifier=t.pointerId,this.pointers[t.pointerId]=t),Object.keys(this.pointers).length},matchType:function(e,t){if(!t.pointerType)return!1;var n={};return n[r.POINTER_MOUSE]=t.pointerType==t.MSPOINTER_TYPE_MOUSE||t.pointerType==r.POINTER_MOUSE,n[r.POINTER_TOUCH]=t.pointerType==t.MSPOINTER_TYPE_TOUCH||t.pointerType==r.POINTER_TOUCH,n[r.POINTER_PEN]=t.pointerType==t.MSPOINTER_TYPE_PEN||t.pointerType==r.POINTER_PEN,n[e]},getEvents:function(){return["pointerdown MSPointerDown","pointermove MSPointerMove","pointerup pointercancel MSPointerUp MSPointerCancel"]},reset:function(){this.pointers={}}},r.utils={extend:function(e,n,r){for(var i in n)e[i]!==t&&r||(e[i]=n[i]);return e},hasParent:function(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1},getCenter:function(e){for(var t=[],n=[],r=0,i=e.length;i>r;r++)t.push(e[r].pageX),n.push(e[r].pageY);return{pageX:(Math.min.apply(Math,t)+Math.max.apply(Math,t))/2,pageY:(Math.min.apply(Math,n)+Math.max.apply(Math,n))/2}},getVelocity:function(e,t,n){return{x:Math.abs(t/e)||0,y:Math.abs(n/e)||0}},getAngle:function(e,t){var n=t.pageY-e.pageY,r=t.pageX-e.pageX;return 180*Math.atan2(n,r)/Math.PI},getDirection:function(e,t){var n=Math.abs(e.pageX-t.pageX),i=Math.abs(e.pageY-t.pageY);return n>=i?e.pageX-t.pageX>0?r.DIRECTION_LEFT:r.DIRECTION_RIGHT:e.pageY-t.pageY>0?r.DIRECTION_UP:r.DIRECTION_DOWN},getDistance:function(e,t){var n=t.pageX-e.pageX,r=t.pageY-e.pageY;return Math.sqrt(n*n+r*r)},getScale:function(e,t){return e.length>=2&&t.length>=2?this.getDistance(t[0],t[1])/this.getDistance(e[0],e[1]):1},getRotation:function(e,t){return e.length>=2&&t.length>=2?this.getAngle(t[1],t[0])-this.getAngle(e[1],e[0]):0},isVertical:function(e){return e==r.DIRECTION_UP||e==r.DIRECTION_DOWN},stopDefaultBrowserBehavior:function(e,t){var n,r=["webkit","khtml","moz","Moz","ms","o",""];if(t&&e.style){for(var i=0;r.length>i;i++)for(var s in t)t.hasOwnProperty(s)&&(n=s,r[i]&&(n=r[i]+n.substring(0,1).toUpperCase()+n.substring(1)),e.style[n]=t[s]);"none"==t.userSelect&&(e.onselectstart=function(){return!1}),"none"==t.userDrag&&(e.ondragstart=function(){return!1})}}},r.detection={gestures:[],current:null,previous:null,stopped:!1,startDetect:function(e,t){this.current||(this.stopped=!1,this.current={inst:e,startEvent:r.utils.extend({},t),lastEvent:!1,name:""},this.detect(t))},detect:function(e){if(this.current&&!this.stopped){e=this.extendEventData(e);for(var t=this.current.inst.options,n=0,i=this.gestures.length;i>n;n++){var s=this.gestures[n];if(!this.stopped&&t[s.name]!==!1&&s.handler.call(s,e,this.current.inst)===!1){this.stopDetect();break}}return this.current&&(this.current.lastEvent=e),e.eventType==r.EVENT_END&&!e.touches.length-1&&this.stopDetect(),e}},stopDetect:function(){this.previous=r.utils.extend({},this.current),this.current=null,this.stopped=!0},extendEventData:function(e){var t=this.current.startEvent;if(t&&(e.touches.length!=t.touches.length||e.touches===t.touches)){t.touches=[];for(var n=0,i=e.touches.length;i>n;n++)t.touches.push(r.utils.extend({},e.touches[n]))}var s=e.timeStamp-t.timeStamp,o=e.center.pageX-t.center.pageX,u=e.center.pageY-t.center.pageY,a=r.utils.getVelocity(s,o,u);return r.utils.extend(e,{deltaTime:s,deltaX:o,deltaY:u,velocityX:a.x,velocityY:a.y,distance:r.utils.getDistance(t.center,e.center),angle:r.utils.getAngle(t.center,e.center),interimAngle:this.current.lastEvent&&r.utils.getAngle(this.current.lastEvent.center,e.center),direction:r.utils.getDirection(t.center,e.center),interimDirection:this.current.lastEvent&&r.utils.getDirection(this.current.lastEvent.center,e.center),scale:r.utils.getScale(t.touches,e.touches),rotation:r.utils.getRotation(t.touches,e.touches),startEvent:t}),e},register:function(e){var n=e.defaults||{};return n[e.name]===t&&(n[e.name]=!0),r.utils.extend(r.defaults,n,!0),e.index=e.index||1e3,this.gestures.push(e),this.gestures.sort(function(e,t){return e.index<t.index?-1:e.index>t.index?1:0}),this.gestures}},r.gestures=r.gestures||{},r.gestures.Hold={name:"hold",index:10,defaults:{hold_timeout:500,hold_threshold:1},timer:null,handler:function(e,t){switch(e.eventType){case r.EVENT_START:clearTimeout(this.timer),r.detection.current.name=this.name,this.timer=setTimeout(function(){"hold"==r.detection.current.name&&t.trigger("hold",e)},t.options.hold_timeout);break;case r.EVENT_MOVE:e.distance>t.options.hold_threshold&&clearTimeout(this.timer);break;case r.EVENT_END:clearTimeout(this.timer)}}},r.gestures.Tap={name:"tap",index:100,defaults:{tap_max_touchtime:250,tap_max_distance:10,tap_always:!0,doubletap_distance:20,doubletap_interval:300},handler:function(e,t){if(e.eventType==r.EVENT_END&&"touchcancel"!=e.srcEvent.type){var n=r.detection.previous,i=!1;if(e.deltaTime>t.options.tap_max_touchtime||e.distance>t.options.tap_max_distance)return;n&&"tap"==n.name&&e.timeStamp-n.lastEvent.timeStamp<t.options.doubletap_interval&&e.distance<t.options.doubletap_distance&&(t.trigger("doubletap",e),i=!0),(!i||t.options.tap_always)&&(r.detection.current.name="tap",t.trigger(r.detection.current.name,e))}}},r.gestures.Swipe={name:"swipe",index:40,defaults:{swipe_max_touches:1,swipe_velocity:.7},handler:function(e,t){if(e.eventType==r.EVENT_END){if(t.options.swipe_max_touches>0&&e.touches.length>t.options.swipe_max_touches)return;(e.velocityX>t.options.swipe_velocity||e.velocityY>t.options.swipe_velocity)&&(t.trigger(this.name,e),t.trigger(this.name+e.direction,e))}}},r.gestures.Drag={name:"drag",index:50,defaults:{drag_min_distance:10,correct_for_drag_min_distance:!0,drag_max_touches:1,drag_block_horizontal:!1,drag_block_vertical:!1,drag_lock_to_axis:!1,drag_lock_min_distance:25},triggered:!1,handler:function(e,n){if(r.detection.current.name!=this.name&&this.triggered)return n.trigger(this.name+"end",e),this.triggered=!1,t;if(!(n.options.drag_max_touches>0&&e.touches.length>n.options.drag_max_touches))switch(e.eventType){case r.EVENT_START:this.triggered=!1;break;case r.EVENT_MOVE:if(e.distance<n.options.drag_min_distance&&r.detection.current.name!=this.name)return;if(r.detection.current.name!=this.name&&(r.detection.current.name=this.name,n.options.correct_for_drag_min_distance)){var i=Math.abs(n.options.drag_min_distance/e.distance);r.detection.current.startEvent.center.pageX+=e.deltaX*i,r.detection.current.startEvent.center.pageY+=e.deltaY*i,e=r.detection.extendEventData(e)}(r.detection.current.lastEvent.drag_locked_to_axis||n.options.drag_lock_to_axis&&n.options.drag_lock_min_distance<=e.distance)&&(e.drag_locked_to_axis=!0);var s=r.detection.current.lastEvent.direction;e.drag_locked_to_axis&&s!==e.direction&&(e.direction=r.utils.isVertical(s)?0>e.deltaY?r.DIRECTION_UP:r.DIRECTION_DOWN:0>e.deltaX?r.DIRECTION_LEFT:r.DIRECTION_RIGHT),this.triggered||(n.trigger(this.name+"start",e),this.triggered=!0),n.trigger(this.name,e),n.trigger(this.name+e.direction,e),(n.options.drag_block_vertical&&r.utils.isVertical(e.direction)||n.options.drag_block_horizontal&&!r.utils.isVertical(e.direction))&&e.preventDefault();break;case r.EVENT_END:this.triggered&&n.trigger(this.name+"end",e),this.triggered=!1}}},r.gestures.Transform={name:"transform",index:45,defaults:{transform_min_scale:.01,transform_min_rotation:1,transform_always_block:!1},triggered:!1,handler:function(e,n){if(r.detection.current.name!=this.name&&this.triggered)return n.trigger(this.name+"end",e),this.triggered=!1,t;if(!(2>e.touches.length))switch(n.options.transform_always_block&&e.preventDefault(),e.eventType){case r.EVENT_START:this.triggered=!1;break;case r.EVENT_MOVE:var i=Math.abs(1-e.scale),s=Math.abs(e.rotation);if(n.options.transform_min_scale>i&&n.options.transform_min_rotation>s)return;r.detection.current.name=this.name,this.triggered||(n.trigger(this.name+"start",e),this.triggered=!0),n.trigger(this.name,e),s>n.options.transform_min_rotation&&n.trigger("rotate",e),i>n.options.transform_min_scale&&(n.trigger("pinch",e),n.trigger("pinch"+(1>e.scale?"in":"out"),e));break;case r.EVENT_END:this.triggered&&n.trigger(this.name+"end",e),this.triggered=!1}}},r.gestures.Touch={name:"touch",index:-1/0,defaults:{prevent_default:!1,prevent_mouseevents:!1},handler:function(e,n){return n.options.prevent_mouseevents&&e.pointerType==r.POINTER_MOUSE?(e.stopDetect(),t):(n.options.prevent_default&&e.preventDefault(),e.eventType==r.EVENT_START&&n.trigger(this.name,e),t)}},r.gestures.Release={name:"release",index:1/0,handler:function(e,t){e.eventType==r.EVENT_END&&t.trigger(this.name,e)}},"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return r}):"object"==typeof module&&"object"==typeof module.exports?module.exports=r:e.Hammer=r})(this),function(e){"use strict";var t=function(t,n){return n===e?t:(t.event.bindDom=function(t,r,i){n(t).on(r,function(t){var n=t.originalEvent||t;n.pageX===e&&(n.pageX=t.pageX,n.pageY=t.pageY),n.target||(n.target=t.target),n.which===e&&(n.which=n.button),n.preventDefault||(n.preventDefault=t.preventDefault),n.stopPropagation||(n.stopPropagation=t.stopPropagation),i.call(this,n)})},t.Instance.prototype.on=function(e,t){return n(this.element).on(e,t)},t.Instance.prototype.off=function(e,t){return n(this.element).off(e,t)},t.Instance.prototype.trigger=function(e,t){var r=n(this.element);return r.has(t.target).length&&(r=n(t.target)),r.trigger({type:e,gesture:t})},n.fn.hammer=function(e){return this.each(function(){var r=n(this),i=r.data("hammer");i?i&&e&&t.utils.extend(i.options,e):r.data("hammer",new t(this,e||{}))})},t)};"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("hammer-jquery",["hammer","jquery"],t):t(window.Hammer,window.jQuery||window.Zepto)}();$.fn.extend({stickit:function(e){function d(){p=!0;o.addClass("collapsed");l===0&&(l=Math.min(a.offset().top,u.outerHeight()));c=f-u.outerHeight()}function v(){p=!1;o.removeClass("collapsed");c=f-u.outerHeight()}function m(){i=getYOffset();n.collapseHeader&&!n.user_collapse_pref&&(p===!1&&i>f*.3?d():p===!0&&i<f*.3&&v());(i===0||i>f)&&t.each(function(){this.stickPoint=c+this.topPos;if(s.width()>=980){r=g(this);y(this,i,r)}i<this.stickPoint&&$(this).css("position","static")})}function g(e){return{lowerLimit:h.position().top-$(e).outerHeight(!0)-20,upperLimit:c-u.outerHeight()}}function y(e,t,n){$this=$(e);n.lowerLimit<t+u.outerHeight()?$this.css({top:-t+n.lowerLimit}):$this.css({position:"fixed",top:n.upperLimit,width:$this.parent().width()})}var t=$(this);if(!t)return;var n=$.extend({stickHeader:!0,collapseHeader:!0,header:"#masthead",footer:"#footer",user_collapse_pref:!0},e),r,i,s=$(window),o=$("body"),u=$(n.header),a=u.next(),f=Math.max(a.offset().top,u.outerHeight()),l=0,c=0,h=$(n.footer);if(n.stickHeader){u.css("position","fixed");o.css("padding-top",f)}if(n.collapseHeader){var p=o.hasClass("collapsed");o.css("min-height",s.height());(p||n.user_collapse_pref)&&d();u.find("#menu-trigger").on("click",function(e){if(p===!0){window.scrollTo(0,0);v()}else d();e.preventDefault()})}t.each(function(){this.parent=$(this).parent();this.parent.css("position","relative");this.topPos=$(this).position().top});s.bind({scroll:m,resize:m})}});(function(e,t,n){"use strict";function i(t,n){this.$slider=e(t).addClass("rs-slider");this.settings=e.extend({},r,n);this.$slides=this.$slider.find("> *");this.totalSlides=this.$slides.length;this.cssTransitions=o.cssTransitions();this.cssTransforms3d=o.cssTransforms3d();this.currentPlace=this.settings.startSlide;this.$currentSlide=this.$slides.eq(this.currentPlace);this.inProgress=!1;this.$sliderWrap=this.$slider.wrap('<div class="rs-wrap" />').parent();this.$sliderBG=this.$slider.wrap('<div class="rs-slide-bg" />').parent();this.settings.slider=this;this.$currentIndexWrapper=e(".rs-current-index");this.init()}function s(t,n,r){this.RS=t;this.RS.inProgress=!0;this.forward=r;this.transition=n;if(this.transition==="custom"){this.customAnims=this.RS.settings.customTransitions;this.isCustomTransition=!0}if(this.transition==="custom"){var i=this;e.each(this.customAnims,function(t,n){e.inArray(n,i.anims)===-1&&i.customAnims.splice(t,1)})}this.fallback3d=this.RS.settings.fallback3d;this.init()}var r={maxWidth:800,transition:"cubeV",customTransitions:[],fallback3d:"sliceV",perspective:1e3,useThumbs:!0,useArrows:!1,thumbMargin:3,autoPlay:!1,delay:5e3,transitionDuration:800,startSlide:0,keyNav:!0,captionWidth:50,controlsTemplate:'<div class="rs-controls"><button class="rs-prev" title="Previous">◅</button><button class="rs-next" title="Next">▻</button><span class="rs-counter"><span class="rs-current-index"></span> of <span class="rs-count"></span></span><button class="fullscreen-toggle" title="full-screen">⤄</button></div>',onInit:function(){},onChange:function(){},afterChange:function(){}};i.prototype={cycling:null,$slideImages:null,init:function(){this.settings.onInit();this.captions();this.settings.transition==="custom"&&(this.nextAnimIndex=-1);this.settings.keyNav&&this.setKeys();for(var t=0;t<this.totalSlides;t++)this.$slides.eq(t).addClass("rs-slide-"+t);if(this.settings.autoPlay){this.setAutoPlay();this.$slider.on({mouseenter:e.proxy(function(){this.cycling!==null&&clearTimeout(this.cycling)},this),mouseleave:e.proxy(this.setAutoPlay,this)})}this.$slideImages=this.$slides.find("img:eq(0)");this.setup()},setup:function(){this.settings.useThumbs&&this.setThumbs();this.settings.useArrows&&this.setArrows();e(".rs-current-index").html(this.settings.startSlide+1);e(".rs-count").html(this.totalSlides);this.$currentSlide.css({opacity:1,"z-index":2})},setArrows:function(){var t=this;this.$sliderWrap.prepend(this.settings.controlsTemplate);e(".rs-next",this.$sliderWrap).on("click",function(e){e.preventDefault();t.next()});e(".rs-prev",this.$sliderWrap).on("click",function(e){e.preventDefault();t.prev()})},next:function(){this.settings.transition==="custom"&&this.nextAnimIndex++;this.currentPlace===this.totalSlides-1?this.transition(0,!0):this.transition(this.currentPlace+1,!0)},prev:function(){this.settings.transition==="custom"&&this.nextAnimIndex--;this.currentPlace===0?this.transition(this.totalSlides-1,!1):this.transition(this.currentPlace-1,!1)},setKeys:function(){var t=this;e(n).on("keydown",function(e){e.keyCode===39?t.next():e.keyCode===37&&t.prev()})},setAutoPlay:function(){var e=this;this.cycling=setTimeout(function(){e.next()},this.settings.delay)},setThumbs:function(){var t=this,n=(100-this.totalSlides*this.settings.thumbMargin)/this.totalSlides+"%";this.$thumbWrap=e('<div class="rs-thumb-wrap" />').prependTo(this.$sliderWrap);for(var r=0;r<this.totalSlides;r++){var i=e("<a />").css({width:n,marginLeft:this.settings.thumbMargin+"%"}).attr("href","#").data("rs-num",r);this.$thumbWrap.append(i)}this.$thumbWrapLinks=this.$thumbWrap.find("a");this.$slides.each(function(t){var n=e(".rs-thumb-wrap a").eq(t),r=e(this),i=r.find("img");i.length>0?n.html(i.clone()):n.html("<span>"+r.data("slide-type")+"</span>").attr("data-slide-type",r.data("slide-type"))});this.$thumbWrapLinks.eq(this.settings.startSlide).addClass("active");this.$thumbWrap.on("click","a",function(n){n.preventDefault();t.transition(parseInt(e(this).data("rs-num"),10))})},captions:function(){var t=this,n=this.$slides.find(".rs-caption");n.css({width:t.settings.captionWidth+"%",opacity:0});this.$currentSlide.find(".rs-caption").css("opacity",1);n.each(function(){e(this).css({transition:"opacity "+t.settings.transitionDuration+"ms linear",backfaceVisibility:"hidden"})})},transition:function(t,n){if(!this.inProgress&&t!==this.currentPlace){typeof n=="undefined"&&(n=t>this.currentPlace?!0:!1);if(this.settings.useThumbs){this.$thumbWrapLinks.eq(this.currentPlace).removeClass("active");this.$thumbWrapLinks.eq(t).addClass("active")}this.$nextSlide=this.$slides.eq(t);this.currentPlace=t;e(".rs-current-index").html(this.currentPlace+1);this.settings.onChange();new s(this,this.settings.transition,n)}}};s.prototype={fallback:"fade",anims:["cubeH","cubeV","fade","sliceH","sliceV","slideH","slideV","scale","blockScale","kaleidoscope","fan","blindH","blindV"],customAnims:[],init:function(){this[this.transition]()},before:function(t){var n=this;this.RS.$currentSlide.css("z-index",2);this.RS.$nextSlide.css({opacity:1,"z-index":1});if(this.RS.cssTransitions){this.RS.$currentSlide.find(".rs-caption").css("opacity",0);this.RS.$nextSlide.find(".rs-caption").css("opacity",1)}else{this.RS.$currentSlide.find(".rs-caption").animate({opacity:0},n.RS.settings.transitionDuration);this.RS.$nextSlide.find(".rs-caption").animate({opacity:1},n.RS.settings.transitionDuration)}if(typeof this.setup=="function"){var r=this.setup();setTimeout(function(){t(r)},20)}else this.execute();this.RS.cssTransitions&&e(this.listenTo).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",e.proxy(this.after,this))},after:function(){this.RS.$sliderBG.removeAttr("style");this.RS.$slider.removeAttr("style");this.RS.$currentSlide.removeAttr("style");this.RS.$nextSlide.removeAttr("style");this.RS.$currentSlide.css({zIndex:1,opacity:0});this.RS.$nextSlide.css({zIndex:2,opacity:1});typeof this.reset=="function"&&this.reset();if(this.RS.settings.autoPlay){clearTimeout(this.RS.cycling);this.RS.setAutoPlay()}this.RS.$currentSlide=this.RS.$nextSlide;this.RS.inProgress=!1;this.RS.settings.afterChange()},fade:function(){var t=this;if(this.RS.cssTransitions){this.setup=function(){t.listenTo=t.RS.$currentSlide;t.RS.$currentSlide.css("transition","opacity "+t.RS.settings.transitionDuration+"ms linear")};this.execute=function(){t.RS.$currentSlide.css("opacity",0)}}else this.execute=function(){t.RS.$currentSlide.animate({opacity:0},t.RS.settings.transitionDuration,function(){t.after()})};this.before(e.proxy(this.execute,this))},cube:function(t,n,r,i,s,o,u){if(!this.RS.cssTransitions||!this.RS.cssTransforms3d)return this[this.fallback3d]();var a=this;this.setup=function(){a.listenTo=a.RS.$slider;this.RS.$sliderBG.css("perspective",1e3);a.RS.$currentSlide.css({transform:"translateZ("+t+"px)",backfaceVisibility:"hidden"});a.RS.$nextSlide.css({opacity:1,backfaceVisibility:"hidden",transform:"translateY("+r+"px) translateX("+n+"px) rotateY("+s+"deg) rotateX("+i+"deg)"});a.RS.$slider.css({transform:"translateZ(-"+t+"px)",transformStyle:"preserve-3d"})};this.execute=function(){a.RS.$slider.css({transition:"all "+a.RS.settings.transitionDuration+"ms ease-in-out",transform:"translateZ(-"+t+"px) rotateX("+o+"deg) rotateY("+u+"deg)"})};this.before(e.proxy(this.execute,this))},cubeH:function(){var t=e(this.RS.$slides).width()/2;this.forward?this.cube(t,t,0,0,90,0,-90):this.cube(t,-t,0,0,-90,0,90)},cubeV:function(){var t=e(this.RS.$slides).height()/2;this.forward?this.cube(t,0,-t,90,0,-90,0):this.cube(t,0,t,-90,0,90,0)},grid:function(t,n,r,i,s,o,u){if(!this.RS.cssTransitions)return this[this.fallback]();var a=this;this.setup=function(){function o(t,n,i,s,o,u,f,l,c){var h=(l+c)*r;return e('<div class="rs-gridlet" />').css({width:t,height:n,top:i,left:s,backgroundImage:"url("+o+")",backgroundPosition:"-"+s+"px -"+i+"px",backgroundSize:u+"px "+f+"px",transition:"all "+a.RS.settings.transitionDuration+"ms ease-in-out "+h+"ms",transform:"none"})}var r=a.RS.settings.transitionDuration/(t+n);a.$img=a.RS.$currentSlide.find("img.rs-slide-image");a.$grid=e("<div />").addClass("rs-grid");a.RS.$currentSlide.prepend(a.$grid);var u=a.$img.width(),f=a.$img.height(),l=a.$img.attr("src"),c=Math.floor(u/t),h=Math.floor(f/n),p=u-t*c,d=Math.ceil(p/t),v=f-n*h,m=Math.ceil(v/n),g=0;i=i==="auto"?u:i;i=i==="min-auto"?-u:i;s=s==="auto"?f:s;s=s==="min-auto"?-f:s;for(var y=0;y<t;y++){var b=0,w=c;if(p>0){var E=p>=d?d:p;w+=E;p-=E}for(var S=0;S<n;S++){var x=h,T=v;if(T>0){var N=T>=m?m:v;x+=N;T-=N}a.$grid.append(o(w,x,b,g,l,u,f,y,S));b+=x}g+=w}a.listenTo=a.$grid.children().last();a.$grid.show();a.$img.css("opacity",0);a.$grid.children().first().addClass("rs-top-left");a.$grid.children().last().addClass("rs-bottom-right");a.$grid.children().eq(n-1).addClass("rs-bottom-left");a.$grid.children().eq(-n).addClass("rs-top-right")};this.execute=function(){a.$grid.children().css({opacity:u,transform:"rotate("+r+"deg) translateX("+i+"px) translateY("+s+"px) scale("+o+")"})};this.before(e.proxy(this.execute,this));this.reset=function(){a.$img.css("opacity",1);a.$grid.remove()}},sliceH:function(){this.grid(1,8,0,"min-auto",0,1,0)},sliceV:function(){this.grid(10,1,0,0,"auto",1,0)},slideV:function(){var e=this.forward?"min-auto":"auto";this.grid(1,1,0,0,e,1,1)},slideH:function(){var e=this.forward?"min-auto":"auto";this.grid(1,1,0,e,0,1,1)},scale:function(){this.grid(1,1,0,0,0,1.5,0)},blockScale:function(){this.grid(8,6,0,0,0,.6,0)},kaleidoscope:function(){this.grid(10,8,0,0,0,1,0)},fan:function(){this.grid(1,10,45,100,0,1,0)},blindV:function(){this.grid(1,8,0,0,0,.7,0)},blindH:function(){this.grid(10,1,0,0,0,.7,0)},random:function(){this[this.anims[Math.floor(Math.random()*this.anims.length)]]()},custom:function(){this.RS.nextAnimIndex<0&&(this.RS.nextAnimIndex=this.customAnims.length-1);this.RS.nextAnimIndex===this.customAnims.length&&(this.RS.nextAnimIndex=0);this[this.customAnims[this.RS.nextAnimIndex]]()}};var o={browserVendors:["","-webkit-","-moz-","-ms-","-o-","-khtml-"],domPrefixes:["","Webkit","Moz","ms","O","Khtml"],testDom:function(e){var t=this.domPrefixes.length;while(t--)if(typeof n.body.style[this.domPrefixes[t]+e]!="undefined")return!0;return!1},cssTransitions:function(){return typeof t.Modernizr!="undefined"&&Modernizr.csstransitions!=="undefined"?Modernizr.csstransitions:this.testDom("Transition")},cssTransforms3d:function(){return typeof t.Modernizr!="undefined"&&t.Modernizr.csstransforms3d!=="undefined"?t.Modernizr.csstransforms3d:typeof n.body.style.perspectiveProperty!="undefined"?!0:this.testDom("Perspective")}};e.fn.refineSlide=function(t){return this.each(function(){e.data(this,"refineSlide")||e.data(this,"refineSlide",new i(this,t))})}})(window.jQuery,window,window.document);if($(".slideshow").length>0){$(".slideshow").refineSlide({transition:"cubeH",thumbMargin:0,useArrows:!0,transitionDuration:500});var $thumbs=$(".rs-thumb-wrap a"),thumbHeight=$thumbs.eq(0).outerWidth()*.65;$thumbs.css("height",thumbHeight);if($thumbs.outerWidth()<80||thumbHeight<40){var $previewer=$('<span class="rs-thumb-viewer"></span>');$(".rs-thumb-wrap").prepend($previewer);$thumbs.hover(function(){var e=$(this);e.find("map-canvas").length>0?$previewer.html("map"):$previewer.html(e.html());$previewer.css("left",this.offsetLeft+this.offsetWidth/2).toggle()})}$(".rs-slider").hammer().on("swipeleft",function(){$(".rs-prev").click()});$(".rs-slider").hammer().on("swiperight",function(){$(".rs-next").click()});$(".fullscreen-toggle").on("click",function(){$(".rs-wrap").toggleClass("rs-fullscreen");$(".rs-thumb-wrap a").css("height",50)})}(function(e,t,n,r){"use strict";var i=7,s=6,o=s*i,u="div",a="tr",f="/",l="pickadate__",c=e(t),h=Array.isArray||function(e){return{}.toString.call(e)==="[object Array]"},p=function(e,t,n){if(typeof e=="function")return e.apply(t,n)},d=function(e){return(e<10?"0":"")+e},v=function(e,t,n,r,i){t=h(t)?t.join(""):t;r=r?" data-"+r.name+'="'+r.value+'"':"";n=n?' class="'+n+'"':"";i=i?" "+i:"";return"<"+e+r+n+i+">"+t+"</"+e+">"},m=function(e,t,n,r,i){var s="";e.map(function(n,o){o=r?r+o:o;var u=(p(i,e,[o])||"")+"value="+o+(t===o?" selected":"");s+=v("option",n,null,null,u)});return v("select",s,n)},g=function(e){var t;if(h(e))t=new Date(e[0],e[1],e[2]);else if(e===!0){t=new Date;t.setHours(0,0,0,0)}else isNaN(e)||(t=new Date(e));return{YEAR:t.getFullYear(),MONTH:t.getMonth(),DATE:t.getDate(),DAY:t.getDay(),TIME:t.getTime()}},y=function(t,r){function _(){var e=function(e){if(e&&k.YEAR>=C.YEAR&&k.MONTH>=C.MONTH||!e&&k.YEAR<=N.YEAR&&k.MONTH<=N.MONTH)return"";var t="month_"+(e?"next":"prev");return v(u,r[t],b[t],{name:"nav",value:e||-1})};return e()+e(1)}function D(){var e=r.show_months_full?r.months_full:r.months_short;return r.month_selector?m(e,k.MONTH,b.month_selector,0,function(e){return Q(e,k.YEAR,"disabled ")||""}):v(u,e[k.MONTH],b.month)}function P(){var e=k.YEAR,t=r.year_selector;if(t){t=t===!0?5:~~(t/2);var n=[],i=e-t,s=j(i,N.YEAR),o=e+t+(s-i),a=j(o,C.YEAR,1);t=o-a;t&&(s=j(i-t,N.YEAR));for(var f=0;f<=a-s;f+=1)n.push(s+f);return m(n,e,b.year_selector,s)}return v(u,e,b.year)}function H(){var e,t,n,r=[],s="",l=F(k.YEAR,k.MONTH),c=I(k.DATE,k.DAY),h=function(e,t){var n=!1,r=[b.calendar_date,t?b.day_infocus:b.day_outfocus];if(e.TIME<N.TIME||e.TIME>C.TIME||L&&L.filter(A,e).length){n=!0;r.push(b.day_disabled)}e.TIME===x.TIME&&r.push(b.day_today);e.TIME===T.TIME&&r.push(b.day_selected);return[r.join(" "),{name:n?"disabled":"date",value:[e.YEAR,e.MONTH+1,e.DATE,e.DAY,e.TIME].join(f)}]};for(var p=0;p<o;p+=1){t=p-c;e=g([k.YEAR,k.MONTH,t]);n=h(e,t>0&&t<=l);r.push(v("td",v(u,e.DATE,n[0],n[1])));p%i+1===i&&(s+=v(a,r.splice(0,i)))}return v("tbody",s,b.calendar_body)}function B(){return v(u,v(u,v(u,_(),b.month_nav)+v(u,D(),b.month_box)+v(u,P(),b.year_box)+v("table",[O,H()],b.calendar),b.calendar_box),b.calendar_wrap)}function j(e,t,n){return n&&e<t||!n&&e>t?e:t}function F(e,t){var n=t>6?!0:!1;return t==1?e%400!==0&&e%100===0||e%4!==0?28:29:t%2?n?31:30:n?30:31}function I(e,t){var n=e%i,s=t-n+(r.first_day?-1:0);return t>=n?s:i+s}function q(){return x||(x=g(!0))}function R(){return T||(T=function(e){return isNaN(e)?x:g(e)}(Date.parse(w.value)))}function U(e,t){var n=J(b.day_selected);T=h(e)?{YEAR:+e[0],MONTH:+e[1]-1,DATE:+e[2],DAY:+e[3],TIME:+e[4]}:e;if(t&&T.MONTH===k.MONTH){n.removeClass(b.day_selected);t.addClass(b.day_selected)}else{k=T;G()}w.value=V();E&&(E.value=V(r.format_submit));p(r.onSelect,y);return l}function z(){return k||(k=R())}function W(e,t){return k=g([t,e,1])}function X(e,t){if(e===!0)return x;if(h(e)){--e[1];return g(e)}if(t&&e>0||!t&&e<0)return g([x.YEAR,x.MONTH,x.DATE+e]);e=t?Infinity:-Infinity;return{YEAR:e,MONTH:e,TIME:e}}function V(e){return S.toArray(e||r.format).map(function(e){return p(S[e])||e}).join("")}function J(e){return s.find("."+e)}function K(e,t){t=t||k.YEAR;e=Q(e,t,N.MONTH,C.MONTH)||e;W(e,t);G();return l}function Q(e,t,n,r){if(t<=N.YEAR&&e<N.MONTH)return n;if(t>=C.YEAR&&e>C.MONTH)return r||n}function G(){s.html(B());Y()}function Y(){J(b.month_selector).on({change:function(){K(+this.value)}});J(b.year_selector).on({change:function(){K(k.MONTH,+this.value)}})}function Z(){if(l.isOpen)return l;l.isOpen=!0;t.addClass(b.input_focus);s.addClass(b.picker_open);c.on("click.P"+l.id,function(e){l.isOpen&&w!=e.target&&et()});p(r.onOpen,y);return l}function et(){l.isOpen=!1;t.removeClass(b.input_focus);s.removeClass(b.picker_open);c.off("click.P"+l.id);p(r.onClose,y);return l}function tt(n){var r=e(n.target),i=r.data();n.stopPropagation();if(i.date){U(i.date.split(f),r);et();return}i.nav&&K(k.MONTH+i.nav);t.focus()}var s,l={id:~~(Math.random()*1e9)},y={open:function(){Z();return this},close:function(){et();return this},show:function(e,t){K(--e,t);return this},getDate:function(){return E?E.value:w.value},setDate:function(e,t,n){U(g([e,--t,n]));return this}},b=r.klass,w=function(e){if(e.nodeName!=="INPUT")r.format_submit=r.format_submit||"yyyy-mm-dd";else{e.autofocus=e===n.activeElement;e.type="text";e.readOnly=!1}return e}(t[0]),E=function(t){return t?E=e("<input type=hidden name="+w.name+r.hidden_suffix+">").val(w.value?V(t):"")[0]:null}(r.format_submit),S={d:function(){return T.DATE},dd:function(){return d(T.DATE)},ddd:function(){return r.weekdays_short[T.DAY]},dddd:function(){return r.weekdays_full[T.DAY]},m:function(){return T.MONTH+1},mm:function(){return d(T.MONTH+1)},mmm:function(){return r.months_short[T.MONTH]},mmmm:function(){return r.months_full[T.MONTH]},yy:function(){return T.YEAR.toString().substr(2,2)},yyyy:function(){return T.YEAR},toArray:function(e){return e.split(/(?=\b)(d{1,4}|m{1,4}|y{4}|yy)+(\b)/g)}},x=q(),T=R(),N=X(r.date_min),C=X(r.date_max,1),k=z(),L=function(e){if(h(e)){e[0]===!0&&(l.disabled=e.shift());return e.map(function(e){if(!isNaN(e)){l.disabledDays=!0;return--e+r.first_day}--e[1];return g(e)})}}(r.dates_disabled),A=function(){var e=function(e){return this.TIME===e.TIME||l.disabledDays&&L.indexOf(this.DAY)>-1};return l.disabled?function(t,n,r){return r.map(e,this).indexOf(!0)<0}:e}(),O=function(e){r.first_day&&e.push(e.splice(0,1)[0]);return v("thead",v(a,e.map(function(e){return v("th",e,b.weekdays)})))}((r.show_weekdays_short?r.weekdays_short:r.weekdays_full).slice(0)),M=function(){s=e(v(u,B(),b.picker_holder)).on({click:tt});t.on({keydown:function(e){e.keyCode===9&&et()},focusin:function(){Z()}}).after([s,E]);Y();w.autofocus&&Z();p(r.onStart,y)}();return y};y.defaults={months_full:["January","February","March","April","May","June","July","August","September","October","November","December"],months_short:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays_full:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdays_short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],month_prev:"◀",month_next:"▶",show_months_full:!0,show_weekdays_short:!0,format:"d mmmm, yyyy",format_submit:!1,hidden_suffix:"_submit",first_day:0,month_selector:!1,year_selector:!1,date_min:!1,date_max:!1,dates_disabled:!1,disable_picker:!1,onOpen:null,onClose:null,onSelect:null,onStart:null,klass:{input_focus:l+"input--focused",picker_holder:l+"holder",picker_open:l+"holder--opened",calendar_wrap:l+"calendar--wrap",calendar_box:l+"calendar--box",calendar:l+"calendar",calendar_body:l+"calendar--body",calendar_date:l+"calendar--date",year:l+"year",year_box:l+"year--box",year_selector:l+"year--selector",month:l+"month",month_box:l+"month--box",month_selector:l+"month--selector",month_nav:l+"month--nav",month_prev:l+"month--prev",month_next:l+"month--next",week:l+"week",weekdays:l+"weekday",day_disabled:l+"day--disabled",day_selected:l+"day--selected",day_today:l+"day--today",day_infocus:l+"day--infocus",day_outfocus:l+"day--outfocus",box_months:l+"holder--months",box_years:l+"holder--years",box_weekdays:l+"holder--weekdays"}};e.fn.pickadate=function(t){var n="pickadate";t=e.extend(!0,{},y.defaults,t);return t.disable_picker?this:this.each(function(){var r=e(this);r.data(n)||r.data(n,new y(r,t))})}})(jQuery,window,document);var didScroll=!1,touchable=Modernizr.touch,screenSize=window.getComputedStyle(document.body,":after").getPropertyValue("content");setExtraAssetsTop
();window.getComputedStyle||(window.getComputedStyle=function(e){this.el=e;this.getPropertyValue=function(t){var n=/(\-([a-z]){1})/g;t==="float"&&(t="styleFloat");n.test(t)&&(t=t.replace(n,function(){return arguments[2].toUpperCase()}));return e.currentStyle[t]?e.currentStyle[t]:null};return this});setNavicon();$("a.trigger").each(function(){"use strict";var e=this.hash,t=$(this);e.split(">").length>1&&(document.width>1e3?e=e.split(">")[0]+" "+e.split(">")[1]:e=e.split(">")[0]);$(e).hide();t.on("click",function(n){$(e).toggle();t.toggleClass("activated");n.preventDefault()})});$(document).on("change",".url-selector",function(){"use strict";window.location=$(this).val()});load_images();tabit();$(document).on("click",".post-admin a",function(){"use strict";var e=$(this),t=e.data("confirm");if(t){t==="use_title"&&(t=e.attr("title"));return confirm(t)}});$(document).on("click touchend",'a[href*="/vote/"]',function(e){"use strict";e.preventDefault();var t=$(this).parent().find(".votes");$.post(this.href,{csrfmiddlewaretoken:$('input[name|="csrfmiddlewaretoken"]').attr("value")},function(e){var n=e.score.score;n<1&&(n="Noted");t.html(n+" ✓")},"json")});$("#comment-list article.toxic header").each(function(){var e=$(this);e.append('<em class="note toxic-message">This comment has been collapsed</em>');e.click(function(){confirm("Are you sure you want to see this? It could get ugly.")&&$(this).parent().toggleClass("toxic")})});$(".datepicker").pickadate({format:"yyyy-mm-dd"});setTimeout(setExtraAssetsTop,400); |
examples/huge-apps/routes/Messages/components/Messages.js | ustccjw/react-router | import React from 'react';
class Messages extends React.Component {
render () {
return (
<div>
<h2>Messages</h2>
</div>
);
}
}
export default Messages;
|
bench/rendering/pages/stateless-big.js | azukaru/next.js | import React from 'react'
export default () => {
return <ul>{items()}</ul>
}
const items = () => {
var out = new Array(10000)
for (let i = 0; i < out.length; i++) {
out[i] = <li key={i}>This is row {i + 1}</li>
}
return out
}
|
src/app/core/atoms/icon/icons/close-circle.js | blowsys/reservo | import React from 'react'; const CloseCircle = (props) => <svg {...props} viewBox="0 0 24 24"><g><g><path d="M12,0 C5.371,0 0,5.373 0,12 C0,18.629 5.373,24 12,24 C18.629,24 24,18.627 24,12 C24,5.371 18.627,0 12,0 M12,2 C17.514,2 22,6.486 22,12 C22,17.514 17.514,22 12,22 C6.486,22 2,17.514 2,12 C2,6.486 6.486,2 12,2"/><polygon points="16.9498 8.4644 15.5358 7.0504 11.9998 10.5854 8.4648 7.0504 7.0508 8.4644 10.5858 12.0004 7.0508 15.5354 8.4648 16.9494 11.9998 13.4144 15.5358 16.9494 16.9498 15.5354 13.4138 12.0004"/></g></g></svg>; export default CloseCircle;
|
node_modules/rx/dist/rx.lite.extras.compat.js | karypun/change-of-address-prototype | // Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information.
;(function (factory) {
var objectTypes = {
'function': true,
'object': true
};
function checkGlobal(value) {
return (value && value.Object === Object) ? value : null;
}
var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null;
var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null;
var freeGlobal = checkGlobal(freeExports && freeModule && typeof global === 'object' && global);
var freeSelf = checkGlobal(objectTypes[typeof self] && self);
var freeWindow = checkGlobal(objectTypes[typeof window] && window);
var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null;
var thisGlobal = checkGlobal(objectTypes[typeof this] && this);
var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')();
// Because of build optimizers
if (typeof define === 'function' && define.amd) {
define(['./rx.lite.compat'], function (Rx, exports) {
return factory(root, exports, Rx);
});
} else if (typeof module === 'object' && module && module.exports === freeExports) {
module.exports = factory(root, module.exports, require('rx-lite-compat'));
} else {
root.Rx = factory(root, {}, root.Rx);
}
}.call(this, function (root, exp, Rx, undefined) {
// References
var Observable = Rx.Observable,
observableProto = Observable.prototype,
observableNever = Observable.never,
observableThrow = Observable['throw'],
AnonymousObservable = Rx.AnonymousObservable,
ObservableBase = Rx.ObservableBase,
AnonymousObserver = Rx.AnonymousObserver,
notificationCreateOnNext = Rx.Notification.createOnNext,
notificationCreateOnError = Rx.Notification.createOnError,
notificationCreateOnCompleted = Rx.Notification.createOnCompleted,
Observer = Rx.Observer,
observerCreate = Observer.create,
AbstractObserver = Rx.internals.AbstractObserver,
Subject = Rx.Subject,
internals = Rx.internals,
helpers = Rx.helpers,
ScheduledObserver = internals.ScheduledObserver,
SerialDisposable = Rx.SerialDisposable,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
CompositeDisposable = Rx.CompositeDisposable,
BinaryDisposable = Rx.BinaryDisposable,
RefCountDisposable = Rx.RefCountDisposable,
disposableEmpty = Rx.Disposable.empty,
immediateScheduler = Rx.Scheduler.immediate,
defaultKeySerializer = helpers.defaultKeySerializer,
addRef = Rx.internals.addRef,
identity = helpers.identity,
isPromise = helpers.isPromise,
isFunction = helpers.isFunction,
inherits = internals.inherits,
bindCallback = internals.bindCallback,
noop = helpers.noop,
isScheduler = Rx.Scheduler.isScheduler,
observableFromPromise = Observable.fromPromise,
ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError;
var errorObj = {e: {}};
function tryCatcherGen(tryCatchTarget) {
return function tryCatcher() {
try {
return tryCatchTarget.apply(this, arguments);
} catch (e) {
errorObj.e = e;
return errorObj;
}
};
}
var tryCatch = Rx.internals.tryCatch = function tryCatch(fn) {
if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }
return tryCatcherGen(fn);
};
function thrower(e) {
throw e;
}
function ScheduledDisposable(scheduler, disposable) {
this.scheduler = scheduler;
this.disposable = disposable;
this.isDisposed = false;
}
function scheduleItem(s, self) {
if (!self.isDisposed) {
self.isDisposed = true;
self.disposable.dispose();
}
}
ScheduledDisposable.prototype.dispose = function () {
this.scheduler.schedule(this, scheduleItem);
};
var CheckedObserver = (function (__super__) {
inherits(CheckedObserver, __super__);
function CheckedObserver(observer) {
__super__.call(this);
this._observer = observer;
this._state = 0; // 0 - idle, 1 - busy, 2 - done
}
var CheckedObserverPrototype = CheckedObserver.prototype;
CheckedObserverPrototype.onNext = function (value) {
this.checkAccess();
var res = tryCatch(this._observer.onNext).call(this._observer, value);
this._state = 0;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.onError = function (err) {
this.checkAccess();
var res = tryCatch(this._observer.onError).call(this._observer, err);
this._state = 2;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.onCompleted = function () {
this.checkAccess();
var res = tryCatch(this._observer.onCompleted).call(this._observer);
this._state = 2;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.checkAccess = function () {
if (this._state === 1) { throw new Error('Re-entrancy detected'); }
if (this._state === 2) { throw new Error('Observer completed'); }
if (this._state === 0) { this._state = 1; }
};
return CheckedObserver;
}(Observer));
var ObserveOnObserver = (function (__super__) {
inherits(ObserveOnObserver, __super__);
function ObserveOnObserver(scheduler, observer, cancel) {
__super__.call(this, scheduler, observer);
this._cancel = cancel;
}
ObserveOnObserver.prototype.next = function (value) {
__super__.prototype.next.call(this, value);
this.ensureActive();
};
ObserveOnObserver.prototype.error = function (e) {
__super__.prototype.error.call(this, e);
this.ensureActive();
};
ObserveOnObserver.prototype.completed = function () {
__super__.prototype.completed.call(this);
this.ensureActive();
};
ObserveOnObserver.prototype.dispose = function () {
__super__.prototype.dispose.call(this);
this._cancel && this._cancel.dispose();
this._cancel = null;
};
return ObserveOnObserver;
})(ScheduledObserver);
/**
* Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods.
* If a violation is detected, an Error is thrown from the offending observer method call.
*
* @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.
*/
Observer.prototype.checked = function () { return new CheckedObserver(this); };
/**
* Schedules the invocation of observer methods on the given scheduler.
* @param {Scheduler} scheduler Scheduler to schedule observer messages on.
* @returns {Observer} Observer whose messages are scheduled on the given scheduler.
*/
Observer.notifyOn = function (scheduler) {
return new ObserveOnObserver(scheduler, this);
};
/**
* Creates an observer from a notification callback.
* @param {Function} handler Action that handles a notification.
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
*/
Observer.fromNotifier = function (handler, thisArg) {
var handlerFunc = bindCallback(handler, thisArg, 1);
return new AnonymousObserver(function (x) {
return handlerFunc(notificationCreateOnNext(x));
}, function (e) {
return handlerFunc(notificationCreateOnError(e));
}, function () {
return handlerFunc(notificationCreateOnCompleted());
});
};
/**
* Creates a notification callback from an observer.
* @returns The action that forwards its input notification to the underlying observer.
*/
Observer.prototype.toNotifier = function () {
var observer = this;
return function (n) { return n.accept(observer); };
};
/**
* Hides the identity of an observer.
* @returns An observer that hides the identity of the specified observer.
*/
Observer.prototype.asObserver = function () {
var source = this;
return new AnonymousObserver(
function (x) { source.onNext(x); },
function (e) { source.onError(e); },
function () { source.onCompleted(); }
);
};
var ObserveOnObservable = (function (__super__) {
inherits(ObserveOnObservable, __super__);
function ObserveOnObservable(source, s) {
this.source = source;
this._s = s;
__super__.call(this);
}
ObserveOnObservable.prototype.subscribeCore = function (o) {
return this.source.subscribe(new ObserveOnObserver(this._s, o));
};
return ObserveOnObservable;
}(ObservableBase));
/**
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
*
* This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
* that require to be run on a scheduler, use subscribeOn.
*
* @param {Scheduler} scheduler Scheduler to notify observers on.
* @returns {Observable} The source sequence whose observations happen on the specified scheduler.
*/
observableProto.observeOn = function (scheduler) {
return new ObserveOnObservable(this, scheduler);
};
var SubscribeOnObservable = (function (__super__) {
inherits(SubscribeOnObservable, __super__);
function SubscribeOnObservable(source, s) {
this.source = source;
this._s = s;
__super__.call(this);
}
function scheduleMethod(scheduler, state) {
var source = state[0], d = state[1], o = state[2];
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(o)));
}
SubscribeOnObservable.prototype.subscribeCore = function (o) {
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
d.setDisposable(m);
m.setDisposable(this._s.schedule([this.source, d, o], scheduleMethod));
return d;
};
return SubscribeOnObservable;
}(ObservableBase));
/**
* Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
* see the remarks section for more information on the distinction between subscribeOn and observeOn.
* This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
* callbacks on a scheduler, use observeOn.
* @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on.
* @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribeOn = function (scheduler) {
return new SubscribeOnObservable(this, scheduler);
};
var GenerateObservable = (function (__super__) {
inherits(GenerateObservable, __super__);
function GenerateObservable(state, cndFn, itrFn, resFn, s) {
this._initialState = state;
this._cndFn = cndFn;
this._itrFn = itrFn;
this._resFn = resFn;
this._s = s;
__super__.call(this);
}
function scheduleRecursive(state, recurse) {
if (state.first) {
state.first = false;
} else {
state.newState = tryCatch(state.self._itrFn)(state.newState);
if (state.newState === errorObj) { return state.o.onError(state.newState.e); }
}
var hasResult = tryCatch(state.self._cndFn)(state.newState);
if (hasResult === errorObj) { return state.o.onError(hasResult.e); }
if (hasResult) {
var result = tryCatch(state.self._resFn)(state.newState);
if (result === errorObj) { return state.o.onError(result.e); }
state.o.onNext(result);
recurse(state);
} else {
state.o.onCompleted();
}
}
GenerateObservable.prototype.subscribeCore = function (o) {
var state = {
o: o,
self: this,
first: true,
newState: this._initialState
};
return this._s.scheduleRecursive(state, scheduleRecursive);
};
return GenerateObservable;
}(ObservableBase));
/**
* Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.
* @returns {Observable} The generated sequence.
*/
Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new GenerateObservable(initialState, condition, iterate, resultSelector, scheduler);
};
var UsingObservable = (function (__super__) {
inherits(UsingObservable, __super__);
function UsingObservable(resFn, obsFn) {
this._resFn = resFn;
this._obsFn = obsFn;
__super__.call(this);
}
UsingObservable.prototype.subscribeCore = function (o) {
var disposable = disposableEmpty;
var resource = tryCatch(this._resFn)();
if (resource === errorObj) {
return new BinaryDisposable(observableThrow(resource.e).subscribe(o), disposable);
}
resource && (disposable = resource);
var source = tryCatch(this._obsFn)(resource);
if (source === errorObj) {
return new BinaryDisposable(observableThrow(source.e).subscribe(o), disposable);
}
return new BinaryDisposable(source.subscribe(o), disposable);
};
return UsingObservable;
}(ObservableBase));
/**
* Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
* @param {Function} resourceFactory Factory function to obtain a resource object.
* @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.
* @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.
*/
Observable.using = function (resourceFactory, observableFactory) {
return new UsingObservable(resourceFactory, observableFactory);
};
/**
* Propagates the observable sequence or Promise that reacts first.
* @param {Observable} rightSource Second observable sequence or Promise.
* @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first.
*/
observableProto.amb = function (rightSource) {
var leftSource = this;
return new AnonymousObservable(function (observer) {
var choice,
leftChoice = 'L', rightChoice = 'R',
leftSubscription = new SingleAssignmentDisposable(),
rightSubscription = new SingleAssignmentDisposable();
isPromise(rightSource) && (rightSource = observableFromPromise(rightSource));
function choiceL() {
if (!choice) {
choice = leftChoice;
rightSubscription.dispose();
}
}
function choiceR() {
if (!choice) {
choice = rightChoice;
leftSubscription.dispose();
}
}
var leftSubscribe = observerCreate(
function (left) {
choiceL();
choice === leftChoice && observer.onNext(left);
},
function (e) {
choiceL();
choice === leftChoice && observer.onError(e);
},
function () {
choiceL();
choice === leftChoice && observer.onCompleted();
}
);
var rightSubscribe = observerCreate(
function (right) {
choiceR();
choice === rightChoice && observer.onNext(right);
},
function (e) {
choiceR();
choice === rightChoice && observer.onError(e);
},
function () {
choiceR();
choice === rightChoice && observer.onCompleted();
}
);
leftSubscription.setDisposable(leftSource.subscribe(leftSubscribe));
rightSubscription.setDisposable(rightSource.subscribe(rightSubscribe));
return new BinaryDisposable(leftSubscription, rightSubscription);
});
};
function amb(p, c) { return p.amb(c); }
/**
* Propagates the observable sequence or Promise that reacts first.
* @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.
*/
Observable.amb = function () {
var acc = observableNever(), items;
if (Array.isArray(arguments[0])) {
items = arguments[0];
} else {
var len = arguments.length;
items = new Array(items);
for(var i = 0; i < len; i++) { items[i] = arguments[i]; }
}
for (var i = 0, len = items.length; i < len; i++) {
acc = amb(acc, items[i]);
}
return acc;
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
* @param {Observable} second Second observable sequence used to produce results after the first sequence terminates.
* @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.
*/
observableProto.onErrorResumeNext = function (second) {
if (!second) { throw new Error('Second observable is required'); }
return onErrorResumeNext([this, second]);
};
var OnErrorResumeNextObservable = (function(__super__) {
inherits(OnErrorResumeNextObservable, __super__);
function OnErrorResumeNextObservable(sources) {
this.sources = sources;
__super__.call(this);
}
function scheduleMethod(state, recurse) {
if (state.pos < state.sources.length) {
var current = state.sources[state.pos++];
isPromise(current) && (current = observableFromPromise(current));
var d = new SingleAssignmentDisposable();
state.subscription.setDisposable(d);
d.setDisposable(current.subscribe(new OnErrorResumeNextObserver(state, recurse)));
} else {
state.o.onCompleted();
}
}
OnErrorResumeNextObservable.prototype.subscribeCore = function (o) {
var subscription = new SerialDisposable(),
state = {pos: 0, subscription: subscription, o: o, sources: this.sources },
cancellable = immediateScheduler.scheduleRecursive(state, scheduleMethod);
return new BinaryDisposable(subscription, cancellable);
};
return OnErrorResumeNextObservable;
}(ObservableBase));
var OnErrorResumeNextObserver = (function(__super__) {
inherits(OnErrorResumeNextObserver, __super__);
function OnErrorResumeNextObserver(state, recurse) {
this._state = state;
this._recurse = recurse;
__super__.call(this);
}
OnErrorResumeNextObserver.prototype.next = function (x) { this._state.o.onNext(x); };
OnErrorResumeNextObserver.prototype.error = function () { this._recurse(this._state); };
OnErrorResumeNextObserver.prototype.completed = function () { this._recurse(this._state); };
return OnErrorResumeNextObserver;
}(AbstractObserver));
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
* @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
*/
var onErrorResumeNext = Observable.onErrorResumeNext = function () {
var sources = [];
if (Array.isArray(arguments[0])) {
sources = arguments[0];
} else {
var len = arguments.length;
sources = new Array(len);
for(var i = 0; i < len; i++) { sources[i] = arguments[i]; }
}
return new OnErrorResumeNextObservable(sources);
};
function toArray(x) { return x.toArray(); }
function notEmpty(x) { return x.length > 0; }
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
* @param {Number} count Length of each buffer.
* @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithCount = observableProto.bufferCount = function (count, skip) {
typeof skip !== 'number' && (skip = count);
return this.windowWithCount(count, skip)
.flatMap(toArray)
.filter(notEmpty);
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on element count information.
* @param {Number} count Length of each window.
* @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithCount = observableProto.windowCount = function (count, skip) {
var source = this;
+count || (count = 0);
Math.abs(count) === Infinity && (count = 0);
if (count <= 0) { throw new ArgumentOutOfRangeError(); }
skip == null && (skip = count);
+skip || (skip = 0);
Math.abs(skip) === Infinity && (skip = 0);
if (skip <= 0) { throw new ArgumentOutOfRangeError(); }
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(),
refCountDisposable = new RefCountDisposable(m),
n = 0,
q = [];
function createWindow () {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
}
createWindow();
m.setDisposable(source.subscribe(
function (x) {
for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }
var c = n - count + 1;
c >= 0 && c % skip === 0 && q.shift().onCompleted();
++n % skip === 0 && createWindow();
},
function (e) {
while (q.length > 0) { q.shift().onError(e); }
observer.onError(e);
},
function () {
while (q.length > 0) { q.shift().onCompleted(); }
observer.onCompleted();
}
));
return refCountDisposable;
}, source);
};
var TakeLastBufferObserver = (function (__super__) {
inherits(TakeLastBufferObserver, __super__);
function TakeLastBufferObserver(o, c) {
this._o = o;
this._c = c;
this._q = [];
__super__.call(this);
}
TakeLastBufferObserver.prototype.next = function (x) {
this._q.push(x);
this._q.length > this._c && this._q.shift();
};
TakeLastBufferObserver.prototype.error = function (e) {
this._o.onError(e);
};
TakeLastBufferObserver.prototype.completed = function () {
this._o.onNext(this._q);
this._o.onCompleted();
};
return TakeLastBufferObserver;
}(AbstractObserver));
/**
* Returns an array with the specified number of contiguous elements from the end of an observable sequence.
*
* @description
* This operator accumulates a buffer with a length enough to store count elements. Upon completion of the
* source sequence, this buffer is produced on the result sequence.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
*/
observableProto.takeLastBuffer = function (count) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
var source = this;
return new AnonymousObservable(function (o) {
return source.subscribe(new TakeLastBufferObserver(o, count));
}, source);
};
var DefaultIfEmptyObserver = (function (__super__) {
inherits(DefaultIfEmptyObserver, __super__);
function DefaultIfEmptyObserver(o, d) {
this._o = o;
this._d = d;
this._f = false;
__super__.call(this);
}
DefaultIfEmptyObserver.prototype.next = function (x) {
this._f = true;
this._o.onNext(x);
};
DefaultIfEmptyObserver.prototype.error = function (e) {
this._o.onError(e);
};
DefaultIfEmptyObserver.prototype.completed = function () {
!this._f && this._o.onNext(this._d);
this._o.onCompleted();
};
return DefaultIfEmptyObserver;
}(AbstractObserver));
/**
* Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
*
* var res = obs = xs.defaultIfEmpty();
* 2 - obs = xs.defaultIfEmpty(false);
*
* @memberOf Observable#
* @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.
* @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
*/
observableProto.defaultIfEmpty = function (defaultValue) {
var source = this;
defaultValue === undefined && (defaultValue = null);
return new AnonymousObservable(function (o) {
return source.subscribe(new DefaultIfEmptyObserver(o, defaultValue));
}, source);
};
// Swap out for Array.findIndex
function arrayIndexOfComparer(array, item, comparer) {
for (var i = 0, len = array.length; i < len; i++) {
if (comparer(array[i], item)) { return i; }
}
return -1;
}
function HashSet(comparer) {
this.comparer = comparer;
this.set = [];
}
HashSet.prototype.push = function(value) {
var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1;
retValue && this.set.push(value);
return retValue;
};
var DistinctObservable = (function (__super__) {
inherits(DistinctObservable, __super__);
function DistinctObservable(source, keyFn, cmpFn) {
this.source = source;
this._keyFn = keyFn;
this._cmpFn = cmpFn;
__super__.call(this);
}
DistinctObservable.prototype.subscribeCore = function (o) {
return this.source.subscribe(new DistinctObserver(o, this._keyFn, this._cmpFn));
};
return DistinctObservable;
}(ObservableBase));
var DistinctObserver = (function (__super__) {
inherits(DistinctObserver, __super__);
function DistinctObserver(o, keyFn, cmpFn) {
this._o = o;
this._keyFn = keyFn;
this._h = new HashSet(cmpFn);
__super__.call(this);
}
DistinctObserver.prototype.next = function (x) {
var key = x;
if (isFunction(this._keyFn)) {
key = tryCatch(this._keyFn)(x);
if (key === errorObj) { return this._o.onError(key.e); }
}
this._h.push(key) && this._o.onNext(x);
};
DistinctObserver.prototype.error = function (e) { this._o.onError(e); };
DistinctObserver.prototype.completed = function () { this._o.onCompleted(); };
return DistinctObserver;
}(AbstractObserver));
/**
* Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
* Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
*
* @example
* var res = obs = xs.distinct();
* 2 - obs = xs.distinct(function (x) { return x.id; });
* 2 - obs = xs.distinct(function (x) { return x.id; }, function (a,b) { return a === b; });
* @param {Function} [keySelector] A function to compute the comparison key for each element.
* @param {Function} [comparer] Used to compare items in the collection.
* @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
*/
observableProto.distinct = function (keySelector, comparer) {
comparer || (comparer = defaultComparer);
return new DistinctObservable(this, keySelector, comparer);
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence. This observable sequence
* can be resubscribed to, even if all prior subscriptions have ended. (unlike `.publish().refCount()`)
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source.
*/
observableProto.singleInstance = function() {
var source = this, hasObservable = false, observable;
function getObservable() {
if (!hasObservable) {
hasObservable = true;
observable = source['finally'](function() { hasObservable = false; }).publish().refCount();
}
return observable;
}
return new AnonymousObservable(function(o) {
return getObservable().subscribe(o);
});
};
return Rx;
}));
|
src/containers/DevTools/DevTools.js | captainill/react-redux-universal-hot-example | import React from 'react';
import { createDevTools } from 'redux-devtools';
import LogMonitor from 'redux-devtools-log-monitor';
import DockMonitor from 'redux-devtools-dock-monitor';
export default createDevTools(
<DockMonitor toggleVisibilityKey="H"
changePositionKey="Q">
<LogMonitor />
</DockMonitor>
);
|
src/svg-icons/device/battery-charging-50.js | IsenrichO/mui-with-arrows | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let DeviceBatteryCharging50 = (props) => (
<SvgIcon {...props}>
<path d="M14.47 13.5L11 20v-5.5H9l.53-1H7v7.17C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V13.5h-2.53z"/><path fillOpacity=".3" d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v8.17h2.53L13 7v5.5h2l-.53 1H17V5.33C17 4.6 16.4 4 15.67 4z"/>
</SvgIcon>
);
DeviceBatteryCharging50 = pure(DeviceBatteryCharging50);
DeviceBatteryCharging50.displayName = 'DeviceBatteryCharging50';
DeviceBatteryCharging50.muiName = 'SvgIcon';
export default DeviceBatteryCharging50;
|
pages/thanks.js | jkupcho/eri-blog | import React from 'react';
export default () => {
return (
<div className="container">
<h1>Thanks for the contact, we'll contact you back soon!</h1>
</div>
);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.