path
stringlengths 5
304
| repo_name
stringlengths 6
79
| content
stringlengths 27
1.05M
|
|---|---|---|
src/views/KeyboardView/Key.react.js
|
ryym/web-keyboard-simulator
|
import React from 'react';
import classNames from 'classnames';
export default function Key({ labels, size = 1, pressed }) {
return (
<div
className={classNames(
'keyboard_key',
{ 'is-key-pressed': pressed }
)}
style={{ flexGrow: size }}
>
{renderLabels(labels)}
</div>
);
}
function renderLabels(labels) {
return labels.map(label => (
<div key={label} className="keyboard_key_label">
{label}
</div>
));
}
|
client/src/components/dashboard/profile/photo-booth.js
|
mikelearning91/seeme-starter
|
import React from 'react';
import { captureUserMedia, S3Upload } from './utils/rtc-utils';
import Webcam from './utils/webcam';
import RecordRTC from 'recordrtc';
import Playback from './utils/playback';
import mui from 'material-ui';
import MdIconPack from 'react-icons/lib/md';
import MdCamera from 'react-icons/lib/md/camera';
import MdStop from 'react-icons/lib/md/stop';
import MdDone from 'react-icons/lib/md/done';
import MdUndo from 'react-icons/lib/md/undo';
const cookie = require('react-cookie');
const hasGetUserMedia = !!(navigator.getUserMedia || navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia || navigator.msGetUserMedia);
class PhotoBooth extends React.Component {
constructor(props) {
super(props);
this.state = {
recordVideo: null,
src: null,
uploadSuccess: null,
uploading: false,
preview: null,
recording: ''
};
this.requestUserMedia = this.requestUserMedia.bind(this);
this.startRecord = this.startRecord.bind(this);
this.stopRecord = this.stopRecord.bind(this);
this.save = this.save.bind(this);
}
componentDidMount() {
if (!hasGetUserMedia) {
alert("Your browser cannot stream from your webcam. Please switch to Chrome or Firefox.");
return;
}
this.requestUserMedia();
}
requestUserMedia() {
console.log('requestUserMedia')
captureUserMedia((stream) => {
this.setState({ src: window.URL.createObjectURL(stream) });
console.log('setting state', this.state)
});
}
startRecord() {
document.getElementById('start-btn').classList.add('hide');
document.getElementById('stop-btn').classList.remove('hide');
document.getElementById('stop-btn').classList.add('spin', 'circle');
this.setState({ recording: true })
captureUserMedia((stream) => {
this.state.recordVideo = RecordRTC(stream, { type: 'video' });
this.state.recordVideo.startRecording();
});
setTimeout(() => {
if (this.state.preview === null) {
this.stopRecord();
}
}, 10000);
}
stopRecord() {
document.getElementById('stop-btn').classList.add('hide');
document.getElementById('start-btn').classList.remove('hide')
document.getElementById('stop-btn').classList.remove('spin', 'circle');
this.setState({ recording: '' })
this.state.recordVideo.stopRecording(() => {
console.log("recordVideo", this.state.recordVideo);
console.log("blob: ", this.state.recordVideo.blob)
let preview = window.URL.createObjectURL(this.state.recordVideo.blob);
this.state.preview = window.URL.createObjectURL(this.state.recordVideo.blob);
this.setState({ preview: preview })
});
}
save() {
let user = cookie.load('user');
let params = {
type: 'video/webm',
data: this.state.recordVideo.blob,
id: user._id + Math.floor(Math.random() * 90000) + 10000
}
this.setState({ uploading: true });
setTimeout(() => {
S3Upload(params)
.then((success) => {
console.log('enter then statement')
if (success) {
console.log(success)
this.setState({ uploadSuccess: true, uploading: false });
window.location.reload()
}
}, (error) => {
alert(error, 'error occurred. check your aws settings and try again.')
})
}, 2500)
}
playVideo() {
this.refs.newLook.play();
}
retake() {
this.setState({ preview: null })
}
render() {
return (
<div>
{
(this.state.preview === null)
? <div className="v-container" ><Webcam src={this.state.src} />
<div><button id="start-btn" className="v-ctl start" onClick={this.startRecord}><MdCamera /></button></div>
<div><button id="stop-btn" className="v-ctl stop hide" onClick={this.stopRecord}><MdStop /></button></div>
</div>
: <div><Playback src={this.state.preview} />
<button className="v-ctl retake" onClick={this.retake.bind(this)}><MdUndo /></button>
<button className="v-ctl save" onClick={this.save}><MdDone /></button>
</div>
}
{this.state.uploading ?
<div className="uploading">Saving...</div> : null}
</div>
)
}
}
export default PhotoBooth;
|
6.0.0-alpha.14/examples/asyncValidation/dist/bundle.js
|
erikras/redux-form-docs
|
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="/dist/",t(0)}([function(e,t,n){n(290),e.exports=n(288)},function(e,t,n){var r=n(5),o=n(33),i=n(17),a=n(19),u=n(38),s="prototype",c=function(e,t,n){var l,p,f,d,h=e&c.F,v=e&c.G,m=e&c.S,y=e&c.P,g=e&c.B,b=v?r:m?r[t]||(r[t]={}):(r[t]||{})[s],_=v?o:o[t]||(o[t]={}),x=_[s]||(_[s]={});v&&(n=t);for(l in n)p=!h&&b&&void 0!==b[l],f=(p?b:n)[l],d=g&&p?u(f,r):y&&"function"==typeof f?u(Function.call,f):f,b&&a(b,l,f,e&c.U),_[l]!=f&&i(_,l,d),y&&x[l]!=f&&(x[l]=f)};r.core=o,c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,e.exports=c},function(e,t,n){"use strict";function r(e,t,n,r,o,i,a,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,i,a,u],l=0;s=new Error(t.replace(/%s/g,function(){return c[l++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}e.exports=r},function(e,t,n){var r=n(7);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){"use strict";var r=n(30),o=r;e.exports=o},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){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(90)("wks"),o=n(59),i=n(5).Symbol,a="function"==typeof i,u=e.exports=function(e){return r[e]||(r[e]=a&&i[e]||(a?i:o)("Symbol."+e))};u.store=r},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 r(){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;10>n;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(i){return!1}}var o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=r()?Object.assign:function(e,t){for(var r,a,u=n(e),s=1;s<arguments.length;s++){r=Object(arguments[s]);for(var c in r)o.call(r,c)&&(u[c]=r[c]);if(Object.getOwnPropertySymbols){a=Object.getOwnPropertySymbols(r);for(var l=0;l<a.length;l++)i.call(r,a[l])&&(u[a[l]]=r[a[l]])}}return u}},function(e,t,n){e.exports=!n(6)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(3),o=n(185),i=n(35),a=Object.defineProperty;t.f=n(10)?Object.defineProperty:function(e,t,n){if(r(e),t=i(t,!0),r(n),o)try{return a(e,t,n)}catch(u){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){"use strict";function r(e){for(var t;t=e._renderedComponent;)e=t;return e}function o(e,t){var n=r(e);n._nativeNode=t,t[v]=n}function i(e){var t=e._nativeNode;t&&(delete t[v],e._nativeNode=null)}function a(e,t){if(!(e._flags&h.hasCachedChildNodes)){var n=e._renderedChildren,i=t.firstChild;e:for(var a in n)if(n.hasOwnProperty(a)){var u=n[a],s=r(u)._domID;if(null!=s){for(;null!==i;i=i.nextSibling)if(1===i.nodeType&&i.getAttribute(d)===String(s)||8===i.nodeType&&i.nodeValue===" react-text: "+s+" "||8===i.nodeType&&i.nodeValue===" react-empty: "+s+" "){o(u,i);continue e}f(!1)}}e._flags|=h.hasCachedChildNodes}}function u(e){if(e[v])return e[v];for(var t=[];!e[v];){if(t.push(e),!e.parentNode)return null;e=e.parentNode}for(var n,r;e&&(r=e[v]);e=t.pop())n=r,t.length&&a(r,e);return n}function s(e){var t=u(e);return null!=t&&t._nativeNode===e?t:null}function c(e){if(void 0===e._nativeNode?f(!1):void 0,e._nativeNode)return e._nativeNode;for(var t=[];!e._nativeNode;)t.push(e),e._nativeParent?void 0:f(!1),e=e._nativeParent;for(;t.length;e=t.pop())a(e,e._nativeNode);return e._nativeNode}var l=n(61),p=n(252),f=n(2),d=l.ID_ATTRIBUTE_NAME,h=p,v="__reactInternalInstance$"+Math.random().toString(36).slice(2),m={getClosestInstanceFromNode:u,getInstanceFromNode:s,getNodeFromInstance:c,precacheChildNodes:a,precacheNode:o,uncacheNode:i};e.exports=m},function(e,t,n){var r=n(46),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(28);e.exports=function(e){return Object(r(e))}},function(e,t){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};e.exports=r},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(11),o=n(45);e.exports=n(10)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(5),o=n(17),i=n(16),a=n(59)("src"),u="toString",s=Function[u],c=(""+s).split(u);n(33).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,n,u){var s="function"==typeof n;s&&(i(n,"name")||o(n,"name",t)),e[t]!==n&&(s&&(i(n,a)||o(n,a,e[t]?""+e[t]:c.join(String(t)))),e===r?e[t]=n:u?e[t]?e[t]=n:o(e,t,n):(delete e[t],o(e,t,n)))})(Function.prototype,u,function(){return"function"==typeof this&&this[a]||s.call(this)})},function(e,t,n){var r=n(1),o=n(6),i=n(28),a=/"/g,u=function(e,t,n,r){var o=String(i(e)),u="<"+t;return""!==n&&(u+=" "+n+'="'+String(r).replace(a,""")+'"'),u+">"+o+"</"+t+">"};e.exports=function(e,t){var n={};n[e]=t(u),r(r.P+r.F*o(function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}),"String",n)}},function(e,t,n){var r=n(70),o=n(28);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(71),o=n(45),i=n(21),a=n(35),u=n(16),s=n(185),c=Object.getOwnPropertyDescriptor;t.f=n(10)?c:function(e,t){if(e=i(e),t=a(t,!0),s)try{return c(e,t)}catch(n){}return u(e,t)?o(!r.f.call(e,t),e[t]):void 0}},function(e,t,n){var r=n(16),o=n(14),i=n(130)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=o(e),r(e,i)?e[i]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},function(e,t,n){(function(t){var r=n(510),o=r("object"==typeof t&&t),i=r("object"==typeof self&&self),a=r("object"==typeof this&&this),u=o||i||a||Function("return this")();e.exports=u}).call(t,function(){return this}())},function(e,t,n){"use strict";var r=n(612);e.exports={debugTool:r}},function(e,t,n){"use strict";e.exports=n(592)},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(6);e.exports=function(e,t){return!!e&&r(function(){t?e.call(null,function(){},1):e.call(null)})}},function(e,t){"use strict";function n(e){return function(){return e}}function r(){}r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";var r=n(9),o=n(50),i=(n(4),n(164),"function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103),a={key:!0,ref:!0,__self:!0,__source:!0},u=function(e,t,n,r,o,a,u){var s={$$typeof:i,type:e,key:t,ref:n,props:u,_owner:a};return s};u.createElement=function(e,t,n){var r,i={},s=null,c=null,l=null,p=null;if(null!=t){c=void 0===t.ref?null:t.ref,s=void 0===t.key?null:""+t.key,l=void 0===t.__self?null:t.__self,p=void 0===t.__source?null:t.__source;for(r in t)t.hasOwnProperty(r)&&!a.hasOwnProperty(r)&&(i[r]=t[r])}var f=arguments.length-2;if(1===f)i.children=n;else if(f>1){for(var d=Array(f),h=0;f>h;h++)d[h]=arguments[h+2];i.children=d}if(e&&e.defaultProps){var v=e.defaultProps;for(r in v)void 0===i[r]&&(i[r]=v[r])}return u(e,s,c,l,p,o.current,i)},u.createFactory=function(e){var t=u.createElement.bind(null,e);return t.type=e,t},u.cloneAndReplaceKey=function(e,t){var n=u(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n},u.cloneElement=function(e,t,n){var i,s=r({},e.props),c=e.key,l=e.ref,p=e._self,f=e._source,d=e._owner;if(null!=t){void 0!==t.ref&&(l=t.ref,d=o.current),void 0!==t.key&&(c=""+t.key);var h;e.type&&e.type.defaultProps&&(h=e.type.defaultProps);for(i in t)t.hasOwnProperty(i)&&!a.hasOwnProperty(i)&&(void 0===t[i]&&void 0!==h?s[i]=h[i]:s[i]=t[i])}var v=arguments.length-2;if(1===v)s.children=n;else if(v>1){for(var m=Array(v),y=0;v>y;y++)m[y]=arguments[y+2];s.children=m}return u(e.type,c,l,p,f,d,s)},u.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===i},e.exports=u},function(e,t,n){var r=n(38),o=n(70),i=n(14),a=n(13),u=n(294);e.exports=function(e,t){var n=1==e,s=2==e,c=3==e,l=4==e,p=6==e,f=5==e||p,d=t||u;return function(t,u,h){for(var v,m,y=i(t),g=o(y),b=r(u,h,3),_=a(g.length),x=0,E=n?d(t,_):s?d(t,0):void 0;_>x;x++)if((f||x in g)&&(v=g[x],m=b(v,x,y),e))if(n)E[x]=m;else if(m)switch(e){case 3:return!0;case 5:return v;case 6:return x;case 2:E.push(v)}else if(l)return!1;return p?-1:c||l?l:E}}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(1),o=n(33),i=n(6);e.exports=function(e,t){var n=(o.Object||{})[e]||Object[e],a={};a[e]=t(n),r(r.S+r.F*i(function(){n(1)}),"Object",a)}},function(e,t,n){var r=n(7);e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){"use strict";function r(){O.ReactReconcileTransaction&&x?void 0:m(!1)}function o(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=p.getPooled(),this.reconcileTransaction=O.ReactReconcileTransaction.getPooled(!0)}function i(e,t,n,o,i,a){r(),x.batchedUpdates(e,t,n,o,i,a)}function a(e,t){return e._mountOrder-t._mountOrder}function u(e){var t=e.dirtyComponentsLength;t!==y.length?m(!1):void 0,y.sort(a),g++;for(var n=0;t>n;n++){var r=y[n],o=r._pendingCallbacks;r._pendingCallbacks=null;var i;if(d.logTopLevelRenders){var u=r;r._currentElement.props===r._renderedComponent._currentElement&&(u=r._renderedComponent),i="React update: "+u.getName(),console.time(i)}if(h.performUpdateIfNecessary(r,e.reconcileTransaction,g),i&&console.timeEnd(i),o)for(var s=0;s<o.length;s++)e.callbackQueue.enqueue(o[s],r.getPublicInstance())}}function s(e){return r(),x.isBatchingUpdates?(y.push(e),void(null==e._updateBatchNumber&&(e._updateBatchNumber=g+1))):void x.batchedUpdates(s,e)}function c(e,t){x.isBatchingUpdates?void 0:m(!1),b.enqueue(e,t),_=!0}var l=n(9),p=n(246),f=n(49),d=n(256),h=(n(25),n(69)),v=n(113),m=n(2),y=[],g=0,b=p.getPooled(),_=!1,x=null,E={initialize:function(){this.dirtyComponentsLength=y.length},close:function(){this.dirtyComponentsLength!==y.length?(y.splice(0,this.dirtyComponentsLength),P()):y.length=0}},w={initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}},C=[E,w];l(o.prototype,v.Mixin,{getTransactionWrappers:function(){return C},destructor:function(){this.dirtyComponentsLength=null,p.release(this.callbackQueue),this.callbackQueue=null,O.ReactReconcileTransaction.release(this.reconcileTransaction),this.reconcileTransaction=null},perform:function(e,t,n){return v.Mixin.perform.call(this,this.reconcileTransaction.perform,this.reconcileTransaction,e,t,n)}}),f.addPoolingTo(o);var P=function(){for(;y.length||_;){if(y.length){var e=o.getPooled();e.perform(u,null,e),o.release(e)}if(_){_=!1;var t=b;b=p.getPooled(),t.notifyAll(),p.release(t)}}},S={injectReconcileTransaction:function(e){e?void 0:m(!1),O.ReactReconcileTransaction=e},injectBatchingStrategy:function(e){e?void 0:m(!1),"function"!=typeof e.batchedUpdates?m(!1):void 0,"boolean"!=typeof e.isBatchingUpdates?m(!1):void 0,x=e}},O={ReactReconcileTransaction:null,batchedUpdates:i,enqueueUpdate:s,flushBatchedUpdates:P,injection:S,asap:c};e.exports=O},function(e,t,n){var r=n(18);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(200),o=n(1),i=n(90)("metadata"),a=i.store||(i.store=new(n(203))),u=function(e,t,n){var o=a.get(e);if(!o){if(!n)return;a.set(e,o=new r)}var i=o.get(t);if(!i){if(!n)return;o.set(t,i=new r)}return i},s=function(e,t,n){var r=u(t,n,!1);return void 0===r?!1:r.has(e)},c=function(e,t,n){var r=u(t,n,!1);return void 0===r?void 0:r.get(e)},l=function(e,t,n,r){u(n,r,!0).set(e,t)},p=function(e,t){var n=u(e,t,!1),r=[];return n&&n.forEach(function(e,t){r.push(t)}),r},f=function(e){return void 0===e||"symbol"==typeof e?e:String(e)},d=function(e){o(o.S,"Reflect",e)};e.exports={store:a,map:u,has:s,get:c,set:l,keys:p,key:f,exp:d}},function(e,t,n){"use strict";if(n(10)){var r=n(52),o=n(5),i=n(6),a=n(1),u=n(91),s=n(137),c=n(38),l=n(43),p=n(45),f=n(17),d=n(56),h=(n(124),n(46)),v=n(13),m=n(58),y=n(35),g=n(16),b=n(197),_=n(63),x=n(7),E=n(14),w=n(122),C=n(53),P=n(23),S=n(54).f,O=(n(301),n(139)),T=n(59),A=n(8),M=n(32),k=n(80),N=n(131),R=n(140),I=n(51),j=n(86),D=n(57),F=n(115),L=n(178),U=n(11),V=n(22),B=U.f,W=V.f,q=o.RangeError,H=o.TypeError,Y=o.Uint8Array,z="ArrayBuffer",K="Shared"+z,G="BYTES_PER_ELEMENT",$="prototype",X=Array[$],Q=s.ArrayBuffer,Z=s.DataView,J=M(0),ee=M(2),te=M(3),ne=M(4),re=M(5),oe=M(6),ie=k(!0),ae=k(!1),ue=R.values,se=R.keys,ce=R.entries,le=X.lastIndexOf,pe=X.reduce,fe=X.reduceRight,de=X.join,he=X.sort,ve=X.slice,me=X.toString,ye=X.toLocaleString,ge=A("iterator"),be=A("toStringTag"),_e=T("typed_constructor"),xe=T("def_constructor"),Ee=u.CONSTR,we=u.TYPED,Ce=u.VIEW,Pe="Wrong length!",Se=M(1,function(e,t){return Ne(N(e,e[xe]),t)}),Oe=i(function(){return 1===new Y(new Uint16Array([1]).buffer)[0]}),Te=!!Y&&!!Y[$].set&&i(function(){new Y(1).set({})}),Ae=function(e,t){if(void 0===e)throw H(Pe);var n=+e,r=v(e);if(t&&!b(n,r))throw q(Pe);return r},Me=function(e,t){var n=h(e);if(0>n||n%t)throw q("Wrong offset!");return n},ke=function(e){if(x(e)&&we in e)return e;throw H(e+" is not a typed array!")},Ne=function(e,t){if(!(x(e)&&_e in e))throw H("It is not a typed array constructor!");return new e(t)},Re=function(e,t){return Ie(N(e,e[xe]),t)},Ie=function(e,t){for(var n=0,r=t.length,o=Ne(e,r);r>n;)o[n]=t[n++];return o},je=function(e,t,n){B(e,t,{get:function(){return this._d[n]}})},De=function(e){var t,n,r,o,i,a,u=E(e),s=arguments.length,l=s>1?arguments[1]:void 0,p=void 0!==l,f=O(u);if(void 0!=f&&!w(f)){for(a=f.call(u),r=[],t=0;!(i=a.next()).done;t++)r.push(i.value);u=r}for(p&&s>2&&(l=c(l,arguments[2],2)),t=0,n=v(u.length),o=Ne(this,n);n>t;t++)o[t]=p?l(u[t],t):u[t];return o},Fe=function(){for(var e=0,t=arguments.length,n=Ne(this,t);t>e;)n[e]=arguments[e++];return n},Le=!!Y&&i(function(){ye.call(new Y(1))}),Ue=function(){return ye.apply(Le?ve.call(ke(this)):ke(this),arguments)},Ve={copyWithin:function(e,t){return L.call(ke(this),e,t,arguments.length>2?arguments[2]:void 0)},every:function(e){return ne(ke(this),e,arguments.length>1?arguments[1]:void 0)},fill:function(e){return F.apply(ke(this),arguments)},filter:function(e){return Re(this,ee(ke(this),e,arguments.length>1?arguments[1]:void 0))},find:function(e){return re(ke(this),e,arguments.length>1?arguments[1]:void 0)},findIndex:function(e){return oe(ke(this),e,arguments.length>1?arguments[1]:void 0)},forEach:function(e){J(ke(this),e,arguments.length>1?arguments[1]:void 0)},indexOf:function(e){return ae(ke(this),e,arguments.length>1?arguments[1]:void 0)},includes:function(e){return ie(ke(this),e,arguments.length>1?arguments[1]:void 0)},join:function(e){return de.apply(ke(this),arguments)},lastIndexOf:function(e){return le.apply(ke(this),arguments)},map:function(e){return Se(ke(this),e,arguments.length>1?arguments[1]:void 0)},reduce:function(e){return pe.apply(ke(this),arguments)},reduceRight:function(e){return fe.apply(ke(this),arguments)},reverse:function(){for(var e,t=this,n=ke(t).length,r=Math.floor(n/2),o=0;r>o;)e=t[o],t[o++]=t[--n],t[n]=e;return t},some:function(e){return te(ke(this),e,arguments.length>1?arguments[1]:void 0)},sort:function(e){return he.call(ke(this),e)},subarray:function(e,t){var n=ke(this),r=n.length,o=m(e,r);return new(N(n,n[xe]))(n.buffer,n.byteOffset+o*n.BYTES_PER_ELEMENT,v((void 0===t?r:m(t,r))-o))}},Be=function(e,t){return Re(this,ve.call(ke(this),e,t))},We=function(e){ke(this);var t=Me(arguments[1],1),n=this.length,r=E(e),o=v(r.length),i=0;if(o+t>n)throw q(Pe);for(;o>i;)this[t+i]=r[i++]},qe={entries:function(){return ce.call(ke(this))},keys:function(){return se.call(ke(this))},values:function(){return ue.call(ke(this))}},He=function(e,t){return x(e)&&e[we]&&"symbol"!=typeof t&&t in e&&String(+t)==String(t)},Ye=function(e,t){return He(e,t=y(t,!0))?p(2,e[t]):W(e,t)},ze=function(e,t,n){return!(He(e,t=y(t,!0))&&x(n)&&g(n,"value"))||g(n,"get")||g(n,"set")||n.configurable||g(n,"writable")&&!n.writable||g(n,"enumerable")&&!n.enumerable?B(e,t,n):(e[t]=n.value,e)};Ee||(V.f=Ye,U.f=ze),a(a.S+a.F*!Ee,"Object",{getOwnPropertyDescriptor:Ye,defineProperty:ze}),i(function(){me.call({})})&&(me=ye=function(){return de.call(this)});var Ke=d({},Ve);d(Ke,qe),f(Ke,ge,qe.values),d(Ke,{slice:Be,set:We,constructor:function(){},toString:me,toLocaleString:Ue}),je(Ke,"buffer","b"),je(Ke,"byteOffset","o"),je(Ke,"byteLength","l"),je(Ke,"length","e"),B(Ke,be,{get:function(){return this[we]}}),e.exports=function(e,t,n,s){s=!!s;var c=e+(s?"Clamped":"")+"Array",p="Uint8Array"!=c,d="get"+e,h="set"+e,m=o[c],y=m||{},g=m&&P(m),b=!m||!u.ABV,E={},w=m&&m[$],O=function(e,n){var r=e._d;return r.v[d](n*t+r.o,Oe)},T=function(e,n,r){var o=e._d;s&&(r=(r=Math.round(r))<0?0:r>255?255:255&r),o.v[h](n*t+o.o,r,Oe)},A=function(e,t){B(e,t,{get:function(){return O(this,t)},set:function(e){return T(this,t,e)},enumerable:!0})};b?(m=n(function(e,n,r,o){l(e,m,c,"_d");var i,a,u,s,p=0,d=0;if(x(n)){if(!(n instanceof Q||(s=_(n))==z||s==K))return we in n?Ie(m,n):De.call(m,n);i=n,d=Me(r,t);var h=n.byteLength;if(void 0===o){if(h%t)throw q(Pe);if(a=h-d,0>a)throw q(Pe)}else if(a=v(o)*t,a+d>h)throw q(Pe);u=a/t}else u=Ae(n,!0),a=u*t,i=new Q(a);for(f(e,"_d",{b:i,o:d,l:a,e:u,v:new Z(i)});u>p;)A(e,p++)}),w=m[$]=C(Ke),f(w,"constructor",m)):j(function(e){new m(null),new m(e)},!0)||(m=n(function(e,n,r,o){l(e,m,c);var i;return x(n)?n instanceof Q||(i=_(n))==z||i==K?void 0!==o?new y(n,Me(r,t),o):void 0!==r?new y(n,Me(r,t)):new y(n):we in n?Ie(m,n):De.call(m,n):new y(Ae(n,p))}),J(g!==Function.prototype?S(y).concat(S(g)):S(y),function(e){e in m||f(m,e,y[e])}),m[$]=w,r||(w.constructor=m));var M=w[ge],k=!!M&&("values"==M.name||void 0==M.name),N=qe.values;f(m,_e,!0),f(w,we,c),f(w,Ce,!0),f(w,xe,m),(s?new m(1)[be]==c:be in w)||B(w,be,{get:function(){return c}}),E[c]=m,a(a.G+a.W+a.F*(m!=y),E),a(a.S,c,{BYTES_PER_ELEMENT:t,from:De,of:Fe}),G in w||f(w,G,t),a(a.P,c,Ve),D(c),a(a.P+a.F*Te,c,{set:We}),a(a.P+a.F*!k,c,qe),a(a.P+a.F*(w.toString!=me),c,{toString:me}),a(a.P+a.F*i(function(){new m(1).slice()}),c,{slice:Be}),a(a.P+a.F*(i(function(){return[1,2].toLocaleString()!=new m([1,2]).toLocaleString()})||!i(function(){w.toLocaleString.call([1,2])})),c,{toLocaleString:Ue}),I[c]=k?M:N,r||k||f(w,ge,N)}}else e.exports=function(){}},function(e,t,n){"use strict";var r=n(93),o=r({bubbled:null,captured:null}),i=r({topAbort:null,topAnimationEnd:null,topAnimationIteration:null,topAnimationStart:null,topBlur:null,topCanPlay:null,topCanPlayThrough:null,topChange:null,topClick:null,topCompositionEnd:null,topCompositionStart:null,topCompositionUpdate:null,topContextMenu:null,topCopy:null,topCut:null,topDoubleClick:null,topDrag:null,topDragEnd:null,topDragEnter:null,topDragExit:null,topDragLeave:null,topDragOver:null,topDragStart:null,topDrop:null,topDurationChange:null,topEmptied:null,topEncrypted:null,topEnded:null,topError:null,topFocus:null,topInput:null,topInvalid:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topLoad:null,topLoadedData:null,topLoadedMetadata:null,topLoadStart:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topPaste:null,topPause:null,topPlay:null,topPlaying:null,topProgress:null,topRateChange:null,topReset:null,topScroll:null,topSeeked:null,topSeeking:null,topSelectionChange:null,topStalled:null,topSubmit:null,topSuspend:null,topTextInput:null,topTimeUpdate:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topTransitionEnd:null,topVolumeChange:null,topWaiting:null,topWheel:null}),a={topLevelTypes:i,PropagationPhases:o};e.exports=a},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var o=this.constructor.Interface;for(var i in o)if(o.hasOwnProperty(i)){var u=o[i];u?this[i]=u(n):"target"===i?this.target=r:this[i]=n[i]}var s=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;return s?this.isDefaultPrevented=a.thatReturnsTrue:this.isDefaultPrevented=a.thatReturnsFalse,this.isPropagationStopped=a.thatReturnsFalse,this}var o=n(9),i=n(49),a=n(30),u=(n(4),"function"==typeof Proxy,["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),s={type:null,target:null,currentTarget:a.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};o(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1,this.isDefaultPrevented=a.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this.isPropagationStopped=a.thatReturnsTrue)},persist:function(){this.isPersistent=a.thatReturnsTrue},isPersistent:a.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n<u.length;n++)this[u[n]]=null}}),r.Interface=s,r.augmentClass=function(e,t){var n=this,r=function(){};r.prototype=n.prototype;var a=new r;o(a,e.prototype),e.prototype=a,e.prototype.constructor=e,e.Interface=o({},n.Interface,t),e.augmentClass=n.augmentClass,i.addPoolingTo(e,i.fourArgumentPooler)},i.addPoolingTo(r,i.fourArgumentPooler),e.exports=r},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var r=n(59)("meta"),o=n(7),i=n(16),a=n(11).f,u=0,s=Object.isExtensible||function(){return!0},c=!n(6)(function(){return s(Object.preventExtensions({}))}),l=function(e){a(e,r,{value:{i:"O"+ ++u,w:{}}})},p=function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,r)){if(!s(e))return"F";if(!t)return"E";l(e)}return e[r].i},f=function(e,t){if(!i(e,r)){if(!s(e))return!0;if(!t)return!1;l(e)}return e[r].w},d=function(e){return c&&h.NEED&&s(e)&&!i(e,r)&&l(e),e},h=e.exports={KEY:r,NEED:!1,fastKey:p,getWeak:f,onFreeze:d}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){"use strict";var n=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};e.exports=n},function(e,t){function n(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=n},function(e,t,n){"use strict";var r=n(2),o=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)},i=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},a=function(e,t,n){var r=this;if(r.instancePool.length){var o=r.instancePool.pop();return r.call(o,e,t,n),o}return new r(e,t,n)},u=function(e,t,n,r){var o=this;if(o.instancePool.length){var i=o.instancePool.pop();return o.call(i,e,t,n,r),i}return new o(e,t,n,r)},s=function(e,t,n,r,o){var i=this;if(i.instancePool.length){var a=i.instancePool.pop();return i.call(a,e,t,n,r,o),a}return new i(e,t,n,r,o)},c=function(e){var t=this;e instanceof t?void 0:r(!1),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},l=10,p=o,f=function(e,t){var n=e;return n.instancePool=[],n.getPooled=t||p,n.poolSize||(n.poolSize=l),n.release=c,n},d={addPoolingTo:f,oneArgumentPooler:o,twoArgumentPooler:i,threeArgumentPooler:a,fourArgumentPooler:u,fiveArgumentPooler:s};e.exports=d},function(e,t){"use strict";var n={current:null};e.exports=n},function(e,t){e.exports={}},function(e,t){e.exports=!1},function(e,t,n){var r=n(3),o=n(190),i=n(118),a=n(130)("IE_PROTO"),u=function(){},s="prototype",c=function(){var e,t=n(117)("iframe"),r=i.length,o=">";for(t.style.display="none",n(120).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("<script>document.F=Object</script"+o),e.close(),c=e.F;r--;)delete c[s][i[r]];return c()};e.exports=Object.create||function(e,t){var n;return null!==e?(u[s]=r(e),n=new u,u[s]=null,n[a]=e):n=c(),void 0===t?n:o(n,t)}},function(e,t,n){var r=n(192),o=n(118).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},function(e,t,n){var r=n(192),o=n(118);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(19);e.exports=function(e,t,n){for(var o in t)r(e,o,t[o],n);return e}},function(e,t,n){"use strict";var r=n(5),o=n(11),i=n(10),a=n(8)("species");e.exports=function(e){var t=r[e];i&&t&&!t[a]&&o.f(t,a,{configurable:!0,get:function(){return this}})}},function(e,t,n){var r=n(46),o=Math.max,i=Math.min;e.exports=function(e,t){return e=r(e),0>e?o(e+t,0):i(e,t)}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t){function n(e){return!!e&&"object"==typeof e}e.exports=n},function(e,t,n){"use strict";function r(e,t){return(e&t)===t}var o=n(2),i={MUST_USE_PROPERTY:1,HAS_SIDE_EFFECTS:2,HAS_BOOLEAN_VALUE:4,HAS_NUMERIC_VALUE:8,HAS_POSITIVE_NUMERIC_VALUE:24,HAS_OVERLOADED_BOOLEAN_VALUE:32,injectDOMPropertyConfig:function(e){var t=i,n=e.Properties||{},a=e.DOMAttributeNamespaces||{},s=e.DOMAttributeNames||{},c=e.DOMPropertyNames||{},l=e.DOMMutationMethods||{};e.isCustomAttribute&&u._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var p in n){u.properties.hasOwnProperty(p)?o(!1):void 0;var f=p.toLowerCase(),d=n[p],h={attributeName:f,attributeNamespace:null,propertyName:p,mutationMethod:null,mustUseProperty:r(d,t.MUST_USE_PROPERTY),hasSideEffects:r(d,t.HAS_SIDE_EFFECTS),hasBooleanValue:r(d,t.HAS_BOOLEAN_VALUE),hasNumericValue:r(d,t.HAS_NUMERIC_VALUE),hasPositiveNumericValue:r(d,t.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:r(d,t.HAS_OVERLOADED_BOOLEAN_VALUE)};if(!h.mustUseProperty&&h.hasSideEffects?o(!1):void 0,h.hasBooleanValue+h.hasNumericValue+h.hasOverloadedBooleanValue<=1?void 0:o(!1),s.hasOwnProperty(p)){var v=s[p];h.attributeName=v}a.hasOwnProperty(p)&&(h.attributeNamespace=a[p]),c.hasOwnProperty(p)&&(h.propertyName=c[p]),l.hasOwnProperty(p)&&(h.mutationMethod=l[p]),u.properties[p]=h}}},a=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",u={ID_ATTRIBUTE_NAME:"data-reactid",ROOT_ATTRIBUTE_NAME:"data-reactroot",ATTRIBUTE_NAME_START_CHAR:a,ATTRIBUTE_NAME_CHAR:a+"\\-.0-9\\uB7\\u0300-\\u036F\\u203F-\\u2040",properties:{},getPossibleStandardName:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t<u._isCustomAttributeFunctions.length;t++){var n=u._isCustomAttributeFunctions[t];if(n(e))return!0}return!1},injection:i};e.exports=u},function(e,t,n){var r=n(8)("unscopables"),o=Array.prototype;void 0==o[r]&&n(17)(o,r,{}),e.exports=function(e){o[r][e]=!0}},function(e,t,n){var r=n(27),o=n(8)("toStringTag"),i="Arguments"==r(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(n){}};e.exports=function(e){var t,n,u;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=a(t=Object(e),o))?n:i?r(t):"Object"==(u=r(t))&&"function"==typeof t.callee?"Arguments":u}},function(e,t,n){var r=n(38),o=n(186),i=n(122),a=n(3),u=n(13),s=n(139),c={},l={},t=e.exports=function(e,t,n,p,f){var d,h,v,m,y=f?function(){return e}:s(e),g=r(n,p,t?2:1),b=0;if("function"!=typeof y)throw TypeError(e+" is not iterable!");if(i(y)){for(d=u(e.length);d>b;b++)if(m=t?g(a(h=e[b])[0],h[1]):g(e[b]),m===c||m===l)return m}else for(v=y.call(e);!(h=v.next()).done;)if(m=o(v,g,h.value,t),m===c||m===l)return m};t.BREAK=c,t.RETURN=l},function(e,t,n){var r=n(11).f,o=n(16),i=n(8)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){var r=n(1),o=n(28),i=n(6),a=n(135),u="["+a+"]",s="
",c=RegExp("^"+u+u+"*"),l=RegExp(u+u+"*$"),p=function(e,t,n){var o={},u=i(function(){return!!a[e]()||s[e]()!=s}),c=o[e]=u?t(f):a[e];n&&(o[n]=c),r(r.P+r.F*u,"String",o)},f=p.trim=function(e,t){return e=String(o(e)),1&t&&(e=e.replace(c,"")),2&t&&(e=e.replace(l,"")),e};e.exports=p},function(e,t,n){function r(e,t){var n=i(e,t);return o(n)?n:void 0}var o=n(502),i=n(524);e.exports=r},function(e,t,n){"use strict";function r(e){if(v){var t=e.node,n=e.children;if(n.length)for(var r=0;r<n.length;r++)m(t,n[r],null);else null!=e.html?t.innerHTML=e.html:null!=e.text&&f(t,e.text)}}function o(e,t){e.parentNode.replaceChild(t.node,e),r(t)}function i(e,t){v?e.children.push(t):e.node.appendChild(t.node)}function a(e,t){v?e.html=t:e.node.innerHTML=t}function u(e,t){v?e.text=t:f(e.node,t)}function s(){return this.node.nodeName}function c(e){return{node:e,children:[],html:null,text:null,toString:s}}var l=n(247),p=n(165),f=n(273),d=1,h=11,v="undefined"!=typeof document&&"number"==typeof document.documentMode||"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent&&/\bEdge\/\d/.test(navigator.userAgent),m=p(function(e,t,n){t.node.nodeType===h||t.node.nodeType===d&&"object"===t.node.nodeName.toLowerCase()&&(null==t.node.namespaceURI||t.node.namespaceURI===l.html)?(r(t),e.insertBefore(t.node,n)):(e.insertBefore(t.node,n),r(t))});c.insertTreeBefore=m,c.replaceChildWithTree=o,c.queueChild=i,c.queueHTML=a,c.queueText=u,e.exports=c},function(e,t,n){"use strict";function r(){o.attachRefs(this,this._currentElement)}var o=n(622),i=(n(25),n(2)),a={mountComponent:function(e,t,n,o,i){var a=e.mountComponent(t,n,o,i);return e._currentElement&&null!=e._currentElement.ref&&t.getReactMountReady().enqueue(r,e),a},getNativeNode:function(e){return e.getNativeNode()},unmountComponent:function(e,t){o.detachRefs(e,e._currentElement),e.unmountComponent(t)},receiveComponent:function(e,t,n,i){var a=e._currentElement;if(t!==a||i!==e._context){var u=o.shouldUpdateRefs(a,t);u&&o.detachRefs(e,a),e.receiveComponent(t,n,i),u&&e._currentElement&&null!=e._currentElement.ref&&n.getReactMountReady().enqueue(r,e)}},performUpdateIfNecessary:function(e,t,n){return e._updateBatchNumber!==n?void(null!=e._updateBatchNumber&&e._updateBatchNumber!==n+1?i(!1):void 0):void e.performUpdateIfNecessary(t)}};e.exports=a},function(e,t,n){var r=n(27);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t){t.f={}.propertyIsEnumerable;
},function(e,t){function n(e,t){for(var n=-1,o=e.length,i=0,a=[];++n<o;){var u=e[n];u!==t&&u!==r||(e[n]=r,a[i++]=n)}return a}var r="__lodash_placeholder__";e.exports=n},function(e,t,n){function r(e){if("string"==typeof e||o(e))return e;var t=e+"";return"0"==t&&1/e==-i?"-0":t}var o=n(74),i=1/0;e.exports=r},function(e,t,n){function r(e){return"symbol"==typeof e||o(e)&&u.call(e)==i}var o=n(60),i="[object Symbol]",a=Object.prototype,u=a.toString;e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0,t.connect=t.Provider=void 0;var o=n(579),i=r(o),a=n(580),u=r(a);t.Provider=i["default"],t.connect=u["default"]},function(e,t,n){"use strict";var r=n(108),o=n(158),i=n(162),a=n(267),u=n(268),s=n(2),c={},l=null,p=function(e,t){e&&(o.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e))},f=function(e){return p(e,!0)},d=function(e){return p(e,!1)},h={injection:{injectEventPluginOrder:r.injectEventPluginOrder,injectEventPluginsByName:r.injectEventPluginsByName},putListener:function(e,t,n){"function"!=typeof n?s(!1):void 0;var o=c[t]||(c[t]={});o[e._rootNodeID]=n;var i=r.registrationNameModules[t];i&&i.didPutListener&&i.didPutListener(e,t,n)},getListener:function(e,t){var n=c[t];return n&&n[e._rootNodeID]},deleteListener:function(e,t){var n=r.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t);var o=c[t];o&&delete o[e._rootNodeID]},deleteAllListeners:function(e){for(var t in c)if(c[t][e._rootNodeID]){var n=r.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t),delete c[t][e._rootNodeID]}},extractEvents:function(e,t,n,o){for(var i,u=r.plugins,s=0;s<u.length;s++){var c=u[s];if(c){var l=c.extractEvents(e,t,n,o);l&&(i=a(i,l))}}return i},enqueueEvents:function(e){e&&(l=a(l,e))},processEventQueue:function(e){var t=l;l=null,e?u(t,f):u(t,d),l?s(!1):void 0,i.rethrowCaughtError()},__purge:function(){c={}},__getListenerBank:function(){return c}};e.exports=h},function(e,t,n){"use strict";function r(e,t,n){var r=t.dispatchConfig.phasedRegistrationNames[n];return b(e,r)}function o(e,t,n){var o=t?g.bubbled:g.captured,i=r(e,n,o);i&&(n._dispatchListeners=m(n._dispatchListeners,i),n._dispatchInstances=m(n._dispatchInstances,e))}function i(e){e&&e.dispatchConfig.phasedRegistrationNames&&v.traverseTwoPhase(e._targetInst,o,e)}function a(e){if(e&&e.dispatchConfig.phasedRegistrationNames){var t=e._targetInst,n=t?v.getParentInstance(t):null;v.traverseTwoPhase(n,o,e)}}function u(e,t,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,o=b(e,r);o&&(n._dispatchListeners=m(n._dispatchListeners,o),n._dispatchInstances=m(n._dispatchInstances,e))}}function s(e){e&&e.dispatchConfig.registrationName&&u(e._targetInst,null,e)}function c(e){y(e,i)}function l(e){y(e,a)}function p(e,t,n,r){v.traverseEnterLeave(n,r,u,e,t)}function f(e){y(e,s)}var d=n(41),h=n(76),v=n(158),m=n(267),y=n(268),g=(n(4),d.PropagationPhases),b=h.getListener,_={accumulateTwoPhaseDispatches:c,accumulateTwoPhaseDispatchesSkipTarget:l,accumulateDirectDispatches:f,accumulateEnterLeaveDispatches:p};e.exports=_},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(42),i=n(168),a={view:function(e){if(e.view)return e.view;var t=i(e);if(null!=t&&t.window===t)return t;var n=t.ownerDocument;return n?n.defaultView||n.parentWindow:window},detail:function(e){return e.detail||0}};o.augmentClass(r,a),e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(569),i=r(o),a=n(674),u=r(a),s=n(282),c=r(s),l=n(673),p=r(l),f=n(671),d=r(f),h=n(672),v=r(h),m={empty:{},getIn:c["default"],setIn:p["default"],deepEqual:d["default"],deleteIn:v["default"],fromJS:function(e){return e},size:function(e){return e?e.length:0},some:i["default"],splice:u["default"]};t["default"]=m},function(e,t,n){var r=n(21),o=n(13),i=n(58);e.exports=function(e){return function(t,n,a){var u,s=r(t),c=o(s.length),l=i(a,c);if(e&&n!=n){for(;c>l;)if(u=s[l++],u!=u)return!0}else for(;c>l;l++)if((e||l in s)&&s[l]===n)return e||l||0;return!e&&-1}}},function(e,t,n){"use strict";var r=n(5),o=n(1),i=n(19),a=n(56),u=n(44),s=n(64),c=n(43),l=n(7),p=n(6),f=n(86),d=n(65),h=n(121);e.exports=function(e,t,n,v,m,y){var g=r[e],b=g,_=m?"set":"add",x=b&&b.prototype,E={},w=function(e){var t=x[e];i(x,e,"delete"==e?function(e){return y&&!l(e)?!1:t.call(this,0===e?0:e)}:"has"==e?function(e){return y&&!l(e)?!1:t.call(this,0===e?0:e)}:"get"==e?function(e){return y&&!l(e)?void 0:t.call(this,0===e?0:e)}:"add"==e?function(e){return t.call(this,0===e?0:e),this}:function(e,n){return t.call(this,0===e?0:e,n),this})};if("function"==typeof b&&(y||x.forEach&&!p(function(){(new b).entries().next()}))){var C=new b,P=C[_](y?{}:-0,1)!=C,S=p(function(){C.has(1)}),O=f(function(e){new b(e)}),T=!y&&p(function(){for(var e=new b,t=5;t--;)e[_](t,t);return!e.has(-0)});O||(b=t(function(t,n){c(t,b,e);var r=h(new g,t,b);return void 0!=n&&s(n,m,r[_],r),r}),b.prototype=x,x.constructor=b),(S||T)&&(w("delete"),w("has"),m&&w("get")),(T||P)&&w(_),y&&x.clear&&delete x.clear}else b=v.getConstructor(t,e,m,_),a(b.prototype,n),u.NEED=!0;return d(b,e),E[e]=b,o(o.G+o.W+o.F*(b!=g),E),y||v.setStrong(b,e,m),b}},function(e,t,n){"use strict";var r=n(17),o=n(19),i=n(6),a=n(28),u=n(8);e.exports=function(e,t,n){var s=u(e),c=n(a,s,""[e]),l=c[0],p=c[1];i(function(){var t={};return t[s]=function(){return 7},7!=""[e](t)})&&(o(String.prototype,e,l),r(RegExp.prototype,s,2==t?function(e,t){return p.call(e,this,t)}:function(e){return p.call(e,this)}))}},function(e,t,n){"use strict";var r=n(3);e.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},function(e,t){e.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){var r=n(7),o=n(27),i=n(8)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==o(e))}},function(e,t,n){var r=n(8)("iterator"),o=!1;try{var i=[7][r]();i["return"]=function(){o=!0},Array.from(i,function(){throw 2})}catch(a){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i=[7],a=i[r]();a.next=function(){return{done:n=!0}},i[r]=function(){return a},e(i)}catch(u){}return n}},function(e,t,n){e.exports=n(52)||!n(6)(function(){var e=Math.random();__defineSetter__.call(null,e,function(){}),delete n(5)[e]})},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(7),o=n(3),i=function(e,t){if(o(e),!r(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{r=n(38)(Function.call,n(22).f(Object.prototype,"__proto__").set,2),r(e,[]),t=!(e instanceof Array)}catch(o){t=!0}return function(e,n){return i(e,n),t?e.__proto__=n:r(e,n),e}}({},!1):void 0),check:i}},function(e,t,n){var r=n(5),o="__core-js_shared__",i=r[o]||(r[o]={});e.exports=function(e){return i[e]||(i[e]={})}},function(e,t,n){for(var r,o=n(5),i=n(17),a=n(59),u=a("typed_array"),s=a("view"),c=!(!o.ArrayBuffer||!o.DataView),l=c,p=0,f=9,d="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");f>p;)(r=o[d[p++]])?(i(r.prototype,u,!0),i(r.prototype,s,!0)):l=!1;e.exports={ABV:c,CONSTR:l,TYPED:u,VIEW:s}},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){"use strict";var r=n(2),o=function(e){var t,n={};e instanceof Object&&!Array.isArray(e)?void 0:r(!1);for(t in e)e.hasOwnProperty(t)&&(n[t]=t);return n};e.exports=o},function(e,t,n){"use strict";var r=function(e,t,n,r,o,i,a,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,i,a,u],l=0;s=new Error(t.replace(/%s/g,function(){return c[l++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}};e.exports=r},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var o=n(537),i=n(538),a=n(539),u=n(540),s=n(541);r.prototype.clear=o,r.prototype["delete"]=i,r.prototype.get=a,r.prototype.has=u,r.prototype.set=s,e.exports=r},function(e,t,n){function r(e,t){for(var n=e.length;n--;)if(o(e[n][0],t))return n;return-1}var o=n(236);e.exports=r},function(e,t,n){function r(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=o(e.prototype),r=e.apply(n,t);return i(r)?r:n}}var o=n(146),i=n(48);e.exports=r},function(e,t){function n(e){var t=e;return t.placeholder}e.exports=n},function(e,t,n){function r(e,t){var n=e.__data__;return o(t)?n["string"==typeof t?"string":"hash"]:n.map}var o=n(533);e.exports=r},function(e,t){function n(e,t){return t=null==t?r:t,!!t&&("number"==typeof e||o.test(e))&&e>-1&&e%1==0&&t>e}var r=9007199254740991,o=/^(?:0|[1-9]\d*)$/;e.exports=n},function(e,t,n){function r(e,t){if(o(e))return!1;var n=typeof e;return"number"==n||"symbol"==n||"boolean"==n||null==e||i(e)?!0:u.test(e)||!a.test(e)||null!=t&&e in Object(t)}var o=n(36),i=n(74),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,u=/^\w*$/;e.exports=r},function(e,t,n){var r=n(67),o=r(Object,"create");e.exports=o},function(e,t,n){function r(e){return null!=e&&a(o(e))&&!i(e)}var o=n(521),i=n(151),a=n(104);e.exports=r},function(e,t){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&r>=e}var r=9007199254740991;e.exports=n},function(e,t,n){var r=n(226),o=n(98),i=n(72),a=n(241),u=32,s=a(function(e,t){var n=i(t,o(s));return r(e,u,void 0,t,n)});s.placeholder={},e.exports=s},function(e,t,n){function r(e){return a(e)?o(e,c):u(e)?[e]:i(s(e))}var o=n(496),i=n(149),a=n(36),u=n(74),s=n(234),c=n(73);e.exports=r},function(e,t){"use strict";var n={onClick:!0,onDoubleClick:!0,onMouseDown:!0,onMouseMove:!0,onMouseUp:!0,onClickCapture:!0,onDoubleClickCapture:!0,onMouseDownCapture:!0,onMouseMoveCapture:!0,onMouseUpCapture:!0},r={getNativeProps:function(e,t){if(!t.disabled)return t;var r={};for(var o in t)!n[o]&&t.hasOwnProperty(o)&&(r[o]=t[o]);return r}};e.exports=r},function(e,t,n){"use strict";function r(){if(u)for(var e in s){var t=s[e],n=u.indexOf(e);if(n>-1?void 0:a(!1),!c.plugins[n]){t.extractEvents?void 0:a(!1),c.plugins[n]=t;var r=t.eventTypes;for(var i in r)o(r[i],t,i)?void 0:a(!1)}}}function o(e,t,n){c.eventNameDispatchConfigs.hasOwnProperty(n)?a(!1):void 0,c.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var o in r)if(r.hasOwnProperty(o)){var u=r[o];i(u,t,n)}return!0}return e.registrationName?(i(e.registrationName,t,n),!0):!1}function i(e,t,n){c.registrationNameModules[e]?a(!1):void 0,c.registrationNameModules[e]=t,c.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var a=n(2),u=null,s={},c={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},possibleRegistrationNames:null,injectEventPluginOrder:function(e){u?a(!1):void 0,u=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var t=!1;for(var n in e)if(e.hasOwnProperty(n)){var o=e[n];s.hasOwnProperty(n)&&s[n]===o||(s[n]?a(!1):void 0,s[n]=o,t=!0)}t&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return c.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=c.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){u=null;for(var e in s)s.hasOwnProperty(e)&&delete s[e];c.plugins.length=0;var t=c.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=c.registrationNameModules;for(var o in r)r.hasOwnProperty(o)&&delete r[o]}};e.exports=c},function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,m)||(e[m]=h++,f[e[m]]={}),f[e[m]]}var o,i=n(9),a=n(41),u=n(108),s=n(615),c=n(266),l=n(643),p=n(170),f={},d=!1,h=0,v={topAbort:"abort",topAnimationEnd:l("animationend")||"animationend",topAnimationIteration:l("animationiteration")||"animationiteration",topAnimationStart:l("animationstart")||"animationstart",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topTransitionEnd:l("transitionend")||"transitionend",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},m="_reactListenersID"+String(Math.random()).slice(2),y=i({},s,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(y.handleTopLevel),y.ReactEventListener=e}},setEnabled:function(e){y.ReactEventListener&&y.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!y.ReactEventListener||!y.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,o=r(n),i=u.registrationNameDependencies[e],s=a.topLevelTypes,c=0;c<i.length;c++){var l=i[c];o.hasOwnProperty(l)&&o[l]||(l===s.topWheel?p("wheel")?y.ReactEventListener.trapBubbledEvent(s.topWheel,"wheel",n):p("mousewheel")?y.ReactEventListener.trapBubbledEvent(s.topWheel,"mousewheel",n):y.ReactEventListener.trapBubbledEvent(s.topWheel,"DOMMouseScroll",n):l===s.topScroll?p("scroll",!0)?y.ReactEventListener.trapCapturedEvent(s.topScroll,"scroll",n):y.ReactEventListener.trapBubbledEvent(s.topScroll,"scroll",y.ReactEventListener.WINDOW_HANDLE):l===s.topFocus||l===s.topBlur?(p("focus",!0)?(y.ReactEventListener.trapCapturedEvent(s.topFocus,"focus",n),y.ReactEventListener.trapCapturedEvent(s.topBlur,"blur",n)):p("focusin")&&(y.ReactEventListener.trapBubbledEvent(s.topFocus,"focusin",n),y.ReactEventListener.trapBubbledEvent(s.topBlur,"focusout",n)),o[s.topBlur]=!0,o[s.topFocus]=!0):v.hasOwnProperty(l)&&y.ReactEventListener.trapBubbledEvent(l,v[l],n),o[l]=!0)}},trapBubbledEvent:function(e,t,n){return y.ReactEventListener.trapBubbledEvent(e,t,n)},trapCapturedEvent:function(e,t,n){return y.ReactEventListener.trapCapturedEvent(e,t,n)},ensureScrollValueMonitoring:function(){if(void 0===o&&(o=document.createEvent&&"pageX"in document.createEvent("MouseEvent")),!o&&!d){var e=c.refreshScrollValues;y.ReactEventListener.monitorScrollValue(e),d=!0}}});e.exports=y},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){"use strict";var r=n(93),o=r({prop:null,context:null,childContext:null});e.exports=o},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(78),i=n(266),a=n(167),u={screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:a,button:function(e){var t=e.button;return"which"in e?t:2===t?2:4===t?1:0},buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},pageX:function(e){return"pageX"in e?e.pageX:e.clientX+i.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+i.currentScrollTop}};o.augmentClass(r,u),e.exports=r},function(e,t,n){"use strict";var r=n(2),o={reinitializeTransaction:function(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function(){return!!this._isInTransaction},perform:function(e,t,n,o,i,a,u,s){this.isInTransaction()?r(!1):void 0;var c,l;try{this._isInTransaction=!0,c=!0,this.initializeAll(0),l=e.call(t,n,o,i,a,u,s),c=!1}finally{try{if(c)try{this.closeAll(0)}catch(p){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return l},initializeAll:function(e){for(var t=this.transactionWrappers,n=e;n<t.length;n++){var r=t[n];try{this.wrapperInitData[n]=i.OBSERVED_ERROR,this.wrapperInitData[n]=r.initialize?r.initialize.call(this):null}finally{if(this.wrapperInitData[n]===i.OBSERVED_ERROR)try{this.initializeAll(n+1)}catch(o){}}}},closeAll:function(e){this.isInTransaction()?void 0:r(!1);for(var t=this.transactionWrappers,n=e;n<t.length;n++){var o,a=t[n],u=this.wrapperInitData[n];try{o=!0,u!==i.OBSERVED_ERROR&&a.close&&a.close.call(this,u),o=!1}finally{if(o)try{this.closeAll(n+1)}catch(s){}}}this.wrapperInitData.length=0}},i={Mixin:o,OBSERVED_ERROR:{}};e.exports=i},function(e,t){"use strict";function n(e){return o[e]}function r(e){return(""+e).replace(i,n)}var o={"&":"&",">":">","<":"<",'"':""","'":"'"},i=/[&><"']/g;e.exports=r},function(e,t,n){"use strict";var r=n(14),o=n(58),i=n(13);e.exports=function(e){for(var t=r(this),n=i(t.length),a=arguments.length,u=o(a>1?arguments[1]:void 0,n),s=a>2?arguments[2]:void 0,c=void 0===s?n:o(s,n);c>u;)t[u++]=e;return t}},function(e,t,n){"use strict";var r=n(11),o=n(45);e.exports=function(e,t,n){t in e?r.f(e,t,o(0,n)):e[t]=n}},function(e,t,n){var r=n(7),o=n(5).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(8)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,!"/./"[e](t)}catch(o){}}return!0}},function(e,t,n){e.exports=n(5).document&&document.documentElement},function(e,t,n){var r=n(7),o=n(89).set;e.exports=function(e,t,n){var i,a=t.constructor;return a!==n&&"function"==typeof a&&(i=a.prototype)!==n.prototype&&r(i)&&o&&o(e,i),e}},function(e,t,n){var r=n(51),o=n(8)("iterator"),i=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||i[o]===e)}},function(e,t,n){var r=n(27);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){var r=n(7),o=Math.floor;e.exports=function(e){return!r(e)&&isFinite(e)&&o(e)===e}},function(e,t,n){"use strict";var r=n(53),o=n(45),i=n(65),a={};n(17)(a,n(8)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(a,{next:o(1,n)}),i(e,t+" Iterator")}},function(e,t,n){"use strict";var r=n(52),o=n(1),i=n(19),a=n(17),u=n(16),s=n(51),c=n(125),l=n(65),p=n(23),f=n(8)("iterator"),d=!([].keys&&"next"in[].keys()),h="@@iterator",v="keys",m="values",y=function(){return this};e.exports=function(e,t,n,g,b,_,x){c(n,t,g);var E,w,C,P=function(e){if(!d&&e in A)return A[e];switch(e){case v:return function(){return new n(this,e)};case m:return function(){return new n(this,e)}}return function(){return new n(this,e)}},S=t+" Iterator",O=b==m,T=!1,A=e.prototype,M=A[f]||A[h]||b&&A[b],k=M||P(b),N=b?O?P("entries"):k:void 0,R="Array"==t?A.entries||M:M;if(R&&(C=p(R.call(new e)),C!==Object.prototype&&(l(C,S,!0),r||u(C,f)||a(C,f,y))),O&&M&&M.name!==m&&(T=!0,k=function(){return M.call(this)}),r&&!x||!d&&!T&&A[f]||a(A,f,k),s[t]=k,s[S]=y,b)if(E={values:O?k:P(m),keys:_?k:P(v),entries:N},x)for(w in E)w in A||i(A,w,E[w]);else o(o.P+o.F*(d||T),t,E);return E}},function(e,t){var n=Math.expm1;e.exports=!n||n(10)>22025.465794806718||n(10)<22025.465794806718||-2e-17!=n(-2e-17)?function(e){return 0==(e=+e)?e:e>-1e-6&&1e-6>e?e+e*e/2:Math.exp(e)-1}:n},function(e,t){e.exports=Math.sign||function(e){return 0==(e=+e)||e!=e?e:0>e?-1:1}},function(e,t,n){var r=n(5),o=n(136).set,i=r.MutationObserver||r.WebKitMutationObserver,a=r.process,u=r.Promise,s="process"==n(27)(a);e.exports=function(){var e,t,n,c=function(){var r,o;for(s&&(r=a.domain)&&r.exit();e;){o=e.fn,e=e.next;try{o()}catch(i){throw e?n():t=void 0,i}}t=void 0,r&&r.enter()};if(s)n=function(){a.nextTick(c)};else if(i){var l=!0,p=document.createTextNode("");new i(c).observe(p,{characterData:!0}),n=function(){p.data=l=!l}}else if(u&&u.resolve){var f=u.resolve();n=function(){f.then(c)}}else n=function(){o.call(r,c)};return function(r){var o={fn:r,next:void 0};t&&(t.next=o),e||(e=o,n()),t=o}}},function(e,t,n){var r=n(90)("keys"),o=n(59);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(3),o=n(18),i=n(8)("species");e.exports=function(e,t){var n,a=r(e).constructor;return void 0===a||void 0==(n=r(a)[i])?t:o(n)}},function(e,t,n){var r=n(46),o=n(28);e.exports=function(e){return function(t,n){var i,a,u=String(o(t)),s=r(n),c=u.length;return 0>s||s>=c?e?"":void 0:(i=u.charCodeAt(s),55296>i||i>56319||s+1===c||(a=u.charCodeAt(s+1))<56320||a>57343?e?u.charAt(s):i:e?u.slice(s,s+2):(i-55296<<10)+(a-56320)+65536)}}},function(e,t,n){var r=n(85),o=n(28);e.exports=function(e,t,n){if(r(t))throw TypeError("String#"+n+" doesn't accept regex!");return String(o(e))}},function(e,t,n){"use strict";var r=n(46),o=n(28);e.exports=function(e){var t=String(o(this)),n="",i=r(e);if(0>i||i==1/0)throw RangeError("Count can't be negative");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(n+=t);return n}},function(e,t){e.exports=" \n\x0B\f\r \u2028\u2029\ufeff"},function(e,t,n){var r,o,i,a=n(38),u=n(84),s=n(120),c=n(117),l=n(5),p=l.process,f=l.setImmediate,d=l.clearImmediate,h=l.MessageChannel,v=0,m={},y="onreadystatechange",g=function(){var e=+this;if(m.hasOwnProperty(e)){var t=m[e];delete m[e],t()}},b=function(e){g.call(e.data)};f&&d||(f=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return m[++v]=function(){u("function"==typeof e?e:Function(e),t)},r(v),v},d=function(e){delete m[e]},"process"==n(27)(p)?r=function(e){p.nextTick(a(g,e,1))}:h?(o=new h,i=o.port2,o.port1.onmessage=b,r=a(i.postMessage,i,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(r=function(e){l.postMessage(e+"","*")},l.addEventListener("message",b,!1)):r=y in c("script")?function(e){s.appendChild(c("script"))[y]=function(){s.removeChild(this),g.call(e)}}:function(e){setTimeout(a(g,e,1),0)}),e.exports={set:f,clear:d}},function(e,t,n){"use strict";var r=n(5),o=n(10),i=n(52),a=n(91),u=n(17),s=n(56),c=n(6),l=n(43),p=n(46),f=n(13),d=n(54).f,h=n(11).f,v=n(115),m=n(65),y="ArrayBuffer",g="DataView",b="prototype",_="Wrong length!",x="Wrong index!",E=r[y],w=r[g],C=r.Math,P=(r.parseInt,r.RangeError),S=r.Infinity,O=E,T=C.abs,A=C.pow,M=(C.min,C.floor),k=C.log,N=C.LN2,R="buffer",I="byteLength",j="byteOffset",D=o?"_b":R,F=o?"_l":I,L=o?"_o":j,U=function(e,t,n){var r,o,i,a=Array(n),u=8*n-t-1,s=(1<<u)-1,c=s>>1,l=23===t?A(2,-24)-A(2,-77):0,p=0,f=0>e||0===e&&0>1/e?1:0;for(e=T(e),e!=e||e===S?(o=e!=e?1:0,r=s):(r=M(k(e)/N),e*(i=A(2,-r))<1&&(r--,i*=2),e+=r+c>=1?l/i:l*A(2,1-c),e*i>=2&&(r++,i/=2),r+c>=s?(o=0,r=s):r+c>=1?(o=(e*i-1)*A(2,t),r+=c):(o=e*A(2,c-1)*A(2,t),r=0));t>=8;a[p++]=255&o,o/=256,t-=8);for(r=r<<t|o,u+=t;u>0;a[p++]=255&r,r/=256,u-=8);return a[--p]|=128*f,a},V=function(e,t,n){var r,o=8*n-t-1,i=(1<<o)-1,a=i>>1,u=o-7,s=n-1,c=e[s--],l=127&c;for(c>>=7;u>0;l=256*l+e[s],s--,u-=8);for(r=l&(1<<-u)-1,l>>=-u,u+=t;u>0;r=256*r+e[s],s--,u-=8);if(0===l)l=1-a;else{if(l===i)return r?NaN:c?-S:S;r+=A(2,t),l-=a}return(c?-1:1)*r*A(2,l-t)},B=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},W=function(e){return[255&e]},q=function(e){return[255&e,e>>8&255]},H=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},Y=function(e){return U(e,52,8)},z=function(e){return U(e,23,4)},K=function(e,t,n){h(e[b],t,{get:function(){return this[n]}})},G=function(e,t,n,r){var o=+n,i=p(o);if(o!=i||0>i||i+t>e[F])throw P(x);var a=e[D]._b,u=i+e[L],s=a.slice(u,u+t);return r?s:s.reverse()},$=function(e,t,n,r,o,i){var a=+n,u=p(a);if(a!=u||0>u||u+t>e[F])throw P(x);for(var s=e[D]._b,c=u+e[L],l=r(+o),f=0;t>f;f++)s[c+f]=l[i?f:t-f-1]},X=function(e,t){l(e,E,y);var n=+t,r=f(n);if(n!=r)throw P(_);return r};if(a.ABV){if(!c(function(){new E})||!c(function(){new E(.5)})){E=function(e){return new O(X(this,e))};for(var Q,Z=E[b]=O[b],J=d(O),ee=0;J.length>ee;)(Q=J[ee++])in E||u(E,Q,O[Q]);i||(Z.constructor=E)}var te=new w(new E(2)),ne=w[b].setInt8;te.setInt8(0,2147483648),te.setInt8(1,2147483649),!te.getInt8(0)&&te.getInt8(1)||s(w[b],{setInt8:function(e,t){ne.call(this,e,t<<24>>24)},setUint8:function(e,t){ne.call(this,e,t<<24>>24)}},!0)}else E=function(e){var t=X(this,e);this._b=v.call(Array(t),0),this[F]=t},w=function(e,t,n){l(this,w,g),l(e,E,g);var r=e[F],o=p(t);if(0>o||o>r)throw P("Wrong offset!");if(n=void 0===n?r-o:f(n),o+n>r)throw P(_);this[D]=e,this[L]=o,this[F]=n},o&&(K(E,I,"_l"),K(w,R,"_b"),K(w,I,"_l"),K(w,j,"_o")),s(w[b],{getInt8:function(e){return G(this,1,e)[0]<<24>>24},getUint8:function(e){return G(this,1,e)[0]},getInt16:function(e){var t=G(this,2,e,arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=G(this,2,e,arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return B(G(this,4,e,arguments[1]))},getUint32:function(e){return B(G(this,4,e,arguments[1]))>>>0},getFloat32:function(e){return V(G(this,4,e,arguments[1]),23,4)},getFloat64:function(e){return V(G(this,8,e,arguments[1]),52,8)},setInt8:function(e,t){$(this,1,e,W,t)},setUint8:function(e,t){$(this,1,e,W,t)},setInt16:function(e,t){$(this,2,e,q,t,arguments[2])},setUint16:function(e,t){$(this,2,e,q,t,arguments[2])},setInt32:function(e,t){$(this,4,e,H,t,arguments[2])},setUint32:function(e,t){$(this,4,e,H,t,arguments[2])},setFloat32:function(e,t){$(this,4,e,z,t,arguments[2])},setFloat64:function(e,t){$(this,8,e,Y,t,arguments[2])}});m(E,y),m(w,g),u(w[b],a.VIEW,!0),t[y]=E,t[g]=w},function(e,t,n){var r=n(5),o=n(33),i=n(52),a=n(199),u=n(11).f;e.exports=function(e){var t=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||u(t,e,{value:a.f(e)})}},function(e,t,n){var r=n(63),o=n(8)("iterator"),i=n(51);e.exports=n(33).getIteratorMethod=function(e){return void 0!=e?e[o]||e["@@iterator"]||i[r(e)]:void 0}},function(e,t,n){"use strict";var r=n(62),o=n(187),i=n(51),a=n(21);e.exports=n(126)(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,o(1)):"keys"==t?o(0,n):"values"==t?o(0,e[n]):o(0,[n,e[n]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(e,t){"use strict";function n(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function r(e,t){if(n(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(var a=0;a<r.length;a++)if(!o.call(t,r[a])||!n(e[r[a]],t[r[a]]))return!1;return!0}var o=Object.prototype.hasOwnProperty;e.exports=r},function(e,t){function n(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}e.exports=n},function(e,t,n){function r(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=a,this.__views__=[]}var o=n(146),i=n(148),a=4294967295;r.prototype=o(i.prototype),r.prototype.constructor=r,e.exports=r},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var o=n(542),i=n(543),a=n(544),u=n(545),s=n(546);r.prototype.clear=o,r.prototype["delete"]=i,r.prototype.get=a,r.prototype.has=u,r.prototype.set=s,e.exports=r},function(e,t){function n(e,t,n){var r=n.length;switch(r){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}e.exports=n},function(e,t,n){function r(e){return o(e)?i(e):{}}var o=n(48),i=Object.create;e.exports=r},function(e,t,n){function r(e,t,n,u,s){return e===t?!0:null==e||null==t||!i(e)&&!a(t)?e!==e&&t!==t:o(e,t,r,n,u,s)}var o=n(500),i=n(48),a=n(60);e.exports=r},function(e,t){function n(){}e.exports=n},function(e,t){function n(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}e.exports=n},function(e,t){function n(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(n){}return t}e.exports=n},function(e,t,n){function r(e){var t=o(e)?s.call(e):"";return t==i||t==a}var o=n(48),i="[object Function]",a="[object GeneratorFunction]",u=Object.prototype,s=u.toString;e.exports=r},function(e,t,n){function r(e){if(!a(e)||f.call(e)!=u||i(e))return!1;var t=o(e);if(null===t)return!0;var n=l.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==p}var o=n(229),i=n(150),a=n(60),u="[object Object]",s=Object.prototype,c=Function.prototype.toString,l=s.hasOwnProperty,p=c.call(Object),f=s.toString;e.exports=r},function(e,t,n){function r(e){var t=c(e);if(!t&&!u(e))return i(e);var n=a(e),r=!!n,l=n||[],p=l.length;for(var f in e)!o(e,f)||r&&("length"==f||s(f,p))||t&&"constructor"==f||l.push(f);return l}var o=n(217),i=n(503),a=n(531),u=n(103),s=n(100),c=n(536);e.exports=r},function(e,t,n){function r(e,t){var n={};return t=i(t,3),o(e,function(e,r,o){n[r]=t(e,r,o)}),n}var o=n(215),i=n(218);e.exports=r},function(e,t,n){e.exports=n(647)},function(e,t,n){"use strict";function r(e,t){return Array.isArray(t)&&(t=t[1]),t?t.nextSibling:e.firstChild}function o(e,t,n){l.insertTreeBefore(e,t,n)}function i(e,t,n){Array.isArray(t)?u(e,t[0],t[1],n):m(e,t,n)}function a(e,t){if(Array.isArray(t)){var n=t[1];t=t[0],s(e,t,n),e.removeChild(n)}e.removeChild(t)}function u(e,t,n,r){for(var o=t;;){var i=o.nextSibling;if(m(e,o,r),o===n)break;o=i}}function s(e,t,n){for(;;){var r=t.nextSibling;if(r===n)break;e.removeChild(r)}}function c(e,t,n){var r=e.parentNode,o=e.nextSibling;o===t?n&&m(r,document.createTextNode(n),o):n?(v(o,n),s(r,o,t)):s(r,e,t)}var l=n(68),p=n(587),f=n(259),d=(n(12),n(25),n(165)),h=n(171),v=n(273),m=d(function(e,t,n){e.insertBefore(t,n)}),y=p.dangerouslyReplaceNodeWithMarkup,g={dangerouslyReplaceNodeWithMarkup:y,replaceDelimitedText:c,processUpdates:function(e,t){for(var n=0;n<t.length;n++){var u=t[n];switch(u.type){case f.INSERT_MARKUP:o(e,u.content,r(e,u.afterNode));break;case f.MOVE_EXISTING:i(e,u.fromNode,r(e,u.afterNode));break;case f.SET_MARKUP:h(e,u.content);break;case f.TEXT_CONTENT:v(e,u.content);break;case f.REMOVE_NODE:a(e,u.fromNode)}}}};e.exports=g},function(e,t,n){"use strict";function r(e){return c.hasOwnProperty(e)?!0:s.hasOwnProperty(e)?!1:u.test(e)?(c[e]=!0,!0):(s[e]=!0,!1)}function o(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&1>t||e.hasOverloadedBooleanValue&&t===!1}var i=n(61),a=(n(12),n(605),n(25),n(645)),u=(n(4),new RegExp("^["+i.ATTRIBUTE_NAME_START_CHAR+"]["+i.ATTRIBUTE_NAME_CHAR+"]*$")),s={},c={},l={createMarkupForID:function(e){return i.ID_ATTRIBUTE_NAME+"="+a(e)},setAttributeForID:function(e,t){e.setAttribute(i.ID_ATTRIBUTE_NAME,t)},createMarkupForRoot:function(){return i.ROOT_ATTRIBUTE_NAME+'=""'},setAttributeForRoot:function(e){e.setAttribute(i.ROOT_ATTRIBUTE_NAME,"");
},createMarkupForProperty:function(e,t){var n=i.properties.hasOwnProperty(e)?i.properties[e]:null;if(n){if(o(n,t))return"";var r=n.attributeName;return n.hasBooleanValue||n.hasOverloadedBooleanValue&&t===!0?r+'=""':r+"="+a(t)}return i.isCustomAttribute(e)?null==t?"":e+"="+a(t):null},createMarkupForCustomAttribute:function(e,t){return r(e)&&null!=t?e+"="+a(t):""},setValueForProperty:function(e,t,n){var r=i.properties.hasOwnProperty(t)?i.properties[t]:null;if(r){var a=r.mutationMethod;if(a)a(e,n);else{if(o(r,n))return void this.deleteValueForProperty(e,t);if(r.mustUseProperty){var u=r.propertyName;r.hasSideEffects&&""+e[u]==""+n||(e[u]=n)}else{var s=r.attributeName,c=r.attributeNamespace;c?e.setAttributeNS(c,s,""+n):r.hasBooleanValue||r.hasOverloadedBooleanValue&&n===!0?e.setAttribute(s,""):e.setAttribute(s,""+n)}}}else if(i.isCustomAttribute(t))return void l.setValueForAttribute(e,t,n)},setValueForAttribute:function(e,t,n){if(r(t)){null==n?e.removeAttribute(t):e.setAttribute(t,""+n)}},deleteValueForProperty:function(e,t){var n=i.properties.hasOwnProperty(t)?i.properties[t]:null;if(n){var r=n.mutationMethod;if(r)r(e,void 0);else if(n.mustUseProperty){var o=n.propertyName;n.hasBooleanValue?e[o]=!1:n.hasSideEffects&&""+e[o]==""||(e[o]="")}else e.removeAttribute(n.attributeName)}else i.isCustomAttribute(t)&&e.removeAttribute(t)}};e.exports=l},function(e,t,n){"use strict";function r(e){return e===g.topMouseUp||e===g.topTouchEnd||e===g.topTouchCancel}function o(e){return e===g.topMouseMove||e===g.topTouchMove}function i(e){return e===g.topMouseDown||e===g.topTouchStart}function a(e,t,n,r){var o=e.type||"unknown-event";e.currentTarget=b.getNodeFromInstance(r),t?v.invokeGuardedCallbackWithCatch(o,n,e):v.invokeGuardedCallback(o,n,e),e.currentTarget=null}function u(e,t){var n=e._dispatchListeners,r=e._dispatchInstances;if(Array.isArray(n))for(var o=0;o<n.length&&!e.isPropagationStopped();o++)a(e,t,n[o],r[o]);else n&&a(e,t,n,r);e._dispatchListeners=null,e._dispatchInstances=null}function s(e){var t=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t)){for(var r=0;r<t.length&&!e.isPropagationStopped();r++)if(t[r](e,n[r]))return n[r]}else if(t&&t(e,n))return n;return null}function c(e){var t=s(e);return e._dispatchInstances=null,e._dispatchListeners=null,t}function l(e){var t=e._dispatchListeners,n=e._dispatchInstances;Array.isArray(t)?m(!1):void 0,e.currentTarget=t?b.getNodeFromInstance(n):null;var r=t?t(e):null;return e.currentTarget=null,e._dispatchListeners=null,e._dispatchInstances=null,r}function p(e){return!!e._dispatchListeners}var f,d,h=n(41),v=n(162),m=n(2),y=(n(4),{injectComponentTree:function(e){f=e},injectTreeTraversal:function(e){d=e}}),g=h.topLevelTypes,b={isEndish:r,isMoveish:o,isStartish:i,executeDirectDispatch:l,executeDispatchesInOrder:u,executeDispatchesInOrderStopAtTrue:c,hasDispatches:p,getInstanceFromNode:function(e){return f.getInstanceFromNode(e)},getNodeFromInstance:function(e){return f.getNodeFromInstance(e)},isAncestor:function(e,t){return d.isAncestor(e,t)},getLowestCommonAncestor:function(e,t){return d.getLowestCommonAncestor(e,t)},getParentInstance:function(e){return d.getParentInstance(e)},traverseTwoPhase:function(e,t,n){return d.traverseTwoPhase(e,t,n)},traverseEnterLeave:function(e,t,n,r,o){return d.traverseEnterLeave(e,t,n,r,o)},injection:y};e.exports=b},function(e,t){"use strict";function n(e){var t=/[=:]/g,n={"=":"=0",":":"=2"},r=(""+e).replace(t,function(e){return n[e]});return"$"+r}function r(e){var t=/(=0|=2)/g,n={"=0":"=","=2":":"},r="."===e[0]&&"$"===e[1]?e.substring(2):e.substring(1);return(""+r).replace(t,function(e){return n[e]})}var o={escape:n,unescape:r};e.exports=o},function(e,t,n){"use strict";function r(e){null!=e.checkedLink&&null!=e.valueLink?c(!1):void 0}function o(e){r(e),null!=e.value||null!=e.onChange?c(!1):void 0}function i(e){r(e),null!=e.checked||null!=e.onChange?c(!1):void 0}function a(e){if(e){var t=e.getName();if(t)return" Check the render method of `"+t+"`."}return""}var u=n(263),s=n(111),c=n(2),l=(n(4),{button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0}),p={value:function(e,t,n){return!e[t]||l[e.type]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(e,t,n){return!e[t]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:u.func},f={},d={checkPropTypes:function(e,t,n){for(var r in p){if(p.hasOwnProperty(r))var o=p[r](t,r,e,s.prop);if(o instanceof Error&&!(o.message in f)){f[o.message]=!0;a(n)}}},getValue:function(e){return e.valueLink?(o(e),e.valueLink.value):e.value},getChecked:function(e){return e.checkedLink?(i(e),e.checkedLink.value):e.checked},executeOnChange:function(e,t){return e.valueLink?(o(e),e.valueLink.requestChange(t.target.value)):e.checkedLink?(i(e),e.checkedLink.requestChange(t.target.checked)):e.onChange?e.onChange.call(void 0,t):void 0}};e.exports=d},function(e,t,n){"use strict";var r=n(2),o=!1,i={unmountIDFromEnvironment:null,replaceNodeWithMarkup:null,processChildrenUpdates:null,injection:{injectEnvironment:function(e){o?r(!1):void 0,i.unmountIDFromEnvironment=e.unmountIDFromEnvironment,i.replaceNodeWithMarkup=e.replaceNodeWithMarkup,i.processChildrenUpdates=e.processChildrenUpdates,o=!0}}};e.exports=i},function(e,t,n){"use strict";function r(e,t,n,r){try{return t(n,r)}catch(i){return void(null===o&&(o=i))}}var o=null,i={invokeGuardedCallback:r,invokeGuardedCallbackWithCatch:r,rethrowCaughtError:function(){if(o){var e=o;throw o=null,e}}};e.exports=i},function(e,t){"use strict";var n={remove:function(e){e._reactInternalInstance=void 0},get:function(e){return e._reactInternalInstance},has:function(e){return void 0!==e._reactInternalInstance},set:function(e,t){e._reactInternalInstance=t}};e.exports=n},function(e,t,n){"use strict";var r=!1;e.exports=r},function(e,t){"use strict";var n=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e};e.exports=n},function(e,t){"use strict";function n(e){var t,n=e.keyCode;return"charCode"in e?(t=e.charCode,0===t&&13===n&&(t=13)):t=n,t>=32||13===t?t:0}e.exports=n},function(e,t){"use strict";function n(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var r=o[e];return r?!!n[r]:!1}function r(e){return n}var o={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};e.exports=r},function(e,t){"use strict";function n(e){var t=e.target||e.srcElement||window;return t.correspondingUseElement&&(t=t.correspondingUseElement),3===t.nodeType?t.parentNode:t}e.exports=n},function(e,t){"use strict";function n(e){var t=e&&(r&&e[r]||e[o]);return"function"==typeof t?t:void 0}var r="function"==typeof Symbol&&Symbol.iterator,o="@@iterator";e.exports=n},function(e,t,n){"use strict";/**
* Checks if an event is supported in the current execution environment.
*
* NOTE: This will not work correctly for non-generic events such as `change`,
* `reset`, `load`, `error`, and `select`.
*
* Borrows from Modernizr.
*
* @param {string} eventNameSuffix Event name, e.g. "click".
* @param {?boolean} capture Check if the capture phase is supported.
* @return {boolean} True if the event is supported.
* @internal
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/
function r(e,t){if(!i.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var a=document.createElement("div");a.setAttribute(n,"return;"),r="function"==typeof a[n]}return!r&&o&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var o,i=n(15);i.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),e.exports=r},function(e,t,n){"use strict";var r=n(15),o=/^[ \r\n\t\f]/,i=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,a=n(165),u=a(function(e,t){e.innerHTML=t});if(r.canUseDOM){var s=document.createElement("div");s.innerHTML=" ",""===s.innerHTML&&(u=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),o.test(t)||"<"===t[0]&&i.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t}),s=null}e.exports=u},function(e,t){"use strict";function n(e,t){var n=null===e||e===!1,r=null===t||t===!1;if(n||r)return n===r;var o=typeof e,i=typeof t;return"string"===o||"number"===o?"string"===i||"number"===i:"object"===i&&e.type===t.type&&e.key===t.key}e.exports=n},function(e,t,n){"use strict";function r(e,t){return e&&"object"==typeof e&&null!=e.key?c.escape(e.key):t.toString(36)}function o(e,t,n,i){var f=typeof e;if("undefined"!==f&&"boolean"!==f||(e=null),null===e||"string"===f||"number"===f||a.isValidElement(e))return n(i,e,""===t?l+r(e,0):t),1;var d,h,v=0,m=""===t?l:t+p;if(Array.isArray(e))for(var y=0;y<e.length;y++)d=e[y],h=m+r(d,y),v+=o(d,h,n,i);else{var g=u(e);if(g){var b,_=g.call(e);if(g!==e.entries)for(var x=0;!(b=_.next()).done;)d=b.value,h=m+r(d,x++),v+=o(d,h,n,i);else for(;!(b=_.next()).done;){var E=b.value;E&&(d=E[1],h=m+c.escape(E[0])+p+r(d,0),v+=o(d,h,n,i))}}else if("object"===f){String(e);s(!1)}}return v}function i(e,t,n){return null==e?0:o(e,"",t,n)}var a=(n(50),n(31)),u=n(169),s=n(2),c=n(159),l=(n(4),"."),p=":";e.exports=i},function(e,t,n){"use strict";var r=(n(9),n(30)),o=(n(4),r);e.exports=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ARRAY_INSERT="redux-form/ARRAY_INSERT",t.ARRAY_POP="redux-form/ARRAY_POP",t.ARRAY_PUSH="redux-form/ARRAY_PUSH",t.ARRAY_REMOVE="redux-form/ARRAY_REMOVE",t.ARRAY_SHIFT="redux-form/ARRAY_SHIFT",t.ARRAY_SPLICE="redux-form/ARRAY_SPLICE",t.ARRAY_UNSHIFT="redux-form/ARRAY_UNSHIFT",t.ARRAY_SWAP="redux-form/ARRAY_SWAP",t.BLUR="redux-form/BLUR",t.CHANGE="redux-form/CHANGE",t.DESTROY="redux-form/DESTROY",t.FOCUS="redux-form/FOCUS",t.INITIALIZE="redux-form/INITIALIZE",t.REGISTER_FIELD="redux-form/REGISTER_FIELD",t.RESET="redux-form/RESET",t.SET_SUBMIT_FAILED="redux-form/SET_SUBMIT_FAILED",t.START_ASYNC_VALIDATION="redux-form/START_ASYNC_VALIDATION",t.START_SUBMIT="redux-form/START_SUBMIT",t.STOP_ASYNC_VALIDATION="redux-form/STOP_ASYNC_VALIDATION",t.STOP_SUBMIT="redux-form/STOP_SUBMIT",t.TOUCH="redux-form/TOUCH",t.UNREGISTER_FIELD="redux-form/UNREGISTER_FIELD",t.UNTOUCH="redux-form/UNTOUCH"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0,t.compose=t.applyMiddleware=t.bindActionCreators=t.combineReducers=t.createStore=void 0;var o=n(284),i=r(o),a=n(679),u=r(a),s=n(678),c=r(s),l=n(677),p=r(l),f=n(283),d=r(f),h=n(285);r(h);t.createStore=i["default"],t.combineReducers=u["default"],t.bindActionCreators=c["default"],t.applyMiddleware=p["default"],t.compose=d["default"]},function(e,t,n){var r=n(27);e.exports=function(e,t){if("number"!=typeof e&&"Number"!=r(e))throw TypeError(t);return+e}},function(e,t,n){"use strict";var r=n(14),o=n(58),i=n(13);e.exports=[].copyWithin||function(e,t){var n=r(this),a=i(n.length),u=o(e,a),s=o(t,a),c=arguments.length>2?arguments[2]:void 0,l=Math.min((void 0===c?a:o(c,a))-s,a-u),p=1;for(u>s&&s+l>u&&(p=-1,s+=l-1,u+=l-1);l-- >0;)s in n?n[u]=n[s]:delete n[u],u+=p,s+=p;return n}},function(e,t,n){var r=n(64);e.exports=function(e,t){var n=[];return r(e,!1,n.push,n,t),n}},function(e,t,n){var r=n(18),o=n(14),i=n(70),a=n(13);e.exports=function(e,t,n,u,s){r(t);var c=o(e),l=i(c),p=a(c.length),f=s?p-1:0,d=s?-1:1;if(2>n)for(;;){if(f in l){u=l[f],f+=d;break}if(f+=d,s?0>f:f>=p)throw TypeError("Reduce of empty array with no initial value")}for(;s?f>=0:p>f;f+=d)f in l&&(u=t(u,l[f],f,c));return u}},function(e,t,n){"use strict";var r=n(18),o=n(7),i=n(84),a=[].slice,u={},s=function(e,t,n){if(!(t in u)){for(var r=[],o=0;t>o;o++)r[o]="a["+o+"]";u[t]=Function("F,a","return new F("+r.join(",")+")")}return u[t](e,n)};e.exports=Function.bind||function(e){var t=r(this),n=a.call(arguments,1),u=function(){var r=n.concat(a.call(arguments));return this instanceof u?s(t,r.length,r):i(t,r,e)};return o(t.prototype)&&(u.prototype=t.prototype),u}},function(e,t,n){"use strict";var r=n(11).f,o=n(53),i=(n(17),n(56)),a=n(38),u=n(43),s=n(28),c=n(64),l=n(126),p=n(187),f=n(57),d=n(10),h=n(44).fastKey,v=d?"_s":"size",m=function(e,t){var n,r=h(t);if("F"!==r)return e._i[r];for(n=e._f;n;n=n.n)if(n.k==t)return n};e.exports={getConstructor:function(e,t,n,l){var p=e(function(e,r){u(e,p,t,"_i"),e._i=o(null),e._f=void 0,e._l=void 0,e[v]=0,void 0!=r&&c(r,n,e[l],e)});return i(p.prototype,{clear:function(){for(var e=this,t=e._i,n=e._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete t[n.i];e._f=e._l=void 0,e[v]=0},"delete":function(e){var t=this,n=m(t,e);if(n){var r=n.n,o=n.p;delete t._i[n.i],n.r=!0,o&&(o.n=r),r&&(r.p=o),t._f==n&&(t._f=r),t._l==n&&(t._l=o),t[v]--}return!!n},forEach:function(e){u(this,p,"forEach");for(var t,n=a(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.n:this._f;)for(n(t.v,t.k,this);t&&t.r;)t=t.p},has:function(e){return!!m(this,e)}}),d&&r(p.prototype,"size",{get:function(){return s(this[v])}}),p},def:function(e,t,n){var r,o,i=m(e,t);return i?i.v=n:(e._l=i={i:o=h(t,!0),k:t,v:n,p:r=e._l,n:void 0,r:!1},e._f||(e._f=i),r&&(r.n=i),e[v]++,"F"!==o&&(e._i[o]=i)),e},getEntry:m,setStrong:function(e,t,n){l(e,t,function(e,t){this._t=e,this._k=t,this._l=void 0},function(){for(var e=this,t=e._k,n=e._l;n&&n.r;)n=n.p;return e._t&&(e._l=n=n?n.n:e._t._f)?"keys"==t?p(0,n.k):"values"==t?p(0,n.v):p(0,[n.k,n.v]):(e._t=void 0,p(1))},n?"entries":"values",!n,!0),f(t)}}},function(e,t,n){var r=n(63),o=n(179);e.exports=function(e){return function(){if(r(this)!=e)throw TypeError(e+"#toJSON isn't generic");return o(this)}}},function(e,t,n){"use strict";var r=n(56),o=n(44).getWeak,i=n(3),a=n(7),u=n(43),s=n(64),c=n(32),l=n(16),p=c(5),f=c(6),d=0,h=function(e){return e._l||(e._l=new v)},v=function(){this.a=[]},m=function(e,t){return p(e.a,function(e){return e[0]===t})};v.prototype={get:function(e){var t=m(this,e);return t?t[1]:void 0},has:function(e){return!!m(this,e)},set:function(e,t){var n=m(this,e);n?n[1]=t:this.a.push([e,t])},"delete":function(e){var t=f(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}},e.exports={getConstructor:function(e,t,n,i){var c=e(function(e,r){u(e,c,t,"_i"),e._i=d++,e._l=void 0,void 0!=r&&s(r,n,e[i],e)});return r(c.prototype,{"delete":function(e){if(!a(e))return!1;var t=o(e);return t===!0?h(this)["delete"](e):t&&l(t,this._i)&&delete t[this._i]},has:function(e){if(!a(e))return!1;var t=o(e);return t===!0?h(this).has(e):t&&l(t,this._i)}}),c},def:function(e,t,n){var r=o(i(t),!0);return r===!0?h(e).set(t,n):r[e._i]=n,e},ufstore:h}},function(e,t,n){e.exports=!n(10)&&!n(6)(function(){return 7!=Object.defineProperty(n(117)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(3);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(i){var a=e["return"];throw void 0!==a&&r(a.call(e)),i}}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t){e.exports=Math.log1p||function(e){return(e=+e)>-1e-8&&1e-8>e?e-e*e/2:Math.log(1+e)}},function(e,t,n){"use strict";var r=n(55),o=n(88),i=n(71),a=n(14),u=n(70),s=Object.assign;e.exports=!s||n(6)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=s({},e)[n]||Object.keys(s({},t)).join("")!=r})?function(e,t){for(var n=a(e),s=arguments.length,c=1,l=o.f,p=i.f;s>c;)for(var f,d=u(arguments[c++]),h=l?r(d).concat(l(d)):r(d),v=h.length,m=0;v>m;)p.call(d,f=h[m++])&&(n[f]=d[f]);return n}:s},function(e,t,n){var r=n(11),o=n(3),i=n(55);e.exports=n(10)?Object.defineProperties:function(e,t){o(e);for(var n,a=i(t),u=a.length,s=0;u>s;)r.f(e,n=a[s++],t[n]);return e}},function(e,t,n){var r=n(21),o=n(54).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],u=function(e){try{return o(e)}catch(t){return a.slice()}};e.exports.f=function(e){return a&&"[object Window]"==i.call(e)?u(e):o(r(e))}},function(e,t,n){var r=n(16),o=n(21),i=n(80)(!1),a=n(130)("IE_PROTO");e.exports=function(e,t){var n,u=o(e),s=0,c=[];for(n in u)n!=a&&r(u,n)&&c.push(n);for(;t.length>s;)r(u,n=t[s++])&&(~i(c,n)||c.push(n));return c}},function(e,t,n){var r=n(55),o=n(21),i=n(71).f;e.exports=function(e){return function(t){for(var n,a=o(t),u=r(a),s=u.length,c=0,l=[];s>c;)i.call(a,n=u[c++])&&l.push(e?[n,a[n]]:a[n]);return l}}},function(e,t,n){var r=n(54),o=n(88),i=n(3),a=n(5).Reflect;e.exports=a&&a.ownKeys||function(e){var t=r.f(i(e)),n=o.f;return n?t.concat(n(e)):t}},function(e,t,n){var r=n(5).parseFloat,o=n(66).trim;e.exports=1/r(n(135)+"-0")!==-(1/0)?function(e){var t=o(String(e),3),n=r(t);return 0===n&&"-"==t.charAt(0)?-0:n}:r},function(e,t,n){var r=n(5).parseInt,o=n(66).trim,i=n(135),a=/^[\-+]?0[xX]/;e.exports=8!==r(i+"08")||22!==r(i+"0x16")?function(e,t){var n=o(String(e),3);return r(n,t>>>0||(a.test(n)?16:10))}:r},function(e,t){e.exports=Object.is||function(e,t){return e===t?0!==e||1/e===1/t:e!=e&&t!=t}},function(e,t,n){var r=n(13),o=n(134),i=n(28);e.exports=function(e,t,n,a){var u=String(i(e)),s=u.length,c=void 0===n?" ":String(n),l=r(t);if(s>=l||""==c)return u;var p=l-s,f=o.call(c,Math.ceil(p/c.length));return f.length>p&&(f=f.slice(0,p)),a?f+u:u+f}},function(e,t,n){t.f=n(8)},function(e,t,n){"use strict";var r=n(182);e.exports=n(81)("Map",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{get:function(e){var t=r.getEntry(this,e);return t&&t.v},set:function(e,t){return r.def(this,0===e?0:e,t)}},r,!0)},function(e,t,n){n(10)&&"g"!=/./g.flags&&n(11).f(RegExp.prototype,"flags",{configurable:!0,get:n(83)})},function(e,t,n){"use strict";var r=n(182);e.exports=n(81)("Set",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{add:function(e){return r.def(this,e=0===e?0:e,e)}},r)},function(e,t,n){"use strict";var r,o=n(32)(0),i=n(19),a=n(44),u=n(189),s=n(184),c=n(7),l=(n(16),a.getWeak),p=Object.isExtensible,f=s.ufstore,d={},h=function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},v={get:function(e){if(c(e)){var t=l(e);return t===!0?f(this).get(e):t?t[this._i]:void 0}},set:function(e,t){return s.def(this,e,t)}},m=e.exports=n(81)("WeakMap",h,v,s,!0,!0);7!=(new m).set((Object.freeze||Object)(d),7).get(d)&&(r=s.getConstructor(h),u(r.prototype,v),a.NEED=!0,o(["delete","has","get","set"],function(e){var t=m.prototype,n=t[e];i(t,e,function(t,o){if(c(t)&&!p(t)){this._f||(this._f=new r);var i=this._f[e](t,o);return"set"==e?this:i}return n.call(this,t,o)})}))},function(e,t,n){"use strict";var r=n(30),o={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!0),{remove:function(){e.removeEventListener(t,n,!0)}}):{remove:r}},registerDefault:function(){}};e.exports=o},function(e,t){"use strict";function n(e){try{e.focus()}catch(t){}}e.exports=n},function(e,t){"use strict";function n(){if("undefined"==typeof document)return null;try{return document.activeElement||document.body}catch(e){return document.body}}e.exports=n},function(e,t,n){"use strict";function r(e){return a?void 0:i(!1),f.hasOwnProperty(e)||(e="*"),u.hasOwnProperty(e)||("*"===e?a.innerHTML="<link />":a.innerHTML="<"+e+"></"+e+">",u[e]=!a.firstChild),u[e]?f[e]:null}var o=n(15),i=n(2),a=o.canUseDOM?document.createElement("div"):null,u={},s=[1,'<select multiple="true">',"</select>"],c=[1,"<table>","</table>"],l=[3,"<table><tbody><tr>","</tr></tbody></table>"],p=[1,'<svg xmlns="http://www.w3.org/2000/svg">',"</svg>"],f={"*":[1,"?<div>","</div>"],area:[1,"<map>","</map>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],legend:[1,"<fieldset>","</fieldset>"],param:[1,"<object>","</object>"],tr:[2,"<table><tbody>","</tbody></table>"],optgroup:s,option:s,caption:c,colgroup:c,tbody:c,tfoot:c,thead:c,td:l,th:l},d=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];d.forEach(function(e){f[e]=p,u[e]=!0}),e.exports=r},function(e,t){"use strict";var n={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0};e.exports=function(e,t){if("string"!=typeof t)for(var o=Object.getOwnPropertyNames(t),i=0;i<o.length;++i)if(!n[o[i]]&&!r[o[i]])try{e[o[i]]=t[o[i]]}catch(a){}return e}},function(e,t,n){function r(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}var o=n(146),i=n(148);r.prototype=o(i.prototype),r.prototype.constructor=r,e.exports=r},function(e,t,n){var r=n(67),o=n(24),i=r(o,"Map");e.exports=i},function(e,t,n){function r(e){this.__data__=new o(e)}var o=n(95),i=n(554),a=n(555),u=n(556),s=n(557),c=n(558);r.prototype.clear=i,r.prototype["delete"]=a,r.prototype.get=u,r.prototype.has=s,r.prototype.set=c,e.exports=r},function(e,t,n){var r=n(24),o=r.Symbol;e.exports=o},function(e,t,n){var r=n(67),o=n(24),i=r(o,"WeakMap");e.exports=i},function(e,t){function n(e,t){for(var n=-1,r=e?e.length:0;++n<r;)if(t(e[n],n,e))return!0;return!1}e.exports=n},function(e,t,n){function r(e,t){return e&&o(e,t,i)}var o=n(498),i=n(153);e.exports=r},function(e,t,n){function r(e,t){t=i(t,e)?[t]:o(t);for(var n=0,r=t.length;null!=e&&r>n;)e=e[a(t[n++])];return n&&n==r?e:void 0}var o=n(221),i=n(101),a=n(73);e.exports=r},function(e,t,n){function r(e,t){return null!=e&&(a.call(e,t)||"object"==typeof e&&t in e&&null===o(e))}var o=n(229),i=Object.prototype,a=i.hasOwnProperty;e.exports=r},function(e,t,n){function r(e){return"function"==typeof e?e:null==e?a:"object"==typeof e?u(e)?i(e[0],e[1]):o(e):s(e)}var o=n(504),i=n(505),a=n(237),u=n(36),s=n(568);e.exports=r},function(e,t){function n(e){return function(t){return null==t?void 0:t[e]}}e.exports=n},function(e,t,n){var r=n(237),o=n(232),i=o?function(e,t){return o.set(e,t),e}:r;e.exports=i},function(e,t,n){function r(e){return o(e)?e:i(e)}var o=n(36),i=n(234);e.exports=r},function(e,t){function n(e,t,n,o){for(var i=-1,a=e.length,u=n.length,s=-1,c=t.length,l=r(a-u,0),p=Array(c+l),f=!o;++s<c;)p[s]=t[s];for(;++i<u;)(f||a>i)&&(p[n[i]]=e[i]);for(;l--;)p[s++]=e[i++];return p}var r=Math.max;e.exports=n},function(e,t){function n(e,t,n,o){for(var i=-1,a=e.length,u=-1,s=n.length,c=-1,l=t.length,p=r(a-s,0),f=Array(p+l),d=!o;++i<p;)f[i]=e[i];for(var h=i;++c<l;)f[h+c]=t[c];for(;++u<s;)(d||a>i)&&(f[h+n[u]]=e[i++]);return f}var r=Math.max;e.exports=n},function(e,t,n){function r(e,t,n,b,_,x,E,w,C,P){function S(){for(var d=arguments.length,h=Array(d),v=d;v--;)h[v]=arguments[v];if(M)var m=c(S),y=a(h,m);if(b&&(h=o(h,b,_,M)),x&&(h=i(h,x,E,M)),d-=y,M&&P>d){var g=p(h,m);return s(e,t,r,S.placeholder,n,h,g,w,C,P-d)}var R=T?n:this,I=A?R[e]:e;return d=h.length,w?h=l(h,w):k&&d>1&&h.reverse(),O&&d>C&&(h.length=C),this&&this!==f&&this instanceof S&&(I=N||u(I)),I.apply(R,h)}var O=t&y,T=t&d,A=t&h,M=t&(v|m),k=t&g,N=A?void 0:u(e);return S}var o=n(222),i=n(223),a=n(512),u=n(97),s=n(225),c=n(98),l=n(550),p=n(72),f=n(24),d=1,h=2,v=8,m=16,y=128,g=512;e.exports=r},function(e,t,n){function r(e,t,n,r,f,d,h,v,m,y){var g=t&c,b=g?h:void 0,_=g?void 0:h,x=g?d:void 0,E=g?void 0:d;t|=g?l:p,t&=~(g?p:l),t&s||(t&=~(a|u));var w=[e,t,f,x,b,E,_,v,m,y],C=n.apply(void 0,w);return o(e)&&i(C,w),C.placeholder=r,C}var o=n(534),i=n(233),a=1,u=2,s=4,c=8,l=32,p=64;e.exports=r},function(e,t,n){function r(e,t,n,r,x,E,w,C){var P=t&v;if(!P&&"function"!=typeof e)throw new TypeError(d);var S=r?r.length:0;if(S||(t&=~(g|b),r=x=void 0),w=void 0===w?w:_(f(w),0),C=void 0===C?C:f(C),S-=x?x.length:0,t&b){var O=r,T=x;r=x=void 0}var A=P?void 0:c(e),M=[e,t,n,r,x,O,T,E,w,C];if(A&&l(M,A),e=M[0],t=M[1],n=M[2],r=M[3],x=M[4],C=M[9]=null==M[9]?P?0:e.length:_(M[9]-S,0),!C&&t&(m|y)&&(t&=~(m|y)),t&&t!=h)k=t==m||t==y?a(e,t,C):t!=g&&t!=(h|g)||x.length?u.apply(void 0,M):s(e,t,n,r);else var k=i(e,t,n);var N=A?o:p;return N(k,M)}var o=n(220),i=n(515),a=n(516),u=n(224),s=n(517),c=n(228),l=n(548),p=n(233),f=n(242),d="Expected a function",h=1,v=2,m=8,y=16,g=32,b=64,_=Math.max;e.exports=r},function(e,t,n){function r(e,t,n,r,s,c){var l=s&u,p=e.length,f=t.length;if(p!=f&&!(l&&f>p))return!1;var d=c.get(e);if(d)return d==t;var h=-1,v=!0,m=s&a?new o:void 0;for(c.set(e,t);++h<p;){var y=e[h],g=t[h];if(r)var b=l?r(g,y,h,t,e,c):r(y,g,h,e,t,c);if(void 0!==b){if(b)continue;v=!1;break}if(m){if(!i(t,function(e,t){return m.has(t)||y!==e&&!n(y,e,r,s,c)?void 0:m.add(t)})){v=!1;break}}else if(y!==g&&!n(y,g,r,s,c)){v=!1;break}}return c["delete"](e),v}var o=n(494),i=n(214),a=1,u=2;e.exports=r},function(e,t,n){var r=n(232),o=n(240),i=r?function(e){return r.get(e)}:o;e.exports=i},function(e,t){function n(e){return r(Object(e))}var r=Object.getPrototypeOf;e.exports=n},function(e,t,n){function r(e){return e===e&&!o(e)}var o=n(48);e.exports=r},function(e,t){function n(e,t){return function(n){return null==n?!1:n[e]===t&&(void 0!==t||e in Object(n))}}e.exports=n},function(e,t,n){var r=n(213),o=r&&new r;e.exports=o},function(e,t,n){var r=n(220),o=n(566),i=150,a=16,u=function(){var e=0,t=0;return function(n,u){var s=o(),c=a-(s-t);if(t=s,c>0){if(++e>=i)return n}else e=0;return r(n,u)}}();e.exports=u},function(e,t,n){var r=n(565),o=n(572),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g,a=/\\(\\)?/g,u=r(function(e){var t=[];return o(e).replace(i,function(e,n,r,o){t.push(r?o.replace(a,"$1"):n||e)}),t});e.exports=u},function(e,t){function n(e){if(null!=e){try{return r.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var r=Function.prototype.toString;e.exports=n},function(e,t){function n(e,t){return e===t||e!==e&&t!==t}e.exports=n},function(e,t){function n(e){return e}e.exports=n},function(e,t,n){function r(e){return o(e)&&u.call(e,"callee")&&(!c.call(e,"callee")||s.call(e)==i)}var o=n(562),i="[object Arguments]",a=Object.prototype,u=a.hasOwnProperty,s=a.toString,c=a.propertyIsEnumerable;e.exports=r},function(e,t,n){function r(e){return"string"==typeof e||!o(e)&&i(e)&&s.call(e)==a}var o=n(36),i=n(60),a="[object String]",u=Object.prototype,s=u.toString;e.exports=r},function(e,t){function n(){}e.exports=n},function(e,t,n){function r(e,t){if("function"!=typeof e)throw new TypeError(a);return t=u(void 0===t?e.length-1:i(t),0),function(){for(var n=arguments,r=-1,i=u(n.length-t,0),a=Array(i);++r<i;)a[r]=n[t+r];switch(t){case 0:return e.call(this,a);case 1:return e.call(this,n[0],a);case 2:return e.call(this,n[0],n[1],a)}var s=Array(t+1);for(r=-1;++r<t;)s[r]=n[r];return s[t]=a,o(e,this,s)}}var o=n(145),i=n(242),a="Expected a function",u=Math.max;e.exports=r},function(e,t,n){function r(e){var t=o(e),n=t%1;return t===t?n?t-n:t:0}var o=n(570);e.exports=r},function(e,t,n){"use strict";t.__esModule=!0;var r=n(26);t["default"]=r.PropTypes.shape({subscribe:r.PropTypes.func.isRequired,dispatch:r.PropTypes.func.isRequired,getState:r.PropTypes.func.isRequired})},function(e,t){"use strict";function n(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(t){}}t.__esModule=!0,t["default"]=n},function(e,t){"use strict";function n(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var r={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},o=["Webkit","ms","Moz","O"];Object.keys(r).forEach(function(e){o.forEach(function(t){r[n(t,e)]=r[e]})});var i={background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}},a={isUnitlessNumber:r,shorthandPropertyExpansions:i};e.exports=a},function(e,t,n){"use strict";function r(){this._callbacks=null,this._contexts=null}var o=n(9),i=n(49),a=n(2);o(r.prototype,{enqueue:function(e,t){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(e),this._contexts.push(t)},notifyAll:function(){var e=this._callbacks,t=this._contexts;if(e){e.length!==t.length?a(!1):void 0,this._callbacks=null,this._contexts=null;for(var n=0;n<e.length;n++)e[n].call(t[n]);e.length=0,t.length=0}},checkpoint:function(){return this._callbacks?this._callbacks.length:0},rollback:function(e){this._callbacks&&(this._callbacks.length=e,this._contexts.length=e)},reset:function(){this._callbacks=null,this._contexts=null},destructor:function(){this.reset()}}),i.addPoolingTo(r),e.exports=r},function(e,t){"use strict";var n={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};e.exports=n},function(e,t,n){"use strict";function r(e){return(""+e).replace(_,"$&/")}function o(e,t){this.func=e,this.context=t,this.count=0}function i(e,t,n){var r=e.func,o=e.context;r.call(o,t,e.count++)}function a(e,t,n){if(null==e)return e;var r=o.getPooled(t,n);y(e,i,r),o.release(r)}function u(e,t,n,r){this.result=e,this.keyPrefix=t,this.func=n,this.context=r,this.count=0}function s(e,t,n){var o=e.result,i=e.keyPrefix,a=e.func,u=e.context,s=a.call(u,t,e.count++);Array.isArray(s)?c(s,o,n,m.thatReturnsArgument):null!=s&&(v.isValidElement(s)&&(s=v.cloneAndReplaceKey(s,i+(!s.key||t&&t.key===s.key?"":r(s.key)+"/")+n)),o.push(s))}function c(e,t,n,o,i){var a="";null!=n&&(a=r(n)+"/");var c=u.getPooled(t,a,o,i);y(e,s,c),u.release(c)}function l(e,t,n){if(null==e)return e;var r=[];return c(e,r,null,t,n),r}function p(e,t,n){return null}function f(e,t){return y(e,p,null)}function d(e){var t=[];return c(e,t,null,m.thatReturnsArgument),t}var h=n(49),v=n(31),m=n(30),y=n(173),g=h.twoArgumentPooler,b=h.fourArgumentPooler,_=/\/+/g;o.prototype.destructor=function(){this.func=null,this.context=null,this.count=0},h.addPoolingTo(o,g),u.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},h.addPoolingTo(u,b);var x={forEach:a,map:l,mapIntoWithKeyPrefixInternal:c,count:f,toArray:d};e.exports=x},function(e,t,n){"use strict";function r(e,t){var n=E.hasOwnProperty(t)?E[t]:null;C.hasOwnProperty(t)&&(n!==_.OVERRIDE_BASE?m(!1):void 0),e&&(n!==_.DEFINE_MANY&&n!==_.DEFINE_MANY_MERGED?m(!1):void 0)}function o(e,t){if(t){"function"==typeof t?m(!1):void 0,d.isValidElement(t)?m(!1):void 0;var n=e.prototype,o=n.__reactAutoBindPairs;t.hasOwnProperty(b)&&w.mixins(e,t.mixins);for(var i in t)if(t.hasOwnProperty(i)&&i!==b){var a=t[i],c=n.hasOwnProperty(i);if(r(c,i),w.hasOwnProperty(i))w[i](e,a);else{var l=E.hasOwnProperty(i),p="function"==typeof a,f=p&&!l&&!c&&t.autobind!==!1;if(f)o.push(i,a),n[i]=a;else if(c){var h=E[i];!l||h!==_.DEFINE_MANY_MERGED&&h!==_.DEFINE_MANY?m(!1):void 0,h===_.DEFINE_MANY_MERGED?n[i]=u(n[i],a):h===_.DEFINE_MANY&&(n[i]=s(n[i],a))}else n[i]=a}}}}function i(e,t){if(t)for(var n in t){var r=t[n];if(t.hasOwnProperty(n)){var o=n in w;o?m(!1):void 0;var i=n in e;i?m(!1):void 0,e[n]=r}}}function a(e,t){e&&t&&"object"==typeof e&&"object"==typeof t?void 0:m(!1);for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?m(!1):void 0,e[n]=t[n]);return e}function u(e,t){return function(){var n=e.apply(this,arguments),r=t.apply(this,arguments);if(null==n)return r;if(null==r)return n;var o={};return a(o,n),a(o,r),o}}function s(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function c(e,t){var n=t.bind(e);return n}function l(e){for(var t=e.__reactAutoBindPairs,n=0;n<t.length;n+=2){var r=t[n],o=t[n+1];e[r]=c(e,o)}}var p=n(9),f=n(250),d=n(31),h=(n(111),n(110),n(262)),v=n(92),m=n(2),y=n(93),g=n(47),b=(n(4),g({mixins:null})),_=y({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),x=[],E={mixins:_.DEFINE_MANY,statics:_.DEFINE_MANY,propTypes:_.DEFINE_MANY,contextTypes:_.DEFINE_MANY,childContextTypes:_.DEFINE_MANY,getDefaultProps:_.DEFINE_MANY_MERGED,getInitialState:_.DEFINE_MANY_MERGED,getChildContext:_.DEFINE_MANY_MERGED,render:_.DEFINE_ONCE,componentWillMount:_.DEFINE_MANY,componentDidMount:_.DEFINE_MANY,componentWillReceiveProps:_.DEFINE_MANY,shouldComponentUpdate:_.DEFINE_ONCE,componentWillUpdate:_.DEFINE_MANY,componentDidUpdate:_.DEFINE_MANY,componentWillUnmount:_.DEFINE_MANY,updateComponent:_.OVERRIDE_BASE},w={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n<t.length;n++)o(e,t[n])},childContextTypes:function(e,t){e.childContextTypes=p({},e.childContextTypes,t)},contextTypes:function(e,t){e.contextTypes=p({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps?e.getDefaultProps=u(e.getDefaultProps,t):e.getDefaultProps=t},propTypes:function(e,t){e.propTypes=p({},e.propTypes,t)},statics:function(e,t){i(e,t)},autobind:function(){}},C={replaceState:function(e,t){this.updater.enqueueReplaceState(this,e),t&&this.updater.enqueueCallback(this,t,"replaceState")},isMounted:function(){return this.updater.isMounted(this)}},P=function(){};p(P.prototype,f.prototype,C);var S={createClass:function(e){var t=function(e,t,n){this.__reactAutoBindPairs.length&&l(this),this.props=e,this.context=t,this.refs=v,this.updater=n||h,this.state=null;var r=this.getInitialState?this.getInitialState():null;"object"!=typeof r||Array.isArray(r)?m(!1):void 0,this.state=r};t.prototype=new P,t.prototype.constructor=t,t.prototype.__reactAutoBindPairs=[],x.forEach(o.bind(null,t)),o(t,e),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),t.prototype.render?void 0:m(!1);for(var n in E)t.prototype[n]||(t.prototype[n]=null);return t},injection:{injectMixin:function(e){x.push(e)}}};e.exports=S},function(e,t,n){"use strict";function r(e,t,n){this.props=e,this.context=t,this.refs=i,this.updater=n||o}var o=n(262),i=(n(25),n(164),n(92)),a=n(2);n(4);r.prototype.isReactComponent={},r.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e?a(!1):void 0,this.updater.enqueueSetState(this,e),t&&this.updater.enqueueCallback(this,t,"setState")},r.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this),e&&this.updater.enqueueCallback(this,e,"forceUpdate")};e.exports=r},function(e,t,n){"use strict";var r=n(156),o=n(603),i={processChildrenUpdates:o.dangerouslyProcessChildrenUpdates,replaceNodeWithMarkup:r.dangerouslyReplaceNodeWithMarkup,unmountIDFromEnvironment:function(e){}};e.exports=i},function(e,t){"use strict";var n={hasCachedChildNodes:1};e.exports=n},function(e,t,n){"use strict";function r(){if(this._rootNodeID&&this._wrapperState.pendingUpdate){this._wrapperState.pendingUpdate=!1;var e=this._currentElement.props,t=s.getValue(e);null!=t&&o(this,Boolean(e.multiple),t)}}function o(e,t,n){var r,o,i=c.getNodeFromInstance(e).options;if(t){for(r={},o=0;o<n.length;o++)r[""+n[o]]=!0;for(o=0;o<i.length;o++){var a=r.hasOwnProperty(i[o].value);i[o].selected!==a&&(i[o].selected=a)}}else{for(r=""+n,o=0;o<i.length;o++)if(i[o].value===r)return void(i[o].selected=!0);i.length&&(i[0].selected=!0)}}function i(e){var t=this._currentElement.props,n=s.executeOnChange(t,e);return this._rootNodeID&&(this._wrapperState.pendingUpdate=!0),l.asap(r,this),n}var a=n(9),u=n(107),s=n(160),c=n(12),l=n(37),p=(n(4),!1),f={getNativeProps:function(e,t){return a({},u.getNativeProps(e,t),{onChange:e._wrapperState.onChange,value:void 0})},mountWrapper:function(e,t){var n=s.getValue(t);e._wrapperState={pendingUpdate:!1,initialValue:null!=n?n:t.defaultValue,listeners:null,onChange:i.bind(e),wasMultiple:Boolean(t.multiple)},void 0===t.value||void 0===t.defaultValue||p||(p=!0)},getSelectValueContext:function(e){return e._wrapperState.initialValue},postUpdateWrapper:function(e){var t=e._currentElement.props;e._wrapperState.initialValue=void 0;var n=e._wrapperState.wasMultiple;e._wrapperState.wasMultiple=Boolean(t.multiple);var r=s.getValue(t);null!=r?(e._wrapperState.pendingUpdate=!1,o(e,Boolean(t.multiple),r)):n!==Boolean(t.multiple)&&(null!=t.defaultValue?o(e,Boolean(t.multiple),t.defaultValue):o(e,Boolean(t.multiple),t.multiple?[]:""))}};e.exports=f},function(e,t,n){"use strict";function r(){if(p.current){var e=p.current.getName();if(e)return" Check the render method of `"+e+"`."}return""}function o(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;i("uniqueKey",e,t)}}function i(e,t,n){var o=r();if(!o){var i="string"==typeof n?n:n.displayName||n.name;i&&(o=" Check the top-level render call using <"+i+">.")}var a=h[e]||(h[e]={});if(a[o])return null;a[o]=!0;var u={parentOrOwner:o,url:" See https://fb.me/react-warning-keys for more information.",childOwner:null};return t&&t._owner&&t._owner!==p.current&&(u.childOwner=" It was passed a child from "+t._owner.getName()+"."),u}function a(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n<e.length;n++){var r=e[n];c.isValidElement(r)&&o(r,t)}else if(c.isValidElement(e))e._store&&(e._store.validated=!0);else if(e){var i=f(e);if(i&&i!==e.entries)for(var a,u=i.call(e);!(a=u.next()).done;)c.isValidElement(a.value)&&o(a.value,t)}}function u(e,t,n,o){for(var i in t)if(t.hasOwnProperty(i)){var a;try{"function"!=typeof t[i]?d(!1):void 0,a=t[i](n,i,e,o)}catch(u){a=u}if(a instanceof Error&&!(a.message in v)){v[a.message]=!0;r()}}}function s(e){var t=e.type;if("function"==typeof t){var n=t.displayName||t.name;t.propTypes&&u(n,t.propTypes,e.props,l.prop),"function"==typeof t.getDefaultProps}}var c=n(31),l=n(111),p=(n(110),n(50)),f=(n(164),n(169)),d=n(2),h=(n(4),{}),v={},m={createElement:function(e,t,n){var r="string"==typeof e||"function"==typeof e,o=c.createElement.apply(this,arguments);if(null==o)return o;if(r)for(var i=2;i<arguments.length;i++)a(arguments[i],e);return s(o),o},createFactory:function(e){var t=m.createElement.bind(null,e);return t.type=e,t},cloneElement:function(e,t,n){for(var r=c.cloneElement.apply(this,arguments),o=2;o<arguments.length;o++)a(arguments[o],r.type);return s(r),r}};e.exports=m},function(e,t){"use strict";var n,r={injectEmptyComponentFactory:function(e){n=e}},o={create:function(e){return n(e)}};o.injection=r,e.exports=o},function(e,t){"use strict";var n={logTopLevelRenders:!1};e.exports=n},function(e,t,n){"use strict";function r(e){return i(document.documentElement,e)}var o=n(607),i=n(477),a=n(205),u=n(206),s={hasSelectionCapabilities:function(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&"text"===e.type||"textarea"===t||"true"===e.contentEditable);
},getSelectionInformation:function(){var e=u();return{focusedElem:e,selectionRange:s.hasSelectionCapabilities(e)?s.getSelection(e):null}},restoreSelection:function(e){var t=u(),n=e.focusedElem,o=e.selectionRange;t!==n&&r(n)&&(s.hasSelectionCapabilities(n)&&s.setSelection(n,o),a(n))},getSelection:function(e){var t;if("selectionStart"in e)t={start:e.selectionStart,end:e.selectionEnd};else if(document.selection&&e.nodeName&&"input"===e.nodeName.toLowerCase()){var n=document.selection.createRange();n.parentElement()===e&&(t={start:-n.moveStart("character",-e.value.length),end:-n.moveEnd("character",-e.value.length)})}else t=o.getOffsets(e);return t||{start:0,end:0}},setSelection:function(e,t){var n=t.start,r=t.end;if(void 0===r&&(r=n),"selectionStart"in e)e.selectionStart=n,e.selectionEnd=Math.min(r,e.value.length);else if(document.selection&&e.nodeName&&"input"===e.nodeName.toLowerCase()){var i=e.createTextRange();i.collapse(!0),i.moveStart("character",n),i.moveEnd("character",r-n),i.select()}else o.setOffsets(e,t)}};e.exports=s},function(e,t,n){"use strict";function r(e,t){for(var n=Math.min(e.length,t.length),r=0;n>r;r++)if(e.charAt(r)!==t.charAt(r))return r;return e.length===t.length?-1:n}function o(e){return e?e.nodeType===N?e.documentElement:e.firstChild:null}function i(e){return e.getAttribute&&e.getAttribute(A)||""}function a(e,t,n,r,o){var i;if(b.logTopLevelRenders){var a=e._currentElement.props,u=a.type;i="React mount: "+("string"==typeof u?u:u.displayName||u.name),console.time(i)}var s=x.mountComponent(e,n,null,m(e,t),o);i&&console.timeEnd(i),e._renderedComponent._topLevelWrapper=e,F._mountImageIntoNode(s,t,e,r,n)}function u(e,t,n,r){var o=w.ReactReconcileTransaction.getPooled(!n&&y.useCreateElement);o.perform(a,null,e,t,o,n,r),w.ReactReconcileTransaction.release(o)}function s(e,t,n){for(x.unmountComponent(e,n),t.nodeType===N&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)}function c(e){var t=o(e);if(t){var n=v.getInstanceFromNode(t);return!(!n||!n._nativeParent)}}function l(e){var t=o(e),n=t&&v.getInstanceFromNode(t);return n&&!n._nativeParent?n:null}function p(e){var t=l(e);return t?t._nativeContainerInfo._topLevelWrapper:null}var f=n(68),d=n(61),h=n(109),v=(n(50),n(12)),m=n(598),y=n(602),g=n(31),b=n(256),_=(n(25),n(618)),x=n(69),E=n(264),w=n(37),C=n(92),P=n(271),S=n(2),O=n(171),T=n(172),A=(n(4),d.ID_ATTRIBUTE_NAME),M=d.ROOT_ATTRIBUTE_NAME,k=1,N=9,R=11,I={},j=1,D=function(){this.rootID=j++};D.prototype.isReactComponent={},D.prototype.render=function(){return this.props};var F={TopLevelWrapper:D,_instancesByReactRootID:I,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,n,r){return F.scrollMonitor(n,function(){E.enqueueElementInternal(e,t),r&&E.enqueueCallbackInternal(e,r)}),e},_renderNewRootComponent:function(e,t,n,r){!t||t.nodeType!==k&&t.nodeType!==N&&t.nodeType!==R?S(!1):void 0,h.ensureScrollValueMonitoring();var o=P(e);w.batchedUpdates(u,o,t,n,r);var i=o._instance.rootID;return I[i]=o,o},renderSubtreeIntoContainer:function(e,t,n,r){return null==e||null==e._reactInternalInstance?S(!1):void 0,F._renderSubtreeIntoContainer(e,t,n,r)},_renderSubtreeIntoContainer:function(e,t,n,r){E.validateCallback(r,"ReactDOM.render"),g.isValidElement(t)?void 0:S(!1);var a=g(D,null,null,null,null,null,t),u=p(n);if(u){var s=u._currentElement,l=s.props;if(T(l,t)){var f=u._renderedComponent.getPublicInstance(),d=r&&function(){r.call(f)};return F._updateRootComponent(u,a,n,d),f}F.unmountComponentAtNode(n)}var h=o(n),v=h&&!!i(h),m=c(n),y=v&&!u&&!m,b=F._renderNewRootComponent(a,n,y,null!=e?e._reactInternalInstance._processChildContext(e._reactInternalInstance._context):C)._renderedComponent.getPublicInstance();return r&&r.call(b),b},render:function(e,t,n){return F._renderSubtreeIntoContainer(null,e,t,n)},unmountComponentAtNode:function(e){!e||e.nodeType!==k&&e.nodeType!==N&&e.nodeType!==R?S(!1):void 0;var t=p(e);if(!t){c(e),1===e.nodeType&&e.hasAttribute(M);return!1}return delete I[t._instance.rootID],w.batchedUpdates(s,t,e,!1),!0},_mountImageIntoNode:function(e,t,n,i,a){if(!t||t.nodeType!==k&&t.nodeType!==N&&t.nodeType!==R?S(!1):void 0,i){var u=o(t);if(_.canReuseMarkup(e,u))return void v.precacheNode(n,u);var s=u.getAttribute(_.CHECKSUM_ATTR_NAME);u.removeAttribute(_.CHECKSUM_ATTR_NAME);var c=u.outerHTML;u.setAttribute(_.CHECKSUM_ATTR_NAME,s);var l=e,p=r(l,c);" (client) "+l.substring(p-20,p+20)+"\n (server) "+c.substring(p-20,p+20);t.nodeType===N?S(!1):void 0}if(t.nodeType===N?S(!1):void 0,a.useCreateElement){for(;t.lastChild;)t.removeChild(t.lastChild);f.insertTreeBefore(t,e,null)}else O(t,e),v.precacheNode(n,t.firstChild)}};e.exports=F},function(e,t,n){"use strict";var r=n(93),o=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,SET_MARKUP:null,TEXT_CONTENT:null});e.exports=o},function(e,t,n){"use strict";function r(e){if("function"==typeof e.type)return e.type;var t=e.type,n=p[t];return null==n&&(p[t]=n=c(t)),n}function o(e){return l?void 0:s(!1),new l(e)}function i(e){return new f(e)}function a(e){return e instanceof f}var u=n(9),s=n(2),c=null,l=null,p={},f=null,d={injectGenericComponentClass:function(e){l=e},injectTextComponentClass:function(e){f=e},injectComponentClasses:function(e){u(p,e)}},h={getComponentClassForElement:r,createInternalComponent:o,createInstanceForText:i,isTextComponent:a,injection:d};e.exports=h},function(e,t,n){"use strict";var r=n(31),o=n(2),i={NATIVE:0,COMPOSITE:1,EMPTY:2,getType:function(e){return null===e||e===!1?i.EMPTY:r.isValidElement(e)?"function"==typeof e.type?i.COMPOSITE:i.NATIVE:void o(!1)}};e.exports=i},function(e,t,n){"use strict";function r(e,t){}var o=(n(4),{isMounted:function(e){return!1},enqueueCallback:function(e,t){},enqueueForceUpdate:function(e){r(e,"forceUpdate")},enqueueReplaceState:function(e,t){r(e,"replaceState")},enqueueSetState:function(e,t){r(e,"setState")}});e.exports=o},function(e,t,n){"use strict";function r(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function o(e){function t(t,n,r,o,i,a){if(o=o||w,a=a||r,null==n[r]){var u=_[i];return t?new Error("Required "+u+" `"+a+"` was not specified in "+("`"+o+"`.")):null}return e(n,r,o,i,a)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function i(e){function t(t,n,r,o,i){var a=t[n],u=m(a);if(u!==e){var s=_[o],c=y(a);return new Error("Invalid "+s+" `"+i+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."))}return null}return o(t)}function a(){return o(x.thatReturns(null))}function u(e){function t(t,n,r,o,i){if("function"!=typeof e)return new Error("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){var u=_[o],s=m(a);return new Error("Invalid "+u+" `"+i+"` of type "+("`"+s+"` supplied to `"+r+"`, expected an array."))}for(var c=0;c<a.length;c++){var l=e(a,c,r,o,i+"["+c+"]");if(l instanceof Error)return l}return null}return o(t)}function s(){function e(e,t,n,r,o){if(!b.isValidElement(e[t])){var i=_[r];return new Error("Invalid "+i+" `"+o+"` supplied to "+("`"+n+"`, expected a single ReactElement."))}return null}return o(e)}function c(e){function t(t,n,r,o,i){if(!(t[n]instanceof e)){var a=_[o],u=e.name||w,s=g(t[n]);return new Error("Invalid "+a+" `"+i+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+u+"`."))}return null}return o(t)}function l(e){function t(t,n,o,i,a){for(var u=t[n],s=0;s<e.length;s++)if(r(u,e[s]))return null;var c=_[i],l=JSON.stringify(e);return new Error("Invalid "+c+" `"+a+"` of value `"+u+"` "+("supplied to `"+o+"`, expected one of "+l+"."))}return o(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOf, expected an instance of array.")})}function p(e){function t(t,n,r,o,i){if("function"!=typeof e)return new Error("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var a=t[n],u=m(a);if("object"!==u){var s=_[o];return new Error("Invalid "+s+" `"+i+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an object."))}for(var c in a)if(a.hasOwnProperty(c)){var l=e(a,c,r,o,i+"."+c);if(l instanceof Error)return l}return null}return o(t)}function f(e){function t(t,n,r,o,i){for(var a=0;a<e.length;a++){var u=e[a];if(null==u(t,n,r,o,i))return null}var s=_[o];return new Error("Invalid "+s+" `"+i+"` supplied to "+("`"+r+"`."))}return o(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOfType, expected an instance of array.")})}function d(){function e(e,t,n,r,o){if(!v(e[t])){var i=_[r];return new Error("Invalid "+i+" `"+o+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return null}return o(e)}function h(e){function t(t,n,r,o,i){var a=t[n],u=m(a);if("object"!==u){var s=_[o];return new Error("Invalid "+s+" `"+i+"` of type `"+u+"` "+("supplied to `"+r+"`, expected `object`."))}for(var c in e){var l=e[c];if(l){var p=l(a,c,r,o,i+"."+c);if(p)return p}}return null}return o(t)}function v(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(v);if(null===e||b.isValidElement(e))return!0;var t=E(e);if(!t)return!1;var n,r=t.call(e);if(t!==e.entries){for(;!(n=r.next()).done;)if(!v(n.value))return!1}else for(;!(n=r.next()).done;){var o=n.value;if(o&&!v(o[1]))return!1}return!0;default:return!1}}function m(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":t}function y(e){var t=m(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function g(e){return e.constructor&&e.constructor.name?e.constructor.name:w}var b=n(31),_=n(110),x=n(30),E=n(169),w="<<anonymous>>",C={array:i("array"),bool:i("boolean"),func:i("function"),number:i("number"),object:i("object"),string:i("string"),any:a(),arrayOf:u,element:s(),instanceOf:c,node:d(),objectOf:p,oneOf:l,oneOfType:f,shape:h};e.exports=C},function(e,t,n){"use strict";function r(e){a.enqueueUpdate(e)}function o(e,t){var n=i.get(e);return n?n:null}var i=(n(50),n(163)),a=n(37),u=n(2),s=(n(4),{isMounted:function(e){var t=i.get(e);return t?!!t._renderedComponent:!1},enqueueCallback:function(e,t,n){s.validateCallback(t,n);var i=o(e);return i?(i._pendingCallbacks?i._pendingCallbacks.push(t):i._pendingCallbacks=[t],void r(i)):null},enqueueCallbackInternal:function(e,t){e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t],r(e)},enqueueForceUpdate:function(e){var t=o(e,"forceUpdate");t&&(t._pendingForceUpdate=!0,r(t))},enqueueReplaceState:function(e,t){var n=o(e,"replaceState");n&&(n._pendingStateQueue=[t],n._pendingReplaceState=!0,r(n))},enqueueSetState:function(e,t){var n=o(e,"setState");if(n){var i=n._pendingStateQueue||(n._pendingStateQueue=[]);i.push(t),r(n)}},enqueueElementInternal:function(e,t){e._pendingElement=t,r(e)},validateCallback:function(e,t){e&&"function"!=typeof e?u(!1):void 0}});e.exports=s},function(e,t){"use strict";e.exports="15.1.0"},function(e,t){"use strict";var n={currentScrollLeft:0,currentScrollTop:0,refreshScrollValues:function(e){n.currentScrollLeft=e.x,n.currentScrollTop=e.y}};e.exports=n},function(e,t,n){"use strict";function r(e,t){if(null==t?o(!1):void 0,null==e)return t;var n=Array.isArray(e),r=Array.isArray(t);return n&&r?(e.push.apply(e,t),e):n?(e.push(t),e):r?[e].concat(t):[e,t]}var o=n(2);e.exports=r},function(e,t){"use strict";var n=function(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)};e.exports=n},function(e,t,n){"use strict";function r(e){for(var t;(t=e._renderedNodeType)===o.COMPOSITE;)e=e._renderedComponent;return t===o.NATIVE?e._renderedComponent:t===o.EMPTY?null:void 0}var o=n(261);e.exports=r},function(e,t,n){"use strict";function r(){return!i&&o.canUseDOM&&(i="textContent"in document.documentElement?"textContent":"innerText"),i}var o=n(15),i=null;e.exports=r},function(e,t,n){"use strict";function r(e){return"function"==typeof e&&"undefined"!=typeof e.prototype&&"function"==typeof e.prototype.mountComponent&&"function"==typeof e.prototype.receiveComponent}function o(e){var t,n=null===e||e===!1;if(n)t=u.create(o);else if("object"==typeof e){var i=e;!i||"function"!=typeof i.type&&"string"!=typeof i.type?c(!1):void 0,t="string"==typeof i.type?s.createInternalComponent(i):r(i.type)?new i.type(i):new l(i)}else"string"==typeof e||"number"==typeof e?t=s.createInstanceForText(e):c(!1);t._mountIndex=0,t._mountImage=null;return t}var i=n(9),a=n(594),u=n(255),s=n(260),c=(n(25),n(2)),l=(n(4),function(e){this.construct(e)});i(l.prototype,a.Mixin,{_instantiateReactComponent:o});e.exports=o},function(e,t){"use strict";function n(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&r[e.type]||"textarea"===t)}var r={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};e.exports=n},function(e,t,n){"use strict";var r=n(15),o=n(114),i=n(171),a=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(a=function(e,t){i(e,o(t))})),e.exports=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 u=n(474),s=r(u),c=function(e){function t(e){o(this,t);var n=i(this,Object.getPrototypeOf(t).call(this,"Submit Validation Failed"));return n.errors=e,n}return a(t,e),t}(s["default"]);t["default"]=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.untouch=t.unregisterField=t.touch=t.setSubmitFailed=t.stopSubmit=t.stopAsyncValidation=t.startSubmit=t.startAsyncValidation=t.reset=t.registerField=t.initialize=t.focus=t.destroy=t.change=t.blur=t.arrayUnshift=t.arraySwap=t.arraySplice=t.arrayShift=t.arrayRemove=t.arrayPush=t.arrayPop=t.arrayInsert=void 0;var r=n(175);t.arrayInsert=function(e,t,n,o){return{type:r.ARRAY_INSERT,meta:{form:e,field:t,index:n},payload:o}},t.arrayPop=function(e,t){return{type:r.ARRAY_POP,meta:{form:e,field:t}}},t.arrayPush=function(e,t,n){return{type:r.ARRAY_PUSH,meta:{form:e,field:t},payload:n}},t.arrayRemove=function(e,t,n){return{type:r.ARRAY_REMOVE,meta:{form:e,field:t,index:n}}},t.arrayShift=function(e,t){return{type:r.ARRAY_SHIFT,meta:{form:e,field:t}}},t.arraySplice=function(e,t,n,o,i){var a={type:r.ARRAY_SPLICE,meta:{form:e,field:t,index:n,removeNum:o}};return void 0!==i&&(a.payload=i),a},t.arraySwap=function(e,t,n,o){if(n===o)throw new Error("Swap indices cannot be equal");if(0>n||0>o)throw new Error("Swap indices cannot be negative");return{type:r.ARRAY_SWAP,meta:{form:e,field:t,indexA:n,indexB:o}}},t.arrayUnshift=function(e,t,n){return{type:r.ARRAY_UNSHIFT,meta:{form:e,field:t},payload:n}},t.blur=function(e,t,n,o){return{type:r.BLUR,meta:{form:e,field:t,touch:o},payload:n}},t.change=function(e,t,n,o){return{type:r.CHANGE,meta:{form:e,field:t,touch:o},payload:n}},t.destroy=function(e){return{type:r.DESTROY,meta:{form:e}}},t.focus=function(e,t){return{type:r.FOCUS,meta:{form:e,field:t}}},t.initialize=function(e,t){return{type:r.INITIALIZE,meta:{form:e},payload:t}},t.registerField=function(e,t,n){return{type:r.REGISTER_FIELD,meta:{form:e},payload:{name:t,type:n}}},t.reset=function(e){return{type:r.RESET,meta:{form:e}}},t.startAsyncValidation=function(e,t){return{type:r.START_ASYNC_VALIDATION,meta:{form:e,field:t}}},t.startSubmit=function(e){return{type:r.START_SUBMIT,meta:{form:e}}},t.stopAsyncValidation=function(e,t){var n={type:r.STOP_ASYNC_VALIDATION,meta:{form:e},payload:t};return t&&Object.keys(t).length&&(n.error=!0),n},t.stopSubmit=function(e,t){var n={type:r.STOP_SUBMIT,meta:{form:e},payload:t};return t&&Object.keys(t).length&&(n.error=!0),n},t.setSubmitFailed=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;t>o;o++)n[o-1]=arguments[o];return{type:r.SET_SUBMIT_FAILED,meta:{form:e,fields:n},error:!0}},t.touch=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;t>o;o++)n[o-1]=arguments[o];return{type:r.TOUCH,meta:{form:e,fields:n}}},t.unregisterField=function(e,t){return{type:r.UNREGISTER_FIELD,meta:{form:e},payload:{name:t}}},t.untouch=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;t>o;o++)n[o-1]=arguments[o];return{type:r.UNTOUCH,meta:{form:e,fields:n}}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=t.dataKey="value",r=function(e,t){return function(e){e.dataTransfer.setData(n,t)}};t["default"]=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(278),i=r(o),a=function(e){var t=[];if(e)for(var n=0;n<e.length;n++){var r=e[n];r.selected&&t.push(r.value)}return t},u=function(e,t){if((0,i["default"])(e)){if(!t&&e.nativeEvent&&void 0!==e.nativeEvent.text)return e.nativeEvent.text;if(t&&void 0!==e.nativeEvent)return e.nativeEvent.text;var n=e.target,r=n.type,o=n.value,u=n.checked,s=n.files,c=e.dataTransfer;return"checkbox"===r?u:"file"===r?s||c&&c.files:"select-multiple"===r?a(e.target.options):o}return e&&void 0!==e.value?e.value:e};t["default"]=u},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return!!(e&&e.stopPropagation&&e.preventDefault)};t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(278),i=r(o),a=function(e){var t=(0,i["default"])(e);return t&&e.preventDefault(),t};t["default"]=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.values=t.untouch=t.touch=t.SubmissionError=t.stopSubmit=t.stopAsyncValidation=t.startSubmit=t.startAsyncValidation=t.setSubmitFailed=t.reset=t.propTypes=t.initialize=t.reduxForm=t.reducer=t.formValueSelector=t.focus=t.FieldArray=t.Field=t.destroy=t.change=t.blur=t.arrayUnshift=t.arraySwap=t.arraySplice=t.arrayShift=t.arrayRemove=t.arrayPush=t.arrayPop=t.arrayInsert=t.actionTypes=void 0;var o=n(654),i=r(o),a=n(79),u=r(a),s=(0,i["default"])(u["default"]),c=s.actionTypes,l=s.arrayInsert,p=s.arrayPop,f=s.arrayPush,d=s.arrayRemove,h=s.arrayShift,v=s.arraySplice,m=s.arraySwap,y=s.arrayUnshift,g=s.blur,b=s.change,_=s.destroy,x=s.Field,E=s.FieldArray,w=s.focus,C=s.formValueSelector,P=s.reducer,S=s.reduxForm,O=s.initialize,T=s.propTypes,A=s.reset,M=s.setSubmitFailed,k=s.startAsyncValidation,N=s.startSubmit,R=s.stopAsyncValidation,I=s.stopSubmit,j=s.SubmissionError,D=s.touch,F=s.untouch,L=s.values;t.actionTypes=c,t.arrayInsert=l,t.arrayPop=p,t.arrayPush=f,t.arrayRemove=d,t.arrayShift=h,t.arraySplice=v,t.arraySwap=m,t.arrayUnshift=y,t.blur=g,t.change=b,t.destroy=_,t.Field=x,t.FieldArray=E,t.focus=w,t.formValueSelector=C,t.reducer=P,t.reduxForm=S,t.initialize=O,t.propTypes=T,t.reset=A,t.setSubmitFailed=M,t.startAsyncValidation=k,t.startSubmit=N,t.stopAsyncValidation=R,t.stopSubmit=I,t.SubmissionError=j,t.touch=D,t.untouch=F,t.values=L},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="undefined"!=typeof window&&window.navigator&&window.navigator.product&&"ReactNative"===window.navigator.product;t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":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)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(106),a=r(i),u=function c(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;n>o;o++)r[o-2]=arguments[o];if(!e)return e;var i=e[t];return r.length?c.apply(void 0,[i].concat(r)):i},s=function(e,t){return u.apply(void 0,[e].concat(o((0,a["default"])(t))))};t["default"]=s},function(e,t){"use strict";function n(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];if(0===t.length)return function(e){return e};var r=function(){var e=t[t.length-1],n=t.slice(0,-1);return{v:function(){return n.reduceRight(function(e,t){return t(e)},e.apply(void 0,arguments))}}}();return"object"==typeof r?r.v:void 0}t.__esModule=!0,t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){function r(){y===m&&(y=m.slice())}function i(){return v}function u(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return r(),y.push(e),function(){if(t){t=!1,r();var n=y.indexOf(e);y.splice(n,1)}}}function l(e){if(!(0,a["default"])(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if("undefined"==typeof e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(g)throw new Error("Reducers may not dispatch actions.");try{g=!0,v=h(v,e)}finally{g=!1}for(var t=m=y,n=0;n<t.length;n++)t[n]();return e}function p(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");h=e,l({type:c.INIT})}function f(){var e,t=u;return e={subscribe:function(e){function n(){e.next&&e.next(i())}if("object"!=typeof e)throw new TypeError("Expected the observer to be an object.");n();var r=t(n);return{unsubscribe:r}}},e[s["default"]]=function(){return this},e}var d;if("function"==typeof t&&"undefined"==typeof n&&(n=t,t=void 0),"undefined"!=typeof n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(o)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var h=e,v=t,m=[],y=m,g=!1;return l({type:c.INIT}),d={dispatch:l,subscribe:u,getState:i,replaceReducer:p},d[s["default"]]=f,d}t.__esModule=!0,t.ActionTypes=void 0,t["default"]=o;var i=n(152),a=r(i),u=n(680),s=r(u),c=t.ActionTypes={INIT:"@@redux/INIT"}},function(e,t){"use strict";function n(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(t){}}t.__esModule=!0,t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(26),i=r(o),a=n(280),u=n(289),s=r(u),c=n(287),l=r(c),p=function(e){return i["default"].createElement("div",null,i["default"].createElement("label",null,e.placeholder),i["default"].createElement("div",{className:e.asyncValidating?"async-validating":""},i["default"].createElement("input",e),e.touched&&e.error&&i["default"].createElement("span",null,e.error)))},f=function(e){var t=e.handleSubmit,n=e.pristine,r=e.reset,o=e.submitting;return i["default"].createElement("form",{onSubmit:t},i["default"].createElement(a.Field,{name:"username",type:"text",component:p,placeholder:"Username"}),i["default"].createElement(a.Field,{name:"password",type:"password",component:p,placeholder:"Password"}),i["default"].createElement("div",null,i["default"].createElement("button",{type:"submit",disabled:o},"Sign Up"),i["default"].createElement("button",{type:"button",disabled:n||o,onClick:r},"Clear Values")))};t["default"]=(0,a.reduxForm)({form:"asyncValidation",validate:s["default"],asyncValidate:l["default"],asyncBlurFields:["username"]})(f)},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return new Promise(function(t){return setTimeout(t,e)})},r=function(e){return n(1e3).then(function(){if(["john","paul","george","ringo"].includes(e.username))throw{username:"That username is taken"}})};t["default"]=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var o=n(26),i=r(o),a=n(578),u=r(a),s=n(75),c=n(176),l=n(280),p=n(648),f=document.getElementById("content"),d=(0,c.combineReducers)({form:l.reducer}),h=(window.devToolsExtension?window.devToolsExtension()(c.createStore):c.createStore)(d),v=function(e){return new Promise(function(t){setTimeout(function(){window.alert("You submitted:\n\n"+JSON.stringify(e,null,2)),t()},500)})},m=function(){var e=n(286)["default"],t=n(489),r=n(575),o=n(577),a=n(576);u["default"].render(i["default"].createElement(s.Provider,{store:h},i["default"].createElement(p.App,{version:"6.0.0-alpha.14",path:"/examples/asyncValidation",breadcrumbs:(0,p.generateExampleBreadcrumbs)("asyncValidation","Async Validation Example","6.0.0-alpha.14")},i["default"].createElement(p.Markdown,{content:t}),i["default"].createElement("h2",null,"Form"),i["default"].createElement(e,{onSubmit:v}),i["default"].createElement(p.Values,{form:"asyncValidation"}),i["default"].createElement("h2",null,"Code"),i["default"].createElement("h4",null,"validate.js"),i["default"].createElement(p.Code,{source:o}),i["default"].createElement("h4",null,"asyncValidate.js"),i["default"].createElement(p.Code,{source:a}),i["default"].createElement("h4",null,"AsyncValidationForm.js"),i["default"].createElement(p.Code,{source:r}))),f)};m()},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){var t={};return e.username||(t.username="Required"),e.password||(t.password="Required"),t};t["default"]=n},function(e,t,n){(function(e){"use strict";function t(e,t,n){e[t]||Object[r](e,t,{writable:!0,configurable:!0,value:n})}if(n(473),n(291),n(292),e._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");e._babelPolyfill=!0;var r="defineProperty";t(String.prototype,"padLeft","".padStart),t(String.prototype,"padRight","".padEnd),"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function(e){[][e]&&t(Array,e,Function.call.bind([][e]))})}).call(t,function(){return this}())},function(e,t,n){(function(t,n){!function(t){"use strict";function r(e,t,n,r){var o=Object.create((t||i).prototype),a=new h(r||[]);return o._invoke=p(e,n,a),o}function o(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(r){return{type:"throw",arg:r}}}function i(){}function a(){}function u(){}function s(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function c(e){this.arg=e}function l(e){function t(t,n){var r=e[t](n),o=r.value;return o instanceof c?Promise.resolve(o.arg).then(i,a):Promise.resolve(o).then(function(e){return r.value=e,r})}function r(e,n){function r(){return t(e,n)}return o=o?o.then(r,r):new Promise(function(e){e(r())})}"object"==typeof n&&n.domain&&(t=n.domain.bind(t));var o,i=t.bind(e,"next"),a=t.bind(e,"throw");t.bind(e,"return");this._invoke=r}function p(e,t,n){var r=E;return function(i,a){if(r===C)throw new Error("Generator is already running");if(r===P){if("throw"===i)throw a;return m()}for(;;){var u=n.delegate;if(u){if("return"===i||"throw"===i&&u.iterator[i]===y){n.delegate=null;var s=u.iterator["return"];if(s){var c=o(s,u.iterator,a);if("throw"===c.type){i="throw",a=c.arg;continue}}if("return"===i)continue}var c=o(u.iterator[i],u.iterator,a);if("throw"===c.type){n.delegate=null,i="throw",a=c.arg;continue}i="next",a=y;var l=c.arg;if(!l.done)return r=w,l;n[u.resultName]=l.value,n.next=u.nextLoc,n.delegate=null}if("next"===i)n._sent=a,r===w?n.sent=a:n.sent=y;else if("throw"===i){if(r===E)throw r=P,a;n.dispatchException(a)&&(i="next",a=y)}else"return"===i&&n.abrupt("return",a);r=C;var c=o(e,t,n);if("normal"===c.type){r=n.done?P:w;var l={value:c.arg,done:n.done};if(c.arg!==S)return l;n.delegate&&"next"===i&&(a=y)}else"throw"===c.type&&(r=P,i="throw",a=c.arg)}}}function f(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function d(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function h(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(f,this),this.reset(!0)}function v(e){if(e){var t=e[b];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function o(){for(;++n<e.length;)if(g.call(e,n))return o.value=e[n],o.done=!1,o;return o.value=y,o.done=!0,o};return r.next=r}}return{next:m}}function m(){return{value:y,done:!0}}var y,g=Object.prototype.hasOwnProperty,b="function"==typeof Symbol&&Symbol.iterator||"@@iterator",_="object"==typeof e,x=t.regeneratorRuntime;if(x)return void(_&&(e.exports=x));x=t.regeneratorRuntime=_?e.exports:{},x.wrap=r;var E="suspendedStart",w="suspendedYield",C="executing",P="completed",S={},O=u.prototype=i.prototype;a.prototype=O.constructor=u,u.constructor=a,a.displayName="GeneratorFunction",x.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return t?t===a||"GeneratorFunction"===(t.displayName||t.name):!1},x.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):e.__proto__=u,e.prototype=Object.create(O),e},x.awrap=function(e){return new c(e)},s(l.prototype),x.async=function(e,t,n,o){var i=new l(r(e,t,n,o));return x.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},s(O),O[b]=function(){return this},O.toString=function(){return"[object Generator]"},x.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},x.values=v,h.prototype={constructor:h,reset:function(e){if(this.prev=0,this.next=0,this.sent=y,this.done=!1,this.delegate=null,this.tryEntries.forEach(d),!e)for(var t in this)"t"===t.charAt(0)&&g.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=y)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return i.type="throw",i.arg=e,n.next=t,!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=g.call(o,"catchLoc"),u=g.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&g.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?this.next=o.finallyLoc:this.complete(i),S},complete:function(e,t){if("throw"===e.type)throw e.arg;"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=e.arg,this.next="end"):"normal"===e.type&&t&&(this.next=t)},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),d(n),S}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;d(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:v(e),resultName:t,nextLoc:n},S}}}("object"==typeof t?t:"object"==typeof window?window:"object"==typeof self?self:this)}).call(t,function(){return this}(),n(574))},function(e,t,n){n(302),e.exports=n(33).RegExp.escape},function(e,t,n){var r=n(7),o=n(123),i=n(8)("species");e.exports=function(e){var t;return o(e)&&(t=e.constructor,"function"!=typeof t||t!==Array&&!o(t.prototype)||(t=void 0),r(t)&&(t=t[i],null===t&&(t=void 0))),void 0===t?Array:t}},function(e,t,n){var r=n(293);e.exports=function(e,t){
return new(r(e))(t)}},function(e,t,n){"use strict";var r=n(3),o=n(35),i="number";e.exports=function(e){if("string"!==e&&e!==i&&"default"!==e)throw TypeError("Incorrect hint");return o(r(this),e!=i)}},function(e,t,n){var r=n(55),o=n(88),i=n(71);e.exports=function(e){var t=r(e),n=o.f;if(n)for(var a,u=n(e),s=i.f,c=0;u.length>c;)s.call(e,a=u[c++])&&t.push(a);return t}},function(e,t,n){var r=n(55),o=n(21);e.exports=function(e,t){for(var n,i=o(e),a=r(i),u=a.length,s=0;u>s;)if(i[n=a[s++]]===t)return n}},function(e,t,n){"use strict";var r=n(299),o=n(84),i=n(18);e.exports=function(){for(var e=i(this),t=arguments.length,n=Array(t),a=0,u=r._,s=!1;t>a;)(n[a]=arguments[a++])===u&&(s=!0);return function(){var r,i=this,a=arguments.length,c=0,l=0;if(!s&&!a)return o(e,n,i);if(r=n.slice(),s)for(;t>c;c++)r[c]===u&&(r[c]=arguments[l++]);for(;a>l;)r.push(arguments[l++]);return o(e,r,i)}}},function(e,t,n){e.exports=n(5)},function(e,t){e.exports=function(e,t){var n=t===Object(t)?function(e){return t[e]}:t;return function(t){return String(t).replace(e,n)}}},function(e,t,n){var r=n(63),o=n(8)("iterator"),i=n(51);e.exports=n(33).isIterable=function(e){var t=Object(e);return void 0!==t[o]||"@@iterator"in t||i.hasOwnProperty(r(t))}},function(e,t,n){var r=n(1),o=n(300)(/[\\^$*+?.()|[\]{}]/g,"\\$&");r(r.S,"RegExp",{escape:function(e){return o(e)}})},function(e,t,n){var r=n(1);r(r.P,"Array",{copyWithin:n(178)}),n(62)("copyWithin")},function(e,t,n){"use strict";var r=n(1),o=n(32)(4);r(r.P+r.F*!n(29)([].every,!0),"Array",{every:function(e){return o(this,e,arguments[1])}})},function(e,t,n){var r=n(1);r(r.P,"Array",{fill:n(115)}),n(62)("fill")},function(e,t,n){"use strict";var r=n(1),o=n(32)(2);r(r.P+r.F*!n(29)([].filter,!0),"Array",{filter:function(e){return o(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(1),o=n(32)(6),i="findIndex",a=!0;i in[]&&Array(1)[i](function(){a=!1}),r(r.P+r.F*a,"Array",{findIndex:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),n(62)(i)},function(e,t,n){"use strict";var r=n(1),o=n(32)(5),i="find",a=!0;i in[]&&Array(1)[i](function(){a=!1}),r(r.P+r.F*a,"Array",{find:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),n(62)(i)},function(e,t,n){"use strict";var r=n(1),o=n(32)(0),i=n(29)([].forEach,!0);r(r.P+r.F*!i,"Array",{forEach:function(e){return o(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(38),o=n(1),i=n(14),a=n(186),u=n(122),s=n(13),c=n(116),l=n(139);o(o.S+o.F*!n(86)(function(e){Array.from(e)}),"Array",{from:function(e){var t,n,o,p,f=i(e),d="function"==typeof this?this:Array,h=arguments.length,v=h>1?arguments[1]:void 0,m=void 0!==v,y=0,g=l(f);if(m&&(v=r(v,h>2?arguments[2]:void 0,2)),void 0==g||d==Array&&u(g))for(t=s(f.length),n=new d(t);t>y;y++)c(n,y,m?v(f[y],y):f[y]);else for(p=g.call(f),n=new d;!(o=p.next()).done;y++)c(n,y,m?a(p,v,[o.value,y],!0):o.value);return n.length=y,n}})},function(e,t,n){"use strict";var r=n(1),o=n(80)(!1),i=[].indexOf,a=!!i&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(a||!n(29)(i)),"Array",{indexOf:function(e){return a?i.apply(this,arguments)||0:o(this,e,arguments[1])}})},function(e,t,n){var r=n(1);r(r.S,"Array",{isArray:n(123)})},function(e,t,n){"use strict";var r=n(1),o=n(21),i=[].join;r(r.P+r.F*(n(70)!=Object||!n(29)(i)),"Array",{join:function(e){return i.call(o(this),void 0===e?",":e)}})},function(e,t,n){"use strict";var r=n(1),o=n(21),i=n(46),a=n(13),u=[].lastIndexOf,s=!!u&&1/[1].lastIndexOf(1,-0)<0;r(r.P+r.F*(s||!n(29)(u)),"Array",{lastIndexOf:function(e){if(s)return u.apply(this,arguments)||0;var t=o(this),n=a(t.length),r=n-1;for(arguments.length>1&&(r=Math.min(r,i(arguments[1]))),0>r&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}})},function(e,t,n){"use strict";var r=n(1),o=n(32)(1);r(r.P+r.F*!n(29)([].map,!0),"Array",{map:function(e){return o(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(1),o=n(116);r(r.S+r.F*n(6)(function(){function e(){}return!(Array.of.call(e)instanceof e)}),"Array",{of:function(){for(var e=0,t=arguments.length,n=new("function"==typeof this?this:Array)(t);t>e;)o(n,e,arguments[e++]);return n.length=t,n}})},function(e,t,n){"use strict";var r=n(1),o=n(180);r(r.P+r.F*!n(29)([].reduceRight,!0),"Array",{reduceRight:function(e){return o(this,e,arguments.length,arguments[1],!0)}})},function(e,t,n){"use strict";var r=n(1),o=n(180);r(r.P+r.F*!n(29)([].reduce,!0),"Array",{reduce:function(e){return o(this,e,arguments.length,arguments[1],!1)}})},function(e,t,n){"use strict";var r=n(1),o=n(120),i=n(27),a=n(58),u=n(13),s=[].slice;r(r.P+r.F*n(6)(function(){o&&s.call(o)}),"Array",{slice:function(e,t){var n=u(this.length),r=i(this);if(t=void 0===t?n:t,"Array"==r)return s.call(this,e,t);for(var o=a(e,n),c=a(t,n),l=u(c-o),p=Array(l),f=0;l>f;f++)p[f]="String"==r?this.charAt(o+f):this[o+f];return p}})},function(e,t,n){"use strict";var r=n(1),o=n(32)(3);r(r.P+r.F*!n(29)([].some,!0),"Array",{some:function(e){return o(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(1),o=n(18),i=n(14),a=n(6),u=[].sort,s=[1,2,3];r(r.P+r.F*(a(function(){s.sort(void 0)})||!a(function(){s.sort(null)})||!n(29)(u)),"Array",{sort:function(e){return void 0===e?u.call(i(this)):u.call(i(this),o(e))}})},function(e,t,n){n(57)("Array")},function(e,t,n){var r=n(1);r(r.S,"Date",{now:function(){return(new Date).getTime()}})},function(e,t,n){"use strict";var r=n(1),o=n(6),i=Date.prototype.getTime,a=function(e){return e>9?e:"0"+e};r(r.P+r.F*(o(function(){return"0385-07-25T07:06:39.999Z"!=new Date(-5e13-1).toISOString()})||!o(function(){new Date(NaN).toISOString()})),"Date",{toISOString:function(){if(!isFinite(i.call(this)))throw RangeError("Invalid time value");var e=this,t=e.getUTCFullYear(),n=e.getUTCMilliseconds(),r=0>t?"-":t>9999?"+":"";return r+("00000"+Math.abs(t)).slice(r?-6:-4)+"-"+a(e.getUTCMonth()+1)+"-"+a(e.getUTCDate())+"T"+a(e.getUTCHours())+":"+a(e.getUTCMinutes())+":"+a(e.getUTCSeconds())+"."+(n>99?n:"0"+a(n))+"Z"}})},function(e,t,n){"use strict";var r=n(1),o=n(14),i=n(35);r(r.P+r.F*n(6)(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}),"Date",{toJSON:function(e){var t=o(this),n=i(t);return"number"!=typeof n||isFinite(n)?t.toISOString():null}})},function(e,t,n){var r=n(8)("toPrimitive"),o=Date.prototype;r in o||n(17)(o,r,n(295))},function(e,t,n){var r=Date.prototype,o="Invalid Date",i="toString",a=r[i],u=r.getTime;new Date(NaN)+""!=o&&n(19)(r,i,function(){var e=u.call(this);return e===e?a.call(this):o})},function(e,t,n){var r=n(1);r(r.P,"Function",{bind:n(181)})},function(e,t,n){"use strict";var r=n(7),o=n(23),i=n(8)("hasInstance"),a=Function.prototype;i in a||n(11).f(a,i,{value:function(e){if("function"!=typeof this||!r(e))return!1;if(!r(this.prototype))return e instanceof this;for(;e=o(e);)if(this.prototype===e)return!0;return!1}})},function(e,t,n){var r=n(11).f,o=n(45),i=n(16),a=Function.prototype,u=/^\s*function ([^ (]*)/,s="name",c=Object.isExtensible||function(){return!0};s in a||n(10)&&r(a,s,{configurable:!0,get:function(){try{var e=this,t=(""+e).match(u)[1];return i(e,s)||!c(e)||r(e,s,o(5,t)),t}catch(n){return""}}})},function(e,t,n){var r=n(1),o=n(188),i=Math.sqrt,a=Math.acosh;r(r.S+r.F*!(a&&710==Math.floor(a(Number.MAX_VALUE))&&a(1/0)==1/0),"Math",{acosh:function(e){return(e=+e)<1?NaN:e>94906265.62425156?Math.log(e)+Math.LN2:o(e-1+i(e-1)*i(e+1))}})},function(e,t,n){function r(e){return isFinite(e=+e)&&0!=e?0>e?-r(-e):Math.log(e+Math.sqrt(e*e+1)):e}var o=n(1),i=Math.asinh;o(o.S+o.F*!(i&&1/i(0)>0),"Math",{asinh:r})},function(e,t,n){var r=n(1),o=Math.atanh;r(r.S+r.F*!(o&&1/o(-0)<0),"Math",{atanh:function(e){return 0==(e=+e)?e:Math.log((1+e)/(1-e))/2}})},function(e,t,n){var r=n(1),o=n(128);r(r.S,"Math",{cbrt:function(e){return o(e=+e)*Math.pow(Math.abs(e),1/3)}})},function(e,t,n){var r=n(1);r(r.S,"Math",{clz32:function(e){return(e>>>=0)?31-Math.floor(Math.log(e+.5)*Math.LOG2E):32}})},function(e,t,n){var r=n(1),o=Math.exp;r(r.S,"Math",{cosh:function(e){return(o(e=+e)+o(-e))/2}})},function(e,t,n){var r=n(1),o=n(127);r(r.S+r.F*(o!=Math.expm1),"Math",{expm1:o})},function(e,t,n){var r=n(1),o=n(128),i=Math.pow,a=i(2,-52),u=i(2,-23),s=i(2,127)*(2-u),c=i(2,-126),l=function(e){return e+1/a-1/a};r(r.S,"Math",{fround:function(e){var t,n,r=Math.abs(e),i=o(e);return c>r?i*l(r/c/u)*c*u:(t=(1+u/a)*r,n=t-(t-r),n>s||n!=n?i*(1/0):i*n)}})},function(e,t,n){var r=n(1),o=Math.abs;r(r.S,"Math",{hypot:function(e,t){for(var n,r,i=0,a=0,u=arguments.length,s=0;u>a;)n=o(arguments[a++]),n>s?(r=s/n,i=i*r*r+1,s=n):n>0?(r=n/s,i+=r*r):i+=n;return s===1/0?1/0:s*Math.sqrt(i)}})},function(e,t,n){var r=n(1),o=Math.imul;r(r.S+r.F*n(6)(function(){return-5!=o(4294967295,5)||2!=o.length}),"Math",{imul:function(e,t){var n=65535,r=+e,o=+t,i=n&r,a=n&o;return 0|i*a+((n&r>>>16)*a+i*(n&o>>>16)<<16>>>0)}})},function(e,t,n){var r=n(1);r(r.S,"Math",{log10:function(e){return Math.log(e)/Math.LN10}})},function(e,t,n){var r=n(1);r(r.S,"Math",{log1p:n(188)})},function(e,t,n){var r=n(1);r(r.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}})},function(e,t,n){var r=n(1);r(r.S,"Math",{sign:n(128)})},function(e,t,n){var r=n(1),o=n(127),i=Math.exp;r(r.S+r.F*n(6)(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(e){return Math.abs(e=+e)<1?(o(e)-o(-e))/2:(i(e-1)-i(-e-1))*(Math.E/2)}})},function(e,t,n){var r=n(1),o=n(127),i=Math.exp;r(r.S,"Math",{tanh:function(e){var t=o(e=+e),n=o(-e);return t==1/0?1:n==1/0?-1:(t-n)/(i(e)+i(-e))}})},function(e,t,n){var r=n(1);r(r.S,"Math",{trunc:function(e){return(e>0?Math.floor:Math.ceil)(e)}})},function(e,t,n){"use strict";var r=n(5),o=n(16),i=n(27),a=n(121),u=n(35),s=n(6),c=n(54).f,l=n(22).f,p=n(11).f,f=n(66).trim,d="Number",h=r[d],v=h,m=h.prototype,y=i(n(53)(m))==d,g="trim"in String.prototype,b=function(e){var t=u(e,!1);if("string"==typeof t&&t.length>2){t=g?t.trim():f(t,3);var n,r,o,i=t.charCodeAt(0);if(43===i||45===i){if(n=t.charCodeAt(2),88===n||120===n)return NaN}else if(48===i){switch(t.charCodeAt(1)){case 66:case 98:r=2,o=49;break;case 79:case 111:r=8,o=55;break;default:return+t}for(var a,s=t.slice(2),c=0,l=s.length;l>c;c++)if(a=s.charCodeAt(c),48>a||a>o)return NaN;return parseInt(s,r)}}return+t};if(!h(" 0o1")||!h("0b1")||h("+0x1")){h=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof h&&(y?s(function(){m.valueOf.call(n)}):i(n)!=d)?a(new v(b(t)),n,h):b(t)};for(var _,x=n(10)?c(v):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),E=0;x.length>E;E++)o(v,_=x[E])&&!o(h,_)&&p(h,_,l(v,_));h.prototype=m,m.constructor=h,n(19)(r,d,h)}},function(e,t,n){var r=n(1);r(r.S,"Number",{EPSILON:Math.pow(2,-52)})},function(e,t,n){var r=n(1),o=n(5).isFinite;r(r.S,"Number",{isFinite:function(e){return"number"==typeof e&&o(e)}})},function(e,t,n){var r=n(1);r(r.S,"Number",{isInteger:n(124)})},function(e,t,n){var r=n(1);r(r.S,"Number",{isNaN:function(e){return e!=e}})},function(e,t,n){var r=n(1),o=n(124),i=Math.abs;r(r.S,"Number",{isSafeInteger:function(e){return o(e)&&i(e)<=9007199254740991}})},function(e,t,n){var r=n(1);r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(e,t,n){var r=n(1);r(r.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(e,t,n){var r=n(1),o=n(195);r(r.S+r.F*(Number.parseFloat!=o),"Number",{parseFloat:o})},function(e,t,n){var r=n(1),o=n(196);r(r.S+r.F*(Number.parseInt!=o),"Number",{parseInt:o})},function(e,t,n){"use strict";var r=n(1),o=(n(43),n(46)),i=n(177),a=n(134),u=1..toFixed,s=Math.floor,c=[0,0,0,0,0,0],l="Number.toFixed: incorrect invocation!",p="0",f=function(e,t){for(var n=-1,r=t;++n<6;)r+=e*c[n],c[n]=r%1e7,r=s(r/1e7)},d=function(e){for(var t=6,n=0;--t>=0;)n+=c[t],c[t]=s(n/e),n=n%e*1e7},h=function(){for(var e=6,t="";--e>=0;)if(""!==t||0===e||0!==c[e]){var n=String(c[e]);t=""===t?n:t+a.call(p,7-n.length)+n}return t},v=function(e,t,n){return 0===t?n:t%2===1?v(e,t-1,n*e):v(e*e,t/2,n)},m=function(e){for(var t=0,n=e;n>=4096;)t+=12,n/=4096;for(;n>=2;)t+=1,n/=2;return t};r(r.P+r.F*(!!u&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==0xde0b6b3a7640080.toFixed(0))||!n(6)(function(){u.call({})})),"Number",{toFixed:function(e){var t,n,r,u,s=i(this,l),c=o(e),y="",g=p;if(0>c||c>20)throw RangeError(l);if(s!=s)return"NaN";if(-1e21>=s||s>=1e21)return String(s);if(0>s&&(y="-",s=-s),s>1e-21)if(t=m(s*v(2,69,1))-69,n=0>t?s*v(2,-t,1):s/v(2,t,1),n*=4503599627370496,t=52-t,t>0){for(f(0,n),r=c;r>=7;)f(1e7,0),r-=7;for(f(v(10,r,1),0),r=t-1;r>=23;)d(1<<23),r-=23;d(1<<r),f(1,1),d(2),g=h()}else f(0,n),f(1<<-t,0),g=h()+a.call(p,c);return c>0?(u=g.length,g=y+(c>=u?"0."+a.call(p,c-u)+g:g.slice(0,u-c)+"."+g.slice(u-c))):g=y+g,g}})},function(e,t,n){"use strict";var r=n(1),o=n(6),i=n(177),a=1..toPrecision;r(r.P+r.F*(o(function(){return"1"!==a.call(1,void 0)})||!o(function(){a.call({})})),"Number",{toPrecision:function(e){var t=i(this,"Number#toPrecision: incorrect invocation!");return void 0===e?a.call(t):a.call(t,e)}})},function(e,t,n){var r=n(1);r(r.S+r.F,"Object",{assign:n(189)})},function(e,t,n){var r=n(1);r(r.S,"Object",{create:n(53)})},function(e,t,n){var r=n(1);r(r.S+r.F*!n(10),"Object",{defineProperties:n(190)})},function(e,t,n){var r=n(1);r(r.S+r.F*!n(10),"Object",{defineProperty:n(11).f})},function(e,t,n){var r=n(7),o=n(44).onFreeze;n(34)("freeze",function(e){return function(t){return e&&r(t)?e(o(t)):t}})},function(e,t,n){var r=n(21),o=n(22).f;n(34)("getOwnPropertyDescriptor",function(){return function(e,t){return o(r(e),t)}})},function(e,t,n){n(34)("getOwnPropertyNames",function(){return n(191).f})},function(e,t,n){var r=n(14),o=n(23);n(34)("getPrototypeOf",function(){return function(e){return o(r(e))}})},function(e,t,n){var r=n(7);n(34)("isExtensible",function(e){return function(t){return r(t)?e?e(t):!0:!1}})},function(e,t,n){var r=n(7);n(34)("isFrozen",function(e){return function(t){return r(t)?e?e(t):!1:!0}})},function(e,t,n){var r=n(7);n(34)("isSealed",function(e){return function(t){return r(t)?e?e(t):!1:!0}})},function(e,t,n){var r=n(1);r(r.S,"Object",{is:n(197)})},function(e,t,n){var r=n(14),o=n(55);n(34)("keys",function(){return function(e){return o(r(e))}})},function(e,t,n){var r=n(7),o=n(44).onFreeze;n(34)("preventExtensions",function(e){return function(t){return e&&r(t)?e(o(t)):t}})},function(e,t,n){var r=n(7),o=n(44).onFreeze;n(34)("seal",function(e){return function(t){return e&&r(t)?e(o(t)):t}})},function(e,t,n){var r=n(1);r(r.S,"Object",{setPrototypeOf:n(89).set})},function(e,t,n){"use strict";var r=n(63),o={};o[n(8)("toStringTag")]="z",o+""!="[object z]"&&n(19)(Object.prototype,"toString",function(){return"[object "+r(this)+"]"},!0)},function(e,t,n){var r=n(1),o=n(195);r(r.G+r.F*(parseFloat!=o),{parseFloat:o})},function(e,t,n){var r=n(1),o=n(196);r(r.G+r.F*(parseInt!=o),{parseInt:o})},function(e,t,n){"use strict";var r,o,i,a=n(52),u=n(5),s=n(38),c=n(63),l=n(1),p=n(7),f=(n(3),n(18)),d=n(43),h=n(64),v=(n(89).set,n(131)),m=n(136).set,y=n(129)(),g="Promise",b=u.TypeError,_=u.process,x=u[g],_=u.process,E="process"==c(_),w=function(){},C=!!function(){try{var e=x.resolve(1),t=(e.constructor={})[n(8)("species")]=function(e){e(w,w)};return(E||"function"==typeof PromiseRejectionEvent)&&e.then(w)instanceof t}catch(r){}}(),P=function(e,t){return e===t||e===x&&t===i},S=function(e){var t;return p(e)&&"function"==typeof(t=e.then)?t:!1},O=function(e){return P(x,e)?new T(e):new o(e)},T=o=function(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw b("Bad Promise constructor");t=e,n=r}),this.resolve=f(t),this.reject=f(n)},A=function(e){try{e()}catch(t){return{error:t}}},M=function(e,t){if(!e._n){e._n=!0;var n=e._c;y(function(){for(var r=e._v,o=1==e._s,i=0,a=function(t){var n,i,a=o?t.ok:t.fail,u=t.resolve,s=t.reject,c=t.domain;try{a?(o||(2==e._h&&R(e),e._h=1),a===!0?n=r:(c&&c.enter(),n=a(r),c&&c.exit()),n===t.promise?s(b("Promise-chain cycle")):(i=S(n))?i.call(n,u,s):u(n)):s(r)}catch(l){s(l)}};n.length>i;)a(n[i++]);e._c=[],e._n=!1,t&&!e._h&&k(e)})}},k=function(e){m.call(u,function(){var t,n,r,o=e._v;if(N(e)&&(t=A(function(){E?_.emit("unhandledRejection",o,e):(n=u.onunhandledrejection)?n({promise:e,reason:o}):(r=u.console)&&r.error&&r.error("Unhandled promise rejection",o)}),e._h=E||N(e)?2:1),e._a=void 0,t)throw t.error})},N=function(e){if(1==e._h)return!1;for(var t,n=e._a||e._c,r=0;n.length>r;)if(t=n[r++],t.fail||!N(t.promise))return!1;return!0},R=function(e){m.call(u,function(){var t;E?_.emit("rejectionHandled",e):(t=u.onrejectionhandled)&&t({promise:e,reason:e._v})})},I=function(e){var t=this;t._d||(t._d=!0,t=t._w||t,t._v=e,t._s=2,t._a||(t._a=t._c.slice()),M(t,!0))},j=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw b("Promise can't be resolved itself");(t=S(e))?y(function(){var r={_w:n,_d:!1};try{t.call(e,s(j,r,1),s(I,r,1))}catch(o){I.call(r,o)}}):(n._v=e,n._s=1,M(n,!1))}catch(r){I.call({_w:n,_d:!1},r)}}};C||(x=function(e){d(this,x,g,"_h"),f(e),r.call(this);try{e(s(j,this,1),s(I,this,1))}catch(t){I.call(this,t)}},r=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},r.prototype=n(56)(x.prototype,{then:function(e,t){var n=O(v(this,x));return n.ok="function"==typeof e?e:!0,n.fail="function"==typeof t&&t,n.domain=E?_.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&M(this,!1),n.promise},"catch":function(e){return this.then(void 0,e)}}),T=function(){var e=new r;this.promise=e,this.resolve=s(j,e,1),this.reject=s(I,e,1)}),l(l.G+l.W+l.F*!C,{Promise:x}),n(65)(x,g),n(57)(g),i=n(33)[g],l(l.S+l.F*!C,g,{reject:function(e){var t=O(this),n=t.reject;return n(e),t.promise}}),l(l.S+l.F*(a||!C),g,{resolve:function(e){if(e instanceof x&&P(e.constructor,this))return e;var t=O(this),n=t.resolve;return n(e),t.promise}}),l(l.S+l.F*!(C&&n(86)(function(e){x.all(e)["catch"](w)})),g,{all:function(e){var t=this,n=O(t),r=n.resolve,o=n.reject,i=A(function(){var n=[],i=0,a=1;h(e,!1,function(e){var u=i++,s=!1;n.push(void 0),a++,t.resolve(e).then(function(e){s||(s=!0,n[u]=e,--a||r(n))},o)}),--a||r(n)});return i&&o(i.error),n.promise},race:function(e){var t=this,n=O(t),r=n.reject,o=A(function(){h(e,!1,function(e){t.resolve(e).then(n.resolve,r)})});return o&&r(o.error),n.promise}})},function(e,t,n){var r=n(1),o=n(18),i=n(3),a=Function.apply;r(r.S,"Reflect",{apply:function(e,t,n){return a.call(o(e),t,i(n))}})},function(e,t,n){var r=n(1),o=n(53),i=n(18),a=n(3),u=n(7),s=n(181);r(r.S+r.F*n(6)(function(){function e(){}return!(Reflect.construct(function(){},[],e)instanceof e)}),"Reflect",{construct:function(e,t){i(e),a(t);var n=arguments.length<3?e:i(arguments[2]);if(e==n){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var r=[null];return r.push.apply(r,t),new(s.apply(e,r))}var c=n.prototype,l=o(u(c)?c:Object.prototype),p=Function.apply.call(e,l,t);return u(p)?p:l}})},function(e,t,n){var r=n(11),o=n(1),i=n(3),a=n(35);o(o.S+o.F*n(6)(function(){Reflect.defineProperty(r.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(e,t,n){i(e),t=a(t,!0),i(n);try{return r.f(e,t,n),!0}catch(o){return!1}}})},function(e,t,n){var r=n(1),o=n(22).f,i=n(3);r(r.S,"Reflect",{deleteProperty:function(e,t){var n=o(i(e),t);return n&&!n.configurable?!1:delete e[t]}})},function(e,t,n){"use strict";var r=n(1),o=n(3),i=function(e){this._t=o(e),this._i=0;var t,n=this._k=[];for(t in e)n.push(t)};n(125)(i,"Object",function(){var e,t=this,n=t._k;do if(t._i>=n.length)return{value:void 0,done:!0};while(!((e=n[t._i++])in t._t));return{value:e,done:!1}}),r(r.S,"Reflect",{enumerate:function(e){return new i(e)}})},function(e,t,n){var r=n(22),o=n(1),i=n(3);o(o.S,"Reflect",{getOwnPropertyDescriptor:function(e,t){return r.f(i(e),t)}})},function(e,t,n){var r=n(1),o=n(23),i=n(3);r(r.S,"Reflect",{getPrototypeOf:function(e){return o(i(e))}})},function(e,t,n){function r(e,t){var n,u,l=arguments.length<3?e:arguments[2];return c(e)===l?e[t]:(n=o.f(e,t))?a(n,"value")?n.value:void 0!==n.get?n.get.call(l):void 0:s(u=i(e))?r(u,t,l):void 0}var o=n(22),i=n(23),a=n(16),u=n(1),s=n(7),c=n(3);u(u.S,"Reflect",{get:r})},function(e,t,n){var r=n(1);r(r.S,"Reflect",{has:function(e,t){return t in e}})},function(e,t,n){var r=n(1),o=n(3),i=Object.isExtensible;r(r.S,"Reflect",{isExtensible:function(e){return o(e),i?i(e):!0}})},function(e,t,n){var r=n(1);r(r.S,"Reflect",{ownKeys:n(194)})},function(e,t,n){var r=n(1),o=n(3),i=Object.preventExtensions;r(r.S,"Reflect",{preventExtensions:function(e){o(e);try{return i&&i(e),!0}catch(t){return!1}}})},function(e,t,n){var r=n(1),o=n(89);o&&r(r.S,"Reflect",{setPrototypeOf:function(e,t){o.check(e,t);try{return o.set(e,t),!0}catch(n){return!1}}})},function(e,t,n){function r(e,t,n){var s,f,d=arguments.length<4?e:arguments[3],h=i.f(l(e),t);if(!h){if(p(f=a(e)))return r(f,t,n,d);h=c(0)}return u(h,"value")?h.writable!==!1&&p(d)?(s=i.f(d,t)||c(0),s.value=n,o.f(d,t,s),!0):!1:void 0===h.set?!1:(h.set.call(d,n),!0)}var o=n(11),i=n(22),a=n(23),u=n(16),s=n(1),c=n(45),l=n(3),p=n(7);s(s.S,"Reflect",{set:r})},function(e,t,n){var r=n(5),o=n(121),i=n(11).f,a=n(54).f,u=n(85),s=n(83),c=r.RegExp,l=c,p=c.prototype,f=/a/g,d=/a/g,h=new c(f)!==f;if(n(10)&&(!h||n(6)(function(){return d[n(8)("match")]=!1,c(f)!=f||c(d)==d||"/a/i"!=c(f,"i")}))){c=function(e,t){var n=this instanceof c,r=u(e),i=void 0===t;return!n&&r&&e.constructor===c&&i?e:o(h?new l(r&&!i?e.source:e,t):l((r=e instanceof c)?e.source:e,r&&i?s.call(e):t),n?this:p,c)};for(var v=(function(e){e in c||i(c,e,{configurable:!0,get:function(){return l[e]},set:function(t){l[e]=t}})}),m=a(l),y=0;m.length>y;)v(m[y++]);p.constructor=c,c.prototype=p,n(19)(r,"RegExp",c)}n(57)("RegExp")},function(e,t,n){n(82)("match",1,function(e,t,n){return[function(n){"use strict";var r=e(this),o=void 0==n?void 0:n[t];return void 0!==o?o.call(n,r):new RegExp(n)[t](String(r))},n]})},function(e,t,n){n(82)("replace",2,function(e,t,n){return[function(r,o){"use strict";var i=e(this),a=void 0==r?void 0:r[t];return void 0!==a?a.call(r,i,o):n.call(String(i),r,o)},n]})},function(e,t,n){n(82)("search",1,function(e,t,n){return[function(n){"use strict";var r=e(this),o=void 0==n?void 0:n[t];return void 0!==o?o.call(n,r):new RegExp(n)[t](String(r))},n]})},function(e,t,n){n(82)("split",2,function(e,t,r){"use strict";var o=n(85),i=r,a=[].push,u="split",s="length",c="lastIndex";if("c"=="abbc"[u](/(b)*/)[1]||4!="test"[u](/(?:)/,-1)[s]||2!="ab"[u](/(?:ab)*/)[s]||4!="."[u](/(.?)(.?)/)[s]||"."[u](/()()/)[s]>1||""[u](/.?/)[s]){var l=void 0===/()??/.exec("")[1];r=function(e,t){var n=String(this);if(void 0===e&&0===t)return[];if(!o(e))return i.call(n,e,t);var r,u,p,f,d,h=[],v=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),m=0,y=void 0===t?4294967295:t>>>0,g=new RegExp(e.source,v+"g");for(l||(r=new RegExp("^"+g.source+"$(?!\\s)",v));(u=g.exec(n))&&(p=u.index+u[0][s],!(p>m&&(h.push(n.slice(m,u.index)),!l&&u[s]>1&&u[0].replace(r,function(){for(d=1;d<arguments[s]-2;d++)void 0===arguments[d]&&(u[d]=void 0)}),u[s]>1&&u.index<n[s]&&a.apply(h,u.slice(1)),f=u[0][s],m=p,h[s]>=y)));)g[c]===u.index&&g[c]++;return m===n[s]?!f&&g.test("")||h.push(""):h.push(n.slice(m)),h[s]>y?h.slice(0,y):h}}else"0"[u](void 0,0)[s]&&(r=function(e,t){return void 0===e&&0===t?[]:i.call(this,e,t)});return[function(n,o){var i=e(this),a=void 0==n?void 0:n[t];return void 0!==a?a.call(n,i,o):r.call(String(i),n,o)},r]})},function(e,t,n){"use strict";n(201);var r=n(3),o=n(83),i=n(10),a="toString",u=/./[a],s=function(e){n(19)(RegExp.prototype,a,e,!0)};n(6)(function(){return"/a/b"!=u.call({source:"a",flags:"b"})})?s(function(){var e=r(this);return"/".concat(e.source,"/","flags"in e?e.flags:!i&&e instanceof RegExp?o.call(e):void 0)}):u.name!=a&&s(function(){return u.call(this)})},function(e,t,n){"use strict";n(20)("anchor",function(e){return function(t){return e(this,"a","name",t)}})},function(e,t,n){"use strict";n(20)("big",function(e){return function(){return e(this,"big","","")}})},function(e,t,n){"use strict";n(20)("blink",function(e){return function(){return e(this,"blink","","")}})},function(e,t,n){"use strict";n(20)("bold",function(e){return function(){return e(this,"b","","")}})},function(e,t,n){"use strict";var r=n(1),o=n(132)(!1);r(r.P,"String",{codePointAt:function(e){return o(this,e)}})},function(e,t,n){"use strict";var r=n(1),o=n(13),i=n(133),a="endsWith",u=""[a];r(r.P+r.F*n(119)(a),"String",{endsWith:function(e){var t=i(this,e,a),n=arguments.length>1?arguments[1]:void 0,r=o(t.length),s=void 0===n?r:Math.min(o(n),r),c=String(e);return u?u.call(t,c,s):t.slice(s-c.length,s)===c}})},function(e,t,n){"use strict";n(20)("fixed",function(e){return function(){return e(this,"tt","","")}})},function(e,t,n){"use strict";n(20)("fontcolor",function(e){return function(t){return e(this,"font","color",t)}})},function(e,t,n){"use strict";n(20)("fontsize",function(e){return function(t){return e(this,"font","size",t)}})},function(e,t,n){var r=n(1),o=n(58),i=String.fromCharCode,a=String.fromCodePoint;r(r.S+r.F*(!!a&&1!=a.length),"String",{fromCodePoint:function(e){for(var t,n=[],r=arguments.length,a=0;r>a;){if(t=+arguments[a++],o(t,1114111)!==t)throw RangeError(t+" is not a valid code point");n.push(65536>t?i(t):i(((t-=65536)>>10)+55296,t%1024+56320))}return n.join("")}})},function(e,t,n){"use strict";var r=n(1),o=n(133),i="includes";r(r.P+r.F*n(119)(i),"String",{includes:function(e){return!!~o(this,e,i).indexOf(e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";n(20)("italics",function(e){return function(){return e(this,"i","","")}})},function(e,t,n){"use strict";var r=n(132)(!0);n(126)(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=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){"use strict";n(20)("link",function(e){return function(t){return e(this,"a","href",t)}})},function(e,t,n){var r=n(1),o=n(21),i=n(13);r(r.S,"String",{raw:function(e){for(var t=o(e.raw),n=i(t.length),r=arguments.length,a=[],u=0;n>u;)a.push(String(t[u++])),r>u&&a.push(String(arguments[u]));return a.join("")}})},function(e,t,n){var r=n(1);r(r.P,"String",{repeat:n(134)})},function(e,t,n){"use strict";n(20)("small",function(e){return function(){return e(this,"small","","")}})},function(e,t,n){"use strict";var r=n(1),o=n(13),i=n(133),a="startsWith",u=""[a];r(r.P+r.F*n(119)(a),"String",{startsWith:function(e){var t=i(this,e,a),n=o(Math.min(arguments.length>1?arguments[1]:void 0,t.length)),r=String(e);return u?u.call(t,r,n):t.slice(n,n+r.length)===r}})},function(e,t,n){"use strict";n(20)("strike",function(e){return function(){return e(this,"strike","","")}})},function(e,t,n){"use strict";n(20)("sub",function(e){return function(){return e(this,"sub","","")}})},function(e,t,n){"use strict";n(20)("sup",function(e){return function(){return e(this,"sup","","")}})},function(e,t,n){"use strict";n(66)("trim",function(e){return function(){return e(this,3)}})},function(e,t,n){"use strict";var r=n(5),o=n(16),i=n(10),a=n(1),u=n(19),s=n(44).KEY,c=n(6),l=n(90),p=n(65),f=n(59),d=n(8),h=n(199),v=n(138),m=n(297),y=n(296),g=n(123),b=n(3),_=n(21),x=n(35),E=n(45),w=n(53),C=n(191),P=n(22),S=n(11),O=n(55),T=P.f,A=S.f,M=C.f,k=r.Symbol,N=r.JSON,R=N&&N.stringify,I="prototype",j=d("_hidden"),D=d("toPrimitive"),F={}.propertyIsEnumerable,L=l("symbol-registry"),U=l("symbols"),V=l("op-symbols"),B=Object[I],W="function"==typeof k,q=r.QObject,H=!q||!q[I]||!q[I].findChild,Y=i&&c(function(){return 7!=w(A({},"a",{get:function(){return A(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=T(B,t);r&&delete B[t],A(e,t,n),r&&e!==B&&A(B,t,r)}:A,z=function(e){var t=U[e]=w(k[I]);return t._k=e,t},K=W&&"symbol"==typeof k.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof k},G=function(e,t,n){return e===B&&G(V,t,n),b(e),t=x(t,!0),b(n),o(U,t)?(n.enumerable?(o(e,j)&&e[j][t]&&(e[j][t]=!1),n=w(n,{enumerable:E(0,!1)})):(o(e,j)||A(e,j,E(1,{})),e[j][t]=!0),Y(e,t,n)):A(e,t,n)},$=function(e,t){b(e);for(var n,r=y(t=_(t)),o=0,i=r.length;i>o;)G(e,n=r[o++],t[n]);return e},X=function(e,t){return void 0===t?w(e):$(w(e),t)},Q=function(e){var t=F.call(this,e=x(e,!0));return this===B&&o(U,e)&&!o(V,e)?!1:t||!o(this,e)||!o(U,e)||o(this,j)&&this[j][e]?t:!0},Z=function(e,t){if(e=_(e),t=x(t,!0),e!==B||!o(U,t)||o(V,t)){var n=T(e,t);return!n||!o(U,t)||o(e,j)&&e[j][t]||(n.enumerable=!0),n}},J=function(e){for(var t,n=M(_(e)),r=[],i=0;n.length>i;)o(U,t=n[i++])||t==j||t==s||r.push(t);return r},ee=function(e){for(var t,n=e===B,r=M(n?V:_(e)),i=[],a=0;r.length>a;)o(U,t=r[a++])&&(n?o(B,t):!0)&&i.push(U[t]);return i};W||(k=function(){if(this instanceof k)throw TypeError("Symbol is not a constructor!");var e=f(arguments.length>0?arguments[0]:void 0),t=function(n){this===B&&t.call(V,n),o(this,j)&&o(this[j],e)&&(this[j][e]=!1),Y(this,e,E(1,n))};return i&&H&&Y(B,e,{configurable:!0,set:t}),z(e)},u(k[I],"toString",function(){return this._k}),P.f=Z,S.f=G,n(54).f=C.f=J,n(71).f=Q,n(88).f=ee,i&&!n(52)&&u(B,"propertyIsEnumerable",Q,!0),h.f=function(e){return z(d(e))}),a(a.G+a.W+a.F*!W,{Symbol:k});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ne=0;te.length>ne;)d(te[ne++]);for(var te=O(d.store),ne=0;te.length>ne;)v(te[ne++]);a(a.S+a.F*!W,"Symbol",{"for":function(e){return o(L,e+="")?L[e]:L[e]=k(e)},keyFor:function(e){if(K(e))return m(L,e);throw TypeError(e+" is not a symbol!")},useSetter:function(){H=!0},useSimple:function(){H=!1}}),a(a.S+a.F*!W,"Object",{create:X,defineProperty:G,defineProperties:$,getOwnPropertyDescriptor:Z,getOwnPropertyNames:J,getOwnPropertySymbols:ee}),N&&a(a.S+a.F*(!W||c(function(){var e=k();return"[null]"!=R([e])||"{}"!=R({a:e})||"{}"!=R(Object(e))})),"JSON",{stringify:function(e){if(void 0!==e&&!K(e)){for(var t,n,r=[e],o=1;arguments.length>o;)r.push(arguments[o++]);return t=r[1],"function"==typeof t&&(n=t),!n&&g(t)||(t=function(e,t){return n&&(t=n.call(this,e,t)),K(t)?void 0:t}),r[1]=t,R.apply(N,r)}}}),k[I][D]||n(17)(k[I],D,k[I].valueOf),p(k,"Symbol"),p(Math,"Math",!0),p(r.JSON,"JSON",!0)},function(e,t,n){"use strict";var r=n(1),o=n(91),i=n(137),a=n(3),u=n(58),s=n(13),c=n(7),l=(n(8)("typed_array"),n(5).ArrayBuffer),p=n(131),f=i.ArrayBuffer,d=i.DataView,h=o.ABV&&l.isView,v=f.prototype.slice,m=o.VIEW,y="ArrayBuffer";r(r.G+r.W+r.F*(l!==f),{ArrayBuffer:f}),r(r.S+r.F*!o.CONSTR,y,{isView:function(e){return h&&h(e)||c(e)&&m in e}}),r(r.P+r.U+r.F*n(6)(function(){return!new f(2).slice(1,void 0).byteLength}),y,{slice:function(e,t){if(void 0!==v&&void 0===t)return v.call(a(this),e);for(var n=a(this).byteLength,r=u(e,n),o=u(void 0===t?n:t,n),i=new(p(this,f))(s(o-r)),c=new d(this),l=new d(i),h=0;o>r;)l.setUint8(h++,c.getUint8(r++));return i}}),n(57)(y)},function(e,t,n){var r=n(1);r(r.G+r.W+r.F*!n(91).ABV,{DataView:n(137).DataView})},function(e,t,n){n(40)("Float32",4,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){n(40)("Float64",8,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){n(40)("Int16",2,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){n(40)("Int32",4,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){n(40)("Int8",1,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){n(40)("Uint16",2,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){n(40)("Uint32",4,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){n(40)("Uint8",1,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){n(40)("Uint8",1,function(e){return function(t,n,r){return e(this,t,n,r)}},!0)},function(e,t,n){"use strict";var r=n(184);n(81)("WeakSet",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{add:function(e){return r.def(this,e,!0);
}},r,!1,!0)},function(e,t,n){"use strict";var r=n(1),o=n(80)(!0);r(r.P,"Array",{includes:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),n(62)("includes")},function(e,t,n){var r=n(1),o=n(129)(),i=n(5).process,a="process"==n(27)(i);r(r.G,{asap:function(e){var t=a&&i.domain;o(t?t.bind(e):e)}})},function(e,t,n){var r=n(1),o=n(27);r(r.S,"Error",{isError:function(e){return"Error"===o(e)}})},function(e,t,n){var r=n(1);r(r.P+r.R,"Map",{toJSON:n(183)("Map")})},function(e,t,n){var r=n(1);r(r.S,"Math",{iaddh:function(e,t,n,r){var o=e>>>0,i=t>>>0,a=n>>>0;return i+(r>>>0)+((o&a|(o|a)&~(o+a>>>0))>>>31)|0}})},function(e,t,n){var r=n(1);r(r.S,"Math",{imulh:function(e,t){var n=65535,r=+e,o=+t,i=r&n,a=o&n,u=r>>16,s=o>>16,c=(u*a>>>0)+(i*a>>>16);return u*s+(c>>16)+((i*s>>>0)+(c&n)>>16)}})},function(e,t,n){var r=n(1);r(r.S,"Math",{isubh:function(e,t,n,r){var o=e>>>0,i=t>>>0,a=n>>>0;return i-(r>>>0)-((~o&a|~(o^a)&o-a>>>0)>>>31)|0}})},function(e,t,n){var r=n(1);r(r.S,"Math",{umulh:function(e,t){var n=65535,r=+e,o=+t,i=r&n,a=o&n,u=r>>>16,s=o>>>16,c=(u*a>>>0)+(i*a>>>16);return u*s+(c>>>16)+((i*s>>>0)+(c&n)>>>16)}})},function(e,t,n){"use strict";var r=n(1),o=n(14),i=n(18),a=n(11);n(10)&&r(r.P+n(87),"Object",{__defineGetter__:function(e,t){a.f(o(this),e,{get:i(t),enumerable:!0,configurable:!0})}})},function(e,t,n){"use strict";var r=n(1),o=n(14),i=n(18),a=n(11);n(10)&&r(r.P+n(87),"Object",{__defineSetter__:function(e,t){a.f(o(this),e,{set:i(t),enumerable:!0,configurable:!0})}})},function(e,t,n){var r=n(1),o=n(193)(!0);r(r.S,"Object",{entries:function(e){return o(e)}})},function(e,t,n){var r=n(1),o=n(194),i=n(21),a=n(22),u=n(116);r(r.S,"Object",{getOwnPropertyDescriptors:function(e){for(var t,n=i(e),r=a.f,s=o(n),c={},l=0;s.length>l;)u(c,t=s[l++],r(n,t));return c}})},function(e,t,n){"use strict";var r=n(1),o=n(14),i=n(35),a=n(23),u=n(22).f;n(10)&&r(r.P+n(87),"Object",{__lookupGetter__:function(e){var t,n=o(this),r=i(e,!0);do if(t=u(n,r))return t.get;while(n=a(n))}})},function(e,t,n){"use strict";var r=n(1),o=n(14),i=n(35),a=n(23),u=n(22).f;n(10)&&r(r.P+n(87),"Object",{__lookupSetter__:function(e){var t,n=o(this),r=i(e,!0);do if(t=u(n,r))return t.set;while(n=a(n))}})},function(e,t,n){var r=n(1),o=n(193)(!1);r(r.S,"Object",{values:function(e){return o(e)}})},function(e,t,n){"use strict";var r=n(1),o=n(5),i=n(33),a=n(129)(),u=n(8)("observable"),s=n(18),c=n(3),l=n(43),p=n(56),f=n(17),d=n(64),h=d.RETURN,v=function(e){return null==e?void 0:s(e)},m=function(e){var t=e._c;t&&(e._c=void 0,t())},y=function(e){return void 0===e._o},g=function(e){y(e)||(e._o=void 0,m(e))},b=function(e,t){c(e),this._c=void 0,this._o=e,e=new _(this);try{var n=t(e),r=n;null!=n&&("function"==typeof n.unsubscribe?n=function(){r.unsubscribe()}:s(n),this._c=n)}catch(o){return void e.error(o)}y(this)&&m(this)};b.prototype=p({},{unsubscribe:function(){g(this)}});var _=function(e){this._s=e};_.prototype=p({},{next:function(e){var t=this._s;if(!y(t)){var n=t._o;try{var r=v(n.next);if(r)return r.call(n,e)}catch(o){try{g(t)}finally{throw o}}}},error:function(e){var t=this._s;if(y(t))throw e;var n=t._o;t._o=void 0;try{var r=v(n.error);if(!r)throw e;e=r.call(n,e)}catch(o){try{m(t)}finally{throw o}}return m(t),e},complete:function(e){var t=this._s;if(!y(t)){var n=t._o;t._o=void 0;try{var r=v(n.complete);e=r?r.call(n,e):void 0}catch(o){try{m(t)}finally{throw o}}return m(t),e}}});var x=function(e){l(this,x,"Observable","_f")._f=s(e)};p(x.prototype,{subscribe:function(e){return new b(e,this._f)},forEach:function(e){var t=this;return new(i.Promise||o.Promise)(function(n,r){s(e);var o=t.subscribe({next:function(t){try{return e(t)}catch(n){r(n),o.unsubscribe()}},error:r,complete:n})})}}),p(x,{from:function(e){var t="function"==typeof this?this:x,n=v(c(e)[u]);if(n){var r=c(n.call(e));return r.constructor===t?r:new t(function(e){return r.subscribe(e)})}return new t(function(t){var n=!1;return a(function(){if(!n){try{if(d(e,!1,function(e){return t.next(e),n?h:void 0})===h)return}catch(r){if(n)throw r;return void t.error(r)}t.complete()}}),function(){n=!0}})},of:function(){for(var e=0,t=arguments.length,n=Array(t);t>e;)n[e]=arguments[e++];return new("function"==typeof this?this:x)(function(e){var t=!1;return a(function(){if(!t){for(var r=0;r<n.length;++r)if(e.next(n[r]),t)return;e.complete()}}),function(){t=!0}})}}),f(x.prototype,u,function(){return this}),r(r.G,{Observable:x}),n(57)("Observable")},function(e,t,n){var r=n(39),o=n(3),i=r.key,a=r.set;r.exp({defineMetadata:function(e,t,n,r){a(e,t,o(n),i(r))}})},function(e,t,n){var r=n(39),o=n(3),i=r.key,a=r.map,u=r.store;r.exp({deleteMetadata:function(e,t){var n=arguments.length<3?void 0:i(arguments[2]),r=a(o(t),n,!1);if(void 0===r||!r["delete"](e))return!1;if(r.size)return!0;var s=u.get(t);return s["delete"](n),!!s.size||u["delete"](t)}})},function(e,t,n){var r=n(202),o=n(179),i=n(39),a=n(3),u=n(23),s=i.keys,c=i.key,l=function(e,t){var n=s(e,t),i=u(e);if(null===i)return n;var a=l(i,t);return a.length?n.length?o(new r(n.concat(a))):a:n};i.exp({getMetadataKeys:function(e){return l(a(e),arguments.length<2?void 0:c(arguments[1]))}})},function(e,t,n){var r=n(39),o=n(3),i=n(23),a=r.has,u=r.get,s=r.key,c=function(e,t,n){var r=a(e,t,n);if(r)return u(e,t,n);var o=i(t);return null!==o?c(e,o,n):void 0};r.exp({getMetadata:function(e,t){return c(e,o(t),arguments.length<3?void 0:s(arguments[2]))}})},function(e,t,n){var r=n(39),o=n(3),i=r.keys,a=r.key;r.exp({getOwnMetadataKeys:function(e){return i(o(e),arguments.length<2?void 0:a(arguments[1]))}})},function(e,t,n){var r=n(39),o=n(3),i=r.get,a=r.key;r.exp({getOwnMetadata:function(e,t){return i(e,o(t),arguments.length<3?void 0:a(arguments[2]))}})},function(e,t,n){var r=n(39),o=n(3),i=n(23),a=r.has,u=r.key,s=function(e,t,n){var r=a(e,t,n);if(r)return!0;var o=i(t);return null!==o?s(e,o,n):!1};r.exp({hasMetadata:function(e,t){return s(e,o(t),arguments.length<3?void 0:u(arguments[2]))}})},function(e,t,n){var r=n(39),o=n(3),i=r.has,a=r.key;r.exp({hasOwnMetadata:function(e,t){return i(e,o(t),arguments.length<3?void 0:a(arguments[2]))}})},function(e,t,n){var r=n(39),o=n(3),i=n(18),a=r.key,u=r.set;r.exp({metadata:function(e,t){return function(n,r){u(e,t,(void 0!==r?o:i)(n),a(r))}}})},function(e,t,n){var r=n(1);r(r.P+r.R,"Set",{toJSON:n(183)("Set")})},function(e,t,n){"use strict";var r=n(1),o=n(132)(!0);r(r.P,"String",{at:function(e){return o(this,e)}})},function(e,t,n){"use strict";var r=n(1),o=n(28),i=n(13),a=n(85),u=n(83),s=RegExp.prototype,c=function(e,t){this._r=e,this._s=t};n(125)(c,"RegExp String",function(){var e=this._r.exec(this._s);return{value:e,done:null===e}}),r(r.P,"String",{matchAll:function(e){if(o(this),!a(e))throw TypeError(e+" is not a regexp!");var t=String(this),n="flags"in s?String(e.flags):u.call(e),r=new RegExp(e.source,~n.indexOf("g")?n:"g"+n);return r.lastIndex=i(e.lastIndex),new c(r,t)}})},function(e,t,n){"use strict";var r=n(1),o=n(198);r(r.P,"String",{padEnd:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0,!1)}})},function(e,t,n){"use strict";var r=n(1),o=n(198);r(r.P,"String",{padStart:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0,!0)}})},function(e,t,n){"use strict";n(66)("trimLeft",function(e){return function(){return e(this,1)}},"trimStart")},function(e,t,n){"use strict";n(66)("trimRight",function(e){return function(){return e(this,2)}},"trimEnd")},function(e,t,n){n(138)("asyncIterator")},function(e,t,n){n(138)("observable")},function(e,t,n){var r=n(1);r(r.S,"System",{global:n(5)})},function(e,t,n){for(var r=n(140),o=n(19),i=n(5),a=n(17),u=n(51),s=n(8),c=s("iterator"),l=s("toStringTag"),p=u.Array,f=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],d=0;5>d;d++){var h,v=f[d],m=i[v],y=m&&m.prototype;if(y){y[c]||a(y,c,p),y[l]||a(y,l,v),u[v]=p;for(h in r)y[h]||o(y,h,r[h],!0)}}},function(e,t,n){var r=n(1),o=n(136);r(r.G+r.B,{setImmediate:o.set,clearImmediate:o.clear})},function(e,t,n){var r=n(5),o=n(1),i=n(84),a=n(298),u=r.navigator,s=!!u&&/MSIE .\./.test(u.userAgent),c=function(e){return s?function(t,n){return e(i(a,[].slice.call(arguments,2),"function"==typeof t?t:Function(t)),n)}:e};o(o.G+o.B+o.F*s,{setTimeout:c(r.setTimeout),setInterval:c(r.setInterval)})},function(e,t,n){n(422),n(361),n(363),n(362),n(365),n(367),n(372),n(366),n(364),n(374),n(373),n(369),n(370),n(368),n(360),n(371),n(375),n(376),n(328),n(330),n(329),n(378),n(377),n(348),n(358),n(359),n(349),n(350),n(351),n(352),n(353),n(354),n(355),n(356),n(357),n(331),n(332),n(333),n(334),n(335),n(336),n(337),n(338),n(339),n(340),n(341),n(342),n(343),n(344),n(345),n(346),n(347),n(409),n(414),n(421),n(412),n(404),n(405),n(410),n(415),n(417),n(400),n(401),n(402),n(403),n(406),n(407),n(408),n(411),n(413),n(416),n(418),n(419),n(420),n(323),n(325),n(324),n(327),n(326),n(312),n(310),n(316),n(313),n(319),n(321),n(309),n(315),n(306),n(320),n(304),n(318),n(317),n(311),n(314),n(303),n(305),n(308),n(307),n(322),n(140),n(394),n(399),n(201),n(395),n(396),n(397),n(398),n(379),n(200),n(202),n(203),n(434),n(423),n(424),n(429),n(432),n(433),n(427),n(430),n(428),n(431),n(425),n(426),n(380),n(381),n(382),n(383),n(384),n(387),n(385),n(386),n(388),n(389),n(390),n(391),n(393),n(392),n(435),n(461),n(464),n(463),n(465),n(466),n(462),n(467),n(468),n(446),n(449),n(445),n(443),n(444),n(447),n(448),n(438),n(460),n(469),n(437),n(439),n(441),n(440),n(442),n(451),n(452),n(454),n(453),n(456),n(455),n(457),n(458),n(459),n(436),n(450),n(472),n(471),n(470),e.exports=n(33)},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 o=function(e,t,n){for(var r=!0;r;){var o=e,i=t,a=n;r=!1,null===o&&(o=Function.prototype);var u=Object.getOwnPropertyDescriptor(o,i);if(void 0!==u){if("value"in u)return u.value;var s=u.get;if(void 0===s)return;return s.call(a)}var c=Object.getPrototypeOf(o);if(null===c)return;e=c,t=i,n=a,r=!0,u=c=void 0}},i=function(e){function t(){var e=arguments.length<=0||void 0===arguments[0]?"":arguments[0];return n(this,t),o(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),Object.defineProperty(this,"message",{enumerable:!1,value:e,writable:!0}),Object.defineProperty(this,"name",{enumerable:!1,value:this.constructor.name,writable:!0}),Error.hasOwnProperty("captureStackTrace")?void Error.captureStackTrace(this,this.constructor):void Object.defineProperty(this,"stack",{enumerable:!1,value:new Error(e).stack,writable:!0})}return r(t,e),t}(Error);t["default"]=i,e.exports=t["default"]},function(e,t){"use strict";function n(e){return e.replace(r,function(e,t){return t.toUpperCase()})}var r=/-(.)/g;e.exports=n},function(e,t,n){"use strict";function r(e){return o(e.replace(i,"ms-"))}var o=n(475),i=/^-ms-/;e.exports=r},function(e,t,n){"use strict";function r(e,t){return e&&t?e===t?!0:o(e)?!1:o(t)?r(e,t.parentNode):e.contains?e.contains(t):e.compareDocumentPosition?!!(16&e.compareDocumentPosition(t)):!1:!1}var o=n(484);e.exports=r},function(e,t,n){"use strict";function r(e){var t=e.length;if(Array.isArray(e)||"object"!=typeof e&&"function"!=typeof e?a(!1):void 0,"number"!=typeof t?a(!1):void 0,0===t||t-1 in e?void 0:a(!1),"function"==typeof e.callee?a(!1):void 0,e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(n){}for(var r=Array(t),o=0;t>o;o++)r[o]=e[o];return r}function o(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}function i(e){return o(e)?Array.isArray(e)?e.slice():r(e):[e]}var a=n(2);e.exports=i},function(e,t,n){"use strict";function r(e){var t=e.match(l);return t&&t[1].toLowerCase()}function o(e,t){var n=c;c?void 0:s(!1);var o=r(e),i=o&&u(o);if(i){n.innerHTML=i[1]+e+i[2];for(var l=i[0];l--;)n=n.lastChild}else n.innerHTML=e;var p=n.getElementsByTagName("script");p.length&&(t?void 0:s(!1),a(p).forEach(t));for(var f=Array.from(n.childNodes);n.lastChild;)n.removeChild(n.lastChild);return f}var i=n(15),a=n(478),u=n(207),s=n(2),c=i.canUseDOM?document.createElement("div"):null,l=/^\s*<(\w+)/;e.exports=o},function(e,t){"use strict";function n(e){return e===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:e.scrollLeft,y:e.scrollTop}}e.exports=n},function(e,t){"use strict";function n(e){return e.replace(r,"-$1").toLowerCase()}var r=/([A-Z])/g;e.exports=n},function(e,t,n){"use strict";function r(e){return o(e).replace(i,"-ms-")}var o=n(481),i=/^ms-/;e.exports=r},function(e,t){"use strict";function n(e){return!(!e||!("function"==typeof Node?e instanceof Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}e.exports=n},function(e,t,n){"use strict";function r(e){return o(e)&&3==e.nodeType}var o=n(483);e.exports=r},function(e,t){"use strict";function n(e,t,n){if(!e)return null;var o={};for(var i in e)r.call(e,i)&&(o[i]=t.call(n,e[i],i,e));return o}var r=Object.prototype.hasOwnProperty;e.exports=n},function(e,t){"use strict";function n(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}e.exports=n},function(e,t,n){"use strict";var r,o=n(15);o.canUseDOM&&(r=window.performance||window.msPerformance||window.webkitPerformance),e.exports=r||{}},function(e,t,n){"use strict";var r,o=n(487);r=o.now?function(){return o.now()}:function(){return Date.now()},e.exports=r},function(e,t){e.exports="<h1 id=async-blur-validation-example>Async Blur Validation Example</h1> <p>The recommended way to provide server-side validation is to use <a href=submitValidation>Submit Validation</a>, but there may be instances when you want to run server-side validation <em>while the form is being filled out</em>. The classic example of this letting someone choose a value, like a username, that must be unique within your system.</p> <p>To provide asynchronous validation, provide <code>redux-form</code> with an asynchronous validation function (<code>asyncValidate</code>) that takes an object of form values, and the Redux <code>dispatch</code> function, and returns a promise that either rejects with an object of errors or resolves.</p> <p>You will also need to specify which fields should fire the asynchronous validation when they are blurred with the <code>asyncBlurFields</code> config property.</p> <h3 id=important>Important</h3> <ol> <li>Asynchronous validation <em>will</em> be called before the <code>onSubmit</code> is fired, but if all you care about is validation <code>onSubmit</code>, you should use <a href=submitValidation>Submit Validation</a>.</li> <li>Asynchronous validation will <em>not</em> be called if synchronous validation is failing <em>for the field just blurred</em>.</li> </ol> <p>The errors are displayed in the exact same way as validation errors created by <a href=syncValidation>Synchronous Validation</a>.</p> <h3 id=how-to-use-the-form-below->How to use the form below:</h3> <ul> <li>Usernames that will <em>fail</em> validation: <code>john</code>, <code>paul</code>, <code>george</code> or <code>ringo</code>.</li> </ul>"},function(e,t,n){var r=n(67),o=n(24),i=r(o,"DataView");e.exports=i},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var o=n(526),i=n(527),a=n(528),u=n(529),s=n(530);r.prototype.clear=o,r.prototype["delete"]=i,r.prototype.get=a,r.prototype.has=u,r.prototype.set=s,e.exports=r},function(e,t,n){var r=n(67),o=n(24),i=r(o,"Promise");e.exports=i},function(e,t,n){var r=n(67),o=n(24),i=r(o,"Set");e.exports=i},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.__data__=new o;++t<n;)this.add(e[t])}var o=n(144),i=n(551),a=n(552);r.prototype.add=r.prototype.push=i,r.prototype.has=a,e.exports=r},function(e,t,n){var r=n(24),o=r.Uint8Array;e.exports=o},function(e,t){function n(e,t){for(var n=-1,r=e?e.length:0,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}e.exports=n},function(e,t,n){var r=n(215),o=n(513),i=o(r);e.exports=i},function(e,t,n){var r=n(514),o=r();e.exports=o},function(e,t){function n(e,t){return null!=e&&t in Object(e)}e.exports=n},function(e,t,n){function r(e,t,n,r,m,g){var b=c(e),_=c(t),x=h,E=h;b||(x=s(e),x=x==d?v:x),_||(E=s(t),E=E==d?v:E);var w=x==v&&!l(e),C=E==v&&!l(t),P=x==E;if(P&&!w)return g||(g=new o),b||p(e)?i(e,t,n,r,m,g):a(e,t,x,n,r,m,g);if(!(m&f)){var S=w&&y.call(e,"__wrapped__"),O=C&&y.call(t,"__wrapped__");if(S||O){var T=S?e.value():e,A=O?t.value():t;return g||(g=new o),n(T,A,r,m,g)}}return P?(g||(g=new o),u(e,t,n,r,m,g)):!1}var o=n(211),i=n(227),a=n(518),u=n(519),s=n(523),c=n(36),l=n(150),p=n(564),f=2,d="[object Arguments]",h="[object Array]",v="[object Object]",m=Object.prototype,y=m.hasOwnProperty;e.exports=r},function(e,t,n){function r(e,t,n,r){var s=n.length,c=s,l=!r;if(null==e)return!c;for(e=Object(e);s--;){var p=n[s];if(l&&p[2]?p[1]!==e[p[0]]:!(p[0]in e))return!1}for(;++s<c;){p=n[s];var f=p[0],d=e[f],h=p[1];if(l&&p[2]){if(void 0===d&&!(f in e))return!1}else{var v=new o;if(r)var m=r(d,h,f,e,t,v);if(!(void 0===m?i(h,d,r,a|u,v):m))return!1}}return!0}var o=n(211),i=n(147),a=1,u=2;e.exports=r},function(e,t,n){function r(e){if(!u(e)||a(e))return!1;var t=o(e)||i(e)?h:l;return t.test(s(e))}var o=n(151),i=n(150),a=n(535),u=n(48),s=n(235),c=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,p=Object.prototype,f=Function.prototype.toString,d=p.hasOwnProperty,h=RegExp("^"+f.call(d).replace(c,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=r},function(e,t){function n(e){return r(Object(e))}var r=Object.keys;e.exports=n},function(e,t,n){function r(e){var t=i(e);return 1==t.length&&t[0][2]?a(t[0][0],t[0][1]):function(n){return n===e||o(n,e,t)}}var o=n(501),i=n(522),a=n(231);e.exports=r},function(e,t,n){function r(e,t){return u(e)&&s(t)?c(l(e),t):function(n){var r=i(n,e);return void 0===r&&r===t?a(n,e):o(t,r,void 0,p|f)}}var o=n(147),i=n(560),a=n(561),u=n(101),s=n(230),c=n(231),l=n(73),p=1,f=2;e.exports=r},function(e,t,n){function r(e){return function(t){return o(t,e)}}var o=n(216);e.exports=r},function(e,t,n){function r(e,t){var n;return o(e,function(e,r,o){return n=t(e,r,o),!n}),!!n}var o=n(497);e.exports=r},function(e,t){function n(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}e.exports=n},function(e,t,n){function r(e){if("string"==typeof e)return e;if(i(e))return s?s.call(e):"";var t=e+"";return"0"==t&&1/e==-a?"-0":t}var o=n(212),i=n(74),a=1/0,u=o?o.prototype:void 0,s=u?u.toString:void 0;e.exports=r},function(e,t){function n(e){return e&&e.Object===Object?e:null}e.exports=n},function(e,t,n){var r=n(24),o=r["__core-js_shared__"];e.exports=o},function(e,t){function n(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&r++;return r}e.exports=n},function(e,t,n){function r(e,t){return function(n,r){if(null==n)return n;if(!o(n))return e(n,r);for(var i=n.length,a=t?i:-1,u=Object(n);(t?a--:++a<i)&&r(u[a],a,u)!==!1;);return n}}var o=n(103);e.exports=r},function(e,t){function n(e){return function(t,n,r){for(var o=-1,i=Object(t),a=r(t),u=a.length;u--;){var s=a[e?u:++o];if(n(i[s],s,i)===!1)break}return t}}e.exports=n},function(e,t,n){function r(e,t,n){function r(){var t=this&&this!==i&&this instanceof r?s:e;return t.apply(u?n:this,arguments)}var u=t&a,s=o(e);return r}var o=n(97),i=n(24),a=1;e.exports=r},function(e,t,n){function r(e,t,n){function r(){for(var i=arguments.length,f=Array(i),d=i,h=s(r);d--;)f[d]=arguments[d];var v=3>i&&f[0]!==h&&f[i-1]!==h?[]:c(f,h);if(i-=v.length,n>i)return u(e,t,a,r.placeholder,void 0,f,v,void 0,void 0,n-i);var m=this&&this!==l&&this instanceof r?p:e;return o(m,this,f)}var p=i(e);return r}var o=n(145),i=n(97),a=n(224),u=n(225),s=n(98),c=n(72),l=n(24);e.exports=r},function(e,t,n){function r(e,t,n,r){function s(){for(var t=-1,i=arguments.length,u=-1,p=r.length,f=Array(p+i),d=this&&this!==a&&this instanceof s?l:e;++u<p;)f[u]=r[u];for(;i--;)f[u++]=arguments[++t];return o(d,c?n:this,f)}var c=t&u,l=i(e);return s}var o=n(145),i=n(97),a=n(24),u=1;e.exports=r},function(e,t,n){function r(e,t,n,r,o,E,C){switch(n){case x:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case _:return!(e.byteLength!=t.byteLength||!r(new i(e),new i(t)));case p:case f:return+e==+t;case d:return e.name==t.name&&e.message==t.message;case v:return e!=+e?t!=+t:e==+t;case m:case g:return e==t+"";case h:var P=u;case y:var S=E&l;if(P||(P=s),e.size!=t.size&&!S)return!1;var O=C.get(e);return O?O==t:(E|=c,C.set(e,t),a(P(e),P(t),r,o,E,C));case b:if(w)return w.call(e)==w.call(t)}return!1}var o=n(212),i=n(495),a=n(227),u=n(547),s=n(553),c=1,l=2,p="[object Boolean]",f="[object Date]",d="[object Error]",h="[object Map]",v="[object Number]",m="[object RegExp]",y="[object Set]",g="[object String]",b="[object Symbol]",_="[object ArrayBuffer]",x="[object DataView]",E=o?o.prototype:void 0,w=E?E.valueOf:void 0;e.exports=r},function(e,t,n){function r(e,t,n,r,u,s){var c=u&a,l=i(e),p=l.length,f=i(t),d=f.length;if(p!=d&&!c)return!1;for(var h=p;h--;){var v=l[h];if(!(c?v in t:o(t,v)))return!1}var m=s.get(e);if(m)return m==t;var y=!0;s.set(e,t);for(var g=c;++h<p;){v=l[h];var b=e[v],_=t[v];if(r)var x=c?r(_,b,v,t,e,s):r(b,_,v,e,t,s);if(!(void 0===x?b===_||n(b,_,r,u,s):x)){y=!1;break}g||(g="constructor"==v)}if(y&&!g){var E=e.constructor,w=t.constructor;E!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof E&&E instanceof E&&"function"==typeof w&&w instanceof w)&&(y=!1)}return s["delete"](e),y}var o=n(217),i=n(153),a=2;e.exports=r},function(e,t,n){function r(e){for(var t=e.name+"",n=o[t],r=a.call(o,t)?n.length:0;r--;){var i=n[r],u=i.func;if(null==u||u==e)return i.name}return t}var o=n(549),i=Object.prototype,a=i.hasOwnProperty;e.exports=r},function(e,t,n){var r=n(219),o=r("length");e.exports=o},function(e,t,n){function r(e){for(var t=i(e),n=t.length;n--;){var r=t[n],a=e[r];t[n]=[r,a,o(a)]}return t}var o=n(230),i=n(153);e.exports=r},function(e,t,n){function r(e){return y.call(e)}var o=n(490),i=n(210),a=n(492),u=n(493),s=n(213),c=n(235),l="[object Map]",p="[object Object]",f="[object Promise]",d="[object Set]",h="[object WeakMap]",v="[object DataView]",m=Object.prototype,y=m.toString,g=c(o),b=c(i),_=c(a),x=c(u),E=c(s);(o&&r(new o(new ArrayBuffer(1)))!=v||i&&r(new i)!=l||a&&r(a.resolve())!=f||u&&r(new u)!=d||s&&r(new s)!=h)&&(r=function(e){var t=y.call(e),n=t==p?e.constructor:void 0,r=n?c(n):void 0;if(r)switch(r){case g:return v;case b:return l;case _:return f;case x:return d;case E:return h}return t}),e.exports=r},function(e,t){function n(e,t){return null==e?void 0:e[t]}e.exports=n},function(e,t,n){function r(e,t,n){t=s(t,e)?[t]:o(t);for(var r,f=-1,d=t.length;++f<d;){var h=p(t[f]);if(!(r=null!=e&&n(e,h)))break;e=e[h]}if(r)return r;var d=e?e.length:0;return!!d&&c(d)&&u(h,d)&&(a(e)||l(e)||i(e))}var o=n(221),i=n(238),a=n(36),u=n(100),s=n(101),c=n(104),l=n(239),p=n(73);e.exports=r},function(e,t,n){function r(){this.__data__=o?o(null):{}}var o=n(102);e.exports=r},function(e,t){function n(e){return this.has(e)&&delete this.__data__[e]}e.exports=n},function(e,t,n){function r(e){var t=this.__data__;if(o){var n=t[e];return n===i?void 0:n}return u.call(t,e)?t[e]:void 0}var o=n(102),i="__lodash_hash_undefined__",a=Object.prototype,u=a.hasOwnProperty;e.exports=r},function(e,t,n){function r(e){var t=this.__data__;return o?void 0!==t[e]:a.call(t,e)}var o=n(102),i=Object.prototype,a=i.hasOwnProperty;e.exports=r},function(e,t,n){function r(e,t){var n=this.__data__;return n[e]=o&&void 0===t?i:t,this}var o=n(102),i="__lodash_hash_undefined__";e.exports=r},function(e,t,n){function r(e){var t=e?e.length:void 0;return u(t)&&(a(e)||s(e)||i(e))?o(t,String):null}var o=n(508),i=n(238),a=n(36),u=n(104),s=n(239);e.exports=r},function(e,t,n){function r(e,t,n){if(!u(n))return!1;var r=typeof t;return("number"==r?i(n)&&a(t,n.length):"string"==r&&t in n)?o(n[t],e):!1}var o=n(236),i=n(103),a=n(100),u=n(48);e.exports=r},function(e,t){function n(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}e.exports=n},function(e,t,n){function r(e){var t=a(e),n=u[t];if("function"!=typeof n||!(t in o.prototype))return!1;if(e===n)return!0;var r=i(n);return!!r&&e===r[0]}var o=n(143),i=n(228),a=n(520),u=n(573);e.exports=r},function(e,t,n){function r(e){return!!i&&i in e}var o=n(511),i=function(){var e=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();e.exports=r},function(e,t){function n(e){var t=e&&e.constructor,n="function"==typeof t&&t.prototype||r;return e===n}var r=Object.prototype;e.exports=n},function(e,t){function n(){this.__data__=[]}e.exports=n},function(e,t,n){function r(e){var t=this.__data__,n=o(t,e);if(0>n)return!1;var r=t.length-1;return n==r?t.pop():a.call(t,n,1),!0}var o=n(96),i=Array.prototype,a=i.splice;e.exports=r},function(e,t,n){function r(e){var t=this.__data__,n=o(t,e);return 0>n?void 0:t[n][1]}var o=n(96);e.exports=r},function(e,t,n){function r(e){return o(this.__data__,e)>-1}var o=n(96);e.exports=r},function(e,t,n){function r(e,t){var n=this.__data__,r=o(n,e);return 0>r?n.push([e,t]):n[r][1]=t,this}var o=n(96);e.exports=r},function(e,t,n){function r(){this.__data__={hash:new o,map:new(a||i),string:new o}}var o=n(491),i=n(95),a=n(210);e.exports=r},function(e,t,n){function r(e){return o(this,e)["delete"](e)}var o=n(99);e.exports=r},function(e,t,n){function r(e){return o(this,e).get(e)}var o=n(99);e.exports=r},function(e,t,n){function r(e){return o(this,e).has(e)}var o=n(99);e.exports=r},function(e,t,n){function r(e,t){return o(this,e).set(e,t),this}var o=n(99);e.exports=r},function(e,t){function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}e.exports=n},function(e,t,n){function r(e,t){var n=e[1],r=t[1],v=n|r,m=(s|c|f)>v,y=r==f&&n==p||r==f&&n==d&&e[7].length<=t[8]||r==(f|d)&&t[7].length<=t[8]&&n==p;if(!m&&!y)return e;r&s&&(e[2]=t[2],v|=n&s?0:l);var g=t[3];if(g){var b=e[3];e[3]=b?o(b,g,t[4]):g,e[4]=b?a(e[3],u):t[4]}return g=t[5],g&&(b=e[5],e[5]=b?i(b,g,t[6]):g,e[6]=b?a(e[5],u):t[6]),g=t[7],g&&(e[7]=g),r&f&&(e[8]=null==e[8]?t[8]:h(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=v,e}var o=n(222),i=n(223),a=n(72),u="__lodash_placeholder__",s=1,c=2,l=4,p=8,f=128,d=256,h=Math.min;e.exports=r},function(e,t){var n={};e.exports=n},function(e,t,n){function r(e,t){for(var n=e.length,r=a(t.length,n),u=o(e);r--;){var s=t[r];e[r]=i(s,n)?u[s]:void 0}return e}var o=n(149),i=n(100),a=Math.min;e.exports=r},function(e,t){function n(e){return this.__data__.set(e,r),this}var r="__lodash_hash_undefined__";e.exports=n},function(e,t){function n(e){return this.__data__.has(e)}e.exports=n},function(e,t){function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}e.exports=n},function(e,t,n){function r(){this.__data__=new o}var o=n(95);e.exports=r},function(e,t){function n(e){return this.__data__["delete"](e)}e.exports=n},function(e,t){function n(e){return this.__data__.get(e)}e.exports=n},function(e,t){function n(e){return this.__data__.has(e)}e.exports=n},function(e,t,n){function r(e,t){var n=this.__data__;return n instanceof o&&n.__data__.length==a&&(n=this.__data__=new i(n.__data__)),n.set(e,t),this}var o=n(95),i=n(144),a=200;e.exports=r},function(e,t,n){function r(e){if(e instanceof o)return e.clone();var t=new i(e.__wrapped__,e.__chain__);return t.__actions__=a(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var o=n(143),i=n(209),a=n(149);e.exports=r},function(e,t,n){function r(e,t,n){var r=null==e?void 0:o(e,t);return void 0===r?n:r}var o=n(216);e.exports=r},function(e,t,n){function r(e,t){return null!=e&&i(e,t,o)}var o=n(499),i=n(525);e.exports=r},function(e,t,n){function r(e){return i(e)&&o(e)}var o=n(103),i=n(60);e.exports=r},function(e,t,n){function r(e,t,n){n="function"==typeof n?n:void 0;var r=n?n(e,t):void 0;return void 0===r?o(e,t,n):!!r}var o=n(147);e.exports=r},function(e,t,n){function r(e){return i(e)&&o(e.length)&&!!M[N.call(e)]}var o=n(104),i=n(60),a="[object Arguments]",u="[object Array]",s="[object Boolean]",c="[object Date]",l="[object Error]",p="[object Function]",f="[object Map]",d="[object Number]",h="[object Object]",v="[object RegExp]",m="[object Set]",y="[object String]",g="[object WeakMap]",b="[object ArrayBuffer]",_="[object DataView]",x="[object Float32Array]",E="[object Float64Array]",w="[object Int8Array]",C="[object Int16Array]",P="[object Int32Array]",S="[object Uint8Array]",O="[object Uint8ClampedArray]",T="[object Uint16Array]",A="[object Uint32Array]",M={};M[x]=M[E]=M[w]=M[C]=M[P]=M[S]=M[O]=M[T]=M[A]=!0,M[a]=M[u]=M[b]=M[s]=M[_]=M[c]=M[l]=M[p]=M[f]=M[d]=M[h]=M[v]=M[m]=M[y]=M[g]=!1;var k=Object.prototype,N=k.toString;e.exports=r},function(e,t,n){function r(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(i);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(r.Cache||o),n}var o=n(144),i="Expected a function";r.Cache=o,e.exports=r},function(e,t){function n(){return Date.now()}e.exports=n},function(e,t,n){var r=n(226),o=n(98),i=n(72),a=n(241),u=64,s=a(function(e,t){var n=i(t,o(s));return r(e,u,void 0,t,n)});s.placeholder={},e.exports=s},function(e,t,n){function r(e){return a(e)?o(u(e)):i(e)}var o=n(219),i=n(506),a=n(101),u=n(73);e.exports=r},function(e,t,n){function r(e,t,n){var r=u(e)?o:a;return n&&s(e,t,n)&&(t=void 0),r(e,i(t,3))}var o=n(214),i=n(218),a=n(507),u=n(36),s=n(532);e.exports=r},function(e,t,n){function r(e){if(!e)return 0===e?e:0;if(e=o(e),e===i||e===-i){var t=0>e?-1:1;return t*a}return e===e?e:0}var o=n(571),i=1/0,a=1.7976931348623157e308;e.exports=r},function(e,t,n){function r(e){if("number"==typeof e)return e;if(a(e))return u;if(i(e)){var t=o(e.valueOf)?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var n=l.test(e);return n||p.test(e)?f(e.slice(2),n?2:8):c.test(e)?u:+e}var o=n(151),i=n(48),a=n(74),u=NaN,s=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,p=/^0o[0-7]+$/i,f=parseInt;e.exports=r},function(e,t,n){function r(e){return null==e?"":o(e)}var o=n(509);e.exports=r},function(e,t,n){function r(e){if(s(e)&&!u(e)&&!(e instanceof o)){if(e instanceof i)return e;if(p.call(e,"__wrapped__"))return c(e)}return new i(e)}var o=n(143),i=n(209),a=n(148),u=n(36),s=n(60),c=n(559),l=Object.prototype,p=l.hasOwnProperty;r.prototype=a.prototype,r.prototype.constructor=r,e.exports=r},function(e,t){function n(){c&&a&&(c=!1,a.length?s=a.concat(s):l=-1,s.length&&r())}function r(){if(!c){var e=setTimeout(n);c=!0;for(var t=s.length;t;){for(a=s,s=[];++l<t;)a&&a[l].run();l=-1,t=s.length}a=null,c=!1,clearTimeout(e)}}function o(e,t){this.fun=e,this.array=t}function i(){}var a,u=e.exports={},s=[],c=!1,l=-1;u.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];s.push(new o(e,t)),1!==s.length||c||setTimeout(r,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=i,u.addListener=i,u.once=i,u.off=i,u.removeListener=i,u.removeAllListeners=i,u.emit=i,u.binding=function(e){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(e){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},function(e,t){e.exports="import React from 'react'\nimport { Field, reduxForm } from 'redux-form'\nimport validate from './validate'\nimport asyncValidate from './asyncValidate'\n\nconst renderField = props => (\n <div>\n <label>{props.placeholder}</label>\n <div className={props.asyncValidating ? 'async-validating' : ''}>\n <input {...props}/>\n {props.touched && props.error && <span>{props.error}</span>}\n </div>\n </div>\n)\n\nconst AsyncValidationForm = (props) => {\n const { handleSubmit, pristine, reset, submitting } = props\n return (\n <form onSubmit={handleSubmit}>\n <Field name=\"username\" type=\"text\" component={renderField} placeholder=\"Username\"/>\n <Field name=\"password\" type=\"password\" component={renderField} placeholder=\"Password\"/>\n <div>\n <button type=\"submit\" disabled={submitting}>Sign Up</button>\n <button type=\"button\" disabled={pristine || submitting} onClick={reset}>Clear Values</button>\n </div>\n </form>\n )\n}\n\nexport default reduxForm({\n form: 'asyncValidation', // a unique identifier for this form\n validate,\n asyncValidate,\n asyncBlurFields: [ 'username' ]\n})(AsyncValidationForm)\n";
},function(e,t){e.exports="const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))\n\nconst asyncValidate = (values/*, dispatch */) => {\n return sleep(1000) // simulate server latency\n .then(() => {\n if ([ 'john', 'paul', 'george', 'ringo' ].includes(values.username)) {\n throw { username: 'That username is taken' }\n }\n })\n}\n\nexport default asyncValidate\n\n"},function(e,t){e.exports="const validate = values => {\n const errors = {}\n if (!values.username) {\n errors.username = 'Required'\n }\n if (!values.password) {\n errors.password = 'Required'\n }\n return errors\n}\n\nexport default validate\n\n"},function(e,t,n){"use strict";e.exports=n(595)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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)}t.__esModule=!0,t["default"]=void 0;var u=n(26),s=n(243),c=r(s),l=n(244),p=(r(l),function(e){function t(n,r){o(this,t);var a=i(this,e.call(this,n,r));return a.store=n.store,a}return a(t,e),t.prototype.getChildContext=function(){return{store:this.store}},t.prototype.render=function(){var e=this.props.children;return u.Children.only(e)},t}(u.Component));t["default"]=p,p.propTypes={store:c["default"].isRequired,children:u.PropTypes.element.isRequired},p.childContextTypes={store:c["default"].isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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)}function u(e){return e.displayName||e.name||"Component"}function s(e,t){try{return e.apply(t)}catch(n){return O.value=n,O}}function c(e,t,n){var r=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],c=Boolean(e),f=e||C,h=void 0;h="function"==typeof t?t:t?(0,y["default"])(t):P;var m=n||S,g=r.pure,b=void 0===g?!0:g,_=r.withRef,E=void 0===_?!1:_,A=b&&m!==S,M=T++;return function(e){function t(e,t,n){var r=m(e,t,n);return r}var n="Connect("+u(e)+")",r=function(r){function u(e,t){o(this,u);var a=i(this,r.call(this,e,t));a.version=M,a.store=e.store||t.store,(0,w["default"])(a.store,'Could not find "store" in either the context or '+('props of "'+n+'". ')+"Either wrap the root component in a <Provider>, "+('or explicitly pass "store" as a prop to "'+n+'".'));var s=a.store.getState();return a.state={storeState:s},a.clearCache(),a}return a(u,r),u.prototype.shouldComponentUpdate=function(){return!b||this.haveOwnPropsChanged||this.hasStoreStateChanged},u.prototype.computeStateProps=function(e,t){if(!this.finalMapStateToProps)return this.configureFinalMapState(e,t);var n=e.getState(),r=this.doStatePropsDependOnOwnProps?this.finalMapStateToProps(n,t):this.finalMapStateToProps(n);return r},u.prototype.configureFinalMapState=function(e,t){var n=f(e.getState(),t),r="function"==typeof n;return this.finalMapStateToProps=r?n:f,this.doStatePropsDependOnOwnProps=1!==this.finalMapStateToProps.length,r?this.computeStateProps(e,t):n},u.prototype.computeDispatchProps=function(e,t){if(!this.finalMapDispatchToProps)return this.configureFinalMapDispatch(e,t);var n=e.dispatch,r=this.doDispatchPropsDependOnOwnProps?this.finalMapDispatchToProps(n,t):this.finalMapDispatchToProps(n);return r},u.prototype.configureFinalMapDispatch=function(e,t){var n=h(e.dispatch,t),r="function"==typeof n;return this.finalMapDispatchToProps=r?n:h,this.doDispatchPropsDependOnOwnProps=1!==this.finalMapDispatchToProps.length,r?this.computeDispatchProps(e,t):n},u.prototype.updateStatePropsIfNeeded=function(){var e=this.computeStateProps(this.store,this.props);return this.stateProps&&(0,v["default"])(e,this.stateProps)?!1:(this.stateProps=e,!0)},u.prototype.updateDispatchPropsIfNeeded=function(){var e=this.computeDispatchProps(this.store,this.props);return this.dispatchProps&&(0,v["default"])(e,this.dispatchProps)?!1:(this.dispatchProps=e,!0)},u.prototype.updateMergedPropsIfNeeded=function(){var e=t(this.stateProps,this.dispatchProps,this.props);return this.mergedProps&&A&&(0,v["default"])(e,this.mergedProps)?!1:(this.mergedProps=e,!0)},u.prototype.isSubscribed=function(){return"function"==typeof this.unsubscribe},u.prototype.trySubscribe=function(){c&&!this.unsubscribe&&(this.unsubscribe=this.store.subscribe(this.handleChange.bind(this)),this.handleChange())},u.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},u.prototype.componentDidMount=function(){this.trySubscribe()},u.prototype.componentWillReceiveProps=function(e){b&&(0,v["default"])(e,this.props)||(this.haveOwnPropsChanged=!0)},u.prototype.componentWillUnmount=function(){this.tryUnsubscribe(),this.clearCache()},u.prototype.clearCache=function(){this.dispatchProps=null,this.stateProps=null,this.mergedProps=null,this.haveOwnPropsChanged=!0,this.hasStoreStateChanged=!0,this.haveStatePropsBeenPrecalculated=!1,this.statePropsPrecalculationError=null,this.renderedElement=null,this.finalMapDispatchToProps=null,this.finalMapStateToProps=null},u.prototype.handleChange=function(){if(this.unsubscribe){var e=this.store.getState(),t=this.state.storeState;if(!b||t!==e){if(b&&!this.doStatePropsDependOnOwnProps){var n=s(this.updateStatePropsIfNeeded,this);if(!n)return;n===O&&(this.statePropsPrecalculationError=O.value),this.haveStatePropsBeenPrecalculated=!0}this.hasStoreStateChanged=!0,this.setState({storeState:e})}}},u.prototype.getWrappedInstance=function(){return(0,w["default"])(E,"To access the wrapped instance, you need to specify { withRef: true } as the fourth argument of the connect() call."),this.refs.wrappedInstance},u.prototype.render=function(){var t=this.haveOwnPropsChanged,n=this.hasStoreStateChanged,r=this.haveStatePropsBeenPrecalculated,o=this.statePropsPrecalculationError,i=this.renderedElement;if(this.haveOwnPropsChanged=!1,this.hasStoreStateChanged=!1,this.haveStatePropsBeenPrecalculated=!1,this.statePropsPrecalculationError=null,o)throw o;var a=!0,u=!0;b&&i&&(a=n||t&&this.doStatePropsDependOnOwnProps,u=t&&this.doDispatchPropsDependOnOwnProps);var s=!1,c=!1;r?s=!0:a&&(s=this.updateStatePropsIfNeeded()),u&&(c=this.updateDispatchPropsIfNeeded());var f=!0;return f=s||c||t?this.updateMergedPropsIfNeeded():!1,!f&&i?i:(E?this.renderedElement=(0,p.createElement)(e,l({},this.mergedProps,{ref:"wrappedInstance"})):this.renderedElement=(0,p.createElement)(e,this.mergedProps),this.renderedElement)},u}(p.Component);return r.displayName=n,r.WrappedComponent=e,r.contextTypes={store:d["default"]},r.propTypes={store:d["default"]},(0,x["default"])(r,e)}}var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.__esModule=!0,t["default"]=c;var p=n(26),f=n(243),d=r(f),h=n(581),v=r(h),m=n(582),y=r(m),g=n(244),b=(r(g),n(152)),_=(r(b),n(208)),x=r(_),E=n(94),w=r(E),C=function(e){return{}},P=function(e){return{dispatch:e}},S=function(e,t,n){return l({},n,e,t)},O={value:null},T=0},function(e,t){"use strict";function n(e,t){if(e===t)return!0;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=Object.prototype.hasOwnProperty,i=0;i<n.length;i++)if(!o.call(t,n[i])||e[n[i]]!==t[n[i]])return!1;return!0}t.__esModule=!0,t["default"]=n},function(e,t,n){"use strict";function r(e){return function(t){return(0,o.bindActionCreators)(e,t)}}t.__esModule=!0,t["default"]=r;var o=n(176)},function(e,t,n){"use strict";var r=n(12),o=n(205),i={focusDOMComponent:function(){o(r.getNodeFromInstance(this))}};e.exports=i},function(e,t,n){"use strict";function r(){var e=window.opera;return"object"==typeof e&&"function"==typeof e.version&&parseInt(e.version(),10)<=12}function o(e){return(e.ctrlKey||e.altKey||e.metaKey)&&!(e.ctrlKey&&e.altKey)}function i(e){switch(e){case T.topCompositionStart:return A.compositionStart;case T.topCompositionEnd:return A.compositionEnd;case T.topCompositionUpdate:return A.compositionUpdate}}function a(e,t){return e===T.topKeyDown&&t.keyCode===x}function u(e,t){switch(e){case T.topKeyUp:return-1!==_.indexOf(t.keyCode);case T.topKeyDown:return t.keyCode!==x;case T.topKeyPress:case T.topMouseDown:case T.topBlur:return!0;default:return!1}}function s(e){var t=e.detail;return"object"==typeof t&&"data"in t?t.data:null}function c(e,t,n,r){var o,c;if(E?o=i(e):k?u(e,n)&&(o=A.compositionEnd):a(e,n)&&(o=A.compositionStart),!o)return null;P&&(k||o!==A.compositionStart?o===A.compositionEnd&&k&&(c=k.getData()):k=m.getPooled(r));var l=y.getPooled(o,t,n,r);if(c)l.data=c;else{var p=s(n);null!==p&&(l.data=p)}return h.accumulateTwoPhaseDispatches(l),l}function l(e,t){switch(e){case T.topCompositionEnd:return s(t);case T.topKeyPress:var n=t.which;return n!==S?null:(M=!0,O);case T.topTextInput:var r=t.data;return r===O&&M?null:r;default:return null}}function p(e,t){if(k){if(e===T.topCompositionEnd||u(e,t)){var n=k.getData();return m.release(k),k=null,n}return null}switch(e){case T.topPaste:return null;case T.topKeyPress:return t.which&&!o(t)?String.fromCharCode(t.which):null;case T.topCompositionEnd:return P?null:t.data;default:return null}}function f(e,t,n,r){var o;if(o=C?l(e,n):p(e,n),!o)return null;var i=g.getPooled(A.beforeInput,t,n,r);return i.data=o,h.accumulateTwoPhaseDispatches(i),i}var d=n(41),h=n(77),v=n(15),m=n(590),y=n(629),g=n(632),b=n(47),_=[9,13,27,32],x=229,E=v.canUseDOM&&"CompositionEvent"in window,w=null;v.canUseDOM&&"documentMode"in document&&(w=document.documentMode);var C=v.canUseDOM&&"TextEvent"in window&&!w&&!r(),P=v.canUseDOM&&(!E||w&&w>8&&11>=w),S=32,O=String.fromCharCode(S),T=d.topLevelTypes,A={beforeInput:{phasedRegistrationNames:{bubbled:b({onBeforeInput:null}),captured:b({onBeforeInputCapture:null})},dependencies:[T.topCompositionEnd,T.topKeyPress,T.topTextInput,T.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:b({onCompositionEnd:null}),captured:b({onCompositionEndCapture:null})},dependencies:[T.topBlur,T.topCompositionEnd,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:b({onCompositionStart:null}),captured:b({onCompositionStartCapture:null})},dependencies:[T.topBlur,T.topCompositionStart,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:b({onCompositionUpdate:null}),captured:b({onCompositionUpdateCapture:null})},dependencies:[T.topBlur,T.topCompositionUpdate,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]}},M=!1,k=null,N={eventTypes:A,extractEvents:function(e,t,n,r){return[c(e,t,n,r),f(e,t,n,r)]}};e.exports=N},function(e,t,n){"use strict";var r=n(245),o=n(15),i=(n(25),n(476),n(638)),a=n(482),u=n(486),s=(n(4),u(function(e){return a(e)})),c=!1,l="cssFloat";if(o.canUseDOM){var p=document.createElement("div").style;try{p.font=""}catch(f){c=!0}void 0===document.documentElement.style.cssFloat&&(l="styleFloat")}var d={createMarkupForStyles:function(e,t){var n="";for(var r in e)if(e.hasOwnProperty(r)){var o=e[r];null!=o&&(n+=s(r)+":",n+=i(r,o,t)+";")}return n||null},setValueForStyles:function(e,t,n){var o=e.style;for(var a in t)if(t.hasOwnProperty(a)){var u=i(a,t[a],n);if("float"!==a&&"cssFloat"!==a||(a=l),u)o[a]=u;else{var s=c&&r.shorthandPropertyExpansions[a];if(s)for(var p in s)o[p]="";else o[a]=""}}}};e.exports=d},function(e,t,n){"use strict";function r(e){var t=e.nodeName&&e.nodeName.toLowerCase();return"select"===t||"input"===t&&"file"===e.type}function o(e){var t=C.getPooled(M.change,N,e,P(e));_.accumulateTwoPhaseDispatches(t),w.batchedUpdates(i,t)}function i(e){b.enqueueEvents(e),b.processEventQueue(!1)}function a(e,t){k=e,N=t,k.attachEvent("onchange",o)}function u(){k&&(k.detachEvent("onchange",o),k=null,N=null)}function s(e,t){return e===A.topChange?t:void 0}function c(e,t,n){e===A.topFocus?(u(),a(t,n)):e===A.topBlur&&u()}function l(e,t){k=e,N=t,R=e.value,I=Object.getOwnPropertyDescriptor(e.constructor.prototype,"value"),Object.defineProperty(k,"value",F),k.attachEvent?k.attachEvent("onpropertychange",f):k.addEventListener("propertychange",f,!1)}function p(){k&&(delete k.value,k.detachEvent?k.detachEvent("onpropertychange",f):k.removeEventListener("propertychange",f,!1),k=null,N=null,R=null,I=null)}function f(e){if("value"===e.propertyName){var t=e.srcElement.value;t!==R&&(R=t,o(e))}}function d(e,t){return e===A.topInput?t:void 0}function h(e,t,n){e===A.topFocus?(p(),l(t,n)):e===A.topBlur&&p()}function v(e,t){return e!==A.topSelectionChange&&e!==A.topKeyUp&&e!==A.topKeyDown||!k||k.value===R?void 0:(R=k.value,N)}function m(e){return e.nodeName&&"input"===e.nodeName.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)}function y(e,t){return e===A.topClick?t:void 0}var g=n(41),b=n(76),_=n(77),x=n(15),E=n(12),w=n(37),C=n(42),P=n(168),S=n(170),O=n(272),T=n(47),A=g.topLevelTypes,M={change:{phasedRegistrationNames:{bubbled:T({onChange:null}),captured:T({onChangeCapture:null})},dependencies:[A.topBlur,A.topChange,A.topClick,A.topFocus,A.topInput,A.topKeyDown,A.topKeyUp,A.topSelectionChange]}},k=null,N=null,R=null,I=null,j=!1;x.canUseDOM&&(j=S("change")&&(!("documentMode"in document)||document.documentMode>8));var D=!1;x.canUseDOM&&(D=S("input")&&(!("documentMode"in document)||document.documentMode>11));var F={get:function(){return I.get.call(this)},set:function(e){R=""+e,I.set.call(this,e)}},L={eventTypes:M,extractEvents:function(e,t,n,o){var i,a,u=t?E.getNodeFromInstance(t):window;if(r(u)?j?i=s:a=c:O(u)?D?i=d:(i=v,a=h):m(u)&&(i=y),i){var l=i(e,t);if(l){var p=C.getPooled(M.change,l,n,o);return p.type="change",_.accumulateTwoPhaseDispatches(p),p}}a&&a(e,u,t)}};e.exports=L},function(e,t,n){"use strict";function r(e){return e.substring(1,e.indexOf(" "))}var o=n(68),i=n(15),a=n(479),u=n(30),s=n(207),c=n(2),l=/^(<[^ \/>]+)/,p="data-danger-index",f={dangerouslyRenderMarkup:function(e){i.canUseDOM?void 0:c(!1);for(var t,n={},o=0;o<e.length;o++)e[o]?void 0:c(!1),t=r(e[o]),t=s(t)?t:"*",n[t]=n[t]||[],n[t][o]=e[o];var f=[],d=0;for(t in n)if(n.hasOwnProperty(t)){var h,v=n[t];for(h in v)if(v.hasOwnProperty(h)){var m=v[h];v[h]=m.replace(l,"$1 "+p+'="'+h+'" ')}for(var y=a(v.join(""),u),g=0;g<y.length;++g){var b=y[g];b.hasAttribute&&b.hasAttribute(p)&&(h=+b.getAttribute(p),b.removeAttribute(p),f.hasOwnProperty(h)?c(!1):void 0,f[h]=b,d+=1)}}return d!==f.length?c(!1):void 0,f.length!==e.length?c(!1):void 0,f},dangerouslyReplaceNodeWithMarkup:function(e,t){if(i.canUseDOM?void 0:c(!1),t?void 0:c(!1),"HTML"===e.nodeName?c(!1):void 0,"string"==typeof t){var n=a(t,u)[0];e.parentNode.replaceChild(n,e)}else o.replaceChildWithTree(e,t)}};e.exports=f},function(e,t,n){"use strict";var r=n(47),o=[r({ResponderEventPlugin:null}),r({SimpleEventPlugin:null}),r({TapEventPlugin:null}),r({EnterLeaveEventPlugin:null}),r({ChangeEventPlugin:null}),r({SelectEventPlugin:null}),r({BeforeInputEventPlugin:null})];e.exports=o},function(e,t,n){"use strict";var r=n(41),o=n(77),i=n(12),a=n(112),u=n(47),s=r.topLevelTypes,c={mouseEnter:{registrationName:u({onMouseEnter:null}),dependencies:[s.topMouseOut,s.topMouseOver]},mouseLeave:{registrationName:u({onMouseLeave:null}),dependencies:[s.topMouseOut,s.topMouseOver]}},l={eventTypes:c,extractEvents:function(e,t,n,r){if(e===s.topMouseOver&&(n.relatedTarget||n.fromElement))return null;if(e!==s.topMouseOut&&e!==s.topMouseOver)return null;var u;if(r.window===r)u=r;else{var l=r.ownerDocument;u=l?l.defaultView||l.parentWindow:window}var p,f;if(e===s.topMouseOut){p=t;var d=n.relatedTarget||n.toElement;f=d?i.getClosestInstanceFromNode(d):null}else p=null,f=t;if(p===f)return null;var h=null==p?u:i.getNodeFromInstance(p),v=null==f?u:i.getNodeFromInstance(f),m=a.getPooled(c.mouseLeave,p,n,r);m.type="mouseleave",m.target=h,m.relatedTarget=v;var y=a.getPooled(c.mouseEnter,f,n,r);return y.type="mouseenter",y.target=v,y.relatedTarget=h,o.accumulateEnterLeaveDispatches(m,y,p,f),[m,y]}};e.exports=l},function(e,t,n){"use strict";function r(e){this._root=e,this._startText=this.getText(),this._fallbackText=null}var o=n(9),i=n(49),a=n(270);o(r.prototype,{destructor:function(){this._root=null,this._startText=null,this._fallbackText=null},getText:function(){return"value"in this._root?this._root.value:this._root[a()]},getData:function(){if(this._fallbackText)return this._fallbackText;var e,t,n=this._startText,r=n.length,o=this.getText(),i=o.length;for(e=0;r>e&&n[e]===o[e];e++);var a=r-e;for(t=1;a>=t&&n[r-t]===o[i-t];t++);var u=t>1?1-t:void 0;return this._fallbackText=o.slice(e,u),this._fallbackText}}),i.addPoolingTo(r),e.exports=r},function(e,t,n){"use strict";var r=n(61),o=r.injection.MUST_USE_PROPERTY,i=r.injection.HAS_BOOLEAN_VALUE,a=r.injection.HAS_SIDE_EFFECTS,u=r.injection.HAS_NUMERIC_VALUE,s=r.injection.HAS_POSITIVE_NUMERIC_VALUE,c=r.injection.HAS_OVERLOADED_BOOLEAN_VALUE,l={isCustomAttribute:RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+r.ATTRIBUTE_NAME_CHAR+"]*$")),Properties:{accept:0,acceptCharset:0,accessKey:0,action:0,allowFullScreen:i,allowTransparency:0,alt:0,async:i,autoComplete:0,autoPlay:i,capture:i,cellPadding:0,cellSpacing:0,charSet:0,challenge:0,checked:o|i,cite:0,classID:0,className:0,cols:s,colSpan:0,content:0,contentEditable:0,contextMenu:0,controls:i,coords:0,crossOrigin:0,data:0,dateTime:0,"default":i,defer:i,dir:0,disabled:i,download:c,draggable:0,encType:0,form:0,formAction:0,formEncType:0,formMethod:0,formNoValidate:i,formTarget:0,frameBorder:0,headers:0,height:0,hidden:i,high:0,href:0,hrefLang:0,htmlFor:0,httpEquiv:0,icon:0,id:0,inputMode:0,integrity:0,is:0,keyParams:0,keyType:0,kind:0,label:0,lang:0,list:0,loop:i,low:0,manifest:0,marginHeight:0,marginWidth:0,max:0,maxLength:0,media:0,mediaGroup:0,method:0,min:0,minLength:0,multiple:o|i,muted:o|i,name:0,nonce:0,noValidate:i,open:i,optimum:0,pattern:0,placeholder:0,poster:0,preload:0,profile:0,radioGroup:0,readOnly:i,rel:0,required:i,reversed:i,role:0,rows:s,rowSpan:u,sandbox:0,scope:0,scoped:i,scrolling:0,seamless:i,selected:o|i,shape:0,size:s,sizes:0,span:s,spellCheck:0,src:0,srcDoc:0,srcLang:0,srcSet:0,start:u,step:0,style:0,summary:0,tabIndex:0,target:0,title:0,type:0,useMap:0,value:o|a,width:0,wmode:0,wrap:0,about:0,datatype:0,inlist:0,prefix:0,property:0,resource:0,"typeof":0,vocab:0,autoCapitalize:0,autoCorrect:0,autoSave:0,color:0,itemProp:0,itemScope:i,itemType:0,itemID:0,itemRef:0,results:0,security:0,unselectable:0},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{}};e.exports=l},function(e,t,n){"use strict";var r=n(9),o=n(248),i=n(250),a=n(249),u=n(601),s=n(31),c=(n(254),n(263)),l=n(265),p=n(644),f=(n(4),s.createElement),d=s.createFactory,h=s.cloneElement,v=r,m={Children:{map:o.map,forEach:o.forEach,count:o.count,toArray:o.toArray,only:p},Component:i,createElement:f,cloneElement:h,isValidElement:s.isValidElement,PropTypes:c,createClass:a.createClass,createFactory:d,createMixin:function(e){return e},DOM:u,version:l,__spread:v};e.exports=m},function(e,t,n){"use strict";function r(e,t,n){var r=void 0===e[n];null!=t&&r&&(e[n]=i(t))}var o=n(69),i=n(271),a=(n(159),n(172)),u=n(173),s=(n(4),{instantiateChildren:function(e,t,n){if(null==e)return null;var o={};return u(e,r,o),o},updateChildren:function(e,t,n,r,u){if(t||e){var s,c;for(s in t)if(t.hasOwnProperty(s)){c=e&&e[s];var l=c&&c._currentElement,p=t[s];if(null!=c&&a(l,p))o.receiveComponent(c,p,r,u),t[s]=c;else{c&&(n[s]=o.getNativeNode(c),o.unmountComponent(c,!1));var f=i(p);t[s]=f}}for(s in e)!e.hasOwnProperty(s)||t&&t.hasOwnProperty(s)||(c=e[s],n[s]=o.getNativeNode(c),o.unmountComponent(c,!1))}},unmountChildren:function(e,t){for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];o.unmountComponent(r,t)}}});e.exports=s},function(e,t,n){"use strict";function r(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" Check the render method of `"+n+"`."}return""}function o(e){}function i(e,t){}function a(e){return e.prototype&&e.prototype.isReactComponent}var u=n(9),s=n(161),c=n(50),l=n(31),p=n(162),f=n(163),d=(n(25),n(261)),h=n(111),v=(n(110),n(69)),m=n(264),y=n(92),g=n(2),b=n(172);n(4);o.prototype.render=function(){var e=f.get(this)._currentElement.type,t=e(this.props,this.context,this.updater);return i(e,t),t};var _=1,x={construct:function(e){this._currentElement=e,this._rootNodeID=null,this._instance=null,this._nativeParent=null,this._nativeContainerInfo=null,this._updateBatchNumber=null,this._pendingElement=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._renderedNodeType=null,this._renderedComponent=null,this._context=null,this._mountOrder=0,this._topLevelWrapper=null,this._pendingCallbacks=null,this._calledComponentWillUnmount=!1},mountComponent:function(e,t,n,r){this._context=r,this._mountOrder=_++,this._nativeParent=t,this._nativeContainerInfo=n;var u,s=this._processProps(this._currentElement.props),c=this._processContext(r),p=this._currentElement.type,d=this._constructComponent(s,c);a(p)||null!=d&&null!=d.render||(u=d,i(p,u),null===d||d===!1||l.isValidElement(d)?void 0:g(!1),d=new o(p));d.props=s,d.context=c,d.refs=y,d.updater=m,this._instance=d,f.set(d,this);var h=d.state;void 0===h&&(d.state=h=null),"object"!=typeof h||Array.isArray(h)?g(!1):void 0,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1;var v;return v=d.unstable_handleError?this.performInitialMountWithErrorHandling(u,t,n,e,r):this.performInitialMount(u,t,n,e,r),d.componentDidMount&&e.getReactMountReady().enqueue(d.componentDidMount,d),v},_constructComponent:function(e,t){return this._constructComponentWithoutOwner(e,t)},_constructComponentWithoutOwner:function(e,t){var n,r=this._currentElement.type;return n=a(r)?new r(e,t,m):r(e,t,m)},performInitialMountWithErrorHandling:function(e,t,n,r,o){var i,a=r.checkpoint();try{i=this.performInitialMount(e,t,n,r,o)}catch(u){r.rollback(a),this._instance.unstable_handleError(u),this._pendingStateQueue&&(this._instance.state=this._processPendingState(this._instance.props,this._instance.context)),a=r.checkpoint(),this._renderedComponent.unmountComponent(!0),r.rollback(a),i=this.performInitialMount(e,t,n,r,o)}return i},performInitialMount:function(e,t,n,r,o){var i=this._instance;i.componentWillMount&&(i.componentWillMount(),this._pendingStateQueue&&(i.state=this._processPendingState(i.props,i.context))),void 0===e&&(e=this._renderValidatedComponent()),this._renderedNodeType=d.getType(e),this._renderedComponent=this._instantiateReactComponent(e);var a=v.mountComponent(this._renderedComponent,r,t,n,this._processChildContext(o));return a},getNativeNode:function(){return v.getNativeNode(this._renderedComponent)},unmountComponent:function(e){if(this._renderedComponent){var t=this._instance;if(t.componentWillUnmount&&!t._calledComponentWillUnmount)if(t._calledComponentWillUnmount=!0,e){var n=this.getName()+".componentWillUnmount()";p.invokeGuardedCallback(n,t.componentWillUnmount.bind(t))}else t.componentWillUnmount();this._renderedComponent&&(v.unmountComponent(this._renderedComponent,e),this._renderedNodeType=null,this._renderedComponent=null,this._instance=null),this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._pendingCallbacks=null,this._pendingElement=null,this._context=null,this._rootNodeID=null,this._topLevelWrapper=null,f.remove(t)}},_maskContext:function(e){var t=this._currentElement.type,n=t.contextTypes;if(!n)return y;var r={};for(var o in n)r[o]=e[o];return r},_processContext:function(e){var t=this._maskContext(e);return t},_processChildContext:function(e){var t=this._currentElement.type,n=this._instance,r=n.getChildContext&&n.getChildContext();if(r){"object"!=typeof t.childContextTypes?g(!1):void 0;for(var o in r)o in t.childContextTypes?void 0:g(!1);return u({},e,r)}return e},_processProps:function(e){return e},_checkPropTypes:function(e,t,n){var o=this.getName();for(var i in e)if(e.hasOwnProperty(i)){var a;try{"function"!=typeof e[i]?g(!1):void 0,a=e[i](t,i,o,n)}catch(u){a=u}if(a instanceof Error){r(this);n===h.prop}}},receiveComponent:function(e,t,n){var r=this._currentElement,o=this._context;this._pendingElement=null,this.updateComponent(t,r,e,o,n)},performUpdateIfNecessary:function(e){null!=this._pendingElement?v.receiveComponent(this,this._pendingElement,e,this._context):null!==this._pendingStateQueue||this._pendingForceUpdate?this.updateComponent(e,this._currentElement,this._currentElement,this._context,this._context):this._updateBatchNumber=null},updateComponent:function(e,t,n,r,o){var i,a,u=this._instance,s=!1;this._context===o?i=u.context:(i=this._processContext(o),s=!0),t===n?a=n.props:(a=this._processProps(n.props),s=!0),s&&u.componentWillReceiveProps&&u.componentWillReceiveProps(a,i);var c=this._processPendingState(a,i),l=!0;!this._pendingForceUpdate&&u.shouldComponentUpdate&&(l=u.shouldComponentUpdate(a,c,i)),this._updateBatchNumber=null,l?(this._pendingForceUpdate=!1,this._performComponentUpdate(n,a,c,i,e,o)):(this._currentElement=n,this._context=o,u.props=a,u.state=c,u.context=i)},_processPendingState:function(e,t){var n=this._instance,r=this._pendingStateQueue,o=this._pendingReplaceState;if(this._pendingReplaceState=!1,this._pendingStateQueue=null,!r)return n.state;if(o&&1===r.length)return r[0];for(var i=u({},o?r[0]:n.state),a=o?1:0;a<r.length;a++){var s=r[a];u(i,"function"==typeof s?s.call(n,i,e,t):s)}return i},_performComponentUpdate:function(e,t,n,r,o,i){var a,u,s,c=this._instance,l=Boolean(c.componentDidUpdate);l&&(a=c.props,u=c.state,s=c.context),c.componentWillUpdate&&c.componentWillUpdate(t,n,r),this._currentElement=e,this._context=i,c.props=t,c.state=n,c.context=r,this._updateRenderedComponent(o,i),l&&o.getReactMountReady().enqueue(c.componentDidUpdate.bind(c,a,u,s),c)},_updateRenderedComponent:function(e,t){var n=this._renderedComponent,r=n._currentElement,o=this._renderValidatedComponent();if(b(r,o))v.receiveComponent(n,o,e,this._processChildContext(t));else{var i=v.getNativeNode(n);v.unmountComponent(n,!1),this._renderedNodeType=d.getType(o),this._renderedComponent=this._instantiateReactComponent(o);var a=v.mountComponent(this._renderedComponent,e,this._nativeParent,this._nativeContainerInfo,this._processChildContext(t));this._replaceNodeWithMarkup(i,a,n)}},_replaceNodeWithMarkup:function(e,t,n){s.replaceNodeWithMarkup(e,t,n)},_renderValidatedComponentWithoutOwnerOrContext:function(){var e=this._instance,t=e.render();return t},_renderValidatedComponent:function(){var e;c.current=this;try{e=this._renderValidatedComponentWithoutOwnerOrContext()}finally{c.current=null}return null===e||e===!1||l.isValidElement(e)?void 0:g(!1),e},attachRef:function(e,t){var n=this.getPublicInstance();null==n?g(!1):void 0;var r=t.getPublicInstance(),o=n.refs===y?n.refs={}:n.refs;o[e]=r},detachRef:function(e){var t=this.getPublicInstance().refs;delete t[e]},getName:function(){var e=this._currentElement.type,t=this._instance&&this._instance.constructor;return e.displayName||t&&t.displayName||e.name||t&&t.name||null},getPublicInstance:function(){var e=this._instance;return e instanceof o?null:e},_instantiateReactComponent:null},E={Mixin:x};e.exports=E},function(e,t,n){"use strict";var r=n(12),o=n(614),i=n(258),a=n(69),u=n(37),s=n(265),c=n(639),l=n(269),p=n(646);n(4);o.inject();var f={findDOMNode:c,render:i.render,unmountComponentAtNode:i.unmountComponentAtNode,version:s,unstable_batchedUpdates:u.batchedUpdates,unstable_renderSubtreeIntoContainer:p};"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ComponentTree:{getClosestInstanceFromNode:r.getClosestInstanceFromNode,getNodeFromInstance:function(e){return e._renderedComponent&&(e=l(e)),e?r.getNodeFromInstance(e):null}},Mount:i,Reconciler:a});e.exports=f},function(e,t,n){"use strict";var r=n(107),o={getNativeProps:r.getNativeProps};e.exports=o},function(e,t,n){"use strict";function r(e,t){t&&($[e._tag]&&(null!=t.children||null!=t.dangerouslySetInnerHTML?I(!1):void 0),null!=t.dangerouslySetInnerHTML&&(null!=t.children?I(!1):void 0,"object"==typeof t.dangerouslySetInnerHTML&&q in t.dangerouslySetInnerHTML?void 0:I(!1)),null!=t.style&&"object"!=typeof t.style?I(!1):void 0)}function o(e,t,n,r){if(!(r instanceof N)){var o=e._nativeContainerInfo,a=o._node&&o._node.nodeType===Y,u=a?o._node:o._ownerDocument;U(t,u),r.getReactMountReady().enqueue(i,{inst:e,registrationName:t,listener:n})}}function i(){var e=this;_.putListener(e.inst,e.registrationName,e.listener)}function a(){var e=this;T.postMountWrapper(e)}function u(){var e=this;e._rootNodeID?void 0:I(!1);var t=L(e);switch(t?void 0:I(!1),e._tag){case"iframe":case"object":e._wrapperState.listeners=[E.trapBubbledEvent(b.topLevelTypes.topLoad,"load",t)];break;case"video":case"audio":e._wrapperState.listeners=[];for(var n in z)z.hasOwnProperty(n)&&e._wrapperState.listeners.push(E.trapBubbledEvent(b.topLevelTypes[n],z[n],t));break;case"img":e._wrapperState.listeners=[E.trapBubbledEvent(b.topLevelTypes.topError,"error",t),E.trapBubbledEvent(b.topLevelTypes.topLoad,"load",t)];break;case"form":e._wrapperState.listeners=[E.trapBubbledEvent(b.topLevelTypes.topReset,"reset",t),E.trapBubbledEvent(b.topLevelTypes.topSubmit,"submit",t)];break;case"input":case"select":case"textarea":e._wrapperState.listeners=[E.trapBubbledEvent(b.topLevelTypes.topInvalid,"invalid",t)]}}function s(){A.postUpdateWrapper(this)}function c(e){Z.call(Q,e)||(X.test(e)?void 0:I(!1),Q[e]=!0)}function l(e,t){return e.indexOf("-")>=0||null!=t.is}function p(e){var t=e.type;c(t),this._currentElement=e,this._tag=t.toLowerCase(),this._namespaceURI=null,this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._nativeNode=null,this._nativeParent=null,this._rootNodeID=null,this._domID=null,this._nativeContainerInfo=null,this._wrapperState=null,this._topLevelWrapper=null,this._flags=0}var f=n(9),d=n(583),h=n(585),v=n(68),m=n(247),y=n(61),g=n(157),b=n(41),_=n(76),x=n(108),E=n(109),w=n(251),C=n(596),P=n(252),S=n(12),O=n(604),T=n(606),A=n(253),M=n(609),k=(n(25),n(619)),N=n(623),R=(n(30),n(114)),I=n(2),j=(n(170),n(47)),D=(n(141),n(174),n(4),P),F=_.deleteListener,L=S.getNodeFromInstance,U=E.listenTo,V=x.registrationNameModules,B={string:!0,number:!0},W=j({style:null}),q=j({__html:null}),H={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null},Y=11,z={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},K={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},G={listing:!0,pre:!0,textarea:!0},$=f({menuitem:!0},K),X=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,Q={},Z={}.hasOwnProperty,J=1;
p.displayName="ReactDOMComponent",p.Mixin={mountComponent:function(e,t,n,o){this._rootNodeID=J++,this._domID=n._idCounter++,this._nativeParent=t,this._nativeContainerInfo=n;var i=this._currentElement.props;switch(this._tag){case"iframe":case"object":case"img":case"form":case"video":case"audio":this._wrapperState={listeners:null},e.getReactMountReady().enqueue(u,this);break;case"button":i=C.getNativeProps(this,i,t);break;case"input":O.mountWrapper(this,i,t),i=O.getNativeProps(this,i),e.getReactMountReady().enqueue(u,this);break;case"option":T.mountWrapper(this,i,t),i=T.getNativeProps(this,i);break;case"select":A.mountWrapper(this,i,t),i=A.getNativeProps(this,i),e.getReactMountReady().enqueue(u,this);break;case"textarea":M.mountWrapper(this,i,t),i=M.getNativeProps(this,i),e.getReactMountReady().enqueue(u,this)}r(this,i);var s,c;null!=t?(s=t._namespaceURI,c=t._tag):n._tag&&(s=n._namespaceURI,c=n._tag),(null==s||s===m.svg&&"foreignobject"===c)&&(s=m.html),s===m.html&&("svg"===this._tag?s=m.svg:"math"===this._tag&&(s=m.mathml)),this._namespaceURI=s;var l;if(e.useCreateElement){var p,f=n._ownerDocument;if(s===m.html)if("script"===this._tag){var h=f.createElement("div"),y=this._currentElement.type;h.innerHTML="<"+y+"></"+y+">",p=h.removeChild(h.firstChild)}else p=f.createElement(this._currentElement.type,i.is||null);else p=f.createElementNS(s,this._currentElement.type);S.precacheNode(this,p),this._flags|=D.hasCachedChildNodes,this._nativeParent||g.setAttributeForRoot(p),this._updateDOMProperties(null,i,e);var b=v(p);this._createInitialChildren(e,i,o,b),l=b}else{var _=this._createOpenTagMarkupAndPutListeners(e,i),x=this._createContentMarkup(e,i,o);l=!x&&K[this._tag]?_+"/>":_+">"+x+"</"+this._currentElement.type+">"}switch(this._tag){case"button":case"input":case"select":case"textarea":i.autoFocus&&e.getReactMountReady().enqueue(d.focusDOMComponent,this);break;case"option":e.getReactMountReady().enqueue(a,this)}return l},_createOpenTagMarkupAndPutListeners:function(e,t){var n="<"+this._currentElement.type;for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];if(null!=i)if(V.hasOwnProperty(r))i&&o(this,r,i,e);else{r===W&&(i&&(i=this._previousStyleCopy=f({},t.style)),i=h.createMarkupForStyles(i,this));var a=null;null!=this._tag&&l(this._tag,t)?H.hasOwnProperty(r)||(a=g.createMarkupForCustomAttribute(r,i)):a=g.createMarkupForProperty(r,i),a&&(n+=" "+a)}}return e.renderToStaticMarkup?n:(this._nativeParent||(n+=" "+g.createMarkupForRoot()),n+=" "+g.createMarkupForID(this._domID))},_createContentMarkup:function(e,t,n){var r="",o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&(r=o.__html);else{var i=B[typeof t.children]?t.children:null,a=null!=i?null:t.children;if(null!=i)r=R(i);else if(null!=a){var u=this.mountChildren(a,e,n);r=u.join("")}}return G[this._tag]&&"\n"===r.charAt(0)?"\n"+r:r},_createInitialChildren:function(e,t,n,r){var o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&v.queueHTML(r,o.__html);else{var i=B[typeof t.children]?t.children:null,a=null!=i?null:t.children;if(null!=i)v.queueText(r,i);else if(null!=a)for(var u=this.mountChildren(a,e,n),s=0;s<u.length;s++)v.queueChild(r,u[s])}},receiveComponent:function(e,t,n){var r=this._currentElement;this._currentElement=e,this.updateComponent(t,r,e,n)},updateComponent:function(e,t,n,o){var i=t.props,a=this._currentElement.props;switch(this._tag){case"button":i=C.getNativeProps(this,i),a=C.getNativeProps(this,a);break;case"input":O.updateWrapper(this),i=O.getNativeProps(this,i),a=O.getNativeProps(this,a);break;case"option":i=T.getNativeProps(this,i),a=T.getNativeProps(this,a);break;case"select":i=A.getNativeProps(this,i),a=A.getNativeProps(this,a);break;case"textarea":M.updateWrapper(this),i=M.getNativeProps(this,i),a=M.getNativeProps(this,a)}r(this,a),this._updateDOMProperties(i,a,e),this._updateDOMChildren(i,a,e,o),"select"===this._tag&&e.getReactMountReady().enqueue(s,this)},_updateDOMProperties:function(e,t,n){var r,i,a;for(r in e)if(!t.hasOwnProperty(r)&&e.hasOwnProperty(r)&&null!=e[r])if(r===W){var u=this._previousStyleCopy;for(i in u)u.hasOwnProperty(i)&&(a=a||{},a[i]="");this._previousStyleCopy=null}else V.hasOwnProperty(r)?e[r]&&F(this,r):(y.properties[r]||y.isCustomAttribute(r))&&g.deleteValueForProperty(L(this),r);for(r in t){var s=t[r],c=r===W?this._previousStyleCopy:null!=e?e[r]:void 0;if(t.hasOwnProperty(r)&&s!==c&&(null!=s||null!=c))if(r===W)if(s?s=this._previousStyleCopy=f({},s):this._previousStyleCopy=null,c){for(i in c)!c.hasOwnProperty(i)||s&&s.hasOwnProperty(i)||(a=a||{},a[i]="");for(i in s)s.hasOwnProperty(i)&&c[i]!==s[i]&&(a=a||{},a[i]=s[i])}else a=s;else if(V.hasOwnProperty(r))s?o(this,r,s,n):c&&F(this,r);else if(l(this._tag,t))H.hasOwnProperty(r)||g.setValueForAttribute(L(this),r,s);else if(y.properties[r]||y.isCustomAttribute(r)){var p=L(this);null!=s?g.setValueForProperty(p,r,s):g.deleteValueForProperty(p,r)}}a&&h.setValueForStyles(L(this),a,this)},_updateDOMChildren:function(e,t,n,r){var o=B[typeof e.children]?e.children:null,i=B[typeof t.children]?t.children:null,a=e.dangerouslySetInnerHTML&&e.dangerouslySetInnerHTML.__html,u=t.dangerouslySetInnerHTML&&t.dangerouslySetInnerHTML.__html,s=null!=o?null:e.children,c=null!=i?null:t.children,l=null!=o||null!=a,p=null!=i||null!=u;null!=s&&null==c?this.updateChildren(null,n,r):l&&!p&&this.updateTextContent(""),null!=i?o!==i&&this.updateTextContent(""+i):null!=u?a!==u&&this.updateMarkup(""+u):null!=c&&this.updateChildren(c,n,r)},getNativeNode:function(){return L(this)},unmountComponent:function(e){switch(this._tag){case"iframe":case"object":case"img":case"form":case"video":case"audio":var t=this._wrapperState.listeners;if(t)for(var n=0;n<t.length;n++)t[n].remove();break;case"html":case"head":case"body":I(!1)}this.unmountChildren(e),S.uncacheNode(this),_.deleteAllListeners(this),w.unmountIDFromEnvironment(this._rootNodeID),this._rootNodeID=null,this._domID=null,this._wrapperState=null},getPublicInstance:function(){return L(this)}},f(p.prototype,p.Mixin,k.Mixin),e.exports=p},function(e,t,n){"use strict";function r(e,t){var n={_topLevelWrapper:e,_idCounter:1,_ownerDocument:t?t.nodeType===o?t:t.ownerDocument:null,_node:t,_tag:t?t.nodeName.toLowerCase():null,_namespaceURI:t?t.namespaceURI:null};return n}var o=(n(174),9);e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r,o,i){}var o=n(611),i=(n(4),[]),a={addDevtool:function(e){i.push(e)},removeDevtool:function(e){for(var t=0;t<i.length;t++)i[t]===e&&(i.splice(t,1),t--)},onCreateMarkupForProperty:function(e,t){r("onCreateMarkupForProperty",e,t)},onSetValueForProperty:function(e,t,n){r("onSetValueForProperty",e,t,n)},onDeleteValueForProperty:function(e,t){r("onDeleteValueForProperty",e,t)}};a.addDevtool(o),e.exports=a},function(e,t,n){"use strict";var r=n(9),o=n(68),i=n(12),a=function(e){this._currentElement=null,this._nativeNode=null,this._nativeParent=null,this._nativeContainerInfo=null,this._domID=null};r(a.prototype,{mountComponent:function(e,t,n,r){var a=n._idCounter++;this._domID=a,this._nativeParent=t,this._nativeContainerInfo=n;var u=" react-empty: "+this._domID+" ";if(e.useCreateElement){var s=n._ownerDocument,c=s.createComment(u);return i.precacheNode(this,c),o(c)}return e.renderToStaticMarkup?"":"<!--"+u+"-->"},receiveComponent:function(){},getNativeNode:function(){return i.getNodeFromInstance(this)},unmountComponent:function(){i.uncacheNode(this)}}),e.exports=a},function(e,t,n){"use strict";function r(e){return o.createFactory(e)}var o=n(31),i=(n(254),n(485)),a=i({a:"a",abbr:"abbr",address:"address",area:"area",article:"article",aside:"aside",audio:"audio",b:"b",base:"base",bdi:"bdi",bdo:"bdo",big:"big",blockquote:"blockquote",body:"body",br:"br",button:"button",canvas:"canvas",caption:"caption",cite:"cite",code:"code",col:"col",colgroup:"colgroup",data:"data",datalist:"datalist",dd:"dd",del:"del",details:"details",dfn:"dfn",dialog:"dialog",div:"div",dl:"dl",dt:"dt",em:"em",embed:"embed",fieldset:"fieldset",figcaption:"figcaption",figure:"figure",footer:"footer",form:"form",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",head:"head",header:"header",hgroup:"hgroup",hr:"hr",html:"html",i:"i",iframe:"iframe",img:"img",input:"input",ins:"ins",kbd:"kbd",keygen:"keygen",label:"label",legend:"legend",li:"li",link:"link",main:"main",map:"map",mark:"mark",menu:"menu",menuitem:"menuitem",meta:"meta",meter:"meter",nav:"nav",noscript:"noscript",object:"object",ol:"ol",optgroup:"optgroup",option:"option",output:"output",p:"p",param:"param",picture:"picture",pre:"pre",progress:"progress",q:"q",rp:"rp",rt:"rt",ruby:"ruby",s:"s",samp:"samp",script:"script",section:"section",select:"select",small:"small",source:"source",span:"span",strong:"strong",style:"style",sub:"sub",summary:"summary",sup:"sup",table:"table",tbody:"tbody",td:"td",textarea:"textarea",tfoot:"tfoot",th:"th",thead:"thead",time:"time",title:"title",tr:"tr",track:"track",u:"u",ul:"ul","var":"var",video:"video",wbr:"wbr",circle:"circle",clipPath:"clipPath",defs:"defs",ellipse:"ellipse",g:"g",image:"image",line:"line",linearGradient:"linearGradient",mask:"mask",path:"path",pattern:"pattern",polygon:"polygon",polyline:"polyline",radialGradient:"radialGradient",rect:"rect",stop:"stop",svg:"svg",text:"text",tspan:"tspan"},r);e.exports=a},function(e,t){"use strict";var n={useCreateElement:!0};e.exports=n},function(e,t,n){"use strict";var r=n(156),o=n(12),i={dangerouslyProcessChildrenUpdates:function(e,t){var n=o.getNodeFromInstance(e);r.processUpdates(n,t)}};e.exports=i},function(e,t,n){"use strict";function r(){this._rootNodeID&&f.updateWrapper(this)}function o(e){var t=this._currentElement.props,n=s.executeOnChange(t,e);l.asap(r,this);var o=t.name;if("radio"===t.type&&null!=o){for(var i=c.getNodeFromInstance(this),a=i;a.parentNode;)a=a.parentNode;for(var u=a.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),f=0;f<u.length;f++){var d=u[f];if(d!==i&&d.form===i.form){var h=c.getInstanceFromNode(d);h?void 0:p(!1),l.asap(r,h)}}}return n}var i=n(9),a=n(107),u=n(157),s=n(160),c=n(12),l=n(37),p=n(2),f=(n(4),{getNativeProps:function(e,t){var n=s.getValue(t),r=s.getChecked(t),o=i({type:void 0},a.getNativeProps(e,t),{defaultChecked:void 0,defaultValue:void 0,value:null!=n?n:e._wrapperState.initialValue,checked:null!=r?r:e._wrapperState.initialChecked,onChange:e._wrapperState.onChange});return o},mountWrapper:function(e,t){var n=t.defaultValue;e._wrapperState={initialChecked:t.defaultChecked||!1,initialValue:null!=n?n:null,listeners:null,onChange:o.bind(e)}},updateWrapper:function(e){var t=e._currentElement.props,n=t.checked;null!=n&&u.setValueForProperty(c.getNodeFromInstance(e),"checked",n||!1);var r=s.getValue(t);null!=r&&u.setValueForProperty(c.getNodeFromInstance(e),"value",""+r)}});e.exports=f},function(e,t,n){"use strict";var r=n(599);e.exports={debugTool:r}},function(e,t,n){"use strict";var r=n(9),o=n(248),i=n(12),a=n(253),u=(n(4),{mountWrapper:function(e,t,n){var r=null;if(null!=n){var o=n;"optgroup"===o._tag&&(o=o._nativeParent),null!=o&&"select"===o._tag&&(r=a.getSelectValueContext(o))}var i=null;if(null!=r)if(i=!1,Array.isArray(r)){for(var u=0;u<r.length;u++)if(""+r[u]==""+t.value){i=!0;break}}else i=""+r==""+t.value;e._wrapperState={selected:i}},postMountWrapper:function(e){var t=e._currentElement.props;if(null!=t.value){var n=i.getNodeFromInstance(e);n.setAttribute("value",t.value)}},getNativeProps:function(e,t){var n=r({selected:void 0,children:void 0},t);null!=e._wrapperState.selected&&(n.selected=e._wrapperState.selected);var i="";return o.forEach(t.children,function(e){null!=e&&("string"!=typeof e&&"number"!=typeof e||(i+=e))}),i&&(n.children=i),n}});e.exports=u},function(e,t,n){"use strict";function r(e,t,n,r){return e===n&&t===r}function o(e){var t=document.selection,n=t.createRange(),r=n.text.length,o=n.duplicate();o.moveToElementText(e),o.setEndPoint("EndToStart",n);var i=o.text.length,a=i+r;return{start:i,end:a}}function i(e){var t=window.getSelection&&window.getSelection();if(!t||0===t.rangeCount)return null;var n=t.anchorNode,o=t.anchorOffset,i=t.focusNode,a=t.focusOffset,u=t.getRangeAt(0);try{u.startContainer.nodeType,u.endContainer.nodeType}catch(s){return null}var c=r(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),l=c?0:u.toString().length,p=u.cloneRange();p.selectNodeContents(e),p.setEnd(u.startContainer,u.startOffset);var f=r(p.startContainer,p.startOffset,p.endContainer,p.endOffset),d=f?0:p.toString().length,h=d+l,v=document.createRange();v.setStart(n,o),v.setEnd(i,a);var m=v.collapsed;return{start:m?h:d,end:m?d:h}}function a(e,t){var n,r,o=document.selection.createRange().duplicate();void 0===t.end?(n=t.start,r=n):t.start>t.end?(n=t.end,r=t.start):(n=t.start,r=t.end),o.moveToElementText(e),o.moveStart("character",n),o.setEndPoint("EndToStart",o),o.moveEnd("character",r-n),o.select()}function u(e,t){if(window.getSelection){var n=window.getSelection(),r=e[l()].length,o=Math.min(t.start,r),i=void 0===t.end?o:Math.min(t.end,r);if(!n.extend&&o>i){var a=i;i=o,o=a}var u=c(e,o),s=c(e,i);if(u&&s){var p=document.createRange();p.setStart(u.node,u.offset),n.removeAllRanges(),o>i?(n.addRange(p),n.extend(s.node,s.offset)):(p.setEnd(s.node,s.offset),n.addRange(p))}}}var s=n(15),c=n(642),l=n(270),p=s.canUseDOM&&"selection"in document&&!("getSelection"in window),f={getOffsets:p?o:i,setOffsets:p?a:u};e.exports=f},function(e,t,n){"use strict";var r=n(9),o=n(156),i=n(68),a=n(12),u=(n(25),n(114)),s=n(2),c=(n(174),function(e){this._currentElement=e,this._stringText=""+e,this._nativeNode=null,this._nativeParent=null,this._domID=null,this._mountIndex=0,this._closingComment=null,this._commentNodes=null});r(c.prototype,{mountComponent:function(e,t,n,r){var o=n._idCounter++,s=" react-text: "+o+" ",c=" /react-text ";if(this._domID=o,this._nativeParent=t,e.useCreateElement){var l=n._ownerDocument,p=l.createComment(s),f=l.createComment(c),d=i(l.createDocumentFragment());return i.queueChild(d,i(p)),this._stringText&&i.queueChild(d,i(l.createTextNode(this._stringText))),i.queueChild(d,i(f)),a.precacheNode(this,p),this._closingComment=f,d}var h=u(this._stringText);return e.renderToStaticMarkup?h:"<!--"+s+"-->"+h+"<!--"+c+"-->"},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;if(n!==this._stringText){this._stringText=n;var r=this.getNativeNode();o.replaceDelimitedText(r[0],r[1],n)}}},getNativeNode:function(){var e=this._commentNodes;if(e)return e;if(!this._closingComment)for(var t=a.getNodeFromInstance(this),n=t.nextSibling;;){if(null==n?s(!1):void 0,8===n.nodeType&&" /react-text "===n.nodeValue){this._closingComment=n;break}n=n.nextSibling}return e=[this._nativeNode,this._closingComment],this._commentNodes=e,e},unmountComponent:function(){this._closingComment=null,this._commentNodes=null,a.uncacheNode(this)}}),e.exports=c},function(e,t,n){"use strict";function r(){this._rootNodeID&&f.updateWrapper(this)}function o(e){var t=this._currentElement.props,n=s.executeOnChange(t,e);return l.asap(r,this),n}var i=n(9),a=n(107),u=n(157),s=n(160),c=n(12),l=n(37),p=n(2),f=(n(4),{getNativeProps:function(e,t){null!=t.dangerouslySetInnerHTML?p(!1):void 0;var n=i({},a.getNativeProps(e,t),{defaultValue:void 0,value:void 0,children:e._wrapperState.initialValue,onChange:e._wrapperState.onChange});return n},mountWrapper:function(e,t){var n=t.defaultValue,r=t.children;null!=r&&(null!=n?p(!1):void 0,Array.isArray(r)&&(r.length<=1?void 0:p(!1),r=r[0]),n=""+r),null==n&&(n="");var i=s.getValue(t);e._wrapperState={initialValue:""+(null!=i?i:n),listeners:null,onChange:o.bind(e)}},updateWrapper:function(e){var t=e._currentElement.props,n=s.getValue(t);null!=n&&u.setValueForProperty(c.getNodeFromInstance(e),"value",""+n)}});e.exports=f},function(e,t,n){"use strict";function r(e,t){"_nativeNode"in e?void 0:s(!1),"_nativeNode"in t?void 0:s(!1);for(var n=0,r=e;r;r=r._nativeParent)n++;for(var o=0,i=t;i;i=i._nativeParent)o++;for(;n-o>0;)e=e._nativeParent,n--;for(;o-n>0;)t=t._nativeParent,o--;for(var a=n;a--;){if(e===t)return e;e=e._nativeParent,t=t._nativeParent}return null}function o(e,t){"_nativeNode"in e?void 0:s(!1),"_nativeNode"in t?void 0:s(!1);for(;t;){if(t===e)return!0;t=t._nativeParent}return!1}function i(e){return"_nativeNode"in e?void 0:s(!1),e._nativeParent}function a(e,t,n){for(var r=[];e;)r.push(e),e=e._nativeParent;var o;for(o=r.length;o-- >0;)t(r[o],!1,n);for(o=0;o<r.length;o++)t(r[o],!0,n)}function u(e,t,n,o,i){for(var a=e&&t?r(e,t):null,u=[];e&&e!==a;)u.push(e),e=e._nativeParent;for(var s=[];t&&t!==a;)s.push(t),t=t._nativeParent;var c;for(c=0;c<u.length;c++)n(u[c],!0,o);for(c=s.length;c-- >0;)n(s[c],!1,i)}var s=n(2);e.exports={isAncestor:o,getLowestCommonAncestor:r,getParentInstance:i,traverseTwoPhase:a,traverseEnterLeave:u}},function(e,t,n){"use strict";var r,o=(n(61),n(108),n(4),{onCreateMarkupForProperty:function(e,t){r(e)},onSetValueForProperty:function(e,t,n){r(t)},onDeleteValueForProperty:function(e,t){r(t)}});e.exports=o},function(e,t,n){"use strict";function r(e,t,n,r,o,i){}function o(e){}var i=(n(15),n(488),n(4),[]),a={addDevtool:function(e){i.push(e)},removeDevtool:function(e){for(var t=0;t<i.length;t++)i[t]===e&&(i.splice(t,1),t--)},beginProfiling:function(){},endProfiling:function(){},getFlushHistory:function(){},onBeginFlush:function(){r("onBeginFlush")},onEndFlush:function(){r("onEndFlush")},onBeginLifeCycleTimer:function(e,t){o(e),r("onBeginLifeCycleTimer",e,t)},onEndLifeCycleTimer:function(e,t){o(e),r("onEndLifeCycleTimer",e,t)},onBeginReconcilerTimer:function(e,t){o(e),r("onBeginReconcilerTimer",e,t)},onEndReconcilerTimer:function(e,t){o(e),r("onEndReconcilerTimer",e,t)},onBeginProcessingChildContext:function(){r("onBeginProcessingChildContext")},onEndProcessingChildContext:function(){r("onEndProcessingChildContext")},onNativeOperation:function(e,t,n){o(e),r("onNativeOperation",e,t,n)},onSetState:function(){r("onSetState")},onSetDisplayName:function(e,t){o(e),r("onSetDisplayName",e,t)},onSetChildren:function(e,t){o(e),r("onSetChildren",e,t)},onSetOwner:function(e,t){o(e),r("onSetOwner",e,t)},onSetText:function(e,t){o(e),r("onSetText",e,t)},onMountRootComponent:function(e){o(e),r("onMountRootComponent",e)},onMountComponent:function(e){o(e),r("onMountComponent",e)},onUpdateComponent:function(e){o(e),r("onUpdateComponent",e)},onUnmountComponent:function(e){o(e),r("onUnmountComponent",e)}};e.exports=a},function(e,t,n){"use strict";function r(){this.reinitializeTransaction()}var o=n(9),i=n(37),a=n(113),u=n(30),s={initialize:u,close:function(){f.isBatchingUpdates=!1}},c={initialize:u,close:i.flushBatchedUpdates.bind(i)},l=[c,s];o(r.prototype,a.Mixin,{getTransactionWrappers:function(){return l}});var p=new r,f={isBatchingUpdates:!1,batchedUpdates:function(e,t,n,r,o,i){var a=f.isBatchingUpdates;f.isBatchingUpdates=!0,a?e(t,n,r,o,i):p.perform(e,null,t,n,r,o,i)}};e.exports=f},function(e,t,n){"use strict";function r(){E||(E=!0,y.EventEmitter.injectReactEventListener(m),y.EventPluginHub.injectEventPluginOrder(a),y.EventPluginUtils.injectComponentTree(p),y.EventPluginUtils.injectTreeTraversal(d),y.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:x,EnterLeaveEventPlugin:u,ChangeEventPlugin:i,SelectEventPlugin:_,BeforeInputEventPlugin:o}),y.NativeComponent.injectGenericComponentClass(l),y.NativeComponent.injectTextComponentClass(h),y.DOMProperty.injectDOMPropertyConfig(s),y.DOMProperty.injectDOMPropertyConfig(b),y.EmptyComponent.injectEmptyComponentFactory(function(e){return new f(e)}),y.Updates.injectReconcileTransaction(g),y.Updates.injectBatchingStrategy(v),y.Component.injectEnvironment(c))}var o=n(584),i=n(586),a=n(588),u=n(589),s=n(591),c=n(251),l=n(597),p=n(12),f=n(600),d=n(610),h=n(608),v=n(613),m=n(616),y=n(617),g=n(621),b=n(624),_=n(625),x=n(626),E=!1;e.exports={inject:r}},function(e,t,n){"use strict";function r(e){o.enqueueEvents(e),o.processEventQueue(!1)}var o=n(76),i={handleTopLevel:function(e,t,n,i){var a=o.extractEvents(e,t,n,i);r(a)}};e.exports=i},function(e,t,n){"use strict";function r(e){for(;e._nativeParent;)e=e._nativeParent;var t=p.getNodeFromInstance(e),n=t.parentNode;return p.getClosestInstanceFromNode(n)}function o(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function i(e){var t=d(e.nativeEvent),n=p.getClosestInstanceFromNode(t),o=n;do e.ancestors.push(o),o=o&&r(o);while(o);for(var i=0;i<e.ancestors.length;i++)n=e.ancestors[i],v._handleTopLevel(e.topLevelType,n,e.nativeEvent,d(e.nativeEvent))}function a(e){var t=h(window);e(t)}var u=n(9),s=n(204),c=n(15),l=n(49),p=n(12),f=n(37),d=n(168),h=n(480);u(o.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),l.addPoolingTo(o,l.twoArgumentPooler);var v={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:c.canUseDOM?window:null,setHandleTopLevel:function(e){v._handleTopLevel=e},setEnabled:function(e){v._enabled=!!e},isEnabled:function(){return v._enabled},trapBubbledEvent:function(e,t,n){var r=n;return r?s.listen(r,t,v.dispatchEvent.bind(null,e)):null},trapCapturedEvent:function(e,t,n){var r=n;return r?s.capture(r,t,v.dispatchEvent.bind(null,e)):null},monitorScrollValue:function(e){var t=a.bind(null,e);s.listen(window,"scroll",t)},dispatchEvent:function(e,t){if(v._enabled){var n=o.getPooled(e,t);try{f.batchedUpdates(i,n)}finally{o.release(n)}}}};e.exports=v},function(e,t,n){"use strict";var r=n(61),o=n(76),i=n(158),a=n(161),u=n(249),s=n(255),c=n(109),l=n(260),p=n(37),f={Component:a.injection,Class:u.injection,DOMProperty:r.injection,EmptyComponent:s.injection,EventPluginHub:o.injection,EventPluginUtils:i.injection,EventEmitter:c.injection,NativeComponent:l.injection,Updates:p.injection};e.exports=f},function(e,t,n){"use strict";var r=n(637),o=/\/?>/,i=/^<\!\-\-/,a={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=r(e);return i.test(e)?e:e.replace(o," "+a.CHECKSUM_ATTR_NAME+'="'+t+'"$&')},canReuseMarkup:function(e,t){var n=t.getAttribute(a.CHECKSUM_ATTR_NAME);n=n&&parseInt(n,10);var o=r(e);return o===n}};e.exports=a},function(e,t,n){"use strict";function r(e,t,n){return{type:p.INSERT_MARKUP,content:e,fromIndex:null,fromNode:null,toIndex:n,afterNode:t}}function o(e,t,n){return{type:p.MOVE_EXISTING,content:null,fromIndex:e._mountIndex,fromNode:f.getNativeNode(e),toIndex:n,afterNode:t}}function i(e,t){return{type:p.REMOVE_NODE,content:null,fromIndex:e._mountIndex,fromNode:t,toIndex:null,afterNode:null}}function a(e){return{type:p.SET_MARKUP,content:e,fromIndex:null,fromNode:null,toIndex:null,afterNode:null}}function u(e){return{type:p.TEXT_CONTENT,content:e,fromIndex:null,fromNode:null,toIndex:null,afterNode:null}}function s(e,t){return t&&(e=e||[],e.push(t)),e}function c(e,t){l.processChildrenUpdates(e,t)}var l=n(161),p=(n(25),n(259)),f=(n(50),n(69)),d=n(593),h=(n(30),n(640)),v=n(2),m={Mixin:{_reconcilerInstantiateChildren:function(e,t,n){return d.instantiateChildren(e,t,n)},_reconcilerUpdateChildren:function(e,t,n,r,o){var i;return i=h(t),d.updateChildren(e,i,n,r,o),i},mountChildren:function(e,t,n){var r=this._reconcilerInstantiateChildren(e,t,n);this._renderedChildren=r;var o=[],i=0;for(var a in r)if(r.hasOwnProperty(a)){var u=r[a],s=f.mountComponent(u,t,this,this._nativeContainerInfo,n);u._mountIndex=i++,o.push(s)}return o},updateTextContent:function(e){var t=this._renderedChildren;d.unmountChildren(t,!1);for(var n in t)t.hasOwnProperty(n)&&v(!1);var r=[u(e)];c(this,r)},updateMarkup:function(e){var t=this._renderedChildren;d.unmountChildren(t,!1);for(var n in t)t.hasOwnProperty(n)&&v(!1);var r=[a(e)];c(this,r)},updateChildren:function(e,t,n){this._updateChildren(e,t,n)},_updateChildren:function(e,t,n){var r=this._renderedChildren,o={},i=this._reconcilerUpdateChildren(r,e,o,t,n);if(i||r){var a,u=null,l=0,p=0,d=null;for(a in i)if(i.hasOwnProperty(a)){var h=r&&r[a],v=i[a];h===v?(u=s(u,this.moveChild(h,d,p,l)),l=Math.max(h._mountIndex,l),h._mountIndex=p):(h&&(l=Math.max(h._mountIndex,l)),u=s(u,this._mountChildAtIndex(v,d,p,t,n))),p++,d=f.getNativeNode(v)}for(a in o)o.hasOwnProperty(a)&&(u=s(u,this._unmountChild(r[a],o[a])));u&&c(this,u),this._renderedChildren=i}},unmountChildren:function(e){var t=this._renderedChildren;d.unmountChildren(t,e),this._renderedChildren=null},moveChild:function(e,t,n,r){return e._mountIndex<r?o(e,t,n):void 0},createChild:function(e,t,n){return r(n,t,e._mountIndex)},removeChild:function(e,t){return i(e,t)},_mountChildAtIndex:function(e,t,n,r,o){var i=f.mountComponent(e,r,this,this._nativeContainerInfo,o);return e._mountIndex=n,this.createChild(e,t,i)},_unmountChild:function(e,t){var n=this.removeChild(e,t);return e._mountIndex=null,n}}};e.exports=m},function(e,t,n){"use strict";var r=n(2),o={isValidOwner:function(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)},addComponentAsRefTo:function(e,t,n){o.isValidOwner(n)?void 0:r(!1),n.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,n){o.isValidOwner(n)?void 0:r(!1);var i=n.getPublicInstance();i&&i.refs[t]===e.getPublicInstance()&&n.detachRef(t)}};e.exports=o},function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=i.getPooled(null),this.useCreateElement=e}var o=n(9),i=n(246),a=n(49),u=n(109),s=n(257),c=n(113),l={initialize:s.getSelectionInformation,close:s.restoreSelection},p={initialize:function(){var e=u.isEnabled();return u.setEnabled(!1),e},close:function(e){u.setEnabled(e)}},f={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},d=[l,p,f],h={getTransactionWrappers:function(){return d},getReactMountReady:function(){return this.reactMountReady},checkpoint:function(){return this.reactMountReady.checkpoint()},rollback:function(e){this.reactMountReady.rollback(e)},destructor:function(){i.release(this.reactMountReady),this.reactMountReady=null}};o(r.prototype,c.Mixin,h),a.addPoolingTo(r),e.exports=r},function(e,t,n){"use strict";function r(e,t,n){"function"==typeof e?e(t.getPublicInstance()):i.addComponentAsRefTo(t,e,n)}function o(e,t,n){"function"==typeof e?e(null):i.removeComponentAsRefFrom(t,e,n)}var i=n(620),a={};a.attachRefs=function(e,t){if(null!==t&&t!==!1){var n=t.ref;null!=n&&r(n,e,t._owner)}},a.shouldUpdateRefs=function(e,t){var n=null===e||e===!1,r=null===t||t===!1;return n||r||t._owner!==e._owner||t.ref!==e.ref},a.detachRefs=function(e,t){if(null!==t&&t!==!1){var n=t.ref;null!=n&&o(n,e,t._owner)}},e.exports=a},function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=e,this.useCreateElement=!1}var o=n(9),i=n(49),a=n(113),u=[],s={enqueue:function(){}},c={getTransactionWrappers:function(){return u},getReactMountReady:function(){return s},destructor:function(){},checkpoint:function(){},rollback:function(){}};o(r.prototype,a.Mixin,c),i.addPoolingTo(r),e.exports=r},function(e,t){"use strict";var n={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},r={accentHeight:"accent-height",accumulate:0,additive:0,alignmentBaseline:"alignment-baseline",allowReorder:"allowReorder",alphabetic:0,amplitude:0,arabicForm:"arabic-form",ascent:0,attributeName:"attributeName",attributeType:"attributeType",autoReverse:"autoReverse",azimuth:0,baseFrequency:"baseFrequency",baseProfile:"baseProfile",baselineShift:"baseline-shift",bbox:0,begin:0,bias:0,by:0,calcMode:"calcMode",capHeight:"cap-height",clip:0,clipPath:"clip-path",clipRule:"clip-rule",clipPathUnits:"clipPathUnits",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",contentScriptType:"contentScriptType",contentStyleType:"contentStyleType",cursor:0,cx:0,cy:0,d:0,decelerate:0,descent:0,diffuseConstant:"diffuseConstant",direction:0,display:0,divisor:0,dominantBaseline:"dominant-baseline",dur:0,dx:0,dy:0,edgeMode:"edgeMode",elevation:0,enableBackground:"enable-background",end:0,exponent:0,externalResourcesRequired:"externalResourcesRequired",fill:0,fillOpacity:"fill-opacity",fillRule:"fill-rule",filter:0,filterRes:"filterRes",filterUnits:"filterUnits",floodColor:"flood-color",floodOpacity:"flood-opacity",focusable:0,fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",glyphRef:"glyphRef",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",hanging:0,horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",ideographic:0,imageRendering:"image-rendering","in":0,in2:0,intercept:0,k:0,k1:0,k2:0,k3:0,k4:0,kernelMatrix:"kernelMatrix",kernelUnitLength:"kernelUnitLength",kerning:0,keyPoints:"keyPoints",keySplines:"keySplines",keyTimes:"keyTimes",lengthAdjust:"lengthAdjust",letterSpacing:"letter-spacing",lightingColor:"lighting-color",limitingConeAngle:"limitingConeAngle",local:0,markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",markerHeight:"markerHeight",markerUnits:"markerUnits",markerWidth:"markerWidth",mask:0,maskContentUnits:"maskContentUnits",maskUnits:"maskUnits",mathematical:0,mode:0,numOctaves:"numOctaves",offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pathLength:"pathLength",patternContentUnits:"patternContentUnits",patternTransform:"patternTransform",patternUnits:"patternUnits",pointerEvents:"pointer-events",points:0,pointsAtX:"pointsAtX",pointsAtY:"pointsAtY",pointsAtZ:"pointsAtZ",preserveAlpha:"preserveAlpha",preserveAspectRatio:"preserveAspectRatio",primitiveUnits:"primitiveUnits",r:0,radius:0,refX:"refX",refY:"refY",renderingIntent:"rendering-intent",repeatCount:"repeatCount",repeatDur:"repeatDur",requiredExtensions:"requiredExtensions",requiredFeatures:"requiredFeatures",restart:0,result:0,rotate:0,rx:0,ry:0,scale:0,seed:0,shapeRendering:"shape-rendering",slope:0,spacing:0,specularConstant:"specularConstant",specularExponent:"specularExponent",speed:0,spreadMethod:"spreadMethod",startOffset:"startOffset",stdDeviation:"stdDeviation",stemh:0,stemv:0,stitchTiles:"stitchTiles",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",string:0,stroke:0,strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",surfaceScale:"surfaceScale",systemLanguage:"systemLanguage",tableValues:"tableValues",targetX:"targetX",targetY:"targetY",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",textLength:"textLength",to:0,transform:0,u1:0,u2:0,underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicode:0,unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",values:0,vectorEffect:"vector-effect",version:0,vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",viewBox:"viewBox",viewTarget:"viewTarget",visibility:0,widths:0,wordSpacing:"word-spacing",writingMode:"writing-mode",x:0,xHeight:"x-height",x1:0,x2:0,xChannelSelector:"xChannelSelector",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlLang:"xml:lang",xmlSpace:"xml:space",y:0,y1:0,y2:0,yChannelSelector:"yChannelSelector",z:0,zoomAndPan:"zoomAndPan"},o={Properties:{},DOMAttributeNamespaces:{xlinkActuate:n.xlink,xlinkArcrole:n.xlink,xlinkHref:n.xlink,xlinkRole:n.xlink,
xlinkShow:n.xlink,xlinkTitle:n.xlink,xlinkType:n.xlink,xmlBase:n.xml,xmlLang:n.xml,xmlSpace:n.xml},DOMAttributeNames:{}};Object.keys(r).forEach(function(e){o.Properties[e]=0,r[e]&&(o.DOMAttributeNames[e]=r[e])}),e.exports=o},function(e,t,n){"use strict";function r(e){if("selectionStart"in e&&c.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function o(e,t){if(x||null==g||g!==p())return null;var n=r(g);if(!_||!h(_,n)){_=n;var o=l.getPooled(y.select,b,e,t);return o.type="select",o.target=g,a.accumulateTwoPhaseDispatches(o),o}return null}var i=n(41),a=n(77),u=n(15),s=n(12),c=n(257),l=n(42),p=n(206),f=n(272),d=n(47),h=n(141),v=i.topLevelTypes,m=u.canUseDOM&&"documentMode"in document&&document.documentMode<=11,y={select:{phasedRegistrationNames:{bubbled:d({onSelect:null}),captured:d({onSelectCapture:null})},dependencies:[v.topBlur,v.topContextMenu,v.topFocus,v.topKeyDown,v.topMouseDown,v.topMouseUp,v.topSelectionChange]}},g=null,b=null,_=null,x=!1,E=!1,w=d({onSelect:null}),C={eventTypes:y,extractEvents:function(e,t,n,r){if(!E)return null;var i=t?s.getNodeFromInstance(t):window;switch(e){case v.topFocus:(f(i)||"true"===i.contentEditable)&&(g=i,b=t,_=null);break;case v.topBlur:g=null,b=null,_=null;break;case v.topMouseDown:x=!0;break;case v.topContextMenu:case v.topMouseUp:return x=!1,o(n,r);case v.topSelectionChange:if(m)break;case v.topKeyDown:case v.topKeyUp:return o(n,r)}return null},didPutListener:function(e,t,n){t===w&&(E=!0)}};e.exports=C},function(e,t,n){"use strict";var r=n(41),o=n(204),i=n(77),a=n(12),u=n(627),s=n(628),c=n(42),l=n(631),p=n(633),f=n(112),d=n(630),h=n(634),v=n(635),m=n(78),y=n(636),g=n(30),b=n(166),_=n(2),x=n(47),E=r.topLevelTypes,w={abort:{phasedRegistrationNames:{bubbled:x({onAbort:!0}),captured:x({onAbortCapture:!0})}},animationEnd:{phasedRegistrationNames:{bubbled:x({onAnimationEnd:!0}),captured:x({onAnimationEndCapture:!0})}},animationIteration:{phasedRegistrationNames:{bubbled:x({onAnimationIteration:!0}),captured:x({onAnimationIterationCapture:!0})}},animationStart:{phasedRegistrationNames:{bubbled:x({onAnimationStart:!0}),captured:x({onAnimationStartCapture:!0})}},blur:{phasedRegistrationNames:{bubbled:x({onBlur:!0}),captured:x({onBlurCapture:!0})}},canPlay:{phasedRegistrationNames:{bubbled:x({onCanPlay:!0}),captured:x({onCanPlayCapture:!0})}},canPlayThrough:{phasedRegistrationNames:{bubbled:x({onCanPlayThrough:!0}),captured:x({onCanPlayThroughCapture:!0})}},click:{phasedRegistrationNames:{bubbled:x({onClick:!0}),captured:x({onClickCapture:!0})}},contextMenu:{phasedRegistrationNames:{bubbled:x({onContextMenu:!0}),captured:x({onContextMenuCapture:!0})}},copy:{phasedRegistrationNames:{bubbled:x({onCopy:!0}),captured:x({onCopyCapture:!0})}},cut:{phasedRegistrationNames:{bubbled:x({onCut:!0}),captured:x({onCutCapture:!0})}},doubleClick:{phasedRegistrationNames:{bubbled:x({onDoubleClick:!0}),captured:x({onDoubleClickCapture:!0})}},drag:{phasedRegistrationNames:{bubbled:x({onDrag:!0}),captured:x({onDragCapture:!0})}},dragEnd:{phasedRegistrationNames:{bubbled:x({onDragEnd:!0}),captured:x({onDragEndCapture:!0})}},dragEnter:{phasedRegistrationNames:{bubbled:x({onDragEnter:!0}),captured:x({onDragEnterCapture:!0})}},dragExit:{phasedRegistrationNames:{bubbled:x({onDragExit:!0}),captured:x({onDragExitCapture:!0})}},dragLeave:{phasedRegistrationNames:{bubbled:x({onDragLeave:!0}),captured:x({onDragLeaveCapture:!0})}},dragOver:{phasedRegistrationNames:{bubbled:x({onDragOver:!0}),captured:x({onDragOverCapture:!0})}},dragStart:{phasedRegistrationNames:{bubbled:x({onDragStart:!0}),captured:x({onDragStartCapture:!0})}},drop:{phasedRegistrationNames:{bubbled:x({onDrop:!0}),captured:x({onDropCapture:!0})}},durationChange:{phasedRegistrationNames:{bubbled:x({onDurationChange:!0}),captured:x({onDurationChangeCapture:!0})}},emptied:{phasedRegistrationNames:{bubbled:x({onEmptied:!0}),captured:x({onEmptiedCapture:!0})}},encrypted:{phasedRegistrationNames:{bubbled:x({onEncrypted:!0}),captured:x({onEncryptedCapture:!0})}},ended:{phasedRegistrationNames:{bubbled:x({onEnded:!0}),captured:x({onEndedCapture:!0})}},error:{phasedRegistrationNames:{bubbled:x({onError:!0}),captured:x({onErrorCapture:!0})}},focus:{phasedRegistrationNames:{bubbled:x({onFocus:!0}),captured:x({onFocusCapture:!0})}},input:{phasedRegistrationNames:{bubbled:x({onInput:!0}),captured:x({onInputCapture:!0})}},invalid:{phasedRegistrationNames:{bubbled:x({onInvalid:!0}),captured:x({onInvalidCapture:!0})}},keyDown:{phasedRegistrationNames:{bubbled:x({onKeyDown:!0}),captured:x({onKeyDownCapture:!0})}},keyPress:{phasedRegistrationNames:{bubbled:x({onKeyPress:!0}),captured:x({onKeyPressCapture:!0})}},keyUp:{phasedRegistrationNames:{bubbled:x({onKeyUp:!0}),captured:x({onKeyUpCapture:!0})}},load:{phasedRegistrationNames:{bubbled:x({onLoad:!0}),captured:x({onLoadCapture:!0})}},loadedData:{phasedRegistrationNames:{bubbled:x({onLoadedData:!0}),captured:x({onLoadedDataCapture:!0})}},loadedMetadata:{phasedRegistrationNames:{bubbled:x({onLoadedMetadata:!0}),captured:x({onLoadedMetadataCapture:!0})}},loadStart:{phasedRegistrationNames:{bubbled:x({onLoadStart:!0}),captured:x({onLoadStartCapture:!0})}},mouseDown:{phasedRegistrationNames:{bubbled:x({onMouseDown:!0}),captured:x({onMouseDownCapture:!0})}},mouseMove:{phasedRegistrationNames:{bubbled:x({onMouseMove:!0}),captured:x({onMouseMoveCapture:!0})}},mouseOut:{phasedRegistrationNames:{bubbled:x({onMouseOut:!0}),captured:x({onMouseOutCapture:!0})}},mouseOver:{phasedRegistrationNames:{bubbled:x({onMouseOver:!0}),captured:x({onMouseOverCapture:!0})}},mouseUp:{phasedRegistrationNames:{bubbled:x({onMouseUp:!0}),captured:x({onMouseUpCapture:!0})}},paste:{phasedRegistrationNames:{bubbled:x({onPaste:!0}),captured:x({onPasteCapture:!0})}},pause:{phasedRegistrationNames:{bubbled:x({onPause:!0}),captured:x({onPauseCapture:!0})}},play:{phasedRegistrationNames:{bubbled:x({onPlay:!0}),captured:x({onPlayCapture:!0})}},playing:{phasedRegistrationNames:{bubbled:x({onPlaying:!0}),captured:x({onPlayingCapture:!0})}},progress:{phasedRegistrationNames:{bubbled:x({onProgress:!0}),captured:x({onProgressCapture:!0})}},rateChange:{phasedRegistrationNames:{bubbled:x({onRateChange:!0}),captured:x({onRateChangeCapture:!0})}},reset:{phasedRegistrationNames:{bubbled:x({onReset:!0}),captured:x({onResetCapture:!0})}},scroll:{phasedRegistrationNames:{bubbled:x({onScroll:!0}),captured:x({onScrollCapture:!0})}},seeked:{phasedRegistrationNames:{bubbled:x({onSeeked:!0}),captured:x({onSeekedCapture:!0})}},seeking:{phasedRegistrationNames:{bubbled:x({onSeeking:!0}),captured:x({onSeekingCapture:!0})}},stalled:{phasedRegistrationNames:{bubbled:x({onStalled:!0}),captured:x({onStalledCapture:!0})}},submit:{phasedRegistrationNames:{bubbled:x({onSubmit:!0}),captured:x({onSubmitCapture:!0})}},suspend:{phasedRegistrationNames:{bubbled:x({onSuspend:!0}),captured:x({onSuspendCapture:!0})}},timeUpdate:{phasedRegistrationNames:{bubbled:x({onTimeUpdate:!0}),captured:x({onTimeUpdateCapture:!0})}},touchCancel:{phasedRegistrationNames:{bubbled:x({onTouchCancel:!0}),captured:x({onTouchCancelCapture:!0})}},touchEnd:{phasedRegistrationNames:{bubbled:x({onTouchEnd:!0}),captured:x({onTouchEndCapture:!0})}},touchMove:{phasedRegistrationNames:{bubbled:x({onTouchMove:!0}),captured:x({onTouchMoveCapture:!0})}},touchStart:{phasedRegistrationNames:{bubbled:x({onTouchStart:!0}),captured:x({onTouchStartCapture:!0})}},transitionEnd:{phasedRegistrationNames:{bubbled:x({onTransitionEnd:!0}),captured:x({onTransitionEndCapture:!0})}},volumeChange:{phasedRegistrationNames:{bubbled:x({onVolumeChange:!0}),captured:x({onVolumeChangeCapture:!0})}},waiting:{phasedRegistrationNames:{bubbled:x({onWaiting:!0}),captured:x({onWaitingCapture:!0})}},wheel:{phasedRegistrationNames:{bubbled:x({onWheel:!0}),captured:x({onWheelCapture:!0})}}},C={topAbort:w.abort,topAnimationEnd:w.animationEnd,topAnimationIteration:w.animationIteration,topAnimationStart:w.animationStart,topBlur:w.blur,topCanPlay:w.canPlay,topCanPlayThrough:w.canPlayThrough,topClick:w.click,topContextMenu:w.contextMenu,topCopy:w.copy,topCut:w.cut,topDoubleClick:w.doubleClick,topDrag:w.drag,topDragEnd:w.dragEnd,topDragEnter:w.dragEnter,topDragExit:w.dragExit,topDragLeave:w.dragLeave,topDragOver:w.dragOver,topDragStart:w.dragStart,topDrop:w.drop,topDurationChange:w.durationChange,topEmptied:w.emptied,topEncrypted:w.encrypted,topEnded:w.ended,topError:w.error,topFocus:w.focus,topInput:w.input,topInvalid:w.invalid,topKeyDown:w.keyDown,topKeyPress:w.keyPress,topKeyUp:w.keyUp,topLoad:w.load,topLoadedData:w.loadedData,topLoadedMetadata:w.loadedMetadata,topLoadStart:w.loadStart,topMouseDown:w.mouseDown,topMouseMove:w.mouseMove,topMouseOut:w.mouseOut,topMouseOver:w.mouseOver,topMouseUp:w.mouseUp,topPaste:w.paste,topPause:w.pause,topPlay:w.play,topPlaying:w.playing,topProgress:w.progress,topRateChange:w.rateChange,topReset:w.reset,topScroll:w.scroll,topSeeked:w.seeked,topSeeking:w.seeking,topStalled:w.stalled,topSubmit:w.submit,topSuspend:w.suspend,topTimeUpdate:w.timeUpdate,topTouchCancel:w.touchCancel,topTouchEnd:w.touchEnd,topTouchMove:w.touchMove,topTouchStart:w.touchStart,topTransitionEnd:w.transitionEnd,topVolumeChange:w.volumeChange,topWaiting:w.waiting,topWheel:w.wheel};for(var P in C)C[P].dependencies=[P];var S=x({onClick:null}),O={},T={eventTypes:w,extractEvents:function(e,t,n,r){var o=C[e];if(!o)return null;var a;switch(e){case E.topAbort:case E.topCanPlay:case E.topCanPlayThrough:case E.topDurationChange:case E.topEmptied:case E.topEncrypted:case E.topEnded:case E.topError:case E.topInput:case E.topInvalid:case E.topLoad:case E.topLoadedData:case E.topLoadedMetadata:case E.topLoadStart:case E.topPause:case E.topPlay:case E.topPlaying:case E.topProgress:case E.topRateChange:case E.topReset:case E.topSeeked:case E.topSeeking:case E.topStalled:case E.topSubmit:case E.topSuspend:case E.topTimeUpdate:case E.topVolumeChange:case E.topWaiting:a=c;break;case E.topKeyPress:if(0===b(n))return null;case E.topKeyDown:case E.topKeyUp:a=p;break;case E.topBlur:case E.topFocus:a=l;break;case E.topClick:if(2===n.button)return null;case E.topContextMenu:case E.topDoubleClick:case E.topMouseDown:case E.topMouseMove:case E.topMouseOut:case E.topMouseOver:case E.topMouseUp:a=f;break;case E.topDrag:case E.topDragEnd:case E.topDragEnter:case E.topDragExit:case E.topDragLeave:case E.topDragOver:case E.topDragStart:case E.topDrop:a=d;break;case E.topTouchCancel:case E.topTouchEnd:case E.topTouchMove:case E.topTouchStart:a=h;break;case E.topAnimationEnd:case E.topAnimationIteration:case E.topAnimationStart:a=u;break;case E.topTransitionEnd:a=v;break;case E.topScroll:a=m;break;case E.topWheel:a=y;break;case E.topCopy:case E.topCut:case E.topPaste:a=s}a?void 0:_(!1);var g=a.getPooled(o,t,n,r);return i.accumulateTwoPhaseDispatches(g),g},didPutListener:function(e,t,n){if(t===S){var r=e._rootNodeID,i=a.getNodeFromInstance(e);O[r]||(O[r]=o.listen(i,"click",g))}},willDeleteListener:function(e,t){if(t===S){var n=e._rootNodeID;O[n].remove(),delete O[n]}}};e.exports=T},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(42),i={animationName:null,elapsedTime:null,pseudoElement:null};o.augmentClass(r,i),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(42),i={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};o.augmentClass(r,i),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(42),i={data:null};o.augmentClass(r,i),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(112),i={dataTransfer:null};o.augmentClass(r,i),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(78),i={relatedTarget:null};o.augmentClass(r,i),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(42),i={data:null};o.augmentClass(r,i),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(78),i=n(166),a=n(641),u=n(167),s={key:a,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:u,charCode:function(e){return"keypress"===e.type?i(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?i(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};o.augmentClass(r,s),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(78),i=n(167),a={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:i};o.augmentClass(r,a),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(42),i={propertyName:null,elapsedTime:null,pseudoElement:null};o.augmentClass(r,i),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(112),i={deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null};o.augmentClass(r,i),e.exports=r},function(e,t){"use strict";function n(e){for(var t=1,n=0,o=0,i=e.length,a=-4&i;a>o;){for(var u=Math.min(o+4096,a);u>o;o+=4)n+=(t+=e.charCodeAt(o))+(t+=e.charCodeAt(o+1))+(t+=e.charCodeAt(o+2))+(t+=e.charCodeAt(o+3));t%=r,n%=r}for(;i>o;o++)n+=t+=e.charCodeAt(o);return t%=r,n%=r,t|n<<16}var r=65521;e.exports=n},function(e,t,n){"use strict";function r(e,t,n){var r=null==t||"boolean"==typeof t||""===t;if(r)return"";var o=isNaN(t);if(o||0===t||i.hasOwnProperty(e)&&i[e])return""+t;if("string"==typeof t){t=t.trim()}return t+"px"}var o=n(245),i=(n(4),o.isUnitlessNumber);e.exports=r},function(e,t,n){"use strict";function r(e){if(null==e)return null;if(1===e.nodeType)return e;var t=i.get(e);return t?(t=a(t),t?o.getNodeFromInstance(t):null):void u(("function"==typeof e.render,!1))}var o=(n(50),n(12)),i=n(163),a=n(269),u=n(2);n(4);e.exports=r},function(e,t,n){"use strict";function r(e,t,n){var r=e,o=void 0===r[n];o&&null!=t&&(r[n]=t)}function o(e){if(null==e)return e;var t={};return i(e,r,t),t}var i=(n(159),n(173));n(4);e.exports=o},function(e,t,n){"use strict";function r(e){if(e.key){var t=i[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=o(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?a[e.keyCode]||"Unidentified":""}var o=n(166),i={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},a={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};e.exports=r},function(e,t){"use strict";function n(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function r(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function o(e,t){for(var o=n(e),i=0,a=0;o;){if(3===o.nodeType){if(a=i+o.textContent.length,t>=i&&a>=t)return{node:o,offset:t-i};i=a}o=n(r(o))}}e.exports=o},function(e,t,n){"use strict";function r(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n["ms"+e]="MS"+t,n["O"+e]="o"+t.toLowerCase(),n}function o(e){if(u[e])return u[e];if(!a[e])return e;var t=a[e];for(var n in t)if(t.hasOwnProperty(n)&&n in s)return u[e]=t[n];return""}var i=n(15),a={animationend:r("Animation","AnimationEnd"),animationiteration:r("Animation","AnimationIteration"),animationstart:r("Animation","AnimationStart"),transitionend:r("Transition","TransitionEnd")},u={},s={};i.canUseDOM&&(s=document.createElement("div").style,"AnimationEvent"in window||(delete a.animationend.animation,delete a.animationiteration.animation,delete a.animationstart.animation),"TransitionEvent"in window||delete a.transitionend.transition),e.exports=o},function(e,t,n){"use strict";function r(e){return o.isValidElement(e)?void 0:i(!1),e}var o=n(31),i=n(2);e.exports=r},function(e,t,n){"use strict";function r(e){return'"'+o(e)+'"'}var o=n(114);e.exports=r},function(e,t,n){"use strict";var r=n(258);e.exports=r.renderSubtreeIntoContainer},function(e,t,n){"use strict";function r(e,t,n){return!o(e.props,t)||!o(e.state,n)}var o=n(141);e.exports=r},function(e,t,n){!function(t,r){e.exports=r(n(26))}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){n(180),e.exports=n(188)},function(e,t,n){"use strict";function r(e,t,n,r,o,i,a,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,i,a,u],l=0;s=new Error(t.replace(/%s/g,function(){return c[l++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}e.exports=r},function(e,t,n){"use strict";var r=n(11),o=r;e.exports=o},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 r(){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;10>n;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(i){return!1}}var o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=r()?Object.assign:function(e,t){for(var r,a,u=n(e),s=1;s<arguments.length;s++){r=Object(arguments[s]);for(var c in r)o.call(r,c)&&(u[c]=r[c]);if(Object.getOwnPropertySymbols){a=Object.getOwnPropertySymbols(r);for(var l=0;l<a.length;l++)i.call(r,a[l])&&(u[a[l]]=r[a[l]])}}return u}},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){for(var t;t=e._renderedComponent;)e=t;return e}function o(e,t){var n=r(e);n._nativeNode=t,t[v]=n}function i(e){var t=e._nativeNode;t&&(delete t[v],e._nativeNode=null)}function a(e,t){if(!(e._flags&h.hasCachedChildNodes)){var n=e._renderedChildren,i=t.firstChild;e:for(var a in n)if(n.hasOwnProperty(a)){var u=n[a],s=r(u)._domID;if(null!=s){for(;null!==i;i=i.nextSibling)if(1===i.nodeType&&i.getAttribute(d)===String(s)||8===i.nodeType&&i.nodeValue===" react-text: "+s+" "||8===i.nodeType&&i.nodeValue===" react-empty: "+s+" "){o(u,i);continue e}f(!1)}}e._flags|=h.hasCachedChildNodes}}function u(e){if(e[v])return e[v];for(var t=[];!e[v];){if(t.push(e),!e.parentNode)return null;e=e.parentNode}for(var n,r;e&&(r=e[v]);e=t.pop())n=r,t.length&&a(r,e);return n}function s(e){var t=u(e);return null!=t&&t._nativeNode===e?t:null}function c(e){if(void 0===e._nativeNode?f(!1):void 0,e._nativeNode)return e._nativeNode;for(var t=[];!e._nativeNode;)t.push(e),e._nativeParent?void 0:f(!1),e=e._nativeParent;for(;t.length;e=t.pop())a(e,e._nativeNode);return e._nativeNode}var l=n(19),p=n(144),f=n(1),d=l.ID_ATTRIBUTE_NAME,h=p,v="__reactInternalInstance$"+Math.random().toString(36).slice(2),m={getClosestInstanceFromNode:u,getInstanceFromNode:s,getNodeFromInstance:c,precacheChildNodes:a,precacheNode:o,uncacheNode:i};e.exports=m},function(e,t){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};e.exports=r},function(e,t,n){"use strict";function r(e,t,n){return n}var o={enableMeasure:!1,storedMeasure:r,measureMethods:function(e,t,n){},measure:function(e,t,n){return n},injection:{injectMeasure:function(e){o.storedMeasure=e}}};e.exports=o},function(e,t,n){(function(e,r){var o=n(227),i={"function":!0,object:!0},a=i[typeof t]&&t&&!t.nodeType?t:void 0,u=i[typeof e]&&e&&!e.nodeType?e:void 0,s=o(a&&u&&"object"==typeof r&&r),c=o(i[typeof self]&&self),l=o(i[typeof window]&&window),p=o(i[typeof this]&&this),f=s||l!==(p&&p.window)&&l||c||p||Function("return this")();e.exports=f}).call(t,n(397)(e),function(){return this}())},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){"use strict";function r(){O.ReactReconcileTransaction&&x?void 0:y(!1)}function o(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=p.getPooled(),this.reconcileTransaction=O.ReactReconcileTransaction.getPooled(!0)}function i(e,t,n,o,i,a){r(),x.batchedUpdates(e,t,n,o,i,a)}function a(e,t){return e._mountOrder-t._mountOrder}function u(e){var t=e.dirtyComponentsLength;t!==g.length?y(!1):void 0,g.sort(a);for(var n=0;t>n;n++){var r=g[n],o=r._pendingCallbacks;r._pendingCallbacks=null;var i;if(d.logTopLevelRenders){var u=r;r._currentElement.props===r._renderedComponent._currentElement&&(u=r._renderedComponent),i="React update: "+u.getName(),console.time(i)}if(v.performUpdateIfNecessary(r,e.reconcileTransaction),i&&console.timeEnd(i),o)for(var s=0;s<o.length;s++)e.callbackQueue.enqueue(o[s],r.getPublicInstance())}}function s(e){return r(),x.isBatchingUpdates?void g.push(e):void x.batchedUpdates(s,e)}function c(e,t){x.isBatchingUpdates?void 0:y(!1),b.enqueue(e,t),_=!0}var l=n(3),p=n(142),f=n(16),d=n(150),h=n(7),v=n(23),m=n(52),y=n(1),g=[],b=p.getPooled(),_=!1,x=null,E={initialize:function(){this.dirtyComponentsLength=g.length},close:function(){this.dirtyComponentsLength!==g.length?(g.splice(0,this.dirtyComponentsLength),P()):g.length=0}},w={initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}},C=[E,w];l(o.prototype,m.Mixin,{getTransactionWrappers:function(){return C},destructor:function(){this.dirtyComponentsLength=null,p.release(this.callbackQueue),this.callbackQueue=null,O.ReactReconcileTransaction.release(this.reconcileTransaction),this.reconcileTransaction=null},perform:function(e,t,n){return m.Mixin.perform.call(this,this.reconcileTransaction.perform,this.reconcileTransaction,e,t,n)}}),f.addPoolingTo(o);var P=function(){for(;g.length||_;){if(g.length){var e=o.getPooled();e.perform(u,null,e),o.release(e)}if(_){_=!1;var t=b;b=p.getPooled(),t.notifyAll(),p.release(t)}}};P=h.measure("ReactUpdates","flushBatchedUpdates",P);var S={injectReconcileTransaction:function(e){e?void 0:y(!1),O.ReactReconcileTransaction=e},injectBatchingStrategy:function(e){e?void 0:y(!1),"function"!=typeof e.batchedUpdates?y(!1):void 0,"boolean"!=typeof e.isBatchingUpdates?y(!1):void 0,x=e}},O={ReactReconcileTransaction:null,batchedUpdates:i,enqueueUpdate:s,flushBatchedUpdates:P,injection:S,asap:c};e.exports=O},function(e,t){"use strict";function n(e){return function(){return e}}function r(){}r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";var r=n(32),o=r({bubbled:null,captured:null}),i=r({topAbort:null,topAnimationEnd:null,topAnimationIteration:null,topAnimationStart:null,topBlur:null,topCanPlay:null,topCanPlayThrough:null,topChange:null,topClick:null,topCompositionEnd:null,topCompositionStart:null,topCompositionUpdate:null,topContextMenu:null,topCopy:null,topCut:null,topDoubleClick:null,topDrag:null,topDragEnd:null,topDragEnter:null,topDragExit:null,topDragLeave:null,topDragOver:null,topDragStart:null,topDrop:null,topDurationChange:null,topEmptied:null,topEncrypted:null,topEnded:null,topError:null,topFocus:null,topInput:null,topInvalid:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topLoad:null,topLoadedData:null,topLoadedMetadata:null,topLoadStart:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topPaste:null,topPause:null,topPlay:null,topPlaying:null,topProgress:null,topRateChange:null,topReset:null,topScroll:null,topSeeked:null,topSeeking:null,topSelectionChange:null,topStalled:null,topSubmit:null,topSuspend:null,topTextInput:null,topTimeUpdate:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topTransitionEnd:null,topVolumeChange:null,topWaiting:null,topWheel:null}),a={topLevelTypes:i,PropagationPhases:o};e.exports=a},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var o=this.constructor.Interface;for(var i in o)if(o.hasOwnProperty(i)){var u=o[i];u?this[i]=u(n):"target"===i?this.target=r:this[i]=n[i]}var s=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;return s?this.isDefaultPrevented=a.thatReturnsTrue:this.isDefaultPrevented=a.thatReturnsFalse,this.isPropagationStopped=a.thatReturnsFalse,this}var o=n(3),i=n(16),a=n(11),u=(n(2),"function"==typeof Proxy,["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),s={type:null,target:null,currentTarget:a.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};o(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1,this.isDefaultPrevented=a.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this.isPropagationStopped=a.thatReturnsTrue)},persist:function(){this.isPersistent=a.thatReturnsTrue},isPersistent:a.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n<u.length;n++)this[u[n]]=null}}),r.Interface=s,r.augmentClass=function(e,t){var n=this,r=function(){};r.prototype=n.prototype;var a=new r;o(a,e.prototype),e.prototype=a,e.prototype.constructor=e,e.Interface=o({},n.Interface,t),e.augmentClass=n.augmentClass,i.addPoolingTo(e,i.fourArgumentPooler)},i.addPoolingTo(r,i.fourArgumentPooler),e.exports=r},function(e,t){"use strict";var n=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};e.exports=n},function(e,t){function n(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=n},function(e,t,n){"use strict";var r=n(1),o=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)},i=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},a=function(e,t,n){var r=this;if(r.instancePool.length){var o=r.instancePool.pop();return r.call(o,e,t,n),o}return new r(e,t,n)},u=function(e,t,n,r){var o=this;if(o.instancePool.length){var i=o.instancePool.pop();return o.call(i,e,t,n,r),i}return new o(e,t,n,r)},s=function(e,t,n,r,o){var i=this;if(i.instancePool.length){var a=i.instancePool.pop();return i.call(a,e,t,n,r,o),a}return new i(e,t,n,r,o)},c=function(e){var t=this;e instanceof t?void 0:r(!1),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},l=10,p=o,f=function(e,t){var n=e;return n.instancePool=[],n.getPooled=t||p,n.poolSize||(n.poolSize=l),n.release=c,n},d={addPoolingTo:f,oneArgumentPooler:o,twoArgumentPooler:i,threeArgumentPooler:a,fourArgumentPooler:u,fiveArgumentPooler:s};e.exports=d},function(e,t,n){"use strict";var r=n(3),o=n(20),i=(n(2),n(162),"function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103),a={key:!0,ref:!0,__self:!0,__source:!0},u=function(e,t,n,r,o,a,u){var s={$$typeof:i,type:e,key:t,ref:n,props:u,_owner:a};return s};u.createElement=function(e,t,n){var r,i={},s=null,c=null,l=null,p=null;if(null!=t){c=void 0===t.ref?null:t.ref,s=void 0===t.key?null:""+t.key,l=void 0===t.__self?null:t.__self,p=void 0===t.__source?null:t.__source;for(r in t)t.hasOwnProperty(r)&&!a.hasOwnProperty(r)&&(i[r]=t[r])}var f=arguments.length-2;if(1===f)i.children=n;else if(f>1){for(var d=Array(f),h=0;f>h;h++)d[h]=arguments[h+2];i.children=d}if(e&&e.defaultProps){var v=e.defaultProps;for(r in v)void 0===i[r]&&(i[r]=v[r])}return u(e,s,c,l,p,o.current,i)},u.createFactory=function(e){var t=u.createElement.bind(null,e);return t.type=e,t},u.cloneAndReplaceKey=function(e,t){var n=u(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n},u.cloneElement=function(e,t,n){var i,s=r({},e.props),c=e.key,l=e.ref,p=e._self,f=e._source,d=e._owner;if(null!=t){void 0!==t.ref&&(l=t.ref,d=o.current),void 0!==t.key&&(c=""+t.key);var h;e.type&&e.type.defaultProps&&(h=e.type.defaultProps);for(i in t)t.hasOwnProperty(i)&&!a.hasOwnProperty(i)&&(void 0===t[i]&&void 0!==h?s[i]=h[i]:s[i]=t[i])}var v=arguments.length-2;if(1===v)s.children=n;else if(v>1){for(var m=Array(v),y=0;v>y;y++)m[y]=arguments[y+2];s.children=m}return u(e.type,c,l,p,f,d,s)},u.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===i},e.exports=u},function(e,t){function n(e){return!!e&&"object"==typeof e}e.exports=n},function(e,t,n){"use strict";function r(e,t){return(e&t)===t}var o=n(1),i={MUST_USE_PROPERTY:1,HAS_SIDE_EFFECTS:2,HAS_BOOLEAN_VALUE:4,HAS_NUMERIC_VALUE:8,HAS_POSITIVE_NUMERIC_VALUE:24,HAS_OVERLOADED_BOOLEAN_VALUE:32,injectDOMPropertyConfig:function(e){var t=i,n=e.Properties||{},a=e.DOMAttributeNamespaces||{},s=e.DOMAttributeNames||{},c=e.DOMPropertyNames||{},l=e.DOMMutationMethods||{};e.isCustomAttribute&&u._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var p in n){u.properties.hasOwnProperty(p)?o(!1):void 0;var f=p.toLowerCase(),d=n[p],h={attributeName:f,attributeNamespace:null,propertyName:p,mutationMethod:null,mustUseProperty:r(d,t.MUST_USE_PROPERTY),hasSideEffects:r(d,t.HAS_SIDE_EFFECTS),hasBooleanValue:r(d,t.HAS_BOOLEAN_VALUE),hasNumericValue:r(d,t.HAS_NUMERIC_VALUE),hasPositiveNumericValue:r(d,t.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:r(d,t.HAS_OVERLOADED_BOOLEAN_VALUE)};if(!h.mustUseProperty&&h.hasSideEffects?o(!1):void 0,h.hasBooleanValue+h.hasNumericValue+h.hasOverloadedBooleanValue<=1?void 0:o(!1),s.hasOwnProperty(p)){var v=s[p];h.attributeName=v}a.hasOwnProperty(p)&&(h.attributeNamespace=a[p]),c.hasOwnProperty(p)&&(h.propertyName=c[p]),l.hasOwnProperty(p)&&(h.mutationMethod=l[p]),u.properties[p]=h}}},a=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",u={ID_ATTRIBUTE_NAME:"data-reactid",ROOT_ATTRIBUTE_NAME:"data-reactroot",ATTRIBUTE_NAME_START_CHAR:a,ATTRIBUTE_NAME_CHAR:a+"\\-.0-9\\uB7\\u0300-\\u036F\\u203F-\\u2040",properties:{},getPossibleStandardName:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t<u._isCustomAttributeFunctions.length;t++){var n=u._isCustomAttributeFunctions[t];if(n(e))return!0}return!1},injection:i};e.exports=u},function(e,t){"use strict";var n={current:null};e.exports=n},function(e,t,n){function r(e,t){var n=e[t];return o(n)?n:void 0}var o=n(278);e.exports=r},function(e,t,n){"use strict";function r(e){if(p){var t=e.node,n=e.children;if(n.length)for(var r=0;r<n.length;r++)f(t,n[r],null);else null!=e.html?t.innerHTML=e.html:null!=e.text&&l(t,e.text)}}function o(e,t){
e.parentNode.replaceChild(t.node,e),r(t)}function i(e,t){p?e.children.push(t):e.node.appendChild(t.node)}function a(e,t){p?e.html=t:e.node.innerHTML=t}function u(e,t){p?e.text=t:l(e.node,t)}function s(e){return{node:e,children:[],html:null,text:null}}var c=n(82),l=n(168),p="undefined"!=typeof document&&"number"==typeof document.documentMode||"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent&&/\bEdge\/\d/.test(navigator.userAgent),f=c(function(e,t,n){11===t.node.nodeType?(r(t),e.insertBefore(t.node,n)):(e.insertBefore(t.node,n),r(t))});s.insertTreeBefore=f,s.replaceChildWithTree=o,s.queueChild=i,s.queueHTML=a,s.queueText=u,e.exports=s},function(e,t,n){"use strict";function r(){o.attachRefs(this,this._currentElement)}var o=n(336),i=(n(50),{mountComponent:function(e,t,n,o,i){var a=e.mountComponent(t,n,o,i);return e._currentElement&&null!=e._currentElement.ref&&t.getReactMountReady().enqueue(r,e),a},getNativeNode:function(e){return e.getNativeNode()},unmountComponent:function(e,t){o.detachRefs(e,e._currentElement),e.unmountComponent(t)},receiveComponent:function(e,t,n,i){var a=e._currentElement;if(t!==a||i!==e._context){var u=o.shouldUpdateRefs(a,t);u&&o.detachRefs(e,a),e.receiveComponent(t,n,i),u&&e._currentElement&&null!=e._currentElement.ref&&n.getReactMountReady().enqueue(r,e)}},performUpdateIfNecessary:function(e,t){e.performUpdateIfNecessary(t)}});e.exports=i},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t){function n(e,t){for(var n=-1,o=e.length,i=0,a=[];++n<o;){var u=e[n];u!==t&&u!==r||(e[n]=r,a[i++]=n)}return a}var r="__lodash_placeholder__";e.exports=n},function(e,t,n){function r(e){if("string"==typeof e||o(e))return e;var t=e+"";return"0"==t&&1/e==-i?"-0":t}var o=n(27),i=1/0;e.exports=r},function(e,t,n){function r(e){return"symbol"==typeof e||o(e)&&u.call(e)==i}var o=n(18),i="[object Symbol]",a=Object.prototype,u=a.toString;e.exports=r},function(e,t,n){"use strict";var r=n(48),o=n(74),i=n(78),a=n(161),u=n(163),s=n(1),c={},l=null,p=function(e,t){e&&(o.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e))},f=function(e){return p(e,!0)},d=function(e){return p(e,!1)},h={injection:{injectEventPluginOrder:r.injectEventPluginOrder,injectEventPluginsByName:r.injectEventPluginsByName},putListener:function(e,t,n){"function"!=typeof n?s(!1):void 0;var o=c[t]||(c[t]={});o[e._rootNodeID]=n;var i=r.registrationNameModules[t];i&&i.didPutListener&&i.didPutListener(e,t,n)},getListener:function(e,t){var n=c[t];return n&&n[e._rootNodeID]},deleteListener:function(e,t){var n=r.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t);var o=c[t];o&&delete o[e._rootNodeID]},deleteAllListeners:function(e){for(var t in c)if(c[t][e._rootNodeID]){var n=r.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t),delete c[t][e._rootNodeID]}},extractEvents:function(e,t,n,o){for(var i,u=r.plugins,s=0;s<u.length;s++){var c=u[s];if(c){var l=c.extractEvents(e,t,n,o);l&&(i=a(i,l))}}return i},enqueueEvents:function(e){e&&(l=a(l,e))},processEventQueue:function(e){var t=l;l=null,e?u(t,f):u(t,d),l?s(!1):void 0,i.rethrowCaughtError()},__purge:function(){c={}},__getListenerBank:function(){return c}};e.exports=h},function(e,t,n){"use strict";function r(e,t,n){var r=t.dispatchConfig.phasedRegistrationNames[n];return b(e,r)}function o(e,t,n){var o=t?g.bubbled:g.captured,i=r(e,n,o);i&&(n._dispatchListeners=m(n._dispatchListeners,i),n._dispatchInstances=m(n._dispatchInstances,e))}function i(e){e&&e.dispatchConfig.phasedRegistrationNames&&v.traverseTwoPhase(e._targetInst,o,e)}function a(e){if(e&&e.dispatchConfig.phasedRegistrationNames){var t=e._targetInst,n=t?v.getParentInstance(t):null;v.traverseTwoPhase(n,o,e)}}function u(e,t,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,o=b(e,r);o&&(n._dispatchListeners=m(n._dispatchListeners,o),n._dispatchInstances=m(n._dispatchInstances,e))}}function s(e){e&&e.dispatchConfig.registrationName&&u(e._targetInst,null,e)}function c(e){y(e,i)}function l(e){y(e,a)}function p(e,t,n,r){v.traverseEnterLeave(n,r,u,e,t)}function f(e){y(e,s)}var d=n(12),h=n(28),v=n(74),m=n(161),y=n(163),g=(n(2),d.PropagationPhases),b=h.getListener,_={accumulateTwoPhaseDispatches:c,accumulateTwoPhaseDispatchesSkipTarget:l,accumulateDirectDispatches:f,accumulateEnterLeaveDispatches:p};e.exports=_},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(13),i=n(85),a={view:function(e){if(e.view)return e.view;var t=i(e);if(null!=t&&t.window===t)return t;var n=t.ownerDocument;return n?n.defaultView||n.parentWindow:window},detail:function(e){return e.detail||0}};o.augmentClass(r,a),e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(284),i=r(o),a=n(389),u=r(a),s=n(387),c=r(s),l=n(388),p=r(l),f=n(385),d=r(f),h=n(386),v=r(h),m={empty:{},getIn:c["default"],setIn:p["default"],deepEqual:d["default"],deleteIn:v["default"],fromJS:function(e){return e},size:function(e){return e?e.length:0},some:i["default"],splice:u["default"]};t["default"]=m},function(e,t,n){"use strict";var r=n(1),o=function(e){var t,n={};e instanceof Object&&!Array.isArray(e)?void 0:r(!1);for(t in e)e.hasOwnProperty(t)&&(n[t]=t);return n};e.exports=o},function(e,t,n){"use strict";var r=function(e,t,n,r,o,i,a,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,i,a,u],l=0;s=new Error(t.replace(/%s/g,function(){return c[l++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}};e.exports=r},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var o=n(250),i=n(251),a=n(252),u=n(253),s=n(254);r.prototype.clear=o,r.prototype["delete"]=i,r.prototype.get=a,r.prototype.has=u,r.prototype.set=s,e.exports=r},function(e,t,n){function r(e,t){for(var n=e.length;n--;)if(o(e[n][0],t))return n;return-1}var o=n(132);e.exports=r},function(e,t,n){function r(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=o(e.prototype),r=e.apply(n,t);return i(r)?r:n}}var o=n(60),i=n(15);e.exports=r},function(e,t){function n(e){var t=e;return t.placeholder}e.exports=n},function(e,t,n){function r(e,t){var n=e.__data__;return o(t)?n["string"==typeof t?"string":"hash"]:n.map}var o=n(247);e.exports=r},function(e,t){function n(e,t){return t=null==t?r:t,!!t&&("number"==typeof e||o.test(e))&&e>-1&&e%1==0&&t>e}var r=9007199254740991,o=/^(?:0|[1-9]\d*)$/;e.exports=n},function(e,t,n){function r(e,t){if(o(e))return!1;var n=typeof e;return"number"==n||"symbol"==n||"boolean"==n||null==e||i(e)?!0:u.test(e)||!a.test(e)||null!=t&&e in Object(t)}var o=n(9),i=n(27),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,u=/^\w*$/;e.exports=r},function(e,t,n){var r=n(21),o=r(Object,"create");e.exports=o},function(e,t,n){function r(e){return null!=e&&a(o(e))&&!i(e)}var o=n(238),i=n(66),a=n(43);e.exports=r},function(e,t){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&r>=e}var r=9007199254740991;e.exports=n},function(e,t,n){var r=n(119),o=n(37),i=n(25),a=n(137),u=32,s=a(function(e,t){var n=i(t,o(s));return r(e,u,void 0,t,n)});s.placeholder={},e.exports=s},function(e,t,n){function r(e){return a(e)?o(e,c):u(e)?[e]:i(s(e))}var o=n(106),i=n(64),a=n(9),u=n(27),s=n(130),c=n(26);e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0,t.connect=t.Provider=void 0;var o=n(292),i=r(o),a=n(293),u=r(a);t.Provider=i["default"],t.connect=u["default"]},function(e,t){"use strict";var n={onClick:!0,onDoubleClick:!0,onMouseDown:!0,onMouseMove:!0,onMouseUp:!0,onClickCapture:!0,onDoubleClickCapture:!0,onMouseDownCapture:!0,onMouseMoveCapture:!0,onMouseUpCapture:!0},r={getNativeProps:function(e,t){if(!t.disabled)return t;var r={};for(var o in t)!n[o]&&t.hasOwnProperty(o)&&(r[o]=t[o]);return r}};e.exports=r},function(e,t,n){"use strict";function r(){if(u)for(var e in s){var t=s[e],n=u.indexOf(e);if(n>-1?void 0:a(!1),!c.plugins[n]){t.extractEvents?void 0:a(!1),c.plugins[n]=t;var r=t.eventTypes;for(var i in r)o(r[i],t,i)?void 0:a(!1)}}}function o(e,t,n){c.eventNameDispatchConfigs.hasOwnProperty(n)?a(!1):void 0,c.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var o in r)if(r.hasOwnProperty(o)){var u=r[o];i(u,t,n)}return!0}return e.registrationName?(i(e.registrationName,t,n),!0):!1}function i(e,t,n){c.registrationNameModules[e]?a(!1):void 0,c.registrationNameModules[e]=t,c.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var a=n(1),u=null,s={},c={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},possibleRegistrationNames:null,injectEventPluginOrder:function(e){u?a(!1):void 0,u=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var t=!1;for(var n in e)if(e.hasOwnProperty(n)){var o=e[n];s.hasOwnProperty(n)&&s[n]===o||(s[n]?a(!1):void 0,s[n]=o,t=!0)}t&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return c.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=c.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){u=null;for(var e in s)s.hasOwnProperty(e)&&delete s[e];c.plugins.length=0;var t=c.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=c.registrationNameModules;for(var o in r)r.hasOwnProperty(o)&&delete r[o]}};e.exports=c},function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,m)||(e[m]=h++,f[e[m]]={}),f[e[m]]}var o,i=n(3),a=n(12),u=n(48),s=n(328),c=n(160),l=n(359),p=n(87),f={},d=!1,h=0,v={topAbort:"abort",topAnimationEnd:l("animationend")||"animationend",topAnimationIteration:l("animationiteration")||"animationiteration",topAnimationStart:l("animationstart")||"animationstart",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topTransitionEnd:l("transitionend")||"transitionend",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},m="_reactListenersID"+String(Math.random()).slice(2),y=i({},s,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(y.handleTopLevel),y.ReactEventListener=e}},setEnabled:function(e){y.ReactEventListener&&y.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!y.ReactEventListener||!y.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,o=r(n),i=u.registrationNameDependencies[e],s=a.topLevelTypes,c=0;c<i.length;c++){var l=i[c];o.hasOwnProperty(l)&&o[l]||(l===s.topWheel?p("wheel")?y.ReactEventListener.trapBubbledEvent(s.topWheel,"wheel",n):p("mousewheel")?y.ReactEventListener.trapBubbledEvent(s.topWheel,"mousewheel",n):y.ReactEventListener.trapBubbledEvent(s.topWheel,"DOMMouseScroll",n):l===s.topScroll?p("scroll",!0)?y.ReactEventListener.trapCapturedEvent(s.topScroll,"scroll",n):y.ReactEventListener.trapBubbledEvent(s.topScroll,"scroll",y.ReactEventListener.WINDOW_HANDLE):l===s.topFocus||l===s.topBlur?(p("focus",!0)?(y.ReactEventListener.trapCapturedEvent(s.topFocus,"focus",n),y.ReactEventListener.trapCapturedEvent(s.topBlur,"blur",n)):p("focusin")&&(y.ReactEventListener.trapBubbledEvent(s.topFocus,"focusin",n),y.ReactEventListener.trapBubbledEvent(s.topBlur,"focusout",n)),o[s.topBlur]=!0,o[s.topFocus]=!0):v.hasOwnProperty(l)&&y.ReactEventListener.trapBubbledEvent(l,v[l],n),o[l]=!0)}},trapBubbledEvent:function(e,t,n){return y.ReactEventListener.trapBubbledEvent(e,t,n)},trapCapturedEvent:function(e,t,n){return y.ReactEventListener.trapCapturedEvent(e,t,n)},ensureScrollValueMonitoring:function(){if(void 0===o&&(o=document.createEvent&&"pageX"in document.createEvent("MouseEvent")),!o&&!d){var e=c.refreshScrollValues;y.ReactEventListener.monitorScrollValue(e),d=!0}}});e.exports=y},function(e,t,n){"use strict";var r=n(327);e.exports={debugTool:r}},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(30),i=n(160),a=n(84),u={screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:a,button:function(e){var t=e.button;return"which"in e?t:2===t?2:4===t?1:0},buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},pageX:function(e){return"pageX"in e?e.pageX:e.clientX+i.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+i.currentScrollTop}};o.augmentClass(r,u),e.exports=r},function(e,t,n){"use strict";var r=n(1),o={reinitializeTransaction:function(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function(){return!!this._isInTransaction},perform:function(e,t,n,o,i,a,u,s){this.isInTransaction()?r(!1):void 0;var c,l;try{this._isInTransaction=!0,c=!0,this.initializeAll(0),l=e.call(t,n,o,i,a,u,s),c=!1}finally{try{if(c)try{this.closeAll(0)}catch(p){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return l},initializeAll:function(e){for(var t=this.transactionWrappers,n=e;n<t.length;n++){var r=t[n];try{this.wrapperInitData[n]=i.OBSERVED_ERROR,this.wrapperInitData[n]=r.initialize?r.initialize.call(this):null}finally{if(this.wrapperInitData[n]===i.OBSERVED_ERROR)try{this.initializeAll(n+1)}catch(o){}}}},closeAll:function(e){this.isInTransaction()?void 0:r(!1);for(var t=this.transactionWrappers,n=e;n<t.length;n++){var o,a=t[n],u=this.wrapperInitData[n];try{o=!0,u!==i.OBSERVED_ERROR&&a.close&&a.close.call(this,u),o=!1}finally{if(o)try{this.closeAll(n+1)}catch(s){}}}this.wrapperInitData.length=0}},i={Mixin:o,OBSERVED_ERROR:{}};e.exports=i},function(e,t){"use strict";function n(e){return o[e]}function r(e){return(""+e).replace(i,n)}var o={"&":"&",">":">","<":"<",'"':""","'":"'"},i=/[&><"']/g;e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":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}Object.defineProperty(t,"__esModule",{value:!0});var i=n(4),a=r(i),u=n(192),s=r(u),c=n(183),l=r(c),p=n(184),f=r(p),d=n(181),h=r(d),v=n(185),m=r(v),y=n(95),g=r(y),b=function(e){var t=e.children,n=e.path,r=e.version,i=e.breadcrumbs,u="/"===n,c="http://redux-form.com/"+r;return a["default"].createElement("div",{className:(0,g["default"])(s["default"].app,o({},s["default"].hasNav,!u))},!u&&a["default"].createElement(f["default"],{path:n,url:c}),a["default"].createElement("div",{className:s["default"].contentAndFooter},a["default"].createElement("div",{className:s["default"].topNav},a["default"].createElement("a",{href:"http://redux-form.com",className:s["default"].brand}),a["default"].createElement("a",{className:s["default"].github,href:"https://github.com/erikras/redux-form",title:"Github",target:"_blank"},a["default"].createElement("i",{className:"fa fa-fw fa-github"}))),a["default"].createElement("div",{className:(0,g["default"])(s["default"].content,o({},s["default"].home,u))},u?a["default"].createElement(l["default"],{version:r}):a["default"].createElement("div",null,a["default"].createElement(h["default"],{items:i}),t)),a["default"].createElement("div",{className:s["default"].footer},a["default"].createElement("div",null,"Created by Erik Rasmussen"),a["default"].createElement("div",null,"Got questions? Ask for help:",a["default"].createElement("a",{className:s["default"].help,href:"https://stackoverflow.com/questions/ask?tags=redux-form",title:"Stack Overflow",target:"_blank"},a["default"].createElement("i",{className:"fa fa-fw fa-stack-overflow"})),a["default"].createElement("a",{className:s["default"].help,href:"https://github.com/erikras/redux-form/issues/new",title:"Github",target:"_blank"},a["default"].createElement("i",{className:"fa fa-fw fa-github"}))),a["default"].createElement("div",null,a["default"].createElement(m["default"],{username:"erikras",showUsername:!0,large:!0}),a["default"].createElement(m["default"],{username:"ReduxForm",showUsername:!0,large:!0})))))};t["default"]=b},function(e,t){"use strict";function n(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function r(e,t){if(n(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(var a=0;a<r.length;a++)if(!o.call(t,r[a])||!n(e[r[a]],t[r[a]]))return!1;return!0}var o=Object.prototype.hasOwnProperty;e.exports=r},function(e,t){function n(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}e.exports=n},function(e,t,n){function r(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=a,this.__views__=[]}var o=n(60),i=n(63),a=4294967295;r.prototype=o(i.prototype),r.prototype.constructor=r,e.exports=r},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var o=n(255),i=n(256),a=n(257),u=n(258),s=n(259);r.prototype.clear=o,r.prototype["delete"]=i,r.prototype.get=a,r.prototype.has=u,r.prototype.set=s,e.exports=r},function(e,t){function n(e,t,n){var r=n.length;switch(r){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}e.exports=n},function(e,t,n){function r(e){return o(e)?i(e):{}}var o=n(15),i=Object.create;e.exports=r},function(e,t,n){function r(e,t,n,u,s){return e===t?!0:null==e||null==t||!i(e)&&!a(t)?e!==e&&t!==t:o(e,t,r,n,u,s)}var o=n(217),i=n(15),a=n(18);e.exports=r},function(e,t,n){function r(e){return"function"==typeof e?e:null==e?a:"object"==typeof e?u(e)?i(e[0],e[1]):o(e):s(e)}var o=n(220),i=n(221),a=n(133),u=n(9),s=n(283);e.exports=r},function(e,t){function n(){}e.exports=n},function(e,t){function n(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}e.exports=n},function(e,t){function n(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(n){}return t}e.exports=n},function(e,t,n){function r(e){var t=o(e)?s.call(e):"";return t==i||t==a}var o=n(15),i="[object Function]",a="[object GeneratorFunction]",u=Object.prototype,s=u.toString;e.exports=r},function(e,t,n){function r(e){if(!a(e)||f.call(e)!=u||i(e))return!1;var t=o(e);if(null===t)return!0;var n=l.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==p}var o=n(122),i=n(65),a=n(18),u="[object Object]",s=Object.prototype,c=Function.prototype.toString,l=s.hasOwnProperty,p=c.call(Object),f=s.toString;e.exports=r},function(e,t,n){function r(e){var t=c(e);if(!t&&!u(e))return i(e);var n=a(e),r=!!n,l=n||[],p=l.length;for(var f in e)!o(e,f)||r&&("length"==f||s(f,p))||t&&"constructor"==f||l.push(f);return l}var o=n(111),i=n(219),a=n(246),u=n(42),s=n(39),c=n(249);e.exports=r},function(e,t,n){function r(e,t){var n={};return t=i(t,3),o(e,function(e,r,o){n[r]=t(e,r,o)}),n}var o=n(109),i=n(62);e.exports=r},function(e,t,n){(function(t){(function(){function t(e){this.tokens=[],this.tokens.links={},this.options=e||l.defaults,this.rules=p.normal,this.options.gfm&&(this.options.tables?this.rules=p.tables:this.rules=p.gfm)}function n(e,t){if(this.options=t||l.defaults,this.links=e,this.rules=f.normal,this.renderer=this.options.renderer||new r,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=f.breaks:this.rules=f.gfm:this.options.pedantic&&(this.rules=f.pedantic)}function r(e){this.options=e||{}}function o(e){this.tokens=[],this.token=null,this.options=e||l.defaults,this.options.renderer=this.options.renderer||new r,this.renderer=this.options.renderer,this.renderer.options=this.options}function i(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function a(e){return e.replace(/&([#\w]+);/g,function(e,t){return t=t.toLowerCase(),"colon"===t?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function u(e,t){return e=e.source,t=t||"",function n(r,o){return r?(o=o.source||o,o=o.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(r,o),n):new RegExp(e,t)}}function s(){}function c(e){for(var t,n,r=1;r<arguments.length;r++){t=arguments[r];for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}function l(e,n,r){if(r||"function"==typeof n){r||(r=n,n=null),n=c({},l.defaults,n||{});var a,u,s=n.highlight,p=0;try{a=t.lex(e,n)}catch(f){return r(f)}u=a.length;var d=function(e){if(e)return n.highlight=s,r(e);var t;try{t=o.parse(a,n)}catch(i){e=i}return n.highlight=s,e?r(e):r(null,t)};if(!s||s.length<3)return d();if(delete n.highlight,!u)return d();for(;p<a.length;p++)!function(e){return"code"!==e.type?--u||d():s(e.text,e.lang,function(t,n){return t?d(t):null==n||n===e.text?--u||d():(e.text=n,e.escaped=!0,void(--u||d()))})}(a[p])}else try{return n&&(n=c({},l.defaults,n)),o.parse(t.lex(e,n),n)}catch(f){if(f.message+="\nPlease report this to https://github.com/chjj/marked.",(n||l.defaults).silent)return"<p>An error occured:</p><pre>"+i(f.message+"",!0)+"</pre>";throw f}}var p={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:s,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:s,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:s,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};p.bullet=/(?:[*+-]|\d+\.)/,p.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,p.item=u(p.item,"gm")(/bull/g,p.bullet)(),p.list=u(p.list)(/bull/g,p.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+p.def.source+")")(),p.blockquote=u(p.blockquote)("def",p.def)(),p._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",p.html=u(p.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,p._tag)(),p.paragraph=u(p.paragraph)("hr",p.hr)("heading",p.heading)("lheading",p.lheading)("blockquote",p.blockquote)("tag","<"+p._tag)("def",p.def)(),p.normal=c({},p),p.gfm=c({},p.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),p.gfm.paragraph=u(p.paragraph)("(?!","(?!"+p.gfm.fences.source.replace("\\1","\\2")+"|"+p.list.source.replace("\\1","\\3")+"|")(),p.tables=c({},p.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),t.rules=p,t.lex=function(e,n){var r=new t(n);return r.lex(e)},t.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},t.prototype.token=function(e,t,n){for(var r,o,i,a,u,s,c,l,f,e=e.replace(/^ +$/gm,"");e;)if((i=this.rules.newline.exec(e))&&(e=e.substring(i[0].length),i[0].length>1&&this.tokens.push({type:"space"})),i=this.rules.code.exec(e))e=e.substring(i[0].length),i=i[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?i:i.replace(/\n+$/,"")});else if(i=this.rules.fences.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"code",lang:i[2],text:i[3]||""});else if(i=this.rules.heading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:i[1].length,text:i[2]});else if(t&&(i=this.rules.nptable.exec(e))){for(e=e.substring(i[0].length),s={type:"table",header:i[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3].replace(/\n$/,"").split("\n")},l=0;l<s.align.length;l++)/^ *-+: *$/.test(s.align[l])?s.align[l]="right":/^ *:-+: *$/.test(s.align[l])?s.align[l]="center":/^ *:-+ *$/.test(s.align[l])?s.align[l]="left":s.align[l]=null;for(l=0;l<s.cells.length;l++)s.cells[l]=s.cells[l].split(/ *\| */);this.tokens.push(s)}else if(i=this.rules.lheading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:"="===i[2]?1:2,text:i[1]});else if(i=this.rules.hr.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"hr"});else if(i=this.rules.blockquote.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"blockquote_start"}),i=i[0].replace(/^ *> ?/gm,""),this.token(i,t,!0),this.tokens.push({type:"blockquote_end"});else if(i=this.rules.list.exec(e)){for(e=e.substring(i[0].length),a=i[2],this.tokens.push({type:"list_start",ordered:a.length>1}),i=i[0].match(this.rules.item),r=!1,f=i.length,l=0;f>l;l++)s=i[l],c=s.length,s=s.replace(/^ *([*+-]|\d+\.) +/,""),~s.indexOf("\n ")&&(c-=s.length,s=this.options.pedantic?s.replace(/^ {1,4}/gm,""):s.replace(new RegExp("^ {1,"+c+"}","gm"),"")),this.options.smartLists&&l!==f-1&&(u=p.bullet.exec(i[l+1])[0],a===u||a.length>1&&u.length>1||(e=i.slice(l+1).join("\n")+e,l=f-1)),o=r||/\n\n(?!\s*$)/.test(s),l!==f-1&&(r="\n"===s.charAt(s.length-1),o||(o=r)),this.tokens.push({type:o?"loose_item_start":"list_item_start"}),this.token(s,!1,n),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(i=this.rules.html.exec(e))e=e.substring(i[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===i[1]||"script"===i[1]||"style"===i[1]),text:i[0]});else if(!n&&t&&(i=this.rules.def.exec(e)))e=e.substring(i[0].length),this.tokens.links[i[1].toLowerCase()]={href:i[2],title:i[3]};else if(t&&(i=this.rules.table.exec(e))){for(e=e.substring(i[0].length),s={type:"table",header:i[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3].replace(/(?: *\| *)?\n$/,"").split("\n")},l=0;l<s.align.length;l++)/^ *-+: *$/.test(s.align[l])?s.align[l]="right":/^ *:-+: *$/.test(s.align[l])?s.align[l]="center":/^ *:-+ *$/.test(s.align[l])?s.align[l]="left":s.align[l]=null;for(l=0;l<s.cells.length;l++)s.cells[l]=s.cells[l].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(s)}else if(t&&(i=this.rules.paragraph.exec(e)))e=e.substring(i[0].length),this.tokens.push({type:"paragraph",text:"\n"===i[1].charAt(i[1].length-1)?i[1].slice(0,-1):i[1]});else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"text",text:i[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var f={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:s,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:s,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};f._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,f._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,f.link=u(f.link)("inside",f._inside)("href",f._href)(),f.reflink=u(f.reflink)("inside",f._inside)(),f.normal=c({},f),f.pedantic=c({},f.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),f.gfm=c({},f.normal,{escape:u(f.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:u(f.text)("]|","~]|")("|","|https?://|")()}),f.breaks=c({},f.gfm,{br:u(f.br)("{2,}","*")(),text:u(f.gfm.text)("{2,}","*")()}),n.rules=f,n.output=function(e,t,r){var o=new n(t,r);return o.output(e)},n.prototype.output=function(e){for(var t,n,r,o,a="";e;)if(o=this.rules.escape.exec(e))e=e.substring(o[0].length),a+=o[1];else if(o=this.rules.autolink.exec(e))e=e.substring(o[0].length),"@"===o[2]?(n=":"===o[1].charAt(6)?this.mangle(o[1].substring(7)):this.mangle(o[1]),r=this.mangle("mailto:")+n):(n=i(o[1]),r=n),a+=this.renderer.link(r,null,n);else if(this.inLink||!(o=this.rules.url.exec(e))){if(o=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(o[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(o[0])&&(this.inLink=!1),e=e.substring(o[0].length),a+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(o[0]):i(o[0]):o[0];else if(o=this.rules.link.exec(e))e=e.substring(o[0].length),this.inLink=!0,a+=this.outputLink(o,{href:o[2],title:o[3]}),this.inLink=!1;else if((o=this.rules.reflink.exec(e))||(o=this.rules.nolink.exec(e))){if(e=e.substring(o[0].length),t=(o[2]||o[1]).replace(/\s+/g," "),t=this.links[t.toLowerCase()],!t||!t.href){a+=o[0].charAt(0),e=o[0].substring(1)+e;continue}this.inLink=!0,a+=this.outputLink(o,t),this.inLink=!1}else if(o=this.rules.strong.exec(e))e=e.substring(o[0].length),a+=this.renderer.strong(this.output(o[2]||o[1]));else if(o=this.rules.em.exec(e))e=e.substring(o[0].length),a+=this.renderer.em(this.output(o[2]||o[1]));else if(o=this.rules.code.exec(e))e=e.substring(o[0].length),a+=this.renderer.codespan(i(o[2],!0));else if(o=this.rules.br.exec(e))e=e.substring(o[0].length),a+=this.renderer.br();else if(o=this.rules.del.exec(e))e=e.substring(o[0].length),a+=this.renderer.del(this.output(o[1]));else if(o=this.rules.text.exec(e))e=e.substring(o[0].length),a+=this.renderer.text(i(this.smartypants(o[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(o[0].length),n=i(o[1]),r=n,a+=this.renderer.link(r,null,n);return a},n.prototype.outputLink=function(e,t){var n=i(t.href),r=t.title?i(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,i(e[1]))},n.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e;
},n.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,o=0;r>o;o++)t=e.charCodeAt(o),Math.random()>.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},r.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'<pre><code class="'+this.options.langPrefix+i(t,!0)+'">'+(n?e:i(e,!0))+"\n</code></pre>\n":"<pre><code>"+(n?e:i(e,!0))+"\n</code></pre>"},r.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n){return"<h"+t+' id="'+this.options.headerPrefix+n.toLowerCase().replace(/[^\w]+/g,"-")+'">'+e+"</h"+t+">\n"},r.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},r.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"</"+n+">\n"},r.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},r.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},r.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n<tbody>\n"+t+"</tbody>\n</table>\n"},r.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},r.prototype.tablecell=function(e,t){var n=t.header?"th":"td",r=t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">";return r+e+"</"+n+">\n"},r.prototype.strong=function(e){return"<strong>"+e+"</strong>"},r.prototype.em=function(e){return"<em>"+e+"</em>"},r.prototype.codespan=function(e){return"<code>"+e+"</code>"},r.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},r.prototype.del=function(e){return"<del>"+e+"</del>"},r.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(a(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(o){return""}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:"))return""}var i='<a href="'+e+'"';return t&&(i+=' title="'+t+'"'),i+=">"+n+"</a>"},r.prototype.image=function(e,t,n){var r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=this.options.xhtml?"/>":">"},r.prototype.text=function(e){return e},o.parse=function(e,t,n){var r=new o(t,n);return r.parse(e)},o.prototype.parse=function(e){this.inline=new n(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},o.prototype.next=function(){return this.token=this.tokens.pop()},o.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},o.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},o.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,o,i="",a="";for(n="",e=0;e<this.token.header.length;e++)r={header:!0,align:this.token.align[e]},n+=this.renderer.tablecell(this.inline.output(this.token.header[e]),{header:!0,align:this.token.align[e]});for(i+=this.renderer.tablerow(n),e=0;e<this.token.cells.length;e++){for(t=this.token.cells[e],n="",o=0;o<t.length;o++)n+=this.renderer.tablecell(this.inline.output(t[o]),{header:!1,align:this.token.align[o]});a+=this.renderer.tablerow(n)}return this.renderer.table(i,a);case"blockquote_start":for(var a="";"blockquote_end"!==this.next().type;)a+=this.tok();return this.renderer.blockquote(a);case"list_start":for(var a="",u=this.token.ordered;"list_end"!==this.next().type;)a+=this.tok();return this.renderer.list(a,u);case"list_item_start":for(var a="";"list_item_end"!==this.next().type;)a+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(a);case"loose_item_start":for(var a="";"list_item_end"!==this.next().type;)a+=this.tok();return this.renderer.listitem(a);case"html":var s=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(s);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},s.exec=s,l.options=l.setOptions=function(e){return c(l.defaults,e),l},l.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new r,xhtml:!1},l.Parser=o,l.parser=o.parse,l.Renderer=r,l.Lexer=t,l.lexer=t.lex,l.InlineLexer=n,l.inlineLexer=n.output,l.parse=l,e.exports=l}).call(function(){return this||("undefined"!=typeof window?window:t)}())}).call(t,function(){return this}())},function(e,t,n){e.exports=n(362)},function(e,t,n){"use strict";function r(e,t){return Array.isArray(t)&&(t=t[1]),t?t.nextSibling:e.firstChild}function o(e,t,n){l.insertTreeBefore(e,t,n)}function i(e,t,n){Array.isArray(t)?u(e,t[0],t[1],n):y(e,t,n)}function a(e,t){if(Array.isArray(t)){var n=t[1];t=t[0],s(e,t,n),e.removeChild(n)}e.removeChild(t)}function u(e,t,n,r){for(var o=t;;){var i=o.nextSibling;if(y(e,o,r),o===n)break;o=i}}function s(e,t,n){for(;;){var r=t.nextSibling;if(r===n)break;e.removeChild(r)}}function c(e,t,n){var r=e.parentNode,o=e.nextSibling;o===t?n&&y(r,document.createTextNode(n),o):n?(m(o,n),s(r,o,t)):s(r,e,t)}var l=n(22),p=n(301),f=n(154),d=n(7),h=n(82),v=n(88),m=n(168),y=h(function(e,t,n){e.insertBefore(t,n)}),g={dangerouslyReplaceNodeWithMarkup:p.dangerouslyReplaceNodeWithMarkup,replaceDelimitedText:c,processUpdates:function(e,t){for(var n=0;n<t.length;n++){var u=t[n];switch(u.type){case f.INSERT_MARKUP:o(e,u.content,r(e,u.afterNode));break;case f.MOVE_EXISTING:i(e,u.fromNode,r(e,u.afterNode));break;case f.SET_MARKUP:v(e,u.content);break;case f.TEXT_CONTENT:m(e,u.content);break;case f.REMOVE_NODE:a(e,u.fromNode)}}}};d.measureMethods(g,"DOMChildrenOperations",{replaceDelimitedText:"replaceDelimitedText"}),e.exports=g},function(e,t,n){"use strict";function r(e){return l.hasOwnProperty(e)?!0:c.hasOwnProperty(e)?!1:s.test(e)?(l[e]=!0,!0):(c[e]=!0,!1)}function o(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&1>t||e.hasOverloadedBooleanValue&&t===!1}var i=n(19),a=(n(319),n(7)),u=n(360),s=(n(2),new RegExp("^["+i.ATTRIBUTE_NAME_START_CHAR+"]["+i.ATTRIBUTE_NAME_CHAR+"]*$")),c={},l={},p={createMarkupForID:function(e){return i.ID_ATTRIBUTE_NAME+"="+u(e)},setAttributeForID:function(e,t){e.setAttribute(i.ID_ATTRIBUTE_NAME,t)},createMarkupForRoot:function(){return i.ROOT_ATTRIBUTE_NAME+'=""'},setAttributeForRoot:function(e){e.setAttribute(i.ROOT_ATTRIBUTE_NAME,"")},createMarkupForProperty:function(e,t){var n=i.properties.hasOwnProperty(e)?i.properties[e]:null;if(n){if(o(n,t))return"";var r=n.attributeName;return n.hasBooleanValue||n.hasOverloadedBooleanValue&&t===!0?r+'=""':r+"="+u(t)}return i.isCustomAttribute(e)?null==t?"":e+"="+u(t):null},createMarkupForCustomAttribute:function(e,t){return r(e)&&null!=t?e+"="+u(t):""},setValueForProperty:function(e,t,n){var r=i.properties.hasOwnProperty(t)?i.properties[t]:null;if(r){var a=r.mutationMethod;if(a)a(e,n);else if(o(r,n))this.deleteValueForProperty(e,t);else if(r.mustUseProperty){var u=r.propertyName;r.hasSideEffects&&""+e[u]==""+n||(e[u]=n)}else{var s=r.attributeName,c=r.attributeNamespace;c?e.setAttributeNS(c,s,""+n):r.hasBooleanValue||r.hasOverloadedBooleanValue&&n===!0?e.setAttribute(s,""):e.setAttribute(s,""+n)}}else i.isCustomAttribute(t)&&p.setValueForAttribute(e,t,n)},setValueForAttribute:function(e,t,n){r(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,t){var n=i.properties.hasOwnProperty(t)?i.properties[t]:null;if(n){var r=n.mutationMethod;if(r)r(e,void 0);else if(n.mustUseProperty){var o=n.propertyName;n.hasBooleanValue?e[o]=!1:n.hasSideEffects&&""+e[o]==""||(e[o]="")}else e.removeAttribute(n.attributeName)}else i.isCustomAttribute(t)&&e.removeAttribute(t)}};a.measureMethods(p,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),e.exports=p},function(e,t,n){"use strict";function r(e){return e===g.topMouseUp||e===g.topTouchEnd||e===g.topTouchCancel}function o(e){return e===g.topMouseMove||e===g.topTouchMove}function i(e){return e===g.topMouseDown||e===g.topTouchStart}function a(e,t,n,r){var o=e.type||"unknown-event";e.currentTarget=b.getNodeFromInstance(r),t?v.invokeGuardedCallbackWithCatch(o,n,e):v.invokeGuardedCallback(o,n,e),e.currentTarget=null}function u(e,t){var n=e._dispatchListeners,r=e._dispatchInstances;if(Array.isArray(n))for(var o=0;o<n.length&&!e.isPropagationStopped();o++)a(e,t,n[o],r[o]);else n&&a(e,t,n,r);e._dispatchListeners=null,e._dispatchInstances=null}function s(e){var t=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t)){for(var r=0;r<t.length&&!e.isPropagationStopped();r++)if(t[r](e,n[r]))return n[r]}else if(t&&t(e,n))return n;return null}function c(e){var t=s(e);return e._dispatchInstances=null,e._dispatchListeners=null,t}function l(e){var t=e._dispatchListeners,n=e._dispatchInstances;Array.isArray(t)?m(!1):void 0,e.currentTarget=t?b.getNodeFromInstance(n):null;var r=t?t(e):null;return e.currentTarget=null,e._dispatchListeners=null,e._dispatchInstances=null,r}function p(e){return!!e._dispatchListeners}var f,d,h=n(12),v=n(78),m=n(1),y=(n(2),{injectComponentTree:function(e){f=e},injectTreeTraversal:function(e){d=e}}),g=h.topLevelTypes,b={isEndish:r,isMoveish:o,isStartish:i,executeDirectDispatch:l,executeDispatchesInOrder:u,executeDispatchesInOrderStopAtTrue:c,hasDispatches:p,getInstanceFromNode:function(e){return f.getInstanceFromNode(e)},getNodeFromInstance:function(e){return f.getNodeFromInstance(e)},isAncestor:function(e,t){return d.isAncestor(e,t)},getLowestCommonAncestor:function(e,t){return d.getLowestCommonAncestor(e,t)},getParentInstance:function(e){return d.getParentInstance(e)},traverseTwoPhase:function(e,t,n){return d.traverseTwoPhase(e,t,n)},traverseEnterLeave:function(e,t,n,r,o){return d.traverseEnterLeave(e,t,n,r,o)},injection:y};e.exports=b},function(e,t){"use strict";function n(e){var t=/[=:]/g,n={"=":"=0",":":"=2"},r=(""+e).replace(t,function(e){return n[e]});return"$"+r}function r(e){var t=/(=0|=2)/g,n={"=0":"=","=2":":"},r="."===e[0]&&"$"===e[1]?e.substring(2):e.substring(1);return(""+r).replace(t,function(e){return n[e]})}var o={escape:n,unescape:r};e.exports=o},function(e,t,n){"use strict";function r(e){null!=e.checkedLink&&null!=e.valueLink?c(!1):void 0}function o(e){r(e),null!=e.value||null!=e.onChange?c(!1):void 0}function i(e){r(e),null!=e.checked||null!=e.onChange?c(!1):void 0}function a(e){if(e){var t=e.getName();if(t)return" Check the render method of `"+t+"`."}return""}var u=n(334),s=n(81),c=n(1),l=(n(2),{button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0}),p={value:function(e,t,n){return!e[t]||l[e.type]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(e,t,n){return!e[t]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:u.func},f={},d={checkPropTypes:function(e,t,n){for(var r in p){if(p.hasOwnProperty(r))var o=p[r](t,r,e,s.prop);o instanceof Error&&!(o.message in f)&&(f[o.message]=!0,a(n))}},getValue:function(e){return e.valueLink?(o(e),e.valueLink.value):e.value},getChecked:function(e){return e.checkedLink?(i(e),e.checkedLink.value):e.checked},executeOnChange:function(e,t){return e.valueLink?(o(e),e.valueLink.requestChange(t.target.value)):e.checkedLink?(i(e),e.checkedLink.requestChange(t.target.checked)):e.onChange?e.onChange.call(void 0,t):void 0}};e.exports=d},function(e,t,n){"use strict";var r=n(1),o=!1,i={unmountIDFromEnvironment:null,replaceNodeWithMarkup:null,processChildrenUpdates:null,injection:{injectEnvironment:function(e){o?r(!1):void 0,i.unmountIDFromEnvironment=e.unmountIDFromEnvironment,i.replaceNodeWithMarkup=e.replaceNodeWithMarkup,i.processChildrenUpdates=e.processChildrenUpdates,o=!0}}};e.exports=i},function(e,t,n){"use strict";function r(e,t,n,r){try{return t(n,r)}catch(i){return void(null===o&&(o=i))}}var o=null,i={invokeGuardedCallback:r,invokeGuardedCallbackWithCatch:r,rethrowCaughtError:function(){if(o){var e=o;throw o=null,e}}};e.exports=i},function(e,t){"use strict";var n={remove:function(e){e._reactInternalInstance=void 0},get:function(e){return e._reactInternalInstance},has:function(e){return void 0!==e._reactInternalInstance},set:function(e,t){e._reactInternalInstance=t}};e.exports=n},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){"use strict";var r=n(32),o=r({prop:null,context:null,childContext:null});e.exports=o},function(e,t){"use strict";var n=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e};e.exports=n},function(e,t){"use strict";function n(e){var t,n=e.keyCode;return"charCode"in e?(t=e.charCode,0===t&&13===n&&(t=13)):t=n,t>=32||13===t?t:0}e.exports=n},function(e,t){"use strict";function n(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var r=o[e];return r?!!n[r]:!1}function r(e){return n}var o={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};e.exports=r},function(e,t){"use strict";function n(e){var t=e.target||e.srcElement||window;return t.correspondingUseElement&&(t=t.correspondingUseElement),3===t.nodeType?t.parentNode:t}e.exports=n},function(e,t,n){"use strict";function r(e){return"function"==typeof e&&"undefined"!=typeof e.prototype&&"function"==typeof e.prototype.mountComponent&&"function"==typeof e.prototype.receiveComponent}function o(e){var t;if(null===e||e===!1)t=u.create(o);else if("object"==typeof e){var n=e;!n||"function"!=typeof n.type&&"string"!=typeof n.type?c(!1):void 0,t="string"==typeof n.type?s.createInternalComponent(n):r(n.type)?new n.type(n):new l(n)}else"string"==typeof e||"number"==typeof e?t=s.createInstanceForText(e):c(!1);return t._mountIndex=0,t._mountImage=null,t}var i=n(3),a=n(310),u=n(149),s=n(155),c=n(1),l=(n(2),function(e){this.construct(e)});i(l.prototype,a.Mixin,{_instantiateReactComponent:o}),e.exports=o},function(e,t,n){"use strict";/**
* Checks if an event is supported in the current execution environment.
*
* NOTE: This will not work correctly for non-generic events such as `change`,
* `reset`, `load`, `error`, and `select`.
*
* Borrows from Modernizr.
*
* @param {string} eventNameSuffix Event name, e.g. "click".
* @param {?boolean} capture Check if the capture phase is supported.
* @return {boolean} True if the event is supported.
* @internal
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/
function r(e,t){if(!i.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var a=document.createElement("div");a.setAttribute(n,"return;"),r="function"==typeof a[n]}return!r&&o&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var o,i=n(6);i.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),e.exports=r},function(e,t,n){"use strict";var r=n(6),o=/^[ \r\n\t\f]/,i=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,a=n(82),u=a(function(e,t){e.innerHTML=t});if(r.canUseDOM){var s=document.createElement("div");s.innerHTML=" ",""===s.innerHTML&&(u=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),o.test(t)||"<"===t[0]&&i.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t}),s=null}e.exports=u},function(e,t){"use strict";function n(e,t){var n=null===e||e===!1,r=null===t||t===!1;if(n||r)return n===r;var o=typeof e,i=typeof t;return"string"===o||"number"===o?"string"===i||"number"===i:"object"===i&&e.type===t.type&&e.key===t.key}e.exports=n},function(e,t,n){"use strict";function r(e,t){return e&&"object"==typeof e&&null!=e.key?c.escape(e.key):t.toString(36)}function o(e,t,n,i){var f=typeof e;if("undefined"!==f&&"boolean"!==f||(e=null),null===e||"string"===f||"number"===f||a.isValidElement(e))return n(i,e,""===t?l+r(e,0):t),1;var d,h,v=0,m=""===t?l:t+p;if(Array.isArray(e))for(var y=0;y<e.length;y++)d=e[y],h=m+r(d,y),v+=o(d,h,n,i);else{var g=u(e);if(g){var b,_=g.call(e);if(g!==e.entries)for(var x=0;!(b=_.next()).done;)d=b.value,h=m+r(d,x++),v+=o(d,h,n,i);else for(;!(b=_.next()).done;){var E=b.value;E&&(d=E[1],h=m+c.escape(E[0])+p+r(d,0),v+=o(d,h,n,i))}}else"object"===f&&(String(e),s(!1))}return v}function i(e,t,n){return null==e?0:o(e,"",t,n)}var a=(n(20),n(17)),u=n(164),s=n(1),c=n(75),l=(n(2),"."),p=":";e.exports=i},function(e,t,n){"use strict";var r=(n(3),n(11)),o=(n(2),r);e.exports=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ARRAY_INSERT="redux-form/ARRAY_INSERT",t.ARRAY_POP="redux-form/ARRAY_POP",t.ARRAY_PUSH="redux-form/ARRAY_PUSH",t.ARRAY_REMOVE="redux-form/ARRAY_REMOVE",t.ARRAY_SHIFT="redux-form/ARRAY_SHIFT",t.ARRAY_SPLICE="redux-form/ARRAY_SPLICE",t.ARRAY_UNSHIFT="redux-form/ARRAY_UNSHIFT",t.ARRAY_SWAP="redux-form/ARRAY_SWAP",t.BLUR="redux-form/BLUR",t.CHANGE="redux-form/CHANGE",t.DESTROY="redux-form/DESTROY",t.FOCUS="redux-form/FOCUS",t.INITIALIZE="redux-form/INITIALIZE",t.RESET="redux-form/RESET",t.SET_SUBMIT_FAILED="redux-form/SET_SUBMIT_FAILED",t.START_ASYNC_VALIDATION="redux-form/START_ASYNC_VALIDATION",t.START_SUBMIT="redux-form/START_SUBMIT",t.STOP_ASYNC_VALIDATION="redux-form/STOP_ASYNC_VALIDATION",t.STOP_SUBMIT="redux-form/STOP_SUBMIT",t.TOUCH="redux-form/TOUCH",t.UNTOUCH="redux-form/UNTOUCH"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),i=r(o),a=n(94),u=r(a),s=function(e){var t=e.source,n=e.language;return i["default"].createElement(u["default"],{content:"```"+n+t+"```"})};s.defaultProps={language:"js"},t["default"]=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),i=r(o),a=n(70),u=r(a),s=n(190),c=r(s),l=function(e){return e.replace(/```(?:javascript|js)([\s\S]+?)```/g,function(e,t){return'<pre class="language-jsx"><code class="language-jsx">'+c["default"].highlight(t,c["default"].languages.jsx)+"</code></pre>"})},p=function(e){var t=e.content;return i["default"].createElement("div",{dangerouslySetInnerHTML:{__html:(0,u["default"])(l(t))}})};t["default"]=p},function(e,t,n){var r,o;/*!
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 r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r))e.push(n.apply(null,r));else if("object"===o)for(var a in r)i.call(r,a)&&r[a]&&e.push(a)}}return e.join(" ")}var i={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=n:(r=[],o=function(){return n}.apply(t,r),!(void 0!==o&&(e.exports=o)))}()},function(e,t,n){"use strict";var r=n(11),o={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!0),{remove:function(){e.removeEventListener(t,n,!0)}}):{remove:r}},registerDefault:function(){}};e.exports=o},function(e,t){"use strict";function n(e){try{e.focus()}catch(t){}}e.exports=n},function(e,t){"use strict";function n(){if("undefined"==typeof document)return null;try{return document.activeElement||document.body}catch(e){return document.body}}e.exports=n},function(e,t,n){"use strict";function r(e){return a?void 0:i(!1),f.hasOwnProperty(e)||(e="*"),u.hasOwnProperty(e)||("*"===e?a.innerHTML="<link />":a.innerHTML="<"+e+"></"+e+">",u[e]=!a.firstChild),u[e]?f[e]:null}var o=n(6),i=n(1),a=o.canUseDOM?document.createElement("div"):null,u={},s=[1,'<select multiple="true">',"</select>"],c=[1,"<table>","</table>"],l=[3,"<table><tbody><tr>","</tr></tbody></table>"],p=[1,'<svg xmlns="http://www.w3.org/2000/svg">',"</svg>"],f={"*":[1,"?<div>","</div>"],area:[1,"<map>","</map>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],legend:[1,"<fieldset>","</fieldset>"],param:[1,"<object>","</object>"],tr:[2,"<table><tbody>","</tbody></table>"],optgroup:s,option:s,caption:c,colgroup:c,tbody:c,tfoot:c,thead:c,td:l,th:l},d=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];d.forEach(function(e){f[e]=p,u[e]=!0}),e.exports=r},function(e,t){"use strict";var n={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0};e.exports=function(e,t){if("string"!=typeof t)for(var o=Object.getOwnPropertyNames(t),i=0;i<o.length;++i)if(!n[o[i]]&&!r[o[i]])try{e[o[i]]=t[o[i]]}catch(a){}return e}},function(e,t,n){function r(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}var o=n(60),i=n(63);r.prototype=o(i.prototype),r.prototype.constructor=r,e.exports=r},function(e,t,n){var r=n(21),o=n(8),i=r(o,"Map");e.exports=i},function(e,t,n){function r(e){this.__data__=new o(e)}var o=n(34),i=n(267),a=n(268),u=n(269),s=n(270),c=n(271);r.prototype.clear=i,r.prototype["delete"]=a,r.prototype.get=u,r.prototype.has=s,r.prototype.set=c,e.exports=r},function(e,t,n){var r=n(8),o=r.Symbol;e.exports=o},function(e,t,n){var r=n(21),o=n(8),i=r(o,"WeakMap");e.exports=i},function(e,t){function n(e,t){for(var n=-1,r=e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}e.exports=n},function(e,t){function n(e,t){for(var n=-1,r=e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}e.exports=n},function(e,t,n){var r=n(109),o=n(229),i=o(r);e.exports=i},function(e,t,n){function r(e,t){return e&&o(e,t,i)}var o=n(215),i=n(68);e.exports=r},function(e,t,n){function r(e,t){t=i(t,e)?[t]:o(t);for(var n=0,r=t.length;null!=e&&r>n;)e=e[a(t[n++])];return n&&n==r?e:void 0}var o=n(114),i=n(40),a=n(26);e.exports=r},function(e,t,n){function r(e,t){return a.call(e,t)||"object"==typeof e&&t in e&&null===o(e)}var o=n(122),i=Object.prototype,a=i.hasOwnProperty;e.exports=r},function(e,t){function n(e){return function(t){return null==t?void 0:t[e]}}e.exports=n},function(e,t,n){var r=n(133),o=n(128),i=o?function(e,t){return o.set(e,t),e}:r;e.exports=i},function(e,t,n){function r(e){return o(e)?e:i(e)}var o=n(9),i=n(130);e.exports=r},function(e,t){function n(e,t,n,o){for(var i=-1,a=e.length,u=n.length,s=-1,c=t.length,l=r(a-u,0),p=Array(c+l),f=!o;++s<c;)p[s]=t[s];for(;++i<u;)(f||a>i)&&(p[n[i]]=e[i]);for(;l--;)p[s++]=e[i++];return p}var r=Math.max;e.exports=n},function(e,t){function n(e,t,n,o){for(var i=-1,a=e.length,u=-1,s=n.length,c=-1,l=t.length,p=r(a-s,0),f=Array(p+l),d=!o;++i<p;)f[i]=e[i];for(var h=i;++c<l;)f[h+c]=t[c];for(;++u<s;)(d||a>i)&&(f[h+n[u]]=e[i++]);return f}var r=Math.max;e.exports=n},function(e,t,n){function r(e,t,n,b,_,x,E,w,C,P){function S(){for(var d=arguments.length,h=Array(d),v=d;v--;)h[v]=arguments[v];if(M)var m=c(S),y=a(h,m);if(b&&(h=o(h,b,_,M)),x&&(h=i(h,x,E,M)),d-=y,M&&P>d){var g=p(h,m);return s(e,t,r,S.placeholder,n,h,g,w,C,P-d)}var R=T?n:this,I=A?R[e]:e;return d=h.length,w?h=l(h,w):k&&d>1&&h.reverse(),O&&d>C&&(h.length=C),this&&this!==f&&this instanceof S&&(I=N||u(I)),I.apply(R,h)}var O=t&y,T=t&d,A=t&h,M=t&(v|m),k=t&g,N=A?void 0:u(e);return S}var o=n(115),i=n(116),a=n(228),u=n(36),s=n(118),c=n(37),l=n(262),p=n(25),f=n(8),d=1,h=2,v=8,m=16,y=128,g=512;e.exports=r},function(e,t,n){function r(e,t,n,r,f,d,h,v,m,y){var g=t&c,b=g?h:void 0,_=g?void 0:h,x=g?d:void 0,E=g?void 0:d;t|=g?l:p,t&=~(g?p:l),t&s||(t&=~(a|u));var w=[e,t,f,x,b,E,_,v,m,y],C=n.apply(void 0,w);return o(e)&&i(C,w),C.placeholder=r,C}var o=n(248),i=n(129),a=1,u=2,s=4,c=8,l=32,p=64;e.exports=r},function(e,t,n){function r(e,t,n,r,x,E,w,C){var P=t&v;if(!P&&"function"!=typeof e)throw new TypeError(d);var S=r?r.length:0;if(S||(t&=~(g|b),r=x=void 0),w=void 0===w?w:_(f(w),0),C=void 0===C?C:f(C),S-=x?x.length:0,t&b){var O=r,T=x;r=x=void 0}var A=P?void 0:c(e),M=[e,t,n,r,x,O,T,E,w,C];if(A&&l(M,A),e=M[0],t=M[1],n=M[2],r=M[3],x=M[4],C=M[9]=null==M[9]?P?0:e.length:_(M[9]-S,0),!C&&t&(m|y)&&(t&=~(m|y)),t&&t!=h)k=t==m||t==y?a(e,t,C):t!=g&&t!=(h|g)||x.length?u.apply(void 0,M):s(e,t,n,r);else var k=i(e,t,n);var N=A?o:p;return N(k,M)}var o=n(113),i=n(231),a=n(232),u=n(117),s=n(233),c=n(121),l=n(260),p=n(129),f=n(138),d="Expected a function",h=1,v=2,m=8,y=16,g=32,b=64,_=Math.max;e.exports=r},function(e,t,n){function r(e,t,n,r,s,c){var l=s&u,p=e.length,f=t.length;if(p!=f&&!(l&&f>p))return!1;var d=c.get(e);if(d)return d==t;var h=-1,v=!0,m=s&a?new o:void 0;for(c.set(e,t);++h<p;){var y=e[h],g=t[h];if(r)var b=l?r(g,y,h,t,e,c):r(y,g,h,e,t,c);if(void 0!==b){if(b)continue;v=!1;break}if(m){if(!i(t,function(e,t){return m.has(t)||y!==e&&!n(y,e,r,s,c)?void 0:m.add(t)})){v=!1;break}}else if(y!==g&&!n(y,g,r,s,c)){v=!1;break}}return c["delete"](e),v}var o=n(211),i=n(107),a=1,u=2;e.exports=r},function(e,t,n){var r=n(128),o=n(136),i=r?function(e){return r.get(e)}:o;e.exports=i},function(e,t){function n(e){return r(Object(e))}var r=Object.getPrototypeOf;e.exports=n},function(e,t,n){function r(e){return y.call(e)}var o=n(207),i=n(102),a=n(209),u=n(210),s=n(105),c=n(131),l="[object Map]",p="[object Object]",f="[object Promise]",d="[object Set]",h="[object WeakMap]",v="[object DataView]",m=Object.prototype,y=m.toString,g=c(o),b=c(i),_=c(a),x=c(u),E=c(s);(o&&r(new o(new ArrayBuffer(1)))!=v||i&&r(new i)!=l||a&&r(a.resolve())!=f||u&&r(new u)!=d||s&&r(new s)!=h)&&(r=function(e){var t=y.call(e),n=t==p?e.constructor:void 0,r=n?c(n):void 0;if(r)switch(r){case g:return v;case b:return l;case _:return f;case x:return d;case E:return h}return t}),e.exports=r},function(e,t,n){function r(e,t,n){if(!u(n))return!1;var r=typeof t;return("number"==r?i(n)&&a(t,n.length):"string"==r&&t in n)?o(n[t],e):!1}var o=n(132),i=n(42),a=n(39),u=n(15);e.exports=r},function(e,t,n){function r(e){return e===e&&!o(e)}var o=n(15);e.exports=r},function(e,t){function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}e.exports=n},function(e,t){function n(e,t){return function(n){return null==n?!1:n[e]===t&&(void 0!==t||e in Object(n))}}e.exports=n},function(e,t,n){var r=n(105),o=r&&new r;e.exports=o},function(e,t,n){var r=n(113),o=n(281),i=150,a=16,u=function(){var e=0,t=0;return function(n,u){var s=o(),c=a-(s-t);if(t=s,c>0){if(++e>=i)return n}else e=0;return r(n,u)}}();e.exports=u},function(e,t,n){var r=n(280),o=n(288),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,a=/\\(\\)?/g,u=r(function(e){var t=[];return o(e).replace(i,function(e,n,r,o){t.push(r?o.replace(a,"$1"):n||e)}),t});e.exports=u},function(e,t){function n(e){if(null!=e){try{return r.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var r=Function.prototype.toString;e.exports=n},function(e,t){function n(e,t){return e===t||e!==e&&t!==t}e.exports=n},function(e,t){function n(e){return e}e.exports=n},function(e,t,n){function r(e){return o(e)&&u.call(e,"callee")&&(!c.call(e,"callee")||s.call(e)==i)}var o=n(276),i="[object Arguments]",a=Object.prototype,u=a.hasOwnProperty,s=a.toString,c=a.propertyIsEnumerable;e.exports=r},function(e,t,n){function r(e){return"string"==typeof e||!o(e)&&i(e)&&s.call(e)==a}var o=n(9),i=n(18),a="[object String]",u=Object.prototype,s=u.toString;e.exports=r},function(e,t){function n(){}e.exports=n},function(e,t,n){function r(e,t){if("function"!=typeof e)throw new TypeError(a);return t=u(void 0===t?e.length-1:i(t),0),function(){for(var n=arguments,r=-1,i=u(n.length-t,0),a=Array(i);++r<i;)a[r]=n[t+r];switch(t){case 0:return e.call(this,a);case 1:return e.call(this,n[0],a);case 2:return e.call(this,n[0],n[1],a)}var s=Array(t+1);for(r=-1;++r<t;)s[r]=n[r];return s[t]=a,o(e,this,s)}}var o=n(59),i=n(138),a="Expected a function",u=Math.max;e.exports=r},function(e,t,n){function r(e){var t=o(e),n=t%1;return t===t?n?t-n:t:0}var o=n(285);e.exports=r},function(e,t,n){"use strict";t.__esModule=!0;var r=n(4);t["default"]=r.PropTypes.shape({subscribe:r.PropTypes.func.isRequired,dispatch:r.PropTypes.func.isRequired,getState:r.PropTypes.func.isRequired})},function(e,t){"use strict";function n(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(t){}}t.__esModule=!0,t["default"]=n},function(e,t){"use strict";function n(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var r={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},o=["Webkit","ms","Moz","O"];Object.keys(r).forEach(function(e){o.forEach(function(t){r[n(t,e)]=r[e]})});var i={background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}},a={isUnitlessNumber:r,shorthandPropertyExpansions:i};e.exports=a},function(e,t,n){"use strict";function r(){this._callbacks=null,this._contexts=null}var o=n(3),i=n(16),a=n(1);o(r.prototype,{enqueue:function(e,t){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(e),this._contexts.push(t)},notifyAll:function(){var e=this._callbacks,t=this._contexts;if(e){e.length!==t.length?a(!1):void 0,this._callbacks=null,this._contexts=null;for(var n=0;n<e.length;n++)e[n].call(t[n]);e.length=0,t.length=0}},checkpoint:function(){return this._callbacks?this._callbacks.length:0},rollback:function(e){this._callbacks&&(this._callbacks.length=e,this._contexts.length=e)},reset:function(){this._callbacks=null,this._contexts=null},destructor:function(){this.reset()}}),i.addPoolingTo(r),e.exports=r},function(e,t,n){"use strict";var r=n(72),o=n(317),i=n(7),a={processChildrenUpdates:o.dangerouslyProcessChildrenUpdates,replaceNodeWithMarkup:r.dangerouslyReplaceNodeWithMarkup,unmountIDFromEnvironment:function(e){}};i.measureMethods(a,"ReactComponentBrowserEnvironment",{replaceNodeWithMarkup:"replaceNodeWithMarkup"}),e.exports=a},function(e,t){"use strict";var n={hasCachedChildNodes:1};e.exports=n},function(e,t,n){"use strict";function r(e,t){var n={_topLevelWrapper:e,_idCounter:1,_ownerDocument:t?t.nodeType===o?t:t.ownerDocument:null,_node:t,_tag:t?t.nodeName.toLowerCase():null,_namespaceURI:t?t.namespaceURI:null};return n}var o=(n(91),9);e.exports=r},function(e,t,n){"use strict";function r(){if(this._rootNodeID&&this._wrapperState.pendingUpdate){this._wrapperState.pendingUpdate=!1;var e=this._currentElement.props,t=s.getValue(e);null!=t&&o(this,Boolean(e.multiple),t)}}function o(e,t,n){var r,o,i=c.getNodeFromInstance(e).options;if(t){for(r={},o=0;o<n.length;o++)r[""+n[o]]=!0;for(o=0;o<i.length;o++){var a=r.hasOwnProperty(i[o].value);i[o].selected!==a&&(i[o].selected=a)}}else{for(r=""+n,o=0;o<i.length;o++)if(i[o].value===r)return void(i[o].selected=!0);i.length&&(i[0].selected=!0)}}function i(e){var t=this._currentElement.props,n=s.executeOnChange(t,e);return this._rootNodeID&&(this._wrapperState.pendingUpdate=!0),l.asap(r,this),n}var a=n(3),u=n(47),s=n(76),c=n(5),l=n(10),p=(n(2),!1),f={getNativeProps:function(e,t){return a({},u.getNativeProps(e,t),{onChange:e._wrapperState.onChange,value:void 0})},mountWrapper:function(e,t){var n=s.getValue(t);e._wrapperState={pendingUpdate:!1,initialValue:null!=n?n:t.defaultValue,listeners:null,onChange:i.bind(e),wasMultiple:Boolean(t.multiple)},void 0===t.value||void 0===t.defaultValue||p||(p=!0)},getSelectValueContext:function(e){return e._wrapperState.initialValue},postUpdateWrapper:function(e){var t=e._currentElement.props;e._wrapperState.initialValue=void 0;var n=e._wrapperState.wasMultiple;e._wrapperState.wasMultiple=Boolean(t.multiple);var r=s.getValue(t);null!=r?(e._wrapperState.pendingUpdate=!1,o(e,Boolean(t.multiple),r)):n!==Boolean(t.multiple)&&(null!=t.defaultValue?o(e,Boolean(t.multiple),t.defaultValue):o(e,Boolean(t.multiple),t.multiple?[]:""))}};e.exports=f},function(e,t,n){"use strict";function r(){this.reinitializeTransaction()}var o=n(3),i=n(10),a=n(52),u=n(11),s={initialize:u,close:function(){f.isBatchingUpdates=!1}},c={initialize:u,close:i.flushBatchedUpdates.bind(i)},l=[c,s];o(r.prototype,a.Mixin,{getTransactionWrappers:function(){return l}});var p=new r,f={isBatchingUpdates:!1,batchedUpdates:function(e,t,n,r,o,i){var a=f.isBatchingUpdates;f.isBatchingUpdates=!0,a?e(t,n,r,o,i):p.perform(e,null,t,n,r,o,i)}};e.exports=f},function(e,t,n){"use strict";function r(){E||(E=!0,y.EventEmitter.injectReactEventListener(m),y.EventPluginHub.injectEventPluginOrder(a),y.EventPluginUtils.injectComponentTree(p),y.EventPluginUtils.injectTreeTraversal(d),y.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:x,EnterLeaveEventPlugin:u,ChangeEventPlugin:i,SelectEventPlugin:_,BeforeInputEventPlugin:o}),y.NativeComponent.injectGenericComponentClass(l),y.NativeComponent.injectTextComponentClass(h),y.DOMProperty.injectDOMPropertyConfig(s),y.DOMProperty.injectDOMPropertyConfig(b),y.EmptyComponent.injectEmptyComponentFactory(function(e){return new f(e)}),y.Updates.injectReconcileTransaction(g),y.Updates.injectBatchingStrategy(v),y.Component.injectEnvironment(c))}var o=n(297),i=n(299),a=n(302),u=n(303),s=(n(6),n(305)),c=n(143),l=n(313),p=n(5),f=n(315),d=n(325),h=n(323),v=n(147),m=n(329),y=n(330),g=n(335),b=n(340),_=n(341),x=n(342),E=!1;e.exports={inject:r}},function(e,t){"use strict";var n,r={injectEmptyComponentFactory:function(e){n=e}},o={create:function(e){return n(e)}};o.injection=r,e.exports=o},function(e,t){"use strict";var n={logTopLevelRenders:!1};e.exports=n},function(e,t,n){"use strict";function r(e){return i(document.documentElement,e)}var o=n(321),i=n(198),a=n(97),u=n(98),s={hasSelectionCapabilities:function(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&"text"===e.type||"textarea"===t||"true"===e.contentEditable)},getSelectionInformation:function(){var e=u();return{focusedElem:e,selectionRange:s.hasSelectionCapabilities(e)?s.getSelection(e):null}},restoreSelection:function(e){var t=u(),n=e.focusedElem,o=e.selectionRange;t!==n&&r(n)&&(s.hasSelectionCapabilities(n)&&s.setSelection(n,o),a(n))},getSelection:function(e){var t;if("selectionStart"in e)t={start:e.selectionStart,end:e.selectionEnd};else if(document.selection&&e.nodeName&&"input"===e.nodeName.toLowerCase()){var n=document.selection.createRange();n.parentElement()===e&&(t={start:-n.moveStart("character",-e.value.length),end:-n.moveEnd("character",-e.value.length)})}else t=o.getOffsets(e);return t||{start:0,end:0}},setSelection:function(e,t){var n=t.start,r=t.end;if(void 0===r&&(r=n),"selectionStart"in e)e.selectionStart=n,e.selectionEnd=Math.min(r,e.value.length);else if(document.selection&&e.nodeName&&"input"===e.nodeName.toLowerCase()){var i=e.createTextRange();i.collapse(!0),i.moveStart("character",n),i.moveEnd("character",r-n),i.select()}else o.setOffsets(e,t)}};e.exports=s},function(e,t,n){"use strict";var r=n(353),o=/\/?>/,i=/^<\!\-\-/,a={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=r(e);return i.test(e)?e:e.replace(o," "+a.CHECKSUM_ATTR_NAME+'="'+t+'"$&')},canReuseMarkup:function(e,t){var n=t.getAttribute(a.CHECKSUM_ATTR_NAME);n=n&&parseInt(n,10);var o=r(e);return o===n}};e.exports=a},function(e,t,n){"use strict";function r(e,t){for(var n=Math.min(e.length,t.length),r=0;n>r;r++)if(e.charAt(r)!==t.charAt(r))return r;return e.length===t.length?-1:n}function o(e){return e?e.nodeType===R?e.documentElement:e.firstChild:null}function i(e){return e.getAttribute&&e.getAttribute(M)||""}function a(e,t,n,r,o){var i;if(b.logTopLevelRenders){var a=e._currentElement.props,u=a.type;i="React mount: "+("string"==typeof u?u:u.displayName||u.name),console.time(i)}var s=E.mountComponent(e,n,null,m(e,t),o);i&&console.timeEnd(i),e._renderedComponent._topLevelWrapper=e,L._mountImageIntoNode(s,t,e,r,n)}function u(e,t,n,r){var o=C.ReactReconcileTransaction.getPooled(!n&&y.useCreateElement);o.perform(a,null,e,t,o,n,r),C.ReactReconcileTransaction.release(o)}function s(e,t,n){for(E.unmountComponent(e,n),t.nodeType===R&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)}function c(e){var t=o(e);if(t){var n=v.getInstanceFromNode(t);return!(!n||!n._nativeParent)}}function l(e){var t=o(e),n=t&&v.getInstanceFromNode(t);return n&&!n._nativeParent?n:null}function p(e){var t=l(e);return t?t._nativeContainerInfo._topLevelWrapper:null}var f=n(22),d=n(19),h=n(49),v=(n(20),n(5)),m=n(145),y=n(316),g=n(17),b=n(150),_=(n(50),n(152)),x=n(7),E=n(23),w=n(158),C=n(10),P=n(24),S=n(86),O=n(1),T=n(88),A=n(89),M=(n(2),d.ID_ATTRIBUTE_NAME),k=d.ROOT_ATTRIBUTE_NAME,N=1,R=9,I=11,j={},D=1,F=function(){this.rootID=D++};F.prototype.isReactComponent={},F.prototype.render=function(){return this.props};var L={TopLevelWrapper:F,_instancesByReactRootID:j,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,n,r){return L.scrollMonitor(n,function(){w.enqueueElementInternal(e,t),r&&w.enqueueCallbackInternal(e,r)}),e},_renderNewRootComponent:function(e,t,n,r){!t||t.nodeType!==N&&t.nodeType!==R&&t.nodeType!==I?O(!1):void 0,h.ensureScrollValueMonitoring();var o=S(e);C.batchedUpdates(u,o,t,n,r);var i=o._instance.rootID;return j[i]=o,o},renderSubtreeIntoContainer:function(e,t,n,r){return null==e||null==e._reactInternalInstance?O(!1):void 0,L._renderSubtreeIntoContainer(e,t,n,r)},_renderSubtreeIntoContainer:function(e,t,n,r){w.validateCallback(r,"ReactDOM.render"),g.isValidElement(t)?void 0:O(!1);var a=g(F,null,null,null,null,null,t),u=p(n);if(u){var s=u._currentElement,l=s.props;if(A(l,t)){var f=u._renderedComponent.getPublicInstance(),d=r&&function(){r.call(f)};return L._updateRootComponent(u,a,n,d),f}L.unmountComponentAtNode(n)}var h=o(n),v=h&&!!i(h),m=c(n),y=v&&!u&&!m,b=L._renderNewRootComponent(a,n,y,null!=e?e._reactInternalInstance._processChildContext(e._reactInternalInstance._context):P)._renderedComponent.getPublicInstance();return r&&r.call(b),b},render:function(e,t,n){return L._renderSubtreeIntoContainer(null,e,t,n)},unmountComponentAtNode:function(e){!e||e.nodeType!==N&&e.nodeType!==R&&e.nodeType!==I?O(!1):void 0;var t=p(e);return t?(delete j[t._instance.rootID],C.batchedUpdates(s,t,e,!1),!0):(c(e),1===e.nodeType&&e.hasAttribute(k),!1)},_mountImageIntoNode:function(e,t,n,i,a){if(!t||t.nodeType!==N&&t.nodeType!==R&&t.nodeType!==I?O(!1):void 0,i){var u=o(t);if(_.canReuseMarkup(e,u))return void v.precacheNode(n,u);var s=u.getAttribute(_.CHECKSUM_ATTR_NAME);u.removeAttribute(_.CHECKSUM_ATTR_NAME);var c=u.outerHTML;u.setAttribute(_.CHECKSUM_ATTR_NAME,s);var l=e,p=r(l,c);" (client) "+l.substring(p-20,p+20)+"\n (server) "+c.substring(p-20,p+20),t.nodeType===R?O(!1):void 0}if(t.nodeType===R?O(!1):void 0,a.useCreateElement){for(;t.lastChild;)t.removeChild(t.lastChild);f.insertTreeBefore(t,e,null)}else T(t,e),v.precacheNode(n,t.firstChild)}};x.measureMethods(L,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),e.exports=L},function(e,t,n){"use strict";var r=n(32),o=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,SET_MARKUP:null,TEXT_CONTENT:null});e.exports=o},function(e,t,n){"use strict";function r(e){if("function"==typeof e.type)return e.type;var t=e.type,n=p[t];return null==n&&(p[t]=n=c(t)),n}function o(e){return l?void 0:s(!1),new l(e)}function i(e){return new f(e)}function a(e){return e instanceof f}var u=n(3),s=n(1),c=null,l=null,p={},f=null,d={injectGenericComponentClass:function(e){l=e},injectTextComponentClass:function(e){f=e},injectComponentClasses:function(e){u(p,e)}},h={getComponentClassForElement:r,createInternalComponent:o,createInstanceForText:i,isTextComponent:a,injection:d};e.exports=h},function(e,t,n){"use strict";var r=n(17),o=n(1),i={NATIVE:0,COMPOSITE:1,EMPTY:2,getType:function(e){return null===e||e===!1?i.EMPTY:r.isValidElement(e)?"function"==typeof e.type?i.COMPOSITE:i.NATIVE:void o(!1)}};e.exports=i},function(e,t,n){"use strict";function r(e,t){}var o=(n(2),{isMounted:function(e){return!1},enqueueCallback:function(e,t){},enqueueForceUpdate:function(e){r(e,"forceUpdate")},enqueueReplaceState:function(e,t){r(e,"replaceState")},enqueueSetState:function(e,t){r(e,"setState")}});e.exports=o},function(e,t,n){"use strict";function r(e){a.enqueueUpdate(e)}function o(e,t){var n=i.get(e);return n?n:null}var i=(n(20),n(79)),a=n(10),u=n(1),s=(n(2),{isMounted:function(e){var t=i.get(e);return t?!!t._renderedComponent:!1},enqueueCallback:function(e,t,n){s.validateCallback(t,n);var i=o(e);return i?(i._pendingCallbacks?i._pendingCallbacks.push(t):i._pendingCallbacks=[t],void r(i)):null},enqueueCallbackInternal:function(e,t){e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t],r(e)},enqueueForceUpdate:function(e){var t=o(e,"forceUpdate");t&&(t._pendingForceUpdate=!0,r(t))},enqueueReplaceState:function(e,t){var n=o(e,"replaceState");n&&(n._pendingStateQueue=[t],n._pendingReplaceState=!0,r(n))},enqueueSetState:function(e,t){var n=o(e,"setState");if(n){var i=n._pendingStateQueue||(n._pendingStateQueue=[]);i.push(t),r(n)}},enqueueElementInternal:function(e,t){e._pendingElement=t,r(e)},validateCallback:function(e,t){e&&"function"!=typeof e?u(!1):void 0}});e.exports=s},function(e,t){"use strict";e.exports="15.0.2"},function(e,t){"use strict";var n={currentScrollLeft:0,currentScrollTop:0,refreshScrollValues:function(e){n.currentScrollLeft=e.x,n.currentScrollTop=e.y}};e.exports=n},function(e,t,n){"use strict";function r(e,t){if(null==t?o(!1):void 0,null==e)return t;var n=Array.isArray(e),r=Array.isArray(t);return n&&r?(e.push.apply(e,t),e):n?(e.push(t),e):r?[e].concat(t):[e,t]}var o=n(1);e.exports=r},function(e,t,n){"use strict";var r=!1;e.exports=r},function(e,t){"use strict";var n=function(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)};e.exports=n},function(e,t){"use strict";function n(e){var t=e&&(r&&e[r]||e[o]);return"function"==typeof t?t:void 0}var r="function"==typeof Symbol&&Symbol.iterator,o="@@iterator";e.exports=n},function(e,t,n){"use strict";function r(e){for(var t;(t=e._renderedNodeType)===o.COMPOSITE;)e=e._renderedComponent;return t===o.NATIVE?e._renderedComponent:t===o.EMPTY?null:void 0}var o=n(156);e.exports=r},function(e,t,n){"use strict";function r(){return!i&&o.canUseDOM&&(i="textContent"in document.documentElement?"textContent":"innerText"),i}var o=n(6),i=null;e.exports=r},function(e,t){"use strict";function n(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&r[e.type]||"textarea"===t)}var r={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};e.exports=n},function(e,t,n){"use strict";var r=n(6),o=n(53),i=n(88),a=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(a=function(e,t){i(e,o(t))})),e.exports=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 u=n(191),s=r(u),c=function(e){function t(e){o(this,t);var n=i(this,Object.getPrototypeOf(t).call(this,"Submit Validation Failed"));return n.errors=e,n}return a(t,e),t}(s["default"]);t["default"]=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.untouch=t.touch=t.setSubmitFailed=t.stopSubmit=t.stopAsyncValidation=t.startSubmit=t.startAsyncValidation=t.reset=t.initialize=t.focus=t.destroy=t.change=t.blur=t.arrayUnshift=t.arraySwap=t.arraySplice=t.arrayShift=t.arrayRemove=t.arrayPush=t.arrayPop=t.arrayInsert=void 0;var r=n(92);t.arrayInsert=function(e,t,n,o){return{type:r.ARRAY_INSERT,meta:{form:e,field:t,index:n},payload:o}},t.arrayPop=function(e,t){return{type:r.ARRAY_POP,meta:{form:e,field:t}}},t.arrayPush=function(e,t,n){return{type:r.ARRAY_PUSH,meta:{form:e,field:t},payload:n}},t.arrayRemove=function(e,t,n){return{type:r.ARRAY_REMOVE,meta:{form:e,field:t,index:n}}},t.arrayShift=function(e,t){return{type:r.ARRAY_SHIFT,meta:{form:e,field:t}}},t.arraySplice=function(e,t,n,o,i){var a={type:r.ARRAY_SPLICE,meta:{form:e,field:t,index:n,removeNum:o}};return void 0!==i&&(a.payload=i),a},t.arraySwap=function(e,t,n,o){if(n===o)throw new Error("Swap indices cannot be equal");if(0>n||0>o)throw new Error("Swap indices cannot be negative");return{type:r.ARRAY_SWAP,meta:{form:e,field:t,indexA:n,indexB:o}}},t.arrayUnshift=function(e,t,n){return{type:r.ARRAY_UNSHIFT,meta:{form:e,field:t},payload:n}},t.blur=function(e,t,n,o){return{type:r.BLUR,meta:{form:e,field:t,touch:o},payload:n}},t.change=function(e,t,n,o){return{type:r.CHANGE,meta:{form:e,field:t,touch:o},payload:n}},t.destroy=function(e){return{type:r.DESTROY,meta:{form:e}}},t.focus=function(e,t){return{type:r.FOCUS,meta:{form:e,field:t}}},t.initialize=function(e,t){return{type:r.INITIALIZE,meta:{form:e},payload:t}},t.reset=function(e){return{type:r.RESET,meta:{form:e}}},t.startAsyncValidation=function(e,t){return{type:r.START_ASYNC_VALIDATION,meta:{form:e,field:t}}},t.startSubmit=function(e){return{type:r.START_SUBMIT,meta:{form:e}}},t.stopAsyncValidation=function(e,t){var n={type:r.STOP_ASYNC_VALIDATION,meta:{form:e},payload:t};return t&&Object.keys(t).length&&(n.error=!0),n},t.stopSubmit=function(e,t){var n={type:r.STOP_SUBMIT,meta:{form:e},payload:t};return t&&Object.keys(t).length&&(n.error=!0),n},t.setSubmitFailed=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;t>o;o++)n[o-1]=arguments[o];return{type:r.SET_SUBMIT_FAILED,meta:{form:e,fields:n},error:!0}},t.touch=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;t>o;o++)n[o-1]=arguments[o];return{type:r.TOUCH,meta:{form:e,fields:n}}},t.untouch=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;t>o;o++)n[o-1]=arguments[o];return{type:r.UNTOUCH,meta:{form:e,fields:n}}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=t.dataKey="value",r=function(e,t){return function(e){e.dataTransfer.setData(n,t)}};t["default"]=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(173),i=r(o),a=function(e){var t=[];if(e)for(var n=0;n<e.length;n++){var r=e[n];r.selected&&t.push(r.value)}return t},u=function(e,t){if((0,i["default"])(e)){if(!t&&e.nativeEvent&&void 0!==e.nativeEvent.text)return e.nativeEvent.text;if(t&&void 0!==e.nativeEvent)return e.nativeEvent.text;var n=e.target,r=n.type,o=n.value,u=n.checked,s=n.files,c=e.dataTransfer;return"checkbox"===r?u:"file"===r?s||c&&c.files:"select-multiple"===r?a(e.target.options):o}return e&&void 0!==e.value?e.value:e};t["default"]=u},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return!!(e&&e.stopPropagation&&e.preventDefault)};t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(173),i=r(o),a=function(e){var t=(0,i["default"])(e);return t&&e.preventDefault(),t};t["default"]=a},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="undefined"!=typeof window&&window.navigator&&window.navigator.product&&"ReactNative"===window.navigator.product;t["default"]=n},function(e,t){"use strict";function n(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];if(0===t.length)return function(e){return e};var r=function(){var e=t[t.length-1],n=t.slice(0,-1);return{v:function(){return n.reduceRight(function(e,t){return t(e)},e.apply(void 0,arguments))}}}();return"object"==typeof r?r.v:void 0}t.__esModule=!0,t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){function r(){y===m&&(y=m.slice())}function i(){return v}function u(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return r(),y.push(e),function(){if(t){t=!1,r();var n=y.indexOf(e);y.splice(n,1)}}}function l(e){if(!(0,a["default"])(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if("undefined"==typeof e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(g)throw new Error("Reducers may not dispatch actions.");try{g=!0,v=h(v,e)}finally{g=!1}for(var t=m=y,n=0;n<t.length;n++)t[n]();return e}function p(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");h=e,l({type:c.INIT})}function f(){var e,t=u;return e={subscribe:function(e){function n(){e.next&&e.next(i())}if("object"!=typeof e)throw new TypeError("Expected the observer to be an object.");n();var r=t(n);return{unsubscribe:r}}},e[s["default"]]=function(){return this},e}var d;if("function"==typeof t&&"undefined"==typeof n&&(n=t,t=void 0),"undefined"!=typeof n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");
return n(o)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var h=e,v=t,m=[],y=m,g=!1;return l({type:c.INIT}),d={dispatch:l,subscribe:u,getState:i,replaceReducer:p},d[s["default"]]=f,d}t.__esModule=!0,t.ActionTypes=void 0,t["default"]=o;var i=n(67),a=r(i),u=n(395),s=r(u),c=t.ActionTypes={INIT:"@@redux/INIT"}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0,t.compose=t.applyMiddleware=t.bindActionCreators=t.combineReducers=t.createStore=void 0;var o=n(177),i=r(o),a=n(394),u=r(a),s=n(393),c=r(s),l=n(392),p=r(l),f=n(176),d=r(f),h=n(179);r(h),t.createStore=i["default"],t.combineReducers=u["default"],t.bindActionCreators=c["default"],t.applyMiddleware=p["default"],t.compose=d["default"]},function(e,t){"use strict";function n(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(t){}}t.__esModule=!0,t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var o=n(4),i=r(o),a=n(290),u=r(a),s=n(54),c=r(s);"undefined"!=typeof window&&(window.initReact=function(e){return u["default"].render(i["default"].createElement(c["default"],e),document.getElementById("content"))})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),i=r(o),a=n(70),u=r(a),s=n(193),c=r(s),l=function(e){return/<p>(.+)<\/p>/.exec((0,u["default"])(e))[1]},p=function(e){var t=e.items;return t&&t.length?i["default"].createElement("ol",{className:c["default"].breadcrumbs},t.map(function(e,n){var r=e.path,o=e.title;return n===t.length-1?i["default"].createElement("li",{key:n,dangerouslySetInnerHTML:{__html:l(o)}}):i["default"].createElement("li",{key:n},i["default"].createElement("a",{href:r,dangerouslySetInnerHTML:{__html:l(o)}}))})):!1};t["default"]=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),i=r(o),a=function(e){var t=e.user,n=e.repo,r=e.type,o=e.width,a=e.height,u=e.count,s=e.large,c="https://ghbtns.com/github-btn.html?user="+t+"&repo="+n+"&type="+r;return u&&(c+="&count=true"),s&&(c+="&size=large"),i["default"].createElement("iframe",{src:c,frameBorder:"0",allowTransparency:"true",scrolling:"0",width:o,height:a,style:{border:"none",width:o,height:a}})};a.propTypes={user:o.PropTypes.string.isRequired,repo:o.PropTypes.string.isRequired,type:o.PropTypes.oneOf(["star","watch","fork","follow"]).isRequired,width:o.PropTypes.number.isRequired,height:o.PropTypes.number.isRequired,count:o.PropTypes.bool,large:o.PropTypes.bool},t["default"]=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),i=r(o),a=n(182),u=r(a),s=function(e){var t=e.version,r=n(194);return i["default"].createElement("div",{className:r.home},i["default"].createElement("div",{className:r.masthead},i["default"].createElement("div",{className:r.logo}),i["default"].createElement("h1",null,"Redux Form"),i["default"].createElement("div",{className:r.version},"v",t),i["default"].createElement("h2",null,"The best way to manage your form state in Redux."),i["default"].createElement(u["default"],{user:"erikras",repo:"redux-form",type:"star",width:160,height:30,count:!0,large:!0}),i["default"].createElement(u["default"],{user:"erikras",repo:"redux-form",type:"fork",width:160,height:30,count:!0,large:!0})),i["default"].createElement("div",{className:r.options},i["default"].createElement("a",{href:"docs/GettingStarted.md"},i["default"].createElement("i",{className:r.start}),"Start Here"),i["default"].createElement("a",{href:"docs/api"},i["default"].createElement("i",{className:r.api}),"API"),i["default"].createElement("a",{href:"examples"},i["default"].createElement("i",{className:r.examples}),"Examples"),i["default"].createElement("a",{href:"docs/faq"},i["default"].createElement("i",{className:r.faq}),"FAQ")))};t["default"]=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":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 i(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 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):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 r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(4),l=r(c),p=n(95),f=r(p),d=n(70),h=r(d),v=n(195),m=r(v),y=function(e){return/<p>(.+)<\/p>/.exec((0,h["default"])(e))[1]},g=function(e){function t(e){i(this,t);var n=a(this,Object.getPrototypeOf(t).call(this,e));return n.open=n.open.bind(n),n.close=n.close.bind(n),n.state={open:!1},n}return u(t,e),s(t,[{key:"renderItem",value:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?0:arguments[2],r=this.props,i=r.path,a=r.url;return l["default"].createElement("a",{href:""+(a||"")+e,className:(0,f["default"])(m["default"]["indent"+n],o({},m["default"].active,e===i)),dangerouslySetInnerHTML:{__html:y(t)}})}},{key:"open",value:function(){this.setState({open:!0})}},{key:"close",value:function(){this.setState({open:!1})}},{key:"render",value:function(){var e=this.state.open,t=this.props.url;return l["default"].createElement("div",{className:(0,f["default"])(m["default"].nav,o({},m["default"].open,e))},l["default"].createElement("button",{type:"button",onClick:this.open}),l["default"].createElement("div",{className:m["default"].overlay,onClick:this.close},l["default"].createElement("i",{className:"fa fa-times"})," Close"),l["default"].createElement("div",{className:m["default"].placeholder}),l["default"].createElement("nav",{className:m["default"].menu},l["default"].createElement("a",{href:t,className:m["default"].brand},"Redux Form"),this.renderItem("/docs/GettingStarted.md","Getting Started"),this.renderItem("/docs/MigrationGuide.md","`v6` Migration Guide"),this.renderItem("/docs/api","API"),this.renderItem("/docs/api/ReduxForm.md","`reduxForm()`",1),this.renderItem("/docs/api/Props.md","`props`",1),this.renderItem("/docs/api/Field.md","`Field`",1),this.renderItem("/docs/api/FieldArray.md","`FieldArray`",1),this.renderItem("/docs/api/FormValueSelector.md","`formValueSelector()`",1),this.renderItem("/docs/api/Reducer.md","`reducer`",1),this.renderItem("/docs/api/SubmissionError.md","`SubmissionError`",1),this.renderItem("/docs/api/ActionCreators.md","Action Creators",1),this.renderItem("/docs/faq","FAQ"),this.renderItem("/examples","Examples"),this.renderItem("/examples/simple","Simple Form",1),this.renderItem("/examples/syncValidation","Sync Validation",1),this.renderItem("/examples/submitValidation","Submit Validation",1),this.renderItem("/examples/asyncValidation","Async Validation",1),this.renderItem("/examples/initializeFromState","Initializing from State",1),this.renderItem("/examples/selectingFormValues","Selecting Form Values",1),this.renderItem("/examples/fieldArrays","Field Arrays",1),this.renderItem("/examples/immutable","Immutable JS",1),this.renderItem("/examples/wizard","Wizard Form",1),this.renderItem("/examples/adapter","Adapter",1),this.renderItem("/examples/material-ui","Material UI",1),this.renderItem("/docs/DocumentationVersions.md","Older Versions")))}}]),t}(c.Component);g.propTypes={path:c.PropTypes.string.isRequired,url:c.PropTypes.string.isRequired},t["default"]=g},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":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 r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(4),a=r(i),u=function(e){var t=e.username,n=e.showUsername,r=e.showCount,i=e.large,u={};return n||(u["data-show-screen-name"]="false"),r||(u["data-show-count"]="false"),i&&(u["data-size"]="large"),a["default"].createElement("a",o({href:"https://twitter.com/"+t,className:"twitter-follow-button"},u),"Follow @",t)};u.propTypes={username:i.PropTypes.string.isRequired,showUserName:i.PropTypes.bool,showCount:i.PropTypes.bool,large:i.PropTypes.bool},t["default"]=u},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),i=r(o),a=n(381),u=n(93),s=r(u),c=function(e){var t=e.form,n=e.format,r=void 0===n?function(e){return JSON.stringify(e,null,2)}:n,o=(0,a.values)({form:t}),u=function(e){var t=e.values;return i["default"].createElement("div",null,i["default"].createElement("h2",null,"Values"),i["default"].createElement(s["default"],{source:r(t)}))},c=o(u);return i["default"].createElement(c,null)};t["default"]=c},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t,n){return[{path:"http://redux-form.com/"+n+"/",title:"Redux Form"},{path:"http://redux-form.com/"+n+"/examples",title:"Examples"},{path:"http://redux-form.com/"+n+"/examples/"+e,title:t}]};t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Values=t.Markdown=t.Code=t.App=t.generateExampleBreadcrumbs=t.render=void 0;var o=n(189),i=r(o),a=n(187),u=r(a),s=n(54),c=r(s),l=n(93),p=r(l),f=n(94),d=r(f),h=n(186),v=r(h);t.render=i["default"],t.generateExampleBreadcrumbs=u["default"],t.App=c["default"],t.Code=p["default"],t.Markdown=d["default"],t.Values=v["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),i=r(o),a=n(291),u=n(54),s=r(u),c=function(e){var t=e.component,n=e.title,r=e.path,o=e.version,u=e.breadcrumbs;return'<!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charSet="utf-8"/>\n <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>\n <title>Redux Form'+(n&&" - "+n)+'</title>\n <link href="http://redux-form.com/'+o+'/bundle.css"\n media="screen, projection" rel="stylesheet" type="text/css"/>\n <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css"\n media="screen, projection" rel="stylesheet" type="text/css"/>\n <meta itemprop="name" content="Redux Form"/>\n <meta property="og:type" content="website"/>\n <meta property="og:title" content="Redux Form"/>\n <meta property="og:site_name" content="Redux Form"/>\n <meta property="og:description" content="The best way to manage your form state in Redux."/>\n <meta property="og:image" content="logo.png"/>\n <meta property="twitter:site" content="@erikras"/>\n <meta property="twitter:creator" content="@erikras"/>\n <style type="text/css">\n body {\n margin: 0;\n }\n </style>\n </head>\n <body>\n <div id="content">\n '+(0,a.renderToString)(i["default"].createElement(s["default"],{version:o,path:r,breadcrumbs:u},t))+'\n </div>\n <script src="http://redux-form.com/'+o+'/bundle.js"></script>\n <script>initReact('+JSON.stringify({version:o,path:r,breadcrumbs:u})+")</script>\n <script>\n (function(i,s,o,g,r,a,m){i[ 'GoogleAnalyticsObject' ] = r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n ga('create', 'UA-69298417-1', 'auto');\n ga('send', 'pageview');\n </script>\n <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>\n </body>\n </html>"};t["default"]=c},function(e,t){(function(t){"use strict";var n="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},r=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,r=n.Prism={util:{encode:function(e){return e instanceof o?new o(e.type,r.util.encode(e.content),e.alias):"Array"===r.util.type(e)?e.map(r.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function(e){var t=r.util.type(e);switch(t){case"Object":var n={};for(var o in e)e.hasOwnProperty(o)&&(n[o]=r.util.clone(e[o]));return n;case"Array":return e.map&&e.map(function(e){return r.util.clone(e)})}return e}},languages:{extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var o in t)n[o]=t[o];return n},insertBefore:function(e,t,n,o){o=o||r.languages;var i=o[e];if(2==arguments.length){n=arguments[1];for(var a in n)n.hasOwnProperty(a)&&(i[a]=n[a]);return i}var u={};for(var s in i)if(i.hasOwnProperty(s)){if(s==t)for(var a in n)n.hasOwnProperty(a)&&(u[a]=n[a]);u[s]=i[s]}return r.languages.DFS(r.languages,function(t,n){n===o[e]&&t!=e&&(this[t]=u)}),o[e]=u},DFS:function(e,t,n,o){o=o||{};for(var i in e)e.hasOwnProperty(i)&&(t.call(e,i,e[i],n||i),"Object"!==r.util.type(e[i])||o[r.util.objId(e[i])]?"Array"!==r.util.type(e[i])||o[r.util.objId(e[i])]||(o[r.util.objId(e[i])]=!0,r.languages.DFS(e[i],t,i,o)):(o[r.util.objId(e[i])]=!0,r.languages.DFS(e[i],t,null,o)))}},plugins:{},highlightAll:function(e,t){var n={callback:t,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",n);for(var o,i=n.elements||document.querySelectorAll(n.selector),a=0;o=i[a++];)r.highlightElement(o,e===!0,n.callback)},highlightElement:function(t,o,i){for(var a,u,s=t;s&&!e.test(s.className);)s=s.parentNode;s&&(a=(s.className.match(e)||[,""])[1],u=r.languages[a]),t.className=t.className.replace(e,"").replace(/\s+/g," ")+" language-"+a,s=t.parentNode,/pre/i.test(s.nodeName)&&(s.className=s.className.replace(e,"").replace(/\s+/g," ")+" language-"+a);var c=t.textContent,l={element:t,language:a,grammar:u,code:c};if(!c||!u)return void r.hooks.run("complete",l);if(r.hooks.run("before-highlight",l),o&&n.Worker){var p=new Worker(r.filename);p.onmessage=function(e){l.highlightedCode=e.data,r.hooks.run("before-insert",l),l.element.innerHTML=l.highlightedCode,i&&i.call(l.element),r.hooks.run("after-highlight",l),r.hooks.run("complete",l)},p.postMessage(JSON.stringify({language:l.language,code:l.code,immediateClose:!0}))}else l.highlightedCode=r.highlight(l.code,l.grammar,l.language),r.hooks.run("before-insert",l),l.element.innerHTML=l.highlightedCode,i&&i.call(t),r.hooks.run("after-highlight",l),r.hooks.run("complete",l)},highlight:function(e,t,n){var i=r.tokenize(e,t);return o.stringify(r.util.encode(i),n)},tokenize:function(e,t){var n=r.Token,o=[e],i=t.rest;if(i){for(var a in i)t[a]=i[a];delete t.rest}e:for(var a in t)if(t.hasOwnProperty(a)&&t[a]){var u=t[a];u="Array"===r.util.type(u)?u:[u];for(var s=0;s<u.length;++s){var c=u[s],l=c.inside,p=!!c.lookbehind,f=!!c.greedy,d=0,h=c.alias;c=c.pattern||c;for(var v=0;v<o.length;v++){var m=o[v];if(o.length>e.length)break e;if(!(m instanceof n)){c.lastIndex=0;var y=c.exec(m),g=1;if(!y&&f&&v!=o.length-1){var b=o[v+1].matchedStr||o[v+1],_=m+b;if(v<o.length-2&&(_+=o[v+2].matchedStr||o[v+2]),c.lastIndex=0,y=c.exec(_),!y)continue;var x=y.index+(p?y[1].length:0);if(x>=m.length)continue;var E=y.index+y[0].length,w=m.length+b.length;g=3,w>=E&&(g=2,_=_.slice(0,w)),m=_}if(y){p&&(d=y[1].length);var x=y.index+d,y=y[0].slice(d),E=x+y.length,C=m.slice(0,x),P=m.slice(E),S=[v,g];C&&S.push(C);var O=new n(a,l?r.tokenize(y,l):y,h,y);S.push(O),P&&S.push(P),Array.prototype.splice.apply(o,S)}}}}}return o},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var o,i=0;o=n[i++];)o(t)}}},o=r.Token=function(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.matchedStr=r||null};if(o.stringify=function(e,t,n){if("string"==typeof e)return e;if("Array"===r.util.type(e))return e.map(function(n){return o.stringify(n,t,e)}).join("");var i={type:e.type,content:o.stringify(e.content,t,n),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:n};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var a="Array"===r.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,a)}r.hooks.run("wrap",i);var u="";for(var s in i.attributes)u+=(u?" ":"")+s+'="'+(i.attributes[s]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+u+">"+i.content+"</"+i.tag+">"},!n.document)return n.addEventListener?(n.addEventListener("message",function(e){var t=JSON.parse(e.data),o=t.language,i=t.code,a=t.immediateClose;n.postMessage(r.highlight(i,r.languages[o],o)),a&&n.close()},!1),n.Prism):n.Prism;var i=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return i&&(r.filename=i.src,document.addEventListener&&!i.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",r.highlightAll)),n.Prism}();"undefined"!=typeof e&&e.exports&&(e.exports=r),"undefined"!=typeof t&&(t.Prism=r),r.languages.markup={comment:/<!--[\w\W]*?-->/,prolog:/<\?[\w\W]+?\?>/,doctype:/<!DOCTYPE[\w\W]+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=.$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},r.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),r.languages.xml=r.languages.markup,r.languages.html=r.languages.markup,r.languages.mathml=r.languages.markup,r.languages.svg=r.languages.markup,r.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},r.languages.css.atrule.inside.rest=r.util.clone(r.languages.css),r.languages.markup&&(r.languages.insertBefore("markup","tag",{style:{pattern:/(<style[\w\W]*?>)[\w\W]*?(?=<\/style>)/i,lookbehind:!0,inside:r.languages.css,alias:"language-css"}}),r.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:r.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:r.languages.css}},alias:"language-css"}},r.languages.markup.tag)),r.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:{pattern:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/},r.languages.javascript=r.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i}),r.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0,greedy:!0}}),r.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\\\|\\?[^\\])*?`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:r.languages.javascript}},string:/[\s\S]+/}}}),r.languages.markup&&r.languages.insertBefore("markup","tag",{script:{pattern:/(<script[\w\W]*?>)[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:r.languages.javascript,alias:"language-javascript"}}),r.languages.js=r.languages.javascript,r.languages.json={property:/".*?"(?=\s*:)/gi,string:/"(?!:)(\\?[^"])*?"(?!:)/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,punctuation:/[{}[\]);,]/g,operator:/:/g,"boolean":/\b(true|false)\b/gi,"null":/\bnull\b/gi},r.languages.jsonp=r.languages.json,!function(e){var t=e.util.clone(e.languages.javascript);e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=/<\/?[\w\.:-]+\s*(?:\s+[\w\.:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+|(\{[\w\W]*?\})))?\s*)*\/?>/i,e.languages.jsx.tag.inside["attr-value"].pattern=/=[^\{](?:('|")[\w\W]*?(\1)|[^\s>]+)/i;var n=e.util.clone(e.languages.jsx);delete n.punctuation,n=e.languages.insertBefore("jsx","operator",{punctuation:/=(?={)|[{}[\];(),.:]/},{jsx:n}),e.languages.insertBefore("inside","attr-value",{script:{pattern:/=(\{(?:\{[^}]*\}|[^}])+\})/i,inside:n,alias:"language-javascript"}},e.languages.jsx.tag)}(r)}).call(t,function(){return this}())},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 o=function(e,t,n){for(var r=!0;r;){var o=e,i=t,a=n;r=!1,null===o&&(o=Function.prototype);var u=Object.getOwnPropertyDescriptor(o,i);if(void 0!==u){if("value"in u)return u.value;var s=u.get;if(void 0===s)return;return s.call(a)}var c=Object.getPrototypeOf(o);if(null===c)return;e=c,t=i,n=a,r=!0,u=c=void 0}},i=function(e){function t(){var e=arguments.length<=0||void 0===arguments[0]?"":arguments[0];return n(this,t),o(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),Object.defineProperty(this,"message",{enumerable:!1,value:e,writable:!0}),Object.defineProperty(this,"name",{enumerable:!1,value:this.constructor.name,writable:!0}),Error.hasOwnProperty("captureStackTrace")?void Error.captureStackTrace(this,this.constructor):void Object.defineProperty(this,"stack",{enumerable:!1,value:new Error(e).stack,writable:!0})}return r(t,e),t}(Error);t["default"]=i,e.exports=t["default"]},function(e,t){e.exports={app:"app___3P8ep",topNav:"topNav___sBW8S",brand:"brand___YAZl-",github:"github___3-vRv",contentAndFooter:"contentAndFooter___kE2nt",content:"content___3TVHp",home:"home___2XyPG",hasNav:"hasNav___1KF_W",footer:"footer___1oh0h",help:"help___3OayI"}},function(e,t){e.exports={breadcrumbs:"breadcrumbs___1BHo6"}},function(e,t){e.exports={home:"home___381a9",masthead:"masthead___MGNF0",logo:"logo___hP7wi",content:"content___2vYdp",version:"version___2mbZo",github:"github___mrRv3",options:"options___2Tyc4",start:"start___1WlUb",api:"api___1hCrr",examples:"examples___2H_mp",faq:"faq___2mIT0"}},function(e,t){e.exports={nav:"nav___11xa5",placeholder:"placeholder___TzF1K",overlay:"overlay___1GMox",menu:"menu___12xDU",active:"active___2eU59",brand:"brand___1qRUu",indent1:"indent1___4iVnL",indent2:"indent2___2PiOO",open:"open___3Bk_k"}},function(e,t){"use strict";function n(e){return e.replace(r,function(e,t){return t.toUpperCase()})}var r=/-(.)/g;e.exports=n},function(e,t,n){"use strict";function r(e){return o(e.replace(i,"ms-"))}var o=n(196),i=/^-ms-/;e.exports=r},function(e,t,n){"use strict";function r(e,t){return e&&t?e===t?!0:o(e)?!1:o(t)?r(e,t.parentNode):e.contains?e.contains(t):e.compareDocumentPosition?!!(16&e.compareDocumentPosition(t)):!1:!1}var o=n(205);e.exports=r},function(e,t,n){"use strict";function r(e){var t=e.length;if(Array.isArray(e)||"object"!=typeof e&&"function"!=typeof e?a(!1):void 0,"number"!=typeof t?a(!1):void 0,0===t||t-1 in e?void 0:a(!1),"function"==typeof e.callee?a(!1):void 0,e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(n){}for(var r=Array(t),o=0;t>o;o++)r[o]=e[o];return r}function o(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}function i(e){return o(e)?Array.isArray(e)?e.slice():r(e):[e]}var a=n(1);e.exports=i},function(e,t,n){"use strict";function r(e){var t=e.match(l);return t&&t[1].toLowerCase()}function o(e,t){var n=c;c?void 0:s(!1);var o=r(e),i=o&&u(o);if(i){n.innerHTML=i[1]+e+i[2];for(var l=i[0];l--;)n=n.lastChild}else n.innerHTML=e;var p=n.getElementsByTagName("script");p.length&&(t?void 0:s(!1),a(p).forEach(t));for(var f=Array.from(n.childNodes);n.lastChild;)n.removeChild(n.lastChild);return f}var i=n(6),a=n(199),u=n(99),s=n(1),c=i.canUseDOM?document.createElement("div"):null,l=/^\s*<(\w+)/;e.exports=o},function(e,t){"use strict";function n(e){return e===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:e.scrollLeft,y:e.scrollTop}}e.exports=n},function(e,t){"use strict";function n(e){return e.replace(r,"-$1").toLowerCase()}var r=/([A-Z])/g;e.exports=n},function(e,t,n){"use strict";function r(e){return o(e).replace(i,"-ms-")}var o=n(202),i=/^ms-/;e.exports=r},function(e,t){"use strict";function n(e){return!(!e||!("function"==typeof Node?e instanceof Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}e.exports=n},function(e,t,n){"use strict";function r(e){return o(e)&&3==e.nodeType}var o=n(204);e.exports=r},function(e,t){"use strict";function n(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}e.exports=n},function(e,t,n){var r=n(21),o=n(8),i=r(o,"DataView");e.exports=i},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var o=n(241),i=n(242),a=n(243),u=n(244),s=n(245);r.prototype.clear=o,r.prototype["delete"]=i,r.prototype.get=a,r.prototype.has=u,r.prototype.set=s,e.exports=r},function(e,t,n){var r=n(21),o=n(8),i=r(o,"Promise");e.exports=i},function(e,t,n){var r=n(21),o=n(8),i=r(o,"Set");e.exports=i},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.__data__=new o;++t<n;)this.add(e[t])}var o=n(58),i=n(263),a=n(264);r.prototype.add=r.prototype.push=i,r.prototype.has=a,e.exports=r},function(e,t,n){var r=n(8),o=r.Uint8Array;e.exports=o},function(e,t){function n(e,t){for(var n=-1,r=e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}e.exports=n},function(e,t,n){function r(e,t){var n=!0;return o(e,function(e,r,o){return n=!!t(e,r,o)}),n}var o=n(108);e.exports=r},function(e,t,n){var r=n(230),o=r();e.exports=o},function(e,t){function n(e,t){return t in Object(e)}e.exports=n},function(e,t,n){function r(e,t,n,r,m,g){var b=c(e),_=c(t),x=h,E=h;b||(x=s(e),x=x==d?v:x),_||(E=s(t),E=E==d?v:E);var w=x==v&&!l(e),C=E==v&&!l(t),P=x==E;if(P&&!w)return g||(g=new o),b||p(e)?i(e,t,n,r,m,g):a(e,t,x,n,r,m,g);if(!(m&f)){var S=w&&y.call(e,"__wrapped__"),O=C&&y.call(t,"__wrapped__");if(S||O){var T=S?e.value():e,A=O?t.value():t;return g||(g=new o),n(T,A,r,m,g)}}return P?(g||(g=new o),u(e,t,n,r,m,g)):!1}var o=n(103),i=n(120),a=n(235),u=n(236),s=n(123),c=n(9),l=n(65),p=n(279),f=2,d="[object Arguments]",h="[object Array]",v="[object Object]",m=Object.prototype,y=m.hasOwnProperty;e.exports=r},function(e,t,n){function r(e,t,n,r){var s=n.length,c=s,l=!r;if(null==e)return!c;for(e=Object(e);s--;){var p=n[s];if(l&&p[2]?p[1]!==e[p[0]]:!(p[0]in e))return!1}for(;++s<c;){p=n[s];var f=p[0],d=e[f],h=p[1];if(l&&p[2]){if(void 0===d&&!(f in e))return!1}else{var v=new o;if(r)var m=r(d,h,f,e,t,v);if(!(void 0===m?i(h,d,r,a|u,v):m))return!1}}return!0}var o=n(103),i=n(61),a=1,u=2;e.exports=r},function(e,t){function n(e){return r(Object(e))}var r=Object.keys;e.exports=n},function(e,t,n){function r(e){var t=i(e);return 1==t.length&&t[0][2]?a(t[0][0],t[0][1]):function(n){return n===e||o(n,e,t)}}var o=n(218),i=n(239),a=n(127);e.exports=r},function(e,t,n){function r(e,t){return u(e)&&s(t)?c(l(e),t):function(n){var r=i(n,e);return void 0===r&&r===t?a(n,e):o(t,r,void 0,p|f)}}var o=n(61),i=n(274),a=n(275),u=n(40),s=n(125),c=n(127),l=n(26),p=1,f=2;e.exports=r},function(e,t,n){function r(e){return function(t){return o(t,e)}}var o=n(110);e.exports=r},function(e,t,n){function r(e,t){var n;return o(e,function(e,r,o){return n=t(e,r,o),!n}),!!n}var o=n(108);e.exports=r},function(e,t){function n(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}e.exports=n},function(e,t,n){function r(e,t){return o(t,function(t){return[t,e[t]]})}var o=n(106);e.exports=r},function(e,t,n){function r(e){if("string"==typeof e)return e;if(i(e))return s?s.call(e):"";var t=e+"";return"0"==t&&1/e==-a?"-0":t}var o=n(104),i=n(27),a=1/0,u=o?o.prototype:void 0,s=u?u.toString:void 0;e.exports=r},function(e,t){function n(e){return e&&e.Object===Object?e:null}e.exports=n},function(e,t){function n(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&r++;return r}e.exports=n},function(e,t,n){function r(e,t){return function(n,r){if(null==n)return n;if(!o(n))return e(n,r);for(var i=n.length,a=t?i:-1,u=Object(n);(t?a--:++a<i)&&r(u[a],a,u)!==!1;);return n}}var o=n(42);e.exports=r},function(e,t){function n(e){return function(t,n,r){for(var o=-1,i=Object(t),a=r(t),u=a.length;u--;){var s=a[e?u:++o];if(n(i[s],s,i)===!1)break}return t}}e.exports=n},function(e,t,n){function r(e,t,n){function r(){var t=this&&this!==i&&this instanceof r?s:e;return t.apply(u?n:this,arguments)}var u=t&a,s=o(e);return r}var o=n(36),i=n(8),a=1;e.exports=r},function(e,t,n){function r(e,t,n){function r(){for(var i=arguments.length,f=Array(i),d=i,h=s(r);d--;)f[d]=arguments[d];var v=3>i&&f[0]!==h&&f[i-1]!==h?[]:c(f,h);if(i-=v.length,n>i)return u(e,t,a,r.placeholder,void 0,f,v,void 0,void 0,n-i);var m=this&&this!==l&&this instanceof r?p:e;return o(m,this,f)}var p=i(e);return r}var o=n(59),i=n(36),a=n(117),u=n(118),s=n(37),c=n(25),l=n(8);e.exports=r},function(e,t,n){function r(e,t,n,r){function s(){for(var t=-1,i=arguments.length,u=-1,p=r.length,f=Array(p+i),d=this&&this!==a&&this instanceof s?l:e;++u<p;)f[u]=r[u];for(;i--;)f[u++]=arguments[++t];return o(d,c?n:this,f)}var c=t&u,l=i(e);return s}var o=n(59),i=n(36),a=n(8),u=1;e.exports=r},function(e,t,n){function r(e){return function(t){var n=i(t);return n==s?a(t):n==c?u(t):o(t,e(t))}}var o=n(225),i=n(123),a=n(126),u=n(266),s="[object Map]",c="[object Set]";e.exports=r},function(e,t,n){function r(e,t,n,r,o,E,C){
switch(n){case x:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case _:return!(e.byteLength!=t.byteLength||!r(new i(e),new i(t)));case p:case f:return+e==+t;case d:return e.name==t.name&&e.message==t.message;case v:return e!=+e?t!=+t:e==+t;case m:case g:return e==t+"";case h:var P=u;case y:var S=E&l;if(P||(P=s),e.size!=t.size&&!S)return!1;var O=C.get(e);return O?O==t:(E|=c,C.set(e,t),a(P(e),P(t),r,o,E,C));case b:if(w)return w.call(e)==w.call(t)}return!1}var o=n(104),i=n(212),a=n(120),u=n(126),s=n(265),c=1,l=2,p="[object Boolean]",f="[object Date]",d="[object Error]",h="[object Map]",v="[object Number]",m="[object RegExp]",y="[object Set]",g="[object String]",b="[object Symbol]",_="[object ArrayBuffer]",x="[object DataView]",E=o?o.prototype:void 0,w=E?E.valueOf:void 0;e.exports=r},function(e,t,n){function r(e,t,n,r,u,s){var c=u&a,l=i(e),p=l.length,f=i(t),d=f.length;if(p!=d&&!c)return!1;for(var h=p;h--;){var v=l[h];if(!(c?v in t:o(t,v)))return!1}var m=s.get(e);if(m)return m==t;var y=!0;s.set(e,t);for(var g=c;++h<p;){v=l[h];var b=e[v],_=t[v];if(r)var x=c?r(_,b,v,t,e,s):r(b,_,v,e,t,s);if(!(void 0===x?b===_||n(b,_,r,u,s):x)){y=!1;break}g||(g="constructor"==v)}if(y&&!g){var E=e.constructor,w=t.constructor;E!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof E&&E instanceof E&&"function"==typeof w&&w instanceof w)&&(y=!1)}return s["delete"](e),y}var o=n(111),i=n(68),a=2;e.exports=r},function(e,t,n){function r(e){for(var t=e.name+"",n=o[t],r=a.call(o,t)?n.length:0;r--;){var i=n[r],u=i.func;if(null==u||u==e)return i.name}return t}var o=n(261),i=Object.prototype,a=i.hasOwnProperty;e.exports=r},function(e,t,n){var r=n(112),o=r("length");e.exports=o},function(e,t,n){function r(e){for(var t=i(e),n=t.length;n--;)t[n][2]=o(t[n][1]);return t}var o=n(125),i=n(287);e.exports=r},function(e,t,n){function r(e,t,n){t=s(t,e)?[t]:o(t);for(var r,f=-1,d=t.length;++f<d;){var h=p(t[f]);if(!(r=null!=e&&n(e,h)))break;e=e[h]}if(r)return r;var d=e?e.length:0;return!!d&&c(d)&&u(h,d)&&(a(e)||l(e)||i(e))}var o=n(114),i=n(134),a=n(9),u=n(39),s=n(40),c=n(43),l=n(135),p=n(26);e.exports=r},function(e,t,n){function r(){this.__data__=o?o(null):{}}var o=n(41);e.exports=r},function(e,t){function n(e){return this.has(e)&&delete this.__data__[e]}e.exports=n},function(e,t,n){function r(e){var t=this.__data__;if(o){var n=t[e];return n===i?void 0:n}return u.call(t,e)?t[e]:void 0}var o=n(41),i="__lodash_hash_undefined__",a=Object.prototype,u=a.hasOwnProperty;e.exports=r},function(e,t,n){function r(e){var t=this.__data__;return o?void 0!==t[e]:a.call(t,e)}var o=n(41),i=Object.prototype,a=i.hasOwnProperty;e.exports=r},function(e,t,n){function r(e,t){var n=this.__data__;return n[e]=o&&void 0===t?i:t,this}var o=n(41),i="__lodash_hash_undefined__";e.exports=r},function(e,t,n){function r(e){var t=e?e.length:void 0;return u(t)&&(a(e)||s(e)||i(e))?o(t,String):null}var o=n(224),i=n(134),a=n(9),u=n(43),s=n(135);e.exports=r},function(e,t){function n(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}e.exports=n},function(e,t,n){function r(e){var t=a(e),n=u[t];if("function"!=typeof n||!(t in o.prototype))return!1;if(e===n)return!0;var r=i(n);return!!r&&e===r[0]}var o=n(57),i=n(121),a=n(237),u=n(289);e.exports=r},function(e,t){function n(e){var t=e&&e.constructor,n="function"==typeof t&&t.prototype||r;return e===n}var r=Object.prototype;e.exports=n},function(e,t){function n(){this.__data__=[]}e.exports=n},function(e,t,n){function r(e){var t=this.__data__,n=o(t,e);if(0>n)return!1;var r=t.length-1;return n==r?t.pop():a.call(t,n,1),!0}var o=n(35),i=Array.prototype,a=i.splice;e.exports=r},function(e,t,n){function r(e){var t=this.__data__,n=o(t,e);return 0>n?void 0:t[n][1]}var o=n(35);e.exports=r},function(e,t,n){function r(e){return o(this.__data__,e)>-1}var o=n(35);e.exports=r},function(e,t,n){function r(e,t){var n=this.__data__,r=o(n,e);return 0>r?n.push([e,t]):n[r][1]=t,this}var o=n(35);e.exports=r},function(e,t,n){function r(){this.__data__={hash:new o,map:new(a||i),string:new o}}var o=n(208),i=n(34),a=n(102);e.exports=r},function(e,t,n){function r(e){return o(this,e)["delete"](e)}var o=n(38);e.exports=r},function(e,t,n){function r(e){return o(this,e).get(e)}var o=n(38);e.exports=r},function(e,t,n){function r(e){return o(this,e).has(e)}var o=n(38);e.exports=r},function(e,t,n){function r(e,t){return o(this,e).set(e,t),this}var o=n(38);e.exports=r},function(e,t,n){function r(e,t){var n=e[1],r=t[1],v=n|r,m=(s|c|f)>v,y=r==f&&n==p||r==f&&n==d&&e[7].length<=t[8]||r==(f|d)&&t[7].length<=t[8]&&n==p;if(!m&&!y)return e;r&s&&(e[2]=t[2],v|=n&s?0:l);var g=t[3];if(g){var b=e[3];e[3]=b?o(b,g,t[4]):g,e[4]=b?a(e[3],u):t[4]}return g=t[5],g&&(b=e[5],e[5]=b?i(b,g,t[6]):g,e[6]=b?a(e[5],u):t[6]),g=t[7],g&&(e[7]=g),r&f&&(e[8]=null==e[8]?t[8]:h(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=v,e}var o=n(115),i=n(116),a=n(25),u="__lodash_placeholder__",s=1,c=2,l=4,p=8,f=128,d=256,h=Math.min;e.exports=r},function(e,t){var n={};e.exports=n},function(e,t,n){function r(e,t){for(var n=e.length,r=a(t.length,n),u=o(e);r--;){var s=t[r];e[r]=i(s,n)?u[s]:void 0}return e}var o=n(64),i=n(39),a=Math.min;e.exports=r},function(e,t){function n(e){return this.__data__.set(e,r),this}var r="__lodash_hash_undefined__";e.exports=n},function(e,t){function n(e){return this.__data__.has(e)}e.exports=n},function(e,t){function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}e.exports=n},function(e,t){function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}e.exports=n},function(e,t,n){function r(){this.__data__=new o}var o=n(34);e.exports=r},function(e,t){function n(e){return this.__data__["delete"](e)}e.exports=n},function(e,t){function n(e){return this.__data__.get(e)}e.exports=n},function(e,t){function n(e){return this.__data__.has(e)}e.exports=n},function(e,t,n){function r(e,t){var n=this.__data__;return n instanceof o&&n.__data__.length==a&&(n=this.__data__=new i(n.__data__)),n.set(e,t),this}var o=n(34),i=n(58),a=200;e.exports=r},function(e,t,n){function r(e){if(e instanceof o)return e.clone();var t=new i(e.__wrapped__,e.__chain__);return t.__actions__=a(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var o=n(57),i=n(101),a=n(64);e.exports=r},function(e,t,n){function r(e,t,n){var r=u(e)?o:i;return n&&s(e,t,n)&&(t=void 0),r(e,a(t,3))}var o=n(213),i=n(214),a=n(62),u=n(9),s=n(124);e.exports=r},function(e,t,n){function r(e,t,n){var r=null==e?void 0:o(e,t);return void 0===r?n:r}var o=n(110);e.exports=r},function(e,t,n){function r(e,t){return null!=e&&i(e,t,o)}var o=n(216),i=n(240);e.exports=r},function(e,t,n){function r(e){return i(e)&&o(e)}var o=n(42),i=n(18);e.exports=r},function(e,t,n){function r(e,t,n){n="function"==typeof n?n:void 0;var r=n?n(e,t):void 0;return void 0===r?o(e,t,n):!!r}var o=n(61);e.exports=r},function(e,t,n){function r(e){if(!a(e))return!1;var t=o(e)||i(e)?d:c;return t.test(u(e))}var o=n(66),i=n(65),a=n(15),u=n(131),s=/[\\^$.*+?()[\]{}|]/g,c=/^\[object .+?Constructor\]$/,l=Object.prototype,p=Function.prototype.toString,f=l.hasOwnProperty,d=RegExp("^"+p.call(f).replace(s,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=r},function(e,t,n){function r(e){return i(e)&&o(e.length)&&!!M[N.call(e)]}var o=n(43),i=n(18),a="[object Arguments]",u="[object Array]",s="[object Boolean]",c="[object Date]",l="[object Error]",p="[object Function]",f="[object Map]",d="[object Number]",h="[object Object]",v="[object RegExp]",m="[object Set]",y="[object String]",g="[object WeakMap]",b="[object ArrayBuffer]",_="[object DataView]",x="[object Float32Array]",E="[object Float64Array]",w="[object Int8Array]",C="[object Int16Array]",P="[object Int32Array]",S="[object Uint8Array]",O="[object Uint8ClampedArray]",T="[object Uint16Array]",A="[object Uint32Array]",M={};M[x]=M[E]=M[w]=M[C]=M[P]=M[S]=M[O]=M[T]=M[A]=!0,M[a]=M[u]=M[b]=M[s]=M[_]=M[c]=M[l]=M[p]=M[f]=M[d]=M[h]=M[v]=M[m]=M[y]=M[g]=!1;var k=Object.prototype,N=k.toString;e.exports=r},function(e,t,n){function r(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(i);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(r.Cache||o),n}var o=n(58),i="Expected a function";r.Cache=o,e.exports=r},function(e,t){var n=Date.now;e.exports=n},function(e,t,n){var r=n(119),o=n(37),i=n(25),a=n(137),u=64,s=a(function(e,t){var n=i(t,o(s));return r(e,u,void 0,t,n)});s.placeholder={},e.exports=s},function(e,t,n){function r(e){return a(e)?o(u(e)):i(e)}var o=n(112),i=n(222),a=n(40),u=n(26);e.exports=r},function(e,t,n){function r(e,t,n){var r=u(e)?o:a;return n&&s(e,t,n)&&(t=void 0),r(e,i(t,3))}var o=n(107),i=n(62),a=n(223),u=n(9),s=n(124);e.exports=r},function(e,t,n){function r(e){if(!e)return 0===e?e:0;if(e=o(e),e===i||e===-i){var t=0>e?-1:1;return t*a}return e===e?e:0}var o=n(286),i=1/0,a=1.7976931348623157e308;e.exports=r},function(e,t,n){function r(e){if("number"==typeof e)return e;if(a(e))return u;if(i(e)){var t=o(e.valueOf)?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var n=l.test(e);return n||p.test(e)?f(e.slice(2),n?2:8):c.test(e)?u:+e}var o=n(66),i=n(15),a=n(27),u=NaN,s=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,p=/^0o[0-7]+$/i,f=parseInt;e.exports=r},function(e,t,n){var r=n(234),o=n(68),i=r(o);e.exports=i},function(e,t,n){function r(e){return null==e?"":o(e)}var o=n(226);e.exports=r},function(e,t,n){function r(e){if(s(e)&&!u(e)&&!(e instanceof o)){if(e instanceof i)return e;if(p.call(e,"__wrapped__"))return c(e)}return new i(e)}var o=n(57),i=n(101),a=n(63),u=n(9),s=n(18),c=n(272),l=Object.prototype,p=l.hasOwnProperty;r.prototype=a.prototype,r.prototype.constructor=r,e.exports=r},function(e,t,n){"use strict";e.exports=n(311)},function(e,t,n){"use strict";e.exports=n(322)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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)}t.__esModule=!0,t["default"]=void 0;var u=n(4),s=n(139),c=r(s),l=n(140),p=(r(l),function(e){function t(n,r){o(this,t);var a=i(this,e.call(this,n,r));return a.store=n.store,a}return a(t,e),t.prototype.getChildContext=function(){return{store:this.store}},t.prototype.render=function(){var e=this.props.children;return u.Children.only(e)},t}(u.Component));t["default"]=p,p.propTypes={store:c["default"].isRequired,children:u.PropTypes.element.isRequired},p.childContextTypes={store:c["default"].isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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)}function u(e){return e.displayName||e.name||"Component"}function s(e,t){try{return e.apply(t)}catch(n){return O.value=n,O}}function c(e,t,n){var r=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],c=Boolean(e),f=e||C,h=void 0;h="function"==typeof t?t:t?(0,y["default"])(t):P;var m=n||S,g=r.pure,b=void 0===g?!0:g,_=r.withRef,E=void 0===_?!1:_,A=b&&m!==S,M=T++;return function(e){function t(e,t,n){var r=m(e,t,n);return r}var n="Connect("+u(e)+")",r=function(r){function u(e,t){o(this,u);var a=i(this,r.call(this,e,t));a.version=M,a.store=e.store||t.store,(0,w["default"])(a.store,'Could not find "store" in either the context or '+('props of "'+n+'". ')+"Either wrap the root component in a <Provider>, "+('or explicitly pass "store" as a prop to "'+n+'".'));var s=a.store.getState();return a.state={storeState:s},a.clearCache(),a}return a(u,r),u.prototype.shouldComponentUpdate=function(){return!b||this.haveOwnPropsChanged||this.hasStoreStateChanged},u.prototype.computeStateProps=function(e,t){if(!this.finalMapStateToProps)return this.configureFinalMapState(e,t);var n=e.getState(),r=this.doStatePropsDependOnOwnProps?this.finalMapStateToProps(n,t):this.finalMapStateToProps(n);return r},u.prototype.configureFinalMapState=function(e,t){var n=f(e.getState(),t),r="function"==typeof n;return this.finalMapStateToProps=r?n:f,this.doStatePropsDependOnOwnProps=1!==this.finalMapStateToProps.length,r?this.computeStateProps(e,t):n},u.prototype.computeDispatchProps=function(e,t){if(!this.finalMapDispatchToProps)return this.configureFinalMapDispatch(e,t);var n=e.dispatch,r=this.doDispatchPropsDependOnOwnProps?this.finalMapDispatchToProps(n,t):this.finalMapDispatchToProps(n);return r},u.prototype.configureFinalMapDispatch=function(e,t){var n=h(e.dispatch,t),r="function"==typeof n;return this.finalMapDispatchToProps=r?n:h,this.doDispatchPropsDependOnOwnProps=1!==this.finalMapDispatchToProps.length,r?this.computeDispatchProps(e,t):n},u.prototype.updateStatePropsIfNeeded=function(){var e=this.computeStateProps(this.store,this.props);return this.stateProps&&(0,v["default"])(e,this.stateProps)?!1:(this.stateProps=e,!0)},u.prototype.updateDispatchPropsIfNeeded=function(){var e=this.computeDispatchProps(this.store,this.props);return this.dispatchProps&&(0,v["default"])(e,this.dispatchProps)?!1:(this.dispatchProps=e,!0)},u.prototype.updateMergedPropsIfNeeded=function(){var e=t(this.stateProps,this.dispatchProps,this.props);return this.mergedProps&&A&&(0,v["default"])(e,this.mergedProps)?!1:(this.mergedProps=e,!0)},u.prototype.isSubscribed=function(){return"function"==typeof this.unsubscribe},u.prototype.trySubscribe=function(){c&&!this.unsubscribe&&(this.unsubscribe=this.store.subscribe(this.handleChange.bind(this)),this.handleChange())},u.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},u.prototype.componentDidMount=function(){this.trySubscribe()},u.prototype.componentWillReceiveProps=function(e){b&&(0,v["default"])(e,this.props)||(this.haveOwnPropsChanged=!0)},u.prototype.componentWillUnmount=function(){this.tryUnsubscribe(),this.clearCache()},u.prototype.clearCache=function(){this.dispatchProps=null,this.stateProps=null,this.mergedProps=null,this.haveOwnPropsChanged=!0,this.hasStoreStateChanged=!0,this.haveStatePropsBeenPrecalculated=!1,this.statePropsPrecalculationError=null,this.renderedElement=null,this.finalMapDispatchToProps=null,this.finalMapStateToProps=null},u.prototype.handleChange=function(){if(this.unsubscribe){var e=this.store.getState(),t=this.state.storeState;if(!b||t!==e){if(b&&!this.doStatePropsDependOnOwnProps){var n=s(this.updateStatePropsIfNeeded,this);if(!n)return;n===O&&(this.statePropsPrecalculationError=O.value),this.haveStatePropsBeenPrecalculated=!0}this.hasStoreStateChanged=!0,this.setState({storeState:e})}}},u.prototype.getWrappedInstance=function(){return(0,w["default"])(E,"To access the wrapped instance, you need to specify { withRef: true } as the fourth argument of the connect() call."),this.refs.wrappedInstance},u.prototype.render=function(){var t=this.haveOwnPropsChanged,n=this.hasStoreStateChanged,r=this.haveStatePropsBeenPrecalculated,o=this.statePropsPrecalculationError,i=this.renderedElement;if(this.haveOwnPropsChanged=!1,this.hasStoreStateChanged=!1,this.haveStatePropsBeenPrecalculated=!1,this.statePropsPrecalculationError=null,o)throw o;var a=!0,u=!0;b&&i&&(a=n||t&&this.doStatePropsDependOnOwnProps,u=t&&this.doDispatchPropsDependOnOwnProps);var s=!1,c=!1;r?s=!0:a&&(s=this.updateStatePropsIfNeeded()),u&&(c=this.updateDispatchPropsIfNeeded());var f=!0;return f=s||c||t?this.updateMergedPropsIfNeeded():!1,!f&&i?i:(E?this.renderedElement=(0,p.createElement)(e,l({},this.mergedProps,{ref:"wrappedInstance"})):this.renderedElement=(0,p.createElement)(e,this.mergedProps),this.renderedElement)},u}(p.Component);return r.displayName=n,r.WrappedComponent=e,r.contextTypes={store:d["default"]},r.propTypes={store:d["default"]},(0,x["default"])(r,e)}}var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.__esModule=!0,t["default"]=c;var p=n(4),f=n(139),d=r(f),h=n(294),v=r(h),m=n(295),y=r(m),g=n(140),b=(r(g),n(67)),_=(r(b),n(100)),x=r(_),E=n(33),w=r(E),C=function(e){return{}},P=function(e){return{dispatch:e}},S=function(e,t,n){return l({},n,e,t)},O={value:null},T=0},function(e,t){"use strict";function n(e,t){if(e===t)return!0;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=Object.prototype.hasOwnProperty,i=0;i<n.length;i++)if(!o.call(t,n[i])||e[n[i]]!==t[n[i]])return!1;return!0}t.__esModule=!0,t["default"]=n},function(e,t,n){"use strict";function r(e){return function(t){return(0,o.bindActionCreators)(e,t)}}t.__esModule=!0,t["default"]=r;var o=n(178)},function(e,t,n){"use strict";var r=n(5),o=n(97),i={focusDOMComponent:function(){o(r.getNodeFromInstance(this))}};e.exports=i},function(e,t,n){"use strict";function r(){var e=window.opera;return"object"==typeof e&&"function"==typeof e.version&&parseInt(e.version(),10)<=12}function o(e){return(e.ctrlKey||e.altKey||e.metaKey)&&!(e.ctrlKey&&e.altKey)}function i(e){switch(e){case T.topCompositionStart:return A.compositionStart;case T.topCompositionEnd:return A.compositionEnd;case T.topCompositionUpdate:return A.compositionUpdate}}function a(e,t){return e===T.topKeyDown&&t.keyCode===x}function u(e,t){switch(e){case T.topKeyUp:return-1!==_.indexOf(t.keyCode);case T.topKeyDown:return t.keyCode!==x;case T.topKeyPress:case T.topMouseDown:case T.topBlur:return!0;default:return!1}}function s(e){var t=e.detail;return"object"==typeof t&&"data"in t?t.data:null}function c(e,t,n,r){var o,c;if(E?o=i(e):k?u(e,n)&&(o=A.compositionEnd):a(e,n)&&(o=A.compositionStart),!o)return null;P&&(k||o!==A.compositionStart?o===A.compositionEnd&&k&&(c=k.getData()):k=m.getPooled(r));var l=y.getPooled(o,t,n,r);if(c)l.data=c;else{var p=s(n);null!==p&&(l.data=p)}return h.accumulateTwoPhaseDispatches(l),l}function l(e,t){switch(e){case T.topCompositionEnd:return s(t);case T.topKeyPress:var n=t.which;return n!==S?null:(M=!0,O);case T.topTextInput:var r=t.data;return r===O&&M?null:r;default:return null}}function p(e,t){if(k){if(e===T.topCompositionEnd||u(e,t)){var n=k.getData();return m.release(k),k=null,n}return null}switch(e){case T.topPaste:return null;case T.topKeyPress:return t.which&&!o(t)?String.fromCharCode(t.which):null;case T.topCompositionEnd:return P?null:t.data;default:return null}}function f(e,t,n,r){var o;if(o=C?l(e,n):p(e,n),!o)return null;var i=g.getPooled(A.beforeInput,t,n,r);return i.data=o,h.accumulateTwoPhaseDispatches(i),i}var d=n(12),h=n(29),v=n(6),m=n(304),y=n(345),g=n(348),b=n(14),_=[9,13,27,32],x=229,E=v.canUseDOM&&"CompositionEvent"in window,w=null;v.canUseDOM&&"documentMode"in document&&(w=document.documentMode);var C=v.canUseDOM&&"TextEvent"in window&&!w&&!r(),P=v.canUseDOM&&(!E||w&&w>8&&11>=w),S=32,O=String.fromCharCode(S),T=d.topLevelTypes,A={beforeInput:{phasedRegistrationNames:{bubbled:b({onBeforeInput:null}),captured:b({onBeforeInputCapture:null})},dependencies:[T.topCompositionEnd,T.topKeyPress,T.topTextInput,T.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:b({onCompositionEnd:null}),captured:b({onCompositionEndCapture:null})},dependencies:[T.topBlur,T.topCompositionEnd,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:b({onCompositionStart:null}),captured:b({onCompositionStartCapture:null})},dependencies:[T.topBlur,T.topCompositionStart,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:b({onCompositionUpdate:null}),captured:b({onCompositionUpdateCapture:null})},dependencies:[T.topBlur,T.topCompositionUpdate,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]}},M=!1,k=null,N={eventTypes:A,extractEvents:function(e,t,n,r){return[c(e,t,n,r),f(e,t,n,r)]}};e.exports=N},function(e,t,n){"use strict";var r=n(141),o=n(6),i=n(7),a=(n(197),n(354)),u=n(203),s=n(206),c=(n(2),s(function(e){return u(e)})),l=!1,p="cssFloat";if(o.canUseDOM){var f=document.createElement("div").style;try{f.font=""}catch(d){l=!0}void 0===document.documentElement.style.cssFloat&&(p="styleFloat")}var h={createMarkupForStyles:function(e,t){var n="";for(var r in e)if(e.hasOwnProperty(r)){var o=e[r];null!=o&&(n+=c(r)+":",n+=a(r,o,t)+";")}return n||null},setValueForStyles:function(e,t,n){var o=e.style;for(var i in t)if(t.hasOwnProperty(i)){var u=a(i,t[i],n);if("float"!==i&&"cssFloat"!==i||(i=p),u)o[i]=u;else{var s=l&&r.shorthandPropertyExpansions[i];if(s)for(var c in s)o[c]="";else o[i]=""}}}};i.measureMethods(h,"CSSPropertyOperations",{setValueForStyles:"setValueForStyles"}),e.exports=h},function(e,t,n){"use strict";function r(e){var t=e.nodeName&&e.nodeName.toLowerCase();return"select"===t||"input"===t&&"file"===e.type}function o(e){var t=C.getPooled(M.change,N,e,P(e));_.accumulateTwoPhaseDispatches(t),w.batchedUpdates(i,t)}function i(e){b.enqueueEvents(e),b.processEventQueue(!1)}function a(e,t){k=e,N=t,k.attachEvent("onchange",o)}function u(){k&&(k.detachEvent("onchange",o),k=null,N=null)}function s(e,t){return e===A.topChange?t:void 0}function c(e,t,n){e===A.topFocus?(u(),a(t,n)):e===A.topBlur&&u()}function l(e,t){k=e,N=t,R=e.value,I=Object.getOwnPropertyDescriptor(e.constructor.prototype,"value"),Object.defineProperty(k,"value",F),k.attachEvent?k.attachEvent("onpropertychange",f):k.addEventListener("propertychange",f,!1)}function p(){k&&(delete k.value,k.detachEvent?k.detachEvent("onpropertychange",f):k.removeEventListener("propertychange",f,!1),k=null,N=null,R=null,I=null)}function f(e){if("value"===e.propertyName){var t=e.srcElement.value;t!==R&&(R=t,o(e))}}function d(e,t){return e===A.topInput?t:void 0}function h(e,t,n){e===A.topFocus?(p(),l(t,n)):e===A.topBlur&&p()}function v(e,t){return e!==A.topSelectionChange&&e!==A.topKeyUp&&e!==A.topKeyDown||!k||k.value===R?void 0:(R=k.value,N)}function m(e){return e.nodeName&&"input"===e.nodeName.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)}function y(e,t){return e===A.topClick?t:void 0}var g=n(12),b=n(28),_=n(29),x=n(6),E=n(5),w=n(10),C=n(13),P=n(85),S=n(87),O=n(167),T=n(14),A=g.topLevelTypes,M={change:{phasedRegistrationNames:{bubbled:T({onChange:null}),captured:T({onChangeCapture:null})},dependencies:[A.topBlur,A.topChange,A.topClick,A.topFocus,A.topInput,A.topKeyDown,A.topKeyUp,A.topSelectionChange]}},k=null,N=null,R=null,I=null,j=!1;x.canUseDOM&&(j=S("change")&&(!("documentMode"in document)||document.documentMode>8));var D=!1;x.canUseDOM&&(D=S("input")&&(!("documentMode"in document)||document.documentMode>11));var F={get:function(){return I.get.call(this)},set:function(e){R=""+e,I.set.call(this,e)}},L={eventTypes:M,extractEvents:function(e,t,n,o){var i,a,u=t?E.getNodeFromInstance(t):window;if(r(u)?j?i=s:a=c:O(u)?D?i=d:(i=v,a=h):m(u)&&(i=y),i){var l=i(e,t);if(l){var p=C.getPooled(M.change,l,n,o);return p.type="change",_.accumulateTwoPhaseDispatches(p),p}}a&&a(e,u,t)}};e.exports=L},function(e,t){"use strict";var n={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};e.exports=n},function(e,t,n){"use strict";function r(e){return e.substring(1,e.indexOf(" "))}var o=n(22),i=n(6),a=n(200),u=n(11),s=n(99),c=n(1),l=/^(<[^ \/>]+)/,p="data-danger-index",f={dangerouslyRenderMarkup:function(e){i.canUseDOM?void 0:c(!1);for(var t,n={},o=0;o<e.length;o++)e[o]?void 0:c(!1),t=r(e[o]),t=s(t)?t:"*",n[t]=n[t]||[],n[t][o]=e[o];var f=[],d=0;for(t in n)if(n.hasOwnProperty(t)){var h,v=n[t];for(h in v)if(v.hasOwnProperty(h)){var m=v[h];v[h]=m.replace(l,"$1 "+p+'="'+h+'" ')}for(var y=a(v.join(""),u),g=0;g<y.length;++g){var b=y[g];b.hasAttribute&&b.hasAttribute(p)&&(h=+b.getAttribute(p),b.removeAttribute(p),f.hasOwnProperty(h)?c(!1):void 0,f[h]=b,d+=1)}}return d!==f.length?c(!1):void 0,f.length!==e.length?c(!1):void 0,f},dangerouslyReplaceNodeWithMarkup:function(e,t){if(i.canUseDOM?void 0:c(!1),t?void 0:c(!1),"HTML"===e.nodeName?c(!1):void 0,"string"==typeof t){var n=a(t,u)[0];e.parentNode.replaceChild(n,e)}else o.replaceChildWithTree(e,t)}};e.exports=f},function(e,t,n){"use strict";var r=n(14),o=[r({ResponderEventPlugin:null}),r({SimpleEventPlugin:null}),r({TapEventPlugin:null}),r({EnterLeaveEventPlugin:null}),r({ChangeEventPlugin:null}),r({SelectEventPlugin:null}),r({BeforeInputEventPlugin:null})];e.exports=o},function(e,t,n){"use strict";var r=n(12),o=n(29),i=n(5),a=n(51),u=n(14),s=r.topLevelTypes,c={mouseEnter:{registrationName:u({onMouseEnter:null}),dependencies:[s.topMouseOut,s.topMouseOver]},mouseLeave:{registrationName:u({onMouseLeave:null}),dependencies:[s.topMouseOut,s.topMouseOver]}},l={eventTypes:c,extractEvents:function(e,t,n,r){if(e===s.topMouseOver&&(n.relatedTarget||n.fromElement))return null;if(e!==s.topMouseOut&&e!==s.topMouseOver)return null;var u;if(r.window===r)u=r;else{var l=r.ownerDocument;u=l?l.defaultView||l.parentWindow:window}var p,f;if(e===s.topMouseOut){p=t;var d=n.relatedTarget||n.toElement;f=d?i.getClosestInstanceFromNode(d):null}else p=null,f=t;if(p===f)return null;var h=null==p?u:i.getNodeFromInstance(p),v=null==f?u:i.getNodeFromInstance(f),m=a.getPooled(c.mouseLeave,p,n,r);m.type="mouseleave",m.target=h,m.relatedTarget=v;var y=a.getPooled(c.mouseEnter,f,n,r);return y.type="mouseenter",y.target=v,y.relatedTarget=h,o.accumulateEnterLeaveDispatches(m,y,p,f),[m,y]}};e.exports=l},function(e,t,n){"use strict";function r(e){this._root=e,this._startText=this.getText(),this._fallbackText=null}var o=n(3),i=n(16),a=n(166);o(r.prototype,{destructor:function(){this._root=null,this._startText=null,this._fallbackText=null},getText:function(){return"value"in this._root?this._root.value:this._root[a()]},getData:function(){if(this._fallbackText)return this._fallbackText;var e,t,n=this._startText,r=n.length,o=this.getText(),i=o.length;for(e=0;r>e&&n[e]===o[e];e++);var a=r-e;for(t=1;a>=t&&n[r-t]===o[i-t];t++);var u=t>1?1-t:void 0;return this._fallbackText=o.slice(e,u),this._fallbackText}}),i.addPoolingTo(r),e.exports=r},function(e,t,n){"use strict";var r=n(19),o=r.injection.MUST_USE_PROPERTY,i=r.injection.HAS_BOOLEAN_VALUE,a=r.injection.HAS_SIDE_EFFECTS,u=r.injection.HAS_NUMERIC_VALUE,s=r.injection.HAS_POSITIVE_NUMERIC_VALUE,c=r.injection.HAS_OVERLOADED_BOOLEAN_VALUE,l={isCustomAttribute:RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+r.ATTRIBUTE_NAME_CHAR+"]*$")),Properties:{accept:0,acceptCharset:0,accessKey:0,action:0,allowFullScreen:i,allowTransparency:0,alt:0,async:i,autoComplete:0,autoPlay:i,capture:i,cellPadding:0,cellSpacing:0,charSet:0,challenge:0,checked:o|i,cite:0,classID:0,className:0,cols:s,colSpan:0,content:0,contentEditable:0,contextMenu:0,controls:i,coords:0,crossOrigin:0,data:0,dateTime:0,"default":i,defer:i,dir:0,disabled:i,download:c,draggable:0,encType:0,form:0,formAction:0,formEncType:0,formMethod:0,formNoValidate:i,formTarget:0,frameBorder:0,headers:0,height:0,hidden:i,high:0,href:0,hrefLang:0,htmlFor:0,httpEquiv:0,icon:0,id:0,inputMode:0,integrity:0,is:0,keyParams:0,keyType:0,kind:0,label:0,lang:0,list:0,loop:i,low:0,manifest:0,marginHeight:0,marginWidth:0,max:0,maxLength:0,media:0,mediaGroup:0,method:0,min:0,minLength:0,multiple:o|i,muted:o|i,name:0,nonce:0,noValidate:i,open:i,optimum:0,pattern:0,placeholder:0,poster:0,preload:0,profile:0,radioGroup:0,readOnly:i,rel:0,required:i,reversed:i,role:0,rows:s,rowSpan:u,sandbox:0,scope:0,scoped:i,scrolling:0,seamless:i,selected:o|i,shape:0,size:s,sizes:0,span:s,spellCheck:0,src:0,srcDoc:0,srcLang:0,srcSet:0,start:u,step:0,style:0,summary:0,tabIndex:0,target:0,title:0,type:0,useMap:0,value:o|a,width:0,wmode:0,wrap:0,about:0,datatype:0,inlist:0,prefix:0,property:0,resource:0,"typeof":0,vocab:0,autoCapitalize:0,autoCorrect:0,autoSave:0,color:0,itemProp:0,itemScope:i,itemType:0,itemID:0,itemRef:0,results:0,security:0,unselectable:0},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{}};e.exports=l},function(e,t,n){"use strict";function r(e,t,n){var r=void 0===e[n];null!=t&&r&&(e[n]=i(t))}var o=n(23),i=n(86),a=(n(75),n(89)),u=n(90),s=(n(2),{instantiateChildren:function(e,t,n){if(null==e)return null;var o={};return u(e,r,o),o},updateChildren:function(e,t,n,r,u){if(t||e){var s,c;for(s in t)if(t.hasOwnProperty(s)){c=e&&e[s];var l=c&&c._currentElement,p=t[s];if(null!=c&&a(l,p))o.receiveComponent(c,p,r,u),t[s]=c;else{c&&(n[s]=o.getNativeNode(c),o.unmountComponent(c,!1));var f=i(p);t[s]=f}}for(s in e)!e.hasOwnProperty(s)||t&&t.hasOwnProperty(s)||(c=e[s],n[s]=o.getNativeNode(c),o.unmountComponent(c,!1))}},unmountChildren:function(e,t){for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];o.unmountComponent(r,t)}}});e.exports=s},function(e,t,n){"use strict";function r(e){return(""+e).replace(_,"$&/")}function o(e,t){this.func=e,this.context=t,this.count=0}function i(e,t,n){var r=e.func,o=e.context;r.call(o,t,e.count++)}function a(e,t,n){if(null==e)return e;var r=o.getPooled(t,n);y(e,i,r),o.release(r)}function u(e,t,n,r){this.result=e,this.keyPrefix=t,this.func=n,this.context=r,this.count=0}function s(e,t,n){var o=e.result,i=e.keyPrefix,a=e.func,u=e.context,s=a.call(u,t,e.count++);Array.isArray(s)?c(s,o,n,m.thatReturnsArgument):null!=s&&(v.isValidElement(s)&&(s=v.cloneAndReplaceKey(s,i+(!s.key||t&&t.key===s.key?"":r(s.key)+"/")+n)),o.push(s))}function c(e,t,n,o,i){var a="";null!=n&&(a=r(n)+"/");var c=u.getPooled(t,a,o,i);y(e,s,c),u.release(c)}function l(e,t,n){if(null==e)return e;var r=[];return c(e,r,null,t,n),r}function p(e,t,n){return null}function f(e,t){return y(e,p,null)}function d(e){var t=[];return c(e,t,null,m.thatReturnsArgument),t}var h=n(16),v=n(17),m=n(11),y=n(90),g=h.twoArgumentPooler,b=h.fourArgumentPooler,_=/\/+/g;o.prototype.destructor=function(){this.func=null,this.context=null,this.count=0},h.addPoolingTo(o,g),u.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},h.addPoolingTo(u,b);var x={forEach:a,map:l,mapIntoWithKeyPrefixInternal:c,count:f,toArray:d};e.exports=x},function(e,t,n){"use strict";function r(e,t){var n=E.hasOwnProperty(t)?E[t]:null;C.hasOwnProperty(t)&&(n!==_.OVERRIDE_BASE?m(!1):void 0),e&&(n!==_.DEFINE_MANY&&n!==_.DEFINE_MANY_MERGED?m(!1):void 0)}function o(e,t){if(t){"function"==typeof t?m(!1):void 0,d.isValidElement(t)?m(!1):void 0;var n=e.prototype,o=n.__reactAutoBindPairs;t.hasOwnProperty(b)&&w.mixins(e,t.mixins);for(var i in t)if(t.hasOwnProperty(i)&&i!==b){var a=t[i],c=n.hasOwnProperty(i);if(r(c,i),w.hasOwnProperty(i))w[i](e,a);else{var l=E.hasOwnProperty(i),p="function"==typeof a,f=p&&!l&&!c&&t.autobind!==!1;if(f)o.push(i,a),n[i]=a;else if(c){var h=E[i];!l||h!==_.DEFINE_MANY_MERGED&&h!==_.DEFINE_MANY?m(!1):void 0,h===_.DEFINE_MANY_MERGED?n[i]=u(n[i],a):h===_.DEFINE_MANY&&(n[i]=s(n[i],a))}else n[i]=a}}}}function i(e,t){if(t)for(var n in t){var r=t[n];if(t.hasOwnProperty(n)){var o=n in w;o?m(!1):void 0;var i=n in e;i?m(!1):void 0,e[n]=r}}}function a(e,t){e&&t&&"object"==typeof e&&"object"==typeof t?void 0:m(!1);for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?m(!1):void 0,
e[n]=t[n]);return e}function u(e,t){return function(){var n=e.apply(this,arguments),r=t.apply(this,arguments);if(null==n)return r;if(null==r)return n;var o={};return a(o,n),a(o,r),o}}function s(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function c(e,t){var n=t.bind(e);return n}function l(e){for(var t=e.__reactAutoBindPairs,n=0;n<t.length;n+=2){var r=t[n],o=t[n+1];e[r]=c(e,o)}}var p=n(3),f=n(309),d=n(17),h=(n(81),n(80),n(157)),v=n(24),m=n(1),y=n(32),g=n(14),b=(n(2),g({mixins:null})),_=y({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),x=[],E={mixins:_.DEFINE_MANY,statics:_.DEFINE_MANY,propTypes:_.DEFINE_MANY,contextTypes:_.DEFINE_MANY,childContextTypes:_.DEFINE_MANY,getDefaultProps:_.DEFINE_MANY_MERGED,getInitialState:_.DEFINE_MANY_MERGED,getChildContext:_.DEFINE_MANY_MERGED,render:_.DEFINE_ONCE,componentWillMount:_.DEFINE_MANY,componentDidMount:_.DEFINE_MANY,componentWillReceiveProps:_.DEFINE_MANY,shouldComponentUpdate:_.DEFINE_ONCE,componentWillUpdate:_.DEFINE_MANY,componentDidUpdate:_.DEFINE_MANY,componentWillUnmount:_.DEFINE_MANY,updateComponent:_.OVERRIDE_BASE},w={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n<t.length;n++)o(e,t[n])},childContextTypes:function(e,t){e.childContextTypes=p({},e.childContextTypes,t)},contextTypes:function(e,t){e.contextTypes=p({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps?e.getDefaultProps=u(e.getDefaultProps,t):e.getDefaultProps=t},propTypes:function(e,t){e.propTypes=p({},e.propTypes,t)},statics:function(e,t){i(e,t)},autobind:function(){}},C={replaceState:function(e,t){this.updater.enqueueReplaceState(this,e),t&&this.updater.enqueueCallback(this,t,"replaceState")},isMounted:function(){return this.updater.isMounted(this)}},P=function(){};p(P.prototype,f.prototype,C);var S={createClass:function(e){var t=function(e,t,n){this.__reactAutoBindPairs.length&&l(this),this.props=e,this.context=t,this.refs=v,this.updater=n||h,this.state=null;var r=this.getInitialState?this.getInitialState():null;"object"!=typeof r||Array.isArray(r)?m(!1):void 0,this.state=r};t.prototype=new P,t.prototype.constructor=t,t.prototype.__reactAutoBindPairs=[],x.forEach(o.bind(null,t)),o(t,e),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),t.prototype.render?void 0:m(!1);for(var n in E)t.prototype[n]||(t.prototype[n]=null);return t},injection:{injectMixin:function(e){x.push(e)}}};e.exports=S},function(e,t,n){"use strict";function r(e,t,n){this.props=e,this.context=t,this.refs=i,this.updater=n||o}var o=n(157),i=(n(50),n(162),n(24)),a=n(1);n(2),r.prototype.isReactComponent={},r.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e?a(!1):void 0,this.updater.enqueueSetState(this,e),t&&this.updater.enqueueCallback(this,t,"setState")},r.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this),e&&this.updater.enqueueCallback(this,e,"forceUpdate")},e.exports=r},function(e,t,n){"use strict";function r(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" Check the render method of `"+n+"`."}return""}function o(e){}function i(e,t){}function a(e){return e.prototype&&e.prototype.isReactComponent}var u=n(3),s=n(77),c=n(20),l=n(17),p=n(78),f=n(79),d=(n(50),n(156)),h=n(7),v=n(81),m=(n(80),n(23)),y=n(158),g=n(24),b=n(1),_=n(89);n(2),o.prototype.render=function(){var e=f.get(this)._currentElement.type,t=e(this.props,this.context,this.updater);return i(e,t),t};var x=1,E={construct:function(e){this._currentElement=e,this._rootNodeID=null,this._instance=null,this._nativeParent=null,this._nativeContainerInfo=null,this._pendingElement=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._renderedNodeType=null,this._renderedComponent=null,this._context=null,this._mountOrder=0,this._topLevelWrapper=null,this._pendingCallbacks=null,this._calledComponentWillUnmount=!1},mountComponent:function(e,t,n,r){this._context=r,this._mountOrder=x++,this._nativeParent=t,this._nativeContainerInfo=n;var u,s=this._processProps(this._currentElement.props),c=this._processContext(r),p=this._currentElement.type,d=this._constructComponent(s,c);a(p)||null!=d&&null!=d.render||(u=d,i(p,u),null===d||d===!1||l.isValidElement(d)?void 0:b(!1),d=new o(p)),d.props=s,d.context=c,d.refs=g,d.updater=y,this._instance=d,f.set(d,this);var h=d.state;void 0===h&&(d.state=h=null),"object"!=typeof h||Array.isArray(h)?b(!1):void 0,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1;var v;return v=d.unstable_handleError?this.performInitialMountWithErrorHandling(u,t,n,e,r):this.performInitialMount(u,t,n,e,r),d.componentDidMount&&e.getReactMountReady().enqueue(d.componentDidMount,d),v},_constructComponent:function(e,t){return this._constructComponentWithoutOwner(e,t)},_constructComponentWithoutOwner:function(e,t){var n=this._currentElement.type;return a(n)?new n(e,t,y):n(e,t,y)},performInitialMountWithErrorHandling:function(e,t,n,r,o){var i,a=r.checkpoint();try{i=this.performInitialMount(e,t,n,r,o)}catch(u){r.rollback(a),this._instance.unstable_handleError(u),this._pendingStateQueue&&(this._instance.state=this._processPendingState(this._instance.props,this._instance.context)),a=r.checkpoint(),this._renderedComponent.unmountComponent(!0),r.rollback(a),i=this.performInitialMount(e,t,n,r,o)}return i},performInitialMount:function(e,t,n,r,o){var i=this._instance;i.componentWillMount&&(i.componentWillMount(),this._pendingStateQueue&&(i.state=this._processPendingState(i.props,i.context))),void 0===e&&(e=this._renderValidatedComponent()),this._renderedNodeType=d.getType(e),this._renderedComponent=this._instantiateReactComponent(e);var a=m.mountComponent(this._renderedComponent,r,t,n,this._processChildContext(o));return a},getNativeNode:function(){return m.getNativeNode(this._renderedComponent)},unmountComponent:function(e){if(this._renderedComponent){var t=this._instance;if(t.componentWillUnmount&&!t._calledComponentWillUnmount)if(t._calledComponentWillUnmount=!0,e){var n=this.getName()+".componentWillUnmount()";p.invokeGuardedCallback(n,t.componentWillUnmount.bind(t))}else t.componentWillUnmount();this._renderedComponent&&(m.unmountComponent(this._renderedComponent,e),this._renderedNodeType=null,this._renderedComponent=null,this._instance=null),this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._pendingCallbacks=null,this._pendingElement=null,this._context=null,this._rootNodeID=null,this._topLevelWrapper=null,f.remove(t)}},_maskContext:function(e){var t=this._currentElement.type,n=t.contextTypes;if(!n)return g;var r={};for(var o in n)r[o]=e[o];return r},_processContext:function(e){var t=this._maskContext(e);return t},_processChildContext:function(e){var t=this._currentElement.type,n=this._instance,r=n.getChildContext&&n.getChildContext();if(r){"object"!=typeof t.childContextTypes?b(!1):void 0;for(var o in r)o in t.childContextTypes?void 0:b(!1);return u({},e,r)}return e},_processProps:function(e){return e},_checkPropTypes:function(e,t,n){var o=this.getName();for(var i in e)if(e.hasOwnProperty(i)){var a;try{"function"!=typeof e[i]?b(!1):void 0,a=e[i](t,i,o,n)}catch(u){a=u}a instanceof Error&&(r(this),n===v.prop)}},receiveComponent:function(e,t,n){var r=this._currentElement,o=this._context;this._pendingElement=null,this.updateComponent(t,r,e,o,n)},performUpdateIfNecessary:function(e){null!=this._pendingElement&&m.receiveComponent(this,this._pendingElement,e,this._context),(null!==this._pendingStateQueue||this._pendingForceUpdate)&&this.updateComponent(e,this._currentElement,this._currentElement,this._context,this._context)},updateComponent:function(e,t,n,r,o){var i,a,u=this._instance,s=!1;this._context===o?i=u.context:(i=this._processContext(o),s=!0),t===n?a=n.props:(a=this._processProps(n.props),s=!0),s&&u.componentWillReceiveProps&&u.componentWillReceiveProps(a,i);var c=this._processPendingState(a,i),l=this._pendingForceUpdate||!u.shouldComponentUpdate||u.shouldComponentUpdate(a,c,i);l?(this._pendingForceUpdate=!1,this._performComponentUpdate(n,a,c,i,e,o)):(this._currentElement=n,this._context=o,u.props=a,u.state=c,u.context=i)},_processPendingState:function(e,t){var n=this._instance,r=this._pendingStateQueue,o=this._pendingReplaceState;if(this._pendingReplaceState=!1,this._pendingStateQueue=null,!r)return n.state;if(o&&1===r.length)return r[0];for(var i=u({},o?r[0]:n.state),a=o?1:0;a<r.length;a++){var s=r[a];u(i,"function"==typeof s?s.call(n,i,e,t):s)}return i},_performComponentUpdate:function(e,t,n,r,o,i){var a,u,s,c=this._instance,l=Boolean(c.componentDidUpdate);l&&(a=c.props,u=c.state,s=c.context),c.componentWillUpdate&&c.componentWillUpdate(t,n,r),this._currentElement=e,this._context=i,c.props=t,c.state=n,c.context=r,this._updateRenderedComponent(o,i),l&&o.getReactMountReady().enqueue(c.componentDidUpdate.bind(c,a,u,s),c)},_updateRenderedComponent:function(e,t){var n=this._renderedComponent,r=n._currentElement,o=this._renderValidatedComponent();if(_(r,o))m.receiveComponent(n,o,e,this._processChildContext(t));else{var i=m.getNativeNode(n);m.unmountComponent(n,!1),this._renderedNodeType=d.getType(o),this._renderedComponent=this._instantiateReactComponent(o);var a=m.mountComponent(this._renderedComponent,e,this._nativeParent,this._nativeContainerInfo,this._processChildContext(t));this._replaceNodeWithMarkup(i,a)}},_replaceNodeWithMarkup:function(e,t){s.replaceNodeWithMarkup(e,t)},_renderValidatedComponentWithoutOwnerOrContext:function(){var e=this._instance,t=e.render();return t},_renderValidatedComponent:function(){var e;c.current=this;try{e=this._renderValidatedComponentWithoutOwnerOrContext()}finally{c.current=null}return null===e||e===!1||l.isValidElement(e)?void 0:b(!1),e},attachRef:function(e,t){var n=this.getPublicInstance();null==n?b(!1):void 0;var r=t.getPublicInstance(),o=n.refs===g?n.refs={}:n.refs;o[e]=r},detachRef:function(e){var t=this.getPublicInstance().refs;delete t[e]},getName:function(){var e=this._currentElement.type,t=this._instance&&this._instance.constructor;return e.displayName||t&&t.displayName||e.name||t&&t.name||null},getPublicInstance:function(){var e=this._instance;return e instanceof o?null:e},_instantiateReactComponent:null};h.measureMethods(E,"ReactCompositeComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent",_renderValidatedComponent:"_renderValidatedComponent"});var w={Mixin:E};e.exports=w},function(e,t,n){"use strict";var r=n(5),o=n(148),i=n(153),a=n(7),u=n(23),s=n(10),c=n(159),l=n(355),p=n(165),f=n(361);n(2),o.inject();var d=a.measure("React","render",i.render),h={findDOMNode:l,render:d,unmountComponentAtNode:i.unmountComponentAtNode,version:c,unstable_batchedUpdates:s.batchedUpdates,unstable_renderSubtreeIntoContainer:f};"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ComponentTree:{getClosestInstanceFromNode:r.getClosestInstanceFromNode,getNodeFromInstance:function(e){return e._renderedComponent&&(e=p(e)),e?r.getNodeFromInstance(e):null}},Mount:i,Reconciler:u}),e.exports=h},function(e,t,n){"use strict";var r=n(47),o={getNativeProps:r.getNativeProps};e.exports=o},function(e,t,n){"use strict";function r(e,t){t&&($[e._tag]&&(null!=t.children||null!=t.dangerouslySetInnerHTML?I(!1):void 0),null!=t.dangerouslySetInnerHTML&&(null!=t.children?I(!1):void 0,"object"==typeof t.dangerouslySetInnerHTML&&q in t.dangerouslySetInnerHTML?void 0:I(!1)),null!=t.style&&"object"!=typeof t.style?I(!1):void 0)}function o(e,t,n,r){var o=e._nativeContainerInfo,a=o._node&&o._node.nodeType===Y,u=a?o._node:o._ownerDocument;u&&(U(t,u),r.getReactMountReady().enqueue(i,{inst:e,registrationName:t,listener:n}))}function i(){var e=this;_.putListener(e.inst,e.registrationName,e.listener)}function a(){var e=this;T.postMountWrapper(e)}function u(){var e=this;e._rootNodeID?void 0:I(!1);var t=L(e);switch(t?void 0:I(!1),e._tag){case"iframe":case"object":e._wrapperState.listeners=[E.trapBubbledEvent(b.topLevelTypes.topLoad,"load",t)];break;case"video":case"audio":e._wrapperState.listeners=[];for(var n in z)z.hasOwnProperty(n)&&e._wrapperState.listeners.push(E.trapBubbledEvent(b.topLevelTypes[n],z[n],t));break;case"img":e._wrapperState.listeners=[E.trapBubbledEvent(b.topLevelTypes.topError,"error",t),E.trapBubbledEvent(b.topLevelTypes.topLoad,"load",t)];break;case"form":e._wrapperState.listeners=[E.trapBubbledEvent(b.topLevelTypes.topReset,"reset",t),E.trapBubbledEvent(b.topLevelTypes.topSubmit,"submit",t)];break;case"input":case"select":case"textarea":e._wrapperState.listeners=[E.trapBubbledEvent(b.topLevelTypes.topInvalid,"invalid",t)]}}function s(){A.postUpdateWrapper(this)}function c(e){Z.call(Q,e)||(X.test(e)?void 0:I(!1),Q[e]=!0)}function l(e,t){return e.indexOf("-")>=0||null!=t.is}function p(e){var t=e.type;c(t),this._currentElement=e,this._tag=t.toLowerCase(),this._namespaceURI=null,this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._nativeNode=null,this._nativeParent=null,this._rootNodeID=null,this._domID=null,this._nativeContainerInfo=null,this._wrapperState=null,this._topLevelWrapper=null,this._flags=0}var f=n(3),d=n(296),h=n(298),v=n(22),m=n(300),y=n(19),g=n(73),b=n(12),_=n(28),x=n(48),E=n(49),w=n(143),C=n(312),P=n(144),S=n(5),O=n(318),T=n(320),A=n(146),M=n(324),k=n(332),N=n(7),R=n(53),I=n(1),j=(n(87),n(14)),D=(n(55),n(91),n(2),P),F=_.deleteListener,L=S.getNodeFromInstance,U=E.listenTo,V=x.registrationNameModules,B={string:!0,number:!0},W=j({style:null}),q=j({__html:null}),H={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null},Y=11,z={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},K={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},G={listing:!0,pre:!0,textarea:!0},$=f({menuitem:!0},K),X=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,Q={},Z={}.hasOwnProperty,J=1;p.displayName="ReactDOMComponent",p.Mixin={mountComponent:function(e,t,n,o){this._rootNodeID=J++,this._domID=n._idCounter++,this._nativeParent=t,this._nativeContainerInfo=n;var i=this._currentElement.props;switch(this._tag){case"iframe":case"object":case"img":case"form":case"video":case"audio":this._wrapperState={listeners:null},e.getReactMountReady().enqueue(u,this);break;case"button":i=C.getNativeProps(this,i,t);break;case"input":O.mountWrapper(this,i,t),i=O.getNativeProps(this,i),e.getReactMountReady().enqueue(u,this);break;case"option":T.mountWrapper(this,i,t),i=T.getNativeProps(this,i);break;case"select":A.mountWrapper(this,i,t),i=A.getNativeProps(this,i),e.getReactMountReady().enqueue(u,this);break;case"textarea":M.mountWrapper(this,i,t),i=M.getNativeProps(this,i),e.getReactMountReady().enqueue(u,this)}r(this,i);var s,c;null!=t?(s=t._namespaceURI,c=t._tag):n._tag&&(s=n._namespaceURI,c=n._tag),(null==s||s===m.svg&&"foreignobject"===c)&&(s=m.html),s===m.html&&("svg"===this._tag?s=m.svg:"math"===this._tag&&(s=m.mathml)),this._namespaceURI=s;var l;if(e.useCreateElement){var p,f=n._ownerDocument;if(s===m.html)if("script"===this._tag){var h=f.createElement("div"),y=this._currentElement.type;h.innerHTML="<"+y+"></"+y+">",p=h.removeChild(h.firstChild)}else p=f.createElement(this._currentElement.type);else p=f.createElementNS(s,this._currentElement.type);S.precacheNode(this,p),this._flags|=D.hasCachedChildNodes,this._nativeParent||g.setAttributeForRoot(p),this._updateDOMProperties(null,i,e);var b=v(p);this._createInitialChildren(e,i,o,b),l=b}else{var _=this._createOpenTagMarkupAndPutListeners(e,i),x=this._createContentMarkup(e,i,o);l=!x&&K[this._tag]?_+"/>":_+">"+x+"</"+this._currentElement.type+">"}switch(this._tag){case"button":case"input":case"select":case"textarea":i.autoFocus&&e.getReactMountReady().enqueue(d.focusDOMComponent,this);break;case"option":e.getReactMountReady().enqueue(a,this)}return l},_createOpenTagMarkupAndPutListeners:function(e,t){var n="<"+this._currentElement.type;for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];if(null!=i)if(V.hasOwnProperty(r))i&&o(this,r,i,e);else{r===W&&(i&&(i=this._previousStyleCopy=f({},t.style)),i=h.createMarkupForStyles(i,this));var a=null;null!=this._tag&&l(this._tag,t)?H.hasOwnProperty(r)||(a=g.createMarkupForCustomAttribute(r,i)):a=g.createMarkupForProperty(r,i),a&&(n+=" "+a)}}return e.renderToStaticMarkup?n:(this._nativeParent||(n+=" "+g.createMarkupForRoot()),n+=" "+g.createMarkupForID(this._domID))},_createContentMarkup:function(e,t,n){var r="",o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&(r=o.__html);else{var i=B[typeof t.children]?t.children:null,a=null!=i?null:t.children;if(null!=i)r=R(i);else if(null!=a){var u=this.mountChildren(a,e,n);r=u.join("")}}return G[this._tag]&&"\n"===r.charAt(0)?"\n"+r:r},_createInitialChildren:function(e,t,n,r){var o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&v.queueHTML(r,o.__html);else{var i=B[typeof t.children]?t.children:null,a=null!=i?null:t.children;if(null!=i)v.queueText(r,i);else if(null!=a)for(var u=this.mountChildren(a,e,n),s=0;s<u.length;s++)v.queueChild(r,u[s])}},receiveComponent:function(e,t,n){var r=this._currentElement;this._currentElement=e,this.updateComponent(t,r,e,n)},updateComponent:function(e,t,n,o){var i=t.props,a=this._currentElement.props;switch(this._tag){case"button":i=C.getNativeProps(this,i),a=C.getNativeProps(this,a);break;case"input":O.updateWrapper(this),i=O.getNativeProps(this,i),a=O.getNativeProps(this,a);break;case"option":i=T.getNativeProps(this,i),a=T.getNativeProps(this,a);break;case"select":i=A.getNativeProps(this,i),a=A.getNativeProps(this,a);break;case"textarea":M.updateWrapper(this),i=M.getNativeProps(this,i),a=M.getNativeProps(this,a)}r(this,a),this._updateDOMProperties(i,a,e),this._updateDOMChildren(i,a,e,o),"select"===this._tag&&e.getReactMountReady().enqueue(s,this)},_updateDOMProperties:function(e,t,n){var r,i,a;for(r in e)if(!t.hasOwnProperty(r)&&e.hasOwnProperty(r)&&null!=e[r])if(r===W){var u=this._previousStyleCopy;for(i in u)u.hasOwnProperty(i)&&(a=a||{},a[i]="");this._previousStyleCopy=null}else V.hasOwnProperty(r)?e[r]&&F(this,r):(y.properties[r]||y.isCustomAttribute(r))&&g.deleteValueForProperty(L(this),r);for(r in t){var s=t[r],c=r===W?this._previousStyleCopy:null!=e?e[r]:void 0;if(t.hasOwnProperty(r)&&s!==c&&(null!=s||null!=c))if(r===W)if(s?s=this._previousStyleCopy=f({},s):this._previousStyleCopy=null,c){for(i in c)!c.hasOwnProperty(i)||s&&s.hasOwnProperty(i)||(a=a||{},a[i]="");for(i in s)s.hasOwnProperty(i)&&c[i]!==s[i]&&(a=a||{},a[i]=s[i])}else a=s;else if(V.hasOwnProperty(r))s?o(this,r,s,n):c&&F(this,r);else if(l(this._tag,t))H.hasOwnProperty(r)||g.setValueForAttribute(L(this),r,s);else if(y.properties[r]||y.isCustomAttribute(r)){var p=L(this);null!=s?g.setValueForProperty(p,r,s):g.deleteValueForProperty(p,r)}}a&&h.setValueForStyles(L(this),a,this)},_updateDOMChildren:function(e,t,n,r){var o=B[typeof e.children]?e.children:null,i=B[typeof t.children]?t.children:null,a=e.dangerouslySetInnerHTML&&e.dangerouslySetInnerHTML.__html,u=t.dangerouslySetInnerHTML&&t.dangerouslySetInnerHTML.__html,s=null!=o?null:e.children,c=null!=i?null:t.children,l=null!=o||null!=a,p=null!=i||null!=u;null!=s&&null==c?this.updateChildren(null,n,r):l&&!p&&this.updateTextContent(""),null!=i?o!==i&&this.updateTextContent(""+i):null!=u?a!==u&&this.updateMarkup(""+u):null!=c&&this.updateChildren(c,n,r)},getNativeNode:function(){return L(this)},unmountComponent:function(e){switch(this._tag){case"iframe":case"object":case"img":case"form":case"video":case"audio":var t=this._wrapperState.listeners;if(t)for(var n=0;n<t.length;n++)t[n].remove();break;case"html":case"head":case"body":I(!1)}this.unmountChildren(e),S.uncacheNode(this),_.deleteAllListeners(this),w.unmountIDFromEnvironment(this._rootNodeID),this._rootNodeID=null,this._domID=null,this._wrapperState=null},getPublicInstance:function(){return L(this)}},N.measureMethods(p.Mixin,"ReactDOMComponent",{mountComponent:"mountComponent",receiveComponent:"receiveComponent"}),f(p.prototype,p.Mixin,k.Mixin),e.exports=p},function(e,t,n){"use strict";function r(e,t,n,r,o,i){}var o=n(326),i=(n(2),[]),a={addDevtool:function(e){i.push(e)},removeDevtool:function(e){for(var t=0;t<i.length;t++)i[t]===e&&(i.splice(t,1),t--)},onCreateMarkupForProperty:function(e,t){r("onCreateMarkupForProperty",e,t)},onSetValueForProperty:function(e,t,n){r("onSetValueForProperty",e,t,n)},onDeleteValueForProperty:function(e,t){r("onDeleteValueForProperty",e,t)}};a.addDevtool(o),e.exports=a},function(e,t,n){"use strict";var r=n(3),o=n(22),i=n(5),a=function(e){this._currentElement=null,this._nativeNode=null,this._nativeParent=null,this._nativeContainerInfo=null,this._domID=null};r(a.prototype,{mountComponent:function(e,t,n,r){var a=n._idCounter++;this._domID=a,this._nativeParent=t,this._nativeContainerInfo=n;var u=" react-empty: "+this._domID+" ";if(e.useCreateElement){var s=n._ownerDocument,c=s.createComment(u);return i.precacheNode(this,c),o(c)}return e.renderToStaticMarkup?"":"<!--"+u+"-->"},receiveComponent:function(){},getNativeNode:function(){return i.getNodeFromInstance(this)},unmountComponent:function(){i.uncacheNode(this)}}),e.exports=a},function(e,t){"use strict";var n={useCreateElement:!0};e.exports=n},function(e,t,n){"use strict";var r=n(72),o=n(5),i=n(7),a={dangerouslyProcessChildrenUpdates:function(e,t){var n=o.getNodeFromInstance(e);r.processUpdates(n,t)}};i.measureMethods(a,"ReactDOMIDOperations",{dangerouslyProcessChildrenUpdates:"dangerouslyProcessChildrenUpdates"}),e.exports=a},function(e,t,n){"use strict";function r(){this._rootNodeID&&f.updateWrapper(this)}function o(e){var t=this._currentElement.props,n=s.executeOnChange(t,e);l.asap(r,this);var o=t.name;if("radio"===t.type&&null!=o){for(var i=c.getNodeFromInstance(this),a=i;a.parentNode;)a=a.parentNode;for(var u=a.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),f=0;f<u.length;f++){var d=u[f];if(d!==i&&d.form===i.form){var h=c.getInstanceFromNode(d);h?void 0:p(!1),l.asap(r,h)}}}return n}var i=n(3),a=n(47),u=n(73),s=n(76),c=n(5),l=n(10),p=n(1),f=(n(2),{getNativeProps:function(e,t){var n=s.getValue(t),r=s.getChecked(t),o=i({type:void 0},a.getNativeProps(e,t),{defaultChecked:void 0,defaultValue:void 0,value:null!=n?n:e._wrapperState.initialValue,checked:null!=r?r:e._wrapperState.initialChecked,onChange:e._wrapperState.onChange});return o},mountWrapper:function(e,t){var n=t.defaultValue;e._wrapperState={initialChecked:t.defaultChecked||!1,initialValue:null!=n?n:null,listeners:null,onChange:o.bind(e)}},updateWrapper:function(e){var t=e._currentElement.props,n=t.checked;null!=n&&u.setValueForProperty(c.getNodeFromInstance(e),"checked",n||!1);var r=s.getValue(t);null!=r&&u.setValueForProperty(c.getNodeFromInstance(e),"value",""+r)}});e.exports=f},function(e,t,n){"use strict";var r=n(314);e.exports={debugTool:r}},function(e,t,n){"use strict";var r=n(3),o=n(307),i=n(5),a=n(146),u=(n(2),{mountWrapper:function(e,t,n){var r=null;if(null!=n){var o=n;"optgroup"===o._tag&&(o=o._nativeParent),null!=o&&"select"===o._tag&&(r=a.getSelectValueContext(o))}var i=null;if(null!=r)if(i=!1,Array.isArray(r)){for(var u=0;u<r.length;u++)if(""+r[u]==""+t.value){i=!0;break}}else i=""+r==""+t.value;e._wrapperState={selected:i}},postMountWrapper:function(e){var t=e._currentElement.props;if(null!=t.value){var n=i.getNodeFromInstance(e);n.setAttribute("value",t.value)}},getNativeProps:function(e,t){var n=r({selected:void 0,children:void 0},t);null!=e._wrapperState.selected&&(n.selected=e._wrapperState.selected);var i="";return o.forEach(t.children,function(e){null!=e&&("string"!=typeof e&&"number"!=typeof e||(i+=e))}),i&&(n.children=i),n}});e.exports=u},function(e,t,n){"use strict";function r(e,t,n,r){return e===n&&t===r}function o(e){var t=document.selection,n=t.createRange(),r=n.text.length,o=n.duplicate();o.moveToElementText(e),o.setEndPoint("EndToStart",n);var i=o.text.length,a=i+r;return{start:i,end:a}}function i(e){var t=window.getSelection&&window.getSelection();if(!t||0===t.rangeCount)return null;var n=t.anchorNode,o=t.anchorOffset,i=t.focusNode,a=t.focusOffset,u=t.getRangeAt(0);try{u.startContainer.nodeType,u.endContainer.nodeType}catch(s){return null}var c=r(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),l=c?0:u.toString().length,p=u.cloneRange();p.selectNodeContents(e),p.setEnd(u.startContainer,u.startOffset);var f=r(p.startContainer,p.startOffset,p.endContainer,p.endOffset),d=f?0:p.toString().length,h=d+l,v=document.createRange();v.setStart(n,o),v.setEnd(i,a);var m=v.collapsed;return{start:m?h:d,end:m?d:h}}function a(e,t){var n,r,o=document.selection.createRange().duplicate();void 0===t.end?(n=t.start,r=n):t.start>t.end?(n=t.end,r=t.start):(n=t.start,r=t.end),o.moveToElementText(e),o.moveStart("character",n),o.setEndPoint("EndToStart",o),o.moveEnd("character",r-n),o.select()}function u(e,t){if(window.getSelection){var n=window.getSelection(),r=e[l()].length,o=Math.min(t.start,r),i=void 0===t.end?o:Math.min(t.end,r);if(!n.extend&&o>i){var a=i;i=o,o=a}var u=c(e,o),s=c(e,i);if(u&&s){var p=document.createRange();p.setStart(u.node,u.offset),n.removeAllRanges(),o>i?(n.addRange(p),n.extend(s.node,s.offset)):(p.setEnd(s.node,s.offset),n.addRange(p))}}}var s=n(6),c=n(358),l=n(166),p=s.canUseDOM&&"selection"in document&&!("getSelection"in window),f={getOffsets:p?o:i,setOffsets:p?a:u};e.exports=f},function(e,t,n){"use strict";var r=n(148),o=n(338),i=n(159);r.inject();var a={renderToString:o.renderToString,renderToStaticMarkup:o.renderToStaticMarkup,version:i};e.exports=a},function(e,t,n){"use strict";var r=n(3),o=n(72),i=n(22),a=n(5),u=n(7),s=n(53),c=n(1),l=(n(91),function(e){this._currentElement=e,this._stringText=""+e,this._nativeNode=null,this._nativeParent=null,this._domID=null,this._mountIndex=0,this._closingComment=null,this._commentNodes=null});r(l.prototype,{mountComponent:function(e,t,n,r){var o=n._idCounter++,u=" react-text: "+o+" ",c=" /react-text ";if(this._domID=o,this._nativeParent=t,e.useCreateElement){var l=n._ownerDocument,p=l.createComment(u),f=l.createComment(c),d=i(l.createDocumentFragment());return i.queueChild(d,i(p)),this._stringText&&i.queueChild(d,i(l.createTextNode(this._stringText))),i.queueChild(d,i(f)),a.precacheNode(this,p),this._closingComment=f,d}var h=s(this._stringText);return e.renderToStaticMarkup?h:"<!--"+u+"-->"+h+"<!--"+c+"-->"},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;if(n!==this._stringText){this._stringText=n;var r=this.getNativeNode();o.replaceDelimitedText(r[0],r[1],n)}}},getNativeNode:function(){var e=this._commentNodes;if(e)return e;if(!this._closingComment)for(var t=a.getNodeFromInstance(this),n=t.nextSibling;;){if(null==n?c(!1):void 0,8===n.nodeType&&" /react-text "===n.nodeValue){this._closingComment=n;break}n=n.nextSibling}return e=[this._nativeNode,this._closingComment],this._commentNodes=e,e},unmountComponent:function(){this._closingComment=null,this._commentNodes=null,a.uncacheNode(this)}}),u.measureMethods(l.prototype,"ReactDOMTextComponent",{mountComponent:"mountComponent",receiveComponent:"receiveComponent"}),e.exports=l},function(e,t,n){"use strict";function r(){this._rootNodeID&&f.updateWrapper(this)}function o(e){var t=this._currentElement.props,n=s.executeOnChange(t,e);return l.asap(r,this),n}var i=n(3),a=n(47),u=n(73),s=n(76),c=n(5),l=n(10),p=n(1),f=(n(2),{getNativeProps:function(e,t){null!=t.dangerouslySetInnerHTML?p(!1):void 0;var n=i({},a.getNativeProps(e,t),{defaultValue:void 0,value:void 0,children:e._wrapperState.initialValue,onChange:e._wrapperState.onChange});return n},mountWrapper:function(e,t){var n=t.defaultValue,r=t.children;null!=r&&(null!=n?p(!1):void 0,Array.isArray(r)&&(r.length<=1?void 0:p(!1),r=r[0]),n=""+r),null==n&&(n="");var i=s.getValue(t);e._wrapperState={initialValue:""+(null!=i?i:n),listeners:null,onChange:o.bind(e)}},updateWrapper:function(e){var t=e._currentElement.props,n=s.getValue(t);null!=n&&u.setValueForProperty(c.getNodeFromInstance(e),"value",""+n)}});e.exports=f},function(e,t,n){"use strict";function r(e,t){"_nativeNode"in e?void 0:s(!1),"_nativeNode"in t?void 0:s(!1);for(var n=0,r=e;r;r=r._nativeParent)n++;for(var o=0,i=t;i;i=i._nativeParent)o++;for(;n-o>0;)e=e._nativeParent,n--;for(;o-n>0;)t=t._nativeParent,o--;for(var a=n;a--;){if(e===t)return e;e=e._nativeParent,t=t._nativeParent}return null}function o(e,t){"_nativeNode"in e?void 0:s(!1),"_nativeNode"in t?void 0:s(!1);for(;t;){if(t===e)return!0;t=t._nativeParent}return!1}function i(e){return"_nativeNode"in e?void 0:s(!1),e._nativeParent}function a(e,t,n){for(var r=[];e;)r.push(e),e=e._nativeParent;var o;for(o=r.length;o-- >0;)t(r[o],!1,n);for(o=0;o<r.length;o++)t(r[o],!0,n)}function u(e,t,n,o,i){for(var a=e&&t?r(e,t):null,u=[];e&&e!==a;)u.push(e),e=e._nativeParent;for(var s=[];t&&t!==a;)s.push(t),t=t._nativeParent;var c;for(c=0;c<u.length;c++)n(u[c],!0,o);for(c=s.length;c-- >0;)n(s[c],!1,i)}var s=n(1);e.exports={isAncestor:o,getLowestCommonAncestor:r,getParentInstance:i,traverseTwoPhase:a,traverseEnterLeave:u}},function(e,t,n){"use strict";var r,o=(n(19),n(48),n(2),{onCreateMarkupForProperty:function(e,t){r(e)},onSetValueForProperty:function(e,t,n){r(t)},onDeleteValueForProperty:function(e,t){r(t)}});e.exports=o},function(e,t,n){"use strict";function r(e,t,n,r,o,i){}var o=n(331),i=(n(2),[]),a={addDevtool:function(e){i.push(e)},removeDevtool:function(e){for(var t=0;t<i.length;t++)i[t]===e&&(i.splice(t,1),t--)},onBeginProcessingChildContext:function(){r("onBeginProcessingChildContext")},onEndProcessingChildContext:function(){r("onEndProcessingChildContext")},onSetState:function(){r("onSetState")},onMountRootComponent:function(e){r("onMountRootComponent",e)},onMountComponent:function(e){r("onMountComponent",e)},onUpdateComponent:function(e){r("onUpdateComponent",e)},onUnmountComponent:function(e){r("onUnmountComponent",e)}};a.addDevtool(o),e.exports=a},function(e,t,n){"use strict";function r(e){o.enqueueEvents(e),o.processEventQueue(!1)}var o=n(28),i={handleTopLevel:function(e,t,n,i){var a=o.extractEvents(e,t,n,i);r(a)}};e.exports=i},function(e,t,n){"use strict";function r(e){for(;e._nativeParent;)e=e._nativeParent;var t=p.getNodeFromInstance(e),n=t.parentNode;return p.getClosestInstanceFromNode(n)}function o(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function i(e){var t=d(e.nativeEvent),n=p.getClosestInstanceFromNode(t),o=n;do e.ancestors.push(o),o=o&&r(o);while(o);for(var i=0;i<e.ancestors.length;i++)n=e.ancestors[i],v._handleTopLevel(e.topLevelType,n,e.nativeEvent,d(e.nativeEvent))}function a(e){var t=h(window);e(t)}var u=n(3),s=n(96),c=n(6),l=n(16),p=n(5),f=n(10),d=n(85),h=n(201);u(o.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),l.addPoolingTo(o,l.twoArgumentPooler);var v={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:c.canUseDOM?window:null,setHandleTopLevel:function(e){v._handleTopLevel=e},setEnabled:function(e){v._enabled=!!e},isEnabled:function(){return v._enabled},trapBubbledEvent:function(e,t,n){var r=n;return r?s.listen(r,t,v.dispatchEvent.bind(null,e)):null},trapCapturedEvent:function(e,t,n){var r=n;return r?s.capture(r,t,v.dispatchEvent.bind(null,e)):null},monitorScrollValue:function(e){var t=a.bind(null,e);s.listen(window,"scroll",t)},dispatchEvent:function(e,t){if(v._enabled){var n=o.getPooled(e,t);try{f.batchedUpdates(i,n)}finally{o.release(n)}}}};e.exports=v;
},function(e,t,n){"use strict";var r=n(19),o=n(28),i=n(74),a=n(77),u=n(308),s=n(149),c=n(49),l=n(155),p=n(7),f=n(10),d={Component:a.injection,Class:u.injection,DOMProperty:r.injection,EmptyComponent:s.injection,EventPluginHub:o.injection,EventPluginUtils:i.injection,EventEmitter:c.injection,NativeComponent:l.injection,Perf:p.injection,Updates:f.injection};e.exports=d},function(e,t,n){"use strict";var r,o,i=(n(2),{onBeginProcessingChildContext:function(){r=!0},onEndProcessingChildContext:function(){r=!1},onSetState:function(){o()}});e.exports=i},function(e,t,n){"use strict";function r(e,t,n){return{type:p.INSERT_MARKUP,content:e,fromIndex:null,fromNode:null,toIndex:n,afterNode:t}}function o(e,t,n){return{type:p.MOVE_EXISTING,content:null,fromIndex:e._mountIndex,fromNode:f.getNativeNode(e),toIndex:n,afterNode:t}}function i(e,t){return{type:p.REMOVE_NODE,content:null,fromIndex:e._mountIndex,fromNode:t,toIndex:null,afterNode:null}}function a(e){return{type:p.SET_MARKUP,content:e,fromIndex:null,fromNode:null,toIndex:null,afterNode:null}}function u(e){return{type:p.TEXT_CONTENT,content:e,fromIndex:null,fromNode:null,toIndex:null,afterNode:null}}function s(e,t){return t&&(e=e||[],e.push(t)),e}function c(e,t){l.processChildrenUpdates(e,t)}var l=n(77),p=n(154),f=(n(20),n(23)),d=n(306),h=n(356),v=n(1),m={Mixin:{_reconcilerInstantiateChildren:function(e,t,n){return d.instantiateChildren(e,t,n)},_reconcilerUpdateChildren:function(e,t,n,r,o){var i;return i=h(t),d.updateChildren(e,i,n,r,o),i},mountChildren:function(e,t,n){var r=this._reconcilerInstantiateChildren(e,t,n);this._renderedChildren=r;var o=[],i=0;for(var a in r)if(r.hasOwnProperty(a)){var u=r[a],s=f.mountComponent(u,t,this,this._nativeContainerInfo,n);u._mountIndex=i++,o.push(s)}return o},updateTextContent:function(e){var t=this._renderedChildren;d.unmountChildren(t,!1);for(var n in t)t.hasOwnProperty(n)&&v(!1);var r=[u(e)];c(this,r)},updateMarkup:function(e){var t=this._renderedChildren;d.unmountChildren(t,!1);for(var n in t)t.hasOwnProperty(n)&&v(!1);var r=[a(e)];c(this,r)},updateChildren:function(e,t,n){this._updateChildren(e,t,n)},_updateChildren:function(e,t,n){var r=this._renderedChildren,o={},i=this._reconcilerUpdateChildren(r,e,o,t,n);if(i||r){var a,u=null,l=0,p=0,d=null;for(a in i)if(i.hasOwnProperty(a)){var h=r&&r[a],v=i[a];h===v?(u=s(u,this.moveChild(h,d,p,l)),l=Math.max(h._mountIndex,l),h._mountIndex=p):(h&&(l=Math.max(h._mountIndex,l)),u=s(u,this._mountChildAtIndex(v,d,p,t,n))),p++,d=f.getNativeNode(v)}for(a in o)o.hasOwnProperty(a)&&(u=s(u,this._unmountChild(r[a],o[a])));u&&c(this,u),this._renderedChildren=i}},unmountChildren:function(e){var t=this._renderedChildren;d.unmountChildren(t,e),this._renderedChildren=null},moveChild:function(e,t,n,r){return e._mountIndex<r?o(e,t,n):void 0},createChild:function(e,t,n){return r(n,t,e._mountIndex)},removeChild:function(e,t){return i(e,t)},_mountChildAtIndex:function(e,t,n,r,o){var i=f.mountComponent(e,r,this,this._nativeContainerInfo,o);return e._mountIndex=n,this.createChild(e,t,i)},_unmountChild:function(e,t){var n=this.removeChild(e,t);return e._mountIndex=null,n}}};e.exports=m},function(e,t,n){"use strict";var r=n(1),o={isValidOwner:function(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)},addComponentAsRefTo:function(e,t,n){o.isValidOwner(n)?void 0:r(!1),n.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,n){o.isValidOwner(n)?void 0:r(!1);var i=n.getPublicInstance();i&&i.refs[t]===e.getPublicInstance()&&n.detachRef(t)}};e.exports=o},function(e,t,n){"use strict";function r(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function o(e){function t(t,n,r,o,i,a){if(o=o||w,a=a||r,null==n[r]){var u=_[i];return t?new Error("Required "+u+" `"+a+"` was not specified in "+("`"+o+"`.")):null}return e(n,r,o,i,a)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function i(e){function t(t,n,r,o,i){var a=t[n],u=m(a);if(u!==e){var s=_[o],c=y(a);return new Error("Invalid "+s+" `"+i+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."))}return null}return o(t)}function a(){return o(x.thatReturns(null))}function u(e){function t(t,n,r,o,i){if("function"!=typeof e)return new Error("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){var u=_[o],s=m(a);return new Error("Invalid "+u+" `"+i+"` of type "+("`"+s+"` supplied to `"+r+"`, expected an array."))}for(var c=0;c<a.length;c++){var l=e(a,c,r,o,i+"["+c+"]");if(l instanceof Error)return l}return null}return o(t)}function s(){function e(e,t,n,r,o){if(!b.isValidElement(e[t])){var i=_[r];return new Error("Invalid "+i+" `"+o+"` supplied to "+("`"+n+"`, expected a single ReactElement."))}return null}return o(e)}function c(e){function t(t,n,r,o,i){if(!(t[n]instanceof e)){var a=_[o],u=e.name||w,s=g(t[n]);return new Error("Invalid "+a+" `"+i+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+u+"`."))}return null}return o(t)}function l(e){function t(t,n,o,i,a){for(var u=t[n],s=0;s<e.length;s++)if(r(u,e[s]))return null;var c=_[i],l=JSON.stringify(e);return new Error("Invalid "+c+" `"+a+"` of value `"+u+"` "+("supplied to `"+o+"`, expected one of "+l+"."))}return o(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOf, expected an instance of array.")})}function p(e){function t(t,n,r,o,i){if("function"!=typeof e)return new Error("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var a=t[n],u=m(a);if("object"!==u){var s=_[o];return new Error("Invalid "+s+" `"+i+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an object."))}for(var c in a)if(a.hasOwnProperty(c)){var l=e(a,c,r,o,i+"."+c);if(l instanceof Error)return l}return null}return o(t)}function f(e){function t(t,n,r,o,i){for(var a=0;a<e.length;a++){var u=e[a];if(null==u(t,n,r,o,i))return null}var s=_[o];return new Error("Invalid "+s+" `"+i+"` supplied to "+("`"+r+"`."))}return o(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOfType, expected an instance of array.")})}function d(){function e(e,t,n,r,o){if(!v(e[t])){var i=_[r];return new Error("Invalid "+i+" `"+o+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return null}return o(e)}function h(e){function t(t,n,r,o,i){var a=t[n],u=m(a);if("object"!==u){var s=_[o];return new Error("Invalid "+s+" `"+i+"` of type `"+u+"` "+("supplied to `"+r+"`, expected `object`."))}for(var c in e){var l=e[c];if(l){var p=l(a,c,r,o,i+"."+c);if(p)return p}}return null}return o(t)}function v(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(v);if(null===e||b.isValidElement(e))return!0;var t=E(e);if(!t)return!1;var n,r=t.call(e);if(t!==e.entries){for(;!(n=r.next()).done;)if(!v(n.value))return!1}else for(;!(n=r.next()).done;){var o=n.value;if(o&&!v(o[1]))return!1}return!0;default:return!1}}function m(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":t}function y(e){var t=m(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function g(e){return e.constructor&&e.constructor.name?e.constructor.name:w}var b=n(17),_=n(80),x=n(11),E=n(164),w="<<anonymous>>",C={array:i("array"),bool:i("boolean"),func:i("function"),number:i("number"),object:i("object"),string:i("string"),any:a(),arrayOf:u,element:s(),instanceOf:c,node:d(),objectOf:p,oneOf:l,oneOfType:f,shape:h};e.exports=C},function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=i.getPooled(null),this.useCreateElement=e}var o=n(3),i=n(142),a=n(16),u=n(49),s=n(151),c=n(52),l={initialize:s.getSelectionInformation,close:s.restoreSelection},p={initialize:function(){var e=u.isEnabled();return u.setEnabled(!1),e},close:function(e){u.setEnabled(e)}},f={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},d=[l,p,f],h={getTransactionWrappers:function(){return d},getReactMountReady:function(){return this.reactMountReady},checkpoint:function(){return this.reactMountReady.checkpoint()},rollback:function(e){this.reactMountReady.rollback(e)},destructor:function(){i.release(this.reactMountReady),this.reactMountReady=null}};o(r.prototype,c.Mixin,h),a.addPoolingTo(r),e.exports=r},function(e,t,n){"use strict";function r(e,t,n){"function"==typeof e?e(t.getPublicInstance()):i.addComponentAsRefTo(t,e,n)}function o(e,t,n){"function"==typeof e?e(null):i.removeComponentAsRefFrom(t,e,n)}var i=n(333),a={};a.attachRefs=function(e,t){if(null!==t&&t!==!1){var n=t.ref;null!=n&&r(n,e,t._owner)}},a.shouldUpdateRefs=function(e,t){var n=null===e||e===!1,r=null===t||t===!1;return n||r||t._owner!==e._owner||t.ref!==e.ref},a.detachRefs=function(e,t){if(null!==t&&t!==!1){var n=t.ref;null!=n&&o(n,e,t._owner)}},e.exports=a},function(e,t){"use strict";var n={isBatchingUpdates:!1,batchedUpdates:function(e){}};e.exports=n},function(e,t,n){"use strict";function r(e,t){var n;try{return f.injection.injectBatchingStrategy(l),n=p.getPooled(t),n.perform(function(){var r=h(e),o=r.mountComponent(n,null,a(),d);return t||(o=c.addChecksumToMarkup(o)),o},null)}finally{p.release(n),f.injection.injectBatchingStrategy(u)}}function o(e){return s.isValidElement(e)?void 0:v(!1),r(e,!1)}function i(e){return s.isValidElement(e)?void 0:v(!1),r(e,!0)}var a=n(145),u=n(147),s=n(17),c=n(152),l=n(337),p=n(339),f=n(10),d=n(24),h=n(86),v=n(1);e.exports={renderToString:o,renderToStaticMarkup:i}},function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=e,this.useCreateElement=!1}var o=n(3),i=n(16),a=n(52),u=[],s={enqueue:function(){}},c={getTransactionWrappers:function(){return u},getReactMountReady:function(){return s},destructor:function(){}};o(r.prototype,a.Mixin,c),i.addPoolingTo(r),e.exports=r},function(e,t){"use strict";var n={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},r={accentHeight:"accent-height",accumulate:0,additive:0,alignmentBaseline:"alignment-baseline",allowReorder:"allowReorder",alphabetic:0,amplitude:0,arabicForm:"arabic-form",ascent:0,attributeName:"attributeName",attributeType:"attributeType",autoReverse:"autoReverse",azimuth:0,baseFrequency:"baseFrequency",baseProfile:"baseProfile",baselineShift:"baseline-shift",bbox:0,begin:0,bias:0,by:0,calcMode:"calcMode",capHeight:"cap-height",clip:0,clipPath:"clip-path",clipRule:"clip-rule",clipPathUnits:"clipPathUnits",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",contentScriptType:"contentScriptType",contentStyleType:"contentStyleType",cursor:0,cx:0,cy:0,d:0,decelerate:0,descent:0,diffuseConstant:"diffuseConstant",direction:0,display:0,divisor:0,dominantBaseline:"dominant-baseline",dur:0,dx:0,dy:0,edgeMode:"edgeMode",elevation:0,enableBackground:"enable-background",end:0,exponent:0,externalResourcesRequired:"externalResourcesRequired",fill:0,fillOpacity:"fill-opacity",fillRule:"fill-rule",filter:0,filterRes:"filterRes",filterUnits:"filterUnits",floodColor:"flood-color",floodOpacity:"flood-opacity",focusable:0,fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",glyphRef:"glyphRef",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",hanging:0,horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",ideographic:0,imageRendering:"image-rendering","in":0,in2:0,intercept:0,k:0,k1:0,k2:0,k3:0,k4:0,kernelMatrix:"kernelMatrix",kernelUnitLength:"kernelUnitLength",kerning:0,keyPoints:"keyPoints",keySplines:"keySplines",keyTimes:"keyTimes",lengthAdjust:"lengthAdjust",letterSpacing:"letter-spacing",lightingColor:"lighting-color",limitingConeAngle:"limitingConeAngle",local:0,markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",markerHeight:"markerHeight",markerUnits:"markerUnits",markerWidth:"markerWidth",mask:0,maskContentUnits:"maskContentUnits",maskUnits:"maskUnits",mathematical:0,mode:0,numOctaves:"numOctaves",offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pathLength:"pathLength",patternContentUnits:"patternContentUnits",patternTransform:"patternTransform",patternUnits:"patternUnits",pointerEvents:"pointer-events",points:0,pointsAtX:"pointsAtX",pointsAtY:"pointsAtY",pointsAtZ:"pointsAtZ",preserveAlpha:"preserveAlpha",preserveAspectRatio:"preserveAspectRatio",primitiveUnits:"primitiveUnits",r:0,radius:0,refX:"refX",refY:"refY",renderingIntent:"rendering-intent",repeatCount:"repeatCount",repeatDur:"repeatDur",requiredExtensions:"requiredExtensions",requiredFeatures:"requiredFeatures",restart:0,result:0,rotate:0,rx:0,ry:0,scale:0,seed:0,shapeRendering:"shape-rendering",slope:0,spacing:0,specularConstant:"specularConstant",specularExponent:"specularExponent",speed:0,spreadMethod:"spreadMethod",startOffset:"startOffset",stdDeviation:"stdDeviation",stemh:0,stemv:0,stitchTiles:"stitchTiles",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",string:0,stroke:0,strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",surfaceScale:"surfaceScale",systemLanguage:"systemLanguage",tableValues:"tableValues",targetX:"targetX",targetY:"targetY",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",textLength:"textLength",to:0,transform:0,u1:0,u2:0,underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicode:0,unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",values:0,vectorEffect:"vector-effect",version:0,vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",viewBox:"viewBox",viewTarget:"viewTarget",visibility:0,widths:0,wordSpacing:"word-spacing",writingMode:"writing-mode",x:0,xHeight:"x-height",x1:0,x2:0,xChannelSelector:"xChannelSelector",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlLang:"xml:lang",xmlSpace:"xml:space",y:0,y1:0,y2:0,yChannelSelector:"yChannelSelector",z:0,zoomAndPan:"zoomAndPan"},o={Properties:{},DOMAttributeNamespaces:{xlinkActuate:n.xlink,xlinkArcrole:n.xlink,xlinkHref:n.xlink,xlinkRole:n.xlink,xlinkShow:n.xlink,xlinkTitle:n.xlink,xlinkType:n.xlink,xmlBase:n.xml,xmlLang:n.xml,xmlSpace:n.xml},DOMAttributeNames:{}};Object.keys(r).forEach(function(e){o.Properties[e]=0,r[e]&&(o.DOMAttributeNames[e]=r[e])}),e.exports=o},function(e,t,n){"use strict";function r(e){if("selectionStart"in e&&c.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function o(e,t){if(x||null==g||g!==p())return null;var n=r(g);if(!_||!h(_,n)){_=n;var o=l.getPooled(y.select,b,e,t);return o.type="select",o.target=g,a.accumulateTwoPhaseDispatches(o),o}return null}var i=n(12),a=n(29),u=n(6),s=n(5),c=n(151),l=n(13),p=n(98),f=n(167),d=n(14),h=n(55),v=i.topLevelTypes,m=u.canUseDOM&&"documentMode"in document&&document.documentMode<=11,y={select:{phasedRegistrationNames:{bubbled:d({onSelect:null}),captured:d({onSelectCapture:null})},dependencies:[v.topBlur,v.topContextMenu,v.topFocus,v.topKeyDown,v.topMouseDown,v.topMouseUp,v.topSelectionChange]}},g=null,b=null,_=null,x=!1,E=!1,w=d({onSelect:null}),C={eventTypes:y,extractEvents:function(e,t,n,r){if(!E)return null;var i=t?s.getNodeFromInstance(t):window;switch(e){case v.topFocus:(f(i)||"true"===i.contentEditable)&&(g=i,b=t,_=null);break;case v.topBlur:g=null,b=null,_=null;break;case v.topMouseDown:x=!0;break;case v.topContextMenu:case v.topMouseUp:return x=!1,o(n,r);case v.topSelectionChange:if(m)break;case v.topKeyDown:case v.topKeyUp:return o(n,r)}return null},didPutListener:function(e,t,n){t===w&&(E=!0)}};e.exports=C},function(e,t,n){"use strict";var r=n(12),o=n(96),i=n(29),a=n(5),u=n(343),s=n(344),c=n(13),l=n(347),p=n(349),f=n(51),d=n(346),h=n(350),v=n(351),m=n(30),y=n(352),g=n(11),b=n(83),_=n(1),x=n(14),E=r.topLevelTypes,w={abort:{phasedRegistrationNames:{bubbled:x({onAbort:!0}),captured:x({onAbortCapture:!0})}},animationEnd:{phasedRegistrationNames:{bubbled:x({onAnimationEnd:!0}),captured:x({onAnimationEndCapture:!0})}},animationIteration:{phasedRegistrationNames:{bubbled:x({onAnimationIteration:!0}),captured:x({onAnimationIterationCapture:!0})}},animationStart:{phasedRegistrationNames:{bubbled:x({onAnimationStart:!0}),captured:x({onAnimationStartCapture:!0})}},blur:{phasedRegistrationNames:{bubbled:x({onBlur:!0}),captured:x({onBlurCapture:!0})}},canPlay:{phasedRegistrationNames:{bubbled:x({onCanPlay:!0}),captured:x({onCanPlayCapture:!0})}},canPlayThrough:{phasedRegistrationNames:{bubbled:x({onCanPlayThrough:!0}),captured:x({onCanPlayThroughCapture:!0})}},click:{phasedRegistrationNames:{bubbled:x({onClick:!0}),captured:x({onClickCapture:!0})}},contextMenu:{phasedRegistrationNames:{bubbled:x({onContextMenu:!0}),captured:x({onContextMenuCapture:!0})}},copy:{phasedRegistrationNames:{bubbled:x({onCopy:!0}),captured:x({onCopyCapture:!0})}},cut:{phasedRegistrationNames:{bubbled:x({onCut:!0}),captured:x({onCutCapture:!0})}},doubleClick:{phasedRegistrationNames:{bubbled:x({onDoubleClick:!0}),captured:x({onDoubleClickCapture:!0})}},drag:{phasedRegistrationNames:{bubbled:x({onDrag:!0}),captured:x({onDragCapture:!0})}},dragEnd:{phasedRegistrationNames:{bubbled:x({onDragEnd:!0}),captured:x({onDragEndCapture:!0})}},dragEnter:{phasedRegistrationNames:{bubbled:x({onDragEnter:!0}),captured:x({onDragEnterCapture:!0})}},dragExit:{phasedRegistrationNames:{bubbled:x({onDragExit:!0}),captured:x({onDragExitCapture:!0})}},dragLeave:{phasedRegistrationNames:{bubbled:x({onDragLeave:!0}),captured:x({onDragLeaveCapture:!0})}},dragOver:{phasedRegistrationNames:{bubbled:x({onDragOver:!0}),captured:x({onDragOverCapture:!0})}},dragStart:{phasedRegistrationNames:{bubbled:x({onDragStart:!0}),captured:x({onDragStartCapture:!0})}},drop:{phasedRegistrationNames:{bubbled:x({onDrop:!0}),captured:x({onDropCapture:!0})}},durationChange:{phasedRegistrationNames:{bubbled:x({onDurationChange:!0}),captured:x({onDurationChangeCapture:!0})}},emptied:{phasedRegistrationNames:{bubbled:x({onEmptied:!0}),captured:x({onEmptiedCapture:!0})}},encrypted:{phasedRegistrationNames:{bubbled:x({onEncrypted:!0}),captured:x({onEncryptedCapture:!0})}},ended:{phasedRegistrationNames:{bubbled:x({onEnded:!0}),captured:x({onEndedCapture:!0})}},error:{phasedRegistrationNames:{bubbled:x({onError:!0}),captured:x({onErrorCapture:!0})}},focus:{phasedRegistrationNames:{bubbled:x({onFocus:!0}),captured:x({onFocusCapture:!0})}},input:{phasedRegistrationNames:{bubbled:x({onInput:!0}),captured:x({onInputCapture:!0})}},invalid:{phasedRegistrationNames:{bubbled:x({onInvalid:!0}),captured:x({onInvalidCapture:!0})}},keyDown:{phasedRegistrationNames:{bubbled:x({onKeyDown:!0}),captured:x({onKeyDownCapture:!0})}},keyPress:{phasedRegistrationNames:{bubbled:x({onKeyPress:!0}),captured:x({onKeyPressCapture:!0})}},keyUp:{phasedRegistrationNames:{bubbled:x({onKeyUp:!0}),captured:x({onKeyUpCapture:!0})}},load:{phasedRegistrationNames:{bubbled:x({onLoad:!0}),captured:x({onLoadCapture:!0})}},loadedData:{phasedRegistrationNames:{bubbled:x({onLoadedData:!0}),captured:x({onLoadedDataCapture:!0})}},loadedMetadata:{phasedRegistrationNames:{bubbled:x({onLoadedMetadata:!0}),captured:x({onLoadedMetadataCapture:!0})}},loadStart:{phasedRegistrationNames:{bubbled:x({onLoadStart:!0}),captured:x({onLoadStartCapture:!0})}},mouseDown:{phasedRegistrationNames:{bubbled:x({onMouseDown:!0}),captured:x({onMouseDownCapture:!0})}},mouseMove:{phasedRegistrationNames:{bubbled:x({onMouseMove:!0}),captured:x({onMouseMoveCapture:!0})}},mouseOut:{phasedRegistrationNames:{bubbled:x({onMouseOut:!0}),captured:x({onMouseOutCapture:!0})}},mouseOver:{phasedRegistrationNames:{bubbled:x({onMouseOver:!0}),captured:x({onMouseOverCapture:!0})}},mouseUp:{phasedRegistrationNames:{bubbled:x({onMouseUp:!0}),captured:x({onMouseUpCapture:!0})}},paste:{phasedRegistrationNames:{bubbled:x({onPaste:!0}),captured:x({onPasteCapture:!0})}},pause:{phasedRegistrationNames:{bubbled:x({onPause:!0}),captured:x({onPauseCapture:!0})}},play:{phasedRegistrationNames:{bubbled:x({onPlay:!0}),captured:x({onPlayCapture:!0})}},playing:{phasedRegistrationNames:{bubbled:x({onPlaying:!0}),captured:x({onPlayingCapture:!0})}},progress:{phasedRegistrationNames:{bubbled:x({onProgress:!0}),captured:x({onProgressCapture:!0})}},rateChange:{phasedRegistrationNames:{bubbled:x({onRateChange:!0}),captured:x({onRateChangeCapture:!0})}},reset:{phasedRegistrationNames:{bubbled:x({onReset:!0}),captured:x({onResetCapture:!0})}},scroll:{phasedRegistrationNames:{bubbled:x({onScroll:!0}),captured:x({onScrollCapture:!0})}},seeked:{phasedRegistrationNames:{bubbled:x({onSeeked:!0}),captured:x({onSeekedCapture:!0})}},seeking:{phasedRegistrationNames:{bubbled:x({onSeeking:!0}),captured:x({onSeekingCapture:!0})}},stalled:{phasedRegistrationNames:{bubbled:x({onStalled:!0}),captured:x({onStalledCapture:!0})}},submit:{phasedRegistrationNames:{bubbled:x({onSubmit:!0}),captured:x({onSubmitCapture:!0})}},suspend:{phasedRegistrationNames:{bubbled:x({onSuspend:!0}),captured:x({onSuspendCapture:!0})}},timeUpdate:{phasedRegistrationNames:{bubbled:x({onTimeUpdate:!0}),captured:x({onTimeUpdateCapture:!0})}},touchCancel:{phasedRegistrationNames:{bubbled:x({onTouchCancel:!0}),captured:x({onTouchCancelCapture:!0})}},touchEnd:{phasedRegistrationNames:{bubbled:x({onTouchEnd:!0}),captured:x({onTouchEndCapture:!0})}},touchMove:{phasedRegistrationNames:{bubbled:x({onTouchMove:!0}),captured:x({onTouchMoveCapture:!0})}},touchStart:{phasedRegistrationNames:{bubbled:x({onTouchStart:!0}),captured:x({onTouchStartCapture:!0})}},transitionEnd:{phasedRegistrationNames:{bubbled:x({onTransitionEnd:!0}),captured:x({onTransitionEndCapture:!0})}},volumeChange:{phasedRegistrationNames:{bubbled:x({onVolumeChange:!0}),captured:x({onVolumeChangeCapture:!0})}},waiting:{phasedRegistrationNames:{bubbled:x({onWaiting:!0}),captured:x({onWaitingCapture:!0})}},wheel:{phasedRegistrationNames:{bubbled:x({onWheel:!0}),captured:x({onWheelCapture:!0})}}},C={topAbort:w.abort,topAnimationEnd:w.animationEnd,topAnimationIteration:w.animationIteration,topAnimationStart:w.animationStart,topBlur:w.blur,topCanPlay:w.canPlay,topCanPlayThrough:w.canPlayThrough,topClick:w.click,topContextMenu:w.contextMenu,topCopy:w.copy,topCut:w.cut,topDoubleClick:w.doubleClick,topDrag:w.drag,topDragEnd:w.dragEnd,topDragEnter:w.dragEnter,topDragExit:w.dragExit,topDragLeave:w.dragLeave,topDragOver:w.dragOver,topDragStart:w.dragStart,topDrop:w.drop,topDurationChange:w.durationChange,topEmptied:w.emptied,topEncrypted:w.encrypted,topEnded:w.ended,topError:w.error,topFocus:w.focus,topInput:w.input,topInvalid:w.invalid,topKeyDown:w.keyDown,topKeyPress:w.keyPress,topKeyUp:w.keyUp,topLoad:w.load,topLoadedData:w.loadedData,topLoadedMetadata:w.loadedMetadata,topLoadStart:w.loadStart,topMouseDown:w.mouseDown,topMouseMove:w.mouseMove,topMouseOut:w.mouseOut,topMouseOver:w.mouseOver,topMouseUp:w.mouseUp,topPaste:w.paste,topPause:w.pause,topPlay:w.play,topPlaying:w.playing,topProgress:w.progress,topRateChange:w.rateChange,topReset:w.reset,topScroll:w.scroll,topSeeked:w.seeked,topSeeking:w.seeking,topStalled:w.stalled,topSubmit:w.submit,topSuspend:w.suspend,topTimeUpdate:w.timeUpdate,topTouchCancel:w.touchCancel,topTouchEnd:w.touchEnd,topTouchMove:w.touchMove,topTouchStart:w.touchStart,topTransitionEnd:w.transitionEnd,topVolumeChange:w.volumeChange,topWaiting:w.waiting,topWheel:w.wheel};for(var P in C)C[P].dependencies=[P];var S=x({onClick:null}),O={},T={eventTypes:w,extractEvents:function(e,t,n,r){var o=C[e];if(!o)return null;var a;switch(e){case E.topAbort:case E.topCanPlay:case E.topCanPlayThrough:case E.topDurationChange:case E.topEmptied:case E.topEncrypted:case E.topEnded:case E.topError:case E.topInput:case E.topInvalid:case E.topLoad:case E.topLoadedData:case E.topLoadedMetadata:case E.topLoadStart:case E.topPause:case E.topPlay:case E.topPlaying:case E.topProgress:case E.topRateChange:case E.topReset:case E.topSeeked:case E.topSeeking:case E.topStalled:case E.topSubmit:case E.topSuspend:case E.topTimeUpdate:case E.topVolumeChange:case E.topWaiting:a=c;break;case E.topKeyPress:if(0===b(n))return null;case E.topKeyDown:case E.topKeyUp:a=p;break;case E.topBlur:case E.topFocus:a=l;break;case E.topClick:if(2===n.button)return null;case E.topContextMenu:case E.topDoubleClick:case E.topMouseDown:case E.topMouseMove:case E.topMouseOut:case E.topMouseOver:case E.topMouseUp:a=f;break;case E.topDrag:case E.topDragEnd:case E.topDragEnter:case E.topDragExit:case E.topDragLeave:case E.topDragOver:case E.topDragStart:case E.topDrop:a=d;break;case E.topTouchCancel:case E.topTouchEnd:case E.topTouchMove:case E.topTouchStart:a=h;break;case E.topAnimationEnd:case E.topAnimationIteration:case E.topAnimationStart:a=u;break;case E.topTransitionEnd:a=v;break;case E.topScroll:a=m;break;case E.topWheel:a=y;break;case E.topCopy:case E.topCut:case E.topPaste:a=s}a?void 0:_(!1);var g=a.getPooled(o,t,n,r);return i.accumulateTwoPhaseDispatches(g),g},didPutListener:function(e,t,n){if(t===S){var r=e._rootNodeID,i=a.getNodeFromInstance(e);O[r]||(O[r]=o.listen(i,"click",g))}},willDeleteListener:function(e,t){if(t===S){var n=e._rootNodeID;O[n].remove(),delete O[n]}}};e.exports=T},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(13),i={animationName:null,elapsedTime:null,pseudoElement:null};o.augmentClass(r,i),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(13),i={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};o.augmentClass(r,i),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(13),i={data:null};o.augmentClass(r,i),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(51),i={dataTransfer:null};o.augmentClass(r,i),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(30),i={relatedTarget:null};o.augmentClass(r,i),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(13),i={data:null};o.augmentClass(r,i),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(30),i=n(83),a=n(357),u=n(84),s={key:a,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:u,charCode:function(e){return"keypress"===e.type?i(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?i(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};o.augmentClass(r,s),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(30),i=n(84),a={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:i};o.augmentClass(r,a),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(13),i={propertyName:null,elapsedTime:null,pseudoElement:null};o.augmentClass(r,i),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(51),i={deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null};o.augmentClass(r,i),e.exports=r},function(e,t){"use strict";function n(e){for(var t=1,n=0,o=0,i=e.length,a=-4&i;a>o;){for(var u=Math.min(o+4096,a);u>o;o+=4)n+=(t+=e.charCodeAt(o))+(t+=e.charCodeAt(o+1))+(t+=e.charCodeAt(o+2))+(t+=e.charCodeAt(o+3));t%=r,n%=r}for(;i>o;o++)n+=t+=e.charCodeAt(o);return t%=r,n%=r,t|n<<16}var r=65521;e.exports=n},function(e,t,n){"use strict";function r(e,t,n){var r=null==t||"boolean"==typeof t||""===t;if(r)return"";var o=isNaN(t);return o||0===t||i.hasOwnProperty(e)&&i[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}var o=n(141),i=(n(2),o.isUnitlessNumber);e.exports=r},function(e,t,n){"use strict";function r(e){if(null==e)return null;if(1===e.nodeType)return e;var t=i.get(e);return t?(t=a(t),t?o.getNodeFromInstance(t):null):void u(("function"==typeof e.render,!1))}var o=(n(20),n(5)),i=n(79),a=n(165),u=n(1);n(2),e.exports=r},function(e,t,n){"use strict";function r(e,t,n){var r=e,o=void 0===r[n];o&&null!=t&&(r[n]=t)}function o(e){if(null==e)return e;var t={};return i(e,r,t),t}var i=(n(75),n(90));n(2),e.exports=o},function(e,t,n){"use strict";function r(e){if(e.key){var t=i[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=o(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?a[e.keyCode]||"Unidentified":""}var o=n(83),i={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},a={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};e.exports=r},function(e,t){"use strict";function n(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function r(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function o(e,t){for(var o=n(e),i=0,a=0;o;){if(3===o.nodeType){if(a=i+o.textContent.length,t>=i&&a>=t)return{node:o,offset:t-i};i=a}o=n(r(o))}}e.exports=o},function(e,t,n){"use strict";function r(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n["ms"+e]="MS"+t,n["O"+e]="o"+t.toLowerCase(),n}function o(e){if(u[e])return u[e];if(!a[e])return e;var t=a[e];for(var n in t)if(t.hasOwnProperty(n)&&n in s)return u[e]=t[n];return""}var i=n(6),a={animationend:r("Animation","AnimationEnd"),animationiteration:r("Animation","AnimationIteration"),animationstart:r("Animation","AnimationStart"),transitionend:r("Transition","TransitionEnd")},u={},s={};i.canUseDOM&&(s=document.createElement("div").style,"AnimationEvent"in window||(delete a.animationend.animation,delete a.animationiteration.animation,delete a.animationstart.animation),"TransitionEvent"in window||delete a.transitionend.transition),e.exports=o},function(e,t,n){"use strict";function r(e){return'"'+o(e)+'"'}var o=n(53);e.exports=r},function(e,t,n){"use strict";var r=n(153);e.exports=r.renderSubtreeIntoContainer},function(e,t,n){"use strict";function r(e,t,n){
return!o(e.props,t)||!o(e.state,n)}var o=n(55);e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(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 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):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(69),c=r(s),l=n(44),p=r(l),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=n(4),h=r(d),v=n(46),m=n(370),y=r(m),g=n(31),b=r(g),_=function(e,t,n){var r=e.asyncValidate,s=e.blur,l=e.change,m=e.focus,g=e.getFormState,_=e.initialValues,x=t.deepEqual,E=t.getIn,w=function(e){function t(){return i(this,t),a(this,Object.getPrototypeOf(t).apply(this,arguments))}return u(t,e),f(t,[{key:"shouldComponentUpdate",value:function(e){return!x(this.props,e)}},{key:"getRenderedComponent",value:function(){return this.refs.renderedComponent}},{key:"render",value:function(){var e=this.props,t=e.component,i=e.defaultValue,a=e.withRef,u=o(e,["component","defaultValue","withRef"]),s=(0,y["default"])(E,n,u,this.syncError,_&&E(_,n),i,r);return a&&(s.ref="renderedComponent"),h["default"].createElement(t,s)}},{key:"syncError",get:function(){var e=this.context._reduxForm.getSyncErrors,t=b["default"].getIn(e(),n);return t&&t._error?t._error:t}},{key:"valid",get:function(){var e=this.props,t=e.asyncError,n=e.submitError,r=this.syncError||t||n;return!r}}]),t}(d.Component);w.propTypes={component:d.PropTypes.oneOfType([d.PropTypes.func,d.PropTypes.string]).isRequired,defaultValue:d.PropTypes.any},w.contextTypes={_reduxForm:d.PropTypes.object};var C=(0,c["default"])({blur:s,change:l,focus:m},function(e){return(0,p["default"])(e,n)}),P=(0,v.connect)(function(e,t){return{initial:E(g(e),"initial."+n),value:E(g(e),"values."+n),state:E(g(e),"fields."+n),asyncError:E(g(e),"asyncErrors."+n),submitError:E(g(e),"submitErrors."+n),asyncValidating:E(g(e),"asyncValidating")===n,_value:t.value}},C,void 0,{withRef:!0});return P(w)};t["default"]=_},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(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 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):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(69),c=r(s),l=n(44),p=r(l),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=n(4),h=r(d),v=n(46),m=n(369),y=r(m),g=n(31),b=r(g),_=n(71),x=r(_),E=function(e,t,n){var r=e.arrayInsert,s=e.arrayPop,l=e.arrayPush,m=e.arrayRemove,g=e.arrayShift,_=e.arraySplice,E=e.arraySwap,w=e.arrayUnshift,C=(e.asyncValidate,e.blur,e.change,e.focus,e.getFormState),P=e.initialValues,S=t.deepEqual,O=t.getIn,T=t.size,A=function(e){function t(){return i(this,t),a(this,Object.getPrototypeOf(t).apply(this,arguments))}return u(t,e),f(t,[{key:"shouldComponentUpdate",value:function(e){return(0,x["default"])(this,e)}},{key:"getRenderedComponent",value:function(){return this.refs.renderedComponent}},{key:"render",value:function(){var e=this.props,t=e.component,r=e.withRef,i=o(e,["component","withRef"]),a=(0,y["default"])(S,O,T,n,i,this.syncError,P&&O(P,n));return r&&(a.ref="renderedComponent"),h["default"].createElement(t,a)}},{key:"syncError",get:function(){var e=this.context._reduxForm.getSyncErrors;return b["default"].getIn(e(),n+"._error")}},{key:"valid",get:function(){var e=this.props,t=e.asyncError,n=e.submitError,r=this.syncError||t||n;return!r}}]),t}(d.Component);A.propTypes={component:d.PropTypes.oneOfType([d.PropTypes.func,d.PropTypes.string]).isRequired,defaultValue:d.PropTypes.any},A.contextTypes={_reduxForm:d.PropTypes.object};var M=(0,c["default"])({arrayInsert:r,arrayPop:s,arrayPush:l,arrayRemove:m,arrayShift:g,arraySplice:_,arraySwap:E,arrayUnshift:w},function(e){return(0,p["default"])(e,n)}),k=(0,v.connect)(function(e){return{initial:O(C(e),"initial."+n),value:O(C(e),"values."+n),asyncError:O(C(e),"asyncErrors."+n+"._error"),submitError:O(C(e),"submitErrors."+n+"._error")}},M,void 0,{withRef:!0});return k(A)};t["default"]=E},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(4),l=r(c),p=n(33),f=r(p),d=n(363),h=r(d),v=n(71),m=r(v),y=0,g=function(){return"redux-form-field-"+y++},b=function(e){var t=e.deepEqual,n=e.getIn,r=function(e){function r(e,a){o(this,r);var u=i(this,Object.getPrototypeOf(r).call(this,e,a));if(!a._reduxForm)throw new Error("Field must be inside a component decorated with reduxForm()");return u.key=g(),u.ConnectedField=(0,h["default"])(a._reduxForm,{deepEqual:t,getIn:n},e.name),u}return a(r,e),s(r,[{key:"shouldComponentUpdate",value:function(e){var t=u({},this.props),n=u({},e);return delete t.component,delete n.component,console.info(t,n),(0,m["default"])({props:t},n)}},{key:"componentWillMount",value:function(){this.context._reduxForm.register(this.key,this)}},{key:"componentWillReceiveProps",value:function(e){this.props.name!==e.name&&(this.ConnectedField=(0,h["default"])(this.context._reduxForm,{deepEqual:t,getIn:n},e.name))}},{key:"componentWillUnmount",value:function(){this.context._reduxForm.unregister(this.key)}},{key:"getRenderedComponent",value:function(){return(0,f["default"])(this.props.withRef,"If you want to access getRenderedComponent(), you must specify a withRef prop to Field"),this.refs.connected.getWrappedInstance().getRenderedComponent()}},{key:"render",value:function(){var e=this.ConnectedField;return l["default"].createElement(e,u({},this.props,{ref:"connected"}))}},{key:"valid",get:function(){return this.refs.connected.getWrappedInstance().valid}},{key:"name",get:function(){return this.props.name}}]),r}(c.Component);return r.propTypes={name:c.PropTypes.string.isRequired,component:c.PropTypes.oneOfType([c.PropTypes.func,c.PropTypes.string]).isRequired,defaultValue:c.PropTypes.any},r.contextTypes={_reduxForm:c.PropTypes.object},r};t["default"]=b},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(4),l=r(c),p=n(33),f=r(p),d=n(364),h=r(d),v=n(71),m=r(v),y=0,g=function(){return"redux-form-field-array-"+y++},b=function(e){var t=e.deepEqual,n=e.getIn,r=e.size,p=function(e){function c(e,a){o(this,c);var u=i(this,Object.getPrototypeOf(c).call(this,e,a));if(!a._reduxForm)throw new Error("FieldArray must be inside a component decorated with reduxForm()");return u.key=g(),u.ConnectedFieldArray=(0,h["default"])(a._reduxForm,{deepEqual:t,getIn:n,size:r},e.name),u}return a(c,e),s(c,[{key:"shouldComponentUpdate",value:function(e){var t=u({},this.props),n=u({},e);return delete t.component,delete n.component,(0,m["default"])({props:t},n)}},{key:"componentWillMount",value:function(){this.context._reduxForm.register(this.key,this)}},{key:"componentWillReceiveProps",value:function(e){this.props.name!==e.name&&(this.ConnectedFieldArray=(0,h["default"])(this.context._reduxForm,{deepEqual:t,getIn:n,size:r},e.name))}},{key:"componentWillUnmount",value:function(){this.context._reduxForm.unregister(this.key)}},{key:"getRenderedComponent",value:function(){return(0,f["default"])(this.props.withRef,"If you want to access getRenderedComponent(), you must specify a withRef prop to FieldArray"),this.refs.connected.getWrappedInstance().getRenderedComponent()}},{key:"render",value:function(){var e=this.ConnectedFieldArray;return l["default"].createElement(e,u({},this.props,{ref:"connected"}))}},{key:"valid",get:function(){return this.refs.connected.getWrappedInstance().valid}},{key:"name",get:function(){return this.props.name}}]),c}(c.Component);return p.propTypes={name:c.PropTypes.string.isRequired,component:c.PropTypes.func.isRequired},p.contextTypes={_reduxForm:c.PropTypes.object},p};t["default"]=b},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(56),i=r(o),a=function(e,t,n,r){t(r);var o=e();if(!(0,i["default"])(o))throw new Error("asyncValidate function passed to reduxForm must return a promise");var a=function(e){return function(t){if(t&&Object.keys(t).length)return n(t),Promise.reject();if(e)throw n(),new Error("Asynchronous validation promise was rejected without errors.");return n(),Promise.resolve()}};return o.then(a(!1),a(!0))};t["default"]=a},function(e,t,n){"use strict";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}function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(383),u=o(a),s=n(384),c=o(s),l=n(365),p=o(l),f=n(366),d=o(f),h=n(378),v=o(h),m=n(391),y=o(m),g=n(169),b=o(g),_=n(382),x=o(_),E=n(170),w=r(E),C=n(92),P=r(C),S=function(e){return i({actionTypes:P},w,{Field:(0,p["default"])(e),FieldArray:(0,d["default"])(e),formValueSelector:(0,v["default"])(e),propTypes:x["default"],reduxForm:(0,c["default"])(e),reducer:(0,u["default"])(e),SubmissionError:b["default"],values:(0,y["default"])(e)})};t["default"]=S},function(e,t){"use strict";function n(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}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 r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(e,t,o,i,a,u,s){var c=a.arrayInsert,l=a.arrayPop,p=a.arrayPush,f=a.arrayRemove,d=a.arrayShift,h=(a.arraySplice,a.arraySwap),v=a.arrayUnshift,m=a.asyncError,y=a.initial,g=(a.state,a.submitError),b=(a.submitFailed,a.value),_=n(a,["arrayInsert","arrayPop","arrayPush","arrayRemove","arrayShift","arraySplice","arraySwap","arrayUnshift","asyncError","initial","state","submitError","submitFailed","value"]),x=u||m||g,E=y||s,w=b||E,C=e(b,E),P=o(w);return r({dirty:!C,error:x,forEach:function(e){return(w||[]).forEach(function(t,n){return e(i+"["+n+"]",n)})},insert:c,invalid:!!x,length:P,map:function(e){return(w||[]).map(function(t,n){return e(i+"["+n+"]",n)})},pop:function(){return l(),t(w,P-1)},pristine:C,push:p,remove:f,shift:function(){return d(),t(w,0)},swap:h,unshift:v,valid:!x},_)};t["default"]=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}Object.defineProperty(t,"__esModule",{value:!0});var i=n(136),a=r(i),u=n(44),s=r(u),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=n(373),p=r(l),f=n(374),d=r(f),h=n(171),v=r(h),m=n(375),y=r(m),g=n(376),b=r(g),_=function(e,t){var n=e.type,r=e.value,i=o(e,["type","value"]);return"checkbox"===n?c({},i,{checked:!!r,type:n}):"radio"===n?c({},i,{checked:r===t,type:n,value:t}):"select-multiple"===n?c({},i,{type:n,value:r||[]}):e},x=function(e,t,n,r,i){var u=n.asyncError,l=n.blur,f=n.change,h=n.focus,m=n.initial,g=n.state,x=n.submitError,E=n.value,w=n._value,C=o(n,["asyncError","blur","change","focus","initial","state","submitError","value","_value"]),P=arguments.length<=5||void 0===arguments[5]?"":arguments[5],S=arguments.length<=6||void 0===arguments[6]?a["default"]:arguments[6],O=r||u||x,T=(0,d["default"])(f),A=m||i;return _(c({active:g&&!!e(g,"active"),dirty:E!==A,error:O,invalid:!!O,name:t,onBlur:(0,p["default"])(l,(0,s["default"])(S,t)),onChange:T,onDragStart:(0,v["default"])(t,E),onDrop:(0,y["default"])(t,f),onFocus:(0,b["default"])(t,h),onUpdate:T,pristine:E===A,touched:!(!g||!e(g,"touched")),valid:!O,value:null==E?P:E,visited:g&&!!e(g,"visited")},C),w)};t["default"]=x},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=t.defaultShouldAsyncValidate=function(e){var t=e.initialized,n=e.trigger,r=e.pristine,o=e.syncValidationPasses;if(!o)return!1;switch(n){case"blur":return!0;case"submit":return!r||!t;default:return!1}};t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(45),i=r(o),a=function(e){var t=e.deepEqual,n=e.empty,r=e.getIn,o=e.deleteIn,a=e.setIn,u=function s(e,u){if("]"===u[u.length-1]){var c=(0,i["default"])(u);c.pop();var l=r(e,c.join("."));return l?a(e,u,void 0):e}var p=o(e,u),f=u.lastIndexOf(".");if(f>0){var d=u.substring(0,f),h=r(p,d);if(t(h,n))return s(p,d)}return p};return u};t["default"]=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(172),i=r(o),a=n(175),u=r(a),s=function(e,t){return function(n){var r=(0,i["default"])(n,u["default"]);e(r),t&&t(r)}};t["default"]=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(172),i=r(o),a=n(175),u=r(a),s=function(e){return function(t){return e((0,i["default"])(t,u["default"]))}};t["default"]=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(171),o=function(e,t){return function(n){t(e,n.dataTransfer.getData(r.dataKey))}};t["default"]=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return function(){return t(e)}};t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(174),i=r(o),a=function(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];return(0,i["default"])(t)?e.apply(void 0,r):e.apply(void 0,[t].concat(r))}};t["default"]=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(33),i=r(o),a=n(31),u=r(a),s=function(e){var t=e.getIn;return function(e){var n=arguments.length<=1||void 0===arguments[1]?function(e){return t(e,"form")}:arguments[1];return(0,i["default"])(e,"Form value must be specified"),function(r){for(var o=arguments.length,a=Array(o>1?o-1:0),s=1;o>s;s++)a[s-1]=arguments[s];return(0,i["default"])(a.length,"No fields specified"),1===a.length?t(n(r),e+".values."+a[0]):a.reduce(function(o,i){var a=t(n(r),e+".values."+i);return void 0===a?o:u["default"].setIn(o,i,a)},{})}}};t["default"]=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":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)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(56),a=r(i),u=n(169),s=r(u),c=function(e,t,n,r,i){var u=t.dispatch,c=t.startSubmit,l=t.stopSubmit,p=t.setSubmitFailed,f=t.syncErrors,d=t.returnRejectedSubmitPromise,h=t.values;if(n){var v=function(){var t=e(h,u);return(0,a["default"])(t)?(c(),t.then(function(e){return l(),e})["catch"](function(e){return l(e instanceof s["default"]?e.errors:void 0),d?Promise.reject(e):void 0})):t},m=r&&r();return m?m.then(v,function(e){return p.apply(void 0,o(i)),d?Promise.reject(e):void 0}):v()}return p.apply(void 0,o(i)),d?Promise.reject(f):void 0};t["default"]=c},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){var t=e.getIn,n=e.some,r=function o(e){if(!e)return!1;var r=t(e,"_error");return r?!0:"string"==typeof e?!!e:!!e&&n(e,o)};return r};t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.values=t.untouch=t.touch=t.swapArrayValues=t.SubmissionError=t.stopSubmit=t.stopAsyncValidation=t.startSubmit=t.startAsyncValidation=t.setSubmitFailed=t.reset=t.propTypes=t.initialize=t.removeArrayValue=t.reduxForm=t.reducer=t.formValueSelector=t.focus=t.FieldArray=t.Field=t.destroy=t.change=t.blur=t.addArrayValue=t.actionTypes=void 0;var o=n(368),i=r(o),a=n(31),u=r(a),s=(0,i["default"])(u["default"]),c=s.actionTypes,l=s.addArrayValue,p=s.blur,f=s.change,d=s.destroy,h=s.Field,v=s.FieldArray,m=s.focus,y=s.formValueSelector,g=s.reducer,b=s.reduxForm,_=s.removeArrayValue,x=s.initialize,E=s.propTypes,w=s.reset,C=s.setSubmitFailed,P=s.startAsyncValidation,S=s.startSubmit,O=s.stopAsyncValidation,T=s.stopSubmit,A=s.SubmissionError,M=s.swapArrayValues,k=s.touch,N=s.untouch,R=s.values;t.actionTypes=c,t.addArrayValue=l,t.blur=p,t.change=f,t.destroy=d,t.Field=h,t.FieldArray=v,t.focus=m,t.formValueSelector=y,t.reducer=g,t.reduxForm=b,t.removeArrayValue=_,t.initialize=x,t.propTypes=E,t.reset=w,t.setSubmitFailed=C,t.startAsyncValidation=P,t.startSubmit=S,t.stopAsyncValidation=O,t.stopSubmit=T,t.SubmissionError=A,t.swapArrayValues=M,t.touch=k,t.untouch=N,t.values=R},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.propTypes=void 0;var r=n(4),o=r.PropTypes.any,i=r.PropTypes.bool,a=r.PropTypes.func;t.propTypes={asyncValidating:i.isRequired,dirty:i.isRequired,error:o,invalid:i.isRequired,pristine:i.isRequired,submitting:i.isRequired,submitFailed:i.isRequired,valid:i.isRequired,asyncValidate:a.isRequired,destroy:a.isRequired,handleSubmit:a.isRequired,initialize:a.isRequired,reset:a.isRequired,touch:a.isRequired,untouch:a.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":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 i(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}Object.defineProperty(t,"__esModule",{value:!0});var a=n(92),u=n(372),s=r(u),c=function(e){function t(e){return e}var n,r=e.splice,u=e.empty,c=e.getIn,l=e.setIn,p=e.deleteIn,f=e.fromJS,d=e.size,h=(0,s["default"])(e),v=function(e,t,n,o,i,a,u){var s=c(e,t+"."+n);return s||u?l(e,t+"."+n,r(s,o,i,a)):e},m=["values","fields","submitErrors","asyncErrors"],y=function(e,t,n,r,o){var i=e;return i=v(i,"values",t,n,r,o,!0),i=v(i,"fields",t,n,r,u),i=v(i,"submitErrors",t,n,r,u),i=v(i,"asyncErrors",t,n,r,u)},g=(n={},o(n,a.ARRAY_INSERT,function(e,t){var n=t.meta,r=n.field,o=n.index,i=t.payload;return y(e,r,o,0,i)}),o(n,a.ARRAY_POP,function(e,t){var n=t.meta.field,r=c(e,"values."+n),o=r?d(r):0;return o?y(e,n,o-1,1):e}),o(n,a.ARRAY_PUSH,function(e,t){var n=t.meta.field,r=t.payload,o=c(e,"values."+n),i=o?d(o):0;return y(e,n,i,0,r)}),o(n,a.ARRAY_REMOVE,function(e,t){var n=t.meta,r=n.field,o=n.index;return y(e,r,o,1)}),o(n,a.ARRAY_SHIFT,function(e,t){var n=t.meta.field;return y(e,n,0,1)}),o(n,a.ARRAY_SPLICE,function(e,t){var n=t.meta,r=n.field,o=n.index,i=n.removeNum,a=t.payload;return y(e,r,o,i,a)}),o(n,a.ARRAY_SWAP,function(e,t){var n=t.meta,r=n.field,o=n.indexA,i=n.indexB,a=e;return m.forEach(function(e){var t=c(a,e+"."+r+"["+o+"]"),n=c(a,e+"."+r+"["+i+"]");void 0===t&&void 0===n||(a=l(a,e+"."+r+"["+o+"]",n),a=l(a,e+"."+r+"["+i+"]",t))}),a}),o(n,a.ARRAY_UNSHIFT,function(e,t){var n=t.meta.field,r=t.payload;return y(e,n,0,0,r)}),o(n,a.BLUR,function(e,t){var n=t.meta,r=n.field,o=n.touch,i=t.payload,a=e,u=c(a,"initial."+r);return void 0===u&&""===i?a=h(a,"values."+r):void 0!==i&&(a=l(a,"values."+r,i)),a=p(a,"active"),a=p(a,"fields."+r+".active"),o&&(a=l(a,"fields."+r+".touched",!0),a=l(a,"anyTouched",!0)),a}),o(n,a.CHANGE,function(e,t){var n=t.meta,r=n.field,o=n.touch,i=t.payload,a=e,u=c(a,"initial."+r);return void 0===u&&""===i?a=h(a,"values."+r):void 0!==i&&(a=l(a,"values."+r,i)),a=h(a,"asyncErrors."+r),a=h(a,"submitErrors."+r),o&&(a=l(a,"fields."+r+".touched",!0),a=l(a,"anyTouched",!0)),a}),o(n,a.FOCUS,function(e,t){var n=t.meta.field,r=e,o=c(e,"active");return r=p(r,"fields."+o+".active"),r=l(r,"fields."+n+".visited",!0),r=l(r,"fields."+n+".active",!0),r=l(r,"active",n)}),o(n,a.INITIALIZE,function(e,t){var n=t.payload,r=f(n),o=u;return o=l(o,"values",r),o=l(o,"initial",r)}),o(n,a.RESET,function(e){var t=c(e,"initial"),n=u;return t?(n=l(n,"values",t),n=l(n,"initial",t)):n=h(n,"values"),n}),o(n,a.START_ASYNC_VALIDATION,function(e,t){var n=t.meta.field;return l(e,"asyncValidating",n||!0)}),o(n,a.START_SUBMIT,function(e){return l(e,"submitting",!0)}),o(n,a.STOP_ASYNC_VALIDATION,function(e,t){var n=t.payload,r=e;if(r=p(r,"asyncValidating"),n&&Object.keys(n).length){var o=n._error,a=i(n,["_error"]);o&&(r=l(r,"error",o)),r=Object.keys(a).length?l(r,"asyncErrors",f(a)):p(r,"asyncErrors")}else r=p(r,"error"),r=p(r,"asyncErrors");return r}),o(n,a.STOP_SUBMIT,function(e,t){var n=t.payload,r=e;if(r=p(r,"submitting"),r=p(r,"submitFailed"),n&&Object.keys(n).length){var o=n._error,a=i(n,["_error"]);o&&(r=l(r,"error",o)),r=Object.keys(a).length?l(r,"submitErrors",f(a)):p(r,"submitErrors"),r=l(r,"submitFailed",!0)}else r=p(r,"error"),r=p(r,"submitErrors");return r}),o(n,a.SET_SUBMIT_FAILED,function(e,t){var n=t.meta.fields,r=e;return r=l(r,"submitFailed",!0),r=p(r,"submitting"),n.forEach(function(e){return r=l(r,"fields."+e+".touched",!0)}),n.length&&(r=l(r,"anyTouched",!0)),r}),o(n,a.TOUCH,function(e,t){var n=t.meta.fields,r=e;return n.forEach(function(e){return r=l(r,"fields."+e+".touched",!0)}),r=l(r,"anyTouched",!0)}),o(n,a.UNTOUCH,function(e,t){var n=t.meta.fields,r=e;return n.forEach(function(e){return r=p(r,"fields."+e+".touched")}),r}),n),b=function(){var e=arguments.length<=0||void 0===arguments[0]?u:arguments[0],t=arguments[1],n=g[t.type];return n?n(e,t):e},_=function(e){return function(){var t=arguments.length<=0||void 0===arguments[0]?u:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=n&&n.meta&&n.meta.form;if(!r)return t;if(n.type===a.DESTROY)return h(t,n.meta.form);var o=c(t,r),i=e(o,n);return i===o?t:l(t,r,i)}};return t(_(b))};t["default"]=c},function(e,t,n){"use strict";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}function o(e){return e&&e.__esModule?e:{"default":e}}function i(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 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):e.__proto__=t)}function s(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 c(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}Object.defineProperty(t,"__esModule",{value:!0});var l=n(282),p=o(l),f=n(44),d=o(f),h=n(69),v=o(h),m=n(273),y=o(m),g="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},b=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},x=n(4),E=o(x),w=n(100),C=o(w),P=n(46),S=n(178),O=n(56),T=o(O),A=n(390),M=o(A),k=n(170),N=r(k),R=n(379),I=o(R),j=n(174),D=o(j),F=n(377),L=o(F),U=n(367),V=o(U),B=n(380),W=o(B),q=n(371),H=o(q),Y=n(31),z=o(Y),K=N.arrayInsert,G=N.arrayPop,$=N.arrayPush,X=N.arrayRemove,Q=N.arrayShift,Z=N.arraySplice,J=N.arraySwap,ee=N.arrayUnshift,te=N.blur,ne=N.change,re=N.focus,oe=c(N,["arrayInsert","arrayPop","arrayPush","arrayRemove","arrayShift","arraySplice","arraySwap","arrayUnshift","blur","change","focus"]),ie=[].concat(s(Object.keys(N)),["array","asyncErrors","initialized","initialValues","syncErrors","values"]),ae=function(e){if(!e||"function"!=typeof e)throw new Error("You must either pass handleSubmit() an onSubmit function or pass onSubmit as a prop");return e},ue=function(e){var t=e.deepEqual,n=e.empty,r=e.getIn,o=e.setIn,s=e.fromJS,l=(0,W["default"])(e),f=(0,W["default"])(z["default"]);return function(e){var h=_({touchOnBlur:!0,touchOnChange:!1,destroyOnUnmount:!0,shouldAsyncValidate:H["default"],getFormState:function(e){return r(e,"form")}},e);return function(e){var m=function(n){function s(e){i(this,s);var t=a(this,Object.getPrototypeOf(s).call(this,e));return t.submit=t.submit.bind(t),t.reset=t.reset.bind(t),t.asyncValidate=t.asyncValidate.bind(t),t.getSyncErrors=t.getSyncErrors.bind(t),t.register=t.register.bind(t),t.unregister=t.unregister.bind(t),t.submitCompleted=t.submitCompleted.bind(t),t.fields={},t}return u(s,n),b(s,[{key:"getChildContext",value:function(){var e=this;return{_reduxForm:_({},this.props,{getFormState:function(t){return r(e.props.getFormState(t),e.props.form)},asyncValidate:this.asyncValidate,getSyncErrors:this.getSyncErrors,register:this.register,unregister:this.unregister})}}},{key:"initIfNeeded",value:function(e){var t=e.initialize,n=e.initialized,r=e.initialValues;r&&!n&&t(r)}},{key:"componentWillMount",value:function(){this.initIfNeeded(this.props)}},{key:"componentWillReceiveProps",value:function(e){this.initIfNeeded(e)}},{key:"shouldComponentUpdate",value:function(e){var n=this;return Object.keys(e).some(function(r){return!~ie.indexOf(r)&&!t(n.props[r],e[r])})}},{key:"componentWillUnmount",value:function(){var e=this.props,t=e.destroyOnUnmount,n=e.destroy;t&&n()}},{key:"getSyncErrors",value:function(){return this.props.syncErrors}},{key:"register",value:function(e,t){this.fields[e]=t}},{key:"unregister",value:function(e){delete this.fields[e]}},{key:"asyncValidate",value:function l(e,t){var n=this,i=this.props,a=i.asyncBlurFields,u=i.asyncErrors,l=i.asyncValidate,s=i.dispatch,c=i.initialized,p=i.pristine,f=i.shouldAsyncValidate,d=i.startAsyncValidation,h=i.stopAsyncValidation,v=i.syncErrors,m=i.values,y=!e;if(l){var b=function(){var i=y?m:o(m,e,t),g=y||!r(v,e),b=!y&&(!a||~a.indexOf(e.replace(/\[[0-9]+\]/g,"[]")));return(b||y)&&f({asyncErrors:u,initialized:c,trigger:y?"submit":"blur",blurredField:e,pristine:p,syncValidationPasses:g})?{v:(0,V["default"])(function(){return l(i,s,n.props)},d,h,e)}:void 0}();if("object"===("undefined"==typeof b?"undefined":g(b)))return b.v}}},{key:"submitCompleted",value:function(e){return delete this.submitPromise,e}},{key:"listenToSubmit",value:function(e){return(0,T["default"])(e)?(this.submitPromise=e,e.then(this.submitCompleted,this.submitCompleted)):e}},{key:"submit",value:function(e){var t=this;if(!this.submitPromise){var n=this.props.onSubmit;return!e||(0,D["default"])(e)?this.listenToSubmit((0,I["default"])(ae(n),this.props,this.valid,this.asyncValidate,this.fieldList)):(0,L["default"])(function(){return t.listenToSubmit((0,I["default"])(ae(e),t.props,t.valid,t.asyncValidate,t.fieldList))})}}},{key:"reset",value:function(){this.props.reset()}},{key:"render",value:function(){var t=this.props,n=(t.arrayInsert,t.arrayPop,t.arrayPush,t.arrayRemove,t.arrayShift,t.arraySplice,t.arraySwap,t.arrayUnshift,t.asyncErrors,t.reduxMountPoint,t.destroyOnUnmount,t.form,t.getFormState,t.touchOnBlur,t.touchOnChange,t.syncErrors,t.values,c(t,["arrayInsert","arrayPop","arrayPush","arrayRemove","arrayShift","arraySplice","arraySwap","arrayUnshift","asyncErrors","reduxMountPoint","destroyOnUnmount","form","getFormState","touchOnBlur","touchOnChange","syncErrors","values"]));return E["default"].createElement(e,_({},n,{handleSubmit:this.submit}))}},{key:"values",get:function(){return this.props.values}},{key:"valid",get:function(){return(0,y["default"])(this.fields,function(e){return e.valid})}},{key:"invalid",get:function(){return!this.valid}},{key:"fieldList",get:function(){var e=this;return Object.keys(this.fields).map(function(t){return e.fields[t].name})}}]),s}(x.Component);m.displayName="Form("+(0,M["default"])(e)+")",m.WrappedComponent=e,m.childContextTypes={_reduxForm:x.PropTypes.object.isRequired},m.propTypes={destroyOnUnmount:x.PropTypes.bool,form:x.PropTypes.string.isRequired,initialValues:x.PropTypes.object,getFormState:x.PropTypes.func,validate:x.PropTypes.func,touchOnBlur:x.PropTypes.bool,touchOnChange:x.PropTypes.bool
};var w=(0,P.connect)(function(e,o){var i=o.form,a=o.getFormState,u=o.initialValues,s=o.validate,c=r(a(e)||n,i)||n,p=r(c,"initial"),d=u||p||n,h=r(c,"values")||d,v=t(d,h),m=r(c,"asyncErrors"),y=r(c,"submitErrors"),g=s&&s(h,o)||{},b=f(g),_=l(m),x=l(y),E=!(b||_||x),w=!!r(c,"anyTouched"),C=!!r(c,"submitting"),P=!!r(c,"submitFailed"),S=r(c,"error");return{anyTouched:w,asyncErrors:m,asyncValidating:r(c,"asyncValidating"),dirty:!v,error:S,initialized:!!p,invalid:!E,pristine:v,submitting:C,submitFailed:P,syncErrors:g,values:h,valid:E}},function(e,t){return _({},(0,S.bindActionCreators)((0,v["default"])(_({},oe),function(e){return(0,d["default"])(e,t.form)}),e),{array:(0,S.bindActionCreators)((0,v["default"])({insert:K,pop:G,push:$,remove:X,shift:Q,splice:Z,swap:J,unshift:ee},function(e){return(0,d["default"])(e,t.form)}),e)},(0,v["default"])({arrayInsert:K,arrayPop:G,arrayPush:$,arrayRemove:X,arrayShift:Q,arraySplice:Z,arraySwap:J,arrayUnshift:ee,blur:(0,p["default"])(te,!!t.touchOnBlur),change:(0,p["default"])(ne,!!t.touchOnChange),focus:re},function(e){return(0,d["default"])(e,t.form)}),{dispatch:e})},void 0,{withRef:!0}),O=(0,C["default"])(w(m),e);return O.defaultProps=h,function(e){function t(){return i(this,t),a(this,Object.getPrototypeOf(t).apply(this,arguments))}return u(t,e),b(t,[{key:"submit",value:function(){return this.refs.wrapped.getWrappedInstance().submit()}},{key:"reset",value:function(){return this.refs.wrapped.getWrappedInstance().reset()}},{key:"render",value:function(){var e=this.props,t=e.initialValues,n=c(e,["initialValues"]);return E["default"].createElement(O,_({ref:"wrapped",initialValues:s(t)},n))}},{key:"valid",get:function(){return this.refs.wrapped.getWrappedInstance().valid}},{key:"invalid",get:function(){return this.refs.wrapped.getWrappedInstance().invalid}},{key:"values",get:function(){return this.refs.wrapped.getWrappedInstance().values}},{key:"fieldList",get:function(){return this.refs.wrapped.getWrappedInstance().fieldList}}]),t}(x.Component)}}};t["default"]=ue},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(277),i=r(o),a=function(e,t){return e==t?!0:null==e&&""===t?!0:""===e&&null==t?!0:void 0},u=function(e,t){return(0,i["default"])(e,t,a)};t["default"]=u},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":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 i(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 a=n(45),u=r(a),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function p(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),a=2;n>a;a++)r[a-2]=arguments[a];if(void 0===e||void 0===t)return e;if(r.length){if(Array.isArray(e)){if(t<e.length){var u=[].concat(i(e));return u[t]=p.apply(void 0,[e&&e[t]].concat(r)),u}return e}return t in e?s({},e,o({},t,p.apply(void 0,[e&&e[t]].concat(r)))):e}if(Array.isArray(e)){if(isNaN(t))throw new Error("Cannot delete non-numerical index from an array");if(t<e.length){var c=[].concat(i(e));return c.splice(t,1),c}return e}if(t in e){var l=s({},e);return delete l[t],l}return e},l=function(e,t){return c.apply(void 0,[e].concat(i((0,u["default"])(t))))};t["default"]=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":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)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(45),a=r(i),u=function c(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;n>o;o++)r[o-2]=arguments[o];if(!e)return e;var i=e[t];return r.length?c.apply(void 0,[i].concat(r)):i},s=function(e,t){return u.apply(void 0,[e].concat(o((0,a["default"])(t))))};t["default"]=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":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 i(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 a=n(45),u=r(a),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function p(e,t,n){for(var r=arguments.length,a=Array(r>3?r-3:0),u=3;r>u;u++)a[u-3]=arguments[u];if(void 0===n)return t;var c=p.apply(void 0,[e&&e[n],t].concat(a));if(!e){var l=isNaN(n)?{}:[];return l[n]=c,l}if(Array.isArray(e)){var f=[].concat(i(e));return f[n]=c,f}return s({},e,o({},n,c))},l=function(e,t,n){return c.apply(void 0,[e,n].concat(i((0,u["default"])(t))))};t["default"]=l},function(e,t){"use strict";function n(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 r=function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments[1],r=arguments[2],o=arguments[3],i=[].concat(n(e));return r?i.splice(t,r):i.splice(t,0,o),i};t["default"]=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return e.displayName||e.name||"Component"};t["default"]=n},function(e,t,n){"use strict";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=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(46),a=function(e){var t=e.empty,n=e.getIn;return function(e){var a=o({prop:"values",getFormState:function(e){return n(e,"form")}},e),u=a.form,s=a.prop,c=a.getFormState;return(0,i.connect)(function(e){return r({},s,n(c(e),u+".values")||t)})}};t["default"]=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return function(e){return function(n,r,o){var a=e(n,r,o),s=a.dispatch,c=[],l={getState:a.getState,dispatch:function(e){return s(e)}};return c=t.map(function(e){return e(l)}),s=u["default"].apply(void 0,c)(a.dispatch),i({},a,{dispatch:s})}}}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t["default"]=o;var a=n(176),u=r(a)},function(e,t){"use strict";function n(e,t){return function(){return t(e.apply(void 0,arguments))}}function r(e,t){if("function"==typeof e)return n(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var r=Object.keys(e),o={},i=0;i<r.length;i++){var a=r[i],u=e[a];"function"==typeof u&&(o[a]=n(u,t))}return o}t.__esModule=!0,t["default"]=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n=t&&t.type,r=n&&'"'+n.toString()+'"'||"an action";return"Given action "+r+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state.'}function i(e){Object.keys(e).forEach(function(t){var n=e[t],r=n(void 0,{type:u.ActionTypes.INIT});if("undefined"==typeof r)throw new Error('Reducer "'+t+'" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined.');var o="@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".");if("undefined"==typeof n(void 0,{type:o}))throw new Error('Reducer "'+t+'" returned undefined when probed with a random type. '+("Don't try to handle "+u.ActionTypes.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined.")})}function a(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var a=t[r];"function"==typeof e[a]&&(n[a]=e[a])}var u,s=Object.keys(n);try{i(n)}catch(c){u=c}return function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments[1];if(u)throw u;for(var r=!1,i={},a=0;a<s.length;a++){var c=s[a],l=n[c],p=e[c],f=l(p,t);if("undefined"==typeof f){var d=o(c,t);throw new Error(d)}i[c]=f,r=r||f!==p}return r?i:e}}t.__esModule=!0,t["default"]=a;var u=n(177),s=n(67),c=(r(s),n(179));r(c)},function(e,t,n){(function(t){"use strict";e.exports=n(396)(t||window||this)}).call(t,function(){return this}())},function(e,t){"use strict";e.exports=function(e){var t,n=e.Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}}])})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(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 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):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(154),c=r(s),l=n(105),p=r(l),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=n(26),h=n(75),v=n(656),m=r(v),y=n(79),g=r(y),b=function(e,t,n){var r=e.asyncValidate,s=e.blur,l=e.change,v=e.focus,y=e.getFormState,b=e.initialValues,_=t.deepEqual,x=t.getIn,E=b&&x(b,n),w=function(e){function t(){return i(this,t),a(this,Object.getPrototypeOf(t).apply(this,arguments))}return u(t,e),f(t,[{key:"shouldComponentUpdate",value:function(e){return!_(this.props,e)}},{key:"getRenderedComponent",value:function(){return this.refs.renderedComponent}},{key:"render",value:function(){var e=this.props,t=e.component,i=e.defaultValue,a=e.withRef,u=o(e,["component","defaultValue","withRef"]),s=this.context._reduxForm.adapter,c=(0,m["default"])(x,n,u,this.syncError,i,r);a&&(c.ref="renderedComponent");var l=void 0;return s&&(l=s(t,c)),l||(l=(0,d.createElement)(t,c)),l}},{key:"syncError",get:function(){var e=this.context._reduxForm.getSyncErrors,t=g["default"].getIn(e(),n);return t&&t._error?t._error:t}},{key:"dirty",get:function(){return this.props.dirty}},{key:"pristine",get:function(){return this.props.pristine}},{key:"value",get:function(){return this.props.value}}]),t}(d.Component);w.propTypes={component:d.PropTypes.oneOfType([d.PropTypes.func,d.PropTypes.string]).isRequired,defaultValue:d.PropTypes.any},w.contextTypes={_reduxForm:d.PropTypes.object};var C=(0,c["default"])({blur:s,change:l,focus:v},function(e){return(0,p["default"])(e,n)}),P=(0,h.connect)(function(e,t){var r=x(y(e),"initial."+n)||E,o=x(y(e),"values."+n),i=o===r;return{asyncError:x(y(e),"asyncErrors."+n),asyncValidating:x(y(e),"asyncValidating")===n,dirty:!i,pristine:i,state:x(y(e),"fields."+n),submitError:x(y(e),"submitErrors."+n),value:o,_value:t.value}},C,void 0,{withRef:!0});return P(w)};t["default"]=b},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(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 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):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(154),c=r(s),l=n(105),p=r(l),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=n(26),h=n(75),v=n(655),m=r(v),y=n(79),g=r(y),b=n(155),_=r(b),x=function(e,t,n){var r=e.arrayInsert,s=e.arrayPop,l=e.arrayPush,v=e.arrayRemove,y=e.arrayShift,b=e.arraySplice,x=e.arraySwap,E=e.arrayUnshift,w=(e.asyncValidate,e.blur,e.change,e.focus,e.getFormState),C=e.initialValues,P=t.deepEqual,S=t.getIn,O=t.size,T=C&&S(C,n),A=function(e){function t(){return i(this,t),a(this,Object.getPrototypeOf(t).apply(this,arguments))}return u(t,e),f(t,[{key:"shouldComponentUpdate",value:function(e){return(0,_["default"])(this,e)}},{key:"getRenderedComponent",value:function(){return this.refs.renderedComponent}},{key:"render",value:function(){var e=this.props,t=e.component,r=e.withRef,i=o(e,["component","withRef"]),a=(0,m["default"])(S,O,n,i,this.syncError);return r&&(a.ref="renderedComponent"),(0,d.createElement)(t,a)}},{key:"syncError",get:function(){var e=this.context._reduxForm.getSyncErrors;return g["default"].getIn(e(),n+"._error")}},{key:"dirty",get:function(){return this.props.dirty}},{key:"pristine",get:function(){return this.props.pristine}},{key:"value",get:function(){return this.props.value}}]),t}(d.Component);A.propTypes={component:d.PropTypes.oneOfType([d.PropTypes.func,d.PropTypes.string]).isRequired,defaultValue:d.PropTypes.any},A.contextTypes={_reduxForm:d.PropTypes.object};var M=(0,c["default"])({arrayInsert:r,arrayPop:s,arrayPush:l,arrayRemove:v,arrayShift:y,arraySplice:b,arraySwap:x,arrayUnshift:E},function(e){return(0,p["default"])(e,n)}),k=(0,h.connect)(function(e){var t=S(w(e),"initial."+n)||T,r=S(w(e),"values."+n),o=P(r,t);return{asyncError:S(w(e),"asyncErrors."+n+"._error"),dirty:!o,pristine:o,submitError:S(w(e),"submitErrors."+n+"._error"),value:r}},M,void 0,{withRef:!0});return k(A)};t["default"]=x},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(26),l=n(94),p=r(l),f=n(649),d=r(f),h=n(155),v=r(h),m=function(e){var t=e.deepEqual,n=e.getIn,r=function(e){function r(e,a){o(this,r);var u=i(this,Object.getPrototypeOf(r).call(this,e,a));if(!a._reduxForm)throw new Error("Field must be inside a component decorated with reduxForm()");return u.ConnectedField=(0,d["default"])(a._reduxForm,{deepEqual:t,getIn:n},e.name),u}return a(r,e),s(r,[{key:"shouldComponentUpdate",value:function(e){return(0,v["default"])(this,e)}},{key:"componentWillMount",value:function(){this.context._reduxForm.register(this.name,"Field")}},{key:"componentWillReceiveProps",value:function(e){this.props.name!==e.name&&(this.ConnectedField=(0,d["default"])(this.context._reduxForm,{deepEqual:t,getIn:n},e.name))}},{key:"componentWillUnmount",value:function(){this.context._reduxForm.unregister(this.name)}},{key:"getRenderedComponent",value:function(){return(0,p["default"])(this.props.withRef,"If you want to access getRenderedComponent(), you must specify a withRef prop to Field"),this.refs.connected.getWrappedInstance().getRenderedComponent()}},{key:"render",value:function(){return(0,c.createElement)(this.ConnectedField,u({},this.props,{ref:"connected"}))}},{key:"name",get:function(){return this.props.name}},{key:"dirty",get:function(){return this.refs.connected.getWrappedInstance().dirty}},{key:"pristine",get:function(){return this.refs.connected.getWrappedInstance().pristine}},{key:"value",get:function(){return this.refs.connected.getWrappedInstance().value}}]),r}(c.Component);return r.propTypes={name:c.PropTypes.string.isRequired,component:c.PropTypes.oneOfType([c.PropTypes.func,c.PropTypes.string]).isRequired,defaultValue:c.PropTypes.any},r.contextTypes={_reduxForm:c.PropTypes.object},r};t["default"]=m},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(26),l=n(94),p=r(l),f=n(650),d=r(f),h=n(155),v=r(h),m=function(e){var t=e.deepEqual,n=e.getIn,r=e.size,l=function(e){function l(e,a){o(this,l);var u=i(this,Object.getPrototypeOf(l).call(this,e,a));if(!a._reduxForm)throw new Error("FieldArray must be inside a component decorated with reduxForm()");return u.ConnectedFieldArray=(0,d["default"])(a._reduxForm,{deepEqual:t,getIn:n,size:r},e.name),u}return a(l,e),s(l,[{key:"shouldComponentUpdate",value:function(e){return(0,v["default"])(this,e)}},{key:"componentWillMount",value:function(){this.context._reduxForm.register(this.name,"FieldArray")}},{key:"componentWillReceiveProps",value:function(e){this.props.name!==e.name&&(this.ConnectedFieldArray=(0,d["default"])(this.context._reduxForm,{deepEqual:t,getIn:n,size:r},e.name))}},{key:"componentWillUnmount",value:function(){this.context._reduxForm.unregister(this.name)}},{key:"getRenderedComponent",value:function(){return(0,p["default"])(this.props.withRef,"If you want to access getRenderedComponent(), you must specify a withRef prop to FieldArray"),this.refs.connected.getWrappedInstance().getRenderedComponent()}},{key:"render",value:function(){return(0,c.createElement)(this.ConnectedFieldArray,u({},this.props,{ref:"connected"}))}},{key:"name",get:function(){return this.props.name}},{key:"dirty",get:function(){return this.refs.connected.getWrappedInstance().dirty}},{key:"pristine",get:function(){return this.refs.connected.getWrappedInstance().pristine}},{key:"value",get:function(){return this.refs.connected.getWrappedInstance().value}}]),l}(c.Component);return l.propTypes={name:c.PropTypes.string.isRequired,component:c.PropTypes.func.isRequired},l.contextTypes={_reduxForm:c.PropTypes.object},l};t["default"]=m},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(142),i=r(o),a=function(e,t,n,r){t(r);var o=e();if(!(0,i["default"])(o))throw new Error("asyncValidate function passed to reduxForm must return a promise");var a=function(e){return function(t){if(t&&Object.keys(t).length)return n(t),Promise.reject();if(e)throw n(),new Error("Asynchronous validation promise was rejected without errors.");return n(),Promise.resolve()}};return o.then(a(!1),a(!0))};t["default"]=a},function(e,t,n){"use strict";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}function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(669),u=o(a),s=n(670),c=o(s),l=n(651),p=o(l),f=n(652),d=o(f),h=n(664),v=o(h),m=n(676),y=o(m),g=n(274),b=o(g),_=n(668),x=o(_),E=n(275),w=r(E),C=n(175),P=r(C),S=function(e){return i({actionTypes:P},w,{Field:(0,p["default"])(e),FieldArray:(0,d["default"])(e),formValueSelector:(0,v["default"])(e),propTypes:x["default"],reduxForm:(0,c["default"])(e),reducer:(0,u["default"])(e),SubmissionError:b["default"],values:(0,y["default"])(e)})};t["default"]=S},function(e,t){"use strict";function n(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}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 r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(e,t,o,i,a){var u=i.arrayInsert,s=i.arrayPop,c=i.arrayPush,l=i.arrayRemove,p=i.arrayShift,f=(i.arraySplice,i.arraySwap),d=i.arrayUnshift,h=i.asyncError,v=i.dirty,m=i.pristine,y=(i.state,i.submitError),g=(i.submitFailed,i.value),b=n(i,["arrayInsert","arrayPop","arrayPush","arrayRemove","arrayShift","arraySplice","arraySwap","arrayUnshift","asyncError","dirty","pristine","state","submitError","submitFailed","value"]),_=a||h||y,x=t(g);return r({dirty:v,error:_,forEach:function(e){return(g||[]).forEach(function(t,n){return e(o+"["+n+"]",n)})},insert:u,invalid:!!_,length:x,map:function(e){return(g||[]).map(function(t,n){return e(o+"["+n+"]",n)})},pop:function(){return s(),e(g,x-1)},pristine:m,push:c,remove:l,shift:function(){return p(),e(g,0)},swap:f,unshift:d,valid:!_},b)};t["default"]=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}Object.defineProperty(t,"__esModule",{value:!0});var i=n(240),a=r(i),u=n(105),s=r(u),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=n(659),p=r(l),f=n(660),d=r(f),h=n(276),v=r(h),m=n(661),y=r(m),g=n(662),b=r(g),_=function(e,t){var n=e.type,r=e.value,i=o(e,["type","value"]);return"checkbox"===n?c({},i,{checked:!!r,type:n}):"radio"===n?c({},i,{checked:r===t,type:n,value:t}):"select-multiple"===n?c({},i,{type:n,value:r||[]}):e},x=function(e,t,n,r){var i=n.asyncError,u=n.blur,l=n.change,f=n.dirty,h=n.focus,m=n.pristine,g=n.state,x=n.submitError,E=n.value,w=n._value,C=o(n,["asyncError","blur","change","dirty","focus","pristine","state","submitError","value","_value"]),P=arguments.length<=4||void 0===arguments[4]?"":arguments[4],S=arguments.length<=5||void 0===arguments[5]?a["default"]:arguments[5],O=r||i||x,T=(0,d["default"])(l);return _(c({active:g&&!!e(g,"active"),dirty:f,error:O,invalid:!!O,name:t,onBlur:(0,p["default"])(u,(0,s["default"])(S,t)),onChange:T,onDragStart:(0,v["default"])(t,E),onDrop:(0,y["default"])(t,l),onFocus:(0,b["default"])(t,h),onUpdate:T,pristine:m,touched:!(!g||!e(g,"touched")),valid:!O,value:null==E?P:E,visited:g&&!!e(g,"visited")},C),w)};t["default"]=x},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){var t=e.initialized,n=e.trigger,r=e.pristine,o=e.syncValidationPasses;if(!o)return!1;switch(n){case"blur":return!0;case"submit":return!r||!t;default:return!1}};t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(106),i=r(o),a=function(e){var t=e.deepEqual,n=e.empty,r=e.getIn,o=e.deleteIn,a=e.setIn,u=function s(e,u){if("]"===u[u.length-1]){var c=(0,i["default"])(u);c.pop();var l=r(e,c.join("."));return l?a(e,u,void 0):e}var p=o(e,u),f=u.lastIndexOf(".");if(f>0){var d=u.substring(0,f);if("]"!==d[d.length-1]){var h=r(p,d);if(t(h,n))return s(p,d)}}return p};return u};t["default"]=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(277),i=r(o),a=n(281),u=r(a),s=function(e,t){return function(n){var r=(0,i["default"])(n,u["default"]);e(r),t&&t(r)}};t["default"]=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(277),i=r(o),a=n(281),u=r(a),s=function(e){return function(t){return e((0,i["default"])(t,u["default"]))}};t["default"]=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(276),o=function(e,t){return function(n){t(e,n.dataTransfer.getData(r.dataKey))}};t["default"]=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return function(){return t(e)}};t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(279),i=r(o),a=function(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];return(0,i["default"])(t)?e.apply(void 0,r):e.apply(void 0,[t].concat(r))}};t["default"]=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(94),i=r(o),a=n(79),u=r(a),s=function(e){var t=e.getIn;return function(e){var n=arguments.length<=1||void 0===arguments[1]?function(e){return t(e,"form")}:arguments[1];return(0,i["default"])(e,"Form value must be specified"),function(r){for(var o=arguments.length,a=Array(o>1?o-1:0),s=1;o>s;s++)a[s-1]=arguments[s];return(0,i["default"])(a.length,"No fields specified"),1===a.length?t(n(r),e+".values."+a[0]):a.reduce(function(o,i){var a=t(n(r),e+".values."+i);return void 0===a?o:u["default"].setIn(o,i,a)},{})}}};t["default"]=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":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)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(142),a=r(i),u=n(274),s=r(u),c=function(e,t,n,r,i){var u=t.dispatch,c=t.startSubmit,l=t.stopSubmit,p=t.setSubmitFailed,f=t.syncErrors,d=t.returnRejectedSubmitPromise,h=t.values;if(n){var v=function(){var t=e(h,u);return(0,a["default"])(t)?(c(),t.then(function(e){return l(),e})["catch"](function(e){return l(e instanceof s["default"]?e.errors:void 0),d?Promise.reject(e):void 0})):t},m=r&&r();return m?m.then(v,function(e){return p.apply(void 0,o(i)),d?Promise.reject(e):void 0}):v()}return p.apply(void 0,o(i)),d?Promise.reject(f):void 0};t["default"]=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(282),i=r(o),a=function(e,t){switch(t){case"Field":return e;case"FieldArray":return e+"._error"}},u=function(e){var t=e.getIn,n=function(e,n,r,o){var u=t(e,"name"),s=t(e,"type");if(!n&&!r&&!o)return!1;var c=a(u,s),l=(0,i["default"])(n,c);if(l&&"string"==typeof l)return!0;var p=t(r,c);if(p&&"string"==typeof p)return!0;var f=t(o,c);return!(!f||"string"!=typeof f)};return n};t["default"]=u},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){var t=e.getIn,n=function(e){if(!e)return!1;var n=t(e,"_error");return n?!0:"string"==typeof e?!!e:!1};return n};t["default"]=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.propTypes=void 0;var r=n(26),o=r.PropTypes.any,i=r.PropTypes.bool,a=r.PropTypes.func;t.propTypes={asyncValidating:i.isRequired,autofilled:i,dirty:i.isRequired,error:o,invalid:i.isRequired,pristine:i.isRequired,submitting:i.isRequired,submitFailed:i.isRequired,valid:i.isRequired,asyncValidate:a.isRequired,destroy:a.isRequired,handleSubmit:a.isRequired,initialize:a.isRequired,reset:a.isRequired,touch:a.isRequired,untouch:a.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":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 i(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}Object.defineProperty(t,"__esModule",{value:!0});var a=n(175),u=n(658),s=r(u),c=function(e){function t(e){return e}var n,r=e.splice,u=e.empty,c=e.getIn,l=e.setIn,p=e.deleteIn,f=e.fromJS,d=e.size,h=e.some,v=(0,s["default"])(e),m=function(e,t,n,o,i,a,u){var s=c(e,t+"."+n);return s||u?l(e,t+"."+n,r(s,o,i,a)):e},y=["values","fields","submitErrors","asyncErrors"],g=function(e,t,n,r,o){var i=e;return i=m(i,"values",t,n,r,o,!0),i=m(i,"fields",t,n,r,u),i=m(i,"submitErrors",t,n,r,u),i=m(i,"asyncErrors",t,n,r,u)},b=(n={},o(n,a.ARRAY_INSERT,function(e,t){var n=t.meta,r=n.field,o=n.index,i=t.payload;return g(e,r,o,0,i)}),o(n,a.ARRAY_POP,function(e,t){var n=t.meta.field,r=c(e,"values."+n),o=r?d(r):0;return o?g(e,n,o-1,1):e}),o(n,a.ARRAY_PUSH,function(e,t){var n=t.meta.field,r=t.payload,o=c(e,"values."+n),i=o?d(o):0;return g(e,n,i,0,r)}),o(n,a.ARRAY_REMOVE,function(e,t){var n=t.meta,r=n.field,o=n.index;return g(e,r,o,1)}),o(n,a.ARRAY_SHIFT,function(e,t){var n=t.meta.field;return g(e,n,0,1)}),o(n,a.ARRAY_SPLICE,function(e,t){var n=t.meta,r=n.field,o=n.index,i=n.removeNum,a=t.payload;return g(e,r,o,i,a)}),o(n,a.ARRAY_SWAP,function(e,t){var n=t.meta,r=n.field,o=n.indexA,i=n.indexB,a=e;return y.forEach(function(e){var t=c(a,e+"."+r+"["+o+"]"),n=c(a,e+"."+r+"["+i+"]");void 0===t&&void 0===n||(a=l(a,e+"."+r+"["+o+"]",n),a=l(a,e+"."+r+"["+i+"]",t))}),a}),o(n,a.ARRAY_UNSHIFT,function(e,t){var n=t.meta.field,r=t.payload;return g(e,n,0,0,r)}),o(n,a.BLUR,function(e,t){var n=t.meta,r=n.field,o=n.touch,i=t.payload,a=e,u=c(a,"initial."+r);return void 0===u&&""===i?a=v(a,"values."+r):void 0!==i&&(a=l(a,"values."+r,i)),r===c(a,"active")&&(a=p(a,"active")),a=p(a,"fields."+r+".active"),o&&(a=l(a,"fields."+r+".touched",!0),a=l(a,"anyTouched",!0)),a}),o(n,a.CHANGE,function(e,t){var n=t.meta,r=n.field,o=n.touch,i=t.payload,a=e,u=c(a,"initial."+r);return void 0===u&&""===i?a=v(a,"values."+r):void 0!==i&&(a=l(a,"values."+r,i)),a=v(a,"asyncErrors."+r),a=v(a,"submitErrors."+r),
o&&(a=l(a,"fields."+r+".touched",!0),a=l(a,"anyTouched",!0)),a}),o(n,a.FOCUS,function(e,t){var n=t.meta.field,r=e,o=c(e,"active");return r=p(r,"fields."+o+".active"),r=l(r,"fields."+n+".visited",!0),r=l(r,"fields."+n+".active",!0),r=l(r,"active",n)}),o(n,a.INITIALIZE,function(e,t){var n=t.payload,r=f(n),o=u;return o=l(o,"values",r),o=l(o,"initial",r)}),o(n,a.REGISTER_FIELD,function(e,t){var n=t.payload,o=n.name,i=n.type,a=e,u=c(a,"registeredFields");if(h(u,function(e){return c(e,"name")===o}))return e;var s=f({name:o,type:i});return a=l(e,"registeredFields",r(u,d(u),0,s))}),o(n,a.RESET,function(e){var t=c(e,"initial"),n=u;return t?(n=l(n,"values",t),n=l(n,"initial",t)):n=v(n,"values"),n}),o(n,a.START_ASYNC_VALIDATION,function(e,t){var n=t.meta.field;return l(e,"asyncValidating",n||!0)}),o(n,a.START_SUBMIT,function(e){return l(e,"submitting",!0)}),o(n,a.STOP_ASYNC_VALIDATION,function(e,t){var n=t.payload,r=e;if(r=p(r,"asyncValidating"),n&&Object.keys(n).length){var o=n._error,a=i(n,["_error"]);o&&(r=l(r,"error",o)),r=Object.keys(a).length?l(r,"asyncErrors",f(a)):p(r,"asyncErrors")}else r=p(r,"error"),r=p(r,"asyncErrors");return r}),o(n,a.STOP_SUBMIT,function(e,t){var n=t.payload,r=e;if(r=p(r,"submitting"),r=p(r,"submitFailed"),n&&Object.keys(n).length){var o=n._error,a=i(n,["_error"]);o&&(r=l(r,"error",o)),r=Object.keys(a).length?l(r,"submitErrors",f(a)):p(r,"submitErrors"),r=l(r,"submitFailed",!0)}else r=p(r,"error"),r=p(r,"submitErrors");return r}),o(n,a.SET_SUBMIT_FAILED,function(e,t){var n=t.meta.fields,r=e;return r=l(r,"submitFailed",!0),r=p(r,"submitting"),n.forEach(function(e){return r=l(r,"fields."+e+".touched",!0)}),n.length&&(r=l(r,"anyTouched",!0)),r}),o(n,a.TOUCH,function(e,t){var n=t.meta.fields,r=e;return n.forEach(function(e){return r=l(r,"fields."+e+".touched",!0)}),r=l(r,"anyTouched",!0)}),o(n,a.UNREGISTER_FIELD,function(e,t){var n=t.payload.name,o=c(e,"registeredFields");if(!o)return e;var i=o.findIndex(function(e){return c(e,"name")===n});return d(o)<=1&&i>=0?v(e,"registeredFields"):l(e,"registeredFields",r(o,i,1))}),o(n,a.UNTOUCH,function(e,t){var n=t.meta.fields,r=e;return n.forEach(function(e){return r=p(r,"fields."+e+".touched")}),r}),n),_=function(){var e=arguments.length<=0||void 0===arguments[0]?u:arguments[0],t=arguments[1],n=b[t.type];return n?n(e,t):e},x=function(e){return function(){var t=arguments.length<=0||void 0===arguments[0]?u:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=n&&n.meta&&n.meta.form;if(!r)return t;if(n.type===a.DESTROY)return v(t,n.meta.form);var o=c(t,r),i=e(o,n);return i===o?t:l(t,r,i)}};return t(x(_))};t["default"]=c},function(e,t,n){"use strict";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}function o(e){return e&&e.__esModule?e:{"default":e}}function i(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 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):e.__proto__=t)}function s(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 c(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}Object.defineProperty(t,"__esModule",{value:!0});var l=n(567),p=o(l),f=n(105),d=o(f),h=n(154),v=o(h),m="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},y=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},b=n(26),_=n(208),x=o(_),E=n(75),w=n(176),C=n(142),P=o(C),S=n(675),O=o(S),T=n(275),A=r(T),M=n(665),k=o(M),N=n(279),R=o(N),I=n(663),j=o(I),D=n(653),F=o(D),L=n(667),U=o(L),V=n(666),B=o(V),W=n(657),q=o(W),H=n(79),Y=o(H),z=A.arrayInsert,K=A.arrayPop,G=A.arrayPush,$=A.arrayRemove,X=A.arrayShift,Q=A.arraySplice,Z=A.arraySwap,J=A.arrayUnshift,ee=A.blur,te=A.change,ne=A.focus,re=c(A,["arrayInsert","arrayPop","arrayPush","arrayRemove","arrayShift","arraySplice","arraySwap","arrayUnshift","blur","change","focus"]),oe={arrayInsert:z,arrayPop:K,arrayPush:G,arrayRemove:$,arrayShift:X,arraySplice:Q,arraySwap:Z,arrayUnshift:J},ie=[].concat(s(Object.keys(A)),["array","asyncErrors","initialized","initialValues","syncErrors","values","registeredFields"]),ae=function(e){if(!e||"function"!=typeof e)throw new Error("You must either pass handleSubmit() an onSubmit function or pass onSubmit as a prop");return e},ue=function(e){var t=e.deepEqual,n=e.empty,r=e.getIn,o=e.setIn,s=e.fromJS,l=e.some,f=(0,U["default"])(e),h=(0,B["default"])(e),_=(0,U["default"])(Y["default"]);return function(e){var C=g({touchOnBlur:!0,touchOnChange:!1,destroyOnUnmount:!0,shouldAsyncValidate:q["default"],getFormState:function(e){return r(e,"form")}},e);return function(e){var S=function(n){function s(e){i(this,s);var t=a(this,Object.getPrototypeOf(s).call(this,e));return t.submit=t.submit.bind(t),t.reset=t.reset.bind(t),t.asyncValidate=t.asyncValidate.bind(t),t.getSyncErrors=t.getSyncErrors.bind(t),t.register=t.register.bind(t),t.unregister=t.unregister.bind(t),t.submitCompleted=t.submitCompleted.bind(t),t}return u(s,n),y(s,[{key:"getChildContext",value:function(){var e=this;return{_reduxForm:g({},this.props,{getFormState:function(t){return r(e.props.getFormState(t),e.props.form)},asyncValidate:this.asyncValidate,getSyncErrors:this.getSyncErrors,register:this.register,unregister:this.unregister})}}},{key:"initIfNeeded",value:function(e){var t=e.initialize,n=e.initialized,r=e.initialValues;r&&!n&&t(r)}},{key:"componentWillMount",value:function(){this.initIfNeeded(this.props)}},{key:"componentWillReceiveProps",value:function(e){this.initIfNeeded(e)}},{key:"shouldComponentUpdate",value:function(e){var n=this;return Object.keys(e).some(function(r){return!~ie.indexOf(r)&&!t(n.props[r],e[r])})}},{key:"componentWillUnmount",value:function(){var e=this.props,t=e.destroyOnUnmount,n=e.destroy;t&&(this.destroyed=!0,n())}},{key:"getSyncErrors",value:function(){return this.props.syncErrors}},{key:"register",value:function(e,t){this.props.registerField(e,t)}},{key:"unregister",value:function(e){this.destroyed||this.props.unregisterField(e)}},{key:"asyncValidate",value:function l(e,t){var n=this,i=this.props,a=i.asyncBlurFields,u=i.asyncErrors,l=i.asyncValidate,s=i.dispatch,c=i.initialized,p=i.pristine,f=i.shouldAsyncValidate,d=i.startAsyncValidation,h=i.stopAsyncValidation,v=i.syncErrors,y=i.values,g=!e;if(l){var b=function(){var i=g?y:o(y,e,t),m=g||!r(v,e),b=!g&&(!a||~a.indexOf(e.replace(/\[[0-9]+\]/g,"[]")));return(b||g)&&f({asyncErrors:u,initialized:c,trigger:g?"submit":"blur",blurredField:e,pristine:p,syncValidationPasses:m})?{v:(0,F["default"])(function(){return l(i,s,n.props)},d,h,e)}:void 0}();if("object"===("undefined"==typeof b?"undefined":m(b)))return b.v}}},{key:"submitCompleted",value:function(e){return delete this.submitPromise,e}},{key:"listenToSubmit",value:function(e){return(0,P["default"])(e)?(this.submitPromise=e,e.then(this.submitCompleted,this.submitCompleted)):e}},{key:"submit",value:function(e){var t=this,n=this.props.onSubmit;return e&&!(0,R["default"])(e)?(0,j["default"])(function(){return!t.submitPromise&&t.listenToSubmit((0,k["default"])(ae(e),t.props,t.valid,t.asyncValidate,t.fieldList))}):this.submitPromise?void 0:this.listenToSubmit((0,k["default"])(ae(n),this.props,this.valid,this.asyncValidate,this.fieldList))}},{key:"reset",value:function(){this.props.reset()}},{key:"render",value:function(){var t=this.props,n=(t.arrayInsert,t.arrayPop,t.arrayPush,t.arrayRemove,t.arrayShift,t.arraySplice,t.arraySwap,t.arrayUnshift,t.asyncErrors,t.reduxMountPoint,t.destroyOnUnmount,t.getFormState,t.touchOnBlur,t.touchOnChange,t.syncErrors,t.values,t.registerField,t.unregisterField,c(t,["arrayInsert","arrayPop","arrayPush","arrayRemove","arrayShift","arraySplice","arraySwap","arrayUnshift","asyncErrors","reduxMountPoint","destroyOnUnmount","getFormState","touchOnBlur","touchOnChange","syncErrors","values","registerField","unregisterField"]));return(0,b.createElement)(e,g({},n,{handleSubmit:this.submit}))}},{key:"values",get:function(){return this.props.values}},{key:"valid",get:function(){return this.props.valid}},{key:"invalid",get:function(){return!this.valid}},{key:"fieldList",get:function(){return this.props.registeredFields.map(function(e){return r(e,"name")})}}]),s}(b.Component);S.displayName="Form("+(0,O["default"])(e)+")",S.WrappedComponent=e,S.childContextTypes={_reduxForm:b.PropTypes.object.isRequired},S.propTypes={adapter:b.PropTypes.func,destroyOnUnmount:b.PropTypes.bool,form:b.PropTypes.string.isRequired,initialValues:b.PropTypes.object,getFormState:b.PropTypes.func,validate:b.PropTypes.func,touchOnBlur:b.PropTypes.bool,touchOnChange:b.PropTypes.bool,registeredFields:b.PropTypes.any};var T=(0,E.connect)(function(e,o){var i=o.form,a=o.getFormState,u=o.initialValues,s=o.validate,c=r(a(e)||n,i)||n,p=r(c,"initial"),d=u||p||n,v=r(c,"values")||d,m=t(d,v),y=r(c,"asyncErrors"),g=r(c,"submitErrors"),b=s&&s(v,o)||{},x=_(b),E=f(y),w=f(g),C=!(x||E||w||l(r(c,"registeredFields"),function(e){return h(e,b,y,g)})),P=!!r(c,"anyTouched"),S=!!r(c,"submitting"),O=!!r(c,"submitFailed"),T=r(c,"error");return{anyTouched:P,asyncErrors:y,asyncValidating:r(c,"asyncValidating"),dirty:!m,error:T,initialized:!!p,invalid:!C,pristine:m,submitting:S,submitFailed:O,syncErrors:b,values:v,valid:C,registeredFields:r(c,"registeredFields")}},function(e,t){var n=function(e){return(0,d["default"])(e,t.form)},r=(0,v["default"])(re,n),o=(0,v["default"])(oe,n),i=(0,p["default"])(n(ee),!!t.touchOnBlur),a=(0,p["default"])(n(te),!!t.touchOnChange),u=n(ne),s=(0,w.bindActionCreators)(r,e),c={insert:(0,w.bindActionCreators)(o.arrayInsert,e),pop:(0,w.bindActionCreators)(o.arrayPop,e),push:(0,w.bindActionCreators)(o.arrayPush,e),remove:(0,w.bindActionCreators)(o.arrayRemove,e),shift:(0,w.bindActionCreators)(o.arrayShift,e),splice:(0,w.bindActionCreators)(o.arraySplice,e),swap:(0,w.bindActionCreators)(o.arraySwap,e),unshift:(0,w.bindActionCreators)(o.arrayUnshift,e)},l=g({},s,o,{blur:i,change:a,array:c,focus:u,dispatch:e});return function(){return l}},void 0,{withRef:!0}),A=(0,x["default"])(T(S),e);return A.defaultProps=C,function(e){function t(){return i(this,t),a(this,Object.getPrototypeOf(t).apply(this,arguments))}return u(t,e),y(t,[{key:"submit",value:function(){return this.refs.wrapped.getWrappedInstance().submit()}},{key:"reset",value:function(){return this.refs.wrapped.getWrappedInstance().reset()}},{key:"render",value:function(){var e=this.props,t=e.initialValues,n=c(e,["initialValues"]);return(0,b.createElement)(A,g({},n,{ref:"wrapped",initialValues:s(t)}))}},{key:"valid",get:function(){return this.refs.wrapped.getWrappedInstance().valid}},{key:"invalid",get:function(){return this.refs.wrapped.getWrappedInstance().invalid}},{key:"values",get:function(){return this.refs.wrapped.getWrappedInstance().values}},{key:"fieldList",get:function(){return this.refs.wrapped.getWrappedInstance().fieldList}}]),t}(b.Component)}}};t["default"]=ue},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(563),i=r(o),a=function(e,t){return e==t?!0:null==e&&""===t?!0:""===e&&null==t?!0:void 0},u=function(e,t){return(0,i["default"])(e,t,a)};t["default"]=u},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":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 i(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 a=n(106),u=r(a),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function p(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),a=2;n>a;a++)r[a-2]=arguments[a];if(void 0===e||void 0===t)return e;if(r.length){if(Array.isArray(e)){if(t<e.length){var u=p.apply(void 0,[e&&e[t]].concat(r));if(u!==e[t]){var c=[].concat(i(e));return c[t]=u,c}}return e}if(t in e){var l=p.apply(void 0,[e&&e[t]].concat(r));return e[t]===l?e:s({},e,o({},t,l))}return e}if(Array.isArray(e)){if(isNaN(t))throw new Error("Cannot delete non-numerical index from an array");if(t<e.length){var f=[].concat(i(e));return f.splice(t,1),f}return e}if(t in e){var d=s({},e);return delete d[t],d}return e},l=function(e,t){return c.apply(void 0,[e].concat(i((0,u["default"])(t))))};t["default"]=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":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 i(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 a=n(106),u=r(a),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function p(e,t,n){for(var r=arguments.length,a=Array(r>3?r-3:0),u=3;r>u;u++)a[u-3]=arguments[u];if(void 0===n)return t;var c=p.apply(void 0,[e&&e[n],t].concat(a));if(!e){var l=isNaN(n)?{}:[];return l[n]=c,l}if(Array.isArray(e)){var f=[].concat(i(e));return f[n]=c,f}return s({},e,o({},n,c))},l=function(e,t,n){return c.apply(void 0,[e,n].concat(i((0,u["default"])(t))))};t["default"]=l},function(e,t){"use strict";function n(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 r=function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments[1],r=arguments[2],o=arguments[3],i=[].concat(n(e));return r?i.splice(t,r):i.splice(t,0,o),i};t["default"]=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return e.displayName||e.name||"Component"};t["default"]=n},function(e,t,n){"use strict";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=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(75),a=function(e){var t=e.getIn;return function(e){var n=o({prop:"values",getFormState:function(e){return t(e,"form")}},e),a=n.form,u=n.prop,s=n.getFormState;return(0,i.connect)(function(e){return r({},u,t(s(e),a+".values"))},function(){return{}})}};t["default"]=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return function(e){return function(n,r,o){var a=e(n,r,o),s=a.dispatch,c=[],l={getState:a.getState,dispatch:function(e){return s(e)}};return c=t.map(function(e){return e(l)}),s=u["default"].apply(void 0,c)(a.dispatch),i({},a,{dispatch:s})}}}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t["default"]=o;var a=n(283),u=r(a)},function(e,t){"use strict";function n(e,t){return function(){return t(e.apply(void 0,arguments))}}function r(e,t){if("function"==typeof e)return n(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var r=Object.keys(e),o={},i=0;i<r.length;i++){var a=r[i],u=e[a];"function"==typeof u&&(o[a]=n(u,t))}return o}t.__esModule=!0,t["default"]=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n=t&&t.type,r=n&&'"'+n.toString()+'"'||"an action";return"Given action "+r+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state.'}function i(e){Object.keys(e).forEach(function(t){var n=e[t],r=n(void 0,{type:u.ActionTypes.INIT});if("undefined"==typeof r)throw new Error('Reducer "'+t+'" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined.');var o="@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".");if("undefined"==typeof n(void 0,{type:o}))throw new Error('Reducer "'+t+'" returned undefined when probed with a random type. '+("Don't try to handle "+u.ActionTypes.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined.")})}function a(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var a=t[r];"function"==typeof e[a]&&(n[a]=e[a])}var u,s=Object.keys(n);try{i(n)}catch(c){u=c}return function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments[1];if(u)throw u;for(var r=!1,i={},a=0;a<s.length;a++){var c=s[a],l=n[c],p=e[c],f=l(p,t);if("undefined"==typeof f){var d=o(c,t);throw new Error(d)}i[c]=f,r=r||f!==p}return r?i:e}}t.__esModule=!0,t["default"]=a;var u=n(284),s=n(152),c=(r(s),n(285));r(c)},function(e,t,n){(function(t){"use strict";e.exports=n(681)(t||window||this)}).call(t,function(){return this}())},function(e,t){"use strict";e.exports=function(e){var t,n=e.Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}}]);
//# sourceMappingURL=bundle.js.map
|
src/MasterPassword/MasterPassword.js
|
Lynx-Productions/OPeM
|
/***
* Copyright 2017 - present Lynx Productions
*
* 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.
*/
// @ts-check
import React, { Component } from 'react';
import Paper from 'material-ui/Paper';
import Divider from 'material-ui/Divider';
import TextField from 'material-ui/TextField';
import RaisedButton from 'material-ui/RaisedButton';
import AppBar from 'material-ui/AppBar';
import { handleInputChange } from '../utils';
const styles = {
paper: {
width: '80%',
margin: 20,
marginLeft: 'auto',
marginRight: 'auto',
textAlign: 'center'
},
form: {
padding: 5
},
buttonDiv: {
textAlign: 'right'
},
button: {
margin: 5,
marginTop: 12
}
};
export class MasterPassword extends Component {
constructor(props) {
super(props);
this.state = {
masterPassword: ''
};
this.handleInputChange = handleInputChange.bind(this);
this.onSubmit = this.onSubmit.bind(this);
}
onSubmit(e) {
const { onSubmit } = this.props;
return onSubmit(e, this.state.masterPassword);
}
render() {
const { title, btnTitle } = this.props;
return (
<Paper style={styles.paper}>
<AppBar title={title} showMenuIconButton={false} zDepth={0} />
<Divider />
<form style={styles.form} onSubmit={this.onSubmit}>
<TextField
type="password"
name="masterPassword"
floatingLabelText="Master Password"
fullWidth={true}
spellCheck={false}
onChange={this.handleInputChange}
autoFocus
/>
<div style={styles.buttonDiv}>
<RaisedButton
type="submit"
label={btnTitle}
secondary={true}
style={styles.button}
/>
</div>
</form>
</Paper>
);
}
}
export default MasterPassword;
|
project-templates/reactfiber/externals/react-fiber/fixtures/ssr/src/index.js
|
itsa-server/itsa-cli
|
import React from 'react';
import { render } from 'react-dom';
import App from './components/App';
render(<App assets={window.assetManifest} />, document);
|
ReactNative/node_modules/react-navigation/src/navigators/createNavigator.js
|
tahashahid/cloud-computing-2017
|
import React from 'react';
/**
* Creates a navigator based on a router and a view that renders the screens.
*/
export default function createNavigator(router, routeConfigs, navigatorConfig) {
return NavigationView => {
class Navigator extends React.Component {
static router = router;
static navigationOptions = null;
render() {
return <NavigationView {...this.props} router={router} />;
}
}
return Navigator;
};
}
|
static/src/components/islands/IslandDoubleTree.js
|
andribja/airhornbot
|
// @flow
// jscs:disable maximumLineLength
import React from 'react';
type Props = {
paused: boolean
};
export default ({paused}: Props): React.Element => (
<svg className={`island double-tree ${paused ? 'paused' : ''}`} xmlns="http://www.w3.org/2000/svg" width="259" height="221">
<g fill="none" fill-rule="evenodd">
<path fill="#FFE6A7" d="M1.5012 93.2279v57.903l118.413 68.367 136.734-78.942v-57.903L1.5012 93.2279z"/>
<path fill="#EDD194" d="M118.8135 88.3652v130.5l1.101.633 136.734-78.942v-57.903l-137.835 5.712z"/>
<path stroke="#5E4634" strokeWidth="3" d="M256.6494 82.6514v57.906l-136.734 78.942-118.416-68.367v-57.906" strokeLinecap="round" strokeLinejoin="round"/>
<path fill="#C7E082" d="M1.5012 93.2279v20.403l118.413 68.37 136.734-78.945v-20.403L1.5012 93.2279z"/>
<path fill="#B0CC64" d="M119.8134 88.3235v93.618l.102.06 136.734-78.945v-20.406l-136.836 5.673z"/>
<path stroke="#5E4634" strokeWidth="3" d="M256.6494 85.6514v17.406l-136.734 78.942-118.416-68.367v-20.406" strokeLinecap="round" strokeLinejoin="round"/>
<path fill="#B7D86F" d="M1.5012 93.2279l118.413 68.367 136.734-78.942-118.413-68.367-136.734 78.942z"/>
<path stroke="#5E4634" strokeWidth="3" d="M119.9151 161.5949L1.4991 93.2279l136.734-78.945 118.416 68.37-136.734 78.942zm0 0v57.906m40.3041-133.1865v3.249M64.0125 70.3532v3.249M51.0297 87.9395v3.249m129.3258-36.8352v3.249m-11.6466 37.7511v3.249" strokeLinecap="round" strokeLinejoin="round"/>
<path fill="#FFE6A7" d="M103.3476 88.2344v20.922c0 2.115 4.155 3.831 9.282 3.831s9.282-1.716 9.282-3.831v-20.922h-18.564z"/>
<path fill="#EDD194" d="M113.4228 88.2344v24.72c4.749-.168 8.49-1.794 8.49-3.798v-20.922h-8.49z"/>
<path stroke="#5E4634" strokeWidth="3" d="M103.3476 88.2344v20.922c0 2.115 4.155 3.831 9.282 3.831s9.282-1.716 9.282-3.831v-20.922h-18.564z" strokeLinecap="round" strokeLinejoin="round"/>
<g className="stretch">
<path fill="#C3F270" d="M117.0579 5.3135l28.392 77.583c1.35 3.69.078 7.899-3.216 10.044-4.755 3.093-13.617 6.492-29.604 6.492-15.984 0-24.846-3.399-29.604-6.492-3.291-2.145-4.566-6.354-3.216-10.044l28.392-77.583c1.509-4.125 7.347-4.125 8.856 0"/>
<path fill="#B7D86F" d="M145.4496 82.8977l-28.392-77.583c-1.509-4.128-7.344-4.128-8.856 0l-2.265 6.186 24.549 67.083c1.353 3.69.078 7.899-3.216 10.041-4.755 3.093-13.617 6.495-29.604 6.495-4.647 0-8.676-.294-12.195-.78 5.148 2.637 13.575 5.094 27.159 5.094 15.987 0 24.849-3.402 29.604-6.495 3.294-2.142 4.566-6.351 3.216-10.041"/>
<path stroke="#5E4634" strokeWidth="3" d="M117.0579 5.3135l28.392 77.583c1.35 3.69.078 7.899-3.216 10.044-4.755 3.093-13.617 6.492-29.604 6.492-15.984 0-24.846-3.399-29.604-6.492-3.291-2.145-4.566-6.354-3.216-10.044l28.392-77.583c1.509-4.125 7.347-4.125 8.856 0z" strokeLinecap="round" strokeLinejoin="round"/>
</g>
<path fill="#FFE6A7" d="M198.6108 72.7844v14.484c0 1.464 2.877 2.652 6.426 2.652 3.549 0 6.426-1.188 6.426-2.652v-14.484h-12.852z"/>
<path fill="#EDD194" d="M205.407 72.7841v17.121c3.372-.081 6.054-1.227 6.054-2.637v-14.484h-6.054z"/>
<path stroke="#5E4634" strokeWidth="3" d="M198.6108 72.7844v14.484c0 1.464 2.877 2.652 6.426 2.652 3.549 0 6.426-1.188 6.426-2.652v-14.484h-12.852z" strokeLinecap="round" strokeLinejoin="round"/>
<g className="stretch">
<path fill="#C3F270" d="M208.8558 33.2786l15.096 42.288c.408 1.146-.09 2.424-1.185 2.952-2.796 1.344-8.613 3.546-16.737 3.546-8.121 0-13.938-2.202-16.734-3.546-1.095-.528-1.596-1.806-1.188-2.952l15.096-42.288c.948-2.655 4.704-2.655 5.652 0"/>
<path fill="#B7D86F" d="M223.9518 75.5681l-15.096-42.288c-.948-2.658-4.704-2.658-5.652 0l-.603 1.689 12.351 34.599c.408 1.143-.09 2.424-1.185 2.949-2.796 1.344-8.613 3.546-16.737 3.546-3.339 0-6.261-.381-8.772-.912l-.15.417c-.408 1.143.093 2.424 1.188 2.949 2.796 1.344 8.613 3.546 16.734 3.546 8.124 0 13.941-2.202 16.737-3.546 1.095-.525 1.593-1.806 1.185-2.949"/>
<path stroke="#5E4634" strokeWidth="3" d="M208.8558 33.2786l15.096 42.288c.408 1.146-.09 2.424-1.185 2.952-2.796 1.344-8.613 3.546-16.737 3.546-8.121 0-13.938-2.202-16.734-3.546-1.095-.528-1.596-1.806-1.188-2.952l15.096-42.288c.948-2.655 4.704-2.655 5.652 0z" strokeLinecap="round" strokeLinejoin="round"/>
</g>
<path fill="#EBEBEB" d="M158.1633 53.3873h-6.684c-.735 0-1.335-.6-1.335-1.338v-.555c0-1.776 1.452-3.231 3.231-3.231h2.895c1.776 0 3.231 1.455 3.231 3.231v.555c0 .738-.603 1.338-1.338 1.338"/>
<path stroke="#5E4634" strokeWidth="3" d="M158.1633 53.3873h-6.684c-.735 0-1.335-.6-1.335-1.338v-.555c0-1.776 1.452-3.231 3.231-3.231h2.895c1.776 0 3.231 1.455 3.231 3.231v.555c0 .738-.603 1.338-1.338 1.338z" strokeLinecap="round" strokeLinejoin="round"/>
<path fill="#EBEBEB" d="M145.9809 122.915h-6.684c-.735 0-1.335-.6-1.335-1.338v-.555c0-1.776 1.452-3.231 3.231-3.231h2.895c1.776 0 3.231 1.455 3.231 3.231v.555c0 .738-.603 1.338-1.338 1.338"/>
<path stroke="#5E4634" strokeWidth="3" d="M145.9809 122.915h-6.684c-.735 0-1.335-.6-1.335-1.338v-.555c0-1.776 1.452-3.231 3.231-3.231h2.895c1.776 0 3.231 1.455 3.231 3.231v.555c0 .738-.603 1.338-1.338 1.338z" strokeLinecap="round" strokeLinejoin="round"/>
</g>
</svg>
);
|
frontend/app/containers/App/index.js
|
jirwin/ipfs-archive
|
/**
*
* App.js
*
* This component is the skeleton around the actual pages, and should only
* contain code that should be seen on all pages. (e.g. navigation bar)
*
* NOTE: while this component should technically be a stateless functional
* component (SFC), hot reloading does not currently support SFCs. If hot
* reloading is not a necessity for you then you can refactor it and remove
* the linting exception.
*/
import React from 'react';
import { Switch, Route } from 'react-router-dom';
import 'bootstrap/dist/css/bootstrap.css';
import 'font-awesome/css/font-awesome.min.css';
import Home from 'containers/Home/Loadable';
import NotFoundPage from 'containers/NotFoundPage/Loadable';
export default function App() {
return (
<div>
<Switch>
<Route exact path="/" component={Home} />
<Route component={NotFoundPage} />
</Switch>
</div>
);
}
|
src/components/Shared/Parallax.react.js
|
andmilj/vip-transfers
|
import React from 'react';
import classNames from 'classnames';
const Parallax = ({ordinal}) => (
<div className={classNames('parallax', `parallax${ordinal}`)}>
<div className="container inner text-center">
</div>
</div>
);
export default Parallax;
|
src/components/heroWidget/heroChart.js
|
govau/datavizkit
|
import React from 'react';
import {compose} from 'recompose';
import withHighcharts from './../withHighcharts';
import withHero from './withHero';
const HeroChart = ({children}) => {
return (
<div>
<span className="chart">{children}</span>
</div>
)
};
const HighchartifiedHeroChart = compose(
withHighcharts,
withHero,
)(HeroChart);
export default HighchartifiedHeroChart;
|
client/src/components/advancedSelectWidget/MultiTypeAdvancedSelectComponent.js
|
NCI-Agency/anet
|
import { SEARCH_OBJECT_LABELS, SEARCH_OBJECT_TYPES } from "actions"
import AdvancedMultiSelect from "components/advancedSelectWidget/AdvancedMultiSelect"
import {
LocationOverlayRow,
OrganizationOverlayRow,
PersonDetailedOverlayRow,
PositionOverlayRow,
ReportDetailedOverlayRow,
TaskSimpleOverlayRow
} from "components/advancedSelectWidget/AdvancedSelectOverlayRow"
import AdvancedSingleSelect from "components/advancedSelectWidget/AdvancedSingleSelect"
import ButtonToggleGroup from "components/ButtonToggleGroup"
import Model from "components/Model"
import * as Models from "models"
import PropTypes from "prop-types"
import React, { useCallback, useMemo, useState } from "react"
import { Button } from "react-bootstrap"
import LOCATIONS_ICON from "resources/locations.png"
import ORGANIZATIONS_ICON from "resources/organizations.png"
import PEOPLE_ICON from "resources/people.png"
import POSITIONS_ICON from "resources/positions.png"
import REPORTS_ICON from "resources/reports.png"
import TASKS_ICON from "resources/tasks.png"
import { ENTITY_TYPES } from "utils_links"
const entityFilters = {
allEntities: {
label: "All entities",
queryVars: {}
}
}
const peopleFilters = {
allEntities: {
label: "All",
queryVars: { matchPositionName: true }
},
activeAdvisors: {
label: "All advisors",
queryVars: { role: Models.Person.ROLE.ADVISOR, matchPositionName: true }
},
activePrincipals: {
label: "All principals",
queryVars: { role: Models.Person.ROLE.PRINCIPAL }
}
}
const widgetPropsReport = {
objectType: Models.Report,
overlayRenderRow: ReportDetailedOverlayRow,
overlayColumns: ["Goal", "Author", "Updated"],
filterDefs: entityFilters,
queryParams: {}, // allow any report, incl. one's own drafts
fields: Models.Report.autocompleteQuery,
addon: REPORTS_ICON
}
const widgetPropsPeople = {
objectType: Models.Person,
overlayRenderRow: PersonDetailedOverlayRow,
overlayColumns: ["Name", "Position", "Location", "Organization"],
filterDefs: peopleFilters,
queryParams: {
status: Model.STATUS.ACTIVE,
pendingVerification: false
},
fields: Models.Person.autocompleteQueryWithNotes,
addon: PEOPLE_ICON
}
const widgetPropsOrganization = {
objectType: Models.Organization,
overlayRenderRow: OrganizationOverlayRow,
overlayColumns: ["Name"],
filterDefs: entityFilters,
queryParams: { status: Model.STATUS.ACTIVE },
fields: Models.Organization.autocompleteQueryWithNotes,
addon: ORGANIZATIONS_ICON
}
const widgetPropsPosition = {
objectType: Models.Position,
overlayRenderRow: PositionOverlayRow,
overlayColumns: ["Position", "Organization", "Current Occupant"],
filterDefs: entityFilters,
queryParams: { status: Model.STATUS.ACTIVE },
fields: Models.Position.autocompleteQueryWithNotes,
addon: POSITIONS_ICON
}
const generateLocationFilters = filter => {
if (!filter?.typeFilter) {
return entityFilters
} else {
const locationFilters = {}
Object.entries(filter.typeFilter.filterValue).forEach((element, index) => {
locationFilters[index] = {
label: Models.Location.humanNameOfType(element[1]),
queryVars: {
status: Model.STATUS.ACTIVE,
[filter.typeFilter.filterField]: element[1]
}
}
})
return locationFilters
}
}
const widgetPropsLocation = {
objectType: Models.Location,
overlayRenderRow: LocationOverlayRow,
overlayColumns: ["Name"],
filterDefs: generateLocationFilters,
queryParams: { status: Model.STATUS.ACTIVE },
fields: Models.Location.autocompleteQueryWithNotes,
addon: LOCATIONS_ICON
}
const widgetPropsTask = {
objectType: Models.Task,
overlayRenderRow: TaskSimpleOverlayRow,
overlayColumns: ["Name"],
filterDefs: entityFilters,
queryParams: { status: Model.STATUS.ACTIVE },
fields: Models.Task.autocompleteQueryWithNotes,
addon: TASKS_ICON
}
const widgetTypeMapping = {
[ENTITY_TYPES.REPORTS]: widgetPropsReport,
[ENTITY_TYPES.PEOPLE]: widgetPropsPeople,
[ENTITY_TYPES.ORGANIZATIONS]: widgetPropsOrganization,
[ENTITY_TYPES.POSITIONS]: widgetPropsPosition,
[ENTITY_TYPES.LOCATIONS]: widgetPropsLocation,
[ENTITY_TYPES.TASKS]: widgetPropsTask
}
const MultiTypeAdvancedSelectComponent = ({
fieldName,
onConfirm,
objectType,
entityTypes,
value,
isMultiSelect,
filters,
className
}) => {
const [entityType, setEntityType] = useState(
objectType ||
Object.values(ENTITY_TYPES).find(et => entityTypes.includes(et)) ||
ENTITY_TYPES.REPORTS
)
const [advancedSelectProps, setAdvancedSelectProps] = useState(
widgetTypeMapping[entityType]
)
const changeEntityType = useCallback(newEntityType => {
setEntityType(newEntityType)
setAdvancedSelectProps(widgetTypeMapping[newEntityType])
}, [])
const searchPlaceholder = useMemo(() => {
const [key] = Object.entries(ENTITY_TYPES).find(
([, et]) => et === entityType
)
const entityLabel = SEARCH_OBJECT_LABELS[SEARCH_OBJECT_TYPES[key]]
return "Find " + entityLabel.toLowerCase()
}, [entityType])
const SelectComponent = isMultiSelect
? AdvancedMultiSelect
: AdvancedSingleSelect
const extraSelectProps = isMultiSelect ? {} : { showRemoveButton: false }
const filterDefs =
typeof advancedSelectProps.filterDefs === "function"
? advancedSelectProps.filterDefs(filters[0]?.[entityType])
: advancedSelectProps.filterDefs
return (
<>
{entityTypes.length > 1 && (
<ButtonToggleGroup
size="sm"
value={entityType}
onChange={changeEntityType}
style={{ marginBottom: "5px" }}
>
{Object.entries(ENTITY_TYPES)
.filter(([, et]) => entityTypes.includes(et))
.map(([key, entityName]) => {
const entityLabel = SEARCH_OBJECT_LABELS[SEARCH_OBJECT_TYPES[key]]
return (
<Button
key={entityName}
value={entityName}
variant="outline-secondary"
>
{entityLabel}
</Button>
)
})}
</ButtonToggleGroup>
)}
<SelectComponent
autofocus="true"
fieldName={fieldName}
fieldLabel="Search in ANET:"
placeholder={searchPlaceholder}
value={value}
showEmbedded
overlayColumns={advancedSelectProps.overlayColumns}
overlayRenderRow={advancedSelectProps.overlayRenderRow}
filterDefs={filterDefs}
onChange={value => onConfirm(value, entityType)}
objectType={advancedSelectProps.objectType}
queryParams={advancedSelectProps.queryParams}
fields={advancedSelectProps.fields}
addon={advancedSelectProps.addon}
className={className}
{...extraSelectProps}
/>
</>
)
}
MultiTypeAdvancedSelectComponent.propTypes = {
fieldName: PropTypes.string,
onConfirm: PropTypes.func,
objectType: PropTypes.string,
entityTypes: PropTypes.arrayOf(PropTypes.string).isRequired,
value: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
isMultiSelect: PropTypes.bool.isRequired,
filters: PropTypes.array,
className: PropTypes.string
}
MultiTypeAdvancedSelectComponent.defaultProps = {
fieldName: "entitySelect",
entityTypes: Object.values(ENTITY_TYPES),
isMultiSelect: false,
filters: []
}
export default MultiTypeAdvancedSelectComponent
|
src/components/icon.js
|
zccz14/blog
|
import React from 'react'
import PropTypes from 'prop-types'
import style from '../styles/icon.module.css'
const Icon = props => {
const { d, size = '1em', label, style: styles } = props
return (
<span className={style.root} style={styles} role="figure">
<svg
version="1.1"
width={size}
height={size}
viewBox="0 0 48 48"
xmlns="http://www.w3.org/2000/svg"
>
<path d={d} className={style.icon} />
</svg>
{label && <span className={style.label}>{label}</span>}
</span>
)
}
Icon.propTypes = {
d: PropTypes.string,
size: PropTypes.number,
label: PropTypes.string,
style: PropTypes.object,
}
export default Icon
|
src/modules/About.js
|
hong1012/FreePay
|
import React from 'react'
import {Button} from 'antd'
import {Input, Table, DatePicker} from 'antd'
import moment from 'moment';
import Api from '../utils/Api'
import './About.less';
const dateFormat = 'YYYY-MM-DD';
const columns = [
{
title: 'eid ',
dataIndex: 'eid',
key: 'eid'
},
{
title: '名称',
dataIndex: 'companyname',
key: 'name'
}, {
title: 'pv',
dataIndex: 'pv',
key: 'pv'
}, {
title: 'uv',
dataIndex: 'uv',
key: 'uv'
}];
class Test extends React.Component {
constructor(props) {
super(props);
// 设置 initial state
this.state = {
dataSource: [],
loading: false,
startDate: '2016-12-15',
endDate: '2016-12-23'
};
this.handleClick = this.handleClick.bind(this);
this.onChange1 = this.onChange1.bind(this);
this.onChange2 = this.onChange2.bind(this);
this.getData = this.getData.bind(this);
}
componentDidMount() {
this.getData();
}
handleClick(e) {
this.setState({
loading: true
});
this.getData();
}
getData() {
var that = this;
this.setState({
loading: true
});
Api.getmob({
'url': 'http://mob.cmcloud.cn/serverCloud/DataReport/GetVisitDataTotal?eid=&startdate=' + this.state.startDate + '&enddate=' + this.state.endDate + '&operateid=1',
'fnSuccess': function (data) {
that.setState({
loading: false,
dataSource: data
});
}
});
}
onChange1(date, dateString) {
// console.log(date, dateString);
var that = this;
this.setState({
startDate: dateString
}, function () {
that.getData();
});
}
onChange2(date, dateString) {
var that = this;
this.setState({
endDate: dateString
}, function () {
that.getData();
});
}
render() {
return (
<div className="About">
<DatePicker style={{'margin': '0 15px'}} onChange={this.onChange1}
defaultValue={moment(this.state.startDate, dateFormat)}/>
<DatePicker onChange={this.onChange2} defaultValue={moment(this.state.endDate, dateFormat)}/>
<Button type="ghost" className="btn" onClick={this.handleClick}>查询</Button>
<Table dataSource={this.state.dataSource} columns={columns} loading={this.state.loading}/>
</div>
)
}
}
Test.propTypes = {
initialValue: React.PropTypes.string
};
Test.defaultProps = {
initialValue: 'hong default',
name: '测试按钮'
};
//导出组件
export default Test;
|
src/components/antd/input/Group.js
|
hyd378008136/olymComponents
|
import React from 'react';
import classNames from 'classnames';
const Group = (props) => {
const { prefixCls = 'ant-input-group', className = '' } = props;
const cls = classNames(prefixCls, {
[`${prefixCls}-lg`]: props.size === 'large',
[`${prefixCls}-sm`]: props.size === 'small',
[`${prefixCls}-compact`]: props.compact,
}, className);
return (React.createElement("span", { className: cls, style: props.style }, props.children));
};
export default Group;
|
src/components/__tests__/AboutPage.spec.js
|
svitekpavel/Conway-s-Game-of-Life
|
import React from 'react';
import { shallow } from 'enzyme';
import { expect } from 'chai';
import AboutPage from './../AboutPage';
describe('<AboutPage />', () => {
it('should have a header called \'Pavel Svitek\'', () => {
const wrapper = shallow(<AboutPage />);
const actual = wrapper.find('h1').text();
expect(actual).to.equal('Pavel Svitek');
});
it('should have a sidebar div with \'sidebar\' class', () => {
const wrapper = shallow(<AboutPage />);
const actual = wrapper.find('div.sidebar');
expect(actual).to.have.length(1);
});
it('should have 5 paragraphs', () => {
const wrapper = shallow(<AboutPage />);
const actual = wrapper.find('p');
expect(actual).to.have.length(5);
});
});
|
src/Components/VenueSwiperComponent.js
|
Xeroeta/nkcgo-webapp
|
import React, { Component } from 'react';
import ReactSwipe from 'react-swipe';
import { Button } from 'react-bootstrap';
import history from '../history';
const GOOGLE_DIR_PREFIX = 'https://www.google.com/maps/dir/?api=1&dir_action=navigate&travelmode=walking&destination=';
export default class VenueSwiperComponent extends Component {
constructor(props) {
super(props);
let currentVenueSliderIndex = this.val2key(props.currentVenueKey, props.VenuesData);
this.state = {
VenuesData: props.VenuesData,
currentVenueKey: props.currentVenueKey,
startSlide: currentVenueSliderIndex
};
console.log('initial Props');
console.log(props.VenuesData);
// this.updateWindowDimensions = this.updateWindowDimensions.bind(this);
}
val2key(val, markers_array){
console.log("Input - markers_array");
console.log(markers_array);
for (var key in markers_array) {
let array_val = markers_array[key];
// console.log("Val = ");
// console.log(val);
// console.log("Venue id - ");
// console.log(array_val.venueID);
if(array_val.venueID === val){
console.log("Returning final key - ");
console.log(key);
let int_key = parseInt(key);
if(int_key==NaN)
{
return 0;
}
return int_key;
}
}
}
componentWillReceiveProps(nextProps) {
console.log('nextProps.VenuesData');
console.log(nextProps.VenuesData);
let currentVenueSliderIndex = this.val2key(this.state.currentVenueKey, nextProps.VenuesData);
console.log('currentVenueSliderIndex');
console.log(currentVenueSliderIndex);
this.setState({ startSlide: currentVenueSliderIndex });
this.setState({ VenuesData: nextProps.VenuesData });
}
login() {
this.props.auth.login();
}
showMapDirections(e, venue_key, venue_description)
{
//alert("Redirect to Google Maps!");
window.location.href = GOOGLE_DIR_PREFIX+venue_description;
}
showCameraScreen(e, venue_key, venue_title)
{
console.log("inside - showCameraScreen Venue_key");
console.log(venue_key);
console.log("inside - showCameraScreen venue_title");
console.log(venue_title);
history.replace('/camera',{venue_key:venue_key, venue_title: venue_title});
}
showSnapUploadScreen(e, venue_key, venue_title)
{
console.log("inside - showCameraScreen Venue_key");
console.log(venue_key);
console.log("inside - showCameraScreen venue_title");
console.log(venue_title);
history.replace('/upload',{venue_key:venue_key, venue_title: venue_title});
}
goTo(route) {
// alert(route);
this.props.history.replace(`/${route}`)
}
goToPreviousSlide()
{
console.log("Go Previous");
if(this.swiper)
{
console.log("Swiper initialised. Going Previous");
this.swiper.prev();
}
else
{
console.log("No Swiper initialised");
}
}
goToNextSlide()
{
console.log("Go Next");
if(this.swiper)
{
console.log("Swiper initialised. Going Next");
this.swiper.next();
}
else
{
console.log("No Swiper initialised");
}
}
render() {
const { isAuthenticated } = this.props.auth;
if(!this.state.VenuesData.length)
{
return (
<div>
Loading Venue Info please wait
</div>
);
}
return (
<div className="slider-wrapper">
<div className="row">
<div className="col-xs-6 text-left">
<Button
bsStyle="primary"
className="btn-margin"
onClick={this.goToPreviousSlide.bind(this)}
>
{'<<'} Previous
</Button>
</div>
<div className="col-xs-6 text-right">
<Button
bsStyle="primary"
className="btn-margin"
onClick={this.goToNextSlide.bind(this)}
>
Next {'>>'}
</Button>
</div>
</div>
<ReactSwipe
key={this.state.VenuesData.length}
ref={ref => { this.swiper = ref; }}
swipeOptions={{continuous: true, startSlide: this.state.startSlide}}
>
{
this.state.VenuesData.map(venue => (
<div
className="slide-wrapper"
key={venue.venueID}
>
<center>
<div>
<p style={styles.venueTitle}>{venue.title}</p>
<p style={styles.venueDescription}>{venue.description}</p>
<img
alt=""
style={{
height:200,
width:200
}}
src={venue.markerImage}
/>
</div>
<div>
<div>
<div>
{
!isAuthenticated() && (
<Button
bsStyle="primary"
className="btn-margin"
onClick={this.login.bind(this)}
>
Login to Check-In
</Button>
)
}
{
isAuthenticated() && (
<Button
bsStyle="primary"
className="btn-margin"
onClick={e => this.showCameraScreen(e, venue.venueID, venue.title)}
>
Check-In here
</Button>
) &&
(
<Button
bsStyle="primary"
className="btn-margin"
onClick={e => this.showSnapUploadScreen(e, venue.venueID, venue.title)}
>
Check-In Here (Photo Upload or Snaps)
</Button>
)
}
</div>
</div>
<div>
<div>
<Button
bsStyle="primary"
className="btn-margin"
onClick={e => this.showMapDirections(e, venue.venueID, venue.description)}
>
Get directions to this venue
</Button>
</div>
</div>
</div>
<p style={styles.venueSpecialOffer}>{venue.notes}</p>
<p style={styles.venueScavengerHint}>{venue.notes2}</p>
</center>
</div>
))
}
</ReactSwipe>
</div>
);
}
}
const styles = {
venueTitle: {
color: '#03c',
fontSize: 30,
fontWeight: 'bold',
},
venueDescription: {
color: '#09c',
fontSize: 17,
fontWeight: 'normal',
},
venueSpecialOffer: {
color: '#000',
fontSize: 17,
fontWeight: 'normal',
},
venueScavengerHint: {
color: '#000',
fontSize: 17,
fontWeight: 'normal',
}
};
|
example/test/components/Input.js
|
wyze/redux-debounce
|
import { shallow } from 'enzyme'
import { spy } from 'sinon'
import Input from '../../src/components/Input.jsx'
import React from 'react'
import test from 'ava'
test('renders a value', t => {
const component = shallow(<Input value="Hi!" />)
t.is(component.find('input').prop('defaultValue'), 'Hi!')
})
test('fires onChange', t => {
const onChange = spy()
const component = shallow(<Input onChange={onChange} />)
component.find('input').simulate('change', 'Hello!')
t.truthy(onChange.called)
t.truthy(onChange.calledWith('Hello!'))
})
|
node_modules/react-icons/md/format-align-justify.js
|
bengimbel/Solstice-React-Contacts-Project
|
import React from 'react'
import Icon from 'react-icon-base'
const MdFormatAlignJustify = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m5 5h30v3.4h-30v-3.4z m0 10v-3.4h30v3.4h-30z m0 6.6v-3.2h30v3.2h-30z m0 6.8v-3.4h30v3.4h-30z m0 6.6v-3.4h30v3.4h-30z"/></g>
</Icon>
)
export default MdFormatAlignJustify
|
client.js
|
leifdalan/flux-websockets
|
'use strict';
import React from 'react';
import debug from 'debug';
import app from './shared/app';
import Router, {HistoryLocation} from 'react-router';
import navigateAction from './shared/actions/navigate';
import config from './config';
import FluxibleComponent from 'fluxible/addons/FluxibleComponent';
import picturefill from 'picturefill';
const bootstrapDebug = debug('Bootstrapping App:');
const dehydratedState = window.App;
// Set client dev tool debug level
window.localStorage &&
window.localStorage.setItem('debug', config.clientDebug);
window.picturefill = picturefill;
app.rehydrate(dehydratedState, (err, context) => {
if (err) {
throw err;
}
const renderApp = (runContext, Handler) => {
bootstrapDebug('React Rendering');
const mountNode = window.document.getElementById('app');
// wrap the root element to provide children with access to the context
const component = React.createFactory(Handler);
React.render(React.createElement(
FluxibleComponent,
{context: runContext.getComponentContext()},
component()
), mountNode);
};
const router = Router.create({
routes: app.getComponent(),
location: HistoryLocation,
// Fluxible's branch allows for passing of Fluxible context
// within React Router. Exposed in a component's willTransitionTo(arg)
// method as arg.context.
// Working off a branch of react-router:
// https://github.com/bobpace/react-router/tree/transitionContext
transitionContext: context
});
router.run((Handler, state) => {
context.executeAction(navigateAction, state, () => {
renderApp(context, Handler);
});
});
});
|
node_modules/reactify/node_modules/react-tools/src/browser/ui/__tests__/ReactMountDestruction-test.js
|
roger-hamilton/PathfinderNode
|
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @emails react-core
*/
'use strict';
var React = require('React');
describe('ReactMount', function() {
it("should destroy a react root upon request", function() {
var mainContainerDiv = document.createElement('div');
document.documentElement.appendChild(mainContainerDiv);
var instanceOne = (
<div className="firstReactDiv">
</div>
);
var firstRootDiv = document.createElement('div');
mainContainerDiv.appendChild(firstRootDiv);
React.render(instanceOne, firstRootDiv);
var instanceTwo = (
<div className="secondReactDiv">
</div>
);
var secondRootDiv = document.createElement('div');
mainContainerDiv.appendChild(secondRootDiv);
React.render(instanceTwo, secondRootDiv);
// Test that two react roots are rendered in isolation
expect(firstRootDiv.firstChild.className).toBe('firstReactDiv');
expect(secondRootDiv.firstChild.className).toBe('secondReactDiv');
// Test that after unmounting each, they are no longer in the document.
React.unmountComponentAtNode(firstRootDiv);
expect(firstRootDiv.firstChild).toBeNull();
React.unmountComponentAtNode(secondRootDiv);
expect(secondRootDiv.firstChild).toBeNull();
});
});
|
public/js/lib/codemirror/addon/emmet/emmet.js
|
zmiftah/freecodecamp
|
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o;"undefined"!=typeof window?o=window:"undefined"!=typeof global?o=global:"undefined"!=typeof self&&(o=self),o.emmetCodeMirror=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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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(require,module,exports){
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Emmet Editor interface implementation for CodeMirror.
* Interface is optimized for multiple cursor usage: authors
* should run acttion multiple times and update `selectionIndex`
* property on each iteration.
*/
var emmet = _interopRequire(require("./emmet"));
var modeMap = {
"text/html": "html",
"application/xml": "xml",
"text/xsl": "xsl",
"text/css": "css",
"text/x-less": "less",
"text/x-scss": "scss",
"text/x-sass": "sass"
};
exports.modeMap = modeMap;
var EmmetEditor = (function () {
function EmmetEditor(ctx) {
var selIndex = arguments[1] === undefined ? 0 : arguments[1];
_classCallCheck(this, EmmetEditor);
this.context = ctx;
this.selectionIndex = selIndex || 0;
}
_createClass(EmmetEditor, {
selectionList: {
/**
* Returns list of selections for current CodeMirror instance.
* @return {Array}
*/
value: function selectionList() {
var cm = this.context;
return cm.listSelections().map(function (sel) {
var anchor = posToIndex(cm, sel.anchor);
var head = posToIndex(cm, sel.head);
return {
start: Math.min(anchor, head),
end: Math.max(anchor, head)
};
});
}
},
getCaretPos: {
value: function getCaretPos() {
return this.getSelectionRange().start;
}
},
setCaretPos: {
value: function setCaretPos(pos) {
this.createSelection(pos);
}
},
getSelectionRange: {
/**
* Returns current selection range (for current selection index)
* @return {Object}
*/
value: function getSelectionRange() {
return this.selectionList()[this.selectionIndex];
}
},
createSelection: {
value: function createSelection(start, end) {
if (typeof end == "undefined") {
end = start;
}
var sels = this.selectionList();
var cm = this.context;
sels[this.selectionIndex] = { start: start, end: end };
this.context.setSelections(sels.map(function (sel) {
return {
head: indexToPos(cm, sel.start),
anchor: indexToPos(cm, sel.end)
};
}));
}
},
getSelection: {
/**
* Returns current selection
* @return {String}
*/
value: function getSelection() {
var sel = this.getSelectionRange();
sel.start = indexToPos(this.context, sel.start);
sel.end = indexToPos(this.context, sel.end);
return this.context.getRange(sel.start, sel.end);
}
},
getCurrentLineRange: {
value: function getCurrentLineRange() {
var caret = indexToPos(this.context, this.getCaretPos());
return {
start: posToIndex(this.context, caret.line, 0),
end: posToIndex(this.context, caret.line, this.context.getLine(caret.line).length)
};
}
},
getCurrentLine: {
value: function getCurrentLine() {
var caret = indexToPos(this.context, this.getCaretPos());
return this.context.getLine(caret.line) || "";
}
},
replaceContent: {
value: function replaceContent(value, start, end, noIndent) {
if (typeof end == "undefined") {
end = typeof start == "undefined" ? this.getContent().length : start;
}
if (typeof start == "undefined") {
start = 0;
}
// normalize indentation according to editor preferences
value = this.normalize(value);
// indent new value
if (!noIndent) {
value = emmet.utils.common.padString(value, emmet.utils.common.getLinePaddingFromPosition(this.getContent(), start));
}
// find new caret position
var tabstopData = emmet.tabStops.extract(value, { escape: function (ch) {
return ch;
} });
value = tabstopData.text;
var firstTabStop = tabstopData.tabstops[0] || { start: value.length, end: value.length };
firstTabStop.start += start;
firstTabStop.end += start;
this.context.replaceRange(value, indexToPos(this.context, start), indexToPos(this.context, end));
this.createSelection(firstTabStop.start, firstTabStop.end);
}
},
normalize: {
/**
* Normalizes string indentation in given string
* according to editor preferences
* @param {String} str
* @return {String}
*/
value: function normalize(str) {
var indent = "\t";
var ctx = this.context;
if (!ctx.getOption("indentWithTabs")) {
indent = emmet.utils.common.repeatString(" ", ctx.getOption("indentUnit"));
}
return emmet.utils.editor.normalize(str, {
indentation: indent
});
}
},
getContent: {
value: function getContent() {
return this.context.getValue();
}
},
getSyntax: {
value: function getSyntax() {
var editor = this.context;
var pos = editor.posFromIndex(this.getCaretPos());
var mode = editor.getModeAt(editor.getCursor());
var syntax = mode.name;
if (syntax === "xml" && mode.configuration) {
syntax = mode.configuration;
}
return syntax || emmet.utils.action.detectSyntax(this, syntax);
}
},
getProfileName: {
/**
* Returns current output profile name (@see emmet#setupProfile)
* @return {String}
*/
value: function getProfileName() {
if (this.context.getOption("profile")) {
return this.context.getOption("profile");
}
return emmet.utils.action.detectProfile(this);
}
},
prompt: {
/**
* Ask user to enter something
* @param {String} title Dialog title
* @return {String} Entered data
*/
value: (function (_prompt) {
var _promptWrapper = function prompt(_x) {
return _prompt.apply(this, arguments);
};
_promptWrapper.toString = function () {
return _prompt.toString();
};
return _promptWrapper;
})(function (title) {
return prompt(title);
})
},
getFilePath: {
/**
* Returns current editor's file path
* @return {String}
*/
value: function getFilePath() {
return location.href;
}
},
isValidSyntax: {
/**
* Check if current editor syntax is valid, e.g. is supported by Emmet
* @return {Boolean}
*/
value: function isValidSyntax() {
return emmet.resources.hasSyntax(this.getSyntax());
}
}
});
return EmmetEditor;
})();
exports["default"] = EmmetEditor;
/**
* Converts CM’s inner representation of character
* position (line, ch) to character index in text
* @param {CodeMirror} cm CodeMirror instance
* @param {Object} pos Position object
* @return {Number}
*/
function posToIndex(cm, pos) {
if (arguments.length > 2 && typeof pos !== "object") {
pos = { line: arguments[1], ch: arguments[2] };
}
return cm.indexFromPos(pos);
}
/**
* Converts charater index in text to CM’s internal object representation
* @param {CodeMirror} cm CodeMirror instance
* @param {Number} ix Character index in CM document
* @return {Object}
*/
function indexToPos(cm, ix) {
return cm.posFromIndex(ix);
}
},{"./emmet":2}],2:[function(require,module,exports){
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var emmet = _interopRequire(require("emmet"));
require("emmet/bundles/snippets");
require("emmet/bundles/caniuse");
module.exports = emmet;
},{"emmet":39,"emmet/bundles/caniuse":3,"emmet/bundles/snippets":4}],3:[function(require,module,exports){
/**
* Bundler, used in builder script to statically
* include optimized caniuse.json into bundle
*/
var ciu = require('../lib/assets/caniuse');
var db = require('../lib/caniuse.json');
ciu.load(db, true);
},{"../lib/assets/caniuse":23,"../lib/caniuse.json":35}],4:[function(require,module,exports){
/**
* Bundler, used in builder script to statically
* include snippets.json into bundle
*/
var res = require('../lib/assets/resources');
var snippets = require('../lib/snippets.json');
res.setVocabulary(snippets, 'system');
},{"../lib/assets/resources":31,"../lib/snippets.json":68}],5:[function(require,module,exports){
/**
* HTML pair matching (balancing) actions
* @constructor
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var htmlMatcher = require('../assets/htmlMatcher');
var utils = require('../utils/common');
var editorUtils = require('../utils/editor');
var actionUtils = require('../utils/action');
var range = require('../assets/range');
var cssEditTree = require('../editTree/css');
var cssSections = require('../utils/cssSections');
var lastMatch = null;
function last(arr) {
return arr[arr.length - 1];
}
function balanceHTML(editor, direction) {
var info = editorUtils.outputInfo(editor);
var content = info.content;
var sel = range(editor.getSelectionRange());
// validate previous match
if (lastMatch && !lastMatch.range.equal(sel)) {
lastMatch = null;
}
if (lastMatch && sel.length()) {
if (direction == 'in') {
// user has previously selected tag and wants to move inward
if (lastMatch.type == 'tag' && !lastMatch.close) {
// unary tag was selected, can't move inward
return false;
} else {
if (lastMatch.range.equal(lastMatch.outerRange)) {
lastMatch.range = lastMatch.innerRange;
} else {
var narrowed = utils.narrowToNonSpace(content, lastMatch.innerRange);
lastMatch = htmlMatcher.find(content, narrowed.start + 1);
if (lastMatch && lastMatch.range.equal(sel) && lastMatch.outerRange.equal(sel)) {
lastMatch.range = lastMatch.innerRange;
}
}
}
} else {
if (
!lastMatch.innerRange.equal(lastMatch.outerRange)
&& lastMatch.range.equal(lastMatch.innerRange)
&& sel.equal(lastMatch.range)) {
lastMatch.range = lastMatch.outerRange;
} else {
lastMatch = htmlMatcher.find(content, sel.start);
if (lastMatch && lastMatch.range.equal(sel) && lastMatch.innerRange.equal(sel)) {
lastMatch.range = lastMatch.outerRange;
}
}
}
} else {
lastMatch = htmlMatcher.find(content, sel.start);
}
if (lastMatch) {
if (lastMatch.innerRange.equal(sel)) {
lastMatch.range = lastMatch.outerRange;
}
if (!lastMatch.range.equal(sel)) {
editor.createSelection(lastMatch.range.start, lastMatch.range.end);
return true;
}
}
lastMatch = null;
return false;
}
function rangesForCSSRule(rule, pos) {
// find all possible ranges
var ranges = [rule.range(true)];
// braces content
ranges.push(rule.valueRange(true));
// find nested sections
var nestedSections = cssSections.nestedSectionsInRule(rule);
// real content, e.g. from first property name to
// last property value
var items = rule.list();
if (items.length || nestedSections.length) {
var start = Number.POSITIVE_INFINITY, end = -1;
if (items.length) {
start = items[0].namePosition(true);
end = last(items).range(true).end;
}
if (nestedSections.length) {
if (nestedSections[0].start < start) {
start = nestedSections[0].start;
}
if (last(nestedSections).end > end) {
end = last(nestedSections).end;
}
}
ranges.push(range.create2(start, end));
}
ranges = ranges.concat(nestedSections);
var prop = cssEditTree.propertyFromPosition(rule, pos) || items[0];
if (prop) {
ranges.push(prop.range(true));
var valueRange = prop.valueRange(true);
if (!prop.end()) {
valueRange._unterminated = true;
}
ranges.push(valueRange);
}
return ranges;
}
/**
* Returns all possible selection ranges for given caret position
* @param {String} content CSS content
* @param {Number} pos Caret position(where to start searching)
* @return {Array}
*/
function getCSSRanges(content, pos) {
var rule;
if (typeof content === 'string') {
var ruleRange = cssSections.matchEnclosingRule(content, pos);
if (ruleRange) {
rule = cssEditTree.parse(ruleRange.substring(content), {
offset: ruleRange.start
});
}
} else {
// passed parsed CSS rule
rule = content;
}
if (!rule) {
return null;
}
// find all possible ranges
var ranges = rangesForCSSRule(rule, pos);
// remove empty ranges
ranges = ranges.filter(function(item) {
return !!item.length;
});
return utils.unique(ranges, function(item) {
return item.valueOf();
});
}
function balanceCSS(editor, direction) {
var info = editorUtils.outputInfo(editor);
var content = info.content;
var sel = range(editor.getSelectionRange());
var ranges = getCSSRanges(info.content, sel.start);
if (!ranges && sel.length()) {
// possible reason: user has already selected
// CSS rule from last match
try {
var rule = cssEditTree.parse(sel.substring(info.content), {
offset: sel.start
});
ranges = getCSSRanges(rule, sel.start);
} catch(e) {}
}
if (!ranges) {
return false;
}
ranges = range.sort(ranges, true);
// edge case: find match that equals current selection,
// in case if user moves inward after selecting full CSS rule
var bestMatch = utils.find(ranges, function(r) {
return r.equal(sel);
});
if (!bestMatch) {
bestMatch = utils.find(ranges, function(r) {
// Check for edge case: caret right after CSS value
// but it doesn‘t contains terminating semicolon.
// In this case we have to check full value range
return r._unterminated ? r.include(sel.start) : r.inside(sel.start);
});
}
if (!bestMatch) {
return false;
}
// if best match equals to current selection, move index
// one position up or down, depending on direction
var bestMatchIx = ranges.indexOf(bestMatch);
if (bestMatch.equal(sel)) {
bestMatchIx += direction == 'out' ? 1 : -1;
}
if (bestMatchIx < 0 || bestMatchIx >= ranges.length) {
if (bestMatchIx >= ranges.length && direction == 'out') {
pos = bestMatch.start - 1;
var outerRanges = getCSSRanges(content, pos);
if (outerRanges) {
bestMatch = last(outerRanges.filter(function(r) {
return r.inside(pos);
}));
}
} else if (bestMatchIx < 0 && direction == 'in') {
bestMatch = null;
} else {
bestMatch = null;
}
} else {
bestMatch = ranges[bestMatchIx];
}
if (bestMatch) {
editor.createSelection(bestMatch.start, bestMatch.end);
return true;
}
return false;
}
return {
/**
* Find and select HTML tag pair
* @param {IEmmetEditor} editor Editor instance
* @param {String} direction Direction of pair matching: 'in' or 'out'.
* Default is 'out'
*/
balance: function(editor, direction) {
direction = String((direction || 'out').toLowerCase());
var info = editorUtils.outputInfo(editor);
if (actionUtils.isSupportedCSS(info.syntax)) {
return balanceCSS(editor, direction);
}
return balanceHTML(editor, direction);
},
balanceInwardAction: function(editor) {
return this.balance(editor, 'in');
},
balanceOutwardAction: function(editor) {
return this.balance(editor, 'out');
},
/**
* Moves caret to matching opening or closing tag
* @param {IEmmetEditor} editor
*/
goToMatchingPairAction: function(editor) {
var content = String(editor.getContent());
var caretPos = editor.getCaretPos();
if (content.charAt(caretPos) == '<')
// looks like caret is outside of tag pair
caretPos++;
var tag = htmlMatcher.tag(content, caretPos);
if (tag && tag.close) { // exclude unary tags
if (tag.open.range.inside(caretPos)) {
editor.setCaretPos(tag.close.range.start);
} else {
editor.setCaretPos(tag.open.range.start);
}
return true;
}
return false;
}
};
});
},{"../assets/htmlMatcher":26,"../assets/range":30,"../editTree/css":37,"../utils/action":70,"../utils/common":73,"../utils/cssSections":74,"../utils/editor":75}],6:[function(require,module,exports){
/**
* Encodes/decodes image under cursor to/from base64
* @param {IEmmetEditor} editor
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var file = require('../plugin/file');
var base64 = require('../utils/base64');
var actionUtils = require('../utils/action');
var editorUtils = require('../utils/editor');
/**
* Test if <code>text</code> starts with <code>token</code> at <code>pos</code>
* position. If <code>pos</code> is omitted, search from beginning of text
* @param {String} token Token to test
* @param {String} text Where to search
* @param {Number} pos Position where to start search
* @return {Boolean}
* @since 0.65
*/
function startsWith(token, text, pos) {
pos = pos || 0;
return text.charAt(pos) == token.charAt(0) && text.substr(pos, token.length) == token;
}
/**
* Encodes image to base64
*
* @param {IEmmetEditor} editor
* @param {String} imgPath Path to image
* @param {Number} pos Caret position where image is located in the editor
* @return {Boolean}
*/
function encodeToBase64(editor, imgPath, pos) {
var editorFile = editor.getFilePath();
var defaultMimeType = 'application/octet-stream';
if (editorFile === null) {
throw "You should save your file before using this action";
}
// locate real image path
var realImgPath = file.locateFile(editorFile, imgPath);
if (realImgPath === null) {
throw "Can't find " + imgPath + ' file';
}
file.read(realImgPath, function(err, content) {
if (err) {
throw 'Unable to read ' + realImgPath + ': ' + err;
}
var b64 = base64.encode(String(content));
if (!b64) {
throw "Can't encode file content to base64";
}
b64 = 'data:' + (actionUtils.mimeTypes[String(file.getExt(realImgPath))] || defaultMimeType) +
';base64,' + b64;
editor.replaceContent('$0' + b64, pos, pos + imgPath.length);
});
return true;
}
/**
* Decodes base64 string back to file.
* @param {IEmmetEditor} editor
* @param {String} data Base64-encoded file content
* @param {Number} pos Caret position where image is located in the editor
*/
function decodeFromBase64(editor, data, pos) {
// ask user to enter path to file
var filePath = String(editor.prompt('Enter path to file (absolute or relative)'));
if (!filePath)
return false;
var absPath = file.createPath(editor.getFilePath(), filePath);
if (!absPath) {
throw "Can't save file";
}
file.save(absPath, base64.decode( data.replace(/^data\:.+?;.+?,/, '') ));
editor.replaceContent('$0' + filePath, pos, pos + data.length);
return true;
}
return {
/**
* Action to encode or decode file to data:url
* @param {IEmmetEditor} editor Editor instance
* @param {String} syntax Current document syntax
* @param {String} profile Output profile name
* @return {Boolean}
*/
encodeDecodeDataUrlAction: function(editor) {
var data = String(editor.getSelection());
var caretPos = editor.getCaretPos();
var info = editorUtils.outputInfo(editor);
if (!data) {
// no selection, try to find image bounds from current caret position
var text = info.content, m;
while (caretPos-- >= 0) {
if (startsWith('src=', text, caretPos)) { // found <img src="">
if ((m = text.substr(caretPos).match(/^(src=(["'])?)([^'"<>\s]+)\1?/))) {
data = m[3];
caretPos += m[1].length;
}
break;
} else if (startsWith('url(', text, caretPos)) { // found CSS url() pattern
if ((m = text.substr(caretPos).match(/^(url\((['"])?)([^'"\)\s]+)\1?/))) {
data = m[3];
caretPos += m[1].length;
}
break;
}
}
}
if (data) {
if (startsWith('data:', data)) {
return decodeFromBase64(editor, data, caretPos);
} else {
return encodeToBase64(editor, data, caretPos);
}
}
return false;
}
};
});
},{"../plugin/file":63,"../utils/action":70,"../utils/base64":71,"../utils/editor":75}],7:[function(require,module,exports){
/**
* Move between next/prev edit points. 'Edit points' are places between tags
* and quotes of empty attributes in html
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
/**
* Search for new caret insertion point
* @param {IEmmetEditor} editor Editor instance
* @param {Number} inc Search increment: -1 — search left, 1 — search right
* @param {Number} offset Initial offset relative to current caret position
* @return {Number} Returns -1 if insertion point wasn't found
*/
function findNewEditPoint(editor, inc, offset) {
inc = inc || 1;
offset = offset || 0;
var curPoint = editor.getCaretPos() + offset;
var content = String(editor.getContent());
var maxLen = content.length;
var nextPoint = -1;
var reEmptyLine = /^\s+$/;
function getLine(ix) {
var start = ix;
while (start >= 0) {
var c = content.charAt(start);
if (c == '\n' || c == '\r')
break;
start--;
}
return content.substring(start, ix);
}
while (curPoint <= maxLen && curPoint >= 0) {
curPoint += inc;
var curChar = content.charAt(curPoint);
var nextChar = content.charAt(curPoint + 1);
var prevChar = content.charAt(curPoint - 1);
switch (curChar) {
case '"':
case '\'':
if (nextChar == curChar && prevChar == '=') {
// empty attribute
nextPoint = curPoint + 1;
}
break;
case '>':
if (nextChar == '<') {
// between tags
nextPoint = curPoint + 1;
}
break;
case '\n':
case '\r':
// empty line
if (reEmptyLine.test(getLine(curPoint - 1))) {
nextPoint = curPoint;
}
break;
}
if (nextPoint != -1)
break;
}
return nextPoint;
}
return {
/**
* Move to previous edit point
* @param {IEmmetEditor} editor Editor instance
* @param {String} syntax Current document syntax
* @param {String} profile Output profile name
* @return {Boolean}
*/
previousEditPointAction: function(editor, syntax, profile) {
var curPos = editor.getCaretPos();
var newPoint = findNewEditPoint(editor, -1);
if (newPoint == curPos)
// we're still in the same point, try searching from the other place
newPoint = findNewEditPoint(editor, -1, -2);
if (newPoint != -1) {
editor.setCaretPos(newPoint);
return true;
}
return false;
},
/**
* Move to next edit point
* @param {IEmmetEditor} editor Editor instance
* @param {String} syntax Current document syntax
* @param {String} profile Output profile name
* @return {Boolean}
*/
nextEditPointAction: function(editor, syntax, profile) {
var newPoint = findNewEditPoint(editor, 1);
if (newPoint != -1) {
editor.setCaretPos(newPoint);
return true;
}
return false;
}
};
});
},{}],8:[function(require,module,exports){
/**
* Evaluates simple math expression under caret
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var actionUtils = require('../utils/action');
var utils = require('../utils/common');
var math = require('../utils/math');
var range = require('../assets/range');
return {
/**
* Evaluates math expression under the caret
* @param {IEmmetEditor} editor
* @return {Boolean}
*/
evaluateMathAction: function(editor) {
var content = editor.getContent();
var chars = '.+-*/\\';
/** @type Range */
var sel = range(editor.getSelectionRange());
if (!sel.length()) {
sel = actionUtils.findExpressionBounds(editor, function(ch) {
return utils.isNumeric(ch) || chars.indexOf(ch) != -1;
});
}
if (sel && sel.length()) {
var expr = sel.substring(content);
// replace integral division: 11\2 => Math.round(11/2)
expr = expr.replace(/([\d\.\-]+)\\([\d\.\-]+)/g, 'round($1/$2)');
try {
var result = utils.prettifyNumber(math.evaluate(expr));
editor.replaceContent(result, sel.start, sel.end);
editor.setCaretPos(sel.start + result.length);
return true;
} catch (e) {}
}
return false;
}
};
});
},{"../assets/range":30,"../utils/action":70,"../utils/common":73,"../utils/math":76}],9:[function(require,module,exports){
/**
* 'Expand abbreviation' editor action: extracts abbreviation from current caret
* position and replaces it with formatted output.
* <br><br>
* This behavior can be overridden with custom handlers which can perform
* different actions when 'Expand Abbreviation' action is called.
* For example, a CSS gradient handler that produces vendor-prefixed gradient
* definitions registers its own expand abbreviation handler.
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var handlerList = require('../assets/handlerList');
var range = require('../assets/range');
var prefs = require('../assets/preferences');
var utils = require('../utils/common');
var editorUtils = require('../utils/editor');
var actionUtils = require('../utils/action');
var cssGradient = require('../resolver/cssGradient');
var parser = require('../parser/abbreviation');
/**
* Search for abbreviation in editor from current caret position
* @param {IEmmetEditor} editor Editor instance
* @return {String}
*/
function findAbbreviation(editor) {
var r = range(editor.getSelectionRange());
var content = String(editor.getContent());
if (r.length()) {
// abbreviation is selected by user
return r.substring(content);
}
// search for new abbreviation from current caret position
var curLine = editor.getCurrentLineRange();
return actionUtils.extractAbbreviation(content.substring(curLine.start, r.start));
}
/**
* @type HandlerList List of registered handlers
*/
var handlers = handlerList.create();
// XXX setup default expand handlers
/**
* Extracts abbreviation from current caret
* position and replaces it with formatted output
* @param {IEmmetEditor} editor Editor instance
* @param {String} syntax Syntax type (html, css, etc.)
* @param {String} profile Output profile name (html, xml, xhtml)
* @return {Boolean} Returns <code>true</code> if abbreviation was expanded
* successfully
*/
handlers.add(function(editor, syntax, profile) {
var caretPos = editor.getSelectionRange().end;
var abbr = findAbbreviation(editor);
if (abbr) {
var content = parser.expand(abbr, {
syntax: syntax,
profile: profile,
contextNode: actionUtils.captureContext(editor)
});
if (content) {
var replaceFrom = caretPos - abbr.length;
var replaceTo = caretPos;
// a special case for CSS: if editor already contains
// semicolon right after current caret position — replace it too
var cssSyntaxes = prefs.getArray('css.syntaxes');
if (cssSyntaxes && ~cssSyntaxes.indexOf(syntax)) {
var curContent = editor.getContent();
if (curContent.charAt(caretPos) == ';' && content.charAt(content.length - 1) == ';') {
replaceTo++;
}
}
editor.replaceContent(content, replaceFrom, replaceTo);
return true;
}
}
return false;
}, {order: -1});
handlers.add(cssGradient.expandAbbreviationHandler.bind(cssGradient));
return {
/**
* The actual “Expand Abbreviation“ action routine
* @param {IEmmetEditor} editor Editor instance
* @param {String} syntax Current document syntax
* @param {String} profile Output profile name
* @return {Boolean}
*/
expandAbbreviationAction: function(editor, syntax, profile) {
var args = utils.toArray(arguments);
// normalize incoming arguments
var info = editorUtils.outputInfo(editor, syntax, profile);
args[1] = info.syntax;
args[2] = info.profile;
return handlers.exec(false, args);
},
/**
* A special case of “Expand Abbreviation“ action, invoked by Tab key.
* In this case if abbreviation wasn’t expanded successfully or there’s a selecetion,
* the current line/selection will be indented.
* @param {IEmmetEditor} editor Editor instance
* @param {String} syntax Current document syntax
* @param {String} profile Output profile name
* @return {Boolean}
*/
expandAbbreviationWithTabAction: function(editor, syntax, profile) {
var sel = editor.getSelection();
var indent = '\t';
// if something is selected in editor,
// we should indent the selected content
if (sel) {
var selRange = range(editor.getSelectionRange());
var content = utils.padString(sel, indent);
editor.replaceContent(indent + '${0}', editor.getCaretPos());
var replaceRange = range(editor.getCaretPos(), selRange.length());
editor.replaceContent(content, replaceRange.start, replaceRange.end, true);
editor.createSelection(replaceRange.start, replaceRange.start + content.length);
return true;
}
// nothing selected, try to expand
if (!this.expandAbbreviationAction(editor, syntax, profile)) {
editor.replaceContent(indent, editor.getCaretPos());
}
return true;
},
_defaultHandler: function(editor, syntax, profile) {
var caretPos = editor.getSelectionRange().end;
var abbr = this.findAbbreviation(editor);
if (abbr) {
var ctx = actionUtils.captureContext(editor);
var content = parser.expand(abbr, syntax, profile, ctx);
if (content) {
editor.replaceContent(content, caretPos - abbr.length, caretPos);
return true;
}
}
return false;
},
/**
* Adds custom expand abbreviation handler. The passed function should
* return <code>true</code> if it was performed successfully,
* <code>false</code> otherwise.
*
* Added handlers will be called when 'Expand Abbreviation' is called
* in order they were added
* @memberOf expandAbbreviation
* @param {Function} fn
* @param {Object} options
*/
addHandler: function(fn, options) {
handlers.add(fn, options);
},
/**
* Removes registered handler
* @returns
*/
removeHandler: function(fn) {
handlers.remove(fn);
},
findAbbreviation: findAbbreviation
};
});
},{"../assets/handlerList":25,"../assets/preferences":28,"../assets/range":30,"../parser/abbreviation":55,"../resolver/cssGradient":65,"../utils/action":70,"../utils/common":73,"../utils/editor":75}],10:[function(require,module,exports){
/**
* Increment/decrement number under cursor
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
var actionUtils = require('../utils/action');
/**
* Returns length of integer part of number
* @param {String} num
*/
function intLength(num) {
num = num.replace(/^\-/, '');
if (~num.indexOf('.')) {
return num.split('.')[0].length;
}
return num.length;
}
return {
increment01Action: function(editor) {
return this.incrementNumber(editor, .1);
},
increment1Action: function(editor) {
return this.incrementNumber(editor, 1);
},
increment10Action: function(editor) {
return this.incrementNumber(editor, 10);
},
decrement01Action: function(editor) {
return this.incrementNumber(editor, -.1);
},
decrement1Action: function(editor) {
return this.incrementNumber(editor, -1);
},
decrement10Action: function(editor) {
return this.incrementNumber(editor, -10);
},
/**
* Default method to increment/decrement number under
* caret with given step
* @param {IEmmetEditor} editor
* @param {Number} step
* @return {Boolean}
*/
incrementNumber: function(editor, step) {
var hasSign = false;
var hasDecimal = false;
var r = actionUtils.findExpressionBounds(editor, function(ch, pos, content) {
if (utils.isNumeric(ch))
return true;
if (ch == '.') {
// make sure that next character is numeric too
if (!utils.isNumeric(content.charAt(pos + 1)))
return false;
return hasDecimal ? false : hasDecimal = true;
}
if (ch == '-')
return hasSign ? false : hasSign = true;
return false;
});
if (r && r.length()) {
var strNum = r.substring(String(editor.getContent()));
var num = parseFloat(strNum);
if (!isNaN(num)) {
num = utils.prettifyNumber(num + step);
// do we have zero-padded number?
if (/^(\-?)0+[1-9]/.test(strNum)) {
var minus = '';
if (RegExp.$1) {
minus = '-';
num = num.substring(1);
}
var parts = num.split('.');
parts[0] = utils.zeroPadString(parts[0], intLength(strNum));
num = minus + parts.join('.');
}
editor.replaceContent(num, r.start, r.end);
editor.createSelection(r.start, r.start + num.length);
return true;
}
}
return false;
}
};
});
},{"../utils/action":70,"../utils/common":73}],11:[function(require,module,exports){
/**
* Actions to insert line breaks. Some simple editors (like browser's
* <textarea>, for example) do not provide such simple things
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var prefs = require('../assets/preferences');
var utils = require('../utils/common');
var resources = require('../assets/resources');
var htmlMatcher = require('../assets/htmlMatcher');
var editorUtils = require('../utils/editor');
var xmlSyntaxes = ['html', 'xml', 'xsl'];
// setup default preferences
prefs.define('css.closeBraceIndentation', '\n',
'Indentation before closing brace of CSS rule. Some users prefere '
+ 'indented closing brace of CSS rule for better readability. '
+ 'This preference’s value will be automatically inserted before '
+ 'closing brace when user adds newline in newly created CSS rule '
+ '(e.g. when “Insert formatted linebreak” action will be performed '
+ 'in CSS file). If you’re such user, you may want to write put a value '
+ 'like <code>\\n\\t</code> in this preference.');
return {
/**
* Inserts newline character with proper indentation. This action is used in
* editors that doesn't have indentation control (like textarea element) to
* provide proper indentation for inserted newlines
* @param {IEmmetEditor} editor Editor instance
*/
insertLineBreakAction: function(editor) {
if (!this.insertLineBreakOnlyAction(editor)) {
var curPadding = editorUtils.getCurrentLinePadding(editor);
var content = String(editor.getContent());
var caretPos = editor.getCaretPos();
var len = content.length;
var nl = '\n';
// check out next line padding
var lineRange = editor.getCurrentLineRange();
var nextPadding = '';
for (var i = lineRange.end + 1, ch; i < len; i++) {
ch = content.charAt(i);
if (ch == ' ' || ch == '\t')
nextPadding += ch;
else
break;
}
if (nextPadding.length > curPadding.length) {
editor.replaceContent(nl + nextPadding, caretPos, caretPos, true);
} else {
editor.replaceContent(nl, caretPos);
}
}
return true;
},
/**
* Inserts newline character with proper indentation in specific positions only.
* @param {IEmmetEditor} editor
* @return {Boolean} Returns <code>true</code> if line break was inserted
*/
insertLineBreakOnlyAction: function(editor) {
var info = editorUtils.outputInfo(editor);
var caretPos = editor.getCaretPos();
var nl = '\n';
var pad = '\t';
if (~xmlSyntaxes.indexOf(info.syntax)) {
// let's see if we're breaking newly created tag
var tag = htmlMatcher.tag(info.content, caretPos);
if (tag && !tag.innerRange.length()) {
editor.replaceContent(nl + pad + utils.getCaretPlaceholder() + nl, caretPos);
return true;
}
} else if (info.syntax == 'css') {
/** @type String */
var content = info.content;
if (caretPos && content.charAt(caretPos - 1) == '{') {
var append = prefs.get('css.closeBraceIndentation');
var hasCloseBrace = content.charAt(caretPos) == '}';
if (!hasCloseBrace) {
// do we really need special formatting here?
// check if this is really a newly created rule,
// look ahead for a closing brace
for (var i = caretPos, il = content.length, ch; i < il; i++) {
ch = content.charAt(i);
if (ch == '{') {
// ok, this is a new rule without closing brace
break;
}
if (ch == '}') {
// not a new rule, just add indentation
append = '';
hasCloseBrace = true;
break;
}
}
}
if (!hasCloseBrace) {
append += '}';
}
// defining rule set
var insValue = nl + pad + utils.getCaretPlaceholder() + append;
editor.replaceContent(insValue, caretPos);
return true;
}
}
return false;
}
};
});
},{"../assets/htmlMatcher":26,"../assets/preferences":28,"../assets/resources":31,"../utils/common":73,"../utils/editor":75}],12:[function(require,module,exports){
/**
* Module describes and performs Emmet actions. The actions themselves are
* defined in <i>actions</i> folder
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
// all registered actions
var actions = {};
// load all default actions
var actionModules = {
base64: require('./base64'),
editPoints: require('./editPoints'),
evaluateMath: require('./evaluateMath'),
expandAbbreviation: require('./expandAbbreviation'),
incrementDecrement: require('./incrementDecrement'),
lineBreaks: require('./lineBreaks'),
balance: require('./balance'),
mergeLines: require('./mergeLines'),
reflectCSSValue: require('./reflectCSSValue'),
removeTag: require('./removeTag'),
selectItem: require('./selectItem'),
selectLine: require('./selectLine'),
splitJoinTag: require('./splitJoinTag'),
toggleComment: require('./toggleComment'),
updateImageSize: require('./updateImageSize'),
wrapWithAbbreviation: require('./wrapWithAbbreviation'),
updateTag: require('./updateTag')
};
function addAction(name, fn, options) {
name = name.toLowerCase();
options = options || {};
if (typeof options === 'string') {
options = {label: options};
}
if (!options.label) {
options.label = humanizeActionName(name);
}
actions[name] = {
name: name,
fn: fn,
options: options
};
}
/**
* “Humanizes” action name, makes it more readable for people
* @param {String} name Action name (like 'expand_abbreviation')
* @return Humanized name (like 'Expand Abbreviation')
*/
function humanizeActionName(name) {
return utils.trim(name.charAt(0).toUpperCase()
+ name.substring(1).replace(/_[a-z]/g, function(str) {
return ' ' + str.charAt(1).toUpperCase();
}));
}
var bind = function(name, method) {
var m = actionModules[name];
return m[method].bind(m);
};
// XXX register default actions
addAction('encode_decode_data_url', bind('base64', 'encodeDecodeDataUrlAction'), 'Encode\\Decode data:URL image');
addAction('prev_edit_point', bind('editPoints', 'previousEditPointAction'), 'Previous Edit Point');
addAction('next_edit_point', bind('editPoints', 'nextEditPointAction'), 'Next Edit Point');
addAction('evaluate_math_expression', bind('evaluateMath', 'evaluateMathAction'), 'Numbers/Evaluate Math Expression');
addAction('expand_abbreviation_with_tab', bind('expandAbbreviation', 'expandAbbreviationWithTabAction'), {hidden: true});
addAction('expand_abbreviation', bind('expandAbbreviation', 'expandAbbreviationAction'), 'Expand Abbreviation');
addAction('insert_formatted_line_break_only', bind('lineBreaks', 'insertLineBreakOnlyAction'), {hidden: true});
addAction('insert_formatted_line_break', bind('lineBreaks', 'insertLineBreakAction'), {hidden: true});
addAction('balance_inward', bind('balance', 'balanceInwardAction'), 'Balance (inward)');
addAction('balance_outward', bind('balance', 'balanceOutwardAction'), 'Balance (outward)');
addAction('matching_pair', bind('balance', 'goToMatchingPairAction'), 'HTML/Go To Matching Tag Pair');
addAction('merge_lines', bind('mergeLines', 'mergeLinesAction'), 'Merge Lines');
addAction('reflect_css_value', bind('reflectCSSValue', 'reflectCSSValueAction'), 'CSS/Reflect Value');
addAction('remove_tag', bind('removeTag', 'removeTagAction'), 'HTML/Remove Tag');
addAction('select_next_item', bind('selectItem', 'selectNextItemAction'), 'Select Next Item');
addAction('select_previous_item', bind('selectItem', 'selectPreviousItemAction'), 'Select Previous Item');
addAction('split_join_tag', bind('splitJoinTag', 'splitJoinTagAction'), 'HTML/Split\\Join Tag Declaration');
addAction('toggle_comment', bind('toggleComment', 'toggleCommentAction'), 'Toggle Comment');
addAction('update_image_size', bind('updateImageSize', 'updateImageSizeAction'), 'Update Image Size');
addAction('wrap_with_abbreviation', bind('wrapWithAbbreviation', 'wrapWithAbbreviationAction'), 'Wrap With Abbreviation');
addAction('update_tag', bind('updateTag', 'updateTagAction'), 'HTML/Update Tag');
[1, -1, 10, -10, 0.1, -0.1].forEach(function(num) {
var prefix = num > 0 ? 'increment' : 'decrement';
var suffix = String(Math.abs(num)).replace('.', '').substring(0, 2);
var actionId = prefix + '_number_by_' + suffix;
var actionMethod = prefix + suffix + 'Action';
var actionLabel = 'Numbers/' + prefix.charAt(0).toUpperCase() + prefix.substring(1) + ' number by ' + Math.abs(num);
addAction(actionId, bind('incrementDecrement', actionMethod), actionLabel);
});
return {
/**
* Registers new action
* @param {String} name Action name
* @param {Function} fn Action function
* @param {Object} options Custom action options:<br>
* <b>label</b> : (<code>String</code>) – Human-readable action name.
* May contain '/' symbols as submenu separators<br>
* <b>hidden</b> : (<code>Boolean</code>) – Indicates whether action
* should be displayed in menu (<code>getMenu()</code> method)
*/
add: addAction,
/**
* Returns action object
* @param {String} name Action name
* @returns {Object}
*/
get: function(name) {
return actions[name.toLowerCase()];
},
/**
* Runs Emmet action. For list of available actions and their
* arguments see <i>actions</i> folder.
* @param {String} name Action name
* @param {Array} args Additional arguments. It may be array of arguments
* or inline arguments. The first argument should be <code>IEmmetEditor</code> instance
* @returns {Boolean} Status of performed operation, <code>true</code>
* means action was performed successfully.
* @example
* require('action/main').run('expand_abbreviation', editor);
* require('action/main').run('wrap_with_abbreviation', [editor, 'div']);
*/
run: function(name, args) {
if (!Array.isArray(args)) {
args = utils.toArray(arguments, 1);
}
var action = this.get(name);
if (!action) {
throw new Error('Action "' + name + '" is not defined');
}
return action.fn.apply(action, args);
},
/**
* Returns all registered actions as object
* @returns {Object}
*/
getAll: function() {
return actions;
},
/**
* Returns all registered actions as array
* @returns {Array}
*/
getList: function() {
var all = this.getAll();
return Object.keys(all).map(function(key) {
return all[key];
});
},
/**
* Returns actions list as structured menu. If action has <i>label</i>,
* it will be splitted by '/' symbol into submenus (for example:
* CSS/Reflect Value) and grouped with other items
* @param {Array} skipActions List of action identifiers that should be
* skipped from menu
* @returns {Array}
*/
getMenu: function(skipActions) {
var result = [];
skipActions = skipActions || [];
this.getList().forEach(function(action) {
if (action.options.hidden || ~skipActions.indexOf(action.name))
return;
var actionName = humanizeActionName(action.name);
var ctx = result;
if (action.options.label) {
var parts = action.options.label.split('/');
actionName = parts.pop();
// create submenus, if needed
var menuName, submenu;
while ((menuName = parts.shift())) {
submenu = utils.find(ctx, function(item) {
return item.type == 'submenu' && item.name == menuName;
});
if (!submenu) {
submenu = {
name: menuName,
type: 'submenu',
items: []
};
ctx.push(submenu);
}
ctx = submenu.items;
}
}
ctx.push({
type: 'action',
name: action.name,
label: actionName
});
});
return result;
},
/**
* Returns action name associated with menu item title
* @param {String} title
* @returns {String}
*/
getActionNameForMenuTitle: function(title, menu) {
return utils.find(menu || this.getMenu(), function(val) {
if (val.type == 'action') {
if (val.label == title || val.name == title) {
return val.name;
}
} else {
return this.getActionNameForMenuTitle(title, val.items);
}
}, this);
}
};
});
},{"../utils/common":73,"./balance":5,"./base64":6,"./editPoints":7,"./evaluateMath":8,"./expandAbbreviation":9,"./incrementDecrement":10,"./lineBreaks":11,"./mergeLines":13,"./reflectCSSValue":14,"./removeTag":15,"./selectItem":16,"./selectLine":17,"./splitJoinTag":18,"./toggleComment":19,"./updateImageSize":20,"./updateTag":21,"./wrapWithAbbreviation":22}],13:[function(require,module,exports){
/**
* Merges selected lines or lines between XHTML tag pairs
* @param {Function} require
* @param {Underscore} _
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var htmlMatcher = require('../assets/htmlMatcher');
var utils = require('../utils/common');
var editorUtils = require('../utils/editor');
var range = require('../assets/range');
return {
mergeLinesAction: function(editor) {
var info = editorUtils.outputInfo(editor);
var selection = range(editor.getSelectionRange());
if (!selection.length()) {
// find matching tag
var pair = htmlMatcher.find(info.content, editor.getCaretPos());
if (pair) {
selection = pair.outerRange;
}
}
if (selection.length()) {
// got range, merge lines
var text = selection.substring(info.content);
var lines = utils.splitByLines(text);
for (var i = 1; i < lines.length; i++) {
lines[i] = lines[i].replace(/^\s+/, '');
}
text = lines.join('').replace(/\s{2,}/, ' ');
var textLen = text.length;
text = utils.escapeText(text);
editor.replaceContent(text, selection.start, selection.end);
editor.createSelection(selection.start, selection.start + textLen);
return true;
}
return false;
}
};
});
},{"../assets/htmlMatcher":26,"../assets/range":30,"../utils/common":73,"../utils/editor":75}],14:[function(require,module,exports){
/**
* Reflect CSS value: takes rule's value under caret and pastes it for the same
* rules with vendor prefixes
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var handlerList = require('../assets/handlerList');
var prefs = require('../assets/preferences');
var cssResolver = require('../resolver/css');
var cssEditTree = require('../editTree/css');
var utils = require('../utils/common');
var actionUtils = require('../utils/action');
var editorUtils = require('../utils/editor');
var cssGradient = require('../resolver/cssGradient');
prefs.define('css.reflect.oldIEOpacity', false, 'Support IE6/7/8 opacity notation, e.g. <code>filter:alpha(opacity=...)</code>.\
Note that CSS3 and SVG also provides <code>filter</code> property so this option is disabled by default.')
/**
* @type HandlerList List of registered handlers
*/
var handlers = handlerList.create();
function doCSSReflection(editor) {
var outputInfo = editorUtils.outputInfo(editor);
var caretPos = editor.getCaretPos();
var cssRule = cssEditTree.parseFromPosition(outputInfo.content, caretPos);
if (!cssRule) return;
var property = cssRule.itemFromPosition(caretPos, true);
// no property under cursor, nothing to reflect
if (!property) return;
var oldRule = cssRule.source;
var offset = cssRule.options.offset;
var caretDelta = caretPos - offset - property.range().start;
handlers.exec(false, [property]);
if (oldRule !== cssRule.source) {
return {
data: cssRule.source,
start: offset,
end: offset + oldRule.length,
caret: offset + property.range().start + caretDelta
};
}
}
/**
* Returns regexp that should match reflected CSS property names
* @param {String} name Current CSS property name
* @return {RegExp}
*/
function getReflectedCSSName(name) {
name = cssEditTree.baseName(name);
var vendorPrefix = '^(?:\\-\\w+\\-)?', m;
if ((name == 'opacity' || name == 'filter') && prefs.get('css.reflect.oldIEOpacity')) {
return new RegExp(vendorPrefix + '(?:opacity|filter)$');
} else if ((m = name.match(/^border-radius-(top|bottom)(left|right)/))) {
// Mozilla-style border radius
return new RegExp(vendorPrefix + '(?:' + name + '|border-' + m[1] + '-' + m[2] + '-radius)$');
} else if ((m = name.match(/^border-(top|bottom)-(left|right)-radius/))) {
return new RegExp(vendorPrefix + '(?:' + name + '|border-radius-' + m[1] + m[2] + ')$');
}
return new RegExp(vendorPrefix + name + '$');
}
/**
* Reflects inner CSS properites in given value
* agains name‘s vendor prefix. In other words, it tries
* to modify `transform 0.2s linear` value for `-webkit-transition`
* property
* @param {String} name Reciever CSS property name
* @param {String} value New property value
* @return {String}
*/
function reflectValueParts(name, value) {
// detects and updates vendor-specific properties in value,
// e.g. -webkit-transition: -webkit-transform
var reVendor = /^\-(\w+)\-/;
var propPrefix = reVendor.test(name) ? RegExp.$1.toLowerCase() : '';
var parts = cssEditTree.findParts(value);
parts.reverse();
parts.forEach(function(part) {
var partValue = part.substring(value).replace(reVendor, '');
var prefixes = cssResolver.vendorPrefixes(partValue);
if (prefixes) {
// if prefixes are not null then given value can
// be resolved against Can I Use database and may or
// may not contain prefixed variant
if (propPrefix && ~prefixes.indexOf(propPrefix)) {
partValue = '-' + propPrefix + '-' + partValue;
}
value = utils.replaceSubstring(value, partValue, part);
}
});
return value;
}
/**
* Reflects value from <code>donor</code> into <code>receiver</code>
* @param {CSSProperty} donor Donor CSS property from which value should
* be reflected
* @param {CSSProperty} receiver Property that should receive reflected
* value from donor
*/
function reflectValue(donor, receiver) {
var value = getReflectedValue(donor.name(), donor.value(),
receiver.name(), receiver.value());
value = reflectValueParts(receiver.name(), value);
receiver.value(value);
}
/**
* Returns value that should be reflected for <code>refName</code> CSS property
* from <code>curName</code> property. This function is used for special cases,
* when the same result must be achieved with different properties for different
* browsers. For example: opаcity:0.5; → filter:alpha(opacity=50);<br><br>
*
* This function does value conversion between different CSS properties
*
* @param {String} curName Current CSS property name
* @param {String} curValue Current CSS property value
* @param {String} refName Receiver CSS property's name
* @param {String} refValue Receiver CSS property's value
* @return {String} New value for receiver property
*/
function getReflectedValue(curName, curValue, refName, refValue) {
curName = cssEditTree.baseName(curName);
refName = cssEditTree.baseName(refName);
if (curName == 'opacity' && refName == 'filter') {
return refValue.replace(/opacity=[^)]*/i, 'opacity=' + Math.floor(parseFloat(curValue) * 100));
} else if (curName == 'filter' && refName == 'opacity') {
var m = curValue.match(/opacity=([^)]*)/i);
return m ? utils.prettifyNumber(parseInt(m[1], 10) / 100) : refValue;
}
return curValue;
}
module = module || {};
module.exports = {
reflectCSSValueAction: function(editor) {
if (editor.getSyntax() != 'css') {
return false;
}
return actionUtils.compoundUpdate(editor, doCSSReflection(editor));
},
_defaultHandler: function(property) {
var reName = getReflectedCSSName(property.name());
property.parent.list().forEach(function(p) {
if (reName.test(p.name())) {
reflectValue(property, p);
}
});
},
/**
* Adds custom reflect handler. The passed function will receive matched
* CSS property (as <code>CSSEditElement</code> object) and should
* return <code>true</code> if it was performed successfully (handled
* reflection), <code>false</code> otherwise.
* @param {Function} fn
* @param {Object} options
*/
addHandler: function(fn, options) {
handlers.add(fn, options);
},
/**
* Removes registered handler
* @returns
*/
removeHandler: function(fn) {
handlers.remove(fn);
}
};
// XXX add default handlers
handlers.add(module.exports._defaultHandler.bind(module.exports), {order: -1});
handlers.add(cssGradient.reflectValueHandler.bind(cssGradient));
return module.exports;
});
},{"../assets/handlerList":25,"../assets/preferences":28,"../editTree/css":37,"../resolver/css":64,"../resolver/cssGradient":65,"../utils/action":70,"../utils/common":73,"../utils/editor":75}],15:[function(require,module,exports){
/**
* Gracefully removes tag under cursor
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
var editorUtils = require('../utils/editor');
var htmlMatcher = require('../assets/htmlMatcher');
return {
removeTagAction: function(editor) {
var info = editorUtils.outputInfo(editor);
// search for tag
var tag = htmlMatcher.tag(info.content, editor.getCaretPos());
if (tag) {
if (!tag.close) {
// simply remove unary tag
editor.replaceContent(utils.getCaretPlaceholder(), tag.range.start, tag.range.end);
} else {
// remove tag and its newlines
/** @type Range */
var tagContentRange = utils.narrowToNonSpace(info.content, tag.innerRange);
/** @type Range */
var startLineBounds = utils.findNewlineBounds(info.content, tagContentRange.start);
var startLinePad = utils.getLinePadding(startLineBounds.substring(info.content));
var tagContent = tagContentRange.substring(info.content);
tagContent = utils.unindentString(tagContent, startLinePad);
editor.replaceContent(utils.getCaretPlaceholder() + utils.escapeText(tagContent), tag.outerRange.start, tag.outerRange.end);
}
return true;
}
return false;
}
};
});
},{"../assets/htmlMatcher":26,"../utils/common":73,"../utils/editor":75}],16:[function(require,module,exports){
/**
* Actions that use stream parsers and tokenizers for traversing:
* -- Search for next/previous items in HTML
* -- Search for next/previous items in CSS
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var range = require('../assets/range');
var utils = require('../utils/common');
var editorUtils = require('../utils/editor');
var actionUtils = require('../utils/action');
var stringStream = require('../assets/stringStream');
var xmlParser = require('../parser/xml');
var cssEditTree = require('../editTree/css');
var cssSections = require('../utils/cssSections');
var startTag = /^<([\w\:\-]+)((?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
/**
* Generic function for searching for items to select
* @param {IEmmetEditor} editor
* @param {Boolean} isBackward Search backward (search forward otherwise)
* @param {Function} extractFn Function that extracts item content
* @param {Function} rangeFn Function that search for next token range
*/
function findItem(editor, isBackward, extractFn, rangeFn) {
var content = editorUtils.outputInfo(editor).content;
var contentLength = content.length;
var itemRange, rng;
/** @type Range */
var prevRange = range(-1, 0);
/** @type Range */
var sel = range(editor.getSelectionRange());
var searchPos = sel.start, loop = 100000; // endless loop protection
while (searchPos >= 0 && searchPos < contentLength && --loop > 0) {
if ( (itemRange = extractFn(content, searchPos, isBackward)) ) {
if (prevRange.equal(itemRange)) {
break;
}
prevRange = itemRange.clone();
rng = rangeFn(itemRange.substring(content), itemRange.start, sel.clone());
if (rng) {
editor.createSelection(rng.start, rng.end);
return true;
} else {
searchPos = isBackward ? itemRange.start : itemRange.end - 1;
}
}
searchPos += isBackward ? -1 : 1;
}
return false;
}
// XXX HTML section
/**
* Find next HTML item
* @param {IEmmetEditor} editor
*/
function findNextHTMLItem(editor) {
var isFirst = true;
return findItem(editor, false, function(content, searchPos){
if (isFirst) {
isFirst = false;
return findOpeningTagFromPosition(content, searchPos);
} else {
return getOpeningTagFromPosition(content, searchPos);
}
}, function(tag, offset, selRange) {
return getRangeForHTMLItem(tag, offset, selRange, false);
});
}
/**
* Find previous HTML item
* @param {IEmmetEditor} editor
*/
function findPrevHTMLItem(editor) {
return findItem(editor, true, getOpeningTagFromPosition, function (tag, offset, selRange) {
return getRangeForHTMLItem(tag, offset, selRange, true);
});
}
/**
* Creates possible selection ranges for HTML tag
* @param {String} source Original HTML source for tokens
* @param {Array} tokens List of HTML tokens
* @returns {Array}
*/
function makePossibleRangesHTML(source, tokens, offset) {
offset = offset || 0;
var result = [];
var attrStart = -1, attrName = '', attrValue = '', attrValueRange, tagName;
tokens.forEach(function(tok) {
switch (tok.type) {
case 'tag':
tagName = source.substring(tok.start, tok.end);
if (/^<[\w\:\-]/.test(tagName)) {
// add tag name
result.push(range({
start: tok.start + 1,
end: tok.end
}));
}
break;
case 'attribute':
attrStart = tok.start;
attrName = source.substring(tok.start, tok.end);
break;
case 'string':
// attribute value
// push full attribute first
result.push(range(attrStart, tok.end - attrStart));
attrValueRange = range(tok);
attrValue = attrValueRange.substring(source);
// is this a quoted attribute?
if (isQuote(attrValue.charAt(0)))
attrValueRange.start++;
if (isQuote(attrValue.charAt(attrValue.length - 1)))
attrValueRange.end--;
result.push(attrValueRange);
if (attrName == 'class') {
result = result.concat(classNameRanges(attrValueRange.substring(source), attrValueRange.start));
}
break;
}
});
// offset ranges
result = result.filter(function(item) {
if (item.length()) {
item.shift(offset);
return true;
}
});
// remove duplicates
return utils.unique(result, function(item) {
return item.toString();
});
}
/**
* Returns ranges of class names in "class" attribute value
* @param {String} className
* @returns {Array}
*/
function classNameRanges(className, offset) {
offset = offset || 0;
var result = [];
/** @type StringStream */
var stream = stringStream.create(className);
// skip whitespace
stream.eatSpace();
stream.start = stream.pos;
var ch;
while ((ch = stream.next())) {
if (/[\s\u00a0]/.test(ch)) {
result.push(range(stream.start + offset, stream.pos - stream.start - 1));
stream.eatSpace();
stream.start = stream.pos;
}
}
result.push(range(stream.start + offset, stream.pos - stream.start));
return result;
}
/**
* Returns best HTML tag range match for current selection
* @param {String} tag Tag declaration
* @param {Number} offset Tag's position index inside content
* @param {Range} selRange Selection range
* @return {Range} Returns range if next item was found, <code>null</code> otherwise
*/
function getRangeForHTMLItem(tag, offset, selRange, isBackward) {
var ranges = makePossibleRangesHTML(tag, xmlParser.parse(tag), offset);
if (isBackward)
ranges.reverse();
// try to find selected range
var curRange = utils.find(ranges, function(r) {
return r.equal(selRange);
});
if (curRange) {
var ix = ranges.indexOf(curRange);
if (ix < ranges.length - 1)
return ranges[ix + 1];
return null;
}
// no selected range, find nearest one
if (isBackward)
// search backward
return utils.find(ranges, function(r) {
return r.start < selRange.start;
});
// search forward
// to deal with overlapping ranges (like full attribute definition
// and attribute value) let's find range under caret first
if (!curRange) {
var matchedRanges = ranges.filter(function(r) {
return r.inside(selRange.end);
});
if (matchedRanges.length > 1)
return matchedRanges[1];
}
return utils.find(ranges, function(r) {
return r.end > selRange.end;
});
}
/**
* Search for opening tag in content, starting at specified position
* @param {String} html Where to search tag
* @param {Number} pos Character index where to start searching
* @return {Range} Returns range if valid opening tag was found,
* <code>null</code> otherwise
*/
function findOpeningTagFromPosition(html, pos) {
var tag;
while (pos >= 0) {
if ((tag = getOpeningTagFromPosition(html, pos)))
return tag;
pos--;
}
return null;
}
/**
* @param {String} html Where to search tag
* @param {Number} pos Character index where to start searching
* @return {Range} Returns range if valid opening tag was found,
* <code>null</code> otherwise
*/
function getOpeningTagFromPosition(html, pos) {
var m;
if (html.charAt(pos) == '<' && (m = html.substring(pos, html.length).match(startTag))) {
return range(pos, m[0]);
}
}
function isQuote(ch) {
return ch == '"' || ch == "'";
}
/**
* Returns all ranges inside given rule, available for selection
* @param {CSSEditContainer} rule
* @return {Array}
*/
function findInnerRanges(rule) {
// rule selector
var ranges = [rule.nameRange(true)];
// find nested sections, keep selectors only
var nestedSections = cssSections.nestedSectionsInRule(rule);
nestedSections.forEach(function(section) {
ranges.push(range.create2(section.start, section._selectorEnd));
});
// add full property ranges and values
rule.list().forEach(function(property) {
ranges = ranges.concat(makePossibleRangesCSS(property));
});
ranges = range.sort(ranges);
// optimize result: remove empty ranges and duplicates
ranges = ranges.filter(function(item) {
return !!item.length();
});
return utils.unique(ranges, function(item) {
return item.toString();
});
}
/**
* Makes all possible selection ranges for specified CSS property
* @param {CSSProperty} property
* @returns {Array}
*/
function makePossibleRangesCSS(property) {
// find all possible ranges, sorted by position and size
var valueRange = property.valueRange(true);
var result = [property.range(true), valueRange];
// locate parts of complex values.
// some examples:
// – 1px solid red: 3 parts
// – arial, sans-serif: enumeration, 2 parts
// – url(image.png): function value part
var value = property.value();
property.valueParts().forEach(function(r) {
// add absolute range
var clone = r.clone();
result.push(clone.shift(valueRange.start));
/** @type StringStream */
var stream = stringStream.create(r.substring(value));
if (stream.match(/^[\w\-]+\(/, true)) {
// we have a function, find values in it.
// but first add function contents
stream.start = stream.pos;
stream.backUp(1);
stream.skipToPair('(', ')');
stream.backUp(1);
var fnBody = stream.current();
result.push(range(clone.start + stream.start, fnBody));
// find parts
cssEditTree.findParts(fnBody).forEach(function(part) {
result.push(range(clone.start + stream.start + part.start, part.substring(fnBody)));
});
}
});
return result;
}
/**
* Tries to find matched CSS property and nearest range for selection
* @param {CSSRule} rule
* @param {Range} selRange
* @param {Boolean} isBackward
* @returns {Range}
*/
function matchedRangeForCSSProperty(rule, selRange, isBackward) {
var ranges = findInnerRanges(rule);
if (isBackward) {
ranges.reverse();
}
// return next to selected range, if possible
var r = utils.find(ranges, function(item) {
return item.equal(selRange);
});
if (r) {
return ranges[ranges.indexOf(r) + 1];
}
// find matched and (possibly) overlapping ranges
var nested = ranges.filter(function(item) {
return item.inside(selRange.end);
});
if (nested.length) {
return nested.sort(function(a, b) {
return a.length() - b.length();
})[0];
}
// return range next to caret
var test =
r = utils.find(ranges, isBackward
? function(item) {return item.end < selRange.start;}
: function(item) {return item.end > selRange.start;}
);
if (!r) {
// can’t find anything, just pick first one
r = ranges[0];
}
return r;
}
function findNextCSSItem(editor) {
return findItem(editor, false, cssSections.locateRule.bind(cssSections), getRangeForNextItemInCSS);
}
function findPrevCSSItem(editor) {
return findItem(editor, true, cssSections.locateRule.bind(cssSections), getRangeForPrevItemInCSS);
}
/**
* Returns range for item to be selected in CSS after current caret
* (selection) position
* @param {String} rule CSS rule declaration
* @param {Number} offset Rule's position index inside content
* @param {Range} selRange Selection range
* @return {Range} Returns range if next item was found, <code>null</code> otherwise
*/
function getRangeForNextItemInCSS(rule, offset, selRange) {
var tree = cssEditTree.parse(rule, {
offset: offset
});
return matchedRangeForCSSProperty(tree, selRange, false);
}
/**
* Returns range for item to be selected in CSS before current caret
* (selection) position
* @param {String} rule CSS rule declaration
* @param {Number} offset Rule's position index inside content
* @param {Range} selRange Selection range
* @return {Range} Returns range if previous item was found, <code>null</code> otherwise
*/
function getRangeForPrevItemInCSS(rule, offset, selRange) {
var tree = cssEditTree.parse(rule, {
offset: offset
});
return matchedRangeForCSSProperty(tree, selRange, true);
}
return {
selectNextItemAction: function(editor) {
if (actionUtils.isSupportedCSS(editor.getSyntax())) {
return findNextCSSItem(editor);
} else {
return findNextHTMLItem(editor);
}
},
selectPreviousItemAction: function(editor) {
if (actionUtils.isSupportedCSS(editor.getSyntax())) {
return findPrevCSSItem(editor);
} else {
return findPrevHTMLItem(editor);
}
}
};
});
},{"../assets/range":30,"../assets/stringStream":32,"../editTree/css":37,"../parser/xml":62,"../utils/action":70,"../utils/common":73,"../utils/cssSections":74,"../utils/editor":75}],17:[function(require,module,exports){
/**
* Select current line (for simple editors like browser's <textarea>)
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
return {
selectLineAction: function(editor) {
var range = editor.getCurrentLineRange();
editor.createSelection(range.start, range.end);
return true;
}
};
});
},{}],18:[function(require,module,exports){
/**
* Splits or joins tag, e.g. transforms it into a short notation and vice versa:<br>
* <div></div> → <div /> : join<br>
* <div /> → <div></div> : split
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
var resources = require('../assets/resources');
var matcher = require('../assets/htmlMatcher');
var editorUtils = require('../utils/editor');
var profile = require('../assets/profile');
/**
* @param {IEmmetEditor} editor
* @param {Object} profile
* @param {Object} tag
*/
function joinTag(editor, profile, tag) {
// empty closing slash is a nonsense for this action
var slash = profile.selfClosing() || ' /';
var content = tag.open.range.substring(tag.source).replace(/\s*>$/, slash + '>');
var caretPos = editor.getCaretPos();
// update caret position
if (content.length + tag.outerRange.start < caretPos) {
caretPos = content.length + tag.outerRange.start;
}
content = utils.escapeText(content);
editor.replaceContent(content, tag.outerRange.start, tag.outerRange.end);
editor.setCaretPos(caretPos);
return true;
}
function splitTag(editor, profile, tag) {
var caretPos = editor.getCaretPos();
// define tag content depending on profile
var tagContent = (profile.tag_nl === true) ? '\n\t\n' : '';
var content = tag.outerContent().replace(/\s*\/>$/, '>');
caretPos = tag.outerRange.start + content.length;
content += tagContent + '</' + tag.open.name + '>';
content = utils.escapeText(content);
editor.replaceContent(content, tag.outerRange.start, tag.outerRange.end);
editor.setCaretPos(caretPos);
return true;
}
return {
splitJoinTagAction: function(editor, profileName) {
var info = editorUtils.outputInfo(editor, null, profileName);
var curProfile = profile.get(info.profile);
// find tag at current position
var tag = matcher.tag(info.content, editor.getCaretPos());
if (tag) {
return tag.close
? joinTag(editor, curProfile, tag)
: splitTag(editor, curProfile, tag);
}
return false;
}
};
});
},{"../assets/htmlMatcher":26,"../assets/profile":29,"../assets/resources":31,"../utils/common":73,"../utils/editor":75}],19:[function(require,module,exports){
/**
* Toggles HTML and CSS comments depending on current caret context. Unlike
* the same action in most editors, this action toggles comment on currently
* matched item—HTML tag or CSS selector—when nothing is selected.
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var prefs = require('../assets/preferences');
var range = require('../assets/range');
var utils = require('../utils/common');
var actionUtils = require('../utils/action');
var editorUtils = require('../utils/editor');
var htmlMatcher = require('../assets/htmlMatcher');
var cssEditTree = require('../editTree/css');
/**
* Toggle HTML comment on current selection or tag
* @param {IEmmetEditor} editor
* @return {Boolean} Returns <code>true</code> if comment was toggled
*/
function toggleHTMLComment(editor) {
/** @type Range */
var r = range(editor.getSelectionRange());
var info = editorUtils.outputInfo(editor);
if (!r.length()) {
// no selection, find matching tag
var tag = htmlMatcher.tag(info.content, editor.getCaretPos());
if (tag) { // found pair
r = tag.outerRange;
}
}
return genericCommentToggle(editor, '<!--', '-->', r);
}
/**
* Simple CSS commenting
* @param {IEmmetEditor} editor
* @return {Boolean} Returns <code>true</code> if comment was toggled
*/
function toggleCSSComment(editor) {
/** @type Range */
var rng = range(editor.getSelectionRange());
var info = editorUtils.outputInfo(editor);
if (!rng.length()) {
// no selection, try to get current rule
/** @type CSSRule */
var rule = cssEditTree.parseFromPosition(info.content, editor.getCaretPos());
if (rule) {
var property = cssItemFromPosition(rule, editor.getCaretPos());
rng = property
? property.range(true)
: range(rule.nameRange(true).start, rule.source);
}
}
if (!rng.length()) {
// still no selection, get current line
rng = range(editor.getCurrentLineRange());
utils.narrowToNonSpace(info.content, rng);
}
return genericCommentToggle(editor, '/*', '*/', rng);
}
/**
* Returns CSS property from <code>rule</code> that matches passed position
* @param {EditContainer} rule
* @param {Number} absPos
* @returns {EditElement}
*/
function cssItemFromPosition(rule, absPos) {
// do not use default EditContainer.itemFromPosition() here, because
// we need to make a few assumptions to make CSS commenting more reliable
var relPos = absPos - (rule.options.offset || 0);
var reSafeChar = /^[\s\n\r]/;
return utils.find(rule.list(), function(item) {
if (item.range().end === relPos) {
// at the end of property, but outside of it
// if there’s a space character at current position,
// use current property
return reSafeChar.test(rule.source.charAt(relPos));
}
return item.range().inside(relPos);
});
}
/**
* Search for nearest comment in <code>str</code>, starting from index <code>from</code>
* @param {String} text Where to search
* @param {Number} from Search start index
* @param {String} start_token Comment start string
* @param {String} end_token Comment end string
* @return {Range} Returns null if comment wasn't found
*/
function searchComment(text, from, startToken, endToken) {
var commentStart = -1;
var commentEnd = -1;
var hasMatch = function(str, start) {
return text.substr(start, str.length) == str;
};
// search for comment start
while (from--) {
if (hasMatch(startToken, from)) {
commentStart = from;
break;
}
}
if (commentStart != -1) {
// search for comment end
from = commentStart;
var contentLen = text.length;
while (contentLen >= from++) {
if (hasMatch(endToken, from)) {
commentEnd = from + endToken.length;
break;
}
}
}
return (commentStart != -1 && commentEnd != -1)
? range(commentStart, commentEnd - commentStart)
: null;
}
/**
* Generic comment toggling routine
* @param {IEmmetEditor} editor
* @param {String} commentStart Comment start token
* @param {String} commentEnd Comment end token
* @param {Range} range Selection range
* @return {Boolean}
*/
function genericCommentToggle(editor, commentStart, commentEnd, range) {
var content = editorUtils.outputInfo(editor).content;
var caretPos = editor.getCaretPos();
var newContent = null;
/**
* Remove comment markers from string
* @param {Sting} str
* @return {String}
*/
function removeComment(str) {
return str
.replace(new RegExp('^' + utils.escapeForRegexp(commentStart) + '\\s*'), function(str){
caretPos -= str.length;
return '';
}).replace(new RegExp('\\s*' + utils.escapeForRegexp(commentEnd) + '$'), '');
}
// first, we need to make sure that this substring is not inside
// comment
var commentRange = searchComment(content, caretPos, commentStart, commentEnd);
if (commentRange && commentRange.overlap(range)) {
// we're inside comment, remove it
range = commentRange;
newContent = removeComment(range.substring(content));
} else {
// should add comment
// make sure that there's no comment inside selection
newContent = commentStart + ' ' +
range.substring(content)
.replace(new RegExp(utils.escapeForRegexp(commentStart) + '\\s*|\\s*' + utils.escapeForRegexp(commentEnd), 'g'), '') +
' ' + commentEnd;
// adjust caret position
caretPos += commentStart.length + 1;
}
// replace editor content
if (newContent !== null) {
newContent = utils.escapeText(newContent);
editor.setCaretPos(range.start);
editor.replaceContent(editorUtils.unindent(editor, newContent), range.start, range.end);
editor.setCaretPos(caretPos);
return true;
}
return false;
}
return {
/**
* Toggle comment on current editor's selection or HTML tag/CSS rule
* @param {IEmmetEditor} editor
*/
toggleCommentAction: function(editor) {
var info = editorUtils.outputInfo(editor);
if (actionUtils.isSupportedCSS(info.syntax)) {
// in case our editor is good enough and can recognize syntax from
// current token, we have to make sure that cursor is not inside
// 'style' attribute of html element
var caretPos = editor.getCaretPos();
var tag = htmlMatcher.tag(info.content, caretPos);
if (tag && tag.open.range.inside(caretPos)) {
info.syntax = 'html';
}
}
var cssSyntaxes = prefs.getArray('css.syntaxes');
if (~cssSyntaxes.indexOf(info.syntax)) {
return toggleCSSComment(editor);
}
return toggleHTMLComment(editor);
}
};
});
},{"../assets/htmlMatcher":26,"../assets/preferences":28,"../assets/range":30,"../editTree/css":37,"../utils/action":70,"../utils/common":73,"../utils/editor":75}],20:[function(require,module,exports){
/**
* Automatically updates image size attributes in HTML's <img> element or
* CSS rule
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
var editorUtils = require('../utils/editor');
var actionUtils = require('../utils/action');
var xmlEditTree = require('../editTree/xml');
var cssEditTree = require('../editTree/css');
var base64 = require('../utils/base64');
var file = require('../plugin/file');
/**
* Updates image size of <img src=""> tag
* @param {IEmmetEditor} editor
*/
function updateImageSizeHTML(editor) {
var offset = editor.getCaretPos();
// find tag from current caret position
var info = editorUtils.outputInfo(editor);
var xmlElem = xmlEditTree.parseFromPosition(info.content, offset, true);
if (xmlElem && (xmlElem.name() || '').toLowerCase() == 'img') {
getImageSizeForSource(editor, xmlElem.value('src'), function(size) {
if (size) {
var compoundData = xmlElem.range(true);
xmlElem.value('width', size.width);
xmlElem.value('height', size.height, xmlElem.indexOf('width') + 1);
actionUtils.compoundUpdate(editor, utils.extend(compoundData, {
data: xmlElem.toString(),
caret: offset
}));
}
});
}
}
/**
* Updates image size of CSS property
* @param {IEmmetEditor} editor
*/
function updateImageSizeCSS(editor) {
var offset = editor.getCaretPos();
// find tag from current caret position
var info = editorUtils.outputInfo(editor);
var cssRule = cssEditTree.parseFromPosition(info.content, offset, true);
if (cssRule) {
// check if there is property with image under caret
var prop = cssRule.itemFromPosition(offset, true), m;
if (prop && (m = /url\((["']?)(.+?)\1\)/i.exec(prop.value() || ''))) {
getImageSizeForSource(editor, m[2], function(size) {
if (size) {
var compoundData = cssRule.range(true);
cssRule.value('width', size.width + 'px');
cssRule.value('height', size.height + 'px', cssRule.indexOf('width') + 1);
actionUtils.compoundUpdate(editor, utils.extend(compoundData, {
data: cssRule.toString(),
caret: offset
}));
}
});
}
}
}
/**
* Returns image dimensions for source
* @param {IEmmetEditor} editor
* @param {String} src Image source (path or data:url)
*/
function getImageSizeForSource(editor, src, callback) {
var fileContent;
if (src) {
// check if it is data:url
if (/^data:/.test(src)) {
fileContent = base64.decode( src.replace(/^data\:.+?;.+?,/, '') );
return callback(actionUtils.getImageSize(fileContent));
}
var absPath = file.locateFile(editor.getFilePath(), src);
if (absPath === null) {
throw "Can't find " + src + ' file';
}
file.read(absPath, function(err, content) {
if (err) {
throw 'Unable to read ' + absPath + ': ' + err;
}
content = String(content);
callback(actionUtils.getImageSize(content));
});
}
}
return {
updateImageSizeAction: function(editor) {
// this action will definitely won’t work in SASS dialect,
// but may work in SCSS or LESS
if (actionUtils.isSupportedCSS(editor.getSyntax())) {
updateImageSizeCSS(editor);
} else {
updateImageSizeHTML(editor);
}
return true;
}
};
});
},{"../editTree/css":37,"../editTree/xml":38,"../plugin/file":63,"../utils/action":70,"../utils/base64":71,"../utils/common":73,"../utils/editor":75}],21:[function(require,module,exports){
/**
* Update Tag action: allows users to update existing HTML tags and add/remove
* attributes or even tag name
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var xmlEditTree = require('../editTree/xml');
var editorUtils = require('../utils/editor');
var actionUtils = require('../utils/action');
var utils = require('../utils/common');
var parser = require('../parser/abbreviation');
function updateAttributes(tag, abbrNode, ix) {
var classNames = (abbrNode.attribute('class') || '').split(/\s+/g);
if (ix) {
classNames.push('+' + abbrNode.name());
}
var r = function(str) {
return utils.replaceCounter(str, abbrNode.counter);
};
// update class
classNames.forEach(function(className) {
if (!className) {
return;
}
className = r(className);
var ch = className.charAt(0);
if (ch == '+') {
tag.addClass(className.substr(1));
} else if (ch == '-') {
tag.removeClass(className.substr(1));
} else {
tag.value('class', className);
}
});
// update attributes
abbrNode.attributeList().forEach(function(attr) {
if (attr.name.toLowerCase() == 'class') {
return;
}
var ch = attr.name.charAt(0);
if (ch == '+') {
var attrName = attr.name.substr(1);
var tagAttr = tag.get(attrName);
if (tagAttr) {
tagAttr.value(tagAttr.value() + r(attr.value));
} else {
tag.value(attrName, r(attr.value));
}
} else if (ch == '-') {
tag.remove(attr.name.substr(1));
} else {
tag.value(attr.name, r(attr.value));
}
});
}
return {
/**
* Matches HTML tag under caret and updates its definition
* according to given abbreviation
* @param {IEmmetEditor} Editor instance
* @param {String} abbr Abbreviation to update with
*/
updateTagAction: function(editor, abbr) {
abbr = abbr || editor.prompt("Enter abbreviation");
if (!abbr) {
return false;
}
var content = editor.getContent();
var ctx = actionUtils.captureContext(editor);
var tag = this.getUpdatedTag(abbr, ctx, content);
if (!tag) {
// nothing to update
return false;
}
// check if tag name was updated
if (tag.name() != ctx.name && ctx.match.close) {
editor.replaceContent('</' + tag.name() + '>', ctx.match.close.range.start, ctx.match.close.range.end, true);
}
editor.replaceContent(tag.source, ctx.match.open.range.start, ctx.match.open.range.end, true);
return true;
},
/**
* Returns XMLEditContainer node with updated tag structure
* of existing tag context.
* This data can be used to modify existing tag
* @param {String} abbr Abbreviation
* @param {Object} ctx Tag to be updated (captured with `htmlMatcher`)
* @param {String} content Original editor content
* @return {XMLEditContainer}
*/
getUpdatedTag: function(abbr, ctx, content, options) {
if (!ctx) {
// nothing to update
return null;
}
var tree = parser.parse(abbr, options || {});
// for this action some characters in abbreviation has special
// meaning. For example, `.-c2` means “remove `c2` class from
// element” and `.+c3` means “append class `c3` to exising one.
//
// But `.+c3` abbreviation will actually produce two elements:
// <div class=""> and <c3>. Thus, we have to walk on each element
// of parsed tree and use their definitions to update current element
var tag = xmlEditTree.parse(ctx.match.open.range.substring(content), {
offset: ctx.match.outerRange.start
});
tree.children.forEach(function(node, i) {
updateAttributes(tag, node, i);
});
// if tag name was resolved by implicit tag name resolver,
// then user omitted it in abbreviation and wants to keep
// original tag name
var el = tree.children[0];
if (!el.data('nameResolved')) {
tag.name(el.name());
}
return tag;
}
};
});
},{"../editTree/xml":38,"../parser/abbreviation":55,"../utils/action":70,"../utils/common":73,"../utils/editor":75}],22:[function(require,module,exports){
/**
* Action that wraps content with abbreviation. For convenience, action is
* defined as reusable module
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var range = require('../assets/range');
var htmlMatcher = require('../assets/htmlMatcher');
var utils = require('../utils/common');
var editorUtils = require('../utils/editor');
var actionUtils = require('../utils/action');
var parser = require('../parser/abbreviation');
return {
/**
* Wraps content with abbreviation
* @param {IEmmetEditor} Editor instance
* @param {String} abbr Abbreviation to wrap with
* @param {String} syntax Syntax type (html, css, etc.)
* @param {String} profile Output profile name (html, xml, xhtml)
*/
wrapWithAbbreviationAction: function(editor, abbr, syntax, profile) {
var info = editorUtils.outputInfo(editor, syntax, profile);
abbr = abbr || editor.prompt("Enter abbreviation");
if (!abbr) {
return null;
}
abbr = String(abbr);
var r = range(editor.getSelectionRange());
if (!r.length()) {
// no selection, find tag pair
var match = htmlMatcher.tag(info.content, r.start);
if (!match) { // nothing to wrap
return false;
}
r = utils.narrowToNonSpace(info.content, match.range);
}
var newContent = utils.escapeText(r.substring(info.content));
var result = parser.expand(abbr, {
pastedContent: editorUtils.unindent(editor, newContent),
syntax: info.syntax,
profile: info.profile,
contextNode: actionUtils.captureContext(editor)
});
if (result) {
editor.replaceContent(result, r.start, r.end);
return true;
}
return false;
}
};
});
},{"../assets/htmlMatcher":26,"../assets/range":30,"../parser/abbreviation":55,"../utils/action":70,"../utils/common":73,"../utils/editor":75}],23:[function(require,module,exports){
/**
* Parsed resources (snippets, abbreviations, variables, etc.) for Emmet.
* Contains convenient method to get access for snippets with respect of
* inheritance. Also provides ability to store data in different vocabularies
* ('system' and 'user') for fast and safe resource update
* @author Sergey Chikuyonok (serge.che@gmail.com)
* @link http://chikuyonok.ru
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var prefs = require('./preferences');
var utils = require('../utils/common');
prefs.define('caniuse.enabled', true, 'Enable support of Can I Use database. When enabled,\
CSS abbreviation resolver will look at Can I Use database first before detecting\
CSS properties that should be resolved');
prefs.define('caniuse.vendors', 'all', 'A comma-separated list vendor identifiers\
(as described in Can I Use database) that should be supported\
when resolving vendor-prefixed properties. Set value to <code>all</code>\
to support all available properties');
prefs.define('caniuse.era', 'e-2', 'Browser era, as defined in Can I Use database.\
Examples: <code>e0</code> (current version), <code>e1</code> (near future)\
<code>e-2</code> (2 versions back) and so on.');
var cssSections = {
'border-image': ['border-image'],
'css-boxshadow': ['box-shadow'],
'css3-boxsizing': ['box-sizing'],
'multicolumn': ['column-width', 'column-count', 'columns', 'column-gap', 'column-rule-color', 'column-rule-style', 'column-rule-width', 'column-rule', 'column-span', 'column-fill'],
'border-radius': ['border-radius', 'border-top-left-radius', 'border-top-right-radius', 'border-bottom-right-radius', 'border-bottom-left-radius'],
'transforms2d': ['transform'],
'css-hyphens': ['hyphens'],
'css-transitions': ['transition', 'transition-property', 'transition-duration', 'transition-timing-function', 'transition-delay'],
'font-feature': ['font-feature-settings'],
'css-animation': ['animation', 'animation-name', 'animation-duration', 'animation-timing-function', 'animation-iteration-count', 'animation-direction', 'animation-play-state', 'animation-delay', 'animation-fill-mode', '@keyframes'],
'css-gradients': ['linear-gradient'],
'css-masks': ['mask-image', 'mask-source-type', 'mask-repeat', 'mask-position', 'mask-clip', 'mask-origin', 'mask-size', 'mask', 'mask-type', 'mask-box-image-source', 'mask-box-image-slice', 'mask-box-image-width', 'mask-box-image-outset', 'mask-box-image-repeat', 'mask-box-image', 'clip-path', 'clip-rule'],
'css-featurequeries': ['@supports'],
'flexbox': ['flex', 'inline-flex', 'flex-direction', 'flex-wrap', 'flex-flow', 'order', 'flex'],
'calc': ['calc'],
'object-fit': ['object-fit', 'object-position'],
'css-grid': ['grid', 'inline-grid', 'grid-template-rows', 'grid-template-columns', 'grid-template-areas', 'grid-template', 'grid-auto-rows', 'grid-auto-columns', ' grid-auto-flow', 'grid-auto-position', 'grid', ' grid-row-start', 'grid-column-start', 'grid-row-end', 'grid-column-end', 'grid-column', 'grid-row', 'grid-area', 'justify-self', 'justify-items', 'align-self', 'align-items'],
'css-repeating-gradients': ['repeating-linear-gradient'],
'css-filters': ['filter'],
'user-select-none': ['user-select'],
'intrinsic-width': ['min-content', 'max-content', 'fit-content', 'fill-available'],
'css3-tabsize': ['tab-size']
};
/** @type {Object} The Can I Use database for CSS */
var cssDB = null;
/** @type {Object} A list of available vendors (browsers) and their prefixes */
var vendorsDB = null;
var erasDB = null;
function intersection(arr1, arr2) {
var result = [];
var smaller = arr1, larger = arr2;
if (smaller.length > larger.length) {
smaller = arr2;
larger = arr1;
}
larger.forEach(function(item) {
if (~smaller.indexOf(item)) {
result.push(item);
}
});
return result;
}
/**
* Parses raw Can I Use database for better lookups
* @param {String} data Raw database
* @param {Boolean} optimized Pass `true` if given `data` is already optimized
* @return {Object}
*/
function parseDB(data, optimized) {
if (typeof data == 'string') {
data = JSON.parse(data);
}
if (!optimized) {
data = optimize(data);
}
vendorsDB = data.vendors;
cssDB = data.css;
erasDB = data.era;
}
/**
* Extract required data only from CIU database
* @param {Object} data Raw Can I Use database
* @return {Object} Optimized database
*/
function optimize(data) {
if (typeof data == 'string') {
data = JSON.parse(data);
}
return {
vendors: parseVendors(data),
css: parseCSS(data),
era: parseEra(data)
};
}
/**
* Parses vendor data
* @param {Object} data
* @return {Object}
*/
function parseVendors(data) {
var out = {};
Object.keys(data.agents).forEach(function(name) {
var agent = data.agents[name];
out[name] = {
prefix: agent.prefix,
versions: agent.versions
};
});
return out;
}
/**
* Parses CSS data from Can I Use raw database
* @param {Object} data
* @return {Object}
*/
function parseCSS(data) {
var out = {};
var cssCategories = data.cats.CSS;
Object.keys(data.data).forEach(function(name) {
var section = data.data[name];
if (name in cssSections) {
cssSections[name].forEach(function(kw) {
out[kw] = section.stats;
});
}
});
return out;
}
/**
* Parses era data from Can I Use raw database
* @param {Object} data
* @return {Array}
*/
function parseEra(data) {
// some runtimes (like Mozilla Rhino) does not preserves
// key order so we have to sort values manually
return Object.keys(data.eras).sort(function(a, b) {
return parseInt(a.substr(1)) - parseInt(b.substr(1));
});
}
/**
* Returs list of supported vendors, depending on user preferences
* @return {Array}
*/
function getVendorsList() {
var allVendors = Object.keys(vendorsDB);
var vendors = prefs.getArray('caniuse.vendors');
if (!vendors || vendors[0] == 'all') {
return allVendors;
}
return intersection(allVendors, vendors);
}
/**
* Returns size of version slice as defined by era identifier
* @return {Number}
*/
function getVersionSlice() {
var era = prefs.get('caniuse.era');
var ix = erasDB.indexOf(era);
if (!~ix) {
ix = erasDB.indexOf('e-2');
}
return ix;
}
// try to load caniuse database
// hide it from Require.JS parser
var db = null;
(function(r) {
if (typeof define === 'undefined' || !define.amd) {
try {
var fs = r('fs');
var path = r('path');
db = fs.readFileSync(path.join(__dirname, '../caniuse.json'), {encoding: 'utf8'});
} catch(e) {}
}
})(require);
if (db) {
parseDB(db);
}
return {
load: parseDB,
optimize: optimize,
/**
* Resolves prefixes for given property
* @param {String} property A property to resolve. It can start with `@` symbol
* (CSS section, like `@keyframes`) or `:` (CSS value, like `flex`)
* @return {Array} Array of resolved prefixes or <code>null</code>
* if prefixes can't be resolved. Empty array means property has no vendor
* prefixes
*/
resolvePrefixes: function(property) {
if (!prefs.get('caniuse.enabled') || !cssDB || !(property in cssDB)) {
return null;
}
var prefixes = [];
var propStats = cssDB[property];
var versions = getVersionSlice();
getVendorsList().forEach(function(vendor) {
var vendorVesions = vendorsDB[vendor].versions.slice(versions);
for (var i = 0, v; i < vendorVesions.length; i++) {
v = vendorVesions[i];
if (!v) {
continue;
}
if (~propStats[vendor][v].indexOf('x')) {
prefixes.push(vendorsDB[vendor].prefix);
break;
}
}
});
return utils.unique(prefixes).sort(function(a, b) {
return b.length - a.length;
});
}
};
});
},{"../utils/common":73,"./preferences":28}],24:[function(require,module,exports){
/**
* Module that contains factories for element types used by Emmet
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var factories = {};
var reAttrs = /([@\!]?)([\w\-:]+)\s*=\s*(['"])(.*?)\3/g;
// register resource references
function commonFactory(value) {
return {data: value};
}
module = module || {};
module.exports = {
/**
* Create new element factory
* @param {String} name Element identifier
* @param {Function} factory Function that produces element of specified
* type. The object generated by this factory is automatically
* augmented with <code>type</code> property pointing to element
* <code>name</code>
* @memberOf elements
*/
add: function(name, factory) {
var that = this;
factories[name] = function() {
var elem = factory.apply(that, arguments);
if (elem)
elem.type = name;
return elem;
};
},
/**
* Returns factory for specified name
* @param {String} name
* @returns {Function}
*/
get: function(name) {
return factories[name];
},
/**
* Creates new element with specified type
* @param {String} name
* @returns {Object}
*/
create: function(name) {
var args = [].slice.call(arguments, 1);
var factory = this.get(name);
return factory ? factory.apply(this, args) : null;
},
/**
* Check if passed element is of specified type
* @param {Object} elem
* @param {String} type
* @returns {Boolean}
*/
is: function(elem, type) {
return this.type(elem) === type;
},
/**
* Returns type of element
* @param {Object} elem
* @return {String}
*/
type: function(elem) {
return elem && elem.type;
}
};
/**
* Element factory
* @param {String} elementName Name of output element
* @param {String} attrs Attributes definition. You may also pass
* <code>Array</code> where each contains object with <code>name</code>
* and <code>value</code> properties, or <code>Object</code>
* @param {Boolean} isEmpty Is expanded element should be empty
*/
module.exports.add('element', function(elementName, attrs, isEmpty) {
var ret = {
name: elementName,
is_empty: !!isEmpty
};
if (attrs) {
ret.attributes = [];
if (Array.isArray(attrs)) {
ret.attributes = attrs;
} else if (typeof attrs === 'string') {
var m;
while ((m = reAttrs.exec(attrs))) {
ret.attributes.push({
name: m[2],
value: m[4],
isDefault: m[1] == '@',
isImplied: m[1] == '!'
});
}
} else {
ret.attributes = Object.keys(attrs).map(function(name) {
return {
name: name,
value: attrs[name]
};
});
}
}
return ret;
});
module.exports.add('snippet', commonFactory);
module.exports.add('reference', commonFactory);
module.exports.add('empty', function() {
return {};
});
return module.exports;
});
},{}],25:[function(require,module,exports){
/**
* Utility module that provides ordered storage of function handlers.
* Many Emmet modules' functionality can be extended/overridden by custom
* function. This modules provides unified storage of handler functions, their
* management and execution
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
/**
* @type HandlerList
* @constructor
*/
function HandlerList() {
this._list = [];
}
HandlerList.prototype = {
/**
* Adds function handler
* @param {Function} fn Handler
* @param {Object} options Handler options. Possible values are:<br><br>
* <b>order</b> : (<code>Number</code>) – order in handler list. Handlers
* with higher order value will be executed earlier.
*/
add: function(fn, options) {
// TODO hack for stable sort, remove after fixing `list()`
var order = this._list.length;
if (options && 'order' in options) {
order = options.order * 10000;
}
this._list.push(utils.extend({}, options, {order: order, fn: fn}));
},
/**
* Removes handler from list
* @param {Function} fn
*/
remove: function(fn) {
var item = utils.find(this._list, function(item) {
return item.fn === fn;
});
if (item) {
this._list.splice(this._list.indexOf(item), 1);
}
},
/**
* Returns ordered list of handlers. By default, handlers
* with the same <code>order</code> option returned in reverse order,
* i.e. the latter function was added into the handlers list, the higher
* it will be in the returned array
* @returns {Array}
*/
list: function() {
// TODO make stable sort
return this._list.sort(function(a, b) {
return b.order - a.order;
});
},
/**
* Returns ordered list of handler functions
* @returns {Array}
*/
listFn: function() {
return this.list().map(function(item) {
return item.fn;
});
},
/**
* Executes handler functions in their designated order. If function
* returns <code>skipVal</code>, meaning that function was unable to
* handle passed <code>args</code>, the next function will be executed
* and so on.
* @param {Object} skipValue If function returns this value, execute
* next handler.
* @param {Array} args Arguments to pass to handler function
* @returns {Boolean} Whether any of registered handlers performed
* successfully
*/
exec: function(skipValue, args) {
args = args || [];
var result = null;
utils.find(this.list(), function(h) {
result = h.fn.apply(h, args);
if (result !== skipValue) {
return true;
}
});
return result;
}
};
return {
/**
* Factory method that produces <code>HandlerList</code> instance
* @returns {HandlerList}
* @memberOf handlerList
*/
create: function() {
return new HandlerList();
}
};
});
},{"../utils/common":73}],26:[function(require,module,exports){
/**
* HTML matcher: takes string and searches for HTML tag pairs for given position
*
* Unlike “classic” matchers, it parses content from the specified
* position, not from the start, so it may work even outside HTML documents
* (for example, inside strings of programming languages like JavaScript, Python
* etc.)
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var range = require('./range');
// Regular Expressions for parsing tags and attributes
var reOpenTag = /^<([\w\:\-]+)((?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
var reCloseTag = /^<\/([\w\:\-]+)[^>]*>/;
function openTag(i, match) {
return {
name: match[1],
selfClose: !!match[3],
/** @type Range */
range: range(i, match[0]),
type: 'open'
};
}
function closeTag(i, match) {
return {
name: match[1],
/** @type Range */
range: range(i, match[0]),
type: 'close'
};
}
function comment(i, match) {
return {
/** @type Range */
range: range(i, typeof match == 'number' ? match - i : match[0]),
type: 'comment'
};
}
/**
* Creates new tag matcher session
* @param {String} text
*/
function createMatcher(text) {
var memo = {}, m;
return {
/**
* Test if given position matches opening tag
* @param {Number} i
* @returns {Object} Matched tag object
*/
open: function(i) {
var m = this.matches(i);
return m && m.type == 'open' ? m : null;
},
/**
* Test if given position matches closing tag
* @param {Number} i
* @returns {Object} Matched tag object
*/
close: function(i) {
var m = this.matches(i);
return m && m.type == 'close' ? m : null;
},
/**
* Matches either opening or closing tag for given position
* @param i
* @returns
*/
matches: function(i) {
var key = 'p' + i;
if (!(key in memo)) {
memo[key] = false;
if (text.charAt(i) == '<') {
var substr = text.slice(i);
if ((m = substr.match(reOpenTag))) {
memo[key] = openTag(i, m);
} else if ((m = substr.match(reCloseTag))) {
memo[key] = closeTag(i, m);
}
}
}
return memo[key];
},
/**
* Returns original text
* @returns {String}
*/
text: function() {
return text;
},
clean: function() {
memo = text = m = null;
}
};
}
function matches(text, pos, pattern) {
return text.substring(pos, pos + pattern.length) == pattern;
}
/**
* Search for closing pair of opening tag
* @param {Object} open Open tag instance
* @param {Object} matcher Matcher instance
*/
function findClosingPair(open, matcher) {
var stack = [], tag = null;
var text = matcher.text();
for (var pos = open.range.end, len = text.length; pos < len; pos++) {
if (matches(text, pos, '<!--')) {
// skip to end of comment
for (var j = pos; j < len; j++) {
if (matches(text, j, '-->')) {
pos = j + 3;
break;
}
}
}
if ((tag = matcher.matches(pos))) {
if (tag.type == 'open' && !tag.selfClose) {
stack.push(tag.name);
} else if (tag.type == 'close') {
if (!stack.length) { // found valid pair?
return tag.name == open.name ? tag : null;
}
// check if current closing tag matches previously opened one
if (stack[stack.length - 1] == tag.name) {
stack.pop();
} else {
var found = false;
while (stack.length && !found) {
var last = stack.pop();
if (last == tag.name) {
found = true;
}
}
if (!stack.length && !found) {
return tag.name == open.name ? tag : null;
}
}
}
pos = tag.range.end - 1;
}
}
}
return {
/**
* Main function: search for tag pair in <code>text</code> for given
* position
* @memberOf htmlMatcher
* @param {String} text
* @param {Number} pos
* @returns {Object}
*/
find: function(text, pos) {
var matcher = createMatcher(text);
var open = null, close = null;
var j, jl;
for (var i = pos; i >= 0; i--) {
if ((open = matcher.open(i))) {
// found opening tag
if (open.selfClose) {
if (open.range.cmp(pos, 'lt', 'gt')) {
// inside self-closing tag, found match
break;
}
// outside self-closing tag, continue
continue;
}
close = findClosingPair(open, matcher);
if (close) {
// found closing tag.
var r = range.create2(open.range.start, close.range.end);
if (r.contains(pos)) {
break;
}
} else if (open.range.contains(pos)) {
// we inside empty HTML tag like <br>
break;
}
open = null;
} else if (matches(text, i, '-->')) {
// skip back to comment start
for (j = i - 1; j >= 0; j--) {
if (matches(text, j, '-->')) {
// found another comment end, do nothing
break;
} else if (matches(text, j, '<!--')) {
i = j;
break;
}
}
} else if (matches(text, i, '<!--')) {
// we're inside comment, match it
for (j = i + 4, jl = text.length; j < jl; j++) {
if (matches(text, j, '-->')) {
j += 3;
break;
}
}
open = comment(i, j);
break;
}
}
matcher.clean();
if (open) {
var outerRange = null;
var innerRange = null;
if (close) {
outerRange = range.create2(open.range.start, close.range.end);
innerRange = range.create2(open.range.end, close.range.start);
} else {
outerRange = innerRange = range.create2(open.range.start, open.range.end);
}
if (open.type == 'comment') {
// adjust positions of inner range for comment
var _c = outerRange.substring(text);
innerRange.start += _c.length - _c.replace(/^<\!--\s*/, '').length;
innerRange.end -= _c.length - _c.replace(/\s*-->$/, '').length;
}
return {
open: open,
close: close,
type: open.type == 'comment' ? 'comment' : 'tag',
innerRange: innerRange,
innerContent: function() {
return this.innerRange.substring(text);
},
outerRange: outerRange,
outerContent: function() {
return this.outerRange.substring(text);
},
range: !innerRange.length() || !innerRange.cmp(pos, 'lte', 'gte') ? outerRange : innerRange,
content: function() {
return this.range.substring(text);
},
source: text
};
}
},
/**
* The same as <code>find()</code> method, but restricts matched result
* to <code>tag</code> type
* @param {String} text
* @param {Number} pos
* @returns {Object}
*/
tag: function(text, pos) {
var result = this.find(text, pos);
if (result && result.type == 'tag') {
return result;
}
}
};
});
},{"./range":30}],27:[function(require,module,exports){
/**
* Simple logger for Emmet
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
return {
log: function() {
if (typeof console != 'undefined' && console.log) {
console.log.apply(console, arguments);
}
}
}
})
},{}],28:[function(require,module,exports){
/**
* Common module's preferences storage. This module
* provides general storage for all module preferences, their description and
* default values.<br><br>
*
* This module can also be used to list all available properties to create
* UI for updating properties
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
var preferences = {};
var defaults = {};
var _dbgDefaults = null;
var _dbgPreferences = null;
function toBoolean(val) {
if (typeof val === 'string') {
val = val.toLowerCase();
return val == 'yes' || val == 'true' || val == '1';
}
return !!val;
}
function isValueObj(obj) {
return typeof obj === 'object'
&& !Array.isArray(obj)
&& 'value' in obj
&& Object.keys(obj).length < 3;
}
return {
/**
* Creates new preference item with default value
* @param {String} name Preference name. You can also pass object
* with many options
* @param {Object} value Preference default value
* @param {String} description Item textual description
* @memberOf preferences
*/
define: function(name, value, description) {
var prefs = name;
if (typeof name === 'string') {
prefs = {};
prefs[name] = {
value: value,
description: description
};
}
Object.keys(prefs).forEach(function(k) {
var v = prefs[k];
defaults[k] = isValueObj(v) ? v : {value: v};
});
},
/**
* Updates preference item value. Preference value should be defined
* first with <code>define</code> method.
* @param {String} name Preference name. You can also pass object
* with many options
* @param {Object} value Preference default value
* @memberOf preferences
*/
set: function(name, value) {
var prefs = name;
if (typeof name === 'string') {
prefs = {};
prefs[name] = value;
}
Object.keys(prefs).forEach(function(k) {
var v = prefs[k];
if (!(k in defaults)) {
throw new Error('Property "' + k + '" is not defined. You should define it first with `define` method of current module');
}
// do not set value if it equals to default value
if (v !== defaults[k].value) {
// make sure we have value of correct type
switch (typeof defaults[k].value) {
case 'boolean':
v = toBoolean(v);
break;
case 'number':
v = parseInt(v + '', 10) || 0;
break;
default: // convert to string
if (v !== null) {
v += '';
}
}
preferences[k] = v;
} else if (k in preferences) {
delete preferences[k];
}
});
},
/**
* Returns preference value
* @param {String} name
* @returns {String} Returns <code>undefined</code> if preference is
* not defined
*/
get: function(name) {
if (name in preferences) {
return preferences[name];
}
if (name in defaults) {
return defaults[name].value;
}
return void 0;
},
/**
* Returns comma-separated preference value as array of values
* @param {String} name
* @returns {Array} Returns <code>undefined</code> if preference is
* not defined, <code>null</code> if string cannot be converted to array
*/
getArray: function(name) {
var val = this.get(name);
if (typeof val === 'undefined' || val === null || val === '') {
return null;
}
val = val.split(',').map(utils.trim);
if (!val.length) {
return null;
}
return val;
},
/**
* Returns comma and colon-separated preference value as dictionary
* @param {String} name
* @returns {Object}
*/
getDict: function(name) {
var result = {};
this.getArray(name).forEach(function(val) {
var parts = val.split(':');
result[parts[0]] = parts[1];
});
return result;
},
/**
* Returns description of preference item
* @param {String} name Preference name
* @returns {Object}
*/
description: function(name) {
return name in defaults ? defaults[name].description : void 0;
},
/**
* Completely removes specified preference(s)
* @param {String} name Preference name (or array of names)
*/
remove: function(name) {
if (!Array.isArray(name)) {
name = [name];
}
name.forEach(function(key) {
if (key in preferences) {
delete preferences[key];
}
if (key in defaults) {
delete defaults[key];
}
});
},
/**
* Returns sorted list of all available properties
* @returns {Array}
*/
list: function() {
return Object.keys(defaults).sort().map(function(key) {
return {
name: key,
value: this.get(key),
type: typeof defaults[key].value,
description: defaults[key].description
};
}, this);
},
/**
* Loads user-defined preferences from JSON
* @param {Object} json
* @returns
*/
load: function(json) {
Object.keys(json).forEach(function(key) {
this.set(key, json[key]);
}, this);
},
/**
* Returns hash of user-modified preferences
* @returns {Object}
*/
exportModified: function() {
return utils.extend({}, preferences);
},
/**
* Reset to defaults
* @returns
*/
reset: function() {
preferences = {};
},
/**
* For unit testing: use empty storage
*/
_startTest: function() {
_dbgDefaults = defaults;
_dbgPreferences = preferences;
defaults = {};
preferences = {};
},
/**
* For unit testing: restore original storage
*/
_stopTest: function() {
defaults = _dbgDefaults;
preferences = _dbgPreferences;
}
};
});
},{"../utils/common":73}],29:[function(require,module,exports){
/**
* Output profile module.
* Profile defines how XHTML output data should look like
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
var resources = require('./resources');
var prefs = require('./preferences');
prefs.define('profile.allowCompactBoolean', true,
'This option can be used to globally disable compact form of boolean ' +
'attribues (attributes where name and value are equal). With compact' +
'form enabled, HTML tags can be outputted as <code><div contenteditable></code> ' +
'instead of <code><div contenteditable="contenteditable"></code>');
prefs.define('profile.booleanAttributes', '^contenteditable|seamless$',
'A regular expression for attributes that should be boolean by default.' +
'If attribute name matches this expression, you don’t have to write dot ' +
'after attribute name in Emmet abbreviation to mark it as boolean.');
var profiles = {};
var defaultProfile = {
tag_case: 'asis',
attr_case: 'asis',
attr_quotes: 'double',
// Each tag on new line
tag_nl: 'decide',
// With tag_nl === true, defines if leaf node (e.g. node with no children)
// should have formatted line breaks
tag_nl_leaf: false,
place_cursor: true,
// Indent tags
indent: true,
// How many inline elements should be to force line break
// (set to 0 to disable)
inline_break: 3,
// Produce compact notation of boolean attribues:
// attributes where name and value are equal.
// With this option enabled, HTML filter will
// produce <div contenteditable> instead of <div contenteditable="contenteditable">
compact_bool: false,
// Use self-closing style for writing empty elements, e.g. <br /> or <br>
self_closing_tag: 'xhtml',
// Profile-level output filters, re-defines syntax filters
filters: '',
// Additional filters applied to abbreviation.
// Unlike "filters", this preference doesn't override default filters
// but add the instead every time given profile is chosen
extraFilters: ''
};
/**
* @constructor
* @type OutputProfile
* @param {Object} options
*/
function OutputProfile(options) {
utils.extend(this, defaultProfile, options);
}
OutputProfile.prototype = {
/**
* Transforms tag name case depending on current profile settings
* @param {String} name String to transform
* @returns {String}
*/
tagName: function(name) {
return stringCase(name, this.tag_case);
},
/**
* Transforms attribute name case depending on current profile settings
* @param {String} name String to transform
* @returns {String}
*/
attributeName: function(name) {
return stringCase(name, this.attr_case);
},
/**
* Returns quote character for current profile
* @returns {String}
*/
attributeQuote: function() {
return this.attr_quotes == 'single' ? "'" : '"';
},
/**
* Returns self-closing tag symbol for current profile
* @returns {String}
*/
selfClosing: function() {
if (this.self_closing_tag == 'xhtml')
return ' /';
if (this.self_closing_tag === true)
return '/';
return '';
},
/**
* Returns cursor token based on current profile settings
* @returns {String}
*/
cursor: function() {
return this.place_cursor ? utils.getCaretPlaceholder() : '';
},
/**
* Check if attribute with given name is boolean,
* e.g. written as `contenteditable` instead of
* `contenteditable="contenteditable"`
* @param {String} name Attribute name
* @return {Boolean}
*/
isBoolean: function(name, value) {
if (name == value) {
return true;
}
var boolAttrs = prefs.get('profile.booleanAttributes');
if (!value && boolAttrs) {
boolAttrs = new RegExp(boolAttrs, 'i');
return boolAttrs.test(name);
}
return false;
},
/**
* Check if compact boolean attribute record is
* allowed for current profile
* @return {Boolean}
*/
allowCompactBoolean: function() {
return this.compact_bool && prefs.get('profile.allowCompactBoolean');
}
};
/**
* Helper function that converts string case depending on
* <code>caseValue</code>
* @param {String} str String to transform
* @param {String} caseValue Case value: can be <i>lower</i>,
* <i>upper</i> and <i>leave</i>
* @returns {String}
*/
function stringCase(str, caseValue) {
switch (String(caseValue || '').toLowerCase()) {
case 'lower':
return str.toLowerCase();
case 'upper':
return str.toUpperCase();
}
return str;
}
/**
* Creates new output profile
* @param {String} name Profile name
* @param {Object} options Profile options
*/
function createProfile(name, options) {
return profiles[name.toLowerCase()] = new OutputProfile(options);
}
function createDefaultProfiles() {
createProfile('xhtml');
createProfile('html', {self_closing_tag: false, compact_bool: true});
createProfile('xml', {self_closing_tag: true, tag_nl: true});
createProfile('plain', {tag_nl: false, indent: false, place_cursor: false});
createProfile('line', {tag_nl: false, indent: false, extraFilters: 's'});
createProfile('css', {tag_nl: true});
createProfile('css_line', {tag_nl: false});
}
createDefaultProfiles();
return {
/**
* Creates new output profile and adds it into internal dictionary
* @param {String} name Profile name
* @param {Object} options Profile options
* @memberOf emmet.profile
* @returns {Object} New profile
*/
create: function(name, options) {
if (arguments.length == 2)
return createProfile(name, options);
else
// create profile object only
return new OutputProfile(utils.defaults(name || {}, defaultProfile));
},
/**
* Returns profile by its name. If profile wasn't found, returns
* 'plain' profile
* @param {String} name Profile name. Might be profile itself
* @param {String} syntax. Optional. Current editor syntax. If defined,
* profile is searched in resources first, then in predefined profiles
* @returns {Object}
*/
get: function(name, syntax) {
if (!name && syntax) {
// search in user resources first
var profile = resources.findItem(syntax, 'profile');
if (profile) {
name = profile;
}
}
if (!name) {
return profiles.plain;
}
if (name instanceof OutputProfile) {
return name;
}
if (typeof name === 'string' && name.toLowerCase() in profiles) {
return profiles[name.toLowerCase()];
}
return this.create(name);
},
/**
* Deletes profile with specified name
* @param {String} name Profile name
*/
remove: function(name) {
name = (name || '').toLowerCase();
if (name in profiles)
delete profiles[name];
},
/**
* Resets all user-defined profiles
*/
reset: function() {
profiles = {};
createDefaultProfiles();
},
/**
* Helper function that converts string case depending on
* <code>caseValue</code>
* @param {String} str String to transform
* @param {String} caseValue Case value: can be <i>lower</i>,
* <i>upper</i> and <i>leave</i>
* @returns {String}
*/
stringCase: stringCase
};
});
},{"../utils/common":73,"./preferences":28,"./resources":31}],30:[function(require,module,exports){
/**
* Helper module to work with ranges
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
function cmp(a, b, op) {
switch (op) {
case 'eq':
case '==':
return a === b;
case 'lt':
case '<':
return a < b;
case 'lte':
case '<=':
return a <= b;
case 'gt':
case '>':
return a > b;
case 'gte':
case '>=':
return a >= b;
}
}
/**
* @type Range
* @constructor
* @param {Object} start
* @param {Number} len
*/
function Range(start, len) {
if (typeof start === 'object' && 'start' in start) {
// create range from object stub
this.start = Math.min(start.start, start.end);
this.end = Math.max(start.start, start.end);
} else if (Array.isArray(start)) {
this.start = start[0];
this.end = start[1];
} else {
len = typeof len === 'string' ? len.length : +len;
this.start = start;
this.end = start + len;
}
}
Range.prototype = {
length: function() {
return Math.abs(this.end - this.start);
},
/**
* Returns <code>true</code> if passed range is equals to current one
* @param {Range} range
* @returns {Boolean}
*/
equal: function(range) {
return this.cmp(range, 'eq', 'eq');
// return this.start === range.start && this.end === range.end;
},
/**
* Shifts indexes position with passed <code>delta</code>
* @param {Number} delta
* @returns {Range} range itself
*/
shift: function(delta) {
this.start += delta;
this.end += delta;
return this;
},
/**
* Check if two ranges are overlapped
* @param {Range} range
* @returns {Boolean}
*/
overlap: function(range) {
return range.start <= this.end && range.end >= this.start;
},
/**
* Finds intersection of two ranges
* @param {Range} range
* @returns {Range} <code>null</code> if ranges does not overlap
*/
intersection: function(range) {
if (this.overlap(range)) {
var start = Math.max(range.start, this.start);
var end = Math.min(range.end, this.end);
return new Range(start, end - start);
}
return null;
},
/**
* Returns the union of the thow ranges.
* @param {Range} range
* @returns {Range} <code>null</code> if ranges are not overlapped
*/
union: function(range) {
if (this.overlap(range)) {
var start = Math.min(range.start, this.start);
var end = Math.max(range.end, this.end);
return new Range(start, end - start);
}
return null;
},
/**
* Returns a Boolean value that indicates whether a specified position
* is in a given range.
* @param {Number} loc
*/
inside: function(loc) {
return this.cmp(loc, 'lte', 'gt');
// return this.start <= loc && this.end > loc;
},
/**
* Returns a Boolean value that indicates whether a specified position
* is in a given range, but not equals bounds.
* @param {Number} loc
*/
contains: function(loc) {
return this.cmp(loc, 'lt', 'gt');
},
/**
* Check if current range completely includes specified one
* @param {Range} r
* @returns {Boolean}
*/
include: function(r) {
return this.cmp(r, 'lte', 'gte');
// return this.start <= r.start && this.end >= r.end;
},
/**
* Low-level comparision method
* @param {Number} loc
* @param {String} left Left comparison operator
* @param {String} right Right comaprison operator
*/
cmp: function(loc, left, right) {
var a, b;
if (loc instanceof Range) {
a = loc.start;
b = loc.end;
} else {
a = b = loc;
}
return cmp(this.start, a, left || '<=') && cmp(this.end, b, right || '>');
},
/**
* Returns substring of specified <code>str</code> for current range
* @param {String} str
* @returns {String}
*/
substring: function(str) {
return this.length() > 0
? str.substring(this.start, this.end)
: '';
},
/**
* Creates copy of current range
* @returns {Range}
*/
clone: function() {
return new Range(this.start, this.length());
},
/**
* @returns {Array}
*/
toArray: function() {
return [this.start, this.end];
},
toString: function() {
return this.valueOf();
},
valueOf: function() {
return '{' + this.start + ', ' + this.length() + '}';
}
};
/**
* Creates new range object instance
* @param {Object} start Range start or array with 'start' and 'end'
* as two first indexes or object with 'start' and 'end' properties
* @param {Number} len Range length or string to produce range from
* @returns {Range}
*/
module.exports = function(start, len) {
if (typeof start == 'undefined' || start === null)
return null;
if (start instanceof Range)
return start;
if (typeof start == 'object' && 'start' in start && 'end' in start) {
len = start.end - start.start;
start = start.start;
}
return new Range(start, len);
};
module.exports.create = module.exports;
module.exports.isRange = function(val) {
return val instanceof Range;
};
/**
* <code>Range</code> object factory, the same as <code>this.create()</code>
* but last argument represents end of range, not length
* @returns {Range}
*/
module.exports.create2 = function(start, end) {
if (typeof start === 'number' && typeof end === 'number') {
end -= start;
}
return this.create(start, end);
};
/**
* Helper function that sorts ranges in order as they
* appear in text
* @param {Array} ranges
* @return {Array}
*/
module.exports.sort = function(ranges, reverse) {
ranges = ranges.sort(function(a, b) {
if (a.start === b.start) {
return b.end - a.end;
}
return a.start - b.start;
});
reverse && ranges.reverse();
return ranges;
};
return module.exports;
});
},{}],31:[function(require,module,exports){
/**
* Parsed resources (snippets, abbreviations, variables, etc.) for Emmet.
* Contains convenient method to get access for snippets with respect of
* inheritance. Also provides ability to store data in different vocabularies
* ('system' and 'user') for fast and safe resource update
* @author Sergey Chikuyonok (serge.che@gmail.com)
* @link http://chikuyonok.ru
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var handlerList = require('./handlerList');
var utils = require('../utils/common');
var elements = require('./elements');
var logger = require('../assets/logger');
var stringScore = require('../vendor/stringScore');
var cssResolver = require('../resolver/css');
var VOC_SYSTEM = 'system';
var VOC_USER = 'user';
var cache = {};
/** Regular expression for XML tag matching */
var reTag = /^<(\w+\:?[\w\-]*)((?:\s+[@\!]?[\w\:\-]+\s*=\s*(['"]).*?\3)*)\s*(\/?)>/;
var systemSettings = {};
var userSettings = {};
/** @type HandlerList List of registered abbreviation resolvers */
var resolvers = handlerList.create();
function each(obj, fn) {
if (!obj) {
return;
}
Object.keys(obj).forEach(function(key) {
fn(obj[key], key);
});
}
/**
* Normalizes caret plceholder in passed text: replaces | character with
* default caret placeholder
* @param {String} text
* @returns {String}
*/
function normalizeCaretPlaceholder(text) {
return utils.replaceUnescapedSymbol(text, '|', utils.getCaretPlaceholder());
}
function parseItem(name, value, type) {
value = normalizeCaretPlaceholder(value);
if (type == 'snippets') {
return elements.create('snippet', value);
}
if (type == 'abbreviations') {
return parseAbbreviation(name, value);
}
}
/**
* Parses single abbreviation
* @param {String} key Abbreviation name
* @param {String} value Abbreviation value
* @return {Object}
*/
function parseAbbreviation(key, value) {
key = utils.trim(key);
var m;
if ((m = reTag.exec(value))) {
return elements.create('element', m[1], m[2], m[4] == '/');
} else {
// assume it's reference to another abbreviation
return elements.create('reference', value);
}
}
/**
* Normalizes snippet key name for better fuzzy search
* @param {String} str
* @returns {String}
*/
function normalizeName(str) {
return str.replace(/:$/, '').replace(/:/g, '-');
}
function expandSnippetsDefinition(snippets) {
var out = {};
each(snippets, function(val, key) {
var items = key.split('|');
// do not use iterators for better performance
for (var i = items.length - 1; i >= 0; i--) {
out[items[i]] = val;
}
});
return out;
}
utils.extend(exports, {
/**
* Sets new unparsed data for specified settings vocabulary
* @param {Object} data
* @param {String} type Vocabulary type ('system' or 'user')
* @memberOf resources
*/
setVocabulary: function(data, type) {
cache = {};
// sections like "snippets" and "abbreviations" could have
// definitions like `"f|fs": "fieldset"` which is the same as distinct
// "f" and "fs" keys both equals to "fieldset".
// We should parse these definitions first
var voc = {};
each(data, function(section, syntax) {
var _section = {};
each(section, function(subsection, name) {
if (name == 'abbreviations' || name == 'snippets') {
subsection = expandSnippetsDefinition(subsection);
}
_section[name] = subsection;
});
voc[syntax] = _section;
});
if (type == VOC_SYSTEM) {
systemSettings = voc;
} else {
userSettings = voc;
}
},
/**
* Returns resource vocabulary by its name
* @param {String} name Vocabulary name ('system' or 'user')
* @return {Object}
*/
getVocabulary: function(name) {
return name == VOC_SYSTEM ? systemSettings : userSettings;
},
/**
* Returns resource (abbreviation, snippet, etc.) matched for passed
* abbreviation
* @param {AbbreviationNode} node
* @param {String} syntax
* @returns {Object}
*/
getMatchedResource: function(node, syntax) {
return resolvers.exec(null, utils.toArray(arguments))
|| this.findSnippet(syntax, node.name());
},
/**
* Returns variable value
* @return {String}
*/
getVariable: function(name) {
return (this.getSection('variables') || {})[name];
},
/**
* Store runtime variable in user storage
* @param {String} name Variable name
* @param {String} value Variable value
*/
setVariable: function(name, value){
var voc = this.getVocabulary('user') || {};
if (!('variables' in voc))
voc.variables = {};
voc.variables[name] = value;
this.setVocabulary(voc, 'user');
},
/**
* Check if there are resources for specified syntax
* @param {String} syntax
* @return {Boolean}
*/
hasSyntax: function(syntax) {
return syntax in this.getVocabulary(VOC_USER)
|| syntax in this.getVocabulary(VOC_SYSTEM);
},
/**
* Registers new abbreviation resolver.
* @param {Function} fn Abbreviation resolver which will receive
* abbreviation as first argument and should return parsed abbreviation
* object if abbreviation has handled successfully, <code>null</code>
* otherwise
* @param {Object} options Options list as described in
* {@link HandlerList#add()} method
*/
addResolver: function(fn, options) {
resolvers.add(fn, options);
},
removeResolver: function(fn) {
resolvers.remove(fn);
},
/**
* Returns actual section data, merged from both
* system and user data
* @param {String} name Section name (syntax)
* @param {String} ...args Subsections
* @returns
*/
getSection: function(name) {
if (!name)
return null;
if (!(name in cache)) {
cache[name] = utils.deepMerge({}, systemSettings[name], userSettings[name]);
}
var data = cache[name], subsections = utils.toArray(arguments, 1), key;
while (data && (key = subsections.shift())) {
if (key in data) {
data = data[key];
} else {
return null;
}
}
return data;
},
/**
* Recursively searches for a item inside top level sections (syntaxes)
* with respect of `extends` attribute
* @param {String} topSection Top section name (syntax)
* @param {String} subsection Inner section name
* @returns {Object}
*/
findItem: function(topSection, subsection) {
var data = this.getSection(topSection);
while (data) {
if (subsection in data)
return data[subsection];
data = this.getSection(data['extends']);
}
},
/**
* Recursively searches for a snippet definition inside syntax section.
* Definition is searched inside `snippets` and `abbreviations`
* subsections
* @param {String} syntax Top-level section name (syntax)
* @param {String} name Snippet name
* @returns {Object}
*/
findSnippet: function(syntax, name, memo) {
if (!syntax || !name)
return null;
memo = memo || [];
var names = [name];
// create automatic aliases to properties with colons,
// e.g. pos-a == pos:a
if (~name.indexOf('-')) {
names.push(name.replace(/\-/g, ':'));
}
var data = this.getSection(syntax), matchedItem = null;
['snippets', 'abbreviations'].some(function(sectionName) {
var data = this.getSection(syntax, sectionName);
if (data) {
return names.some(function(n) {
if (data[n]) {
return matchedItem = parseItem(n, data[n], sectionName);
}
});
}
}, this);
memo.push(syntax);
if (!matchedItem && data['extends'] && !~memo.indexOf(data['extends'])) {
// try to find item in parent syntax section
return this.findSnippet(data['extends'], name, memo);
}
return matchedItem;
},
/**
* Performs fuzzy search of snippet definition
* @param {String} syntax Top-level section name (syntax)
* @param {String} name Snippet name
* @returns
*/
fuzzyFindSnippet: function(syntax, name, minScore) {
var result = this.fuzzyFindMatches(syntax, name, minScore)[0];
if (result) {
return result.value.parsedValue;
}
},
fuzzyFindMatches: function(syntax, name, minScore) {
minScore = minScore || 0.3;
name = normalizeName(name);
var snippets = this.getAllSnippets(syntax);
return Object.keys(snippets)
.map(function(key) {
var value = snippets[key];
return {
key: key,
score: stringScore.score(value.nk, name, 0.1),
value: value
};
})
.filter(function(item) {
return item.score >= minScore;
})
.sort(function(a, b) {
return a.score - b.score;
})
.reverse();
},
/**
* Returns plain dictionary of all available abbreviations and snippets
* for specified syntax with respect of inheritance
* @param {String} syntax
* @returns {Object}
*/
getAllSnippets: function(syntax) {
var cacheKey = 'all-' + syntax;
if (!cache[cacheKey]) {
var stack = [], sectionKey = syntax;
var memo = [];
do {
var section = this.getSection(sectionKey);
if (!section)
break;
['snippets', 'abbreviations'].forEach(function(sectionName) {
var stackItem = {};
each(section[sectionName] || null, function(v, k) {
stackItem[k] = {
nk: normalizeName(k),
value: v,
parsedValue: parseItem(k, v, sectionName),
type: sectionName
};
});
stack.push(stackItem);
});
memo.push(sectionKey);
sectionKey = section['extends'];
} while (sectionKey && !~memo.indexOf(sectionKey));
cache[cacheKey] = utils.extend.apply(utils, stack.reverse());
}
return cache[cacheKey];
},
/**
* Returns newline character
* @returns {String}
*/
getNewline: function() {
var nl = this.getVariable('newline');
return typeof nl === 'string' ? nl : '\n';
},
/**
* Sets new newline character that will be used in output
* @param {String} str
*/
setNewline: function(str) {
this.setVariable('newline', str);
this.setVariable('nl', str);
}
});
// XXX add default resolvers
exports.addResolver(cssResolver.resolve.bind(cssResolver));
// try to load snippets
// hide it from Require.JS parser
(function(r) {
if (typeof define === 'undefined' || !define.amd) {
try {
var fs = r('fs');
var path = r('path');
var defaultSnippets = fs.readFileSync(path.join(__dirname, '../snippets.json'), {encoding: 'utf8'});
exports.setVocabulary(JSON.parse(defaultSnippets), VOC_SYSTEM);
} catch (e) {}
}
})(require);
return exports;
});
},{"../assets/logger":27,"../resolver/css":64,"../utils/common":73,"../vendor/stringScore":79,"./elements":24,"./handlerList":25}],32:[function(require,module,exports){
/**
* A trimmed version of CodeMirror's StringStream module for string parsing
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
/**
* @type StringStream
* @constructor
* @param {String} string Assuming that bound string should be
* immutable
*/
function StringStream(string) {
this.pos = this.start = 0;
this.string = string;
this._length = string.length;
}
StringStream.prototype = {
/**
* Returns true only if the stream is at the end of the line.
* @returns {Boolean}
*/
eol: function() {
return this.pos >= this._length;
},
/**
* Returns true only if the stream is at the start of the line
* @returns {Boolean}
*/
sol: function() {
return this.pos === 0;
},
/**
* Returns the next character in the stream without advancing it.
* Will return <code>undefined</code> at the end of the line.
* @returns {String}
*/
peek: function() {
return this.string.charAt(this.pos);
},
/**
* Returns the next character in the stream and advances it.
* Also returns <code>undefined</code> when no more characters are available.
* @returns {String}
*/
next: function() {
if (this.pos < this._length)
return this.string.charAt(this.pos++);
},
/**
* match can be a character, a regular expression, or a function that
* takes a character and returns a boolean. If the next character in the
* stream 'matches' the given argument, it is consumed and returned.
* Otherwise, undefined is returned.
* @param {Object} match
* @returns {String}
*/
eat: function(match) {
var ch = this.string.charAt(this.pos), ok;
if (typeof match == "string")
ok = ch == match;
else
ok = ch && (match.test ? match.test(ch) : match(ch));
if (ok) {
++this.pos;
return ch;
}
},
/**
* Repeatedly calls <code>eat</code> with the given argument, until it
* fails. Returns <code>true</code> if any characters were eaten.
* @param {Object} match
* @returns {Boolean}
*/
eatWhile: function(match) {
var start = this.pos;
while (this.eat(match)) {}
return this.pos > start;
},
/**
* Shortcut for <code>eatWhile</code> when matching white-space.
* @returns {Boolean}
*/
eatSpace: function() {
var start = this.pos;
while (/[\s\u00a0]/.test(this.string.charAt(this.pos)))
++this.pos;
return this.pos > start;
},
/**
* Moves the position to the end of the line.
*/
skipToEnd: function() {
this.pos = this._length;
},
/**
* Skips to the next occurrence of the given character, if found on the
* current line (doesn't advance the stream if the character does not
* occur on the line). Returns true if the character was found.
* @param {String} ch
* @returns {Boolean}
*/
skipTo: function(ch) {
var found = this.string.indexOf(ch, this.pos);
if (found > -1) {
this.pos = found;
return true;
}
},
/**
* Skips to <code>close</code> character which is pair to <code>open</code>
* character, considering possible pair nesting. This function is used
* to consume pair of characters, like opening and closing braces
* @param {String} open
* @param {String} close
* @returns {Boolean} Returns <code>true</code> if pair was successfully
* consumed
*/
skipToPair: function(open, close, skipString) {
var braceCount = 0, ch;
var pos = this.pos, len = this._length;
while (pos < len) {
ch = this.string.charAt(pos++);
if (ch == open) {
braceCount++;
} else if (ch == close) {
braceCount--;
if (braceCount < 1) {
this.pos = pos;
return true;
}
} else if (skipString && (ch == '"' || ch == "'")) {
this.skipString(ch);
}
}
return false;
},
/**
* A helper function which, in case of either single or
* double quote was found in current position, skips entire
* string (quoted value)
* @return {Boolean} Wether quoted string was skipped
*/
skipQuoted: function(noBackup) {
var ch = this.string.charAt(noBackup ? this.pos : this.pos - 1);
if (ch === '"' || ch === "'") {
if (noBackup) {
this.pos++;
}
return this.skipString(ch);
}
},
/**
* A custom function to skip string literal, e.g. a "double-quoted"
* or 'single-quoted' value
* @param {String} quote An opening quote
* @return {Boolean}
*/
skipString: function(quote) {
var pos = this.pos, len = this._length, ch;
while (pos < len) {
ch = this.string.charAt(pos++);
if (ch == '\\') {
continue;
} else if (ch == quote) {
this.pos = pos;
return true;
}
}
return false;
},
/**
* Backs up the stream n characters. Backing it up further than the
* start of the current token will cause things to break, so be careful.
* @param {Number} n
*/
backUp : function(n) {
this.pos -= n;
},
/**
* Act like a multi-character <code>eat</code>—if <code>consume</code> is true or
* not given—or a look-ahead that doesn't update the stream position—if
* it is false. <code>pattern</code> can be either a string or a
* regular expression starting with ^. When it is a string,
* <code>caseInsensitive</code> can be set to true to make the match
* case-insensitive. When successfully matching a regular expression,
* the returned value will be the array returned by <code>match</code>,
* in case you need to extract matched groups.
*
* @param {RegExp} pattern
* @param {Boolean} consume
* @param {Boolean} caseInsensitive
* @returns
*/
match: function(pattern, consume, caseInsensitive) {
if (typeof pattern == "string") {
var cased = caseInsensitive
? function(str) {return str.toLowerCase();}
: function(str) {return str;};
if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
if (consume !== false)
this.pos += pattern.length;
return true;
}
} else {
var match = this.string.slice(this.pos).match(pattern);
if (match && consume !== false)
this.pos += match[0].length;
return match;
}
},
/**
* Get the string between the start of the current token and the
* current stream position.
* @returns {String}
*/
current: function(backUp) {
return this.string.slice(this.start, this.pos - (backUp ? 1 : 0));
}
};
module.exports = function(string) {
return new StringStream(string);
};
/** @deprecated */
module.exports.create = module.exports;
return module.exports;
});
},{}],33:[function(require,module,exports){
/**
* Utility module for handling tabstops tokens generated by Emmet's
* "Expand Abbreviation" action. The main <code>extract</code> method will take
* raw text (for example: <i>${0} some ${1:text}</i>), find all tabstops
* occurrences, replace them with tokens suitable for your editor of choice and
* return object with processed text and list of found tabstops and their ranges.
* For sake of portability (Objective-C/Java) the tabstops list is a plain
* sorted array with plain objects.
*
* Placeholders with the same are meant to be <i>linked</i> in your editor.
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
var stringStream = require('./stringStream');
var resources = require('./resources');
/**
* Global placeholder value, automatically incremented by
* <code>variablesResolver()</code> function
*/
var startPlaceholderNum = 100;
var tabstopIndex = 0;
var defaultOptions = {
replaceCarets: false,
escape: function(ch) {
return '\\' + ch;
},
tabstop: function(data) {
return data.token;
},
variable: function(data) {
return data.token;
}
};
return {
/**
* Main function that looks for a tabstops in provided <code>text</code>
* and returns a processed version of <code>text</code> with expanded
* placeholders and list of tabstops found.
* @param {String} text Text to process
* @param {Object} options List of processor options:<br>
*
* <b>replaceCarets</b> : <code>Boolean</code> — replace all default
* caret placeholders (like <i>{%::emmet-caret::%}</i>) with <i>${0:caret}</i><br>
*
* <b>escape</b> : <code>Function</code> — function that handle escaped
* characters (mostly '$'). By default, it returns the character itself
* to be displayed as is in output, but sometimes you will use
* <code>extract</code> method as intermediate solution for further
* processing and want to keep character escaped. Thus, you should override
* <code>escape</code> method to return escaped symbol (e.g. '\\$')<br>
*
* <b>tabstop</b> : <code>Function</code> – a tabstop handler. Receives
* a single argument – an object describing token: its position, number
* group, placeholder and token itself. Should return a replacement
* string that will appear in final output
*
* <b>variable</b> : <code>Function</code> – variable handler. Receives
* a single argument – an object describing token: its position, name
* and original token itself. Should return a replacement
* string that will appear in final output
*
* @returns {Object} Object with processed <code>text</code> property
* and array of <code>tabstops</code> found
* @memberOf tabStops
*/
extract: function(text, options) {
// prepare defaults
var placeholders = {carets: ''};
var marks = [];
options = utils.extend({}, defaultOptions, options, {
tabstop: function(data) {
var token = data.token;
var ret = '';
if (data.placeholder == 'cursor') {
marks.push({
start: data.start,
end: data.start + token.length,
group: 'carets',
value: ''
});
} else {
// unify placeholder value for single group
if ('placeholder' in data)
placeholders[data.group] = data.placeholder;
if (data.group in placeholders)
ret = placeholders[data.group];
marks.push({
start: data.start,
end: data.start + token.length,
group: data.group,
value: ret
});
}
return token;
}
});
if (options.replaceCarets) {
text = text.replace(new RegExp( utils.escapeForRegexp( utils.getCaretPlaceholder() ), 'g'), '${0:cursor}');
}
// locate tabstops and unify group's placeholders
text = this.processText(text, options);
// now, replace all tabstops with placeholders
var buf = '', lastIx = 0;
var tabStops = marks.map(function(mark) {
buf += text.substring(lastIx, mark.start);
var pos = buf.length;
var ph = placeholders[mark.group] || '';
buf += ph;
lastIx = mark.end;
return {
group: mark.group,
start: pos,
end: pos + ph.length
};
});
buf += text.substring(lastIx);
return {
text: buf,
tabstops: tabStops.sort(function(a, b) {
return a.start - b.start;
})
};
},
/**
* Text processing routine. Locates escaped characters and tabstops and
* replaces them with values returned by handlers defined in
* <code>options</code>
* @param {String} text
* @param {Object} options See <code>extract</code> method options
* description
* @returns {String}
*/
processText: function(text, options) {
options = utils.extend({}, defaultOptions, options);
var buf = '';
/** @type StringStream */
var stream = stringStream.create(text);
var ch, m, a;
while ((ch = stream.next())) {
if (ch == '\\' && !stream.eol()) {
// handle escaped character
buf += options.escape(stream.next());
continue;
}
a = ch;
if (ch == '$') {
// looks like a tabstop
stream.start = stream.pos - 1;
if ((m = stream.match(/^[0-9]+/))) {
// it's $N
a = options.tabstop({
start: buf.length,
group: stream.current().substr(1),
token: stream.current()
});
} else if ((m = stream.match(/^\{([a-z_\-][\w\-]*)\}/))) {
// ${variable}
a = options.variable({
start: buf.length,
name: m[1],
token: stream.current()
});
} else if ((m = stream.match(/^\{([0-9]+)(:.+?)?\}/, false))) {
// ${N:value} or ${N} placeholder
// parse placeholder, including nested ones
stream.skipToPair('{', '}');
var obj = {
start: buf.length,
group: m[1],
token: stream.current()
};
var placeholder = obj.token.substring(obj.group.length + 2, obj.token.length - 1);
if (placeholder) {
obj.placeholder = placeholder.substr(1);
}
a = options.tabstop(obj);
}
}
buf += a;
}
return buf;
},
/**
* Upgrades tabstops in output node in order to prevent naming conflicts
* @param {AbbreviationNode} node
* @param {Number} offset Tab index offset
* @returns {Number} Maximum tabstop index in element
*/
upgrade: function(node, offset) {
var maxNum = 0;
var options = {
tabstop: function(data) {
var group = parseInt(data.group, 10);
if (group > maxNum) maxNum = group;
if (data.placeholder)
return '${' + (group + offset) + ':' + data.placeholder + '}';
else
return '${' + (group + offset) + '}';
}
};
['start', 'end', 'content'].forEach(function(p) {
node[p] = this.processText(node[p], options);
}, this);
return maxNum;
},
/**
* Helper function that produces a callback function for
* <code>replaceVariables()</code> method from {@link utils}
* module. This callback will replace variable definitions (like
* ${var_name}) with their value defined in <i>resource</i> module,
* or outputs tabstop with variable name otherwise.
* @param {AbbreviationNode} node Context node
* @returns {Function}
*/
variablesResolver: function(node) {
var placeholderMemo = {};
return function(str, varName) {
// do not mark `child` variable as placeholder – it‘s a reserved
// variable name
if (varName == 'child') {
return str;
}
if (varName == 'cursor') {
return utils.getCaretPlaceholder();
}
var attr = node.attribute(varName);
if (typeof attr !== 'undefined' && attr !== str) {
return attr;
}
var varValue = resources.getVariable(varName);
if (varValue) {
return varValue;
}
// output as placeholder
if (!placeholderMemo[varName]) {
placeholderMemo[varName] = startPlaceholderNum++;
}
return '${' + placeholderMemo[varName] + ':' + varName + '}';
};
},
/**
* Replace variables like ${var} in string
* @param {String} str
* @param {Object} vars Variable set (defaults to variables defined in
* <code>snippets.json</code>) or variable resolver (<code>Function</code>)
* @return {String}
*/
replaceVariables: function(str, vars) {
vars = vars || {};
var resolver = typeof vars === 'function' ? vars : function(str, p1) {
return p1 in vars ? vars[p1] : null;
};
return this.processText(str, {
variable: function(data) {
var newValue = resolver(data.token, data.name, data);
if (newValue === null) {
// try to find variable in resources
newValue = resources.getVariable(data.name);
}
if (newValue === null || typeof newValue === 'undefined')
// nothing found, return token itself
newValue = data.token;
return newValue;
}
});
},
/**
* Resets global tabstop index. When parsed tree is converted to output
* string (<code>AbbreviationNode.toString()</code>), all tabstops
* defined in snippets and elements are upgraded in order to prevent
* naming conflicts of nested. For example, <code>${1}</code> of a node
* should not be linked with the same placehilder of the child node.
* By default, <code>AbbreviationNode.toString()</code> automatically
* upgrades tabstops of the same index for each node and writes maximum
* tabstop index into the <code>tabstopIndex</code> variable. To keep
* this variable at reasonable value, it is recommended to call
* <code>resetTabstopIndex()</code> method each time you expand variable
* @returns
*/
resetTabstopIndex: function() {
tabstopIndex = 0;
startPlaceholderNum = 100;
},
/**
* Output processor for abbreviation parser that will upgrade tabstops
* of parsed node in order to prevent tabstop index conflicts
*/
abbrOutputProcessor: function(text, node, type) {
var maxNum = 0;
var that = this;
var tsOptions = {
tabstop: function(data) {
var group = parseInt(data.group, 10);
if (group === 0)
return '${0}';
if (group > maxNum) maxNum = group;
if (data.placeholder) {
// respect nested placeholders
var ix = group + tabstopIndex;
var placeholder = that.processText(data.placeholder, tsOptions);
return '${' + ix + ':' + placeholder + '}';
} else {
return '${' + (group + tabstopIndex) + '}';
}
}
};
// upgrade tabstops
text = this.processText(text, tsOptions);
// resolve variables
text = this.replaceVariables(text, this.variablesResolver(node));
tabstopIndex += maxNum + 1;
return text;
}
};
});
},{"../utils/common":73,"./resources":31,"./stringStream":32}],34:[function(require,module,exports){
/**
* Helper class for convenient token iteration
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
/**
* @type TokenIterator
* @param {Array} tokens
* @type TokenIterator
* @constructor
*/
function TokenIterator(tokens) {
/** @type Array */
this.tokens = tokens;
this._position = 0;
this.reset();
}
TokenIterator.prototype = {
next: function() {
if (this.hasNext()) {
var token = this.tokens[++this._i];
this._position = token.start;
return token;
} else {
this._i = this._il;
}
return null;
},
current: function() {
return this.tokens[this._i];
},
peek: function() {
return this.tokens[this._i + i];
},
position: function() {
return this._position;
},
hasNext: function() {
return this._i < this._il - 1;
},
reset: function() {
this._i = 0;
this._il = this.tokens.length;
},
item: function() {
return this.tokens[this._i];
},
itemNext: function() {
return this.tokens[this._i + 1];
},
itemPrev: function() {
return this.tokens[this._i - 1];
},
nextUntil: function(type, callback) {
var token;
var test = typeof type == 'string'
? function(t){return t.type == type;}
: type;
while ((token = this.next())) {
if (callback)
callback.call(this, token);
if (test.call(this, token))
break;
}
}
};
return {
create: function(tokens) {
return new TokenIterator(tokens);
}
};
});
},{}],35:[function(require,module,exports){
module.exports={
"eras": {
"e-26": "26 versions back",
"e-25": "25 versions back",
"e-24": "24 versions back",
"e-23": "23 versions back",
"e-22": "22 versions back",
"e-21": "21 versions back",
"e-20": "20 versions back",
"e-19": "19 versions back",
"e-18": "18 versions back",
"e-17": "17 versions back",
"e-16": "16 versions back",
"e-15": "15 versions back",
"e-14": "14 versions back",
"e-13": "13 versions back",
"e-12": "12 versions back",
"e-11": "11 versions back",
"e-10": "10 versions back",
"e-9": "9 versions back",
"e-8": "8 versions back",
"e-7": "7 versions back",
"e-6": "6 versions back",
"e-5": "5 versions back",
"e-4": "4 versions back",
"e-3": "3 versions back",
"e-2": "2 versions back",
"e-1": "Previous version",
"e0": "Current",
"e1": "Near future",
"e2": "Farther future"
},
"agents": {
"ie": {
"browser": "IE",
"abbr": "IE",
"prefix": "ms",
"type": "desktop",
"usage_global": {
"10": 10.7866,
"11": 0.114751,
"5.5": 0.009298,
"6": 0.204912,
"7": 0.508182,
"8": 8.31124,
"9": 5.21297
},
"versions": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "5.5", "6", "7", "8", "9", "10", "11", null, null],
"current_version": ""
},
"firefox": {
"browser": "Firefox",
"abbr": "FF",
"prefix": "moz",
"type": "desktop",
"usage_global": {
"10": 0.112406,
"11": 0.088319,
"12": 0.208754,
"13": 0.096348,
"14": 0.096348,
"15": 0.136493,
"16": 0.264957,
"17": 0.192696,
"18": 0.112406,
"19": 0.128464,
"2": 0.016058,
"20": 0.16058,
"21": 0.216783,
"22": 0.256928,
"23": 0.907277,
"24": 11.0318,
"25": 0.529914,
"26": 0.016058,
"27": 0.016058,
"3": 0.088319,
"3.5": 0.040145,
"3.6": 0.305102,
"4": 0.072261,
"5": 0.048174,
"6": 0.048174,
"7": 0.040145,
"8": 0.072261,
"9": 0.056203
},
"versions": [null, "2", "3", "3.5", "3.6", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27"],
"current_version": ""
},
"chrome": {
"browser": "Chrome",
"abbr": "Chr.",
"prefix": "webkit",
"type": "desktop",
"usage_global": {
"10": 0.048174,
"11": 0.112406,
"12": 0.064232,
"13": 0.056203,
"14": 0.056203,
"15": 0.072261,
"16": 0.048174,
"17": 0.040145,
"18": 0.08029,
"19": 0.040145,
"20": 0.040145,
"21": 0.48174,
"22": 0.248899,
"23": 0.216783,
"24": 0.200725,
"25": 0.361305,
"26": 0.353276,
"27": 0.369334,
"28": 0.610204,
"29": 5.08236,
"30": 24.6089,
"31": 0.16058,
"32": 0.064232,
"4": 0.024087,
"5": 0.024087,
"6": 0.032116,
"7": 0.024087,
"8": 0.032116,
"9": 0.024087
},
"versions": ["4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32"],
"current_version": ""
},
"safari": {
"browser": "Safari",
"abbr": "Saf.",
"prefix": "webkit",
"type": "desktop",
"usage_global": {
"3.1": 0,
"3.2": 0.008692,
"4": 0.104377,
"5": 0.305102,
"5.1": 1.28464,
"6": 2.04739,
"6.1": 0.064232,
"7": 0.16058
},
"versions": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "3.1", "3.2", "4", "5", "5.1", "6", "6.1", "7", null, null],
"current_version": ""
},
"opera": {
"browser": "Opera",
"abbr": "Op.",
"prefix": "o",
"type": "desktop",
"usage_global": {
"10.0-10.1": 0.016058,
"10.5": 0.008392,
"10.6": 0.008029,
"11": 0.008219,
"11.1": 0.008219,
"11.5": 0.016058,
"11.6": 0.032116,
"12": 0.040145,
"12.1": 0.48174,
"15": 0.032116,
"16": 0.104377,
"17": 0.16058,
"18": 0,
"9.5-9.6": 0.008219
},
"versions": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, "9.5-9.6", "10.0-10.1", "10.5", "10.6", "11", "11.1", "11.5", "11.6", "12", "12.1", "15", "16", "17", "18", null],
"current_version": "",
"prefix_exceptions": {
"15": "webkit",
"16": "webkit",
"17": "webkit",
"18": "webkit"
}
},
"ios_saf": {
"browser": "iOS Safari",
"abbr": "iOS",
"prefix": "webkit",
"type": "mobile",
"usage_global": {
"3.2": 0.00400113,
"4.0-4.1": 0.00800226,
"4.2-4.3": 0.0280079,
"5.0-5.1": 0.28408,
"6.0-6.1": 1.15633,
"7.0": 2.52071
},
"versions": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "3.2", "4.0-4.1", "4.2-4.3", "5.0-5.1", "6.0-6.1", "7.0", null, null],
"current_version": ""
},
"op_mini": {
"browser": "Opera Mini",
"abbr": "O.Mini",
"prefix": "o",
"type": "mobile",
"usage_global": {
"5.0-7.0": 4.58374
},
"versions": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "5.0-7.0", null, null],
"current_version": ""
},
"android": {
"browser": "Android Browser",
"abbr": "And.",
"prefix": "webkit",
"type": "mobile",
"usage_global": {
"2.1": 0.0251229,
"2.2": 0.0854178,
"2.3": 1.32146,
"3": 0.00502458,
"4": 0.994867,
"4.1": 1.87417,
"4.2-4.3": 0.743638,
"4.4": 0
},
"versions": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "2.1", "2.2", "2.3", "3", "4", "4.1", "4.2-4.3", "4.4", null],
"current_version": ""
},
"op_mob": {
"browser": "Opera Mobile",
"abbr": "O.Mob",
"prefix": "o",
"type": "mobile",
"usage_global": {
"0": 0,
"10": 0,
"11.5": 0.00726525,
"12": 0.0363263,
"12.1": 0.101714
},
"versions": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "10", null, null, "11.5", "12", "12.1", "0", null, null],
"current_version": "16",
"prefix_exceptions": {
"0": "webkit"
}
},
"bb": {
"browser": "Blackberry Browser",
"abbr": "BB",
"prefix": "webkit",
"type": "mobile",
"usage_global": {
"10": 0,
"7": 0.141419
},
"versions": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "7", "10", null, null],
"current_version": ""
},
"and_chr": {
"browser": "Chrome for Android",
"abbr": "Chr/And.",
"prefix": "webkit",
"type": "mobile",
"usage_global": {
"0": 1.38176
},
"versions": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "0", null, null],
"current_version": "30"
},
"and_ff": {
"browser": "Firefox for Android",
"abbr": "FF/And.",
"prefix": "moz",
"type": "mobile",
"usage_global": {
"0": 0.070956
},
"versions": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "0", null, null],
"current_version": "25"
},
"ie_mob": {
"browser": "IE Mobile",
"abbr": "IE.Mob",
"prefix": "ms",
"type": "mobile",
"usage_global": {
"10": 0.205595
},
"versions": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "10", null, null],
"current_version": ""
}
},
"statuses": {
"rec": "Recommendation",
"pr": "Proposed Recommendation",
"cr": "Candidate Recommendation",
"wd": "Working Draft",
"other": "Other",
"unoff": "Unofficial / Note"
},
"cats": {
"CSS": ["CSS", "CSS2", "CSS3"],
"HTML5": ["Canvas", "HTML5"],
"JS API": ["JS API"],
"Other": ["PNG", "Other", "DOM"],
"SVG": ["SVG"]
},
"updated": 1383587152,
"data": {
"png-alpha": {
"title": "PNG alpha transparency",
"description": "Semi-transparent areas in PNG files",
"spec": "http://www.w3.org/TR/PNG/",
"status": "rec",
"links": [{
"url": "http://dillerdesign.com/experiment/DD_belatedPNG/",
"title": "Workaround for IE6"
}, {
"url": "http://en.wikipedia.org/wiki/Portable_Network_Graphics",
"title": "Wikipedia"
}],
"categories": ["PNG"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "y",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "IE6 does support full transparency in 8-bit PNGs, which can sometimes be an alternative to 24-bit PNGs.",
"usage_perc_y": 94.36,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"apng": {
"title": "Animated PNG (APNG)",
"description": "Like animated GIFs, but allowing 24-bit colors and alpha transparency",
"spec": "https://wiki.mozilla.org/APNG_Specification",
"status": "unoff",
"links": [{
"url": "http://en.wikipedia.org/wiki/APNG",
"title": "Wikipedia"
}, {
"url": "https://github.com/davidmz/apng-canvas",
"title": "Polyfill using canvas"
}, {
"url": "https://chrome.google.com/webstore/detail/ehkepjiconegkhpodgoaeamnpckdbblp",
"title": "Chrome extension providing support"
}, {
"url": "http://www.truekolor.net/learn-how-to-create-an-animated-png/",
"title": "APNG tutorial"
}],
"categories": ["PNG"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n",
"28": "n",
"29": "n",
"30": "n",
"31": "n",
"32": "n"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "n",
"7": "n"
},
"opera": {
"9": "n",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "n",
"16": "n",
"17": "n",
"18": "n"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "n"
},
"and_chr": {
"0": "n"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Where support for APNG is missing, only the first frame is displayed",
"usage_perc_y": 16.19,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"video": {
"title": "Video element",
"description": "Method of playing videos on webpages (without requiring a plug-in)",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#video",
"status": "wd",
"links": [{
"url": "https://raw.github.com/phiggins42/has.js/master/detect/video.js#video",
"title": "has.js test"
}, {
"url": "http://webmproject.org",
"title": "WebM format information"
}, {
"url": "http://docs.webplatform.org/wiki/html/elements/video",
"title": "WebPlatform Docs"
}, {
"url": "http://camendesign.co.uk/code/video_for_everybody",
"title": "Video for Everybody"
}, {
"url": "http://diveinto.org/html5/video.html",
"title": "Video on the Web - includes info on Android support"
}, {
"url": "http://dev.opera.com/articles/view/everything-you-need-to-know-about-html5-video-and-audio/",
"title": "Detailed article on video/audio elements"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "a",
"2.2": "a",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Different browsers have support for different video formats, see sub-features for details. \r\n\r\nThe Android browser (before 2.3) requires <a href=\"http://www.broken-links.com/2010/07/08/making-html5-video-work-on-android-phones/\">specific handling</a> to run the video element.",
"usage_perc_y": 80.71,
"usage_perc_a": 0.11,
"ucprefix": false,
"parent": "",
"keywords": "<video>"
},
"audio": {
"title": "Audio element",
"description": "Method of playing sound on webpages (without requiring a plug-in)",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#audio",
"status": "wd",
"links": [{
"url": "http://html5doctor.com/native-audio-in-the-browser/",
"title": "HTML5 Doctor article"
}, {
"url": "http://textopia.org/androidsoundformats.html",
"title": "File format test page"
}, {
"url": "http://www.jplayer.org/latest/demos/",
"title": "Demos of audio player that uses <audio>"
}, {
"url": "http://www.phoboslab.org/log/2011/03/the-state-of-html5-audio",
"title": "The State of HTML5 Audio"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/audio.js#audio",
"title": "has.js test"
}, {
"url": "http://dev.opera.com/articles/view/everything-you-need-to-know-about-html5-video-and-audio/",
"title": "Detailed article on video/audio elements"
}, {
"url": "http://docs.webplatform.org/wiki/html/elements/audio",
"title": "WebPlatform Docs"
}, {
"url": "http://24ways.org/2010/the-state-of-html5-audio",
"title": "Detailed article on support"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "a",
"10.0-10.1": "a",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 80.7,
"usage_perc_a": 0.02,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"contenteditable": {
"title": "contenteditable attribute (basic support)",
"description": "Method of making any HTML element editable",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#contenteditable",
"status": "wd",
"links": [{
"url": "http://accessgarage.wordpress.com/2009/05/08/how-to-hack-your-app-to-make-contenteditable-work/",
"title": "Blog post on usage problems"
}, {
"url": "http://html5demos.com/contenteditable",
"title": "Demo page"
}, {
"url": "http://blog.whatwg.org/the-road-to-html-5-contenteditable",
"title": "WHATWG blog post"
}, {
"url": "http://docs.webplatform.org/wiki/html/attributes/contentEditable",
"title": "WebPlatform Docs"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "a",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "This support only refers to very basic editing capability, implementations vary significantly on how certain elements can be edited.",
"usage_perc_y": 88.37,
"usage_perc_a": 0.09,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"dragndrop": {
"title": "Drag and Drop",
"description": "Method of easily dragging and dropping elements on a page, requiring minimal JavaScript.",
"spec": "http://www.w3.org/TR/html5/editing.html#dnd",
"status": "wd",
"links": [{
"url": "http://html5demos.com/drag",
"title": "Demo with link blocks"
}, {
"url": "http://html5doctor.com/native-drag-and-drop/",
"title": "HTML5 Doctor article"
}, {
"url": "http://docs.webplatform.org/wiki/dom/events/drag",
"title": "WebPlatform Docs"
}, {
"url": "http://nettutsplus.s3.amazonaws.com/64_html5dragdrop/demo/index.html",
"title": "Shopping cart demo"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "y",
"11": "y"
},
"firefox": {
"2": "p",
"3": "p",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "p",
"9.5-9.6": "p",
"10.0-10.1": "p",
"10.5": "p",
"10.6": "p",
"11": "p",
"11.1": "p",
"11.5": "p",
"11.6": "p",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "p",
"11": "p",
"11.1": "p",
"11.5": "p",
"12": "p",
"12.1": "y",
"0": "n"
},
"and_chr": {
"0": "n"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support in older IE refers to no support for the dataTransfer.files or .types objects and limited supported formats for dataTransfer.setData/getData.",
"usage_perc_y": 64.83,
"usage_perc_a": 14.25,
"ucprefix": false,
"parent": "",
"keywords": "draganddrop"
},
"queryselector": {
"title": "querySelector/querySelectorAll",
"description": "Method of accessing DOM elements using CSS selectors",
"spec": "http://www.w3.org/TR/selectors-api/",
"status": "rec",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/selectors_api/querySelector",
"title": "WebPlatform Docs"
}, {
"url": "http://cjihrig.com/blog/javascripts-selectors-api/",
"title": "Blog post"
}, {
"url": "https://developer.mozilla.org/En/DOM/Element.querySelectorAll",
"title": "MDN article on querySelectorAll"
}, {
"url": "https://developer.mozilla.org/en/DOM/element.querySelector",
"title": "MDN article on querySelector"
}],
"categories": ["DOM"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "p",
"3": "p",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "p",
"9.5-9.6": "p",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Only works for the CSS selectors available. Thus the IE8 implementation is limited to the CSS 2.1 selectors",
"usage_perc_y": 93.74,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "query,selectors,selectors api"
},
"getelementsbyclassname": {
"title": "getElementsByClassName",
"description": "Method of accessing DOM elements by class name",
"spec": "http://www.w3.org/TR/dom/#dom-document-getelementsbyclassname",
"status": "wd",
"links": [{
"url": "http://www.quirksmode.org/dom/tests/basics.html#getElementsByClassName",
"title": "Test page"
}, {
"url": "http://docs.webplatform.org/wiki/dom/methods/getElementsByClassName",
"title": "WebPlatform Docs"
}],
"categories": ["DOM", "HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "p",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 85.52,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "byclassname"
},
"forms": {
"title": "HTML5 form features",
"description": "Expanded form options, including things like date pickers, sliders, validation, placeholders and multiple file uploads. Previously known as \"Web forms 2.0\".",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html",
"status": "wd",
"links": [{
"url": "https://github.com/westonruter/webforms2",
"title": "Cross-browser JS implementation (based on original spec)"
}, {
"url": "http://www.miketaylr.com/code/input-type-attr.html",
"title": "HTML5 inputs and attribute support page"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "p",
"10": "a",
"11": "a"
},
"firefox": {
"2": "p",
"3": "p",
"3.5": "p",
"3.6": "p",
"4": "a",
"5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a"
},
"chrome": {
"4": "a",
"5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a",
"28": "a",
"29": "a",
"30": "a",
"31": "a",
"32": "a"
},
"safari": {
"3.1": "p",
"3.2": "p",
"4": "a",
"5": "a",
"5.1": "a",
"6": "a",
"6.1": "a",
"7": "a"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "a",
"16": "a",
"17": "a",
"18": "a"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "a",
"4.2-4.3": "a",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "a"
},
"bb": {
"7": "n",
"10": "a"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "a"
},
"and_chr": {
"0": "a"
},
"and_ff": {
"0": "a"
},
"ie_mob": {
"10": "a"
}
},
"notes": "",
"usage_perc_y": 4.75,
"usage_perc_a": 65.35,
"ucprefix": false,
"parent": "",
"keywords": "input,datepicker"
},
"html5semantic": {
"title": "New semantic elements",
"description": "HTML5 offers some new elements, primarily for semantic purposes. The elements include: section, article, aside, header, footer, nav, figure, figcaption, time, mark.",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#sections",
"status": "wd",
"links": [{
"url": "http://oli.jp/2009/html5-structure3/",
"title": "Article on structural elements"
}, {
"url": "http://blog.whatwg.org/supporting-new-elements-in-ie",
"title": "Workaround for IE"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/dom.js#dom-html5-elements",
"title": "has.js test"
}, {
"url": "http://blog.whatwg.org/styling-ie-noscript",
"title": "Alternate workaround"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "a",
"3.5": "a",
"3.6": "a",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "a",
"5": "a",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "a",
"3.2": "a",
"4": "a",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "a",
"9.5-9.6": "a",
"10.0-10.1": "a",
"10.5": "a",
"10.6": "a",
"11": "a",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "a",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "a"
},
"android": {
"2.1": "a",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "a",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support refers to missing the default styling. This is easily taken care of by using display:block for all new elements (except time and mark, these should be display:inline anyway).",
"usage_perc_y": 80.26,
"usage_perc_a": 5.26,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"offline-apps": {
"title": "Offline web applications",
"description": "Method of defining web page files to be cached using a cache manifest file, allowing them to work offline on subsequent visits to the page",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html",
"status": "wd",
"links": [{
"url": "http://www.sitepoint.com/offline-web-application-tutorial/",
"title": "Sitepoint tutorial"
}, {
"url": "http://diveinto.org/html5/offline.html",
"title": "Dive Into HTML5 article"
}, {
"url": "http://docs.webplatform.org/wiki/apis/appcache/ApplicationCache",
"title": "WebPlatform Docs"
}, {
"url": "http://hacks.mozilla.org/2010/01/offline-web-applications/",
"title": "Mozilla Hacks article/demo"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "p",
"3": "a",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "p",
"3.2": "p",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "p",
"10.5": "p",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 75.59,
"usage_perc_a": 0.09,
"ucprefix": false,
"parent": "",
"keywords": "appcache,app cache,application cache,online"
},
"webworkers": {
"title": "Web Workers",
"description": "Method of running scripts in the background, isolated from the web page",
"spec": "http://www.w3.org/TR/workers/",
"status": "cr",
"links": [{
"url": "http://code.google.com/p/ie-web-worker/",
"title": "Polyfill for IE (single threaded)"
}, {
"url": "http://net.tutsplus.com/tutorials/javascript-ajax/getting-started-with-web-workers/",
"title": "Tutorial"
}, {
"url": "https://developer.mozilla.org/En/Using_web_workers",
"title": "MDN article"
}, {
"url": "http://nerget.com/rayjs-mt/rayjs.html",
"title": "Web Worker demo"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "p",
"10": "y",
"11": "y"
},
"firefox": {
"2": "p",
"3": "p",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "p",
"3.2": "p",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "p",
"10.5": "p",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "p",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 70.53,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"fontface": {
"title": "@font-face Web fonts",
"description": "Method of displaying fonts downloaded from websites",
"spec": "http://www.w3.org/TR/css3-webfonts/",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/atrules/@font-face",
"title": "WebPlatform Docs"
}, {
"url": "http://www.css3files.com/font/",
"title": "Information page"
}, {
"url": "http://webfonts.info",
"title": "News and information site"
}, {
"url": "http://en.wikipedia.org/wiki/Web_typography",
"title": "Wikipedia"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "a",
"4.0-4.1": "a",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "a",
"2.3": "a",
"3": "a",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "a",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support before IE8 refers to only supporting EOT fonts. Safari for iOS 4.1 and below only supports SVG fonts.",
"usage_perc_y": 79.25,
"usage_perc_a": 10.6,
"ucprefix": false,
"parent": "",
"keywords": "font face"
},
"eot": {
"title": "EOT - Embedded OpenType fonts",
"description": "Type of font that can be derived from a regular font, allowing small files and legal use of high-quality fonts. Usage is restricted by the file being tied to the website",
"spec": "http://www.w3.org/Submission/EOT/",
"status": "unoff",
"links": [{
"url": "http://www.microsoft.com/typography/web/embedding/default.aspx",
"title": "Example pages"
}, {
"url": "http://en.wikipedia.org/wiki/Embedded_OpenType",
"title": "Wikipedia"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n",
"28": "n",
"29": "n",
"30": "n",
"31": "n",
"32": "n"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "n",
"7": "n"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "n"
},
"and_chr": {
"0": "n"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Proposal by Microsoft, being considered for W3C standardization.",
"usage_perc_y": 25.14,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "fontface",
"keywords": ""
},
"woff": {
"title": "WOFF - Web Open Font Format",
"description": "Compressed TrueType/OpenType font that contains information about the font's source.",
"spec": "http://www.w3.org/TR/WOFF/",
"status": "rec",
"links": [{
"url": "http://hacks.mozilla.org/2009/10/woff/",
"title": "Mozilla hacks blog post"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Reported to be supported in some modified versions of the Android 4.0 browser.",
"usage_perc_y": 75.23,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "fontface",
"keywords": ""
},
"multibackgrounds": {
"title": "CSS3 Multiple backgrounds",
"description": "Method of using multiple images as a background",
"spec": "http://www.w3.org/TR/css3-background/",
"status": "cr",
"links": [{
"url": "http://www.css3.info/preview/multiple-backgrounds/",
"title": "Demo & information page"
}, {
"url": "http://www.css3files.com/background/",
"title": "Information page"
}, {
"url": "http://docs.webplatform.org/wiki/css/properties/background-image",
"title": "WebPlatform Docs"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 85.37,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"border-image": {
"title": "CSS3 Border images",
"description": "Method of using images for borders",
"spec": "http://www.w3.org/TR/css3-background/#the-border-image",
"status": "cr",
"links": [{
"url": "http://www.css3files.com/border/",
"title": "Information page"
}, {
"url": "http://docs.webplatform.org/wiki/css/properties/border-image",
"title": "WebPlatform Docs"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "a x",
"3.6": "a x",
"4": "a x",
"5": "a x",
"6": "a x",
"7": "a x",
"8": "a x",
"9": "a x",
"10": "a x",
"11": "a x",
"12": "a x",
"13": "a x",
"14": "a x",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "a x",
"5": "a x",
"6": "a x",
"7": "a x",
"8": "a x",
"9": "a x",
"10": "a x",
"11": "a x",
"12": "a x",
"13": "a x",
"14": "a x",
"15": "y x",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "a x",
"3.2": "a x",
"4": "a x",
"5": "a x",
"5.1": "a x",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "a",
"10.6": "a",
"11": "a x",
"11.1": "a x",
"11.5": "a x",
"11.6": "a x",
"12": "a x",
"12.1": "a x",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "a x",
"4.0-4.1": "a x",
"4.2-4.3": "a x",
"5.0-5.1": "a x",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "a x",
"2.2": "a x",
"2.3": "a x",
"3": "a x",
"4": "a x",
"4.1": "a x",
"4.2-4.3": "a x",
"4.4": "y"
},
"bb": {
"7": "a x",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "a x",
"11.1": "a x",
"11.5": "a x",
"12": "a x",
"12.1": "a x",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "In Firefox both the border-style and border-width must be specified for border-images to work. Partial support refers to supporting the shorthand syntax, but not the individual properties (border-image-source, border-image-slice, etc).",
"usage_perc_y": 54.86,
"usage_perc_a": 9.76,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"background-img-opts": {
"title": "CSS3 Background-image options",
"description": "New properties to affect background images, including background-clip, background-origin and background-size",
"spec": "http://www.w3.org/TR/css3-background/#backgrounds",
"status": "cr",
"links": [{
"url": "https://github.com/louisremi/background-size-polyfill",
"title": "Polyfill for IE7-8"
}, {
"url": "http://www.standardista.com/css3/css3-background-properties",
"title": "Detailed compatibility tables and demos"
}, {
"url": "http://www.css3files.com/background/",
"title": "Information page"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "a x",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "a",
"3.2": "a",
"4": "a",
"5": "y",
"5.1": "y",
"6": "a",
"6.1": "a",
"7": "a"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "a x",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "a",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "a"
},
"android": {
"2.1": "a x",
"2.2": "y x",
"2.3": "y x",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support in Opera Mini refers to not supporting background sizing or background attachments. Partial support in Safari 6 refers to not supporting background sizing offset from edges syntax.",
"usage_perc_y": 78.07,
"usage_perc_a": 7.32,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"css-table": {
"title": "CSS Table display",
"description": "Method of displaying elements as tables, rows, and cells",
"spec": "http://www.w3.org/TR/CSS21/tables.html",
"status": "rec",
"links": [{
"url": "http://blog.12spokes.com/web-design-development/when-to-choose-between-the-html-table-element-and-css-displaytable-property/",
"title": "Deciding on HTML or CSS tables"
}, {
"url": "http://www.onenaught.com/posts/201/use-css-displaytable-for-layout",
"title": "Blog post on usage"
}],
"categories": ["CSS2"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "y",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 93.86,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "display:table, display: table,table-cell,table-row,table-layout"
},
"css-gencontent": {
"title": "CSS Generated content",
"description": "Method of displaying text or images before or after the given element's contents using the :before and :after pseudo-elements",
"spec": "http://www.w3.org/TR/CSS21/generate.html",
"status": "rec",
"links": [{
"url": "http://www.westciv.com/style_master/academy/css_tutorial/advanced/generated_content.html",
"title": "Guide on usage"
}, {
"url": "http://docs.webplatform.org/wiki/css/generated_and_replaced_content",
"title": "WebPlatform Docs"
}, {
"url": "http://dev.opera.com/articles/view/css-generated-content-techniques/",
"title": "Dev.Opera article"
}],
"categories": ["CSS2", "CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "a",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "y",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "IE8 only supports the single-colon CSS 2.1 syntax (i.e. pseudo-class). It does not support the double-colon CSS3 syntax (i.e. pseudo-element)",
"usage_perc_y": 85.55,
"usage_perc_a": 8.31,
"ucprefix": false,
"parent": "",
"keywords": "before,after"
},
"css-fixed": {
"title": "CSS position:fixed",
"description": "Method of keeping an element in a fixed location regardless of scroll position",
"spec": "http://www.w3.org/TR/CSS21/visuren.html#fixed-positioning",
"status": "rec",
"links": [{
"url": "http://www.css-101.org/fixed-positioning/05.php",
"title": "Workaround for IE6"
}, {
"url": "http://bradfrostweb.com/blog/mobile/fixed-position/",
"title": "Article on mobile support"
}, {
"url": "http://docs.webplatform.org/wiki/css/properties/position",
"title": "WebPlatform Docs"
}],
"categories": ["CSS"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "y",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "a",
"6.0-6.1": "a",
"7.0": "a"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "a",
"2.2": "a",
"2.3": "a",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Only works in Android 2.2+ by using the following meta tag: <meta name=\"viewport\" content=\"width=device-width, user-scalable=no\">. Partial support in iOS Safari refers to <a href=\"http://remysharp.com/2012/05/24/issues-with-position-fixed-scrolling-on-ios/\">buggy behavior</a>.",
"usage_perc_y": 84.35,
"usage_perc_a": 5.39,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"hashchange": {
"title": "Hashchange event",
"description": "Event triggered in JavaScript when the URL's hash has changed (for example: page.html#foo to page.html#bar) ",
"spec": "http://www.w3.org/TR/html5/history.html#event-hashchange",
"status": "cr",
"links": [{
"url": "http://www.quirksmode.org/dom/events/tests/hashchange.html",
"title": "Simple demo"
}, {
"url": "http://docs.webplatform.org/wiki/dom/events/hashchange",
"title": "WebPlatform Docs"
}, {
"url": "https://developer.mozilla.org/en/DOM/window.onhashchange",
"title": "MDN article"
}, {
"url": "http://github.com/3nr1c/jUri.js",
"title": "Polyfill"
}, {
"url": "http://msdn.microsoft.com/en-us/library/cc288209(VS.85).aspx",
"title": "MSDN article"
}],
"categories": ["HTML5", "JS API"],
"stats": {
"ie": {
"5.5": "p",
"6": "p",
"7": "p",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "p",
"3": "p",
"3.5": "p",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "p",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "p",
"3.2": "p",
"4": "p",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "p",
"9.5-9.6": "p",
"10.0-10.1": "p",
"10.5": "p",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "p",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 88.92,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "onhashchange,HashChangeEvent"
},
"css-sel2": {
"title": "CSS 2.1 selectors",
"description": "Allows more accurate element selecting, using >, +, [attr], :first-child, etc.",
"spec": "http://www.w3.org/TR/CSS21/selector.html",
"status": "rec",
"links": [{
"url": "http://www.quirksmode.org/css/contents.html",
"title": "Detailed support information"
}, {
"url": "http://docs.webplatform.org/wiki/css/selectors",
"title": "WebPlatform Docs"
}, {
"url": "http://selectivizr.com",
"title": "Selectivizr: Polyfill for IE6-8"
}, {
"url": "http://www.yourhtmlsource.com/stylesheets/advancedselectors.html",
"title": "Examples of advanced selectors"
}],
"categories": ["CSS2"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "y",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 94.36,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "child selector,:hover,adjacent,sibling,adjacent sibling"
},
"css-sel3": {
"title": "CSS3 selectors",
"description": "Advanced element selection using selectors like :nth-child(), :last-child, :first-of-type, etc.",
"spec": "http://www.w3.org/TR/css3-selectors/",
"status": "rec",
"links": [{
"url": "http://www.css3.info/selectors-test/",
"title": "Automated CSS3 selector test"
}, {
"url": "http://docs.webplatform.org/wiki/css/selectors",
"title": "WebPlatform Docs"
}, {
"url": "http://www.quirksmode.org/css/contents.html",
"title": "Detailed support information"
}, {
"url": "http://selectivizr.com",
"title": "Selectivizr: Polyfill for IE6-8"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 85.43,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ":target,:not"
},
"css-textshadow": {
"title": "CSS3 Text-shadow",
"description": "Method of applying one or more shadow or blur effects to text",
"spec": "http://www.w3.org/TR/css-text-decor-3/#text-shadow-property",
"status": "wd",
"links": [{
"url": "http://ie.microsoft.com/testdrive/Graphics/hands-on-css3/hands-on_text-shadow.htm",
"title": "Live editor"
}, {
"url": "http://docs.webplatform.org/wiki/css/properties/text-shadow",
"title": "WebPlatform Docs"
}, {
"url": "http://hacks.mozilla.org/2009/06/text-shadow/",
"title": "Mozilla hacks article"
}, {
"url": "http://www.css3files.com/shadow/#textshadow",
"title": "Information page"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "a",
"3.2": "a",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "a"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "a",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Opera Mini ignores the blur-radius set, so no blur effect is visible. Text-shadow behavior can be somewhat emulated in older IE versions using the non-standard \"dropshadow\" or \"glow\" filters. ",
"usage_perc_y": 75.49,
"usage_perc_a": 4.73,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"css-boxshadow": {
"title": "CSS3 Box-shadow",
"description": "Method of displaying an inner or outer shadow effect to elements",
"spec": "http://www.w3.org/TR/css3-background/#box-shadow",
"status": "cr",
"links": [{
"url": "http://www.css3files.com/shadow/",
"title": "Information page"
}, {
"url": "https://developer.mozilla.org/En/CSS/-moz-box-shadow",
"title": "MDN article"
}, {
"url": "http://westciv.com/tools/boxshadows/index.html",
"title": "Live editor"
}, {
"url": "http://tests.themasta.com/blogstuff/boxshadowdemo.html",
"title": "Demo of various effects"
}, {
"url": "http://docs.webplatform.org/wiki/css/properties/box-shadow",
"title": "WebPlatform Docs"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "y x",
"3.6": "y x",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "a x",
"3.2": "a x",
"4": "a x",
"5": "y x",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "a x",
"4.0-4.1": "y x",
"4.2-4.3": "y x",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "a x",
"2.2": "a x",
"2.3": "a x",
"3": "a x",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y x",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Can be partially emulated in older IE versions using the non-standard \"shadow\" filter. Partial support in Safari, iOS Safari and Android Browser refers to missing \"inset\" and blur radius value support.",
"usage_perc_y": 79.27,
"usage_perc_a": 1.55,
"ucprefix": false,
"parent": "",
"keywords": "box-shadows,boxshadows,box shadow,shaow"
},
"css3-colors": {
"title": "CSS3 Colors",
"description": "Method of describing colors using Hue, Saturation and Lightness (hsl()) rather than just RGB, as well as allowing alpha-transparency with rgba() and hsla().",
"spec": "http://www.w3.org/TR/css3-color/",
"status": "rec",
"links": [{
"url": "http://www.zenelements.com/blog/css3-rgb-rgba-color-opacity/",
"title": "Guide to RGB & RGBA"
}, {
"url": "http://www.css3files.com/color/",
"title": "Information page"
}, {
"url": "http://www.zenelements.com/blog/css3-hsl-hsla-color-opacity/",
"title": "Guide to HSL & HSLA"
}, {
"url": "http://docs.webplatform.org/wiki/css/color#RGBA_Notation",
"title": "WebPlatform Docs"
}, {
"url": "http://dev.opera.com/articles/view/color-in-opera-10-hsl-rgb-and-alpha-transparency/",
"title": "Dev.Opera article"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "a",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "a",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 85.51,
"usage_perc_a": 0.02,
"ucprefix": false,
"parent": "",
"keywords": "rgb,hsl,rgba,hsla"
},
"css3-boxsizing": {
"title": "CSS3 Box-sizing",
"description": "Method of specifying whether or not an element's borders and padding should be included in size units",
"spec": "http://www.w3.org/TR/css3-ui/#box-sizing",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/properties/box-sizing",
"title": "WebPlatform Docs"
}, {
"url": "http://css-tricks.com/box-sizing/",
"title": "CSS Tricks"
}, {
"url": "https://github.com/Schepp/box-sizing-polyfill",
"title": "Polyfill for IE"
}, {
"url": "https://developer.mozilla.org/En/CSS/Box-sizing",
"title": "MDN article"
}, {
"url": "http://www.456bereastreet.com/archive/201104/controlling_width_with_css3_box-sizing/",
"title": "Blog post"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "p",
"6": "p",
"7": "p",
"8": "a",
"9": "a",
"10": "a",
"11": "a"
},
"firefox": {
"2": "y x",
"3": "y x",
"3.5": "y x",
"3.6": "y x",
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x"
},
"chrome": {
"4": "a x",
"5": "a x",
"6": "a x",
"7": "a x",
"8": "a x",
"9": "a x",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a",
"28": "a",
"29": "a",
"30": "a",
"31": "a",
"32": "a"
},
"safari": {
"3.1": "a x",
"3.2": "a x",
"4": "a x",
"5": "a x",
"5.1": "a",
"6": "a",
"6.1": "a",
"7": "a"
},
"opera": {
"9": "n",
"9.5-9.6": "a",
"10.0-10.1": "a",
"10.5": "a",
"10.6": "a",
"11": "a",
"11.1": "a",
"11.5": "a",
"11.6": "a",
"12": "a",
"12.1": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a"
},
"ios_saf": {
"3.2": "a x",
"4.0-4.1": "a x",
"4.2-4.3": "a x",
"5.0-5.1": "a",
"6.0-6.1": "a",
"7.0": "a"
},
"op_mini": {
"5.0-7.0": "a"
},
"android": {
"2.1": "a x",
"2.2": "a x",
"2.3": "a x",
"3": "a x",
"4": "a",
"4.1": "a",
"4.2-4.3": "a",
"4.4": "a"
},
"bb": {
"7": "a x",
"10": "a"
},
"op_mob": {
"10": "a",
"11": "a",
"11.1": "a",
"11.5": "a",
"12": "a",
"12.1": "a",
"0": "a"
},
"and_chr": {
"0": "a"
},
"and_ff": {
"0": "y x"
},
"ie_mob": {
"10": "a"
}
},
"notes": "Partial support refers to supporting only the \"border-box\" value, not \"padding-box\" (which was added to the spec later).",
"usage_perc_y": 15.43,
"usage_perc_a": 78.42,
"ucprefix": false,
"parent": "",
"keywords": "border-box,content-box,padding-box"
},
"css-mediaqueries": {
"title": "CSS3 Media Queries",
"description": "Method of applying styles based on media information. Includes things like page and device dimensions",
"spec": "http://www.w3.org/TR/css3-mediaqueries/",
"status": "rec",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/atrules/@media",
"title": "WebPlatform Docs"
}, {
"url": "http://ie.microsoft.com/testdrive/HTML5/85CSS3_MediaQueries/",
"title": "IE demo page with information"
}, {
"url": "https://github.com/scottjehl/Respond",
"title": "Polyfill for IE"
}, {
"url": "http://webdesignerwall.com/tutorials/responsive-design-with-css3-media-queries",
"title": "Media Queries tutorial"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "p",
"6": "p",
"7": "p",
"8": "p",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "a",
"3.2": "a",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Incomplete support by older webkit browsers refers to only acknowledging different media rules on page reload",
"usage_perc_y": 85.42,
"usage_perc_a": 0.01,
"ucprefix": false,
"parent": "",
"keywords": "@media"
},
"multicolumn": {
"title": "CSS3 Multiple column layout",
"description": "Method of flowing information in multiple columns",
"spec": "http://www.w3.org/TR/css3-multicol/",
"status": "cr",
"links": [{
"url": "http://dev.opera.com/articles/view/css3-multi-column-layout/",
"title": "Dev.Opera article"
}, {
"url": "http://docs.webplatform.org/wiki/css/properties/column-width",
"title": "WebPlatform Docs"
}, {
"url": "http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/an-introduction-to-the-css3-multiple-column-layout-module/",
"title": "Introduction page"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "a x",
"3": "a x",
"3.5": "a x",
"3.6": "a x",
"4": "a x",
"5": "a x",
"6": "a x",
"7": "a x",
"8": "a x",
"9": "a x",
"10": "a x",
"11": "a x",
"12": "a x",
"13": "a x",
"14": "a x",
"15": "a x",
"16": "a x",
"17": "a x",
"18": "a x",
"19": "a x",
"20": "a x",
"21": "a x",
"22": "a x",
"23": "a x",
"24": "a x",
"25": "a x",
"26": "a x",
"27": "a x"
},
"chrome": {
"4": "a x",
"5": "a x",
"6": "a x",
"7": "a x",
"8": "a x",
"9": "a x",
"10": "a x",
"11": "a x",
"12": "a x",
"13": "a x",
"14": "a x",
"15": "a x",
"16": "a x",
"17": "a x",
"18": "a x",
"19": "a x",
"20": "a x",
"21": "a x",
"22": "a x",
"23": "a x",
"24": "a x",
"25": "a x",
"26": "a x",
"27": "a x",
"28": "a x",
"29": "a x",
"30": "a x",
"31": "a x",
"32": "a x"
},
"safari": {
"3.1": "a x",
"3.2": "a x",
"4": "a x",
"5": "a x",
"5.1": "a x",
"6": "a x",
"6.1": "a x",
"7": "a x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "a x",
"16": "a x",
"17": "a x",
"18": "a x"
},
"ios_saf": {
"3.2": "a x",
"4.0-4.1": "a x",
"4.2-4.3": "a x",
"5.0-5.1": "a x",
"6.0-6.1": "a x",
"7.0": "a x"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "a x",
"2.2": "a x",
"2.3": "a x",
"3": "a x",
"4": "a x",
"4.1": "a x",
"4.2-4.3": "a x",
"4.4": "a x"
},
"bb": {
"7": "a x",
"10": "a x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "a x"
},
"and_chr": {
"0": "a x"
},
"and_ff": {
"0": "a x"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support refers to not supporting the break-before, break-after, break-inside properties. Webkit browsers do have equivalent support for the non-standard -webkit-column-break-* properties.",
"usage_perc_y": 16.41,
"usage_perc_a": 63.85,
"ucprefix": false,
"parent": "",
"keywords": "column-count"
},
"border-radius": {
"title": "CSS3 Border-radius (rounded corners)",
"description": "Method of making the border corners round",
"spec": "http://www.w3.org/TR/css3-background/#the-border-radius",
"status": "cr",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/properties/border-radius",
"title": "WebPlatform Docs"
}, {
"url": "http://muddledramblings.com/table-of-css3-border-radius-compliance",
"title": "Detailed compliance table"
}, {
"url": "http://www.css3files.com/border/#borderradius",
"title": "Information page"
}, {
"url": "http://css3pie.com/",
"title": "Polyfill which includes border-radius"
}, {
"url": "http://border-radius.com",
"title": "Border-radius CSS Generator"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "a x",
"3": "y x",
"3.5": "y x",
"3.6": "y x",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y x",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y x",
"3.2": "y x",
"4": "y x",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y x",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y x",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 80.91,
"usage_perc_a": 0.02,
"ucprefix": false,
"parent": "",
"keywords": "roundedcorners, border radius,-moz-border-radius"
},
"transforms2d": {
"title": "CSS3 Transforms",
"description": "Method of transforming an element including rotating, scaling, etc.",
"spec": "http://www.w3.org/TR/css3-2d-transforms/",
"status": "wd",
"links": [{
"url": "http://www.westciv.com/tools/transforms/",
"title": "Live editor"
}, {
"url": "http://www.useragentman.com/IETransformsTranslator/",
"title": "Converter for IE"
}, {
"url": "http://docs.webplatform.org/wiki/css/transforms/transform",
"title": "WebPlatform Docs"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/css.js#css-transform",
"title": "has.js test"
}, {
"url": "https://developer.mozilla.org/en/CSS/-moz-transform",
"title": "MDN article"
}, {
"url": "http://www.webresourcesdepot.com/cross-browser-css-transforms-csssandpaper/",
"title": "Workaround script for IE"
}, {
"url": "http://www.css3files.com/transform/",
"title": "Information page"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "y x",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "y x",
"3.6": "y x",
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "y x",
"3.2": "y x",
"4": "y x",
"5": "y x",
"5.1": "y x",
"6": "y x",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "y x",
"10.6": "y x",
"11": "y x",
"11.1": "y x",
"11.5": "y x",
"11.6": "y x",
"12": "y x",
"12.1": "y",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x"
},
"ios_saf": {
"3.2": "y x",
"4.0-4.1": "y x",
"4.2-4.3": "y x",
"5.0-5.1": "y x",
"6.0-6.1": "y x",
"7.0": "y x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y x",
"2.2": "y x",
"2.3": "y x",
"3": "y x",
"4": "y x",
"4.1": "y x",
"4.2-4.3": "y x",
"4.4": "y x"
},
"bb": {
"7": "y x",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y x"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "The scale transform can be emulated in IE < 9 using Microsoft's \"zoom\" extension, others are (not easily) possible using the MS Matrix filter",
"usage_perc_y": 80.82,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "transformation,translate,rotation,rotate,scale,css-transforms"
},
"use-strict": {
"title": "ECMAScript 5 Strict Mode",
"description": "Method of placing code in a \"strict\" operating context.",
"spec": "http://ecma-international.org/ecma-262/5.1/#sec-14.1",
"status": "other",
"links": [{
"url": "http://javascriptweblog.wordpress.com/2011/05/03/javascript-strict-mode/",
"title": "Article with test suite"
}, {
"url": "http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/",
"title": "Information page"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "a",
"5.1": "a",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support in older Safari refers to strict mode still accepting a lot of JS that should be considered invalid.",
"usage_perc_y": 71.65,
"usage_perc_a": 1.59,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"transforms3d": {
"title": "CSS3 3D Transforms",
"description": "Method of transforming an element in the third dimension",
"spec": "http://www.w3.org/TR/css3-3d-transforms/",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/transforms/transform",
"title": "WebPlatform Docs"
}, {
"url": "http://css3.bradshawenterprises.com/flip/",
"title": "Multi-browser demo"
}, {
"url": "http://thewebrocks.com/demos/3D-css-tester/",
"title": "3D CSS Tester"
}, {
"url": "http://hacks.mozilla.org/2011/10/css-3d-transformations-in-firefox-nightly/",
"title": "Mozilla hacks article"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/css.js#css-transform",
"title": "has.js test"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "a",
"11": "a"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "y x",
"5": "y x",
"5.1": "y x",
"6": "y x",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x"
},
"ios_saf": {
"3.2": "y x",
"4.0-4.1": "y x",
"4.2-4.3": "y x",
"5.0-5.1": "y x",
"6.0-6.1": "y x",
"7.0": "y x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "y x",
"4": "y x",
"4.1": "y x",
"4.2-4.3": "y x",
"4.4": "y x"
},
"bb": {
"7": "y x",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y x"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "a"
}
},
"notes": "Partial support in IE10 refers to not supporting <a href=\"http://msdn.microsoft.com/en-us/library/ie/hh673529%28v=vs.85%29.aspx#the_ms_transform_style_property\">the transform-style: preserve-3d property</a>. This prevents nesting 3D transformed elements.",
"usage_perc_y": 61.31,
"usage_perc_a": 11.11,
"ucprefix": false,
"parent": "",
"keywords": "css 3d,3dtransforms,translate3d,transform3d"
},
"sharedworkers": {
"title": "Shared Web Workers",
"description": "Method of allowing multiple scripts to communicate with a single web worker.",
"spec": "http://www.w3.org/TR/workers/#shared-workers-introduction",
"status": "cr",
"links": [{
"url": "http://www.sitepoint.com/javascript-shared-web-workers-html5/",
"title": "Sitepoint article"
}, {
"url": "http://greenido.wordpress.com/2011/11/03/web-workers-part-3-out-of-3-shared-wrokers/",
"title": "Blog post"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "u",
"27": "u"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "u",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "n"
},
"and_chr": {
"0": "n"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Expected to be supported in Firefox 27.",
"usage_perc_y": 40.07,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "webworkers",
"keywords": "shared worker"
},
"css-hyphens": {
"title": "CSS Hyphenation",
"description": "Method of controlling when words at the end of lines should be hyphenated using the \"hyphens\" property.",
"spec": "http://www.w3.org/TR/css3-text/#hyphenation",
"status": "wd",
"links": [{
"url": "https://developer.mozilla.org/en/CSS/hyphens",
"title": "MDN article"
}, {
"url": "http://docs.webplatform.org/wiki/css/properties/hyphens",
"title": "WebPlatform Docs"
}, {
"url": "http://blog.fontdeck.com/post/9037028497/hyphens",
"title": "Blog post"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y x",
"11": "y x"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n",
"28": "n",
"29": "n",
"30": "n",
"31": "n",
"32": "n"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "y x",
"6": "y x",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "y x",
"5.0-5.1": "y x",
"6.0-6.1": "y x",
"7.0": "y x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "n"
},
"and_chr": {
"0": "n"
},
"and_ff": {
"0": "y x"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Chrome 29- and Android 4.0 Browser support \"-webkit-hyphens: none\", but not the \"auto\" property. Chrome 30+ doesn't support it either.",
"usage_perc_y": 33.31,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "hyphen,shy"
},
"css-transitions": {
"title": "CSS3 Transitions",
"description": "Simple method of animating certain properties of an element",
"spec": "http://www.w3.org/TR/css3-transitions/",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/properties/transition",
"title": "WebPlatform Docs"
}, {
"url": "http://www.webdesignerdepot.com/2010/01/css-transitions-101/",
"title": "Article on usage"
}, {
"url": "http://www.opera.com/docs/specs/presto2.12/css/transitions/#anima",
"title": "Animation of property types support in Opera"
}, {
"url": "http://www.css3files.com/transition/",
"title": "Information page"
}, {
"url": "http://www.the-art-of-web.com/css/timing-function/",
"title": "Examples on timing functions"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y x",
"3.2": "y x",
"4": "y x",
"5": "y x",
"5.1": "y x",
"6": "y x",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "y x",
"10.6": "y x",
"11": "y x",
"11.1": "y x",
"11.5": "y x",
"11.6": "y x",
"12": "y x",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y x",
"4.0-4.1": "y x",
"4.2-4.3": "y x",
"5.0-5.1": "y x",
"6.0-6.1": "y x",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y x",
"2.2": "y x",
"2.3": "y x",
"3": "y x",
"4": "y x",
"4.1": "y x",
"4.2-4.3": "y x",
"4.4": "y"
},
"bb": {
"7": "y x",
"10": "y x"
},
"op_mob": {
"10": "y x",
"11": "y x",
"11.1": "y x",
"11.5": "y x",
"12": "y x",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 75.27,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "css transition"
},
"font-feature": {
"title": "Font feature settings",
"description": "Method of applying advanced typographic and language-specific font features to supported OpenType fonts.",
"spec": "http://w3.org/TR/css3-fonts/#font-rend-props",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/properties/font-feature-settings",
"title": "WebPlatform Docs"
}, {
"url": "http://hacks.mozilla.org/2010/11/firefox-4-font-feature-support/",
"title": "Mozilla hacks article"
}, {
"url": "http://html5accessibility.com/",
"title": "Detailed tables on accessability support"
}, {
"url": "http://ie.microsoft.com/testdrive/Graphics/opentype/",
"title": "Demo pages (IE/Firefox only)"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "a x",
"5": "a x",
"6": "a x",
"7": "a x",
"8": "a x",
"9": "a x",
"10": "a x",
"11": "a x",
"12": "a x",
"13": "a x",
"14": "a x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "a x",
"17": "a x",
"18": "a x",
"19": "a x",
"20": "a x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "a",
"5": "a",
"5.1": "a",
"6": "a",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x"
},
"ios_saf": {
"3.2": "a",
"4.0-4.1": "a",
"4.2-4.3": "a",
"5.0-5.1": "a",
"6.0-6.1": "a",
"7.0": "y x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y x"
},
"bb": {
"7": "n",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y x"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "y x"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Partial support in older Firefox versions refers to using an older syntax. Partial support in older Chrome versions refers to lacking support in Mac OS X. ",
"usage_perc_y": 62.13,
"usage_perc_a": 6.41,
"ucprefix": false,
"parent": "",
"keywords": "font-feature,font-feature-settings,kern,kerning,font-variant-alternates,ligatures,font-variant-ligatures"
},
"css-animation": {
"title": "CSS3 Animation",
"description": "Complex method of animating certain properties of an element",
"spec": "http://www.w3.org/TR/css3-animations/",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/properties/animations",
"title": "WebPlatform Docs"
}, {
"url": "http://www.css3files.com/animation/",
"title": "Information page"
}, {
"url": "http://robertnyman.com/2010/05/06/css3-animations/",
"title": "Blog post on usage"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "y x",
"5": "y x",
"5.1": "y x",
"6": "y x",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "y x",
"12.1": "y",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x"
},
"ios_saf": {
"3.2": "y x",
"4.0-4.1": "y x",
"4.2-4.3": "y x",
"5.0-5.1": "y x",
"6.0-6.1": "y x",
"7.0": "y x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "a x",
"2.2": "a x",
"2.3": "a x",
"3": "a x",
"4": "y x",
"4.1": "y x",
"4.2-4.3": "y x",
"4.4": "y x"
},
"bb": {
"7": "y x",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "y",
"0": "y x"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support in Android browser refers to buggy behavior in different scenarios.",
"usage_perc_y": 73.62,
"usage_perc_a": 1.44,
"ucprefix": false,
"parent": "",
"keywords": "animations,css-animations,keyframe,keyframes"
},
"css-gradients": {
"title": "CSS Gradients",
"description": "Method of defining a linear or radial color gradient as a CSS image.",
"spec": "http://www.w3.org/TR/css3-images/",
"status": "cr",
"links": [{
"url": "http://www.colorzilla.com/gradient-editor/",
"title": "Cross-browser editor"
}, {
"url": "http://docs.webplatform.org/wiki/css/functions/linear-gradient",
"title": "WebPlatform Docs"
}, {
"url": "http://www.css3files.com/gradient/",
"title": "Information page"
}, {
"url": "http://css3pie.com/",
"title": "Tool to emulate support in IE"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "y x",
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "a x",
"5": "a x",
"6": "a x",
"7": "a x",
"8": "a x",
"9": "a x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "a x",
"5": "a x",
"5.1": "y x",
"6": "y x",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "a x",
"11.5": "a x",
"11.6": "y x",
"12": "y x",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "a x",
"4.0-4.1": "a x",
"4.2-4.3": "a x",
"5.0-5.1": "y x",
"6.0-6.1": "y x",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "a x",
"2.2": "a x",
"2.3": "a x",
"3": "a x",
"4": "y x",
"4.1": "y x",
"4.2-4.3": "y x",
"4.4": "y"
},
"bb": {
"7": "a x",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "a x",
"11.5": "a x",
"12": "y x",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support in Opera 11.10 and 11.50 also refers to only having support for linear gradients. Support can be somewhat emulated in older IE versions using the non-standard \"gradient\" filter. Firefox 10+, Opera 11.6+, Chrome 26+ and IE10 also support the new \"to (side)\" syntax.",
"usage_perc_y": 73.31,
"usage_perc_a": 2.22,
"ucprefix": false,
"parent": "",
"keywords": "linear,linear-gradient,gradiant"
},
"css-canvas": {
"title": "CSS Canvas Drawings",
"description": "Method of using HTML5 Canvas as a background image",
"spec": "http://webkit.org/blog/176/css-canvas-drawing/",
"status": "unoff",
"links": [{
"url": "http://webkit.org/blog/176/css-canvas-drawing/",
"title": "Webkit blog post"
}],
"categories": ["CSS"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "u",
"27": "u"
},
"chrome": {
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "y x",
"5": "y x",
"5.1": "y x",
"6": "y x",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x"
},
"ios_saf": {
"3.2": "y x",
"4.0-4.1": "y x",
"4.2-4.3": "y x",
"5.0-5.1": "y x",
"6.0-6.1": "y x",
"7.0": "y x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y x",
"2.2": "y x",
"2.3": "y x",
"3": "y x",
"4": "y x",
"4.1": "y x",
"4.2-4.3": "y x",
"4.4": "y x"
},
"bb": {
"7": "y x",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y x"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Proposal by Webkit, being considered for W3C standardization. A similar effect can be achieved in Firefox 4+ using the -moz-element() background property",
"usage_perc_y": 48.41,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"css-reflections": {
"title": "CSS Reflections",
"description": "Method of displaying a reflection of an element",
"spec": "http://webkit.org/blog/182/css-reflections/",
"status": "unoff",
"links": [{
"url": "http://webkit.org/blog/182/css-reflections/",
"title": "Webkit blog post"
}],
"categories": ["CSS"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n"
},
"chrome": {
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "y x",
"5": "y x",
"5.1": "y x",
"6": "y x",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x"
},
"ios_saf": {
"3.2": "y x",
"4.0-4.1": "y x",
"4.2-4.3": "y x",
"5.0-5.1": "y x",
"6.0-6.1": "y x",
"7.0": "y x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y x",
"2.2": "y x",
"2.3": "y x",
"3": "y x",
"4": "y x",
"4.1": "y x",
"4.2-4.3": "y x",
"4.4": "y x"
},
"bb": {
"7": "y x",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y x"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Similar effect can be achieved in Firefox 4+ using the -moz-element() background property",
"usage_perc_y": 48.41,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "box-reflect"
},
"css-masks": {
"title": "CSS Masks",
"description": "Method of displaying part of an element, using a selected image as a mask",
"spec": "http://www.w3.org/TR/css-masking/",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/properties/mask",
"title": "WebPlatform Docs"
}, {
"url": "http://www.html5rocks.com/en/tutorials/masking/adobe/",
"title": "HTML5 Rocks article"
}, {
"url": "http://thenittygritty.co/css-masking",
"title": "Detailed blog post"
}],
"categories": ["CSS"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "u",
"27": "u"
},
"chrome": {
"4": "a x",
"5": "a x",
"6": "a x",
"7": "a x",
"8": "a x",
"9": "a x",
"10": "a x",
"11": "a x",
"12": "a x",
"13": "a x",
"14": "a x",
"15": "a x",
"16": "a x",
"17": "a x",
"18": "a x",
"19": "a x",
"20": "a x",
"21": "a x",
"22": "a x",
"23": "a x",
"24": "a x",
"25": "a x",
"26": "a x",
"27": "a x",
"28": "a x",
"29": "a x",
"30": "a x",
"31": "a x",
"32": "a x"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "a x",
"5": "a x",
"5.1": "a x",
"6": "a x",
"6.1": "a x",
"7": "a x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "a x",
"16": "a x",
"17": "a x",
"18": "a x"
},
"ios_saf": {
"3.2": "a x",
"4.0-4.1": "a x",
"4.2-4.3": "a x",
"5.0-5.1": "a x",
"6.0-6.1": "a x",
"7.0": "a x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "a x",
"2.2": "a x",
"2.3": "a x",
"3": "a x",
"4": "a x",
"4.1": "a x",
"4.2-4.3": "a x",
"4.4": "a x"
},
"bb": {
"7": "a x",
"10": "a x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "a x"
},
"and_chr": {
"0": "a x"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Previously a WebKit-only property, now a W3C specification. Partial support refers to not yet fully supporting the new spec (details currently unknown).",
"usage_perc_y": 0,
"usage_perc_a": 48.41,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"svg": {
"title": "SVG (basic support)",
"description": "Method of displaying basic Vector Graphics features using the embed or object elements",
"spec": "http://www.w3.org/Graphics/SVG/",
"status": "rec",
"links": [{
"url": "http://en.wikipedia.org/wiki/Scalable_Vector_Graphics",
"title": "Wikipedia"
}, {
"url": "http://code.google.com/p/svgweb/",
"title": "SVG Web: Flash-based polyfill"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/graphics.js#svg",
"title": "has.js test"
}, {
"url": "http://svg-edit.googlecode.com",
"title": "Web-based SVG editor"
}, {
"url": "http://www.alistapart.com/articles/using-svg-for-flexible-scalable-and-fun-backgrounds-part-i",
"title": "A List Apart article"
}, {
"url": "http://svg-wow.org/",
"title": "SVG showcase site"
}],
"categories": ["SVG"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "a",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "a",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 84.1,
"usage_perc_a": 0.02,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"svg-css": {
"title": "SVG in CSS backgrounds",
"description": "Method of using SVG images as CSS backgrounds",
"spec": "http://www.w3.org/TR/css3-background/#background-image",
"status": "cr",
"links": [{
"url": "http://designfestival.com/a-farewell-to-css3-gradients/",
"title": "Tutorial for advanced effects"
}],
"categories": ["SVG", "CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "a",
"5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "a",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "a",
"4": "a",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "a",
"4.0-4.1": "a",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "a"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "a",
"11": "a",
"11.1": "a",
"11.5": "a",
"12": "a",
"12.1": "a",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support in older Firefox and Opera Mini/Mobile refers to SVG images being blurry when scaled. Partial support in iOS Safari and older Safari versions refers to failing to support tiling or the background-position property.",
"usage_perc_y": 75.45,
"usage_perc_a": 8.2,
"ucprefix": false,
"parent": "",
"keywords": "svg-in-css,svgincss,css-svg"
},
"svg-smil": {
"title": "SVG SMIL animation",
"description": "Method of using animation elements to animate SVG images",
"spec": "http://www.w3.org/TR/SVG/animate.html",
"status": "rec",
"links": [{
"url": "https://github.com/madsgraphics/SVGEventListener",
"title": "Polyfill for SMIL animate events on SVG"
}, {
"url": "https://developer.mozilla.org/en/SVG/SVG_animation_with_SMIL",
"title": "MDN article"
}, {
"url": "http://svg-wow.org/blog/category/animation/",
"title": "Examples on SVG WOW"
}, {
"url": "http://leunen.me/fakesmile/",
"title": "JS library to support SMIL in SVG"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/graphics.js#svg-smil",
"title": "has.js test"
}],
"categories": ["SVG"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "p",
"10": "p",
"11": "p"
},
"firefox": {
"2": "p",
"3": "p",
"3.5": "p",
"3.6": "p",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "a",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "p",
"3.2": "p",
"4": "a",
"5": "a",
"5.1": "a",
"6": "a",
"6.1": "a",
"7": "a"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "a",
"4.0-4.1": "a",
"4.2-4.3": "a",
"5.0-5.1": "a",
"6.0-6.1": "a",
"7.0": "a"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "p"
}
},
"notes": "Partial support in Safari refers to not working in HTML files.",
"usage_perc_y": 54.76,
"usage_perc_a": 7.99,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"svg-fonts": {
"title": "SVG fonts",
"description": "Method of using fonts defined as SVG shapes",
"spec": "http://www.w3.org/TR/SVG/fonts.html",
"status": "rec",
"links": [{
"url": "http://opentype.info/blog/2010/04/13/the-ipad-and-svg-fonts-in-mobile-safari/",
"title": "Blog post on usage for iPad"
}, {
"url": "http://jeremie.patonnier.net/post/2011/02/07/Why-are-SVG-Fonts-so-different",
"title": "Blog post"
}],
"categories": ["SVG"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Supported in Opera Mini in SVG images only, not in HTML.",
"usage_perc_y": 47.78,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "fontface",
"keywords": ""
},
"svg-filters": {
"title": "SVG filters",
"description": "Method of using photoshop-like effects on SVG objects including blurring and color manipulation.",
"spec": "http://www.w3.org/TR/SVG/filters.html",
"status": "rec",
"links": [{
"url": "http://electricbeach.org/?p=950",
"title": "Experiments with filter effects"
}, {
"url": "http://svg-wow.org/blog/category/filters/",
"title": "SVG filter demos"
}, {
"url": "http://docs.webplatform.org/wiki/svg/elements/filter",
"title": "WebPlatform Docs"
}],
"categories": ["SVG"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "a",
"6": "a",
"7": "a",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 72.99,
"usage_perc_a": 0.08,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"svg-html": {
"title": "SVG effects for HTML",
"description": "Method of using SVG transforms, filters, etc on HTML elements using either CSS or the foreignObject element",
"spec": "http://www.w3.org/TR/SVG11/extend.html#ForeignObjectElement",
"status": "wd",
"links": [{
"url": "https://developer.mozilla.org/En/Applying_SVG_effects_to_HTML_content",
"title": "MDN Reference page"
}, {
"url": "https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html",
"title": "Filter Effects draft"
}, {
"url": "https://developer.mozilla.org/en/SVG/Tutorial/Other_content_in_SVG",
"title": "MDN Tutorial"
}],
"categories": ["SVG"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "a",
"10": "a",
"11": "a"
},
"firefox": {
"2": "n",
"3": "a",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "a",
"5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a",
"28": "a",
"29": "a",
"30": "a",
"31": "a",
"32": "a"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "a",
"5": "a",
"5.1": "a",
"6": "a",
"6.1": "a",
"7": "a"
},
"opera": {
"9": "a",
"9.5-9.6": "a",
"10.0-10.1": "a",
"10.5": "a",
"10.6": "a",
"11": "a",
"11.1": "a",
"11.5": "a",
"11.6": "a",
"12": "a",
"12.1": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a"
},
"ios_saf": {
"3.2": "a",
"4.0-4.1": "a",
"4.2-4.3": "a",
"5.0-5.1": "a",
"6.0-6.1": "a",
"7.0": "a"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "a"
},
"bb": {
"7": "n",
"10": "y"
},
"op_mob": {
"10": "a",
"11": "a",
"11.1": "a",
"11.5": "a",
"12": "a",
"12.1": "a",
"0": "a"
},
"and_chr": {
"0": "a"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Partial support refers to lack of filter support or buggy result from effects. A <a href=\"https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html\">CSS Filter Effects</a> specification is in the works that would replace this method.",
"usage_perc_y": 15.33,
"usage_perc_a": 60.21,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"svg-html5": {
"title": "Inline SVG in HTML5",
"description": "Method of using SVG tags directly in HTML documents. Requires HTML5 parser.",
"spec": "http://www.w3.org/TR/html5/embedded-content-0.html#svg-0",
"status": "cr",
"links": [{
"url": "http://hacks.mozilla.org/2010/05/firefox-4-the-html5-parser-inline-svg-speed-and-more/",
"title": "Mozilla Hacks blog post"
}, {
"url": "http://samples.msdn.microsoft.com/ietestcenter/html5/svghtml_harness.htm?url=SVG_HTML_Elements_001",
"title": "Test suite"
}],
"categories": ["SVG", "HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "p",
"3": "p",
"3.5": "p",
"3.6": "p",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "p",
"5": "p",
"6": "p",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "p",
"3.2": "p",
"4": "p",
"5": "p",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "p",
"9.5-9.6": "p",
"10.0-10.1": "p",
"10.5": "p",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "p",
"4.0-4.1": "p",
"4.2-4.3": "p",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "p",
"11": "p",
"11.1": "p",
"11.5": "p",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 78.45,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"canvas": {
"title": "Canvas (basic support)",
"description": "Method of generating fast, dynamic graphics using JavaScript",
"spec": "http://www.w3.org/TR/html5/embedded-content-0.html#the-canvas-element",
"status": "cr",
"links": [{
"url": "https://developer.mozilla.org/en/Canvas_tutorial",
"title": "Tutorial by Mozilla"
}, {
"url": "http://explorercanvas.googlecode.com/",
"title": "Implementation for Internet Explorer"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/graphics.js#canvas",
"title": "has.js test"
}, {
"url": "http://www.diveinto.org/html5/canvas.html",
"title": "Another tutorial"
}, {
"url": "http://glimr.rubyforge.org/cake/canvas.html",
"title": "Animation kit "
}, {
"url": "http://www.canvasdemos.com/",
"title": "Showcase site"
}],
"categories": ["Canvas", "HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "y",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "a"
},
"android": {
"2.1": "a",
"2.2": "a",
"2.3": "a",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Opera Mini supports the canvas element, but is unable to play animations or run other more complex applications. Android 2.x supports canvas except the toDataURL() function. See http://code.google.com/p/android/issues/detail?id=7901 Some (slow) workarounds are described here: http://stackoverflow.com/q/10488033/841830",
"usage_perc_y": 79.53,
"usage_perc_a": 6.02,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"canvas-text": {
"title": "Text API for Canvas",
"description": "Method of displaying text on Canvas elements",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#text-0",
"status": "wd",
"links": [{
"url": "http://code.google.com/p/canvas-text/",
"title": "Support library"
}, {
"url": "http://docs.webplatform.org/wiki/apis/canvas/CanvasRenderingContext2D/fillText",
"title": "WebPlatform Docs"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/graphics.js#canvas-text",
"title": "has.js test"
}, {
"url": "https://developer.mozilla.org/en/Drawing_text_using_a_canvas#Additional_examples",
"title": "Examples by Mozilla"
}],
"categories": ["Canvas", "HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "p",
"3": "p",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "p",
"3.2": "p",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "p",
"9.5-9.6": "p",
"10.0-10.1": "p",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "p",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 80.82,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "canvas",
"keywords": ""
},
"namevalue-storage": {
"title": "Web Storage - name/value pairs",
"description": "Method of storing data locally like cookies, but for larger amounts of data (sessionStorage and localStorage, used to fall under HTML5).",
"spec": "http://www.w3.org/TR/webstorage/#storage",
"status": "rec",
"links": [{
"url": "http://html5demos.com/storage",
"title": "Simple demo"
}, {
"url": "http://docs.webplatform.org/wiki/apis/web-storage/Storage/localStorage",
"title": "WebPlatform Docs"
}, {
"url": "https://developer.mozilla.org/En/DOM/Storage",
"title": "Gecko reference"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/features.js#native-localstorage;native-sessionstorage",
"title": "has.js test"
}, {
"url": "http://code.google.com/p/sessionstorage/",
"title": "Support library"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "a",
"3": "a",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "In private browsing mode Safari and iOS Safari don't support setting localStorage.",
"usage_perc_y": 89.13,
"usage_perc_a": 0.1,
"ucprefix": false,
"parent": "",
"keywords": "webstorage,local storage"
},
"sql-storage": {
"title": "Web SQL Database",
"description": "Method of storing data client-side, allows Sqlite database queries for access and manipulation",
"spec": "http://www.w3.org/TR/webdatabase/",
"status": "unoff",
"links": [{
"url": "https://raw.github.com/phiggins42/has.js/master/detect/features.js#native-sql-db",
"title": "has.js test"
}, {
"url": "http://html5doctor.com/introducing-web-sql-databases/",
"title": "HTML5 Doctor article"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "The Web SQL Database specification is no longer being maintained and support may be dropped in future versions.",
"usage_perc_y": 49.18,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "db-storage,websql"
},
"indexeddb": {
"title": "IndexedDB",
"description": "Method of storing data client-side, allows indexed database queries. Previously known as WebSimpleDB API.",
"spec": "http://www.w3.org/TR/IndexedDB/",
"status": "wd",
"links": [{
"url": "http://hacks.mozilla.org/2010/06/comparing-indexeddb-and-webdatabase/",
"title": "Mozilla Hacks article"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/features.js#native-indexeddb",
"title": "has.js test"
}, {
"url": "http://docs.webplatform.org/wiki/apis/indexedDB",
"title": "WebPlatform Docs"
}, {
"url": "https://github.com/axemclion/IndexedDBShim",
"title": "Polyfill for browsers supporting WebSQL"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "a x",
"5": "a x",
"6": "a x",
"7": "a x",
"8": "a x",
"9": "a x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "a x",
"12": "a x",
"13": "a x",
"14": "a x",
"15": "a x",
"16": "a x",
"17": "a x",
"18": "a x",
"19": "a x",
"20": "a x",
"21": "a x",
"22": "a x",
"23": "y x",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "n",
"7": "n"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "a x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support in BB10 refers to an <a href=\"http://www.w3.org/TR/2011/WD-IndexedDB-20110419/\">outdated specification</a> being implemented. Code targeting the <a href=\"http://www.w3.org/TR/IndexedDB/\">current state of the specification</a> might not work.",
"usage_perc_y": 59.46,
"usage_perc_a": 1.68,
"ucprefix": false,
"parent": "",
"keywords": "indexdb"
},
"eventsource": {
"title": "Server-sent DOM events",
"description": "Method of continuously sending data from a server to the browser, rather than repeatedly requesting it (EventSource interface, used to fall under HTML5)",
"spec": "http://www.w3.org/TR/eventsource/",
"status": "cr",
"links": [{
"url": "http://www.html5rocks.com/tutorials/eventsource/basics/",
"title": "HTML5 Rocks tutorial"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/features.js#native-eventsource",
"title": "has.js test"
}, {
"url": "http://samshull.blogspot.com/2010/10/ajax-push-in-ios-safari-and-chrome-with.html",
"title": "Blog post with demo"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "a",
"9.5-9.6": "a",
"10.0-10.1": "a",
"10.5": "a",
"10.6": "a",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "a",
"11": "a",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "",
"usage_perc_y": 58.8,
"usage_perc_a": 0.06,
"ucprefix": false,
"parent": "",
"keywords": "serversent,s-sent-events"
},
"x-doc-messaging": {
"title": "Cross-document messaging",
"description": "Method of sending information from a page on one domain to a page on a different one (using postMessage)",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages",
"status": "wd",
"links": [{
"url": "https://raw.github.com/phiggins42/has.js/master/detect/features.js#native-crosswindowmessaging",
"title": "has.js test"
}, {
"url": "http://html5demos.com/postmessage2",
"title": "Simple demo"
}, {
"url": "https://developer.mozilla.org/en/DOM/window.postMessage",
"title": "MDN article"
}, {
"url": "http://docs.webplatform.org/wiki/apis/web-messaging/methods/postMessage_%28window%29",
"title": "WebPlatform Docs"
}, {
"url": "http://72lions.com/2011/05/cross-origin-communication-with-html5",
"title": "Article and demo"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "a",
"9": "a",
"10": "a",
"11": "y"
},
"firefox": {
"2": "n",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "a"
}
},
"notes": "Partial support in IE8-9 refers to only working in frames/iframes (not other tabs/windows). Also in IE 9 and below an object cannot be sent using postMessage. Partial support in IE10 refers to <a href=\"http://stackoverflow.com/questions/16226924/is-cross-origin-postmessage-broken-in-ie10\">limitations in certain conditions</a>",
"usage_perc_y": 69.31,
"usage_perc_a": 24.52,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"datauri": {
"title": "Data URIs",
"description": "Method of embedding images and other files in webpages as a string of text",
"spec": "http://www.ietf.org/rfc/rfc2397.txt",
"status": "other",
"links": [{
"url": "http://www.websiteoptimization.com/speed/tweak/inline-images/",
"title": "Data URL converter"
}, {
"url": "http://css-tricks.com/5970-data-uris/",
"title": "Information page"
}, {
"url": "http://en.wikipedia.org/wiki/data_URI_scheme",
"title": "Wikipedia"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "a",
"9": "a",
"10": "a",
"11": "a"
},
"firefox": {
"2": "y",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "a"
}
},
"notes": "Support in Internet Explorer 8 is limited to images and linked resources like CSS files, not HTML files. Max URI length in IE8 is 32KB. In IE9+ JavaScript files are supported too and the maximum size limit set to 4GB.",
"usage_perc_y": 69.23,
"usage_perc_a": 24.63,
"ucprefix": false,
"parent": "",
"keywords": "data url,datauris,data uri,dataurl,dataurls"
},
"mathml": {
"title": "MathML",
"description": "An XML language that allows mathematical formulas and notations to be written on web pages.",
"spec": "http://www.w3.org/TR/MathML/",
"status": "rec",
"links": [{
"url": "http://www.mozilla.org/projects/mathml/demo/",
"title": "MathML demos"
}, {
"url": "http://en.wikipedia.org/wiki/MathML",
"title": "Wikipedia"
}, {
"url": "http://www.mathjax.org",
"title": "Cross-browser support script"
}, {
"url": "https://developer.mozilla.org/en/MathML/Element",
"title": "MDN element reference"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "y",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "p",
"5": "p",
"6": "p",
"7": "p",
"8": "p",
"9": "p",
"10": "p",
"11": "p",
"12": "p",
"13": "p",
"14": "p",
"15": "p",
"16": "p",
"17": "p",
"18": "p",
"19": "p",
"20": "p",
"21": "p",
"22": "p",
"23": "p",
"24": "y",
"25": "p",
"26": "p",
"27": "p",
"28": "p",
"29": "p",
"30": "p",
"31": "p",
"32": "p"
},
"safari": {
"3.1": "p",
"3.2": "p",
"4": "p",
"5": "p",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "a",
"10.0-10.1": "a",
"10.5": "a",
"10.6": "a",
"11": "a",
"11.1": "a",
"11.5": "a",
"11.6": "a",
"12": "a",
"12.1": "a",
"15": "p",
"16": "p",
"17": "p",
"18": "p"
},
"ios_saf": {
"3.2": "p",
"4.0-4.1": "p",
"4.2-4.3": "p",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "p"
},
"android": {
"2.1": "p",
"2.2": "p",
"2.3": "p",
"3": "p",
"4": "p",
"4.1": "p",
"4.2-4.3": "p",
"4.4": "p"
},
"bb": {
"7": "p",
"10": "y"
},
"op_mob": {
"10": "p",
"11": "p",
"11.1": "p",
"11.5": "p",
"12": "p",
"12.1": "p",
"0": "p"
},
"and_chr": {
"0": "p"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Opera's support is limited to a CSS profile of MathML. Support was added in Chrome 24, but removed afterwards due to instability.",
"usage_perc_y": 23.15,
"usage_perc_a": 0.63,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"css-featurequeries": {
"title": "CSS Feature Queries",
"description": "CSS Feature Queries allow authors to condition rules based on whether particular property declarations are supported in CSS using the @supports at rule.",
"spec": "http://www.w3.org/TR/css3-conditional/#at-supports",
"status": "cr",
"links": [{
"url": "http://dabblet.com/gist/3895764",
"title": "Test case"
}, {
"url": "http://mcc.id.au/blog/2012/08/supports",
"title": "@supports in Firefox"
}, {
"url": "https://developer.mozilla.org/en-US/docs/Web/CSS/@supports",
"title": "MDN Article"
}, {
"url": "http://docs.webplatform.org/wiki/css/atrules/@supports",
"title": "WebPlatform Docs"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "n",
"7": "n"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "",
"usage_perc_y": 45.52,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "supports,conditional"
},
"xhtml": {
"title": "XHTML served as application/xhtml+xml",
"description": "A strict form of HTML, and allows embedding of other XML languages",
"spec": "http://www.w3.org/TR/xhtml1/",
"status": "rec",
"links": [{
"url": "http://en.wikipedia.org/wiki/XHTML",
"title": "Wikipedia"
}, {
"url": "http://docs.webplatform.org/wiki/concepts/internet_and_web/the_web_standards_model#What_is_XHTML.3F",
"title": "WebPlatform Docs"
}, {
"url": "http://www.xmlplease.com/xhtml/xhtml5polyglot/",
"title": "Information on XHTML5"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "y",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "The XHTML syntax is very close to HTML, and thus is almost always (<a href=\"https://developer.mozilla.org/en-US/docs/XHTML#MIME_type_versus_DOCTYPE\">incorrectly</a>) served as text/html on the web.",
"usage_perc_y": 85.55,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "xhtml+xml"
},
"xhtmlsmil": {
"title": "XHTML+SMIL animation",
"description": "Method of using SMIL animation in web pages",
"spec": "http://www.w3.org/TR/XHTMLplusSMIL/",
"status": "unoff",
"links": [{
"url": "http://en.wikipedia.org/wiki/XHTML%2BSMIL",
"title": "Wikipedia"
}, {
"url": "http://leunen.me/fakesmile/",
"title": "JS library to support XHTML+SMIL"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "a",
"7": "a",
"8": "a",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "p",
"3": "p",
"3.5": "p",
"3.6": "p",
"4": "p",
"5": "p",
"6": "p",
"7": "p",
"8": "p",
"9": "p",
"10": "p",
"11": "p",
"12": "p",
"13": "p",
"14": "p",
"15": "p",
"16": "p",
"17": "p",
"18": "p",
"19": "p",
"20": "p",
"21": "p",
"22": "p",
"23": "p",
"24": "p",
"25": "p",
"26": "p",
"27": "p"
},
"chrome": {
"4": "p",
"5": "p",
"6": "p",
"7": "p",
"8": "p",
"9": "p",
"10": "p",
"11": "p",
"12": "p",
"13": "p",
"14": "p",
"15": "p",
"16": "p",
"17": "p",
"18": "p",
"19": "p",
"20": "p",
"21": "p",
"22": "p",
"23": "p",
"24": "p",
"25": "p",
"26": "p",
"27": "p",
"28": "p",
"29": "p",
"30": "p",
"31": "p",
"32": "p"
},
"safari": {
"3.1": "p",
"3.2": "p",
"4": "p",
"5": "p",
"5.1": "p",
"6": "p",
"6.1": "p",
"7": "p"
},
"opera": {
"9": "p",
"9.5-9.6": "p",
"10.0-10.1": "p",
"10.5": "p",
"10.6": "p",
"11": "p",
"11.1": "p",
"11.5": "p",
"11.6": "p",
"12": "p",
"12.1": "p",
"15": "p",
"16": "p",
"17": "p",
"18": "p"
},
"ios_saf": {
"3.2": "p",
"4.0-4.1": "p",
"4.2-4.3": "p",
"5.0-5.1": "p",
"6.0-6.1": "p",
"7.0": "p"
},
"op_mini": {
"5.0-7.0": "p"
},
"android": {
"2.1": "p",
"2.2": "p",
"2.3": "p",
"3": "p",
"4": "p",
"4.1": "p",
"4.2-4.3": "p",
"4.4": "p"
},
"bb": {
"7": "p",
"10": "p"
},
"op_mob": {
"10": "p",
"11": "p",
"11.1": "p",
"11.5": "p",
"12": "p",
"12.1": "p",
"0": "p"
},
"and_chr": {
"0": "p"
},
"and_ff": {
"0": "p"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Internet Explorer supports the W3C proposal HTML+TIME, which is largely the same as XHTML+SMIL",
"usage_perc_y": 0,
"usage_perc_a": 9.02,
"ucprefix": false,
"parent": "xhtml",
"keywords": ""
},
"wai-aria": {
"title": "WAI-ARIA Accessibility features",
"description": "Method of providing ways for people with disabilities to use dynamic web content and web applications.",
"spec": "http://www.w3.org/TR/wai-aria/",
"status": "cr",
"links": [{
"url": "http://www.alistapart.com/articles/the-accessibility-of-wai-aria/",
"title": "ALA Article"
}, {
"url": "http://en.wikipedia.org/wiki/WAI-ARIA",
"title": "Wikipedia"
}, {
"url": "http://zufelt.ca/blog/are-you-confused-html5-and-wai-aria-yet",
"title": "HTML5/WAI-ARIA information"
}, {
"url": "http://www.w3.org/WAI/intro/aria",
"title": "Information page"
}, {
"url": "http://www.paciellogroup.com/blog/2011/10/browser-assistive-technology-tests-redux/",
"title": "Links to various test results"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "a",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "a",
"5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a",
"28": "a",
"29": "a",
"30": "a",
"31": "a",
"32": "a"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "a",
"5": "a",
"5.1": "a",
"6": "a",
"6.1": "a",
"7": "a"
},
"opera": {
"9": "n",
"9.5-9.6": "a",
"10.0-10.1": "a",
"10.5": "a",
"10.6": "a",
"11": "a",
"11.1": "a",
"11.5": "a",
"11.6": "a",
"12": "a",
"12.1": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a"
},
"ios_saf": {
"3.2": "a",
"4.0-4.1": "a",
"4.2-4.3": "a",
"5.0-5.1": "a",
"6.0-6.1": "a",
"7.0": "a"
},
"op_mini": {
"5.0-7.0": "a"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "a"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "a",
"11": "a",
"11.1": "a",
"11.5": "a",
"12": "a",
"12.1": "a",
"0": "a"
},
"and_chr": {
"0": "a"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 40.05,
"usage_perc_a": 48.6,
"ucprefix": false,
"parent": "",
"keywords": "wai,aria"
},
"geolocation": {
"title": "Geolocation",
"description": "Method of informing a website of the user's geographical location",
"spec": "http://www.w3.org/TR/geolocation-API/",
"status": "cr",
"links": [{
"url": "https://raw.github.com/phiggins42/has.js/master/detect/features.js#native-geolocation",
"title": "has.js test"
}, {
"url": "http://docs.webplatform.org/wiki/apis/geolocation",
"title": "WebPlatform Docs"
}, {
"url": "http://html5demos.com/geo",
"title": "Simple demo"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "p",
"3": "p",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "a",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "p",
"3.2": "p",
"4": "p",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "p",
"10.5": "p",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "n",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "p",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 80.65,
"usage_perc_a": 0.02,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"flexbox": {
"title": "Flexible Box Layout Module",
"description": "Method of positioning elements in horizontal or vertical stacks.",
"spec": "http://www.w3.org/TR/css3-flexbox/",
"status": "cr",
"links": [{
"url": "http://css-tricks.com/snippets/css/a-guide-to-flexbox/",
"title": "A Complete Guide to Flexbox"
}, {
"url": "http://bennettfeely.com/flexplorer/",
"title": "Flexbox CSS generator"
}, {
"url": "http://www.adobe.com/devnet/html5/articles/working-with-flexbox-the-new-spec.html",
"title": "Article on using the latest spec"
}, {
"url": "http://philipwalton.github.io/solved-by-flexbox/",
"title": "Examples on how to solve common layout problems with flexbox"
}, {
"url": "http://dev.opera.com/articles/view/advanced-cross-browser-flexbox/",
"title": "Tutorial on cross-browser support"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "a x #2",
"11": "y"
},
"firefox": {
"2": "a x #1",
"3": "a x #1",
"3.5": "a x #1",
"3.6": "a x #1",
"4": "a x #1",
"5": "a x #1",
"6": "a x #1",
"7": "a x #1",
"8": "a x #1",
"9": "a x #1",
"10": "a x #1",
"11": "a x #1",
"12": "a x #1",
"13": "a x #1",
"14": "a x #1",
"15": "a x #1",
"16": "a x #1",
"17": "a x #1",
"18": "a x #1",
"19": "a x #1",
"20": "a x #1",
"21": "a x #1",
"22": "a #3",
"23": "a #3",
"24": "a #3",
"25": "a #3",
"26": "a #3",
"27": "a #3"
},
"chrome": {
"4": "a x #1",
"5": "a x #1",
"6": "a x #1",
"7": "a x #1",
"8": "a x #1",
"9": "a x #1",
"10": "a x #1",
"11": "a x #1",
"12": "a x #1",
"13": "a x #1",
"14": "a x #1",
"15": "a x #1",
"16": "a x #1",
"17": "a x #1",
"18": "a x #1",
"19": "a x #1",
"20": "a x #1",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "a x #1",
"3.2": "a x #1",
"4": "a x #1",
"5": "a x #1",
"5.1": "a x #1",
"6": "a x #1",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "y",
"15": "y x",
"16": "y x",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "a x #1",
"4.0-4.1": "a x #1",
"4.2-4.3": "a x #1",
"5.0-5.1": "a x #1",
"6.0-6.1": "a x #1",
"7.0": "y x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "a x #1",
"2.2": "a x #1",
"2.3": "a x #1",
"3": "a x #1",
"4": "a x #1",
"4.1": "a x #1",
"4.2-4.3": "a x #1",
"4.4": "y"
},
"bb": {
"7": "a x #1",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "a x #1"
},
"ie_mob": {
"10": "a x #2"
}
},
"notes": "Most partial support refers to supporting an <a href=\"http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/\">older version</a> of the specification or an <a href=\"http://www.w3.org/TR/2012/WD-css3-flexbox-20120322/\">older syntax</a>. For Firefox 21+ it refers to lack of flex-wrap & flex-flow support.",
"usage_perc_y": 37.88,
"usage_perc_a": 37.66,
"ucprefix": false,
"parent": "",
"keywords": "flex"
},
"webgl": {
"title": "WebGL - 3D Canvas graphics",
"description": "Method of generating dynamic 3D graphics using JavaScript, accelerated through hardware",
"spec": "https://www.khronos.org/registry/webgl/specs/1.0/",
"status": "other",
"links": [{
"url": "http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation",
"title": "Instructions on enabling WebGL"
}, {
"url": "http://webkit.org/blog/603/webgl-now-available-in-webkit-nightlies/",
"title": "Webkit blog post"
}, {
"url": "http://www.khronos.org/webgl/wiki/Tutorial",
"title": "Tutorial"
}, {
"url": "http://hacks.mozilla.org/2009/12/webgl-draft-released-today/",
"title": "Firefox blog post"
}, {
"url": "http://iewebgl.com/",
"title": "Polyfill for IE"
}],
"categories": ["Canvas"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "p",
"10": "p",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "a",
"5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "a",
"6": "a",
"6.1": "a",
"7": "a"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "a",
"12.1": "a",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "a",
"12.1": "a",
"0": "y"
},
"and_chr": {
"0": "n"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "p"
}
},
"notes": "Support listed as \"partial\" refers to the fact that not all users with these browsers have WebGL access. This is due to the additional requirement for users to have <a href=\"http://www.khronos.org/webgl/wiki/BlacklistsAndWhitelists\">up to date video drivers</a>. This problem was <a href=\"http://blog.chromium.org/2012/02/gpu-accelerating-2d-canvas-and-enabling.html\">solved in Chrome</a> as of version 18.\r\n\r\nNote that WebGL is part of the <a href=\"http://www.khronos.org/webgl/\">Khronos Group</a>, not the W3C. On Chrome for Android, WebGL is disabled by default, but can be enabled by enabling the \"Enable WebGL\" flag under chrome://flags",
"usage_perc_y": 33.4,
"usage_perc_a": 19.68,
"ucprefix": false,
"parent": "canvas",
"keywords": "web gl"
},
"fileapi": {
"title": "File API",
"description": "Method of manipulating file objects in web applications client-side, as well as programmatically selecting them and accessing their data.",
"spec": "http://www.w3.org/TR/FileAPI/",
"status": "wd",
"links": [{
"url": "https://developer.mozilla.org/en/Using_files_from_web_applications",
"title": "MDN article"
}, {
"url": "http://docs.webplatform.org/wiki/apis/file",
"title": "WebPlatform Docs"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "a",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "a",
"4": "a",
"4.1": "a",
"4.2-4.3": "a",
"4.4": "y"
},
"bb": {
"7": "a",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Partial support in older Safari refers to lacking FileReader support. ",
"usage_perc_y": 67.73,
"usage_perc_a": 5.38,
"ucprefix": false,
"parent": "",
"keywords": "FileReader"
},
"shadowdom": {
"title": "Shadow DOM",
"description": "Method of establishing and maintaining functional boundaries between DOM trees and how these trees interact with each other within a document, thus enabling better functional encapsulation within the DOM.",
"spec": "http://www.w3.org/TR/shadow-dom/",
"status": "wd",
"links": [{
"url": "http://www.html5rocks.com/tutorials/webcomponents/shadowdom/",
"title": "HTML5Rocks - Shadow DOM 101 article"
}, {
"url": "http://html5-demos.appspot.com/static/shadowdom-visualizer/index.html",
"title": "Shadow DOM Visualizer"
}],
"categories": ["DOM", "HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "y x",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "u",
"7": "u"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y x"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y x"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "",
"usage_perc_y": 33.29,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "web components"
},
"websockets": {
"title": "Web Sockets",
"description": "Bidirectional communication technology for web apps",
"spec": "http://www.w3.org/TR/websockets/",
"status": "cr",
"links": [{
"url": "http://docs.webplatform.org/wiki/apis/websocket",
"title": "WebPlatform Docs"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/features.js#native-websockets",
"title": "has.js test"
}, {
"url": "http://websocket.org/aboutwebsocket.html",
"title": "WebSockets information"
}, {
"url": "http://en.wikipedia.org/wiki/WebSocket",
"title": "Wikipedia"
}, {
"url": "http://updates.html5rocks.com/2011/08/What-s-different-in-the-new-WebSocket-protocol",
"title": "Details on newer protocol"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "a",
"5": "a",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "a",
"5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "a",
"5.1": "a",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "a",
"11.1": "a",
"11.5": "a",
"11.6": "a",
"12": "a",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "a",
"5.0-5.1": "a",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "a",
"11.1": "a",
"11.5": "a",
"12": "a",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support refers to the websockets implementation using an older version of the protocol and/or the implementation being disabled by default (due to security issues with the older protocol).",
"usage_perc_y": 67.46,
"usage_perc_a": 2.62,
"ucprefix": true,
"parent": "",
"keywords": ""
},
"script-async": {
"title": "async attribute for external scripts",
"description": "The boolean async attribute on script elements allows the external JavaScript file to run when it's available, without delaying page load first.",
"spec": "http://www.w3.org/TR/html5/scripting-1.html#attr-script-async",
"status": "cr",
"links": [{
"url": "https://developer.mozilla.org/en/HTML/Element/script#Attributes",
"title": "MDN article"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/script.js#script-async",
"title": "has.js test"
}, {
"url": "http://ie.microsoft.com/testdrive/Performance/AsyncScripts/Default.html",
"title": "Demo"
}],
"categories": ["HTML5", "DOM"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "a",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Using script.async = false; to maintain execution order for dynamically-added scripts isn't supported in Safari 5.0",
"usage_perc_y": 72.82,
"usage_perc_a": 0.31,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"cors": {
"title": "Cross-Origin Resource Sharing",
"description": "Method of performing XMLHttpRequests across domains",
"spec": "http://www.w3.org/TR/cors/",
"status": "cr",
"links": [{
"url": "http://saltybeagle.com/2009/09/cross-origin-resource-sharing-demo/",
"title": "Demo and script with cross-browser support"
}, {
"url": "http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/",
"title": "Mozilla Hacks blog post"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/features.js#native-cors-xhr",
"title": "has.js test"
}, {
"url": "http://msdn.microsoft.com/en-us/library/cc288060(VS.85).aspx",
"title": "Alternative implementation by IE8"
}, {
"url": "http://dev.opera.com/articles/view/dom-access-control-using-cross-origin-resource-sharing/",
"title": "DOM access using CORS"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "a",
"9": "a",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Supported somewhat in IE8 and IE9 using the XDomainRequest object (but has <a href=\" http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx\">limitations</a>)",
"usage_perc_y": 75.51,
"usage_perc_a": 13.52,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"calc": {
"title": "calc() as CSS unit value",
"description": "Method of allowing calculated values for length units, i.e. width: calc(100% - 3em)",
"spec": "http://www.w3.org/TR/css3-values/#calc",
"status": "cr",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/functions/calc",
"title": "WebPlatform Docs"
}, {
"url": "https://developer.mozilla.org/en/CSS/-moz-calc",
"title": "MDN article"
}, {
"url": "http://hacks.mozilla.org/2010/06/css3-calc/",
"title": "Mozilla Hacks article"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "y x",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "y x",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Support can be somewhat emulated in older versions of IE using the non-standard expression() syntax. ",
"usage_perc_y": 71.77,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"ruby": {
"title": "Ruby annotation",
"description": "Method of adding pronunciation or other annotations using ruby elements (primarily used in East Asian typography)",
"spec": "http://www.w3.org/TR/html-markup/ruby.html",
"status": "wd",
"links": [{
"url": "https://addons.mozilla.org/firefox/addon/6812/",
"title": "Addon \"HTML Ruby\" for Firefox support"
}, {
"url": "http://html5doctor.com/ruby-rt-rp-element/",
"title": "HTML5 Doctor article"
}, {
"url": "http://docs.webplatform.org/wiki/html/elements/ruby",
"title": "WebPlatform Docs"
}, {
"url": "https://addons.mozilla.org/firefox/addon/1935/",
"title": "Add-on \"XHTML Ruby Support\" for Firefox"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a"
},
"firefox": {
"2": "p",
"3": "p",
"3.5": "p",
"3.6": "p",
"4": "p",
"5": "p",
"6": "p",
"7": "p",
"8": "p",
"9": "p",
"10": "p",
"11": "p",
"12": "p",
"13": "p",
"14": "p",
"15": "p",
"16": "p",
"17": "p",
"18": "p",
"19": "p",
"20": "p",
"21": "p",
"22": "p",
"23": "p",
"24": "p",
"25": "p",
"26": "p",
"27": "p"
},
"chrome": {
"4": "p",
"5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a",
"28": "a",
"29": "a",
"30": "a",
"31": "a",
"32": "a"
},
"safari": {
"3.1": "p",
"3.2": "p",
"4": "p",
"5": "a",
"5.1": "a",
"6": "a",
"6.1": "a",
"7": "a"
},
"opera": {
"9": "p",
"9.5-9.6": "p",
"10.0-10.1": "p",
"10.5": "p",
"10.6": "p",
"11": "p",
"11.1": "p",
"11.5": "p",
"11.6": "p",
"12": "p",
"12.1": "p",
"15": "a",
"16": "a",
"17": "a",
"18": "a"
},
"ios_saf": {
"3.2": "p",
"4.0-4.1": "p",
"4.2-4.3": "p",
"5.0-5.1": "a",
"6.0-6.1": "a",
"7.0": "a"
},
"op_mini": {
"5.0-7.0": "p"
},
"android": {
"2.1": "p",
"2.2": "p",
"2.3": "p",
"3": "a",
"4": "a",
"4.1": "a",
"4.2-4.3": "a",
"4.4": "a"
},
"bb": {
"7": "p",
"10": "a"
},
"op_mob": {
"10": "p",
"11": "p",
"11.1": "p",
"11.5": "p",
"12": "p",
"12.1": "p",
"0": "a"
},
"and_chr": {
"0": "a"
},
"and_ff": {
"0": "p"
},
"ie_mob": {
"10": "a"
}
},
"notes": "Browsers without native support can still simulate support using CSS. Partial support refers to only supporting basic ruby, may still be missing writing-mode, Complex ruby and CSS3 Ruby",
"usage_perc_y": 0,
"usage_perc_a": 72.03,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"css-opacity": {
"title": "CSS3 Opacity",
"description": "Method of setting the transparency level of an element",
"spec": "http://www.w3.org/TR/css3-color/",
"status": "rec",
"links": [{
"url": "http://www.css3files.com/color/#opacity",
"title": "Information page"
}, {
"url": "http://docs.webplatform.org/wiki/css/properties/opacity",
"title": "WebPlatform Docs"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "y",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Transparency for elements in IE8 and older can be achieved using the proprietary \"filter\" property and does not work well with PNG images using alpha transparency.",
"usage_perc_y": 85.55,
"usage_perc_a": 9.03,
"ucprefix": false,
"parent": "",
"keywords": "transparent,transparency,alpha"
},
"form-validation": {
"title": "Form validation",
"description": "Method of setting required fields and field types without requiring JavaScript",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#client-side-form-validation",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/html/attributes/required",
"title": "WebPlatform Docs"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "a",
"5.1": "a",
"6": "a",
"6.1": "a",
"7": "a"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "a"
}
},
"notes": "Partial support in Safari refers to lack of notice when form with required fields is attempted to be submitted. Partial support in IE10 mobile refers to lack of warning when blocking submission.",
"usage_perc_y": 61.75,
"usage_perc_a": 4.07,
"ucprefix": false,
"parent": "forms",
"keywords": ""
},
"history": {
"title": "Session history management",
"description": "Method of manipulating the user's browser's session history in JavaScript using history.pushState, history.replaceState and the popstate event",
"spec": "http://www.w3.org/TR/html5/browsers.html#history-1",
"status": "cr",
"links": [{
"url": "https://raw.github.com/phiggins42/has.js/master/detect/features.js#native-history-state",
"title": "has.js test"
}, {
"url": "https://github.com/browserstate/history.js",
"title": "History.js polyfill "
}, {
"url": "http://docs.webplatform.org/wiki/dom/history",
"title": "WebPlatform Docs"
}, {
"url": "http://html5demos.com/history",
"title": "Demo page"
}, {
"url": "http://www.adequatelygood.com/2010/7/Saner-HTML5-History-Management",
"title": "Introduction to history management"
}, {
"url": "https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history",
"title": "MDN article"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "a",
"5.1": "a",
"6": "a",
"6.1": "a",
"7": "a"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "a",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "y",
"2.3": "y",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Older iOS versions and Android 4.0.4 claim support, but implementation is too buggy to be useful. Partial support in other Safari browsers refers to other buggy behavior.",
"usage_perc_y": 68.29,
"usage_perc_a": 3.89,
"ucprefix": false,
"parent": "",
"keywords": "onpushstate,onreplacestate"
},
"json": {
"title": "JSON parsing",
"description": "Method of converting JavaScript objects to JSON strings and JSON back to objects using JSON.stringify() and JSON.parse()",
"spec": "http://es5.github.com/#x15.12",
"status": "other",
"links": [{
"url": "http://docs.webplatform.org/wiki/apis/json",
"title": "WebPlatform Docs"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/json.js#json",
"title": "has.js test"
}, {
"url": "http://www.json.org/js.html",
"title": "JSON in JS (includes script w/support)"
}, {
"url": "https://developer.mozilla.org/En/Using_native_JSON",
"title": "MDN article"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Requires document to be in IE8+ <a href=\"http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx\">standards mode</a> to work in IE8.",
"usage_perc_y": 93.71,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"classlist": {
"title": "classList (DOMTokenList )",
"description": "Method of easily manipulating classes on elements, using the DOMTokenList object.",
"spec": "http://www.w3.org/TR/dom/#dom-element-classlist",
"status": "wd",
"links": [{
"url": "https://github.com/eligrey/classList.js",
"title": "Polyfill script"
}, {
"url": "http://hacks.mozilla.org/2010/01/classlist-in-firefox-3-6/",
"title": "Mozilla Hacks article"
}, {
"url": "http://docs.webplatform.org/wiki/dom/properties/classList",
"title": "WebPlatform Docs"
}, {
"url": "https://github.com/eligrey/classList.js/pull/12",
"title": "Polyfill script for classList on SVG elements on WebKit"
}],
"categories": ["DOM", "HTML5"],
"stats": {
"ie": {
"5.5": "p",
"6": "p",
"7": "p",
"8": "p",
"9": "p",
"10": "y",
"11": "y"
},
"firefox": {
"2": "p",
"3": "p",
"3.5": "p",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "p",
"5": "p",
"6": "p",
"7": "p",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "p",
"3.2": "p",
"4": "p",
"5": "p",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "p",
"9.5-9.6": "p",
"10.0-10.1": "p",
"10.5": "p",
"10.6": "p",
"11": "p",
"11.1": "p",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "p",
"4.0-4.1": "p",
"4.2-4.3": "p",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "p"
},
"android": {
"2.1": "p",
"2.2": "p",
"2.3": "p",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "p",
"11": "p",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 73.54,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"text-overflow": {
"title": "CSS3 Text-overflow",
"description": "Append ellipsis when text overflows its containing element",
"spec": "http://www.w3.org/TR/css3-ui/#text-overflow0",
"status": "wd",
"links": [{
"url": "http://www.css3files.com/text/",
"title": "Information page"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/css.js#css-text-overflow",
"title": "has.js test"
}, {
"url": "http://docs.webplatform.org/wiki/css/properties/text-overflow",
"title": "WebPlatform Docs"
}, {
"url": "https://developer.mozilla.org/En/CSS/Text-overflow",
"title": "MDN article"
}, {
"url": "https://github.com/rmorse/AutoEllipsis",
"title": "jQuery polyfill for Firefox"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "p",
"3": "p",
"3.5": "p",
"3.6": "p",
"4": "p",
"5": "p",
"6": "p",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y x",
"9.5-9.6": "y x",
"10.0-10.1": "y x",
"10.5": "y x",
"10.6": "y x",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y x"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y x",
"11": "y x",
"11.1": "y x",
"11.5": "y x",
"12": "y x",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 93.95,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "textoverflow,ellipsis"
},
"webm": {
"title": "WebM/VP8 video format",
"description": "Multimedia format designed to provide a royalty-free, high-quality open video compression format for use with HTML5 video.",
"spec": "http://www.webmproject.org/",
"status": "other",
"links": [{
"url": "http://perian.org/",
"title": "Perian :Mac OSX Webm Codec install"
}, {
"url": "https://tools.google.com/dlpage/webmmf",
"title": "Codec for IE9 support"
}, {
"url": "http://webmproject.org",
"title": "Officical website"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/video.js#video-webm",
"title": "has.js test"
}, {
"url": "http://www.broken-links.com/2010/09/01/playing-webm-in-safari-with-plugins/",
"title": "Info on supporting WebM in Safari"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "p",
"10": "p",
"11": "p"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "p",
"4": "p",
"5": "p",
"5.1": "p",
"6": "p",
"6.1": "p",
"7": "p"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "p"
}
},
"notes": "Will work in IE9+ and Safari/MacOSX provided the user has the WebM codecs installed.",
"usage_perc_y": 55.72,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "video",
"keywords": "matroska"
},
"mpeg4": {
"title": "MPEG-4/H.264 video format",
"description": "Commonly used video compression format (not royalty-free)",
"spec": "http://ip.hhi.de/imagecom_G1/assets/pdfs/csvt_overview_0305.pdf",
"status": "other",
"links": [{
"url": "http://www.interoperabilitybridges.com/html5-extension-for-wmp-plugin",
"title": "Firefox extension allowing support in Win7"
}, {
"url": "http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC",
"title": "Wikipedia article"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "a",
"2.2": "a",
"2.3": "a",
"3": "a",
"4": "a",
"4.1": "a",
"4.2-4.3": "a",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "a"
},
"ie_mob": {
"10": "y"
}
},
"notes": "The Android 2.3 browser currently requires <a href=\"http://www.broken-links.com/2010/07/08/making-html5-video-work-on-android-phones/\">specific handling</a> to play videos. Firefox <a href=\"http://blog.lizardwrangler.com/2012/03/18/video-user-experience-and-our-mission/\">will include support</a> on some platforms in upcoming versions. Firefox supports H.264 on Windows 7 and later since version 21. Partial support for Firefox refers to the lack of support in OSX & Linux platforms, for Android Firefox it refers to the inability of hardware acceleration.",
"usage_perc_y": 59.55,
"usage_perc_a": 18.1,
"ucprefix": false,
"parent": "video",
"keywords": "avc,mp4,mpv,mov,aac"
},
"ogv": {
"title": "Ogg/Theora video format",
"description": "Free lossy video compression format.",
"spec": "http://theora.org/doc/",
"status": "other",
"links": [{
"url": "http://en.wikipedia.org/wiki/Theora",
"title": "Wikipedia article"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "p",
"10": "p",
"11": "p"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "n",
"7": "n"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "n"
},
"and_chr": {
"0": "n"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "p"
}
},
"notes": "",
"usage_perc_y": 49.8,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "video",
"keywords": "xiph"
},
"wordwrap": {
"title": "CSS3 Overflow-wrap",
"description": "Allows lines to be broken within words if an otherwise unbreakable string is too long to fit.",
"spec": "http://www.w3.org/TR/css3-text/#overflow-wrap",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/properties/word-wrap",
"title": "WebPlatform Docs"
}, {
"url": "https://developer.mozilla.org/En/CSS/Word-wrap",
"title": "MDN article"
}, {
"url": "http://www.css3files.com/text/#wordwrap",
"title": "Information page"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "a",
"3.6": "a",
"4": "a",
"5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a"
},
"chrome": {
"4": "a",
"5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "a",
"3.2": "a",
"4": "a",
"5": "a",
"5.1": "a",
"6": "a",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "a",
"10.6": "a",
"11": "a",
"11.1": "a",
"11.5": "a",
"11.6": "a",
"12": "a",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "a",
"4.0-4.1": "a",
"4.2-4.3": "a",
"5.0-5.1": "a",
"6.0-6.1": "a",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "a"
},
"android": {
"2.1": "a",
"2.2": "a",
"2.3": "a",
"3": "a",
"4": "a",
"4.1": "a",
"4.2-4.3": "a",
"4.4": "y"
},
"bb": {
"7": "a",
"10": "y"
},
"op_mob": {
"10": "a",
"11": "a",
"11.1": "a",
"11.5": "a",
"12": "a",
"12.1": "a",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "a"
},
"ie_mob": {
"10": "a"
}
},
"notes": "Partial support refers to requiring the legacy name \"word-wrap\" (rather than overflow-wrap) to work.",
"usage_perc_y": 36.93,
"usage_perc_a": 57.51,
"ucprefix": false,
"parent": "",
"keywords": "wordwrap,word-wrap"
},
"progressmeter": {
"title": "Progress & Meter",
"description": "Method of indicating a progress state (progress element) or the current level of a gauge (meter element).\r\n",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-progress-element",
"status": "wd",
"links": [{
"url": "http://dev.opera.com/articles/view/new-form-features-in-HTML5/#newoutput",
"title": "Dev.Opera article"
}, {
"url": "http://peter.sh/examples/?/html/meter-progress.html",
"title": "Examples of progress and meter elements"
}, {
"url": "http://docs.webplatform.org/wiki/html/elements/progress",
"title": "WebPlatform Docs"
}, {
"url": "http://html5doctor.com/measure-up-with-the-meter-tag/",
"title": "HTML5 Doctor on meter element "
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "a",
"11": "a"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "a"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "a"
}
},
"notes": "Partial support in Firefox 6-15, IE10 & iOS7 Safari refers to supporting the progress element, but not the meter element. iOS7 Safari also does not support \"indeterminate\" progress elements.",
"usage_perc_y": 52.21,
"usage_perc_a": 14.58,
"ucprefix": false,
"parent": "forms",
"keywords": ""
},
"object-fit": {
"title": "CSS3 object-fit/object-position",
"description": "Method of specifying how an object (image or video) should fit inside its box. object-fit options include \"contain\" (fit according to aspect ratio), \"fill\" (stretches object to fill) and \"cover\" (overflows box but maintains ratio), where object-position allows the object to be repositioned like background-image does.",
"spec": "http://www.w3.org/TR/css3-images/",
"status": "cr",
"links": [{
"url": "http://dev.opera.com/articles/view/css3-object-fit-object-position/",
"title": "Dev.Opera article"
}, {
"url": "http://docs.webplatform.org/wiki/css/properties/object-fit",
"title": "WebPlatform Docs"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "u",
"27": "u"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n",
"28": "n",
"29": "n",
"30": "n",
"31": "n",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "u",
"7": "u"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "y x",
"11": "y x",
"11.1": "y x",
"11.5": "y x",
"11.6": "y x",
"12": "y x",
"12.1": "y x",
"15": "n",
"16": "n",
"17": "n",
"18": "n"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "y x",
"11.1": "y x",
"11.5": "y x",
"12": "y x",
"12.1": "y x",
"0": "n"
},
"and_chr": {
"0": "n"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Can be enabled in Chrome 31+ and Opera 18+ by enabling experimental Web Platform features under chrome://flags/ or opera://flags/.",
"usage_perc_y": 0.81,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "objectfit,objectposition"
},
"xhr2": {
"title": "XMLHttpRequest 2",
"description": "Adds more functionality to AJAX requests like file uploads, transfer progress information and the ability to send form data.",
"spec": "http://www.w3.org/TR/XMLHttpRequest2/",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/apis/xhr/XMLHttpRequest",
"title": "WebPlatform Docs"
}, {
"url": "http://www.profilepicture.co.uk/tutorials/ajax-file-upload-xmlhttprequest-level-2/",
"title": "Article with file upload demo"
}, {
"url": "https://developer.mozilla.org/en/XMLHttpRequest/FormData",
"title": "MDN article on FormData"
}, {
"url": "https://github.com/3nr1c/jUri.js",
"title": "Polyfill for FormData object"
}],
"categories": ["DOM", "JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "a",
"3.6": "a",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "u",
"5": "u",
"6": "u",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 73.51,
"usage_perc_a": 0.35,
"ucprefix": false,
"parent": "",
"keywords": "formdata"
},
"minmaxwh": {
"title": "CSS min/max-width/height",
"description": "Method of setting a minimum or maximum width or height to an element. ",
"spec": "http://www.w3.org/TR/CSS21/visudet.html#min-max-widths",
"status": "rec",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/properties/min-width",
"title": "WebPlatform Docs"
}, {
"url": "http://code.google.com/p/ie7-js/",
"title": "JS library with support"
}, {
"url": "http://www.impressivewebs.com/min-max-width-height-css/",
"title": "CSS Basics post"
}],
"categories": ["CSS2"],
"stats": {
"ie": {
"5.5": "p",
"6": "p",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "y",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "IE7 does not support \"inherit\" as a value on any of these properties. IE8 has some bugs with max-width/height combined with overflow: auto/scroll.",
"usage_perc_y": 94.36,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "min-width,min-height,max-width,max-height"
},
"details": {
"title": "Details & Summary elements",
"description": "The <details> element generates a simple no-JavaScript widget to show/hide element contents, optionally by clicking on its child <summary> element.",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#the-details-element",
"status": "wd",
"links": [{
"url": "http://html5doctor.com/summary-figcaption-element/",
"title": "HTML5 Doctor article"
}, {
"url": "http://mathiasbynens.be/notes/html5-details-jquery",
"title": "jQuery fallback script"
}, {
"url": "http://docs.webplatform.org/wiki/html/elements/details",
"title": "WebPlatform Docs"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/features.js#native-details",
"title": "has.js test"
}, {
"url": "https://gist.github.com/370590",
"title": "Fallback script"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "p",
"3.5": "p",
"3.6": "p",
"4": "p",
"5": "p",
"6": "p",
"7": "p",
"8": "p",
"9": "p",
"10": "p",
"11": "p",
"12": "p",
"13": "p",
"14": "p",
"15": "p",
"16": "p",
"17": "p",
"18": "p",
"19": "p",
"20": "p",
"21": "p",
"22": "p",
"23": "p",
"24": "p",
"25": "p",
"26": "p",
"27": "p"
},
"chrome": {
"4": "p",
"5": "p",
"6": "p",
"7": "p",
"8": "p",
"9": "p",
"10": "p",
"11": "p",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "p",
"3.2": "p",
"4": "p",
"5": "p",
"5.1": "p",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "p",
"9.5-9.6": "p",
"10.0-10.1": "p",
"10.5": "p",
"10.6": "p",
"11": "p",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "p",
"4.0-4.1": "p",
"4.2-4.3": "p",
"5.0-5.1": "p",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "p"
},
"android": {
"2.1": "p",
"2.2": "p",
"2.3": "p",
"3": "p",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "p",
"10": "y"
},
"op_mob": {
"10": "p",
"11": "p",
"11.1": "p",
"11.5": "p",
"12": "p",
"12.1": "p",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "",
"usage_perc_y": 44.5,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"text-stroke": {
"title": "CSS text-stroke",
"description": "Method of declaring the outline (stroke) width and color for text.",
"spec": "http://developer.apple.com/library/safari/documentation/appleapplications/reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266-_webkit_text_stroke",
"status": "unoff",
"links": [{
"url": "http://www.westciv.com/tools/textStroke/",
"title": "Live editor"
}, {
"url": "http://css-tricks.com/7405-adding-stroke-to-web-text/",
"title": "Information & workarounds"
}],
"categories": ["CSS"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "u",
"27": "u"
},
"chrome": {
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "y x",
"3.2": "y x",
"4": "y x",
"5": "y x",
"5.1": "y x",
"6": "y x",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x"
},
"ios_saf": {
"3.2": "a x",
"4.0-4.1": "y x",
"4.2-4.3": "y x",
"5.0-5.1": "y x",
"6.0-6.1": "y x",
"7.0": "y x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y x",
"2.2": "y x",
"2.3": "y x",
"3": "n",
"4": "y x",
"4.1": "y x",
"4.2-4.3": "y x",
"4.4": "y x"
},
"bb": {
"7": "y x",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y x"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Does not yet appear in any W3C specification. Was briefly included in a spec as the \"text-outline\" property, but this was removed.",
"usage_perc_y": 48.41,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "textstroke,stroke-color,stroke-width,fill-color"
},
"inline-block": {
"title": "CSS inline-block",
"description": "Method of displaying an element as a block while flowing it with text. ",
"spec": "http://www.w3.org/TR/CSS21/visuren.html#fixed-positioning",
"status": "rec",
"links": [{
"url": "http://robertnyman.com/2010/02/24/css-display-inline-block-why-it-rocks-and-why-it-sucks/",
"title": "Blog post w/info"
}, {
"url": "http://docs.webplatform.org/wiki/css/properties/display",
"title": "WebPlatform Docs"
}, {
"url": "http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/",
"title": "Info on cross browser support"
}],
"categories": ["CSS2"],
"stats": {
"ie": {
"5.5": "a",
"6": "a",
"7": "a",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "a x",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Only supported in IE6 and IE7 on elements with a display of \"inline\" by default. <a href=\"http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/\">Alternative properties</a> are available to provide complete cross-browser support.",
"usage_perc_y": 93.84,
"usage_perc_a": 0.74,
"ucprefix": false,
"parent": "",
"keywords": "inlineblock"
},
"notifications": {
"title": "Web Notifications",
"description": "Method of alerting the user outside of a web page by displaying notifications (that do not require interaction by the user).",
"spec": "http://www.w3.org/TR/notifications/",
"status": "wd",
"links": [{
"url": "http://www.html5rocks.com/tutorials/notifications/quick/",
"title": "HTML5 Rocks tutorial"
}, {
"url": "http://www.chromium.org/developers/design-documents/desktop-notifications/api-specification",
"title": "Chromium API"
}, {
"url": "https://addons.mozilla.org/en-us/firefox/addon/221523/",
"title": "Add-on "
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "a x",
"6": "a x",
"7": "a x",
"8": "a x",
"9": "a x",
"10": "a x",
"11": "a x",
"12": "a x",
"13": "a x",
"14": "a x",
"15": "a x",
"16": "a x",
"17": "a x",
"18": "a x",
"19": "a x",
"20": "a x",
"21": "a x",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "n",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "a x"
},
"bb": {
"7": "n",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "a x"
},
"and_chr": {
"0": "a x"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "",
"usage_perc_y": 45.27,
"usage_perc_a": 2.66,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"stream": {
"title": "getUserMedia/Stream API",
"description": "Method of accessing external device data (such as a webcam video stream). Formerly this was envisioned as the <device> element.",
"spec": "http://www.w3.org/TR/mediacapture-streams/",
"status": "wd",
"links": [{
"url": "http://my.opera.com/core/blog/2011/03/23/webcam-orientation-preview",
"title": "Technology preview from Opera"
}, {
"url": "http://docs.webplatform.org/wiki/dom/methods/getUserMedia",
"title": "WebPlatform Docs"
}],
"categories": ["HTML5", "JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "u",
"7": "u"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "y",
"12.1": "y",
"15": "n",
"16": "n",
"17": "n",
"18": "y x"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "y",
"12.1": "y",
"0": "y x"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y x"
},
"ie_mob": {
"10": "n"
}
},
"notes": "",
"usage_perc_y": 48.44,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "camera,device,getUserMedia,media stream,Media Capture API"
},
"svg-img": {
"title": "SVG in HTML img element",
"description": "Method of displaying SVG images in HTML using <img>",
"spec": "http://www.w3.org/TR/html5/embedded-content-1.html#the-img-element",
"status": "cr",
"links": [{
"url": "http://www.codedread.com/blog/",
"title": "Blog with SVGs an images"
}, {
"url": "http://blog.dholbert.org/2010/10/svg-as-image.html",
"title": "Blog post with examples"
}],
"categories": ["SVG"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "a",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "a",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 83.65,
"usage_perc_a": 0.01,
"ucprefix": false,
"parent": "",
"keywords": "svg-as-img,svg-in-img"
},
"datalist": {
"title": "Datalist element",
"description": "Method of setting a list of options for a user to select in a text field, while leaving the ability to enter a custom value.",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-datalist-element",
"status": "wd",
"links": [{
"url": "http://demo.agektmr.com/datalist/",
"title": "Eiji Kitamura's options demos & tests"
}, {
"url": "http://docs.webplatform.org/wiki/html/elements/datalist",
"title": "WebPlatform Docs"
}, {
"url": "https://developer.mozilla.org/en/HTML/Element/datalist",
"title": "MDN reference"
}, {
"url": "http://afarkas.github.com/webshim/demos/",
"title": "HTML5 Library including datalist support"
}, {
"url": "http://hacks.mozilla.org/2010/11/firefox-4-html5-forms/",
"title": "Mozilla Hacks article"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "p",
"10": "a",
"11": "a"
},
"firefox": {
"2": "p",
"3": "p",
"3.5": "p",
"3.6": "p",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "p",
"5": "p",
"6": "p",
"7": "p",
"8": "p",
"9": "p",
"10": "p",
"11": "p",
"12": "p",
"13": "p",
"14": "p",
"15": "p",
"16": "p",
"17": "p",
"18": "p",
"19": "n",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "p",
"3.2": "p",
"4": "p",
"5": "p",
"5.1": "p",
"6": "n",
"6.1": "n",
"7": "n"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "p",
"4.0-4.1": "p",
"4.2-4.3": "p",
"5.0-5.1": "p",
"6.0-6.1": "p",
"7.0": "p"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "p",
"2.2": "p",
"2.3": "p",
"3": "p",
"4": "p",
"4.1": "p",
"4.2-4.3": "p",
"4.4": "p"
},
"bb": {
"7": "p",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "p"
},
"and_chr": {
"0": "p"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "p"
}
},
"notes": "Partial support in IE10 refers to <a href=\"http://playground.onereason.eu/2013/04/ie10s-lousy-support-for-datalists/\">significantly buggy behavior</a>.",
"usage_perc_y": 48.86,
"usage_perc_a": 10.9,
"ucprefix": false,
"parent": "forms",
"keywords": "list attribute"
},
"dataset": {
"title": "dataset & data-* attributes",
"description": "Method of applying and accessing custom data to elements.",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#embedding-custom-non-visible-data-with-the-data-*-attributes",
"status": "wd",
"links": [{
"url": "http://www.orangesoda.net/jquery.dataset.html",
"title": "jQuery polyfill for dataset support"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/dom.js#dom-dataset",
"title": "has.js test"
}, {
"url": "http://html5demos.com/dataset",
"title": "Demo using dataset"
}, {
"url": "http://html5doctor.com/html5-custom-data-attributes/",
"title": "HTML5 Doctor article"
}, {
"url": "http://docs.webplatform.org/wiki/html/attributes/data-*",
"title": "WebPlatform Docs"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "y"
},
"firefox": {
"2": "a",
"3": "a",
"3.5": "a",
"3.6": "a",
"4": "a",
"5": "a",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "a",
"5": "a",
"6": "a",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "a",
"3.2": "a",
"4": "a",
"5": "a",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "a",
"9.5-9.6": "a",
"10.0-10.1": "a",
"10.5": "a",
"10.6": "a",
"11": "a",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "a",
"4.0-4.1": "a",
"4.2-4.3": "a",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "a"
},
"android": {
"2.1": "a",
"2.2": "a",
"2.3": "a",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "a",
"11": "a",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "a"
}
},
"notes": "All browsers can already use data-* attributes and access them using getAttribute. \"Supported\" refers to accessing the values using the dataset property. Current spec only refers to support on HTML elements, only some browsers also have support for SVG/MathML elements.",
"usage_perc_y": 62.15,
"usage_perc_a": 32.43,
"ucprefix": false,
"parent": "",
"keywords": "DOMStringMap"
},
"css-grid": {
"title": "CSS Grid Layout",
"description": "Method of using a grid concept to lay out content, providing a mechanism for authors to divide available space for lay out into columns and rows using a set of predictable sizing behaviors",
"spec": "http://www.w3.org/TR/css3-grid-layout/",
"status": "wd",
"links": [{
"url": "https://bugzilla.mozilla.org/show_bug.cgi?id=616605",
"title": "Mozilla (Firefox) feature request"
}, {
"url": "http://blogs.msdn.com/b/ie/archive/2011/04/14/ie10-platform-preview-and-css-features-for-adaptive-layouts.aspx",
"title": "IE Blog post"
}, {
"url": "https://github.com/codler/Grid-Layout-Polyfill",
"title": "Grid Layout Polyfill"
}, {
"url": "https://bugs.webkit.org/show_bug.cgi?id=60731",
"title": "Webkit (Chrome, Safari, etc.) feature request"
}],
"categories": ["CSS"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "p",
"10": "y x",
"11": "y x"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "p",
"20": "p",
"21": "p",
"22": "p",
"23": "p",
"24": "p",
"25": "p",
"26": "u",
"27": "u"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "p",
"26": "p",
"27": "p",
"28": "p",
"29": "p",
"30": "p",
"31": "u",
"32": "u"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "p",
"6.1": "p",
"7": "p"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "p",
"7.0": "p"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "p",
"4.4": "p"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "p"
},
"and_chr": {
"0": "p"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "y x"
}
},
"notes": "",
"usage_perc_y": 11.11,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "grids,grid-row,grid-column"
},
"menu": {
"title": "Toolbar/context menu",
"description": "Method of defining a toolbar menu, a context menu or a list of (interactive) options using the <menu> element.",
"spec": "http://www.w3.org/TR/html5/interactive-elements.html#context-menus",
"status": "cr",
"links": [{
"url": "https://raw.github.com/phiggins42/has.js/master/detect/events.js#event-contextmenu",
"title": "has.js test"
}, {
"url": "https://bug617528.bugzilla.mozilla.org/attachment.cgi?id=554309",
"title": "Demo"
}, {
"url": "http://addyosmani.github.com/jQuery-contextMenu/",
"title": "jQuery polyfill"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n",
"28": "n",
"29": "n",
"30": "n",
"31": "u",
"32": "u"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "u",
"7": "u"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "n"
},
"and_chr": {
"0": "n"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Partial support in Firefox refers to using the non-standard \"menuitem\" child elements, where the current spec uses \"<a href=\"http://www.w3.org/TR/html5/interactive-elements.html#the-command-element\">command</a>\" child elements. It is also currently limited to context menus, not toolbar menus.",
"usage_perc_y": 0,
"usage_perc_a": 14.7,
"ucprefix": false,
"parent": "",
"keywords": "contextmenu,menuitem,command"
},
"rem": {
"title": "rem (root em) units",
"description": "Type of unit similar to \"em\", but relative only to the root element, not any parent element. Thus compounding does not occur as it does with \"em\" units.",
"spec": "http://www.w3.org/TR/css3-values/#font-relative-lengths",
"status": "cr",
"links": [{
"url": "http://snook.ca/archives/html_and_css/font-size-with-rem",
"title": "Article on usage"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "u",
"5": "u",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 80.56,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"ttf": {
"title": "TTF/OTF - TrueType and OpenType font support",
"description": "Support for the TrueType (.ttf)and OpenType (.otf) outline font formats in @font-face. ",
"spec": "http://developer.apple.com/fonts/TTRefMan/index.html",
"status": "other",
"links": [{
"url": "http://stackoverflow.com/questions/17694143/what-is-the-status-of-ttf-support-in-internet-explorer",
"title": "What is the status of TTF support in Internet Explorer?"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "a",
"10": "a",
"11": "a"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "u"
}
},
"notes": "Partial support in IE9 refers to the fonts only working <a href=\"http://blogs.msdn.com/b/ie/archive/2010/07/15/the-css-corner-better-web-typography-for-better-design.aspx\">when set to be \"installable\"</a>.",
"usage_perc_y": 64.48,
"usage_perc_a": 16.11,
"ucprefix": false,
"parent": "fontface",
"keywords": ""
},
"touch": {
"title": "Touch events",
"description": "Method of registering when, where and how the interface is touched, for devices with a touch screen. These DOM events are similar to mousedown, mousemove, etc.",
"spec": "http://www.w3.org/TR/touch-events/",
"status": "rec",
"links": [{
"url": "http://schepers.cc/getintouch",
"title": "Information on the spec development"
}, {
"url": "http://www.quirksmode.org/mobile/tableTouch.html",
"title": "Detailed support tables"
}, {
"url": "http://www.quirksmode.org/m/tests/drag2.html",
"title": "Multi-touch demo"
}, {
"url": "http://msdn.microsoft.com/en-us/library/ie/hh673557(v=vs.85).aspx",
"title": "Internet Explorer's gesture and touch implementation."
}],
"categories": ["DOM", "JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "p",
"11": "p"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "a",
"5": "a",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "u",
"7": "u"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "p"
}
},
"notes": "Internet Explorer implements Pointer Events specification which supports more input devices than Touch Events one.",
"usage_perc_y": 58.16,
"usage_perc_a": 0.12,
"ucprefix": false,
"parent": "",
"keywords": "touchstart,touchend,touchmove,touchenter,touchleave,touchcancel"
},
"matchesselector": {
"title": "matches() DOM method",
"description": "Method of testing whether or not a DOM element matches a given selector. Formerly known (and largely supported with prefix) as matchesSelector.",
"spec": "http://www.w3.org/TR/selectors-api2/",
"status": "wd",
"links": [{
"url": "https://developer.mozilla.org/en/DOM/Element.mozMatchesSelector",
"title": "MDN article"
}, {
"url": "http://docs.webplatform.org/wiki/dom/methods/matchesSelector",
"title": "WebPlatform Docs"
}],
"categories": ["DOM", "JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "a x",
"10": "a x",
"11": "a x"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "a x",
"4": "a x",
"5": "a x",
"6": "a x",
"7": "a x",
"8": "a x",
"9": "a x",
"10": "a x",
"11": "a x",
"12": "a x",
"13": "a x",
"14": "a x",
"15": "a x",
"16": "a x",
"17": "a x",
"18": "a x",
"19": "a x",
"20": "a x",
"21": "a x",
"22": "a x",
"23": "a x",
"24": "a x",
"25": "a x",
"26": "a x",
"27": "a x"
},
"chrome": {
"4": "a x",
"5": "a x",
"6": "a x",
"7": "a x",
"8": "a x",
"9": "a x",
"10": "a x",
"11": "a x",
"12": "a x",
"13": "a x",
"14": "a x",
"15": "a x",
"16": "a x",
"17": "a x",
"18": "a x",
"19": "a x",
"20": "a x",
"21": "a x",
"22": "a x",
"23": "a x",
"24": "a x",
"25": "a x",
"26": "a x",
"27": "a x",
"28": "a x",
"29": "a x",
"30": "a x",
"31": "a x",
"32": "a x"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "a x",
"5.1": "a x",
"6": "a x",
"6.1": "a x",
"7": "a x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "a x",
"11.6": "a x",
"12": "a x",
"12.1": "a x",
"15": "a x",
"16": "a x",
"17": "a x",
"18": "a x"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "a x",
"4.2-4.3": "a x",
"5.0-5.1": "a x",
"6.0-6.1": "a x",
"7.0": "a x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "a x",
"2.3": "a x",
"3": "a x",
"4": "a x",
"4.1": "a x",
"4.2-4.3": "a x",
"4.4": "a x"
},
"bb": {
"7": "a x",
"10": "a x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "a x",
"11.5": "a x",
"12": "a x",
"12.1": "a x",
"0": "a x"
},
"and_chr": {
"0": "a x"
},
"and_ff": {
"0": "a x"
},
"ie_mob": {
"10": "a x"
}
},
"notes": "Partial support refers to supporting the older specification's \"matchesSelector\" name rather than just \"matches\".",
"usage_perc_y": 0,
"usage_perc_a": 80.6,
"ucprefix": false,
"parent": "",
"keywords": " matchesSelector"
},
"pointer-events": {
"title": "CSS pointer-events (for HTML)",
"description": "This CSS property, when set to \"none\" allows elements to not receive hover/click events, instead the event will occur on anything behind it. ",
"spec": "http://wiki.csswg.org/spec/css4-ui#pointer-events",
"status": "unoff",
"links": [{
"url": "http://robertnyman.com/2010/03/22/css-pointer-events-to-allow-clicks-on-underlying-elements/",
"title": "Article & tutorial"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/css.js#css-pointerevents",
"title": "has.js test"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Already part of the SVG specification, and all SVG-supporting browsers appear to support the property on SVG elements.",
"usage_perc_y": 63.82,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "pointerevents"
},
"blobbuilder": {
"title": "Blob constructing",
"description": "Construct Blobs (binary large objects) either using the BlobBuilder API (deprecated) or the Blob constructor.",
"spec": "http://www.w3.org/TR/file-writer-api/#the-blobbuilder-interface",
"status": "wd",
"links": [{
"url": "https://developer.mozilla.org/en/DOM/BlobBuilder",
"title": "MDN article on BlobBuilder"
}, {
"url": "https://developer.mozilla.org/en-US/docs/DOM/Blob",
"title": "MDN article on Blobs"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "a x",
"7": "a x",
"8": "a x",
"9": "a x",
"10": "a x",
"11": "a x",
"12": "a x",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "a x",
"9": "a x",
"10": "a x",
"11": "a x",
"12": "a x",
"13": "a x",
"14": "a x",
"15": "a x",
"16": "a x",
"17": "a x",
"18": "a x",
"19": "a x",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "a x",
"4": "a x",
"4.1": "a x",
"4.2-4.3": "a x",
"4.4": "a x"
},
"bb": {
"7": "n",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "a x"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support refers to only supporting the now deprecated BlobBuilder to create blobs.",
"usage_perc_y": 64.97,
"usage_perc_a": 6.3,
"ucprefix": true,
"parent": "fileapi",
"keywords": ""
},
"filereader": {
"title": "FileReader API",
"description": "Method of reading the contents of a File or Blob object into memory",
"spec": "http://www.w3.org/TR/FileAPI/#dfn-filereader",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/apis/file/FileReader",
"title": "WebPlatform Docs"
}, {
"url": "https://developer.mozilla.org/en/DOM/FileReader",
"title": "FileReader API"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 71.89,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "fileapi",
"keywords": ""
},
"filesystem": {
"title": "Filesystem & FileWriter API",
"description": "Method of reading and writing files to a sandboxed file system.\r\n",
"spec": "http://www.w3.org/TR/file-system-api/",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/apis/filesystem",
"title": "WebPlatform Docs"
}, {
"url": "http://www.html5rocks.com/en/tutorials/file/filesystem/",
"title": "HTML5 Rocks tutorial"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "a x",
"9": "a x",
"10": "a x",
"11": "a x",
"12": "a x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "u",
"7": "u"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y x"
},
"bb": {
"7": "n",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y x"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "",
"usage_perc_y": 34.87,
"usage_perc_a": 0.28,
"ucprefix": false,
"parent": "",
"keywords": "filewriter"
},
"bloburls": {
"title": "Blob URLs",
"description": "Method of creating URL handles to the specified File or Blob object.",
"spec": "http://www.w3.org/TR/FileAPI/#url",
"status": "wd",
"links": [{
"url": "https://developer.mozilla.org/en/DOM/window.URL.createObjectURL",
"title": "MDN article"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "y x",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "y x",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "y x",
"4.1": "y x",
"4.2-4.3": "y x",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y x"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "",
"usage_perc_y": 70.6,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "fileapi",
"keywords": "createobjecturl"
},
"typedarrays": {
"title": "Typed Arrays",
"description": "JavaScript typed arrays provide a mechanism for accessing raw binary data much more efficiently.\r\n",
"spec": "http://www.khronos.org/registry/typedarray/specs/latest/",
"status": "other",
"links": [{
"url": "https://developer.mozilla.org/en/javascript_typed_arrays",
"title": "MDN article"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 73.11,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "float64array,dataview,uint8array"
},
"deviceorientation": {
"title": "DeviceOrientation events",
"description": "API for detecting orientation and motion events from the device running the browser.",
"spec": "http://www.w3.org/TR/orientation-event/",
"status": "wd",
"links": [{
"url": "http://html5labs.interoperabilitybridges.com/prototypes/device-orientation-events/device-orientation-events/info",
"title": "DeviceOrientation implementation prototype for IE10"
}, {
"url": "http://www.html5rocks.com/en/tutorials/device/orientation/",
"title": "HTML5 Rocks tutorial"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/features.js#native-orientation",
"title": "has.js test"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "a"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "p",
"4": "p",
"5": "p",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a",
"28": "a",
"29": "a",
"30": "a",
"31": "a",
"32": "a"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "u",
"7": "u"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "a",
"16": "a",
"17": "a",
"18": "a"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "a",
"5.0-5.1": "a",
"6.0-6.1": "a",
"7.0": "a"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "a",
"4": "a",
"4.1": "a",
"4.2-4.3": "a",
"4.4": "a"
},
"bb": {
"7": "n",
"10": "a"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "y",
"12.1": "y",
"0": "a"
},
"and_chr": {
"0": "a"
},
"and_ff": {
"0": "a"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Partial support refers to the lack of compassneedscalibration event. Partial support also refers to the lack of devicemotion event support for Chrome 30- and Opera. Opera Mobile 14 lost the ondevicemotion event support. Firefox 3.6, 4 and 5 support the non-standard <a href=\"https://developer.mozilla.org/en/DOM/MozOrientation\">MozOrientation</a> event.",
"usage_perc_y": 0.14,
"usage_perc_a": 57.76,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"script-defer": {
"title": "defer attribute for external scripts",
"description": "The boolean defer attribute on script elements allows the external JavaScript file to run when the DOM is loaded, without delaying page load first.",
"spec": "http://www.w3.org/TR/html5/the-script-element.html#attr-script-defer",
"status": "cr",
"links": [{
"url": "https://developer.mozilla.org/en/HTML/Element/script#Attributes",
"title": "MDN article"
}, {
"url": "http://docs.webplatform.org/wiki/html/attributes/defer",
"title": "WebPlatform Docs"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/script.js#script-defer",
"title": "has.js test"
}],
"categories": ["DOM", "HTML5"],
"stats": {
"ie": {
"5.5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support refers to a buggy implementation in IE<10",
"usage_perc_y": 73.17,
"usage_perc_a": 14.25,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"nav-timing": {
"title": "Navigation Timing API",
"description": "API for accessing timing information related to navigation and elements.",
"spec": "http://www.w3.org/TR/navigation-timing/",
"status": "cr",
"links": [{
"url": "https://developer.mozilla.org/en/API/navigationTiming",
"title": "MDN article"
}, {
"url": "http://www.html5rocks.com/en/tutorials/webperformance/basics/",
"title": "HTML5 Rocks tutorial"
}, {
"url": "http://docs.webplatform.org/wiki/apis/navigation_timing",
"title": "WebPlatform Docs"
}],
"categories": ["DOM", "JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "n",
"7": "n"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 69.95,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "performance,performance.timing"
},
"audio-api": {
"title": "Web Audio API",
"description": "High-level JavaScript API for processing and synthesizing audio",
"spec": "http://www.w3.org/TR/webaudio/",
"status": "wd",
"links": [{
"url": "http://www.doboism.com/projects/webaudio-compatibility/",
"title": "Additional browser compatibility tests for specific features"
}, {
"url": "http://docs.webplatform.org/wiki/apis/webaudio",
"title": "WebPlatform Docs"
}, {
"url": "https://github.com/corbanbrook/audionode.js",
"title": "Polyfill to support Web Audio API in Firefox"
}, {
"url": "https://github.com/g200kg/WAAPISim",
"title": "Polyfill to enable Web Audio API through Firefox Audio Data api or flash"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "y x",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "y x",
"7.0": "y x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "n"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Firefox versions < 25 support an alternative, deprecated audio API.",
"usage_perc_y": 41.68,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "web-audio"
},
"css-regions": {
"title": "CSS Regions",
"description": "Method of flowing content into multiple elements.",
"spec": "http://www.w3.org/TR/css3-regions/",
"status": "wd",
"links": [{
"url": "http://msdn.microsoft.com/en-us/ie/hh272902#_CSSConnected",
"title": "IE10 developer guide info"
}, {
"url": "http://html.adobe.com/webstandards/cssregions/",
"title": "Adobe demos and samples"
}, {
"url": "http://docs.webplatform.org/wiki/css/atrules/@region",
"title": "WebPlatform Docs"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "a x",
"11": "a x"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "a x",
"16": "a x",
"17": "a x",
"18": "a x",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n",
"28": "n",
"29": "n",
"30": "n",
"31": "n",
"32": "n"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "y x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "n"
},
"and_chr": {
"0": "n"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "a x"
}
},
"notes": "Currently supported in WebKit Nightly using <code>-webkit-flow-into: flow_name;</code> and <code>-webkit-from-flow: flow_name;</code>. Support in Chrome 19+ is disabled by default and can be enabled using a runtime flag (see <code>about:flags</code>) or a command line flag (see <a href=\"http://peter.sh/experiments/chromium-command-line-switches/#enable-css-regions\">this list</a>). For Chrome 19-22 the flag is named \"Enable CSS Regions\" / <code>--enable-css-regions</code>, while for Chrome 23+ the flag is named \"Enable experimental WebKit features\" / <code>--enable-experimental-webkit-features</code>. Support in IE10 is limited to using an iframe as a content source with the <code>-ms-flow-into: flow_name;</code> and <code>-ms-flow-from: flow_name;</code> syntax. Support for Safari 6.1&7 is <a href=\"http://www.broken-links.com/2013/07/10/web-platform-technologies-in-safari-6-1-and-7/\">likely</a> but not official.",
"usage_perc_y": 2.75,
"usage_perc_a": 11.35,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"fullscreen": {
"title": "Full Screen API",
"description": "API for allowing content (like a video or canvas element) to take up the entire screen.",
"spec": "http://www.w3.org/TR/fullscreen/",
"status": "wd",
"links": [{
"url": "https://developer.mozilla.org/en/DOM/Using_full-screen_mode",
"title": "MDN article"
}, {
"url": "http://jlongster.com/2011/11/21/canvas.html",
"title": "Blog post"
}, {
"url": "http://hacks.mozilla.org/2012/01/using-the-fullscreen-api-in-web-browsers/",
"title": "Mozilla hacks article"
}, {
"url": "http://docs.webplatform.org/wiki/dom/methods/requestFullscreen",
"title": "WebPlatform Docs"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "y x"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "a x",
"11": "a x",
"12": "a x",
"13": "a x",
"14": "a x",
"15": "a x",
"16": "a x",
"17": "a x",
"18": "a x",
"19": "a x",
"20": "a x",
"21": "a x",
"22": "a x",
"23": "a x",
"24": "a x",
"25": "a x",
"26": "a x",
"27": "a x"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "a x",
"16": "a x",
"17": "a x",
"18": "a x",
"19": "a x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "a x",
"6": "y x",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "y",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "a"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y x"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "a x"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Partial support refers to supporting an earlier draft of the spec.",
"usage_perc_y": 37.35,
"usage_perc_a": 16.21,
"ucprefix": false,
"parent": "",
"keywords": "full-screen"
},
"requestanimationframe": {
"title": "requestAnimationFrame",
"description": "API allowing a more efficient way of running script-based animation, compared to traditional methods using timeouts.",
"spec": "http://www.w3.org/TR/animation-timing/#requestAnimationFrame",
"status": "wd",
"links": [{
"url": "http://hacks.mozilla.org/2011/08/animating-with-javascript-from-setinterval-to-requestanimationframe/",
"title": "Mozilla Hacks article"
}, {
"url": "http://paulirish.com/2011/requestanimationframe-for-smart-animating/",
"title": "Blog post"
}, {
"url": "http://docs.webplatform.org/wiki/apis/timing/methods/requestAnimationFrame",
"title": "WebPlatform Docs"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "y x",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "y x",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y x"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 67.13,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"input-range": {
"title": "Range input type",
"description": "Form field type that allows the user to select a value using a slider widget.",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#range-state-(type=range)",
"status": "wd",
"links": [{
"url": "https://github.com/fryn/html5slider",
"title": "Polyfill for Firefox"
}, {
"url": "http://docs.webplatform.org/wiki/html/elements/input/type/range",
"title": "WebPlatform Docs"
}, {
"url": "http://tutorialzine.com/2011/12/what-you-need-to-know-html5-range-input/",
"title": "Tutorial"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/form.js#input-type-range",
"title": "has.js test"
}, {
"url": "https://github.com/freqdec/fd-slider",
"title": "Cross-browser polyfill"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "u",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "a",
"2.2": "a",
"2.3": "a",
"3": "a",
"4": "a",
"4.1": "a",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Currently all Android browsers with partial support hide the slider input field by default. However, the element <a href=\"http://tiffanybbrown.com/2012/02/07/input-typerange-and-androids-stock-browser/\">can be styled</a> to be made visible and usable.",
"usage_perc_y": 68.52,
"usage_perc_a": 4.31,
"ucprefix": false,
"parent": "forms",
"keywords": ""
},
"matchmedia": {
"title": "matchMedia",
"description": "API for finding out whether or not a media query applies to the document.",
"spec": "http://www.w3.org/TR/cssom-view/#dom-window-matchmedia",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/media_queries/apis/matchMedia",
"title": "WebPlatform Docs"
}, {
"url": "https://github.com/paulirish/matchMedia.js/",
"title": "matchMedia.js polyfill"
}, {
"url": "https://developer.mozilla.org/en/DOM/window.matchMedia",
"title": "MDN article"
}, {
"url": "https://developer.mozilla.org/en/CSS/Using_media_queries_from_code",
"title": "MDN tutorial"
}],
"categories": ["JS API", "DOM"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 72.81,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "mediaquerylist"
},
"input-datetime": {
"title": "Date/time input types",
"description": "Form field widget to easily allow users to enter dates and/or times, generally by using a calendar widget.",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#date-state-(type=date)",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/html/elements/input/type/date",
"title": "WebPlatform Docs"
}, {
"url": "http://net.tutsplus.com/tutorials/javascript-ajax/quick-tip-cross-browser-datepickers-within-minutes/",
"title": "Datepicker tutorial w/polyfill"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/form.js#input-type-datetime;input-type-datetime-local",
"title": "has.js test"
}, {
"url": "https://github.com/zoltan-dulac/html5Forms.js",
"title": "Polyfill for HTML5 forms"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a",
"28": "a",
"29": "a",
"30": "a",
"31": "a",
"32": "a"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "u",
"7": "u"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "a",
"16": "a",
"17": "a",
"18": "a"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "a"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Safari provides date-formatted text fields, but no real calendar widget. Partial support in Chrome refers to a missing calendar widget for the \"datetime\" type (and other types in older versions). Some modified versions of the Android 4.x browser do have support for date/time fields. ",
"usage_perc_y": 6.13,
"usage_perc_a": 33.1,
"ucprefix": false,
"parent": "forms",
"keywords": "datepicker,timepicker"
},
"input-color": {
"title": "Color input type",
"description": "Form field allowing the user to select a color.",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#color-state-(type=color)",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/html/elements/input/type/color",
"title": "WebPlatform Docs"
}, {
"url": "http://www.html5tutorial.info/html5-color.php",
"title": "Tutorial"
}, {
"url": "https://github.com/jonstipe/color-polyfill",
"title": "Polyfill"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "n",
"7": "n"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "n",
"16": "n",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "",
"usage_perc_y": 35.22,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "forms",
"keywords": "colour"
},
"input-number": {
"title": "Number input type",
"description": "Form field type for numbers.",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#number-state-(type=number)",
"status": "wd",
"links": [{
"url": "https://raw.github.com/phiggins42/has.js/master/detect/form.js#input-type-number",
"title": "has.js test"
}, {
"url": "http://www.html5tutorial.info/html5-number.php",
"title": "Tutorial"
}, {
"url": "https://github.com/jonstipe/number-polyfill",
"title": "Polyfill"
}, {
"url": "http://docs.webplatform.org/wiki/html/elements/input/type/number",
"title": "WebPlatform Docs"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "a",
"11": "a"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n"
},
"chrome": {
"4": "n",
"5": "n",
"6": "u",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "a",
"4.0-4.1": "a",
"4.2-4.3": "a",
"5.0-5.1": "a",
"6.0-6.1": "a",
"7.0": "a"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "a",
"4.1": "a",
"4.2-4.3": "a",
"4.4": "a"
},
"bb": {
"7": "n",
"10": "a"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "a"
},
"and_chr": {
"0": "a"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "a"
}
},
"notes": "iOS Safari, Android 4 and Chrome for Android show number input, but do not use \"step\", \"min\" or \"max\" attributes or show increment/decrement buttons. Internet Explorer 10 does not show increment/decrement buttons.",
"usage_perc_y": 38.44,
"usage_perc_a": 20.1,
"ucprefix": false,
"parent": "forms",
"keywords": "spinner"
},
"iframe-sandbox": {
"title": "sandbox attribute for iframes",
"description": "Method of running external site pages with reduced privileges (e.g. no JavaScript) in iframes",
"spec": "http://www.w3.org/TR/html5/the-iframe-element.html#attr-iframe-sandbox",
"status": "cr",
"links": [{
"url": "http://msdn.microsoft.com/en-us/hh563496",
"title": "MSDN article"
}, {
"url": "http://blog.chromium.org/2010/05/security-in-depth-html5s-sandbox.html",
"title": "Chromium blog article"
}, {
"url": "http://docs.webplatform.org/wiki/html/attributes/sandbox",
"title": "WebPlatform Docs"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 59.45,
"usage_perc_a": 13.57,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"css-counters": {
"title": "CSS Counters",
"description": "Method of controlling number values in generated content, using the counter-reset and counter-increment properties.",
"spec": "http://www.w3.org/TR/CSS21/generate.html#counters",
"status": "wd",
"links": [{
"url": "http://onwebdev.blogspot.com/2012/02/css-counters-tutorial.html",
"title": "Tutorial and information"
}, {
"url": "http://docs.webplatform.org/wiki/css/properties/counter-reset",
"title": "WebPlatform Docs"
}, {
"url": "https://developer.mozilla.org/en/CSS_Counters",
"title": "MDN article"
}],
"categories": ["CSS2"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "y",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "y"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 93.86,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"css-resize": {
"title": "CSS resize property",
"description": "Method of allowing an element to be resized by the user, with options to limit to a given direction. ",
"spec": "http://www.w3.org/TR/css3-ui/#resize",
"status": "wd",
"links": [{
"url": "http://css-tricks.com/almanac/properties/r/resize/",
"title": "CSS Tricks info"
}, {
"url": "http://davidwalsh.name/textarea-resize",
"title": "On textarea resizing"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y x",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "a",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "n"
},
"and_chr": {
"0": "n"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Opera 12.10+ currently only supports the resize property for textarea elements.",
"usage_perc_y": 52.82,
"usage_perc_a": 0.48,
"ucprefix": false,
"parent": "",
"keywords": "horizontal,vertical"
},
"input-placeholder": {
"title": "input placeholder attribute",
"description": "Method of setting placeholder text for text-like input fields, to suggest the expected inserted information.",
"spec": "http://dev.w3.org/html5/spec/Overview.html#attr-input-placeholder",
"status": "cr",
"links": [{
"url": "http://docs.webplatform.org/wiki/html/attributes/placeholder",
"title": "WebPlatform Docs"
}, {
"url": "https://raw.github.com/phiggins42/has.js/master/detect/form.js#input-attr-placeholder",
"title": "has.js test"
}, {
"url": "http://www.zachleat.com/web/placeholder/",
"title": "Article on usage"
}, {
"url": "https://github.com/mathiasbynens/jquery-placeholder",
"title": "Polyfill"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "a",
"3.2": "a",
"4": "a",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "a",
"11.1": "a",
"11.5": "a",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support in older Safari and Opera versions refers to lacking placeholder support on textarea elements. ",
"usage_perc_y": 75.1,
"usage_perc_a": 0.15,
"ucprefix": false,
"parent": "forms",
"keywords": ""
},
"spdy": {
"title": "SPDY networking protocol",
"description": "Networking protocol for low-latency transport of content over the web.",
"spec": "http://tools.ietf.org/html/draft-mbelshe-httpbis-spdy-00",
"status": "unoff",
"links": [{
"url": "http://en.wikipedia.org/wiki/SPDY",
"title": "Wikipedia"
}, {
"url": "http://dev.chromium.org/spdy/spdy-whitepaper",
"title": "SPDY whitepaper"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "a"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "u",
"7": "u"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "u"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "",
"usage_perc_y": 53.69,
"usage_perc_a": 0.11,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"css-repeating-gradients": {
"title": "CSS Repeating Gradients",
"description": "Method of defining a repeating linear or radial color gradient as a CSS image.",
"spec": "http://www.w3.org/TR/css3-images/#repeating-gradients",
"status": "cr",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/repeating-linear-gradient",
"title": "WebPlatform Docs"
}, {
"url": "https://developer.mozilla.org/en/CSS/repeating-linear-gradient",
"title": "MDN article"
}, {
"url": "http://www.css3files.com/gradient/#repeatinglineargradient",
"title": "Information page"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "y x",
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "y x",
"6": "y x",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "a x",
"11.5": "a x",
"11.6": "y x",
"12": "y x",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "y x",
"6.0-6.1": "y x",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "y x",
"4.1": "y x",
"4.2-4.3": "y x",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "a x",
"11.5": "a x",
"12": "y x",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y x"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Firefox 10+, Chrome 26+ and Opera 11.6+ also support the new \"to (side)\" syntax.",
"usage_perc_y": 73.31,
"usage_perc_a": 0.03,
"ucprefix": false,
"parent": "css-gradients",
"keywords": ""
},
"css-filters": {
"title": "CSS Filter Effects",
"description": "Method of applying filter effects (like blur, grayscale, brightness, contrast and hue) to elements, previously only possible by using SVG.",
"spec": "http://www.w3.org/TR/filter-effects/",
"status": "wd",
"links": [{
"url": "http://dl.dropbox.com/u/3260327/angular/CSS3ImageManipulation.html",
"title": "Filter editor"
}, {
"url": "http://bennettfeely.com/filters/",
"title": "Filter Playground"
}, {
"url": "http://html5-demos.appspot.com/static/css/filters/index.html",
"title": "Demo file for WebKit browsers"
}, {
"url": "http://www.html5rocks.com/en/tutorials/filters/understanding-css/",
"title": "Mozilla hacks article"
}],
"categories": ["CSS3", "CSS"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "u",
"27": "u"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "y x",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "y x",
"7.0": "y x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y x"
},
"bb": {
"7": "n",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y x"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Note that this property is significantly different from and incompatible with Microsoft's <a href=\"http://msdn.microsoft.com/en-us/library/ie/ms530752%28v=vs.85%29.aspx\">older \"filter\" property</a>.",
"usage_perc_y": 40.55,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "sepia,hue-rotate,invert,saturate"
},
"getcomputedstyle": {
"title": "getComputedStyle",
"description": "API to get the current computed CSS styles applied to an element. This may be the current value applied by an animation or as set by a stylesheet.",
"spec": "http://www.w3.org/TR/cssom/#dom-window-getcomputedstyle",
"status": "rec",
"links": [{
"url": "http://ie.microsoft.com/testdrive/HTML5/getComputedStyle/",
"title": "Demo"
}, {
"url": "http://snipplr.com/view/13523/",
"title": "Polyfill for IE"
}, {
"url": "https://developer.mozilla.org/en/DOM/window.getComputedStyle",
"title": "MDN article"
}, {
"url": "http://docs.webplatform.org/wiki/css/cssom/methods/getComputedStyle",
"title": "WebPlatform Docs"
}],
"categories": ["JS API", "CSS3", "DOM"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "a",
"3.5": "a",
"3.6": "a",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "a",
"5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "a",
"3.2": "a",
"4": "a",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "a",
"9.5-9.6": "a",
"10.0-10.1": "a",
"10.5": "a",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "a",
"4.0-4.1": "a",
"4.2-4.3": "a",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "a"
},
"android": {
"2.1": "a",
"2.2": "a",
"2.3": "a",
"3": "a",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "a",
"10": "y"
},
"op_mob": {
"10": "a",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support in older Firefox versions refers to requiring the second parameter to be included. Partial support in all other browsers refers to not supporting getComputedStyle on pseudo-elements.",
"usage_perc_y": 78.53,
"usage_perc_a": 7,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"word-break": {
"title": "CSS3 word-break",
"description": "Property to prevent or allow words to be broken over multiple lines between letters.",
"spec": "http://www.w3.org/TR/css3-text/#word-break",
"status": "wd",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/properties/word-break",
"title": "WebPlatform Docs"
}, {
"url": "https://developer.mozilla.org/en/CSS/word-break",
"title": "MDN article"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "a",
"5": "a",
"6": "a",
"7": "a",
"8": "a",
"9": "a",
"10": "a",
"11": "a",
"12": "a",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a",
"28": "a",
"29": "a",
"30": "a",
"31": "a",
"32": "a"
},
"safari": {
"3.1": "a",
"3.2": "a",
"4": "a",
"5": "a",
"5.1": "a",
"6": "a",
"6.1": "a",
"7": "a"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "a",
"16": "a",
"17": "a",
"18": "a"
},
"ios_saf": {
"3.2": "a",
"4.0-4.1": "a",
"4.2-4.3": "a",
"5.0-5.1": "a",
"6.0-6.1": "a",
"7.0": "a"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "a",
"2.2": "a",
"2.3": "a",
"3": "a",
"4": "a",
"4.1": "a",
"4.2-4.3": "a",
"4.4": "a"
},
"bb": {
"7": "a",
"10": "a"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "a"
},
"and_chr": {
"0": "a"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "Partial support refers to supporting the \"break-all\" value, but not the \"keep-all\" value.",
"usage_perc_y": 39.39,
"usage_perc_a": 48.42,
"ucprefix": false,
"parent": "",
"keywords": "break-all,keep-all"
},
"viewport-units": {
"title": "Viewport units: vw, vh, vmin, vmax",
"description": "Length units representing 1% of the viewport size for viewport width (vw), height (vh), the smaller of the two (vmin), or the larger of the two (vmax).",
"spec": "http://www.w3.org/TR/css3-values/#viewport-relative-lengths",
"status": "cr",
"links": [{
"url": "http://css-tricks.com/viewport-sized-typography/",
"title": "Blog post"
}, {
"url": "https://github.com/saabi/vminpoly",
"title": "Polyfill"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "a",
"10": "a",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "a",
"6.1": "a",
"7": "a"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "a",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "a"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "a"
}
},
"notes": "Partial support in IE9 refers to supporting \"vm\" instead of \"vmin\". All other partial support refers to not supporting the \"vmax\" unit.",
"usage_perc_y": 48.9,
"usage_perc_a": 21.18,
"ucprefix": false,
"parent": "",
"keywords": "vm,viewport-percentage"
},
"contentsecuritypolicy": {
"title": "Content Security Policy",
"description": "Mitigate cross-site scripting attacks by whitelisting allowed sources of script, style, and other resources.",
"spec": "http://www.w3.org/TR/CSP/",
"status": "cr",
"links": [{
"url": "http://content-security-policy.com/",
"title": "CSP Examples & Quick Reference"
}, {
"url": "http://html5rocks.com/en/tutorials/security/content-security-policy/",
"title": "HTML5Rocks article"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "a x",
"11": "a x"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "a x",
"6": "y x",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "a x",
"6.0-6.1": "y x",
"7.0": "y x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y x"
},
"ie_mob": {
"10": "a x"
}
},
"notes": "The HTTP header is 'X-Content-Security-Policy' for Firefox and IE 10&11, and 'X-WebKit-CSP' for Safari and Chrome. IE 10&11's support is limited to the 'sandbox' directive.",
"usage_perc_y": 55.74,
"usage_perc_a": 12.68,
"ucprefix": false,
"parent": "",
"keywords": "csp,security,header"
},
"pagevisibility": {
"title": "PageVisibility",
"description": "JavaScript API for determining whether a document is visible on the display",
"spec": "http://www.w3.org/TR/page-visibility/",
"status": "cr",
"links": [{
"url": "https://developer.mozilla.org/en-US/docs/DOM/Using_the_Page_Visibility_API",
"title": "MDN article"
}, {
"url": "http://docs.webplatform.org/wiki/apis/timing/properties/visibilityState",
"title": "WebPlatform Docs"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "y",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y x"
},
"bb": {
"7": "n",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "y",
"0": "y x"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 63.89,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "visibilitystate"
},
"stricttransportsecurity": {
"title": "Strict Transport Security",
"description": "Declare that a website is only accessible over a secure connection (HTTPS).",
"spec": "http://tools.ietf.org/html/rfc6797",
"status": "other",
"links": [{
"url": "http://dev.chromium.org/sts",
"title": "Strict Transport Security @ Chromium"
}, {
"url": "https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security",
"title": "Strict Transport Security @ Mozilla Developer Network"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "u",
"7": "u"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "u"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "The HTTP header is 'Strict-Transport-Security'.",
"usage_perc_y": 50.76,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "sts,hsts,security,header"
},
"style-scoped": {
"title": "Scoped CSS",
"description": "Allows CSS rules to be scoped to part of the document, based on the position of the style element.",
"spec": "http://www.w3.org/TR/html5/document-metadata.html#attr-style-scoped",
"status": "cr",
"links": [{
"url": "https://github.com/PM5544/scoped-polyfill",
"title": "Polyfill"
}, {
"url": "http://html5doctor.com/the-scoped-attribute/",
"title": "HTML5 Doctor article"
}, {
"url": "http://updates.html5rocks.com/2012/03/A-New-Experimental-Feature-style-scoped",
"title": "HTML5Rocks article"
}],
"categories": ["CSS", "HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n",
"28": "n",
"29": "n",
"30": "n",
"31": "u",
"32": "u"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "u",
"7": "u"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "u",
"0": "n"
},
"and_chr": {
"0": "n"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Supported in Chrome 20+ by enabling the \"experimental WebKit features\" flag in chrome://flags.",
"usage_perc_y": 13.05,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "scope"
},
"svg-fragment": {
"title": "SVG fragment identifiers",
"description": "Method of displaying only a part of an SVG image by defining a view ID or view box dimensions as the file's fragment identifier.",
"spec": "http://www.w3.org/TR/SVG/linking.html#SVGFragmentIdentifiers",
"status": "rec",
"links": [{
"url": "http://www.broken-links.com/2012/08/14/better-svg-sprites-with-fragment-identifiers/",
"title": "Blog post"
}],
"categories": ["SVG"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n",
"28": "n",
"29": "n",
"30": "n",
"31": "u",
"32": "u"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "n",
"7": "n"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "u",
"0": "n"
},
"and_chr": {
"0": "n"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 25.15,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "fragments,sprite"
},
"outline": {
"title": "CSS outline",
"description": "The CSS outline property is a shorthand property for setting one or more of the individual outline properties outline-style, outline-width and outline-color in a single rule. In most cases the use of this shortcut is preferable and more convenient.",
"spec": "http://www.w3.org/TR/CSS2/ui.html#propdef-outline",
"status": "rec",
"links": [{
"url": "https://developer.mozilla.org/en-US/docs/CSS/outline",
"title": "Mozilla Developer Network: outline"
}, {
"url": "http://dev.w3.org/csswg/css3-ui/#outline",
"title": "CSS Basic User Interface Module Level 3"
}],
"categories": ["CSS2"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "y",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "y",
"3": "y",
"3.5": "y",
"3.6": "y",
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "y",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "y",
"4.0-4.1": "y",
"4.2-4.3": "y",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y",
"2.2": "y",
"2.3": "y",
"3": "y",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 89.27,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "-moz-outline,outline-width,outline-style,outline-color"
},
"download": {
"title": "Download attribute",
"description": "When used on an anchor, this attribute signifies that the resource it points to should be downloaded by the browser rather than navigate to it.",
"spec": "http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#downloading-resources",
"status": "wd",
"links": [{
"url": "http://html5-demos.appspot.com/static/a.download.html",
"title": "Demo: creating a text file and downloading it."
}, {
"url": "http://updates.html5rocks.com/2011/08/Downloading-resources-in-HTML5-a-download",
"title": "HTML5Rocks post"
}],
"categories": ["HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "n",
"7": "n"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "",
"usage_perc_y": 48.02,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "download,a.download,a[download],download attribute"
},
"pointer": {
"title": "Pointer events",
"description": "This specification integrates various inputs from mice, touchscreens, and pens, making separate implementations no longer necessary and authoring for cross-device pointers easier. Not to be mistaken with the unrelated \"pointer-events\" CSS property.",
"spec": "http://www.w3.org/TR/pointerevents/",
"status": "cr",
"links": [{
"url": "http://blogs.msdn.com/b/eternalcoding/archive/2013/01/16/hand-js-a-polyfill-for-supporting-pointer-events-on-every-browser.aspx",
"title": "Hand.js, the polyfill for browsers only supporting Touch Events"
}, {
"url": "http://blogs.msdn.com/b/ie/archive/2011/09/20/touch-input-for-ie10-and-metro-style-apps.aspx",
"title": "Implementation of Pointer Events in IE10"
}, {
"url": "http://blogs.msdn.com/b/davrous/archive/2013/02/20/handling-touch-in-your-html5-apps-thanks-to-the-pointer-events-of-ie10-and-windows-8.aspx",
"title": "Article & tutorial"
}],
"categories": ["DOM", "JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "a x",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "p",
"10": "p",
"11": "p",
"12": "p",
"13": "p",
"14": "p",
"15": "p",
"16": "p",
"17": "p",
"18": "p",
"19": "p",
"20": "p",
"21": "p",
"22": "p",
"23": "p",
"24": "p",
"25": "p",
"26": "p",
"27": "p"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "p",
"23": "p",
"24": "p",
"25": "p",
"26": "p",
"27": "p",
"28": "p",
"29": "p",
"30": "p",
"31": "p",
"32": "p"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "u",
"7": "u"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "p",
"16": "p",
"17": "p",
"18": "p"
},
"ios_saf": {
"3.2": "p",
"4.0-4.1": "p",
"4.2-4.3": "p",
"5.0-5.1": "p",
"6.0-6.1": "p",
"7.0": "p"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "p",
"2.2": "p",
"2.3": "p",
"3": "p",
"4": "p",
"4.1": "p",
"4.2-4.3": "p",
"4.4": "p"
},
"bb": {
"7": "p",
"10": "p"
},
"op_mob": {
"10": "n",
"11": "p",
"11.1": "p",
"11.5": "p",
"12": "p",
"12.1": "p",
"0": "p"
},
"and_chr": {
"0": "p"
},
"and_ff": {
"0": "p"
},
"ie_mob": {
"10": "a x"
}
},
"notes": "Partial support in IE10 refers the lack of pointerenter and pointerleave events.",
"usage_perc_y": 0.11,
"usage_perc_a": 10.99,
"ucprefix": false,
"parent": "",
"keywords": "pointerdown,pointermove,pointerup,pointercancel,pointerover,pointerout,pointerenter,pointerleave"
},
"user-select-none": {
"title": "CSS user-select: none",
"description": "Method of preventing text/element selection using CSS. ",
"spec": "https://developer.mozilla.org/en-US/docs/CSS/user-select",
"status": "unoff",
"links": [{
"url": "http://msdn.microsoft.com/en-us/library/ie/hh781492(v=vs.85).aspx",
"title": "MSDN Documentation"
}, {
"url": "https://developer.mozilla.org/en-US/docs/CSS/user-select",
"title": "MDN article"
}, {
"url": "http://css-tricks.com/almanac/properties/u/user-select/",
"title": "CSS Tricks article"
}],
"categories": ["CSS"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y x",
"11": "y x"
},
"firefox": {
"2": "y x",
"3": "y x",
"3.5": "y x",
"3.6": "y x",
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x"
},
"chrome": {
"4": "u",
"5": "u",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "y x",
"3.2": "y x",
"4": "y x",
"5": "y x",
"5.1": "y x",
"6": "y x",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x"
},
"ios_saf": {
"3.2": "y x",
"4.0-4.1": "y x",
"4.2-4.3": "y x",
"5.0-5.1": "y x",
"6.0-6.1": "y x",
"7.0": "y x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "y x",
"2.2": "y x",
"2.3": "y x",
"3": "y x",
"4": "y x",
"4.1": "y x",
"4.2-4.3": "y x",
"4.4": "y x"
},
"bb": {
"7": "y x",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y x"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "y x"
},
"ie_mob": {
"10": "y x"
}
},
"notes": "Currently the user-select property does not appear in any W3C specification. Support information here is only for \"none\" value, not others.",
"usage_perc_y": 74.91,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"webp": {
"title": "WebP image format",
"description": "Image format that supports lossy and lossless compression, as well as animation and alpha transparency.",
"spec": "https://developers.google.com/speed/webp/",
"status": "other",
"links": [{
"url": "http://libwebpjs.appspot.com/",
"title": "Decoder in JS"
}, {
"url": "https://developers.google.com/speed/webp/",
"title": "Official website"
}, {
"url": "http://antimatter15.github.io/weppy/demo.html",
"title": "Polyfill for browsers with WebM support"
}, {
"url": "http://webpjs.appspot.com/",
"title": "Polyfill for browsers with or without WebM support (i.e. IE6-IE9, Safari/iOS version 6.1 and below; Firefox versions 24 and bel"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "p",
"5": "p",
"6": "p",
"7": "p",
"8": "p",
"9": "p",
"10": "p",
"11": "p",
"12": "p",
"13": "p",
"14": "p",
"15": "p",
"16": "p",
"17": "p",
"18": "p",
"19": "p",
"20": "p",
"21": "p",
"22": "p",
"23": "p",
"24": "p",
"25": "p",
"26": "p",
"27": "p"
},
"chrome": {
"4": "n",
"5": "n",
"6": "p",
"7": "p",
"8": "p",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "n",
"7": "n"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "p",
"11": "p",
"11.1": "p",
"11.5": "p",
"11.6": "p",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "y",
"4.1": "y",
"4.2-4.3": "y",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "a",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Animated webp images are supported in Chrome 32+ and Opera 19+.",
"usage_perc_y": 39.4,
"usage_perc_a": 0.01,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"intrinsic-width": {
"title": "Intrinsic & Extrinsic Sizing",
"description": "Allows for the heights and widths to be specified in intrinsic values using the fill-available, max-content, min-content, and fit-content properties.",
"spec": "http://www.w3.org/TR/css3-sizing/",
"status": "wd",
"links": [{
"url": "http://demosthenes.info/blog/662/Design-From-the-Inside-Out-With-CSS-MinContent",
"title": "Min-Content tutorial"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "y x",
"7": "y x"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "y x"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y x"
},
"bb": {
"7": "n",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y x"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "y x"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Prefixes are on the values, not the property names (e.g. -webkit-min-content) Firefox currently supports the \"-moz-available\" property rather than \"-moz-fill-available\".",
"usage_perc_y": 51.68,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "fill-available,max-content,min-content,fit-content,contain-floats"
},
"template": {
"title": "HTML templates",
"description": "Method of declaring a portion of reusable markup that is parsed but not rendered until cloned.",
"spec": "http://www.w3.org/TR/html-templates/",
"status": "wd",
"links": [{
"url": "http://www.html5rocks.com/en/tutorials/webcomponents/template/",
"title": "HTML5Rocks - HTML's New template Tag"
}, {
"url": "http://polymer-project.org",
"title": "Polymer project (polyfill & web compontents framework)"
}],
"categories": ["DOM", "HTML5"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "n",
"7": "n"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "",
"usage_perc_y": 45.76,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "web components, template"
},
"opus": {
"title": "Opus",
"description": "Royalty-free open audio codec by IETF, which incorporated SILK from Skype and CELT from Xiph.org, to serve higher sound quality and lower latency at the same bitrate.",
"spec": "http://tools.ietf.org/html/rfc6716",
"status": "other",
"links": [{
"url": "https://hacks.mozilla.org/2012/07/firefox-beta-15-supports-the-new-opus-audio-format/",
"title": "Introduction of Opus by Mozilla"
}, {
"url": "http://www.ietf.org/mail-archive/web/rtcweb/current/msg04953.html",
"title": "Google's statement about the use of VP8 and Opus codec for WebRTC standard"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n",
"28": "n",
"29": "n",
"30": "n",
"31": "n",
"32": "n"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "u",
"7": "u"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "u"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "n"
},
"and_chr": {
"0": "n"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Chrome does not support Opus by default but users can enable it via the 'enable-opus-playback' flag. When it comes to Opera, it is said that the Linux version may be able to play it when the GStreamer module is up to date and the served mime-type is 'audio/ogg'.",
"usage_perc_y": 14.04,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "audio",
"keywords": ""
},
"jpegxr": {
"title": "JPEG XR image format",
"description": "The latest JPEG image format of Joint Photographic Experts Group which boasts better compression and supports lossless compression, alpha channel, and 48-bit deep color over normal jpg format.",
"spec": "http://www.itu.int/rec/T-REC-T.832",
"status": "other",
"links": [{
"url": "http://msdn.microsoft.com/en-us/library/windows/desktop/hh707223(v=vs.85).aspx",
"title": "Microsoft JPEG XR Codec Overview"
}],
"categories": ["Other"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n",
"28": "n",
"29": "n",
"30": "n",
"31": "n",
"32": "n"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "n",
"7": "n"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "n"
},
"and_chr": {
"0": "n"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 16.32,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
},
"channel-messaging": {
"title": "Channel messaging",
"description": "Method for having two-way communication between browsing contexts (using MessageChannel)",
"spec": "http://www.w3.org/TR/webmessaging/#channel-messaging",
"status": "cr",
"links": [{
"url": "http://dev.opera.com/articles/view/window-postmessage-messagechannel/#channel",
"title": "An Introduction to HTML5 web messaging"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "y",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "u",
"10.0-10.1": "u",
"10.5": "u",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "y",
"6.0-6.1": "y",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "u",
"11": "y",
"11.1": "y",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 55.07,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "x-doc-messaging",
"keywords": ""
},
"css3-tabsize": {
"title": "CSS3 tab-size",
"description": "Method of customizing the width of a tab character. Only effective using 'white-space: pre'.",
"spec": "http://www.w3.org/TR/css3-text/#tab-size1",
"status": "wd",
"links": [{
"url": "https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size",
"title": "MDN article"
}],
"categories": ["CSS3"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "y x",
"11": "y x",
"11.1": "y x",
"11.5": "y x",
"11.6": "y x",
"12": "y x",
"12.1": "y x",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "y",
"10": "y"
},
"op_mob": {
"10": "n",
"11": "y x",
"11.1": "y x",
"11.5": "y x",
"12": "y x",
"12.1": "y x",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y x"
},
"ie_mob": {
"10": "n"
}
},
"notes": "",
"usage_perc_y": 53.05,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "tab-size,tab-width"
},
"mutationobserver": {
"title": "Mutation Observer",
"description": "Method for observing and reacting to changes to the DOM. Replaces MutationEvents, which is deprecated.",
"spec": "http://www.w3.org/TR/dom/",
"status": "wd",
"links": [{
"url": "https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver",
"title": "MutationObserver from MDN"
}, {
"url": "https://github.com/Polymer/MutationObservers",
"title": "Polyfill"
}],
"categories": ["DOM", "JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "p",
"10": "p",
"11": "y"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "y x",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "y x",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "p",
"4.1": "p",
"4.2-4.3": "p",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "y x"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "p"
}
},
"notes": "When the content of a node with a single CharacterData child node is changed by innerHTML attribute and the node have a single different one as a result, WebKit browsers consider it as a characterData mutation of the child CharacterData node, while other browsers think it as a childList mutation of the parent node.",
"usage_perc_y": 54.8,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "MutationObserver"
},
"css-selection": {
"title": "::selection CSS pseudo-element",
"description": "The ::selection CSS pseudo-element applies rules to the portion of a document that has been highlighted (e.g., selected with the mouse or another pointing device) by the user.",
"spec": "https://developer.mozilla.org/en-US/docs/Web/CSS/::selection",
"status": "unoff",
"links": [{
"url": "http://docs.webplatform.org/wiki/css/selectors/pseudo-elements/::selection",
"title": "WebPlatform Docs"
}, {
"url": "http://quirksmode.org/css/selectors/selection.html",
"title": "::selection test"
}],
"categories": ["CSS"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "y",
"10": "y",
"11": "y"
},
"firefox": {
"2": "y x",
"3": "y x",
"3.5": "y x",
"3.6": "y x",
"4": "y x",
"5": "y x",
"6": "y x",
"7": "y x",
"8": "y x",
"9": "y x",
"10": "y x",
"11": "y x",
"12": "y x",
"13": "y x",
"14": "y x",
"15": "y x",
"16": "y x",
"17": "y x",
"18": "y x",
"19": "y x",
"20": "y x",
"21": "y x",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x"
},
"chrome": {
"4": "y",
"5": "y",
"6": "y",
"7": "y",
"8": "y",
"9": "y",
"10": "y",
"11": "y",
"12": "y",
"13": "y",
"14": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y",
"19": "y",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y",
"28": "y",
"29": "y",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "y",
"3.2": "y",
"4": "y",
"5": "y",
"5.1": "y",
"6": "y",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "y",
"10.0-10.1": "y",
"10.5": "y",
"10.6": "y",
"11": "y",
"11.1": "y",
"11.5": "y",
"11.6": "y",
"12": "y",
"12.1": "y",
"15": "y",
"16": "y",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "u",
"11": "u",
"11.1": "u",
"11.5": "y",
"12": "y",
"12.1": "y",
"0": "y"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "n"
},
"ie_mob": {
"10": "y"
}
},
"notes": "",
"usage_perc_y": 71.68,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": "::selection,selection"
},
"canvas-blending": {
"title": "Canvas blend modes",
"description": "Method of defining the effect resulting from overlaying two layers on a Canvas element. ",
"spec": "http://www.w3.org/TR/compositing-1/#blending",
"status": "wd",
"links": [{
"url": "http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/",
"title": "Blog post"
}],
"categories": ["Canvas"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "y",
"21": "y",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "n",
"24": "n",
"25": "n",
"26": "n",
"27": "n",
"28": "n",
"29": "n",
"30": "y",
"31": "y",
"32": "y"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "y",
"7": "y"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "n",
"16": "n",
"17": "y",
"18": "y"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "y"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "y"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "n"
},
"and_chr": {
"0": "y"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "",
"usage_perc_y": 42.33,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "canvas",
"keywords": ""
},
"clipboard": {
"title": "Clipboard API",
"description": "API to provide copy, cut and paste functionality using the OS clipboard.",
"spec": "http://www.w3.org/TR/clipboard-apis/",
"status": "wd",
"links": [{
"url": "http://www.deluxeblogtips.com/2010/06/javascript-copy-to-clipboard.html",
"title": "Blog post on cross-browser usage"
}, {
"url": "https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent",
"title": "MDN page on ClipboardEvent"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "a #1",
"6": "a #1",
"7": "a #1",
"8": "a #1",
"9": "a #1",
"10": "a #1",
"11": "a #1"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "y",
"23": "y",
"24": "y",
"25": "y",
"26": "y",
"27": "y"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "a",
"14": "a",
"15": "a",
"16": "a",
"17": "a",
"18": "a",
"19": "a",
"20": "a",
"21": "a",
"22": "a",
"23": "a",
"24": "a",
"25": "a",
"26": "a",
"27": "a",
"28": "a",
"29": "a",
"30": "a",
"31": "a",
"32": "a"
},
"safari": {
"3.1": "u",
"3.2": "u",
"4": "a",
"5": "a",
"5.1": "a",
"6": "a",
"6.1": "a",
"7": "a"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "n",
"16": "a",
"17": "a",
"18": "a"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "a",
"6.0-6.1": "a",
"7.0": "a"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "a"
},
"bb": {
"7": "n",
"10": "a"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "a"
},
"and_chr": {
"0": "a"
},
"and_ff": {
"0": "y"
},
"ie_mob": {
"10": "n"
}
},
"notes": "Partial support in IE refers using <a href=\"http://msdn.microsoft.com/en-us/library/ie/ms535220%28v=vs.85%29.aspx\">a non-standard method</a> of interacting with the clipboard. For other browsers it refers to not supporting the ClipboardEvent constructor.",
"usage_perc_y": 12.83,
"usage_perc_a": 67.91,
"ucprefix": false,
"parent": "",
"keywords": "cut,copy,paste,clipboarddata"
},
"rtcpeerconnection": {
"title": "WebRTC Peer-to-peer connections",
"description": "Method of allowing two users to communicate directly, browser to browser using the RTCPeerConnection API.",
"spec": "http://www.w3.org/TR/webrtc/#peer-to-peer-connections",
"status": "wd",
"links": [{
"url": "http://www.webrtc.org/",
"title": "WebRTC Project site"
}],
"categories": ["JS API"],
"stats": {
"ie": {
"5.5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n"
},
"firefox": {
"2": "n",
"3": "n",
"3.5": "n",
"3.6": "n",
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "y x",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x"
},
"chrome": {
"4": "n",
"5": "n",
"6": "n",
"7": "n",
"8": "n",
"9": "n",
"10": "n",
"11": "n",
"12": "n",
"13": "n",
"14": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n",
"19": "n",
"20": "n",
"21": "n",
"22": "n",
"23": "y x",
"24": "y x",
"25": "y x",
"26": "y x",
"27": "y x",
"28": "y x",
"29": "y x",
"30": "y x",
"31": "y x",
"32": "y x"
},
"safari": {
"3.1": "n",
"3.2": "n",
"4": "n",
"5": "n",
"5.1": "n",
"6": "n",
"6.1": "u",
"7": "u"
},
"opera": {
"9": "n",
"9.5-9.6": "n",
"10.0-10.1": "n",
"10.5": "n",
"10.6": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"11.6": "n",
"12": "n",
"12.1": "n",
"15": "n",
"16": "n",
"17": "n",
"18": "n"
},
"ios_saf": {
"3.2": "n",
"4.0-4.1": "n",
"4.2-4.3": "n",
"5.0-5.1": "n",
"6.0-6.1": "n",
"7.0": "n"
},
"op_mini": {
"5.0-7.0": "n"
},
"android": {
"2.1": "n",
"2.2": "n",
"2.3": "n",
"3": "n",
"4": "n",
"4.1": "n",
"4.2-4.3": "n",
"4.4": "n"
},
"bb": {
"7": "n",
"10": "n"
},
"op_mob": {
"10": "n",
"11": "n",
"11.1": "n",
"11.5": "n",
"12": "n",
"12.1": "n",
"0": "y x"
},
"and_chr": {
"0": "y x"
},
"and_ff": {
"0": "y x"
},
"ie_mob": {
"10": "n"
}
},
"notes": "BlackBerry 10 recognizes RTCPeerConnection but real support is unconfirmed.",
"usage_perc_y": 46.24,
"usage_perc_a": 0,
"ucprefix": false,
"parent": "",
"keywords": ""
}
}
}
},{}],36:[function(require,module,exports){
/**
* Abstract implementation of edit tree interface.
* Edit tree is a named container of editable “name-value” child elements,
* parsed from <code>source</code>. This container provides convenient methods
* for editing/adding/removing child elements. All these update actions are
* instantly reflected in the <code>source</code> code with respect of formatting.
* <br><br>
* For example, developer can create an edit tree from CSS rule and add or
* remove properties from it–all changes will be immediately reflected in the
* original source.
* <br><br>
* All classes defined in this module should be extended the same way as in
* Backbone framework: using <code>extend</code> method to create new class and
* <code>initialize</code> method to define custom class constructor.
*
* @example
* <pre><code>
* var MyClass = require('editTree/base').EditElement.extend({
* initialize: function() {
* // constructor code here
* }
* });
*
* var elem = new MyClass();
* </code></pre>
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var range = require('../assets/range');
var utils = require('../utils/common');
var klass = require('../vendor/klass');
/**
* Named container of edited source
* @type EditContainer
* @param {String} source
* @param {Object} options
*/
function EditContainer(source, options) {
this.options = utils.extend({offset: 0}, options);
/**
* Source code of edited structure. All changes in the structure are
* immediately reflected into this property
*/
this.source = source;
/**
* List of all editable children
* @private
*/
this._children = [];
/**
* Hash of all positions of container
* @private
*/
this._positions = {
name: 0
};
this.initialize.apply(this, arguments);
}
/**
* The self-propagating extend function for classes.
* @type Function
*/
EditContainer.extend = klass.extend;
EditContainer.prototype = {
type: 'container',
/**
* Child class constructor
*/
initialize: function() {},
/**
* Make position absolute
* @private
* @param {Number} num
* @param {Boolean} isAbsolute
* @returns {Boolean}
*/
_pos: function(num, isAbsolute) {
return num + (isAbsolute ? this.options.offset : 0);
},
/**
* Replace substring of tag's source
* @param {String} value
* @param {Number} start
* @param {Number} end
* @private
*/
_updateSource: function(value, start, end) {
// create modification range
var r = range.create(start, typeof end === 'undefined' ? 0 : end - start);
var delta = value.length - r.length();
var update = function(obj) {
Object.keys(obj).forEach(function(k) {
if (obj[k] >= r.end) {
obj[k] += delta;
}
});
};
// update affected positions of current container
update(this._positions);
// update affected positions of children
var recursiveUpdate = function(items) {
items.forEach(function(item) {
update(item._positions);
if (item.type == 'container') {
recursiveUpdate(item.list());
}
});
};
recursiveUpdate(this.list());
this.source = utils.replaceSubstring(this.source, value, r);
},
/**
* Adds new attribute
* @param {String} name Property name
* @param {String} value Property value
* @param {Number} pos Position at which to insert new property. By
* default the property is inserted at the end of rule
* @returns {EditElement} Newly created element
*/
add: function(name, value, pos) {
// this is abstract implementation
var item = new EditElement(name, value);
this._children.push(item);
return item;
},
/**
* Returns attribute object
* @param {String} name Attribute name or its index
* @returns {EditElement}
*/
get: function(name) {
if (typeof name === 'number') {
return this.list()[name];
}
if (typeof name === 'string') {
return utils.find(this.list(), function(prop) {
return prop.name() === name;
});
}
return name;
},
/**
* Returns all children by name or indexes
* @param {Object} name Element name(s) or indexes (<code>String</code>,
* <code>Array</code>, <code>Number</code>)
* @returns {Array}
*/
getAll: function(name) {
if (!Array.isArray(name))
name = [name];
// split names and indexes
var names = [], indexes = [];
name.forEach(function(item) {
if (typeof item === 'string') {
names.push(item);
} else if (typeof item === 'number') {
indexes.push(item);
}
});
return this.list().filter(function(attribute, i) {
return ~indexes.indexOf(i) || ~names.indexOf(attribute.name());
});
},
/**
* Returns list of all editable child elements
* @returns {Array}
*/
list: function() {
return this._children;
},
/**
* Remove child element
* @param {String} name Property name or its index
*/
remove: function(name) {
var element = this.get(name);
if (element) {
this._updateSource('', element.fullRange());
var ix = this._children.indexOf(element);
if (~ix) {
this._children.splice(ix, 1);
}
}
},
/**
* Returns index of editble child in list
* @param {Object} item
* @returns {Number}
*/
indexOf: function(item) {
return this.list().indexOf(this.get(item));
},
/**
* Returns or updates element value. If such element doesn't exists,
* it will be created automatically and added at the end of child list.
* @param {String} name Element name or its index
* @param {String} value New element value
* @returns {String}
*/
value: function(name, value, pos) {
var element = this.get(name);
if (element)
return element.value(value);
if (typeof value !== 'undefined') {
// no such element — create it
return this.add(name, value, pos);
}
},
/**
* Returns all values of child elements found by <code>getAll()</code>
* method
* @param {Object} name Element name(s) or indexes (<code>String</code>,
* <code>Array</code>, <code>Number</code>)
* @returns {Array}
*/
values: function(name) {
return this.getAll(name).map(function(element) {
return element.value();
});
},
/**
* Sets or gets container name
* @param {String} val New name. If not passed, current
* name is returned
* @return {String}
*/
name: function(val) {
if (typeof val !== 'undefined' && this._name !== (val = String(val))) {
this._updateSource(val, this._positions.name, this._positions.name + this._name.length);
this._name = val;
}
return this._name;
},
/**
* Returns name range object
* @param {Boolean} isAbsolute Return absolute range (with respect of
* rule offset)
* @returns {Range}
*/
nameRange: function(isAbsolute) {
return range.create(this._positions.name + (isAbsolute ? this.options.offset : 0), this.name());
},
/**
* Returns range of current source
* @param {Boolean} isAbsolute
*/
range: function(isAbsolute) {
return range.create(isAbsolute ? this.options.offset : 0, this.valueOf());
},
/**
* Returns element that belongs to specified position
* @param {Number} pos
* @param {Boolean} isAbsolute
* @returns {EditElement}
*/
itemFromPosition: function(pos, isAbsolute) {
return utils.find(this.list(), function(elem) {
return elem.range(isAbsolute).inside(pos);
});
},
/**
* Returns source code of current container
* @returns {String}
*/
toString: function() {
return this.valueOf();
},
valueOf: function() {
return this.source;
}
};
/**
* @param {EditContainer} parent
* @param {Object} nameToken
* @param {Object} valueToken
*/
function EditElement(parent, nameToken, valueToken) {
/** @type EditContainer */
this.parent = parent;
this._name = nameToken.value;
this._value = valueToken ? valueToken.value : '';
this._positions = {
name: nameToken.start,
value: valueToken ? valueToken.start : -1
};
this.initialize.apply(this, arguments);
}
/**
* The self-propagating extend function for classes.
* @type Function
*/
EditElement.extend = klass.extend;
EditElement.prototype = {
type: 'element',
/**
* Child class constructor
*/
initialize: function() {},
/**
* Make position absolute
* @private
* @param {Number} num
* @param {Boolean} isAbsolute
* @returns {Boolean}
*/
_pos: function(num, isAbsolute) {
return num + (isAbsolute ? this.parent.options.offset : 0);
},
/**
* Sets of gets element value
* @param {String} val New element value. If not passed, current
* value is returned
* @returns {String}
*/
value: function(val) {
if (typeof val !== 'undefined' && this._value !== (val = String(val))) {
this.parent._updateSource(val, this.valueRange());
this._value = val;
}
return this._value;
},
/**
* Sets of gets element name
* @param {String} val New element name. If not passed, current
* name is returned
* @returns {String}
*/
name: function(val) {
if (typeof val !== 'undefined' && this._name !== (val = String(val))) {
this.parent._updateSource(val, this.nameRange());
this._name = val;
}
return this._name;
},
/**
* Returns position of element name token
* @param {Boolean} isAbsolute Return absolute position
* @returns {Number}
*/
namePosition: function(isAbsolute) {
return this._pos(this._positions.name, isAbsolute);
},
/**
* Returns position of element value token
* @param {Boolean} isAbsolute Return absolute position
* @returns {Number}
*/
valuePosition: function(isAbsolute) {
return this._pos(this._positions.value, isAbsolute);
},
/**
* Returns element name
* @param {Boolean} isAbsolute Return absolute range
* @returns {Range}
*/
range: function(isAbsolute) {
return range.create(this.namePosition(isAbsolute), this.valueOf());
},
/**
* Returns full element range, including possible indentation
* @param {Boolean} isAbsolute Return absolute range
* @returns {Range}
*/
fullRange: function(isAbsolute) {
return this.range(isAbsolute);
},
/**
* Returns element name range
* @param {Boolean} isAbsolute Return absolute range
* @returns {Range}
*/
nameRange: function(isAbsolute) {
return range.create(this.namePosition(isAbsolute), this.name());
},
/**
* Returns element value range
* @param {Boolean} isAbsolute Return absolute range
* @returns {Range}
*/
valueRange: function(isAbsolute) {
return range.create(this.valuePosition(isAbsolute), this.value());
},
/**
* Returns current element string representation
* @returns {String}
*/
toString: function() {
return this.valueOf();
},
valueOf: function() {
return this.name() + this.value();
}
};
return {
EditContainer: EditContainer,
EditElement: EditElement,
/**
* Creates token that can be fed to <code>EditElement</code>
* @param {Number} start
* @param {String} value
* @param {String} type
* @returns
*/
createToken: function(start, value, type) {
var obj = {
start: start || 0,
value: value || '',
type: type
};
obj.end = obj.start + obj.value.length;
return obj;
}
};
});
},{"../assets/range":30,"../utils/common":73,"../vendor/klass":78}],37:[function(require,module,exports){
/**
* CSS EditTree is a module that can parse a CSS rule into a tree with
* convenient methods for adding, modifying and removing CSS properties. These
* changes can be written back to string with respect of code formatting.
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
var editTree = require('./base');
var cssParser = require('../parser/css');
var cssSections = require('../utils/cssSections');
var range = require('../assets/range');
var stringStream = require('../assets/stringStream');
var tokenIterator = require('../assets/tokenIterator');
var defaultOptions = {
styleBefore: '\n\t',
styleSeparator: ': ',
offset: 0
};
var reSpaceStart = /^\s+/;
var reSpaceEnd = /\s+$/;
var WHITESPACE_REMOVE_FROM_START = 1;
var WHITESPACE_REMOVE_FROM_END = 2;
/**
* Modifies given range to remove whitespace from beginning
* and/or from the end
* @param {Range} rng Range to modify
* @param {String} text Text that range belongs to
* @param {Number} mask Mask indicating from which end
* whitespace should be removed
* @return {Range}
*/
function trimWhitespaceInRange(rng, text, mask) {
mask = mask || (WHITESPACE_REMOVE_FROM_START | WHITESPACE_REMOVE_FROM_END);
text = rng.substring(text);
var m;
if ((mask & WHITESPACE_REMOVE_FROM_START) && (m = text.match(reSpaceStart))) {
rng.start += m[0].length;
}
if ((mask & WHITESPACE_REMOVE_FROM_END) && (m = text.match(reSpaceEnd))) {
rng.end -= m[0].length;
}
// in case given range is just a whatespace
if (rng.end < rng.start) {
rng.end = rng.start;
}
return rng;
}
/**
* Consumes CSS property and value from current token
* iterator state. Offsets iterator pointer into token
* that can be used for next value consmption
* @param {TokenIterator} it
* @param {String} text
* @return {Object} Object with `name` and `value` properties
* ar ranges. Value range can be zero-length.
*/
function consumeSingleProperty(it, text) {
var name, value, end;
var token = it.current();
if (!token) {
return null;
}
// skip whitespace
var ws = {'white': 1, 'line': 1, 'comment': 1};
while ((token = it.current())) {
if (!(token.type in ws)) {
break;
}
it.next();
}
if (!it.hasNext()) {
return null;
}
// consume property name
token = it.current();
name = range(token.start, token.value);
var isAtProperty = token.value.charAt(0) == '@';
while (token = it.next()) {
name.end = token.end;
if (token.type == ':' || token.type == 'white') {
name.end = token.start;
it.next();
if (token.type == ':' || isAtProperty) {
// XXX I really ashame of this hardcode, but I need
// to stop parsing if this is an SCSS mixin call,
// for example: @include border-radius(10px)
break;
}
} else if (token.type == ';' || token.type == 'line') {
// there’s no value, looks like a mixin
// or a special use case:
// user is writing a new property or abbreviation
name.end = token.start;
value = range(token.start, 0);
it.next();
break;
}
}
token = it.current();
if (!value && token) {
if (token.type == 'line') {
lastNewline = token;
}
// consume value
value = range(token.start, token.value);
var lastNewline;
while ((token = it.next())) {
value.end = token.end;
if (token.type == 'line') {
lastNewline = token;
} else if (token.type == '}' || token.type == ';') {
value.end = token.start;
if (token.type == ';') {
end = range(token.start, token.value);
}
it.next();
break;
} else if (token.type == ':' && lastNewline) {
// A special case:
// user is writing a value before existing
// property, but didn’t inserted closing semi-colon.
// In this case, limit value range to previous
// newline
value.end = lastNewline.start;
it._i = it.tokens.indexOf(lastNewline);
break;
}
}
}
if (!value) {
value = range(name.end, 0);
}
return {
name: trimWhitespaceInRange(name, text),
value: trimWhitespaceInRange(value, text, WHITESPACE_REMOVE_FROM_START | (end ? WHITESPACE_REMOVE_FROM_END : 0)),
end: end || range(value.end, 0)
};
}
/**
* Finds parts of complex CSS value
* @param {String} str
* @returns {Array} Returns list of <code>Range</code>'s
*/
function findParts(str) {
/** @type StringStream */
var stream = stringStream.create(str);
var ch;
var result = [];
var sep = /[\s\u00a0,;]/;
var add = function() {
stream.next();
result.push(range(stream.start, stream.current()));
stream.start = stream.pos;
};
// skip whitespace
stream.eatSpace();
stream.start = stream.pos;
while ((ch = stream.next())) {
if (ch == '"' || ch == "'") {
stream.next();
if (!stream.skipTo(ch)) break;
add();
} else if (ch == '(') {
// function found, may have nested function
stream.backUp(1);
if (!stream.skipToPair('(', ')')) break;
stream.backUp(1);
add();
} else {
if (sep.test(ch)) {
result.push(range(stream.start, stream.current().length - 1));
stream.eatWhile(sep);
stream.start = stream.pos;
}
}
}
add();
return utils.unique(result.filter(function(item) {
return !!item.length();
}));
}
/**
* Parses CSS properties from given CSS source
* and adds them to CSSEditContainer node
* @param {CSSEditContainer} node
* @param {String} source CSS source
* @param {Number} offset Offset of properties subset from original source
*/
function consumeProperties(node, source, offset) {
var list = extractPropertiesFromSource(source, offset);
list.forEach(function(property) {
node._children.push(new CSSEditElement(node,
editTree.createToken(property.name.start, property.nameText),
editTree.createToken(property.value.start, property.valueText),
editTree.createToken(property.end.start, property.endText)
));
});
}
/**
* Parses given CSS source and returns list of ranges of located CSS properties.
* Normally, CSS source must contain properties only, it must be,
* for example, a content of CSS selector or text between nested
* CSS sections
* @param {String} source CSS source
* @param {Number} offset Offset of properties subset from original source.
* Used to provide proper ranges of locates items
*/
function extractPropertiesFromSource(source, offset) {
offset = offset || 0;
source = source.replace(reSpaceEnd, '');
var out = [];
if (!source) {
return out;
}
var tokens = cssParser.parse(source);
var it = tokenIterator.create(tokens);
var property;
while ((property = consumeSingleProperty(it, source))) {
out.push({
nameText: property.name.substring(source),
name: property.name.shift(offset),
valueText: property.value.substring(source),
value: property.value.shift(offset),
endText: property.end.substring(source),
end: property.end.shift(offset)
});
}
return out;
}
/**
* @class
* @extends EditContainer
*/
var CSSEditContainer = editTree.EditContainer.extend({
initialize: function(source, options) {
utils.extend(this.options, defaultOptions, options);
if (Array.isArray(source)) {
source = cssParser.toSource(source);
}
var allRules = cssSections.findAllRules(source);
var currentRule = allRules.shift();
// keep top-level rules only since they will
// be parsed by nested CSSEditContainer call
var topLevelRules = [];
allRules.forEach(function(r) {
var isTopLevel = !utils.find(topLevelRules, function(tr) {
return tr.contains(r);
});
if (isTopLevel) {
topLevelRules.push(r);
}
});
var selectorRange = range.create2(currentRule.start, currentRule._selectorEnd);
this._name = selectorRange.substring(source);
this._positions.name = selectorRange.start;
this._positions.contentStart = currentRule._contentStart + 1;
var sectionOffset = currentRule._contentStart + 1;
var sectionEnd = currentRule.end - 1;
// parse properties between nested rules
// and add nested rules as children
var that = this;
topLevelRules.forEach(function(r) {
consumeProperties(that, source.substring(sectionOffset, r.start), sectionOffset);
var opt = utils.extend({}, that.options, {offset: r.start + that.options.offset});
// XXX I think I don’t need nested containers here
// They should be handled separately
// that._children.push(new CSSEditContainer(r.substring(source), opt));
sectionOffset = r.end;
});
// consume the rest of data
consumeProperties(this, source.substring(sectionOffset, currentRule.end - 1), sectionOffset);
this._saveStyle();
},
/**
* Remembers all styles of properties
* @private
*/
_saveStyle: function() {
var start = this._positions.contentStart;
var source = this.source;
this.list().forEach(function(p) {
if (p.type === 'container') {
return;
}
p.styleBefore = source.substring(start, p.namePosition());
// a small hack here:
// Sometimes users add empty lines before properties to logically
// separate groups of properties. In this case, a blind copy of
// characters between rules may lead to undesired behavior,
// especially when current rule is duplicated or used as a donor
// to create new rule.
// To solve this issue, we‘ll take only last newline indentation
var lines = utils.splitByLines(p.styleBefore);
if (lines.length > 1) {
p.styleBefore = '\n' + lines[lines.length - 1];
}
p.styleSeparator = source.substring(p.nameRange().end, p.valuePosition());
// graceful and naive comments removal
var parts = p.styleBefore.split('*/');
p.styleBefore = parts[parts.length - 1];
p.styleSeparator = p.styleSeparator.replace(/\/\*.*?\*\//g, '');
start = p.range().end;
});
},
/**
* Returns position of element name token
* @param {Boolean} isAbsolute Return absolute position
* @returns {Number}
*/
namePosition: function(isAbsolute) {
return this._pos(this._positions.name, isAbsolute);
},
/**
* Returns position of element value token
* @param {Boolean} isAbsolute Return absolute position
* @returns {Number}
*/
valuePosition: function(isAbsolute) {
return this._pos(this._positions.contentStart, isAbsolute);
},
/**
* Returns element value range
* @param {Boolean} isAbsolute Return absolute range
* @returns {Range}
*/
valueRange: function(isAbsolute) {
return range.create2(this.valuePosition(isAbsolute), this._pos(this.valueOf().length, isAbsolute) - 1);
},
/**
* Adds new CSS property
* @param {String} name Property name
* @param {String} value Property value
* @param {Number} pos Position at which to insert new property. By
* default the property is inserted at the end of rule
* @returns {CSSEditProperty}
*/
add: function(name, value, pos) {
var list = this.list();
var start = this._positions.contentStart;
var styles = utils.pick(this.options, 'styleBefore', 'styleSeparator');
if (typeof pos === 'undefined') {
pos = list.length;
}
/** @type CSSEditProperty */
var donor = list[pos];
if (donor) {
start = donor.fullRange().start;
} else if ((donor = list[pos - 1])) {
// make sure that donor has terminating semicolon
donor.end(';');
start = donor.range().end;
}
if (donor) {
styles = utils.pick(donor, 'styleBefore', 'styleSeparator');
}
var nameToken = editTree.createToken(start + styles.styleBefore.length, name);
var valueToken = editTree.createToken(nameToken.end + styles.styleSeparator.length, value);
var property = new CSSEditElement(this, nameToken, valueToken,
editTree.createToken(valueToken.end, ';'));
utils.extend(property, styles);
// write new property into the source
this._updateSource(property.styleBefore + property.toString(), start);
// insert new property
this._children.splice(pos, 0, property);
return property;
}
});
/**
* @class
* @type CSSEditElement
* @constructor
*/
var CSSEditElement = editTree.EditElement.extend({
initialize: function(rule, name, value, end) {
this.styleBefore = rule.options.styleBefore;
this.styleSeparator = rule.options.styleSeparator;
this._end = end.value;
this._positions.end = end.start;
},
/**
* Returns ranges of complex value parts
* @returns {Array} Returns <code>null</code> if value is not complex
*/
valueParts: function(isAbsolute) {
var parts = findParts(this.value());
if (isAbsolute) {
var offset = this.valuePosition(true);
parts.forEach(function(p) {
p.shift(offset);
});
}
return parts;
},
/**
* Sets of gets element value.
* When setting value, this implementation will ensure that your have
* proper name-value separator
* @param {String} val New element value. If not passed, current
* value is returned
* @returns {String}
*/
value: function(val) {
var isUpdating = typeof val !== 'undefined';
var allItems = this.parent.list();
if (isUpdating && this.isIncomplete()) {
var self = this;
var donor = utils.find(allItems, function(item) {
return item !== self && !item.isIncomplete();
});
this.styleSeparator = donor
? donor.styleSeparator
: this.parent.options.styleSeparator;
this.parent._updateSource(this.styleSeparator, range(this.valueRange().start, 0));
}
var value = this.constructor.__super__.value.apply(this, arguments);
if (isUpdating) {
// make sure current property has terminating semi-colon
// if it’s not the last one
var ix = allItems.indexOf(this);
if (ix !== allItems.length - 1 && !this.end()) {
this.end(';');
}
}
return value;
},
/**
* Test if current element is incomplete, e.g. has no explicit
* name-value separator
* @return {Boolean} [description]
*/
isIncomplete: function() {
return this.nameRange().end === this.valueRange().start;
},
/**
* Sets of gets property end value (basically, it's a semicolon)
* @param {String} val New end value. If not passed, current
* value is returned
*/
end: function(val) {
if (typeof val !== 'undefined' && this._end !== val) {
this.parent._updateSource(val, this._positions.end, this._positions.end + this._end.length);
this._end = val;
}
return this._end;
},
/**
* Returns full rule range, with indentation
* @param {Boolean} isAbsolute Return absolute range (with respect of
* rule offset)
* @returns {Range}
*/
fullRange: function(isAbsolute) {
var r = this.range(isAbsolute);
r.start -= this.styleBefore.length;
return r;
},
/**
* Returns item string representation
* @returns {String}
*/
valueOf: function() {
return this.name() + this.styleSeparator + this.value() + this.end();
}
});
return {
/**
* Parses CSS rule into editable tree
* @param {String} source
* @param {Object} options
* @memberOf emmet.cssEditTree
* @returns {EditContainer}
*/
parse: function(source, options) {
return new CSSEditContainer(source, options);
},
/**
* Extract and parse CSS rule from specified position in <code>content</code>
* @param {String} content CSS source code
* @param {Number} pos Character position where to start source code extraction
* @returns {EditContainer}
*/
parseFromPosition: function(content, pos, isBackward) {
var bounds = cssSections.locateRule(content, pos, isBackward);
if (!bounds || !bounds.inside(pos)) {
// no matching CSS rule or caret outside rule bounds
return null;
}
return this.parse(bounds.substring(content), {
offset: bounds.start
});
},
/**
* Locates CSS property in given CSS code fragment under specified character position
* @param {String} css CSS code or parsed CSSEditContainer
* @param {Number} pos Character position where to search CSS property
* @return {CSSEditElement}
*/
propertyFromPosition: function(css, pos) {
var cssProp = null;
/** @type EditContainer */
var cssRule = typeof css === 'string' ? this.parseFromPosition(css, pos, true) : css;
if (cssRule) {
cssProp = cssRule.itemFromPosition(pos, true);
if (!cssProp) {
// in case user just started writing CSS property
// and didn't include semicolon–try another approach
cssProp = utils.find(cssRule.list(), function(elem) {
return elem.range(true).end == pos;
});
}
}
return cssProp;
},
/**
* Removes vendor prefix from CSS property
* @param {String} name CSS property
* @return {String}
*/
baseName: function(name) {
return name.replace(/^\s*\-\w+\-/, '');
},
/**
* Finds parts of complex CSS value
* @param {String} str
* @returns {Array}
*/
findParts: findParts,
extractPropertiesFromSource: extractPropertiesFromSource
};
});
},{"../assets/range":30,"../assets/stringStream":32,"../assets/tokenIterator":34,"../parser/css":56,"../utils/common":73,"../utils/cssSections":74,"./base":36}],38:[function(require,module,exports){
/**
* XML EditTree is a module that can parse an XML/HTML element into a tree with
* convenient methods for adding, modifying and removing attributes. These
* changes can be written back to string with respect of code formatting.
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var editTree = require('./base');
var xmlParser = require('../parser/xml');
var range = require('../assets/range');
var utils = require('../utils/common');
var defaultOptions = {
styleBefore: ' ',
styleSeparator: '=',
styleQuote: '"',
offset: 0
};
var startTag = /^<([\w\:\-]+)((?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/m;
var XMLEditContainer = editTree.EditContainer.extend({
initialize: function(source, options) {
utils.defaults(this.options, defaultOptions);
this._positions.name = 1;
var attrToken = null;
var tokens = xmlParser.parse(source);
tokens.forEach(function(token) {
token.value = range.create(token).substring(source);
switch (token.type) {
case 'tag':
if (/^<[^\/]+/.test(token.value)) {
this._name = token.value.substring(1);
}
break;
case 'attribute':
// add empty attribute
if (attrToken) {
this._children.push(new XMLEditElement(this, attrToken));
}
attrToken = token;
break;
case 'string':
this._children.push(new XMLEditElement(this, attrToken, token));
attrToken = null;
break;
}
}, this);
if (attrToken) {
this._children.push(new XMLEditElement(this, attrToken));
}
this._saveStyle();
},
/**
* Remembers all styles of properties
* @private
*/
_saveStyle: function() {
var start = this.nameRange().end;
var source = this.source;
this.list().forEach(function(p) {
p.styleBefore = source.substring(start, p.namePosition());
if (p.valuePosition() !== -1) {
p.styleSeparator = source.substring(p.namePosition() + p.name().length, p.valuePosition() - p.styleQuote.length);
}
start = p.range().end;
});
},
/**
* Adds new attribute
* @param {String} name Property name
* @param {String} value Property value
* @param {Number} pos Position at which to insert new property. By
* default the property is inserted at the end of rule
*/
add: function(name, value, pos) {
var list = this.list();
var start = this.nameRange().end;
var styles = utils.pick(this.options, 'styleBefore', 'styleSeparator', 'styleQuote');
if (typeof pos === 'undefined') {
pos = list.length;
}
/** @type XMLEditAttribute */
var donor = list[pos];
if (donor) {
start = donor.fullRange().start;
} else if ((donor = list[pos - 1])) {
start = donor.range().end;
}
if (donor) {
styles = utils.pick(donor, 'styleBefore', 'styleSeparator', 'styleQuote');
}
value = styles.styleQuote + value + styles.styleQuote;
var attribute = new XMLEditElement(this,
editTree.createToken(start + styles.styleBefore.length, name),
editTree.createToken(start + styles.styleBefore.length + name.length
+ styles.styleSeparator.length, value)
);
utils.extend(attribute, styles);
// write new attribute into the source
this._updateSource(attribute.styleBefore + attribute.toString(), start);
// insert new attribute
this._children.splice(pos, 0, attribute);
return attribute;
},
/**
* A special case of attribute editing: adds class value to existing
* `class` attribute
* @param {String} value
*/
addClass: function(value) {
var attr = this.get('class');
value = utils.trim(value);
if (!attr) {
return this.add('class', value);
}
var classVal = attr.value();
var classList = ' ' + classVal.replace(/\n/g, ' ') + ' ';
if (!~classList.indexOf(' ' + value + ' ')) {
attr.value(classVal + ' ' + value);
}
},
/**
* A special case of attribute editing: removes class value from existing
* `class` attribute
* @param {String} value
*/
removeClass: function(value) {
var attr = this.get('class');
value = utils.trim(value);
if (!attr) {
return;
}
var reClass = new RegExp('(^|\\s+)' + utils.escapeForRegexp(value));
var classVal = attr.value().replace(reClass, '');
if (!utils.trim(classVal)) {
this.remove('class');
} else {
attr.value(classVal);
}
}
});
var XMLEditElement = editTree.EditElement.extend({
initialize: function(parent, nameToken, valueToken) {
this.styleBefore = parent.options.styleBefore;
this.styleSeparator = parent.options.styleSeparator;
var value = '', quote = parent.options.styleQuote;
if (valueToken) {
value = valueToken.value;
quote = value.charAt(0);
if (quote == '"' || quote == "'") {
value = value.substring(1);
} else {
quote = '';
}
if (quote && value.charAt(value.length - 1) == quote) {
value = value.substring(0, value.length - 1);
}
}
this.styleQuote = quote;
this._value = value;
this._positions.value = valueToken ? valueToken.start + quote.length : -1;
},
/**
* Returns full rule range, with indentation
* @param {Boolean} isAbsolute Return absolute range (with respect of
* rule offset)
* @returns {Range}
*/
fullRange: function(isAbsolute) {
var r = this.range(isAbsolute);
r.start -= this.styleBefore.length;
return r;
},
valueOf: function() {
return this.name() + this.styleSeparator
+ this.styleQuote + this.value() + this.styleQuote;
}
});
return {
/**
* Parses HTML element into editable tree
* @param {String} source
* @param {Object} options
* @memberOf emmet.htmlEditTree
* @returns {EditContainer}
*/
parse: function(source, options) {
return new XMLEditContainer(source, options);
},
/**
* Extract and parse HTML from specified position in <code>content</code>
* @param {String} content CSS source code
* @param {Number} pos Character position where to start source code extraction
* @returns {XMLEditElement}
*/
parseFromPosition: function(content, pos, isBackward) {
var bounds = this.extractTag(content, pos, isBackward);
if (!bounds || !bounds.inside(pos))
// no matching HTML tag or caret outside tag bounds
return null;
return this.parse(bounds.substring(content), {
offset: bounds.start
});
},
/**
* Extracts nearest HTML tag range from <code>content</code>, starting at
* <code>pos</code> position
* @param {String} content
* @param {Number} pos
* @param {Boolean} isBackward
* @returns {Range}
*/
extractTag: function(content, pos, isBackward) {
var len = content.length, i;
// max extraction length. I don't think there may be tags larger
// than 2000 characters length
var maxLen = Math.min(2000, len);
/** @type Range */
var r = null;
var match = function(pos) {
var m;
if (content.charAt(pos) == '<' && (m = content.substr(pos, maxLen).match(startTag)))
return range.create(pos, m[0]);
};
// lookup backward, in case we are inside tag already
for (i = pos; i >= 0; i--) {
if ((r = match(i))) break;
}
if (r && (r.inside(pos) || isBackward))
return r;
if (!r && isBackward)
return null;
// search forward
for (i = pos; i < len; i++) {
if ((r = match(i)))
return r;
}
}
};
});
},{"../assets/range":30,"../parser/xml":62,"../utils/common":73,"./base":36}],39:[function(require,module,exports){
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var global = typeof self != 'undefined' ? self : this;
var utils = require('./utils/common');
var actions = require('./action/main');
var parser = require('./parser/abbreviation');
var file = require('./plugin/file');
var preferences = require('./assets/preferences');
var resources = require('./assets/resources');
var profile = require('./assets/profile');
var ciu = require('./assets/caniuse');
var logger = require('./assets/logger');
var sliceFn = Array.prototype.slice;
/**
* Returns file name part from path
* @param {String} path Path to file
* @return {String}
*/
function getFileName(path) {
var re = /([\w\.\-]+)$/i;
var m = re.exec(path);
return m ? m[1] : '';
}
/**
* Normalizes profile definition: converts some
* properties to valid data types
* @param {Object} profile
* @return {Object}
*/
function normalizeProfile(profile) {
if (typeof profile === 'object') {
if ('indent' in profile) {
profile.indent = !!profile.indent;
}
if ('self_closing_tag' in profile) {
if (typeof profile.self_closing_tag === 'number') {
profile.self_closing_tag = !!profile.self_closing_tag;
}
}
}
return profile;
}
return {
/**
* The essential function that expands Emmet abbreviation
* @param {String} abbr Abbreviation to parse
* @param {String} syntax Abbreviation's context syntax
* @param {String} profile Output profile (or its name)
* @param {Object} contextNode Contextual node where abbreviation is
* written
* @return {String}
*/
expandAbbreviation: function(abbr, syntax, profile, contextNode) {
return parser.expand(abbr, {
syntax: syntax,
profile: profile,
contextNode: contextNode
});
},
/**
* Runs given action
* @param {String} name Action name
* @param {IEmmetEditor} editor Editor instance
* @return {Boolean} Returns true if action was performed successfully
*/
run: function(name) {
return actions.run.apply(actions, sliceFn.call(arguments, 0));
},
/**
* Loads Emmet extensions. Extensions are simple .js files that
* uses Emmet modules and resources to create new actions, modify
* existing ones etc.
* @param {Array} fileList List of absolute paths to files in extensions
* folder. Back-end app should not filter this list (e.g. by extension)
* but return it "as-is" so bootstrap can decide how to load contents
* of each file.
* This method requires a <code>file</code> module of <code>IEmmetFile</code>
* interface to be implemented.
* @memberOf bootstrap
*/
loadExtensions: function(fileList) {
var payload = {};
var userSnippets = null;
var that = this;
// make sure file list contians only valid extension files
fileList = fileList.filter(function(f) {
var ext = file.getExt(f);
return ext === 'json' || ext === 'js';
});
var reader = (file.readText || file.read).bind(file);
var next = function() {
if (fileList.length) {
var f = fileList.shift();
reader(f, function(err, content) {
if (err) {
logger.log('Unable to read "' + f + '" file: '+ err);
return next();
}
switch (file.getExt(f)) {
case 'js':
try {
eval(content);
} catch (e) {
logger.log('Unable to eval "' + f + '" file: '+ e);
}
break;
case 'json':
var fileName = getFileName(f).toLowerCase().replace(/\.json$/, '');
if (/^snippets/.test(fileName)) {
if (fileName === 'snippets') {
// data in snippets.json is more important to user
userSnippets = utils.parseJSON(content);
} else {
payload.snippets = utils.deepMerge(payload.snippets || {}, utils.parseJSON(content));
}
} else {
payload[fileName] = content;
}
break;
}
next();
});
} else {
// complete
if (userSnippets) {
payload.snippets = utils.deepMerge(payload.snippets || {}, userSnippets);
}
that.loadUserData(payload);
}
};
next();
},
/**
* Loads preferences from JSON object (or string representation of JSON)
* @param {Object} data
* @returns
*/
loadPreferences: function(data) {
preferences.load(utils.parseJSON(data));
},
/**
* Loads user snippets and abbreviations. It doesn’t replace current
* user resource vocabulary but merges it with passed one. If you need
* to <i>replaces</i> user snippets you should call
* <code>resetSnippets()</code> method first
*/
loadSnippets: function(data) {
data = utils.parseJSON(data);
var userData = resources.getVocabulary('user') || {};
resources.setVocabulary(utils.deepMerge(userData, data), 'user');
},
/**
* Helper function that loads default snippets, defined in project’s
* <i>snippets.json</i>
* @param {Object} data
*/
loadSystemSnippets: function(data) {
resources.setVocabulary(utils.parseJSON(data), 'system');
},
/**
* Helper function that loads Can I Use database
* @param {Object} data
*/
loadCIU: function(data) {
ciu.load(utils.parseJSON(data));
},
/**
* Removes all user-defined snippets
*/
resetSnippets: function() {
resources.setVocabulary({}, 'user');
},
/**
* Helper function that loads all user data (snippets and preferences)
* defined as a single JSON object. This is useful for loading data
* stored in a common storage, for example <code>NSUserDefaults</code>
* @param {Object} data
*/
loadUserData: function(data) {
data = utils.parseJSON(data);
if (data.snippets) {
this.loadSnippets(data.snippets);
}
if (data.preferences) {
this.loadPreferences(data.preferences);
}
if (data.profiles) {
this.loadProfiles(data.profiles);
}
if (data.caniuse) {
this.loadCIU(data.caniuse);
}
var profiles = data.syntaxProfiles || data.syntaxprofiles;
if (profiles) {
this.loadSyntaxProfiles(profiles);
}
},
/**
* Resets all user-defined data: preferences, snippets etc.
* @returns
*/
resetUserData: function() {
this.resetSnippets();
preferences.reset();
profile.reset();
},
/**
* Load syntax-specific output profiles. These are essentially
* an extension to syntax snippets
* @param {Object} profiles Dictionary of profiles
*/
loadSyntaxProfiles: function(profiles) {
profiles = utils.parseJSON(profiles);
var snippets = {};
Object.keys(profiles).forEach(function(syntax) {
var options = profiles[syntax];
if (!(syntax in snippets)) {
snippets[syntax] = {};
}
snippets[syntax].profile = normalizeProfile(options);
});
this.loadSnippets(snippets);
},
/**
* Load named profiles
* @param {Object} profiles
*/
loadProfiles: function(profiles) {
profiles = utils.parseJSON(profiles);
Object.keys(profiles).forEach(function(name) {
profile.create(name, normalizeProfile(profiles[name]));
});
},
require: require,
// expose some useful data for plugin authors
actions: actions,
file: file,
preferences: preferences,
resources: resources,
profile: profile,
tabStops: require('./assets/tabStops'),
htmlMatcher: require('./assets/htmlMatcher'),
utils: {
common: utils,
action: require('./utils/action'),
editor: require('./utils/editor')
}
};
});
},{"./action/main":12,"./assets/caniuse":23,"./assets/htmlMatcher":26,"./assets/logger":27,"./assets/preferences":28,"./assets/profile":29,"./assets/resources":31,"./assets/tabStops":33,"./parser/abbreviation":55,"./plugin/file":63,"./utils/action":70,"./utils/common":73,"./utils/editor":75}],40:[function(require,module,exports){
/**
* Filter for aiding of writing elements with complex class names as described
* in Yandex's BEM (Block, Element, Modifier) methodology. This filter will
* automatically inherit block and element names from parent elements and insert
* them into child element classes
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var htmlFilter = require('./html');
var prefs = require('../assets/preferences');
var abbreviationUtils = require('../utils/abbreviation');
var utils = require('../utils/common');
prefs.define('bem.elementSeparator', '__', 'Class name’s element separator.');
prefs.define('bem.modifierSeparator', '_', 'Class name’s modifier separator.');
prefs.define('bem.shortElementPrefix', '-',
'Symbol for describing short “block-element” notation. Class names '
+ 'prefixed with this symbol will be treated as element name for parent‘s '
+ 'block name. Each symbol instance traverses one level up in parsed '
+ 'tree for block name lookup. Empty value will disable short notation.');
var shouldRunHtmlFilter = false;
function getSeparators() {
return {
element: prefs.get('bem.elementSeparator'),
modifier: prefs.get('bem.modifierSeparator')
};
}
/**
* @param {AbbreviationNode} item
*/
function bemParse(item) {
if (abbreviationUtils.isSnippet(item))
return item;
// save BEM stuff in cache for faster lookups
item.__bem = {
block: '',
element: '',
modifier: ''
};
var classNames = normalizeClassName(item.attribute('class')).split(' ');
// guess best match for block name
var reBlockName = /^[a-z]\-/i;
item.__bem.block = utils.find(classNames, function(name) {
return reBlockName.test(name);
});
// guessing doesn't worked, pick first class name as block name
if (!item.__bem.block) {
reBlockName = /^[a-z]/i;
item.__bem.block = utils.find(classNames, function(name) {
return reBlockName.test(name);
}) || '';
}
classNames = classNames.map(function(name) {
return processClassName(name, item);
});
classNames = utils.unique(utils.flatten(classNames)).join(' ');
if (classNames) {
item.attribute('class', classNames);
}
return item;
}
/**
* @param {String} className
* @returns {String}
*/
function normalizeClassName(className) {
className = (' ' + (className || '') + ' ').replace(/\s+/g, ' ');
var shortSymbol = prefs.get('bem.shortElementPrefix');
if (shortSymbol) {
var re = new RegExp('\\s(' + utils.escapeForRegexp(shortSymbol) + '+)', 'g');
className = className.replace(re, function(str, p1) {
return ' ' + utils.repeatString(getSeparators().element, p1.length);
});
}
return utils.trim(className);
}
/**
* Processes class name
* @param {String} name Class name item to process
* @param {AbbreviationNode} item Host node for provided class name
* @returns Processed class name. May return <code>Array</code> of
* class names
*/
function processClassName(name, item) {
name = transformClassName(name, item, 'element');
name = transformClassName(name, item, 'modifier');
// expand class name
// possible values:
// * block__element
// * block__element_modifier
// * block__element_modifier1_modifier2
// * block_modifier
var block = '', element = '', modifier = '';
var separators = getSeparators();
if (~name.indexOf(separators.element)) {
var elements = name.split(separators.element);
block = elements.shift();
var modifiers = elements.pop().split(separators.modifier);
elements.push(modifiers.shift());
element = elements.join(separators.element);
modifier = modifiers.join(separators.modifier);
} else if (~name.indexOf(separators.modifier)) {
var blockModifiers = name.split(separators.modifier);
block = blockModifiers.shift();
modifier = blockModifiers.join(separators.modifier);
}
if (block || element || modifier) {
if (!block) {
block = item.__bem.block;
}
// inherit parent bem element, if exists
// if (item.parent && item.parent.__bem && item.parent.__bem.element)
// element = item.parent.__bem.element + separators.element + element;
// produce multiple classes
var prefix = block;
var result = [];
if (element) {
prefix += separators.element + element;
result.push(prefix);
} else {
result.push(prefix);
}
if (modifier) {
result.push(prefix + separators.modifier + modifier);
}
item.__bem.block = block;
item.__bem.element = element;
item.__bem.modifier = modifier;
return result;
}
// ...otherwise, return processed or original class name
return name;
}
/**
* Low-level function to transform user-typed class name into full BEM class
* @param {String} name Class name item to process
* @param {AbbreviationNode} item Host node for provided class name
* @param {String} entityType Type of entity to be tried to transform
* ('element' or 'modifier')
* @returns {String} Processed class name or original one if it can't be
* transformed
*/
function transformClassName(name, item, entityType) {
var separators = getSeparators();
var reSep = new RegExp('^(' + separators[entityType] + ')+', 'g');
if (reSep.test(name)) {
var depth = 0; // parent lookup depth
var cleanName = name.replace(reSep, function(str) {
depth = str.length / separators[entityType].length;
return '';
});
// find donor element
var donor = item;
while (donor.parent && depth--) {
donor = donor.parent;
}
if (!donor || !donor.__bem)
donor = item;
if (donor && donor.__bem) {
var prefix = donor.__bem.block;
// decide if we should inherit element name
// if (entityType == 'element') {
// var curElem = cleanName.split(separators.modifier, 1)[0];
// if (donor.__bem.element && donor.__bem.element != curElem)
// prefix += separators.element + donor.__bem.element;
// }
if (entityType == 'modifier' && donor.__bem.element)
prefix += separators.element + donor.__bem.element;
return prefix + separators[entityType] + cleanName;
}
}
return name;
}
/**
* Recursive function for processing tags, which extends class names
* according to BEM specs: http://bem.github.com/bem-method/pages/beginning/beginning.ru.html
* <br><br>
* It does several things:<br>
* <ul>
* <li>Expands complex class name (according to BEM symbol semantics):
* .block__elem_modifier → .block.block__elem.block__elem_modifier
* </li>
* <li>Inherits block name on child elements:
* .b-block > .__el > .__el → .b-block > .b-block__el > .b-block__el__el
* </li>
* <li>Treats first dash symbol as '__'</li>
* <li>Double underscore (or typographic '–') is also treated as an element
* level lookup, e.g. ____el will search for element definition in parent’s
* parent element:
* .b-block > .__el1 > .____el2 → .b-block > .b-block__el1 > .b-block__el2
* </li>
* </ul>
*
* @param {AbbreviationNode} tree
* @param {Object} profile
*/
function process(tree, profile) {
if (tree.name) {
bemParse(tree, profile);
}
tree.children.forEach(function(item) {
process(item, profile);
if (!abbreviationUtils.isSnippet(item) && item.start) {
shouldRunHtmlFilter = true;
}
});
return tree;
}
return function(tree, profile) {
shouldRunHtmlFilter = false;
tree = process(tree, profile);
// in case 'bem' filter is applied after 'html' filter: run it again
// to update output
if (shouldRunHtmlFilter) {
tree = htmlFilter(tree, profile);
}
return tree;
};
});
},{"../assets/preferences":28,"../utils/abbreviation":69,"../utils/common":73,"./html":46}],41:[function(require,module,exports){
/**
* Comment important tags (with 'id' and 'class' attributes)
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var prefs = require('../assets/preferences');
var utils = require('../utils/common');
var template = require('../utils/template');
var abbrUtils = require('../utils/abbreviation');
var filterCore = require('./main');
prefs.define('filter.commentAfter',
'\n<!-- /<%= attr("id", "#") %><%= attr("class", ".") %> -->',
'A definition of comment that should be placed <i>after</i> matched '
+ 'element when <code>comment</code> filter is applied. This definition '
+ 'is an ERB-style template passed to <code>_.template()</code> '
+ 'function (see Underscore.js docs for details). In template context, '
+ 'the following properties and functions are availabe:\n'
+ '<ul>'
+ '<li><code>attr(name, before, after)</code> – a function that outputs'
+ 'specified attribute value concatenated with <code>before</code> '
+ 'and <code>after</code> strings. If attribute doesn\'t exists, the '
+ 'empty string will be returned.</li>'
+ '<li><code>node</code> – current node (instance of <code>AbbreviationNode</code>)</li>'
+ '<li><code>name</code> – name of current tag</li>'
+ '<li><code>padding</code> – current string padding, can be used '
+ 'for formatting</li>'
+'</ul>');
prefs.define('filter.commentBefore',
'',
'A definition of comment that should be placed <i>before</i> matched '
+ 'element when <code>comment</code> filter is applied. '
+ 'For more info, read description of <code>filter.commentAfter</code> '
+ 'property');
prefs.define('filter.commentTrigger', 'id, class',
'A comma-separated list of attribute names that should exist in abbreviatoin '
+ 'where comment should be added. If you wish to add comment for '
+ 'every element, set this option to <code>*</code>');
/**
* Add comments to tag
* @param {AbbreviationNode} node
*/
function addComments(node, templateBefore, templateAfter) {
// check if comments should be added
var trigger = prefs.get('filter.commentTrigger');
if (trigger != '*') {
var shouldAdd = utils.find(trigger.split(','), function(name) {
return !!node.attribute(utils.trim(name));
});
if (!shouldAdd) {
return;
}
}
var ctx = {
node: node,
name: node.name(),
padding: node.parent ? node.parent.padding : '',
attr: function(name, before, after) {
var attr = node.attribute(name);
if (attr) {
return (before || '') + attr + (after || '');
}
return '';
}
};
var nodeBefore = templateBefore ? templateBefore(ctx) : '';
var nodeAfter = templateAfter ? templateAfter(ctx) : '';
node.start = node.start.replace(/</, nodeBefore + '<');
node.end = node.end.replace(/>/, '>' + nodeAfter);
}
function process(tree, before, after) {
tree.children.forEach(function(item) {
if (abbrUtils.isBlock(item)) {
addComments(item, before, after);
}
process(item, before, after);
});
return tree;
}
return function(tree) {
var templateBefore = template(prefs.get('filter.commentBefore'));
var templateAfter = template(prefs.get('filter.commentAfter'));
return process(tree, templateBefore, templateAfter);
};
});
},{"../assets/preferences":28,"../utils/abbreviation":69,"../utils/common":73,"../utils/template":77,"./main":49}],42:[function(require,module,exports){
/**
* Filter for outputting CSS and alike
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
/**
* Test if passed item is very first child in parsed tree
* @param {AbbreviationNode} item
*/
function isVeryFirstChild(item) {
return item.parent && !item.parent.parent && !item.index();
}
return function process(tree, profile, level) {
level = level || 0;
tree.children.forEach(function(item) {
if (!isVeryFirstChild(item) && profile.tag_nl !== false) {
item.start = '\n' + item.start;
}
process(item, profile, level + 1);
});
return tree;
};
});
},{}],43:[function(require,module,exports){
/**
* Filter for escaping unsafe XML characters: <, >, &
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var charMap = {
'<': '<',
'>': '>',
'&': '&'
};
function escapeChars(str) {
return str.replace(/([<>&])/g, function(str, p1){
return charMap[p1];
});
}
return function process(tree) {
tree.children.forEach(function(item) {
item.start = escapeChars(item.start);
item.end = escapeChars(item.end);
item.content = escapeChars(item.content);
process(item);
});
return tree;
};
});
},{}],44:[function(require,module,exports){
/**
* Generic formatting filter: creates proper indentation for each tree node,
* placing "%s" placeholder where the actual output should be. You can use
* this filter to preformat tree and then replace %s placeholder to whatever you
* need. This filter should't be called directly from editor as a part
* of abbreviation.
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
var abbrUtils = require('../utils/abbreviation');
var prefs = require('../assets/preferences');
var resources = require('../assets/resources');
prefs.define('format.noIndentTags', 'html',
'A comma-separated list of tag names that should not get inner indentation.');
prefs.define('format.forceIndentationForTags', 'body',
'A comma-separated list of tag names that should <em>always</em> get inner indentation.');
var placeholder = '%s';
/**
* Get indentation for given node
* @param {AbbreviationNode} node
* @returns {String}
*/
function getIndentation(node) {
var items = prefs.getArray('format.noIndentTags') || [];
if (~items.indexOf(node.name())) {
return '';
}
return '\t';
}
/**
* Test if passed node has block-level sibling element
* @param {AbbreviationNode} item
* @return {Boolean}
*/
function hasBlockSibling(item) {
return item.parent && abbrUtils.hasBlockChildren(item.parent);
}
/**
* Test if passed item is very first child in parsed tree
* @param {AbbreviationNode} item
*/
function isVeryFirstChild(item) {
return item.parent && !item.parent.parent && !item.index();
}
/**
* Check if a newline should be added before element
* @param {AbbreviationNode} node
* @param {OutputProfile} profile
* @return {Boolean}
*/
function shouldAddLineBreak(node, profile) {
if (profile.tag_nl === true || abbrUtils.isBlock(node))
return true;
if (!node.parent || !profile.inline_break)
return false;
// check if there are required amount of adjacent inline element
return shouldFormatInline(node.parent, profile);
}
/**
* Need to add newline because <code>item</code> has too many inline children
* @param {AbbreviationNode} node
* @param {OutputProfile} profile
*/
function shouldBreakChild(node, profile) {
// we need to test only one child element, because
// hasBlockChildren() method will do the rest
return node.children.length && shouldAddLineBreak(node.children[0], profile);
}
function shouldFormatInline(node, profile) {
var nodeCount = 0;
return !!utils.find(node.children, function(child) {
if (child.isTextNode() || !abbrUtils.isInline(child))
nodeCount = 0;
else if (abbrUtils.isInline(child))
nodeCount++;
if (nodeCount >= profile.inline_break)
return true;
});
}
function isRoot(item) {
return !item.parent;
}
/**
* Processes element with matched resource of type <code>snippet</code>
* @param {AbbreviationNode} item
* @param {OutputProfile} profile
*/
function processSnippet(item, profile) {
item.start = item.end = '';
if (!isVeryFirstChild(item) && profile.tag_nl !== false && shouldAddLineBreak(item, profile)) {
// check if we’re not inside inline element
if (isRoot(item.parent) || !abbrUtils.isInline(item.parent)) {
item.start = '\n' + item.start;
}
}
return item;
}
/**
* Check if we should add line breaks inside inline element
* @param {AbbreviationNode} node
* @param {OutputProfile} profile
* @return {Boolean}
*/
function shouldBreakInsideInline(node, profile) {
var hasBlockElems = node.children.some(function(child) {
if (abbrUtils.isSnippet(child))
return false;
return !abbrUtils.isInline(child);
});
if (!hasBlockElems) {
return shouldFormatInline(node, profile);
}
return true;
}
/**
* Processes element with <code>tag</code> type
* @param {AbbreviationNode} item
* @param {OutputProfile} profile
*/
function processTag(item, profile) {
item.start = item.end = placeholder;
var isUnary = abbrUtils.isUnary(item);
var nl = '\n';
var indent = getIndentation(item);
// formatting output
if (profile.tag_nl !== false) {
var forceNl = profile.tag_nl === true && (profile.tag_nl_leaf || item.children.length);
if (!forceNl) {
var forceIndentTags = prefs.getArray('format.forceIndentationForTags') || [];
forceNl = ~forceIndentTags.indexOf(item.name());
}
// formatting block-level elements
if (!item.isTextNode()) {
if (shouldAddLineBreak(item, profile)) {
// - do not indent the very first element
// - do not indent first child of a snippet
if (!isVeryFirstChild(item) && (!abbrUtils.isSnippet(item.parent) || item.index()))
item.start = nl + item.start;
if (abbrUtils.hasBlockChildren(item) || shouldBreakChild(item, profile) || (forceNl && !isUnary))
item.end = nl + item.end;
if (abbrUtils.hasTagsInContent(item) || (forceNl && !item.children.length && !isUnary))
item.start += nl + indent;
} else if (abbrUtils.isInline(item) && hasBlockSibling(item) && !isVeryFirstChild(item)) {
item.start = nl + item.start;
} else if (abbrUtils.isInline(item) && shouldBreakInsideInline(item, profile)) {
item.end = nl + item.end;
}
item.padding = indent;
}
}
return item;
}
/**
* Processes simplified tree, making it suitable for output as HTML structure
* @param {AbbreviationNode} tree
* @param {OutputProfile} profile
* @param {Number} level Depth level
*/
return function process(tree, profile, level) {
level = level || 0;
tree.children.forEach(function(item) {
if (abbrUtils.isSnippet(item)) {
processSnippet(item, profile, level);
} else {
processTag(item, profile, level);
}
process(item, profile, level + 1);
});
return tree;
};
});
},{"../assets/preferences":28,"../assets/resources":31,"../utils/abbreviation":69,"../utils/common":73}],45:[function(require,module,exports){
/**
* Filter for producing HAML code from abbreviation.
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
var abbrUtils = require('../utils/abbreviation');
var formatFilter = require('./format');
function transformClassName(className) {
return utils.trim(className).replace(/\s+/g, '.');
}
/**
* Condenses all "data-" attributes into a single entry.
* HAML allows data attributes to be ouputted as a sub-hash
* of `:data` key
* @param {Array} attrs
* @return {Array}
*/
function condenseDataAttrs(attrs) {
var out = [], data = null;
var reData = /^data-/i;
attrs.forEach(function(attr) {
if (reData.test(attr.name)) {
if (!data) {
data = [];
out.push({
name: 'data',
value: data
});
}
data.push(utils.extend({}, attr, {name: attr.name.replace(reData, '')}));
} else {
out.push(attr);
}
});
return out;
}
function stringifyAttrs(attrs, profile) {
var attrQuote = profile.attributeQuote();
return '{' + attrs.map(function(attr) {
var value = attrQuote + attr.value + attrQuote;
if (Array.isArray(attr.value)) {
value = stringifyAttrs(attr.value, profile);
} else if (attr.isBoolean) {
value = 'true';
}
return ':' + attr.name + ' => ' + value
}).join(', ') + '}';
}
/**
* Creates HAML attributes string from tag according to profile settings
* @param {AbbreviationNode} tag
* @param {Object} profile
*/
function makeAttributesString(tag, profile) {
var attrs = '';
var otherAttrs = [];
var attrQuote = profile.attributeQuote();
var cursor = profile.cursor();
tag.attributeList().forEach(function(a) {
var attrName = profile.attributeName(a.name);
switch (attrName.toLowerCase()) {
// use short notation for ID and CLASS attributes
case 'id':
attrs += '#' + (a.value || cursor);
break;
case 'class':
attrs += '.' + transformClassName(a.value || cursor);
break;
// process other attributes
default:
otherAttrs.push({
name: attrName,
value: a.value || cursor,
isBoolean: profile.isBoolean(a.name, a.value)
});
}
});
if (otherAttrs.length) {
attrs += stringifyAttrs(condenseDataAttrs(otherAttrs), profile);
}
return attrs;
}
/**
* Processes element with <code>tag</code> type
* @param {AbbreviationNode} item
* @param {OutputProfile} profile
*/
function processTag(item, profile) {
if (!item.parent)
// looks like it's root element
return item;
var attrs = makeAttributesString(item, profile);
var cursor = profile.cursor();
var isUnary = abbrUtils.isUnary(item);
var selfClosing = profile.self_closing_tag && isUnary ? '/' : '';
var start= '';
// define tag name
var tagName = '%' + profile.tagName(item.name());
if (tagName.toLowerCase() == '%div' && attrs && attrs.indexOf('{') == -1)
// omit div tag
tagName = '';
item.end = '';
start = tagName + attrs + selfClosing;
if (item.content && !/^\s/.test(item.content)) {
item.content = ' ' + item.content;
}
var placeholder = '%s';
// We can't just replace placeholder with new value because
// JavaScript will treat double $ character as a single one, assuming
// we're using RegExp literal.
item.start = utils.replaceSubstring(item.start, start, item.start.indexOf(placeholder), placeholder);
if (!item.children.length && !isUnary)
item.start += cursor;
return item;
}
return function process(tree, profile, level) {
level = level || 0;
if (!level) {
tree = formatFilter(tree, '_format', profile);
}
tree.children.forEach(function(item) {
if (!abbrUtils.isSnippet(item)) {
processTag(item, profile, level);
}
process(item, profile, level + 1);
});
return tree;
};
});
},{"../utils/abbreviation":69,"../utils/common":73,"./format":44}],46:[function(require,module,exports){
/**
* Filter that produces HTML tree
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var abbrUtils = require('../utils/abbreviation');
var utils = require('../utils/common');
var tabStops = require('../assets/tabStops');
var formatFilter = require('./format');
/**
* Creates HTML attributes string from tag according to profile settings
* @param {AbbreviationNode} node
* @param {OutputProfile} profile
*/
function makeAttributesString(node, profile) {
var attrQuote = profile.attributeQuote();
var cursor = profile.cursor();
return node.attributeList().map(function(a) {
var isBoolean = profile.isBoolean(a.name, a.value);
var attrName = profile.attributeName(a.name);
var attrValue = isBoolean ? attrName : a.value;
if (isBoolean && profile.allowCompactBoolean()) {
return ' ' + attrName;
}
return ' ' + attrName + '=' + attrQuote + (attrValue || cursor) + attrQuote;
}).join('');
}
/**
* Processes element with <code>tag</code> type
* @param {AbbreviationNode} item
* @param {OutputProfile} profile
*/
function processTag(item, profile) {
if (!item.parent) { // looks like it's root element
return item;
}
var attrs = makeAttributesString(item, profile);
var cursor = profile.cursor();
var isUnary = abbrUtils.isUnary(item);
var start = '';
var end = '';
// define opening and closing tags
if (!item.isTextNode()) {
var tagName = profile.tagName(item.name());
if (isUnary) {
start = '<' + tagName + attrs + profile.selfClosing() + '>';
item.end = '';
} else {
start = '<' + tagName + attrs + '>';
end = '</' + tagName + '>';
}
}
var placeholder = '%s';
// We can't just replace placeholder with new value because
// JavaScript will treat double $ character as a single one, assuming
// we're using RegExp literal.
item.start = utils.replaceSubstring(item.start, start, item.start.indexOf(placeholder), placeholder);
item.end = utils.replaceSubstring(item.end, end, item.end.indexOf(placeholder), placeholder);
// should we put caret placeholder after opening tag?
if (
!item.children.length
&& !isUnary
&& !~item.content.indexOf(cursor)
&& !tabStops.extract(item.content).tabstops.length
) {
item.start += cursor;
}
return item;
}
return function process(tree, profile, level) {
level = level || 0;
if (!level) {
tree = formatFilter(tree, profile, level)
}
tree.children.forEach(function(item) {
if (!abbrUtils.isSnippet(item)) {
processTag(item, profile, level);
}
process(item, profile, level + 1);
});
return tree;
};
});
},{"../assets/tabStops":33,"../utils/abbreviation":69,"../utils/common":73,"./format":44}],47:[function(require,module,exports){
/**
* Filter for producing Jade code from abbreviation.
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
var abbrUtils = require('../utils/abbreviation');
var formatFilter = require('./format');
var tabStops = require('../assets/tabStops');
var profile = require('../assets/profile');
var reNl = /[\n\r]/;
var reIndentedText = /^\s*\|/;
var reSpace = /^\s/;
function transformClassName(className) {
return utils.trim(className).replace(/\s+/g, '.');
}
function stringifyAttrs(attrs, profile) {
var attrQuote = profile.attributeQuote();
return '(' + attrs.map(function(attr) {
if (attr.isBoolean) {
return attr.name;
}
return attr.name + '=' + attrQuote + attr.value + attrQuote;
}).join(', ') + ')';
}
/**
* Creates HAML attributes string from tag according to profile settings
* @param {AbbreviationNode} tag
* @param {Object} profile
*/
function makeAttributesString(tag, profile) {
var attrs = '';
var otherAttrs = [];
var attrQuote = profile.attributeQuote();
var cursor = profile.cursor();
tag.attributeList().forEach(function(a) {
var attrName = profile.attributeName(a.name);
switch (attrName.toLowerCase()) {
// use short notation for ID and CLASS attributes
case 'id':
attrs += '#' + (a.value || cursor);
break;
case 'class':
attrs += '.' + transformClassName(a.value || cursor);
break;
// process other attributes
default:
otherAttrs.push({
name: attrName,
value: a.value || cursor,
isBoolean: profile.isBoolean(a.name, a.value)
});
}
});
if (otherAttrs.length) {
attrs += stringifyAttrs(otherAttrs, profile);
}
return attrs;
}
function processTagContent(item) {
if (!item.content) {
return;
}
var content = tabStops.replaceVariables(item.content, function(str, name) {
if (name === 'nl' || name === 'newline') {
return '\n';
}
return str;
});
if (reNl.test(content) && !reIndentedText.test(content)) {
// multiline content: pad it with indentation and pipe
var pad = '| ';
item.content = '\n' + pad + utils.padString(content, pad);
} else if (!reSpace.test(content)) {
item.content = ' ' + content;
}
}
/**
* Processes element with <code>tag</code> type
* @param {AbbreviationNode} item
* @param {OutputProfile} profile
*/
function processTag(item, profile) {
if (!item.parent)
// looks like it's a root (empty) element
return item;
var attrs = makeAttributesString(item, profile);
var cursor = profile.cursor();
var isUnary = abbrUtils.isUnary(item);
// define tag name
var tagName = profile.tagName(item.name());
if (tagName.toLowerCase() == 'div' && attrs && attrs.charAt(0) != '(')
// omit div tag
tagName = '';
item.end = '';
var start = tagName + attrs;
processTagContent(item);
var placeholder = '%s';
// We can't just replace placeholder with new value because
// JavaScript will treat double $ character as a single one, assuming
// we're using RegExp literal.
item.start = utils.replaceSubstring(item.start, start, item.start.indexOf(placeholder), placeholder);
if (!item.children.length && !isUnary)
item.start += cursor;
return item;
}
return function process(tree, curProfile, level) {
level = level || 0;
if (!level) {
// always format with `xml` profile since
// Jade requires all tags to be on separate lines
tree = formatFilter(tree, profile.get('xml'));
}
tree.children.forEach(function(item) {
if (!abbrUtils.isSnippet(item)) {
processTag(item, curProfile, level);
}
process(item, curProfile, level + 1);
});
return tree;
};
});
},{"../assets/profile":29,"../assets/tabStops":33,"../utils/abbreviation":69,"../utils/common":73,"./format":44}],48:[function(require,module,exports){
/**
* A filter for React.js (JSX):
* ranames attributes like `class` and `for`
* for proper representation in JSX
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var attrMap = {
'class': 'className',
'for': 'htmlFor'
};
return function process(tree) {
tree.children.forEach(function(item) {
item._attributes.forEach(function(attr) {
if (attr.name in attrMap) {
attr.name = attrMap[attr.name]
}
});
process(item);
});
return tree;
};
});
},{}],49:[function(require,module,exports){
/**
* Module for handling filters
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
var profile = require('../assets/profile');
var resources = require('../assets/resources');
/** List of registered filters */
var registeredFilters = {
html: require('./html'),
haml: require('./haml'),
jade: require('./jade'),
jsx: require('./jsx'),
slim: require('./slim'),
xsl: require('./xsl'),
css: require('./css'),
bem: require('./bem'),
c: require('./comment'),
e: require('./escape'),
s: require('./singleLine'),
t: require('./trim')
};
/** Filters that will be applied for unknown syntax */
var basicFilters = 'html';
function list(filters) {
if (!filters)
return [];
if (typeof filters === 'string') {
return filters.split(/[\|,]/g);
}
return filters;
}
return {
/**
* Register new filter
* @param {String} name Filter name
* @param {Function} fn Filter function
*/
add: function(name, fn) {
registeredFilters[name] = fn;
},
/**
* Apply filters for final output tree
* @param {AbbreviationNode} tree Output tree
* @param {Array} filters List of filters to apply. Might be a
* <code>String</code>
* @param {Object} profile Output profile, defined in <i>profile</i>
* module. Filters defined it profile are not used, <code>profile</code>
* is passed to filter function
* @memberOf emmet.filters
* @returns {AbbreviationNode}
*/
apply: function(tree, filters, profileName) {
profileName = profile.get(profileName);
list(filters).forEach(function(filter) {
var name = utils.trim(filter.toLowerCase());
if (name && name in registeredFilters) {
tree = registeredFilters[name](tree, profileName);
}
});
return tree;
},
/**
* Composes list of filters that should be applied to a tree, based on
* passed data
* @param {String} syntax Syntax name ('html', 'css', etc.)
* @param {Object} profile Output profile
* @param {String} additionalFilters List or pipe-separated
* string of additional filters to apply
* @returns {Array}
*/
composeList: function(syntax, profileName, additionalFilters) {
profileName = profile.get(profileName);
var filters = list(profileName.filters || resources.findItem(syntax, 'filters') || basicFilters);
if (profileName.extraFilters) {
filters = filters.concat(list(profileName.extraFilters));
}
if (additionalFilters) {
filters = filters.concat(list(additionalFilters));
}
if (!filters || !filters.length) {
// looks like unknown syntax, apply basic filters
filters = list(basicFilters);
}
return filters;
},
/**
* Extracts filter list from abbreviation
* @param {String} abbr
* @returns {Array} Array with cleaned abbreviation and list of
* extracted filters
*/
extract: function(abbr) {
var filters = '';
abbr = abbr.replace(/\|([\w\|\-]+)$/, function(str, p1){
filters = p1;
return '';
});
return [abbr, list(filters)];
}
};
});
},{"../assets/profile":29,"../assets/resources":31,"../utils/common":73,"./bem":40,"./comment":41,"./css":42,"./escape":43,"./haml":45,"./html":46,"./jade":47,"./jsx":48,"./singleLine":50,"./slim":51,"./trim":52,"./xsl":53}],50:[function(require,module,exports){
/**
* Output abbreviation on a single line (i.e. no line breaks)
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var abbrUtils = require('../utils/abbreviation');
var rePad = /^\s+/;
var reNl = /[\n\r]/g;
return function process(tree) {
tree.children.forEach(function(item) {
if (!abbrUtils.isSnippet(item)) {
// remove padding from item
item.start = item.start.replace(rePad, '');
item.end = item.end.replace(rePad, '');
}
// remove newlines
item.start = item.start.replace(reNl, '');
item.end = item.end.replace(reNl, '');
item.content = item.content.replace(reNl, '');
process(item);
});
return tree;
};
});
},{"../utils/abbreviation":69}],51:[function(require,module,exports){
/**
* Filter for producing Jade code from abbreviation.
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
var abbrUtils = require('../utils/abbreviation');
var formatFilter = require('./format');
var tabStops = require('../assets/tabStops');
var prefs = require('../assets/preferences');
var profile = require('../assets/profile');
var reNl = /[\n\r]/;
var reIndentedText = /^\s*\|/;
var reSpace = /^\s/;
prefs.define('slim.attributesWrapper', 'none',
'Defines how attributes will be wrapped:' +
'<ul>' +
'<li><code>none</code> – no wrapping;</li>' +
'<li><code>round</code> — wrap attributes with round braces;</li>' +
'<li><code>square</code> — wrap attributes with round braces;</li>' +
'<li><code>curly</code> — wrap attributes with curly braces.</li>' +
'</ul>');
function transformClassName(className) {
return utils.trim(className).replace(/\s+/g, '.');
}
function getAttrWrapper() {
var start = ' ', end = '';
switch (prefs.get('slim.attributesWrapper')) {
case 'round':
start = '(';
end = ')';
break;
case 'square':
start = '[';
end = ']';
break;
case 'curly':
start = '{';
end = '}';
break;
}
return {
start: start,
end: end
};
}
function stringifyAttrs(attrs, profile) {
var attrQuote = profile.attributeQuote();
var attrWrap = getAttrWrapper();
return attrWrap.start + attrs.map(function(attr) {
var value = attrQuote + attr.value + attrQuote;
if (attr.isBoolean) {
if (!attrWrap.end) {
value = 'true';
} else {
return attr.name;
}
}
return attr.name + '=' + value;
}).join(' ') + attrWrap.end;
}
/**
* Creates HAML attributes string from tag according to profile settings
* @param {AbbreviationNode} tag
* @param {Object} profile
*/
function makeAttributesString(tag, profile) {
var attrs = '';
var otherAttrs = [];
var attrQuote = profile.attributeQuote();
var cursor = profile.cursor();
tag.attributeList().forEach(function(a) {
var attrName = profile.attributeName(a.name);
switch (attrName.toLowerCase()) {
// use short notation for ID and CLASS attributes
case 'id':
attrs += '#' + (a.value || cursor);
break;
case 'class':
attrs += '.' + transformClassName(a.value || cursor);
break;
// process other attributes
default:
otherAttrs.push({
name: attrName,
value: a.value || cursor,
isBoolean: profile.isBoolean(a.name, a.value)
});
}
});
if (otherAttrs.length) {
attrs += stringifyAttrs(otherAttrs, profile);
}
return attrs;
}
function processTagContent(item) {
if (!item.content) {
return;
}
var content = tabStops.replaceVariables(item.content, function(str, name) {
if (name === 'nl' || name === 'newline') {
return '\n';
}
return str;
});
if (reNl.test(content) && !reIndentedText.test(content)) {
// multiline content: pad it with indentation and pipe
var pad = ' ';
item.content = '\n| ' + utils.padString(content, pad);
} else if (!reSpace.test(content)) {
item.content = ' ' + content;
}
}
/**
* Processes element with <code>tag</code> type
* @param {AbbreviationNode} item
* @param {OutputProfile} profile
*/
function processTag(item, profile) {
if (!item.parent)
// looks like it's a root (empty) element
return item;
var attrs = makeAttributesString(item, profile);
var cursor = profile.cursor();
var isUnary = abbrUtils.isUnary(item);
var selfClosing = profile.self_closing_tag && isUnary ? '/' : '';
// define tag name
var tagName = profile.tagName(item.name());
if (tagName.toLowerCase() == 'div' && attrs && '([{'.indexOf(attrs.charAt(0)) == -1)
// omit div tag
tagName = '';
item.end = '';
var start = tagName + attrs + selfClosing;
processTagContent(item);
var placeholder = '%s';
// We can't just replace placeholder with new value because
// JavaScript will treat double $ character as a single one, assuming
// we're using RegExp literal.
item.start = utils.replaceSubstring(item.start, start, item.start.indexOf(placeholder), placeholder);
if (!item.children.length && !isUnary)
item.start += cursor;
return item;
}
return function process(tree, curProfile, level) {
level = level || 0;
if (!level) {
// always format with `xml` profile since
// Slim requires all tags to be on separate lines
tree = formatFilter(tree, profile.get('xml'));
}
tree.children.forEach(function(item) {
if (!abbrUtils.isSnippet(item)) {
processTag(item, curProfile, level);
}
process(item, curProfile, level + 1);
});
return tree;
};
});
},{"../assets/preferences":28,"../assets/profile":29,"../assets/tabStops":33,"../utils/abbreviation":69,"../utils/common":73,"./format":44}],52:[function(require,module,exports){
/**
* Trim filter: removes characters at the beginning of the text
* content that indicates lists: numbers, #, *, -, etc.
*
* Useful for wrapping lists with abbreviation.
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var prefs = require('../assets/preferences');
prefs.define('filter.trimRegexp',
'[\\s|\\u00a0]*[\\d|#|\\-|\*|\\u2022]+\\.?\\s*',
'Regular expression used to remove list markers (numbers, dashes, '
+ 'bullets, etc.) in <code>t</code> (trim) filter. The trim filter '
+ 'is useful for wrapping with abbreviation lists, pased from other '
+ 'documents (for example, Word documents).');
function process(tree, re) {
tree.children.forEach(function(item) {
if (item.content) {
item.content = item.content.replace(re, '');
}
process(item, re);
});
return tree;
}
return function(tree) {
var re = new RegExp(prefs.get('filter.trimRegexp'));
return process(tree, re);
};
});
},{"../assets/preferences":28}],53:[function(require,module,exports){
/**
* Filter for trimming "select" attributes from some tags that contains
* child elements
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var abbrUtils = require('../utils/abbreviation');
var tags = {
'xsl:variable': 1,
'xsl:with-param': 1
};
/**
* Removes "select" attribute from node
* @param {AbbreviationNode} node
*/
function trimAttribute(node) {
node.start = node.start.replace(/\s+select\s*=\s*(['"]).*?\1/, '');
}
return function process(tree) {
tree.children.forEach(function(item) {
if (!abbrUtils.isSnippet(item)
&& (item.name() || '').toLowerCase() in tags
&& item.children.length)
trimAttribute(item);
process(item);
});
return tree;
};
});
},{"../utils/abbreviation":69}],54:[function(require,module,exports){
/**
* "Lorem ipsum" text generator. Matches <code>lipsum(num)?</code> or
* <code>lorem(num)?</code> abbreviation.
* This code is based on Django's contribution:
* https://code.djangoproject.com/browser/django/trunk/django/contrib/webdesign/lorem_ipsum.py
* <br><br>
* Examples to test:<br>
* <code>lipsum</code> – generates 30 words text.<br>
* <code>lipsum*6</code> – generates 6 paragraphs (autowrapped with <p> element) of text.<br>
* <code>ol>lipsum10*5</code> — generates ordered list with 5 list items (autowrapped with <li> tag)
* with text of 10 words on each line.<br>
* <code>span*3>lipsum20</code> – generates 3 paragraphs of 20-words text, each wrapped with <span> element.
* Each paragraph phrase is unique.
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var prefs = require('../assets/preferences');
var langs = {
en: {
common: ['lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipisicing', 'elit'],
words: ['exercitationem', 'perferendis', 'perspiciatis', 'laborum', 'eveniet',
'sunt', 'iure', 'nam', 'nobis', 'eum', 'cum', 'officiis', 'excepturi',
'odio', 'consectetur', 'quasi', 'aut', 'quisquam', 'vel', 'eligendi',
'itaque', 'non', 'odit', 'tempore', 'quaerat', 'dignissimos',
'facilis', 'neque', 'nihil', 'expedita', 'vitae', 'vero', 'ipsum',
'nisi', 'animi', 'cumque', 'pariatur', 'velit', 'modi', 'natus',
'iusto', 'eaque', 'sequi', 'illo', 'sed', 'ex', 'et', 'voluptatibus',
'tempora', 'veritatis', 'ratione', 'assumenda', 'incidunt', 'nostrum',
'placeat', 'aliquid', 'fuga', 'provident', 'praesentium', 'rem',
'necessitatibus', 'suscipit', 'adipisci', 'quidem', 'possimus',
'voluptas', 'debitis', 'sint', 'accusantium', 'unde', 'sapiente',
'voluptate', 'qui', 'aspernatur', 'laudantium', 'soluta', 'amet',
'quo', 'aliquam', 'saepe', 'culpa', 'libero', 'ipsa', 'dicta',
'reiciendis', 'nesciunt', 'doloribus', 'autem', 'impedit', 'minima',
'maiores', 'repudiandae', 'ipsam', 'obcaecati', 'ullam', 'enim',
'totam', 'delectus', 'ducimus', 'quis', 'voluptates', 'dolores',
'molestiae', 'harum', 'dolorem', 'quia', 'voluptatem', 'molestias',
'magni', 'distinctio', 'omnis', 'illum', 'dolorum', 'voluptatum', 'ea',
'quas', 'quam', 'corporis', 'quae', 'blanditiis', 'atque', 'deserunt',
'laboriosam', 'earum', 'consequuntur', 'hic', 'cupiditate',
'quibusdam', 'accusamus', 'ut', 'rerum', 'error', 'minus', 'eius',
'ab', 'ad', 'nemo', 'fugit', 'officia', 'at', 'in', 'id', 'quos',
'reprehenderit', 'numquam', 'iste', 'fugiat', 'sit', 'inventore',
'beatae', 'repellendus', 'magnam', 'recusandae', 'quod', 'explicabo',
'doloremque', 'aperiam', 'consequatur', 'asperiores', 'commodi',
'optio', 'dolor', 'labore', 'temporibus', 'repellat', 'veniam',
'architecto', 'est', 'esse', 'mollitia', 'nulla', 'a', 'similique',
'eos', 'alias', 'dolore', 'tenetur', 'deleniti', 'porro', 'facere',
'maxime', 'corrupti']
},
sp: {
common: ['mujer', 'uno', 'dolor', 'más', 'de', 'poder', 'mismo', 'si'],
words: ['ejercicio', 'preferencia', 'perspicacia', 'laboral', 'paño',
'suntuoso', 'molde', 'namibia', 'planeador', 'mirar', 'demás', 'oficinista', 'excepción',
'odio', 'consecuencia', 'casi', 'auto', 'chicharra', 'velo', 'elixir',
'ataque', 'no', 'odio', 'temporal', 'cuórum', 'dignísimo',
'facilismo', 'letra', 'nihilista', 'expedición', 'alma', 'alveolar', 'aparte',
'león', 'animal', 'como', 'paria', 'belleza', 'modo', 'natividad',
'justo', 'ataque', 'séquito', 'pillo', 'sed', 'ex', 'y', 'voluminoso',
'temporalidad', 'verdades', 'racional', 'asunción', 'incidente', 'marejada',
'placenta', 'amanecer', 'fuga', 'previsor', 'presentación', 'lejos',
'necesariamente', 'sospechoso', 'adiposidad', 'quindío', 'pócima',
'voluble', 'débito', 'sintió', 'accesorio', 'falda', 'sapiencia',
'volutas', 'queso', 'permacultura', 'laudo', 'soluciones', 'entero',
'pan', 'litro', 'tonelada', 'culpa', 'libertario', 'mosca', 'dictado',
'reincidente', 'nascimiento', 'dolor', 'escolar', 'impedimento', 'mínima',
'mayores', 'repugnante', 'dulce', 'obcecado', 'montaña', 'enigma',
'total', 'deletéreo', 'décima', 'cábala', 'fotografía', 'dolores',
'molesto', 'olvido', 'paciencia', 'resiliencia', 'voluntad', 'molestias',
'magnífico', 'distinción', 'ovni', 'marejada', 'cerro', 'torre', 'y',
'abogada', 'manantial', 'corporal', 'agua', 'crepúsculo', 'ataque', 'desierto',
'laboriosamente', 'angustia', 'afortunado', 'alma', 'encefalograma',
'materialidad', 'cosas', 'o', 'renuncia', 'error', 'menos', 'conejo',
'abadía', 'analfabeto', 'remo', 'fugacidad', 'oficio', 'en', 'almácigo', 'vos', 'pan',
'represión', 'números', 'triste', 'refugiado', 'trote', 'inventor',
'corchea', 'repelente', 'magma', 'recusado', 'patrón', 'explícito',
'paloma', 'síndrome', 'inmune', 'autoinmune', 'comodidad',
'ley', 'vietnamita', 'demonio', 'tasmania', 'repeler', 'apéndice',
'arquitecto', 'columna', 'yugo', 'computador', 'mula', 'a', 'propósito',
'fantasía', 'alias', 'rayo', 'tenedor', 'deleznable', 'ventana', 'cara',
'anemia', 'corrupto']
},
ru: {
common: ['далеко-далеко', 'за', 'словесными', 'горами', 'в стране', 'гласных', 'и согласных', 'живут', 'рыбные', 'тексты'],
words: ['вдали', 'от всех', 'они', 'буквенных', 'домах', 'на берегу', 'семантика',
'большого', 'языкового', 'океана', 'маленький', 'ручеек', 'даль',
'журчит', 'по всей', 'обеспечивает', 'ее','всеми', 'необходимыми',
'правилами', 'эта', 'парадигматическая', 'страна', 'которой', 'жаренные',
'предложения', 'залетают', 'прямо', 'рот', 'даже', 'всемогущая',
'пунктуация', 'не', 'имеет', 'власти', 'над', 'рыбными', 'текстами',
'ведущими', 'безорфографичный', 'образ', 'жизни', 'однажды', 'одна',
'маленькая', 'строчка','рыбного', 'текста', 'имени', 'lorem', 'ipsum',
'решила', 'выйти', 'большой', 'мир', 'грамматики', 'великий', 'оксмокс',
'предупреждал', 'о', 'злых', 'запятых', 'диких', 'знаках', 'вопроса',
'коварных', 'точках', 'запятой', 'но', 'текст', 'дал', 'сбить',
'себя', 'толку', 'он', 'собрал', 'семь', 'своих', 'заглавных', 'букв',
'подпоясал', 'инициал', 'за', 'пояс', 'пустился', 'дорогу',
'взобравшись', 'первую', 'вершину', 'курсивных', 'гор', 'бросил',
'последний', 'взгляд', 'назад', 'силуэт', 'своего', 'родного', 'города',
'буквоград', 'заголовок', 'деревни', 'алфавит', 'подзаголовок', 'своего',
'переулка', 'грустный', 'реторический', 'вопрос', 'скатился', 'его',
'щеке', 'продолжил', 'свой', 'путь', 'дороге', 'встретил', 'рукопись',
'она', 'предупредила', 'моей', 'все', 'переписывается', 'несколько',
'раз', 'единственное', 'что', 'меня', 'осталось', 'это', 'приставка',
'возвращайся', 'ты', 'лучше', 'свою', 'безопасную', 'страну', 'послушавшись',
'рукописи', 'наш', 'продолжил', 'свой', 'путь', 'вскоре', 'ему',
'повстречался', 'коварный', 'составитель', 'рекламных', 'текстов',
'напоивший', 'языком', 'речью', 'заманивший', 'свое', 'агенство',
'которое', 'использовало', 'снова', 'снова', 'своих', 'проектах',
'если', 'переписали', 'то', 'живет', 'там', 'до', 'сих', 'пор']
}
};
prefs.define('lorem.defaultLang', 'en',
'Default language of generated dummy text. Currently, <code>en</code>\
and <code>ru</code> are supported, but users can add their own syntaxes\
see <a href="http://docs.emmet.io/abbreviations/lorem-ipsum/">docs</a>.');
prefs.define('lorem.omitCommonPart', false,
'Omit commonly used part (e.g. “Lorem ipsum dolor sit amet“) from generated text.');
/**
* Returns random integer between <code>from</code> and <code>to</code> values
* @param {Number} from
* @param {Number} to
* @returns {Number}
*/
function randint(from, to) {
return Math.round(Math.random() * (to - from) + from);
}
/**
* @param {Array} arr
* @param {Number} count
* @returns {Array}
*/
function sample(arr, count) {
var len = arr.length;
var iterations = Math.min(len, count);
var result = [];
while (result.length < iterations) {
var randIx = randint(0, len - 1);
if (!~result.indexOf(randIx)) {
result.push(randIx);
}
}
return result.map(function(ix) {
return arr[ix];
});
}
function choice(val) {
if (typeof val === 'string')
return val.charAt(randint(0, val.length - 1));
return val[randint(0, val.length - 1)];
}
function sentence(words, end) {
if (words.length) {
words[0] = words[0].charAt(0).toUpperCase() + words[0].substring(1);
}
return words.join(' ') + (end || choice('?!...')); // more dots than question marks
}
/**
* Insert commas at randomly selected words. This function modifies values
* inside <code>words</code> array
* @param {Array} words
*/
function insertCommas(words) {
var len = words.length;
if (len < 2) {
return;
}
var totalCommas = 0;
if (len > 3 && len <= 6) {
totalCommas = randint(0, 1);
} else if (len > 6 && len <= 12) {
totalCommas = randint(0, 2);
} else {
totalCommas = randint(1, 4);
}
for (var i = 0, pos, word; i < totalCommas; i++) {
pos = randint(0, words.length - 2);
word = words[pos];
if (word.charAt(word.length - 1) !== ',') {
words[pos] += ',';
}
}
}
/**
* Generate a paragraph of "Lorem ipsum" text
* @param {Number} wordCount Words count in paragraph
* @param {Boolean} startWithCommon Should paragraph start with common
* "lorem ipsum" sentence.
* @returns {String}
*/
function paragraph(lang, wordCount, startWithCommon) {
var data = langs[lang];
if (!data) {
return '';
}
var result = [];
var totalWords = 0;
var words;
wordCount = parseInt(wordCount, 10);
if (startWithCommon && data.common) {
words = data.common.slice(0, wordCount);
if (words.length > 5) {
words[4] += ',';
}
totalWords += words.length;
result.push(sentence(words, '.'));
}
while (totalWords < wordCount) {
words = sample(data.words, Math.min(randint(2, 30), wordCount - totalWords));
totalWords += words.length;
insertCommas(words);
result.push(sentence(words));
}
return result.join(' ');
}
return {
/**
* Adds new language words for Lorem Ipsum generator
* @param {String} lang Two-letter lang definition
* @param {Object} data Words for language. Maight be either a space-separated
* list of words (String), Array of words or object with <code>text</code> and
* <code>common</code> properties
*/
addLang: function(lang, data) {
if (typeof data === 'string') {
data = {
words: data.split(' ').filter(function(item) {
return !!item;
})
};
} else if (Array.isArray(data)) {
data = {words: data};
}
langs[lang] = data;
},
preprocessor: function(tree) {
var re = /^(?:lorem|lipsum)([a-z]{2})?(\d*)$/i, match;
var allowCommon = !prefs.get('lorem.omitCommonPart');
/** @param {AbbreviationNode} node */
tree.findAll(function(node) {
if (node._name && (match = node._name.match(re))) {
var wordCound = match[2] || 30;
var lang = match[1] || prefs.get('lorem.defaultLang') || 'en';
// force node name resolving if node should be repeated
// or contains attributes. In this case, node should be outputed
// as tag, otherwise as text-only node
node._name = '';
node.data('forceNameResolving', node.isRepeating() || node.attributeList().length);
node.data('pasteOverwrites', true);
node.data('paste', function(i) {
return paragraph(lang, wordCound, !i && allowCommon);
});
}
});
}
};
});
},{"../assets/preferences":28}],55:[function(require,module,exports){
/**
* Emmet abbreviation parser.
* Takes string abbreviation and recursively parses it into a tree. The parsed
* tree can be transformed into a string representation with
* <code>toString()</code> method. Note that string representation is defined
* by custom processors (called <i>filters</i>), not by abbreviation parser
* itself.
*
* This module can be extended with custom pre-/post-processors to shape-up
* final tree or its representation. Actually, many features of abbreviation
* engine are defined in other modules as tree processors
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var tabStops = require('../assets/tabStops');
var profile = require('../assets/profile');
var filters = require('../filter/main');
var utils = require('../utils/common');
var abbreviationUtils = require('../utils/abbreviation');
var stringStream = require('../assets/stringStream');
// pre- and post-processorcs
var lorem = require('../generator/lorem');
var procPastedContent = require('./processor/pastedContent');
var procTagName = require('./processor/tagName');
var procResourceMatcher = require('./processor/resourceMatcher');
var procAttributes = require('./processor/attributes');
var procHref = require('./processor/href');
var reValidName = /^[\w\-\$\:@\!%]+\+?$/i;
var reWord = /[\w\-:\$@]/;
var DEFAULT_ATTR_NAME = '%default';
var pairs = {
'[': ']',
'(': ')',
'{': '}'
};
var spliceFn = Array.prototype.splice;
var preprocessors = [];
var postprocessors = [];
var outputProcessors = [];
/**
* @type AbbreviationNode
*/
function AbbreviationNode(parent) {
/** @type AbbreviationNode */
this.parent = null;
this.children = [];
this._attributes = [];
/** @type String Raw abbreviation for current node */
this.abbreviation = '';
this.counter = 1;
this._name = null;
this._text = '';
this.repeatCount = 1;
this.hasImplicitRepeat = false;
/** Custom data dictionary */
this._data = {};
// output properties
this.start = '';
this.end = '';
this.content = '';
this.padding = '';
}
AbbreviationNode.prototype = {
/**
* Adds passed node as child or creates new child
* @param {AbbreviationNode} child
* @param {Number} position Index in children array where child should
* be inserted
* @return {AbbreviationNode}
*/
addChild: function(child, position) {
child = child || new AbbreviationNode();
child.parent = this;
if (typeof position === 'undefined') {
this.children.push(child);
} else {
this.children.splice(position, 0, child);
}
return child;
},
/**
* Creates a deep copy of current node
* @returns {AbbreviationNode}
*/
clone: function() {
var node = new AbbreviationNode();
var attrs = ['abbreviation', 'counter', '_name', '_text', 'repeatCount', 'hasImplicitRepeat', 'start', 'end', 'content', 'padding'];
attrs.forEach(function(a) {
node[a] = this[a];
}, this);
// clone attributes
node._attributes = this._attributes.map(function(attr) {
return utils.extend({}, attr);
});
node._data = utils.extend({}, this._data);
// clone children
node.children = this.children.map(function(child) {
child = child.clone();
child.parent = node;
return child;
});
return node;
},
/**
* Removes current node from parent‘s child list
* @returns {AbbreviationNode} Current node itself
*/
remove: function() {
if (this.parent) {
var ix = this.parent.children.indexOf(this);
if (~ix) {
this.parent.children.splice(ix, 1);
}
}
return this;
},
/**
* Replaces current node in parent‘s children list with passed nodes
* @param {AbbreviationNode} node Replacement node or array of nodes
*/
replace: function() {
var parent = this.parent;
var ix = parent.children.indexOf(this);
var items = utils.flatten(arguments);
spliceFn.apply(parent.children, [ix, 1].concat(items));
// update parent
items.forEach(function(item) {
item.parent = parent;
});
},
/**
* Recursively sets <code>property</code> to <code>value</code> of current
* node and its children
* @param {String} name Property to update
* @param {Object} value New property value
*/
updateProperty: function(name, value) {
this[name] = value;
this.children.forEach(function(child) {
child.updateProperty(name, value);
});
return this;
},
/**
* Finds first child node that matches truth test for passed
* <code>fn</code> function
* @param {Function} fn
* @returns {AbbreviationNode}
*/
find: function(fn) {
return this.findAll(fn, {amount: 1})[0];
},
/**
* Finds all child nodes that matches truth test for passed
* <code>fn</code> function
* @param {Function} fn
* @returns {Array}
*/
findAll: function(fn, state) {
state = utils.extend({amount: 0, found: 0}, state || {});
if (typeof fn !== 'function') {
var elemName = fn.toLowerCase();
fn = function(item) {return item.name().toLowerCase() == elemName;};
}
var result = [];
this.children.forEach(function(child) {
if (fn(child)) {
result.push(child);
state.found++;
if (state.amount && state.found >= state.amount) {
return;
}
}
result = result.concat(child.findAll(fn));
});
return result.filter(function(item) {
return !!item;
});
},
/**
* Sets/gets custom data
* @param {String} name
* @param {Object} value
* @returns {Object}
*/
data: function(name, value) {
if (arguments.length == 2) {
this._data[name] = value;
}
return this._data[name];
},
/**
* Returns name of current node
* @returns {String}
*/
name: function() {
return this._name;
},
/**
* Returns list of attributes for current node
* @returns {Array}
*/
attributeList: function() {
return optimizeAttributes(this._attributes.slice(0));
},
/**
* Returns or sets attribute value
* @param {String} name Attribute name
* @param {String} value New attribute value. `Null` value
* will remove attribute
* @returns {String}
*/
attribute: function(name, value) {
if (arguments.length == 2) {
if (value === null) {
// remove attribute
var vals = this._attributes.filter(function(attr) {
return attr.name === name;
});
var that = this;
vals.forEach(function(attr) {
var ix = that._attributes.indexOf(attr);
if (~ix) {
that._attributes.splice(ix, 1);
}
});
return;
}
// modify attribute
var attrNames = this._attributes.map(function(attr) {
return attr.name;
});
var ix = attrNames.indexOf(name.toLowerCase());
if (~ix) {
this._attributes[ix].value = value;
} else {
this._attributes.push({
name: name,
value: value
});
}
}
return (utils.find(this.attributeList(), function(attr) {
return attr.name == name;
}) || {}).value;
},
/**
* Returns index of current node in parent‘s children list
* @returns {Number}
*/
index: function() {
return this.parent ? this.parent.children.indexOf(this) : -1;
},
/**
* Sets how many times current element should be repeated
* @private
*/
_setRepeat: function(count) {
if (count) {
this.repeatCount = parseInt(count, 10) || 1;
} else {
this.hasImplicitRepeat = true;
}
},
/**
* Sets abbreviation that belongs to current node
* @param {String} abbr
*/
setAbbreviation: function(abbr) {
abbr = abbr || '';
var that = this;
// find multiplier
abbr = abbr.replace(/\*(\d+)?$/, function(str, repeatCount) {
that._setRepeat(repeatCount);
return '';
});
this.abbreviation = abbr;
var abbrText = extractText(abbr);
if (abbrText) {
abbr = abbrText.element;
this.content = this._text = abbrText.text;
}
var abbrAttrs = parseAttributes(abbr);
if (abbrAttrs) {
abbr = abbrAttrs.element;
this._attributes = abbrAttrs.attributes;
}
this._name = abbr;
// validate name
if (this._name && !reValidName.test(this._name)) {
throw new Error('Invalid abbreviation');
}
},
/**
* Returns string representation of current node
* @return {String}
*/
valueOf: function() {
var start = this.start;
var end = this.end;
var content = this.content;
// apply output processors
var node = this;
outputProcessors.forEach(function(fn) {
start = fn(start, node, 'start');
content = fn(content, node, 'content');
end = fn(end, node, 'end');
});
var innerContent = this.children.map(function(child) {
return child.valueOf();
}).join('');
content = abbreviationUtils.insertChildContent(content, innerContent, {
keepVariable: false
});
return start + utils.padString(content, this.padding) + end;
},
toString: function() {
return this.valueOf();
},
/**
* Check if current node contains children with empty <code>expr</code>
* property
* @return {Boolean}
*/
hasEmptyChildren: function() {
return !!utils.find(this.children, function(child) {
return child.isEmpty();
});
},
/**
* Check if current node has implied name that should be resolved
* @returns {Boolean}
*/
hasImplicitName: function() {
return !this._name && !this.isTextNode();
},
/**
* Indicates that current element is a grouping one, e.g. has no
* representation but serves as a container for other nodes
* @returns {Boolean}
*/
isGroup: function() {
return !this.abbreviation;
},
/**
* Indicates empty node (i.e. without abbreviation). It may be a
* grouping node and should not be outputted
* @return {Boolean}
*/
isEmpty: function() {
return !this.abbreviation && !this.children.length;
},
/**
* Indicates that current node should be repeated
* @returns {Boolean}
*/
isRepeating: function() {
return this.repeatCount > 1 || this.hasImplicitRepeat;
},
/**
* Check if current node is a text-only node
* @return {Boolean}
*/
isTextNode: function() {
return !this.name() && !this.attributeList().length;
},
/**
* Indicates whether this node may be used to build elements or snippets
* @returns {Boolean}
*/
isElement: function() {
return !this.isEmpty() && !this.isTextNode();
},
/**
* Returns latest and deepest child of current tree
* @returns {AbbreviationNode}
*/
deepestChild: function() {
if (!this.children.length)
return null;
var deepestChild = this;
while (deepestChild.children.length) {
deepestChild = deepestChild.children[deepestChild.children.length - 1];
}
return deepestChild;
}
};
/**
* Returns stripped string: a string without first and last character.
* Used for “unquoting” strings
* @param {String} str
* @returns {String}
*/
function stripped(str) {
return str.substring(1, str.length - 1);
}
function consumeQuotedValue(stream, quote) {
var ch;
while ((ch = stream.next())) {
if (ch === quote)
return true;
if (ch == '\\')
continue;
}
return false;
}
/**
* Parses abbreviation into a tree
* @param {String} abbr
* @returns {AbbreviationNode}
*/
function parseAbbreviation(abbr) {
abbr = utils.trim(abbr);
var root = new AbbreviationNode();
var context = root.addChild(), ch;
/** @type StringStream */
var stream = stringStream.create(abbr);
var loopProtector = 1000, multiplier;
var addChild = function(child) {
context.addChild(child);
};
var consumeAbbr = function() {
stream.start = stream.pos;
stream.eatWhile(function(c) {
if (c == '[' || c == '{') {
if (stream.skipToPair(c, pairs[c])) {
stream.backUp(1);
return true;
}
throw new Error('Invalid abbreviation: mo matching "' + pairs[c] + '" found for character at ' + stream.pos);
}
if (c == '+') {
// let's see if this is an expando marker
stream.next();
var isMarker = stream.eol() || ~'+>^*'.indexOf(stream.peek());
stream.backUp(1);
return isMarker;
}
return c != '(' && isAllowedChar(c);
});
};
while (!stream.eol() && --loopProtector > 0) {
ch = stream.peek();
switch (ch) {
case '(': // abbreviation group
stream.start = stream.pos;
if (stream.skipToPair('(', ')')) {
var inner = parseAbbreviation(stripped(stream.current()));
if ((multiplier = stream.match(/^\*(\d+)?/, true))) {
context._setRepeat(multiplier[1]);
}
inner.children.forEach(addChild);
} else {
throw new Error('Invalid abbreviation: mo matching ")" found for character at ' + stream.pos);
}
break;
case '>': // child operator
context = context.addChild();
stream.next();
break;
case '+': // sibling operator
context = context.parent.addChild();
stream.next();
break;
case '^': // climb up operator
var parent = context.parent || context;
context = (parent.parent || parent).addChild();
stream.next();
break;
default: // consume abbreviation
consumeAbbr();
context.setAbbreviation(stream.current());
stream.start = stream.pos;
}
}
if (loopProtector < 1) {
throw new Error('Endless loop detected');
}
return root;
}
/**
* Splits attribute set into a list of attributes string
* @param {String} attrSet
* @return {Array}
*/
function splitAttributes(attrSet) {
attrSet = utils.trim(attrSet);
var parts = [];
// split attribute set by spaces
var stream = stringStream(attrSet), ch;
while ((ch = stream.next())) {
if (ch == ' ') {
parts.push(utils.trim(stream.current()));
// skip spaces
while (stream.peek() == ' ') {
stream.next();
}
stream.start = stream.pos;
} else if (ch == '"' || ch == "'") {
// skip values in strings
if (!stream.skipString(ch)) {
throw new Error('Invalid attribute set');
}
}
}
parts.push(utils.trim(stream.current()));
return parts;
}
/**
* Removes opening and closing quotes from given string
* @param {String} str
* @return {String}
*/
function unquote(str) {
var ch = str.charAt(0);
if (ch == '"' || ch == "'") {
str = str.substr(1);
var last = str.charAt(str.length - 1);
if (last === ch) {
str = str.substr(0, str.length - 1);
}
}
return str;
}
/**
* Extract attributes and their values from attribute set:
* <code>[attr col=3 title="Quoted string"]</code> (without square braces)
* @param {String} attrSet
* @returns {Array}
*/
function extractAttributes(attrSet) {
var reAttrName = /^[\w\-:\$@]+\.?$/;
return splitAttributes(attrSet).map(function(attr) {
// attribute name: [attr]
if (reAttrName.test(attr)) {
var value = '';
if (attr.charAt(attr.length - 1) == '.') {
// a boolean attribute
attr = attr.substr(0, attr.length - 1);
value = attr;
}
return {
name: attr,
value: value
};
}
// attribute with value: [name=val], [name="val"]
if (~attr.indexOf('=')) {
var parts = attr.split('=');
return {
name: parts.shift(),
value: unquote(parts.join('='))
};
}
// looks like it’s implied attribute
return {
name: DEFAULT_ATTR_NAME,
value: unquote(attr)
};
});
}
/**
* Parses tag attributes extracted from abbreviation. If attributes found,
* returns object with <code>element</code> and <code>attributes</code>
* properties
* @param {String} abbr
* @returns {Object} Returns <code>null</code> if no attributes found in
* abbreviation
*/
function parseAttributes(abbr) {
/*
* Example of incoming data:
* #header
* .some.data
* .some.data#header
* [attr]
* #item[attr=Hello other="World"].class
*/
var result = [];
var attrMap = {'#': 'id', '.': 'class'};
var nameEnd = null;
/** @type StringStream */
var stream = stringStream.create(abbr);
while (!stream.eol()) {
switch (stream.peek()) {
case '#': // id
case '.': // class
if (nameEnd === null)
nameEnd = stream.pos;
var attrName = attrMap[stream.peek()];
stream.next();
stream.start = stream.pos;
stream.eatWhile(reWord);
result.push({
name: attrName,
value: stream.current()
});
break;
case '[': //begin attribute set
if (nameEnd === null)
nameEnd = stream.pos;
stream.start = stream.pos;
if (!stream.skipToPair('[', ']')) {
throw new Error('Invalid attribute set definition');
}
result = result.concat(
extractAttributes(stripped(stream.current()))
);
break;
default:
stream.next();
}
}
if (!result.length)
return null;
return {
element: abbr.substring(0, nameEnd),
attributes: optimizeAttributes(result)
};
}
/**
* Optimize attribute set: remove duplicates and merge class attributes
* @param attrs
*/
function optimizeAttributes(attrs) {
// clone all attributes to make sure that original objects are
// not modified
attrs = attrs.map(function(attr) {
return utils.clone(attr);
});
var lookup = {};
return attrs.filter(function(attr) {
if (!(attr.name in lookup)) {
return lookup[attr.name] = attr;
}
var la = lookup[attr.name];
if (attr.name.toLowerCase() == 'class') {
la.value += (la.value.length ? ' ' : '') + attr.value;
} else {
la.value = attr.value;
la.isImplied = !!attr.isImplied;
}
return false;
});
}
/**
* Extract text data from abbreviation: if <code>a{hello}</code> abbreviation
* is passed, returns object <code>{element: 'a', text: 'hello'}</code>.
* If nothing found, returns <code>null</code>
* @param {String} abbr
*
*/
function extractText(abbr) {
if (!~abbr.indexOf('{'))
return null;
/** @type StringStream */
var stream = stringStream.create(abbr);
while (!stream.eol()) {
switch (stream.peek()) {
case '[':
case '(':
stream.skipToPair(stream.peek(), pairs[stream.peek()]); break;
case '{':
stream.start = stream.pos;
stream.skipToPair('{', '}');
return {
element: abbr.substring(0, stream.start),
text: stripped(stream.current())
};
default:
stream.next();
}
}
}
/**
* “Un-rolls“ contents of current node: recursively replaces all repeating
* children with their repeated clones
* @param {AbbreviationNode} node
* @returns {AbbreviationNode}
*/
function unroll(node) {
for (var i = node.children.length - 1, j, child, maxCount; i >= 0; i--) {
child = node.children[i];
if (child.isRepeating()) {
maxCount = j = child.repeatCount;
child.repeatCount = 1;
child.updateProperty('counter', 1);
child.updateProperty('maxCount', maxCount);
while (--j > 0) {
child.parent.addChild(child.clone(), i + 1)
.updateProperty('counter', j + 1)
.updateProperty('maxCount', maxCount);
}
}
}
// to keep proper 'counter' property, we need to walk
// on children once again
node.children.forEach(unroll);
return node;
}
/**
* Optimizes tree node: replaces empty nodes with their children
* @param {AbbreviationNode} node
* @return {AbbreviationNode}
*/
function squash(node) {
for (var i = node.children.length - 1; i >= 0; i--) {
/** @type AbbreviationNode */
var n = node.children[i];
if (n.isGroup()) {
n.replace(squash(n).children);
} else if (n.isEmpty()) {
n.remove();
}
}
node.children.forEach(squash);
return node;
}
function isAllowedChar(ch) {
var charCode = ch.charCodeAt(0);
var specialChars = '#.*:$-_!@|%';
return (charCode > 64 && charCode < 91) // uppercase letter
|| (charCode > 96 && charCode < 123) // lowercase letter
|| (charCode > 47 && charCode < 58) // number
|| specialChars.indexOf(ch) != -1; // special character
}
// XXX add counter replacer function as output processor
outputProcessors.push(function(text, node) {
return utils.replaceCounter(text, node.counter, node.maxCount);
});
// XXX add tabstop updater
outputProcessors.push(tabStops.abbrOutputProcessor.bind(tabStops));
// include default pre- and postprocessors
[lorem, procResourceMatcher, procAttributes, procPastedContent, procTagName, procHref].forEach(function(mod) {
if (mod.preprocessor) {
preprocessors.push(mod.preprocessor.bind(mod));
}
if (mod.postprocessor) {
postprocessors.push(mod.postprocessor.bind(mod));
}
});
return {
DEFAULT_ATTR_NAME: DEFAULT_ATTR_NAME,
/**
* Parses abbreviation into tree with respect of groups,
* text nodes and attributes. Each node of the tree is a single
* abbreviation. Tree represents actual structure of the outputted
* result
* @memberOf abbreviationParser
* @param {String} abbr Abbreviation to parse
* @param {Object} options Additional options for parser and processors
*
* @return {AbbreviationNode}
*/
parse: function(abbr, options) {
options = options || {};
var tree = parseAbbreviation(abbr);
var that = this;
if (options.contextNode) {
// add info about context node –
// a parent XHTML node in editor inside which abbreviation is
// expanded
tree._name = options.contextNode.name;
var attrLookup = {};
tree._attributes.forEach(function(attr) {
attrLookup[attr.name] = attr;
});
options.contextNode.attributes.forEach(function(attr) {
if (attr.name in attrLookup) {
attrLookup[attr.name].value = attr.value;
} else {
attr = utils.clone(attr);
tree._attributes.push(attr);
attrLookup[attr.name] = attr;
}
});
}
// apply preprocessors
preprocessors.forEach(function(fn) {
fn(tree, options, that);
});
if ('counter' in options) {
tree.updateProperty('counter', options.counter);
}
tree = squash(unroll(tree));
// apply postprocessors
postprocessors.forEach(function(fn) {
fn(tree, options, that);
});
return tree;
},
/**
* Expands given abbreviation into a formatted code structure.
* This is the main method that is used for expanding abbreviation
* @param {String} abbr Abbreviation to expand
* @param {Options} options Additional options for abbreviation
* expanding and transformation: `syntax`, `profile`, `contextNode` etc.
* @return {String}
*/
expand: function(abbr, options) {
if (!abbr) return '';
if (typeof options == 'string') {
throw new Error('Deprecated use of `expand` method: `options` must be object');
}
options = options || {};
if (!options.syntax) {
options.syntax = utils.defaultSyntax();
}
var p = profile.get(options.profile, options.syntax);
tabStops.resetTabstopIndex();
var data = filters.extract(abbr);
var outputTree = this.parse(data[0], options);
var filtersList = filters.composeList(options.syntax, p, data[1]);
filters.apply(outputTree, filtersList, p);
return outputTree.valueOf();
},
AbbreviationNode: AbbreviationNode,
/**
* Add new abbreviation preprocessor. <i>Preprocessor</i> is a function
* that applies to a parsed abbreviation tree right after it get parsed.
* The passed tree is in unoptimized state.
* @param {Function} fn Preprocessor function. This function receives
* two arguments: parsed abbreviation tree (<code>AbbreviationNode</code>)
* and <code>options</code> hash that was passed to <code>parse</code>
* method
*/
addPreprocessor: function(fn) {
if (!~preprocessors.indexOf(fn)) {
preprocessors.push(fn);
}
},
/**
* Removes registered preprocessor
*/
removeFilter: function(fn) {
var ix = preprocessors.indexOf(fn);
if (~ix) {
preprocessors.splice(ix, 1);
}
},
/**
* Adds new abbreviation postprocessor. <i>Postprocessor</i> is a
* functinon that applies to <i>optimized</i> parsed abbreviation tree
* right before it returns from <code>parse()</code> method
* @param {Function} fn Postprocessor function. This function receives
* two arguments: parsed abbreviation tree (<code>AbbreviationNode</code>)
* and <code>options</code> hash that was passed to <code>parse</code>
* method
*/
addPostprocessor: function(fn) {
if (!~postprocessors.indexOf(fn)) {
postprocessors.push(fn);
}
},
/**
* Removes registered postprocessor function
*/
removePostprocessor: function(fn) {
var ix = postprocessors.indexOf(fn);
if (~ix) {
postprocessors.splice(ix, 1);
}
},
/**
* Registers output postprocessor. <i>Output processor</i> is a
* function that applies to output part (<code>start</code>,
* <code>end</code> and <code>content</code>) when
* <code>AbbreviationNode.toString()</code> method is called
*/
addOutputProcessor: function(fn) {
if (!~outputProcessors.indexOf(fn)) {
outputProcessors.push(fn);
}
},
/**
* Removes registered output processor
*/
removeOutputProcessor: function(fn) {
var ix = outputProcessors.indexOf(fn);
if (~ix) {
outputProcessors.splice(ix, 1);
}
},
/**
* Check if passed symbol is valid symbol for abbreviation expression
* @param {String} ch
* @return {Boolean}
*/
isAllowedChar: function(ch) {
ch = String(ch); // convert Java object to JS
return isAllowedChar(ch) || ~'>+^[](){}'.indexOf(ch);
}
};
});
},{"../assets/profile":29,"../assets/stringStream":32,"../assets/tabStops":33,"../filter/main":49,"../generator/lorem":54,"../utils/abbreviation":69,"../utils/common":73,"./processor/attributes":57,"./processor/href":58,"./processor/pastedContent":59,"./processor/resourceMatcher":60,"./processor/tagName":61}],56:[function(require,module,exports){
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var session = {tokens: null};
// walks around the source
var walker = {
init: function (source) {
// this.source = source.replace(/\r\n?/g, '\n');
this.source = source;
this.ch = '';
this.chnum = -1;
// advance
this.nextChar();
},
nextChar: function () {
return this.ch = this.source.charAt(++this.chnum);
},
peek: function() {
return this.source.charAt(this.chnum + 1);
}
};
// utility helpers
function isNameChar(c, cc) {
cc = cc || c.charCodeAt(0);
return (
(cc >= 97 && cc <= 122 /* a-z */) ||
(cc >= 65 && cc <= 90 /* A-Z */) ||
/*
Experimental: include cyrillic ranges
since some letters, similar to latin ones, can
accidentally appear in CSS tokens
*/
(cc >= 1024 && cc <= 1279) ||
c === '&' || /* selector placeholder (LESS, SCSS) */
c === '_' ||
c === '<' || /* comparisons (LESS, SCSS) */
c === '>' ||
c === '=' ||
c === '-'
);
}
function isDigit(c, cc) {
cc = cc || c.charCodeAt(0);
return (cc >= 48 && cc <= 57);
}
var isOp = (function () {
var opsa = "{}[]()+*=.,;:>~|\\%$#@^!".split(''),
opsmatcha = "*^|$~".split(''),
ops = {},
opsmatch = {},
i = 0;
for (; i < opsa.length; i += 1) {
ops[opsa[i]] = true;
}
for (i = 0; i < opsmatcha.length; i += 1) {
opsmatch[opsmatcha[i]] = true;
}
return function (ch, matchattr) {
if (matchattr) {
return ch in opsmatch;
}
return ch in ops;
};
}());
// creates token objects and pushes them to a list
function tokener(value, type) {
session.tokens.push({
value: value,
type: type || value,
start: null,
end: null
});
}
function getPosInfo(w) {
var errPos = w.chnum;
var source = w.source.replace(/\r\n?/g, '\n');
var part = w.source.substring(0, errPos + 1).replace(/\r\n?/g, '\n');
var lines = part.split('\n');
var ch = (lines[lines.length - 1] || '').length;
var fullLine = source.split('\n')[lines.length - 1] || '';
var chunkSize = 100;
var offset = Math.max(0, ch - chunkSize);
var formattedLine = fullLine.substr(offset, chunkSize * 2) + '\n';
for (var i = 0; i < ch - offset - 1; i++) {
formattedLine += '-';
}
formattedLine += '^';
return {
line: lines.length,
ch: ch,
text: fullLine,
hint: formattedLine
};
}
function raiseError(message) {
var err = error(message);
var errObj = new Error(err.message, '', err.line);
errObj.line = err.line;
errObj.ch = err.ch;
errObj.name = err.name;
errObj.hint = err.hint;
throw errObj;
}
// oops
function error(m) {
var w = walker;
var info = getPosInfo(walker);
var tokens = session.tokens;
session.tokens = null;
var message = 'CSS parsing error at line ' + info.line + ', char ' + info.ch + ': ' + m;
message += '\n' + info.hint;
return {
name: "ParseError",
message: message,
hint: info.hint,
line: info.line,
ch: info.ch
};
}
// token handlers follow for:
// white space, comment, string, identifier, number, operator
function white() {
var c = walker.ch,
token = '';
while (c === " " || c === "\t") {
token += c;
c = walker.nextChar();
}
tokener(token, 'white');
}
function comment() {
var w = walker,
c = w.ch,
token = c,
cnext;
cnext = w.nextChar();
if (cnext === '/') {
// inline comment in SCSS and LESS
while (c && !(cnext === "\n" || cnext === "\r")) {
token += cnext;
c = cnext;
cnext = w.nextChar();
}
} else if (cnext === '*') {
// multiline CSS commment
while (c && !(c === "*" && cnext === "/")) {
token += cnext;
c = cnext;
cnext = w.nextChar();
}
} else {
// oops, not a comment, just a /
return tokener(token, token);
}
token += cnext;
w.nextChar();
tokener(token, 'comment');
}
function eatString() {
var w = walker,
c = w.ch,
q = c,
token = c,
cnext;
c = w.nextChar();
while (c !== q) {
if (c === '\n') {
cnext = w.nextChar();
if (cnext === "\\") {
token += c + cnext;
} else {
// end of line with no \ escape = bad
raiseError("Unterminated string");
}
} else {
if (c === "\\") {
token += c + w.nextChar();
} else {
token += c;
}
}
c = w.nextChar();
}
token += c;
return token;
}
function str() {
var token = eatString();
walker.nextChar();
tokener(token, 'string');
}
function brace() {
var w = walker,
c = w.ch,
depth = 1,
token = c,
stop = false;
c = w.nextChar();
while (c && !stop) {
if (c === '(') {
depth++;
} else if (c === ')') {
depth--;
if (!depth) {
stop = true;
}
} else if (c === '"' || c === "'") {
c = eatString();
} else if (c === '') {
raiseError("Unterminated brace");
}
token += c;
c = w.nextChar();
}
tokener(token, 'brace');
}
function identifier(pre) {
var c = walker.ch;
var token = pre ? pre + c : c;
c = walker.nextChar();
var cc = c.charCodeAt(0);
while (isNameChar(c, cc) || isDigit(c, cc)) {
token += c;
c = walker.nextChar();
cc = c.charCodeAt(0);
}
tokener(token, 'identifier');
}
function num() {
var w = walker,
c = w.ch,
token = c,
point = token === '.',
nondigit;
c = w.nextChar();
nondigit = !isDigit(c);
// .2px or .classname?
if (point && nondigit) {
// meh, NaN, could be a class name, so it's an operator for now
return tokener(token, '.');
}
// -2px or -moz-something
if (token === '-' && nondigit) {
return identifier('-');
}
while (c !== '' && (isDigit(c) || (!point && c === '.'))) { // not end of source && digit or first instance of .
if (c === '.') {
point = true;
}
token += c;
c = w.nextChar();
}
tokener(token, 'number');
}
function op() {
var w = walker,
c = w.ch,
token = c,
next = w.nextChar();
if (next === "=" && isOp(token, true)) {
token += next;
tokener(token, 'match');
w.nextChar();
return;
}
tokener(token, token);
}
// call the appropriate handler based on the first character in a token suspect
function tokenize() {
var ch = walker.ch;
if (ch === " " || ch === "\t") {
return white();
}
if (ch === '/') {
return comment();
}
if (ch === '"' || ch === "'") {
return str();
}
if (ch === '(') {
return brace();
}
if (ch === '-' || ch === '.' || isDigit(ch)) { // tricky - char: minus (-1px) or dash (-moz-stuff)
return num();
}
if (isNameChar(ch)) {
return identifier();
}
if (isOp(ch)) {
return op();
}
if (ch === '\r') {
if (walker.peek() === '\n') {
ch += walker.nextChar();
}
tokener(ch, 'line');
walker.nextChar();
return;
}
if (ch === '\n') {
tokener(ch, 'line');
walker.nextChar();
return;
}
raiseError("Unrecognized character '" + ch + "'");
}
return {
/**
* Sprits given source into tokens
* @param {String} source
* @returns {Array}
*/
lex: function (source) {
walker.init(source);
session.tokens = [];
// for empty source, return single space token
if (!source) {
session.tokens.push(this.white());
} else {
while (walker.ch !== '') {
tokenize();
}
}
var tokens = session.tokens;
session.tokens = null;
return tokens;
},
/**
* Tokenizes CSS source. It's like `lex()` method,
* but also stores proper token indexes in source,
* so it's a bit slower
* @param {String} source
* @returns {Array}
*/
parse: function(source) {
// transform tokens
var tokens = this.lex(source), pos = 0, token;
for (var i = 0, il = tokens.length; i < il; i++) {
token = tokens[i];
token.start = pos;
token.end = (pos += token.value.length);
}
return tokens;
},
white: function() {
return {
value: '',
type: 'white',
start: 0,
end: 0
};
},
toSource: function(toks) {
var i = 0, max = toks.length, src = '';
for (; i < max; i++) {
src += toks[i].value;
}
return src;
}
};
});
},{}],57:[function(require,module,exports){
/**
* Resolves node attribute names: moves `default` attribute value
* from stub to real attribute.
*
* This resolver should be applied *after* resource matcher
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../../utils/common');
var findDefault = function(attr) {
return attr.isDefault;
};
var findImplied = function(attr) {
return attr.isImplied;
};
var findEmpty = function(attr) {
return !attr.value;
};
function resolveDefaultAttrs(node, parser) {
node.children.forEach(function(item) {
var attrList = item.attributeList();
var defaultAttrValue = item.attribute(parser.DEFAULT_ATTR_NAME);
if (typeof defaultAttrValue !== 'undefined') {
// remove stub attribute
item.attribute(parser.DEFAULT_ATTR_NAME, null);
if (attrList.length) {
// target for default value:
// 1. default attribute
// 2. implied attribute
// 3. first empty attribute
// find attribute marked as default
var defaultAttr = utils.find(attrList, findDefault)
|| utils.find(attrList, findImplied)
|| utils.find(attrList, findEmpty);
if (defaultAttr) {
var oldVal = item.attribute(defaultAttr.name);
var newVal = utils.replaceUnescapedSymbol(oldVal, '|', defaultAttrValue);
// no replacement, e.g. default value does not contains | symbol
if (oldVal == newVal) {
newVal = defaultAttrValue
}
item.attribute(defaultAttr.name, newVal);
}
}
} else {
// if no default attribute value, remove implied attributes
attrList.forEach(function(attr) {
if (attr.isImplied) {
item.attribute(attr.name, null);
}
});
}
resolveDefaultAttrs(item, parser);
});
}
return {
/**
* @param {AbbreviationNode} tree
* @param {Object} options
* @param {abbreviation} parser
*/
preprocessor: function(tree, options, parser) {
resolveDefaultAttrs(tree, parser);
}
};
});
},{"../../utils/common":73}],58:[function(require,module,exports){
/**
* A preptocessor for <a> tag: tests wrapped content
* for common URL patterns and, if matched, inserts it as
* `href` attribute
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var prefs = require('../../assets/preferences');
var utils = require('../../utils/common');
var pc = require('./pastedContent');
prefs.define('href.autodetect', true,
'Enables or disables automatic URL recognition when wrapping\
text with <code><a></code> tag. With this option enabled,\
if wrapped text matches URL or e-mail pattern it will be automatically\
inserted into <code>href</code> attribute.');
prefs.define('href.urlPattern', '^(?:(?:https?|ftp|file)://|www\\.|ftp\\.)(?:\\([-A-Z0-9+&@#/%=~_|$?!:,.]*\\)|[-A-Z0-9+&@#/%=~_|$?!:,.])*(?:\\([-A-Z0-9+&@#/%=~_|$?!:,.]*\\)|[A-Z0-9+&@#/%=~_|$])',
'RegExp pattern to match wrapped URLs. Matched content will be inserts\
as-is into <code>href</code> attribute, only whitespace will be trimmed.');
prefs.define('href.emailPattern', '^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,5}$',
'RegExp pattern to match wrapped e-mails. Unlike <code>href.urlPattern</code>,\
wrapped content will be prefixed with <code>mailto:</code> in <code>href</code>\
attribute');
return {
/**
* @param {AbbreviationNode} tree
* @param {Object} options
*/
postprocessor: function(tree, options) {
if (!prefs.get('href.autodetect')) {
return;
}
var reUrl = new RegExp(prefs.get('href.urlPattern'), 'i');
var reEmail = new RegExp(prefs.get('href.emailPattern'), 'i');
var reProto = /^([a-z]+:)?\/\//i;
tree.findAll(function(item) {
if (item.name().toLowerCase() != 'a' || item.attribute('href')) {
return;
}
var pastedContent = utils.trim(pc.pastedContent(item) || options.pastedContent);
if (pastedContent) {
if (reUrl.test(pastedContent)) {
// do we have protocol?
if (!reProto.test(pastedContent)) {
pastedContent = 'http://' + pastedContent;
}
item.attribute('href', pastedContent);
} else if (reEmail.test(pastedContent)) {
item.attribute('href', 'mailto:' + pastedContent);
}
}
});
}
};
});
},{"../../assets/preferences":28,"../../utils/common":73,"./pastedContent":59}],59:[function(require,module,exports){
/**
* Pasted content abbreviation processor. A pasted content is a content that
* should be inserted into implicitly repeated abbreviation nodes.
* This processor powers “Wrap With Abbreviation” action
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../../utils/common');
var abbrUtils = require('../../utils/abbreviation');
var stringStream = require('../../assets/stringStream');
var range = require('../../assets/range');
var outputPlaceholder = '$#';
/**
* Locates output placeholders inside text
* @param {String} text
* @returns {Array} Array of ranges of output placeholder in text
*/
function locateOutputPlaceholder(text) {
var result = [];
var stream = stringStream.create(text);
while (!stream.eol()) {
if (stream.peek() == '\\') {
stream.next();
} else {
stream.start = stream.pos;
if (stream.match(outputPlaceholder, true)) {
result.push(range.create(stream.start, outputPlaceholder));
continue;
}
}
stream.next();
}
return result;
}
/**
* Replaces output placeholders inside <code>source</code> with
* <code>value</code>
* @param {String} source
* @param {String} value
* @returns {String}
*/
function replaceOutputPlaceholders(source, value) {
var ranges = locateOutputPlaceholder(source);
ranges.reverse().forEach(function(r) {
source = utils.replaceSubstring(source, value, r);
});
return source;
}
/**
* Check if parsed node contains output placeholder – a target where
* pasted content should be inserted
* @param {AbbreviationNode} node
* @returns {Boolean}
*/
function hasOutputPlaceholder(node) {
if (locateOutputPlaceholder(node.content).length)
return true;
// check if attributes contains placeholder
return !!utils.find(node.attributeList(), function(attr) {
return !!locateOutputPlaceholder(attr.value).length;
});
}
/**
* Insert pasted content into correct positions of parsed node
* @param {AbbreviationNode} node
* @param {String} content
* @param {Boolean} overwrite Overwrite node content if no value placeholders
* found instead of appending to existing content
*/
function insertPastedContent(node, content, overwrite) {
var nodesWithPlaceholders = node.findAll(function(item) {
return hasOutputPlaceholder(item);
});
if (hasOutputPlaceholder(node))
nodesWithPlaceholders.unshift(node);
if (nodesWithPlaceholders.length) {
nodesWithPlaceholders.forEach(function(item) {
item.content = replaceOutputPlaceholders(item.content, content);
item._attributes.forEach(function(attr) {
attr.value = replaceOutputPlaceholders(attr.value, content);
});
});
} else {
// on output placeholders in subtree, insert content in the deepest
// child node
var deepest = node.deepestChild() || node;
if (overwrite) {
deepest.content = content;
} else {
deepest.content = abbrUtils.insertChildContent(deepest.content, content);
}
}
}
return {
pastedContent: function(item) {
var content = item.data('paste');
if (Array.isArray(content)) {
return content[item.counter - 1];
} else if (typeof content === 'function') {
return content(item.counter - 1, item.content);
} else if (content) {
return content;
}
},
/**
* @param {AbbreviationNode} tree
* @param {Object} options
*/
preprocessor: function(tree, options) {
if (options.pastedContent) {
var lines = utils.splitByLines(options.pastedContent, true).map(utils.trim);
// set repeat count for implicitly repeated elements before
// tree is unrolled
tree.findAll(function(item) {
if (item.hasImplicitRepeat) {
item.data('paste', lines);
return item.repeatCount = lines.length;
}
});
}
},
/**
* @param {AbbreviationNode} tree
* @param {Object} options
*/
postprocessor: function(tree, options) {
var that = this;
// for each node with pasted content, update text data
var targets = tree.findAll(function(item) {
var pastedContent = that.pastedContent(item);
if (pastedContent) {
insertPastedContent(item, pastedContent, !!item.data('pasteOverwrites'));
}
return !!pastedContent;
});
if (!targets.length && options.pastedContent) {
// no implicitly repeated elements, put pasted content in
// the deepest child
insertPastedContent(tree, options.pastedContent);
}
}
};
});
},{"../../assets/range":30,"../../assets/stringStream":32,"../../utils/abbreviation":69,"../../utils/common":73}],60:[function(require,module,exports){
/**
* Processor function that matches parsed <code>AbbreviationNode</code>
* against resources defined in <code>resource</code> module
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var resources = require('../../assets/resources');
var elements = require('../../assets/elements');
var utils = require('../../utils/common');
var abbreviationUtils = require('../../utils/abbreviation');
/**
* Finds matched resources for child nodes of passed <code>node</code>
* element. A matched resource is a reference to <i>snippets.json</i> entry
* that describes output of parsed node
* @param {AbbreviationNode} node
* @param {String} syntax
*/
function matchResources(node, syntax, parser) {
// do a shallow copy because the children list can be modified during
// resource matching
node.children.slice(0).forEach(function(child) {
var r = resources.getMatchedResource(child, syntax);
if (typeof r === 'string') {
r = elements.create('snippet', r);
}
child.data('resource', r);
var elemType = elements.type(r);
if (elemType == 'snippet') {
var content = r.data;
var curContent = child._text || child.content;
if (curContent) {
content = abbreviationUtils.insertChildContent(content, curContent);
}
child.content = content;
} else if (elemType == 'element') {
child._name = r.name;
if (Array.isArray(r.attributes)) {
child._attributes = [].concat(r.attributes, child._attributes);
}
} else if (elemType == 'reference') {
// it’s a reference to another abbreviation:
// parse it and insert instead of current child
/** @type AbbreviationNode */
var subtree = parser.parse(r.data, {
syntax: syntax
});
// if context element should be repeated, check if we need to
// transfer repeated element to specific child node
if (child.repeatCount > 1) {
var repeatedChildren = subtree.findAll(function(node) {
return node.hasImplicitRepeat;
});
if (!repeatedChildren.length) {
repeatedChildren = subtree.children
}
repeatedChildren.forEach(function(node) {
node.repeatCount = child.repeatCount;
node.hasImplicitRepeat = false;
});
}
// move child‘s children into the deepest child of new subtree
var deepestChild = subtree.deepestChild();
if (deepestChild) {
child.children.forEach(function(c) {
deepestChild.addChild(c);
});
deepestChild.content = child.content;
}
// copy current attributes to children
subtree.children.forEach(function(node) {
child.attributeList().forEach(function(attr) {
node.attribute(attr.name, attr.value);
});
});
child.replace(subtree.children);
}
matchResources(child, syntax, parser);
});
}
return {
preprocessor: function(tree, options, parser) {
var syntax = options.syntax || utils.defaultSyntax();
matchResources(tree, syntax, parser);
}
};
});
},{"../../assets/elements":24,"../../assets/resources":31,"../../utils/abbreviation":69,"../../utils/common":73}],61:[function(require,module,exports){
/**
* Resolves tag names in abbreviations with implied name
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var tagName = require('../../resolver/tagName');
/**
* Resolves implicit node names in parsed tree
* @param {AbbreviationNode} tree
*/
function resolveNodeNames(tree) {
tree.children.forEach(function(node) {
if (node.hasImplicitName() || node.data('forceNameResolving')) {
node._name = tagName.resolve(node.parent.name());
node.data('nameResolved', true);
}
resolveNodeNames(node);
});
return tree;
}
return {
postprocessor: resolveNodeNames
};
});
},{"../../resolver/tagName":67}],62:[function(require,module,exports){
/**
* HTML tokenizer by Marijn Haverbeke
* http://codemirror.net/
* @constructor
* @memberOf __xmlParseDefine
* @param {Function} require
* @param {Underscore} _
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var stringStream = require('../assets/stringStream');
var Kludges = {
autoSelfClosers : {},
implicitlyClosed : {},
contextGrabbers : {},
doNotIndent : {},
allowUnquoted : true,
allowMissing : true
};
// Return variables for tokenizers
var tagName = null, type = null;
function inText(stream, state) {
function chain(parser) {
state.tokenize = parser;
return parser(stream, state);
}
var ch = stream.next();
if (ch == "<") {
if (stream.eat("!")) {
if (stream.eat("[")) {
if (stream.match("CDATA["))
return chain(inBlock("atom", "]]>"));
else
return null;
} else if (stream.match("--"))
return chain(inBlock("comment", "-->"));
else if (stream.match("DOCTYPE", true, true)) {
stream.eatWhile(/[\w\._\-]/);
return chain(doctype(1));
} else
return null;
} else if (stream.eat("?")) {
stream.eatWhile(/[\w\._\-]/);
state.tokenize = inBlock("meta", "?>");
return "meta";
} else {
type = stream.eat("/") ? "closeTag" : "openTag";
stream.eatSpace();
tagName = "";
var c;
while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/)))
tagName += c;
state.tokenize = inTag;
return "tag";
}
} else if (ch == "&") {
var ok;
if (stream.eat("#")) {
if (stream.eat("x")) {
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
} else {
ok = stream.eatWhile(/[\d]/) && stream.eat(";");
}
} else {
ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
}
return ok ? "atom" : "error";
} else {
stream.eatWhile(/[^&<]/);
return "text";
}
}
function inTag(stream, state) {
var ch = stream.next();
if (ch == ">" || (ch == "/" && stream.eat(">"))) {
state.tokenize = inText;
type = ch == ">" ? "endTag" : "selfcloseTag";
return "tag";
} else if (ch == "=") {
type = "equals";
return null;
} else if (/[\'\"]/.test(ch)) {
state.tokenize = inAttribute(ch);
return state.tokenize(stream, state);
} else {
stream.eatWhile(/[^\s\u00a0=<>\"\'\/?]/);
return "word";
}
}
function inAttribute(quote) {
return function(stream, state) {
while (!stream.eol()) {
if (stream.next() == quote) {
state.tokenize = inTag;
break;
}
}
return "string";
};
}
function inBlock(style, terminator) {
return function(stream, state) {
while (!stream.eol()) {
if (stream.match(terminator)) {
state.tokenize = inText;
break;
}
stream.next();
}
return style;
};
}
function doctype(depth) {
return function(stream, state) {
var ch;
while ((ch = stream.next()) !== null) {
if (ch == "<") {
state.tokenize = doctype(depth + 1);
return state.tokenize(stream, state);
} else if (ch == ">") {
if (depth == 1) {
state.tokenize = inText;
break;
} else {
state.tokenize = doctype(depth - 1);
return state.tokenize(stream, state);
}
}
}
return "meta";
};
}
var curState = null, setStyle;
function pass() {
for (var i = arguments.length - 1; i >= 0; i--)
curState.cc.push(arguments[i]);
}
function cont() {
pass.apply(null, arguments);
return true;
}
function pushContext(tagName, startOfLine) {
var noIndent = Kludges.doNotIndent.hasOwnProperty(tagName)
|| (curState.context && curState.context.noIndent);
curState.context = {
prev : curState.context,
tagName : tagName,
indent : curState.indented,
startOfLine : startOfLine,
noIndent : noIndent
};
}
function popContext() {
if (curState.context)
curState.context = curState.context.prev;
}
function element(type) {
if (type == "openTag") {
curState.tagName = tagName;
return cont(attributes, endtag(curState.startOfLine));
} else if (type == "closeTag") {
var err = false;
if (curState.context) {
if (curState.context.tagName != tagName) {
if (Kludges.implicitlyClosed.hasOwnProperty(curState.context.tagName.toLowerCase())) {
popContext();
}
err = !curState.context || curState.context.tagName != tagName;
}
} else {
err = true;
}
if (err)
setStyle = "error";
return cont(endclosetag(err));
}
return cont();
}
function endtag(startOfLine) {
return function(type) {
if (type == "selfcloseTag"
|| (type == "endTag" && Kludges.autoSelfClosers
.hasOwnProperty(curState.tagName
.toLowerCase()))) {
maybePopContext(curState.tagName.toLowerCase());
return cont();
}
if (type == "endTag") {
maybePopContext(curState.tagName.toLowerCase());
pushContext(curState.tagName, startOfLine);
return cont();
}
return cont();
};
}
function endclosetag(err) {
return function(type) {
if (err)
setStyle = "error";
if (type == "endTag") {
popContext();
return cont();
}
setStyle = "error";
return cont(arguments.callee);
};
}
function maybePopContext(nextTagName) {
var parentTagName;
while (true) {
if (!curState.context) {
return;
}
parentTagName = curState.context.tagName.toLowerCase();
if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName)
|| !Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
return;
}
popContext();
}
}
function attributes(type) {
if (type == "word") {
setStyle = "attribute";
return cont(attribute, attributes);
}
if (type == "endTag" || type == "selfcloseTag")
return pass();
setStyle = "error";
return cont(attributes);
}
function attribute(type) {
if (type == "equals")
return cont(attvalue, attributes);
if (!Kludges.allowMissing)
setStyle = "error";
return (type == "endTag" || type == "selfcloseTag") ? pass()
: cont();
}
function attvalue(type) {
if (type == "string")
return cont(attvaluemaybe);
if (type == "word" && Kludges.allowUnquoted) {
setStyle = "string";
return cont();
}
setStyle = "error";
return (type == "endTag" || type == "selfCloseTag") ? pass()
: cont();
}
function attvaluemaybe(type) {
if (type == "string")
return cont(attvaluemaybe);
else
return pass();
}
function startState() {
return {
tokenize : inText,
cc : [],
indented : 0,
startOfLine : true,
tagName : null,
context : null
};
}
function token(stream, state) {
if (stream.sol()) {
state.startOfLine = true;
state.indented = 0;
}
if (stream.eatSpace())
return null;
setStyle = type = tagName = null;
var style = state.tokenize(stream, state);
state.type = type;
if ((style || type) && style != "comment") {
curState = state;
while (true) {
var comb = state.cc.pop() || element;
if (comb(type || style))
break;
}
}
state.startOfLine = false;
return setStyle || style;
}
return {
/**
* @memberOf emmet.xmlParser
* @returns
*/
parse: function(data, offset) {
offset = offset || 0;
var state = startState();
var stream = stringStream.create(data);
var tokens = [];
while (!stream.eol()) {
tokens.push({
type: token(stream, state),
start: stream.start + offset,
end: stream.pos + offset
});
stream.start = stream.pos;
}
return tokens;
}
};
});
},{"../assets/stringStream":32}],63:[function(require,module,exports){
/**
* Module for working with file. Shall implement
* IEmmetFile interface.
*
* Since implementation of this module depends
* greatly on current runtime, this module must be
* initialized with actual implementation first
* before use. E.g.
* require('./plugin/file')({
* read: function() {...}
* })
*
* By default, this module provides Node.JS implementation
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
// hide it from Require.JS parser
(function(r) {
if (typeof define === 'undefined' || !define.amd) {
try {
fs = r('fs');
path = r('path');
} catch(e) {}
}
})(require);
// module is a function that can extend itself
module.exports = function(obj) {
if (obj) {
utils.extend(module.exports, obj);
}
};
function bts(bytes) {
var out = [];
for (var i = 0, il = bytes.length; i < il; i++) {
out.push(String.fromCharCode(bytes[i]));
}
return out.join('');
}
function isURL(path) {
var re = /^https?:\/\//;
return re.test(path);
}
return utils.extend(module.exports, {
_parseParams: function(args) {
var params = {
path: args[0],
size: 0
};
args = utils.toArray(args, 1);
params.callback = args[args.length - 1];
args = args.slice(0, args.length - 1);
if (args.length) {
params.size = args[0];
}
return params;
},
_read: function(params, callback) {
if (isURL(params.path)) {
var req = require(/^https:/.test(params.path) ? 'https' : 'http').get(params.path, function(res) {
var bufs = [];
var totalLength = 0;
var finished = false;
res
.on('data', function(chunk) {
totalLength += chunk.length;
bufs.push(chunk);
if (params.size && totalLength >= params.size) {
finished = true;
callback(null, Buffer.concat(bufs));
req.abort();
}
})
.on('end', function() {
if (!finished) {
finished = true;
callback(null, Buffer.concat(bufs));
}
});
}).on('error', callback);
} else {
if (params.size) {
var fd = fs.openSync(params.path, 'r');
var buf = new Buffer(params.size);
fs.read(fd, buf, 0, params.size, null, function(err, bytesRead) {
callback(err, buf)
});
} else {
callback(null, fs.readFileSync(params.path));
}
}
},
/**
* Reads binary file content and return it
* @param {String} path File's relative or absolute path
* @return {String}
*/
read: function(path, size, callback) {
var params = this._parseParams(arguments);
this._read(params, function(err, buf) {
params.callback(err, err ? '' : bts(buf));
});
},
/**
* Read file content and return it
* @param {String} path File's relative or absolute path
* @return {String}
*/
readText: function(path, size, callback) {
var params = this._parseParams(arguments);
this._read(params, function(err, buf) {
params.callback(err, err ? '' : buf.toString());
});
},
/**
* Locate <code>file_name</code> file that relates to <code>editor_file</code>.
* File name may be absolute or relative path
*
* <b>Dealing with absolute path.</b>
* Many modern editors have a "project" support as information unit, but you
* should not rely on project path to find file with absolute path. First,
* it requires user to create a project before using this method (and this
* is not very convenient). Second, project path doesn't always points to
* to website's document root folder: it may point, for example, to an
* upper folder which contains server-side scripts.
*
* For better result, you should use the following algorithm in locating
* absolute resources:
* 1) Get parent folder for <code>editorFile</code> as a start point
* 2) Append required <code>fileName</code> to start point and test if
* file exists
* 3) If it doesn't exists, move start point one level up (to parent folder)
* and repeat step 2.
*
* @param {String} editorFile
* @param {String} fileName
* @return {String} Returns null if <code>fileName</code> cannot be located
*/
locateFile: function(editorFile, fileName) {
if (isURL(fileName)) {
return fileName;
}
var dirname = editorFile, f;
fileName = fileName.replace(/^\/+/, '');
while (dirname && dirname !== path.dirname(dirname)) {
dirname = path.dirname(dirname);
f = path.join(dirname, fileName);
if (fs.existsSync(f))
return f;
}
return '';
},
/**
* Creates absolute path by concatenating <code>parent</code> and <code>fileName</code>.
* If <code>parent</code> points to file, its parent directory is used
* @param {String} parent
* @param {String} fileName
* @return {String}
*/
createPath: function(parent, fileName, callback) {
var stat = fs.statSync(parent);
if (stat && !stat.isDirectory()) {
parent = path.dirname(parent);
}
return callback(path.resolve(parent, fileName));
},
/**
* Saves <code>content</code> as <code>file</code>
* @param {String} file File's absolute path
* @param {String} content File content
*/
save: function(file, content) {
fs.writeFileSync(file, content, 'ascii');
},
/**
* Returns file extension in lower case
* @param {String} file
* @return {String}
*/
getExt: function(file) {
var m = (file || '').match(/\.([\w\-]+)$/);
return m ? m[1].toLowerCase() : '';
}
});
});
},{"../utils/common":73}],64:[function(require,module,exports){
/**
* Resolver for fast CSS typing. Handles abbreviations with the following
* notation:<br>
*
* <code>(-vendor prefix)?property(value)*(!)?</code>
*
* <br><br>
* <b>Abbreviation handling</b><br>
*
* By default, Emmet searches for matching snippet definition for provided abbreviation.
* If snippet wasn't found, Emmet automatically generates element with
* abbreviation's name. For example, <code>foo</code> abbreviation will generate
* <code><foo></foo></code> output.
* <br><br>
* This module will capture all expanded properties and upgrade them with values,
* vendor prefixes and !important declarations. All unmatched abbreviations will
* be automatically transformed into <code>property-name: ${1}</code> snippets.
*
* <b>Vendor prefixes<b><br>
*
* If CSS-property is preceded with dash, resolver should output property with
* all <i>known</i> vendor prefixes. For example, if <code>brad</code>
* abbreviation generates <code>border-radius: ${value};</code> snippet,
* the <code>-brad</code> abbreviation should generate:
* <pre><code>
* -webkit-border-radius: ${value};
* -moz-border-radius: ${value};
* border-radius: ${value};
* </code></pre>
* Note that <i>o</i> and <i>ms</i> prefixes are omitted since Opera and IE
* supports unprefixed property.<br><br>
*
* Users can also provide an explicit list of one-character prefixes for any
* CSS property. For example, <code>-wm-float</code> will produce
*
* <pre><code>
* -webkit-float: ${1};
* -moz-float: ${1};
* float: ${1};
* </code></pre>
*
* Although this example looks pointless, users can use this feature to write
* cutting-edge properties implemented by browser vendors recently.
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var prefs = require('../assets/preferences');
var resources = require('../assets/resources');
var stringStream = require('../assets/stringStream');
var ciu = require('../assets/caniuse');
var utils = require('../utils/common');
var template = require('../utils/template');
var cssEditTree = require('../editTree/css');
var prefixObj = {
/** Real vendor prefix name */
prefix: 'emmet',
/**
* Indicates this prefix is obsolete and should't be used when user
* wants to generate all-prefixed properties
*/
obsolete: false,
/**
* Returns prefixed CSS property name
* @param {String} name Unprefixed CSS property
*/
transformName: function(name) {
return '-' + this.prefix + '-' + name;
},
/**
* List of unprefixed CSS properties that supported by
* current prefix. This list is used to generate all-prefixed property
* @returns {Array}
*/
properties: function() {
return getProperties('css.' + this.prefix + 'Properties') || [];
},
/**
* Check if given property is supported by current prefix
* @param name
*/
supports: function(name) {
return ~this.properties().indexOf(name);
}
};
/**
* List of registered one-character prefixes. Key is a one-character prefix,
* value is an <code>prefixObj</code> object
*/
var vendorPrefixes = {};
var defaultValue = '${1};';
// XXX module preferences
prefs.define('css.valueSeparator', ': ',
'Defines a symbol that should be placed between CSS property and '
+ 'value when expanding CSS abbreviations.');
prefs.define('css.propertyEnd', ';',
'Defines a symbol that should be placed at the end of CSS property '
+ 'when expanding CSS abbreviations.');
prefs.define('stylus.valueSeparator', ' ',
'Defines a symbol that should be placed between CSS property and '
+ 'value when expanding CSS abbreviations in Stylus dialect.');
prefs.define('stylus.propertyEnd', '',
'Defines a symbol that should be placed at the end of CSS property '
+ 'when expanding CSS abbreviations in Stylus dialect.');
prefs.define('sass.propertyEnd', '',
'Defines a symbol that should be placed at the end of CSS property '
+ 'when expanding CSS abbreviations in SASS dialect.');
prefs.define('css.syntaxes', 'css, less, sass, scss, stylus, styl',
'List of syntaxes that should be treated as CSS dialects.');
prefs.define('css.autoInsertVendorPrefixes', true,
'Automatically generate vendor-prefixed copies of expanded CSS '
+ 'property. By default, Emmet will generate vendor-prefixed '
+ 'properties only when you put dash before abbreviation '
+ '(e.g. <code>-bxsh</code>). With this option enabled, you don’t '
+ 'need dashes before abbreviations: Emmet will produce '
+ 'vendor-prefixed properties for you.');
prefs.define('less.autoInsertVendorPrefixes', false, 'Same as <code>css.autoInsertVendorPrefixes</code> but for LESS syntax');
prefs.define('scss.autoInsertVendorPrefixes', false, 'Same as <code>css.autoInsertVendorPrefixes</code> but for SCSS syntax');
prefs.define('sass.autoInsertVendorPrefixes', false, 'Same as <code>css.autoInsertVendorPrefixes</code> but for SASS syntax');
prefs.define('stylus.autoInsertVendorPrefixes', false, 'Same as <code>css.autoInsertVendorPrefixes</code> but for Stylus syntax');
var descTemplate = template('A comma-separated list of CSS properties that may have '
+ '<code><%= vendor %></code> vendor prefix. This list is used to generate '
+ 'a list of prefixed properties when expanding <code>-property</code> '
+ 'abbreviations. Empty list means that all possible CSS values may '
+ 'have <code><%= vendor %></code> prefix.');
var descAddonTemplate = template('A comma-separated list of <em>additional</em> CSS properties '
+ 'for <code>css.<%= vendor %>Preperties</code> preference. '
+ 'You should use this list if you want to add or remove a few CSS '
+ 'properties to original set. To add a new property, simply write its name, '
+ 'to remove it, precede property with hyphen.<br>'
+ 'For example, to add <em>foo</em> property and remove <em>border-radius</em> one, '
+ 'the preference value will look like this: <code>foo, -border-radius</code>.');
// properties list is created from cssFeatures.html file
var props = {
'webkit': 'animation, animation-delay, animation-direction, animation-duration, animation-fill-mode, animation-iteration-count, animation-name, animation-play-state, animation-timing-function, appearance, backface-visibility, background-clip, background-composite, background-origin, background-size, border-fit, border-horizontal-spacing, border-image, border-vertical-spacing, box-align, box-direction, box-flex, box-flex-group, box-lines, box-ordinal-group, box-orient, box-pack, box-reflect, box-shadow, color-correction, column-break-after, column-break-before, column-break-inside, column-count, column-gap, column-rule-color, column-rule-style, column-rule-width, column-span, column-width, dashboard-region, font-smoothing, highlight, hyphenate-character, hyphenate-limit-after, hyphenate-limit-before, hyphens, line-box-contain, line-break, line-clamp, locale, margin-before-collapse, margin-after-collapse, marquee-direction, marquee-increment, marquee-repetition, marquee-style, mask-attachment, mask-box-image, mask-box-image-outset, mask-box-image-repeat, mask-box-image-slice, mask-box-image-source, mask-box-image-width, mask-clip, mask-composite, mask-image, mask-origin, mask-position, mask-repeat, mask-size, nbsp-mode, perspective, perspective-origin, rtl-ordering, text-combine, text-decorations-in-effect, text-emphasis-color, text-emphasis-position, text-emphasis-style, text-fill-color, text-orientation, text-security, text-stroke-color, text-stroke-width, transform, transition, transform-origin, transform-style, transition-delay, transition-duration, transition-property, transition-timing-function, user-drag, user-modify, user-select, writing-mode, svg-shadow, box-sizing, border-radius',
'moz': 'animation-delay, animation-direction, animation-duration, animation-fill-mode, animation-iteration-count, animation-name, animation-play-state, animation-timing-function, appearance, backface-visibility, background-inline-policy, binding, border-bottom-colors, border-image, border-left-colors, border-right-colors, border-top-colors, box-align, box-direction, box-flex, box-ordinal-group, box-orient, box-pack, box-shadow, box-sizing, column-count, column-gap, column-rule-color, column-rule-style, column-rule-width, column-width, float-edge, font-feature-settings, font-language-override, force-broken-image-icon, hyphens, image-region, orient, outline-radius-bottomleft, outline-radius-bottomright, outline-radius-topleft, outline-radius-topright, perspective, perspective-origin, stack-sizing, tab-size, text-blink, text-decoration-color, text-decoration-line, text-decoration-style, text-size-adjust, transform, transform-origin, transform-style, transition, transition-delay, transition-duration, transition-property, transition-timing-function, user-focus, user-input, user-modify, user-select, window-shadow, background-clip, border-radius',
'ms': 'accelerator, backface-visibility, background-position-x, background-position-y, behavior, block-progression, box-align, box-direction, box-flex, box-line-progression, box-lines, box-ordinal-group, box-orient, box-pack, content-zoom-boundary, content-zoom-boundary-max, content-zoom-boundary-min, content-zoom-chaining, content-zoom-snap, content-zoom-snap-points, content-zoom-snap-type, content-zooming, filter, flow-from, flow-into, font-feature-settings, grid-column, grid-column-align, grid-column-span, grid-columns, grid-layer, grid-row, grid-row-align, grid-row-span, grid-rows, high-contrast-adjust, hyphenate-limit-chars, hyphenate-limit-lines, hyphenate-limit-zone, hyphens, ime-mode, interpolation-mode, layout-flow, layout-grid, layout-grid-char, layout-grid-line, layout-grid-mode, layout-grid-type, line-break, overflow-style, perspective, perspective-origin, perspective-origin-x, perspective-origin-y, scroll-boundary, scroll-boundary-bottom, scroll-boundary-left, scroll-boundary-right, scroll-boundary-top, scroll-chaining, scroll-rails, scroll-snap-points-x, scroll-snap-points-y, scroll-snap-type, scroll-snap-x, scroll-snap-y, scrollbar-arrow-color, scrollbar-base-color, scrollbar-darkshadow-color, scrollbar-face-color, scrollbar-highlight-color, scrollbar-shadow-color, scrollbar-track-color, text-align-last, text-autospace, text-justify, text-kashida-space, text-overflow, text-size-adjust, text-underline-position, touch-action, transform, transform-origin, transform-origin-x, transform-origin-y, transform-origin-z, transform-style, transition, transition-delay, transition-duration, transition-property, transition-timing-function, user-select, word-break, wrap-flow, wrap-margin, wrap-through, writing-mode',
'o': 'dashboard-region, animation, animation-delay, animation-direction, animation-duration, animation-fill-mode, animation-iteration-count, animation-name, animation-play-state, animation-timing-function, border-image, link, link-source, object-fit, object-position, tab-size, table-baseline, transform, transform-origin, transition, transition-delay, transition-duration, transition-property, transition-timing-function, accesskey, input-format, input-required, marquee-dir, marquee-loop, marquee-speed, marquee-style'
};
Object.keys(props).forEach(function(k) {
prefs.define('css.' + k + 'Properties', props[k], descTemplate({vendor: k}));
prefs.define('css.' + k + 'PropertiesAddon', '', descAddonTemplate({vendor: k}));
});
prefs.define('css.unitlessProperties', 'z-index, line-height, opacity, font-weight, zoom',
'The list of properties whose values must not contain units.');
prefs.define('css.intUnit', 'px', 'Default unit for integer values');
prefs.define('css.floatUnit', 'em', 'Default unit for float values');
prefs.define('css.keywords', 'auto, inherit, all',
'A comma-separated list of valid keywords that can be used in CSS abbreviations.');
prefs.define('css.keywordAliases', 'a:auto, i:inherit, s:solid, da:dashed, do:dotted, t:transparent',
'A comma-separated list of keyword aliases, used in CSS abbreviation. '
+ 'Each alias should be defined as <code>alias:keyword_name</code>.');
prefs.define('css.unitAliases', 'e:em, p:%, x:ex, r:rem',
'A comma-separated list of unit aliases, used in CSS abbreviation. '
+ 'Each alias should be defined as <code>alias:unit_value</code>.');
prefs.define('css.color.short', true,
'Should color values like <code>#ffffff</code> be shortened to '
+ '<code>#fff</code> after abbreviation with color was expanded.');
prefs.define('css.color.case', 'keep',
'Letter case of color values generated by abbreviations with color '
+ '(like <code>c#0</code>). Possible values are <code>upper</code>, '
+ '<code>lower</code> and <code>keep</code>.');
prefs.define('css.fuzzySearch', true,
'Enable fuzzy search among CSS snippet names. When enabled, every '
+ '<em>unknown</em> snippet will be scored against available snippet '
+ 'names (not values or CSS properties!). The match with best score '
+ 'will be used to resolve snippet value. For example, with this '
+ 'preference enabled, the following abbreviations are equal: '
+ '<code>ov:h</code> == <code>ov-h</code> == <code>o-h</code> == '
+ '<code>oh</code>');
prefs.define('css.fuzzySearchMinScore', 0.3,
'The minium score (from 0 to 1) that fuzzy-matched abbreviation should '
+ 'achive. Lower values may produce many false-positive matches, '
+ 'higher values may reduce possible matches.');
prefs.define('css.alignVendor', false,
'If set to <code>true</code>, all generated vendor-prefixed properties '
+ 'will be aligned by real property name.');
function isNumeric(ch) {
var code = ch && ch.charCodeAt(0);
return (ch && ch == '.' || (code > 47 && code < 58));
}
/**
* Check if provided snippet contains only one CSS property and value.
* @param {String} snippet
* @returns {Boolean}
*/
function isSingleProperty(snippet) {
snippet = utils.trim(snippet);
// check if it doesn't contain a comment and a newline
if (/\/\*|\n|\r/.test(snippet)) {
return false;
}
// check if it's a valid snippet definition
if (!/^[a-z0-9\-]+\s*\:/i.test(snippet)) {
return false;
}
return snippet.replace(/\$\{.+?\}/g, '').split(':').length == 2;
}
/**
* Normalizes abbreviated value to final CSS one
* @param {String} value
* @returns {String}
*/
function normalizeValue(value) {
if (value.charAt(0) == '-' && !/^\-[\.\d]/.test(value)) {
value = value.replace(/^\-+/, '');
}
var ch = value.charAt(0);
if (ch == '#') {
return normalizeHexColor(value);
}
if (ch == '$') {
return utils.escapeText(value);
}
return getKeyword(value);
}
function normalizeHexColor(value) {
var hex = value.replace(/^#+/, '') || '0';
if (hex.toLowerCase() == 't') {
return 'transparent';
}
var opacity = '';
hex = hex.replace(/\.(\d+)$/, function(str) {
opacity = '0' + str;
return '';
});
var repeat = utils.repeatString;
var color = null;
switch (hex.length) {
case 1:
color = repeat(hex, 6);
break;
case 2:
color = repeat(hex, 3);
break;
case 3:
color = hex.charAt(0) + hex.charAt(0) + hex.charAt(1) + hex.charAt(1) + hex.charAt(2) + hex.charAt(2);
break;
case 4:
color = hex + hex.substr(0, 2);
break;
case 5:
color = hex + hex.charAt(0);
break;
default:
color = hex.substr(0, 6);
}
if (opacity) {
return toRgba(color, opacity);
}
// color must be shortened?
if (prefs.get('css.color.short')) {
var p = color.split('');
if (p[0] == p[1] && p[2] == p[3] && p[4] == p[5]) {
color = p[0] + p[2] + p[4];
}
}
// should transform case?
switch (prefs.get('css.color.case')) {
case 'upper':
color = color.toUpperCase();
break;
case 'lower':
color = color.toLowerCase();
break;
}
return '#' + color;
}
/**
* Transforms HEX color definition into RGBA one
* @param {String} color HEX color, 6 characters
* @param {String} opacity Opacity value
* @return {String}
*/
function toRgba(color, opacity) {
var r = parseInt(color.substr(0, 2), 16);
var g = parseInt(color.substr(2, 2), 16);
var b = parseInt(color.substr(4, 2), 16);
return 'rgba(' + [r, g, b, opacity].join(', ') + ')';
}
function getKeyword(name) {
var aliases = prefs.getDict('css.keywordAliases');
return name in aliases ? aliases[name] : name;
}
function getUnit(name) {
var aliases = prefs.getDict('css.unitAliases');
return name in aliases ? aliases[name] : name;
}
function isValidKeyword(keyword) {
return ~prefs.getArray('css.keywords').indexOf(getKeyword(keyword));
}
/**
* Check if passed CSS property support specified vendor prefix
* @param {String} property
* @param {String} prefix
*/
function hasPrefix(property, prefix) {
var info = vendorPrefixes[prefix];
if (!info)
info = utils.find(vendorPrefixes, function(data) {
return data.prefix == prefix;
});
return info && info.supports(property);
}
/**
* Finds available vendor prefixes for given CSS property.
* Search is performed within Can I Use database and internal
* property list
* @param {String} property CSS property name
* @return {Array} Array of resolved prefixes or null if
* prefixes are not available for this property at all.
* Empty array means prefixes are not available for current
* user-define era
*/
function findVendorPrefixes(property) {
var prefixes = ciu.resolvePrefixes(property);
if (!prefixes) {
// Can I Use database is disabled or prefixes are not
// available for this property
prefixes = [];
Object.keys(vendorPrefixes).forEach(function(key) {
if (hasPrefix(property, key)) {
prefixes.push(vendorPrefixes[key].prefix);
}
});
if (!prefixes.length) {
prefixes = null;
}
}
return prefixes;
}
/**
* Search for a list of supported prefixes for CSS property. This list
* is used to generate all-prefixed snippet
* @param {String} property CSS property name
* @returns {Array}
*/
function findInternalPrefixes(property, noAutofill) {
var result = [];
var prefixes = findVendorPrefixes(property);
if (prefixes) {
var prefixMap = {};
Object.keys(vendorPrefixes).forEach(function(key) {
prefixMap[vendorPrefixes[key].prefix] = key;
});
result = prefixes.map(function(prefix) {
return prefixMap[prefix];
});
}
if (!result.length && !noAutofill) {
// add all non-obsolete prefixes
Object.keys(vendorPrefixes).forEach(function(prefix) {
if (!vendorPrefixes[prefix].obsolete) {
result.push(prefix);
}
});
}
return result;
}
function addPrefix(name, obj) {
if (typeof obj === 'string') {
obj = {prefix: obj};
}
vendorPrefixes[name] = utils.extend({}, prefixObj, obj);
}
function getSyntaxPreference(name, syntax) {
if (syntax) {
// hacky alias for Stylus dialect
if (syntax == 'styl') {
syntax = 'stylus';
}
var val = prefs.get(syntax + '.' + name);
if (typeof val !== 'undefined') {
return val;
}
}
return prefs.get('css.' + name);
}
/**
* Format CSS property according to current syntax dialect
* @param {String} property
* @param {String} syntax
* @returns {String}
*/
function formatProperty(property, syntax) {
var ix = property.indexOf(':');
property = property.substring(0, ix).replace(/\s+$/, '')
+ getSyntaxPreference('valueSeparator', syntax)
+ utils.trim(property.substring(ix + 1));
return property.replace(/\s*;\s*$/, getSyntaxPreference('propertyEnd', syntax));
}
/**
* Transforms snippet value if required. For example, this transformation
* may add <i>!important</i> declaration to CSS property
* @param {String} snippet
* @param {Boolean} isImportant
* @returns {String}
*/
function transformSnippet(snippet, isImportant, syntax) {
if (typeof snippet !== 'string') {
snippet = snippet.data;
}
if (!isSingleProperty(snippet)) {
return snippet;
}
if (isImportant) {
if (~snippet.indexOf(';')) {
snippet = snippet.split(';').join(' !important;');
} else {
snippet += ' !important';
}
}
return formatProperty(snippet, syntax);
}
function getProperties(key) {
var list = prefs.getArray(key);
var addon = prefs.getArray(key + 'Addon');
if (addon) {
addon.forEach(function(prop) {
if (prop.charAt(0) == '-') {
list = utils.without(list, prop.substr(1));
} else {
if (prop.charAt(0) == '+')
prop = prop.substr(1);
list.push(prop);
}
});
}
return list;
}
/**
* Tries to produce properties with vendor-prefixed value
* @param {Object} snippetObj Parsed snippet object
* @return {Array} Array of properties with prefixed values
*/
function resolvePrefixedValues(snippetObj, isImportant, syntax) {
var prefixes = [];
var lookup = {};
var parts = cssEditTree.findParts(snippetObj.value);
parts.reverse();
parts.forEach(function(p) {
var partValue = p.substring(snippetObj.value);
(findVendorPrefixes(partValue) || []).forEach(function(prefix) {
if (!lookup[prefix]) {
lookup[prefix] = snippetObj.value;
prefixes.push(prefix);
}
lookup[prefix] = utils.replaceSubstring(lookup[prefix], '-' + prefix + '-' + partValue, p);
});
});
return prefixes.map(function(prefix) {
return transformSnippet(snippetObj.name + ':' + lookup[prefix], isImportant, syntax);
});
}
// TODO refactor, this looks awkward now
addPrefix('w', {
prefix: 'webkit'
});
addPrefix('m', {
prefix: 'moz'
});
addPrefix('s', {
prefix: 'ms'
});
addPrefix('o', {
prefix: 'o'
});
module = module || {};
module.exports = {
/**
* Adds vendor prefix
* @param {String} name One-character prefix name
* @param {Object} obj Object describing vendor prefix
* @memberOf cssResolver
*/
addPrefix: addPrefix,
/**
* Check if passed CSS property supports specified vendor prefix
* @param {String} property
* @param {String} prefix
*/
supportsPrefix: hasPrefix,
resolve: function(node, syntax) {
var cssSyntaxes = prefs.getArray('css.syntaxes');
if (cssSyntaxes && ~cssSyntaxes.indexOf(syntax) && node.isElement()) {
return this.expandToSnippet(node.abbreviation, syntax);
}
return null;
},
/**
* Returns prefixed version of passed CSS property, only if this
* property supports such prefix
* @param {String} property
* @param {String} prefix
* @returns
*/
prefixed: function(property, prefix) {
return hasPrefix(property, prefix)
? '-' + prefix + '-' + property
: property;
},
/**
* Returns list of all registered vendor prefixes
* @returns {Array}
*/
listPrefixes: function() {
return vendorPrefixes.map(function(obj) {
return obj.prefix;
});
},
/**
* Returns object describing vendor prefix
* @param {String} name
* @returns {Object}
*/
getPrefix: function(name) {
return vendorPrefixes[name];
},
/**
* Removes prefix object
* @param {String} name
*/
removePrefix: function(name) {
if (name in vendorPrefixes)
delete vendorPrefixes[name];
},
/**
* Extract vendor prefixes from abbreviation
* @param {String} abbr
* @returns {Object} Object containing array of prefixes and clean
* abbreviation name
*/
extractPrefixes: function(abbr) {
if (abbr.charAt(0) != '-') {
return {
property: abbr,
prefixes: null
};
}
// abbreviation may either contain sequence of one-character prefixes
// or just dash, meaning that user wants to produce all possible
// prefixed properties
var i = 1, il = abbr.length, ch;
var prefixes = [];
while (i < il) {
ch = abbr.charAt(i);
if (ch == '-') {
// end-sequence character found, stop searching
i++;
break;
}
if (ch in vendorPrefixes) {
prefixes.push(ch);
} else {
// no prefix found, meaning user want to produce all
// vendor-prefixed properties
prefixes.length = 0;
i = 1;
break;
}
i++;
}
// reached end of abbreviation and no property name left
if (i == il -1) {
i = 1;
prefixes.length = 1;
}
return {
property: abbr.substring(i),
prefixes: prefixes.length ? prefixes : 'all'
};
},
/**
* Search for value substring in abbreviation
* @param {String} abbr
* @returns {String} Value substring
*/
findValuesInAbbreviation: function(abbr, syntax) {
syntax = syntax || 'css';
var i = 0, il = abbr.length, value = '', ch;
while (i < il) {
ch = abbr.charAt(i);
if (isNumeric(ch) || ch == '#' || ch == '$' || (ch == '-' && isNumeric(abbr.charAt(i + 1)))) {
value = abbr.substring(i);
break;
}
i++;
}
// try to find keywords in abbreviation
var property = abbr.substring(0, abbr.length - value.length);
var keywords = [];
// try to extract some commonly-used properties
while (~property.indexOf('-') && !resources.findSnippet(syntax, property)) {
var parts = property.split('-');
var lastPart = parts.pop();
if (!isValidKeyword(lastPart)) {
break;
}
keywords.unshift(lastPart);
property = parts.join('-');
}
return keywords.join('-') + value;
},
parseValues: function(str) {
/** @type StringStream */
var stream = stringStream.create(str);
var values = [];
var ch = null;
while ((ch = stream.next())) {
if (ch == '$') {
stream.match(/^[^\$]+/, true);
values.push(stream.current());
} else if (ch == '#') {
stream.match(/^t|[0-9a-f]+(\.\d+)?/i, true);
values.push(stream.current());
} else if (ch == '-') {
if (isValidKeyword(utils.last(values)) ||
( stream.start && isNumeric(str.charAt(stream.start - 1)) )
) {
stream.start = stream.pos;
}
stream.match(/^\-?[0-9]*(\.[0-9]+)?[a-z%\.]*/, true);
values.push(stream.current());
} else {
stream.match(/^[0-9]*(\.[0-9]*)?[a-z%]*/, true);
values.push(stream.current());
}
stream.start = stream.pos;
}
return values
.filter(function(item) {
return !!item;
})
.map(normalizeValue);
},
/**
* Extracts values from abbreviation
* @param {String} abbr
* @returns {Object} Object containing array of values and clean
* abbreviation name
*/
extractValues: function(abbr) {
// search for value start
var abbrValues = this.findValuesInAbbreviation(abbr);
if (!abbrValues) {
return {
property: abbr,
values: null
};
}
return {
property: abbr.substring(0, abbr.length - abbrValues.length).replace(/-$/, ''),
values: this.parseValues(abbrValues)
};
},
/**
* Normalizes value, defined in abbreviation.
* @param {String} value
* @param {String} property
* @returns {String}
*/
normalizeValue: function(value, property) {
property = (property || '').toLowerCase();
var unitlessProps = prefs.getArray('css.unitlessProperties');
return value.replace(/^(\-?[0-9\.]+)([a-z]*)$/, function(str, val, unit) {
if (!unit && (val == '0' || ~unitlessProps.indexOf(property)))
return val;
if (!unit)
return val.replace(/\.$/, '') + prefs.get(~val.indexOf('.') ? 'css.floatUnit' : 'css.intUnit');
return val + getUnit(unit);
});
},
/**
* Expands abbreviation into a snippet
* @param {String} abbr Abbreviation name to expand
* @param {String} value Abbreviation value
* @param {String} syntax Currect syntax or dialect. Default is 'css'
* @returns {Object} Array of CSS properties and values or predefined
* snippet (string or element)
*/
expand: function(abbr, value, syntax) {
syntax = syntax || 'css';
var autoInsertPrefixes = prefs.get(syntax + '.autoInsertVendorPrefixes');
// check if snippet should be transformed to !important
var isImportant = /^(.+)\!$/.test(abbr);
if (isImportant) {
abbr = RegExp.$1;
}
// check if we have abbreviated resource
var snippet = resources.findSnippet(syntax, abbr);
if (snippet && !autoInsertPrefixes) {
return transformSnippet(snippet, isImportant, syntax);
}
// no abbreviated resource, parse abbreviation
var prefixData = this.extractPrefixes(abbr);
var valuesData = this.extractValues(prefixData.property);
var abbrData = utils.extend(prefixData, valuesData);
if (!snippet) {
snippet = resources.findSnippet(syntax, abbrData.property);
} else {
abbrData.values = null;
}
if (!snippet && prefs.get('css.fuzzySearch')) {
// let’s try fuzzy search
snippet = resources.fuzzyFindSnippet(syntax, abbrData.property, parseFloat(prefs.get('css.fuzzySearchMinScore')));
}
if (!snippet) {
if (!abbrData.property) {
return null;
}
snippet = abbrData.property + ':' + defaultValue;
} else if (typeof snippet !== 'string') {
snippet = snippet.data;
}
if (!isSingleProperty(snippet)) {
return snippet;
}
var snippetObj = this.splitSnippet(snippet);
var result = [];
if (!value && abbrData.values) {
value = abbrData.values.map(function(val) {
return this.normalizeValue(val, snippetObj.name);
}, this).join(' ') + ';';
}
snippetObj.value = value || snippetObj.value;
var prefixes = abbrData.prefixes == 'all' || (!abbrData.prefixes && autoInsertPrefixes)
? findInternalPrefixes(snippetObj.name, autoInsertPrefixes && abbrData.prefixes != 'all')
: abbrData.prefixes;
var names = [], propName;
(prefixes || []).forEach(function(p) {
if (p in vendorPrefixes) {
propName = vendorPrefixes[p].transformName(snippetObj.name);
names.push(propName);
result.push(transformSnippet(propName + ':' + snippetObj.value,
isImportant, syntax));
}
});
// put the original property
result.push(transformSnippet(snippetObj.name + ':' + snippetObj.value, isImportant, syntax));
names.push(snippetObj.name);
result = resolvePrefixedValues(snippetObj, isImportant, syntax).concat(result);
if (prefs.get('css.alignVendor')) {
var pads = utils.getStringsPads(names);
result = result.map(function(prop, i) {
return pads[i] + prop;
});
}
return result;
},
/**
* Same as <code>expand</code> method but transforms output into
* Emmet snippet
* @param {String} abbr
* @param {String} syntax
* @returns {String}
*/
expandToSnippet: function(abbr, syntax) {
var snippet = this.expand(abbr, null, syntax);
if (snippet === null) {
return null;
}
if (Array.isArray(snippet)) {
return snippet.join('\n');
}
if (typeof snippet !== 'string') {
return snippet.data;
}
return snippet + '';
},
/**
* Split snippet into a CSS property-value pair
* @param {String} snippet
*/
splitSnippet: function(snippet) {
snippet = utils.trim(snippet);
if (snippet.indexOf(':') == -1) {
return {
name: snippet,
value: defaultValue
};
}
var pair = snippet.split(':');
return {
name: utils.trim(pair.shift()),
// replace ${0} tabstop to produce valid vendor-prefixed values
// where possible
value: utils.trim(pair.join(':')).replace(/^(\$\{0\}|\$0)(\s*;?)$/, '${1}$2')
};
},
getSyntaxPreference: getSyntaxPreference,
transformSnippet: transformSnippet,
vendorPrefixes: findVendorPrefixes
};
return module.exports;
});
},{"../assets/caniuse":23,"../assets/preferences":28,"../assets/resources":31,"../assets/stringStream":32,"../editTree/css":37,"../utils/common":73,"../utils/template":77}],65:[function(require,module,exports){
/**
* 'Expand Abbreviation' handler that parses gradient definition from under
* cursor and updates CSS rule with vendor-prefixed values.
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var prefs = require('../assets/preferences');
var resources = require('../assets/resources');
var utils = require('../utils/common');
var stringStream = require('../assets/stringStream');
var cssResolver = require('./css');
var range = require('../assets/range');
var cssEditTree = require('../editTree/css');
var editorUtils = require('../utils/editor');
var linearGradient = require('./gradient/linear');
var cssSyntaxes = ['css', 'less', 'sass', 'scss', 'stylus', 'styl'];
// XXX define preferences
prefs.define('css.gradient.prefixes', 'webkit, moz, o',
'A comma-separated list of vendor-prefixes for which values should '
+ 'be generated.');
prefs.define('css.gradient.oldWebkit', false,
'Generate gradient definition for old Webkit implementations');
prefs.define('css.gradient.omitDefaultDirection', true,
'Do not output default direction definition in generated gradients.');
prefs.define('css.gradient.defaultProperty', 'background-image',
'When gradient expanded outside CSS value context, it will produce '
+ 'properties with this name.');
prefs.define('css.gradient.fallback', false,
'With this option enabled, CSS gradient generator will produce '
+ '<code>background-color</code> property with gradient first color '
+ 'as fallback for old browsers.');
/**
* Resolves property name (abbreviation): searches for snippet definition in
* 'resources' and returns new name of matched property
*/
function resolvePropertyName(name, syntax) {
var snippet = resources.findSnippet(syntax, name);
if (!snippet && prefs.get('css.fuzzySearch')) {
var minScore = parseFloat(prefs.get('css.fuzzySearchMinScore'));
snippet = resources.fuzzyFindSnippet(syntax, name, minScore);
}
if (snippet) {
if (typeof snippet !== 'string') {
snippet = snippet.data;
}
return cssResolver.splitSnippet(snippet).name;
}
}
/**
* Returns vendor prefixes for given gradient type
* @param {String} type Gradient type (currently, 'linear-gradient'
* is the only supported value)
* @return {Array}
*/
function getGradientPrefixes(type) {
var prefixes = cssResolver.vendorPrefixes(type);
if (!prefixes) {
// disabled Can I Use, fallback to property list
prefixes = prefs.getArray('css.gradient.prefixes');
}
return prefixes || [];
}
function getPrefixedNames(type) {
var prefixes = getGradientPrefixes(type);
var names = prefixes
? prefixes.map(function(p) {
return '-' + p + '-' + type;
})
: [];
names.push(type);
return names;
}
/**
* Returns list of CSS properties with gradient
* @param {Array} gradient List of gradient objects
* @param {CSSEditElement} property Original CSS property
* @returns {Array}
*/
function getPropertiesForGradient(gradients, property) {
var props = [];
var propertyName = property.name();
var omitDir = prefs.get('css.gradient.omitDefaultDirection');
if (prefs.get('css.gradient.fallback') && ~propertyName.toLowerCase().indexOf('background')) {
props.push({
name: 'background-color',
value: '${1:' + gradients[0].gradient.colorStops[0].color + '}'
});
}
var value = property.value();
getGradientPrefixes('linear-gradient').forEach(function(prefix) {
var name = cssResolver.prefixed(propertyName, prefix);
if (prefix == 'webkit' && prefs.get('css.gradient.oldWebkit')) {
try {
props.push({
name: name,
value: insertGradientsIntoCSSValue(gradients, value, {
prefix: prefix,
oldWebkit: true,
omitDefaultDirection: omitDir
})
});
} catch(e) {}
}
props.push({
name: name,
value: insertGradientsIntoCSSValue(gradients, value, {
prefix: prefix,
omitDefaultDirection: omitDir
})
});
});
return props.sort(function(a, b) {
return b.name.length - a.name.length;
});
}
/**
* Replaces old gradient definitions in given CSS property value
* with new ones, preserving original formatting
* @param {Array} gradients List of CSS gradients
* @param {String} value Original CSS value
* @param {Object} options Options for gradient’s stringify() method
* @return {String}
*/
function insertGradientsIntoCSSValue(gradients, value, options) {
// gradients *should* passed in order they actually appear in CSS property
// iterate over it in backward direction to preserve gradient locations
options = options || {};
gradients = utils.clone(gradients);
gradients.reverse().forEach(function(item, i) {
var suffix = !i && options.placeholder ? options.placeholder : '';
var str = options.oldWebkit ? item.gradient.stringifyOldWebkit(options) : item.gradient.stringify(options);
value = utils.replaceSubstring(value, str + suffix, item.matchedPart);
});
return value;
}
/**
* Returns list of properties with the same meaning
* (e.g. vendor-prefixed + original name)
* @param {String} property CSS property name
* @return {Array}
*/
function similarPropertyNames(property) {
if (typeof property !== 'string') {
property = property.name();
}
var similarProps = (cssResolver.vendorPrefixes(property) || []).map(function(prefix) {
return '-' + prefix + '-' + property;
});
similarProps.push(property);
return similarProps;
}
/**
* Pastes gradient definition into CSS rule with correct vendor-prefixes
* @param {EditElement} property Matched CSS property
* @param {Array} gradients List of gradients to insert
*/
function pasteGradient(property, gradients) {
var rule = property.parent;
var alignVendor = prefs.get('css.alignVendor');
var omitDir = prefs.get('css.gradient.omitDefaultDirection');
// we may have aligned gradient definitions: find the smallest value
// separator
var sep = property.styleSeparator;
var before = property.styleBefore;
// first, remove all properties within CSS rule with the same name and
// gradient definition
rule.getAll(similarPropertyNames(property)).forEach(function(item) {
if (item != property && /gradient/i.test(item.value())) {
if (item.styleSeparator.length < sep.length) {
sep = item.styleSeparator;
}
if (item.styleBefore.length < before.length) {
before = item.styleBefore;
}
rule.remove(item);
}
});
if (alignVendor) {
// update prefix
if (before != property.styleBefore) {
var fullRange = property.fullRange();
rule._updateSource(before, fullRange.start, fullRange.start + property.styleBefore.length);
property.styleBefore = before;
}
// update separator value
if (sep != property.styleSeparator) {
rule._updateSource(sep, property.nameRange().end, property.valueRange().start);
property.styleSeparator = sep;
}
}
var value = property.value();
// create list of properties to insert
var propsToInsert = getPropertiesForGradient(gradients, property);
// align prefixed values
if (alignVendor) {
var names = [], values = [];
propsToInsert.forEach(function(item) {
names.push(item.name);
values.push(item.value);
});
values.push(property.value());
names.push(property.name());
var valuePads = utils.getStringsPads(values.map(function(v) {
return v.substring(0, v.indexOf('('));
}));
var namePads = utils.getStringsPads(names);
property.name(namePads[namePads.length - 1] + property.name());
propsToInsert.forEach(function(prop, i) {
prop.name = namePads[i] + prop.name;
prop.value = valuePads[i] + prop.value;
});
property.value(valuePads[valuePads.length - 1] + property.value());
}
// put vendor-prefixed definitions before current rule
propsToInsert.forEach(function(prop) {
rule.add(prop.name, prop.value, rule.indexOf(property));
});
// put vanilla-clean gradient definition into current rule
property.value(insertGradientsIntoCSSValue(gradients, value, {
placeholder: '${2}',
omitDefaultDirection: omitDir
}));
}
/**
* Validates caret position relatively to located gradients
* in CSS rule. In other words, it checks if it’s safe to
* expand gradients for current caret position or not.
*
* See issue https://github.com/sergeche/emmet-sublime/issues/411
*
* @param {Array} gradients List of parsed gradients
* @param {Number} caretPos Current caret position
* @param {String} syntax Current document syntax
* @return {Boolean}
*/
function isValidCaretPosition(gradients, caretPos, syntax) {
syntax = syntax || 'css';
if (syntax == 'css' || syntax == 'less' || syntax == 'scss') {
return true;
}
var offset = gradients.property.valueRange(true).start;
var parts = gradients.gradients;
// in case of preprocessors where properties are separated with
// newlines, make sure there’s no gradient definition past
// current caret position.
for (var i = parts.length - 1; i >= 0; i--) {
if (parts[i].matchedPart.start + offset >= caretPos) {
return false;
}
}
return true;
}
module = module || {};
return module.exports = {
/**
* Search for gradient definitions inside CSS property value
* @returns {Array} Array of matched gradients
*/
findGradients: function(cssProp) {
var value = cssProp.value();
var gradients = [];
var that = this;
cssProp.valueParts().forEach(function(part) {
var partValue = part.substring(value);
if (linearGradient.isLinearGradient(partValue)) {
var gradient = linearGradient.parse(partValue);
if (gradient) {
gradients.push({
gradient: gradient,
matchedPart: part
});
}
}
});
return gradients.length ? gradients : null;
},
/**
* Returns list of gradients found in CSS property
* of given CSS code in specified (caret) position
* @param {String} css CSS code snippet
* @param {Number} pos Character index where to start searching for CSS property
* @return {Array}
*/
gradientsFromCSSProperty: function(css, pos) {
var cssProp = cssEditTree.propertyFromPosition(css, pos);
if (cssProp) {
var grd = this.findGradients(cssProp);
if (grd) {
return {
property: cssProp,
gradients: grd
};
}
}
return null;
},
/**
* Handler for “Expand Abbreviation” action
* @param {IEmmetEditor} editor
* @param {String} syntax
* @param {String} profile
* return {Boolean}
*/
expandAbbreviationHandler: function(editor, syntax, profile) {
var info = editorUtils.outputInfo(editor, syntax, profile);
if (!~cssSyntaxes.indexOf(info.syntax)) {
return false;
}
// let's see if we are expanding gradient definition
var caret = editor.getCaretPos();
var content = info.content;
var gradients = this.gradientsFromCSSProperty(content, caret);
if (gradients) {
if (!isValidCaretPosition(gradients, caret, info.syntax)) {
return false;
}
var cssProperty = gradients.property;
var cssRule = cssProperty.parent;
var ruleStart = cssRule.options.offset || 0;
var ruleEnd = ruleStart + cssRule.toString().length;
// Handle special case:
// user wrote gradient definition between existing CSS
// properties and did not finished it with semicolon.
// In this case, we have semicolon right after gradient
// definition and re-parse rule again
if (/[\n\r]/.test(cssProperty.value())) {
// insert semicolon at the end of gradient definition
var insertPos = cssProperty.valueRange(true).start + utils.last(gradients.gradients).matchedPart.end;
content = utils.replaceSubstring(content, ';', insertPos);
var _gradients = this.gradientsFromCSSProperty(content, caret);
if (_gradients) {
gradients = _gradients;
cssProperty = gradients.property;
cssRule = cssProperty.parent;
}
}
// make sure current property has terminating semicolon
cssProperty.end(';');
// resolve CSS property name
var resolvedName = resolvePropertyName(cssProperty.name(), syntax);
if (resolvedName) {
cssProperty.name(resolvedName);
}
pasteGradient(cssProperty, gradients.gradients);
editor.replaceContent(cssRule.toString(), ruleStart, ruleEnd, true);
return true;
}
return this.expandGradientOutsideValue(editor, syntax);
},
/**
* Tries to expand gradient outside CSS value
* @param {IEmmetEditor} editor
* @param {String} syntax
*/
expandGradientOutsideValue: function(editor, syntax) {
var propertyName = prefs.get('css.gradient.defaultProperty');
var omitDir = prefs.get('css.gradient.omitDefaultDirection');
if (!propertyName) {
return false;
}
// assuming that gradient definition is written on new line,
// do a simplified parsing
var content = String(editor.getContent());
/** @type Range */
var lineRange = range.create(editor.getCurrentLineRange());
// get line content and adjust range with padding
var line = lineRange.substring(content)
.replace(/^\s+/, function(pad) {
lineRange.start += pad.length;
return '';
})
.replace(/\s+$/, function(pad) {
lineRange.end -= pad.length;
return '';
});
// trick parser: make it think that we’re parsing actual CSS property
var fakeCSS = 'a{' + propertyName + ': ' + line + ';}';
var gradients = this.gradientsFromCSSProperty(fakeCSS, fakeCSS.length - 2);
if (gradients) {
var props = getPropertiesForGradient(gradients.gradients, gradients.property);
props.push({
name: gradients.property.name(),
value: insertGradientsIntoCSSValue(gradients.gradients, gradients.property.value(), {
placeholder: '${2}',
omitDefaultDirection: omitDir
})
});
var sep = cssResolver.getSyntaxPreference('valueSeparator', syntax);
var end = cssResolver.getSyntaxPreference('propertyEnd', syntax);
if (prefs.get('css.alignVendor')) {
var pads = utils.getStringsPads(props.map(function(prop) {
return prop.value.substring(0, prop.value.indexOf('('));
}));
props.forEach(function(prop, i) {
prop.value = pads[i] + prop.value;
});
}
props = props.map(function(item) {
return item.name + sep + item.value + end;
});
editor.replaceContent(props.join('\n'), lineRange.start, lineRange.end);
return true;
}
return false;
},
/**
* Handler for “Reflect CSS Value“ action
* @param {String} property
*/
reflectValueHandler: function(property) {
var omitDir = prefs.get('css.gradient.omitDefaultDirection');
var gradients = this.findGradients(property);
if (!gradients) {
return false;
}
var that = this;
var value = property.value();
// reflect value for properties with the same name
property.parent.getAll(similarPropertyNames(property)).forEach(function(prop) {
if (prop === property) {
return;
}
// make sure current property contains gradient definition,
// otherwise – skip it
var localGradients = that.findGradients(prop);
if (localGradients) {
// detect vendor prefix for current property
var localValue = prop.value();
var dfn = localGradients[0].matchedPart.substring(localValue);
var prefix = '';
if (/^\s*\-([a-z]+)\-/.test(dfn)) {
prefix = RegExp.$1;
}
prop.value(insertGradientsIntoCSSValue(gradients, value, {
prefix: prefix,
omitDefaultDirection: omitDir
}));
}
});
return true;
}
};
});
},{"../assets/preferences":28,"../assets/range":30,"../assets/resources":31,"../assets/stringStream":32,"../editTree/css":37,"../utils/common":73,"../utils/editor":75,"./css":64,"./gradient/linear":66}],66:[function(require,module,exports){
/**
* CSS linear gradient definition
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var stringStream = require('../../assets/stringStream');
var utils = require('../../utils/common');
// all directions are expressed in “new style” degrees
var directions = {
'bottom': 0,
'bottom left': 45,
'left': 90,
'top left': 135,
'top': 180,
'top right': 225,
'right': 270,
'bottom right': 315,
'to top': 0,
'to top right': 45,
'to right': 90,
'to bottom right': 135,
'to bottom': 180,
'to bottom left': 225,
'to left': 270,
'to top left': 315
};
var defaultDirections = ['top', 'to bottom', '0deg'];
var reLinearGradient = /^\s*(\-[a-z]+\-)?(lg|linear\-gradient)\s*\(/i;
var reDeg = /(\d+)deg/i;
var reKeyword = /top|bottom|left|right/i;
function LinearGradient(dfn) {
this.colorStops = [];
this.direction = 180;
// extract tokens
var stream = stringStream.create(utils.trim(dfn));
var ch, cur;
while ((ch = stream.next())) {
if (stream.peek() == ',') {
// Is it a first entry? Check if it’s a direction
cur = stream.current();
if (!this.colorStops.length && (reDeg.test(cur) || reKeyword.test(cur))) {
this.direction = resolveDirection(cur);
} else {
this.addColorStop(cur);
}
stream.next();
stream.eatSpace();
stream.start = stream.pos;
} else if (ch == '(') { // color definition, like 'rgb(0,0,0)'
stream.skipTo(')');
}
}
// add last token
this.addColorStop(stream.current());
}
LinearGradient.prototype = {
type: 'linear-gradient',
addColorStop: function(color, ix) {
color = normalizeSpace(color || '');
if (!color) {
return;
}
color = this.parseColorStop(color);
if (typeof ix === 'undefined') {
this.colorStops.push(color);
} else {
this.colorStops.splice(ix, 0, color);
}
},
/**
* Parses color stop definition
* @param {String} colorStop
* @returns {Object}
*/
parseColorStop: function(colorStop) {
colorStop = normalizeSpace(colorStop);
// find color declaration
// first, try complex color declaration, like rgb(0,0,0)
var color = null;
colorStop = colorStop.replace(/^(\w+\(.+?\))\s*/, function(str, c) {
color = c;
return '';
});
if (!color) {
// try simple declaration, like yellow, #fco, #ffffff, etc.
var parts = colorStop.split(' ');
color = parts[0];
colorStop = parts[1] || '';
}
var result = {
color: color
};
if (colorStop) {
// there's position in color stop definition
colorStop.replace(/^(\-?[\d\.]+)([a-z%]+)?$/, function(str, pos, unit) {
result.position = pos;
if (~pos.indexOf('.')) {
unit = '';
} else if (!unit) {
unit = '%';
}
if (unit) {
result.unit = unit;
}
});
}
return result;
},
stringify: function(options) {
options = options || {};
var fn = 'linear-gradient';
if (options.prefix) {
fn = '-' + options.prefix + '-' + fn;
}
// transform color-stops
var parts = this.colorStops.map(function(cs) {
var pos = cs.position ? ' ' + cs.position + (cs.unit || '') : '';
return cs.color + pos;
});
var dir = stringifyDirection(this.direction, !!options.prefix);
if (!options.omitDefaultDirection || !~defaultDirections.indexOf(dir)) {
parts.unshift(dir);
}
return fn + '(' + parts.join(', ') + ')';
},
stringifyOldWebkit: function() {
var colorStops = this.colorStops.map(function(item) {
return utils.clone(item);
});
// normalize color-stops position
colorStops.forEach(function(cs) {
if (!('position' in cs)) // implied position
return;
if (~cs.position.indexOf('.') || cs.unit == '%') {
cs.position = parseFloat(cs.position) / (cs.unit == '%' ? 100 : 1);
} else {
throw "Can't convert color stop '" + (cs.position + (cs.unit || '')) + "'";
}
});
this._fillImpliedPositions(colorStops);
// transform color-stops into string representation
colorStops = colorStops.map(function(cs, i) {
if (!cs.position && !i) {
return 'from(' + cs.color + ')';
}
if (cs.position == 1 && i == colorStops.length - 1) {
return 'to(' + cs.color + ')';
}
return 'color-stop(' + (cs.position.toFixed(2).replace(/\.?0+$/, '')) + ', ' + cs.color + ')';
});
return '-webkit-gradient(linear, '
+ oldWebkitDirection((this.direction + 180) % 360)
+ ', '
+ colorStops.join(', ')
+ ')';
},
/**
* Fills-out implied positions in color-stops. This function is useful for
* old Webkit gradient definitions
*/
_fillImpliedPositions: function(colorStops) {
var from = 0;
colorStops.forEach(function(cs, i) {
// make sure that first and last positions are defined
if (!i) {
return cs.position = cs.position || 0;
}
if (i == colorStops.length - 1 && !('position' in cs)) {
cs.position = 1;
}
if ('position' in cs) {
var start = colorStops[from].position || 0;
var step = (cs.position - start) / (i - from);
colorStops.slice(from, i).forEach(function(cs2, j) {
cs2.position = start + step * j;
});
from = i;
}
});
},
valueOf: function() {
return this.stringify();
}
};
function normalizeSpace(str) {
return utils.trim(str).replace(/\s+/g, ' ');
}
/**
* Resolves textual direction to degrees
* @param {String} dir Direction to resolve
* @return {Number}
*/
function resolveDirection(dir) {
if (typeof dir == 'number') {
return dir;
}
dir = normalizeSpace(dir).toLowerCase();
if (reDeg.test(dir)) {
return +RegExp.$1;
}
var prefix = /^to\s/.test(dir) ? 'to ' : '';
var left = ~dir.indexOf('left') && 'left';
var right = ~dir.indexOf('right') && 'right';
var top = ~dir.indexOf('top') && 'top';
var bottom = ~dir.indexOf('bottom') && 'bottom';
var key = normalizeSpace(prefix + (top || bottom || '') + ' ' + (left || right || ''));
return directions[key] || 0;
}
/**
* Tries to find keyword for given direction, expressed in degrees
* @param {Number} dir Direction (degrees)
* @param {Boolean} oldStyle Use old style keywords (e.g. "top" instead of "to bottom")
* @return {String} Keyword or <code>Ndeg</code> expression
*/
function stringifyDirection(dir, oldStyle) {
var reNewStyle = /^to\s/;
var keys = Object.keys(directions).filter(function(k) {
var hasPrefix = reNewStyle.test(k);
return oldStyle ? !hasPrefix : hasPrefix;
});
for (var i = 0; i < keys.length; i++) {
if (directions[keys[i]] == dir) {
return keys[i];
}
}
if (oldStyle) {
dir = (dir + 270) % 360;
}
return dir + 'deg';
}
/**
* Creates direction definition for old Webkit gradients
* @param {String} direction
* @returns {String}
*/
function oldWebkitDirection(dir) {
dir = stringifyDirection(dir, true);
if(reDeg.test(dir)) {
throw "The direction is an angle that can’t be converted.";
}
var v = function(pos) {
return ~dir.indexOf(pos) ? '100%' : '0';
};
return v('left') + ' ' + v('top') + ', ' + v('right') + ' ' + v('bottom');
}
return {
/**
* Parses gradient definition into an object.
* This object can be used to transform gradient into various
* forms
* @param {String} gradient Gradient definition
* @return {LinearGradient}
*/
parse: function(gradient) {
// cut out all redundant data
if (this.isLinearGradient(gradient)) {
gradient = gradient.replace(/^\s*[\-a-z]+\s*\(|\)\s*$/ig, '');
} else {
throw 'Invalid linear gradient definition:\n' + gradient;
}
return new LinearGradient(gradient);
},
/**
* Check if given string can be parsed as linear gradient
* @param {String} str
* @return {Boolean}
*/
isLinearGradient: function(str) {
return reLinearGradient.test(str);
},
resolveDirection: resolveDirection,
stringifyDirection: stringifyDirection
};
});
},{"../../assets/stringStream":32,"../../utils/common":73}],67:[function(require,module,exports){
/**
* Module for resolving tag names: returns best matched tag name for child
* element based on passed parent's tag name. Also provides utility function
* for element type detection (inline, block-level, empty)
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
var elementTypes = {
// empty: 'area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,keygen,command'.split(','),
empty: [],
blockLevel: 'address,applet,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,link,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul,h1,h2,h3,h4,h5,h6'.split(','),
inlineLevel: 'a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'.split(',')
};
var elementMap = {
'p': 'span',
'ul': 'li',
'ol': 'li',
'table': 'tr',
'tr': 'td',
'tbody': 'tr',
'thead': 'tr',
'tfoot': 'tr',
'colgroup': 'col',
'select': 'option',
'optgroup': 'option',
'audio': 'source',
'video': 'source',
'object': 'param',
'map': 'area'
};
return {
/**
* Returns best matched child element name for passed parent's
* tag name
* @param {String} name
* @returns {String}
* @memberOf tagName
*/
resolve: function(name) {
name = (name || '').toLowerCase();
if (name in elementMap)
return this.getMapping(name);
if (this.isInlineLevel(name))
return 'span';
return 'div';
},
/**
* Returns mapped child element name for passed parent's name
* @param {String} name
* @returns {String}
*/
getMapping: function(name) {
return elementMap[name.toLowerCase()];
},
/**
* Check if passed element name belongs to inline-level element
* @param {String} name
* @returns {Boolean}
*/
isInlineLevel: function(name) {
return this.isTypeOf(name, 'inlineLevel');
},
/**
* Check if passed element belongs to block-level element.
* For better matching of unknown elements (for XML, for example),
* you should use <code>!this.isInlineLevel(name)</code>
* @returns {Boolean}
*/
isBlockLevel: function(name) {
return this.isTypeOf(name, 'blockLevel');
},
/**
* Check if passed element is void (i.e. should not have closing tag).
* @returns {Boolean}
*/
isEmptyElement: function(name) {
return this.isTypeOf(name, 'empty');
},
/**
* Generic function for testing if element name belongs to specified
* elements collection
* @param {String} name Element name
* @param {String} type Collection name
* @returns {Boolean}
*/
isTypeOf: function(name, type) {
return ~elementTypes[type].indexOf(name);
},
/**
* Adds new parent–child mapping
* @param {String} parent
* @param {String} child
*/
addMapping: function(parent, child) {
elementMap[parent] = child;
},
/**
* Removes parent-child mapping
*/
removeMapping: function(parent) {
if (parent in elementMap)
delete elementMap[parent];
},
/**
* Adds new element into collection
* @param {String} name Element name
* @param {String} collection Collection name
*/
addElementToCollection: function(name, collection) {
if (!elementTypes[collection])
elementTypes[collection] = [];
var col = this.getCollection(collection);
if (!~col.indexOf(name)) {
col.push(name);
}
},
/**
* Removes element name from specified collection
* @param {String} name Element name
* @param {String} collection Collection name
* @returns
*/
removeElementFromCollection: function(name, collection) {
if (collection in elementTypes) {
elementTypes[collection] = utils.without(this.getCollection(collection), name);
}
},
/**
* Returns elements name collection
* @param {String} name Collection name
* @returns {Array}
*/
getCollection: function(name) {
return elementTypes[name];
}
};
});
},{"../utils/common":73}],68:[function(require,module,exports){
module.exports={
"variables": {
"lang": "en",
"locale": "en-US",
"charset": "UTF-8",
"indentation": "\t",
"newline": "\n"
},
"css": {
"filters": "css",
"profile": "css",
"snippets": {
"@i": "@import url(|);",
"@import": "@import url(|);",
"@m": "@media ${1:screen} {\n\t|\n}",
"@media": "@media ${1:screen} {\n\t|\n}",
"@f": "@font-face {\n\tfont-family:|;\n\tsrc:url(|);\n}",
"@f+": "@font-face {\n\tfont-family: '${1:FontName}';\n\tsrc: url('${2:FileName}.eot');\n\tsrc: url('${2:FileName}.eot?#iefix') format('embedded-opentype'),\n\t\t url('${2:FileName}.woff') format('woff'),\n\t\t url('${2:FileName}.ttf') format('truetype'),\n\t\t url('${2:FileName}.svg#${1:FontName}') format('svg');\n\tfont-style: ${3:normal};\n\tfont-weight: ${4:normal};\n}",
"@kf": "@-webkit-keyframes ${1:identifier} {\n\t${2:from} { ${3} }${6}\n\t${4:to} { ${5} }\n}\n@-o-keyframes ${1:identifier} {\n\t${2:from} { ${3} }${6}\n\t${4:to} { ${5} }\n}\n@-moz-keyframes ${1:identifier} {\n\t${2:from} { ${3} }${6}\n\t${4:to} { ${5} }\n}\n@keyframes ${1:identifier} {\n\t${2:from} { ${3} }${6}\n\t${4:to} { ${5} }\n}",
"anim": "animation:|;",
"anim-": "animation:${1:name} ${2:duration} ${3:timing-function} ${4:delay} ${5:iteration-count} ${6:direction} ${7:fill-mode};",
"animdel": "animation-delay:${1:time};",
"animdir": "animation-direction:${1:normal};",
"animdir:n": "animation-direction:normal;",
"animdir:r": "animation-direction:reverse;",
"animdir:a": "animation-direction:alternate;",
"animdir:ar": "animation-direction:alternate-reverse;",
"animdur": "animation-duration:${1:0}s;",
"animfm": "animation-fill-mode:${1:both};",
"animfm:f": "animation-fill-mode:forwards;",
"animfm:b": "animation-fill-mode:backwards;",
"animfm:bt": "animation-fill-mode:both;",
"animfm:bh": "animation-fill-mode:both;",
"animic": "animation-iteration-count:${1:1};",
"animic:i": "animation-iteration-count:infinite;",
"animn": "animation-name:${1:none};",
"animps": "animation-play-state:${1:running};",
"animps:p": "animation-play-state:paused;",
"animps:r": "animation-play-state:running;",
"animtf": "animation-timing-function:${1:linear};",
"animtf:e": "animation-timing-function:ease;",
"animtf:ei": "animation-timing-function:ease-in;",
"animtf:eo": "animation-timing-function:ease-out;",
"animtf:eio": "animation-timing-function:ease-in-out;",
"animtf:l": "animation-timing-function:linear;",
"animtf:cb": "animation-timing-function:cubic-bezier(${1:0.1}, ${2:0.7}, ${3:1.0}, ${3:0.1});",
"ap": "appearance:${none};",
"!": "!important",
"pos": "position:${1:relative};",
"pos:s": "position:static;",
"pos:a": "position:absolute;",
"pos:r": "position:relative;",
"pos:f": "position:fixed;",
"t": "top:|;",
"t:a": "top:auto;",
"r": "right:|;",
"r:a": "right:auto;",
"b": "bottom:|;",
"b:a": "bottom:auto;",
"l": "left:|;",
"l:a": "left:auto;",
"z": "z-index:|;",
"z:a": "z-index:auto;",
"fl": "float:${1:left};",
"fl:n": "float:none;",
"fl:l": "float:left;",
"fl:r": "float:right;",
"cl": "clear:${1:both};",
"cl:n": "clear:none;",
"cl:l": "clear:left;",
"cl:r": "clear:right;",
"cl:b": "clear:both;",
"colm": "columns:|;",
"colmc": "column-count:|;",
"colmf": "column-fill:|;",
"colmg": "column-gap:|;",
"colmr": "column-rule:|;",
"colmrc": "column-rule-color:|;",
"colmrs": "column-rule-style:|;",
"colmrw": "column-rule-width:|;",
"colms": "column-span:|;",
"colmw": "column-width:|;",
"d": "display:${1:block};",
"d:n": "display:none;",
"d:b": "display:block;",
"d:f": "display:flex;",
"d:if": "display:inline-flex;",
"d:i": "display:inline;",
"d:ib": "display:inline-block;",
"d:ib+": "display: inline-block;\n*display: inline;\n*zoom: 1;",
"d:li": "display:list-item;",
"d:ri": "display:run-in;",
"d:cp": "display:compact;",
"d:tb": "display:table;",
"d:itb": "display:inline-table;",
"d:tbcp": "display:table-caption;",
"d:tbcl": "display:table-column;",
"d:tbclg": "display:table-column-group;",
"d:tbhg": "display:table-header-group;",
"d:tbfg": "display:table-footer-group;",
"d:tbr": "display:table-row;",
"d:tbrg": "display:table-row-group;",
"d:tbc": "display:table-cell;",
"d:rb": "display:ruby;",
"d:rbb": "display:ruby-base;",
"d:rbbg": "display:ruby-base-group;",
"d:rbt": "display:ruby-text;",
"d:rbtg": "display:ruby-text-group;",
"v": "visibility:${1:hidden};",
"v:v": "visibility:visible;",
"v:h": "visibility:hidden;",
"v:c": "visibility:collapse;",
"ov": "overflow:${1:hidden};",
"ov:v": "overflow:visible;",
"ov:h": "overflow:hidden;",
"ov:s": "overflow:scroll;",
"ov:a": "overflow:auto;",
"ovx": "overflow-x:${1:hidden};",
"ovx:v": "overflow-x:visible;",
"ovx:h": "overflow-x:hidden;",
"ovx:s": "overflow-x:scroll;",
"ovx:a": "overflow-x:auto;",
"ovy": "overflow-y:${1:hidden};",
"ovy:v": "overflow-y:visible;",
"ovy:h": "overflow-y:hidden;",
"ovy:s": "overflow-y:scroll;",
"ovy:a": "overflow-y:auto;",
"ovs": "overflow-style:${1:scrollbar};",
"ovs:a": "overflow-style:auto;",
"ovs:s": "overflow-style:scrollbar;",
"ovs:p": "overflow-style:panner;",
"ovs:m": "overflow-style:move;",
"ovs:mq": "overflow-style:marquee;",
"zoo": "zoom:1;",
"zm": "zoom:1;",
"cp": "clip:|;",
"cp:a": "clip:auto;",
"cp:r": "clip:rect(${1:top} ${2:right} ${3:bottom} ${4:left});",
"bxz": "box-sizing:${1:border-box};",
"bxz:cb": "box-sizing:content-box;",
"bxz:bb": "box-sizing:border-box;",
"bxsh": "box-shadow:${1:inset }${2:hoff} ${3:voff} ${4:blur} ${5:color};",
"bxsh:r": "box-shadow:${1:inset }${2:hoff} ${3:voff} ${4:blur} ${5:spread }rgb(${6:0}, ${7:0}, ${8:0});",
"bxsh:ra": "box-shadow:${1:inset }${2:h} ${3:v} ${4:blur} ${5:spread }rgba(${6:0}, ${7:0}, ${8:0}, .${9:5});",
"bxsh:n": "box-shadow:none;",
"m": "margin:|;",
"m:a": "margin:auto;",
"mt": "margin-top:|;",
"mt:a": "margin-top:auto;",
"mr": "margin-right:|;",
"mr:a": "margin-right:auto;",
"mb": "margin-bottom:|;",
"mb:a": "margin-bottom:auto;",
"ml": "margin-left:|;",
"ml:a": "margin-left:auto;",
"p": "padding:|;",
"pt": "padding-top:|;",
"pr": "padding-right:|;",
"pb": "padding-bottom:|;",
"pl": "padding-left:|;",
"w": "width:|;",
"w:a": "width:auto;",
"h": "height:|;",
"h:a": "height:auto;",
"maw": "max-width:|;",
"maw:n": "max-width:none;",
"mah": "max-height:|;",
"mah:n": "max-height:none;",
"miw": "min-width:|;",
"mih": "min-height:|;",
"mar": "max-resolution:${1:res};",
"mir": "min-resolution:${1:res};",
"ori": "orientation:|;",
"ori:l": "orientation:landscape;",
"ori:p": "orientation:portrait;",
"ol": "outline:|;",
"ol:n": "outline:none;",
"olo": "outline-offset:|;",
"olw": "outline-width:|;",
"olw:tn": "outline-width:thin;",
"olw:m": "outline-width:medium;",
"olw:tc": "outline-width:thick;",
"ols": "outline-style:|;",
"ols:n": "outline-style:none;",
"ols:dt": "outline-style:dotted;",
"ols:ds": "outline-style:dashed;",
"ols:s": "outline-style:solid;",
"ols:db": "outline-style:double;",
"ols:g": "outline-style:groove;",
"ols:r": "outline-style:ridge;",
"ols:i": "outline-style:inset;",
"ols:o": "outline-style:outset;",
"olc": "outline-color:#${1:000};",
"olc:i": "outline-color:invert;",
"bfv": "backface-visibility:|;",
"bfv:h": "backface-visibility:hidden;",
"bfv:v": "backface-visibility:visible;",
"bd": "border:|;",
"bd+": "border:${1:1px} ${2:solid} ${3:#000};",
"bd:n": "border:none;",
"bdbk": "border-break:${1:close};",
"bdbk:c": "border-break:close;",
"bdcl": "border-collapse:|;",
"bdcl:c": "border-collapse:collapse;",
"bdcl:s": "border-collapse:separate;",
"bdc": "border-color:#${1:000};",
"bdc:t": "border-color:transparent;",
"bdi": "border-image:url(|);",
"bdi:n": "border-image:none;",
"bdti": "border-top-image:url(|);",
"bdti:n": "border-top-image:none;",
"bdri": "border-right-image:url(|);",
"bdri:n": "border-right-image:none;",
"bdbi": "border-bottom-image:url(|);",
"bdbi:n": "border-bottom-image:none;",
"bdli": "border-left-image:url(|);",
"bdli:n": "border-left-image:none;",
"bdci": "border-corner-image:url(|);",
"bdci:n": "border-corner-image:none;",
"bdci:c": "border-corner-image:continue;",
"bdtli": "border-top-left-image:url(|);",
"bdtli:n": "border-top-left-image:none;",
"bdtli:c": "border-top-left-image:continue;",
"bdtri": "border-top-right-image:url(|);",
"bdtri:n": "border-top-right-image:none;",
"bdtri:c": "border-top-right-image:continue;",
"bdbri": "border-bottom-right-image:url(|);",
"bdbri:n": "border-bottom-right-image:none;",
"bdbri:c": "border-bottom-right-image:continue;",
"bdbli": "border-bottom-left-image:url(|);",
"bdbli:n": "border-bottom-left-image:none;",
"bdbli:c": "border-bottom-left-image:continue;",
"bdf": "border-fit:${1:repeat};",
"bdf:c": "border-fit:clip;",
"bdf:r": "border-fit:repeat;",
"bdf:sc": "border-fit:scale;",
"bdf:st": "border-fit:stretch;",
"bdf:ow": "border-fit:overwrite;",
"bdf:of": "border-fit:overflow;",
"bdf:sp": "border-fit:space;",
"bdlen": "border-length:|;",
"bdlen:a": "border-length:auto;",
"bdsp": "border-spacing:|;",
"bds": "border-style:|;",
"bds:n": "border-style:none;",
"bds:h": "border-style:hidden;",
"bds:dt": "border-style:dotted;",
"bds:ds": "border-style:dashed;",
"bds:s": "border-style:solid;",
"bds:db": "border-style:double;",
"bds:dtds": "border-style:dot-dash;",
"bds:dtdtds": "border-style:dot-dot-dash;",
"bds:w": "border-style:wave;",
"bds:g": "border-style:groove;",
"bds:r": "border-style:ridge;",
"bds:i": "border-style:inset;",
"bds:o": "border-style:outset;",
"bdw": "border-width:|;",
"bdtw": "border-top-width:|;",
"bdrw": "border-right-width:|;",
"bdbw": "border-bottom-width:|;",
"bdlw": "border-left-width:|;",
"bdt": "border-top:|;",
"bt": "border-top:|;",
"bdt+": "border-top:${1:1px} ${2:solid} ${3:#000};",
"bdt:n": "border-top:none;",
"bdts": "border-top-style:|;",
"bdts:n": "border-top-style:none;",
"bdtc": "border-top-color:#${1:000};",
"bdtc:t": "border-top-color:transparent;",
"bdr": "border-right:|;",
"br": "border-right:|;",
"bdr+": "border-right:${1:1px} ${2:solid} ${3:#000};",
"bdr:n": "border-right:none;",
"bdrst": "border-right-style:|;",
"bdrst:n": "border-right-style:none;",
"bdrc": "border-right-color:#${1:000};",
"bdrc:t": "border-right-color:transparent;",
"bdb": "border-bottom:|;",
"bb": "border-bottom:|;",
"bdb+": "border-bottom:${1:1px} ${2:solid} ${3:#000};",
"bdb:n": "border-bottom:none;",
"bdbs": "border-bottom-style:|;",
"bdbs:n": "border-bottom-style:none;",
"bdbc": "border-bottom-color:#${1:000};",
"bdbc:t": "border-bottom-color:transparent;",
"bdl": "border-left:|;",
"bl": "border-left:|;",
"bdl+": "border-left:${1:1px} ${2:solid} ${3:#000};",
"bdl:n": "border-left:none;",
"bdls": "border-left-style:|;",
"bdls:n": "border-left-style:none;",
"bdlc": "border-left-color:#${1:000};",
"bdlc:t": "border-left-color:transparent;",
"bdrs": "border-radius:|;",
"bdtrrs": "border-top-right-radius:|;",
"bdtlrs": "border-top-left-radius:|;",
"bdbrrs": "border-bottom-right-radius:|;",
"bdblrs": "border-bottom-left-radius:|;",
"bg": "background:#${1:000};",
"bg+": "background:${1:#fff} url(${2}) ${3:0} ${4:0} ${5:no-repeat};",
"bg:n": "background:none;",
"bg:ie": "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1:x}.png',sizingMethod='${2:crop}');",
"bgc": "background-color:#${1:fff};",
"bgc:t": "background-color:transparent;",
"bgi": "background-image:url(|);",
"bgi:n": "background-image:none;",
"bgr": "background-repeat:|;",
"bgr:n": "background-repeat:no-repeat;",
"bgr:x": "background-repeat:repeat-x;",
"bgr:y": "background-repeat:repeat-y;",
"bgr:sp": "background-repeat:space;",
"bgr:rd": "background-repeat:round;",
"bga": "background-attachment:|;",
"bga:f": "background-attachment:fixed;",
"bga:s": "background-attachment:scroll;",
"bgp": "background-position:${1:0} ${2:0};",
"bgpx": "background-position-x:|;",
"bgpy": "background-position-y:|;",
"bgbk": "background-break:|;",
"bgbk:bb": "background-break:bounding-box;",
"bgbk:eb": "background-break:each-box;",
"bgbk:c": "background-break:continuous;",
"bgcp": "background-clip:${1:padding-box};",
"bgcp:bb": "background-clip:border-box;",
"bgcp:pb": "background-clip:padding-box;",
"bgcp:cb": "background-clip:content-box;",
"bgcp:nc": "background-clip:no-clip;",
"bgo": "background-origin:|;",
"bgo:pb": "background-origin:padding-box;",
"bgo:bb": "background-origin:border-box;",
"bgo:cb": "background-origin:content-box;",
"bgsz": "background-size:|;",
"bgsz:a": "background-size:auto;",
"bgsz:ct": "background-size:contain;",
"bgsz:cv": "background-size:cover;",
"c": "color:#${1:000};",
"c:r": "color:rgb(${1:0}, ${2:0}, ${3:0});",
"c:ra": "color:rgba(${1:0}, ${2:0}, ${3:0}, .${4:5});",
"cm": "/* |${child} */",
"cnt": "content:'|';",
"cnt:n": "content:normal;",
"cnt:oq": "content:open-quote;",
"cnt:noq": "content:no-open-quote;",
"cnt:cq": "content:close-quote;",
"cnt:ncq": "content:no-close-quote;",
"cnt:a": "content:attr(|);",
"cnt:c": "content:counter(|);",
"cnt:cs": "content:counters(|);",
"tbl": "table-layout:|;",
"tbl:a": "table-layout:auto;",
"tbl:f": "table-layout:fixed;",
"cps": "caption-side:|;",
"cps:t": "caption-side:top;",
"cps:b": "caption-side:bottom;",
"ec": "empty-cells:|;",
"ec:s": "empty-cells:show;",
"ec:h": "empty-cells:hide;",
"lis": "list-style:|;",
"lis:n": "list-style:none;",
"lisp": "list-style-position:|;",
"lisp:i": "list-style-position:inside;",
"lisp:o": "list-style-position:outside;",
"list": "list-style-type:|;",
"list:n": "list-style-type:none;",
"list:d": "list-style-type:disc;",
"list:c": "list-style-type:circle;",
"list:s": "list-style-type:square;",
"list:dc": "list-style-type:decimal;",
"list:dclz": "list-style-type:decimal-leading-zero;",
"list:lr": "list-style-type:lower-roman;",
"list:ur": "list-style-type:upper-roman;",
"lisi": "list-style-image:|;",
"lisi:n": "list-style-image:none;",
"q": "quotes:|;",
"q:n": "quotes:none;",
"q:ru": "quotes:'\\00AB' '\\00BB' '\\201E' '\\201C';",
"q:en": "quotes:'\\201C' '\\201D' '\\2018' '\\2019';",
"ct": "content:|;",
"ct:n": "content:normal;",
"ct:oq": "content:open-quote;",
"ct:noq": "content:no-open-quote;",
"ct:cq": "content:close-quote;",
"ct:ncq": "content:no-close-quote;",
"ct:a": "content:attr(|);",
"ct:c": "content:counter(|);",
"ct:cs": "content:counters(|);",
"coi": "counter-increment:|;",
"cor": "counter-reset:|;",
"va": "vertical-align:${1:top};",
"va:sup": "vertical-align:super;",
"va:t": "vertical-align:top;",
"va:tt": "vertical-align:text-top;",
"va:m": "vertical-align:middle;",
"va:bl": "vertical-align:baseline;",
"va:b": "vertical-align:bottom;",
"va:tb": "vertical-align:text-bottom;",
"va:sub": "vertical-align:sub;",
"ta": "text-align:${1:left};",
"ta:l": "text-align:left;",
"ta:c": "text-align:center;",
"ta:r": "text-align:right;",
"ta:j": "text-align:justify;",
"ta-lst": "text-align-last:|;",
"tal:a": "text-align-last:auto;",
"tal:l": "text-align-last:left;",
"tal:c": "text-align-last:center;",
"tal:r": "text-align-last:right;",
"td": "text-decoration:${1:none};",
"td:n": "text-decoration:none;",
"td:u": "text-decoration:underline;",
"td:o": "text-decoration:overline;",
"td:l": "text-decoration:line-through;",
"te": "text-emphasis:|;",
"te:n": "text-emphasis:none;",
"te:ac": "text-emphasis:accent;",
"te:dt": "text-emphasis:dot;",
"te:c": "text-emphasis:circle;",
"te:ds": "text-emphasis:disc;",
"te:b": "text-emphasis:before;",
"te:a": "text-emphasis:after;",
"th": "text-height:|;",
"th:a": "text-height:auto;",
"th:f": "text-height:font-size;",
"th:t": "text-height:text-size;",
"th:m": "text-height:max-size;",
"ti": "text-indent:|;",
"ti:-": "text-indent:-9999px;",
"tj": "text-justify:|;",
"tj:a": "text-justify:auto;",
"tj:iw": "text-justify:inter-word;",
"tj:ii": "text-justify:inter-ideograph;",
"tj:ic": "text-justify:inter-cluster;",
"tj:d": "text-justify:distribute;",
"tj:k": "text-justify:kashida;",
"tj:t": "text-justify:tibetan;",
"tov": "text-overflow:${ellipsis};",
"tov:e": "text-overflow:ellipsis;",
"tov:c": "text-overflow:clip;",
"to": "text-outline:|;",
"to+": "text-outline:${1:0} ${2:0} ${3:#000};",
"to:n": "text-outline:none;",
"tr": "text-replace:|;",
"tr:n": "text-replace:none;",
"tt": "text-transform:${1:uppercase};",
"tt:n": "text-transform:none;",
"tt:c": "text-transform:capitalize;",
"tt:u": "text-transform:uppercase;",
"tt:l": "text-transform:lowercase;",
"tw": "text-wrap:|;",
"tw:n": "text-wrap:normal;",
"tw:no": "text-wrap:none;",
"tw:u": "text-wrap:unrestricted;",
"tw:s": "text-wrap:suppress;",
"tsh": "text-shadow:${1:hoff} ${2:voff} ${3:blur} ${4:#000};",
"tsh:r": "text-shadow:${1:h} ${2:v} ${3:blur} rgb(${4:0}, ${5:0}, ${6:0});",
"tsh:ra": "text-shadow:${1:h} ${2:v} ${3:blur} rgba(${4:0}, ${5:0}, ${6:0}, .${7:5});",
"tsh+": "text-shadow:${1:0} ${2:0} ${3:0} ${4:#000};",
"tsh:n": "text-shadow:none;",
"trf": "transform:|;",
"trf:skx": "transform: skewX(${1:angle});",
"trf:sky": "transform: skewY(${1:angle});",
"trf:sc": "transform: scale(${1:x}, ${2:y});",
"trf:scx": "transform: scaleX(${1:x});",
"trf:scy": "transform: scaleY(${1:y});",
"trf:scz": "transform: scaleZ(${1:z});",
"trf:sc3": "transform: scale3d(${1:x}, ${2:y}, ${3:z});",
"trf:r": "transform: rotate(${1:angle});",
"trf:rx": "transform: rotateX(${1:angle});",
"trf:ry": "transform: rotateY(${1:angle});",
"trf:rz": "transform: rotateZ(${1:angle});",
"trf:t": "transform: translate(${1:x}, ${2:y});",
"trf:tx": "transform: translateX(${1:x});",
"trf:ty": "transform: translateY(${1:y});",
"trf:tz": "transform: translateZ(${1:z});",
"trf:t3": "transform: translate3d(${1:tx}, ${2:ty}, ${3:tz});",
"trfo": "transform-origin:|;",
"trfs": "transform-style:${1:preserve-3d};",
"trs": "transition:${1:prop} ${2:time};",
"trsde": "transition-delay:${1:time};",
"trsdu": "transition-duration:${1:time};",
"trsp": "transition-property:${1:prop};",
"trstf": "transition-timing-function:${1:tfunc};",
"lh": "line-height:|;",
"whs": "white-space:|;",
"whs:n": "white-space:normal;",
"whs:p": "white-space:pre;",
"whs:nw": "white-space:nowrap;",
"whs:pw": "white-space:pre-wrap;",
"whs:pl": "white-space:pre-line;",
"whsc": "white-space-collapse:|;",
"whsc:n": "white-space-collapse:normal;",
"whsc:k": "white-space-collapse:keep-all;",
"whsc:l": "white-space-collapse:loose;",
"whsc:bs": "white-space-collapse:break-strict;",
"whsc:ba": "white-space-collapse:break-all;",
"wob": "word-break:|;",
"wob:n": "word-break:normal;",
"wob:k": "word-break:keep-all;",
"wob:ba": "word-break:break-all;",
"wos": "word-spacing:|;",
"wow": "word-wrap:|;",
"wow:nm": "word-wrap:normal;",
"wow:n": "word-wrap:none;",
"wow:u": "word-wrap:unrestricted;",
"wow:s": "word-wrap:suppress;",
"wow:b": "word-wrap:break-word;",
"wm": "writing-mode:${1:lr-tb};",
"wm:lrt": "writing-mode:lr-tb;",
"wm:lrb": "writing-mode:lr-bt;",
"wm:rlt": "writing-mode:rl-tb;",
"wm:rlb": "writing-mode:rl-bt;",
"wm:tbr": "writing-mode:tb-rl;",
"wm:tbl": "writing-mode:tb-lr;",
"wm:btl": "writing-mode:bt-lr;",
"wm:btr": "writing-mode:bt-rl;",
"lts": "letter-spacing:|;",
"lts-n": "letter-spacing:normal;",
"f": "font:|;",
"f+": "font:${1:1em} ${2:Arial,sans-serif};",
"fw": "font-weight:|;",
"fw:n": "font-weight:normal;",
"fw:b": "font-weight:bold;",
"fw:br": "font-weight:bolder;",
"fw:lr": "font-weight:lighter;",
"fs": "font-style:${italic};",
"fs:n": "font-style:normal;",
"fs:i": "font-style:italic;",
"fs:o": "font-style:oblique;",
"fv": "font-variant:|;",
"fv:n": "font-variant:normal;",
"fv:sc": "font-variant:small-caps;",
"fz": "font-size:|;",
"fza": "font-size-adjust:|;",
"fza:n": "font-size-adjust:none;",
"ff": "font-family:|;",
"ff:s": "font-family:serif;",
"ff:ss": "font-family:sans-serif;",
"ff:c": "font-family:cursive;",
"ff:f": "font-family:fantasy;",
"ff:m": "font-family:monospace;",
"ff:a": "font-family: Arial, \"Helvetica Neue\", Helvetica, sans-serif;",
"ff:t": "font-family: \"Times New Roman\", Times, Baskerville, Georgia, serif;",
"ff:v": "font-family: Verdana, Geneva, sans-serif;",
"fef": "font-effect:|;",
"fef:n": "font-effect:none;",
"fef:eg": "font-effect:engrave;",
"fef:eb": "font-effect:emboss;",
"fef:o": "font-effect:outline;",
"fem": "font-emphasize:|;",
"femp": "font-emphasize-position:|;",
"femp:b": "font-emphasize-position:before;",
"femp:a": "font-emphasize-position:after;",
"fems": "font-emphasize-style:|;",
"fems:n": "font-emphasize-style:none;",
"fems:ac": "font-emphasize-style:accent;",
"fems:dt": "font-emphasize-style:dot;",
"fems:c": "font-emphasize-style:circle;",
"fems:ds": "font-emphasize-style:disc;",
"fsm": "font-smooth:|;",
"fsm:a": "font-smooth:auto;",
"fsm:n": "font-smooth:never;",
"fsm:aw": "font-smooth:always;",
"fst": "font-stretch:|;",
"fst:n": "font-stretch:normal;",
"fst:uc": "font-stretch:ultra-condensed;",
"fst:ec": "font-stretch:extra-condensed;",
"fst:c": "font-stretch:condensed;",
"fst:sc": "font-stretch:semi-condensed;",
"fst:se": "font-stretch:semi-expanded;",
"fst:e": "font-stretch:expanded;",
"fst:ee": "font-stretch:extra-expanded;",
"fst:ue": "font-stretch:ultra-expanded;",
"op": "opacity:|;",
"op+": "opacity: $1;\nfilter: alpha(opacity=$2);",
"op:ie": "filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);",
"op:ms": "-ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=100)';",
"rsz": "resize:|;",
"rsz:n": "resize:none;",
"rsz:b": "resize:both;",
"rsz:h": "resize:horizontal;",
"rsz:v": "resize:vertical;",
"cur": "cursor:${pointer};",
"cur:a": "cursor:auto;",
"cur:d": "cursor:default;",
"cur:c": "cursor:crosshair;",
"cur:ha": "cursor:hand;",
"cur:he": "cursor:help;",
"cur:m": "cursor:move;",
"cur:p": "cursor:pointer;",
"cur:t": "cursor:text;",
"fxd": "flex-direction:|;",
"fxd:r": "flex-direction:row;",
"fxd:rr": "flex-direction:row-reverse;",
"fxd:c": "flex-direction:column;",
"fxd:cr": "flex-direction:column-reverse;",
"fxw": "flex-wrap: |;",
"fxw:n": "flex-wrap:nowrap;",
"fxw:w": "flex-wrap:wrap;",
"fxw:wr": "flex-wrap:wrap-reverse;",
"fxf": "flex-flow:|;",
"jc": "justify-content:|;",
"jc:fs": "justify-content:flex-start;",
"jc:fe": "justify-content:flex-end;",
"jc:c": "justify-content:center;",
"jc:sb": "justify-content:space-between;",
"jc:sa": "justify-content:space-around;",
"ai": "align-items:|;",
"ai:fs": "align-items:flex-start;",
"ai:fe": "align-items:flex-end;",
"ai:c": "align-items:center;",
"ai:b": "align-items:baseline;",
"ai:s": "align-items:stretch;",
"ac": "align-content:|;",
"ac:fs": "align-content:flex-start;",
"ac:fe": "align-content:flex-end;",
"ac:c": "align-content:center;",
"ac:sb": "align-content:space-between;",
"ac:sa": "align-content:space-around;",
"ac:s": "align-content:stretch;",
"ord": "order:|;",
"fxg": "flex-grow:|;",
"fxsh": "flex-shrink:|;",
"fxb": "flex-basis:|;",
"fx": "flex:|;",
"as": "align-self:|;",
"as:a": "align-self:auto;",
"as:fs": "align-self:flex-start;",
"as:fe": "align-self:flex-end;",
"as:c": "align-self:center;",
"as:b": "align-self:baseline;",
"as:s": "align-self:stretch;",
"pgbb": "page-break-before:|;",
"pgbb:au": "page-break-before:auto;",
"pgbb:al": "page-break-before:always;",
"pgbb:l": "page-break-before:left;",
"pgbb:r": "page-break-before:right;",
"pgbi": "page-break-inside:|;",
"pgbi:au": "page-break-inside:auto;",
"pgbi:av": "page-break-inside:avoid;",
"pgba": "page-break-after:|;",
"pgba:au": "page-break-after:auto;",
"pgba:al": "page-break-after:always;",
"pgba:l": "page-break-after:left;",
"pgba:r": "page-break-after:right;",
"orp": "orphans:|;",
"us": "user-select:${none};",
"wid": "widows:|;",
"wfsm": "-webkit-font-smoothing:${antialiased};",
"wfsm:a": "-webkit-font-smoothing:antialiased;",
"wfsm:s": "-webkit-font-smoothing:subpixel-antialiased;",
"wfsm:sa": "-webkit-font-smoothing:subpixel-antialiased;",
"wfsm:n": "-webkit-font-smoothing:none;"
}
},
"html": {
"filters": "html",
"profile": "html",
"snippets": {
"!!!": "<!DOCTYPE html>",
"!!!4t": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
"!!!4s": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">",
"!!!xt": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">",
"!!!xs": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">",
"!!!xxs": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">",
"c": "<!-- |${child} -->",
"cc:ie6": "<!--[if lte IE 6]>\n\t${child}|\n<![endif]-->",
"cc:ie": "<!--[if IE]>\n\t${child}|\n<![endif]-->",
"cc:noie": "<!--[if !IE]><!-->\n\t${child}|\n<!--<![endif]-->"
},
"abbreviations": {
"!": "html:5",
"a": "<a href=\"\">",
"a:link": "<a href=\"http://|\">",
"a:mail": "<a href=\"mailto:|\">",
"abbr": "<abbr title=\"\">",
"acr|acronym": "<acronym title=\"\">",
"base": "<base href=\"\" />",
"basefont": "<basefont/>",
"br": "<br/>",
"frame": "<frame/>",
"hr": "<hr/>",
"bdo": "<bdo dir=\"\">",
"bdo:r": "<bdo dir=\"rtl\">",
"bdo:l": "<bdo dir=\"ltr\">",
"col": "<col/>",
"link": "<link rel=\"stylesheet\" href=\"\" />",
"link:css": "<link rel=\"stylesheet\" href=\"${1:style}.css\" />",
"link:print": "<link rel=\"stylesheet\" href=\"${1:print}.css\" media=\"print\" />",
"link:favicon": "<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"${1:favicon.ico}\" />",
"link:touch": "<link rel=\"apple-touch-icon\" href=\"${1:favicon.png}\" />",
"link:rss": "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"${1:rss.xml}\" />",
"link:atom": "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"Atom\" href=\"${1:atom.xml}\" />",
"link:im|link:import": "<link rel=\"import\" href=\"${1:component}.html\" />",
"meta": "<meta/>",
"meta:utf": "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\" />",
"meta:win": "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=windows-1251\" />",
"meta:vp": "<meta name=\"viewport\" content=\"width=${1:device-width}, user-scalable=${2:no}, initial-scale=${3:1.0}, maximum-scale=${4:1.0}, minimum-scale=${5:1.0}\" />",
"meta:compat": "<meta http-equiv=\"X-UA-Compatible\" content=\"${1:IE=7}\" />",
"style": "<style>",
"script": "<script !src=\"\">",
"script:src": "<script src=\"\">",
"img": "<img src=\"\" alt=\"\" />",
"img:s|img:srcset": "<img srcset=\"\" src=\"\" alt=\"\" />",
"img:z|img:sizes": "<img sizes=\"\" srcset=\"\" src=\"\" alt=\"\" />",
"picture": "<picture>",
"src|source": "<source/>",
"src:sc|source:src": "<source src=\"\" type=\"\"/>",
"src:s|source:srcset": "<source srcset=\"\"/>",
"src:m|source:media": "<source media=\"(${1:min-width: })\" srcset=\"\"/>",
"src:t|source:type": "<source srcset=\"|\" type=\"${1:image/}\"/>",
"src:z|source:sizes": "<source sizes=\"\" srcset=\"\"/>",
"src:mt|source:media:type": "<source media=\"(${1:min-width: })\" srcset=\"\" type=\"${2:image/}\"/>",
"src:mz|source:media:sizes": "<source media=\"(${1:min-width: })\" sizes=\"\" srcset=\"\"/>",
"src:zt|source:sizes:type": "<source sizes=\"\" srcset=\"\" type=\"${1:image/}\"/>",
"iframe": "<iframe src=\"\" frameborder=\"0\">",
"embed": "<embed src=\"\" type=\"\" />",
"object": "<object data=\"\" type=\"\">",
"param": "<param name=\"\" value=\"\" />",
"map": "<map name=\"\">",
"area": "<area shape=\"\" coords=\"\" href=\"\" alt=\"\" />",
"area:d": "<area shape=\"default\" href=\"\" alt=\"\" />",
"area:c": "<area shape=\"circle\" coords=\"\" href=\"\" alt=\"\" />",
"area:r": "<area shape=\"rect\" coords=\"\" href=\"\" alt=\"\" />",
"area:p": "<area shape=\"poly\" coords=\"\" href=\"\" alt=\"\" />",
"form": "<form action=\"\">",
"form:get": "<form action=\"\" method=\"get\">",
"form:post": "<form action=\"\" method=\"post\">",
"label": "<label for=\"\">",
"input": "<input type=\"${1:text}\" />",
"inp": "<input type=\"${1:text}\" name=\"\" id=\"\" />",
"input:h|input:hidden": "input[type=hidden name]",
"input:t|input:text": "inp",
"input:search": "inp[type=search]",
"input:email": "inp[type=email]",
"input:url": "inp[type=url]",
"input:p|input:password": "inp[type=password]",
"input:datetime": "inp[type=datetime]",
"input:date": "inp[type=date]",
"input:datetime-local": "inp[type=datetime-local]",
"input:month": "inp[type=month]",
"input:week": "inp[type=week]",
"input:time": "inp[type=time]",
"input:tel": "inp[type=tel]",
"input:number": "inp[type=number]",
"input:color": "inp[type=color]",
"input:c|input:checkbox": "inp[type=checkbox]",
"input:r|input:radio": "inp[type=radio]",
"input:range": "inp[type=range]",
"input:f|input:file": "inp[type=file]",
"input:s|input:submit": "<input type=\"submit\" value=\"\" />",
"input:i|input:image": "<input type=\"image\" src=\"\" alt=\"\" />",
"input:b|input:button": "<input type=\"button\" value=\"\" />",
"isindex": "<isindex/>",
"input:reset": "input:button[type=reset]",
"select": "<select name=\"\" id=\"\">",
"select:d|select:disabled": "select[disabled.]",
"opt|option": "<option value=\"\">",
"textarea": "<textarea name=\"\" id=\"\" cols=\"${1:30}\" rows=\"${2:10}\">",
"marquee": "<marquee behavior=\"\" direction=\"\">",
"menu:c|menu:context": "menu[type=context]>",
"menu:t|menu:toolbar": "menu[type=toolbar]>",
"video": "<video src=\"\">",
"audio": "<audio src=\"\">",
"html:xml": "<html xmlns=\"http://www.w3.org/1999/xhtml\">",
"keygen": "<keygen/>",
"command": "<command/>",
"btn:s|button:s|button:submit" : "button[type=submit]",
"btn:r|button:r|button:reset" : "button[type=reset]",
"btn:d|button:d|button:disabled" : "button[disabled.]",
"fst:d|fset:d|fieldset:d|fieldset:disabled" : "fieldset[disabled.]",
"bq": "blockquote",
"fig": "figure",
"figc": "figcaption",
"pic": "picture",
"ifr": "iframe",
"emb": "embed",
"obj": "object",
"cap": "caption",
"colg": "colgroup",
"fst": "fieldset",
"btn": "button",
"optg": "optgroup",
"tarea": "textarea",
"leg": "legend",
"sect": "section",
"art": "article",
"hdr": "header",
"ftr": "footer",
"adr": "address",
"dlg": "dialog",
"str": "strong",
"prog": "progress",
"mn": "main",
"tem": "template",
"fset": "fieldset",
"datag": "datagrid",
"datal": "datalist",
"kg": "keygen",
"out": "output",
"det": "details",
"cmd": "command",
"doc": "html>(head>meta[charset=${charset}]+title{${1:Document}})+body",
"doc4": "html>(head>meta[http-equiv=\"Content-Type\" content=\"text/html;charset=${charset}\"]+title{${1:Document}})+body",
"ri:d|ri:dpr": "img:s",
"ri:v|ri:viewport": "img:z",
"ri:a|ri:art": "pic>src:m+img",
"ri:t|ri:type": "pic>src:t+img",
"html:4t": "!!!4t+doc4[lang=${lang}]",
"html:4s": "!!!4s+doc4[lang=${lang}]",
"html:xt": "!!!xt+doc4[xmlns=http://www.w3.org/1999/xhtml xml:lang=${lang}]",
"html:xs": "!!!xs+doc4[xmlns=http://www.w3.org/1999/xhtml xml:lang=${lang}]",
"html:xxs": "!!!xxs+doc4[xmlns=http://www.w3.org/1999/xhtml xml:lang=${lang}]",
"html:5": "!!!+doc[lang=${lang}]",
"ol+": "ol>li",
"ul+": "ul>li",
"dl+": "dl>dt+dd",
"map+": "map>area",
"table+": "table>tr>td",
"colgroup+": "colgroup>col",
"colg+": "colgroup>col",
"tr+": "tr>td",
"select+": "select>option",
"optgroup+": "optgroup>option",
"optg+": "optgroup>option",
"pic+": "picture>source:srcset+img"
}
},
"xml": {
"extends": "html",
"profile": "xml",
"filters": "html"
},
"xsl": {
"extends": "html",
"profile": "xml",
"filters": "html, xsl",
"abbreviations": {
"tm|tmatch": "<xsl:template match=\"\" mode=\"\">",
"tn|tname": "<xsl:template name=\"\">",
"call": "<xsl:call-template name=\"\"/>",
"ap": "<xsl:apply-templates select=\"\" mode=\"\"/>",
"api": "<xsl:apply-imports/>",
"imp": "<xsl:import href=\"\"/>",
"inc": "<xsl:include href=\"\"/>",
"ch": "<xsl:choose>",
"wh|xsl:when": "<xsl:when test=\"\">",
"ot": "<xsl:otherwise>",
"if": "<xsl:if test=\"\">",
"par": "<xsl:param name=\"\">",
"pare": "<xsl:param name=\"\" select=\"\"/>",
"var": "<xsl:variable name=\"\">",
"vare": "<xsl:variable name=\"\" select=\"\"/>",
"wp": "<xsl:with-param name=\"\" select=\"\"/>",
"key": "<xsl:key name=\"\" match=\"\" use=\"\"/>",
"elem": "<xsl:element name=\"\">",
"attr": "<xsl:attribute name=\"\">",
"attrs": "<xsl:attribute-set name=\"\">",
"cp": "<xsl:copy select=\"\"/>",
"co": "<xsl:copy-of select=\"\"/>",
"val": "<xsl:value-of select=\"\"/>",
"for|each": "<xsl:for-each select=\"\">",
"tex": "<xsl:text></xsl:text>",
"com": "<xsl:comment>",
"msg": "<xsl:message terminate=\"no\">",
"fall": "<xsl:fallback>",
"num": "<xsl:number value=\"\"/>",
"nam": "<namespace-alias stylesheet-prefix=\"\" result-prefix=\"\"/>",
"pres": "<xsl:preserve-space elements=\"\"/>",
"strip": "<xsl:strip-space elements=\"\"/>",
"proc": "<xsl:processing-instruction name=\"\">",
"sort": "<xsl:sort select=\"\" order=\"\"/>",
"choose+": "xsl:choose>xsl:when+xsl:otherwise",
"xsl": "!!!+xsl:stylesheet[version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform]>{\n|}"
},
"snippets": {
"!!!": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
}
},
"haml": {
"filters": "haml",
"extends": "html",
"profile": "xml"
},
"jade": {
"filters": "jade",
"extends": "html",
"profile": "xml"
},
"jsx": {
"filters": "jsx, html",
"extends": "html",
"profile": "xml"
},
"slim": {
"filters": "slim",
"extends": "html",
"profile": "xml"
},
"scss": {
"extends": "css"
},
"sass": {
"extends": "css"
},
"less": {
"extends": "css"
},
"stylus": {
"extends": "css"
},
"styl": {
"extends": "stylus"
}
}
},{}],69:[function(require,module,exports){
/**
* Utility functions to work with <code>AbbreviationNode</code> as HTML element
* @param {Function} require
* @param {Underscore} _
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var elements = require('../assets/elements');
var tabStops = require('../assets/tabStops');
var utils = require('../utils/common');
var tagName = require('../resolver/tagName');
return {
/**
* Test if passed node is unary (no closing tag)
* @param {AbbreviationNode} node
* @return {Boolean}
*/
isUnary: function(node) {
if (node.children.length || node._text || this.isSnippet(node)) {
return false;
}
var r = node.data('resource');
return r && r.is_empty;
},
/**
* Test if passed node is inline-level (like <strong>, <img>)
* @param {AbbreviationNode} node
* @return {Boolean}
*/
isInline: function(node) {
return node.isTextNode()
|| !node.name()
|| tagName.isInlineLevel(node.name());
},
/**
* Test if passed node is block-level
* @param {AbbreviationNode} node
* @return {Boolean}
*/
isBlock: function(node) {
return this.isSnippet(node) || !this.isInline(node);
},
/**
* Test if given node is a snippet
* @param {AbbreviationNode} node
* @return {Boolean}
*/
isSnippet: function(node) {
return elements.is(node.data('resource'), 'snippet');
},
/**
* This function tests if passed node content contains HTML tags.
* This function is mostly used for output formatting
* @param {AbbreviationNode} node
* @returns {Boolean}
*/
hasTagsInContent: function(node) {
return utils.matchesTag(node.content);
},
/**
* Test if current element contains block-level children
* @param {AbbreviationNode} node
* @return {Boolean}
*/
hasBlockChildren: function(node) {
return (this.hasTagsInContent(node) && this.isBlock(node))
|| node.children.some(function(child) {
return this.isBlock(child);
}, this);
},
/**
* Utility function that inserts content instead of <code>${child}</code>
* variables on <code>text</code>
* @param {String} text Text where child content should be inserted
* @param {String} childContent Content to insert
* @param {Object} options
* @returns {String
*/
insertChildContent: function(text, childContent, options) {
options = utils.extend({
keepVariable: true,
appendIfNoChild: true
}, options || {});
var childVariableReplaced = false;
text = tabStops.replaceVariables(text, function(variable, name, data) {
var output = variable;
if (name == 'child') {
// add correct indentation
output = utils.padString(childContent, utils.getLinePaddingFromPosition(text, data.start));
childVariableReplaced = true;
if (options.keepVariable)
output += variable;
}
return output;
});
if (!childVariableReplaced && options.appendIfNoChild) {
text += childContent;
}
return text;
}
};
});
},{"../assets/elements":24,"../assets/tabStops":33,"../resolver/tagName":67,"../utils/common":73}],70:[function(require,module,exports){
/**
* Utility methods for Emmet actions
* @author Sergey Chikuyonok (serge.che@gmail.com) <http://chikuyonok.ru>
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('./common');
var cssSections = require('./cssSections');
var abbreviationParser = require('../parser/abbreviation');
var htmlMatcher = require('../assets/htmlMatcher');
var xmlEditTree = require('../editTree/xml');
var range = require('../assets/range');
var resources = require('../assets/resources');
return {
mimeTypes: {
'gif' : 'image/gif',
'png' : 'image/png',
'jpg' : 'image/jpeg',
'jpeg': 'image/jpeg',
'svg' : 'image/svg+xml',
'html': 'text/html',
'htm' : 'text/html'
},
/**
* Extracts abbreviations from text stream, starting from the end
* @param {String} str
* @return {String} Abbreviation or empty string
* @memberOf emmet.actionUtils
*/
extractAbbreviation: function(str) {
var curOffset = str.length;
var startIndex = -1;
var groupCount = 0;
var braceCount = 0;
var textCount = 0;
while (true) {
curOffset--;
if (curOffset < 0) {
// moved to the beginning of the line
startIndex = 0;
break;
}
var ch = str.charAt(curOffset);
if (ch == ']') {
braceCount++;
} else if (ch == '[') {
if (!braceCount) { // unexpected brace
startIndex = curOffset + 1;
break;
}
braceCount--;
} else if (ch == '}') {
textCount++;
} else if (ch == '{') {
if (!textCount) { // unexpected brace
startIndex = curOffset + 1;
break;
}
textCount--;
} else if (ch == ')') {
groupCount++;
} else if (ch == '(') {
if (!groupCount) { // unexpected brace
startIndex = curOffset + 1;
break;
}
groupCount--;
} else {
if (braceCount || textCount)
// respect all characters inside attribute sets or text nodes
continue;
else if (!abbreviationParser.isAllowedChar(ch) || (ch == '>' && utils.endsWithTag(str.substring(0, curOffset + 1)))) {
// found stop symbol
startIndex = curOffset + 1;
break;
}
}
}
if (startIndex != -1 && !textCount && !braceCount && !groupCount)
// found something, remove some invalid symbols from the
// beginning and return abbreviation
return str.substring(startIndex).replace(/^[\*\+\>\^]+/, '');
else
return '';
},
/**
* Gets image size from image byte stream.
* @author http://romeda.org/rePublish/
* @param {String} stream Image byte stream (use <code>IEmmetFile.read()</code>)
* @return {Object} Object with <code>width</code> and <code>height</code> properties
*/
getImageSize: function(stream) {
var pngMagicNum = "\211PNG\r\n\032\n",
jpgMagicNum = "\377\330",
gifMagicNum = "GIF8",
pos = 0,
nextByte = function() {
return stream.charCodeAt(pos++);
};
if (stream.substr(0, 8) === pngMagicNum) {
// PNG. Easy peasy.
pos = stream.indexOf('IHDR') + 4;
return {
width: (nextByte() << 24) | (nextByte() << 16) | (nextByte() << 8) | nextByte(),
height: (nextByte() << 24) | (nextByte() << 16) | (nextByte() << 8) | nextByte()
};
} else if (stream.substr(0, 4) === gifMagicNum) {
pos = 6;
return {
width: nextByte() | (nextByte() << 8),
height: nextByte() | (nextByte() << 8)
};
} else if (stream.substr(0, 2) === jpgMagicNum) {
pos = 2;
var l = stream.length;
while (pos < l) {
if (nextByte() != 0xFF) return;
var marker = nextByte();
if (marker == 0xDA) break;
var size = (nextByte() << 8) | nextByte();
if (marker >= 0xC0 && marker <= 0xCF && !(marker & 0x4) && !(marker & 0x8)) {
pos += 1;
return {
height: (nextByte() << 8) | nextByte(),
width: (nextByte() << 8) | nextByte()
};
} else {
pos += size - 2;
}
}
}
},
/**
* Captures context XHTML element from editor under current caret position.
* This node can be used as a helper for abbreviation extraction
* @param {IEmmetEditor} editor
* @returns {Object}
*/
captureContext: function(editor, pos) {
var allowedSyntaxes = {'html': 1, 'xml': 1, 'xsl': 1};
var syntax = editor.getSyntax();
if (syntax in allowedSyntaxes) {
var content = editor.getContent();
if (typeof pos === 'undefined') {
pos = editor.getCaretPos();
}
var tag = htmlMatcher.find(content, pos);
if (tag && tag.type == 'tag') {
var startTag = tag.open;
var contextNode = {
name: startTag.name,
attributes: [],
match: tag
};
// parse attributes
var tagTree = xmlEditTree.parse(startTag.range.substring(content));
if (tagTree) {
contextNode.attributes = tagTree.getAll().map(function(item) {
return {
name: item.name(),
value: item.value()
};
});
}
return contextNode;
}
}
return null;
},
/**
* Find expression bounds in current editor at caret position.
* On each character a <code>fn</code> function will be called and must
* return <code>true</code> if current character meets requirements,
* <code>false</code> otherwise
* @param {IEmmetEditor} editor
* @param {Function} fn Function to test each character of expression
* @return {Range}
*/
findExpressionBounds: function(editor, fn) {
var content = String(editor.getContent());
var il = content.length;
var exprStart = editor.getCaretPos() - 1;
var exprEnd = exprStart + 1;
// start by searching left
while (exprStart >= 0 && fn(content.charAt(exprStart), exprStart, content)) exprStart--;
// then search right
while (exprEnd < il && fn(content.charAt(exprEnd), exprEnd, content)) exprEnd++;
if (exprEnd > exprStart) {
return range([++exprStart, exprEnd]);
}
},
/**
* @param {IEmmetEditor} editor
* @param {Object} data
* @returns {Boolean}
*/
compoundUpdate: function(editor, data) {
if (data) {
var sel = editor.getSelectionRange();
editor.replaceContent(data.data, data.start, data.end, true);
editor.createSelection(data.caret, data.caret + sel.end - sel.start);
return true;
}
return false;
},
/**
* Common syntax detection method for editors that doesn’t provide any
* info about current syntax scope.
* @param {IEmmetEditor} editor Current editor
* @param {String} hint Any syntax hint that editor can provide
* for syntax detection. Default is 'html'
* @returns {String}
*/
detectSyntax: function(editor, hint) {
var syntax = hint || 'html';
if (!resources.hasSyntax(syntax)) {
syntax = 'html';
}
if (syntax == 'html' && (this.isStyle(editor) || this.isInlineCSS(editor))) {
syntax = 'css';
}
if (syntax == 'styl') {
syntax = 'stylus';
}
return syntax;
},
/**
* Common method for detecting output profile
* @param {IEmmetEditor} editor
* @returns {String}
*/
detectProfile: function(editor) {
var syntax = editor.getSyntax();
// get profile from syntax definition
var profile = resources.findItem(syntax, 'profile');
if (profile) {
return profile;
}
switch(syntax) {
case 'xml':
case 'xsl':
return 'xml';
case 'css':
if (this.isInlineCSS(editor)) {
return 'line';
}
break;
case 'html':
profile = resources.getVariable('profile');
if (!profile) { // no forced profile, guess from content
// html or xhtml?
profile = this.isXHTML(editor) ? 'xhtml': 'html';
}
return profile;
}
return 'xhtml';
},
/**
* Tries to detect if current document is XHTML one.
* @param {IEmmetEditor} editor
* @returns {Boolean}
*/
isXHTML: function(editor) {
return editor.getContent().search(/<!DOCTYPE[^>]+XHTML/i) != -1;
},
/**
* Check if current caret position is inside <style> tag
* @param {IEmmetEditor} editor
* @returns {Range} Inner range of <style> tag
*/
isStyle: function(editor) {
return !!cssSections.styleTagRange(editor.getContent(), editor.getCaretPos());
},
/**
* Check if given CSS dialect is supported by CSS actions
* @param {String} syntax
* @return {Boolean}
*/
isSupportedCSS: function(syntax) {
return syntax == 'css' || syntax == 'less' || syntax == 'scss';
},
/**
* Check if current caret position is inside "style" attribute of HTML
* element
* @param {IEmmetEditor} editor
* @returns {Range} Inner range of style attribute
*/
isInlineCSS: function(editor) {
return !!cssSections.styleAttrRange(editor.getContent(), editor.getCaretPos());
}
};
});
},{"../assets/htmlMatcher":26,"../assets/range":30,"../assets/resources":31,"../editTree/xml":38,"../parser/abbreviation":55,"./common":73,"./cssSections":74}],71:[function(require,module,exports){
/**
* @author Sergey Chikuyonok (serge.che@gmail.com)
* @link http://chikuyonok.ru
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
return {
/**
* Encodes data using base64 algorithm
* @author Tyler Akins (http://rumkin.com)
* @param {String} input
* @returns {String}
*/
encode : function(input) {
var output = [];
var chr1, chr2, chr3, enc1, enc2, enc3, enc4, cdp1, cdp2, cdp3;
var i = 0, il = input.length, b64 = chars;
while (i < il) {
cdp1 = input.charCodeAt(i++);
cdp2 = input.charCodeAt(i++);
cdp3 = input.charCodeAt(i++);
chr1 = cdp1 & 0xff;
chr2 = cdp2 & 0xff;
chr3 = cdp3 & 0xff;
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(cdp2)) {
enc3 = enc4 = 64;
} else if (isNaN(cdp3)) {
enc4 = 64;
}
output.push(b64.charAt(enc1) + b64.charAt(enc2) + b64.charAt(enc3) + b64.charAt(enc4));
}
return output.join('');
},
/**
* Decodes string using MIME base64 algorithm
*
* @author Tyler Akins (http://rumkin.com)
* @param {String} data
* @return {String}
*/
decode : function(data) {
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, tmpArr = [];
var b64 = chars, il = data.length;
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) {
tmpArr[ac++] = String.fromCharCode(o1);
} else if (h4 == 64) {
tmpArr[ac++] = String.fromCharCode(o1, o2);
} else {
tmpArr[ac++] = String.fromCharCode(o1, o2, o3);
}
} while (i < il);
return tmpArr.join('');
}
};
});
},{}],72:[function(require,module,exports){
/**
* Utility module for working with comments in source code
* (mostly stripping it from source)
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('./common');
var range = require('../assets/range');
var stringStream = require('../assets/stringStream');
var reHasComment = /\/\*|\/\//;
return {
/**
* Replaces all comments in given CSS source with spaces,
* which allows more reliable (and faster) token search
* in CSS content
* @param {String} content CSS content
* @return {String}
*/
strip: function(content) {
if (!reHasComment.test(content)) {
return content;
}
var stream = stringStream(content);
var replaceRanges = [];
var ch, ch2;
while ((ch = stream.next())) {
if (ch === '/') {
ch2 = stream.peek();
if (ch2 === '*') { // multiline CSS comment
stream.start = stream.pos - 1;
if (stream.skipTo('*/')) {
stream.pos += 2;
} else {
// unclosed comment
stream.skipToEnd();
}
replaceRanges.push([stream.start, stream.pos]);
} else if (ch2 === '/') {
// preprocessor’s single line comments
stream.start = stream.pos - 1;
while ((ch2 = stream.next())) {
if (ch2 === '\n' || ch2 == '\r') {
break
}
}
replaceRanges.push([stream.start, stream.pos]);
}
} else {
stream.skipQuoted();
}
}
return utils.replaceWith(content, replaceRanges, ' ');
}
};
});
},{"../assets/range":30,"../assets/stringStream":32,"./common":73}],73:[function(require,module,exports){
/**
* Common utility helper for Emmet
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var range = require('../assets/range');
/**
* Special token used as a placeholder for caret positions inside
* generated output
*/
var caretPlaceholder = '${0}';
return {
reTag: /<\/?[\w:\-]+(?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*\s*(\/?)>$/,
defaultSyntax: function() {
return 'html';
},
defaultProfile: function() {
return 'plain';
},
/**
* Test if passed string ends with XHTML tag. This method is used for testing
* '>' character: it belongs to tag or it's a part of abbreviation?
* @param {String} str
* @return {Boolean}
*/
endsWithTag: function(str) {
return this.reTag.test(str);
},
/**
* Check if passed symbol is a number
* @param {String} ch
* @returns {Boolean}
*/
isNumeric: function(ch) {
if (typeof(ch) == 'string')
ch = ch.charCodeAt(0);
return (ch && ch > 47 && ch < 58);
},
/**
* Trim whitespace from string
* @param {String} text
* @return {String}
*/
trim: (function() {
if (String.prototype.trim) {
return function(text) {
return text ? text.trim() : '';
};
}
return function(text) {
return (text || "").replace(/^\s+|\s+$/g, "");
}
})(),
/**
* Split text into lines. Set <code>remove_empty</code> to true to filter
* empty lines
* @param {String} text Text to split
* @param {Boolean} removeEmpty Remove empty lines from result
* @return {Array}
*/
splitByLines: function(text, removeEmpty) {
// IE fails to split string by regexp,
// need to normalize newlines first
// Also, Mozilla's Rhiho JS engine has a weird newline bug
var nl = '\n';
var lines = (text || '')
.replace(/\r\n/g, '\n')
.replace(/\n\r/g, '\n')
.replace(/\r/g, '\n')
.replace(/\n/g, nl)
.split(nl);
if (removeEmpty) {
lines = lines.filter(function(line) {
return line.length && !!this.trim(line);
}, this);
}
return lines;
},
/**
* Repeats string <code>howMany</code> times
* @param {String} str
* @param {Number} how_many
* @return {String}
*/
repeatString: function(str, howMany) {
var out = '';
while (howMany--) {
out += str;
}
return out;
},
/**
* Returns list of paddings that should be used to align passed string
* @param {Array} strings
* @returns {Array}
*/
getStringsPads: function(strings) {
var lengths = strings.map(function(s) {
return typeof s === 'string' ? s.length : +s;
});
var max = lengths.reduce(function(prev, cur) {
return typeof prev === 'undefined' ? cur : Math.max(prev, cur);
});
return lengths.map(function(l) {
var pad = max - l;
return pad ? this.repeatString(' ', pad) : '';
}, this);
},
/**
* Indents text with padding
* @param {String} text Text to indent
* @param {String} pad Padding size (number) or padding itself (string)
* @return {String}
*/
padString: function(text, pad) {
var result = [];
var lines = this.splitByLines(text);
var nl = '\n';
result.push(lines[0]);
for (var j = 1; j < lines.length; j++)
result.push(nl + pad + lines[j]);
return result.join('');
},
/**
* Pad string with zeroes
* @param {String} str String to pad
* @param {Number} pad Desired string length
* @return {String}
*/
zeroPadString: function(str, pad) {
var padding = '';
var il = str.length;
while (pad > il++) padding += '0';
return padding + str;
},
/**
* Removes padding at the beginning of each text's line
* @param {String} text
* @param {String} pad
*/
unindentString: function(text, pad) {
var lines = this.splitByLines(text);
var pl = pad.length;
for (var i = 0, il = lines.length, line; i < il; i++) {
line = lines[i];
if (line.substr(0, pl) === pad) {
lines[i] = line.substr(pl);
}
}
return lines.join('\n');
},
/**
* Replaces unescaped symbols in <code>str</code>. For example, the '$' symbol
* will be replaced in 'item$count', but not in 'item\$count'.
* @param {String} str Original string
* @param {String} symbol Symbol to replace
* @param {String} replace Symbol replacement. Might be a function that
* returns new value
* @return {String}
*/
replaceUnescapedSymbol: function(str, symbol, replace) {
var i = 0;
var il = str.length;
var sl = symbol.length;
var matchCount = 0;
while (i < il) {
if (str.charAt(i) == '\\') {
// escaped symbol, skip next character
i += sl + 1;
} else if (str.substr(i, sl) == symbol) {
// have match
var curSl = sl;
matchCount++;
var newValue = replace;
if (typeof replace === 'function') {
var replaceData = replace(str, symbol, i, matchCount);
if (replaceData) {
curSl = replaceData[0].length;
newValue = replaceData[1];
} else {
newValue = false;
}
}
if (newValue === false) { // skip replacement
i++;
continue;
}
str = str.substring(0, i) + newValue + str.substring(i + curSl);
// adjust indexes
il = str.length;
i += newValue.length;
} else {
i++;
}
}
return str;
},
/**
* Replaces '$' character in string assuming it might be escaped with '\'
* @param {String} str String where character should be replaced
* @param {String} value New value
* @return {String}
*/
replaceCounter: function(str, value, total) {
var symbol = '$';
// in case we received strings from Java, convert the to native strings
str = String(str);
value = String(value);
if (/^\-?\d+$/.test(value)) {
value = +value;
}
var that = this;
return this.replaceUnescapedSymbol(str, symbol, function(str, symbol, pos, matchNum){
if (str.charAt(pos + 1) == '{' || that.isNumeric(str.charAt(pos + 1)) ) {
// it's a variable, skip it
return false;
}
// replace sequense of $ symbols with padded number
var j = pos + 1;
while(str.charAt(j) == '$' && str.charAt(j + 1) != '{') j++;
var pad = j - pos;
// get counter base
var base = 0, decrement = false, m;
if ((m = str.substr(j).match(/^@(\-?)(\d*)/))) {
j += m[0].length;
if (m[1]) {
decrement = true;
}
base = parseInt(m[2] || 1, 10) - 1;
}
if (decrement && total && typeof value === 'number') {
value = total - value + 1;
}
value += base;
return [str.substring(pos, j), that.zeroPadString(value + '', pad)];
});
},
/**
* Check if string matches against <code>reTag</code> regexp. This
* function may be used to test if provided string contains HTML tags
* @param {String} str
* @returns {Boolean}
*/
matchesTag: function(str) {
return this.reTag.test(str || '');
},
/**
* Escapes special characters used in Emmet, like '$', '|', etc.
* Use this method before passing to actions like "Wrap with Abbreviation"
* to make sure that existing special characters won't be altered
* @param {String} text
* @return {String}
*/
escapeText: function(text) {
return text.replace(/([\$\\])/g, '\\$1');
},
/**
* Unescapes special characters used in Emmet, like '$', '|', etc.
* @param {String} text
* @return {String}
*/
unescapeText: function(text) {
return text.replace(/\\(.)/g, '$1');
},
/**
* Returns caret placeholder
* @returns {String}
*/
getCaretPlaceholder: function() {
return typeof caretPlaceholder === 'function'
? caretPlaceholder.apply(this, arguments)
: caretPlaceholder;
},
/**
* Sets new representation for carets in generated output
* @param {String} value New caret placeholder. Might be a
* <code>Function</code>
*/
setCaretPlaceholder: function(value) {
caretPlaceholder = value;
},
/**
* Returns line padding
* @param {String} line
* @return {String}
*/
getLinePadding: function(line) {
return (line.match(/^(\s+)/) || [''])[0];
},
/**
* Helper function that returns padding of line of <code>pos</code>
* position in <code>content</code>
* @param {String} content
* @param {Number} pos
* @returns {String}
*/
getLinePaddingFromPosition: function(content, pos) {
var lineRange = this.findNewlineBounds(content, pos);
return this.getLinePadding(lineRange.substring(content));
},
/**
* Escape special regexp chars in string, making it usable for creating dynamic
* regular expressions
* @param {String} str
* @return {String}
*/
escapeForRegexp: function(str) {
var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\
return str.replace(specials, "\\$&");
},
/**
* Make decimal number look good: convert it to fixed precision end remove
* traling zeroes
* @param {Number} num
* @param {Number} fracion Fraction numbers (default is 2)
* @return {String}
*/
prettifyNumber: function(num, fraction) {
return num.toFixed(typeof fraction == 'undefined' ? 2 : fraction).replace(/\.?0+$/, '');
},
/**
* Replace substring of <code>str</code> with <code>value</code>
* @param {String} str String where to replace substring
* @param {String} value New substring value
* @param {Number} start Start index of substring to replace. May also
* be a <code>Range</code> object: in this case, the <code>end</code>
* argument is not required
* @param {Number} end End index of substring to replace. If ommited,
* <code>start</code> argument is used
*/
replaceSubstring: function(str, value, start, end) {
if (typeof start === 'object' && 'end' in start) {
end = start.end;
start = start.start;
}
if (typeof end === 'string') {
end = start + end.length;
}
if (typeof end === 'undefined') {
end = start;
}
if (start < 0 || start > str.length)
return str;
return str.substring(0, start) + value + str.substring(end);
},
/**
* Fills substrings in `content`, defined by given ranges,
* wich `ch` character
* @param {String} content
* @param {Array} ranges
* @return {String}
*/
replaceWith: function(content, ranges, ch, noRepeat) {
if (ranges.length) {
var offset = 0, fragments = [];
ranges.forEach(function(r) {
var repl = noRepeat ? ch : this.repeatString(ch, r[1] - r[0]);
fragments.push(content.substring(offset, r[0]), repl);
offset = r[1];
}, this);
content = fragments.join('') + content.substring(offset);
}
return content;
},
/**
* Narrows down text range, adjusting selection to non-space characters
* @param {String} text
* @param {Number} start Starting range in <code>text</code> where
* slection should be adjusted. Can also be any object that is accepted
* by <code>Range</code> class
* @return {Range}
*/
narrowToNonSpace: function(text, start, end) {
var rng = range.create(start, end);
var reSpace = /[\s\n\r\u00a0]/;
// narrow down selection until first non-space character
while (rng.start < rng.end) {
if (!reSpace.test(text.charAt(rng.start)))
break;
rng.start++;
}
while (rng.end > rng.start) {
rng.end--;
if (!reSpace.test(text.charAt(rng.end))) {
rng.end++;
break;
}
}
return rng;
},
/**
* Find start and end index of text line for <code>from</code> index
* @param {String} text
* @param {Number} from
*/
findNewlineBounds: function(text, from) {
var len = text.length,
start = 0,
end = len - 1,
ch;
// search left
for (var i = from - 1; i > 0; i--) {
ch = text.charAt(i);
if (ch == '\n' || ch == '\r') {
start = i + 1;
break;
}
}
// search right
for (var j = from; j < len; j++) {
ch = text.charAt(j);
if (ch == '\n' || ch == '\r') {
end = j;
break;
}
}
return range.create(start, end - start);
},
/**
* Deep merge of two or more objects. Taken from jQuery.extend()
*/
deepMerge: function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length;
// Handle case when target is a string or something (possible in deep copy)
if (typeof target !== 'object' && typeof target !== 'function') {
target = {};
}
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 ( copy && ( typeof copy === 'object' || (copyIsArray = Array.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && Array.isArray(src) ? src : [];
} else {
clone = src && typeof src === 'object' ? src : {};
}
// Never move original objects, clone them
target[ name ] = this.deepMerge(clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
},
/**
* Dead simple string-to-JSON parser
* @param {String} str
* @returns {Object}
*/
parseJSON: function(str) {
if (typeof str == 'object') {
return str;
}
try {
return JSON.parse(str);
} catch(e) {
return {};
}
},
/**************************
* Utility belt
**************************/
unique: function(arr, comparator) {
var lookup = [];
return arr.filter(function(item) {
var val = comparator ? comparator(item) : item;
if (lookup.indexOf(val) < 0) {
lookup.push(val);
return true;
}
});
},
/**
* Return a copy of the object, filtered to only have values for
* the whitelisted keys.
* @param {Object} obj
* @return {Object}
*/
pick: function(obj) {
var result = {};
var keys = this.toArray(arguments, 1);
Object.keys(obj).forEach(function(key) {
if (~keys.indexOf(key)) {
result[key] = obj[key];
}
});
return result;
},
find: function(arr, comparator, ctx) {
var result;
if (ctx) {
comparator = comparator.bind(ctx);
}
if (Array.isArray(arr)) {
arr.some(function(item, i) {
if (comparator(item, i)) {
return result = item;
}
});
} else {
Object.keys(arr).some(function(key, i) {
if (comparator(arr[key], i)) {
return result = arr[key];
}
});
}
return result;
},
toArray: function(obj, sliceIx) {
if (Array.isArray(obj) && !sliceIx) {
return obj;
}
return Array.prototype.slice.call(obj, sliceIx || 0);
},
extend: function(obj) {
for (var i = 1, il = arguments.length, a; i < il; i++) {
a = arguments[i];
if (a) {
Object.keys(a).forEach(function(key) {
obj[key] = a[key];
});
}
}
return obj;
},
defaults: function(obj) {
for (var i = 1, il = arguments.length, a; i < il; i++) {
a = arguments[i];
if (a) {
Object.keys(a).forEach(function(key) {
if (!(key in obj)) {
obj[key] = a[key];
}
});
}
}
return obj;
},
flatten: function(arr, out) {
out = out || [];
var self = this;
self.toArray(arr).forEach(function(item) {
if (Array.isArray(item)) {
self.flatten(item, out);
} else {
out.push(item);
}
});
return out;
},
clone: function(obj) {
if (Array.isArray(obj)) {
return obj.slice(0);
}
return this.extend({}, obj);
},
without: function(arr) {
this.toArray(arguments, 1).forEach(function(item) {
var ix;
while (~(ix = arr.indexOf(item))) {
arr.splice(ix, 1);
}
});
return arr;
},
last: function(arr) {
return arr[arr.length - 1];
}
};
});
},{"../assets/range":30}],74:[function(require,module,exports){
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('./common');
var commentsUtils = require('./comments');
var range = require('../assets/range');
var stringStream = require('../assets/stringStream');
var cssParser = require('../parser/css');
var htmlMatcher = require('../assets/htmlMatcher');
var xmlEditTree = require('../editTree/xml');
var idCounter = 1;
var maxId = 1000000;
var reSpaceTrim = /^(\s*).+?(\s*)$/;
var reSpace = /\s/g;
var reComma = /,/;
function isQuote(ch) {
return ch == '"' || ch == "'";
}
function getId() {
idCounter = (idCounter + 1) % maxId;
return 's' + idCounter;
}
/**
* @param {Range} range Full selector range with additional
* properties for matching name and content (@see findAllRules())
* @param {String} source CSS source
*/
function CSSSection(rng, source) {
this.id = getId();
/** @type {CSSSection} */
this.parent = null;
/** @type {CSSSection} */
this.nextSibling = null;
/** @type {CSSSection} */
this.previousSibling = null;
this._source = source;
this._name = null;
this._content = null;
/**
* Custom data for current nodes, used by other modules for
* caching etc.
* @type {Object}
*/
this._data = {};
if (!rng && source) {
rng = range(0, source);
}
this.range = rng;
this.children = [];
}
CSSSection.prototype = {
addChild: function(section) {
if (!(section instanceof CSSSection)) {
section = new CSSSection(section);
}
var lastChild = utils.last(this.children);
if (lastChild) {
lastChild.nextSibling = section;
section.previousSibling = lastChild;
}
section.parent = this;
this.children.push(section);
return section;
},
/**
* Returns root node
* @return {CSSSection}
*/
root: function() {
var root = this;
do {
if (!root.parent) {
return root;
}
} while(root = root.parent);
return root;
},
/**
* Returns currect CSS source
* @return {String}
*/
source: function() {
return this._source || this.root()._source;
},
/**
* Returns section name
* @return {String}
*/
name: function() {
if (this._name === null) {
var range = this.nameRange();
if (range) {
this._name = range.substring(this.source());
}
}
return this._name;
},
/**
* Returns section name range
* @return {[type]} [description]
*/
nameRange: function() {
if (this.range && '_selectorEnd' in this.range) {
return range.create2(this.range.start, this.range._selectorEnd);
}
},
/**
* Returns deepest child of current section (or section itself)
* which includes given position.
* @param {Number} pos
* @return {CSSSection}
*/
matchDeep: function(pos) {
if (!this.range.inside(pos)) {
return null;
}
for (var i = 0, il = this.children.length, m; i < il; i++) {
m = this.children[i].matchDeep(pos);
if (m) {
return m;
}
};
return this.parent ? this : null;
},
/**
* Returns current and all nested sections ranges
* @return {Array}
*/
allRanges: function() {
var out = [];
if (this.parent) {
// add current range if it is not root node
out.push(this.range);
}
this.children.forEach(function(child) {
out = out.concat(child.allRanges());
});
return out;
},
data: function(key, value) {
if (typeof value !== 'undefined') {
this._data[key] = value;
}
return this._data[key];
},
stringify: function(indent) {
indent = indent || '';
var out = '';
this.children.forEach(function(item) {
out += indent + item.name().replace(/\n/g, '\\n') + '\n';
out += item.stringify(indent + '--');
});
return out;
},
/**
* Returns current section’s actual content,
* e.g. content without nested sections
* @return {String}
*/
content: function() {
if (this._content !== null) {
return this._content;
}
if (!this.range || !('_contentStart' in this.range)) {
return '';
}
var r = range.create2(this.range._contentStart + 1, this.range.end - 1);
var source = this.source();
var start = r.start;
var out = '';
this.children.forEach(function(child) {
out += source.substring(start, child.range.start);
start = child.range.end;
});
out += source.substring(start, r.end);
return this._content = utils.trim(out);
}
};
return {
/**
* Finds all CSS rules‘ ranges in given CSS source
* @param {String} content CSS source
* @return {Array} Array of ranges
*/
findAllRules: function(content) {
content = this.sanitize(content);
var stream = stringStream(content);
var ranges = [], matchedRanges;
var self = this;
var saveRule = function(r) {
var selRange = self.extractSelector(content, r.start);
var rule = range.create2(selRange.start, r.end);
rule._selectorEnd = selRange.end;
rule._contentStart = r.start;
ranges.push(rule);
};
var ch;
while (ch = stream.next()) {
if (isQuote(ch)) {
if (!stream.skipString(ch)) {
break; // unterminated string
}
continue;
}
if (ch == '{') {
matchedRanges = this.matchBracesRanges(content, stream.pos - 1);
matchedRanges.forEach(saveRule);
if (matchedRanges.length) {
stream.pos = utils.last(matchedRanges).end;
continue;
}
}
}
return ranges.sort(function(a, b) {
return a.start - b.start;
});
},
/**
* Matches curly braces content right after given position
* @param {String} content CSS content. Must not contain comments!
* @param {Number} pos Search start position
* @return {Range}
*/
matchBracesRanges: function(content, pos, sanitize) {
if (sanitize) {
content = this.sanitize(content);
}
var stream = stringStream(content);
stream.start = stream.pos = pos;
var stack = [], ranges = [];
var ch;
while (ch = stream.next()) {
if (ch == '{') {
stack.push(stream.pos - 1);
} else if (ch == '}') {
if (!stack.length) {
throw 'Invalid source structure (check for curly braces)';
}
ranges.push(range.create2(stack.pop(), stream.pos));
if (!stack.length) {
return ranges;
}
} else {
stream.skipQuoted();
}
}
return ranges;
},
/**
* Extracts CSS selector from CSS document from
* given position. The selector is located by moving backward
* from given position which means that passed position
* must point to the end of selector
* @param {String} content CSS source
* @param {Number} pos Search position
* @param {Boolean} sanitize Sanitize CSS source before processing.
* Off by default and assumes that CSS must be comment-free already
* (for performance)
* @return {Range}
*/
extractSelector: function(content, pos, sanitize) {
if (sanitize) {
content = this.sanitize(content);
}
var skipString = function() {
var quote = content.charAt(pos);
if (quote == '"' || quote == "'") {
while (--pos >= 0) {
if (content.charAt(pos) == quote && content.charAt(pos - 1) != '\\') {
break;
}
}
return true;
}
return false;
};
// find CSS selector
var ch;
var endPos = pos;
while (--pos >= 0) {
if (skipString()) continue;
ch = content.charAt(pos);
if (ch == ')') {
// looks like it’s a preprocessor thing,
// most likely a mixin arguments list, e.g.
// .mixin (@arg1; @arg2) {...}
while (--pos >= 0) {
if (skipString()) continue;
if (content.charAt(pos) == '(') {
break;
}
}
continue;
}
if (ch == '{' || ch == '}' || ch == ';') {
pos++;
break;
}
}
if (pos < 0) {
pos = 0;
}
var selector = content.substring(pos, endPos);
// trim whitespace from matched selector
var m = selector.replace(reSpace, ' ').match(reSpaceTrim);
if (m) {
pos += m[1].length;
endPos -= m[2].length;
}
return range.create2(pos, endPos);
},
/**
* Search for nearest CSS rule/section that contains
* given position
* @param {String} content CSS content or matched CSS rules (array of ranges)
* @param {Number} pos Search position
* @return {Range}
*/
matchEnclosingRule: function(content, pos) {
if (typeof content === 'string') {
content = this.findAllRules(content);
}
var rules = content.filter(function(r) {
return r.inside(pos);
});
return utils.last(rules);
},
/**
* Locates CSS rule next or before given position
* @param {String} content CSS content
* @param {Number} pos Search start position
* @param {Boolean} isBackward Search backward (find previous rule insteaf of next one)
* @return {Range}
*/
locateRule: function(content, pos, isBackward) {
// possible case: editor reported that current syntax is
// CSS, but it’s actually a HTML document (either `style` tag or attribute)
var offset = 0;
var subrange = this.styleTagRange(content, pos);
if (subrange) {
offset = subrange.start;
pos -= subrange.start;
content = subrange.substring(content);
}
var rules = this.findAllRules(content);
var ctxRule = this.matchEnclosingRule(rules, pos);
if (ctxRule) {
return ctxRule.shift(offset);
}
for (var i = 0, il = rules.length; i < il; i++) {
if (rules[i].start > pos) {
return rules[isBackward && i > 0 ? i - 1 : i].shift(offset);
}
}
},
/**
* Sanitizes given CSS content: replaces content that may
* interfere with parsing (comments, interpolations, etc.)
* with spaces. Sanitized content MUST NOT be used for
* editing or outputting, it just simplifies searching
* @param {String} content CSS content
* @return {String}
*/
sanitize: function(content) {
content = commentsUtils.strip(content);
// remove preprocessor string interpolations like #{var}
var stream = stringStream(content);
var replaceRanges = [];
var ch, ch2;
while ((ch = stream.next())) {
if (isQuote(ch)) {
// skip string
stream.skipString(ch)
continue;
} else if (ch === '#' || ch === '@') {
ch2 = stream.peek();
if (ch2 === '{') { // string interpolation
stream.start = stream.pos - 1;
if (stream.skipTo('}')) {
stream.pos += 1;
} else {
throw 'Invalid string interpolation at ' + stream.start;
}
replaceRanges.push([stream.start, stream.pos]);
}
}
}
return utils.replaceWith(content, replaceRanges, 'a');
},
/**
* Parses and returns all sections in given CSS
* as tree-like structure, e.g. provides nesting
* info
* @param {String} content CSS content
* @return {CSSSection}
*/
sectionTree: function(content) {
var root = new CSSSection(null, content);
var rules = this.findAllRules(content);
// rules are sorted in order they appear in CSS source
// so we can optimize their nesting routine
var insert = function(range, ctx) {
while (ctx && ctx.range) {
if (ctx.range.contains(range)) {
return ctx.addChild(range);
}
ctx = ctx.parent;
}
// if we are here then given range is a top-level section
return root.addChild(range);
};
var ctx = root;
rules.forEach(function(r) {
ctx = insert(r, ctx);
});
return root;
},
/**
* Returns ranges for all nested sections, available in
* given CSS rule
* @param {CSSEditContainer} rule
* @return {Array}
*/
nestedSectionsInRule: function(rule) {
var offset = rule.valueRange(true).start;
var nestedSections = this.findAllRules(rule.valueRange().substring(rule.source));
nestedSections.forEach(function(section) {
section.start += offset;
section.end += offset;
section._selectorEnd += offset;
section._contentStart += offset;
});
return nestedSections;
},
styleTagRange: function(content, pos) {
var tag = htmlMatcher.tag(content, pos);
return tag && tag.open.name.toLowerCase() == 'style'
&& tag.innerRange.cmp(pos, 'lte', 'gte')
&& tag.innerRange;
},
styleAttrRange: function(content, pos) {
var tree = xmlEditTree.parseFromPosition(content, pos, true);
if (tree) {
var attr = tree.itemFromPosition(pos, true);
return attr && attr.name().toLowerCase() == 'style'
&& attr.valueRange(true).cmp(pos, 'lte', 'gte')
&& attr.valueRange(true);
}
},
CSSSection: CSSSection
};
});
},{"../assets/htmlMatcher":26,"../assets/range":30,"../assets/stringStream":32,"../editTree/xml":38,"../parser/css":56,"./comments":72,"./common":73}],75:[function(require,module,exports){
/**
* Utility module used to prepare text for pasting into back-end editor
* @author Sergey Chikuyonok (serge.che@gmail.com) <http://chikuyonok.ru>
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('./common');
var resources = require('../assets/resources');
return {
/**
* Check if cursor is placed inside XHTML tag
* @param {String} html Contents of the document
* @param {Number} caretPos Current caret position inside tag
* @return {Boolean}
*/
isInsideTag: function(html, caretPos) {
var reTag = /^<\/?\w[\w\:\-]*.*?>/;
// search left to find opening brace
var pos = caretPos;
while (pos > -1) {
if (html.charAt(pos) == '<')
break;
pos--;
}
if (pos != -1) {
var m = reTag.exec(html.substring(pos));
if (m && caretPos > pos && caretPos < pos + m[0].length)
return true;
}
return false;
},
/**
* Sanitizes incoming editor data and provides default values for
* output-specific info
* @param {IEmmetEditor} editor
* @param {String} syntax
* @param {String} profile
*/
outputInfo: function(editor, syntax, profile) {
// most of this code makes sense for Java/Rhino environment
// because string that comes from Java are not actually JS string
// but Java String object so the have to be explicitly converted
// to native string
profile = profile || editor.getProfileName();
return {
/** @memberOf outputInfo */
syntax: String(syntax || editor.getSyntax()),
profile: profile || null,
content: String(editor.getContent())
};
},
/**
* Unindent content, thus preparing text for tag wrapping
* @param {IEmmetEditor} editor Editor instance
* @param {String} text
* @return {String}
*/
unindent: function(editor, text) {
return utils.unindentString(text, this.getCurrentLinePadding(editor));
},
/**
* Returns padding of current editor's line
* @param {IEmmetEditor} Editor instance
* @return {String}
*/
getCurrentLinePadding: function(editor) {
return utils.getLinePadding(editor.getCurrentLine());
},
/**
* Normalizes content according to given preferences, e.g.
* replaces newlines and indentation with ones defined in
* `options`. If options are not provided or incomplete,
* values will be taken from current user environment
* @param {String} text
* @param {Object} options
* @return {String}
*/
normalize: function(text, options) {
options = utils.extend({
newline: resources.getNewline(),
indentation: resources.getVariable('indentation')
}, options);
var indent = function(tabs) {
return utils.repeatString(options.indentation, tabs.length);
};
var lines = utils.splitByLines(text);
// normailze indentation if it’s not tabs
if (options.indentation !== '\t') {
lines = lines.map(function(line) {
return line.replace(/^\s+/, function(space) {
return space.replace(/\t/g, indent);
});
});
}
// normalize newlines
return lines.join(options.newline);
}
};
});
},{"../assets/resources":31,"./common":73}],76:[function(require,module,exports){
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
/*
Source: https://github.com/silentmatt/js-expression-eval
Based on ndef.parser, by Raphael Graf(r@undefined.ch)
http://www.undefined.ch/mparser/index.html
Ported to JavaScript and modified by Matthew Crumley (email@matthewcrumley.com, http://silentmatt.com/)
You are free to use and modify this code in anyway you find useful. Please leave this comment in the code
to acknowledge its original source. If you feel like it, I enjoy hearing about projects that use my code,
but don't feel like you have to let me know or ask permission.
*/
function object(o) {
function F() {}
F.prototype = o;
return new F();
}
var TNUMBER = 0;
var TOP1 = 1;
var TOP2 = 2;
var TVAR = 3;
var TFUNCALL = 4;
function Token(type_, index_, prio_, number_) {
this.type_ = type_;
this.index_ = index_ || 0;
this.prio_ = prio_ || 0;
this.number_ = (number_ !== undefined && number_ !== null) ? number_ : 0;
this.toString = function () {
switch (this.type_) {
case TNUMBER:
return this.number_;
case TOP1:
case TOP2:
case TVAR:
return this.index_;
case TFUNCALL:
return "CALL";
default:
return "Invalid Token";
}
};
}
function Expression(tokens, ops1, ops2, functions) {
this.tokens = tokens;
this.ops1 = ops1;
this.ops2 = ops2;
this.functions = functions;
}
// Based on http://www.json.org/json2.js
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,
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
"'" : "\\'",
'\\': '\\\\'
};
function escapeValue(v) {
if (typeof v === "string") {
escapable.lastIndex = 0;
return escapable.test(v) ?
"'" + v.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string' ? c :
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + "'" :
"'" + v + "'";
}
return v;
}
Expression.prototype = {
simplify: function (values) {
values = values || {};
var nstack = [];
var newexpression = [];
var n1;
var n2;
var f;
var L = this.tokens.length;
var item;
var i = 0;
for (i = 0; i < L; i++) {
item = this.tokens[i];
var type_ = item.type_;
if (type_ === TNUMBER) {
nstack.push(item);
}
else if (type_ === TVAR && (item.index_ in values)) {
item = new Token(TNUMBER, 0, 0, values[item.index_]);
nstack.push(item);
}
else if (type_ === TOP2 && nstack.length > 1) {
n2 = nstack.pop();
n1 = nstack.pop();
f = this.ops2[item.index_];
item = new Token(TNUMBER, 0, 0, f(n1.number_, n2.number_));
nstack.push(item);
}
else if (type_ === TOP1 && nstack.length > 0) {
n1 = nstack.pop();
f = this.ops1[item.index_];
item = new Token(TNUMBER, 0, 0, f(n1.number_));
nstack.push(item);
}
else {
while (nstack.length > 0) {
newexpression.push(nstack.shift());
}
newexpression.push(item);
}
}
while (nstack.length > 0) {
newexpression.push(nstack.shift());
}
return new Expression(newexpression, object(this.ops1), object(this.ops2), object(this.functions));
},
substitute: function (variable, expr) {
if (!(expr instanceof Expression)) {
expr = new Parser().parse(String(expr));
}
var newexpression = [];
var L = this.tokens.length;
var item;
var i = 0;
for (i = 0; i < L; i++) {
item = this.tokens[i];
var type_ = item.type_;
if (type_ === TVAR && item.index_ === variable) {
for (var j = 0; j < expr.tokens.length; j++) {
var expritem = expr.tokens[j];
var replitem = new Token(expritem.type_, expritem.index_, expritem.prio_, expritem.number_);
newexpression.push(replitem);
}
}
else {
newexpression.push(item);
}
}
var ret = new Expression(newexpression, object(this.ops1), object(this.ops2), object(this.functions));
return ret;
},
evaluate: function (values) {
values = values || {};
var nstack = [];
var n1;
var n2;
var f;
var L = this.tokens.length;
var item;
var i = 0;
for (i = 0; i < L; i++) {
item = this.tokens[i];
var type_ = item.type_;
if (type_ === TNUMBER) {
nstack.push(item.number_);
}
else if (type_ === TOP2) {
n2 = nstack.pop();
n1 = nstack.pop();
f = this.ops2[item.index_];
nstack.push(f(n1, n2));
}
else if (type_ === TVAR) {
if (item.index_ in values) {
nstack.push(values[item.index_]);
}
else if (item.index_ in this.functions) {
nstack.push(this.functions[item.index_]);
}
else {
throw new Error("undefined variable: " + item.index_);
}
}
else if (type_ === TOP1) {
n1 = nstack.pop();
f = this.ops1[item.index_];
nstack.push(f(n1));
}
else if (type_ === TFUNCALL) {
n1 = nstack.pop();
f = nstack.pop();
if (f.apply && f.call) {
if (Object.prototype.toString.call(n1) == "[object Array]") {
nstack.push(f.apply(undefined, n1));
}
else {
nstack.push(f.call(undefined, n1));
}
}
else {
throw new Error(f + " is not a function");
}
}
else {
throw new Error("invalid Expression");
}
}
if (nstack.length > 1) {
throw new Error("invalid Expression (parity)");
}
return nstack[0];
},
toString: function (toJS) {
var nstack = [];
var n1;
var n2;
var f;
var L = this.tokens.length;
var item;
var i = 0;
for (i = 0; i < L; i++) {
item = this.tokens[i];
var type_ = item.type_;
if (type_ === TNUMBER) {
nstack.push(escapeValue(item.number_));
}
else if (type_ === TOP2) {
n2 = nstack.pop();
n1 = nstack.pop();
f = item.index_;
if (toJS && f == "^") {
nstack.push("Math.pow(" + n1 + "," + n2 + ")");
}
else {
nstack.push("(" + n1 + f + n2 + ")");
}
}
else if (type_ === TVAR) {
nstack.push(item.index_);
}
else if (type_ === TOP1) {
n1 = nstack.pop();
f = item.index_;
if (f === "-") {
nstack.push("(" + f + n1 + ")");
}
else {
nstack.push(f + "(" + n1 + ")");
}
}
else if (type_ === TFUNCALL) {
n1 = nstack.pop();
f = nstack.pop();
nstack.push(f + "(" + n1 + ")");
}
else {
throw new Error("invalid Expression");
}
}
if (nstack.length > 1) {
throw new Error("invalid Expression (parity)");
}
return nstack[0];
},
variables: function () {
var L = this.tokens.length;
var vars = [];
for (var i = 0; i < L; i++) {
var item = this.tokens[i];
if (item.type_ === TVAR && (vars.indexOf(item.index_) == -1)) {
vars.push(item.index_);
}
}
return vars;
},
toJSFunction: function (param, variables) {
var f = new Function(param, "with(Parser.values) { return " + this.simplify(variables).toString(true) + "; }");
return f;
}
};
function add(a, b) {
return Number(a) + Number(b);
}
function sub(a, b) {
return a - b;
}
function mul(a, b) {
return a * b;
}
function div(a, b) {
return a / b;
}
function mod(a, b) {
return a % b;
}
function concat(a, b) {
return "" + a + b;
}
function neg(a) {
return -a;
}
function random(a) {
return Math.random() * (a || 1);
}
function fac(a) { //a!
a = Math.floor(a);
var b = a;
while (a > 1) {
b = b * (--a);
}
return b;
}
// TODO: use hypot that doesn't overflow
function pyt(a, b) {
return Math.sqrt(a * a + b * b);
}
function append(a, b) {
if (Object.prototype.toString.call(a) != "[object Array]") {
return [a, b];
}
a = a.slice();
a.push(b);
return a;
}
function Parser() {
this.success = false;
this.errormsg = "";
this.expression = "";
this.pos = 0;
this.tokennumber = 0;
this.tokenprio = 0;
this.tokenindex = 0;
this.tmpprio = 0;
this.ops1 = {
"sin": Math.sin,
"cos": Math.cos,
"tan": Math.tan,
"asin": Math.asin,
"acos": Math.acos,
"atan": Math.atan,
"sqrt": Math.sqrt,
"log": Math.log,
"abs": Math.abs,
"ceil": Math.ceil,
"floor": Math.floor,
"round": Math.round,
"-": neg,
"exp": Math.exp
};
this.ops2 = {
"+": add,
"-": sub,
"*": mul,
"/": div,
"%": mod,
"^": Math.pow,
",": append,
"||": concat
};
this.functions = {
"random": random,
"fac": fac,
"min": Math.min,
"max": Math.max,
"pyt": pyt,
"pow": Math.pow,
"atan2": Math.atan2
};
this.consts = {
"E": Math.E,
"PI": Math.PI
};
}
Parser.parse = function (expr) {
return new Parser().parse(expr);
};
Parser.evaluate = function (expr, variables) {
return Parser.parse(expr).evaluate(variables);
};
Parser.Expression = Expression;
Parser.values = {
sin: Math.sin,
cos: Math.cos,
tan: Math.tan,
asin: Math.asin,
acos: Math.acos,
atan: Math.atan,
sqrt: Math.sqrt,
log: Math.log,
abs: Math.abs,
ceil: Math.ceil,
floor: Math.floor,
round: Math.round,
random: random,
fac: fac,
exp: Math.exp,
min: Math.min,
max: Math.max,
pyt: pyt,
pow: Math.pow,
atan2: Math.atan2,
E: Math.E,
PI: Math.PI
};
var PRIMARY = 1 << 0;
var OPERATOR = 1 << 1;
var FUNCTION = 1 << 2;
var LPAREN = 1 << 3;
var RPAREN = 1 << 4;
var COMMA = 1 << 5;
var SIGN = 1 << 6;
var CALL = 1 << 7;
var NULLARY_CALL = 1 << 8;
Parser.prototype = {
parse: function (expr) {
this.errormsg = "";
this.success = true;
var operstack = [];
var tokenstack = [];
this.tmpprio = 0;
var expected = (PRIMARY | LPAREN | FUNCTION | SIGN);
var noperators = 0;
this.expression = expr;
this.pos = 0;
while (this.pos < this.expression.length) {
if (this.isOperator()) {
if (this.isSign() && (expected & SIGN)) {
if (this.isNegativeSign()) {
this.tokenprio = 2;
this.tokenindex = "-";
noperators++;
this.addfunc(tokenstack, operstack, TOP1);
}
expected = (PRIMARY | LPAREN | FUNCTION | SIGN);
}
else if (this.isComment()) {
}
else {
if ((expected & OPERATOR) === 0) {
this.error_parsing(this.pos, "unexpected operator");
}
noperators += 2;
this.addfunc(tokenstack, operstack, TOP2);
expected = (PRIMARY | LPAREN | FUNCTION | SIGN);
}
}
else if (this.isNumber()) {
if ((expected & PRIMARY) === 0) {
this.error_parsing(this.pos, "unexpected number");
}
var token = new Token(TNUMBER, 0, 0, this.tokennumber);
tokenstack.push(token);
expected = (OPERATOR | RPAREN | COMMA);
}
else if (this.isString()) {
if ((expected & PRIMARY) === 0) {
this.error_parsing(this.pos, "unexpected string");
}
var token = new Token(TNUMBER, 0, 0, this.tokennumber);
tokenstack.push(token);
expected = (OPERATOR | RPAREN | COMMA);
}
else if (this.isLeftParenth()) {
if ((expected & LPAREN) === 0) {
this.error_parsing(this.pos, "unexpected \"(\"");
}
if (expected & CALL) {
noperators += 2;
this.tokenprio = -2;
this.tokenindex = -1;
this.addfunc(tokenstack, operstack, TFUNCALL);
}
expected = (PRIMARY | LPAREN | FUNCTION | SIGN | NULLARY_CALL);
}
else if (this.isRightParenth()) {
if (expected & NULLARY_CALL) {
var token = new Token(TNUMBER, 0, 0, []);
tokenstack.push(token);
}
else if ((expected & RPAREN) === 0) {
this.error_parsing(this.pos, "unexpected \")\"");
}
expected = (OPERATOR | RPAREN | COMMA | LPAREN | CALL);
}
else if (this.isComma()) {
if ((expected & COMMA) === 0) {
this.error_parsing(this.pos, "unexpected \",\"");
}
this.addfunc(tokenstack, operstack, TOP2);
noperators += 2;
expected = (PRIMARY | LPAREN | FUNCTION | SIGN);
}
else if (this.isConst()) {
if ((expected & PRIMARY) === 0) {
this.error_parsing(this.pos, "unexpected constant");
}
var consttoken = new Token(TNUMBER, 0, 0, this.tokennumber);
tokenstack.push(consttoken);
expected = (OPERATOR | RPAREN | COMMA);
}
else if (this.isOp2()) {
if ((expected & FUNCTION) === 0) {
this.error_parsing(this.pos, "unexpected function");
}
this.addfunc(tokenstack, operstack, TOP2);
noperators += 2;
expected = (LPAREN);
}
else if (this.isOp1()) {
if ((expected & FUNCTION) === 0) {
this.error_parsing(this.pos, "unexpected function");
}
this.addfunc(tokenstack, operstack, TOP1);
noperators++;
expected = (LPAREN);
}
else if (this.isVar()) {
if ((expected & PRIMARY) === 0) {
this.error_parsing(this.pos, "unexpected variable");
}
var vartoken = new Token(TVAR, this.tokenindex, 0, 0);
tokenstack.push(vartoken);
expected = (OPERATOR | RPAREN | COMMA | LPAREN | CALL);
}
else if (this.isWhite()) {
}
else {
if (this.errormsg === "") {
this.error_parsing(this.pos, "unknown character");
}
else {
this.error_parsing(this.pos, this.errormsg);
}
}
}
if (this.tmpprio < 0 || this.tmpprio >= 10) {
this.error_parsing(this.pos, "unmatched \"()\"");
}
while (operstack.length > 0) {
var tmp = operstack.pop();
tokenstack.push(tmp);
}
if (noperators + 1 !== tokenstack.length) {
//print(noperators + 1);
//print(tokenstack);
this.error_parsing(this.pos, "parity");
}
return new Expression(tokenstack, object(this.ops1), object(this.ops2), object(this.functions));
},
evaluate: function (expr, variables) {
return this.parse(expr).evaluate(variables);
},
error_parsing: function (column, msg) {
this.success = false;
this.errormsg = "parse error [column " + (column) + "]: " + msg;
throw new Error(this.errormsg);
},
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
addfunc: function (tokenstack, operstack, type_) {
var operator = new Token(type_, this.tokenindex, this.tokenprio + this.tmpprio, 0);
while (operstack.length > 0) {
if (operator.prio_ <= operstack[operstack.length - 1].prio_) {
tokenstack.push(operstack.pop());
}
else {
break;
}
}
operstack.push(operator);
},
isNumber: function () {
var r = false;
var str = "";
while (this.pos < this.expression.length) {
var code = this.expression.charCodeAt(this.pos);
if ((code >= 48 && code <= 57) || code === 46) {
str += this.expression.charAt(this.pos);
this.pos++;
this.tokennumber = parseFloat(str);
r = true;
}
else {
break;
}
}
return r;
},
// Ported from the yajjl JSON parser at http://code.google.com/p/yajjl/
unescape: function(v, pos) {
var buffer = [];
var escaping = false;
for (var i = 0; i < v.length; i++) {
var c = v.charAt(i);
if (escaping) {
switch (c) {
case "'":
buffer.push("'");
break;
case '\\':
buffer.push('\\');
break;
case '/':
buffer.push('/');
break;
case 'b':
buffer.push('\b');
break;
case 'f':
buffer.push('\f');
break;
case 'n':
buffer.push('\n');
break;
case 'r':
buffer.push('\r');
break;
case 't':
buffer.push('\t');
break;
case 'u':
// interpret the following 4 characters as the hex of the unicode code point
var codePoint = parseInt(v.substring(i + 1, i + 5), 16);
buffer.push(String.fromCharCode(codePoint));
i += 4;
break;
default:
throw this.error_parsing(pos + i, "Illegal escape sequence: '\\" + c + "'");
}
escaping = false;
} else {
if (c == '\\') {
escaping = true;
} else {
buffer.push(c);
}
}
}
return buffer.join('');
},
isString: function () {
var r = false;
var str = "";
var startpos = this.pos;
if (this.pos < this.expression.length && this.expression.charAt(this.pos) == "'") {
this.pos++;
while (this.pos < this.expression.length) {
var code = this.expression.charAt(this.pos);
if (code != "'" || str.slice(-1) == "\\") {
str += this.expression.charAt(this.pos);
this.pos++;
}
else {
this.pos++;
this.tokennumber = this.unescape(str, startpos);
r = true;
break;
}
}
}
return r;
},
isConst: function () {
var str;
for (var i in this.consts) {
if (true) {
var L = i.length;
str = this.expression.substr(this.pos, L);
if (i === str) {
this.tokennumber = this.consts[i];
this.pos += L;
return true;
}
}
}
return false;
},
isOperator: function () {
var code = this.expression.charCodeAt(this.pos);
if (code === 43) { // +
this.tokenprio = 0;
this.tokenindex = "+";
}
else if (code === 45) { // -
this.tokenprio = 0;
this.tokenindex = "-";
}
else if (code === 124) { // |
if (this.expression.charCodeAt(this.pos + 1) === 124) {
this.pos++;
this.tokenprio = 0;
this.tokenindex = "||";
}
else {
return false;
}
}
else if (code === 42) { // *
this.tokenprio = 1;
this.tokenindex = "*";
}
else if (code === 47) { // /
this.tokenprio = 2;
this.tokenindex = "/";
}
else if (code === 37) { // %
this.tokenprio = 2;
this.tokenindex = "%";
}
else if (code === 94) { // ^
this.tokenprio = 3;
this.tokenindex = "^";
}
else {
return false;
}
this.pos++;
return true;
},
isSign: function () {
var code = this.expression.charCodeAt(this.pos - 1);
if (code === 45 || code === 43) { // -
return true;
}
return false;
},
isPositiveSign: function () {
var code = this.expression.charCodeAt(this.pos - 1);
if (code === 43) { // -
return true;
}
return false;
},
isNegativeSign: function () {
var code = this.expression.charCodeAt(this.pos - 1);
if (code === 45) { // -
return true;
}
return false;
},
isLeftParenth: function () {
var code = this.expression.charCodeAt(this.pos);
if (code === 40) { // (
this.pos++;
this.tmpprio += 10;
return true;
}
return false;
},
isRightParenth: function () {
var code = this.expression.charCodeAt(this.pos);
if (code === 41) { // )
this.pos++;
this.tmpprio -= 10;
return true;
}
return false;
},
isComma: function () {
var code = this.expression.charCodeAt(this.pos);
if (code === 44) { // ,
this.pos++;
this.tokenprio = -1;
this.tokenindex = ",";
return true;
}
return false;
},
isWhite: function () {
var code = this.expression.charCodeAt(this.pos);
if (code === 32 || code === 9 || code === 10 || code === 13) {
this.pos++;
return true;
}
return false;
},
isOp1: function () {
var str = "";
for (var i = this.pos; i < this.expression.length; i++) {
var c = this.expression.charAt(i);
if (c.toUpperCase() === c.toLowerCase()) {
if (i === this.pos || (c != '_' && (c < '0' || c > '9'))) {
break;
}
}
str += c;
}
if (str.length > 0 && (str in this.ops1)) {
this.tokenindex = str;
this.tokenprio = 5;
this.pos += str.length;
return true;
}
return false;
},
isOp2: function () {
var str = "";
for (var i = this.pos; i < this.expression.length; i++) {
var c = this.expression.charAt(i);
if (c.toUpperCase() === c.toLowerCase()) {
if (i === this.pos || (c != '_' && (c < '0' || c > '9'))) {
break;
}
}
str += c;
}
if (str.length > 0 && (str in this.ops2)) {
this.tokenindex = str;
this.tokenprio = 5;
this.pos += str.length;
return true;
}
return false;
},
isVar: function () {
var str = "";
for (var i = this.pos; i < this.expression.length; i++) {
var c = this.expression.charAt(i);
if (c.toUpperCase() === c.toLowerCase()) {
if (i === this.pos || (c != '_' && (c < '0' || c > '9'))) {
break;
}
}
str += c;
}
if (str.length > 0) {
this.tokenindex = str;
this.tokenprio = 4;
this.pos += str.length;
return true;
}
return false;
},
isComment: function () {
var code = this.expression.charCodeAt(this.pos - 1);
if (code === 47 && this.expression.charCodeAt(this.pos) === 42) {
this.pos = this.expression.indexOf("*/", this.pos) + 2;
if (this.pos === 1) {
this.pos = this.expression.length;
}
return true;
}
return false;
}
};
return Parser;
});
},{}],77:[function(require,module,exports){
/**
* A very simple, ERB-style templating. Basically, just as string substitution.
* The reason to not use default Lo-dash’es `_.template()` implementation
* is because it fails to run in CSP-enabled environments (Chrome extension, Atom)
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var stringStream = require('../assets/stringStream');
var utils = require('./common');
function parseArgs(str) {
var args = [];
var stream = stringStream(str);
while (!stream.eol()) {
if (stream.peek() == ',') {
args.push(utils.trim(stream.current()));
stream.next();
stream.start = stream.pos;
}
stream.next();
}
args.push(utils.trim(stream.current()));
return args.filter(function(a) {
return !!a;
});
}
function parseFunctionCall(str) {
var fnName = null, args;
var stream = stringStream(str);
while (!stream.eol()) {
if (stream.peek() == '(') {
fnName = stream.current();
stream.start = stream.pos;
stream.skipToPair('(', ')', true);
args = stream.current();
args = parseArgs(args.substring(1, args.length - 1));
break;
}
stream.next();
}
return fnName && {
name: fnName,
args: args
};
}
function evalArg(arg, context) {
if (/^['"]/.test(arg)) {
// plain string
return arg.replace(/^(['"])(.+?)\1$/, '$2');
}
if (!isNaN(+arg)) {
// a number
return +arg;
}
// otherwise, treat argument as a property name
if (arg) {
var parts = arg.split('.');
var prop = context;
while (parts.length) {
prop = prop[parts.shift()];
}
return prop;
}
}
function process(template, context) {
return template.replace(/<%[=\-](.+?)%>/g, function(str, match) {
match = utils.trim(match);
var fn = parseFunctionCall(match);
if (fn) {
var fnArgs = fn.args.map(function(arg) {
return evalArg(arg, context);
});
return context[fn.name].apply(context, fnArgs);
}
return evalArg(match, context);
});
}
return function(template, context) {
return context ? process(template, context) : function(context) {
return process(template, context);
};
};
});
},{"../assets/stringStream":32,"./common":73}],78:[function(require,module,exports){
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var utils = require('../utils/common');
/**
* Shared empty constructor function to aid in prototype-chain creation.
*/
var ctor = function(){};
/**
* Helper function to correctly set up the prototype chain, for subclasses.
* Similar to `goog.inherits`, but uses a hash of prototype properties and
* class properties to be extended.
* Took it from Backbone.
* @param {Object} parent
* @param {Object} protoProps
* @param {Object} staticProps
* @returns {Object}
*/
function inherits(parent, protoProps, staticProps) {
var child;
// The constructor function for the new subclass is either defined by
// you (the "constructor" property in your `extend` definition), or
// defaulted by us to simply call the parent's constructor.
if (protoProps && protoProps.hasOwnProperty('constructor')) {
child = protoProps.constructor;
} else {
child = function() {
parent.apply(this, arguments);
};
}
// Inherit class (static) properties from parent.
utils.extend(child, parent);
// Set the prototype chain to inherit from `parent`, without calling
// `parent`'s constructor function.
ctor.prototype = parent.prototype;
child.prototype = new ctor();
// Add prototype properties (instance properties) to the subclass,
// if supplied.
if (protoProps)
utils.extend(child.prototype, protoProps);
// Add static properties to the constructor function, if supplied.
if (staticProps)
utils.extend(child, staticProps);
// Correctly set child's `prototype.constructor`.
child.prototype.constructor = child;
// Set a convenience property in case the parent's prototype is needed
// later.
child.__super__ = parent.prototype;
return child;
}
return {
/**
* The self-propagating extend function for classes.
* Took it from Backbone
* @param {Object} protoProps
* @param {Object} classProps
* @returns {Object}
*/
extend: function(protoProps, classProps) {
var child = inherits(this, protoProps, classProps);
child.extend = this.extend;
// a hack required to WSH inherit `toString` method
if (protoProps.hasOwnProperty('toString'))
child.prototype.toString = protoProps.toString;
return child;
}
};
});
},{"../utils/common":73}],79:[function(require,module,exports){
/*!
* string_score.js: String Scoring Algorithm 0.1.10
*
* http://joshaven.com/string_score
* https://github.com/joshaven/string_score
*
* Copyright (C) 2009-2011 Joshaven Potter <yourtech@gmail.com>
* Special thanks to all of the contributors listed here https://github.com/joshaven/string_score
* MIT license: http://www.opensource.org/licenses/mit-license.php
*
* Date: Tue Mar 1 2011
*/
/**
* Scores a string against another string.
* 'Hello World'.score('he'); //=> 0.5931818181818181
* 'Hello World'.score('Hello'); //=> 0.7318181818181818
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
return {
score: function(string, abbreviation, fuzziness) {
// If the string is equal to the abbreviation, perfect match.
if (string == abbreviation) {return 1;}
//if it's not a perfect match and is empty return 0
if(abbreviation == "") {return 0;}
var total_character_score = 0,
abbreviation_length = abbreviation.length,
string_length = string.length,
start_of_string_bonus,
abbreviation_score,
fuzzies=1,
final_score;
// Walk through abbreviation and add up scores.
for (var i = 0,
character_score/* = 0*/,
index_in_string/* = 0*/,
c/* = ''*/,
index_c_lowercase/* = 0*/,
index_c_uppercase/* = 0*/,
min_index/* = 0*/;
i < abbreviation_length;
++i) {
// Find the first case-insensitive match of a character.
c = abbreviation.charAt(i);
index_c_lowercase = string.indexOf(c.toLowerCase());
index_c_uppercase = string.indexOf(c.toUpperCase());
min_index = Math.min(index_c_lowercase, index_c_uppercase);
index_in_string = (min_index > -1) ? min_index : Math.max(index_c_lowercase, index_c_uppercase);
if (index_in_string === -1) {
if (fuzziness) {
fuzzies += 1-fuzziness;
continue;
} else {
return 0;
}
} else {
character_score = 0.1;
}
// Set base score for matching 'c'.
// Same case bonus.
if (string[index_in_string] === c) {
character_score += 0.1;
}
// Consecutive letter & start-of-string Bonus
if (index_in_string === 0) {
// Increase the score when matching first character of the remainder of the string
character_score += 0.6;
if (i === 0) {
// If match is the first character of the string
// & the first character of abbreviation, add a
// start-of-string match bonus.
start_of_string_bonus = 1; //true;
}
}
else {
// Acronym Bonus
// Weighing Logic: Typing the first character of an acronym is as if you
// preceded it with two perfect character matches.
if (string.charAt(index_in_string - 1) === ' ') {
character_score += 0.8; // * Math.min(index_in_string, 5); // Cap bonus at 0.4 * 5
}
}
// Left trim the already matched part of the string
// (forces sequential matching).
string = string.substring(index_in_string + 1, string_length);
total_character_score += character_score;
} // end of for loop
// Uncomment to weigh smaller words higher.
// return total_character_score / string_length;
abbreviation_score = total_character_score / abbreviation_length;
//percentage_of_matched_string = abbreviation_length / string_length;
//word_score = abbreviation_score * percentage_of_matched_string;
// Reduce penalty for longer strings.
//final_score = (word_score + abbreviation_score) / 2;
final_score = ((abbreviation_score * (abbreviation_length / string_length)) + abbreviation_score) / 2;
final_score = final_score / fuzzies;
if (start_of_string_bonus && (final_score + 0.15 < 1)) {
final_score += 0.15;
}
return final_score;
}
};
});
},{}],80:[function(require,module,exports){
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
/**
* Setup Emmet on given CodeMirror editor instance
* @param {CodeMirror} cm
* @param {Object} keymap
*/
module.exports = main;
/**
* Emmet plugin for CodeMirror
*/
var EmmetEditor = _interopRequire(require("./editor"));
var emmet = _interopRequire(require("./emmet"));
var defaultKeymap = {
"Cmd-E": "emmet.expand_abbreviation",
Tab: "emmet.expand_abbreviation_with_tab",
"Cmd-D": "emmet.balance_outward",
"Shift-Cmd-D": "emmet.balance_inward",
"Cmd-M": "emmet.matching_pair",
"Shift-Cmd-A": "emmet.wrap_with_abbreviation",
"Ctrl-Alt-Right": "emmet.next_edit_point",
"Ctrl-Alt-Left": "emmet.prev_edit_point",
"Cmd-L": "emmet.select_line",
"Cmd-Shift-M": "emmet.merge_lines",
"Cmd-/": "emmet.toggle_comment",
"Cmd-J": "emmet.split_join_tag",
"Cmd-K": "emmet.remove_tag",
"Shift-Cmd-Y": "emmet.evaluate_math_expression",
"Ctrl-Up": "emmet.increment_number_by_1",
"Ctrl-Down": "emmet.decrement_number_by_1",
"Ctrl-Alt-Up": "emmet.increment_number_by_01",
"Ctrl-Alt-Down": "emmet.decrement_number_by_01",
"Shift-Ctrl-Up": "emmet.increment_number_by_10",
"Shift-Ctrl-Down": "emmet.decrement_number_by_10",
"Shift-Cmd-.": "emmet.select_next_item",
"Shift-Cmd-,": "emmet.select_previous_item",
"Cmd-B": "emmet.reflect_css_value",
Enter: "emmet.insert_formatted_line_break_only"
};
// actions that should be performed in single selection mode
var singleSelectionActions = ["prev_edit_point", "next_edit_point", "merge_lines", "reflect_css_value", "select_next_item", "select_previous_item", "wrap_with_abbreviation", "update_tag", "insert_formatted_line_break_only"];
function main(cm) {
var keymap = arguments[1] === undefined ? defaultKeymap : arguments[1];
keymap = systemKeymap(keymap);
cm.__emmetKeymap = keymap;
cm.addKeyMap(keymap);
return cm;
}
main.dispose = function (cm) {
if (cm.__emmetKeymap) {
cm.removeKeyMap(cm.__emmetKeymap);
delete cm.__emmetKeymap;
}
};
main.defaultKeymap = defaultKeymap;
main.systemKeymap = systemKeymap;
main.emmet = emmet;
main.EmmetEditor = EmmetEditor;
main.setup = function (CodeMirror) {
// setup default Emmet actions
emmet.actions.getList().forEach(function (obj) {
var action = obj.name;
var command = "emmet." + action;
if (!CodeMirror.commands[command]) {
CodeMirror.commands[command] = ~singleSelectionActions.indexOf(action) ? actionDecorator(action) : multiSelectionActionDecorator(action);
}
});
// add “profile” property to CodeMirror defaults so in won’t be lost
// then CM instance is instantiated with “profile” property
if (CodeMirror.defineOption) {
CodeMirror.defineOption("profile", "html");
} else {
CodeMirror.defaults.profile = "html";
}
};
if (typeof CodeMirror !== "undefined") {
main.setup(CodeMirror);
}
function noop() {
if (CodeMirror.version >= "3.1") {
return CodeMirror.Pass;
}
throw CodeMirror.Pass;
}
/**
* Emmet action decorator: creates a command function
* for CodeMirror and executes Emmet action as single
* undo command
* @param {String} name Action name
* @return {Function}
*/
function actionDecorator(name) {
return function (cm) {
var result;
cm.operation(function () {
return result = runAction(name, new EmmetEditor(cm));
});
return result;
};
}
/**
* Same as `actionDecorator()` but executes action
* with multiple selections
* @param {String} name Action name
* @return {Function}
*/
function multiSelectionActionDecorator(name) {
return function (cm) {
var editor = new EmmetEditor(cm);
var selections = editor.selectionList();
var result = null;
cm.operation(function () {
for (var i = 0, il = selections.length; i < il; i++) {
editor.selectionIndex = i;
result = runAction(name, editor);
if (result === CodeMirror.Pass) {
break;
}
}
});
return result;
};
}
/**
* Runs Emmet action
* @param {String} name Action name
* @param {EmmetEditor} editor EmmetEditor instance
* @return {Boolean} Returns `true` if action is performed
* successfully
*/
function runAction(name, editor) {
if (name == "expand_abbreviation_with_tab" && (editor.context.somethingSelected() || !editor.isValidSyntax())) {
// pass through Tab key handler if there's a selection
return noop();
}
var result = false;
try {
result = emmet.run(name, editor);
if (!result && name == "insert_formatted_line_break_only") {
return noop();
}
} catch (e) {
console.error(e);
}
return result;
}
function systemKeymap(keymap) {
var mac = /Mac/.test(navigator.platform);
var out = {};
Object.keys(keymap).forEach(function (key) {
return out[!mac ? key.replace("Cmd", "Ctrl") : key] = keymap[key];
});
return out;
}
},{"./editor":1,"./emmet":2}]},{},[80])(80)
});
|
src/components/Charts/StackBar/index.js
|
ascrutae/sky-walking-ui
|
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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, { Component } from 'react';
import { Chart, Axis, Tooltip, Geom } from 'bizcharts';
import Debounce from 'lodash-decorators/debounce';
import Bind from 'lodash-decorators/bind';
import autoHeight from '../autoHeight';
import styles from '../index.less';
@autoHeight()
class Area extends Component {
static defaultProps = {
limitColor: 'rgb(255, 181, 102)',
color: 'rgb(102, 181, 255)',
};
state = {
autoHideXLabels: false,
};
componentDidMount() {
window.addEventListener('resize', this.resize);
this.resize();
}
componentWillUnmount() {
window.removeEventListener('resize', this.resize);
}
@Bind()
@Debounce(200)
resize() {
if (!this.node) {
return;
}
const canvasWidth = this.node.parentNode.clientWidth;
const { data = [], autoLabel = true } = this.props;
if (!autoLabel) {
return;
}
const minWidth = data.length * 30;
const { autoHideXLabels } = this.state;
if (canvasWidth <= minWidth) {
if (!autoHideXLabels) {
this.setState({
autoHideXLabels: true,
});
}
} else if (autoHideXLabels) {
this.setState({
autoHideXLabels: false,
});
}
}
handleRoot = (n) => {
this.root = n;
};
handleRef = (n) => {
this.node = n;
};
render() {
const {
height,
title,
forceFit = true,
data,
color,
limitColor,
} = this.props;
if (!data || data.length < 1) {
return (<span style={{ display: 'none' }} />);
}
const { autoHideXLabels } = this.state;
const scale = {
x: {
type: 'cat',
tickCount: 5,
},
y: {
min: 0,
},
};
return (
<div className={styles.chart} style={{ height }} ref={this.handleRoot}>
<div ref={this.handleRef}>
{title && <h4 style={{ marginBottom: 20 }}>{title}</h4>}
<Chart
scale={scale}
height={title ? height - 41 : height}
forceFit={forceFit}
data={data}
padding="auto"
>
<Axis
name="x"
title={false}
label={autoHideXLabels ? false : {}}
tickLine={autoHideXLabels ? false : {}}
/>
<Axis name="y" min={0} />
<Tooltip />
<Geom type="intervalStack" position="x*y" color={['type', [color, limitColor]]} />
</Chart>
</div>
</div>
);
}
}
export default Area;
|
app/javascript/flavours/glitch/features/list_editor/containers/search_container.js
|
im-in-space/mastodon
|
import React from 'react';
import { connect } from 'react-redux';
import { injectIntl } from 'react-intl';
import { fetchListSuggestions, clearListSuggestions, changeListSuggestions } from '../../../actions/lists';
import Search from '../components/search';
const mapStateToProps = state => ({
value: state.getIn(['listEditor', 'suggestions', 'value']),
});
const mapDispatchToProps = dispatch => ({
onSubmit: value => dispatch(fetchListSuggestions(value)),
onClear: () => dispatch(clearListSuggestions()),
onChange: value => dispatch(changeListSuggestions(value)),
});
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(Search));
|
src/svg-icons/image/crop-3-2.js
|
barakmitz/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageCrop32 = (props) => (
<SvgIcon {...props}>
<path d="M19 4H5c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H5V6h14v12z"/>
</SvgIcon>
);
ImageCrop32 = pure(ImageCrop32);
ImageCrop32.displayName = 'ImageCrop32';
ImageCrop32.muiName = 'SvgIcon';
export default ImageCrop32;
|
src/Table/TableSortLabel.js
|
AndriusBil/material-ui
|
// @flow
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import ButtonBase from '../ButtonBase';
import ArrowDownwardIcon from '../svg-icons/ArrowDownward';
export const styles = (theme: Object) => ({
root: {
cursor: 'pointer',
display: 'inline-flex',
justifyContent: 'flex-start',
flexDirection: 'inherit',
alignItems: 'center',
background: 'transparent',
'&:hover': {
color: theme.palette.text.primary,
},
'&:focus': {
color: theme.palette.text.primary,
},
},
active: {
color: theme.palette.text.primary,
'& $icon': {
opacity: 1,
},
},
icon: {
height: 16,
marginRight: 4,
marginLeft: 4,
opacity: 0,
transition: theme.transitions.create(['opacity', 'transform'], {
duration: theme.transitions.duration.shorter,
}),
userSelect: 'none',
width: 16,
},
desc: {
transform: 'rotate(0deg)',
},
asc: {
transform: 'rotate(180deg)',
},
});
/**
* A button based label for placing inside `TableCell` for column sorting.
*/
function TableSortLabel(props) {
const { active, classes, className: classNameProp, children, direction, ...other } = props;
const className = classNames(
classes.root,
{
[classes.active]: active,
},
classNameProp,
);
const iconClassName = classNames(classes.icon, {
[classes[direction]]: !!direction,
});
return (
<ButtonBase className={className} component="span" disableRipple {...other}>
{children}
<ArrowDownwardIcon className={iconClassName} />
</ButtonBase>
);
}
TableSortLabel.propTypes = {
/**
* If `true`, the label will have the active styling (should be true for the sorted column).
*/
active: PropTypes.bool,
/**
* Label contents, the arrow will be appended automatically.
*/
children: PropTypes.node,
/**
* Useful to extend the style applied to components.
*/
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
className: PropTypes.string,
/**
* The current sort direction.
*/
direction: PropTypes.oneOf(['asc', 'desc']),
};
TableSortLabel.defaultProps = {
active: false,
direction: 'desc',
};
export default withStyles(styles, { name: 'MuiTableSortLabel' })(TableSortLabel);
|
packages/cf-component-tabs/test/TabsPanel.js
|
koddsson/cf-ui
|
import React from 'react';
import PropTypes from 'prop-types';
import { felaSnapshot } from 'cf-style-provider';
import { TabsPanel } from '../../cf-component-tabs/src/index';
class Context extends React.Component {
getChildContext() {
return { active: this.props.active };
}
render() {
return this.props.children;
}
}
Context.propTypes = {
active: PropTypes.string.isRequired,
children: PropTypes.node
};
Context.childContextTypes = {
active: PropTypes.string.isRequired
};
test('should render', () => {
const snapshot = felaSnapshot(
<Context active="something-else">
<TabsPanel id="tab">TabsPanel</TabsPanel>
</Context>
);
expect(snapshot.component).toMatchSnapshot();
expect(snapshot.styles).toMatchSnapshot();
});
test('should render active', () => {
const snapshot = felaSnapshot(
<Context active="tab">
<TabsPanel id="tab">TabsPanel</TabsPanel>
</Context>
);
expect(snapshot.component).toMatchSnapshot();
expect(snapshot.styles).toMatchSnapshot();
});
|
src/App.js
|
partneran/partneran
|
import React, { Component } from 'react';
// import NaviationAuthorize from './components/Navigation/NavigationAuthorize';
// import NavigationUnauthorize from './components/Navigation/NavigationUnauthorize';
import NavigationBar from './components/Navigation/NavigationBar';
import { isLoggedIn } from './helpers/verification';
class App extends Component {
render() {
return (
<div>
<NavigationBar isLoggedIn={isLoggedIn()}/>
{this.props.children}
</div>
)
}
}
export default App;
|
src/svg-icons/hardware/sim-card.js
|
matthewoates/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let HardwareSimCard = (props) => (
<SvgIcon {...props}>
<path d="M19.99 4c0-1.1-.89-2-1.99-2h-8L4 8v12c0 1.1.9 2 2 2h12.01c1.1 0 1.99-.9 1.99-2l-.01-16zM9 19H7v-2h2v2zm8 0h-2v-2h2v2zm-8-4H7v-4h2v4zm4 4h-2v-4h2v4zm0-6h-2v-2h2v2zm4 2h-2v-4h2v4z"/>
</SvgIcon>
);
HardwareSimCard = pure(HardwareSimCard);
HardwareSimCard.displayName = 'HardwareSimCard';
HardwareSimCard.muiName = 'SvgIcon';
export default HardwareSimCard;
|
ajax/libs/redux-form/4.0.4/redux-form.min.js
|
boneskull/cdnjs
|
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ReduxForm=e(require("react")):t.ReduxForm=e(t.React)}(this,function(t){return function(t){function e(n){if(r[n])return r[n].exports;var u=r[n]={exports:{},id:n,loaded:!1};return t[n].call(u.exports,u,u.exports,e),u.loaded=!0,u.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(25),o=n(u),i=r(57),a=r(27),s=n(a),f=s.default(!1,o.default,i.connect),c=f.actionTypes,l=f.blur,d=f.change,p=f.changeWithKey,v=f.destroy,y=f.focus,h=f.reducer,m=f.reduxForm,g=f.getValues,b=f.initialize,_=f.initializeWithKey,O=f.propTypes,x=f.reset,A=f.startAsyncValidation,j=f.startSubmit,S=f.stopAsyncValidation,T=f.stopSubmit,w=f.touch,M=f.touchWithKey,R=f.untouch,E=f.untouchWithKey;e.actionTypes=c,e.blur=l,e.change=d,e.changeWithKey=p,e.destroy=v,e.focus=y,e.reducer=h,e.reduxForm=m,e.getValues=g,e.initialize=b,e.initializeWithKey=_,e.propTypes=O,e.reset=x,e.startAsyncValidation=A,e.startSubmit=j,e.stopAsyncValidation=S,e.stopSubmit=T,e.touch=w,e.touchWithKey=M,e.untouch=R,e.untouchWithKey=E},function(t,e){"use strict";function r(t){return Array.isArray(t)?t.reduce(function(t,e){return t&&r(e)},!0):t&&"object"==typeof t?Object.keys(t).reduce(function(e,n){return e&&r(t[n])},!0):!t}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r="redux-form/ADD_ARRAY_VALUE";e.ADD_ARRAY_VALUE=r;var n="redux-form/BLUR";e.BLUR=n;var u="redux-form/CHANGE";e.CHANGE=u;var o="redux-form/DESTROY";e.DESTROY=o;var i="redux-form/FOCUS";e.FOCUS=i;var a="redux-form/INITIALIZE";e.INITIALIZE=a;var s="redux-form/REMOVE_ARRAY_VALUE";e.REMOVE_ARRAY_VALUE=s;var f="redux-form/RESET";e.RESET=f;var c="redux-form/START_ASYNC_VALIDATION";e.START_ASYNC_VALIDATION=c;var l="redux-form/START_SUBMIT";e.START_SUBMIT=l;var d="redux-form/STOP_ASYNC_VALIDATION";e.STOP_ASYNC_VALIDATION=d;var p="redux-form/STOP_SUBMIT";e.STOP_SUBMIT=p;var v="redux-form/SUBMIT_FAILED";e.SUBMIT_FAILED=v;var y="redux-form/TOUCH";e.TOUCH=y;var h="redux-form/UNTOUCH";e.UNTOUCH=h},function(t,e){"use strict";function r(t,e){return t?Object.keys(t).reduce(function(r,u){var o;return n({},r,(o={},o[u]=e(t[u],u),o))},{}):t}e.__esModule=!0;var n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=r,t.exports=e.default},function(t,e){function r(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}t.exports=r},function(t,e,r){"use strict";e.__esModule=!0;var n=r(2),u=function(t,e,r){return{type:n.ADD_ARRAY_VALUE,path:t,value:e,index:r}};e.addArrayValue=u;var o=function(t,e){return{type:n.BLUR,field:t,value:e}};e.blur=o;var i=function(t,e){return{type:n.CHANGE,field:t,value:e}};e.change=i;var a=function(){return{type:n.DESTROY}};e.destroy=a;var s=function(t){return{type:n.FOCUS,field:t}};e.focus=s;var f=function(t,e){if(!Array.isArray(e))throw new Error("must provide fields array to initialize() action creator");return{type:n.INITIALIZE,data:t,fields:e}};e.initialize=f;var c=function(t,e){return{type:n.REMOVE_ARRAY_VALUE,path:t,index:e}};e.removeArrayValue=c;var l=function(){return{type:n.RESET}};e.reset=l;var d=function(){return{type:n.START_ASYNC_VALIDATION}};e.startAsyncValidation=d;var p=function(){return{type:n.START_SUBMIT}};e.startSubmit=p;var v=function(t){return{type:n.STOP_ASYNC_VALIDATION,errors:t}};e.stopAsyncValidation=v;var y=function(t){return{type:n.STOP_SUBMIT,errors:t}};e.stopSubmit=y;var h=function(){return{type:n.SUBMIT_FAILED}};e.submitFailed=h;var m=function(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return{type:n.TOUCH,fields:e}};e.touch=m;var g=function(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return{type:n.UNTOUCH,fields:e}};e.untouch=g},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){return"function"==typeof t?function(){return o({},t.apply(void 0,arguments),e)}:"object"==typeof t?a.default(t,function(t){return u(t,e)}):t}e.__esModule=!0;var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=u;var i=r(3),a=n(i);t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r="value";e.dataKey=r;var n=function(t,e){return function(t){t.dataTransfer.setData(r,e())}};e.default=n},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(9),o=n(u),i=function(t){var e=[];if(t)for(var r=0;r<t.length;r++){var n=t[r];n.selected&&e.push(n.value)}return e},a=function(t,e){if(o.default(t)){if(!e&&t.nativeEvent&&void 0!==t.nativeEvent.text)return t.nativeEvent.text;if(e&&void 0!==t.nativeEvent)return t.nativeEvent.text;var r=t.target,n=r.type,u=r.value,a=r.checked,s=r.files,f=t.dataTransfer;return"checkbox"===n?a:"file"===n?s||f&&f.files:"select-multiple"===n?i(t.target.options):u}return t&&"object"==typeof t&&void 0!==t.value?t.value:t};e.default=a,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r=function(t){return!!(t&&t.stopPropagation&&t.preventDefault)};e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(9),o=n(u),i=function(t){var e=o.default(t);return e&&t.preventDefault(),e};e.default=i,t.exports=e.default},function(t,e){"use strict";function r(t){return t.displayName||t.name||"Component"}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r=function u(t,e,r){var n=t.indexOf("."),o=t.indexOf("["),i=t.indexOf("]");if(o>0&&i!==o+1)throw new Error("found [ not followed by ]");if(o>0&&(0>n||n>o))!function(){var n=t.substring(0,o),a=t.substring(i+1);"."===a[0]&&(a=a.substring(1));var s=e&&e[n]||[];a?(r[n]||(r[n]=[]),s.forEach(function(t,e){r[n][e]||(r[n][e]={}),u(a,t,r[n][e])})):r[n]=s.map(function(t){return t.value})}();else if(n>0){var a=t.substring(0,n),s=t.substring(n+1);r[a]||(r[a]={}),u(s,e&&e[a]||{},r[a])}else r[t]=e[t]&&e[t].value},n=function(t,e){return t.reduce(function(t,n){return r(n,e,t),t},{})};e.default=n,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r=function n(t){if(!t)return t;var e=Object.keys(t);if(e.length)return e.reduce(function(e,r){var u=t[r];if(u)if(u.hasOwnProperty&&u.hasOwnProperty("value"))void 0!==u.value&&(e[r]=u.value);else if(Array.isArray(u))e[r]=u.map(function(t){return t.value||n(t)});else if("object"==typeof u){var o=n(u);o&&Object.keys(o).length>0&&(e[r]=o)}return e},{})};e.default=r,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r=function(t,e){var r=!0;t:for(;r;){var n=t,u=e;if(r=!1,!n||!u)return u;var o=n.indexOf(".");if(0!==o){var i=n.indexOf("["),a=n.indexOf("]");if(o>=0&&(0>i||i>o))t=n.substring(o+1),e=u[n.substring(0,o)],r=!0,o=i=a=void 0;else{if(!(i>=0&&(0>o||o>i)))return u[n];if(0>a)throw new Error("found [ but no ]");var s=n.substring(0,i),f=n.substring(i+1,a);if(!f.length)return u[s];if(0===i){t=n.substring(a+1),e=u[f],r=!0,o=i=a=s=f=void 0;continue t}if(!u[s])return;t=n.substring(a+1),e=u[s][f],r=!0,o=i=a=s=f=void 0}}else t=n.substring(1),e=u,r=!0,o=void 0}};e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(){var t,e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=r.form,o=r.key,i=u(r,["form","key"]);if(!n)return e;if(o){var a,s;if(r.type===c.DESTROY){var l;return f({},e,(l={},l[n]=e[n]&&Object.keys(e[n]).reduce(function(t,r){var u;return r===o?t:f({},t,(u={},u[r]=e[n][r],u))},{}),l))}return f({},e,(s={},s[n]=f({},e[n],(a={},a[o]=M((e[n]||{})[o],i),a)),s))}return r.type===c.DESTROY?Object.keys(e).reduce(function(t,r){var u;return r===n?t:f({},t,(u={},u[r]=e[r],u))},{}):f({},e,(t={},t[n]=M(e[n],i),t))}function i(t){return t.plugin=function(t){var e=this;return i(function(){var r=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],u=e(r,n);return f({},u,d.default(t,function(t,e){return t(u[e]||T,n)}))})},t.normalize=function(t){var e=this;return i(function(){var r=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],u=e(r,n);return f({},u,d.default(t,function(t,e){var o=function(e,r){var n=g.default(f({},T,e)),u=f({},T,r);return f({},u,d.default(t,function(t,r){return f({},u[r],{value:t(u[r]?u[r].value:void 0,e&&e[r]?e[r].value:void 0,g.default(u),n)})}))};if(n.key){var i;return f({},u[e],(i={},i[n.key]=o(r[e][n.key],u[e][n.key]),i))}return o(r[e],u[e])}))})},t}e.__esModule=!0;var a,s,f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},c=r(2),l=r(3),d=n(l),p=r(14),v=n(p),y=r(16),h=n(y),m=r(13),g=n(m),b=r(38),_=n(b),O=r(43),x=n(O),A=r(44),j=n(A),S="_error";e.globalErrorKey=S;var T=(a={_active:void 0,_asyncValidating:!1},a[S]=void 0,a._submitting=!1,a._submitFailed=!1,a);e.initialState=T;var w=(s={},s[c.ADD_ARRAY_VALUE]=function(t,e){var r=e.path,n=e.index,u=e.value,o=v.default(r,t),i=f({},t),a=o?[].concat(o):[],s=null!==u&&"object"==typeof u?_.default(u,Object.keys(u)):{value:u};return void 0===n?a.push(s):a.splice(n,0,s),h.default(r,a,i)},s[c.BLUR]=function(t,e){var r=e.field,n=e.value,o=e.touch,i=(t._active,u(t,["_active"]));return h.default(r,function(t){var e=f({},t);return void 0!==n&&(e.value=n),o&&(e.touched=!0),e},i)},s[c.CHANGE]=function(t,e){var r=e.field,n=e.value,o=e.touch;return h.default(r,function(t){var e=f({},t,{value:n}),r=(e.asyncError,e.submitError,u(e,["asyncError","submitError"]));return o&&(r.touched=!0),r},t)},s[c.DESTROY]=function(){},s[c.FOCUS]=function(t,e){var r=e.field,n=h.default(r+".visited",!0,t);return n._active=r,n},s[c.INITIALIZE]=function(t,e){var r,n=e.data,u=e.fields;return f({},_.default(n,u,t),(r={_asyncValidating:!1,_active:void 0},r[S]=void 0,r._submitting=!1,r._submitFailed=!1,r))},s[c.REMOVE_ARRAY_VALUE]=function(t,e){var r=e.path,n=e.index,u=v.default(r,t),o=f({},t),i=u?[].concat(u):[];return void 0===n?i.pop():isNaN(n)?delete i[n]:i.splice(n,1),h.default(r,i,o)},s[c.RESET]=function(t){var e;return f({},x.default(t),(e={_active:void 0,_asyncValidating:!1},e[S]=void 0,e._submitting=!1,e._submitFailed=!1,e))},s[c.START_ASYNC_VALIDATION]=function(t){return f({},t,{_asyncValidating:!0})},s[c.START_SUBMIT]=function(t){return f({},t,{_submitting:!0})},s[c.STOP_ASYNC_VALIDATION]=function(t,e){var r,n=e.errors;return f({},j.default(t,n,"asyncError"),(r={_asyncValidating:!1},r[S]=n&&n[S],r))},s[c.STOP_SUBMIT]=function(t,e){var r,n=e.errors;return f({},j.default(t,n,"submitError"),(r={},r[S]=n&&n[S],r._submitting=!1,r._submitFailed=!(!n||!Object.keys(n).length),r))},s[c.SUBMIT_FAILED]=function(t){return f({},t,{_submitFailed:!0})},s[c.TOUCH]=function(t,e){var r=e.fields;return f({},t,r.reduce(function(t,e){return h.default(e,function(t){return f({},t,{touched:!0})},t)},t))},s[c.UNTOUCH]=function(t,e){var r=e.fields;return f({},t,r.reduce(function(t,e){return h.default(e,function(t){if(t){var e=(t.touched,u(t,["touched"]));return e}return t},t)},t))},s),M=function(){var t=arguments.length<=0||void 0===arguments[0]?T:arguments[0],e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=w[e.type];return r?r(t,e):t};e.default=i(o)},function(t,e){"use strict";e.__esModule=!0;var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},n=function u(t,e,n){for(var o=!0;o;){var i,a=t,s=e,f=n;o=!1;var c=a.indexOf(".");if(0!==c){var l=a.indexOf("["),d=a.indexOf("]");if(c>=0&&(0>l||l>c)){var p,v=a.substring(0,c);return r({},f,(p={},p[v]=u(a.substring(c+1),s,f[v]||{}),p))}if(l>=0&&(0>c||c>l)){var y,h,m,g,b=function(){if(0>d)throw new Error("found [ but no ]");var t=a.substring(0,l),e=a.substring(l+1,d),n=f[t]||[],o=a.substring(d+1);if(e){if(o.length){var i=n[e]||{},c=[].concat(n);return c[e]=u(o,s,i),{v:r({},f||{},(m={},m[t]=c,m))}}var p=[].concat(n);return p[e]="function"==typeof s?s(p[e]):s,{v:r({},f||{},(h={},h[t]=p,h))}}if(o.length){if(!(n&&n.length||"function"!=typeof s))return{v:f};var c=n.map(function(t){return u(o,s,t)});return{v:r({},f||{},(g={},g[t]=c,g))}}var v=void 0;if(Array.isArray(s))v=s;else if(f[t])v=n.map(function(t){return"function"==typeof s?s(t):s});else{if("function"==typeof s)return{v:f};v=s}return{v:r({},f||{},(y={},y[t]=v,y))}}();if("object"==typeof b)return b.v}return r({},f,(i={},i[a]="function"==typeof s?s(f[a]):s,i))}t=a.substring(1),e=s,n=f,o=!0,i=c=void 0}};e.default=n,t.exports=e.default},function(t,e,r){function n(t){return null===t||void 0===t}function u(t){return t&&"object"==typeof t&&"number"==typeof t.length?"function"!=typeof t.copy||"function"!=typeof t.slice?!1:t.length>0&&"number"!=typeof t[0]?!1:!0:!1}function o(t,e,r){var o,c;if(n(t)||n(e))return!1;if(t.prototype!==e.prototype)return!1;if(s(t))return s(e)?(t=i.call(t),e=i.call(e),f(t,e,r)):!1;if(u(t)){if(!u(e))return!1;if(t.length!==e.length)return!1;for(o=0;o<t.length;o++)if(t[o]!==e[o])return!1;return!0}try{var l=a(t),d=a(e)}catch(p){return!1}if(l.length!=d.length)return!1;for(l.sort(),d.sort(),o=l.length-1;o>=0;o--)if(l[o]!=d[o])return!1;for(o=l.length-1;o>=0;o--)if(c=l[o],!f(t[c],e[c],r))return!1;return typeof t==typeof e}var i=Array.prototype.slice,a=r(50),s=r(49),f=t.exports=function(t,e,r){return r||(r={}),t===e?!0:t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=typeof t&&"object"!=typeof e?r.strict?t===e:t==e:o(t,e,r)}},function(t,e){"use strict";var r={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0};t.exports=function(t,e){for(var u=Object.getOwnPropertyNames(e),o=0;o<u.length;++o)r[u[o]]||n[u[o]]||(t[u[o]]=e[u[o]]);return t}},function(t,e){"use strict";function r(t){return t.shape({subscribe:t.func.isRequired,dispatch:t.func.isRequired,getState:t.func.isRequired})}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){function r(){return f}function n(t){c.push(t);var e=!0;return function(){if(e){e=!1;var r=c.indexOf(t);c.splice(r,1)}}}function u(t){if(!i.default(t))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if("undefined"==typeof t.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,f=s(f,t)}finally{l=!1}return c.slice().forEach(function(t){return t()}),t}function o(t){s=t,u({type:a.INIT})}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var s=t,f=e,c=[],l=!1;return u({type:a.INIT}),{dispatch:u,subscribe:n,getState:r,replaceReducer:o}}e.__esModule=!0,e.default=u;var o=r(23),i=n(o),a={INIT:"@@redux/INIT"};e.ActionTypes=a},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(20),o=n(u),i=r(63),a=n(i),s=r(62),f=n(s),c=r(61),l=n(c),d=r(22),p=n(d);e.createStore=o.default,e.combineReducers=a.default,e.bindActionCreators=f.default,e.applyMiddleware=l.default,e.compose=p.default},function(t,e){"use strict";function r(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return function(t){return e.reduceRight(function(t,e){return e(t)},t)}}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e){"use strict";function r(t){if(!t||"object"!=typeof t)return!1;var e="function"==typeof t.constructor?Object.getPrototypeOf(t):Object.prototype;if(null===e)return!0;var r=e.constructor;return"function"==typeof r&&r instanceof r&&n(r)===u}e.__esModule=!0,e.default=r;var n=function(t){return Function.prototype.toString.call(t)},u=n(Object);t.exports=e.default},function(t,e){"use strict";function r(t,e){return Object.keys(t).reduce(function(r,n){return r[n]=e(t[n],n),r},{})}e.__esModule=!0,e.default=r,t.exports=e.default},function(e,r){e.exports=t},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(4),o=n(u),i=r(1),a=n(i),s=function(t,e,r){e();var n=t();if(!o.default(n))throw new Error("asyncValidate function passed to reduxForm must return a promise");var u=function(t){return function(e){if(!a.default(e))return r(e),Promise.reject();if(t)throw r(),new Error("Asynchronous validation promise was rejected without errors.");return r(),Promise.resolve()}};return n.then(u(!1),u(!0))};e.default=s,t.exports=e.default},function(t,e,r){"use strict";function n(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function u(t){return t&&t.__esModule?t:{"default":t}}function o(t,e,r){return{actionTypes:g,blur:j,change:S,changeWithKey:T,destroy:w,focus:M,getValues:x.default,initialize:R,initializeWithKey:E,propTypes:_.default(e),reduxForm:c.default(t,e,r),reducer:s.default,reset:P,startAsyncValidation:V,startSubmit:I,stopAsyncValidation:C,stopSubmit:F,submitFailed:N,touch:U,touchWithKey:k,untouch:q,untouchWithKey:D}}e.__esModule=!0;var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=o;var a=r(15),s=u(a),f=r(30),c=u(f),l=r(3),d=u(l),p=r(6),v=u(p),y=r(5),h=n(y),m=r(2),g=n(m),b=r(29),_=u(b),O=r(13),x=u(O),A=i({},d.default(i({},h,{changeWithKey:function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;e>n;n++)r[n-1]=arguments[n];return v.default(h.change,{key:t}).apply(void 0,r)},initializeWithKey:function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;e>n;n++)r[n-1]=arguments[n];return v.default(h.initialize,{key:t}).apply(void 0,r)},reset:function(t){return v.default(h.reset,{key:t})()},touchWithKey:function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;e>n;n++)r[n-1]=arguments[n];return v.default(h.touch,{key:t}).apply(void 0,r)},untouchWithKey:function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;e>n;n++)r[n-1]=arguments[n];return v.default(h.untouch,{key:t}).apply(void 0,r)},destroy:function(t){return v.default(h.destroy,{key:t})()}}),function(t){return function(e){for(var r=arguments.length,n=Array(r>1?r-1:0),u=1;r>u;u++)n[u-1]=arguments[u];return v.default(t,{form:e}).apply(void 0,n)}})),j=A.blur,S=A.change,T=A.changeWithKey,w=A.destroy,M=A.focus,R=A.initialize,E=A.initializeWithKey,P=A.reset,V=A.startAsyncValidation,I=A.startSubmit,C=A.stopAsyncValidation,F=A.stopSubmit,N=A.submitFailed,U=A.touch,k=A.touchWithKey,q=A.untouch,D=A.untouchWithKey;t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},f=r(5),c=u(f),l=r(11),d=n(l),p=r(15),v=r(17),y=n(v),h=r(6),m=n(h),g=r(12),b=n(g),_=r(1),O=n(_),x=r(41),A=n(x),j=r(37),S=n(j),T=r(26),w=n(T),M=r(36),R=n(M),E=r(10),P=n(E),V=r(47),I=n(V),C=r(48),F=n(C),N=function(t,e,r,n,u,f,l){var v=r.Component,h=r.PropTypes;return function(g,_,x,j){var T=function(n){function f(t){i(this,f),n.call(this,t),this.asyncValidate=this.asyncValidate.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.fields=A.default(t,{},{},this.asyncValidate,e)}return a(f,n),f.prototype.componentWillMount=function(){var t=this.props,e=t.fields,r=t.initialize,n=t.initialValues;n&&r(n,e)},f.prototype.componentWillReceiveProps=function(t){y.default(this.props.fields,t.fields)&&y.default(this.props.form,t.form)||(this.fields=A.default(t,this.props,this.fields,this.asyncValidate,e)),y.default(this.props.initialValues,t.initialValues)||this.props.initialize(t.initialValues,t.fields)},f.prototype.componentWillUnmount=function(){t.destroyOnUnmount&&this.props.destroy()},f.prototype.asyncValidate=function c(t,e){var r=this,n=this.props,c=n.asyncValidate,u=n.dispatch,o=n.fields,i=n.form,a=n.startAsyncValidation,s=n.stopAsyncValidation,f=n.validate;if(c){var l=function(){var n=b.default(o,i);t&&(n[t]=e);var l=f(n,r.props);return!t||O.default(l[t])?{v:w.default(function(){return c(n,u,r.props)},a,s)}:void 0}();if("object"==typeof l)return l.v}},f.prototype.handleSubmit=function(t){var e=this,r=this.props,n=r.onSubmit,u=r.fields,o=r.form,i=function(t){if(!t||"function"!=typeof t)throw new Error("You must either pass handleSubmit() an onSubmit function or pass onSubmit as a prop");return t};return!t||P.default(t)?S.default(i(n),b.default(u,o),this.props,this.asyncValidate):R.default(function(r){P.default(r),S.default(i(t),b.default(u,o),e.props,e.asyncValidate)})},f.prototype.render=function(){var t,e=this,n=this.fields,i=this.props,a=(i.addArrayValue,i.asyncBlurFields,i.blur,i.change,i.destroy),f=(i.focus,i.fields),c=i.form,l=(i.initialValues,i.initialize),d=(i.onSubmit,i.propNamespace),p=i.reset,v=(i.removeArrayValue,i.returnRejectedSubmitPromise,i.startAsyncValidation,i.startSubmit,i.stopAsyncValidation,i.stopSubmit,i.submitFailed,i.touch),y=i.untouch,h=(i.validate,o(i,["addArrayValue","asyncBlurFields","blur","change","destroy","focus","fields","form","initialValues","initialize","onSubmit","propNamespace","reset","removeArrayValue","returnRejectedSubmitPromise","startAsyncValidation","startSubmit","stopAsyncValidation","stopSubmit","submitFailed","touch","untouch","validate"])),m=n._meta,g=m.allPristine,b=m.allValid,_=m.errors,O=m.formError,A=m.values,j={active:c._active,asyncValidating:c._asyncValidating,dirty:!g,error:O,errors:_,fields:n,formKey:x,invalid:!b,pristine:g,submitting:c._submitting,submitFailed:c._submitFailed,valid:b,values:A,asyncValidate:R.default(function(){return e.asyncValidate()}),destroyForm:R.default(a),handleSubmit:this.handleSubmit,initializeForm:R.default(function(t){return l(t,f)}),resetForm:R.default(p),touch:R.default(function(){return v.apply(void 0,arguments)}),touchAll:R.default(function(){return v.apply(void 0,f)}),untouch:R.default(function(){return y.apply(void 0,arguments)}),untouchAll:R.default(function(){return y.apply(void 0,f)})},S=d?(t={},t[d]=j,t):j;return r.createElement(u,s({},h,S))},f}(v);T.displayName="ReduxForm("+d.default(u)+")",T.WrappedComponent=u,T.propTypes={asyncBlurFields:h.arrayOf(h.string),asyncValidate:h.func,dispatch:h.func.isRequired,fields:h.arrayOf(h.string).isRequired,form:h.object,initialValues:h.any,onSubmit:h.func,propNamespace:h.string,readonly:h.bool,returnRejectedSubmitPromise:h.bool,validate:h.func,addArrayValue:h.func.isRequired,blur:h.func.isRequired,change:h.func.isRequired,destroy:h.func.isRequired,focus:h.func.isRequired,initialize:h.func.isRequired,removeArrayValue:h.func.isRequired,reset:h.func.isRequired,startAsyncValidation:h.func.isRequired,startSubmit:h.func.isRequired,stopAsyncValidation:h.func.isRequired,stopSubmit:h.func.isRequired,submitFailed:h.func.isRequired,touch:h.func.isRequired,untouch:h.func.isRequired},T.defaultProps={asyncBlurFields:[],form:p.initialState,readonly:!1,returnRejectedSubmitPromise:!1,validate:function(){return{}}};var M=s({},c,{blur:m.default(c.blur,{touch:!!t.touchOnBlur}),change:m.default(c.change,{touch:!!t.touchOnChange})}),E=void 0!==x&&null!==x?n(F.default(f,function(t){var e=j(t,g);if(!e)throw new Error('You need to mount the redux-form reducer at "'+g+'"');return e&&e[_]&&e[_][x]}),I.default(l,m.default(M,{form:_,key:x}))):n(F.default(f,function(t){var e=j(t,g);if(!e)throw new Error('You need to mount the redux-form reducer at "'+g+'"');return e&&e[_]}),I.default(l,m.default(M,{form:_})));return E(T)}};e.default=N,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r=function(t){var e=t.PropTypes,r=e.any,n=e.bool,u=e.string,o=e.func,i=e.object;return{active:u,asyncValidating:n.isRequired,dirty:n.isRequired,error:r,errors:i,fields:i.isRequired,formKey:r,invalid:n.isRequired,pristine:n.isRequired,submitting:n.isRequired,submitFailed:n.isRequired,valid:n.isRequired,values:i.isRequired,asyncValidate:o.isRequired,destroyForm:o.isRequired,handleSubmit:o.isRequired,initializeForm:o.isRequired,resetForm:o.isRequired,touch:o.isRequired,touchAll:o.isRequired,untouch:o.isRequired,untouchAll:o.isRequired}};e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},a=r(31),s=n(a),f=r(18),c=n(f),l=function(t,e,r){var n=e.Component,a=s.default(t,e,r);return function(t,r,s){return function(f){var l=a(f,r,s),d=i({touchOnBlur:!0,touchOnChange:!1,destroyOnUnmount:!0},t),p=function(t){function r(){u(this,r),t.apply(this,arguments)}return o(r,t),r.prototype.render=function(){return e.createElement(l,i({},d,this.props))},r}(n);return c.default(p,f)}}};e.default=l,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var a=r(52),s=n(a),f=r(11),c=n(f),l=r(28),d=n(l),p=function(t,e,r){return function(n,a,f){var l=e.Component,p=e.PropTypes,v=function(c){function l(u){o(this,l),c.call(this,u),this.cache=s.default(this,{ReduxForm:{params:["reduxMountPoint","form","formKey","getFormState"],fn:d.default(u,t,e,r,n,a,f)}})}return i(l,c),l.prototype.componentWillReceiveProps=function(t){this.cache.componentWillReceiveProps(t)},l.prototype.render=function(){var t=this.cache.ReduxForm,r=this.props,n=(r.reduxMountPoint,r.destroyOnUnmount,r.form,r.getFormState,r.touchOnBlur,r.touchOnChange,u(r,["reduxMountPoint","destroyOnUnmount","form","getFormState","touchOnBlur","touchOnChange"]));return e.createElement(t,n)},l}(l);return v.displayName="ReduxFormConnector("+c.default(n)+")",v.WrappedComponent=n,v.propTypes={destroyOnUnmount:p.bool,reduxMountPoint:p.string,form:p.string.isRequired,formKey:p.string,getFormState:p.func,touchOnBlur:p.bool,touchOnChange:p.bool},v.defaultProps={reduxMountPoint:"form",getFormState:function(t,e){return t[e]}},v}};e.default=p,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(8),o=n(u),i=function(t,e,r,n){return function(u){var i=o.default(u,r);e(t,i),n&&n(t,i)}};e.default=i,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(8),o=n(u),i=function(t,e,r){return function(n){return e(t,o.default(n,r))}};e.default=i,t.exports=e.default},function(t,e,r){"use strict";e.__esModule=!0;var n=r(7),u=function(t,e){return function(r){e(t,r.dataTransfer.getData(n.dataKey))}};e.default=u,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r=function(t,e){return function(){return e(t)}};e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(10),o=n(u),i=function(t){return function(e){for(var r=arguments.length,n=Array(r>1?r-1:0),u=1;r>u;u++)n[u-1]=arguments[u];return o.default(e)?t.apply(void 0,n):t.apply(void 0,[e].concat(n))}};e.default=i,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(4),o=n(u),i=r(1),a=n(i),s=function(t,e,r,n){var u=r.dispatch,i=r.fields,s=r.startSubmit,f=r.stopSubmit,c=r.submitFailed,l=r.returnRejectedSubmitPromise,d=r.touch,p=r.validate,v=p(e,r);if(d.apply(void 0,i),a.default(v)){var y=function(){var r=t(e,u);return o.default(r)?(s(),r.then(function(t){return f(),t},function(t){return f(t),l?Promise.reject(t):void 0})):r},h=n();return o.default(h)?h.then(y,function(){return c(),l?Promise.reject():Promise.resolve()}):y()}c()};e.default=s,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},n=function(t,e){return t&&void 0!==t.value?{initial:e,value:t.value}:void 0===e?{}:{initial:e,value:e}},u=function(t,e){var u=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(!e)throw new Error("fields must be passed when initializing state");if(!t||!e.length)return u;var o=function i(t,e,r){for(var u=!0;u;){var o=t,a=e,s=r;u=!1;var f=o.indexOf(".");{if(0!==f){var c=o.indexOf("["),l=o.indexOf("]"),d=s||{};if(f>=0&&(0>c||c>f)){var p=o.substring(0,f);d[p]=a[p]&&i(o.substring(f+1),a[p],d[p]||{})}else c>=0&&(0>f||f>c)?!function(){if(0>l)throw new Error("found '[' but no ']': '"+o+"'");var t=o.substring(0,c),e=a[t],r=d[t],u=o.substring(l+1);Array.isArray(e)?u.length?d[t]=e.map(function(t,e){return i(u,t,r&&r[e])}):d[t]=e.map(function(t,e){return n(r&&r[e],t)}):d[t]=n(r,e)}():d[o]=n(d[o],a&&a[o]);return d}t=o.substring(1),e=a,r=s,u=!0,f=void 0}}};return e.reduce(function(e,r){return o(r,t,e)},r({},u))};e.default=u,t.exports=e.default},function(t,e){"use strict";function r(t,e){if(t===e)return!0;if("boolean"==typeof t||"boolean"==typeof e)return t===e;if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(t&&"object"==typeof t){if(!e||"object"!=typeof e)return!1;var n=Object.keys(t),u=Object.keys(e);if(n.length!==u.length)return!1;for(var o=0;o<u.length;o++){var i=u[o];if(!r(t[i],e[i]))return!1}}else if(t||e)return t===e;return!0}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(32),o=n(u),i=r(33),a=n(i),s=r(7),f=n(s),c=r(34),l=n(c),d=r(35),p=n(d),v=r(45),y=n(v),h=r(14),m=n(h),g=r(46),b=n(g),_=function O(t,e,r,n,u,i,s,c){
for(var d=arguments,v=!0;v;){var h=t,g=e,_=r,x=n,A=u,j=i,S=s,T=c;void 0===_&&(_=""),v=!1;var w=d.length<=8||void 0===d[8]?function(){return null}:d[8],M=T.asyncBlurFields,R=T.blur,E=T.change,P=T.focus,V=T.form,I=T.initialValues,C=T.readonly,F=T.addArrayValue,N=T.removeArrayValue,U=g.indexOf("."),k=g.indexOf("["),q=g.indexOf("]");if(k>0&&q!==k+1)throw new Error("found [ not followed by ]");if(k>0&&(0>U||U>k)){var D=function(){var t=g.substring(0,k),e=g.substring(q+1);"."===e[0]&&(e=e.substring(1));var r=h&&h[t]||[];x[t]||(x[t]=[],Object.defineProperty(x[t],"addField",{value:function(e,r){return F(_+t,e,r)}}),Object.defineProperty(x[t],"removeField",{value:function(e){return N(_+t,e)}}));var n=x[t];return r.forEach(function(r,u){e&&!n[u]&&(n[u]={});var o=e?n[u]:{},i=O(r,e,""+_+t+"["+u+"]"+(e?".":""),o,A,j,S,T,w);e||(n[u]=i)}),n.length>r.length&&n.splice(r.length,n.length-r.length),{v:n}}();if("object"==typeof D)return D.v}if(!(U>0)){var W=_+g,B=x[g]||{};if(B.name!==W){var K=a.default(W,E,S),L=m.default(W,I);B.name=W,B.defaultChecked=L===!0,B.defaultValue=L,B.initialValue=L,C||(B.onBlur=o.default(W,R,S,~M.indexOf(W)&&function(t,e){return y.default(j(t,e))}),B.onChange=K,B.onDragStart=f.default(W,function(){return B.value}),B.onDrop=l.default(W,E),B.onFocus=p.default(W,P),B.onUpdate=K),B.valid=!0,B.invalid=!1,Object.defineProperty(B,"_isField",{value:!0})}var Y=(g?h[g]:h)||{},z=m.default(W,A),H=b.default(B,Y,W===V._active,z);return(g||x[g]!==H)&&(x[g]=H),w(H),H}var G=g.substring(0,U),Z=g.substring(U+1);x[G]||(x[G]={}),d=[t=h[G]||{},e=Z,r=_+G+".",n=x[G],u=A,i=j,s=S,c=T,w],v=!0,w=M=R=E=P=V=I=C=F=N=U=k=q=D=G=Z=void 0}};e.default=_,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o=r(40),i=n(o),a=r(16),s=n(a),f=r(12),c=n(f),l=r(42),d=n(l),p=function(t,e,r,n,o){var a=t.fields,f=t.form,l=t.validate,p=e.fields,v=c.default(a,f),y=l(v,t),h={},m=y._error||f._error,g=!m,b=!0,_=function(t){t.error&&(h=s.default(t.name,t.error,h),g=!1),t.dirty&&(b=!1)},O=p?p.reduce(function(t,e){return~a.indexOf(e)?t:d.default(t,e)},u({},r)):u({},r);return a.forEach(function(e){i.default(f,e,void 0,O,y,n,o,t,_)}),Object.defineProperty(O,"_meta",{value:{allPristine:b,allValid:g,values:v,errors:h,formError:m}}),O};e.default=p,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},n=function(t,e){var n=r({},t);return delete n[e],n},u=function o(t,e){var u=e.indexOf("."),i=e.indexOf("["),a=e.indexOf("]");if(i>0&&a!==i+1)throw new Error("found [ not followed by ]");if(i>0&&(0>u||u>i)){var s,f=function(){var u=e.substring(0,i);if(!Array.isArray(t[u]))return{v:n(t,u)};var f=e.substring(a+1);if("."===f[0]&&(f=f.substring(1)),f){var c=function(){var e=[];return t[u].forEach(function(t,r){var n=o(t,f);Object.keys(n).length&&(e[r]=n)}),{v:{v:e.length?r({},t,(s={},s[u]=e,s)):n(t,u)}}}();if("object"==typeof c)return c.v}return{v:n(t,u)}}();if("object"==typeof f)return f.v}if(u>0){var c,l=e.substring(0,u),d=e.substring(u+1);if(!t[l])return t;var p=o(t[l],d);return Object.keys(p).length?r({},t,(c={},c[l]=o(t[l],d),c)):n(t,l)}return n(t,e)};e.default=u,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r=function(t){return void 0===t||t&&void 0===t.initial?{}:{initial:t.initial,value:t.initial}},n=function(t){return t&&"object"==typeof t&&(void 0!==t.value||void 0!==t.initial)},u=function o(t){return t?Object.keys(t).reduce(function(e,u){var i=t[u];return Array.isArray(i)?e[u]=i.map(function(t){return n(t)?r(t):o(t)}):i&&(n(i)?e[u]=r(i):"object"==typeof i&&null!==i?e[u]=o(i):e[u]=i),e},{}):t};e.default=u,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},n=function(t){return"_"===t[0]},u=function o(t,e,u){for(var i=!0;i;){var a=t,s=e,f=u;i=!1;var c=function(){return Array.isArray(a)?a.map(function(t,e){return o(t,s&&s[e],f)}):a&&"object"==typeof a?Object.keys(a).reduce(function(t,e){var u;return n(e)?t:r({},t,(u={},u[e]=o(a[e],s&&s[e],f),u))},a):a};if(!s){if(a[f]){var l=r({},a);return delete l[f],l}return c()}if("string"==typeof s){var d;return r({},a,(d={},d[f]=s,d))}{if(!Array.isArray(s))return Object.keys(s).reduce(function(t,e){var u;return n(e)?t:r({},t,(u={},u[e]=o(a&&a[e],s[e],f),u))},c()||{});if(!a||Array.isArray(a)){var p=function(){var t=(a||[]).map(function(t,e){return o(t,s[e],f)});return s.forEach(function(e,r){return t[r]=o(t[r],e,f)}),{v:t}}();if("object"==typeof p)return p.v}t=a,e=s[0],u=f,i=!0,c=l=d=p=void 0}}};e.default=u,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(4),o=n(u),i=function(){},a=function(t){return o.default(t)?t.then(i,i):t};e.default=a,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o=r(39),i=n(o),a=r(1),s=n(a),f=function(t,e,r,n){var o={};t.value!==e.value&&(o.value=e.value,o.checked="boolean"==typeof e.value?e.value:void 0);var a=i.default(e.value,e.initial);t.pristine!==a&&(o.dirty=!a,o.pristine=a);var f=n||e.submitError||e.asyncError;f!==t.error&&(o.error=f);var c=s.default(f);t.valid!==c&&(o.invalid=!c,o.valid=c),r!==t.active&&(o.active=r);var l=!!e.touched;l!==t.touched&&(o.touched=l);var d=!!e.visited;return d!==t.visited&&(o.visited=d),Object.keys(o).length?u({},t,o):t};e.default=f,t.exports=e.default},function(t,e,r){"use strict";e.__esModule=!0;var n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},u=r(21),o=function(t,e){return t?"function"==typeof t?t.length>1?function(r,o){return n({},t(r,o),u.bindActionCreators(e,r),{dispatch:r})}:function(r){return n({},t(r),u.bindActionCreators(e,r),{dispatch:r})}:function(r){return n({},u.bindActionCreators(t,r),u.bindActionCreators(e,r),{dispatch:r})}:function(t){return n({},u.bindActionCreators(e,t),{dispatch:t})}};e.default=o,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},n=function(t,e){if(t){if("function"!=typeof t)throw new Error("mapStateToProps must be a function");return t.length>1?function(n,u){return r({},t(n,u),{form:e(n)})}:function(n){return r({},t(n),{form:e(n)})}}return function(t){return{form:e(t)}}};e.default=n,t.exports=e.default},function(t,e){function r(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function n(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}var u="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();e=t.exports=u?r:n,e.supported=r,e.unsupported=n},function(t,e){function r(t){var e=[];for(var r in t)e.push(r);return e}e=t.exports="function"==typeof Object.keys?Object.keys:r,e.shim=r},function(t,e,r){"use strict";var n=function(t,e,r,n,u,o,i,a){if(!t){var s;if(void 0===e)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[r,n,u,o,i,a],c=0;s=new Error(e.replace(/%s/g,function(){return f[c++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}};t.exports=n},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(53),o=n(u);e.default=o.default,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){var r=[],n={},u={},o=function a(t){Object.keys(n).forEach(function(e){~n[e].props.indexOf(t)&&(delete n[e].value,a(e))})};return Object.keys(e).forEach(function(o){var i=e[o].fn,a=e[o].params;a.forEach(function(t){~r.indexOf(t)||r.push(t)}),n[o]={props:a},Object.defineProperty(u,o,{get:function(){var e=n[o];if(e&&void 0!==e.value)return e.value;var r=a.map(function(e){return t.props[e]||u[e]}),s=i.apply(void 0,r);return n[o]={props:a,value:s},s}})}),u.componentWillReceiveProps=function(e){var n=[];r.forEach(function(r){i.default(t.props[r],e[r])||n.push(r)}),n.forEach(o)},u}e.__esModule=!0,e.default=u;var o=r(17),i=n(o);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t){var e=i.default(t),r=s.default(t);return{Provider:e,connect:r}}e.__esModule=!0,e.default=u;var o=r(56),i=n(o),a=r(55),s=n(a);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function i(t){return t.displayName||t.name||"Component"}function a(t){var e=t.Component,r=t.PropTypes,n=c.default(r);return function(r,a,f){function c(t,e){var r=t.getState(),n=w?b(r,e):b(r);return _.default(v.default(n),"`mapStateToProps` must return an object. Instead received %s.",n),n}function l(t,e){var r=t.dispatch,n=M?S(r,e):S(r);return _.default(v.default(n),"`mapDispatchToProps` must return an object. Instead received %s.",n),n}function p(t,e,r){var n=T(t,e,r);return _.default(v.default(n),"`mergeProps` must return an object. Instead received %s.",n),n}var y=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],m=Boolean(r),b=r||O,S=v.default(a)?h.default(a):a||x,T=f||A,w=b.length>1,M=S.length>1,R=y.pure,E=void 0===R?!0:R,P=j++;return function(r){var a=function(e){function n(t,r){u(this,n),e.call(this,t,r),this.version=P,this.store=t.store||r.store,_.default(this.store,'Could not find "store" in either the context or '+('props of "'+this.constructor.displayName+'". ')+"Either wrap the root component in a <Provider>, "+('or explicitly pass "store" as a prop to "'+this.constructor.displayName+'".')),this.stateProps=c(this.store,t),this.dispatchProps=l(this.store,t),this.state={storeState:null},this.updateState()}return o(n,e),n.prototype.shouldComponentUpdate=function(t,e){if(!E)return this.updateStateProps(t),this.updateDispatchProps(t),this.updateState(t),!0;var r=e.storeState!==this.state.storeState,n=!d.default(t,this.props),u=!1,o=!1;return(r||n&&w)&&(u=this.updateStateProps(t)),n&&M&&(o=this.updateDispatchProps(t)),n||u||o?(this.updateState(t),!0):!1},n.prototype.computeNextState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0];return p(this.stateProps,this.dispatchProps,t)},n.prototype.updateStateProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=c(this.store,t);return d.default(e,this.stateProps)?!1:(this.stateProps=e,!0)},n.prototype.updateDispatchProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=l(this.store,t);return d.default(e,this.dispatchProps)?!1:(this.dispatchProps=e,!0)},n.prototype.updateState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0];this.nextState=this.computeNextState(t)},n.prototype.isSubscribed=function(){return"function"==typeof this.unsubscribe},n.prototype.trySubscribe=function(){m&&!this.unsubscribe&&(this.unsubscribe=this.store.subscribe(this.handleChange.bind(this)),this.handleChange())},n.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},n.prototype.componentDidMount=function(){this.trySubscribe()},n.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},n.prototype.handleChange=function(){this.unsubscribe&&this.setState({storeState:this.store.getState()})},n.prototype.getWrappedInstance=function(){return this.refs.wrappedInstance},n.prototype.render=function(){return t.createElement(r,s({ref:"wrappedInstance"},this.nextState))},n}(e);return a.displayName="Connect("+i(r)+")",a.WrappedComponent=r,a.contextTypes={store:n},a.propTypes={store:n},g.default(a,r)}}}e.__esModule=!0;var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=a;var f=r(19),c=n(f),l=r(59),d=n(l),p=r(58),v=n(p),y=r(60),h=n(y),m=r(18),g=n(m),b=r(51),_=n(b),O=function(){return{}},x=function(t){return{dispatch:t}},A=function(t,e,r){return s({},r,t,e)},j=0;t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function i(t){var e=t.version;if("string"!=typeof e)return!0;var r=e.split("."),n=parseInt(r[0],10),u=parseInt(r[1],10);return 0===n&&13===u}function a(t){function e(){p||d||(p=!0,console.error("With React 0.14 and later versions, you no longer need to wrap <Provider> child into a function."))}function r(){!p&&d&&(p=!0,console.error("With React 0.13, you need to wrap <Provider> child into a function. This restriction will be removed with React 0.14."))}function n(){v||(v=!0,console.error("<Provider> does not support changing `store` on the fly. It is most likely that you see this error because you updated to Redux 2.x and React Redux 2.x which no longer hot reload reducers automatically. See https://github.com/rackt/react-redux/releases/tag/v2.0.0 for the migration instructions."))}var a=t.Component,s=t.PropTypes,c=t.Children,l=f.default(s),d=i(t),p=!1,v=!1,y=function(t){function i(e,r){u(this,i),t.call(this,e,r),this.store=e.store}return o(i,t),i.prototype.getChildContext=function(){return{store:this.store}},i.prototype.componentWillReceiveProps=function(t){var e=this.store,r=t.store;e!==r&&n()},i.prototype.render=function(){var t=this.props.children;return"function"==typeof t?(e(),t=t()):r(),c.only(t)},i}(a);return y.childContextTypes={store:l.isRequired},y.propTypes={store:l.isRequired,children:(d?s.func:s.element).isRequired},y}e.__esModule=!0,e.default=a;var s=r(19),f=n(s);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(25),o=n(u),i=r(54),a=n(i),s=a.default(o.default),f=s.Provider,c=s.connect;e.Provider=f,e.connect=c},function(t,e){"use strict";function r(t){if(!t||"object"!=typeof t)return!1;var e="function"==typeof t.constructor?Object.getPrototypeOf(t):Object.prototype;if(null===e)return!0;var r=e.constructor;return"function"==typeof r&&r instanceof r&&n(r)===n(Object)}e.__esModule=!0,e.default=r;var n=function(t){return Function.prototype.toString.call(t)};t.exports=e.default},function(t,e){"use strict";function r(t,e){if(t===e)return!0;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(var u=Object.prototype.hasOwnProperty,o=0;o<r.length;o++)if(!u.call(e,r[o])||t[r[o]]!==e[r[o]])return!1;return!0}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return function(e){return u.bindActionCreators(t,e)}}e.__esModule=!0,e.default=n;var u=r(21);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return function(t){return function(r,n){var u=t(r,n),i=u.dispatch,s=[],f={getState:u.getState,dispatch:function(t){return i(t)}};return s=e.map(function(t){return t(f)}),i=a.default.apply(void 0,s)(u.dispatch),o({},u,{dispatch:i})}}}e.__esModule=!0;var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=u;var i=r(22),a=n(i);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){return function(){return e(t.apply(void 0,arguments))}}function o(t,e){if("function"==typeof t)return u(t,e);if("object"!=typeof t||null===t||void 0===t)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===t?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');return a.default(t,function(t){return u(t,e)})}e.__esModule=!0,e.default=o;var i=r(24),a=n(i);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){var r=e&&e.type,n=r&&'"'+r.toString()+'"'||"an action";return'Reducer "'+t+'" returned undefined handling '+n+". To ignore an action, you must explicitly return the previous state."}function o(t){Object.keys(t).forEach(function(e){var r=t[e],n=r(void 0,{type:a.ActionTypes.INIT});if("undefined"==typeof n)throw new Error('Reducer "'+e+'" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined.');var u="@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".");if("undefined"==typeof r(void 0,{type:u}))throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+a.ActionTypes.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined.")})}function i(t){var e,r=d.default(t,function(t){return"function"==typeof t});try{o(r)}catch(n){e=n}var i=c.default(r,function(){});return function(t,n){if(void 0===t&&(t=i),e)throw e;var o=!1,a=c.default(r,function(e,r){var i=t[r],a=e(i,n);if("undefined"==typeof a){var s=u(r,n);throw new Error(s)}return o=o||a!==i,a});return o?a:t}}e.__esModule=!0,e.default=i;var a=r(20),s=r(23),f=(n(s),r(24)),c=n(f),l=r(64),d=n(l);t.exports=e.default},function(t,e){"use strict";function r(t,e){return Object.keys(t).reduce(function(r,n){return e(t[n])&&(r[n]=t[n]),r},{})}e.__esModule=!0,e.default=r,t.exports=e.default}])});
|
docs/client.js
|
pandoraui/react-bootstrap
|
import 'bootstrap/less/bootstrap.less';
import './assets/docs.css';
import './assets/style.css';
import './assets/carousel.png';
import './assets/logo.png';
import './assets/favicon.ico';
import './assets/thumbnail.png';
import './assets/thumbnaildiv.png';
import 'codemirror/mode/htmlmixed/htmlmixed';
import 'codemirror/mode/javascript/javascript';
import 'codemirror/theme/solarized.css';
import 'codemirror/lib/codemirror.css';
import './assets/CodeMirror.css';
import React from 'react';
import CodeMirror from 'codemirror';
import 'codemirror/addon/runmode/runmode';
import Router from 'react-router';
import routes from './src/Routes';
global.CodeMirror = CodeMirror;
Router.run(routes, Router.RefreshLocation, Handler => {
React.render(
React.createElement(Handler, window.INITIAL_PROPS), document);
});
|
ajax/libs/forerunnerdb/1.3.30/fdb-core+views.min.js
|
kiwi89/cdnjs
|
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){{var d=a("../lib/Core");a("../lib/View")}"undefined"!=typeof window&&(window.ForerunnerDB=d),b.exports=d},{"../lib/Core":5,"../lib/View":24}],2:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a){var b;this._primaryKey="_id",this._keyArr=[],this._data=[],this._objLookup={},this._count=0;for(b in a)a.hasOwnProperty(b)&&this._keyArr.push({key:b,dir:a[b]})};d.addModule("ActiveBucket",e),d.synthesize(e.prototype,"primaryKey"),d.mixin(e.prototype,"Mixin.Sorting"),e.prototype.qs=function(a,b,c,d){if(!b.length)return 0;for(var e,f,g,h=-1,i=0,j=b.length-1;j>=i&&(e=Math.floor((i+j)/2),h!==e);)f=b[e],void 0!==f&&(g=d(this,a,c,f),g>0&&(i=e+1),0>g&&(j=e-1)),h=e;return g>0?e+1:e},e.prototype._sortFunc=function(a,b,c,d){var e,f,g,h=c.split(".:."),i=d.split(".:."),j=a._keyArr,k=j.length;for(e=0;k>e;e++)if(f=j[e],g=typeof b[f.key],"number"===g&&(h[e]=Number(h[e]),i[e]=Number(i[e])),h[e]!==i[e]){if(1===f.dir)return a.sortAsc(h[e],i[e]);if(-1===f.dir)return a.sortDesc(h[e],i[e])}},e.prototype.insert=function(a){var b,c;return b=this.documentKey(a),c=this._data.indexOf(b),-1===c?(c=this.qs(a,this._data,b,this._sortFunc),this._data.splice(c,0,b)):this._data.splice(c,0,b),this._objLookup[a[this._primaryKey]]=b,this._count++,c},e.prototype.remove=function(a){var b,c;return b=this._objLookup[a[this._primaryKey]],b?(c=this._data.indexOf(b),c>-1?(this._data.splice(c,1),delete this._objLookup[a[this._primaryKey]],this._count--,!0):!1):!1},e.prototype.index=function(a){var b,c;return b=this.documentKey(a),c=this._data.indexOf(b),-1===c&&(c=this.qs(a,this._data,b,this._sortFunc)),c},e.prototype.documentKey=function(a){var b,c,d="",e=this._keyArr,f=e.length;for(b=0;f>b;b++)c=e[b],d&&(d+=".:."),d+=a[c.key];return d+=".:."+a[this._primaryKey]},e.prototype.count=function(){return this._count},d.finishModule("ActiveBucket"),b.exports=e},{"./Shared":23}],3:[function(a,b,c){"use strict";var d,e,f,g,h,i,j,k,l,m;d=a("./Shared");var n=function(a){this.init.apply(this,arguments)};n.prototype.init=function(a){this._primaryKey="_id",this._primaryIndex=new g("primary"),this._primaryCrc=new g("primaryCrc"),this._crcLookup=new g("crcLookup"),this._name=a,this._data=[],this._metrics=new f,this._deferQueue={insert:[],update:[],remove:[],upsert:[]},this._deferThreshold={insert:100,update:100,remove:100,upsert:100},this._deferTime={insert:1,update:1,remove:1,upsert:1},this._subsetOf(this)},d.addModule("Collection",n),d.mixin(n.prototype,"Mixin.Common"),d.mixin(n.prototype,"Mixin.Events"),d.mixin(n.prototype,"Mixin.ChainReactor"),d.mixin(n.prototype,"Mixin.CRUD"),d.mixin(n.prototype,"Mixin.Constants"),d.mixin(n.prototype,"Mixin.Triggers"),d.mixin(n.prototype,"Mixin.Sorting"),d.mixin(n.prototype,"Mixin.Matching"),f=a("./Metrics"),g=a("./KeyValueStore"),h=a("./Path"),i=a("./IndexHashMap"),j=a("./IndexBinaryTree"),k=a("./Crc"),e=d.modules.Core,l=a("./Overload"),m=a("./ReactorIO"),n.prototype.crc=k,d.synthesize(n.prototype,"state"),d.synthesize(n.prototype,"name"),n.prototype.data=function(){return this._data},n.prototype.drop=function(){var a;if("dropped"===this._state)return!0;if(this._db&&this._db._collection&&this._name){if(this.debug()&&console.log("Dropping collection "+this._name),this._state="dropped",this.emit("drop",this),delete this._db._collection[this._name],this._collate)for(a in this._collate)this._collate.hasOwnProperty(a)&&this.collateRemove(a);return delete this._primaryKey,delete this._primaryIndex,delete this._primaryCrc,delete this._crcLookup,delete this._name,delete this._data,delete this._metrics,!0}return!1},n.prototype.primaryKey=function(a){return void 0!==a?(this._primaryKey!==a&&(this._primaryKey=a,this._primaryIndex.primaryKey(a),this.rebuildPrimaryKeyIndex()),this):this._primaryKey},n.prototype._onInsert=function(a,b){this.emit("insert",a,b)},n.prototype._onUpdate=function(a){this.emit("update",a)},n.prototype._onRemove=function(a){this.emit("remove",a)},d.synthesize(n.prototype,"db",function(a){return a&&"_id"===this.primaryKey()&&this.primaryKey(a.primaryKey()),this.$super.apply(this,arguments)}),n.prototype.setData=function(a,b,c){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';if(a){var d=this._metrics.create("setData");d.start(),b=this.options(b),this.preSetData(a,b,c),b.$decouple&&(a=this.decouple(a)),a instanceof Array||(a=[a]),d.time("transformIn"),a=this.transformIn(a),d.time("transformIn");var e=[].concat(this._data);this._dataReplace(a),d.time("Rebuild Primary Key Index"),this.rebuildPrimaryKeyIndex(b),d.time("Rebuild Primary Key Index"),d.time("Rebuild All Other Indexes"),this._rebuildIndexes(),d.time("Rebuild All Other Indexes"),d.time("Resolve chains"),this.chainSend("setData",a,{oldData:e}),d.time("Resolve chains"),d.stop(),this.emit("setData",this._data,e)}return c&&c(!1),this},n.prototype.rebuildPrimaryKeyIndex=function(a){a=a||{$ensureKeys:void 0,$violationCheck:void 0};var b,c,d,e,f=a&&void 0!==a.$ensureKeys?a.$ensureKeys:!0,g=a&&void 0!==a.$violationCheck?a.$violationCheck:!0,h=this._primaryIndex,i=this._primaryCrc,j=this._crcLookup,k=this._primaryKey;for(h.truncate(),i.truncate(),j.truncate(),b=this._data,c=b.length;c--;){if(d=b[c],f&&this.ensurePrimaryKey(d),g){if(!h.uniqueSet(d[k],d))throw'ForerunnerDB.Collection "'+this.name()+'": Call to setData on collection failed because your data violates the primary key unique constraint. One or more documents are using the same primary key: '+d[this._primaryKey]}else h.set(d[k],d);e=JSON.stringify(d),i.set(d[k],e),j.set(e,d)}},n.prototype.ensurePrimaryKey=function(a){void 0===a[this._primaryKey]&&(a[this._primaryKey]=this.objectId())},n.prototype.truncate=function(){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';return this.emit("truncate",this._data),this._data.length=0,this._primaryIndex=new g("primary"),this._primaryCrc=new g("primaryCrc"),this._crcLookup=new g("crcLookup"),this.deferEmit("change",{type:"truncate"}),this},n.prototype.upsert=function(a,b){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';if(a){var c,d,e=this._deferQueue.upsert,f=this._deferThreshold.upsert,g={};if(a instanceof Array){if(a.length>f)return this._deferQueue.upsert=e.concat(a),this.processQueue("upsert",b),{};for(g=[],d=0;d<a.length;d++)g.push(this.upsert(a[d]));return b&&b(),g}switch(a[this._primaryKey]?(c={},c[this._primaryKey]=a[this._primaryKey],this._primaryIndex.lookup(c)[0]?g.op="update":g.op="insert"):g.op="insert",g.op){case"insert":g.result=this.insert(a);break;case"update":g.result=this.update(c,a)}return g}return b&&b(),{}},n.prototype.update=function(a,b,c){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';b=this.decouple(b),b=this.transformIn(b),this.debug()&&console.log('Updating some collection data for collection "'+this.name()+'"');var d,e,f=this,g=this._metrics.create("update"),h=function(d){var e,h,i=f.decouple(d);return f.willTrigger(f.TYPE_UPDATE,f.PHASE_BEFORE)||f.willTrigger(f.TYPE_UPDATE,f.PHASE_AFTER)?(e={type:"update",query:f.decouple(a),update:f.decouple(b),options:f.decouple(c),op:g},h=f.updateObject(i,e.update,e.query,e.options,""),f.processTrigger(e,f.TYPE_UPDATE,f.PHASE_BEFORE,d,i)!==!1?(h=f.updateObject(d,i,e.query,e.options,""),f.processTrigger(e,f.TYPE_UPDATE,f.PHASE_AFTER,d,i)):h=!1):h=f.updateObject(d,b,a,c,""),h};return g.start(),g.time("Retrieve documents to update"),d=this.find(a,{$decouple:!1}),g.time("Retrieve documents to update"),d.length&&(g.time("Update documents"),e=d.filter(h),g.time("Update documents"),e.length&&(g.time("Resolve chains"),this.chainSend("update",{query:a,update:b,dataSet:d},c),g.time("Resolve chains"),this._onUpdate(e),this.deferEmit("change",{type:"update",data:e}))),g.stop(),e||[]},n.prototype._replaceObj=function(a,b){var c;this._removeFromIndexes(a);for(c in a)a.hasOwnProperty(c)&&delete a[c];for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);if(!this._insertIntoIndexes(a))throw'ForerunnerDB.Collection "'+this.name()+'": Primary key violation in update! Key violated: '+a[this._primaryKey];return!0},n.prototype.updateById=function(a,b){var c={};return c[this._primaryKey]=a,this.update(c,b)},n.prototype.updateObject=function(a,b,c,d,e,f){b=this.decouple(b),e=e||"","."===e.substr(0,1)&&(e=e.substr(1,e.length-1));var g,i,j,k,l,m,n,o,p,q=!1,r=!1;for(p in b)if(b.hasOwnProperty(p)){if(g=!1,"$"===p.substr(0,1))switch(p){case"$key":case"$index":g=!0;break;default:g=!0,r=this.updateObject(a,b[p],c,d,e,p),q=q||r}if(this._isPositionalKey(p)&&(g=!0,p=p.substr(0,p.length-2),m=new h(e+"."+p),a[p]&&a[p]instanceof Array&&a[p].length)){for(i=[],j=0;j<a[p].length;j++)this._match(a[p][j],m.value(c)[0],"",{})&&i.push(j);for(j=0;j<i.length;j++)r=this.updateObject(a[p][i[j]],b[p+".$"],c,d,e+"."+p,f),q=q||r}if(!g)if(f||"object"!=typeof b[p])switch(f){case"$inc":this._updateIncrement(a,p,b[p]),q=!0;break;case"$push":if(void 0===a[p]&&this._updateProperty(a,p,[]),!(a[p]instanceof Array))throw'ForerunnerDB.Collection "'+this.name()+'": Cannot push to a key that is not an array! ('+p+")";if(void 0!==b[p].$position&&b[p].$each instanceof Array)for(l=b[p].$position,k=b[p].$each.length,j=0;k>j;j++)this._updateSplicePush(a[p],l+j,b[p].$each[j]);else if(b[p].$each instanceof Array)for(k=b[p].$each.length,j=0;k>j;j++)this._updatePush(a[p],b[p].$each[j]);else this._updatePush(a[p],b[p]);q=!0;break;case"$pull":if(a[p]instanceof Array){for(i=[],j=0;j<a[p].length;j++)this._match(a[p][j],b[p],"",{})&&i.push(j);for(k=i.length;k--;)this._updatePull(a[p],i[k]),q=!0}break;case"$pullAll":if(a[p]instanceof Array){if(!(b[p]instanceof Array))throw'ForerunnerDB.Collection "'+this.name()+'": Cannot pullAll without being given an array of values to pull! ('+p+")";if(i=a[p],k=i.length,k>0)for(;k--;){for(l=0;l<b[p].length;l++)i[k]===b[p][l]&&(this._updatePull(a[p],k),k--,q=!0);if(0>k)break}}break;case"$addToSet":if(void 0===a[p]&&this._updateProperty(a,p,[]),!(a[p]instanceof Array))throw'ForerunnerDB.Collection "'+this.name()+'": Cannot addToSet on a key that is not an array! ('+p+")";var s,t,u,v,w=a[p],x=w.length,y=!0,z=d&&d.$addToSet;for(b[p].$key?(u=!1,v=new h(b[p].$key),t=v.value(b[p])[0],delete b[p].$key):z&&z.key?(u=!1,v=new h(z.key),t=v.value(b[p])[0]):(t=JSON.stringify(b[p]),u=!0),s=0;x>s;s++)if(u){if(JSON.stringify(w[s])===t){y=!1;break}}else if(t===v.value(w[s])[0]){y=!1;break}y&&(this._updatePush(a[p],b[p]),q=!0);break;case"$splicePush":if(void 0===a[p]&&this._updateProperty(a,p,[]),!(a[p]instanceof Array))throw'ForerunnerDB.Collection "'+this.name()+'": Cannot splicePush with a key that is not an array! ('+p+")";if(l=b.$index,void 0===l)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot splicePush without a $index integer value!';delete b.$index,l>a[p].length&&(l=a[p].length),this._updateSplicePush(a[p],l,b[p]),q=!0;break;case"$move":if(!(a[p]instanceof Array))throw'ForerunnerDB.Collection "'+this.name()+'": Cannot move on a key that is not an array! ('+p+")";for(j=0;j<a[p].length;j++)if(this._match(a[p][j],b[p],"",{})){var A=b.$index;if(void 0===A)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot move without a $index integer value!';delete b.$index,this._updateSpliceMove(a[p],j,A),q=!0;break}break;case"$mul":this._updateMultiply(a,p,b[p]),q=!0;break;case"$rename":this._updateRename(a,p,b[p]),q=!0;break;case"$unset":this._updateUnset(a,p),q=!0;break;case"$pop":if(!(a[p]instanceof Array))throw'ForerunnerDB.Collection "'+this.name()+'": Cannot pop from a key that is not an array! ('+p+")";this._updatePop(a[p],b[p])&&(q=!0);break;default:a[p]!==b[p]&&(this._updateProperty(a,p,b[p]),q=!0)}else if(null!==a[p]&&"object"==typeof a[p])if(n=a[p]instanceof Array,o=b[p]instanceof Array,n||o)if(!o&&n)for(j=0;j<a[p].length;j++)r=this.updateObject(a[p][j],b[p],c,d,e+"."+p,f),q=q||r;else a[p]!==b[p]&&(this._updateProperty(a,p,b[p]),q=!0);else r=this.updateObject(a[p],b[p],c,d,e+"."+p,f),q=q||r;else a[p]!==b[p]&&(this._updateProperty(a,p,b[p]),q=!0)}return q},n.prototype._isPositionalKey=function(a){return".$"===a.substr(a.length-2,2)},n.prototype._updateProperty=function(a,b,c){a[b]=c,this.debug()&&console.log('ForerunnerDB.Collection: Setting non-data-bound document property "'+b+'" for collection "'+this.name()+'"')},n.prototype._updateIncrement=function(a,b,c){a[b]+=c},n.prototype._updateSpliceMove=function(a,b,c){a.splice(c,0,a.splice(b,1)[0]),this.debug()&&console.log('ForerunnerDB.Collection: Moving non-data-bound document array index from "'+b+'" to "'+c+'" for collection "'+this.name()+'"')},n.prototype._updateSplicePush=function(a,b,c){a.length>b?a.splice(b,0,c):a.push(c)},n.prototype._updatePush=function(a,b){a.push(b)},n.prototype._updatePull=function(a,b){a.splice(b,1)},n.prototype._updateMultiply=function(a,b,c){a[b]*=c},n.prototype._updateRename=function(a,b,c){a[c]=a[b],delete a[b]},n.prototype._updateUnset=function(a,b){delete a[b]},n.prototype._updatePop=function(a,b){var c=!1;return a.length>0&&(1===b?(a.pop(),c=!0):-1===b&&(a.shift(),c=!0)),c},n.prototype.remove=function(a,b,c){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';var d,e,f,g,h,i,j,k,l=this;if(a instanceof Array){for(g=[],f=0;f<a.length;f++)g.push(this.remove(a[f],{noEmit:!0}));return(!b||b&&!b.noEmit)&&this._onRemove(g),c&&c(!1,g),g}if(d=this.find(a,{$decouple:!1}),d.length){h=function(a){l._removeFromIndexes(a),e=l._data.indexOf(a),l._dataRemoveAtIndex(e)};for(var m=0;m<d.length;m++)j=d[m],l.willTrigger(l.TYPE_REMOVE,l.PHASE_BEFORE)||l.willTrigger(l.TYPE_REMOVE,l.PHASE_AFTER)?(i={type:"remove"},k=l.decouple(j),l.processTrigger(i,l.TYPE_REMOVE,l.PHASE_BEFORE,k,k)!==!1&&(h(j),l.processTrigger(i,l.TYPE_REMOVE,l.PHASE_AFTER,k,k))):h(j);this.chainSend("remove",{query:a,dataSet:d},b),(!b||b&&!b.noEmit)&&this._onRemove(d),this.deferEmit("change",{type:"remove",data:d})}return c&&c(!1,d),d},n.prototype.removeById=function(a){var b={};return b[this._primaryKey]=a,this.remove(b)},n.prototype.deferEmit=function(){var a,b=this;this._noEmitDefer||this._db&&(!this._db||this._db._noEmitDefer)?this.emit.apply(this,arguments):(a=arguments,this._changeTimeout&&clearTimeout(this._changeTimeout),this._changeTimeout=setTimeout(function(){b.debug()&&console.log("ForerunnerDB.Collection: Emitting "+a[0]),b.emit.apply(b,a)},100))},n.prototype.processQueue=function(a,b){var c=this._deferQueue[a],d=this._deferThreshold[a],e=this._deferTime[a];if(c.length){var f,g=this;c.length&&(f=c.length>d?c.splice(0,d):c.splice(0,c.length),this[a](f)),setTimeout(function(){g.processQueue(a,b)},e)}else b&&b()},n.prototype.insert=function(a,b,c){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';return"function"==typeof b?(c=b,b=this._data.length):void 0===b&&(b=this._data.length),a=this.transformIn(a),this._insertHandle(a,b,c)},n.prototype._insertHandle=function(a,b,c){var d,e,f=this._deferQueue.insert,g=this._deferThreshold.insert,h=[],i=[];if(a instanceof Array){if(a.length>g)return this._deferQueue.insert=f.concat(a),void this.processQueue("insert",c);for(e=0;e<a.length;e++)d=this._insert(a[e],b+e),d===!0?h.push(a[e]):i.push({doc:a[e],reason:d})}else d=this._insert(a,b),d===!0?h.push(a):i.push({doc:a,reason:d});return this.chainSend("insert",a,{index:b}),this._onInsert(h,i),c&&c(),this.deferEmit("change",{type:"insert",data:h}),{inserted:h,failed:i}},n.prototype._insert=function(a,b){if(a){var c,d,e,f,g=this;if(this.ensurePrimaryKey(a),c=this.insertIndexViolation(a),e=function(a){g._insertIntoIndexes(a),b>g._data.length&&(b=g._data.length),g._dataInsertAtIndex(b,a)},c)return"Index violation in index: "+c;if(g.willTrigger(g.TYPE_INSERT,g.PHASE_BEFORE)||g.willTrigger(g.TYPE_INSERT,g.PHASE_AFTER)){if(d={type:"insert"},g.processTrigger(d,g.TYPE_INSERT,g.PHASE_BEFORE,{},a)===!1)return!1;e(a),g.willTrigger(g.TYPE_INSERT,g.PHASE_AFTER)&&(f=g.decouple(a),g.processTrigger(d,g.TYPE_INSERT,g.PHASE_AFTER,{},f))}else e(a);return!0}return"No document passed to insert"},n.prototype._dataInsertAtIndex=function(a,b){this._data.splice(a,0,b)},n.prototype._dataRemoveAtIndex=function(a){this._data.splice(a,1)},n.prototype._dataReplace=function(a){for(;this._data.length;)this._data.pop();this._data=this._data.concat(a)},n.prototype._insertIntoIndexes=function(a){var b,c,d=this._indexByName,e=JSON.stringify(a);c=this._primaryIndex.uniqueSet(a[this._primaryKey],a),this._primaryCrc.uniqueSet(a[this._primaryKey],e),this._crcLookup.uniqueSet(e,a);for(b in d)d.hasOwnProperty(b)&&d[b].insert(a);return c},n.prototype._removeFromIndexes=function(a){var b,c=this._indexByName,d=JSON.stringify(a);this._primaryIndex.unSet(a[this._primaryKey]),this._primaryCrc.unSet(a[this._primaryKey]),this._crcLookup.unSet(d);for(b in c)c.hasOwnProperty(b)&&c[b].remove(a)},n.prototype._rebuildIndexes=function(){var a,b=this._indexByName;for(a in b)b.hasOwnProperty(a)&&b[a].rebuild()},n.prototype.indexOfDocById=function(a){return this._data.indexOf(this._primaryIndex.get(a[this._primaryKey]))},n.prototype.subset=function(a,b){var c=this.find(a,b);return(new n)._subsetOf(this).primaryKey(this._primaryKey).setData(c)},n.prototype.subsetOf=function(){return this.__subsetOf},n.prototype._subsetOf=function(a){return this.__subsetOf=a,this},n.prototype.distinct=function(a,b,c){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';var d,e,f=this.find(b,c),g=new h(a),i={},j=[];for(e=0;e<f.length;e++)d=g.value(f[e])[0],d&&!i[d]&&(i[d]=!0,j.push(d));return j},n.prototype.findById=function(a,b){var c={};return c[this._primaryKey]=a,this.find(c,b)[0]},n.prototype.peek=function(a,b){var c,d,e=this._data,f=e.length,g=new n,h=typeof a;if("string"===h){for(c=0;f>c;c++)d=JSON.stringify(e[c]),d.indexOf(a)>-1&&g.insert(e[c]);return g.find({},b)}return this.find(a,b)},n.prototype.explain=function(a,b){var c=this.find(a,b);return c.__fdbOp._data},n.prototype.options=function(a){return a=a||{},a.$decouple=void 0!==a.$decouple?a.$decouple:!0,a.$explain=void 0!==a.$explain?a.$explain:!1,a},n.prototype.find=function(a,b){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';a=a||{},b=this.options(b);var c,d,e,f,g,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C=this._metrics.create("find"),D=this.primaryKey(),E=this,F=!0,G={},H=[],I=[],J=[],K={},L=function(b){return E._match(b,a,"and",K)};if(C.start(),a){if(C.time("analyseQuery"),c=this._analyseQuery(a,b,C),C.time("analyseQuery"),C.data("analysis",c),c.hasJoin&&c.queriesJoin){for(C.time("joinReferences"),g=0;g<c.joinsOn.length;g++)k=c.joinsOn[g],j=new h(c.joinQueries[k]),i=j.value(a)[0],G[c.joinsOn[g]]=this._db.collection(c.joinsOn[g]).subset(i);C.time("joinReferences")}if(c.indexMatch.length&&(!b||b&&!b.$skipIndex)?(C.data("index.potential",c.indexMatch),C.data("index.used",c.indexMatch[0].index),C.time("indexLookup"),e=c.indexMatch[0].lookup,C.time("indexLookup"),c.indexMatch[0].keyData.totalKeyCount===c.indexMatch[0].keyData.score&&(F=!1)):C.flag("usedIndex",!1),F&&(e&&e.length?(d=e.length,C.time("tableScan: "+d),e=e.filter(L)):(d=this._data.length,C.time("tableScan: "+d),e=this._data.filter(L)),b.$orderBy&&(C.time("sort"),e=this.sort(b.$orderBy,e),C.time("sort")),C.time("tableScan: "+d)),b.$limit&&e&&e.length>b.$limit&&(e.length=b.$limit,C.data("limit",b.$limit)),b.$decouple&&(C.time("decouple"),e=this.decouple(e),C.time("decouple"),C.data("flag.decouple",!0)),b.$join){for(f=0;f<b.$join.length;f++)for(k in b.$join[f])if(b.$join[f].hasOwnProperty(k))for(s=k,l=this._db.collection(k),m=b.$join[f][k],t=0;t<e.length;t++){o={},p=!1,q=!1;for(n in m)if(m.hasOwnProperty(n))if("$"===n.substr(0,1))switch(n){case"$as":s=m[n];break;case"$multi":p=m[n];break;case"$require":q=m[n]}else o[n]=new h(m[n]).value(e[t])[0];r=l.find(o),!q||q&&r[0]?e[t][s]=p===!1?r[0]:r:H.push(e[t])}C.data("flag.join",!0)}if(H.length){for(C.time("removalQueue"),v=0;v<H.length;v++)u=e.indexOf(H[v]),u>-1&&e.splice(u,1);C.time("removalQueue")}if(b.$transform){for(C.time("transform"),v=0;v<e.length;v++)e.splice(v,1,b.$transform(e[v]));C.time("transform"),C.data("flag.transform",!0)}this._transformEnabled&&this._transformOut&&(C.time("transformOut"),e=this.transformOut(e),C.time("transformOut")),C.data("results",e.length)}else e=[];C.time("scanFields");for(v in b)b.hasOwnProperty(v)&&0!==v.indexOf("$")&&(1===b[v]?I.push(v):0===b[v]&&J.push(v));if(C.time("scanFields"),I.length||J.length){for(C.data("flag.limitFields",!0),C.data("limitFields.on",I),C.data("limitFields.off",J),C.time("limitFields"),v=0;v<e.length;v++){B=e[v];for(w in B)B.hasOwnProperty(w)&&(I.length&&w!==D&&-1===I.indexOf(w)&&delete B[w],J.length&&J.indexOf(w)>-1&&delete B[w])}C.time("limitFields")}if(b.$elemMatch){C.data("flag.elemMatch",!0),C.time("projection-elemMatch");for(v in b.$elemMatch)if(b.$elemMatch.hasOwnProperty(v))for(y=new h(v),w=0;w<e.length;w++)if(z=y.value(e[w])[0],z&&z.length)for(x=0;x<z.length;x++)if(E._match(z[x],b.$elemMatch[v],"",{})){y.set(e[w],v,[z[x]]);break}C.time("projection-elemMatch")}if(b.$elemsMatch){C.data("flag.elemsMatch",!0),C.time("projection-elemsMatch");for(v in b.$elemsMatch)if(b.$elemsMatch.hasOwnProperty(v))for(y=new h(v),w=0;w<e.length;w++)if(z=y.value(e[w])[0],z&&z.length){for(A=[],x=0;x<z.length;x++)E._match(z[x],b.$elemsMatch[v],"",{})&&A.push(z[x]);y.set(e[w],v,A)}C.time("projection-elemsMatch")}return C.stop(),e.__fdbOp=C,e},n.prototype.findOne=function(){return this.find.apply(this,arguments)[0]},n.prototype.indexOf=function(a){var b=this.find(a,{$decouple:!1})[0];return b?this._data.indexOf(b):void 0},n.prototype.transform=function(a){return void 0!==a?("object"==typeof a?(void 0!==a.enabled&&(this._transformEnabled=a.enabled),void 0!==a.dataIn&&(this._transformIn=a.dataIn),void 0!==a.dataOut&&(this._transformOut=a.dataOut)):this._transformEnabled=a!==!1,this):{enabled:this._transformEnabled,dataIn:this._transformIn,dataOut:this._transformOut}},n.prototype.transformIn=function(a){if(this._transformEnabled&&this._transformIn){if(a instanceof Array){var b,c=[];for(b=0;b<a.length;b++)c[b]=this._transformIn(a[b]);return c}return this._transformIn(a)}return a},n.prototype.transformOut=function(a){if(this._transformEnabled&&this._transformOut){if(a instanceof Array){var b,c=[];for(b=0;b<a.length;b++)c[b]=this._transformOut(a[b]);return c}return this._transformOut(a)}return a},n.prototype.sort=function(a,b){b=b||[];var c,d,e=[];for(c in a)a.hasOwnProperty(c)&&(d={},d[c]=a[c],d.___fdbKey=c,e.push(d));return e.length<2?this._sort(a,b):this._bucketSort(e,b)},n.prototype._bucketSort=function(a,b){var c,d,e,f=a.shift(),g=[];if(a.length>0){b=this._sort(f,b),d=this.bucket(f.___fdbKey,b);for(e in d)d.hasOwnProperty(e)&&(c=[].concat(a),g=g.concat(this._bucketSort(c,d[e])));return g}return this._sort(f,b)},n.prototype._sort=function(a,b){var c,d=this,e=new h,f=e.parse(a,!0)[0];if(e.path(f.path),1===f.value)c=function(a,b){var c=e.value(a)[0],f=e.value(b)[0];return d.sortAsc(c,f)};else{if(-1!==f.value)throw'ForerunnerDB.Collection "'+this.name()+'": $orderBy clause has invalid direction: '+f.value+", accepted values are 1 or -1 for ascending or descending!";c=function(a,b){var c=e.value(a)[0],f=e.value(b)[0];return d.sortDesc(c,f)}}return b.sort(c)},n.prototype.bucket=function(a,b){var c,d={};for(c=0;c<b.length;c++)d[b[c][a]]=d[b[c][a]]||[],d[b[c][a]].push(b[c]);return d},n.prototype._analyseQuery=function(a,b,c){var d,e,f,g,i,j,k,l,m,n,o,p={queriesOn:[this._name],indexMatch:[],hasJoin:!1,queriesJoin:!1,joinQueries:{},query:a,options:b},q=[],r=[];if(c.time("checkIndexes"),m=new h,n=m.countKeys(a)){void 0!==a[this._primaryKey]&&(c.time("checkIndexMatch: Primary Key"),p.indexMatch.push({lookup:this._primaryIndex.lookup(a,b),keyData:{matchedKeys:[this._primaryKey],totalKeyCount:n,score:1},index:this._primaryIndex}),c.time("checkIndexMatch: Primary Key"));for(o in this._indexById)if(this._indexById.hasOwnProperty(o)&&(j=this._indexById[o],k=j.name(),c.time("checkIndexMatch: "+k),i=j.match(a,b),i.score>0&&(l=j.lookup(a,b),p.indexMatch.push({lookup:l,keyData:i,index:j})),c.time("checkIndexMatch: "+k),i.score===n))break;c.time("checkIndexes"),p.indexMatch.length>1&&(c.time("findOptimalIndex"),p.indexMatch.sort(function(a,b){return a.keyData.score>b.keyData.score?-1:a.keyData.score<b.keyData.score?1:a.keyData.score===b.keyData.score?a.lookup.length-b.lookup.length:void 0}),c.time("findOptimalIndex"))}if(b.$join){for(p.hasJoin=!0,d=0;d<b.$join.length;d++)for(e in b.$join[d])b.$join[d].hasOwnProperty(e)&&(q.push(e),r.push("$as"in b.$join[d][e]?b.$join[d][e].$as:e));for(g=0;g<r.length;g++)f=this._queryReferencesCollection(a,r[g],""),f&&(p.joinQueries[q[g]]=f,p.queriesJoin=!0);p.joinsOn=q,p.queriesOn=p.queriesOn.concat(q)}return p},n.prototype._queryReferencesCollection=function(a,b,c){var d;for(d in a)if(a.hasOwnProperty(d)){if(d===b)return c&&(c+="."),c+d;if("object"==typeof a[d])return c&&(c+="."),c+=d,this._queryReferencesCollection(a[d],b,c)}return!1},n.prototype.count=function(a,b){return a?this.find(a,b).length:this._data.length},n.prototype.findSub=function(a,b,c,d){var e,f,g,i=new h(b),j=this.find(a),k=j.length,l=this._db.collection("__FDB_temp_"+this.objectId()),m={parents:k,subDocTotal:0,subDocs:[],pathFound:!1,err:""};for(e=0;k>e;e++)if(f=i.value(j[e])[0]){if(l.setData(f),g=l.find(c,d),d.returnFirst&&g.length)return g[0];m.subDocs.push(g),m.subDocTotal+=g.length,m.pathFound=!0}return l.drop(),d.noStats?m.subDocs:(m.pathFound||(m.err="No objects found in the parent documents with a matching path of: "+b),m)},n.prototype.insertIndexViolation=function(a){var b,c,d,e=this._indexByName;if(this._primaryIndex.get(a[this._primaryKey]))b=this._primaryIndex;else for(c in e)if(e.hasOwnProperty(c)&&(d=e[c],d.unique()&&d.violation(a))){b=d;break}return b?b.name():!1},n.prototype.ensureIndex=function(a,b){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';this._indexByName=this._indexByName||{},this._indexById=this._indexById||{};var c,d={start:(new Date).getTime()};if(b)switch(b.type){case"hashed":c=new i(a,b,this);break;case"btree":c=new j(a,b,this);break;default:c=new i(a,b,this)}else c=new i(a,b,this);return this._indexByName[c.name()]?{err:"Index with that name already exists"}:this._indexById[c.id()]?{err:"Index with those keys already exists"}:(c.rebuild(),this._indexByName[c.name()]=c,this._indexById[c.id()]=c,d.end=(new Date).getTime(),d.total=d.end-d.start,this._lastOp={type:"ensureIndex",stats:{time:d}},{index:c,id:c.id(),name:c.name(),state:c.state()})},n.prototype.index=function(a){return this._indexByName?this._indexByName[a]:void 0},n.prototype.lastOp=function(){return this._metrics.list()},n.prototype.diff=function(a){var b,c,d,e,f={insert:[],update:[],remove:[]},g=this.primaryKey();if(g!==a.primaryKey())throw'ForerunnerDB.Collection "'+this.name()+'": Collection diffing requires that both collections have the same primary key!';for(b=a._data;b&&!(b instanceof Array);)a=b,b=a._data;for(e=b.length,c=0;e>c;c++)d=b[c],this._primaryIndex.get(d[g])?this._primaryCrc.get(d[g])!==a._primaryCrc.get(d[g])&&f.update.push(d):f.insert.push(d);for(b=this._data,e=b.length,c=0;e>c;c++)d=b[c],a._primaryIndex.get(d[g])||f.remove.push(d);return f},n.prototype.collateAdd=function(a,b){if("string"==typeof a&&(a=this._db.collection(a,{autoCreate:!1,throwError:!1})),a)return this._collate=this._collate||{},this._collate[a.name()]=new m(a,this,b),this;throw"Cannot collate from a non-existent collection!"},n.prototype.collateRemove=function(a){if("object"==typeof a&&(a=a.name()),a)return this._collate[a].drop(),delete this._collate[a],this;throw"No collection name passed to collateRemove() or collection not found!"},e.prototype.collection=new l({object:function(a){return this.$main.call(this,a)},string:function(a){return this.$main.call(this,{name:a})},"string, string":function(a,b){return this.$main.call(this,{name:a,primaryKey:b})},"string, object":function(a,b){return b.name=a,this.$main.call(this,b)},"string, string, object":function(a,b,c){return c.name=a,c.primaryKey=b,this.$main.call(this,c)},$main:function(a){var b=a.name;if(b){if(!this._collection[b]){if(a&&a.autoCreate===!1&&a&&a.throwError!==!1)throw'ForerunnerDB.Core "'+this.name()+'": Cannot get collection '+b+" because it does not exist and auto-create has been disabled!";this.debug()&&console.log("Creating collection "+b)}return this._collection[b]=this._collection[b]||new n(b).db(this),void 0!==a.primaryKey&&this._collection[b].primaryKey(a.primaryKey),this._collection[b]}if(!a||a&&a.throwError!==!1)throw'ForerunnerDB.Core "'+this.name()+'": Cannot get collection with undefined name!'}}),e.prototype.collectionExists=function(a){return Boolean(this._collection[a])},e.prototype.collections=function(a){var b,c=[];a&&(a instanceof RegExp||(a=new RegExp(a)));for(b in this._collection)this._collection.hasOwnProperty(b)&&(a?a.exec(b)&&c.push({name:b,count:this._collection[b].count()}):c.push({name:b,count:this._collection[b].count()}));return c},d.finishModule("Collection"),b.exports=n},{"./Crc":6,"./IndexBinaryTree":7,"./IndexHashMap":8,"./KeyValueStore":9,"./Metrics":10,"./Overload":20,"./Path":21,"./ReactorIO":22,"./Shared":23}],4:[function(a,b,c){"use strict";var d,e,f,g;d=a("./Shared");var h=function(){this.init.apply(this,arguments)};h.prototype.init=function(a){var b=this;b._name=a,b._data=new g("__FDB__cg_data_"+b._name),b._collections=[],b._view=[]},d.addModule("CollectionGroup",h),d.mixin(h.prototype,"Mixin.Common"),d.mixin(h.prototype,"Mixin.ChainReactor"),d.mixin(h.prototype,"Mixin.Constants"),d.mixin(h.prototype,"Mixin.Triggers"),g=a("./Collection"),e=d.modules.Core,f=d.modules.Core.prototype.init,h.prototype.on=function(){this._data.on.apply(this._data,arguments)},h.prototype.off=function(){this._data.off.apply(this._data,arguments)},h.prototype.emit=function(){this._data.emit.apply(this._data,arguments)},h.prototype.primaryKey=function(a){return void 0!==a?(this._primaryKey=a,this):this._primaryKey},d.synthesize(h.prototype,"state"),d.synthesize(h.prototype,"db"),h.prototype.addCollection=function(a){if(a&&-1===this._collections.indexOf(a)){if(this._collections.length){if(this._primaryKey!==a.primaryKey())throw'ForerunnerDB.CollectionGroup "'+this.name()+'": All collections in a collection group must have the same primary key!'}else this.primaryKey(a.primaryKey());this._collections.push(a),a._groups=a._groups||[],a._groups.push(this),a.chain(this),a.on("drop",function(){if(a._groups&&a._groups.length){var b,c=[];for(b=0;b<a._groups.length;b++)c.push(a._groups[b]);for(b=0;b<c.length;b++)a._groups[b].removeCollection(a)}delete a._groups}),this._data.insert(a.find())}return this},h.prototype.removeCollection=function(a){if(a){var b,c=this._collections.indexOf(a);-1!==c&&(a.unChain(this),this._collections.splice(c,1),a._groups=a._groups||[],b=a._groups.indexOf(this),-1!==b&&a._groups.splice(b,1),a.off("drop")),0===this._collections.length&&delete this._primaryKey}return this},h.prototype._chainHandler=function(a){switch(a.type){case"setData":a.data=this.decouple(a.data),this._data.remove(a.options.oldData),this._data.insert(a.data);break;case"insert":a.data=this.decouple(a.data),this._data.insert(a.data);break;case"update":this._data.update(a.data.query,a.data.update,a.options);break;case"remove":this._data.remove(a.data.query,a.options);
}},h.prototype.insert=function(){this._collectionsRun("insert",arguments)},h.prototype.update=function(){this._collectionsRun("update",arguments)},h.prototype.updateById=function(){this._collectionsRun("updateById",arguments)},h.prototype.remove=function(){this._collectionsRun("remove",arguments)},h.prototype._collectionsRun=function(a,b){for(var c=0;c<this._collections.length;c++)this._collections[c][a].apply(this._collections[c],b)},h.prototype.find=function(a,b){return this._data.find(a,b)},h.prototype.removeById=function(a){for(var b=0;b<this._collections.length;b++)this._collections[b].removeById(a)},h.prototype.subset=function(a,b){var c=this.find(a,b);return(new g)._subsetOf(this).primaryKey(this._primaryKey).setData(c)},h.prototype.drop=function(){if("dropped"!==this._state){var a,b,c;if(this._debug&&console.log("Dropping collection group "+this._name),this._state="dropped",this._collections&&this._collections.length)for(b=[].concat(this._collections),a=0;a<b.length;a++)this.removeCollection(b[a]);if(this._view&&this._view.length)for(c=[].concat(this._view),a=0;a<c.length;a++)this._removeView(c[a]);this.emit("drop",this)}return!0},e.prototype.init=function(){this._collectionGroup={},f.apply(this,arguments)},e.prototype.collectionGroup=function(a){return a?(this._collectionGroup[a]=this._collectionGroup[a]||new h(a).db(this),this._collectionGroup[a]):this._collectionGroup},e.prototype.collectionGroups=function(){var a,b=[];for(a in this._collectionGroup)this._collectionGroup.hasOwnProperty(a)&&b.push({name:a});return b},b.exports=h},{"./Collection":3,"./Shared":23}],5:[function(a,b,c){"use strict";var d,e,f,g,h;d=a("./Shared"),h=a("./Overload");var i=function(a){this.init.apply(this,arguments)};i.prototype.init=function(a){this._primaryKey="_id",this._name=a,this._collection={},this._debug={}},i.prototype.moduleLoaded=new h({string:function(a){if(void 0!==a){a=a.replace(/ /g,"");var b,c=a.split(",");for(b=0;b<c.length;b++)if(!d.modules[c[b]])return!1;return!0}return!1},"string, function":function(a,b){if(void 0!==a){a=a.replace(/ /g,"");var c,e=a.split(",");for(c=0;c<e.length;c++)if(!d.modules[e[c]])return!1;b()}},"string, function, function":function(a,b,c){if(void 0!==a){a=a.replace(/ /g,"");var e,f=a.split(",");for(e=0;e<f.length;e++)if(!d.modules[f[e]])return c(),!1;b()}}}),i.prototype.version=function(a,b){return void 0!==a?0===d.version.indexOf(a)?(b&&b(),!0):!1:d.version},i.moduleLoaded=i.prototype.moduleLoaded,i.version=i.prototype.version,i.shared=d,i.prototype.shared=d,d.addModule("Core",i),d.mixin(i.prototype,"Mixin.Common"),d.mixin(i.prototype,"Mixin.ChainReactor"),d.mixin(i.prototype,"Mixin.Constants"),e=a("./Collection.js"),f=a("./Metrics.js"),g=a("./Crc.js"),i.prototype._isServer=!1,d.synthesize(i.prototype,"primaryKey"),d.synthesize(i.prototype,"state"),d.synthesize(i.prototype,"name"),i.prototype.isClient=function(){return!this._isServer},i.prototype.isServer=function(){return this._isServer},i.prototype.crc=g,i.prototype.isClient=function(){return!this._isServer},i.prototype.isServer=function(){return this._isServer},i.prototype.arrayToCollection=function(a){return(new e).setData(a)},i.prototype.on=function(a,b){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||[],this._listeners[a].push(b),this},i.prototype.off=function(a,b){if(a in this._listeners){var c=this._listeners[a],d=c.indexOf(b);d>-1&&c.splice(d,1)}return this},i.prototype.emit=function(a,b){if(this._listeners=this._listeners||{},a in this._listeners){var c,d=this._listeners[a],e=d.length;for(c=0;e>c;c++)d[c].apply(this,Array.prototype.slice.call(arguments,1))}return this},i.prototype.peek=function(a){var b,c,d=[],e=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],d=d.concat("string"===e?c.peek(a):c.find(a)));return d},i.prototype.peekCat=function(a){var b,c,d,e={},f=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],"string"===f?(d=c.peek(a),d&&d.length&&(e[c.name()]=d)):(d=c.find(a),d&&d.length&&(e[c.name()]=d)));return e},i.prototype.drop=function(a){if("dropped"!==this._state){var b,c=this.collections(),d=c.length,e=0,f=function(){e++,e===d&&a&&a()};for(this._state="dropped",b=0;d>b;b++)this.collection(c[b].name).drop(f),delete this._collection[c[b].name];this.emit("drop",this)}return!0},b.exports=i},{"./Collection.js":3,"./Crc.js":6,"./Metrics.js":10,"./Overload":20,"./Shared":23}],6:[function(a,b,c){"use strict";var d=function(){var a,b,c,d=[];for(b=0;256>b;b++){for(a=b,c=0;8>c;c++)a=1&a?3988292384^a>>>1:a>>>1;d[b]=a}return d}();b.exports=function(a){var b,c=-1;for(b=0;b<a.length;b++)c=c>>>8^d[255&(c^a.charCodeAt(b))];return(-1^c)>>>0}},{}],7:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(){},g=function(){this.init.apply(this,arguments)};g.prototype.init=function(a,b,c){this._btree=new(f.create(2,this.sortAsc)),this._size=0,this._id=this._itemKeyHash(a,a),this.unique(b&&b.unique?b.unique:!1),void 0!==a&&this.keys(a),void 0!==c&&this.collection(c),this.name(b&&b.name?b.name:this._id)},d.addModule("IndexBinaryTree",g),d.mixin(g.prototype,"Mixin.ChainReactor"),d.mixin(g.prototype,"Mixin.Sorting"),g.prototype.id=function(){return this._id},g.prototype.state=function(){return this._state},g.prototype.size=function(){return this._size},d.synthesize(g.prototype,"data"),d.synthesize(g.prototype,"name"),d.synthesize(g.prototype,"collection"),d.synthesize(g.prototype,"type"),d.synthesize(g.prototype,"unique"),g.prototype.keys=function(a){return void 0!==a?(this._keys=a,this._keyCount=(new e).parse(this._keys).length,this):this._keys},g.prototype.rebuild=function(){if(this._collection){var a,b=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}),c=b.find(),d=c.length;for(this._btree=new(f.create(2,this.sortAsc)),this._unique&&(this._uniqueLookup={}),a=0;d>a;a++)this.insert(c[a])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}},g.prototype.insert=function(a,b){var c,d,e=this._unique,f=this._itemKeyHash(a,this._keys);e&&(c=this._itemHash(a,this._keys),this._uniqueLookup[c]=a),d=this._btree.get(f),void 0===d&&(d=[],this._btree.put(f,d)),d.push(a),this._size++},g.prototype.remove=function(a,b){var c,d,e,f=this._unique,g=this._itemKeyHash(a,this._keys);f&&(c=this._itemHash(a,this._keys),delete this._uniqueLookup[c]),d=this._btree.get(g),void 0!==d&&(e=d.indexOf(a),e>-1&&(1===d.length?this._btree.del(g):d.splice(e,1),this._size--))},g.prototype.violation=function(a){var b=this._itemHash(a,this._keys);return Boolean(this._uniqueLookup[b])},g.prototype.hashViolation=function(a){return Boolean(this._uniqueLookup[a])},g.prototype.lookup=function(a){return this._data[this._itemHash(a,this._keys)]||[]},g.prototype.match=function(a,b){var c,d=new e,f=d.parseArr(this._keys),g=d.parseArr(a),h=[],i=0;for(c=0;c<f.length;c++){if(g[c]!==f[c])return{matchedKeys:[],totalKeyCount:g.length,score:0};i++,h.push(g[c])}return{matchedKeys:h,totalKeyCount:g.length,score:i}},g.prototype._itemHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.value(a,c[d].path).join(":");return g},g.prototype._itemKeyHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.keyValue(a,c[d].path);return g},g.prototype._itemHashArr=function(a,b){var c,d,f,g,h,i=new e,j=[];for(c=i.parse(b),g=0;g<c.length;g++)for(d=i.value(a,c[g].path),f=0;f<d.length;f++)if(0===g)j.push(d[f]);else for(h=0;h<j.length;h++)j[h]=j[h]+"_"+d[f];return j},d.finishModule("IndexBinaryTree"),b.exports=g},{"./Path":21,"./Shared":23}],8:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(a,b,c){this._crossRef={},this._size=0,this._id=this._itemKeyHash(a,a),this.data({}),this.unique(b&&b.unique?b.unique:!1),void 0!==a&&this.keys(a),void 0!==c&&this.collection(c),this.name(b&&b.name?b.name:this._id)},d.addModule("IndexHashMap",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.id=function(){return this._id},f.prototype.state=function(){return this._state},f.prototype.size=function(){return this._size},d.synthesize(f.prototype,"data"),d.synthesize(f.prototype,"name"),d.synthesize(f.prototype,"collection"),d.synthesize(f.prototype,"type"),d.synthesize(f.prototype,"unique"),f.prototype.keys=function(a){return void 0!==a?(this._keys=a,this._keyCount=(new e).parse(this._keys).length,this):this._keys},f.prototype.rebuild=function(){if(this._collection){var a,b=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}),c=b.find(),d=c.length;for(this._data={},this._unique&&(this._uniqueLookup={}),a=0;d>a;a++)this.insert(c[a])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}},f.prototype.insert=function(a,b){var c,d,e,f=this._unique;for(f&&(c=this._itemHash(a,this._keys),this._uniqueLookup[c]=a),d=this._itemHashArr(a,this._keys),e=0;e<d.length;e++)this.pushToPathValue(d[e],a)},f.prototype.remove=function(a,b){var c,d,e,f=this._unique;for(f&&(c=this._itemHash(a,this._keys),delete this._uniqueLookup[c]),d=this._itemHashArr(a,this._keys),e=0;e<d.length;e++)this.pullFromPathValue(d[e],a)},f.prototype.violation=function(a){var b=this._itemHash(a,this._keys);return Boolean(this._uniqueLookup[b])},f.prototype.hashViolation=function(a){return Boolean(this._uniqueLookup[a])},f.prototype.pushToPathValue=function(a,b){var c=this._data[a]=this._data[a]||[];-1===c.indexOf(b)&&(c.push(b),this._size++,this.pushToCrossRef(b,c))},f.prototype.pullFromPathValue=function(a,b){var c,d=this._data[a];c=d.indexOf(b),c>-1&&(d.splice(c,1),this._size--,this.pullFromCrossRef(b,d)),d.length||delete this._data[a]},f.prototype.pull=function(a){var b,c,d=a[this._collection.primaryKey()],e=this._crossRef[d],f=e.length;for(b=0;f>b;b++)c=e[b],this._pullFromArray(c,a);this._size--,delete this._crossRef[d]},f.prototype._pullFromArray=function(a,b){for(var c=a.length;c--;)a[c]===b&&a.splice(c,1)},f.prototype.pushToCrossRef=function(a,b){var c,d=a[this._collection.primaryKey()];this._crossRef[d]=this._crossRef[d]||[],c=this._crossRef[d],-1===c.indexOf(b)&&c.push(b)},f.prototype.pullFromCrossRef=function(a,b){var c=a[this._collection.primaryKey()];delete this._crossRef[c]},f.prototype.lookup=function(a){return this._data[this._itemHash(a,this._keys)]||[]},f.prototype.match=function(a,b){var c,d=new e,f=d.parseArr(this._keys),g=d.parseArr(a),h=[],i=0;for(c=0;c<f.length;c++){if(g[c]!==f[c])return{matchedKeys:[],totalKeyCount:g.length,score:0};i++,h.push(g[c])}return{matchedKeys:h,totalKeyCount:g.length,score:i}},f.prototype._itemHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.value(a,c[d].path).join(":");return g},f.prototype._itemKeyHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.keyValue(a,c[d].path);return g},f.prototype._itemHashArr=function(a,b){var c,d,f,g,h,i=new e,j=[];for(c=i.parse(b),g=0;g<c.length;g++)for(d=i.value(a,c[g].path),f=0;f<d.length;f++)if(0===g)j.push(d[f]);else for(h=0;h<j.length;h++)j[h]=j[h]+"_"+d[f];return j},d.finishModule("IndexHashMap"),b.exports=f},{"./Path":21,"./Shared":23}],9:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a){this.init.apply(this,arguments)};e.prototype.init=function(a){this._name=a,this._data={},this._primaryKey="_id"},d.addModule("KeyValueStore",e),d.mixin(e.prototype,"Mixin.ChainReactor"),d.synthesize(e.prototype,"name"),e.prototype.primaryKey=function(a){return void 0!==a?(this._primaryKey=a,this):this._primaryKey},e.prototype.truncate=function(){return this._data={},this},e.prototype.set=function(a,b){return this._data[a]=b?b:!0,this},e.prototype.get=function(a){return this._data[a]},e.prototype.lookup=function(a){var b,c,d,e,f=a[this._primaryKey];if(f instanceof Array){for(c=f.length,e=[],b=0;c>b;b++)d=this._data[f[b]],d&&e.push(d);return e}if(f instanceof RegExp){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&f.test(b)&&e.push(this._data[b]);return e}if("object"!=typeof f)return d=this._data[f],void 0!==d?[d]:[];if(f.$ne){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&b!==f.$ne&&e.push(this._data[b]);return e}if(f.$in&&f.$in instanceof Array){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&f.$in.indexOf(b)>-1&&e.push(this._data[b]);return e}if(f.$nin&&f.$nin instanceof Array){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&-1===f.$nin.indexOf(b)&&e.push(this._data[b]);return e}if(f.$or&&f.$or instanceof Array){for(e=[],b=0;b<f.$or.length;b++)e=e.concat(this.lookup(f.$or[b]));return e}},e.prototype.unSet=function(a){return delete this._data[a],this},e.prototype.uniqueSet=function(a,b){return void 0===this._data[a]?(this._data[a]=b,!0):!1},d.finishModule("KeyValueStore"),b.exports=e},{"./Shared":23}],10:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Operation"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(){this._data=[]},d.addModule("Metrics",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.create=function(a){var b=new e(a);return this._enabled&&this._data.push(b),b},f.prototype.start=function(){return this._enabled=!0,this},f.prototype.stop=function(){return this._enabled=!1,this},f.prototype.clear=function(){return this._data=[],this},f.prototype.list=function(){return this._data},d.finishModule("Metrics"),b.exports=f},{"./Operation":19,"./Shared":23}],11:[function(a,b,c){"use strict";var d={preSetData:function(){},postSetData:function(){}};b.exports=d},{}],12:[function(a,b,c){"use strict";var d={chain:function(a){this._chain=this._chain||[];var b=this._chain.indexOf(a);-1===b&&this._chain.push(a)},unChain:function(a){if(this._chain){var b=this._chain.indexOf(a);b>-1&&this._chain.splice(b,1)}},chainSend:function(a,b,c){if(this._chain){var d,e=this._chain,f=e.length;for(d=0;f>d;d++)e[d].chainReceive(this,a,b,c)}},chainReceive:function(a,b,c,d){var e={sender:a,type:b,data:c,options:d};(!this._chainHandler||this._chainHandler&&!this._chainHandler(e))&&this.chainSend(e.type,e.data,e.options)}};b.exports=d},{}],13:[function(a,b,c){"use strict";var d,e=0,f=a("./Overload");d={store:function(a,b){if(void 0!==a){if(void 0!==b)return this._store=this._store||{},this._store[a]=b,this;if(this._store)return this._store[a]}return void 0},unStore:function(a){return void 0!==a&&delete this._store[a],this},decouple:function(a,b){if(void 0!==a){if(b){var c,d=JSON.stringify(a),e=[];for(c=0;b>c;c++)e.push(JSON.parse(d));return e}return JSON.parse(JSON.stringify(a))}return void 0},objectId:function(a){var b,c=Math.pow(10,17);if(a){var d,f=0,g=a.length;for(d=0;g>d;d++)f+=a.charCodeAt(d)*c;b=f.toString(16)}else e++,b=(e+(Math.random()*c+Math.random()*c+Math.random()*c+Math.random()*c)).toString(16);return b},debug:new f([function(){return this._debug&&this._debug.all},function(a){return void 0!==a?"boolean"==typeof a?(this._debug=this._debug||{},this._debug.all=a,this.chainSend("debug",this._debug),this):this._debug&&this._debug[a]||this._db&&this._db._debug&&this._db._debug[a]||this._debug&&this._debug.all:this._debug&&this._debug.all},function(a,b){return void 0!==a?void 0!==b?(this._debug=this._debug||{},this._debug[a]=b,this.chainSend("debug",this._debug),this):this._debug&&this._debug[b]||this._db&&this._db._debug&&this._db._debug[a]:this._debug&&this._debug.all}])},b.exports=d},{"./Overload":20}],14:[function(a,b,c){"use strict";var d={TYPE_INSERT:0,TYPE_UPDATE:1,TYPE_REMOVE:2,PHASE_BEFORE:0,PHASE_AFTER:1};b.exports=d},{}],15:[function(a,b,c){"use strict";var d=a("./Overload"),e={on:new d({"string, function":function(a,b){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||{},this._listeners[a]["*"]=this._listeners[a]["*"]||[],this._listeners[a]["*"].push(b),this},"string, *, function":function(a,b,c){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||{},this._listeners[a][b]=this._listeners[a][b]||[],this._listeners[a][b].push(c),this}}),off:new d({string:function(a){return this._listeners&&this._listeners[a]&&a in this._listeners&&delete this._listeners[a],this},"string, function":function(a,b){var c,d;return"string"==typeof b?this._listeners&&this._listeners[a]&&this._listeners[a][b]&&delete this._listeners[a][b]:a in this._listeners&&(c=this._listeners[a]["*"],d=c.indexOf(b),d>-1&&c.splice(d,1)),this},"string, *, function":function(a,b,c){if(this._listeners&&a in this._listeners&&b in this.listeners[a]){var d=this._listeners[a][b],e=d.indexOf(c);e>-1&&d.splice(e,1)}},"string, *":function(a,b){this._listeners&&a in this._listeners&&b in this._listeners[a]&&delete this._listeners[a][b]}}),emit:function(a,b){if(this._listeners=this._listeners||{},a in this._listeners){var c,d;if(this._listeners[a]["*"]){var e=this._listeners[a]["*"];for(d=e.length,c=0;d>c;c++)e[c].apply(this,Array.prototype.slice.call(arguments,1))}if(b instanceof Array&&b[0]&&b[0][this._primaryKey]){var f,g,h=this._listeners[a];for(d=b.length,c=0;d>c;c++)if(h[b[c][this._primaryKey]])for(f=h[b[c][this._primaryKey]].length,g=0;f>g;g++)h[b[c][this._primaryKey]][g].apply(this,Array.prototype.slice.call(arguments,1))}}return this}};b.exports=e},{"./Overload":20}],16:[function(a,b,c){"use strict";var d={_match:function(a,b,c,d){var e,f,g,h,i,j,k,l=typeof a,m=typeof b,n=!0;if(d=d||{},d.$rootQuery||(d.$rootQuery=b),"string"!==l&&"number"!==l||"string"!==m&&"number"!==m){for(k in b)if(b.hasOwnProperty(k)){if(e=!1,j=k.substr(0,2),"//"===j)continue;if(0===j.indexOf("$")&&(i=this._matchOp(k,a,b[k],d),i>-1)){if(i){if("or"===c)return!0}else n=i;e=!0}if(!e&&b[k]instanceof RegExp)if(e=!0,"object"==typeof a&&void 0!==a[k]&&b[k].test(a[k])){if("or"===c)return!0}else n=!1;if(!e)if("object"==typeof b[k])if(void 0!==a[k])if(a[k]instanceof Array&&!(b[k]instanceof Array)){for(g=!1,h=0;h<a[k].length&&!(g=this._match(a[k][h],b[k],f,d));h++);if(g){if("or"===c)return!0}else n=!1}else if(!(a[k]instanceof Array)&&b[k]instanceof Array){for(g=!1,h=0;h<b[k].length&&!(g=this._match(a[k],b[k][h],f,d));h++);if(g){if("or"===c)return!0}else n=!1}else if("object"==typeof a)if(g=this._match(a[k],b[k],f,d)){if("or"===c)return!0}else n=!1;else if(g=this._match(void 0,b[k],f,d)){if("or"===c)return!0}else n=!1;else if(b[k]&&void 0!==b[k].$exists)if(g=this._match(void 0,b[k],f,d)){if("or"===c)return!0}else n=!1;else n=!1;else if(a&&a[k]===b[k]){if("or"===c)return!0}else if(a&&a[k]&&a[k]instanceof Array&&b[k]&&"object"!=typeof b[k]){for(g=!1,h=0;h<a[k].length&&!(g=this._match(a[k][h],b[k],f,d));h++);if(g){if("or"===c)return!0}else n=!1}else n=!1;if("and"===c&&!n)return!1}}else"number"===l?a!==b&&(n=!1):a.localeCompare(b)&&(n=!1);return n},_matchOp:function(a,b,c,d){switch(a){case"$gt":return b>c;case"$gte":return b>=c;case"$lt":return c>b;case"$lte":return c>=b;case"$exists":return void 0===b!==c;case"$ne":return b!=c;case"$or":for(var e=0;e<c.length;e++)if(this._match(b,c[e],"and",d))return!0;return!1;case"$and":for(var f=0;f<c.length;f++)if(!this._match(b,c[f],"and",d))return!1;return!0;case"$in":if(c instanceof Array){var g,h=c,i=h.length;for(g=0;i>g;g++)if(h[g]===b)return!0;return!1}throw'ForerunnerDB.Mixin.Matching "'+this.name()+'": Cannot use an $in operator on a non-array key: '+a;case"$nin":if(c instanceof Array){var j,k=c,l=k.length;for(j=0;l>j;j++)if(k[j]===b)return!1;return!0}throw'ForerunnerDB.Mixin.Matching "'+this.name()+'": Cannot use a $nin operator on a non-array key: '+a;case"$distinct":d.$rootQuery["//distinctLookup"]=d.$rootQuery["//distinctLookup"]||{};for(var m in c)if(c.hasOwnProperty(m))return d.$rootQuery["//distinctLookup"][m]=d.$rootQuery["//distinctLookup"][m]||{},d.$rootQuery["//distinctLookup"][m][b[m]]?!1:(d.$rootQuery["//distinctLookup"][m][b[m]]=!0,!0)}return-1}};b.exports=d},{}],17:[function(a,b,c){"use strict";var d={sortAsc:function(a,b){return"string"==typeof a&&"string"==typeof b?a.localeCompare(b):a>b?1:b>a?-1:0},sortDesc:function(a,b){return"string"==typeof a&&"string"==typeof b?b.localeCompare(a):a>b?-1:b>a?1:0}};b.exports=d},{}],18:[function(a,b,c){"use strict";var d=a("./Overload"),e={addTrigger:function(a,b,c,d){var e,f=this;return e=f._triggerIndexOf(a,b,c),-1===e?(f._trigger=f._trigger||{},f._trigger[b]=f._trigger[b]||{},f._trigger[b][c]=f._trigger[b][c]||[],f._trigger[b][c].push({id:a,method:d,enabled:!0}),!0):!1},removeTrigger:function(a,b,c){var d,e=this;return d=e._triggerIndexOf(a,b,c),d>-1&&e._trigger[b][c].splice(d,1),!1},enableTrigger:new d({string:function(a){var b,c,d,e,f,g=this,h=g._trigger,i=!1;if(h)for(f in h)if(h.hasOwnProperty(f)&&(b=h[f]))for(d in b)if(b.hasOwnProperty(d))for(c=b[d],e=0;e<c.length;e++)c[e].id===a&&(c[e].enabled=!0,i=!0);return i},number:function(a){var b,c,d,e=this,f=e._trigger[a],g=!1;if(f)for(c in f)if(f.hasOwnProperty(c))for(b=f[c],d=0;d<b.length;d++)b[d].enabled=!0,g=!0;return g},"number, number":function(a,b){var c,d,e=this,f=e._trigger[a],g=!1;if(f&&(c=f[b]))for(d=0;d<c.length;d++)c[d].enabled=!0,g=!0;return g},"string, number, number":function(a,b,c){var d=this,e=d._triggerIndexOf(a,b,c);return e>-1?(d._trigger[b][c][e].enabled=!0,!0):!1}}),disableTrigger:new d({string:function(a){var b,c,d,e,f,g=this,h=g._trigger,i=!1;if(h)for(f in h)if(h.hasOwnProperty(f)&&(b=h[f]))for(d in b)if(b.hasOwnProperty(d))for(c=b[d],e=0;e<c.length;e++)c[e].id===a&&(c[e].enabled=!1,i=!0);return i},number:function(a){var b,c,d,e=this,f=e._trigger[a],g=!1;if(f)for(c in f)if(f.hasOwnProperty(c))for(b=f[c],d=0;d<b.length;d++)b[d].enabled=!1,g=!0;return g},"number, number":function(a,b){var c,d,e=this,f=e._trigger[a],g=!1;if(f&&(c=f[b]))for(d=0;d<c.length;d++)c[d].enabled=!1,g=!0;return g},"string, number, number":function(a,b,c){var d=this,e=d._triggerIndexOf(a,b,c);return e>-1?(d._trigger[b][c][e].enabled=!1,!0):!1}}),willTrigger:function(a,b){if(this._trigger&&this._trigger[a]&&this._trigger[a][b]&&this._trigger[a][b].length){var c,d=this._trigger[a][b];for(c=0;c<d.length;c++)if(d[c].enabled)return!0}return!1},processTrigger:function(a,b,c,d,e){var f,g,h,i,j,k=this;if(k._trigger&&k._trigger[b]&&k._trigger[b][c]){for(f=k._trigger[b][c],h=f.length,g=0;h>g;g++)if(i=f[g],i.enabled){if(this.debug()){var l,m;switch(b){case this.TYPE_INSERT:l="insert";break;case this.TYPE_UPDATE:l="update";break;case this.TYPE_REMOVE:l="remove";break;default:l=""}switch(c){case this.PHASE_BEFORE:m="before";break;case this.PHASE_AFTER:m="after";break;default:m=""}}if(j=i.method.call(k,a,d,e),j===!1)return!1;if(void 0!==j&&j!==!0&&j!==!1)throw"ForerunnerDB.Mixin.Triggers: Trigger error: "+j}return!0}},_triggerIndexOf:function(a,b,c){var d,e,f,g=this;if(g._trigger&&g._trigger[b]&&g._trigger[b][c])for(d=g._trigger[b][c],e=d.length,f=0;e>f;f++)if(d[f].id===a)return f;return-1}};b.exports=e},{"./Overload":20}],19:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(a){this.pathSolver=new e,this.counter=0,this.init.apply(this,arguments)};f.prototype.init=function(a){this._data={operation:a,index:{potential:[],used:!1},steps:[],time:{startMs:0,stopMs:0,totalMs:0,process:{}},flag:{},log:[]}},d.addModule("Operation",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.start=function(){this._data.time.startMs=(new Date).getTime()},f.prototype.log=function(a){if(a){var b=this._log.length>0?this._data.log[this._data.log.length-1].time:0,c={event:a,time:(new Date).getTime(),delta:0};return this._data.log.push(c),b&&(c.delta=c.time-b),this}return this._data.log},f.prototype.time=function(a){if(void 0!==a){var b=this._data.time.process,c=b[a]=b[a]||{};return c.startMs?(c.stopMs=(new Date).getTime(),c.totalMs=c.stopMs-c.startMs,c.stepObj.totalMs=c.totalMs,delete c.stepObj):(c.startMs=(new Date).getTime(),c.stepObj={name:a},this._data.steps.push(c.stepObj)),this}return this._data.time},f.prototype.flag=function(a,b){return void 0===a||void 0===b?void 0!==a?this._data.flag[a]:this._data.flag:void(this._data.flag[a]=b)},f.prototype.data=function(a,b,c){return void 0!==b?(this.pathSolver.set(this._data,a,b),this):this.pathSolver.get(this._data,a)},f.prototype.pushData=function(a,b,c){this.pathSolver.push(this._data,a,b)},f.prototype.stop=function(){this._data.time.stopMs=(new Date).getTime(),this._data.time.totalMs=this._data.time.stopMs-this._data.time.startMs},d.finishModule("Operation"),b.exports=f},{"./Path":21,"./Shared":23}],20:[function(a,b,c){"use strict";var d=function(a){if(a){var b,c,d,e,f,g,h=this;if(!(a instanceof Array)){d={};for(b in a)if(a.hasOwnProperty(b))if(e=b.replace(/ /g,""),-1===e.indexOf("*"))d[e]=a[b];else for(g=this.generateSignaturePermutations(e),f=0;f<g.length;f++)d[g[f]]||(d[g[f]]=a[b]);a=d}return function(){var d,e,f=[];if(a instanceof Array){for(c=a.length,b=0;c>b;b++)if(a[b].length===arguments.length)return h.callExtend(this,"$main",a,a[b],arguments)}else{for(b=0;b<arguments.length;b++)e=typeof arguments[b],"object"===e&&arguments[b]instanceof Array&&(e="array"),f.push(e);if(d=f.join(","),a[d])return h.callExtend(this,"$main",a,a[d],arguments);for(b=f.length;b>=0;b--)if(d=f.slice(0,b).join(","),a[d+",..."])return h.callExtend(this,"$main",a,a[d+",..."],arguments)}throw'ForerunnerDB.Overload "'+this.name()+'": Overloaded method does not have a matching signature for the passed arguments: '+JSON.stringify(f)}}return function(){}};d.prototype.generateSignaturePermutations=function(a){var b,c,d=[],e=["string","object","number","function","undefined"];if(a.indexOf("*")>-1)for(c=0;c<e.length;c++)b=a.replace("*",e[c]),d=d.concat(this.generateSignaturePermutations(b));else d.push(a);return d},d.prototype.callExtend=function(a,b,c,d,e){var f,g;return a&&c[b]?(f=a[b],a[b]=c[b],g=d.apply(a,e),a[b]=f,g):d.apply(a,e)},b.exports=d},{}],21:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a){this.init.apply(this,arguments)};e.prototype.init=function(a){a&&this.path(a)},d.addModule("Path",e),d.mixin(e.prototype,"Mixin.ChainReactor"),e.prototype.path=function(a){return void 0!==a?(this._path=this.clean(a),this._pathParts=this._path.split("."),this):this._path},e.prototype.hasObjectPaths=function(a,b){var c,d=!0;for(c in a)if(a.hasOwnProperty(c)){if(void 0===b[c])return!1;if("object"==typeof a[c]&&(d=this.hasObjectPaths(a[c],b[c]),!d))return!1}return d},e.prototype.countKeys=function(a){var b,c=0;for(b in a)a.hasOwnProperty(b)&&void 0!==a[b]&&("object"!=typeof a[b]?c++:c+=this.countKeys(a[b]));return c},e.prototype.countObjectPaths=function(a,b){var c,d,e={},f=0,g=0;for(d in b)b.hasOwnProperty(d)&&("object"==typeof b[d]?(c=this.countObjectPaths(a[d],b[d]),e[d]=c.matchedKeys,g+=c.totalKeyCount,f+=c.matchedKeyCount):(g++,a&&a[d]&&"object"!=typeof a[d]?(e[d]=!0,f++):e[d]=!1));return{matchedKeys:e,matchedKeyCount:f,totalKeyCount:g}},e.prototype.parse=function(a,b){var c,d,e,f=[],g="";for(d in a)if(a.hasOwnProperty(d))if(g=d,"object"==typeof a[d])if(b)for(c=this.parse(a[d],b),e=0;e<c.length;e++)f.push({path:g+"."+c[e].path,value:c[e].value});else for(c=this.parse(a[d]),e=0;e<c.length;e++)f.push({path:g+"."+c[e].path});else f.push(b?{path:g,value:a[d]}:{path:g});return f},e.prototype.parseArr=function(a,b){return b=b||{},this._parseArr(a,"",[],b)},e.prototype._parseArr=function(a,b,c,d){var e,f="";b=b||"",c=c||[];for(e in a)a.hasOwnProperty(e)&&(!d.ignore||d.ignore&&!d.ignore.test(e))&&(f=b?b+"."+e:e,"object"==typeof a[e]?this._parseArr(a[e],f,c,d):c.push(f));return c},e.prototype.value=function(a,b){if(void 0!==a&&"object"==typeof a){var c,d,e,f,g,h,i,j=[];for(void 0!==b&&(b=this.clean(b),c=b.split(".")),d=c||this._pathParts,e=d.length,f=a,h=0;e>h;h++){if(f=f[d[h]],g instanceof Array){for(i=0;i<g.length;i++)j=j.concat(this.value(g,i+"."+d[h]));return j}if(!f||"object"!=typeof f)break;g=f}return[f]}return[]},e.prototype.set=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;b=this.clean(b),d=b.split("."),e=d.shift(),d.length?(a[e]=a[e]||{},this.set(a[e],d.join("."),c)):a[e]=c}return a},e.prototype.get=function(a,b){return this.value(a,b)[0]},e.prototype.push=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;if(b=this.clean(b),d=b.split("."),e=d.shift(),d.length)a[e]=a[e]||{},this.set(a[e],d.join("."),c);else{if(a[e]=a[e]||[],!(a[e]instanceof Array))throw"ForerunnerDB.Path: Cannot push to a path whose endpoint is not an array!";a[e].push(c)}}return a},e.prototype.keyValue=function(a,b){var c,d,e,f,g,h,i;for(void 0!==b&&(b=this.clean(b),c=b.split(".")),d=c||this._pathParts,e=d.length,f=a,i=0;e>i;i++){if(f=f[d[i]],!f||"object"!=typeof f){h=d[i]+":"+f;break}g=f}return h},e.prototype.clean=function(a){return"."===a.substr(0,1)&&(a=a.substr(1,a.length-1)),a},d.finishModule("Path"),b.exports=e},{"./Shared":23}],22:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a,b,c){if(!(a&&b&&c))throw"ForerunnerDB.ReactorIO: ReactorIO requires in, out and process arguments to instantiate!";if(this._reactorIn=a,this._reactorOut=b,this._chainHandler=c,!a.chain||!b.chainReceive)throw"ForerunnerDB.ReactorIO: ReactorIO requires passed in and out objects to implement the ChainReactor mixin!";a.chain(this),this.chain(b)};d.addModule("ReactorIO",e),e.prototype.drop=function(){return"dropped"!==this._state&&(this._state="dropped",this._reactorIn&&this._reactorIn.unChain(this),this._reactorOut&&this.unChain(this._reactorOut),delete this._reactorIn,delete this._reactorOut,delete this._chainHandler,this.emit("drop",this)),!0},d.synthesize(e.prototype,"state"),d.mixin(e.prototype,"Mixin.ChainReactor"),d.mixin(e.prototype,"Mixin.Events"),d.finishModule("ReactorIO"),b.exports=e},{"./Shared":23}],23:[function(a,b,c){"use strict";var d={version:"1.3.30",modules:{},_synth:{},addModule:function(a,b){this.modules[a]=b,this.emit("moduleLoad",[a,b])},finishModule:function(a){if(!this.modules[a])throw"ForerunnerDB.Shared: finishModule called on a module that has not been registered with addModule(): "+a;this.modules[a]._fdbFinished=!0,this.emit("moduleFinished",[a,this.modules[a]])},moduleFinished:function(a,b){this.modules[a]&&this.modules[a]._fdbFinished?b(a,this.modules[a]):this.on("moduleFinished",b)},moduleExists:function(a){return Boolean(this.modules[a])},mixin:function(a,b){var c=this.mixins[b];if(!c)throw"ForerunnerDB.Shared: Cannot find mixin named: "+b;for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])},synthesize:function(a,b,c){if(this._synth[b]=this._synth[b]||function(a){return void 0!==a?(this["_"+b]=a,this):this["_"+b]},c){var d=this;a[b]=function(){var a,e=this.$super;return this.$super=d._synth[b],a=c.apply(this,arguments),this.$super=e,a}}else a[b]=this._synth[b]},overload:a("./Overload"),mixins:{"Mixin.Common":a("./Mixin.Common"),"Mixin.Events":a("./Mixin.Events"),"Mixin.ChainReactor":a("./Mixin.ChainReactor"),"Mixin.CRUD":a("./Mixin.CRUD"),"Mixin.Constants":a("./Mixin.Constants"),"Mixin.Triggers":a("./Mixin.Triggers"),"Mixin.Sorting":a("./Mixin.Sorting"),"Mixin.Matching":a("./Mixin.Matching")}};d.mixin(d,"Mixin.Events"),b.exports=d},{"./Mixin.CRUD":11,"./Mixin.ChainReactor":12,"./Mixin.Common":13,"./Mixin.Constants":14,"./Mixin.Events":15,"./Mixin.Matching":16,"./Mixin.Sorting":17,"./Mixin.Triggers":18,"./Overload":20}],24:[function(a,b,c){"use strict";var d,e,f,g,h,i,j,k;d=a("./Shared");var l=function(a,b,c){this.init.apply(this,arguments)};l.prototype.init=function(a,b,c){var d=this;this._name=a,this._listeners={},this._querySettings={},this._debug={},this.query(b,!1),this.queryOptions(c,!1),this._collectionDroppedWrap=function(){d._collectionDropped.apply(d,arguments)},this._privateData=new f("__FDB__view_privateData_"+this._name)},d.addModule("View",l),d.mixin(l.prototype,"Mixin.Common"),d.mixin(l.prototype,"Mixin.ChainReactor"),d.mixin(l.prototype,"Mixin.Constants"),d.mixin(l.prototype,"Mixin.Triggers"),f=a("./Collection"),g=a("./CollectionGroup"),k=a("./ActiveBucket"),j=a("./ReactorIO"),h=f.prototype.init,e=d.modules.Core,i=e.prototype.init,d.synthesize(l.prototype,"state"),d.synthesize(l.prototype,"name"),l.prototype.insert=function(){this._from.insert.apply(this._from,arguments);
},l.prototype.update=function(){this._from.update.apply(this._from,arguments)},l.prototype.updateById=function(){this._from.updateById.apply(this._from,arguments)},l.prototype.remove=function(){this._from.remove.apply(this._from,arguments)},l.prototype.find=function(a,b){return this.publicData().find(a,b)},l.prototype.data=function(){return this._privateData},l.prototype.from=function(a){var b=this;if(void 0!==a){this._from&&(this._from.off("drop",this._collectionDroppedWrap),delete this._from),"string"==typeof a&&(a=this._db.collection(a)),this._from=a,this._from.on("drop",this._collectionDroppedWrap),this._io=new j(a,this,function(a){var c,d,e,f,g,h,i;if(b._querySettings.query){if("insert"===a.type){if(c=a.data,c instanceof Array)for(f=[],i=0;i<c.length;i++)b._privateData._match(c[i],b._querySettings.query,"and",{})&&(f.push(c[i]),g=!0);else b._privateData._match(c,b._querySettings.query,"and",{})&&(f=c,g=!0);return g&&this.chainSend("insert",f),!0}if("update"===a.type){if(d=b._privateData.diff(b._from.subset(b._querySettings.query,b._querySettings.options)),d.insert.length||d.remove.length){if(d.insert.length&&this.chainSend("insert",d.insert),d.update.length)for(h=b._privateData.primaryKey(),i=0;i<d.update.length;i++)e={},e[h]=d.update[i][h],this.chainSend("update",{query:e,update:d.update[i]});if(d.remove.length){h=b._privateData.primaryKey();var j=[],k={query:{$or:j}};for(i=0;i<d.remove.length;i++)j.push({_id:d.remove[i][h]});this.chainSend("remove",k)}return!0}return!1}}return!1});var c=a.find(this._querySettings.query,this._querySettings.options);this._transformPrimaryKey(a.primaryKey()),this._transformSetData(c),this._privateData.primaryKey(a.primaryKey()),this._privateData.setData(c),this._querySettings.options&&this._querySettings.options.$orderBy?this.rebuildActiveBucket(this._querySettings.options.$orderBy):this.rebuildActiveBucket()}return this},l.prototype._collectionDropped=function(a){a&&delete this._from},l.prototype.ensureIndex=function(){return this._privateData.ensureIndex.apply(this._privateData,arguments)},l.prototype._chainHandler=function(a){var b,c,d,e,f,g,h,i,j,k;switch(a.type){case"setData":this.debug()&&console.log('ForerunnerDB.View: Setting data on view "'+this.name()+'" in underlying (internal) view collection "'+this._privateData.name()+'"');var l=this._from.find(this._querySettings.query,this._querySettings.options);this._transformSetData(l),this._privateData.setData(l);break;case"insert":if(this.debug()&&console.log('ForerunnerDB.View: Inserting some data on view "'+this.name()+'" in underlying (internal) view collection "'+this._privateData.name()+'"'),a.data=this.decouple(a.data),a.data instanceof Array||(a.data=[a.data]),this._querySettings.options&&this._querySettings.options.$orderBy)for(b=a.data,c=b.length,d=0;c>d;d++)e=this._activeBucket.insert(b[d]),this._transformInsert(a.data,e),this._privateData._insertHandle(a.data,e);else e=this._privateData._data.length,this._transformInsert(a.data,e),this._privateData._insertHandle(a.data,e);break;case"update":if(this.debug()&&console.log('ForerunnerDB.View: Updating some data on view "'+this.name()+'" in underlying (internal) view collection "'+this._privateData.name()+'"'),g=this._privateData.primaryKey(),f=this._privateData.update(a.data.query,a.data.update,a.data.options),this._querySettings.options&&this._querySettings.options.$orderBy)for(c=f.length,d=0;c>d;d++)i=f[d],this._activeBucket.remove(i),j=this._privateData._data.indexOf(i),e=this._activeBucket.insert(i),j!==e&&this._privateData._updateSpliceMove(this._privateData._data,j,e);if(this._transformEnabled&&this._transformIn)for(g=this._publicData.primaryKey(),k=0;k<f.length;k++)h={},i=f[k],h[g]=i[g],this._transformUpdate(h,i);break;case"remove":this.debug()&&console.log('ForerunnerDB.View: Removing some data on view "'+this.name()+'" in underlying (internal) view collection "'+this._privateData.name()+'"'),this._transformRemove(a.data.query,a.options),this._privateData.remove(a.data.query,a.options)}},l.prototype.on=function(){this._privateData.on.apply(this._privateData,arguments)},l.prototype.off=function(){this._privateData.off.apply(this._privateData,arguments)},l.prototype.emit=function(){this._privateData.emit.apply(this._privateData,arguments)},l.prototype.distinct=function(a,b,c){return this._privateData.distinct.apply(this._privateData,arguments)},l.prototype.primaryKey=function(){return this._privateData.primaryKey()},l.prototype.drop=function(){return"dropped"===this._state?!0:this._from?(this._from.off("drop",this._collectionDroppedWrap),this._from._removeView(this),(this.debug()||this._db&&this._db.debug())&&console.log("ForerunnerDB.View: Dropping view "+this._name),this._state="dropped",this._io&&this._io.drop(),this._privateData&&this._privateData.drop(),this._db&&this._name&&delete this._db._view[this._name],this.emit("drop",this),delete this._chain,delete this._from,delete this._privateData,delete this._io,delete this._listeners,delete this._querySettings,delete this._db,!0):!1},l.prototype.db=function(a){return void 0!==a?(this._db=a,this.privateData().db(a),this.publicData().db(a),this):this._db},l.prototype.queryData=function(a,b,c){return void 0!==a&&(this._querySettings.query=a),void 0!==b&&(this._querySettings.options=b),void 0!==a||void 0!==b?((void 0===c||c===!0)&&this.refresh(),this):this._querySettings},l.prototype.queryAdd=function(a,b,c){this._querySettings.query=this._querySettings.query||{};var d,e=this._querySettings.query;if(void 0!==a)for(d in a)a.hasOwnProperty(d)&&(void 0===e[d]||void 0!==e[d]&&b!==!1)&&(e[d]=a[d]);(void 0===c||c===!0)&&this.refresh()},l.prototype.queryRemove=function(a,b){var c,d=this._querySettings.query;if(void 0!==a)for(c in a)a.hasOwnProperty(c)&&delete d[c];(void 0===b||b===!0)&&this.refresh()},l.prototype.query=function(a,b){return void 0!==a?(this._querySettings.query=a,(void 0===b||b===!0)&&this.refresh(),this):this._querySettings.query},l.prototype.orderBy=function(a){if(void 0!==a){var b=this.queryOptions()||{};return b.$orderBy=a,this.queryOptions(b),this}return(this.queryOptions()||{}).$orderBy},l.prototype.queryOptions=function(a,b){return void 0!==a?(this._querySettings.options=a,void 0===a.$decouple&&(a.$decouple=!0),void 0===b||b===!0?this.refresh():this.rebuildActiveBucket(a.$orderBy),this):this._querySettings.options},l.prototype.rebuildActiveBucket=function(a){if(a){var b=this._privateData._data,c=b.length;this._activeBucket=new k(a),this._activeBucket.primaryKey(this._privateData.primaryKey());for(var d=0;c>d;d++)this._activeBucket.insert(b[d])}else delete this._activeBucket},l.prototype.refresh=function(){if(this._from){var a=this.publicData();this._privateData.remove(),a.remove(),this._privateData.insert(this._from.find(this._querySettings.query,this._querySettings.options))}return this._querySettings.options&&this._querySettings.options.$orderBy?this.rebuildActiveBucket(this._querySettings.options.$orderBy):this.rebuildActiveBucket(),this},l.prototype.count=function(){return this._privateData&&this._privateData._data?this._privateData._data.length:0},l.prototype.subset=function(){return this.publicData().subset.apply(this._privateData,arguments)},l.prototype.transform=function(a){return void 0!==a?("object"==typeof a?(void 0!==a.enabled&&(this._transformEnabled=a.enabled),void 0!==a.dataIn&&(this._transformIn=a.dataIn),void 0!==a.dataOut&&(this._transformOut=a.dataOut)):this._transformEnabled=a!==!1,this._transformPrimaryKey(this.privateData().primaryKey()),this._transformSetData(this.privateData().find()),this):{enabled:this._transformEnabled,dataIn:this._transformIn,dataOut:this._transformOut}},l.prototype.privateData=function(){return this._privateData},l.prototype.publicData=function(){return this._transformEnabled?this._publicData:this._privateData},l.prototype._transformSetData=function(a){this._transformEnabled&&(this._publicData=new f("__FDB__view_publicData_"+this._name),this._publicData.db(this._privateData._db),this._publicData.transform({enabled:!0,dataIn:this._transformIn,dataOut:this._transformOut}),this._publicData.setData(a))},l.prototype._transformInsert=function(a,b){this._transformEnabled&&this._publicData&&this._publicData.insert(a,b)},l.prototype._transformUpdate=function(a,b,c){this._transformEnabled&&this._publicData&&this._publicData.update(a,b,c)},l.prototype._transformRemove=function(a,b){this._transformEnabled&&this._publicData&&this._publicData.remove(a,b)},l.prototype._transformPrimaryKey=function(a){this._transformEnabled&&this._publicData&&this._publicData.primaryKey(a)},f.prototype.init=function(){this._view=[],h.apply(this,arguments)},f.prototype.view=function(a,b,c){if(this._db&&this._db._view){if(this._db._view[a])throw'ForerunnerDB.Collection "'+this.name()+'": Cannot create a view using this collection because a view with this name already exists: '+a;var d=new l(a,b,c).db(this._db).from(this);return this._view=this._view||[],this._view.push(d),d}},f.prototype._addView=g.prototype._addView=function(a){return void 0!==a&&this._view.push(a),this},f.prototype._removeView=g.prototype._removeView=function(a){if(void 0!==a){var b=this._view.indexOf(a);b>-1&&this._view.splice(b,1)}return this},e.prototype.init=function(){this._view={},i.apply(this,arguments)},e.prototype.view=function(a){return this._view[a]||(this.debug()||this._db&&this._db.debug())&&console.log("Core.View: Creating view "+a),this._view[a]=this._view[a]||new l(a).db(this),this._view[a]},e.prototype.viewExists=function(a){return Boolean(this._view[a])},e.prototype.views=function(){var a,b=[];for(a in this._view)this._view.hasOwnProperty(a)&&b.push({name:a,count:this._view[a].count()});return b},d.finishModule("View"),b.exports=l},{"./ActiveBucket":2,"./Collection":3,"./CollectionGroup":4,"./ReactorIO":22,"./Shared":23}]},{},[1]);
|
node_modules/react-dom/test-utils.js
|
NGU2016/gallery-picture
|
'use strict';
if (process.env.NODE_ENV === 'production') {
throw Error('test-utils is not available in production mode.');
} else {
module.exports = require('./cjs/react-dom-test-utils.development');
}
|
src/main.js
|
benkeen/invoice-editor
|
import React from 'react';
import ReactDOM from 'react-dom';
import createStore from './store/createStore';
import AppContainer from './containers/AppContainer';
const initialState = window.__INITIAL_STATE__;
const store = createStore(initialState);
const MOUNT_NODE = document.getElementById('root');
let render = () => {
const routes = require('./routes/index').default(store);
ReactDOM.render(
<AppContainer store={store} routes={routes} />,
MOUNT_NODE
);
};
// This code is excluded from production bundle
if (__DEV__) {
if (module.hot) {
// Development render functions
const renderApp = render;
const renderError = (error) => {
const RedBox = require('redbox-react').default;
ReactDOM.render(<RedBox error={error} />, MOUNT_NODE);
};
// Wrap render in try/catch
render = () => {
try {
renderApp();
} catch (error) {
console.error(error);
renderError(error);
}
};
// Setup hot module replacement
module.hot.accept('./routes/index', () =>
setImmediate(() => {
ReactDOM.unmountComponentAtNode(MOUNT_NODE);
render();
})
);
}
}
render();
|
src/components/TodoForm.js
|
Lenousek/Helsinki
|
import React from 'react';
import uuid from 'node-uuid';
export default class TodoForm extends React.Component {
render() {
return (
<form onSubmit={this.onSubmit.bind(this)}>
<input ref="text" type="text" placeholder="what u wanna todo?" />
<button type="submit">Add</button>
</form>
);
}
onSubmit(e) {
e.preventDefault();
const newTodo = {
id: uuid.v4(),
text: this.refs.text.value,
done: false
};
this.refs.text.value = '';
this.props.onAdd(newTodo);
}
}
|
src/interface/common/DelayRender.js
|
ronaldpereira/WoWAnalyzer
|
import React from 'react';
import PropTypes from 'prop-types';
class DelayRender extends React.PureComponent {
static propTypes = {
delay: PropTypes.number.isRequired,
children: PropTypes.node.isRequired,
fallback: PropTypes.node,
};
state = {
timerExpired: false,
};
timer = null;
constructor(props) {
super(props);
this.timer = setTimeout(() => {
this.setState({
timerExpired: true,
});
}, props.delay);
}
componentWillUnmount() {
clearTimeout(this.timer);
}
render() {
const { children } = this.props;
if (!this.state.timerExpired) {
return this.props.fallback ? this.props.fallback : null;
}
return children;
}
}
export default DelayRender;
|
example/src/screens/Actions.js
|
inalist/react-native-navigation
|
import React from 'react';
import { StyleSheet, ScrollView } from 'react-native';
import Row from '../components/Row';
class Actions extends React.Component {
constructor(props) {
super(props);
this._fab = false;
this._rightButton = null;
this._contextualMenu = false;
this._toggleTabs = 'shown';
this._toggleNavBar = 'shown';
this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
}
onNavigatorEvent(event) {
if (event.id === 'contextualMenuDismissed') {
this._contextualMenu = false;
}
}
setTitle = () => {
this.props.navigator.setTitle({
title: 'New Title!',
});
};
setSubtitle = () => {
this.props.navigator.setSubTitle({
subtitle: 'New SubTitle!',
navigatorStyle: {
navBarSubtitleColor: 'red'
}
});
};
toggleTabs = () => {
const to = this._toggleTabs === 'shown' ? 'hidden' : 'shown';
this.props.navigator.toggleTabs({
to,
animated: true,
});
this._toggleTabs = to;
};
setTabBadge = () => {
this.props.navigator.setTabBadge({
tabIndex: 1,
badge: Math.floor(Math.random() * 20) + 1,
});
};
switchToTab = () => {
this.props.navigator.switchToTab({
tabIndex: 0,
});
};
toggleNavBar = () => {
const to = this._toggleNavBar === 'shown' ? 'hidden' : 'shown';
this.props.navigator.toggleNavBar({
to,
animated: true,
});
this._toggleNavBar = to;
};
showSnackbar = () => {
this.props.navigator.showSnackbar({
title: 'Woo Snacks!',
});
};
toggleContextualMenu = () => {
if (!this._contextualMenu) {
this.props.navigator.showContextualMenu({
rightButtons: [{
title: 'Edit',
icon: require('../../img/edit.png'),
}, {
title: 'Delete',
icon: require('../../img/delete.png'),
}],
onButtonPressed: (index) => console.log(`Button ${index} tapped`)
});
this._contextualMenu = true;
} else {
this.props.navigator.dismissContextualMenu();
this._contextualMenu = false;
}
};
setButtons = () => {
let title = '';
if (!this._rightButton) {
title = 'Hello';
} else if (this._rightButton === 'Hello') {
title = 'Its Me';
}
this.props.navigator.setButtons({
rightButtons: [{
title,
id: 'topRight',
}],
animated: true,
});
this._rightButton = title;
};
toggleFAB = () => {
if (this._fab) {
this.props.navigator.setButtons({
fab: {},
});
this._fab = false;
} else {
this.props.navigator.setButtons({
fab: {
collapsedId: 'share',
collapsedIcon: require('../../img/edit@1x.png'),
expendedId: 'clear',
expendedIcon: require('../../img/edit@1x.png'),
backgroundColor: '#ff505c',
actions: [
{
id: 'mail',
icon: require('../../img/edit@1x.png'),
backgroundColor: '#03A9F4'
},
{
id: 'delete',
icon: require('../../img/delete@1x.png'),
backgroundColor: '#4CAF50'
}
]
},
animated: true,
});
this._fab = true;
}
};
render() {
return (
<ScrollView style={styles.container}>
<Row title={'Set Title'} onPress={this.setTitle} />
<Row title={'Set Subtitle'} onPress={this.setSubtitle} />
<Row title={'Toggle Tabs'} onPress={this.toggleTabs} />
<Row title={'Set Tab Badge'} onPress={this.setTabBadge} />
<Row title={'Switch To Tab 0'} onPress={this.switchToTab} />
<Row title={'Toggle Nav Bar'} onPress={this.toggleNavBar} />
<Row title={'Show Snackbar'} onPress={this.showSnackbar} platform={'android'} />
<Row title={'Toggle Contextual Menu'} onPress={this.toggleContextualMenu} platform={'android'} />
<Row title={'Set Right Buttons'} onPress={this.setButtons} />
<Row title={'Toggle FAB'} onPress={this.toggleFAB} platform={'android'} />
</ScrollView>
);
}
}
const styles = StyleSheet.create({
container: {},
});
export default Actions;
|
src/svg-icons/notification/sync-disabled.js
|
hai-cea/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let NotificationSyncDisabled = (props) => (
<SvgIcon {...props}>
<path d="M10 6.35V4.26c-.8.21-1.55.54-2.23.96l1.46 1.46c.25-.12.5-.24.77-.33zm-7.14-.94l2.36 2.36C4.45 8.99 4 10.44 4 12c0 2.21.91 4.2 2.36 5.64L4 20h6v-6l-2.24 2.24C6.68 15.15 6 13.66 6 12c0-1 .25-1.94.68-2.77l8.08 8.08c-.25.13-.5.25-.77.34v2.09c.8-.21 1.55-.54 2.23-.96l2.36 2.36 1.27-1.27L4.14 4.14 2.86 5.41zM20 4h-6v6l2.24-2.24C17.32 8.85 18 10.34 18 12c0 1-.25 1.94-.68 2.77l1.46 1.46C19.55 15.01 20 13.56 20 12c0-2.21-.91-4.2-2.36-5.64L20 4z"/>
</SvgIcon>
);
NotificationSyncDisabled = pure(NotificationSyncDisabled);
NotificationSyncDisabled.displayName = 'NotificationSyncDisabled';
NotificationSyncDisabled.muiName = 'SvgIcon';
export default NotificationSyncDisabled;
|
containers/Navigation.js
|
brown-jones-industries/client
|
import React from 'react'
import { connect } from 'react-redux'
import TabPage from '../components/TabPage'
import PreferenceContainer from './PreferenceContainer'
import LocationButton from '../components/LocationButton'
import NumberOfPeople from './NumberOfPeople'
import NavigationBar from '../components/navigation/NavigationBar'
import { setTab } from '../actions/navigation'
class Navigation extends React.Component {
render () {
let tabs = []
tabs.push(<PreferenceContainer />)
tabs.push(<LocationButton />)
tabs.push(<NumberOfPeople />)
let that = this
return (
<div>
<div className='row justify-content-md-center'>
{tabs.map(function (tabContent, index) {
return (
<TabPage key={index} selected={that.props.navigation.currentTab === index}>
<div className='col-sm-12'>
<div className='card text-center'>
<div className='card-body'>
{tabContent}
</div>
</div>
</div>
</TabPage>
)
})}
</div>
<div className='row justify-content-md-center'>
<div className='col'>
<NavigationBar
setTab={this.props.setTab}
numTabs={tabs.length}
currentTab={that.props.navigation.currentTab} />
</div>
</div>
</div>
)
}
}
export default connect(({ navigation }) => ({ navigation }), {
setTab
})(Navigation)
|
ajax/libs/react-chartjs-2/2.7.1/react-chartjs-2.js
|
extend1994/cdnjs
|
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('chart.js')) :
typeof define === 'function' && define.amd ? define(['exports', 'react', 'chart.js'], factory) :
(factory((global.ReactChartjs2 = {}),global.React,global.Chart));
}(this, (function (exports,React,Chart) { 'use strict';
React = React && React.hasOwnProperty('default') ? React['default'] : React;
Chart = Chart && Chart.hasOwnProperty('default') ? Chart['default'] : Chart;
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
var emptyFunction_1 = emptyFunction;
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var validateFormat = function validateFormat(format) {};
if (process.env.NODE_ENV !== 'production') {
validateFormat = function validateFormat(format) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
};
}
function invariant(condition, format, a, b, c, d, e, f) {
validateFormat(format);
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
var invariant_1 = invariant;
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction_1;
if (process.env.NODE_ENV !== 'production') {
var printWarning = function printWarning(format) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
warning = function warning(condition, format) {
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
printWarning.apply(undefined, [format].concat(args));
}
};
}
var warning_1 = warning;
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
if (process.env.NODE_ENV !== 'production') {
var invariant$1 = invariant_1;
var warning$1 = warning_1;
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
var loggedTypeFailures = {};
}
/**
* Assert that the values match with the type specs.
* Error messages are memorized and will only be shown once.
*
* @param {object} typeSpecs Map of name to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @param {string} componentName Name of the component for error messages.
* @param {?Function} getStack Returns the component stack.
* @private
*/
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
if (process.env.NODE_ENV !== 'production') {
for (var typeSpecName in typeSpecs) {
if (typeSpecs.hasOwnProperty(typeSpecName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
invariant$1(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName);
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
} catch (ex) {
error = ex;
}
warning$1(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var stack = getStack ? getStack() : '';
warning$1(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
}
}
}
}
}
var checkPropTypes_1 = checkPropTypes;
var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
/* global Symbol */
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
/**
* Returns the iterator method function contained on the iterable object.
*
* Be sure to invoke the function with the iterable as context:
*
* var iteratorFn = getIteratorFn(myIterable);
* if (iteratorFn) {
* var iterator = iteratorFn.call(myIterable);
* ...
* }
*
* @param {?object} maybeIterable
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
/**
* Collection of methods that allow declaration and validation of props that are
* supplied to React components. Example usage:
*
* var Props = require('ReactPropTypes');
* var MyArticle = React.createClass({
* propTypes: {
* // An optional string prop named "description".
* description: Props.string,
*
* // A required enum prop named "category".
* category: Props.oneOf(['News','Photos']).isRequired,
*
* // A prop named "dialog" that requires an instance of Dialog.
* dialog: Props.instanceOf(Dialog).isRequired
* },
* render: function() { ... }
* });
*
* A more formal specification of how these methods are used:
*
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
* decl := ReactPropTypes.{type}(.isRequired)?
*
* Each and every declaration produces a function with the same signature. This
* allows the creation of custom validation functions. For example:
*
* var MyLink = React.createClass({
* propTypes: {
* // An optional string or URI prop named "href".
* href: function(props, propName, componentName) {
* var propValue = props[propName];
* if (propValue != null && typeof propValue !== 'string' &&
* !(propValue instanceof URI)) {
* return new Error(
* 'Expected a string or an URI for ' + propName + ' in ' +
* componentName
* );
* }
* }
* },
* render: function() {...}
* });
*
* @internal
*/
var ANONYMOUS = '<<anonymous>>';
// Important!
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
symbol: createPrimitiveTypeChecker('symbol'),
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
element: createElementTypeChecker(),
instanceOf: createInstanceTypeChecker,
node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
shape: createShapeTypeChecker
};
/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
/*eslint-disable no-self-compare*/
function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
}
/*eslint-enable no-self-compare*/
/**
* We use an Error-like object for backward compatibility as people may call
* PropTypes directly and inspect their output. However, we don't use real
* Errors anymore. We don't inspect their stack anyway, and creating them
* is prohibitively expensive if they are created too often, such as what
* happens in oneOfType() for any type before the one that matched.
*/
function PropTypeError(message) {
this.message = message;
this.stack = '';
}
// Make `instanceof Error` still work for returned errors.
PropTypeError.prototype = Error.prototype;
function createChainableTypeChecker(validate) {
if (process.env.NODE_ENV !== 'production') {
var manualPropTypeCallCache = {};
var manualPropTypeWarningCount = 0;
}
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
componentName = componentName || ANONYMOUS;
propFullName = propFullName || propName;
if (secret !== ReactPropTypesSecret_1) {
if (throwOnDirectAccess) {
// New behavior only for users of `prop-types` package
invariant_1(
false,
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use `PropTypes.checkPropTypes()` to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
// Old behavior for people using React.PropTypes
var cacheKey = componentName + ':' + propName;
if (
!manualPropTypeCallCache[cacheKey] &&
// Avoid spamming the console because they are often not actionable except for lib authors
manualPropTypeWarningCount < 3
) {
warning_1(
false,
'You are manually calling a React.PropTypes validation ' +
'function for the `%s` prop on `%s`. This is deprecated ' +
'and will throw in the standalone `prop-types` package. ' +
'You may be seeing this warning due to a third-party PropTypes ' +
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
propFullName,
componentName
);
manualPropTypeCallCache[cacheKey] = true;
manualPropTypeWarningCount++;
}
}
}
if (props[propName] == null) {
if (isRequired) {
if (props[propName] === null) {
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
}
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
}
return null;
} else {
return validate(props, propName, componentName, location, propFullName);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createPrimitiveTypeChecker(expectedType) {
function validate(props, propName, componentName, location, propFullName, secret) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
// `propValue` being instance of, say, date/regexp, pass the 'object'
// check, but we can offer a more precise error message here rather than
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createAnyTypeChecker() {
return createChainableTypeChecker(emptyFunction_1.thatReturnsNull);
}
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
}
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
if (error instanceof Error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeChecker() {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!isValidElement(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var expectedClassName = expectedClass.name || ANONYMOUS;
var actualClassName = getClassName(props[propName]);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) {
if (!Array.isArray(expectedValues)) {
process.env.NODE_ENV !== 'production' ? warning_1(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
return emptyFunction_1.thatReturnsNull;
}
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (is(propValue, expectedValues[i])) {
return null;
}
}
var valuesString = JSON.stringify(expectedValues);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
}
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
if (error instanceof Error) {
return error;
}
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
if (!Array.isArray(arrayOfTypeCheckers)) {
process.env.NODE_ENV !== 'production' ? warning_1(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
return emptyFunction_1.thatReturnsNull;
}
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (typeof checker !== 'function') {
warning_1(
false,
'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' +
'received %s at index %s.',
getPostfixForTypeWarning(checker),
i
);
return emptyFunction_1.thatReturnsNull;
}
}
function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
return null;
}
}
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) {
switch (typeof propValue) {
case 'number':
case 'string':
case 'undefined':
return true;
case 'boolean':
return !propValue;
case 'object':
if (Array.isArray(propValue)) {
return propValue.every(isNode);
}
if (propValue === null || isValidElement(propValue)) {
return true;
}
var iteratorFn = getIteratorFn(propValue);
if (iteratorFn) {
var iterator = iteratorFn.call(propValue);
var step;
if (iteratorFn !== propValue.entries) {
while (!(step = iterator.next()).done) {
if (!isNode(step.value)) {
return false;
}
}
} else {
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
if (!isNode(entry[1])) {
return false;
}
}
}
}
} else {
return false;
}
return true;
default:
return false;
}
}
function isSymbol(propType, propValue) {
// Native Symbol.
if (propType === 'symbol') {
return true;
}
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
if (propValue['@@toStringTag'] === 'Symbol') {
return true;
}
// Fallback for non-spec compliant Symbols which are polyfilled.
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
return true;
}
return false;
}
// Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) {
var propType = typeof propValue;
if (Array.isArray(propValue)) {
return 'array';
}
if (propValue instanceof RegExp) {
// Old webkits (at least until Android 4.0) return 'function' rather than
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
// passes PropTypes.object.
return 'object';
}
if (isSymbol(propType, propValue)) {
return 'symbol';
}
return propType;
}
// This handles more types than `getPropType`. Only used for error messages.
// See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) {
if (typeof propValue === 'undefined' || propValue === null) {
return '' + propValue;
}
var propType = getPropType(propValue);
if (propType === 'object') {
if (propValue instanceof Date) {
return 'date';
} else if (propValue instanceof RegExp) {
return 'regexp';
}
}
return propType;
}
// Returns a string that is postfixed to a warning about an invalid type.
// For example, "undefined" or "of type array"
function getPostfixForTypeWarning(value) {
var type = getPreciseType(value);
switch (type) {
case 'array':
case 'object':
return 'an ' + type;
case 'boolean':
case 'date':
case 'regexp':
return 'a ' + type;
default:
return type;
}
}
// Returns class name of the object, if any.
function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return ANONYMOUS;
}
return propValue.constructor.name;
}
ReactPropTypes.checkPropTypes = checkPropTypes_1;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
var factoryWithThrowingShims = function() {
function shim(props, propName, componentName, location, propFullName, secret) {
if (secret === ReactPropTypesSecret_1) {
// It is still safe when called from React.
return;
}
invariant_1(
false,
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use PropTypes.checkPropTypes() to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
}
shim.isRequired = shim;
function getShim() {
return shim;
}
// Important!
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
var ReactPropTypes = {
array: shim,
bool: shim,
func: shim,
number: shim,
object: shim,
string: shim,
symbol: shim,
any: shim,
arrayOf: getShim,
element: shim,
instanceOf: getShim,
node: shim,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim
};
ReactPropTypes.checkPropTypes = emptyFunction_1;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
var index = createCommonjsModule(function (module) {
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
if (process.env.NODE_ENV !== 'production') {
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
Symbol.for &&
Symbol.for('react.element')) ||
0xeac7;
var isValidElement = function(object) {
return typeof object === 'object' &&
object !== null &&
object.$$typeof === REACT_ELEMENT_TYPE;
};
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
module.exports = factoryWithTypeCheckers(isValidElement, throwOnDirectAccess);
} else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = factoryWithThrowingShims();
}
});
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
var _listCacheClear = listCacheClear;
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
var eq_1 = eq;
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq_1(array[length][0], key)) {
return length;
}
}
return -1;
}
var _assocIndexOf = assocIndexOf;
/** Used for built-in method references. */
var arrayProto = Array.prototype;
/** Built-in value references. */
var splice = arrayProto.splice;
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = _assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}
var _listCacheDelete = listCacheDelete;
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = _assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
var _listCacheGet = listCacheGet;
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return _assocIndexOf(this.__data__, key) > -1;
}
var _listCacheHas = listCacheHas;
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = _assocIndexOf(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
var _listCacheSet = listCacheSet;
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = _listCacheClear;
ListCache.prototype['delete'] = _listCacheDelete;
ListCache.prototype.get = _listCacheGet;
ListCache.prototype.has = _listCacheHas;
ListCache.prototype.set = _listCacheSet;
var _ListCache = ListCache;
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new _ListCache;
this.size = 0;
}
var _stackClear = stackClear;
/**
* Removes `key` and its value from the stack.
*
* @private
* @name delete
* @memberOf Stack
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
var data = this.__data__,
result = data['delete'](key);
this.size = data.size;
return result;
}
var _stackDelete = stackDelete;
/**
* Gets the stack value for `key`.
*
* @private
* @name get
* @memberOf Stack
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
return this.__data__.get(key);
}
var _stackGet = stackGet;
/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
return this.__data__.has(key);
}
var _stackHas = stackHas;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
var _freeGlobal = freeGlobal;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = _freeGlobal || freeSelf || Function('return this')();
var _root = root;
/** Built-in value references. */
var Symbol$1 = _root.Symbol;
var _Symbol = Symbol$1;
/** Used for built-in method references. */
var objectProto$2 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto$2.toString;
/** Built-in value references. */
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty$2.call(value, symToStringTag$1),
tag = value[symToStringTag$1];
try {
value[symToStringTag$1] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag$1] = tag;
} else {
delete value[symToStringTag$1];
}
}
return result;
}
var _getRawTag = getRawTag;
/** Used for built-in method references. */
var objectProto$3 = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString$1 = objectProto$3.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString$1.call(value);
}
var _objectToString = objectToString;
/** `Object#toString` result references. */
var nullTag = '[object Null]';
var undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag && symToStringTag in Object(value))
? _getRawTag(value)
: _objectToString(value);
}
var _baseGetTag = baseGetTag;
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return value != null && (type == 'object' || type == 'function');
}
var isObject_1 = isObject;
/** `Object#toString` result references. */
var asyncTag = '[object AsyncFunction]';
var funcTag = '[object Function]';
var genTag = '[object GeneratorFunction]';
var proxyTag = '[object Proxy]';
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
if (!isObject_1(value)) {
return false;
}
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 9 which returns 'object' for typed arrays and other constructors.
var tag = _baseGetTag(value);
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
var isFunction_1 = isFunction;
/** Used to detect overreaching core-js shims. */
var coreJsData = _root['__core-js_shared__'];
var _coreJsData = coreJsData;
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
var _isMasked = isMasked;
/** Used for built-in method references. */
var funcProto$1 = Function.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString$1 = funcProto$1.toString;
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to convert.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString$1.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
var _toSource = toSource;
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used for built-in method references. */
var funcProto = Function.prototype;
var objectProto$1 = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject_1(value) || _isMasked(value)) {
return false;
}
var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
return pattern.test(_toSource(value));
}
var _baseIsNative = baseIsNative;
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
var _getValue = getValue;
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = _getValue(object, key);
return _baseIsNative(value) ? value : undefined;
}
var _getNative = getNative;
/* Built-in method references that are verified to be native. */
var Map = _getNative(_root, 'Map');
var _Map = Map;
/* Built-in method references that are verified to be native. */
var nativeCreate = _getNative(Object, 'create');
var _nativeCreate = nativeCreate;
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
this.size = 0;
}
var _hashClear = hashClear;
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
}
var _hashDelete = hashDelete;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used for built-in method references. */
var objectProto$4 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (_nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty$3.call(data, key) ? data[key] : undefined;
}
var _hashGet = hashGet;
/** Used for built-in method references. */
var objectProto$5 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$4.call(data, key);
}
var _hashHas = hashHas;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
return this;
}
var _hashSet = hashSet;
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `Hash`.
Hash.prototype.clear = _hashClear;
Hash.prototype['delete'] = _hashDelete;
Hash.prototype.get = _hashGet;
Hash.prototype.has = _hashHas;
Hash.prototype.set = _hashSet;
var _Hash = Hash;
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.size = 0;
this.__data__ = {
'hash': new _Hash,
'map': new (_Map || _ListCache),
'string': new _Hash
};
}
var _mapCacheClear = mapCacheClear;
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}
var _isKeyable = isKeyable;
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return _isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
var _getMapData = getMapData;
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
var result = _getMapData(this, key)['delete'](key);
this.size -= result ? 1 : 0;
return result;
}
var _mapCacheDelete = mapCacheDelete;
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return _getMapData(this, key).get(key);
}
var _mapCacheGet = mapCacheGet;
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return _getMapData(this, key).has(key);
}
var _mapCacheHas = mapCacheHas;
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
var data = _getMapData(this, key),
size = data.size;
data.set(key, value);
this.size += data.size == size ? 0 : 1;
return this;
}
var _mapCacheSet = mapCacheSet;
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `MapCache`.
MapCache.prototype.clear = _mapCacheClear;
MapCache.prototype['delete'] = _mapCacheDelete;
MapCache.prototype.get = _mapCacheGet;
MapCache.prototype.has = _mapCacheHas;
MapCache.prototype.set = _mapCacheSet;
var _MapCache = MapCache;
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/**
* Sets the stack `key` to `value`.
*
* @private
* @name set
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var data = this.__data__;
if (data instanceof _ListCache) {
var pairs = data.__data__;
if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
this.size = ++data.size;
return this;
}
data = this.__data__ = new _MapCache(pairs);
}
data.set(key, value);
this.size = data.size;
return this;
}
var _stackSet = stackSet;
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
var data = this.__data__ = new _ListCache(entries);
this.size = data.size;
}
// Add methods to `Stack`.
Stack.prototype.clear = _stackClear;
Stack.prototype['delete'] = _stackDelete;
Stack.prototype.get = _stackGet;
Stack.prototype.has = _stackHas;
Stack.prototype.set = _stackSet;
var _Stack = Stack;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED$2);
return this;
}
var _setCacheAdd = setCacheAdd;
/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
}
var _setCacheHas = setCacheHas;
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values == null ? 0 : values.length;
this.__data__ = new _MapCache;
while (++index < length) {
this.add(values[index]);
}
}
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = _setCacheAdd;
SetCache.prototype.has = _setCacheHas;
var _SetCache = SetCache;
/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
var _arraySome = arraySome;
/**
* Checks if a `cache` value for `key` exists.
*
* @private
* @param {Object} cache The cache to query.
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function cacheHas(cache, key) {
return cache.has(key);
}
var _cacheHas = cacheHas;
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$1 = 1;
var COMPARE_UNORDERED_FLAG = 2;
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new _SetCache : undefined;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
if (customizer) {
var compared = isPartial
? customizer(othValue, arrValue, index, other, array, stack)
: customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!_arraySome(other, function(othValue, othIndex) {
if (!_cacheHas(seen, othIndex) &&
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
return seen.push(othIndex);
}
})) {
result = false;
break;
}
} else if (!(
arrValue === othValue ||
equalFunc(arrValue, othValue, bitmask, customizer, stack)
)) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}
var _equalArrays = equalArrays;
/** Built-in value references. */
var Uint8Array = _root.Uint8Array;
var _Uint8Array = Uint8Array;
/**
* Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
* @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
result = Array(map.size);
map.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
var _mapToArray = mapToArray;
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
var _setToArray = setToArray;
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$2 = 1;
var COMPARE_UNORDERED_FLAG$1 = 2;
/** `Object#toString` result references. */
var boolTag = '[object Boolean]';
var dateTag = '[object Date]';
var errorTag = '[object Error]';
var mapTag = '[object Map]';
var numberTag = '[object Number]';
var regexpTag = '[object RegExp]';
var setTag = '[object Set]';
var stringTag = '[object String]';
var symbolTag = '[object Symbol]';
var arrayBufferTag = '[object ArrayBuffer]';
var dataViewTag = '[object DataView]';
/** Used to convert symbols to primitives and strings. */
var symbolProto = _Symbol ? _Symbol.prototype : undefined;
var symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
case dataViewTag:
if ((object.byteLength != other.byteLength) ||
(object.byteOffset != other.byteOffset)) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new _Uint8Array(object), new _Uint8Array(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq_1(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == (other + '');
case mapTag:
var convert = _mapToArray;
case setTag:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
convert || (convert = _setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= COMPARE_UNORDERED_FLAG$1;
// Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
var result = _equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
stack['delete'](object);
return result;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
var _equalByTag = equalByTag;
/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
var _arrayPush = arrayPush;
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
var isArray_1 = isArray;
/**
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Function} keysFunc The function to get the keys of `object`.
* @param {Function} symbolsFunc The function to get the symbols of `object`.
* @returns {Array} Returns the array of property names and symbols.
*/
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));
}
var _baseGetAllKeys = baseGetAllKeys;
/**
* A specialized version of `_.filter` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function arrayFilter(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}
var _arrayFilter = arrayFilter;
/**
* This method returns a new empty array.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {Array} Returns the new empty array.
* @example
*
* var arrays = _.times(2, _.stubArray);
*
* console.log(arrays);
* // => [[], []]
*
* console.log(arrays[0] === arrays[1]);
* // => false
*/
function stubArray() {
return [];
}
var stubArray_1 = stubArray;
/** Used for built-in method references. */
var objectProto$7 = Object.prototype;
/** Built-in value references. */
var propertyIsEnumerable = objectProto$7.propertyIsEnumerable;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols;
/**
* Creates an array of the own enumerable symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbols = !nativeGetSymbols ? stubArray_1 : function(object) {
if (object == null) {
return [];
}
object = Object(object);
return _arrayFilter(nativeGetSymbols(object), function(symbol) {
return propertyIsEnumerable.call(object, symbol);
});
};
var _getSymbols = getSymbols;
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
var _baseTimes = baseTimes;
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
var isObjectLike_1 = isObjectLike;
/** `Object#toString` result references. */
var argsTag$1 = '[object Arguments]';
/**
* The base implementation of `_.isArguments`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
*/
function baseIsArguments(value) {
return isObjectLike_1(value) && _baseGetTag(value) == argsTag$1;
}
var _baseIsArguments = baseIsArguments;
/** Used for built-in method references. */
var objectProto$9 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
/** Built-in value references. */
var propertyIsEnumerable$1 = objectProto$9.propertyIsEnumerable;
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
return isObjectLike_1(value) && hasOwnProperty$7.call(value, 'callee') &&
!propertyIsEnumerable$1.call(value, 'callee');
};
var isArguments_1 = isArguments;
/**
* This method returns `false`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `false`.
* @example
*
* _.times(2, _.stubFalse);
* // => [false, false]
*/
function stubFalse() {
return false;
}
var stubFalse_1 = stubFalse;
var isBuffer_1 = createCommonjsModule(function (module, exports) {
/** Detect free variable `exports`. */
var freeExports = 'object' == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Built-in value references. */
var Buffer = moduleExports ? _root.Buffer : undefined;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
/**
* Checks if `value` is a buffer.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
* @example
*
* _.isBuffer(new Buffer(2));
* // => true
*
* _.isBuffer(new Uint8Array(2));
* // => false
*/
var isBuffer = nativeIsBuffer || stubFalse_1;
module.exports = isBuffer;
});
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
}
var _isIndex = isIndex;
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER$1 = 9007199254740991;
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
}
var isLength_1 = isLength;
/** `Object#toString` result references. */
var argsTag$2 = '[object Arguments]';
var arrayTag$1 = '[object Array]';
var boolTag$1 = '[object Boolean]';
var dateTag$1 = '[object Date]';
var errorTag$1 = '[object Error]';
var funcTag$1 = '[object Function]';
var mapTag$1 = '[object Map]';
var numberTag$1 = '[object Number]';
var objectTag$1 = '[object Object]';
var regexpTag$1 = '[object RegExp]';
var setTag$1 = '[object Set]';
var stringTag$1 = '[object String]';
var weakMapTag = '[object WeakMap]';
var arrayBufferTag$1 = '[object ArrayBuffer]';
var dataViewTag$1 = '[object DataView]';
var float32Tag = '[object Float32Array]';
var float64Tag = '[object Float64Array]';
var int8Tag = '[object Int8Array]';
var int16Tag = '[object Int16Array]';
var int32Tag = '[object Int32Array]';
var uint8Tag = '[object Uint8Array]';
var uint8ClampedTag = '[object Uint8ClampedArray]';
var uint16Tag = '[object Uint16Array]';
var uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$1] =
typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] =
typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag$1] =
typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] =
typedArrayTags[mapTag$1] = typedArrayTags[numberTag$1] =
typedArrayTags[objectTag$1] = typedArrayTags[regexpTag$1] =
typedArrayTags[setTag$1] = typedArrayTags[stringTag$1] =
typedArrayTags[weakMapTag] = false;
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike_1(value) &&
isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
}
var _baseIsTypedArray = baseIsTypedArray;
/**
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new capped function.
*/
function baseUnary(func) {
return function(value) {
return func(value);
};
}
var _baseUnary = baseUnary;
var _nodeUtil = createCommonjsModule(function (module, exports) {
/** Detect free variable `exports`. */
var freeExports = 'object' == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && _freeGlobal.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
return freeProcess && freeProcess.binding && freeProcess.binding('util');
} catch (e) {}
}());
module.exports = nodeUtil;
});
/* Node.js helper references. */
var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
var isTypedArray_1 = isTypedArray;
/** Used for built-in method references. */
var objectProto$8 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
var isArr = isArray_1(value),
isArg = !isArr && isArguments_1(value),
isBuff = !isArr && !isArg && isBuffer_1(value),
isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
skipIndexes = isArr || isArg || isBuff || isType,
result = skipIndexes ? _baseTimes(value.length, String) : [],
length = result.length;
for (var key in value) {
if ((inherited || hasOwnProperty$6.call(value, key)) &&
!(skipIndexes && (
// Safari 9 has enumerable `arguments.length` in strict mode.
key == 'length' ||
// Node.js 0.10 has enumerable non-index properties on buffers.
(isBuff && (key == 'offset' || key == 'parent')) ||
// PhantomJS 2 has enumerable non-index properties on typed arrays.
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
// Skip index properties.
_isIndex(key, length)
))) {
result.push(key);
}
}
return result;
}
var _arrayLikeKeys = arrayLikeKeys;
/** Used for built-in method references. */
var objectProto$11 = Object.prototype;
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$11;
return value === proto;
}
var _isPrototype = isPrototype;
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
var _overArg = overArg;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = _overArg(Object.keys, Object);
var _nativeKeys = nativeKeys;
/** Used for built-in method references. */
var objectProto$10 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$8 = objectProto$10.hasOwnProperty;
/**
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
if (!_isPrototype(object)) {
return _nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty$8.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
var _baseKeys = baseKeys;
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength_1(value.length) && !isFunction_1(value);
}
var isArrayLike_1 = isArrayLike;
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);
}
var keys_1 = keys;
/**
* Creates an array of own enumerable property names and symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeys(object) {
return _baseGetAllKeys(object, keys_1, _getSymbols);
}
var _getAllKeys = getAllKeys;
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$3 = 1;
/** Used for built-in method references. */
var objectProto$6 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
objProps = _getAllKeys(object),
objLength = objProps.length,
othProps = _getAllKeys(other),
othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty$5.call(other, key))) {
return false;
}
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
if (customizer) {
var compared = isPartial
? customizer(othValue, objValue, key, other, object, stack)
: customizer(objValue, othValue, key, object, other, stack);
}
// Recursively compare objects (susceptible to call stack limits).
if (!(compared === undefined
? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
: compared
)) {
result = false;
break;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
result = false;
}
}
stack['delete'](object);
stack['delete'](other);
return result;
}
var _equalObjects = equalObjects;
/* Built-in method references that are verified to be native. */
var DataView = _getNative(_root, 'DataView');
var _DataView = DataView;
/* Built-in method references that are verified to be native. */
var Promise$1 = _getNative(_root, 'Promise');
var _Promise = Promise$1;
/* Built-in method references that are verified to be native. */
var Set = _getNative(_root, 'Set');
var _Set = Set;
/* Built-in method references that are verified to be native. */
var WeakMap = _getNative(_root, 'WeakMap');
var _WeakMap = WeakMap;
/** `Object#toString` result references. */
var mapTag$2 = '[object Map]';
var objectTag$2 = '[object Object]';
var promiseTag = '[object Promise]';
var setTag$2 = '[object Set]';
var weakMapTag$1 = '[object WeakMap]';
var dataViewTag$2 = '[object DataView]';
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = _toSource(_DataView);
var mapCtorString = _toSource(_Map);
var promiseCtorString = _toSource(_Promise);
var setCtorString = _toSource(_Set);
var weakMapCtorString = _toSource(_WeakMap);
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = _baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
(_Map && getTag(new _Map) != mapTag$2) ||
(_Promise && getTag(_Promise.resolve()) != promiseTag) ||
(_Set && getTag(new _Set) != setTag$2) ||
(_WeakMap && getTag(new _WeakMap) != weakMapTag$1)) {
getTag = function(value) {
var result = _baseGetTag(value),
Ctor = result == objectTag$2 ? value.constructor : undefined,
ctorString = Ctor ? _toSource(Ctor) : '';
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag$2;
case mapCtorString: return mapTag$2;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag$2;
case weakMapCtorString: return weakMapTag$1;
}
}
return result;
};
}
var _getTag = getTag;
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]';
var arrayTag = '[object Array]';
var objectTag = '[object Object]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray_1(object),
othIsArr = isArray_1(other),
objTag = objIsArr ? arrayTag : _getTag(object),
othTag = othIsArr ? arrayTag : _getTag(other);
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
var objIsObj = objTag == objectTag,
othIsObj = othTag == objectTag,
isSameTag = objTag == othTag;
if (isSameTag && isBuffer_1(object)) {
if (!isBuffer_1(other)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new _Stack);
return (objIsArr || isTypedArray_1(object))
? _equalArrays(object, other, bitmask, customizer, equalFunc, stack)
: _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new _Stack);
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new _Stack);
return _equalObjects(object, other, bitmask, customizer, equalFunc, stack);
}
var _baseIsEqualDeep = baseIsEqualDeep;
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {boolean} bitmask The bitmask flags.
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Function} [customizer] The function to customize comparisons.
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObjectLike_1(value) && !isObjectLike_1(other))) {
return value !== value && other !== other;
}
return _baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}
var _baseIsEqual = baseIsEqual;
/**
* Performs a deep comparison between two values to determine if they are
* equivalent.
*
* **Note:** This method supports comparing arrays, array buffers, booleans,
* date objects, error objects, maps, numbers, `Object` objects, regexes,
* sets, strings, symbols, and typed arrays. `Object` objects are compared
* by their own, not inherited, enumerable properties. Functions and DOM
* nodes are compared by strict equality, i.e. `===`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.isEqual(object, other);
* // => true
*
* object === other;
* // => false
*/
function isEqual(value, other) {
return _baseIsEqual(value, other);
}
var isEqual_1 = isEqual;
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$4 = 1;
var COMPARE_UNORDERED_FLAG$2 = 2;
/**
* The base implementation of `_.isMatch` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
* @param {Array} matchData The property names, values, and compare flags to match.
* @param {Function} [customizer] The function to customize comparisons.
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
*/
function baseIsMatch(object, source, matchData, customizer) {
var index = matchData.length,
length = index,
noCustomizer = !customizer;
if (object == null) {
return !length;
}
object = Object(object);
while (index--) {
var data = matchData[index];
if ((noCustomizer && data[2])
? data[1] !== object[data[0]]
: !(data[0] in object)
) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0],
objValue = object[key],
srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === undefined && !(key in object)) {
return false;
}
} else {
var stack = new _Stack;
if (customizer) {
var result = customizer(objValue, srcValue, key, object, source, stack);
}
if (!(result === undefined
? _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$4 | COMPARE_UNORDERED_FLAG$2, customizer, stack)
: result
)) {
return false;
}
}
}
return true;
}
var _baseIsMatch = baseIsMatch;
/**
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` if suitable for strict
* equality comparisons, else `false`.
*/
function isStrictComparable(value) {
return value === value && !isObject_1(value);
}
var _isStrictComparable = isStrictComparable;
/**
* Gets the property names, values, and compare flags of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the match data of `object`.
*/
function getMatchData(object) {
var result = keys_1(object),
length = result.length;
while (length--) {
var key = result[length],
value = object[key];
result[length] = [key, value, _isStrictComparable(value)];
}
return result;
}
var _getMatchData = getMatchData;
/**
* A specialized version of `matchesProperty` for source values suitable
* for strict equality comparisons, i.e. `===`.
*
* @private
* @param {string} key The key of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function matchesStrictComparable(key, srcValue) {
return function(object) {
if (object == null) {
return false;
}
return object[key] === srcValue &&
(srcValue !== undefined || (key in Object(object)));
};
}
var _matchesStrictComparable = matchesStrictComparable;
/**
* The base implementation of `_.matches` which doesn't clone `source`.
*
* @private
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatches(source) {
var matchData = _getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return _matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function(object) {
return object === source || _baseIsMatch(object, source, matchData);
};
}
var _baseMatches = baseMatches;
/** `Object#toString` result references. */
var symbolTag$1 = '[object Symbol]';
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag$1);
}
var isSymbol_1 = isSymbol;
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
var reIsPlainProp = /^\w*$/;
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
if (isArray_1(value)) {
return false;
}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
value == null || isSymbol_1(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
(object != null && value in Object(object));
}
var _isKey = isKey;
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
* provided, it determines the cache key for storing the result based on the
* arguments provided to the memoized function. By default, the first argument
* provided to the memoized function is used as the map cache key. The `func`
* is invoked with the `this` binding of the memoized function.
*
* **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
* @returns {Function} Returns the new memoized function.
* @example
*
* var object = { 'a': 1, 'b': 2 };
* var other = { 'c': 3, 'd': 4 };
*
* var values = _.memoize(_.values);
* values(object);
* // => [1, 2]
*
* values(other);
* // => [3, 4]
*
* object.a = 2;
* values(object);
* // => [1, 2]
*
* // Modify the result cache.
* values.cache.set(object, ['a', 'b']);
* values(object);
* // => ['a', 'b']
*
* // Replace `_.memoize.Cache`.
* _.memoize.Cache = WeakMap;
*/
function memoize(func, resolver) {
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result) || cache;
return result;
};
memoized.cache = new (memoize.Cache || _MapCache);
return memoized;
}
// Expose `MapCache`.
memoize.Cache = _MapCache;
var memoize_1 = memoize;
/** Used as the maximum memoize cache size. */
var MAX_MEMOIZE_SIZE = 500;
/**
* A specialized version of `_.memoize` which clears the memoized function's
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
*
* @private
* @param {Function} func The function to have its output memoized.
* @returns {Function} Returns the new memoized function.
*/
function memoizeCapped(func) {
var result = memoize_1(func, function(key) {
if (cache.size === MAX_MEMOIZE_SIZE) {
cache.clear();
}
return key;
});
var cache = result.cache;
return result;
}
var _memoizeCapped = memoizeCapped;
/** Used to match property names within property paths. */
var reLeadingDot = /^\./;
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
/**
* Converts `string` to a property path array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the property path array.
*/
var stringToPath = _memoizeCapped(function(string) {
var result = [];
if (reLeadingDot.test(string)) {
result.push('');
}
string.replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
});
return result;
});
var _stringToPath = stringToPath;
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
var _arrayMap = arrayMap;
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/** Used to convert symbols to primitives and strings. */
var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined;
var symbolToString = symbolProto$1 ? symbolProto$1.toString : undefined;
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isArray_1(value)) {
// Recursively convert values (susceptible to call stack limits).
return _arrayMap(value, baseToString) + '';
}
if (isSymbol_1(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
var _baseToString = baseToString;
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : _baseToString(value);
}
var toString_1 = toString;
/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @param {Object} [object] The object to query keys on.
* @returns {Array} Returns the cast property path array.
*/
function castPath(value, object) {
if (isArray_1(value)) {
return value;
}
return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
}
var _castPath = castPath;
/** Used as references for various `Number` constants. */
var INFINITY$1 = 1 / 0;
/**
* Converts `value` to a string key if it's not a string or symbol.
*
* @private
* @param {*} value The value to inspect.
* @returns {string|symbol} Returns the key.
*/
function toKey(value) {
if (typeof value == 'string' || isSymbol_1(value)) {
return value;
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
}
var _toKey = toKey;
/**
* The base implementation of `_.get` without support for default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = _castPath(path, object);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[_toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
}
var _baseGet = baseGet;
/**
* Gets the value at `path` of `object`. If the resolved value is
* `undefined`, the `defaultValue` is returned in its place.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.get(object, 'a[0].b.c');
* // => 3
*
* _.get(object, ['a', '0', 'b', 'c']);
* // => 3
*
* _.get(object, 'a.b.c', 'default');
* // => 'default'
*/
function get(object, path, defaultValue) {
var result = object == null ? undefined : _baseGet(object, path);
return result === undefined ? defaultValue : result;
}
var get_1 = get;
/**
* The base implementation of `_.hasIn` without support for deep paths.
*
* @private
* @param {Object} [object] The object to query.
* @param {Array|string} key The key to check.
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHasIn(object, key) {
return object != null && key in Object(object);
}
var _baseHasIn = baseHasIn;
/**
* Checks if `path` exists on `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @param {Function} hasFunc The function to check properties.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
*/
function hasPath(object, path, hasFunc) {
path = _castPath(path, object);
var index = -1,
length = path.length,
result = false;
while (++index < length) {
var key = _toKey(path[index]);
if (!(result = object != null && hasFunc(object, key))) {
break;
}
object = object[key];
}
if (result || ++index != length) {
return result;
}
length = object == null ? 0 : object.length;
return !!length && isLength_1(length) && _isIndex(key, length) &&
(isArray_1(object) || isArguments_1(object));
}
var _hasPath = hasPath;
/**
* Checks if `path` is a direct or inherited property of `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example
*
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
*
* _.hasIn(object, 'a');
* // => true
*
* _.hasIn(object, 'a.b');
* // => true
*
* _.hasIn(object, ['a', 'b']);
* // => true
*
* _.hasIn(object, 'b');
* // => false
*/
function hasIn(object, path) {
return object != null && _hasPath(object, path, _baseHasIn);
}
var hasIn_1 = hasIn;
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$5 = 1;
var COMPARE_UNORDERED_FLAG$3 = 2;
/**
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
*
* @private
* @param {string} path The path of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatchesProperty(path, srcValue) {
if (_isKey(path) && _isStrictComparable(srcValue)) {
return _matchesStrictComparable(_toKey(path), srcValue);
}
return function(object) {
var objValue = get_1(object, path);
return (objValue === undefined && objValue === srcValue)
? hasIn_1(object, path)
: _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$5 | COMPARE_UNORDERED_FLAG$3);
};
}
var _baseMatchesProperty = baseMatchesProperty;
/**
* This method returns the first argument it receives.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {*} value Any value.
* @returns {*} Returns `value`.
* @example
*
* var object = { 'a': 1 };
*
* console.log(_.identity(object) === object);
* // => true
*/
function identity(value) {
return value;
}
var identity_1 = identity;
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
};
}
var _baseProperty = baseProperty;
/**
* A specialized version of `baseProperty` which supports deep paths.
*
* @private
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function basePropertyDeep(path) {
return function(object) {
return _baseGet(object, path);
};
}
var _basePropertyDeep = basePropertyDeep;
/**
* Creates a function that returns the value at `path` of a given object.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Util
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
* @example
*
* var objects = [
* { 'a': { 'b': 2 } },
* { 'a': { 'b': 1 } }
* ];
*
* _.map(objects, _.property('a.b'));
* // => [2, 1]
*
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
* // => [1, 2]
*/
function property(path) {
return _isKey(path) ? _baseProperty(_toKey(path)) : _basePropertyDeep(path);
}
var property_1 = property;
/**
* The base implementation of `_.iteratee`.
*
* @private
* @param {*} [value=_.identity] The value to convert to an iteratee.
* @returns {Function} Returns the iteratee.
*/
function baseIteratee(value) {
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
if (typeof value == 'function') {
return value;
}
if (value == null) {
return identity_1;
}
if (typeof value == 'object') {
return isArray_1(value)
? _baseMatchesProperty(value[0], value[1])
: _baseMatches(value);
}
return property_1(value);
}
var _baseIteratee = baseIteratee;
/**
* Creates a `_.find` or `_.findLast` function.
*
* @private
* @param {Function} findIndexFunc The function to find the collection index.
* @returns {Function} Returns the new find function.
*/
function createFind(findIndexFunc) {
return function(collection, predicate, fromIndex) {
var iterable = Object(collection);
if (!isArrayLike_1(collection)) {
var iteratee = _baseIteratee(predicate, 3);
collection = keys_1(collection);
predicate = function(key) { return iteratee(iterable[key], key, iterable); };
}
var index = findIndexFunc(collection, predicate, fromIndex);
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
};
}
var _createFind = createFind;
/**
* The base implementation of `_.findIndex` and `_.findLastIndex` without
* support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} predicate The function invoked per iteration.
* @param {number} fromIndex The index to search from.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length = array.length,
index = fromIndex + (fromRight ? 1 : -1);
while ((fromRight ? index-- : ++index < length)) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
}
var _baseFindIndex = baseFindIndex;
/** Used as references for various `Number` constants. */
var NAN = 0 / 0;
/** Used to match leading and trailing whitespace. */
var reTrim = /^\s+|\s+$/g;
/** Used to detect bad signed hexadecimal string values. */
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
/** Used to detect binary string values. */
var reIsBinary = /^0b[01]+$/i;
/** Used to detect octal string values. */
var reIsOctal = /^0o[0-7]+$/i;
/** Built-in method references without a dependency on `root`. */
var freeParseInt = parseInt;
/**
* Converts `value` to a number.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {number} Returns the number.
* @example
*
* _.toNumber(3.2);
* // => 3.2
*
* _.toNumber(Number.MIN_VALUE);
* // => 5e-324
*
* _.toNumber(Infinity);
* // => Infinity
*
* _.toNumber('3.2');
* // => 3.2
*/
function toNumber(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol_1(value)) {
return NAN;
}
if (isObject_1(value)) {
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
value = isObject_1(other) ? (other + '') : other;
}
if (typeof value != 'string') {
return value === 0 ? value : +value;
}
value = value.replace(reTrim, '');
var isBinary = reIsBinary.test(value);
return (isBinary || reIsOctal.test(value))
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
: (reIsBadHex.test(value) ? NAN : +value);
}
var toNumber_1 = toNumber;
/** Used as references for various `Number` constants. */
var INFINITY$2 = 1 / 0;
var MAX_INTEGER = 1.7976931348623157e+308;
/**
* Converts `value` to a finite number.
*
* @static
* @memberOf _
* @since 4.12.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted number.
* @example
*
* _.toFinite(3.2);
* // => 3.2
*
* _.toFinite(Number.MIN_VALUE);
* // => 5e-324
*
* _.toFinite(Infinity);
* // => 1.7976931348623157e+308
*
* _.toFinite('3.2');
* // => 3.2
*/
function toFinite(value) {
if (!value) {
return value === 0 ? value : 0;
}
value = toNumber_1(value);
if (value === INFINITY$2 || value === -INFINITY$2) {
var sign = (value < 0 ? -1 : 1);
return sign * MAX_INTEGER;
}
return value === value ? value : 0;
}
var toFinite_1 = toFinite;
/**
* Converts `value` to an integer.
*
* **Note:** This method is loosely based on
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
* @example
*
* _.toInteger(3.2);
* // => 3
*
* _.toInteger(Number.MIN_VALUE);
* // => 0
*
* _.toInteger(Infinity);
* // => 1.7976931348623157e+308
*
* _.toInteger('3.2');
* // => 3
*/
function toInteger(value) {
var result = toFinite_1(value),
remainder = result % 1;
return result === result ? (remainder ? result - remainder : result) : 0;
}
var toInteger_1 = toInteger;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* This method is like `_.find` except that it returns the index of the first
* element `predicate` returns truthy for instead of the element itself.
*
* @static
* @memberOf _
* @since 1.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': true }
* ];
*
* _.findIndex(users, function(o) { return o.user == 'barney'; });
* // => 0
*
* // The `_.matches` iteratee shorthand.
* _.findIndex(users, { 'user': 'fred', 'active': false });
* // => 1
*
* // The `_.matchesProperty` iteratee shorthand.
* _.findIndex(users, ['active', false]);
* // => 0
*
* // The `_.property` iteratee shorthand.
* _.findIndex(users, 'active');
* // => 2
*/
function findIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger_1(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return _baseFindIndex(array, _baseIteratee(predicate, 3), index);
}
var findIndex_1 = findIndex;
/**
* Iterates over elements of `collection`, returning the first element
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false },
* { 'user': 'pebbles', 'age': 1, 'active': true }
* ];
*
* _.find(users, function(o) { return o.age < 40; });
* // => object for 'barney'
*
* // The `_.matches` iteratee shorthand.
* _.find(users, { 'age': 1, 'active': true });
* // => object for 'pebbles'
*
* // The `_.matchesProperty` iteratee shorthand.
* _.find(users, ['active', false]);
* // => object for 'fred'
*
* // The `_.property` iteratee shorthand.
* _.find(users, 'active');
* // => object for 'barney'
*/
var find = _createFind(findIndex_1);
var defineProperty = (function() {
try {
var func = _getNative(Object, 'defineProperty');
func({}, '', {});
return func;
} catch (e) {}
}());
var _defineProperty = defineProperty;
/**
* The base implementation of `assignValue` and `assignMergeValue` without
* value checks.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function baseAssignValue(object, key, value) {
if (key == '__proto__' && _defineProperty) {
_defineProperty(object, key, {
'configurable': true,
'enumerable': true,
'value': value,
'writable': true
});
} else {
object[key] = value;
}
}
var _baseAssignValue = baseAssignValue;
/**
* A specialized version of `baseAggregator` for arrays.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform keys.
* @param {Object} accumulator The initial aggregated object.
* @returns {Function} Returns `accumulator`.
*/
function arrayAggregator(array, setter, iteratee, accumulator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
var value = array[index];
setter(accumulator, value, iteratee(value), array);
}
return accumulator;
}
var _arrayAggregator = arrayAggregator;
/**
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseFor(fromRight) {
return function(object, iteratee, keysFunc) {
var index = -1,
iterable = Object(object),
props = keysFunc(object),
length = props.length;
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
var _createBaseFor = createBaseFor;
/**
* The base implementation of `baseForOwn` which iterates over `object`
* properties returned by `keysFunc` and invokes `iteratee` for each property.
* Iteratee functions may exit iteration early by explicitly returning `false`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
*/
var baseFor = _createBaseFor();
var _baseFor = baseFor;
/**
* The base implementation of `_.forOwn` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForOwn(object, iteratee) {
return object && _baseFor(object, iteratee, keys_1);
}
var _baseForOwn = baseForOwn;
/**
* Creates a `baseEach` or `baseEachRight` function.
*
* @private
* @param {Function} eachFunc The function to iterate over a collection.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseEach(eachFunc, fromRight) {
return function(collection, iteratee) {
if (collection == null) {
return collection;
}
if (!isArrayLike_1(collection)) {
return eachFunc(collection, iteratee);
}
var length = collection.length,
index = fromRight ? length : -1,
iterable = Object(collection);
while ((fromRight ? index-- : ++index < length)) {
if (iteratee(iterable[index], index, iterable) === false) {
break;
}
}
return collection;
};
}
var _createBaseEach = createBaseEach;
/**
* The base implementation of `_.forEach` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
*/
var baseEach = _createBaseEach(_baseForOwn);
var _baseEach = baseEach;
/**
* Aggregates elements of `collection` on `accumulator` with keys transformed
* by `iteratee` and values set by `setter`.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform keys.
* @param {Object} accumulator The initial aggregated object.
* @returns {Function} Returns `accumulator`.
*/
function baseAggregator(collection, setter, iteratee, accumulator) {
_baseEach(collection, function(value, key, collection) {
setter(accumulator, value, iteratee(value), collection);
});
return accumulator;
}
var _baseAggregator = baseAggregator;
/**
* Creates a function like `_.groupBy`.
*
* @private
* @param {Function} setter The function to set accumulator values.
* @param {Function} [initializer] The accumulator object initializer.
* @returns {Function} Returns the new aggregator function.
*/
function createAggregator(setter, initializer) {
return function(collection, iteratee) {
var func = isArray_1(collection) ? _arrayAggregator : _baseAggregator,
accumulator = initializer ? initializer() : {};
return func(collection, setter, _baseIteratee(iteratee, 2), accumulator);
};
}
var _createAggregator = createAggregator;
/**
* Creates an object composed of keys generated from the results of running
* each element of `collection` thru `iteratee`. The corresponding value of
* each key is the last element responsible for generating the key. The
* iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
* var array = [
* { 'dir': 'left', 'code': 97 },
* { 'dir': 'right', 'code': 100 }
* ];
*
* _.keyBy(array, function(o) {
* return String.fromCharCode(o.code);
* });
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
*
* _.keyBy(array, 'dir');
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
*/
var keyBy = _createAggregator(function(result, value, key) {
_baseAssignValue(result, key, value);
});
var keyBy_1 = keyBy;
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
var objectWithoutProperties = function (obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
};
var possibleConstructorReturn = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
var ChartComponent = function (_React$Component) {
inherits(ChartComponent, _React$Component);
function ChartComponent() {
var _temp, _this, _ret;
classCallCheck(this, ChartComponent);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleOnClick = function (event) {
var instance = _this.chartInstance;
var _this$props = _this.props,
getDatasetAtEvent = _this$props.getDatasetAtEvent,
getElementAtEvent = _this$props.getElementAtEvent,
getElementsAtEvent = _this$props.getElementsAtEvent,
onElementsClick = _this$props.onElementsClick;
getDatasetAtEvent && getDatasetAtEvent(instance.getDatasetAtEvent(event), event);
getElementAtEvent && getElementAtEvent(instance.getElementAtEvent(event), event);
getElementsAtEvent && getElementsAtEvent(instance.getElementsAtEvent(event), event);
onElementsClick && onElementsClick(instance.getElementsAtEvent(event), event); // Backward compatibility
}, _this.ref = function (element) {
_this.element = element;
}, _temp), possibleConstructorReturn(_this, _ret);
}
ChartComponent.prototype.componentWillMount = function componentWillMount() {
this.chartInstance = undefined;
};
ChartComponent.prototype.componentDidMount = function componentDidMount() {
this.renderChart();
};
ChartComponent.prototype.componentDidUpdate = function componentDidUpdate() {
if (this.props.redraw) {
this.chartInstance.destroy();
this.renderChart();
return;
}
this.updateChart();
};
ChartComponent.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
var _props = this.props,
redraw = _props.redraw,
type = _props.type,
options = _props.options,
plugins = _props.plugins,
legend = _props.legend,
height = _props.height,
width = _props.width;
if (nextProps.redraw === true) {
return true;
}
if (height !== nextProps.height || width !== nextProps.width) {
return true;
}
if (type !== nextProps.type) {
return true;
}
if (!isEqual_1(legend, nextProps.legend)) {
return true;
}
if (!isEqual_1(options, nextProps.options)) {
return true;
}
var nextData = this.transformDataProp(nextProps);
if (!isEqual_1(this.shadowDataProp, nextData)) {
return true;
}
return !isEqual_1(plugins, nextProps.plugins);
};
ChartComponent.prototype.componentWillUnmount = function componentWillUnmount() {
this.chartInstance.destroy();
};
ChartComponent.prototype.transformDataProp = function transformDataProp(props) {
var data = props.data;
if (typeof data == 'function') {
var node = this.element;
return data(node);
} else {
return data;
}
};
// Chart.js directly mutates the data.dataset objects by adding _meta proprerty
// this makes impossible to compare the current and next data changes
// therefore we memoize the data prop while sending a fake to Chart.js for mutation.
// see https://github.com/chartjs/Chart.js/blob/master/src/core/core.controller.js#L615-L617
ChartComponent.prototype.memoizeDataProps = function memoizeDataProps() {
if (!this.props.data) {
return;
}
var data = this.transformDataProp(this.props);
this.shadowDataProp = _extends({}, data, {
datasets: data.datasets && data.datasets.map(function (set$$1) {
return _extends({}, set$$1);
})
});
return data;
};
ChartComponent.prototype.updateChart = function updateChart() {
var _this2 = this;
var options = this.props.options;
var data = this.memoizeDataProps(this.props);
if (!this.chartInstance) return;
if (options) {
this.chartInstance.options = Chart.helpers.configMerge(this.chartInstance.options, options);
}
// Pipe datasets to chart instance datasets enabling
// seamless transitions
var currentDatasets = this.chartInstance.config.data && this.chartInstance.config.data.datasets || [];
var nextDatasets = data.datasets || [];
var currentDatasetsIndexed = keyBy_1(currentDatasets, this.props.datasetKeyProvider);
// We can safely replace the dataset array, as long as we retain the _meta property
// on each dataset.
this.chartInstance.config.data.datasets = nextDatasets.map(function (next) {
var current = currentDatasetsIndexed[_this2.props.datasetKeyProvider(next)];
if (current && current.type === next.type) {
// The data array must be edited in place. As chart.js adds listeners to it.
current.data.splice(next.data.length);
next.data.forEach(function (point, pid) {
current.data[pid] = next.data[pid];
});
var _data = next.data,
otherProps = objectWithoutProperties(next, ['data']);
// Merge properties. Notice a weakness here. If a property is removed
// from next, it will be retained by current and never disappears.
// Workaround is to set value to null or undefined in next.
return _extends({}, current, otherProps);
} else {
return next;
}
});
var datasets = data.datasets,
rest = objectWithoutProperties(data, ['datasets']);
this.chartInstance.config.data = _extends({}, this.chartInstance.config.data, rest);
this.chartInstance.update();
};
ChartComponent.prototype.renderChart = function renderChart() {
var _props2 = this.props,
options = _props2.options,
legend = _props2.legend,
type = _props2.type,
redraw = _props2.redraw,
plugins = _props2.plugins;
var node = this.element;
var data = this.memoizeDataProps();
if (typeof legend !== 'undefined' && !isEqual_1(ChartComponent.defaultProps.legend, legend)) {
options.legend = legend;
}
this.chartInstance = new Chart(node, {
type: type,
data: data,
options: options,
plugins: plugins
});
};
ChartComponent.prototype.render = function render() {
var _props3 = this.props,
height = _props3.height,
width = _props3.width,
onElementsClick = _props3.onElementsClick;
return React.createElement('canvas', {
ref: this.ref,
height: height,
width: width,
onClick: this.handleOnClick
});
};
return ChartComponent;
}(React.Component);
ChartComponent.getLabelAsKey = function (d) {
return d.label;
};
ChartComponent.propTypes = {
data: index.oneOfType([index.object, index.func]).isRequired,
getDatasetAtEvent: index.func,
getElementAtEvent: index.func,
getElementsAtEvent: index.func,
height: index.number,
legend: index.object,
onElementsClick: index.func,
options: index.object,
plugins: index.arrayOf(index.object),
redraw: index.bool,
type: function type(props, propName, componentName) {
if (!Chart.controllers[props[propName]]) {
return new Error('Invalid chart type `' + props[propName] + '` supplied to' + ' `' + componentName + '`.');
}
},
width: index.number,
datasetKeyProvider: index.func
};
ChartComponent.defaultProps = {
legend: {
display: true,
position: 'bottom'
},
type: 'doughnut',
height: 150,
width: 300,
redraw: false,
options: {},
datasetKeyProvider: ChartComponent.getLabelAsKey
};
var Doughnut = function (_React$Component2) {
inherits(Doughnut, _React$Component2);
function Doughnut() {
classCallCheck(this, Doughnut);
return possibleConstructorReturn(this, _React$Component2.apply(this, arguments));
}
Doughnut.prototype.render = function render() {
var _this4 = this;
return React.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref) {
return _this4.chartInstance = _ref && _ref.chartInstance;
},
type: 'doughnut'
}));
};
return Doughnut;
}(React.Component);
var Pie = function (_React$Component3) {
inherits(Pie, _React$Component3);
function Pie() {
classCallCheck(this, Pie);
return possibleConstructorReturn(this, _React$Component3.apply(this, arguments));
}
Pie.prototype.render = function render() {
var _this6 = this;
return React.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref2) {
return _this6.chartInstance = _ref2 && _ref2.chartInstance;
},
type: 'pie'
}));
};
return Pie;
}(React.Component);
var Line = function (_React$Component4) {
inherits(Line, _React$Component4);
function Line() {
classCallCheck(this, Line);
return possibleConstructorReturn(this, _React$Component4.apply(this, arguments));
}
Line.prototype.render = function render() {
var _this8 = this;
return React.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref3) {
return _this8.chartInstance = _ref3 && _ref3.chartInstance;
},
type: 'line'
}));
};
return Line;
}(React.Component);
var Bar = function (_React$Component5) {
inherits(Bar, _React$Component5);
function Bar() {
classCallCheck(this, Bar);
return possibleConstructorReturn(this, _React$Component5.apply(this, arguments));
}
Bar.prototype.render = function render() {
var _this10 = this;
return React.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref4) {
return _this10.chartInstance = _ref4 && _ref4.chartInstance;
},
type: 'bar'
}));
};
return Bar;
}(React.Component);
var HorizontalBar = function (_React$Component6) {
inherits(HorizontalBar, _React$Component6);
function HorizontalBar() {
classCallCheck(this, HorizontalBar);
return possibleConstructorReturn(this, _React$Component6.apply(this, arguments));
}
HorizontalBar.prototype.render = function render() {
var _this12 = this;
return React.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref5) {
return _this12.chartInstance = _ref5 && _ref5.chartInstance;
},
type: 'horizontalBar'
}));
};
return HorizontalBar;
}(React.Component);
var Radar = function (_React$Component7) {
inherits(Radar, _React$Component7);
function Radar() {
classCallCheck(this, Radar);
return possibleConstructorReturn(this, _React$Component7.apply(this, arguments));
}
Radar.prototype.render = function render() {
var _this14 = this;
return React.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref6) {
return _this14.chartInstance = _ref6 && _ref6.chartInstance;
},
type: 'radar'
}));
};
return Radar;
}(React.Component);
var Polar = function (_React$Component8) {
inherits(Polar, _React$Component8);
function Polar() {
classCallCheck(this, Polar);
return possibleConstructorReturn(this, _React$Component8.apply(this, arguments));
}
Polar.prototype.render = function render() {
var _this16 = this;
return React.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref7) {
return _this16.chartInstance = _ref7 && _ref7.chartInstance;
},
type: 'polarArea'
}));
};
return Polar;
}(React.Component);
var Bubble = function (_React$Component9) {
inherits(Bubble, _React$Component9);
function Bubble() {
classCallCheck(this, Bubble);
return possibleConstructorReturn(this, _React$Component9.apply(this, arguments));
}
Bubble.prototype.render = function render() {
var _this18 = this;
return React.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref8) {
return _this18.chartInstance = _ref8 && _ref8.chartInstance;
},
type: 'bubble'
}));
};
return Bubble;
}(React.Component);
var Scatter = function (_React$Component10) {
inherits(Scatter, _React$Component10);
function Scatter() {
classCallCheck(this, Scatter);
return possibleConstructorReturn(this, _React$Component10.apply(this, arguments));
}
Scatter.prototype.render = function render() {
var _this20 = this;
return React.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref9) {
return _this20.chartInstance = _ref9 && _ref9.chartInstance;
},
type: 'scatter'
}));
};
return Scatter;
}(React.Component);
var defaults = Chart.defaults;
exports['default'] = ChartComponent;
exports.Doughnut = Doughnut;
exports.Pie = Pie;
exports.Line = Line;
exports.Bar = Bar;
exports.HorizontalBar = HorizontalBar;
exports.Radar = Radar;
exports.Polar = Polar;
exports.Bubble = Bubble;
exports.Scatter = Scatter;
exports.defaults = defaults;
exports.Chart = Chart;
Object.defineProperty(exports, '__esModule', { value: true });
})));
|
src/index.js
|
starrpatty28/React_ToDoList
|
import React from 'react';
import { render } from 'react-dom';
import App from 'components/app';
render (<App />, document.getElementById('app')); //this is where we put in our HTML
|
ajax/libs/rxjs/2.3.10/rx.js
|
DDMAL/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 = 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;
}());
// 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 = { done: true, value: undefined };
/** `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
suportNodeClass,
errorProto = Error.prototype,
objectProto = Object.prototype,
propertyIsEnumerable = objectProto.propertyIsEnumerable;
try {
suportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch(e) {
suportNodeClass = 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';
}
function isArguments(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;
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;
/** @private */
var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
/** @private */
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));
});
};
// Collection polyfills
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
// 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;
})();
function ScheduledDisposable(scheduler, disposable) {
this.scheduler = scheduler;
this.disposable = disposable;
this.isDisposed = false;
}
ScheduledDisposable.prototype.dispose = function () {
var parent = this;
this.scheduler.schedule(function () {
if (!parent.isDisposed) {
parent.isDisposed = true;
parent.disposable.dispose();
}
});
};
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 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 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));
(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); }
function scheduleRelative(state, dueTime, action) {
var dt = normalizeTime(dt);
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 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, nextTick, setImmediate, postMessage, MessageChannel, script readystatechanged, setTimeout
if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleMethod = process.nextTick;
} else if (typeof setImmediate === 'function') {
scheduleMethod = setImmediate;
clearMethod = clearImmediate;
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
tasks = {},
taskId = 0;
function onGlobalPostMessage(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);
})();
/** @private */
var CatchScheduler = (function (_super) {
function localNow() {
return this._scheduler.now();
}
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);
/** @private */
function CatchScheduler(scheduler, handler) {
this._scheduler = scheduler;
this._handler = handler;
this._recursiveOriginal = null;
this._recursiveWrapper = null;
_super.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}
/** @private */
CatchScheduler.prototype._clone = function (scheduler) {
return new CatchScheduler(scheduler, this._handler);
};
/** @private */
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;
}
};
};
/** @private */
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;
};
/** @private */
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, 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 (exception) {
var notification = new Notification('E');
notification.exception = exception;
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();
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.catchException = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e;
try {
e = sources[$iterator$]();
} catch(err) {
observer.onError();
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 enumerableFor = Enumerable.forEach = 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.
*
* @param observer Observer object.
* @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.
*
* @static
* @memberOf Observer
* @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) {
return new AnonymousObserver(function (x) {
return handler(notificationCreateOnNext(x));
}, function (exception) {
return handler(notificationCreateOnError(exception));
}, function () {
return handler(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.notifyOn = function (scheduler) {
return new ObserveOnObserver(scheduler, this);
};
/**
* 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.
*
* @constructor
*/
function AbstractObserver() {
this.isStopped = false;
_super.call(this);
}
/**
* Notifies the observer of a new element in the sequence.
*
* @memberOf AbstractObserver
* @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.
*
* @memberOf AbstractObserver
* @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 (exception) {
this._onError(exception);
};
/**
* 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();
try {
this._observer.onNext(value);
} catch (e) {
throw e;
} finally {
this._state = 0;
}
};
CheckedObserverPrototype.onError = function (err) {
this.checkAccess();
try {
this._observer.onError(err);
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
CheckedObserverPrototype.onCompleted = function () {
this.checkAccess();
try {
this._observer.onCompleted();
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
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 (err) {
var self = this;
this.queue.push(function () {
self.observer.onError(err);
});
};
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() {
__super__.apply(this, arguments);
}
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();
};
return ObserveOnObserver;
})(ScheduledObserver);
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.
*
* @example
* 1 - source.subscribe();
* 2 - source.subscribe(observer);
* 3 - source.subscribe(function (x) { console.log(x); });
* 4 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); });
* 5 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }, function () { console.log('done'); });
* @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} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
var subscriber = typeof observerOrOnNext === 'object' ?
observerOrOnNext :
observerCreate(observerOrOnNext, onError, onCompleted);
return this._subscribe(subscriber);
};
return 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));
});
};
/**
* 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;
});
};
/**
* 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) {
if (!subject.isDisposed) {
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);
});
});
};
/**
* Creates a list from an observable sequence.
* @returns 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 numberIsFinite(value) {
return typeof value === 'number' && root.isFinite(value);
}
function isNan(n) {
return n !== n;
}
function isIterable(o) {
return o[$iterator$] !== undefined;
}
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;
}
function isCallable(f) {
return Object.prototype.toString.call(f) === '[object Function]' && typeof f === 'function';
}
/**
* 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.
*/
Observable.from = function (iterable, mapFn, thisArg, scheduler) {
if (iterable == null) {
throw new Error('iterable cannot be null.')
}
if (mapFn && !isCallable(mapFn)) {
throw new Error('mapFn when provided must be a function');
}
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var list = Object(iterable),
objIsIterable = isIterable(list),
len = objIsIterable ? 0 : toLength(list),
it = objIsIterable ? list[$iterator$]() : null,
i = 0;
return scheduler.scheduleRecursive(function (self) {
if (i < len || objIsIterable) {
var result;
if (objIsIterable) {
var next = it.next();
if (next.done) {
observer.onCompleted();
return;
}
result = next.value;
} else {
result = list[i];
}
if (mapFn && isCallable(mapFn)) {
try {
result = thisArg ? mapFn.call(thisArg, result, i) : mapFn(result, i);
} catch (e) {
observer.onError(e);
return;
}
}
observer.onNext(result);
i++;
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
*
* @example
* var res = Rx.Observable.fromArray([1,2,3]);
* var res = Rx.Observable.fromArray([1,2,3], Rx.Scheduler.timeout);
* @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 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();
}
});
});
};
/**
* 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;
});
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @example
* var res = Rx.Observable.of(1,2,3);
* @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 observableFromArray(args);
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @example
* var res = Rx.Observable.of(1,2,3);
* @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
var observableOf = Observable.ofWithScheduler = function (scheduler) {
var len = arguments.length - 1, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i + 1]; }
return observableFromArray(args, scheduler);
};
/**
* 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.returnValue = Observable.just = function (value, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onNext(value);
observer.onCompleted();
});
});
};
/**
* 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);
});
});
};
/**
* 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 = argsOrArray(arguments, 0);
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 (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.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.
*
* @example
* 1 - res = Rx.Observable.catchException(xs, ys, zs);
* 2 - res = Rx.Observable.catchException([xs, ys, zs]);
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable.catchException = Observable['catch'] = function () {
var items = argsOrArray(arguments, 0);
return enumerableFor(items).catchException();
};
/**
* 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.
*
* @example
* 1 - res = Rx.Observable.concat(xs, ys, zs);
* 2 - res = Rx.Observable.concat([xs, ys, zs]);
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
var sources = argsOrArray(arguments, 0);
return enumerableFor(sources).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.concatObservable = observableProto.concatAll =function () {
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 observableFromArray(sources, scheduler).mergeObservable();
};
/**
* 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.mergeObservable = 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;
});
};
/**
* 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 = argsOrArray(arguments, 0);
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 (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));
};
/**
* 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 (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.
*
* @example
* var res = observable.do(observer);
* var res = observable.do(onNext);
* var res = observable.do(onNext, onError);
* var res = observable.do(onNext, onError, onCompleted);
* @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.doAction = 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) {
observer.onError(err);
} else {
try {
onError(err);
} catch (e) {
observer.onError(e);
}
observer.onError(err);
}
}, function () {
if (!onCompleted) {
observer.onCompleted();
} else {
try {
onCompleted();
} catch (e) {
observer.onError(e);
}
observer.onCompleted();
}
});
});
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
*
* @example
* var res = observable.finallyAction(function () { console.log('sequence ended'; });
* @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.finallyAction = 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();
}
});
});
};
/**
* 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.
*
* @example
* var res = repeated = source.repeat();
* var res = repeated = source.repeat(42);
* @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).catchException();
};
/**
* 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 enumerableFor([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();
});
});
};
/**
* 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 (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, observer.onError.bind(observer), function () {
observer.onNext(q);
observer.onCompleted();
});
});
};
/**
* 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;
if (count <= 0) {
throw new Error(argumentOutOfRange);
}
if (arguments.length === 1) {
skip = count;
}
if (skip <= 0) {
throw new Error(argumentOutOfRange);
}
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(),
refCountDisposable = new RefCountDisposable(m),
n = 0,
q = [],
createWindow = function () {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
};
createWindow();
m.setDisposable(source.subscribe(function (x) {
var s;
for (var i = 0, len = q.length; i < len; i++) {
q[i].onNext(x);
}
var c = n - count + 1;
if (c >= 0 && c % skip === 0) {
s = q.shift();
s.onCompleted();
}
n++;
if (n % skip === 0) {
createWindow();
}
}, function (exception) {
while (q.length > 0) {
q.shift().onError(exception);
}
observer.onError(exception);
}, function () {
while (q.length > 0) {
q.shift().onCompleted();
}
observer.onCompleted();
}));
return refCountDisposable;
});
};
function concatMap(source, selector, thisArg) {
return source.map(function (x, i) {
var result = selector.call(thisArg, x, i);
return isPromise(result) ? observableFromPromise(result) : 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 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 (resultSelector) {
return this.concatMap(function (x, i) {
var selectorResult = selector(x, i),
result = isPromise(selectorResult) ? observableFromPromise(selectorResult) : selectorResult;
return result.map(function (y) {
return resultSelector(x, y, i);
});
});
}
return typeof selector === 'function' ?
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;
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();
});
}).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;
if (defaultValue === undefined) {
defaultValue = null;
}
return new AnonymousObservable(function (observer) {
var found = false;
return source.subscribe(function (x) {
found = true;
observer.onNext(x);
}, observer.onError.bind(observer), function () {
if (!found) {
observer.onNext(defaultValue);
}
observer.onCompleted();
});
});
};
// 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 (observer) {
var hashSet = new HashSet(comparer);
return source.subscribe(function (x) {
var key = x;
if (keySelector) {
try {
key = keySelector(x);
} catch (e) {
observer.onError(e);
return;
}
}
hashSet.push(key) && observer.onNext(x);
},
observer.onError.bind(observer),
observer.onCompleted.bind(observer));
});
};
/**
* 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 parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var result;
try {
result = selector.call(thisArg, value, count++, parent);
} catch (exception) {
observer.onError(exception);
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]; });
};
/**
* 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();
});
}).mergeAll();
};
function flatMap(source, selector, thisArg) {
return source.map(function (x, i) {
var result = selector.call(thisArg, x, i);
return isPromise(result) ? observableFromPromise(result) : result;
}).mergeObservable();
}
/**
* 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 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 (resultSelector) {
return this.flatMap(function (x, i) {
var selectorResult = selector(x, i),
result = isPromise(selectorResult) ? observableFromPromise(selectorResult) : selectorResult;
return result.map(function (y) {
return resultSelector(x, y, i);
});
}, thisArg);
}
return typeof selector === 'function' ?
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 (exception) {
observer.onError(exception);
return;
}
if (shouldRun) {
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/*
* Performs a exclusive waiting for the first to finish before subscribing to another observable.
* Observables that come in between subscriptions will be dropped on the floor.
* @returns {Observable} A exclusive observable with only the results that happen when subscribed.
*/
observableProto.exclusive = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasCurrent = false,
isStopped = false,
m = new SingleAssignmentDisposable(),
g = new CompositeDisposable();
g.add(m);
m.setDisposable(sources.subscribe(
function (innerSource) {
if (!hasCurrent) {
hasCurrent = true;
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
var innerSubscription = new SingleAssignmentDisposable();
g.add(innerSubscription);
innerSubscription.setDisposable(innerSource.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () {
g.remove(innerSubscription);
hasCurrent = false;
if (isStopped && g.length === 1) {
observer.onCompleted();
}
}));
}
},
observer.onError.bind(observer),
function () {
isStopped = true;
if (!hasCurrent && g.length === 1) {
observer.onCompleted();
}
}));
return g;
});
};
/*
* Performs a exclusive map waiting for the first to finish before subscribing to another observable.
* Observables that come in between subscriptions will be dropped on the floor.
* @param {Function} selector Selector to invoke for every item in the current subscription.
* @param {Any} [thisArg] An optional context to invoke with the selector parameter.
* @returns {Observable} An exclusive observable with only the results that happen when subscribed.
*/
observableProto.exclusiveMap = function (selector, thisArg) {
var sources = this;
return new AnonymousObservable(function (observer) {
var index = 0,
hasCurrent = false,
isStopped = true,
m = new SingleAssignmentDisposable(),
g = new CompositeDisposable();
g.add(m);
m.setDisposable(sources.subscribe(
function (innerSource) {
if (!hasCurrent) {
hasCurrent = true;
innerSubscription = new SingleAssignmentDisposable();
g.add(innerSubscription);
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(
function (x) {
var result;
try {
result = selector.call(thisArg, x, index++, innerSource);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
},
observer.onError.bind(observer),
function () {
g.remove(innerSubscription);
hasCurrent = false;
if (isStopped && g.length === 1) {
observer.onCompleted();
}
}));
}
},
observer.onError.bind(observer),
function () {
isStopped = true;
if (g.length === 1 && !hasCurrent) {
observer.onCompleted();
}
}));
return g;
});
};
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));
/** @private */
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 {
if (!noError) {
this.dispose();
}
}
};
AutoDetachObserverPrototype.error = function (exn) {
try {
this.observer.onError(exn);
} 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(); };
/* @private */
AutoDetachObserverPrototype.disposable = function (value) {
return arguments.length ? this.getDisposable() : setDisposable(value);
};
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));
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));
|
sites/all/modules/jquery_update/replace/jquery/1.9/jquery.min.js
|
shanti-uva/drupal_shanti_sources
|
/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;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 b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.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(b.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},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.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?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},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||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.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||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},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:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.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 f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.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?b.extend(e,r):r}},i={};return r.pipe=r.then,b.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=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.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],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.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;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[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%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.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&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,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 b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.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=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.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,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._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(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value: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,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},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(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.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 n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},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}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[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),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=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));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,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]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),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=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),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=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=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 b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):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,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.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))},b.Event=function(e,n){return this instanceof b.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&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.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()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;
return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._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 b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.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 b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.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,b(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(){b.event.remove(this,e,r,n)})},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)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="<a name='"+x+"'></a><div name='"+x+"'></div>",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?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},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.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},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-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 u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(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?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(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]))})})}o=st.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+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===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]||st.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]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.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,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!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[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[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]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[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[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(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:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.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===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.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!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.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:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(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 mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.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?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(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(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.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,Nt=/^(?:checkbox|radio)$/i,Ct=/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:b.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(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 b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.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 b.clone(this,e,t)})},html:function(e){return b.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)||!b.support.htmlSerialize&&mt.test(e)||!b.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&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._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++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.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)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(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||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l)
}b.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),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(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,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});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("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","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"===b.css(e,"display")||!b.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]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.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}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.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,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],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||b.isNumeric(o)?o||0:a):a},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}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});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+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.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=b.support.boxSizing&&"border-box"===b.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&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("<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=ln(e,t),Pt.detach()),Gt[e]=n),n}function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.each(["height","width"],function(e,n){b.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(b.css(e,"display"))?b.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,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}}),b.support.opacity||(b.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=b.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===b.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),b(function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,n){return n?b.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],function(e,n){b.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?b(e).position()[n]+"px":r):t}}})}),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!b.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||b.css(e,"display"))},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},function(e,t){b.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)||(b.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;b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Nt.test(e))}).map(function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.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(b.isArray(t))b.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"!==b.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}b.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){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),b.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var mn,yn,vn=b.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=b.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=a.href}catch(Ln){yn=o.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(w)||[];if(b.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(u){var l;return o[u]=!0,b.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&b.extend(!0,e,r),e}b.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&b.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.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"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.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,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){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===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.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=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],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=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.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&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.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)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("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){(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 On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=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 u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.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,On.push(o)),s&&b.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){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.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,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.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,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.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||(b.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?b.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=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.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)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.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=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._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=b.timers,a=b._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)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),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}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.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,b.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},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.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?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.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?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);
|
admin/client/components/Forms/AltText.js
|
wmertens/keystone
|
import React from 'react';
import blacklist from 'blacklist';
import vkey from 'vkey';
var AltText = React.createClass({
propTypes: {
component: React.PropTypes.string,
modified: React.PropTypes.string,
modifier: React.PropTypes.string,
normal: React.PropTypes.string,
},
getDefaultProps () {
return {
component: 'span',
modifier: '<alt>',
normal: '',
modified: '',
};
},
getInitialState () {
return {
modified: false,
};
},
componentDidMount () {
document.body.addEventListener('keydown', this.handleKeyDown, false);
document.body.addEventListener('keyup', this.handleKeyUp, false);
},
componentWillUnmount () {
document.body.removeEventListener('keydown', this.handleKeyDown);
document.body.removeEventListener('keyup', this.handleKeyUp);
},
handleKeyDown (e) {
if (vkey[e.keyCode] !== this.props.modifier) return;
this.setState({
modified: true,
});
},
handleKeyUp (e) {
if (vkey[e.keyCode] !== this.props.modifier) return;
this.setState({
modified: false,
});
},
render () {
var props = blacklist(this.props, 'component', 'modifier', 'normal', 'modified');
return React.createElement(this.props.component, props, this.state.modified ? this.props.modified : this.props.normal);
},
});
module.exports = AltText;
|
ajax/libs/vue/2.2.6/vue.runtime.common.min.js
|
BenjaminVanRyseghem/cdnjs
|
"use strict";function _toString(e){return null==e?"":"object"==typeof e?JSON.stringify(e,null,2):String(e)}function toNumber(e){var t=parseFloat(e);return isNaN(t)?e:t}function makeMap(e,t){for(var n=Object.create(null),r=e.split(","),o=0;o<r.length;o++)n[r[o]]=!0;return t?function(e){return n[e.toLowerCase()]}:function(e){return n[e]}}function remove(e,t){if(e.length){var n=e.indexOf(t);if(n>-1)return e.splice(n,1)}}function hasOwn(e,t){return hasOwnProperty.call(e,t)}function isPrimitive(e){return"string"==typeof e||"number"==typeof e}function cached(e){var t=Object.create(null);return function(n){var r=t[n];return r||(t[n]=e(n))}}function bind(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n}function toArray(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function extend(e,t){for(var n in t)e[n]=t[n];return e}function isObject(e){return null!==e&&"object"==typeof e}function isPlainObject(e){return toString.call(e)===OBJECT_STRING}function toObject(e){for(var t={},n=0;n<e.length;n++)e[n]&&extend(t,e[n]);return t}function noop(){}function looseEqual(e,t){var n=isObject(e),r=isObject(t);if(!n||!r)return!n&&!r&&String(e)===String(t);try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){return e===t}}function looseIndexOf(e,t){for(var n=0;n<e.length;n++)if(looseEqual(e[n],t))return n;return-1}function once(e){var t=!1;return function(){t||(t=!0,e())}}function isReserved(e){var t=(e+"").charCodeAt(0);return 36===t||95===t}function def(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}function parsePath(e){if(!bailRE.test(e)){var t=e.split(".");return function(e){for(var n=0;n<t.length;n++){if(!e)return;e=e[t[n]]}return e}}}function isNative(e){return/native code/.test(e.toString())}function pushTarget(e){Dep.target&&targetStack.push(Dep.target),Dep.target=e}function popTarget(){Dep.target=targetStack.pop()}function protoAugment(e,t){e.__proto__=t}function copyAugment(e,t,n){for(var r=0,o=n.length;r<o;r++){var i=n[r];def(e,i,t[i])}}function observe(e,t){if(isObject(e)){var n;return hasOwn(e,"__ob__")&&e.__ob__ instanceof Observer?n=e.__ob__:observerState.shouldConvert&&!isServerRendering()&&(Array.isArray(e)||isPlainObject(e))&&Object.isExtensible(e)&&!e._isVue&&(n=new Observer(e)),t&&n&&n.vmCount++,n}}function defineReactive$$1(e,t,n,r){var o=new Dep,i=Object.getOwnPropertyDescriptor(e,t);if(!i||i.configurable!==!1){var a=i&&i.get,s=i&&i.set,c=observe(n);Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var t=a?a.call(e):n;return Dep.target&&(o.depend(),c&&c.dep.depend(),Array.isArray(t)&&dependArray(t)),t},set:function(t){var i=a?a.call(e):n;t===i||t!==t&&i!==i||("production"!==process.env.NODE_ENV&&r&&r(),s?s.call(e,t):n=t,c=observe(t),o.notify())}})}}function set(e,t,n){if(Array.isArray(e)&&"number"==typeof t)return e.length=Math.max(e.length,t),e.splice(t,1,n),n;if(hasOwn(e,t))return e[t]=n,n;var r=e.__ob__;return e._isVue||r&&r.vmCount?("production"!==process.env.NODE_ENV&&warn("Avoid adding reactive properties to a Vue instance or its root $data at runtime - declare it upfront in the data option."),n):r?(defineReactive$$1(r.value,t,n),r.dep.notify(),n):(e[t]=n,n)}function del(e,t){if(Array.isArray(e)&&"number"==typeof t)return void e.splice(t,1);var n=e.__ob__;return e._isVue||n&&n.vmCount?void("production"!==process.env.NODE_ENV&&warn("Avoid deleting properties on a Vue instance or its root $data - just set it to null.")):void(hasOwn(e,t)&&(delete e[t],n&&n.dep.notify()))}function dependArray(e){for(var t=void 0,n=0,r=e.length;n<r;n++)t=e[n],t&&t.__ob__&&t.__ob__.dep.depend(),Array.isArray(t)&&dependArray(t)}function mergeData(e,t){if(!t)return e;for(var n,r,o,i=Object.keys(t),a=0;a<i.length;a++)n=i[a],r=e[n],o=t[n],hasOwn(e,n)?isPlainObject(r)&&isPlainObject(o)&&mergeData(r,o):set(e,n,o);return e}function mergeHook(e,t){return t?e?e.concat(t):Array.isArray(t)?t:[t]:e}function mergeAssets(e,t){var n=Object.create(e||null);return t?extend(n,t):n}function checkComponents(e){for(var t in e.components){var n=t.toLowerCase();(isBuiltInTag(n)||config.isReservedTag(n))&&warn("Do not use built-in or reserved HTML elements as component id: "+t)}}function normalizeProps(e){var t=e.props;if(t){var n,r,o,i={};if(Array.isArray(t))for(n=t.length;n--;)r=t[n],"string"==typeof r?(o=camelize(r),i[o]={type:null}):"production"!==process.env.NODE_ENV&&warn("props must be strings when using array syntax.");else if(isPlainObject(t))for(var a in t)r=t[a],o=camelize(a),i[o]=isPlainObject(r)?r:{type:r};e.props=i}}function normalizeDirectives(e){var t=e.directives;if(t)for(var n in t){var r=t[n];"function"==typeof r&&(t[n]={bind:r,update:r})}}function mergeOptions(e,t,n){function r(r){var o=strats[r]||defaultStrat;l[r]=o(e[r],t[r],n,r)}"production"!==process.env.NODE_ENV&&checkComponents(t),normalizeProps(t),normalizeDirectives(t);var o=t.extends;if(o&&(e="function"==typeof o?mergeOptions(e,o.options,n):mergeOptions(e,o,n)),t.mixins)for(var i=0,a=t.mixins.length;i<a;i++){var s=t.mixins[i];s.prototype instanceof Vue$2&&(s=s.options),e=mergeOptions(e,s,n)}var c,l={};for(c in e)r(c);for(c in t)hasOwn(e,c)||r(c);return l}function resolveAsset(e,t,n,r){if("string"==typeof n){var o=e[t];if(hasOwn(o,n))return o[n];var i=camelize(n);if(hasOwn(o,i))return o[i];var a=capitalize(i);if(hasOwn(o,a))return o[a];var s=o[n]||o[i]||o[a];return"production"!==process.env.NODE_ENV&&r&&!s&&warn("Failed to resolve "+t.slice(0,-1)+": "+n,e),s}}function validateProp(e,t,n,r){var o=t[e],i=!hasOwn(n,e),a=n[e];if(isType(Boolean,o.type)&&(i&&!hasOwn(o,"default")?a=!1:isType(String,o.type)||""!==a&&a!==hyphenate(e)||(a=!0)),void 0===a){a=getPropDefaultValue(r,o,e);var s=observerState.shouldConvert;observerState.shouldConvert=!0,observe(a),observerState.shouldConvert=s}return"production"!==process.env.NODE_ENV&&assertProp(o,e,a,r,i),a}function getPropDefaultValue(e,t,n){if(hasOwn(t,"default")){var r=t.default;return"production"!==process.env.NODE_ENV&&isObject(r)&&warn('Invalid default value for prop "'+n+'": Props with type Object/Array must use a factory function to return the default value.',e),e&&e.$options.propsData&&void 0===e.$options.propsData[n]&&void 0!==e._props[n]?e._props[n]:"function"==typeof r&&"Function"!==getType(t.type)?r.call(e):r}}function assertProp(e,t,n,r,o){if(e.required&&o)return void warn('Missing required prop: "'+t+'"',r);if(null!=n||e.required){var i=e.type,a=!i||i===!0,s=[];if(i){Array.isArray(i)||(i=[i]);for(var c=0;c<i.length&&!a;c++){var l=assertType(n,i[c]);s.push(l.expectedType||""),a=l.valid}}if(!a)return void warn('Invalid prop: type check failed for prop "'+t+'". Expected '+s.map(capitalize).join(", ")+", got "+Object.prototype.toString.call(n).slice(8,-1)+".",r);var p=e.validator;p&&(p(n)||warn('Invalid prop: custom validator check failed for prop "'+t+'".',r))}}function assertType(e,t){var n,r=getType(t);return n="String"===r?typeof e==(r="string"):"Number"===r?typeof e==(r="number"):"Boolean"===r?typeof e==(r="boolean"):"Function"===r?typeof e==(r="function"):"Object"===r?isPlainObject(e):"Array"===r?Array.isArray(e):e instanceof t,{valid:n,expectedType:r}}function getType(e){var t=e&&e.toString().match(/^\s*function (\w+)/);return t&&t[1]}function isType(e,t){if(!Array.isArray(t))return getType(t)===getType(e);for(var n=0,r=t.length;n<r;n++)if(getType(t[n])===getType(e))return!0;return!1}function handleError(e,t,n){if(config.errorHandler)config.errorHandler.call(null,e,t,n);else{if("production"!==process.env.NODE_ENV&&warn("Error in "+n+":",t),!inBrowser||"undefined"==typeof console)throw e;console.error(e)}}function createTextVNode(e){return new VNode(void 0,void 0,void 0,String(e))}function cloneVNode(e){var t=new VNode(e.tag,e.data,e.children,e.text,e.elm,e.context,e.componentOptions);return t.ns=e.ns,t.isStatic=e.isStatic,t.key=e.key,t.isCloned=!0,t}function cloneVNodes(e){for(var t=e.length,n=new Array(t),r=0;r<t;r++)n[r]=cloneVNode(e[r]);return n}function createFnInvoker(e){function t(){var e=arguments,n=t.fns;if(!Array.isArray(n))return n.apply(null,arguments);for(var r=0;r<n.length;r++)n[r].apply(null,e)}return t.fns=e,t}function updateListeners(e,t,n,r,o){var i,a,s,c;for(i in e)a=e[i],s=t[i],c=normalizeEvent(i),a?s?a!==s&&(s.fns=a,e[i]=s):(a.fns||(a=e[i]=createFnInvoker(a)),n(c.name,a,c.once,c.capture)):"production"!==process.env.NODE_ENV&&warn('Invalid handler for event "'+c.name+'": got '+String(a),o);for(i in t)e[i]||(c=normalizeEvent(i),r(c.name,t[i],c.capture))}function mergeVNodeHook(e,t,n){function r(){n.apply(this,arguments),remove(o.fns,r)}var o,i=e[t];i?i.fns&&i.merged?(o=i,o.fns.push(r)):o=createFnInvoker([i,r]):o=createFnInvoker([r]),o.merged=!0,e[t]=o}function simpleNormalizeChildren(e){for(var t=0;t<e.length;t++)if(Array.isArray(e[t]))return Array.prototype.concat.apply([],e);return e}function normalizeChildren(e){return isPrimitive(e)?[createTextVNode(e)]:Array.isArray(e)?normalizeArrayChildren(e):void 0}function normalizeArrayChildren(e,t){var n,r,o,i=[];for(n=0;n<e.length;n++)r=e[n],null!=r&&"boolean"!=typeof r&&(o=i[i.length-1],Array.isArray(r)?i.push.apply(i,normalizeArrayChildren(r,(t||"")+"_"+n)):isPrimitive(r)?o&&o.text?o.text+=String(r):""!==r&&i.push(createTextVNode(r)):r.text&&o&&o.text?i[i.length-1]=createTextVNode(o.text+r.text):(r.tag&&null==r.key&&null!=t&&(r.key="__vlist"+t+"_"+n+"__"),i.push(r)));return i}function getFirstComponentChild(e){return e&&e.filter(function(e){return e&&e.componentOptions})[0]}function initEvents(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&updateComponentListeners(e,t)}function add(e,t,n){n?target.$once(e,t):target.$on(e,t)}function remove$1(e,t){target.$off(e,t)}function updateComponentListeners(e,t,n){target=e,updateListeners(t,n||{},add,remove$1,e)}function eventsMixin(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this,o=this;if(Array.isArray(e))for(var i=0,a=e.length;i<a;i++)r.$on(e[i],n);else(o._events[e]||(o._events[e]=[])).push(n),t.test(e)&&(o._hasHookEvent=!0);return o},e.prototype.$once=function(e,t){function n(){r.$off(e,n),t.apply(r,arguments)}var r=this;return n.fn=t,r.$on(e,n),r},e.prototype.$off=function(e,t){var n=this,r=this;if(!arguments.length)return r._events=Object.create(null),r;if(Array.isArray(e)){for(var o=0,i=e.length;o<i;o++)n.$off(e[o],t);return r}var a=r._events[e];if(!a)return r;if(1===arguments.length)return r._events[e]=null,r;for(var s,c=a.length;c--;)if(s=a[c],s===t||s.fn===t){a.splice(c,1);break}return r},e.prototype.$emit=function(e){var t=this;if("production"!==process.env.NODE_ENV){var n=e.toLowerCase();n!==e&&t._events[n]&&tip('Event "'+n+'" is emitted in component '+formatComponentName(t)+' but the handler is registered for "'+e+'". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "'+hyphenate(e)+'" instead of "'+e+'".')}var r=t._events[e];if(r){r=r.length>1?toArray(r):r;for(var o=toArray(arguments,1),i=0,a=r.length;i<a;i++)r[i].apply(t,o)}return t}}function resolveSlots(e,t){var n={};if(!e)return n;for(var r,o,i=[],a=0,s=e.length;a<s;a++)if(o=e[a],(o.context===t||o.functionalContext===t)&&o.data&&(r=o.data.slot)){var c=n[r]||(n[r]=[]);"template"===o.tag?c.push.apply(c,o.children):c.push(o)}else i.push(o);return i.every(isWhitespace)||(n.default=i),n}function isWhitespace(e){return e.isComment||" "===e.text}function resolveScopedSlots(e){for(var t={},n=0;n<e.length;n++)t[e[n][0]]=e[n][1];return t}function initLifecycle(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}function lifecycleMixin(e){e.prototype._update=function(e,t){var n=this;n._isMounted&&callHook(n,"beforeUpdate");var r=n.$el,o=n._vnode,i=activeInstance;activeInstance=n,n._vnode=e,o?n.$el=n.__patch__(o,e):n.$el=n.__patch__(n.$el,e,t,!1,n.$options._parentElm,n.$options._refElm),activeInstance=i,r&&(r.__vue__=null),n.$el&&(n.$el.__vue__=n),n.$vnode&&n.$parent&&n.$vnode===n.$parent._vnode&&(n.$parent.$el=n.$el)},e.prototype.$forceUpdate=function(){var e=this;e._watcher&&e._watcher.update()},e.prototype.$destroy=function(){var e=this;if(!e._isBeingDestroyed){callHook(e,"beforeDestroy"),e._isBeingDestroyed=!0;var t=e.$parent;!t||t._isBeingDestroyed||e.$options.abstract||remove(t.$children,e),e._watcher&&e._watcher.teardown();for(var n=e._watchers.length;n--;)e._watchers[n].teardown();e._data.__ob__&&e._data.__ob__.vmCount--,e._isDestroyed=!0,e.__patch__(e._vnode,null),callHook(e,"destroyed"),e.$off(),e.$el&&(e.$el.__vue__=null),e.$options._parentElm=e.$options._refElm=null}}}function mountComponent(e,t,n){e.$el=t,e.$options.render||(e.$options.render=createEmptyVNode,"production"!==process.env.NODE_ENV&&(e.$options.template&&"#"!==e.$options.template.charAt(0)||e.$options.el||t?warn("You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.",e):warn("Failed to mount component: template or render function not defined.",e))),callHook(e,"beforeMount");var r;return r="production"!==process.env.NODE_ENV&&config.performance&&mark?function(){var t=e._name,r=e._uid,o="vue-perf-start:"+r,i="vue-perf-end:"+r;mark(o);var a=e._render();mark(i),measure(t+" render",o,i),mark(o),e._update(a,n),mark(i),measure(t+" patch",o,i)}:function(){e._update(e._render(),n)},e._watcher=new Watcher(e,r,noop),n=!1,null==e.$vnode&&(e._isMounted=!0,callHook(e,"mounted")),e}function updateChildComponent(e,t,n,r,o){var i=!!(o||e.$options._renderChildren||r.data.scopedSlots||e.$scopedSlots!==emptyObject);if(e.$options._parentVnode=r,e.$vnode=r,e._vnode&&(e._vnode.parent=r),e.$options._renderChildren=o,t&&e.$options.props){observerState.shouldConvert=!1,"production"!==process.env.NODE_ENV&&(observerState.isSettingProps=!0);for(var a=e._props,s=e.$options._propKeys||[],c=0;c<s.length;c++){var l=s[c];a[l]=validateProp(l,e.$options.props,t,e)}observerState.shouldConvert=!0,"production"!==process.env.NODE_ENV&&(observerState.isSettingProps=!1),e.$options.propsData=t}if(n){var p=e.$options._parentListeners;e.$options._parentListeners=n,updateComponentListeners(e,n,p)}i&&(e.$slots=resolveSlots(o,r.context),e.$forceUpdate())}function isInInactiveTree(e){for(;e&&(e=e.$parent);)if(e._inactive)return!0;return!1}function activateChildComponent(e,t){if(t){if(e._directInactive=!1,isInInactiveTree(e))return}else if(e._directInactive)return;if(e._inactive||null==e._inactive){e._inactive=!1;for(var n=0;n<e.$children.length;n++)activateChildComponent(e.$children[n]);callHook(e,"activated")}}function deactivateChildComponent(e,t){if(!(t&&(e._directInactive=!0,isInInactiveTree(e))||e._inactive)){e._inactive=!0;for(var n=0;n<e.$children.length;n++)deactivateChildComponent(e.$children[n]);callHook(e,"deactivated")}}function callHook(e,t){var n=e.$options[t];if(n)for(var r=0,o=n.length;r<o;r++)try{n[r].call(e)}catch(n){handleError(n,e,t+" hook")}e._hasHookEvent&&e.$emit("hook:"+t)}function resetSchedulerState(){queue.length=0,has={},"production"!==process.env.NODE_ENV&&(circular={}),waiting=flushing=!1}function flushSchedulerQueue(){flushing=!0;var e,t,n;for(queue.sort(function(e,t){return e.id-t.id}),index=0;index<queue.length;index++)if(e=queue[index],t=e.id,has[t]=null,e.run(),"production"!==process.env.NODE_ENV&&null!=has[t]&&(circular[t]=(circular[t]||0)+1,circular[t]>config._maxUpdateCount)){warn("You may have an infinite update loop "+(e.user?'in watcher with expression "'+e.expression+'"':"in a component render function."),e.vm);break}var r=queue.slice();for(resetSchedulerState(),index=r.length;index--;)e=r[index],n=e.vm,n._watcher===e&&n._isMounted&&callHook(n,"updated");devtools&&config.devtools&&devtools.emit("flush")}function queueWatcher(e){var t=e.id;if(null==has[t]){if(has[t]=!0,flushing){for(var n=queue.length-1;n>=0&&queue[n].id>e.id;)n--;queue.splice(Math.max(n,index)+1,0,e)}else queue.push(e);waiting||(waiting=!0,nextTick(flushSchedulerQueue))}}function traverse(e){seenObjects.clear(),_traverse(e,seenObjects)}function _traverse(e,t){var n,r,o=Array.isArray(e);if((o||isObject(e))&&Object.isExtensible(e)){if(e.__ob__){var i=e.__ob__.dep.id;if(t.has(i))return;t.add(i)}if(o)for(n=e.length;n--;)_traverse(e[n],t);else for(r=Object.keys(e),n=r.length;n--;)_traverse(e[r[n]],t)}}function proxy(e,t,n){sharedPropertyDefinition.get=function(){return this[t][n]},sharedPropertyDefinition.set=function(e){this[t][n]=e},Object.defineProperty(e,n,sharedPropertyDefinition)}function initState(e){e._watchers=[];var t=e.$options;t.props&&initProps(e,t.props),t.methods&&initMethods(e,t.methods),t.data?initData(e):observe(e._data={},!0),t.computed&&initComputed(e,t.computed),t.watch&&initWatch(e,t.watch)}function initProps(e,t){var n=e.$options.propsData||{},r=e._props={},o=e.$options._propKeys=[],i=!e.$parent;observerState.shouldConvert=i;var a=function(i){o.push(i);var a=validateProp(i,t,n,e);"production"!==process.env.NODE_ENV?(isReservedProp[i]&&warn('"'+i+'" is a reserved attribute and cannot be used as component prop.',e),defineReactive$$1(r,i,a,function(){e.$parent&&!observerState.isSettingProps&&warn("Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: \""+i+'"',e)})):defineReactive$$1(r,i,a),i in e||proxy(e,"_props",i)};for(var s in t)a(s);observerState.shouldConvert=!0}function initData(e){var t=e.$options.data;t=e._data="function"==typeof t?getData(t,e):t||{},isPlainObject(t)||(t={},"production"!==process.env.NODE_ENV&&warn("data functions should return an object:\nhttps://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function",e));for(var n=Object.keys(t),r=e.$options.props,o=n.length;o--;)r&&hasOwn(r,n[o])?"production"!==process.env.NODE_ENV&&warn('The data property "'+n[o]+'" is already declared as a prop. Use prop default value instead.',e):isReserved(n[o])||proxy(e,"_data",n[o]);observe(t,!0)}function getData(e,t){try{return e.call(t)}catch(e){return handleError(e,t,"data()"),{}}}function initComputed(e,t){var n=e._computedWatchers=Object.create(null);for(var r in t){var o=t[r],i="function"==typeof o?o:o.get;"production"!==process.env.NODE_ENV&&void 0===i&&(warn('No getter function has been defined for computed property "'+r+'".',e),i=noop),n[r]=new Watcher(e,i,noop,computedWatcherOptions),r in e||defineComputed(e,r,o)}}function defineComputed(e,t,n){"function"==typeof n?(sharedPropertyDefinition.get=createComputedGetter(t),sharedPropertyDefinition.set=noop):(sharedPropertyDefinition.get=n.get?n.cache!==!1?createComputedGetter(t):n.get:noop,sharedPropertyDefinition.set=n.set?n.set:noop),Object.defineProperty(e,t,sharedPropertyDefinition)}function createComputedGetter(e){return function(){var t=this._computedWatchers&&this._computedWatchers[e];if(t)return t.dirty&&t.evaluate(),Dep.target&&t.depend(),t.value}}function initMethods(e,t){var n=e.$options.props;for(var r in t)e[r]=null==t[r]?noop:bind(t[r],e),"production"!==process.env.NODE_ENV&&(null==t[r]&&warn('method "'+r+'" has an undefined value in the component definition. Did you reference the function correctly?',e),n&&hasOwn(n,r)&&warn('method "'+r+'" has already been defined as a prop.',e))}function initWatch(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var o=0;o<r.length;o++)createWatcher(e,n,r[o]);else createWatcher(e,n,r)}}function createWatcher(e,t,n){var r;isPlainObject(n)&&(r=n,n=n.handler),"string"==typeof n&&(n=e[n]),e.$watch(t,n,r)}function stateMixin(e){var t={};t.get=function(){return this._data};var n={};n.get=function(){return this._props},"production"!==process.env.NODE_ENV&&(t.set=function(e){warn("Avoid replacing instance root $data. Use nested data properties instead.",this)},n.set=function(){warn("$props is readonly.",this)}),Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=set,e.prototype.$delete=del,e.prototype.$watch=function(e,t,n){var r=this;n=n||{},n.user=!0;var o=new Watcher(r,e,t,n);return n.immediate&&t.call(r,o.value),function(){o.teardown()}}}function createComponent(e,t,n,r,o){if(e){var i=n.$options._base;if(isObject(e)&&(e=i.extend(e)),"function"!=typeof e)return void("production"!==process.env.NODE_ENV&&warn("Invalid Component definition: "+String(e),n));if(!e.cid)if(e.resolved)e=e.resolved;else if(e=resolveAsyncComponent(e,i,function(){n.$forceUpdate()}),!e)return;resolveConstructorOptions(e),t=t||{},t.model&&transformModel(e.options,t);var a=extractProps(t,e,o);if(e.options.functional)return createFunctionalComponent(e,a,t,n,r);var s=t.on;t.on=t.nativeOn,e.options.abstract&&(t={}),mergeHooks(t);var c=e.options.name||o,l=new VNode("vue-component-"+e.cid+(c?"-"+c:""),t,void 0,void 0,void 0,n,{Ctor:e,propsData:a,listeners:s,tag:o,children:r});return l}}function createFunctionalComponent(e,t,n,r,o){var i={},a=e.options.props;if(a)for(var s in a)i[s]=validateProp(s,a,t);var c=Object.create(r),l=function(e,t,n,r){return createElement(c,e,t,n,r,!0)},p=e.options.render.call(null,l,{props:i,data:n,parent:r,children:o,slots:function(){return resolveSlots(o,r)}});return p instanceof VNode&&(p.functionalContext=r,n.slot&&((p.data||(p.data={})).slot=n.slot)),p}function createComponentInstanceForVnode(e,t,n,r){var o=e.componentOptions,i={_isComponent:!0,parent:t,propsData:o.propsData,_componentTag:o.tag,_parentVnode:e,_parentListeners:o.listeners,_renderChildren:o.children,_parentElm:n||null,_refElm:r||null},a=e.data.inlineTemplate;return a&&(i.render=a.render,i.staticRenderFns=a.staticRenderFns),new o.Ctor(i)}function resolveAsyncComponent(e,t,n){if(!e.requested){e.requested=!0;var r=e.pendingCallbacks=[n],o=!0,i=function(n){if(isObject(n)&&(n=t.extend(n)),e.resolved=n,!o)for(var i=0,a=r.length;i<a;i++)r[i](n)},a=function(t){"production"!==process.env.NODE_ENV&&warn("Failed to resolve async component: "+String(e)+(t?"\nReason: "+t:""))},s=e(i,a);return s&&"function"==typeof s.then&&!e.resolved&&s.then(i,a),o=!1,e.resolved}e.pendingCallbacks.push(n)}function extractProps(e,t,n){var r=t.options.props;if(r){var o={},i=e.attrs,a=e.props,s=e.domProps;if(i||a||s)for(var c in r){var l=hyphenate(c);if("production"!==process.env.NODE_ENV){var p=c.toLowerCase();c!==p&&i&&i.hasOwnProperty(p)&&tip('Prop "'+p+'" is passed to component '+formatComponentName(n||t)+', but the declared prop name is "'+c+'". Note that HTML attributes are case-insensitive and camelCased props need to use their kebab-case equivalents when using in-DOM templates. You should probably use "'+l+'" instead of "'+c+'".')}checkProp(o,a,c,l,!0)||checkProp(o,i,c,l)||checkProp(o,s,c,l)}return o}}function checkProp(e,t,n,r,o){if(t){if(hasOwn(t,n))return e[n]=t[n],o||delete t[n],!0;if(hasOwn(t,r))return e[n]=t[r],o||delete t[r],!0}return!1}function mergeHooks(e){e.hook||(e.hook={});for(var t=0;t<hooksToMerge.length;t++){var n=hooksToMerge[t],r=e.hook[n],o=componentVNodeHooks[n];e.hook[n]=r?mergeHook$1(o,r):o}}function mergeHook$1(e,t){return function(n,r,o,i){e(n,r,o,i),t(n,r,o,i)}}function transformModel(e,t){var n=e.model&&e.model.prop||"value",r=e.model&&e.model.event||"input";(t.props||(t.props={}))[n]=t.model.value;var o=t.on||(t.on={});o[r]?o[r]=[t.model.callback].concat(o[r]):o[r]=t.model.callback}function createElement(e,t,n,r,o,i){return(Array.isArray(n)||isPrimitive(n))&&(o=r,r=n,n=void 0),i&&(o=ALWAYS_NORMALIZE),_createElement(e,t,n,r,o)}function _createElement(e,t,n,r,o){if(n&&n.__ob__)return"production"!==process.env.NODE_ENV&&warn("Avoid using observed data object as vnode data: "+JSON.stringify(n)+"\nAlways create fresh vnode data objects in each render!",e),createEmptyVNode();if(!t)return createEmptyVNode();Array.isArray(r)&&"function"==typeof r[0]&&(n=n||{},n.scopedSlots={default:r[0]},r.length=0),o===ALWAYS_NORMALIZE?r=normalizeChildren(r):o===SIMPLE_NORMALIZE&&(r=simpleNormalizeChildren(r));var i,a;if("string"==typeof t){var s;a=config.getTagNamespace(t),i=config.isReservedTag(t)?new VNode(config.parsePlatformTagName(t),n,r,void 0,void 0,e):(s=resolveAsset(e.$options,"components",t))?createComponent(s,n,e,r,t):new VNode(t,n,r,void 0,void 0,e)}else i=createComponent(t,n,e,r);return i?(a&&applyNS(i,a),i):createEmptyVNode()}function applyNS(e,t){if(e.ns=t,"foreignObject"!==e.tag&&e.children)for(var n=0,r=e.children.length;n<r;n++){var o=e.children[n];o.tag&&!o.ns&&applyNS(o,t)}}function renderList(e,t){var n,r,o,i,a;if(Array.isArray(e)||"string"==typeof e)for(n=new Array(e.length),r=0,o=e.length;r<o;r++)n[r]=t(e[r],r);else if("number"==typeof e)for(n=new Array(e),r=0;r<e;r++)n[r]=t(r+1,r);else if(isObject(e))for(i=Object.keys(e),n=new Array(i.length),r=0,o=i.length;r<o;r++)a=i[r],n[r]=t(e[a],a,r);return n}function renderSlot(e,t,n,r){var o=this.$scopedSlots[e];if(o)return n=n||{},r&&extend(n,r),o(n)||t;var i=this.$slots[e];return i&&"production"!==process.env.NODE_ENV&&(i._rendered&&warn('Duplicate presence of slot "'+e+'" found in the same render tree - this will likely cause render errors.',this),i._rendered=!0),i||t}function resolveFilter(e){return resolveAsset(this.$options,"filters",e,!0)||identity}function checkKeyCodes(e,t,n){var r=config.keyCodes[t]||n;return Array.isArray(r)?r.indexOf(e)===-1:r!==e}function bindObjectProps(e,t,n,r){if(n)if(isObject(n)){Array.isArray(n)&&(n=toObject(n));var o;for(var i in n){if("class"===i||"style"===i)o=e;else{var a=e.attrs&&e.attrs.type;o=r||config.mustUseProp(t,a,i)?e.domProps||(e.domProps={}):e.attrs||(e.attrs={})}i in o||(o[i]=n[i])}}else"production"!==process.env.NODE_ENV&&warn("v-bind without argument expects an Object or Array value",this);return e}function renderStatic(e,t){var n=this._staticTrees[e];return n&&!t?Array.isArray(n)?cloneVNodes(n):cloneVNode(n):(n=this._staticTrees[e]=this.$options.staticRenderFns[e].call(this._renderProxy),markStatic(n,"__static__"+e,!1),n)}function markOnce(e,t,n){return markStatic(e,"__once__"+t+(n?"_"+n:""),!0),e}function markStatic(e,t,n){if(Array.isArray(e))for(var r=0;r<e.length;r++)e[r]&&"string"!=typeof e[r]&&markStaticNode(e[r],t+"_"+r,n);else markStaticNode(e,t,n)}function markStaticNode(e,t,n){e.isStatic=!0,e.key=t,e.isOnce=n}function initRender(e){e.$vnode=null,e._vnode=null,e._staticTrees=null;var t=e.$options._parentVnode,n=t&&t.context;e.$slots=resolveSlots(e.$options._renderChildren,n),e.$scopedSlots=emptyObject,e._c=function(t,n,r,o){return createElement(e,t,n,r,o,!1)},e.$createElement=function(t,n,r,o){return createElement(e,t,n,r,o,!0)}}function renderMixin(e){e.prototype.$nextTick=function(e){return nextTick(e,this)},e.prototype._render=function(){var e=this,t=e.$options,n=t.render,r=t.staticRenderFns,o=t._parentVnode;if(e._isMounted)for(var i in e.$slots)e.$slots[i]=cloneVNodes(e.$slots[i]);e.$scopedSlots=o&&o.data.scopedSlots||emptyObject,r&&!e._staticTrees&&(e._staticTrees=[]),e.$vnode=o;var a;try{a=n.call(e._renderProxy,e.$createElement)}catch(t){handleError(t,e,"render function"),a="production"!==process.env.NODE_ENV&&e.$options.renderError?e.$options.renderError.call(e._renderProxy,e.$createElement,t):e._vnode}return a instanceof VNode||("production"!==process.env.NODE_ENV&&Array.isArray(a)&&warn("Multiple root nodes returned from render function. Render function should return a single root node.",e),a=createEmptyVNode()),a.parent=o,a},e.prototype._o=markOnce,e.prototype._n=toNumber,e.prototype._s=_toString,e.prototype._l=renderList,e.prototype._t=renderSlot,e.prototype._q=looseEqual,e.prototype._i=looseIndexOf,e.prototype._m=renderStatic,e.prototype._f=resolveFilter,e.prototype._k=checkKeyCodes,e.prototype._b=bindObjectProps,e.prototype._v=createTextVNode,e.prototype._e=createEmptyVNode,e.prototype._u=resolveScopedSlots}function initProvide(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}function initInjections(e){var t=e.$options.inject;if(t)for(var n=Array.isArray(t),r=n?t:hasSymbol?Reflect.ownKeys(t):Object.keys(t),o=(function(o){for(var i=r[o],a=n?i:t[i],s=e;s;){if(s._provided&&a in s._provided){"production"!==process.env.NODE_ENV?defineReactive$$1(e,i,s._provided[a],function(){warn('Avoid mutating an injected value directly since the changes will be overwritten whenever the provided component re-renders. injection being mutated: "'+i+'"',e)}):defineReactive$$1(e,i,s._provided[a]);break}s=s.$parent}}),i=0;i<r.length;i++)o(i)}function initMixin(e){e.prototype._init=function(e){var t=this;t._uid=uid++;var n,r;"production"!==process.env.NODE_ENV&&config.performance&&mark&&(n="vue-perf-init:"+t._uid,r="vue-perf-end:"+t._uid,mark(n)),t._isVue=!0,e&&e._isComponent?initInternalComponent(t,e):t.$options=mergeOptions(resolveConstructorOptions(t.constructor),e||{},t),"production"!==process.env.NODE_ENV?initProxy(t):t._renderProxy=t,t._self=t,initLifecycle(t),initEvents(t),initRender(t),callHook(t,"beforeCreate"),initInjections(t),initState(t),initProvide(t),callHook(t,"created"),"production"!==process.env.NODE_ENV&&config.performance&&mark&&(t._name=formatComponentName(t,!1),mark(r),measure(t._name+" init",n,r)),t.$options.el&&t.$mount(t.$options.el)}}function initInternalComponent(e,t){var n=e.$options=Object.create(e.constructor.options);n.parent=t.parent,n.propsData=t.propsData,n._parentVnode=t._parentVnode,n._parentListeners=t._parentListeners,n._renderChildren=t._renderChildren,n._componentTag=t._componentTag,n._parentElm=t._parentElm,n._refElm=t._refElm,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}function resolveConstructorOptions(e){var t=e.options;if(e.super){var n=resolveConstructorOptions(e.super),r=e.superOptions;if(n!==r){e.superOptions=n;var o=resolveModifiedOptions(e);o&&extend(e.extendOptions,o),t=e.options=mergeOptions(n,e.extendOptions),t.name&&(t.components[t.name]=e)}}return t}function resolveModifiedOptions(e){var t,n=e.options,r=e.sealedOptions;for(var o in n)n[o]!==r[o]&&(t||(t={}),t[o]=dedupe(n[o],r[o]));return t}function dedupe(e,t){if(Array.isArray(e)){var n=[];t=Array.isArray(t)?t:[t];for(var r=0;r<e.length;r++)t.indexOf(e[r])<0&&n.push(e[r]);return n}return e}function Vue$2(e){"production"===process.env.NODE_ENV||this instanceof Vue$2||warn("Vue is a constructor and should be called with the `new` keyword"),this._init(e)}function initUse(e){e.use=function(e){if(!e.installed){var t=toArray(arguments,1);return t.unshift(this),"function"==typeof e.install?e.install.apply(e,t):"function"==typeof e&&e.apply(null,t),e.installed=!0,this}}}function initMixin$1(e){e.mixin=function(e){this.options=mergeOptions(this.options,e)}}function initExtend(e){e.cid=0;var t=1;e.extend=function(e){e=e||{};var n=this,r=n.cid,o=e._Ctor||(e._Ctor={});if(o[r])return o[r];var i=e.name||n.options.name;"production"!==process.env.NODE_ENV&&(/^[a-zA-Z][\w-]*$/.test(i)||warn('Invalid component name: "'+i+'". Component names can only contain alphanumeric characters and the hyphen, and must start with a letter.'));var a=function(e){this._init(e)};return a.prototype=Object.create(n.prototype),a.prototype.constructor=a,a.cid=t++,a.options=mergeOptions(n.options,e),a.super=n,a.options.props&&initProps$1(a),a.options.computed&&initComputed$1(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,config._assetTypes.forEach(function(e){a[e]=n[e]}),i&&(a.options.components[i]=a),a.superOptions=n.options,a.extendOptions=e,a.sealedOptions=extend({},a.options),o[r]=a,a}}function initProps$1(e){var t=e.options.props;for(var n in t)proxy(e.prototype,"_props",n)}function initComputed$1(e){var t=e.options.computed;for(var n in t)defineComputed(e.prototype,n,t[n])}function initAssetRegisters(e){config._assetTypes.forEach(function(t){
e[t]=function(e,n){return n?("production"!==process.env.NODE_ENV&&"component"===t&&config.isReservedTag(e)&&warn("Do not use built-in or reserved HTML elements as component id: "+e),"component"===t&&isPlainObject(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}function getComponentName(e){return e&&(e.Ctor.options.name||e.tag)}function matches(e,t){return"string"==typeof e?e.split(",").indexOf(t)>-1:e instanceof RegExp&&e.test(t)}function pruneCache(e,t){for(var n in e){var r=e[n];if(r){var o=getComponentName(r.componentOptions);o&&!t(o)&&(pruneCacheEntry(r),e[n]=null)}}}function pruneCacheEntry(e){e&&(e.componentInstance._inactive||callHook(e.componentInstance,"deactivated"),e.componentInstance.$destroy())}function initGlobalAPI(e){var t={};t.get=function(){return config},"production"!==process.env.NODE_ENV&&(t.set=function(){warn("Do not replace the Vue.config object, set individual fields instead.")}),Object.defineProperty(e,"config",t),e.util={warn:warn,extend:extend,mergeOptions:mergeOptions,defineReactive:defineReactive$$1},e.set=set,e.delete=del,e.nextTick=nextTick,e.options=Object.create(null),config._assetTypes.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,extend(e.options.components,builtInComponents),initUse(e),initMixin$1(e),initExtend(e),initAssetRegisters(e)}function genClassForVnode(e){for(var t=e.data,n=e,r=e;r.componentInstance;)r=r.componentInstance._vnode,r.data&&(t=mergeClassData(r.data,t));for(;n=n.parent;)n.data&&(t=mergeClassData(t,n.data));return genClassFromData(t)}function mergeClassData(e,t){return{staticClass:concat(e.staticClass,t.staticClass),class:e.class?[e.class,t.class]:t.class}}function genClassFromData(e){var t=e.class,n=e.staticClass;return n||t?concat(n,stringifyClass(t)):""}function concat(e,t){return e?t?e+" "+t:e:t||""}function stringifyClass(e){var t="";if(!e)return t;if("string"==typeof e)return e;if(Array.isArray(e)){for(var n,r=0,o=e.length;r<o;r++)e[r]&&(n=stringifyClass(e[r]))&&(t+=n+" ");return t.slice(0,-1)}if(isObject(e)){for(var i in e)e[i]&&(t+=i+" ");return t.slice(0,-1)}return t}function getTagNamespace(e){return isSVG(e)?"svg":"math"===e?"math":void 0}function isUnknownElement(e){if(!inBrowser)return!0;if(isReservedTag(e))return!1;if(e=e.toLowerCase(),null!=unknownElementCache[e])return unknownElementCache[e];var t=document.createElement(e);return e.indexOf("-")>-1?unknownElementCache[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:unknownElementCache[e]=/HTMLUnknownElement/.test(t.toString())}function query(e){if("string"==typeof e){var t=document.querySelector(e);return t?t:("production"!==process.env.NODE_ENV&&warn("Cannot find element: "+e),document.createElement("div"))}return e}function createElement$1(e,t){var n=document.createElement(e);return"select"!==e?n:(t.data&&t.data.attrs&&void 0!==t.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n)}function createElementNS(e,t){return document.createElementNS(namespaceMap[e],t)}function createTextNode(e){return document.createTextNode(e)}function createComment(e){return document.createComment(e)}function insertBefore(e,t,n){e.insertBefore(t,n)}function removeChild(e,t){e.removeChild(t)}function appendChild(e,t){e.appendChild(t)}function parentNode(e){return e.parentNode}function nextSibling(e){return e.nextSibling}function tagName(e){return e.tagName}function setTextContent(e,t){e.textContent=t}function setAttribute(e,t,n){e.setAttribute(t,n)}function registerRef(e,t){var n=e.data.ref;if(n){var r=e.context,o=e.componentInstance||e.elm,i=r.$refs;t?Array.isArray(i[n])?remove(i[n],o):i[n]===o&&(i[n]=void 0):e.data.refInFor?Array.isArray(i[n])&&i[n].indexOf(o)<0?i[n].push(o):i[n]=[o]:i[n]=o}}function isUndef(e){return void 0===e||null===e}function isDef(e){return void 0!==e&&null!==e}function isTrue(e){return e===!0}function sameVnode(e,t){return e.key===t.key&&e.tag===t.tag&&e.isComment===t.isComment&&isDef(e.data)===isDef(t.data)&&sameInputType(e,t)}function sameInputType(e,t){if("input"!==e.tag)return!0;var n,r=isDef(n=e.data)&&isDef(n=n.attrs)&&n.type,o=isDef(n=t.data)&&isDef(n=n.attrs)&&n.type;return r===o}function createKeyToOldIdx(e,t,n){var r,o,i={};for(r=t;r<=n;++r)o=e[r].key,isDef(o)&&(i[o]=r);return i}function createPatchFunction(e){function t(e){return new VNode(D.tagName(e).toLowerCase(),{},[],void 0,e)}function n(e,t){function n(){0===--n.listeners&&r(e)}return n.listeners=t,n}function r(e){var t=D.parentNode(e);isDef(t)&&D.removeChild(t,e)}function o(e,t,n,r,o){if(e.isRootInsert=!o,!i(e,t,n,r)){var a=e.data,s=e.children,p=e.tag;isDef(p)?("production"!==process.env.NODE_ENV&&(a&&a.pre&&k++,k||e.ns||config.ignoredElements.length&&config.ignoredElements.indexOf(p)>-1||!config.isUnknownElement(p)||warn("Unknown custom element: <"+p+'> - did you register the component correctly? For recursive components, make sure to provide the "name" option.',e.context)),e.elm=e.ns?D.createElementNS(e.ns,p):D.createElement(p,e),d(e),l(e,s,t),isDef(a)&&u(e,t),c(n,e.elm,r),"production"!==process.env.NODE_ENV&&a&&a.pre&&k--):isTrue(e.isComment)?(e.elm=D.createComment(e.text),c(n,e.elm,r)):(e.elm=D.createTextNode(e.text),c(n,e.elm,r))}}function i(e,t,n,r){var o=e.data;if(isDef(o)){var i=isDef(e.componentInstance)&&o.keepAlive;if(isDef(o=o.hook)&&isDef(o=o.init)&&o(e,!1,n,r),isDef(e.componentInstance))return a(e,t),isTrue(i)&&s(e,t,n,r),!0}}function a(e,t){isDef(e.data.pendingInsert)&&t.push.apply(t,e.data.pendingInsert),e.elm=e.componentInstance.$el,p(e)?(u(e,t),d(e)):(registerRef(e),t.push(e))}function s(e,t,n,r){for(var o,i=e;i.componentInstance;)if(i=i.componentInstance._vnode,isDef(o=i.data)&&isDef(o=o.transition)){for(o=0;o<O.activate.length;++o)O.activate[o](emptyNode,i);t.push(i);break}c(n,e.elm,r)}function c(e,t,n){isDef(e)&&(isDef(n)?D.insertBefore(e,t,n):D.appendChild(e,t))}function l(e,t,n){if(Array.isArray(t))for(var r=0;r<t.length;++r)o(t[r],n,e.elm,null,!0);else isPrimitive(e.text)&&D.appendChild(e.elm,D.createTextNode(e.text))}function p(e){for(;e.componentInstance;)e=e.componentInstance._vnode;return isDef(e.tag)}function u(e,t){for(var n=0;n<O.create.length;++n)O.create[n](emptyNode,e);C=e.data.hook,isDef(C)&&(isDef(C.create)&&C.create(emptyNode,e),isDef(C.insert)&&t.push(e))}function d(e){for(var t,n=e;n;)isDef(t=n.context)&&isDef(t=t.$options._scopeId)&&D.setAttribute(e.elm,t,""),n=n.parent;isDef(t=activeInstance)&&t!==e.context&&isDef(t=t.$options._scopeId)&&D.setAttribute(e.elm,t,"")}function f(e,t,n,r,i,a){for(;r<=i;++r)o(n[r],a,e,t)}function v(e){var t,n,r=e.data;if(isDef(r))for(isDef(t=r.hook)&&isDef(t=t.destroy)&&t(e),t=0;t<O.destroy.length;++t)O.destroy[t](e);if(isDef(t=e.children))for(n=0;n<e.children.length;++n)v(e.children[n])}function m(e,t,n,o){for(;n<=o;++n){var i=t[n];isDef(i)&&(isDef(i.tag)?(h(i),v(i)):r(i.elm))}}function h(e,t){if(isDef(t)||isDef(e.data)){var o=O.remove.length+1;for(isDef(t)?t.listeners+=o:t=n(e.elm,o),isDef(C=e.componentInstance)&&isDef(C=C._vnode)&&isDef(C.data)&&h(C,t),C=0;C<O.remove.length;++C)O.remove[C](e,t);isDef(C=e.data.hook)&&isDef(C=C.remove)?C(e,t):t()}else r(e.elm)}function y(e,t,n,r,i){for(var a,s,c,l,p=0,u=0,d=t.length-1,v=t[0],h=t[d],y=n.length-1,_=n[0],b=n[y],E=!i;p<=d&&u<=y;)isUndef(v)?v=t[++p]:isUndef(h)?h=t[--d]:sameVnode(v,_)?(g(v,_,r),v=t[++p],_=n[++u]):sameVnode(h,b)?(g(h,b,r),h=t[--d],b=n[--y]):sameVnode(v,b)?(g(v,b,r),E&&D.insertBefore(e,v.elm,D.nextSibling(h.elm)),v=t[++p],b=n[--y]):sameVnode(h,_)?(g(h,_,r),E&&D.insertBefore(e,h.elm,v.elm),h=t[--d],_=n[++u]):(isUndef(a)&&(a=createKeyToOldIdx(t,p,d)),s=isDef(_.key)?a[_.key]:null,isUndef(s)?(o(_,r,e,v.elm),_=n[++u]):(c=t[s],"production"===process.env.NODE_ENV||c||warn("It seems there are duplicate keys that is causing an update error. Make sure each v-for item has a unique key."),sameVnode(c,_)?(g(c,_,r),t[s]=void 0,E&&D.insertBefore(e,_.elm,v.elm),_=n[++u]):(o(_,r,e,v.elm),_=n[++u])));p>d?(l=isUndef(n[y+1])?null:n[y+1].elm,f(e,l,n,u,y,r)):u>y&&m(e,t,p,d)}function g(e,t,n,r){if(e!==t){if(isTrue(t.isStatic)&&isTrue(e.isStatic)&&t.key===e.key&&(isTrue(t.isCloned)||isTrue(t.isOnce)))return t.elm=e.elm,void(t.componentInstance=e.componentInstance);var o,i=t.data;isDef(i)&&isDef(o=i.hook)&&isDef(o=o.prepatch)&&o(e,t);var a=t.elm=e.elm,s=e.children,c=t.children;if(isDef(i)&&p(t)){for(o=0;o<O.update.length;++o)O.update[o](e,t);isDef(o=i.hook)&&isDef(o=o.update)&&o(e,t)}isUndef(t.text)?isDef(s)&&isDef(c)?s!==c&&y(a,s,c,n,r):isDef(c)?(isDef(e.text)&&D.setTextContent(a,""),f(a,null,c,0,c.length-1,n)):isDef(s)?m(a,s,0,s.length-1):isDef(e.text)&&D.setTextContent(a,""):e.text!==t.text&&D.setTextContent(a,t.text),isDef(i)&&isDef(o=i.hook)&&isDef(o=o.postpatch)&&o(e,t)}}function _(e,t,n){if(isTrue(n)&&isDef(e.parent))e.parent.data.pendingInsert=t;else for(var r=0;r<t.length;++r)t[r].data.hook.insert(t[r])}function b(e,t,n){if("production"!==process.env.NODE_ENV&&!E(e,t))return!1;t.elm=e;var r=t.tag,o=t.data,i=t.children;if(isDef(o)&&(isDef(C=o.hook)&&isDef(C=C.init)&&C(t,!0),isDef(C=t.componentInstance)))return a(t,n),!0;if(isDef(r)){if(isDef(i))if(e.hasChildNodes()){for(var s=!0,c=e.firstChild,p=0;p<i.length;p++){if(!c||!b(c,i[p],n)){s=!1;break}c=c.nextSibling}if(!s||c)return"production"===process.env.NODE_ENV||"undefined"==typeof console||A||(A=!0,console.warn("Parent: ",e),console.warn("Mismatching childNodes vs. VNodes: ",e.childNodes,i)),!1}else l(t,i,n);if(isDef(o))for(var d in o)if(!x(d)){u(t,n);break}}else e.data!==t.text&&(e.data=t.text);return!0}function E(e,t){return isDef(t.tag)?0===t.tag.indexOf("vue-component")||t.tag.toLowerCase()===(e.tagName&&e.tagName.toLowerCase()):e.nodeType===(t.isComment?8:3)}var C,N,O={},w=e.modules,D=e.nodeOps;for(C=0;C<hooks.length;++C)for(O[hooks[C]]=[],N=0;N<w.length;++N)isDef(w[N][hooks[C]])&&O[hooks[C]].push(w[N][hooks[C]]);var k=0,A=!1,x=makeMap("attrs,style,class,staticClass,staticStyle,key");return function(e,n,r,i,a,s){if(isUndef(n))return void(isDef(e)&&v(e));var c=!1,l=[];if(isUndef(e))c=!0,o(n,l,a,s);else{var u=isDef(e.nodeType);if(!u&&sameVnode(e,n))g(e,n,l,i);else{if(u){if(1===e.nodeType&&e.hasAttribute("server-rendered")&&(e.removeAttribute("server-rendered"),r=!0),isTrue(r)){if(b(e,n,l))return _(n,l,!0),e;"production"!==process.env.NODE_ENV&&warn("The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. Bailing hydration and performing full client-side render.")}e=t(e)}var d=e.elm,f=D.parentNode(d);if(o(n,l,d._leaveCb?null:f,D.nextSibling(d)),isDef(n.parent)){for(var h=n.parent;h;)h.elm=n.elm,h=h.parent;if(p(n))for(var y=0;y<O.create.length;++y)O.create[y](emptyNode,n.parent)}isDef(f)?m(f,[e],0,0):isDef(e.tag)&&v(e)}}return _(n,l,c),n.elm}}function updateDirectives(e,t){(e.data.directives||t.data.directives)&&_update(e,t)}function _update(e,t){var n,r,o,i=e===emptyNode,a=t===emptyNode,s=normalizeDirectives$1(e.data.directives,e.context),c=normalizeDirectives$1(t.data.directives,t.context),l=[],p=[];for(n in c)r=s[n],o=c[n],r?(o.oldValue=r.value,callHook$1(o,"update",t,e),o.def&&o.def.componentUpdated&&p.push(o)):(callHook$1(o,"bind",t,e),o.def&&o.def.inserted&&l.push(o));if(l.length){var u=function(){for(var n=0;n<l.length;n++)callHook$1(l[n],"inserted",t,e)};i?mergeVNodeHook(t.data.hook||(t.data.hook={}),"insert",u):u()}if(p.length&&mergeVNodeHook(t.data.hook||(t.data.hook={}),"postpatch",function(){for(var n=0;n<p.length;n++)callHook$1(p[n],"componentUpdated",t,e)}),!i)for(n in s)c[n]||callHook$1(s[n],"unbind",e,e,a)}function normalizeDirectives$1(e,t){var n=Object.create(null);if(!e)return n;var r,o;for(r=0;r<e.length;r++)o=e[r],o.modifiers||(o.modifiers=emptyModifiers),n[getRawDirName(o)]=o,o.def=resolveAsset(t.$options,"directives",o.name,!0);return n}function getRawDirName(e){return e.rawName||e.name+"."+Object.keys(e.modifiers||{}).join(".")}function callHook$1(e,t,n,r,o){var i=e.def&&e.def[t];i&&i(n.elm,e,n,r,o)}function updateAttrs(e,t){if(e.data.attrs||t.data.attrs){var n,r,o,i=t.elm,a=e.data.attrs||{},s=t.data.attrs||{};s.__ob__&&(s=t.data.attrs=extend({},s));for(n in s)r=s[n],o=a[n],o!==r&&setAttr(i,n,r);isIE9&&s.value!==a.value&&setAttr(i,"value",s.value);for(n in a)null==s[n]&&(isXlink(n)?i.removeAttributeNS(xlinkNS,getXlinkProp(n)):isEnumeratedAttr(n)||i.removeAttribute(n))}}function setAttr(e,t,n){isBooleanAttr(t)?isFalsyAttrValue(n)?e.removeAttribute(t):e.setAttribute(t,t):isEnumeratedAttr(t)?e.setAttribute(t,isFalsyAttrValue(n)||"false"===n?"false":"true"):isXlink(t)?isFalsyAttrValue(n)?e.removeAttributeNS(xlinkNS,getXlinkProp(t)):e.setAttributeNS(xlinkNS,t,n):isFalsyAttrValue(n)?e.removeAttribute(t):e.setAttribute(t,n)}function updateClass(e,t){var n=t.elm,r=t.data,o=e.data;if(r.staticClass||r.class||o&&(o.staticClass||o.class)){var i=genClassForVnode(t),a=n._transitionClasses;a&&(i=concat(i,stringifyClass(a))),i!==n._prevClass&&(n.setAttribute("class",i),n._prevClass=i)}}function wrapFilter(e,t){var n=t.indexOf("(");if(n<0)return'_f("'+t+'")('+e+")";var r=t.slice(0,n),o=t.slice(n+1);return'_f("'+r+'")('+e+","+o}function normalizeEvents(e){var t;e[RANGE_TOKEN]&&(t=isIE?"change":"input",e[t]=[].concat(e[RANGE_TOKEN],e[t]||[]),delete e[RANGE_TOKEN]),e[CHECKBOX_RADIO_TOKEN]&&(t=isChrome?"click":"change",e[t]=[].concat(e[CHECKBOX_RADIO_TOKEN],e[t]||[]),delete e[CHECKBOX_RADIO_TOKEN])}function add$1(e,t,n,r){if(n){var o=t,i=target$1;t=function(n){var a=1===arguments.length?o(n):o.apply(null,arguments);null!==a&&remove$2(e,t,r,i)}}target$1.addEventListener(e,t,r)}function remove$2(e,t,n,r){(r||target$1).removeEventListener(e,t,n)}function updateDOMListeners(e,t){if(e.data.on||t.data.on){var n=t.data.on||{},r=e.data.on||{};target$1=t.elm,normalizeEvents(n),updateListeners(n,r,add$1,remove$2,t.context)}}function updateDOMProps(e,t){if(e.data.domProps||t.data.domProps){var n,r,o=t.elm,i=e.data.domProps||{},a=t.data.domProps||{};a.__ob__&&(a=t.data.domProps=extend({},a));for(n in i)null==a[n]&&(o[n]="");for(n in a)if(r=a[n],"textContent"!==n&&"innerHTML"!==n||(t.children&&(t.children.length=0),r!==i[n]))if("value"===n){o._value=r;var s=null==r?"":String(r);shouldUpdateValue(o,t,s)&&(o.value=s)}else o[n]=r}}function shouldUpdateValue(e,t,n){return!e.composing&&("option"===t.tag||isDirty(e,n)||isInputChanged(e,n))}function isDirty(e,t){return document.activeElement!==e&&e.value!==t}function isInputChanged(e,t){var n=e.value,r=e._vModifiers;return r&&r.number||"number"===e.type?toNumber(n)!==toNumber(t):r&&r.trim?n.trim()!==t.trim():n!==t}function normalizeStyleData(e){var t=normalizeStyleBinding(e.style);return e.staticStyle?extend(e.staticStyle,t):t}function normalizeStyleBinding(e){return Array.isArray(e)?toObject(e):"string"==typeof e?parseStyleText(e):e}function getStyle(e,t){var n,r={};if(t)for(var o=e;o.componentInstance;)o=o.componentInstance._vnode,o.data&&(n=normalizeStyleData(o.data))&&extend(r,n);(n=normalizeStyleData(e.data))&&extend(r,n);for(var i=e;i=i.parent;)i.data&&(n=normalizeStyleData(i.data))&&extend(r,n);return r}function updateStyle(e,t){var n=t.data,r=e.data;if(n.staticStyle||n.style||r.staticStyle||r.style){var o,i,a=t.elm,s=e.data.staticStyle,c=e.data.style||{},l=s||c,p=normalizeStyleBinding(t.data.style)||{};t.data.style=p.__ob__?extend({},p):p;var u=getStyle(t,!0);for(i in l)null==u[i]&&setProp(a,i,"");for(i in u)o=u[i],o!==l[i]&&setProp(a,i,null==o?"":o)}}function addClass(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(/\s+/).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function removeClass(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(/\s+/).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t);else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");e.setAttribute("class",n.trim())}}function resolveTransition(e){if(e){if("object"==typeof e){var t={};return e.css!==!1&&extend(t,autoCssTransition(e.name||"v")),extend(t,e),t}return"string"==typeof e?autoCssTransition(e):void 0}}function nextFrame(e){raf(function(){raf(e)})}function addTransitionClass(e,t){(e._transitionClasses||(e._transitionClasses=[])).push(t),addClass(e,t)}function removeTransitionClass(e,t){e._transitionClasses&&remove(e._transitionClasses,t),removeClass(e,t)}function whenTransitionEnds(e,t,n){var r=getTransitionInfo(e,t),o=r.type,i=r.timeout,a=r.propCount;if(!o)return n();var s=o===TRANSITION?transitionEndEvent:animationEndEvent,c=0,l=function(){e.removeEventListener(s,p),n()},p=function(t){t.target===e&&++c>=a&&l()};setTimeout(function(){c<a&&l()},i+1),e.addEventListener(s,p)}function getTransitionInfo(e,t){var n,r=window.getComputedStyle(e),o=r[transitionProp+"Delay"].split(", "),i=r[transitionProp+"Duration"].split(", "),a=getTimeout(o,i),s=r[animationProp+"Delay"].split(", "),c=r[animationProp+"Duration"].split(", "),l=getTimeout(s,c),p=0,u=0;t===TRANSITION?a>0&&(n=TRANSITION,p=a,u=i.length):t===ANIMATION?l>0&&(n=ANIMATION,p=l,u=c.length):(p=Math.max(a,l),n=p>0?a>l?TRANSITION:ANIMATION:null,u=n?n===TRANSITION?i.length:c.length:0);var d=n===TRANSITION&&transformRE.test(r[transitionProp+"Property"]);return{type:n,timeout:p,propCount:u,hasTransform:d}}function getTimeout(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max.apply(null,t.map(function(t,n){return toMs(t)+toMs(e[n])}))}function toMs(e){return 1e3*Number(e.slice(0,-1))}function enter(e,t){var n=e.elm;n._leaveCb&&(n._leaveCb.cancelled=!0,n._leaveCb());var r=resolveTransition(e.data.transition);if(r&&!n._enterCb&&1===n.nodeType){for(var o=r.css,i=r.type,a=r.enterClass,s=r.enterToClass,c=r.enterActiveClass,l=r.appearClass,p=r.appearToClass,u=r.appearActiveClass,d=r.beforeEnter,f=r.enter,v=r.afterEnter,m=r.enterCancelled,h=r.beforeAppear,y=r.appear,g=r.afterAppear,_=r.appearCancelled,b=r.duration,E=activeInstance,C=activeInstance.$vnode;C&&C.parent;)C=C.parent,E=C.context;var N=!E._isMounted||!e.isRootInsert;if(!N||y||""===y){var O=N&&l?l:a,w=N&&u?u:c,D=N&&p?p:s,k=N?h||d:d,A=N&&"function"==typeof y?y:f,x=N?g||v:v,$=N?_||m:m,T=toNumber(isObject(b)?b.enter:b);"production"!==process.env.NODE_ENV&&null!=T&&checkDuration(T,"enter",e);var S=o!==!1&&!isIE9,V=getHookArgumentsLength(A),I=n._enterCb=once(function(){S&&(removeTransitionClass(n,D),removeTransitionClass(n,w)),I.cancelled?(S&&removeTransitionClass(n,O),$&&$(n)):x&&x(n),n._enterCb=null});e.data.show||mergeVNodeHook(e.data.hook||(e.data.hook={}),"insert",function(){var t=n.parentNode,r=t&&t._pending&&t._pending[e.key];r&&r.tag===e.tag&&r.elm._leaveCb&&r.elm._leaveCb(),A&&A(n,I)}),k&&k(n),S&&(addTransitionClass(n,O),addTransitionClass(n,w),nextFrame(function(){addTransitionClass(n,D),removeTransitionClass(n,O),I.cancelled||V||(isValidDuration(T)?setTimeout(I,T):whenTransitionEnds(n,i,I))})),e.data.show&&(t&&t(),A&&A(n,I)),S||V||I()}}}function leave(e,t){function n(){_.cancelled||(e.data.show||((r.parentNode._pending||(r.parentNode._pending={}))[e.key]=e),p&&p(r),h&&(addTransitionClass(r,s),addTransitionClass(r,l),nextFrame(function(){addTransitionClass(r,c),removeTransitionClass(r,s),_.cancelled||y||(isValidDuration(g)?setTimeout(_,g):whenTransitionEnds(r,a,_))})),u&&u(r,_),h||y||_())}var r=e.elm;r._enterCb&&(r._enterCb.cancelled=!0,r._enterCb());var o=resolveTransition(e.data.transition);if(!o)return t();if(!r._leaveCb&&1===r.nodeType){var i=o.css,a=o.type,s=o.leaveClass,c=o.leaveToClass,l=o.leaveActiveClass,p=o.beforeLeave,u=o.leave,d=o.afterLeave,f=o.leaveCancelled,v=o.delayLeave,m=o.duration,h=i!==!1&&!isIE9,y=getHookArgumentsLength(u),g=toNumber(isObject(m)?m.leave:m);"production"!==process.env.NODE_ENV&&null!=g&&checkDuration(g,"leave",e);var _=r._leaveCb=once(function(){r.parentNode&&r.parentNode._pending&&(r.parentNode._pending[e.key]=null),h&&(removeTransitionClass(r,c),removeTransitionClass(r,l)),_.cancelled?(h&&removeTransitionClass(r,s),f&&f(r)):(t(),d&&d(r)),r._leaveCb=null});v?v(n):n()}}function checkDuration(e,t,n){"number"!=typeof e?warn("<transition> explicit "+t+" duration is not a valid number - got "+JSON.stringify(e)+".",n.context):isNaN(e)&&warn("<transition> explicit "+t+" duration is NaN - the duration expression might be incorrect.",n.context)}function isValidDuration(e){return"number"==typeof e&&!isNaN(e)}function getHookArgumentsLength(e){if(!e)return!1;var t=e.fns;return t?getHookArgumentsLength(Array.isArray(t)?t[0]:t):(e._length||e.length)>1}function _enter(e,t){t.data.show||enter(t)}function setSelected(e,t,n){var r=t.value,o=e.multiple;if(o&&!Array.isArray(r))return void("production"!==process.env.NODE_ENV&&warn('<select multiple v-model="'+t.expression+'"> expects an Array value for its binding, but got '+Object.prototype.toString.call(r).slice(8,-1),n));for(var i,a,s=0,c=e.options.length;s<c;s++)if(a=e.options[s],o)i=looseIndexOf(r,getValue(a))>-1,a.selected!==i&&(a.selected=i);else if(looseEqual(getValue(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));o||(e.selectedIndex=-1)}function hasNoMatchingOption(e,t){for(var n=0,r=t.length;n<r;n++)if(looseEqual(getValue(t[n]),e))return!1;return!0}function getValue(e){return"_value"in e?e._value:e.value}function onCompositionStart(e){e.target.composing=!0}function onCompositionEnd(e){e.target.composing=!1,trigger(e.target,"input")}function trigger(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function locateNode(e){return!e.componentInstance||e.data&&e.data.transition?e:locateNode(e.componentInstance._vnode)}function getRealChild(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?getRealChild(getFirstComponentChild(t.children)):e}function extractTransitionData(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var o=n._parentListeners;for(var i in o)t[camelize(i)]=o[i];return t}function placeholder(e,t){return/\d-keep-alive$/.test(t.tag)?e("keep-alive"):null}function hasParentTransition(e){for(;e=e.parent;)if(e.data.transition)return!0}function isSameChild(e,t){return t.key===e.key&&t.tag===e.tag}function callPendingCbs(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function recordPosition(e){e.data.newPos=e.elm.getBoundingClientRect()}function applyTranslation(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,o=t.top-n.top;if(r||o){e.data.moved=!0;var i=e.elm.style;i.transform=i.WebkitTransform="translate("+r+"px,"+o+"px)",i.transitionDuration="0s"}}var isBuiltInTag=makeMap("slot,component",!0),hasOwnProperty=Object.prototype.hasOwnProperty,camelizeRE=/-(\w)/g,camelize=cached(function(e){return e.replace(camelizeRE,function(e,t){return t?t.toUpperCase():""})}),capitalize=cached(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),hyphenateRE=/([^-])([A-Z])/g,hyphenate=cached(function(e){return e.replace(hyphenateRE,"$1-$2").replace(hyphenateRE,"$1-$2").toLowerCase()}),toString=Object.prototype.toString,OBJECT_STRING="[object Object]",no=function(){return!1},identity=function(e){return e},config={optionMergeStrategies:Object.create(null),silent:!1,productionTip:"production"!==process.env.NODE_ENV,devtools:"production"!==process.env.NODE_ENV,performance:!1,errorHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:no,isUnknownElement:no,getTagNamespace:noop,parsePlatformTagName:identity,mustUseProp:no,_assetTypes:["component","directive","filter"],_lifecycleHooks:["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated"],_maxUpdateCount:100},emptyObject=Object.freeze({}),bailRE=/[^\w.$]/,hasProto="__proto__"in{},inBrowser="undefined"!=typeof window,UA=inBrowser&&window.navigator.userAgent.toLowerCase(),isIE=UA&&/msie|trident/.test(UA),isIE9=UA&&UA.indexOf("msie 9.0")>0,isEdge=UA&&UA.indexOf("edge/")>0,isAndroid=UA&&UA.indexOf("android")>0,isIOS=UA&&/iphone|ipad|ipod|ios/.test(UA),isChrome=UA&&/chrome\/\d+/.test(UA)&&!isEdge,_isServer,isServerRendering=function(){return void 0===_isServer&&(_isServer=!inBrowser&&"undefined"!=typeof global&&"server"===global.process.env.VUE_ENV),_isServer},devtools=inBrowser&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__,hasSymbol="undefined"!=typeof Symbol&&isNative(Symbol)&&"undefined"!=typeof Reflect&&isNative(Reflect.ownKeys),nextTick=function(){function e(){r=!1;var e=n.slice(0);n.length=0;for(var t=0;t<e.length;t++)e[t]()}var t,n=[],r=!1;if("undefined"!=typeof Promise&&isNative(Promise)){var o=Promise.resolve(),i=function(e){console.error(e)};t=function(){o.then(e).catch(i),isIOS&&setTimeout(noop)}}else if("undefined"==typeof MutationObserver||!isNative(MutationObserver)&&"[object MutationObserverConstructor]"!==MutationObserver.toString())t=function(){setTimeout(e,0)};else{var a=1,s=new MutationObserver(e),c=document.createTextNode(String(a));s.observe(c,{characterData:!0}),t=function(){a=(a+1)%2,c.data=String(a)}}return function(e,o){var i;if(n.push(function(){e&&e.call(o),i&&i(o)}),r||(r=!0,t()),!e&&"undefined"!=typeof Promise)return new Promise(function(e){i=e})}}(),_Set;_Set="undefined"!=typeof Set&&isNative(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return this.set[e]===!0},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var warn=noop,tip=noop,formatComponentName;if("production"!==process.env.NODE_ENV){var hasConsole="undefined"!=typeof console,classifyRE=/(?:^|[-_])(\w)/g,classify=function(e){return e.replace(classifyRE,function(e){return e.toUpperCase()}).replace(/[-_]/g,"")};warn=function(e,t){hasConsole&&!config.silent&&console.error("[Vue warn]: "+e+" "+(t?formatLocation(formatComponentName(t)):""))},tip=function(e,t){hasConsole&&!config.silent&&console.warn("[Vue tip]: "+e+" "+(t?formatLocation(formatComponentName(t)):""))},formatComponentName=function(e,t){if(e.$root===e)return"<Root>";var n="string"==typeof e?e:"function"==typeof e&&e.options?e.options.name:e._isVue?e.$options.name||e.$options._componentTag:e.name,r=e._isVue&&e.$options.__file;if(!n&&r){var o=r.match(/([^\/\\]+)\.vue$/);n=o&&o[1]}return(n?"<"+classify(n)+">":"<Anonymous>")+(r&&t!==!1?" at "+r:"")};var formatLocation=function(e){return"<Anonymous>"===e&&(e+=' - use the "name" option for better debugging messages.'),"\n(found in "+e+")"}}var uid$1=0,Dep=function(){this.id=uid$1++,this.subs=[]};Dep.prototype.addSub=function(e){this.subs.push(e)},Dep.prototype.removeSub=function(e){remove(this.subs,e)},Dep.prototype.depend=function(){Dep.target&&Dep.target.addDep(this)},Dep.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t<n;t++)e[t].update()},Dep.target=null;var targetStack=[],arrayProto=Array.prototype,arrayMethods=Object.create(arrayProto);["push","pop","shift","unshift","splice","sort","reverse"].forEach(function(e){var t=arrayProto[e];def(arrayMethods,e,function(){for(var n=arguments,r=arguments.length,o=new Array(r);r--;)o[r]=n[r];var i,a=t.apply(this,o),s=this.__ob__;switch(e){case"push":i=o;break;case"unshift":i=o;break;case"splice":i=o.slice(2)}return i&&s.observeArray(i),s.dep.notify(),a})});var arrayKeys=Object.getOwnPropertyNames(arrayMethods),observerState={shouldConvert:!0,isSettingProps:!1},Observer=function(e){if(this.value=e,this.dep=new Dep,this.vmCount=0,def(e,"__ob__",this),Array.isArray(e)){var t=hasProto?protoAugment:copyAugment;t(e,arrayMethods,arrayKeys),this.observeArray(e)}else this.walk(e)};Observer.prototype.walk=function(e){for(var t=Object.keys(e),n=0;n<t.length;n++)defineReactive$$1(e,t[n],e[t[n]])},Observer.prototype.observeArray=function(e){for(var t=0,n=e.length;t<n;t++)observe(e[t])};var strats=config.optionMergeStrategies;"production"!==process.env.NODE_ENV&&(strats.el=strats.propsData=function(e,t,n,r){return n||warn('option "'+r+'" can only be used during instance creation with the `new` keyword.'),defaultStrat(e,t)}),strats.data=function(e,t,n){return n?e||t?function(){var r="function"==typeof t?t.call(n):t,o="function"==typeof e?e.call(n):void 0;return r?mergeData(r,o):o}:void 0:t?"function"!=typeof t?("production"!==process.env.NODE_ENV&&warn('The "data" option should be a function that returns a per-instance value in component definitions.',n),e):e?function(){return mergeData(t.call(this),e.call(this))}:t:e},config._lifecycleHooks.forEach(function(e){strats[e]=mergeHook}),config._assetTypes.forEach(function(e){strats[e+"s"]=mergeAssets}),strats.watch=function(e,t){if(!t)return Object.create(e||null);if(!e)return t;var n={};extend(n,e);for(var r in t){var o=n[r],i=t[r];o&&!Array.isArray(o)&&(o=[o]),n[r]=o?o.concat(i):[i]}return n},strats.props=strats.methods=strats.computed=function(e,t){if(!t)return Object.create(e||null);if(!e)return t;var n=Object.create(null);return extend(n,e),extend(n,t),n};var defaultStrat=function(e,t){return void 0===t?e:t},initProxy;if("production"!==process.env.NODE_ENV){var allowedGlobals=makeMap("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,require"),warnNonPresent=function(e,t){warn('Property or method "'+t+'" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.',e)},hasProxy="undefined"!=typeof Proxy&&Proxy.toString().match(/native code/);if(hasProxy){var isBuiltInModifier=makeMap("stop,prevent,self,ctrl,shift,alt,meta");config.keyCodes=new Proxy(config.keyCodes,{set:function(e,t,n){return isBuiltInModifier(t)?(warn("Avoid overwriting built-in modifier in config.keyCodes: ."+t),!1):(e[t]=n,!0)}})}var hasHandler={has:function e(t,n){var e=n in t,r=allowedGlobals(n)||"_"===n.charAt(0);return e||r||warnNonPresent(t,n),e||!r}},getHandler={get:function(e,t){return"string"!=typeof t||t in e||warnNonPresent(e,t),e[t]}};initProxy=function(e){if(hasProxy){var t=e.$options,n=t.render&&t.render._withStripped?getHandler:hasHandler;e._renderProxy=new Proxy(e,n)}else e._renderProxy=e}}var mark,measure;if("production"!==process.env.NODE_ENV){var perf=inBrowser&&window.performance;perf&&perf.mark&&perf.measure&&perf.clearMarks&&perf.clearMeasures&&(mark=function(e){return perf.mark(e)},measure=function(e,t,n){perf.measure(e,t,n),perf.clearMarks(t),perf.clearMarks(n),perf.clearMeasures(e)})}var VNode=function(e,t,n,r,o,i,a){this.tag=e,this.data=t,this.children=n,this.text=r,this.elm=o,this.ns=void 0,this.context=i,this.functionalContext=void 0,this.key=t&&t.key,this.componentOptions=a,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1},prototypeAccessors={child:{}};prototypeAccessors.child.get=function(){return this.componentInstance},Object.defineProperties(VNode.prototype,prototypeAccessors);var createEmptyVNode=function(){var e=new VNode;return e.text="",e.isComment=!0,e},normalizeEvent=cached(function(e){var t="~"===e.charAt(0);e=t?e.slice(1):e;var n="!"===e.charAt(0);return e=n?e.slice(1):e,{name:e,once:t,capture:n}}),target,activeInstance=null,queue=[],has={},circular={},waiting=!1,flushing=!1,index=0,uid$2=0,Watcher=function(e,t,n,r){this.vm=e,e._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++uid$2,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new _Set,this.newDepIds=new _Set,this.expression="production"!==process.env.NODE_ENV?t.toString():"","function"==typeof t?this.getter=t:(this.getter=parsePath(t),this.getter||(this.getter=function(){},"production"!==process.env.NODE_ENV&&warn('Failed watching path: "'+t+'" Watcher only accepts simple dot-delimited paths. For full control, use a function instead.',e))),
this.value=this.lazy?void 0:this.get()};Watcher.prototype.get=function(){pushTarget(this);var e,t=this.vm;if(this.user)try{e=this.getter.call(t,t)}catch(e){handleError(e,t,'getter for watcher "'+this.expression+'"')}else e=this.getter.call(t,t);return this.deep&&traverse(e),popTarget(),this.cleanupDeps(),e},Watcher.prototype.addDep=function(e){var t=e.id;this.newDepIds.has(t)||(this.newDepIds.add(t),this.newDeps.push(e),this.depIds.has(t)||e.addSub(this))},Watcher.prototype.cleanupDeps=function(){for(var e=this,t=this.deps.length;t--;){var n=e.deps[t];e.newDepIds.has(n.id)||n.removeSub(e)}var r=this.depIds;this.depIds=this.newDepIds,this.newDepIds=r,this.newDepIds.clear(),r=this.deps,this.deps=this.newDeps,this.newDeps=r,this.newDeps.length=0},Watcher.prototype.update=function(){this.lazy?this.dirty=!0:this.sync?this.run():queueWatcher(this)},Watcher.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||isObject(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){handleError(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},Watcher.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},Watcher.prototype.depend=function(){for(var e=this,t=this.deps.length;t--;)e.deps[t].depend()},Watcher.prototype.teardown=function(){var e=this;if(this.active){this.vm._isBeingDestroyed||remove(this.vm._watchers,this);for(var t=this.deps.length;t--;)e.deps[t].removeSub(e);this.active=!1}};var seenObjects=new _Set,sharedPropertyDefinition={enumerable:!0,configurable:!0,get:noop,set:noop},isReservedProp={key:1,ref:1,slot:1},computedWatcherOptions={lazy:!0},componentVNodeHooks={init:function(e,t,n,r){if(!e.componentInstance||e.componentInstance._isDestroyed){var o=e.componentInstance=createComponentInstanceForVnode(e,activeInstance,n,r);o.$mount(t?e.elm:void 0,t)}else if(e.data.keepAlive){var i=e;componentVNodeHooks.prepatch(i,i)}},prepatch:function(e,t){var n=t.componentOptions,r=t.componentInstance=e.componentInstance;updateChildComponent(r,n.propsData,n.listeners,t,n.children)},insert:function(e){e.componentInstance._isMounted||(e.componentInstance._isMounted=!0,callHook(e.componentInstance,"mounted")),e.data.keepAlive&&activateChildComponent(e.componentInstance,!0)},destroy:function(e){e.componentInstance._isDestroyed||(e.data.keepAlive?deactivateChildComponent(e.componentInstance,!0):e.componentInstance.$destroy())}},hooksToMerge=Object.keys(componentVNodeHooks),SIMPLE_NORMALIZE=1,ALWAYS_NORMALIZE=2,uid=0;initMixin(Vue$2),stateMixin(Vue$2),eventsMixin(Vue$2),lifecycleMixin(Vue$2),renderMixin(Vue$2);var patternTypes=[String,RegExp],KeepAlive={name:"keep-alive",abstract:!0,props:{include:patternTypes,exclude:patternTypes},created:function(){this.cache=Object.create(null)},destroyed:function(){var e=this;for(var t in e.cache)pruneCacheEntry(e.cache[t])},watch:{include:function(e){pruneCache(this.cache,function(t){return matches(e,t)})},exclude:function(e){pruneCache(this.cache,function(t){return!matches(e,t)})}},render:function(){var e=getFirstComponentChild(this.$slots.default),t=e&&e.componentOptions;if(t){var n=getComponentName(t);if(n&&(this.include&&!matches(this.include,n)||this.exclude&&matches(this.exclude,n)))return e;var r=null==e.key?t.Ctor.cid+(t.tag?"::"+t.tag:""):e.key;this.cache[r]?e.componentInstance=this.cache[r].componentInstance:this.cache[r]=e,e.data.keepAlive=!0}return e}},builtInComponents={KeepAlive:KeepAlive};initGlobalAPI(Vue$2),Object.defineProperty(Vue$2.prototype,"$isServer",{get:isServerRendering}),Vue$2.version="2.2.6";var acceptValue=makeMap("input,textarea,option,select"),mustUseProp=function(e,t,n){return"value"===n&&acceptValue(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},isEnumeratedAttr=makeMap("contenteditable,draggable,spellcheck"),isBooleanAttr=makeMap("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),xlinkNS="http://www.w3.org/1999/xlink",isXlink=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},getXlinkProp=function(e){return isXlink(e)?e.slice(6,e.length):""},isFalsyAttrValue=function(e){return null==e||e===!1},namespaceMap={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},isHTMLTag=makeMap("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template"),isSVG=makeMap("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0),isReservedTag=function(e){return isHTMLTag(e)||isSVG(e)},unknownElementCache=Object.create(null),nodeOps=Object.freeze({createElement:createElement$1,createElementNS:createElementNS,createTextNode:createTextNode,createComment:createComment,insertBefore:insertBefore,removeChild:removeChild,appendChild:appendChild,parentNode:parentNode,nextSibling:nextSibling,tagName:tagName,setTextContent:setTextContent,setAttribute:setAttribute}),ref={create:function(e,t){registerRef(t)},update:function(e,t){e.data.ref!==t.data.ref&&(registerRef(e,!0),registerRef(t))},destroy:function(e){registerRef(e,!0)}},emptyNode=new VNode("",{},[]),hooks=["create","activate","update","remove","destroy"],directives={create:updateDirectives,update:updateDirectives,destroy:function(e){updateDirectives(e,emptyNode)}},emptyModifiers=Object.create(null),baseModules=[ref,directives],attrs={create:updateAttrs,update:updateAttrs},klass={create:updateClass,update:updateClass},validDivisionCharRE=/[\w).+\-_$\]]/,str,index$1,RANGE_TOKEN="__r",CHECKBOX_RADIO_TOKEN="__c",target$1,events={create:updateDOMListeners,update:updateDOMListeners},domProps={create:updateDOMProps,update:updateDOMProps},parseStyleText=cached(function(e){var t={},n=/;(?![^(]*\))/g,r=/:(.+)/;return e.split(n).forEach(function(e){if(e){var n=e.split(r);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}),cssVarRE=/^--/,importantRE=/\s*!important$/,setProp=function(e,t,n){cssVarRE.test(t)?e.style.setProperty(t,n):importantRE.test(n)?e.style.setProperty(t,n.replace(importantRE,""),"important"):e.style[normalize(t)]=n},prefixes=["Webkit","Moz","ms"],testEl,normalize=cached(function(e){if(testEl=testEl||document.createElement("div"),e=camelize(e),"filter"!==e&&e in testEl.style)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=0;n<prefixes.length;n++){var r=prefixes[n]+t;if(r in testEl.style)return r}}),style={create:updateStyle,update:updateStyle},autoCssTransition=cached(function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}}),hasTransition=inBrowser&&!isIE9,TRANSITION="transition",ANIMATION="animation",transitionProp="transition",transitionEndEvent="transitionend",animationProp="animation",animationEndEvent="animationend";hasTransition&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(transitionProp="WebkitTransition",transitionEndEvent="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(animationProp="WebkitAnimation",animationEndEvent="webkitAnimationEnd"));var raf=inBrowser&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout,transformRE=/\b(transform|all)(,|$)/,transition=inBrowser?{create:_enter,activate:_enter,remove:function(e,t){e.data.show?t():leave(e,t)}}:{},platformModules=[attrs,klass,events,domProps,style,transition],modules=platformModules.concat(baseModules),patch=createPatchFunction({nodeOps:nodeOps,modules:modules});isIE9&&document.addEventListener("selectionchange",function(){var e=document.activeElement;e&&e.vmodel&&trigger(e,"input")});var model$1={inserted:function(e,t,n){if("select"===n.tag){var r=function(){setSelected(e,t,n.context)};r(),(isIE||isEdge)&&setTimeout(r,0)}else"textarea"!==n.tag&&"text"!==e.type&&"password"!==e.type||(e._vModifiers=t.modifiers,t.modifiers.lazy||(isAndroid||(e.addEventListener("compositionstart",onCompositionStart),e.addEventListener("compositionend",onCompositionEnd)),isIE9&&(e.vmodel=!0)))},componentUpdated:function(e,t,n){if("select"===n.tag){setSelected(e,t,n.context);var r=e.multiple?t.value.some(function(t){return hasNoMatchingOption(t,e.options)}):t.value!==t.oldValue&&hasNoMatchingOption(t.value,e.options);r&&trigger(e,"change")}}},show={bind:function(e,t,n){var r=t.value;n=locateNode(n);var o=n.data&&n.data.transition,i=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&o&&!isIE9?(n.data.show=!0,enter(n,function(){e.style.display=i})):e.style.display=r?i:"none"},update:function(e,t,n){var r=t.value,o=t.oldValue;if(r!==o){n=locateNode(n);var i=n.data&&n.data.transition;i&&!isIE9?(n.data.show=!0,r?enter(n,function(){e.style.display=e.__vOriginalDisplay}):leave(n,function(){e.style.display="none"})):e.style.display=r?e.__vOriginalDisplay:"none"}},unbind:function(e,t,n,r,o){o||(e.style.display=e.__vOriginalDisplay)}},platformDirectives={model:model$1,show:show},transitionProps={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]},Transition={name:"transition",props:transitionProps,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(function(e){return e.tag}),n.length)){"production"!==process.env.NODE_ENV&&n.length>1&&warn("<transition> can only be used on a single element. Use <transition-group> for lists.",this.$parent);var r=this.mode;"production"!==process.env.NODE_ENV&&r&&"in-out"!==r&&"out-in"!==r&&warn("invalid <transition> mode: "+r,this.$parent);var o=n[0];if(hasParentTransition(this.$vnode))return o;var i=getRealChild(o);if(!i)return o;if(this._leaving)return placeholder(e,o);var a="__transition-"+this._uid+"-";i.key=null==i.key?a+i.tag:isPrimitive(i.key)?0===String(i.key).indexOf(a)?i.key:a+i.key:i.key;var s=(i.data||(i.data={})).transition=extractTransitionData(this),c=this._vnode,l=getRealChild(c);if(i.data.directives&&i.data.directives.some(function(e){return"show"===e.name})&&(i.data.show=!0),l&&l.data&&!isSameChild(i,l)){var p=l&&(l.data.transition=extend({},s));if("out-in"===r)return this._leaving=!0,mergeVNodeHook(p,"afterLeave",function(){t._leaving=!1,t.$forceUpdate()}),placeholder(e,o);if("in-out"===r){var u,d=function(){u()};mergeVNodeHook(s,"afterEnter",d),mergeVNodeHook(s,"enterCancelled",d),mergeVNodeHook(p,"delayLeave",function(e){u=e})}}return o}}},props=extend({tag:String,moveClass:String},transitionProps);delete props.mode;var TransitionGroup={props:props,render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,o=this.$slots.default||[],i=this.children=[],a=extractTransitionData(this),s=0;s<o.length;s++){var c=o[s];if(c.tag)if(null!=c.key&&0!==String(c.key).indexOf("__vlist"))i.push(c),n[c.key]=c,(c.data||(c.data={})).transition=a;else if("production"!==process.env.NODE_ENV){var l=c.componentOptions,p=l?l.Ctor.options.name||l.tag||"":c.tag;warn("<transition-group> children must be keyed: <"+p+">")}}if(r){for(var u=[],d=[],f=0;f<r.length;f++){var v=r[f];v.data.transition=a,v.data.pos=v.elm.getBoundingClientRect(),n[v.key]?u.push(v):d.push(v)}this.kept=e(t,null,u),this.removed=d}return e(t,null,i)},beforeUpdate:function(){this.__patch__(this._vnode,this.kept,!1,!0),this._vnode=this.kept},updated:function(){var e=this.prevChildren,t=this.moveClass||(this.name||"v")+"-move";if(e.length&&this.hasMove(e[0].elm,t)){e.forEach(callPendingCbs),e.forEach(recordPosition),e.forEach(applyTranslation);var n=document.body;n.offsetHeight;e.forEach(function(e){if(e.data.moved){var n=e.elm,r=n.style;addTransitionClass(n,t),r.transform=r.WebkitTransform=r.transitionDuration="",n.addEventListener(transitionEndEvent,n._moveCb=function e(r){r&&!/transform$/.test(r.propertyName)||(n.removeEventListener(transitionEndEvent,e),n._moveCb=null,removeTransitionClass(n,t))})}})}},methods:{hasMove:function(e,t){if(!hasTransition)return!1;if(null!=this._hasMove)return this._hasMove;var n=e.cloneNode();e._transitionClasses&&e._transitionClasses.forEach(function(e){removeClass(n,e)}),addClass(n,t),n.style.display="none",this.$el.appendChild(n);var r=getTransitionInfo(n);return this.$el.removeChild(n),this._hasMove=r.hasTransform}}},platformComponents={Transition:Transition,TransitionGroup:TransitionGroup};Vue$2.config.mustUseProp=mustUseProp,Vue$2.config.isReservedTag=isReservedTag,Vue$2.config.getTagNamespace=getTagNamespace,Vue$2.config.isUnknownElement=isUnknownElement,extend(Vue$2.options.directives,platformDirectives),extend(Vue$2.options.components,platformComponents),Vue$2.prototype.__patch__=inBrowser?patch:noop,Vue$2.prototype.$mount=function(e,t){return e=e&&inBrowser?query(e):void 0,mountComponent(this,e,t)},setTimeout(function(){config.devtools&&(devtools?devtools.emit("init",Vue$2):"production"!==process.env.NODE_ENV&&isChrome&&console[console.info?"info":"log"]("Download the Vue Devtools extension for a better development experience:\nhttps://github.com/vuejs/vue-devtools")),"production"!==process.env.NODE_ENV&&config.productionTip!==!1&&inBrowser&&"undefined"!=typeof console&&console[console.info?"info":"log"]("You are running Vue in development mode.\nMake sure to turn on production mode when deploying for production.\nSee more tips at https://vuejs.org/guide/deployment.html")},0),module.exports=Vue$2;
//# sourceMappingURL=vue.runtime.common.min.js.map
|
test/fixtures-es6-react-project/public/components/stateles-sample.js
|
capaj/jspm-hot-reloader
|
import React from 'react'
const Test = (props) => {
return <div onClick={() => console.log('clicked2')}>hello {props.name}</div>
}
export default Test
|
app/config/routes.js
|
StuartPearlman/github-battle
|
import React from 'react';
import { Router, Route, IndexRoute, hashHistory } from 'react-router';
import Home from '../components/Home';
import Main from '../components/Main';
import ConfirmBattleContainer from '../containers/ConfirmBattleContainer';
import PromptContainer from '../containers/PromptContainer';
import ResultsContainer from '../containers/ResultsContainer';
const routes = (
<Router history={ hashHistory }>
<Route path='/' component={ Main }>
<IndexRoute component={ Home } />
<Route path='playerOne' header='Player One' component={ PromptContainer } />
<Route path='playerTwo/:playerOne' header='Player Two' component={ PromptContainer } />
<Route path='battle' component={ ConfirmBattleContainer } />
<Route path='results' component={ ResultsContainer } />
</Route>
</Router>
);
export default routes;
|
packages/node_modules/@webex/react-component-call-data-activity/src/index.js
|
ciscospark/react-ciscospark
|
import React from 'react';
import PropTypes from 'prop-types';
import {FormattedMessage} from 'react-intl';
import messages from './messages';
import {parseActivityCallData} from './helpers';
const propTypes = {
actor: PropTypes.shape({
displayName: PropTypes.string.isRequired
}),
duration: PropTypes.number.isRequired,
isGroupCall: PropTypes.bool.isRequired,
participants: PropTypes.arrayOf(
PropTypes.shape({
isInitiator: PropTypes.bool,
person: PropTypes.shape({
entryUUID: PropTypes.string
}),
state: PropTypes.string
})
).isRequired,
currentUser: PropTypes.shape({
id: PropTypes.string.isRequired
}).isRequired
};
const defaultProps = {
actor: {
displayName: ''
}
};
const CallDataActivityMessage = (props) => {
const {
actor,
duration,
isGroupCall,
participants,
currentUser
} = props;
const callData = {
actor,
duration,
isGroupCall,
participants
};
const parsedCallData = parseActivityCallData(callData, currentUser);
return parsedCallData && (
<FormattedMessage {...messages[parsedCallData.status]} values={{...parsedCallData.callInfo}} />
);
};
CallDataActivityMessage.propTypes = propTypes;
CallDataActivityMessage.defaultProps = defaultProps;
export default CallDataActivityMessage;
|
src/components/markdown.js
|
ShiChao1996/BlogAdmin
|
import React, { Component } from 'react';
import MarkDown from 'react-markdown';
import './markdown.css';
export default class MyMarkDown extends Component{
constructor(props){
super(props);
this.state = {
text: ''
}
}
componentWillMount(){
if(this.props.text){
this.setState({
text: this.props.text
})
}
}
componentWillReceiveProps(nextProps){
this.setState({
text: nextProps.text
})
}
render(){
return(
<MarkDown className='markdownWrapper' source={this.state.text} />
)
}
}
|
node_modules/react-dnd/karma.conf.js
|
rageboom/React_Study
|
var path = require('path');
module.exports = function (config) {
config.set({
browsers: ['Chrome'],
singleRun: true,
frameworks: ['mocha'],
files: [
'tests.webpack.js'
],
preprocessors: {
'tests.webpack.js': ['webpack', 'sourcemap']
},
reporters: ['dots'],
webpack: {
devtool: 'inline-source-map',
module: {
loaders: [
{ test: /\.js$/, loaders: ['babel'], exclude: /node_modules/ }
]
},
resolve: {
alias: {
'react-dnd/modules': path.join(__dirname, './src'),
'react-dnd': path.join(__dirname, './src')
}
}
},
webpackServer: {
noInfo: true
}
});
};
|
src/Parser/Hunter/Survival/Modules/Items/Tier21_2p.js
|
hasseboulen/WoWAnalyzer
|
import React from 'react';
import SPELLS from 'common/SPELLS';
import SpellIcon from 'common/SpellIcon';
import SpellLink from 'common/SpellLink';
import { formatPercentage } from 'common/format';
import Analyzer from 'Parser/Core/Analyzer';
import Combatants from 'Parser/Core/Modules/Combatants';
import ItemDamageDone from 'Main/ItemDamageDone';
import HIT_TYPES from 'Parser/Core/HIT_TYPES';
import getDamageBonus from 'Parser/Hunter/Shared/Modules/getDamageBonus';
//It's a 100% increase to critical strike damage, which is already a 100% modifier, making it effectively only hit 50% harder than a crit otherwise would.
const T21_2P_CRIT_DMG_BONUS = 0.5;
/**
* Flanking Strike has a 50% chance to increase the critical strike chance of your next Raptor Strike by 100% and the critical strike damage of Raptor Strike by 100% within the next 20 sec.
*/
class Tier21_2p extends Analyzer {
static dependencies = {
combatants: Combatants,
};
bonusDmg = 0;
applications = 0;
flankingStrikeCasts = 0;
totalRaptorStrikes = 0;
buffedRaptorStrikes = 0;
on_initialized() {
this.active = this.combatants.selected.hasBuff(SPELLS.HUNTER_SV_T21_2P_BONUS.id);
}
on_byPlayer_cast(event) {
const spellId = event.ability.guid;
if (spellId === SPELLS.FLANKING_STRIKE.id) {
this.flankingStrikeCasts++;
}
if (spellId === SPELLS.RAPTOR_STRIKE.id) {
this.totalRaptorStrikes++;
}
}
on_byPlayer_applybuff(event) {
const spellId = event.ability.guid;
if (spellId !== SPELLS.HUNTER_SV_T21_2P_BONUS_BUFF.id) {
return;
}
this.applications++;
}
on_byPlayer_damage(event) {
if (!this.isApplicable(event)) {
return;
}
this.buffedRaptorStrikes++;
this.bonusDmg += getDamageBonus(event, T21_2P_CRIT_DMG_BONUS);
}
isApplicable(event) {
const spellId = event.ability.guid;
if (spellId !== SPELLS.RAPTOR_STRIKE.id) {
return false;
}
if (!this.combatants.selected.hasBuff(SPELLS.HUNTER_SV_T21_2P_BONUS_BUFF.id, event.timestamp)) {
return false;
}
if (event.hitType !== HIT_TYPES.CRIT && event.hitType !== HIT_TYPES.BLOCKED_CRIT) {
return false;
}
return true;
}
item() {
return {
id: `spell-${SPELLS.HUNTER_SV_T21_2P_BONUS.id}`,
icon: <SpellIcon id={SPELLS.HUNTER_SV_T21_2P_BONUS.id} />,
title: <SpellLink id={SPELLS.HUNTER_SV_T21_2P_BONUS.id} />,
result: (
<dfn data-tip={`The damage shown here only accounts for the added crit damage, and not what the increased crit chance theoretically contributed with. </br>
Your utilization of tier 21 2 piece:
<ul>
<li> Flanking strike casts: ${this.flankingStrikeCasts}.</li>
<li> Tier procs: ${this.applications}.</li>
<li> Procs in % of casts: ${formatPercentage(this.applications / this.flankingStrikeCasts)}%</li>
</ul> `}>
Buffed raptor strikes: {formatPercentage(this.buffedRaptorStrikes / this.totalRaptorStrikes)}%<br />
<ItemDamageDone amount={this.bonusDmg} />
</dfn>
),
};
}
}
export default Tier21_2p;
|
ajax/libs/react-native-web/0.11.4/vendor/react-native/SwipeableRow/index.js
|
cdnjs/cdnjs
|
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @providesModule SwipeableRow
*
*/
'use strict';
import Animated from '../../../exports/Animated';
import I18nManager from '../../../exports/I18nManager';
import PanResponder from '../../../exports/PanResponder';
import React from 'react';
import PropTypes from 'prop-types';
import StyleSheet from '../../../exports/StyleSheet';
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
import TimerMixin from 'react-timer-mixin';
import View from '../../../exports/View';
import createReactClass from 'create-react-class';
import emptyFunction from 'fbjs/lib/emptyFunction';
var isRTL = function isRTL() {
return I18nManager.isRTL;
}; // NOTE: Eventually convert these consts to an input object of configurations
// Position of the left of the swipable item when closed
var CLOSED_LEFT_POSITION = 0; // Minimum swipe distance before we recognize it as such
var HORIZONTAL_SWIPE_DISTANCE_THRESHOLD = 10; // Minimum swipe speed before we fully animate the user's action (open/close)
var HORIZONTAL_FULL_SWIPE_SPEED_THRESHOLD = 0.3; // Factor to divide by to get slow speed; i.e. 4 means 1/4 of full speed
var SLOW_SPEED_SWIPE_FACTOR = 4; // Time, in milliseconds, of how long the animated swipe should be
var SWIPE_DURATION = 300;
/**
* On SwipeableListView mount, the 1st item will bounce to show users it's
* possible to swipe
*/
var ON_MOUNT_BOUNCE_DELAY = 700;
var ON_MOUNT_BOUNCE_DURATION = 400; // Distance left of closed position to bounce back when right-swiping from closed
var RIGHT_SWIPE_BOUNCE_BACK_DISTANCE = 30;
var RIGHT_SWIPE_BOUNCE_BACK_DURATION = 300;
/**
* Max distance of right swipe to allow (right swipes do functionally nothing).
* Must be multiplied by SLOW_SPEED_SWIPE_FACTOR because gestureState.dx tracks
* how far the finger swipes, and not the actual animation distance.
*/
var RIGHT_SWIPE_THRESHOLD = 30 * SLOW_SPEED_SWIPE_FACTOR;
/**
* Creates a swipable row that allows taps on the main item and a custom View
* on the item hidden behind the row. Typically this should be used in
* conjunction with SwipeableListView for additional functionality, but can be
* used in a normal ListView. See the renderRow for SwipeableListView to see how
* to use this component separately.
*/
var SwipeableRow = createReactClass({
displayName: 'SwipeableRow',
_panResponder: {},
_previousLeft: CLOSED_LEFT_POSITION,
mixins: [TimerMixin],
propTypes: {
children: PropTypes.any,
isOpen: PropTypes.bool,
preventSwipeRight: PropTypes.bool,
maxSwipeDistance: PropTypes.number.isRequired,
onOpen: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
onSwipeEnd: PropTypes.func.isRequired,
onSwipeStart: PropTypes.func.isRequired,
// Should bounce the row on mount
shouldBounceOnMount: PropTypes.bool,
/**
* A ReactElement that is unveiled when the user swipes
*/
slideoutView: PropTypes.node.isRequired,
/**
* The minimum swipe distance required before fully animating the swipe. If
* the user swipes less than this distance, the item will return to its
* previous (open/close) position.
*/
swipeThreshold: PropTypes.number.isRequired
},
getInitialState: function getInitialState() {
return {
currentLeft: new Animated.Value(this._previousLeft),
/**
* In order to render component A beneath component B, A must be rendered
* before B. However, this will cause "flickering", aka we see A briefly
* then B. To counter this, _isSwipeableViewRendered flag is used to set
* component A to be transparent until component B is loaded.
*/
isSwipeableViewRendered: false,
rowHeight: null
};
},
getDefaultProps: function getDefaultProps() {
return {
isOpen: false,
preventSwipeRight: false,
maxSwipeDistance: 0,
onOpen: emptyFunction,
onClose: emptyFunction,
onSwipeEnd: emptyFunction,
onSwipeStart: emptyFunction,
swipeThreshold: 30
};
},
UNSAFE_componentWillMount: function UNSAFE_componentWillMount() {
this._panResponder = PanResponder.create({
onMoveShouldSetPanResponderCapture: this._handleMoveShouldSetPanResponderCapture,
onPanResponderGrant: this._handlePanResponderGrant,
onPanResponderMove: this._handlePanResponderMove,
onPanResponderRelease: this._handlePanResponderEnd,
onPanResponderTerminationRequest: this._onPanResponderTerminationRequest,
onPanResponderTerminate: this._handlePanResponderEnd,
onShouldBlockNativeResponder: function onShouldBlockNativeResponder(event, gestureState) {
return false;
}
});
},
componentDidMount: function componentDidMount() {
var _this = this;
if (this.props.shouldBounceOnMount) {
/**
* Do the on mount bounce after a delay because if we animate when other
* components are loading, the animation will be laggy
*/
this.setTimeout(function () {
_this._animateBounceBack(ON_MOUNT_BOUNCE_DURATION);
}, ON_MOUNT_BOUNCE_DELAY);
}
},
UNSAFE_componentWillReceiveProps: function UNSAFE_componentWillReceiveProps(nextProps) {
/**
* We do not need an "animateOpen(noCallback)" because this animation is
* handled internally by this component.
*/
if (this.props.isOpen && !nextProps.isOpen) {
this._animateToClosedPosition();
}
},
render: function render() {
// The view hidden behind the main view
var slideOutView;
if (this.state.isSwipeableViewRendered && this.state.rowHeight) {
slideOutView = React.createElement(View, {
style: [styles.slideOutContainer, {
height: this.state.rowHeight
}]
}, this.props.slideoutView);
} // The swipeable item
var swipeableView = React.createElement(Animated.View, {
onLayout: this._onSwipeableViewLayout,
style: {
transform: [{
translateX: this.state.currentLeft
}]
}
}, this.props.children);
return React.createElement(View, this._panResponder.panHandlers, slideOutView, swipeableView);
},
close: function close() {
this.props.onClose();
this._animateToClosedPosition();
},
_onSwipeableViewLayout: function _onSwipeableViewLayout(event) {
this.setState({
isSwipeableViewRendered: true,
rowHeight: event.nativeEvent.layout.height
});
},
_handleMoveShouldSetPanResponderCapture: function _handleMoveShouldSetPanResponderCapture(event, gestureState) {
// Decides whether a swipe is responded to by this component or its child
return gestureState.dy < 10 && this._isValidSwipe(gestureState);
},
_handlePanResponderGrant: function _handlePanResponderGrant(event, gestureState) {},
_handlePanResponderMove: function _handlePanResponderMove(event, gestureState) {
if (this._isSwipingExcessivelyRightFromClosedPosition(gestureState)) {
return;
}
this.props.onSwipeStart();
if (this._isSwipingRightFromClosed(gestureState)) {
this._swipeSlowSpeed(gestureState);
} else {
this._swipeFullSpeed(gestureState);
}
},
_isSwipingRightFromClosed: function _isSwipingRightFromClosed(gestureState) {
var gestureStateDx = isRTL() ? -gestureState.dx : gestureState.dx;
return this._previousLeft === CLOSED_LEFT_POSITION && gestureStateDx > 0;
},
_swipeFullSpeed: function _swipeFullSpeed(gestureState) {
this.state.currentLeft.setValue(this._previousLeft + gestureState.dx);
},
_swipeSlowSpeed: function _swipeSlowSpeed(gestureState) {
this.state.currentLeft.setValue(this._previousLeft + gestureState.dx / SLOW_SPEED_SWIPE_FACTOR);
},
_isSwipingExcessivelyRightFromClosedPosition: function _isSwipingExcessivelyRightFromClosedPosition(gestureState) {
/**
* We want to allow a BIT of right swipe, to allow users to know that
* swiping is available, but swiping right does not do anything
* functionally.
*/
var gestureStateDx = isRTL() ? -gestureState.dx : gestureState.dx;
return this._isSwipingRightFromClosed(gestureState) && gestureStateDx > RIGHT_SWIPE_THRESHOLD;
},
_onPanResponderTerminationRequest: function _onPanResponderTerminationRequest(event, gestureState) {
return false;
},
_animateTo: function _animateTo(toValue, duration, callback) {
var _this2 = this;
if (duration === void 0) {
duration = SWIPE_DURATION;
}
if (callback === void 0) {
callback = emptyFunction;
}
Animated.timing(this.state.currentLeft, {
duration: duration,
toValue: toValue,
useNativeDriver: true
}).start(function () {
_this2._previousLeft = toValue;
callback();
});
},
_animateToOpenPosition: function _animateToOpenPosition() {
var maxSwipeDistance = isRTL() ? -this.props.maxSwipeDistance : this.props.maxSwipeDistance;
this._animateTo(-maxSwipeDistance);
},
_animateToOpenPositionWith: function _animateToOpenPositionWith(speed, distMoved) {
/**
* Ensure the speed is at least the set speed threshold to prevent a slow
* swiping animation
*/
speed = speed > HORIZONTAL_FULL_SWIPE_SPEED_THRESHOLD ? speed : HORIZONTAL_FULL_SWIPE_SPEED_THRESHOLD;
/**
* Calculate the duration the row should take to swipe the remaining distance
* at the same speed the user swiped (or the speed threshold)
*/
var duration = Math.abs((this.props.maxSwipeDistance - Math.abs(distMoved)) / speed);
var maxSwipeDistance = isRTL() ? -this.props.maxSwipeDistance : this.props.maxSwipeDistance;
this._animateTo(-maxSwipeDistance, duration);
},
_animateToClosedPosition: function _animateToClosedPosition(duration) {
if (duration === void 0) {
duration = SWIPE_DURATION;
}
this._animateTo(CLOSED_LEFT_POSITION, duration);
},
_animateToClosedPositionDuringBounce: function _animateToClosedPositionDuringBounce() {
this._animateToClosedPosition(RIGHT_SWIPE_BOUNCE_BACK_DURATION);
},
_animateBounceBack: function _animateBounceBack(duration) {
/**
* When swiping right, we want to bounce back past closed position on release
* so users know they should swipe right to get content.
*/
var swipeBounceBackDistance = isRTL() ? -RIGHT_SWIPE_BOUNCE_BACK_DISTANCE : RIGHT_SWIPE_BOUNCE_BACK_DISTANCE;
this._animateTo(-swipeBounceBackDistance, duration, this._animateToClosedPositionDuringBounce);
},
// Ignore swipes due to user's finger moving slightly when tapping
_isValidSwipe: function _isValidSwipe(gestureState) {
if (this.props.preventSwipeRight && this._previousLeft === CLOSED_LEFT_POSITION && gestureState.dx > 0) {
return false;
}
return Math.abs(gestureState.dx) > HORIZONTAL_SWIPE_DISTANCE_THRESHOLD;
},
_shouldAnimateRemainder: function _shouldAnimateRemainder(gestureState) {
/**
* If user has swiped past a certain distance, animate the rest of the way
* if they let go
*/
return Math.abs(gestureState.dx) > this.props.swipeThreshold || gestureState.vx > HORIZONTAL_FULL_SWIPE_SPEED_THRESHOLD;
},
_handlePanResponderEnd: function _handlePanResponderEnd(event, gestureState) {
var horizontalDistance = isRTL() ? -gestureState.dx : gestureState.dx;
if (this._isSwipingRightFromClosed(gestureState)) {
this.props.onOpen();
this._animateBounceBack(RIGHT_SWIPE_BOUNCE_BACK_DURATION);
} else if (this._shouldAnimateRemainder(gestureState)) {
if (horizontalDistance < 0) {
// Swiped left
this.props.onOpen();
this._animateToOpenPositionWith(gestureState.vx, horizontalDistance);
} else {
// Swiped right
this.props.onClose();
this._animateToClosedPosition();
}
} else {
if (this._previousLeft === CLOSED_LEFT_POSITION) {
this._animateToClosedPosition();
} else {
this._animateToOpenPosition();
}
}
this.props.onSwipeEnd();
}
});
var styles = StyleSheet.create({
slideOutContainer: {
bottom: 0,
left: 0,
position: 'absolute',
right: 0,
top: 0
}
});
export default SwipeableRow;
|
website/layout/AutodocsLayout.js
|
mukesh-kumar1905/react-native
|
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule AutodocsLayout
*/
var DocsSidebar = require('DocsSidebar');
var H = require('Header');
var Header = require('Header');
var Marked = require('Marked');
var Prism = require('Prism');
var React = require('React');
var Site = require('Site');
var slugify = require('slugify');
var styleReferencePattern = /^[^.]+\.propTypes\.style$/;
function renderType(type) {
if (type.name === 'enum') {
if (typeof type.value === 'string') {
return type.value;
}
return 'enum(' + type.value.map((v) => v.value).join(', ') + ')';
}
if (type.name === 'shape') {
return '{' + Object.keys(type.value).map((key => key + ': ' + renderType(type.value[key]))).join(', ') + '}';
}
if (type.name == 'union') {
return type.value.map(renderType).join(', ');
}
if (type.name === 'arrayOf') {
return '[' + renderType(type.value) + ']';
}
if (type.name === 'instanceOf') {
return type.value;
}
if (type.name === 'custom') {
if (styleReferencePattern.test(type.raw)) {
var name = type.raw.substring(0, type.raw.indexOf('.'));
return <a href={slugify(name) + '.html#style'}>{name}#style</a>
}
if (type.raw === 'EdgeInsetsPropType') {
return '{top: number, left: number, bottom: number, right: number}';
}
return type.raw;
}
if (type.name === 'stylesheet') {
return 'style';
}
if (type.name === 'func') {
return 'function';
}
return type.name;
}
var ComponentDoc = React.createClass({
renderProp: function(name, prop) {
return (
<div className="prop" key={name}>
<Header level={4} className="propTitle" toSlug={name}>
{prop.platforms && prop.platforms.map(platform =>
<span className="platform">{platform}</span>
)}
{name}
{' '}
{prop.type && <span className="propType">
{renderType(prop.type)}
</span>}
</Header>
{prop.type && prop.type.name === 'stylesheet' &&
this.renderStylesheetProps(prop.type.value)}
{prop.description && <Marked>{prop.description}</Marked>}
</div>
);
},
renderCompose: function(name) {
return (
<div className="prop" key={name}>
<Header level={4} className="propTitle" toSlug={name}>
<a href={slugify(name) + '.html#props'}>{name} props...</a>
</Header>
</div>
);
},
renderStylesheetProps: function(stylesheetName) {
var style = this.props.content.styles[stylesheetName];
return (
<div className="compactProps">
{(style.composes || []).map((name) => {
var link;
if (name === 'LayoutPropTypes') {
name = 'Flexbox';
link =
<a href={slugify(name) + '.html#proptypes'}>{name}...</a>;
} else if (name === 'TransformPropTypes') {
name = 'Transforms';
link =
<a href={slugify(name) + '.html#proptypes'}>{name}...</a>;
} else {
name = name.replace('StylePropTypes', '');
link =
<a href={slugify(name) + '.html#style'}>{name}#style...</a>;
}
return (
<div className="prop" key={name}>
<h6 className="propTitle">{link}</h6>
</div>
);
})}
{Object.keys(style.props).map((name) =>
<div className="prop" key={name}>
<h6 className="propTitle">
{name}
{' '}
{style.props[name].type && <span className="propType">
{renderType(style.props[name].type)}
</span>}
</h6>
</div>
)}
</div>
);
},
renderProps: function(props, composes) {
return (
<div className="props">
{(composes || []).map((name) =>
this.renderCompose(name)
)}
{Object.keys(props)
.sort((nameA, nameB) => {
var a = props[nameA];
var b = props[nameB];
if (a.platforms && !b.platforms) {
return 1;
}
if (b.platforms && !a.platforms) {
return -1;
}
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
return 0;
})
.map((name) =>
this.renderProp(name, props[name])
)}
</div>
);
},
extractPlatformFromProps: function(props) {
for (var key in props) {
var prop = props[key];
var description = prop.description || '';
var platforms = description.match(/\@platform (.+)/);
platforms = platforms && platforms[1].replace(/ /g, '').split(',');
description = description.replace(/\@platform (.+)/, '');
prop.description = description;
prop.platforms = platforms;
}
},
render: function() {
var content = this.props.content;
this.extractPlatformFromProps(content.props);
return (
<div>
<Marked>
{content.description}
</Marked>
<HeaderWithGithub
title="Props"
path={content.filepath}
/>
{this.renderProps(content.props, content.composes)}
</div>
);
}
});
var APIDoc = React.createClass({
removeCommentsFromDocblock: function(docblock) {
return docblock
.trim('\n ')
.replace(/^\/\*+/, '')
.replace(/\*\/$/, '')
.split('\n')
.map(function(line) {
return line.trim().replace(/^\* ?/, '');
})
.join('\n');
},
renderTypehintRec: function(typehint) {
if (typehint.type === 'simple') {
return typehint.value;
}
if (typehint.type === 'generic') {
return this.renderTypehintRec(typehint.value[0]) + '<' + this.renderTypehintRec(typehint.value[1]) + '>';
}
return JSON.stringify(typehint);
},
renderTypehint: function(typehint) {
try {
var typehint = JSON.parse(typehint);
} catch(e) {
return typehint;
}
return this.renderTypehintRec(typehint);
},
renderMethod: function(method) {
return (
<div className="prop" key={method.name}>
<Header level={4} className="propTitle" toSlug={method.name}>
{method.modifiers.length && <span className="propType">
{method.modifiers.join(' ') + ' '}
</span> || ''}
{method.name}
<span className="propType">
({method.params
.map((param) => {
var res = param.name;
if (param.typehint) {
res += ': ' + this.renderTypehint(param.typehint);
}
return res;
})
.join(', ')})
</span>
</Header>
{method.docblock && <Marked>
{this.removeCommentsFromDocblock(method.docblock)}
</Marked>}
</div>
);
},
renderMethods: function(methods) {
if (!methods.length) {
return null;
}
return (
<span>
<H level={3}>Methods</H>
<div className="props">
{methods.filter((method) => {
return method.name[0] !== '_';
}).map(this.renderMethod)}
</div>
</span>
);
},
renderProperty: function(property) {
return (
<div className="prop" key={property.name}>
<Header level={4} className="propTitle" toSlug={property.name}>
{property.name}
{property.type &&
<span className="propType">
{': ' + renderType(property.type)}
</span>
}
</Header>
{property.docblock && <Marked>
{this.removeCommentsFromDocblock(property.docblock)}
</Marked>}
</div>
);
},
renderProperties: function(properties) {
if (!properties || !properties.length) {
return null;
}
return (
<span>
<H level={3}>Properties</H>
<div className="props">
{properties.filter((property) => {
return property.name[0] !== '_';
}).map(this.renderProperty)}
</div>
</span>
);
},
renderClasses: function(classes) {
if (!classes || !classes.length) {
return null;
}
return (
<span>
<div>
{classes.filter((cls) => {
return cls.name[0] !== '_' && cls.ownerProperty[0] !== '_';
}).map((cls) => {
return (
<span key={cls.name}>
<Header level={2} toSlug={cls.name}>
class {cls.name}
</Header>
<ul>
{cls.docblock && <Marked>
{this.removeCommentsFromDocblock(cls.docblock)}
</Marked>}
{this.renderMethods(cls.methods)}
{this.renderProperties(cls.properties)}
</ul>
</span>
);
})}
</div>
</span>
);
},
render: function() {
var content = this.props.content;
if (!content.methods) {
throw new Error(
'No component methods found for ' + content.componentName
);
}
return (
<div>
<Marked>
{this.removeCommentsFromDocblock(content.docblock)}
</Marked>
{this.renderMethods(content.methods)}
{this.renderProperties(content.properties)}
{this.renderClasses(content.classes)}
</div>
);
}
});
var HeaderWithGithub = React.createClass({
renderRunnableLink: function() {
if (this.props.metadata && this.props.metadata.runnable) {
return (
<a
className="run-example"
target="_blank"
href={'https://rnplay.org/apps/l3Zi2g?route='+this.props.metadata.title+'&file=' + this.props.metadata.title+ "Example.js"}>
Run this example
</a>
);
}
},
render: function() {
return (
<H level={3} toSlug={this.props.title}>
<a
className="edit-github"
href={'https://github.com/facebook/react-native/blob/master/' + this.props.path}>
Edit on GitHub
</a>
{this.renderRunnableLink()}
{this.props.title}
</H>
);
}
});
var Autodocs = React.createClass({
renderFullDescription: function(docs) {
if (!docs.fullDescription) {
return;
}
return (
<div>
<HeaderWithGithub
title="Description"
path={'docs/' + docs.componentName + '.md'}
/>
<Marked>
{docs.fullDescription}
</Marked>
</div>
);
},
renderExample: function(docs, metadata) {
if (!docs.example) {
return;
}
return (
<div>
<HeaderWithGithub
title="Examples"
path={docs.example.path}
metadata={metadata}
/>
<Prism>
{docs.example.content.replace(/^[\s\S]*?\*\//, '').trim()}
</Prism>
</div>
);
},
render: function() {
var metadata = this.props.metadata;
var docs = JSON.parse(this.props.children);
var content = docs.type === 'component' || docs.type === 'style' ?
<ComponentDoc content={docs} /> :
<APIDoc content={docs} apiName={metadata.title} />;
return (
<Site section="docs" title={metadata.title}>
<section className="content wrap documentationContent">
<DocsSidebar metadata={metadata} />
<div className="inner-content">
<a id="content" />
<h1>{metadata.title}</h1>
{content}
{this.renderFullDescription(docs)}
{this.renderExample(docs, metadata)}
<div className="docs-prevnext">
{metadata.previous && <a className="docs-prev" href={metadata.previous + '.html#content'}>← Prev</a>}
{metadata.next && <a className="docs-next" href={metadata.next + '.html#content'}>Next →</a>}
</div>
</div>
</section>
</Site>
);
}
});
module.exports = Autodocs;
|
ajax/libs/vue/0.11.0-rc/vue.js
|
honestree/cdnjs
|
/**
* Vue.js v0.11.0-rc
* (c) 2014 Evan You
* Released under the MIT License.
*/
;(function(){
"use strict"
/**
* Require the module at `name`.
*
* @param {String} name
* @return {Object} exports
* @api public
*/
function require(name) {
var module = require.modules[name];
if (!module) throw new Error('failed to require "' + name + '"');
if (!('exports' in module) && typeof module.definition === 'function') {
module.client = module.component = true;
module.definition.call(this, module.exports = {}, module);
delete module.definition;
}
return module.exports;
}
/**
* Registered modules.
*/
require.modules = {};
/**
* Register module at `name` with callback `definition`.
*
* @param {String} name
* @param {Function} definition
* @api private
*/
require.register = function (name, definition) {
require.modules[name] = {
definition: definition
};
};
/**
* Define a module's exports immediately with `exports`.
*
* @param {String} name
* @param {Generic} exports
* @api private
*/
require.define = function (name, exports) {
require.modules[name] = {
exports: exports
};
};
require.register(1, function (exports, module) {
var _ = require(2)
/**
* Create a child instance that prototypally inehrits
* data on parent. To achieve that we create an intermediate
* constructor with its prototype pointing to parent.
*
* @param {Object} opts
* @param {Function} [BaseCtor]
* @return {Vue}
* @public
*/
exports.$addChild = function (opts, BaseCtor) {
BaseCtor = BaseCtor || _.Vue
opts = opts || {}
var parent = this
var ChildVue
var inherit = opts.inherit !== undefined
? opts.inherit
: BaseCtor.options.inherit
if (inherit) {
var ctors = parent._childCtors
if (!ctors) {
ctors = parent._childCtors = {}
}
ChildVue = ctors[BaseCtor.cid]
if (!ChildVue) {
ChildVue = function (options) {
this.constructor = ChildVue
_.Vue.call(this, options)
}
ChildVue.options = BaseCtor.options
ChildVue.prototype = this
ctors[BaseCtor.cid] = ChildVue
}
} else {
ChildVue = BaseCtor
}
opts._parent = parent
opts._root = parent.$root
var child = new ChildVue(opts)
if (!this._children) {
this._children = []
}
this._children.push(child)
return child
}
});
require.register(3, function (exports, module) {
var _ = require(2)
var Watcher = require(4)
var textParser = require(5)
var dirParser = require(6)
var expParser = require(7)
var filterRE = /[^|]\|[^|]/
/**
* Get the value from an expression on this vm.
*
* @param {String} exp
* @return {*}
*/
exports.$get = function (exp) {
var res = expParser.parse(exp)
if (res) {
return res.get.call(this, this)
}
}
/**
* Set the value from an expression on this vm.
* The expression must be a valid left-hand
* expression in an assignment.
*
* @param {String} exp
* @param {*} val
*/
exports.$set = function (exp, val) {
var res = expParser.parse(exp, true)
if (res && res.set) {
res.set.call(this, this, val)
}
}
/**
* Add a property on the VM
*
* @param {String} key
* @param {*} val
*/
exports.$add = function (key, val) {
this._data.$add(key, val)
}
/**
* Delete a property on the VM
*
* @param {String} key
*/
exports.$delete = function (key) {
this._data.$delete(key)
}
/**
* Watch an expression, trigger callback when its
* value changes.
*
* @param {String} exp
* @param {Function} cb
* @param {Boolean} [deep]
* @param {Boolean} [immediate]
* @return {Function} - unwatchFn
*/
exports.$watch = function (exp, cb, deep, immediate) {
var vm = this
var key = deep ? exp + '**deep**' : exp
var watcher = vm._userWatchers[key]
var wrappedCb = function (val, oldVal) {
cb.call(vm, val, oldVal)
}
if (!watcher) {
watcher = vm._userWatchers[key] =
new Watcher(vm, exp, wrappedCb, null, false, deep)
} else {
watcher.addCb(wrappedCb)
}
if (immediate) {
wrappedCb(watcher.value)
}
return function unwatchFn () {
watcher.removeCb(wrappedCb)
if (!watcher.active) {
vm._userWatchers[key] = null
}
}
}
/**
* Evaluate a text directive, including filters.
*
* @param {String} text
* @return {String}
*/
exports.$eval = function (text) {
// check for filters.
if (filterRE.test(text)) {
var dir = dirParser.parse(text)[0]
// the filter regex check might give false positive
// for pipes inside strings, so it's possible that
// we don't get any filters here
return dir.filters
? _.applyFilters(
this.$get(dir.expression),
_.resolveFilters(this, dir.filters).read,
this
)
: this.$get(dir.expression)
} else {
// no filter
return this.$get(text)
}
}
/**
* Interpolate a piece of template text.
*
* @param {String} text
* @return {String}
*/
exports.$interpolate = function (text) {
var tokens = textParser.parse(text)
var vm = this
if (tokens) {
return tokens.length === 1
? vm.$eval(tokens[0].value)
: tokens.map(function (token) {
return token.tag
? vm.$eval(token.value)
: token.value
}).join('')
} else {
return text
}
}
/**
* Log instance data as a plain JS object
* so that it is easier to inspect in console.
* This method assumes console is available.
*
* @param {String} [key]
*/
exports.$log = function (key) {
var data = this[key || '_data']
console.log(JSON.parse(JSON.stringify(data)))
}
});
require.register(8, function (exports, module) {
var _ = require(2)
var transition = require(9)
/**
* Append instance to target
*
* @param {Node} target
* @param {Function} [cb]
* @param {Boolean} [withTransition] - defaults to true
*/
exports.$appendTo = function (target, cb, withTransition) {
var targetIsDetached = !_.inDoc(target)
var op = withTransition === false || targetIsDetached
? append
: transition.append
insert(this, target, op, targetIsDetached, cb)
}
/**
* Prepend instance to target
*
* @param {Node} target
* @param {Function} [cb]
* @param {Boolean} [withTransition] - defaults to true
*/
exports.$prependTo = function (target, cb, withTransition) {
target = query(target)
if (target.hasChildNodes()) {
this.$before(target.firstChild, cb, withTransition)
} else {
this.$appendTo(target, cb, withTransition)
}
}
/**
* Insert instance before target
*
* @param {Node} target
* @param {Function} [cb]
* @param {Boolean} [withTransition] - defaults to true
*/
exports.$before = function (target, cb, withTransition) {
var targetIsDetached = !_.inDoc(target)
var op = withTransition === false || targetIsDetached
? before
: transition.before
insert(this, target, op, targetIsDetached, cb)
}
/**
* Insert instance after target
*
* @param {Node} target
* @param {Function} [cb]
* @param {Boolean} [withTransition] - defaults to true
*/
exports.$after = function (target, cb, withTransition) {
target = query(target)
if (target.nextSibling) {
this.$before(target.nextSibling, cb, withTransition)
} else {
this.$appendTo(target.parentNode, cb, withTransition)
}
}
/**
* Remove instance from DOM
*
* @param {Function} [cb]
* @param {Boolean} [withTransition] - defaults to true
*/
exports.$remove = function (cb, withTransition) {
var inDoc = this._isAttached && _.inDoc(this.$el)
// if we are not in document, no need to check
// for transitions
if (!inDoc) withTransition = false
var op
var self = this
var realCb = function () {
if (inDoc) self._callHook('detached')
if (cb) cb()
}
if (
this._isBlock &&
!this._blockFragment.hasChildNodes()
) {
op = withTransition === false
? append
: transition.removeThenAppend
blockOp(this, this._blockFragment, op, realCb)
} else {
op = withTransition === false
? remove
: transition.remove
op(this.$el, this, realCb)
}
}
/**
* Shared DOM insertion function.
*
* @param {Vue} vm
* @param {Element} target
* @param {Function} op
* @param {Boolean} targetIsDetached
* @param {Function} [cb]
*/
function insert (vm, target, op, targetIsDetached, cb) {
target = query(target)
var shouldCallHook =
!targetIsDetached &&
!vm._isAttached &&
!_.inDoc(vm.$el)
if (vm._isBlock) {
blockOp(vm, target, op, cb)
} else {
op(vm.$el, target, vm, cb)
}
if (shouldCallHook) {
vm._callHook('attached')
}
}
/**
* Execute a transition operation on a block instance,
* iterating through all its block nodes.
*
* @param {Vue} vm
* @param {Node} target
* @param {Function} op
* @param {Function} cb
*/
function blockOp (vm, target, op, cb) {
var current = vm._blockStart
var end = vm._blockEnd
var next
while (next !== end) {
next = current.nextSibling
op(current, target, vm)
current = next
}
op(end, target, vm, cb)
}
/**
* Check for selectors
*
* @param {String|Element} el
*/
function query (el) {
return typeof el === 'string'
? document.querySelector(el)
: el
}
/**
* Append operation that takes a callback.
*
* @param {Node} el
* @param {Node} target
* @param {Vue} vm - unused
* @param {Function} [cb]
*/
function append (el, target, vm, cb) {
target.appendChild(el)
if (cb) cb()
}
/**
* InsertBefore operation that takes a callback.
*
* @param {Node} el
* @param {Node} target
* @param {Vue} vm - unused
* @param {Function} [cb]
*/
function before (el, target, vm, cb) {
_.before(el, target)
if (cb) cb()
}
/**
* Remove operation that takes a callback.
*
* @param {Node} el
* @param {Vue} vm - unused
* @param {Function} [cb]
*/
function remove (el, vm, cb) {
_.remove(el)
if (cb) cb()
}
});
require.register(10, function (exports, module) {
var _ = require(2)
/**
* Listen on the given `event` with `fn`.
*
* @param {String} event
* @param {Function} fn
*/
exports.$on = function (event, fn) {
(this._events[event] || (this._events[event] = []))
.push(fn)
modifyListenerCount(this, event, 1)
}
/**
* Adds an `event` listener that will be invoked a single
* time then automatically removed.
*
* @param {String} event
* @param {Function} fn
*/
exports.$once = function (event, fn) {
var self = this
function on () {
self.$off(event, on)
fn.apply(this, arguments)
}
on.fn = fn
this.$on(event, on)
}
/**
* Remove the given callback for `event` or all
* registered callbacks.
*
* @param {String} event
* @param {Function} fn
*/
exports.$off = function (event, fn) {
var cbs
// all
if (!arguments.length) {
if (this.$parent) {
for (event in this._events) {
cbs = this._events[event]
if (cbs) {
modifyListenerCount(this, event, -cbs.length)
}
}
}
this._events = {}
return
}
// specific event
cbs = this._events[event]
if (!cbs) return
if (arguments.length === 1) {
modifyListenerCount(this, event, -cbs.length)
this._events[event] = null
return
}
// specific handler
var cb
var i = cbs.length
while (i--) {
cb = cbs[i]
if (cb === fn || cb.fn === fn) {
modifyListenerCount(this, event, -1)
cbs.splice(i, 1)
break
}
}
}
/**
* Trigger an event on self.
*
* @param {String} event
*/
exports.$emit = function (event) {
this._eventCancelled = false
var cbs = this._events[event]
if (cbs) {
// avoid leaking arguments:
// http://jsperf.com/closure-with-arguments
var i = arguments.length - 1
var args = new Array(i)
while (i--) {
args[i] = arguments[i + 1]
}
i = 0
cbs = cbs.length > 1
? _.toArray(cbs)
: cbs
for (var l = cbs.length; i < l; i++) {
if (cbs[i].apply(this, args) === false) {
this._eventCancelled = true
}
}
}
}
/**
* Recursively broadcast an event to all children instances.
*
* @param {String} event
* @param {...*} additional arguments
*/
exports.$broadcast = function (event) {
// if no child has registered for this event,
// then there's no need to broadcast.
if (!this._eventsCount[event]) return
var children = this._children
if (children) {
for (var i = 0, l = children.length; i < l; i++) {
var child = children[i]
child.$emit.apply(child, arguments)
if (!child._eventCancelled) {
child.$broadcast.apply(child, arguments)
}
}
}
}
/**
* Recursively propagate an event up the parent chain.
*
* @param {String} event
* @param {...*} additional arguments
*/
exports.$dispatch = function () {
var parent = this.$parent
while (parent) {
parent.$emit.apply(parent, arguments)
parent = parent._eventCancelled
? null
: parent.$parent
}
}
/**
* Modify the listener counts on all parents.
* This bookkeeping allows $broadcast to return early when
* no child has listened to a certain event.
*
* @param {Vue} vm
* @param {String} event
* @param {Number} count
*/
var hookRE = /^hook:/
function modifyListenerCount (vm, event, count) {
var parent = vm.$parent
// hooks do not get broadcasted so no need
// to do bookkeeping for them
if (!parent || !count || hookRE.test(event)) return
while (parent) {
parent._eventsCount[event] =
(parent._eventsCount[event] || 0) + count
parent = parent.$parent
}
}
});
require.register(11, function (exports, module) {
var _ = require(2)
var mergeOptions = require(12)
/**
* Expose useful internals
*/
exports.util = _
exports.nextTick = _.nextTick
exports.config = require(13)
/**
* Each instance constructor, including Vue, has a unique
* cid. This enables us to create wrapped "child
* constructors" for prototypal inheritance and cache them.
*/
exports.cid = 0
var cid = 1
/**
* Class inehritance
*
* @param {Object} extendOptions
*/
exports.extend = function (extendOptions) {
extendOptions = extendOptions || {}
var Super = this
var Sub = createClass(extendOptions.name || 'VueComponent')
Sub.prototype = Object.create(Super.prototype)
Sub.prototype.constructor = Sub
Sub.cid = cid++
Sub.options = mergeOptions(
Super.options,
extendOptions
)
Sub['super'] = Super
// allow further extension
Sub.extend = Super.extend
// create asset registers, so extended classes
// can have their private assets too.
createAssetRegisters(Sub)
return Sub
}
/**
* A function that returns a sub-class constructor with the
* given name. This gives us much nicer output when
* logging instances in the console.
*
* @param {String} name
* @return {Function}
*/
function createClass (name) {
return new Function(
'Vue',
'return function ' + _.camelize(name) +
' (options) { Vue.call(this, options) }'
)(_.Vue)
}
/**
* Plugin system
*
* @param {Object} plugin
*/
exports.use = function (plugin) {
// additional parameters
var args = _.toArray(arguments, 1)
args.unshift(this)
if (typeof plugin.install === 'function') {
plugin.install.apply(plugin, args)
} else {
plugin.apply(null, args)
}
return this
}
/**
* Define asset registration methods on a constructor.
*
* @param {Function} Constructor
*/
var assetTypes = [
'directive',
'filter',
'partial',
'transition'
]
function createAssetRegisters (Constructor) {
/* Asset registration methods share the same signature:
*
* @param {String} id
* @param {*} definition
*/
assetTypes.forEach(function (type) {
Constructor[type] = function (id, definition) {
if (!definition) {
return this.options[type + 's'][id]
} else {
this.options[type + 's'][id] = definition
}
}
})
/**
* Component registration needs to automatically invoke
* Vue.extend on object values.
*
* @param {String} id
* @param {Object|Function} definition
*/
Constructor.component = function (id, definition) {
if (!definition) {
return this.options.components[id]
} else {
if (_.isPlainObject(definition)) {
definition.name = id
definition = _.Vue.extend(definition)
}
this.options.components[id] = definition
}
}
}
createAssetRegisters(exports)
});
require.register(14, function (exports, module) {
var _ = require(2)
/**
* Set instance target element and kick off the compilation
* process. The passed in `el` can be a selector string, an
* existing Element, or a DocumentFragment (for block
* instances).
*
* @param {Element|DocumentFragment|string} el
* @public
*/
exports.$mount = function (el) {
if (this._isCompiled) {
_.warn('$mount() should be called only once.')
return
}
if (typeof el === 'string') {
var selector = el
el = document.querySelector(el)
if (!el) {
_.warn('Cannot find element: ' + selector)
return
}
}
this._compile(el)
this._isCompiled = true
this._callHook('compiled')
if (_.inDoc(this.$el)) {
this._callHook('attached')
this._initDOMHooks()
ready.call(this)
} else {
this._initDOMHooks()
this.$once('hook:attached', ready)
}
}
/**
* Mark an instance as ready.
*/
function ready () {
this._isAttached = true
this._isReady = true
this._callHook('ready')
}
/**
* Teardown an instance, unobserves the data, unbind all the
* directives, turn off all the event listeners, etc.
*
* @param {Boolean} remove - whether to remove the DOM node.
* @public
*/
exports.$destroy = function (remove) {
if (this._isDestroyed) {
return
}
this._callHook('beforeDestroy')
this._isBeingDestroyed = true
// remove DOM element
if (remove && this.$el) {
this.$remove()
}
var i
// remove self from parent. only necessary
// if parent is not being destroyed as well.
var parent = this.$parent
if (parent && !parent._isBeingDestroyed) {
i = parent._children.indexOf(this)
parent._children.splice(i)
}
// destroy all children.
if (this._children) {
i = this._children.length
while (i--) {
this._children[i].$destroy()
}
}
// teardown all directives. this also tearsdown all
// directive-owned watchers.
i = this._directives.length
while (i--) {
this._directives[i]._teardown()
}
// teardown all user watchers.
for (i in this._userWatchers) {
this._userWatchers[i].teardown()
}
// clean up
if (this.$el) {
this.$el.__vue__ = null
}
// remove reference from data ob
this._data.__ob__.removeVm(this)
this._data =
this._watchers =
this._userWatchers =
this._watcherList =
this.$el =
this.$parent =
this.$root =
this._children =
this._bindings =
this._directives = null
// call the last hook...
this._isDestroyed = true
this._callHook('destroyed')
// turn off all instance listeners.
this.$off()
}
});
require.register(15, function (exports, module) {
var _ = require(2)
/**
* The Batcher maintains a job queue to be run
* async on the next event loop.
*/
function Batcher () {
this._preFlush = null
this.reset()
}
var p = Batcher.prototype
/**
* Push a job into the job queue.
* Jobs with duplicate IDs will be skipped, however we can
* use the `override` option to override existing jobs.
*
* @param {Object} job
* properties:
* - {String|Number} id
* - {Boolean} override
* - {Function} run
*/
p.push = function (job) {
if (!job.id || !this.has[job.id]) {
this.queue.push(job)
this.has[job.id] = job
if (!this.waiting) {
this.waiting = true
_.nextTick(this.flush, this)
}
} else if (job.override) {
var oldJob = this.has[job.id]
oldJob.cancelled = true
this.queue.push(job)
this.has[job.id] = job
}
}
/**
* Flush the queue and run the jobs.
* Will call a preFlush hook if has one.
*/
p.flush = function () {
// before flush hook
if (this._preFlush) {
this._preFlush()
}
// do not cache length because more jobs might be pushed
// as we run existing jobs
for (var i = 0; i < this.queue.length; i++) {
var job = this.queue[i]
if (!job.cancelled) {
job.run()
}
}
this.reset()
}
/**
* Reset the batcher's state.
*/
p.reset = function () {
this.has = {}
this.queue = []
this.waiting = false
}
module.exports = Batcher
});
require.register(16, function (exports, module) {
var uid = 0
/**
* A binding is an observable that can have multiple
* directives subscribing to it.
*
* @constructor
*/
function Binding () {
this.id = ++uid
this.subs = []
}
var p = Binding.prototype
/**
* Add a directive subscriber.
*
* @param {Directive} sub
*/
p.addSub = function (sub) {
this.subs.push(sub)
}
/**
* Remove a directive subscriber.
*
* @param {Directive} sub
*/
p.removeSub = function (sub) {
if (this.subs.length) {
var i = this.subs.indexOf(sub)
if (i > -1) this.subs.splice(i, 1)
}
}
/**
* Notify all subscribers of a new value.
*/
p.notify = function () {
var i = this.subs.length
while (i--) {
this.subs[i].update()
}
}
module.exports = Binding
});
require.register(17, function (exports, module) {
/**
* A doubly linked list-based Least Recently Used (LRU)
* cache. Will keep most recently used items while
* discarding least recently used items when its limit is
* reached. This is a bare-bone version of
* Rasmus Andersson's js-lru:
*
* https://github.com/rsms/js-lru
*
* @param {Number} limit
* @constructor
*/
function Cache (limit) {
this.size = 0
this.limit = limit
this.head = this.tail = undefined
this._keymap = {}
}
var p = Cache.prototype
/**
* Put <value> into the cache associated with <key>.
* Returns the entry which was removed to make room for
* the new entry. Otherwise undefined is returned.
* (i.e. if there was enough room already).
*
* @param {String} key
* @param {*} value
* @return {Entry|undefined}
*/
p.put = function (key, value) {
var entry = {
key:key,
value:value
}
this._keymap[key] = entry
if (this.tail) {
this.tail.newer = entry
entry.older = this.tail
} else {
this.head = entry
}
this.tail = entry
if (this.size === this.limit) {
return this.shift()
} else {
this.size++
}
}
/**
* Purge the least recently used (oldest) entry from the
* cache. Returns the removed entry or undefined if the
* cache was empty.
*/
p.shift = function () {
var entry = this.head
if (entry) {
this.head = this.head.newer
this.head.older = undefined
entry.newer = entry.older = undefined
this._keymap[entry.key] = undefined
}
return entry
}
/**
* Get and register recent use of <key>. Returns the value
* associated with <key> or undefined if not in cache.
*
* @param {String} key
* @param {Boolean} returnEntry
* @return {Entry|*}
*/
p.get = function (key, returnEntry) {
var entry = this._keymap[key]
if (entry === undefined) return
if (entry === this.tail) {
return returnEntry
? entry
: entry.value
}
// HEAD--------------TAIL
// <.older .newer>
// <--- add direction --
// A B C <D> E
if (entry.newer) {
if (entry === this.head) {
this.head = entry.newer
}
entry.newer.older = entry.older // C <-- E.
}
if (entry.older) {
entry.older.newer = entry.newer // C. --> E
}
entry.newer = undefined // D --x
entry.older = this.tail // D. --> E
if (this.tail) {
this.tail.newer = entry // E. <-- D
}
this.tail = entry
return returnEntry
? entry
: entry.value
}
module.exports = Cache
});
require.register(18, function (exports, module) {
var _ = require(2)
var config = require(13)
var textParser = require(5)
var dirParser = require(6)
var templateParser = require(19)
function noop () {}
/**
* Compile a template and return a reusable composite link
* function, which recursively contains more link functions
* inside. This top level compile function should only be
* called on instance root nodes.
*
* @param {Element|DocumentFragment} el
* @param {Object} options
* @param {Boolean} partial
* @return {Function}
*/
module.exports = function compile (el, options, partial) {
var params = !partial && options.paramAttributes
var paramsLinkFn = params
? compileParamAttributes(el, params, options)
: null
var nodeLinkFn = el instanceof DocumentFragment
? null
: compileNode(el, options)
var childLinkFn =
(!nodeLinkFn || !nodeLinkFn.terminal) &&
el.hasChildNodes()
? compileNodeList(el.childNodes, options)
: null
return function link (vm, el) {
if (paramsLinkFn) paramsLinkFn(vm, el)
if (nodeLinkFn) nodeLinkFn(vm, el)
if (childLinkFn) childLinkFn(vm, el.childNodes)
}
}
/**
* Compile a node and return a nodeLinkFn based on the
* node type.
*
* @param {Node} node
* @param {Object} options
* @return {Function|undefined}
*/
function compileNode (node, options) {
var type = node.nodeType
if (type === 1 && node.tagName !== 'SCRIPT') {
return compileElement(node, options)
} else if (type === 3 && config.interpolate) {
return compileTextNode(node, options)
}
}
/**
* Compile an element and return a nodeLinkFn.
*
* @param {Element} el
* @param {Object} options
* @return {Function|null}
*/
function compileElement (el, options) {
var hasAttributes = el.hasAttributes()
var tag = el.tagName.toLowerCase()
if (hasAttributes) {
// check terminal direcitves
var terminalLinkFn
for (var i = 0; i < 3; i++) {
terminalLinkFn = checkTerminalDirectives(el, options)
if (terminalLinkFn) {
terminalLinkFn.terminal = true
return terminalLinkFn
}
}
}
// check custom element component
var component =
tag.indexOf('-') > 0 &&
options.components[tag]
if (component) {
return makeTeriminalLinkFn(el, 'component', tag, options)
}
// check other directives
var linkFn
if (hasAttributes) {
var directives = collectDirectives(el, options)
linkFn = directives.length
? makeDirectivesLinkFn(directives)
: null
}
// if the element is a textarea, we need to interpolate
// its content on initial render.
if (el.tagName === 'TEXTAREA') {
var realLinkFn = linkFn
linkFn = function (vm, el) {
el.value = vm.$interpolate(el.value)
if (realLinkFn) realLinkFn(vm, el)
}
}
return linkFn
}
/**
* Build a multi-directive link function.
*
* @param {Array} directives
* @return {Function} directivesLinkFn
*/
function makeDirectivesLinkFn (directives) {
return function directivesLinkFn (vm, el) {
// reverse apply because it's sorted low to high
var i = directives.length
var dir, j
while (i--) {
dir = directives[i]
if (dir._link) {
// custom link fn
dir._link(vm, el)
} else {
j = dir.descriptors.length
while (j--) {
vm._bindDir(dir.name, el,
dir.descriptors[j], dir.def)
}
}
}
}
}
/**
* Compile a textNode and return a nodeLinkFn.
*
* @param {TextNode} node
* @param {Object} options
* @return {Function|null} textNodeLinkFn
*/
function compileTextNode (node, options) {
var tokens = textParser.parse(node.nodeValue)
if (!tokens) {
return null
}
var frag = document.createDocumentFragment()
var dirs = options.directives
var el, token, value
for (var i = 0, l = tokens.length; i < l; i++) {
token = tokens[i]
value = token.value
if (token.tag) {
if (token.oneTime) {
el = document.createTextNode(value)
} else {
if (token.html) {
el = document.createComment('v-html')
token.type = 'html'
token.def = dirs.html
token.descriptor = dirParser.parse(value)[0]
} else if (token.partial) {
el = document.createComment('v-partial')
token.type = 'partial'
token.def = dirs.partial
token.descriptor = dirParser.parse(value)[0]
} else {
// IE will clean up empty textNodes during
// frag.cloneNode(true), so we have to give it
// something here...
el = document.createTextNode(' ')
token.type = 'text'
token.def = dirs.text
token.descriptor = dirParser.parse(value)[0]
}
}
} else {
el = document.createTextNode(value)
}
frag.appendChild(el)
}
return makeTextNodeLinkFn(tokens, frag, options)
}
/**
* Build a function that processes a textNode.
*
* @param {Array<Object>} tokens
* @param {DocumentFragment} frag
*/
function makeTextNodeLinkFn (tokens, frag) {
return function textNodeLinkFn (vm, el) {
var fragClone = frag.cloneNode(true)
var childNodes = _.toArray(fragClone.childNodes)
var token, value, node
for (var i = 0, l = tokens.length; i < l; i++) {
token = tokens[i]
value = token.value
if (token.tag) {
node = childNodes[i]
if (token.oneTime) {
value = vm.$eval(value)
if (token.html) {
_.replace(node, templateParser.parse(value, true))
} else {
node.nodeValue = value
}
} else {
vm._bindDir(token.type, node,
token.descriptor, token.def)
}
}
}
_.replace(el, fragClone)
}
}
/**
* Compile a node list and return a childLinkFn.
*
* @param {NodeList} nodeList
* @param {Object} options
* @return {Function|undefined}
*/
function compileNodeList (nodeList, options) {
var linkFns = []
var nodeLinkFn, childLinkFn, node
for (var i = 0, l = nodeList.length; i < l; i++) {
node = nodeList[i]
nodeLinkFn = compileNode(node, options)
childLinkFn =
(!nodeLinkFn || !nodeLinkFn.terminal) &&
node.hasChildNodes()
? compileNodeList(node.childNodes, options)
: null
linkFns.push(nodeLinkFn, childLinkFn)
}
return linkFns.length
? makeChildLinkFn(linkFns)
: null
}
/**
* Make a child link function for a node's childNodes.
*
* @param {Array<Function>} linkFns
* @return {Function} childLinkFn
*/
function makeChildLinkFn (linkFns) {
return function childLinkFn (vm, nodes) {
// stablize nodes
nodes = _.toArray(nodes)
var node, nodeLinkFn, childrenLinkFn
for (var i = 0, n = 0, l = linkFns.length; i < l; n++) {
node = nodes[n]
nodeLinkFn = linkFns[i++]
childrenLinkFn = linkFns[i++]
if (nodeLinkFn) {
nodeLinkFn(vm, node)
}
if (childrenLinkFn) {
childrenLinkFn(vm, node.childNodes)
}
}
}
}
/**
* Compile param attributes on a root element and return
* a paramAttributes link function.
*
* @param {Element} el
* @param {Array} attrs
* @param {Object} options
* @return {Function} paramsLinkFn
*/
function compileParamAttributes (el, attrs, options) {
var params = []
var i = attrs.length
var name, value, param
while (i--) {
name = attrs[i]
value = el.getAttribute(name)
if (value !== null) {
param = {
name: name,
value: value
}
var tokens = textParser.parse(value)
if (tokens) {
el.removeAttribute(name)
if (tokens.length > 1) {
_.warn(
'Invalid param attribute binding: "' +
name + '="' + value + '"' +
'\nDon\'t mix binding tags with plain text ' +
'in param attribute bindings.'
)
continue
} else {
param.dynamic = true
param.value = tokens[0].value
}
}
params.push(param)
}
}
return makeParamsLinkFn(params, options)
}
/**
* Build a function that applies param attributes to a vm.
*
* @param {Array} params
* @param {Object} options
* @return {Function} paramsLinkFn
*/
function makeParamsLinkFn (params, options) {
var def = options.directives['with']
return function paramsLinkFn (vm, el) {
var i = params.length
var param
while (i--) {
param = params[i]
if (param.dynamic) {
// dynamic param attribtues are bound as v-with.
// we can directly duck the descriptor here beacuse
// param attributes cannot use expressions or
// filters.
vm._bindDir('with', el, {
arg: param.name,
expression: param.value
}, def)
} else {
// just set once
vm.$set(param.name, param.value)
}
}
}
}
/**
* Check an element for terminal directives in fixed order.
* If it finds one, return a terminal link function.
*
* @param {Element} el
* @param {Object} options
* @return {Function} terminalLinkFn
*/
var terminalDirectives = [
'repeat',
'component',
'if'
]
function checkTerminalDirectives (el, options) {
if (_.attr(el, 'pre') !== null) {
return noop
}
var value, dirName
/* jshint boss: true */
for (var i = 0; i < 3; i++) {
dirName = terminalDirectives[i]
if (value = _.attr(el, dirName)) {
return makeTeriminalLinkFn(el, dirName, value, options)
}
}
}
/**
* Build a link function for a terminal directive.
*
* @param {Element} el
* @param {String} dirName
* @param {String} value
* @param {Object} options
* @return {Function} terminalLinkFn
*/
function makeTeriminalLinkFn (el, dirName, value, options) {
var descriptor = dirParser.parse(value)[0]
var def = options.directives[dirName]
return function terminalLinkFn (vm, el) {
vm._bindDir(dirName, el, descriptor, def)
}
}
/**
* Collect the directives on an element.
*
* @param {Element} el
* @param {Object} options
* @return {Array}
*/
function collectDirectives (el, options) {
var attrs = _.toArray(el.attributes)
var i = attrs.length
var dirs = []
var attr, attrName, dir, dirName, dirDef
while (i--) {
attr = attrs[i]
attrName = attr.name
if (attrName.indexOf(config.prefix) === 0) {
dirName = attrName.slice(config.prefix.length)
dirDef = options.directives[dirName]
_.assertAsset(dirDef, 'directive', dirName)
if (dirDef) {
if (dirName !== 'cloak') {
el.removeAttribute(attrName)
}
dirs.push({
name: dirName,
descriptors: dirParser.parse(attr.value),
def: dirDef
})
}
} else if (config.interpolate) {
dir = collectAttrDirective(el, attrName, attr.value,
options)
if (dir) {
dirs.push(dir)
}
}
}
// sort by priority, LOW to HIGH
dirs.sort(directiveComparator)
return dirs
}
/**
* Check an attribute for potential dynamic bindings,
* and return a directive object.
*
* @param {Element} el
* @param {String} name
* @param {String} value
* @param {Object} options
* @return {Object}
*/
function collectAttrDirective (el, name, value, options) {
var tokens = textParser.parse(value)
if (tokens) {
var def = options.directives.attr
var i = tokens.length
var allOneTime = true
while (i--) {
var token = tokens[i]
if (token.tag && !token.oneTime) {
allOneTime = false
}
}
return {
def: def,
_link: allOneTime
? function (vm, el) {
el.setAttribute(name, vm.$interpolate(value))
}
: function (vm, el) {
var value = textParser.tokensToExp(tokens, vm)
var desc = dirParser.parse(name + ':' + value)[0]
vm._bindDir('attr', el, desc, def)
}
}
}
}
/**
* Directive priority sort comparator
*
* @param {Object} a
* @param {Object} b
*/
function directiveComparator (a, b) {
a = a.def.priority || 0
b = b.def.priority || 0
return a > b ? 1 : -1
}
});
require.register(20, function (exports, module) {
var _ = require(2)
var templateParser = require(19)
/**
* Process an element or a DocumentFragment based on a
* instance option object. This allows us to transclude
* a template node/fragment before the instance is created,
* so the processed fragment can then be cloned and reused
* in v-repeat.
*
* @param {Element} el
* @param {Object} options
* @return {Element|DocumentFragment}
*/
module.exports = function transclude (el, options) {
// for template tags, what we want is its content as
// a documentFragment (for block instances)
if (el.tagName === 'TEMPLATE') {
el = templateParser.parse(el)
}
if (options.template) {
return transcludeTemplate(el, options)
} else {
return el
}
}
/**
* Process the template option.
* If the replace option is true this will swap the $el.
*
* @param {Element} el
* @param {Object} options
* @return {Element|DocumentFragment}
*/
function transcludeTemplate (el, options) {
var template = options.template
var frag = templateParser.parse(template, true)
if (!frag) {
_.warn('Invalid template option: ' + template)
} else {
collectRawContent(el)
if (options.replace) {
if (frag.childNodes.length > 1) {
transcludeContent(_.toArray(frag.childNodes))
return frag
} else {
var replacer = frag.firstChild
_.copyAttributes(el, replacer)
transcludeContent(replacer)
return replacer
}
} else {
el.appendChild(frag)
transcludeContent(el)
return el
}
}
}
/**
* Collect raw content inside $el before they are
* replaced by template content.
*/
var rawContent
function collectRawContent (el) {
var child
rawContent = null
if (el.hasChildNodes()) {
rawContent = document.createElement('div')
/* jshint boss:true */
while (child = el.firstChild) {
rawContent.appendChild(child)
}
}
}
/**
* Resolve <content> insertion points mimicking the behavior
* of the Shadow DOM spec:
*
* http://w3c.github.io/webcomponents/spec/shadow/#insertion-points
*
* @param {Element|DocumentFragment} el
*/
function transcludeContent (el) {
var outlets = getOutlets(el)
var i = outlets.length
if (!i) return
var outlet, select, j, main
// first pass, collect corresponding content
// for each outlet.
while (i--) {
outlet = outlets[i]
if (rawContent) {
select = outlet.getAttribute('select')
if (select) { // select content
outlet.content = _.toArray(
rawContent.querySelectorAll(select)
)
} else { // default content
main = outlet
}
} else { // fallback content
outlet.content = _.toArray(outlet.childNodes)
}
}
// second pass, actually insert the contents
for (i = 0, j = outlets.length; i < j; i++) {
outlet = outlets[i]
if (outlet !== main) {
insertContentAt(outlet, outlet.content)
}
}
// finally insert the main content
if (main) {
insertContentAt(main, _.toArray(rawContent.childNodes))
}
}
/**
* Get <content> outlets from the element/list
*
* @param {Element|Array} el
* @return {Array}
*/
var concat = [].concat
function getOutlets (el) {
return _.isArray(el)
? concat.apply([], el.map(getOutlets))
: el.nodeType === 1
? _.toArray(el.querySelectorAll('content'))
: []
}
/**
* Insert an array of nodes at outlet,
* then remove the outlet.
*
* @param {Element} outlet
* @param {Array} contents
*/
function insertContentAt (outlet, contents) {
// not using util DOM methods here because
// parentNode can be cached
var parent = outlet.parentNode
for (var i = 0, j = contents.length; i < j; i++) {
parent.insertBefore(contents[i], outlet)
}
parent.removeChild(outlet)
}
});
require.register(13, function (exports, module) {
module.exports = {
/**
* The prefix to look for when parsing directives.
*
* @type {String}
*/
prefix: 'v-',
/**
* Whether to print debug messages.
* Also enables stack trace for warnings.
*
* @type {Boolean}
*/
debug: false,
/**
* Whether to suppress warnings.
*
* @type {Boolean}
*/
silent: false,
/**
* Whether allow observer to alter data objects'
* __proto__.
*
* @type {Boolean}
*/
proto: true,
/**
* Whether to parse mustache tags in templates.
*
* @type {Boolean}
*/
interpolate: true,
/**
* Internal flag to indicate the delimiters have been
* changed.
*
* @type {Boolean}
*/
_delimitersChanged: true
}
/**
* Interpolation delimiters.
* We need to mark the changed flag so that the text parser
* knows it needs to recompile the regex.
*
* @type {Array<String>}
*/
var delimiters = ['{{', '}}']
Object.defineProperty(module.exports, 'delimiters', {
get: function () {
return delimiters
},
set: function (val) {
delimiters = val
this._delimitersChanged = true
}
})
});
require.register(21, function (exports, module) {
var _ = require(2)
var Watcher = require(4)
var textParser = require(5)
var expParser = require(7)
/**
* A directive links a DOM element with a piece of data,
* which is the result of evaluating an expression.
* It registers a watcher with the expression and calls
* the DOM update function when a change is triggered.
*
* @param {String} name
* @param {Node} el
* @param {Vue} vm
* @param {Object} descriptor
* - {String} expression
* - {String} [arg]
* - {Array<Object>} [filters]
* @param {Object} def - directive definition object
* @param {Function} [linker] - pre-compiled linker function
* @constructor
*/
function Directive (name, el, vm, descriptor, def, linker) {
// public
this.name = name
this.el = el
this.vm = vm
// copy descriptor props
this.raw = descriptor.raw
this.expression = descriptor.expression
this.arg = descriptor.arg
this.filters = _.resolveFilters(vm, descriptor.filters)
// private
this._linker = linker
this._locked = false
this._bound = false
// init
this._bind(def)
}
var p = Directive.prototype
/**
* Initialize the directive, mixin definition properties,
* setup the watcher, call definition bind() and update()
* if present.
*
* @param {Object} def
*/
p._bind = function (def) {
if (typeof def === 'function') {
this.update = def
} else {
_.extend(this, def)
}
this._watcherExp = this.expression
this._checkDynamicLiteral()
if (this.bind) {
this.bind()
}
if (
this.expression && this.update &&
(!this.isLiteral || this._isDynamicLiteral) &&
!this._checkExpFn()
) {
// use raw expression as identifier because filters
// make them different watchers
var watcher = this.vm._watchers[this.raw]
// wrapped updater for context
var dir = this
var update = this._update = function (val, oldVal) {
if (!dir._locked) {
dir.update(val, oldVal)
}
}
if (!watcher) {
watcher = this.vm._watchers[this.raw] = new Watcher(
this.vm,
this._watcherExp,
update, // callback
this.filters,
this.twoWay // need setter
)
} else {
watcher.addCb(update)
}
this._watcher = watcher
this.update(watcher.value)
}
this._bound = true
}
/**
* check if this is a dynamic literal binding.
*
* e.g. v-component="{{currentView}}"
*/
p._checkDynamicLiteral = function () {
var expression = this.expression
if (expression && this.isLiteral) {
var tokens = textParser.parse(expression)
if (tokens) {
var exp = textParser.tokensToExp(tokens)
this.expression = this.vm.$get(exp)
this._watcherExp = exp
this._isDynamicLiteral = true
}
}
}
/**
* Check if the directive is a function caller
* and if the expression is a callable one. If both true,
* we wrap up the expression and use it as the event
* handler.
*
* e.g. v-on="click: a++"
*
* @return {Boolean}
*/
p._checkExpFn = function () {
var expression = this.expression
if (
expression && this.isFn &&
!expParser.pathTestRE.test(expression)
) {
var fn = expParser.parse(expression).get
var vm = this.vm
var handler = function () {
fn.call(vm, vm)
}
if (this.filters) {
handler = _.applyFilters(
handler,
this.filters.read,
vm
)
}
this.update(handler)
return true
}
}
/**
* Teardown the watcher and call unbind.
*/
p._teardown = function () {
if (this._bound) {
if (this.unbind) {
this.unbind()
}
var watcher = this._watcher
if (watcher && watcher.active) {
watcher.removeCb(this._update)
if (!watcher.active) {
this.vm._watchers[this.expression] = null
}
}
this._bound = false
this.vm = this.el = this._watcher = null
}
}
/**
* Set the corresponding value with the setter.
* This should only be used in two-way directives
* e.g. v-model.
*
* @param {*} value
* @param {Boolean} lock - prevent wrtie triggering update.
* @public
*/
p.set = function (value, lock) {
if (this.twoWay) {
if (lock) {
this._locked = true
}
this._watcher.set(value)
if (lock) {
var self = this
_.nextTick(function () {
self._locked = false
})
}
}
}
module.exports = Directive
});
require.register(22, function (exports, module) {
// xlink
var xlinkNS = 'http://www.w3.org/1999/xlink'
var xlinkRE = /^xlink:/
module.exports = {
priority: 850,
bind: function () {
var name = this.arg
this.update = xlinkRE.test(name)
? xlinkHandler
: defaultHandler
}
}
function defaultHandler (value) {
if (value != null) {
this.el.setAttribute(this.arg, value)
} else {
this.el.removeAttribute(this.arg)
}
}
function xlinkHandler (value) {
if (value != null) {
this.el.setAttributeNS(xlinkNS, this.arg, value)
} else {
this.el.removeAttributeNS(xlinkNS, 'href')
}
}
});
require.register(23, function (exports, module) {
var _ = require(2)
var hasClassList =
typeof document !== 'undefined' &&
'classList' in document.documentElement
/**
* add class for IE9
*
* @param {Element} el
* @param {Strong} cls
*/
var addClass = hasClassList
? function (el, cls) {
el.classList.add(cls)
}
: _.addClass
/**
* remove class for IE9
*
* @param {Element} el
* @param {Strong} cls
*/
var removeClass = hasClassList
? function (el, cls) {
el.classList.remove(cls)
}
: _.removeClass
module.exports = function (value) {
if (this.arg) {
var method = value ? addClass : removeClass
method(this.el, this.arg)
} else {
if (this.lastVal) {
removeClass(this.el, this.lastVal)
}
if (value) {
addClass(this.el, value)
this.lastVal = value
}
}
}
});
require.register(24, function (exports, module) {
var config = require(13)
module.exports = {
bind: function () {
var el = this.el
this.vm.$once('hook:compiled', function () {
el.removeAttribute(config.prefix + 'cloak')
})
}
}
});
require.register(25, function (exports, module) {
var _ = require(2)
var Watcher = require(4)
module.exports = {
isLiteral: true,
/**
* Setup. Need to check a few possible permutations:
*
* - literal:
* v-component="comp"
*
* - dynamic:
* v-component="{{currentView}}"
*
* - conditional:
* v-component="comp" v-if="abc"
*
* - dynamic + conditional:
* v-component="{{currentView}}" v-if="abc"
*/
bind: function () {
if (!this.el.__vue__) {
// create a ref anchor
this.ref = document.createComment('v-component')
_.replace(this.el, this.ref)
// check v-if conditionals
this.checkIf()
// check keep-alive options
this.checkKeepAlive()
// if static, build right now.
if (!this._isDynamicLiteral) {
this.resolveCtor(this.expression)
this.build()
}
} else {
_.warn(
'v-component="' + this.expression + '" cannot be ' +
'used on an already mounted instance.'
)
}
},
/**
* Check if v-component is being used together with v-if.
* If yes, we created a watcher for the v-if value and
* react to its value change in `this.ifCallback`.
*/
checkIf: function () {
var condition = _.attr(this.el, 'if')
if (condition !== null) {
var self = this
this.ifWatcher = new Watcher(
this.vm,
condition,
function (value) {
self.toggleIf(value)
}
)
this.active = this.ifWatcher.value
} else {
this.active = true
}
},
/**
* Callback when v-if value changes.
* Marks the active flag.
*
* @param {*} value
*/
toggleIf: function (value) {
if (value) {
this.active = true
this.build()
} else {
this.active = false
this.unbuild(true)
}
},
/**
* Check if the "keep-alive" flag is present.
* If yes, instead of destroying the active vm when
* hiding (v-if) or switching (dynamic literal) it,
* we simply remove it from the DOM and save it in a
* cache object, with its constructor id as the key.
*/
checkKeepAlive: function () {
// check keep-alive flag
this.keepAlive = this.el.hasAttribute('keep-alive')
if (this.keepAlive) {
this.el.removeAttribute('keep-alive')
this.cache = {}
}
},
/**
* Resolve the component constructor to use when creating
* the child vm.
*/
resolveCtor: function (id) {
this.ctorId = id
this.Ctor = this.vm.$options.components[id]
_.assertAsset(this.Ctor, 'component', id)
},
/**
* Instantiate/insert a new child vm.
* If keep alive and has cached instance, insert that
* instance; otherwise build a new one and cache it.
*/
build: function () {
if (!this.active) {
return
}
if (this.keepAlive) {
var vm = this.cache[this.ctorId]
if (vm) {
this.childVM = vm
vm.$before(this.ref)
return
}
}
if (this.Ctor && !this.childVM) {
this.childVM = this.vm.$addChild({
el: this.el.cloneNode(true)
}, this.Ctor)
if (this.keepAlive) {
this.cache[this.ctorId] = this.childVM
}
this.childVM.$before(this.ref)
}
},
/**
* Teardown the active vm.
* If keep alive, simply remove it; otherwise destroy it.
*
* @param {Boolean} remove
*/
unbuild: function (remove) {
if (!this.childVM) {
return
}
if (this.keepAlive) {
if (remove) {
this.childVM.$remove()
}
} else {
this.childVM.$destroy(remove)
}
this.childVM = null
},
/**
* Update callback for the dynamic literal scenario,
* e.g. v-component="{{view}}"
*/
update: function (value) {
this.unbuild(true)
if (value) {
this.resolveCtor(value)
this.build()
}
},
/**
* Unbind.
* Make sure keepAlive is set to false so that the
* instance is always destroyed. Teardown v-if watcher
* if present.
*/
unbind: function () {
this.keepAlive = false
this.unbuild()
if (this.ifWatcher) {
this.ifWatcher.teardown()
}
}
}
});
require.register(26, function (exports, module) {
module.exports = {
isLiteral: true,
bind: function () {
this.vm._owner.$$[this.expression] = this.el
},
unbind: function () {
this.vm._owner.$$[this.expression] = null
}
}
});
require.register(27, function (exports, module) {
var _ = require(2)
var templateParser = require(19)
module.exports = {
bind: function () {
// a comment node means this is a binding for
// {{{ inline unescaped html }}}
if (this.el.nodeType === 8) {
// hold nodes
this.nodes = []
}
},
update: function (value) {
value = _.toString(value)
if (this.nodes) {
this.swap(value)
} else {
this.el.innerHTML = value
}
},
swap: function (value) {
// remove old nodes
var i = this.nodes.length
while (i--) {
_.remove(this.nodes[i])
}
// convert new value to a fragment
var frag = templateParser.parse(value, true)
// save a reference to these nodes so we can remove later
this.nodes = _.toArray(frag.childNodes)
_.before(frag, this.el)
}
}
});
require.register(28, function (exports, module) {
var _ = require(2)
var templateParser = require(19)
module.exports = {
bind: function () {
var el = this.el
if (!el.__vue__) {
this.ref = document.createComment('v-if')
_.replace(el, this.ref)
this.inserted = false
if (el.tagName === 'TEMPLATE') {
this.el = templateParser.parse(el, true)
}
} else {
this.invalid = true
_.warn(
'v-if="' + this.expression + '" cannot be ' +
'used on an already mounted instance.'
)
}
},
update: function (value) {
if (this.invalid) return
if (value) {
if (!this.inserted) {
if (!this.childVM) {
this.childVM = this.vm.$addChild({
el: this.el,
inherit: true,
_anonymous: true
})
}
this.childVM.$before(this.ref)
this.inserted = true
}
} else {
if (this.inserted) {
this.childVM.$remove()
this.inserted = false
}
}
},
unbind: function () {
if (this.childVM) {
this.childVM.$destroy()
}
}
}
});
require.register(29, function (exports, module) {
// manipulation directives
exports.text = require(30)
exports.html = require(27)
exports.attr = require(22)
exports.show = require(31)
exports['class'] = require(23)
exports.el = require(26)
exports.ref = require(32)
exports.cloak = require(24)
exports.style = require(33)
exports.partial = require(34)
exports.transition = require(35)
// event listener directives
exports.on = require(36)
exports.model = require(37)
// child vm directives
exports.component = require(25)
exports.repeat = require(38)
exports['if'] = require(28)
exports['with'] = require(39)
});
require.register(40, function (exports, module) {
var _ = require(2)
module.exports = {
bind: function () {
var self = this
var el = this.el
this.listener = function () {
self.set(el.checked, true)
}
_.on(el, 'change', this.listener)
if (el.checked) {
// watcher is not set up yet
this.vm.$set(this.expression, el.checked)
}
},
update: function (value) {
this.el.checked = !!value
},
unbind: function () {
_.off(this.el, 'change', this.listener)
}
}
});
require.register(37, function (exports, module) {
var _ = require(2)
var handlers = {
text: require(41),
radio: require(42),
select: require(43),
checkbox: require(40)
}
module.exports = {
priority: 800,
twoWay: true,
handlers: handlers,
/**
* Possible elements:
* <select>
* <textarea>
* <input type="*">
* - text
* - checkbox
* - radio
* - number
* - TODO: more types may be supplied as a plugin
*/
bind: function () {
var el = this.el
var tag = el.tagName
var handler
if (tag === 'INPUT') {
handler = handlers[el.type] || handlers.text
} else if (tag === 'SELECT') {
handler = handlers.select
} else if (tag === 'TEXTAREA') {
handler = handlers.text
} else {
_.warn("v-model doesn't support element type: " + tag)
return
}
handler.bind.call(this)
this.update = handler.update
this.unbind = handler.unbind
}
}
});
require.register(42, function (exports, module) {
var _ = require(2)
module.exports = {
bind: function () {
var self = this
var el = this.el
this.listener = function () {
self.set(el.value, true)
}
_.on(el, 'change', this.listener)
if (el.checked) {
// watcher is not set up yet
this.vm.$set(this.expression, el.value)
}
},
update: function (value) {
/* jshint eqeqeq: false */
this.el.checked = value == this.el.value
},
unbind: function () {
_.off(this.el, 'change', this.listener)
}
}
});
require.register(43, function (exports, module) {
var _ = require(2)
var Watcher = require(4)
module.exports = {
bind: function () {
var self = this
var el = this.el
// check options param
var optionsParam = el.getAttribute('options')
if (optionsParam) {
el.removeAttribute('options')
initOptions.call(this, optionsParam)
}
this.multiple = el.hasAttribute('multiple')
this.listener = function () {
var value = self.multiple
? getMultiValue(el)
: el.value
self.set(value, true)
}
_.on(el, 'change', this.listener)
checkInitialValue.call(this)
},
update: function (value) {
/* jshint eqeqeq: false */
var el = this.el
el.selectedIndex = -1
var multi = this.multiple && _.isArray(value)
var options = el.options
var i = options.length
var option
while (i--) {
option = options[i]
option.selected = multi
? value.indexOf(option.value) > -1
: value == option.value
}
},
unbind: function () {
_.off(this.el, 'change', this.listener)
if (this.optionWatcher) {
this.optionWatcher.teardown()
}
}
}
/**
* Initialize the option list from the param.
*
* @param {String} expression
*/
function initOptions (expression) {
var self = this
function optionUpdateWatcher (value) {
if (_.isArray(value)) {
self.el.innerHTML = ''
buildOptions(self.el, value)
if (self._watcher) {
self.update(self._watcher.value)
}
} else {
_.warn('Invalid options value for v-model: ' + value)
}
}
this.optionWatcher = new Watcher(
this.vm,
expression,
optionUpdateWatcher
)
// update with initial value
optionUpdateWatcher(this.optionWatcher.value)
}
/**
* Build up option elements. IE9 doesn't create options
* when setting innerHTML on <select> elements, so we have
* to use DOM API here.
*
* @param {Element} parent - a <select> or an <optgroup>
* @param {Array} options
*/
function buildOptions (parent, options) {
var op, el
for (var i = 0, l = options.length; i < l; i++) {
op = options[i]
if (!op.options) {
el = document.createElement('option')
if (typeof op === 'string') {
el.text = el.value = op
} else {
el.text = op.text
el.value = op.value
}
} else {
el = document.createElement('optgroup')
el.label = op.label
buildOptions(el, op.options)
}
parent.appendChild(el)
}
}
/**
* Check the initial value for selected options.
*/
function checkInitialValue () {
var initValue
var options = this.el.options
for (var i = 0, l = options.length; i < l; i++) {
if (options[i].hasAttribute('selected')) {
if (this.multiple) {
(initValue || (initValue = []))
.push(options[i].value)
} else {
initValue = options[i].value
}
}
}
if (initValue) {
this.vm.$set(this.expression, initValue)
}
}
/**
* Helper to extract a value array for select[multiple]
*
* @param {SelectElement} el
* @return {Array}
*/
function getMultiValue (el) {
return Array.prototype.filter
.call(el.options, filterSelected)
.map(getOptionValue)
}
function filterSelected (op) {
return op.selected
}
function getOptionValue (op) {
return op.value || op.text
}
});
require.register(41, function (exports, module) {
var _ = require(2)
module.exports = {
bind: function () {
var self = this
var el = this.el
// check params
// - lazy: update model on "change" instead of "input"
var lazy = el.hasAttribute('lazy')
if (lazy) {
el.removeAttribute('lazy')
}
// - number: cast value into number when updating model.
var number =
el.hasAttribute('number') ||
el.type === 'number'
if (number) {
el.removeAttribute('number')
}
// handle composition events.
// http://blog.evanyou.me/2014/01/03/composition-event/
var cpLocked = false
this.cpLock = function () {
cpLocked = true
}
this.cpUnlock = function () {
cpLocked = false
// in IE11 the "compositionend" event fires AFTER
// the "input" event, so the input handler is blocked
// at the end... have to call it here.
set()
}
_.on(el,'compositionstart', this.cpLock)
_.on(el,'compositionend', this.cpUnlock)
// shared setter
function set () {
self.set(
number ? _.toNumber(el.value) : el.value,
true
)
}
// if the directive has filters, we need to
// record cursor position and restore it after updating
// the input with the filtered value.
if (this.filters) {
this.listener = function textInputListener () {
if (cpLocked) return
var cursorPos
// some HTML5 input types throw error here
try { cursorPos = el.selectionStart } catch (e) {}
set()
// force a value update, because in
// certain cases the write filters output the same
// result for different input values, and the Observer
// set events won't be triggered.
_.nextTick(function () {
var newVal = self._watcher.value
self.update(newVal)
if (cursorPos != null) {
el.setSelectionRange(cursorPos, cursorPos)
}
})
}
} else {
this.listener = function textInputListener () {
if (cpLocked) return
set()
}
}
this.event = lazy ? 'change' : 'input'
_.on(el, this.event, this.listener)
// IE9 doesn't fire input event on backspace/del/cut
if (!lazy && _.isIE9) {
this.onCut = function () {
_.nextTick(self.listener)
}
this.onDel = function (e) {
if (e.keyCode === 46 || e.keyCode === 8) {
self.listener()
}
}
_.on(el, 'cut', this.onCut)
_.on(el, 'keyup', this.onDel)
}
// set initial value if present
if (
el.hasAttribute('value') ||
(el.tagName === 'TEXTAREA' && el.value.trim())
) {
// watcher is not set up yet
this.vm.$set(this.expression, el.value)
}
},
update: function (value) {
this.el.value = _.toString(value)
},
unbind: function () {
var el = this.el
_.off(el, this.event, this.listener)
_.off(el,'compositionstart', this.cpLock)
_.off(el,'compositionend', this.cpUnlock)
if (this.onCut) {
_.off(el,'cut', this.onCut)
_.off(el,'keyup', this.onDel)
}
}
}
});
require.register(36, function (exports, module) {
var _ = require(2)
module.exports = {
isFn: true,
priority: 700,
bind: function () {
// deal with iframes
if (
this.el.tagName === 'IFRAME' &&
this.arg !== 'load'
) {
var self = this
this.iframeBind = function () {
_.on(self.el.contentWindow, self.arg, self.handler)
}
_.on(this.el, 'load', this.iframeBind)
}
},
update: function (handler) {
if (typeof handler !== 'function') {
_.warn(
'Directive "v-on:' + this.expression + '" ' +
'expects a function value.'
)
return
}
this.reset()
var vm = this.vm
var root = vm.$root
this.handler = function (e) {
e.targetVM = vm
root.$event = e
var res = handler(e)
root.$event = null
return res
}
if (this.iframeBind) {
this.iframeBind()
} else {
_.on(this.el, this.arg, this.handler)
}
},
reset: function () {
var el = this.iframeBind
? this.el.contentWindow
: this.el
if (this.handler) {
_.off(el, this.arg, this.handler)
}
},
unbind: function () {
this.reset()
_.off(this.el, 'load', this.iframeBind)
}
}
});
require.register(34, function (exports, module) {
var _ = require(2)
var compile = require(18)
var templateParser = require(19)
module.exports = {
isLiteral: true,
bind: function () {
var id = this.expression
var partial = this.vm.$options.partials[id]
_.assertAsset(partial, 'partial', id)
if (!partial) {
return
}
partial = templateParser.parse(partial, true)
var el = this.el
var vm = this.vm
if (el.nodeType === 8) {
// comment ref node means inline partial
compile(partial, vm.$options)(vm, partial)
_.replace(el, partial)
} else {
// just set innerHTML...
el.innerHTML = ''
el.appendChild(partial)
compile(el, vm.$options, true)(vm, el)
}
}
}
});
require.register(32, function (exports, module) {
var _ = require(2)
module.exports = {
isLiteral: true,
bind: function () {
if (this.el !== this.vm.$el) {
_.warn(
'v-ref should only be used on instance root nodes.'
)
return
}
this.vm._owner.$[this.expression] = this.vm
},
unbind: function () {
this.vm._owner.$[this.expression] = null
}
}
});
require.register(38, function (exports, module) {
var _ = require(2)
var isObject = _.isObject
var textParser = require(5)
var expParser = require(7)
var templateParser = require(19)
var compile = require(18)
var transclude = require(20)
var mergeOptions = require(12)
var uid = 0
module.exports = {
/**
* Setup.
*/
bind: function () {
// uid as a cache identifier
this.id = '__v_repeat_' + (++uid)
// we need to insert the objToArray converter
// as the first read filter.
if (!this.filters) {
this.filters = {}
}
if (!this.filters.read) {
this.filters.read = [objToArray]
} else {
this.filters.read.unshift(objToArray)
}
// setup ref node
this.ref = document.createComment('v-repeat')
_.replace(this.el, this.ref)
// check if this is a block repeat
this.template = this.el.tagName === 'TEMPLATE'
? templateParser.parse(this.el, true)
: this.el
// check other directives that need to be handled
// at v-repeat level
this.checkIf()
this.checkRef()
this.checkTrackById()
this.checkComponent()
// cache for primitive value instances
this.cache = Object.create(null)
},
/**
* Warn against v-if usage.
*/
checkIf: function () {
if (_.attr(this.el, 'if') !== null) {
_.warn(
'Don\'t use v-if with v-repeat. ' +
'Use v-show or the "filterBy" filter instead.'
)
}
},
/**
* Check if v-ref/ v-el is also present.
*/
checkRef: function () {
this.owner = this.vm._owner
var childId = _.attr(this.el, 'ref')
this.childId = childId
? this.vm.$interpolate(childId)
: null
var elId = _.attr(this.el, 'el')
this.elId = elId
? this.vm.$interpolate(elId)
: null
},
/**
* Check for a track-by ID, which allows us to identify
* a piece of data and its associated instance by its
* unique id.
*/
checkTrackById: function () {
this.idKey = this.el.getAttribute('trackby')
if (this.idKey !== null) {
this.el.removeAttribute('trackby')
}
},
/**
* Check the component constructor to use for repeated
* instances. If static we resolve it now, otherwise it
* needs to be resolved at build time with actual data.
*/
checkComponent: function () {
var id = _.attr(this.el, 'component')
if (!id) {
this.Ctor = _.Vue // default constructor
this.inherit = true // inline repeats should inherit
this._linker = compile(this.template, this.vm.$options)
} else {
var tokens = textParser.parse(id)
if (!tokens) { // static component
var Ctor = this.Ctor = this.vm.$options.components[id]
_.assertAsset(Ctor, 'component', id)
if (Ctor) {
// merge an empty object with owner vm as parent
// so child vms can access parent assets.
var merged = mergeOptions(
Ctor.options,
{},
{ $parent: this.vm }
)
this.template = transclude(this.template, merged)
this._linker = compile(this.template, merged)
}
} else {
// to be resolved later
var ctorExp = textParser.tokensToExp(tokens)
this.ctorGetter = expParser.parse(ctorExp).get
}
}
},
/**
* Update.
* This is called whenever the Array mutates.
*
* @param {Array} data
*/
update: function (data) {
if (typeof data === 'number') {
data = range(data)
}
this.converted = data && data._converted
this.vms = this.diff(data || [], this.vms)
// update v-ref
if (this.childId) {
this.owner.$[this.childId] = this.vms
}
if (this.elId) {
this.owner.$$[this.elId] = this.vms.map(function (vm) {
return vm.$el
})
}
},
/**
* Diff, based on new data and old data, determine the
* minimum amount of DOM manipulations needed to make the
* DOM reflect the new data Array.
*
* The algorithm diffs the new data Array by storing a
* hidden reference to an owner vm instance on previously
* seen data. This allows us to achieve O(n) which is
* better than a levenshtein distance based algorithm,
* which is O(m * n).
*
* @param {Array} data
* @param {Array} oldVms
* @return {Array}
*/
diff: function (data, oldVms) {
var idKey = this.idKey
var converted = this.converted
var ref = this.ref
var alias = this.arg
var init = !oldVms
var vms = new Array(data.length)
var obj, raw, vm, i, l
// First pass, go through the new Array and fill up
// the new vms array. If a piece of data has a cached
// instance for it, we reuse it. Otherwise build a new
// instance.
for (i = 0, l = data.length; i < l; i++) {
obj = data[i]
raw = converted ? obj.value : obj
vm = !init && this.getVm(raw)
if (vm) { // reusable instance
vm._reused = true
vm.$index = i // update $index
if (converted) {
vm.$key = obj.key // update $key
}
if (idKey) { // swap track by id data
if (alias) {
vm[alias] = raw
} else {
vm._setData(raw)
}
}
} else { // new instance
vm = this.build(obj, i)
}
vms[i] = vm
// insert if this is first run
if (init) {
vm.$before(ref)
}
}
// if this is the first run, we're done.
if (init) {
return vms
}
// Second pass, go through the old vm instances and
// destroy those who are not reused (and remove them
// from cache)
for (i = 0, l = oldVms.length; i < l; i++) {
vm = oldVms[i]
if (!vm._reused) {
this.uncacheVm(vm)
vm.$destroy(true)
}
}
// final pass, move/insert new instances into the
// right place. We're going in reverse here because
// insertBefore relies on the next sibling to be
// resolved.
var targetNext, currentNext
i = vms.length
while (i--) {
vm = vms[i]
// this is the vm that we should be in front of
targetNext = vms[i + 1]
if (!targetNext) {
// This is the last item. If it's reused then
// everything else will eventually be in the right
// place, so no need to touch it. Otherwise, insert
// it.
if (!vm._reused) {
vm.$before(ref)
}
} else {
if (vm._reused) {
// this is the vm we are actually in front of
currentNext = findNextVm(vm, ref)
// we only need to move if we are not in the right
// place already.
if (currentNext !== targetNext) {
vm.$before(targetNext.$el, null, false)
}
} else {
// new instance, insert to existing next
vm.$before(targetNext.$el)
}
}
vm._reused = false
}
return vms
},
/**
* Build a new instance and cache it.
*
* @param {Object} data
* @param {Number} index
*/
build: function (data, index) {
var original = data
var meta = { $index: index }
if (this.converted) {
meta.$key = original.key
}
var raw = this.converted ? data.value : data
var alias = this.arg
var hasAlias = !isObject(raw) || alias
// wrap the raw data with alias
data = hasAlias ? {} : raw
if (alias) {
data[alias] = raw
} else if (hasAlias) {
meta.$value = raw
}
// resolve constructor
var Ctor = this.Ctor || this.resolveCtor(data)
var vm = this.vm.$addChild({
el: this.template.cloneNode(true),
_linker: this._linker,
_meta: meta,
data: data,
inherit: this.inherit
}, Ctor)
// cache instance
this.cacheVm(raw, vm)
return vm
},
/**
* Resolve a contructor to use for an instance.
* The tricky part here is that there could be dynamic
* components depending on instance data.
*
* @param {Object} data
* @return {Function}
*/
resolveCtor: function (data) {
var context = Object.create(this.vm)
for (var key in data) {
// use _.define to avoid accidentally
// overwriting scope properties
_.define(context, key, data[key])
}
var id = this.ctorGetter.call(context, context)
var Ctor = this.vm.$options.components[id]
_.assertAsset(Ctor, 'component', id)
return Ctor
},
/**
* Unbind, teardown everything
*/
unbind: function () {
if (this.childId) {
delete this.owner.$[this.childId]
}
if (this.vms) {
var i = this.vms.length
var vm
while (i--) {
vm = this.vms[i]
this.uncacheVm(vm)
vm.$destroy()
}
}
},
/**
* Cache a vm instance based on its data.
*
* If the data is an object, we save the vm's reference on
* the data object as a hidden property. Otherwise we
* cache them in an object and for each primitive value
* there is an array in case there are duplicates.
*
* @param {Object} data
* @param {Vue} vm
*/
cacheVm: function (data, vm) {
var idKey = this.idKey
var cache = this.cache
var id
if (idKey) {
id = data[idKey]
if (!cache[id]) {
cache[id] = vm
} else {
_.warn('Duplicate ID in v-repeat: ' + id)
}
} else if (isObject(data)) {
id = this.id
if (data.hasOwnProperty(id)) {
if (data[id] === null) {
data[id] = vm
} else {
_.warn(
'Duplicate objects are not supported in v-repeat.'
)
}
} else {
_.define(data, this.id, vm)
}
} else {
if (!cache[data]) {
cache[data] = [vm]
} else {
cache[data].push(vm)
}
}
vm._raw = data
},
/**
* Try to get a cached instance from a piece of data.
*
* @param {Object} data
* @return {Vue|undefined}
*/
getVm: function (data) {
if (this.idKey) {
return this.cache[data[this.idKey]]
} else if (isObject(data)) {
return data[this.id]
} else {
var cached = this.cache[data]
if (cached) {
var i = 0
var vm = cached[i]
// since duplicated vm instances might be reused
// already, we need to return the first non-reused
// instance.
while (vm && vm._reused) {
vm = cached[++i]
}
return vm
}
}
},
/**
* Delete a cached vm instance.
*
* @param {Vue} vm
*/
uncacheVm: function (vm) {
var data = vm._raw
if (this.idKey) {
this.cache[data[this.idKey]] = null
} else if (isObject(data)) {
data[this.id] = null
vm._raw = null
} else {
this.cache[data].pop()
}
}
}
/**
* Helper to find the next element that is an instance
* root node. This is necessary because a destroyed vm's
* element could still be lingering in the DOM before its
* leaving transition finishes, but its __vue__ reference
* should have been removed so we can skip them.
*
* @param {Vue} vm
* @param {CommentNode} ref
* @return {Vue}
*/
function findNextVm (vm, ref) {
var el = (vm._blockEnd || vm.$el).nextSibling
while (!el.__vue__ && el !== ref) {
el = el.nextSibling
}
return el.__vue__
}
/**
* Attempt to convert non-Array objects to array.
* This is the default filter installed to every v-repeat
* directive.
*
* @param {*} obj
* @return {Array}
* @private
*/
function objToArray (obj) {
if (!_.isPlainObject(obj)) {
return obj
}
var keys = Object.keys(obj)
var i = keys.length
var res = new Array(i)
var key
while (i--) {
key = keys[i]
res[i] = {
key: key,
value: obj[key]
}
}
res._converted = true
return res
}
/**
* Create a range array from given number.
*
* @param {Number} n
* @return {Array}
*/
function range (n) {
var i = -1
var ret = new Array(n)
while (++i < n) {
ret[i] = i
}
return ret
}
});
require.register(31, function (exports, module) {
var transition = require(9)
module.exports = function (value) {
var el = this.el
transition.apply(el, value ? 1 : -1, function () {
el.style.display = value ? '' : 'none'
}, this.vm)
}
});
require.register(33, function (exports, module) {
var prefixes = ['-webkit-', '-moz-', '-ms-']
var importantRE = /!important;?$/
module.exports = {
bind: function () {
var prop = this.arg
if (!prop) return
if (prop.charAt(0) === '$') {
// properties that start with $ will be auto-prefixed
prop = prop.slice(1)
this.prefixed = true
}
this.prop = prop
},
update: function (value) {
var prop = this.prop
// cast possible numbers/booleans into strings
if (value != null) {
value += ''
}
if (prop) {
var isImportant = importantRE.test(value)
? 'important'
: ''
if (isImportant) {
value = value.replace(importantRE, '').trim()
}
this.el.style.setProperty(prop, value, isImportant)
if (this.prefixed) {
var i = prefixes.length
while (i--) {
this.el.style.setProperty(
prefixes[i] + prop,
value,
isImportant
)
}
}
} else {
this.el.style.cssText = value
}
}
}
});
require.register(30, function (exports, module) {
var _ = require(2)
module.exports = {
bind: function () {
this.attr = this.el.nodeType === 3
? 'nodeValue'
: 'textContent'
},
update: function (value) {
this.el[this.attr] = _.toString(value)
}
}
});
require.register(35, function (exports, module) {
module.exports = {
priority: 1000,
isLiteral: true,
bind: function () {
this.el.__v_trans = {
id: this.expression
}
}
}
});
require.register(39, function (exports, module) {
var _ = require(2)
var Watcher = require(4)
module.exports = {
priority: 900,
bind: function () {
var vm = this.vm
if (this.el !== vm.$el) {
_.warn(
'v-with can only be used on instance root elements.'
)
} else if (!vm.$parent) {
_.warn(
'v-with must be used on an instance with a parent.'
)
} else {
var key = this.arg
this.watcher = new Watcher(
vm.$parent,
this.expression,
key
? function (val) {
vm.$set(key, val)
}
: function (val) {
vm.$data = val
}
)
// initial set
var initialVal = this.watcher.value
if (key) {
vm.$set(key, initialVal)
} else {
vm.$data = initialVal
}
}
},
unbind: function () {
if (this.watcher) {
this.watcher.teardown()
}
}
}
});
require.register(44, function (exports, module) {
var _ = require(2)
var Path = require(45)
/**
* Filter filter for v-repeat
*
* @param {String} searchKey
* @param {String} [delimiter]
* @param {String} dataKey
*/
exports.filterBy = function (arr, searchKey, delimiter, dataKey) {
// allow optional `in` delimiter
// because why not
if (delimiter && delimiter !== 'in') {
dataKey = delimiter
}
// get the search string
var search =
_.stripQuotes(searchKey) ||
this.$get(searchKey)
if (!search) {
return arr
}
search = search.toLowerCase()
// get the optional dataKey
dataKey =
dataKey &&
(_.stripQuotes(dataKey) || this.$get(dataKey))
return arr.filter(function (item) {
return dataKey
? contains(Path.get(item, dataKey), search)
: contains(item, search)
})
}
/**
* Filter filter for v-repeat
*
* @param {String} sortKey
* @param {String} reverseKey
*/
exports.orderBy = function (arr, sortKey, reverseKey) {
var key =
_.stripQuotes(sortKey) ||
this.$get(sortKey)
if (!key) {
return arr
}
var order = 1
if (reverseKey) {
if (reverseKey === '-1') {
order = -1
} else if (reverseKey.charCodeAt(0) === 0x21) { // !
reverseKey = reverseKey.slice(1)
order = this.$get(reverseKey) ? 1 : -1
} else {
order = this.$get(reverseKey) ? -1 : 1
}
}
// sort on a copy to avoid mutating original array
return arr.slice().sort(function (a, b) {
a = Path.get(a, key)
b = Path.get(b, key)
return a === b ? 0 : a > b ? order : -order
})
}
/**
* String contain helper
*
* @param {*} val
* @param {String} search
*/
function contains (val, search) {
if (_.isObject(val)) {
for (var key in val) {
if (contains(val[key], search)) {
return true
}
}
} else if (val != null) {
return val.toString().toLowerCase().indexOf(search) > -1
}
}
});
require.register(46, function (exports, module) {
var _ = require(2)
/**
* Stringify value.
*
* @param {Number} indent
*/
exports.json = function (value, indent) {
return JSON.stringify(value, null, Number(indent) || 2)
}
/**
* 'abc' => 'Abc'
*/
exports.capitalize = function (value) {
if (!value && value !== 0) return ''
value = value.toString()
return value.charAt(0).toUpperCase() + value.slice(1)
}
/**
* 'abc' => 'ABC'
*/
exports.uppercase = function (value) {
return (value || value === 0)
? value.toString().toUpperCase()
: ''
}
/**
* 'AbC' => 'abc'
*/
exports.lowercase = function (value) {
return (value || value === 0)
? value.toString().toLowerCase()
: ''
}
/**
* 12345 => $12,345.00
*
* @param {String} sign
*/
var digitsRE = /(\d{3})(?=\d)/g
exports.currency = function (value, sign) {
value = parseFloat(value)
if (!value && value !== 0) return ''
sign = sign || '$'
var s = Math.floor(value).toString(),
i = s.length % 3,
h = i > 0
? (s.slice(0, i) + (s.length > 3 ? ',' : ''))
: '',
f = '.' + value.toFixed(2).slice(-2)
return sign + h + s.slice(i).replace(digitsRE, '$1,') + f
}
/**
* 'item' => 'items'
*
* @params
* an array of strings corresponding to
* the single, double, triple ... forms of the word to
* be pluralized. When the number to be pluralized
* exceeds the length of the args, it will use the last
* entry in the array.
*
* e.g. ['single', 'double', 'triple', 'multiple']
*/
exports.pluralize = function (value) {
var args = _.toArray(arguments, 1)
return args.length > 1
? (args[value % 10 - 1] || args[args.length - 1])
: (args[0] + (value === 1 ? '' : 's'))
}
/**
* A special filter that takes a handler function,
* wraps it so it only gets triggered on specific
* keypresses. v-on only.
*
* @param {String} key
*/
var keyCodes = {
enter : 13,
tab : 9,
'delete' : 46,
up : 38,
left : 37,
right : 39,
down : 40,
esc : 27
}
exports.key = function (handler, key) {
if (!handler) return
var code = keyCodes[key]
if (!code) {
code = parseInt(key, 10)
}
return function (e) {
if (e.keyCode === code) {
return handler.call(this, e)
}
}
}
/**
* Install special array filters
*/
_.extend(exports, require(44))
});
require.register(47, function (exports, module) {
var _ = require(2)
var Directive = require(21)
var compile = require(18)
var transclude = require(20)
/**
* Transclude, compile and link element.
*
* If a pre-compiled linker is available, that means the
* passed in element will be pre-transcluded and compiled
* as well - all we need to do is to call the linker.
*
* Otherwise we need to call transclude/compile/link here.
*
* @param {Element} el
* @return {Element}
*/
exports._compile = function (el) {
var options = this.$options
if (options._linker) {
this._initElement(el)
options._linker(this, el)
} else {
var raw = el
el = transclude(el, options)
this._initElement(el)
var linker = compile(el, options)
linker(this, el)
if (options.replace) {
_.replace(raw, el)
}
}
return el
}
/**
* Initialize instance element. Called in the public
* $mount() method.
*
* @param {Element} el
*/
exports._initElement = function (el) {
if (el instanceof DocumentFragment) {
this._isBlock = true
this.$el = this._blockStart = el.firstChild
this._blockEnd = el.lastChild
this._blockFragment = el
} else {
this.$el = el
}
this.$el.__vue__ = this
this._callHook('beforeCompile')
}
/**
* Create and bind a directive to an element.
*
* @param {String} name - directive name
* @param {Node} node - target node
* @param {Object} desc - parsed directive descriptor
* @param {Object} def - directive definition object
* @param {Function} [linker] - pre-compiled linker fn
*/
exports._bindDir = function (name, node, desc, def, linker) {
this._directives.push(
new Directive(name, node, this, desc, def, linker)
)
}
});
require.register(48, function (exports, module) {
var _ = require(2)
var inDoc = _.inDoc
/**
* Setup the instance's option events.
* If the value is a string, we pull it from the
* instance's methods by name.
*/
exports._initEvents = function () {
var options = this.$options
var events = options.events
var methods = options.methods
if (events) {
var handlers, e, i, j
for (e in events) {
handlers = events[e]
if (_.isArray(handlers)) {
for (i = 0, j = handlers.length; i < j; i++) {
register(this, e, handlers[i], methods)
}
} else {
register(this, e, handlers, methods)
}
}
}
}
/**
* Helper to register an event.
*
* @param {Vue} vm
* @param {String} event
* @param {*} handler
* @param {Object|undefined} methods
*/
function register (vm, event, handler, methods) {
var type = typeof handler
if (type === 'function') {
vm.$on(event, handler)
} else if (type === 'string') {
var method = methods && methods[handler]
if (method) {
vm.$on(event, method)
} else {
_.warn(
'Unknown method: "' + handler + '" when ' +
'registering callback for event: "' + event + '".'
)
}
}
}
/**
* Setup recursive attached/detached calls
*/
exports._initDOMHooks = function () {
this.$on('hook:attached', onAttached)
this.$on('hook:detached', onDetached)
}
/**
* Callback to recursively call attached hook on children
*/
function onAttached () {
this._isAttached = true
var children = this._children
if (!children) return
for (var i = 0, l = children.length; i < l; i++) {
var child = children[i]
if (!child._isAttached && inDoc(child.$el)) {
child._callHook('attached')
}
}
}
/**
* Callback to recursively call detached hook on children
*/
function onDetached () {
this._isAttached = false
var children = this._children
if (!children) return
for (var i = 0, l = children.length; i < l; i++) {
var child = children[i]
if (child._isAttached && !inDoc(child.$el)) {
child._callHook('detached')
}
}
}
/**
* Trigger all handlers for a hook
*
* @param {String} hook
*/
exports._callHook = function (hook) {
var handlers = this.$options[hook]
if (handlers) {
for (var i = 0, j = handlers.length; i < j; i++) {
handlers[i].call(this)
}
}
this.$emit('hook:' + hook)
}
});
require.register(49, function (exports, module) {
var mergeOptions = require(12)
/**
* The main init sequence. This is called for every
* instance, including ones that are created from extended
* constructors.
*
* @param {Object} options - this options object should be
* the result of merging class
* options and the options passed
* in to the constructor.
*/
exports._init = function (options) {
options = options || {}
this.$el = null
this.$parent = options._parent
this.$root = options._root || this
this.$ = {} // child vm references
this.$$ = {} // element references
this._watcherList = [] // all watchers as an array
this._watchers = {} // internal watchers as a hash
this._userWatchers = {} // user watchers as a hash
this._directives = [] // all directives
// a flag to avoid this being observed
this._isVue = true
// events bookkeeping
this._events = {} // registered callbacks
this._eventsCount = {} // for $broadcast optimization
this._eventCancelled = false // for event cancellation
// block instance properties
this._isBlock = false
this._blockStart = // @type {CommentNode}
this._blockEnd = null // @type {CommentNode}
// lifecycle state
this._isCompiled =
this._isDestroyed =
this._isReady =
this._isAttached =
this._isBeingDestroyed = false
// children
this._children = // @type {Array}
this._childCtors = null // @type {Object} - hash to cache
// child constructors
// anonymous instances are created by v-if
// we need to walk along the parent chain to locate the
// first non-anonymous instance as the owner.
this._isAnonymous = options._anonymous
var parent = this.$parent
while (parent && parent._isAnonymous) {
parent = parent.$parent
}
this._owner = parent || this
// merge options.
options = this.$options = mergeOptions(
this.constructor.options,
options,
this
)
// set data after merge.
this._data = options.data || {}
// setup event system and option events.
this._initEvents()
// initialize data observation and scope inheritance.
this._initScope()
// call created hook
this._callHook('created')
// if `el` option is passed, start compilation.
if (options.el) {
this.$mount(options.el)
}
}
});
require.register(50, function (exports, module) {
var _ = require(2)
var Observer = require(51)
var Binding = require(16)
/**
* Setup the scope of an instance, which contains:
* - observed data
* - computed properties
* - user methods
* - meta properties
*/
exports._initScope = function () {
this._initData()
this._initComputed()
this._initMethods()
this._initMeta()
}
/**
* Initialize the data.
*/
exports._initData = function () {
// proxy data on instance
var data = this._data
var keys = Object.keys(data)
var i = keys.length
var key
while (i--) {
key = keys[i]
if (!_.isReserved(key)) {
this._proxy(key)
}
}
// observe data
Observer.create(data).addVm(this)
}
/**
* Swap the isntance's $data. Called in $data's setter.
*
* @param {Object} newData
*/
exports._setData = function (newData) {
var oldData = this._data
this._data = newData
var keys, key, i
// unproxy keys not present in new data
keys = Object.keys(oldData)
i = keys.length
while (i--) {
key = keys[i]
if (!_.isReserved(key) && !(key in newData)) {
this._unproxy(key)
}
}
// proxy keys not already proxied,
// and trigger change for changed values
keys = Object.keys(newData)
i = keys.length
while (i--) {
key = keys[i]
if (!this.hasOwnProperty(key) && !_.isReserved(key)) {
// new property
this._proxy(key)
}
}
oldData.__ob__.removeVm(this)
Observer.create(newData).addVm(this)
this._digest()
}
/**
* Proxy a property, so that
* vm.prop === vm._data.prop
*
* @param {String} key
*/
exports._proxy = function (key) {
// need to store ref to self here
// because these getter/setters might
// be called by child instances!
var self = this
Object.defineProperty(self, key, {
configurable: true,
enumerable: true,
get: function proxyGetter () {
return self._data[key]
},
set: function proxySetter (val) {
self._data[key] = val
}
})
}
/**
* Unproxy a property.
*
* @param {String} key
*/
exports._unproxy = function (key) {
delete this[key]
}
/**
* Force update on every watcher in scope.
*/
exports._digest = function () {
var i = this._watcherList.length
while (i--) {
this._watcherList[i].update()
}
var children = this._children
var child
if (children) {
i = children.length
while (i--) {
child = children[i]
if (child.$options.inherit) {
child._digest()
}
}
}
}
/**
* Setup computed properties. They are essentially
* special getter/setters
*/
function noop () {}
exports._initComputed = function () {
var computed = this.$options.computed
if (computed) {
for (var key in computed) {
var def = computed[key]
if (typeof def === 'function') {
def = {
get: _.bind(def, this),
set: noop
}
} else {
def.get = def.get
? _.bind(def.get, this)
: noop
def.set = def.set
? _.bind(def.set, this)
: noop
}
def.enumerable = true
def.configurable = true
Object.defineProperty(this, key, def)
}
}
}
/**
* Setup instance methods. Methods must be bound to the
* instance since they might be called by children
* inheriting them.
*/
exports._initMethods = function () {
var methods = this.$options.methods
if (methods) {
for (var key in methods) {
this[key] = _.bind(methods[key], this)
}
}
}
/**
* Initialize meta information like $index, $key & $value.
*/
exports._initMeta = function () {
var metas = this.$options._meta
if (metas) {
for (var key in metas) {
this._defineMeta(key, metas[key])
}
}
}
/**
* Define a meta property, e.g $index, $key, $value
* which only exists on the vm instance but not in $data.
*
* @param {String} key
* @param {*} value
*/
exports._defineMeta = function (key, value) {
var binding = new Binding()
Object.defineProperty(this, key, {
enumerable: true,
configurable: true,
get: function metaGetter () {
if (Observer.target) {
Observer.target.addDep(binding)
}
return value
},
set: function metaSetter (val) {
if (val !== value) {
value = val
binding.notify()
}
}
})
}
});
require.register(52, function (exports, module) {
var _ = require(2)
var arrayAugmentations = Object.create(Array.prototype)
/**
* Intercept mutating methods and emit events
*/
;[
'push',
'pop',
'shift',
'unshift',
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
// cache original method
var original = Array.prototype[method]
_.define(arrayAugmentations, method, function mutator () {
// avoid leaking arguments:
// http://jsperf.com/closure-with-arguments
var i = arguments.length
var args = new Array(i)
while (i--) {
args[i] = arguments[i]
}
var result = original.apply(this, args)
var ob = this.__ob__
var inserted
switch (method) {
case 'push':
inserted = args
break
case 'unshift':
inserted = args
break
case 'splice':
inserted = args.slice(2)
break
}
if (inserted) ob.observeArray(inserted)
// notify change
ob.notify()
return result
})
})
/**
* Swap the element at the given index with a new value
* and emits corresponding event.
*
* @param {Number} index
* @param {*} val
* @return {*} - replaced element
*/
_.define(
arrayAugmentations,
'$set',
function $set (index, val) {
if (index >= this.length) {
this.length = index + 1
}
return this.splice(index, 1, val)[0]
}
)
/**
* Convenience method to remove the element at given index.
*
* @param {Number} index
* @param {*} val
*/
_.define(
arrayAugmentations,
'$remove',
function $remove (index) {
if (typeof index !== 'number') {
index = this.indexOf(index)
}
if (index > -1) {
return this.splice(index, 1)[0]
}
}
)
module.exports = arrayAugmentations
});
require.register(51, function (exports, module) {
var _ = require(2)
var config = require(13)
var Binding = require(16)
var arrayAugmentations = require(52)
var objectAugmentations = require(53)
var arrayKeys = Object.getOwnPropertyNames(arrayAugmentations)
var objectKeys = Object.getOwnPropertyNames(objectAugmentations)
var uid = 0
/**
* Type enums
*/
var ARRAY = 0
var OBJECT = 1
/**
* Augment an target Object or Array by intercepting
* the prototype chain using __proto__
*
* @param {Object|Array} target
* @param {Object} proto
*/
function protoAugment (target, src) {
target.__proto__ = src
}
/**
* Augment an target Object or Array by defining
* hidden properties.
*
* @param {Object|Array} target
* @param {Object} proto
*/
function copyAugment (target, src, keys) {
var i = keys.length
var key
while (i--) {
key = keys[i]
_.define(target, key, src[key])
}
}
/**
* Observer class that are attached to each observed
* object. Once attached, the observer converts target
* object's property keys into getter/setters that
* collect dependencies and dispatches updates.
*
* @param {Array|Object} value
* @param {Number} type
* @constructor
*/
function Observer (value, type) {
this.id = ++uid
this.value = value
this.active = true
this.bindings = []
_.define(value, '__ob__', this)
var augment = config.proto && _.hasProto
? protoAugment
: copyAugment
if (type === ARRAY) {
augment(value, arrayAugmentations, arrayKeys)
this.observeArray(value)
} else if (type === OBJECT) {
augment(value, objectAugmentations, objectKeys)
this.walk(value)
}
}
Observer.target = null
var p = Observer.prototype
/**
* Attempt to create an observer instance for a value,
* returns the new observer if successfully observed,
* or the existing observer if the value already has one.
*
* @param {*} value
* @return {Observer|undefined}
* @static
*/
Observer.create = function (value) {
if (
value &&
value.hasOwnProperty('__ob__') &&
value.__ob__ instanceof Observer
) {
return value.__ob__
} else if (_.isArray(value)) {
return new Observer(value, ARRAY)
} else if (
_.isPlainObject(value) &&
!value._isVue // avoid Vue instance
) {
return new Observer(value, OBJECT)
}
}
/**
* Walk through each property and convert them into
* getter/setters. This method should only be called when
* value type is Object. Properties prefixed with `$` or `_`
* and accessor properties are ignored.
*
* @param {Object} obj
*/
p.walk = function (obj) {
var keys = Object.keys(obj)
var i = keys.length
var key, prefix
while (i--) {
key = keys[i]
prefix = key.charCodeAt(0)
if (prefix !== 0x24 && prefix !== 0x5F) { // skip $ or _
this.convert(key, obj[key])
}
}
}
/**
* Try to carete an observer for a child value,
* and if value is array, link binding to the array.
*
* @param {*} val
* @return {Binding|undefined}
*/
p.observe = function (val) {
return Observer.create(val)
}
/**
* Observe a list of Array items.
*
* @param {Array} items
*/
p.observeArray = function (items) {
var i = items.length
while (i--) {
this.observe(items[i])
}
}
/**
* Convert a property into getter/setter so we can emit
* the events when the property is accessed/changed.
*
* @param {String} key
* @param {*} val
*/
p.convert = function (key, val) {
var ob = this
var childOb = ob.observe(val)
var binding = new Binding()
if (childOb) {
childOb.bindings.push(binding)
}
Object.defineProperty(ob.value, key, {
enumerable: true,
configurable: true,
get: function () {
// Observer.target is a watcher whose getter is
// currently being evaluated.
if (ob.active && Observer.target) {
Observer.target.addDep(binding)
}
return val
},
set: function (newVal) {
if (newVal === val) return
// remove binding from old value
var oldChildOb = val && val.__ob__
if (oldChildOb) {
var oldBindings = oldChildOb.bindings
oldBindings.splice(oldBindings.indexOf(binding))
}
val = newVal
// add binding to new value
var newChildOb = ob.observe(newVal)
if (newChildOb) {
newChildOb.bindings.push(binding)
}
binding.notify()
}
})
}
/**
* Notify change on all self bindings on an observer.
* This is called when a mutable value mutates. e.g.
* when an Array's mutating methods are called, or an
* Object's $add/$delete are called.
*/
p.notify = function () {
var bindings = this.bindings
for (var i = 0, l = bindings.length; i < l; i++) {
bindings[i].notify()
}
}
/**
* Add an owner vm, so that when $add/$delete mutations
* happen we can notify owner vms to proxy the keys and
* digest the watchers. This is only called when the object
* is observed as an instance's root $data.
*
* @param {Vue} vm
*/
p.addVm = function (vm) {
(this.vms = this.vms || []).push(vm)
}
/**
* Remove an owner vm. This is called when the object is
* swapped out as an instance's $data object.
*
* @param {Vue} vm
*/
p.removeVm = function (vm) {
this.vms.splice(this.vms.indexOf(vm), 1)
}
module.exports = Observer
});
require.register(53, function (exports, module) {
var _ = require(2)
var objectAgumentations = Object.create(Object.prototype)
/**
* Add a new property to an observed object
* and emits corresponding event
*
* @param {String} key
* @param {*} val
* @public
*/
_.define(
objectAgumentations,
'$add',
function $add (key, val) {
if (_.isReserved(key)) {
_.warn('Refused to $add reserved key: ' + key)
return
}
if (this.hasOwnProperty(key)) return
var ob = this.__ob__
ob.convert(key, val)
if (ob.vms) {
var i = ob.vms.length
while (i--) {
var vm = ob.vms[i]
vm._proxy(key)
vm._digest()
}
} else {
ob.notify()
}
}
)
/**
* Deletes a property from an observed object
* and emits corresponding event
*
* @param {String} key
* @public
*/
_.define(
objectAgumentations,
'$delete',
function $delete (key) {
if (_.isReserved(key)) {
_.warn('Refused to $add reserved key: ' + key)
return
}
if (!this.hasOwnProperty(key)) return
delete this[key]
var ob = this.__ob__
if (ob.vms) {
var i = ob.vms.length
while (i--) {
var vm = ob.vms[i]
vm._unproxy(key)
vm._digest()
}
} else {
ob.notify()
}
}
)
module.exports = objectAgumentations
});
require.register(6, function (exports, module) {
var _ = require(2)
var Cache = require(17)
var cache = new Cache(1000)
var argRE = /^[^\{\?]+$|^'[^']*'$|^"[^"]*"$/
var filterTokenRE = /[^\s'"]+|'[^']+'|"[^"]+"/g
/**
* Parser state
*/
var str
var c, i, l
var inSingle
var inDouble
var curly
var square
var paren
var begin
var argIndex
var dirs
var dir
var lastFilterIndex
var arg
/**
* Push a directive object into the result Array
*/
function pushDir () {
dir.raw = str.slice(begin, i).trim()
if (dir.expression === undefined) {
dir.expression = str.slice(argIndex, i).trim()
} else if (lastFilterIndex !== begin) {
pushFilter()
}
if (i === 0 || dir.expression) {
dirs.push(dir)
}
}
/**
* Push a filter to the current directive object
*/
function pushFilter () {
var exp = str.slice(lastFilterIndex, i).trim()
var filter
if (exp) {
filter = {}
var tokens = exp.match(filterTokenRE)
filter.name = tokens[0]
filter.args = tokens.length > 1 ? tokens.slice(1) : null
}
if (filter) {
(dir.filters = dir.filters || []).push(filter)
}
lastFilterIndex = i + 1
}
/**
* Parse a directive string into an Array of AST-like
* objects representing directives.
*
* Example:
*
* "click: a = a + 1 | uppercase" will yield:
* {
* arg: 'click',
* expression: 'a = a + 1',
* filters: [
* { name: 'uppercase', args: null }
* ]
* }
*
* @param {String} str
* @return {Array<Object>}
*/
exports.parse = function (s) {
var hit = cache.get(s)
if (hit) {
return hit
}
// reset parser state
str = s
inSingle = inDouble = false
curly = square = paren = begin = argIndex = 0
lastFilterIndex = 0
dirs = []
dir = {}
arg = null
for (i = 0, l = str.length; i < l; i++) {
c = str.charCodeAt(i)
if (inSingle) {
// check single quote
if (c === 0x27) inSingle = !inSingle
} else if (inDouble) {
// check double quote
if (c === 0x22) inDouble = !inDouble
} else if (
c === 0x2C && // comma
!paren && !curly && !square
) {
// reached the end of a directive
pushDir()
// reset & skip the comma
dir = {}
begin = argIndex = lastFilterIndex = i + 1
} else if (
c === 0x3A && // colon
!dir.expression &&
!dir.arg
) {
// argument
arg = str.slice(begin, i).trim()
// test for valid argument here
// since we may have caught stuff like first half of
// an object literal or a ternary expression.
if (argRE.test(arg)) {
argIndex = i + 1
dir.arg = _.stripQuotes(arg) || arg
}
} else if (
c === 0x7C && // pipe
str.charCodeAt(i + 1) !== 0x7C &&
str.charCodeAt(i - 1) !== 0x7C
) {
if (dir.expression === undefined) {
// first filter, end of expression
lastFilterIndex = i + 1
dir.expression = str.slice(argIndex, i).trim()
} else {
// already has filter
pushFilter()
}
} else {
switch (c) {
case 0x22: inDouble = true; break // "
case 0x27: inSingle = true; break // '
case 0x28: paren++; break // (
case 0x29: paren--; break // )
case 0x5B: square++; break // [
case 0x5D: square--; break // ]
case 0x7B: curly++; break // {
case 0x7D: curly--; break // }
}
}
}
if (i === 0 || begin !== i) {
pushDir()
}
cache.put(s, dirs)
return dirs
}
});
require.register(7, function (exports, module) {
var _ = require(2)
var Path = require(45)
var Cache = require(17)
var expressionCache = new Cache(1000)
var keywords =
'Math,break,case,catch,continue,debugger,default,' +
'delete,do,else,false,finally,for,function,if,in,' +
'instanceof,new,null,return,switch,this,throw,true,try,' +
'typeof,var,void,while,with,undefined,abstract,boolean,' +
'byte,char,class,const,double,enum,export,extends,' +
'final,float,goto,implements,import,int,interface,long,' +
'native,package,private,protected,public,short,static,' +
'super,synchronized,throws,transient,volatile,' +
'arguments,let,yield'
var wsRE = /\s/g
var newlineRE = /\n/g
var saveRE = /[\{,]\s*[\w\$_]+\s*:|'[^']*'|"[^"]*"/g
var restoreRE = /"(\d+)"/g
var pathTestRE = /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\])*$/
var pathReplaceRE = /[^\w$\.]([A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\])*)/g
var keywordsRE = new RegExp('^(' + keywords.replace(/,/g, '\\b|') + '\\b)')
/**
* Save / Rewrite / Restore
*
* When rewriting paths found in an expression, it is
* possible for the same letter sequences to be found in
* strings and Object literal property keys. Therefore we
* remove and store these parts in a temporary array, and
* restore them after the path rewrite.
*/
var saved = []
/**
* Save replacer
*
* @param {String} str
* @return {String} - placeholder with index
*/
function save (str) {
var i = saved.length
saved[i] = str.replace(newlineRE, '\\n')
return '"' + i + '"'
}
/**
* Path rewrite replacer
*
* @param {String} raw
* @return {String}
*/
function rewrite (raw) {
var c = raw.charAt(0)
var path = raw.slice(1)
if (keywordsRE.test(path)) {
return raw
} else {
path = path.indexOf('"') > -1
? path.replace(restoreRE, restore)
: path
return c + 'scope.' + path
}
}
/**
* Restore replacer
*
* @param {String} str
* @param {String} i - matched save index
* @return {String}
*/
function restore (str, i) {
return saved[i]
}
/**
* Rewrite an expression, prefixing all path accessors with
* `scope.` and generate getter/setter functions.
*
* @param {String} exp
* @param {Boolean} needSet
* @return {Function}
*/
function compileExpFns (exp, needSet) {
// reset state
saved.length = 0
// save strings and object literal keys
var body = exp
.replace(saveRE, save)
.replace(wsRE, '')
// rewrite all paths
// pad 1 space here becaue the regex matches 1 extra char
body = (' ' + body)
.replace(pathReplaceRE, rewrite)
.replace(restoreRE, restore)
var getter = makeGetter(body)
if (getter) {
return {
get: getter,
body: body,
set: needSet
? makeSetter(body)
: null
}
}
}
/**
* Compile getter setters for a simple path.
*
* @param {String} exp
* @return {Function}
*/
function compilePathFns (exp) {
var getter, path
if (exp.indexOf('[') < 0) {
// really simple path
path = exp.split('.')
getter = Path.compileGetter(path)
} else {
// do the real parsing
path = Path.parse(exp)
getter = path.get
}
return {
get: getter,
// always generate setter for simple paths
set: function (obj, val) {
Path.set(obj, path, val)
}
}
}
/**
* Build a getter function. Requires eval.
*
* We isolate the try/catch so it doesn't affect the
* optimization of the parse function when it is not called.
*
* @param {String} body
* @return {Function|undefined}
*/
function makeGetter (body) {
try {
return new Function(
'scope',
'"use strict";try{return ' + body + '}catch(e){};'
)
} catch (e) {
_.warn(
'Invalid expression. ' +
'Generated function body: ' + body
)
}
}
/**
* Build a setter function.
*
* This is only needed in rare situations like "a[b]" where
* a settable path requires dynamic evaluation.
*
* This setter function may throw error when called if the
* expression body is not a valid left-hand expression in
* assignment.
*
* @param {String} body
* @return {Function|undefined}
*/
function makeSetter (body) {
try {
return new Function(
'scope',
'value',
'"use strict";' + body + ' = value;'
)
} catch (e) {
_.warn('Invalid setter function body: ' + body)
}
}
/**
* Check for setter existence on a cache hit.
*
* @param {Function} hit
*/
function checkSetter (hit) {
if (!hit.set) {
hit.set = makeSetter(hit.body)
}
}
/**
* Parse an expression into re-written getter/setters.
*
* @param {String} exp
* @param {Boolean} needSet
* @return {Function}
*/
exports.parse = function (exp, needSet) {
exp = exp.trim()
// try cache
var hit = expressionCache.get(exp)
if (hit) {
if (needSet) {
checkSetter(hit)
}
return hit
}
// we do a simple path check to optimize for them.
// the check fails valid paths with unusal whitespaces,
// but that's too rare and we don't care.
var res = pathTestRE.test(exp)
? compilePathFns(exp)
: compileExpFns(exp, needSet)
expressionCache.put(exp, res)
return res
}
// Export the pathRegex for external use
exports.pathTestRE = pathTestRE
});
require.register(45, function (exports, module) {
var _ = require(2)
var Cache = require(17)
var pathCache = new Cache(1000)
var identRE = /^[$_a-zA-Z]+[\w$]*$/
/**
* Path-parsing algorithm scooped from Polymer/observe-js
*/
var pathStateMachine = {
'beforePath': {
'ws': ['beforePath'],
'ident': ['inIdent', 'append'],
'[': ['beforeElement'],
'eof': ['afterPath']
},
'inPath': {
'ws': ['inPath'],
'.': ['beforeIdent'],
'[': ['beforeElement'],
'eof': ['afterPath']
},
'beforeIdent': {
'ws': ['beforeIdent'],
'ident': ['inIdent', 'append']
},
'inIdent': {
'ident': ['inIdent', 'append'],
'0': ['inIdent', 'append'],
'number': ['inIdent', 'append'],
'ws': ['inPath', 'push'],
'.': ['beforeIdent', 'push'],
'[': ['beforeElement', 'push'],
'eof': ['afterPath', 'push']
},
'beforeElement': {
'ws': ['beforeElement'],
'0': ['afterZero', 'append'],
'number': ['inIndex', 'append'],
"'": ['inSingleQuote', 'append', ''],
'"': ['inDoubleQuote', 'append', '']
},
'afterZero': {
'ws': ['afterElement', 'push'],
']': ['inPath', 'push']
},
'inIndex': {
'0': ['inIndex', 'append'],
'number': ['inIndex', 'append'],
'ws': ['afterElement'],
']': ['inPath', 'push']
},
'inSingleQuote': {
"'": ['afterElement'],
'eof': 'error',
'else': ['inSingleQuote', 'append']
},
'inDoubleQuote': {
'"': ['afterElement'],
'eof': 'error',
'else': ['inDoubleQuote', 'append']
},
'afterElement': {
'ws': ['afterElement'],
']': ['inPath', 'push']
}
}
function noop () {}
/**
* Determine the type of a character in a keypath.
*
* @param {Char} char
* @return {String} type
*/
function getPathCharType (char) {
if (char === undefined) {
return 'eof'
}
var code = char.charCodeAt(0)
switch(code) {
case 0x5B: // [
case 0x5D: // ]
case 0x2E: // .
case 0x22: // "
case 0x27: // '
case 0x30: // 0
return char
case 0x5F: // _
case 0x24: // $
return 'ident'
case 0x20: // Space
case 0x09: // Tab
case 0x0A: // Newline
case 0x0D: // Return
case 0xA0: // No-break space
case 0xFEFF: // Byte Order Mark
case 0x2028: // Line Separator
case 0x2029: // Paragraph Separator
return 'ws'
}
// a-z, A-Z
if ((0x61 <= code && code <= 0x7A) ||
(0x41 <= code && code <= 0x5A)) {
return 'ident'
}
// 1-9
if (0x31 <= code && code <= 0x39) {
return 'number'
}
return 'else'
}
/**
* Parse a string path into an array of segments
* Todo implement cache
*
* @param {String} path
* @return {Array|undefined}
*/
function parsePath (path) {
var keys = []
var index = -1
var mode = 'beforePath'
var c, newChar, key, type, transition, action, typeMap
var actions = {
push: function() {
if (key === undefined) {
return
}
keys.push(key)
key = undefined
},
append: function() {
if (key === undefined) {
key = newChar
} else {
key += newChar
}
}
}
function maybeUnescapeQuote () {
var nextChar = path[index + 1]
if ((mode === 'inSingleQuote' && nextChar === "'") ||
(mode === 'inDoubleQuote' && nextChar === '"')) {
index++
newChar = nextChar
actions.append()
return true
}
}
while (mode) {
index++
c = path[index]
if (c === '\\' && maybeUnescapeQuote()) {
continue
}
type = getPathCharType(c)
typeMap = pathStateMachine[mode]
transition = typeMap[type] || typeMap['else'] || 'error'
if (transition === 'error') {
return // parse error
}
mode = transition[0]
action = actions[transition[1]] || noop
newChar = transition[2] === undefined
? c
: transition[2]
action()
if (mode === 'afterPath') {
return keys
}
}
}
/**
* Format a accessor segment based on its type.
*
* @param {String} key
* @return {Boolean}
*/
function formatAccessor(key) {
if (identRE.test(key)) { // identifier
return '.' + key
} else if (+key === key >>> 0) { // bracket index
return '[' + key + ']';
} else { // bracket string
return '["' + key.replace(/"/g, '\\"') + '"]';
}
}
/**
* Compiles a getter function with a fixed path.
*
* @param {Array} path
* @return {Function}
*/
exports.compileGetter = function (path) {
var body =
'try{return o' +
path.map(formatAccessor).join('') +
'}catch(e){};'
return new Function('o', body)
}
/**
* External parse that check for a cache hit first
*
* @param {String} path
* @return {Array|undefined}
*/
exports.parse = function (path) {
var hit = pathCache.get(path)
if (!hit) {
hit = parsePath(path)
if (hit) {
hit.get = exports.compileGetter(hit)
pathCache.put(path, hit)
}
}
return hit
}
/**
* Get from an object from a path string
*
* @param {Object} obj
* @param {String} path
*/
exports.get = function (obj, path) {
path = exports.parse(path)
if (path) {
return path.get(obj)
}
}
/**
* Set on an object from a path
*
* @param {Object} obj
* @param {String | Array} path
* @param {*} val
*/
exports.set = function (obj, path, val) {
if (typeof path === 'string') {
path = exports.parse(path)
}
if (!path || !_.isObject(obj)) {
return false
}
var last, key
for (var i = 0, l = path.length - 1; i < l; i++) {
last = obj
key = path[i]
obj = obj[key]
if (!_.isObject(obj)) {
obj = {}
add(last, key, obj)
}
}
key = path[i]
if (key in obj) {
obj[key] = val
} else {
add(obj, key, val)
}
return true
}
/**
* Add a property to an object, using $add if target
* has been augmented by Vue's observer.
*
* @param {Object} obj
* @param {String} key
* @param {*} val
*/
function add (obj, key, val) {
if (obj.$add) {
obj.$add(key, val)
} else {
obj[key] = val
}
}
});
require.register(19, function (exports, module) {
var Cache = require(17)
var templateCache = new Cache(100)
var map = {
_default : [0, '', ''],
legend : [1, '<fieldset>', '</fieldset>'],
tr : [2, '<table><tbody>', '</tbody></table>'],
col : [
2,
'<table><tbody></tbody><colgroup>',
'</colgroup></table>'
]
}
map.td =
map.th = [
3,
'<table><tbody><tr>',
'</tr></tbody></table>'
]
map.option =
map.optgroup = [
1,
'<select multiple="multiple">',
'</select>'
]
map.thead =
map.tbody =
map.colgroup =
map.caption =
map.tfoot = [1, '<table>', '</table>']
map.g =
map.defs =
map.symbol =
map.use =
map.image =
map.text =
map.circle =
map.ellipse =
map.line =
map.path =
map.polygon =
map.polyline =
map.rect = [
1,
'<svg ' +
'xmlns="http://www.w3.org/2000/svg" ' +
'xmlns:xlink="http://www.w3.org/1999/xlink" ' +
'xmlns:ev="http://www.w3.org/2001/xml-events"' +
'version="1.1">',
'</svg>'
]
var TAG_RE = /<([\w:]+)/
/**
* Convert a string template to a DocumentFragment.
* Determines correct wrapping by tag types. Wrapping
* strategy found in jQuery & component/domify.
*
* @param {String} templateString
* @return {DocumentFragment}
*/
function stringToFragment (templateString) {
// try a cache hit first
var hit = templateCache.get(templateString)
if (hit) {
return hit
}
var frag = document.createDocumentFragment()
var tagMatch = TAG_RE.exec(templateString)
if (!tagMatch) {
// text only, return a single text node.
frag.appendChild(
document.createTextNode(templateString)
)
} else {
var tag = tagMatch[1]
var wrap = map[tag] || map._default
var depth = wrap[0]
var prefix = wrap[1]
var suffix = wrap[2]
var node = document.createElement('div')
node.innerHTML = prefix + templateString.trim() + suffix
while (depth--) {
node = node.lastChild
}
var child
/* jshint boss:true */
while (child = node.firstChild) {
frag.appendChild(child)
}
}
templateCache.put(templateString, frag)
return frag
}
/**
* Convert a template node to a DocumentFragment.
*
* @param {Node} node
* @return {DocumentFragment}
*/
function nodeToFragment (node) {
var tag = node.tagName
// if its a template tag and the browser supports it,
// its content is already a document fragment.
if (
tag === 'TEMPLATE' &&
node.content instanceof DocumentFragment
) {
return node.content
}
return tag === 'SCRIPT'
? stringToFragment(node.textContent)
: stringToFragment(node.innerHTML)
}
/**
* Process the template option and normalizes it into a
* a DocumentFragment that can be used as a partial or a
* instance template.
*
* @param {*} template
* Possible values include:
* - DocumentFragment object
* - Node object of type Template
* - id selector: '#some-template-id'
* - template string: '<div><span>{{msg}}</span></div>'
* @param {Boolean} clone
* @return {DocumentFragment|undefined}
*/
exports.parse = function (template, clone) {
var node, frag
// if the template is already a document fragment,
// do nothing
if (template instanceof DocumentFragment) {
return clone
? template.cloneNode(true)
: template
}
if (typeof template === 'string') {
// id selector
if (template.charAt(0) === '#') {
// id selector can be cached too
frag = templateCache.get(template)
if (!frag) {
node = document.getElementById(template.slice(1))
if (node) {
frag = nodeToFragment(node)
// save selector to cache
templateCache.put(template, frag)
}
}
} else {
// normal string template
frag = stringToFragment(template)
}
} else if (template.nodeType) {
// a direct node
frag = nodeToFragment(template)
}
return frag && clone
? frag.cloneNode(true)
: frag
}
});
require.register(5, function (exports, module) {
var Cache = require(17)
var config = require(13)
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g
var cache, tagRE, htmlRE, firstChar, lastChar
/**
* Escape a string so it can be used in a RegExp
* constructor.
*
* @param {String} str
*/
function escapeRegex (str) {
return str.replace(regexEscapeRE, '\\$&')
}
/**
* Compile the interpolation tag regex.
*
* @return {RegExp}
*/
function compileRegex () {
config._delimitersChanged = false
var open = config.delimiters[0]
var close = config.delimiters[1]
firstChar = open.charAt(0)
lastChar = close.charAt(close.length - 1)
var firstCharRE = escapeRegex(firstChar)
var lastCharRE = escapeRegex(lastChar)
var openRE = escapeRegex(open)
var closeRE = escapeRegex(close)
tagRE = new RegExp(
firstCharRE + '?' + openRE +
'(.+?)' +
closeRE + lastCharRE + '?',
'g'
)
htmlRE = new RegExp(
'^' + firstCharRE + openRE +
'.*' +
closeRE + lastCharRE + '$'
)
// reset cache
cache = new Cache(1000)
}
/**
* Parse a template text string into an array of tokens.
*
* @param {String} text
* @return {Array<Object> | null}
* - {String} type
* - {String} value
* - {Boolean} [html]
* - {Boolean} [oneTime]
*/
exports.parse = function (text) {
if (config._delimitersChanged) {
compileRegex()
}
var hit = cache.get(text)
if (hit) {
return hit
}
if (!tagRE.test(text)) {
return null
}
var tokens = []
var lastIndex = tagRE.lastIndex = 0
var match, index, value, first, oneTime, partial
/* jshint boss:true */
while (match = tagRE.exec(text)) {
index = match.index
// push text token
if (index > lastIndex) {
tokens.push({
value: text.slice(lastIndex, index)
})
}
// tag token
first = match[1].charCodeAt(0)
oneTime = first === 0x2A // *
partial = first === 0x3E // >
value = (oneTime || partial)
? match[1].slice(1)
: match[1]
tokens.push({
tag: true,
value: value.trim(),
html: htmlRE.test(match[0]),
oneTime: oneTime,
partial: partial
})
lastIndex = index + match[0].length
}
if (lastIndex < text.length) {
tokens.push({
value: text.slice(lastIndex)
})
}
cache.put(text, tokens)
return tokens
}
/**
* Format a list of tokens into an expression.
*
* @param {Array} tokens
* @param {Vue} [vm]
* @return {String}
*/
exports.tokensToExp = function (tokens, vm) {
return tokens.length > 1
? tokens.map(function (token) {
return formatToken(token, vm)
}).join('+')
: formatToken(tokens[0], vm)
}
/**
* Format a single token.
*
* @param {Object} token
* @param {Vue} [vm]
* @return {String}
*/
function formatToken (token, vm) {
return token.tag
? vm && token.oneTime
? '"' + vm.$get(token.value) + '"'
: token.value
: '"' + token.value + '"'
}
});
require.register(54, function (exports, module) {
var _ = require(2)
var Batcher = require(15)
var batcher = new Batcher()
var transDurationProp = _.transitionProp + 'Duration'
var animDurationProp = _.animationProp + 'Duration'
/**
* Force layout before triggering transitions/animations
*/
batcher._preFlush = function () {
/* jshint unused: false */
var f = document.documentElement.offsetHeight
}
/**
* Get an element's transition type based on the
* calculated styles
*
* @param {Element} el
* @param {Object} data
* @param {String} className
* @return {Number}
* 1 - transition
* 2 - animation
*/
function getTransitionType (el, data, className) {
var type = data.cache && data.cache[className]
if (type) return type
var inlineStyles = el.style
var computedStyles = window.getComputedStyle(el)
var transDuration =
inlineStyles[transDurationProp] ||
computedStyles[transDurationProp]
if (transDuration && transDuration !== '0s') {
type = 1
} else {
var animDuration =
inlineStyles[animDurationProp] ||
computedStyles[animDurationProp]
if (animDuration && animDuration !== '0s') {
type = 2
}
}
if (type) {
if (!data.cache) data.cache = {}
data.cache[className] = type
}
return type
}
/**
* Apply CSS transition to an element.
*
* @param {Element} el
* @param {Number} direction - 1: enter, -1: leave
* @param {Function} op - the actual DOM operation
* @param {Object} data - target element's transition data
*/
module.exports = function (el, direction, op, data, cb) {
var classList = el.classList
var prefix = data.id || 'v'
var enterClass = prefix + '-enter'
var leaveClass = prefix + '-leave'
// clean up potential previous unfinished transition
if (data.callback) {
_.off(el, data.event, data.callback)
classList.remove(enterClass)
classList.remove(leaveClass)
data.event = data.callback = null
}
var transitionType, onEnd, endEvent
if (direction > 0) { // enter
// Enter Transition
classList.add(enterClass)
op()
transitionType = getTransitionType(el, data, enterClass)
if (transitionType === 1) {
batcher.push({
run: function () {
classList.remove(enterClass)
}
})
// only listen for transition end if user has sent
// in a callback
if (cb) {
endEvent = data.event = _.transitionEndEvent
onEnd = data.callback = function transitionCb (e) {
if (e.target === el) {
_.off(el, endEvent, onEnd)
data.event = data.callback = null
cb()
}
}
_.on(el, endEvent, onEnd)
}
} else if (transitionType === 2) {
// Enter Animation
//
// Animations are triggered automatically as the
// element is inserted into the DOM, so we just
// listen for the animationend event.
endEvent = data.event = _.animationEndEvent
onEnd = data.callback = function transitionCb (e) {
if (e.target === el) {
_.off(el, endEvent, onEnd)
data.event = data.callback = null
classList.remove(enterClass)
if (cb) cb()
}
}
_.on(el, endEvent, onEnd)
} else {
// no transition applicable
classList.remove(enterClass)
if (cb) cb()
}
} else { // leave
classList.add(leaveClass)
transitionType = getTransitionType(el, data, leaveClass)
if (transitionType) {
if (transitionType === 1) {
classList.remove(leaveClass)
batcher.push({
run: function () {
classList.add(leaveClass)
}
})
}
endEvent = data.event = transitionType === 1
? _.transitionEndEvent
: _.animationEndEvent
onEnd = data.callback = function transitionCb (e) {
if (e.target === el) {
_.off(el, endEvent, onEnd)
data.event = data.callback = null
// actually remove node here
op()
classList.remove(leaveClass)
if (cb) cb()
}
}
_.on(el, endEvent, onEnd)
} else {
op()
classList.remove(leaveClass)
if (cb) cb()
}
}
}
});
require.register(9, function (exports, module) {
var _ = require(2)
var applyCSSTransition = require(54)
var applyJSTransition = require(55)
/**
* Append with transition.
*
* @oaram {Element} el
* @param {Element} target
* @param {Vue} vm
* @param {Function} [cb]
*/
exports.append = function (el, target, vm, cb) {
apply(el, 1, function () {
target.appendChild(el)
}, vm, cb)
}
/**
* InsertBefore with transition.
*
* @oaram {Element} el
* @param {Element} target
* @param {Vue} vm
* @param {Function} [cb]
*/
exports.before = function (el, target, vm, cb) {
apply(el, 1, function () {
_.before(el, target)
}, vm, cb)
}
/**
* Remove with transition.
*
* @oaram {Element} el
* @param {Vue} vm
* @param {Function} [cb]
*/
exports.remove = function (el, vm, cb) {
apply(el, -1, function () {
_.remove(el)
}, vm, cb)
}
/**
* Remove by appending to another parent with transition.
* This is only used in block operations.
*
* @oaram {Element} el
* @param {Element} target
* @param {Vue} vm
* @param {Function} [cb]
*/
exports.removeThenAppend = function (el, target, vm, cb) {
apply(el, -1, function () {
target.appendChild(el)
}, vm, cb)
}
/**
* Apply transitions with an operation callback.
*
* @oaram {Element} el
* @param {Number} direction
* 1: enter
* -1: leave
* @param {Function} op - the actual DOM operation
* @param {Vue} vm
* @param {Function} [cb]
*/
var apply = exports.apply = function (el, direction, op, vm, cb) {
var transData = el.__v_trans
if (
!transData ||
!vm._isCompiled ||
// if the vm is being manipulated by a parent directive
// during the parent's compilation phase, skip the
// animation.
(vm.$parent && !vm.$parent._isCompiled)
) {
op()
if (cb) cb()
return
}
// determine the transition type on the element
var jsTransition = vm.$options.transitions[transData.id]
if (jsTransition) {
// js
applyJSTransition(
el,
direction,
op,
transData,
jsTransition,
cb
)
} else if (_.transitionEndEvent) {
// css
applyCSSTransition(
el,
direction,
op,
transData,
cb
)
} else {
// not applicable
op()
if (cb) cb()
}
}
});
require.register(55, function (exports, module) {
/**
* Apply JavaScript enter/leave functions.
*
* @param {Element} el
* @param {Number} direction - 1: enter, -1: leave
* @param {Function} op - the actual DOM operation
* @param {Object} data - target element's transition data
* @param {Object} def - transition definition object
* @param {Function} [cb]
*/
module.exports = function (el, direction, op, data, def, cb) {
if (data.cancel) {
data.cancel()
data.cancel = null
}
if (direction > 0) { // enter
if (def.beforeEnter) {
def.beforeEnter(el)
}
op()
if (def.enter) {
data.cancel = def.enter(el, function () {
data.cancel = null
if (cb) cb()
})
} else if (cb) {
cb()
}
} else { // leave
if (def.leave) {
data.cancel = def.leave(el, function () {
data.cancel = null
op()
if (cb) cb()
})
} else {
op()
if (cb) cb()
}
}
}
});
require.register(56, function (exports, module) {
var config = require(13)
/**
* Enable debug utilities. The enableDebug() function and
* all _.log() & _.warn() calls will be dropped in the
* minified production build.
*/
enableDebug()
function enableDebug () {
var hasConsole = typeof console !== 'undefined'
/**
* Log a message.
*
* @param {String} msg
*/
exports.log = function (msg) {
if (hasConsole && config.debug) {
console.log('[Vue info]: ' + msg)
}
}
/**
* We've got a problem here.
*
* @param {String} msg
*/
exports.warn = function (msg) {
if (hasConsole && !config.silent) {
console.warn('[Vue warn]: ' + msg)
if (config.debug && console.trace) {
console.trace()
}
}
}
/**
* Assert asset exists
*/
exports.assertAsset = function (val, type, id) {
if (!val) {
exports.warn('Failed to resolve ' + type + ': ' + id)
}
}
}
});
require.register(57, function (exports, module) {
var config = require(13)
/**
* Check if a node is in the document.
*
* @param {Node} node
* @return {Boolean}
*/
var doc =
typeof document !== 'undefined' &&
document.documentElement
exports.inDoc = function (node) {
return doc && doc.contains(node)
}
/**
* Extract an attribute from a node.
*
* @param {Node} node
* @param {String} attr
*/
exports.attr = function (node, attr) {
attr = config.prefix + attr
var val = node.getAttribute(attr)
if (val !== null) {
node.removeAttribute(attr)
}
return val
}
/**
* Insert el before target
*
* @param {Element} el
* @param {Element} target
*/
exports.before = function (el, target) {
target.parentNode.insertBefore(el, target)
}
/**
* Insert el after target
*
* @param {Element} el
* @param {Element} target
*/
exports.after = function (el, target) {
if (target.nextSibling) {
exports.before(el, target.nextSibling)
} else {
target.parentNode.appendChild(el)
}
}
/**
* Remove el from DOM
*
* @param {Element} el
*/
exports.remove = function (el) {
el.parentNode.removeChild(el)
}
/**
* Prepend el to target
*
* @param {Element} el
* @param {Element} target
*/
exports.prepend = function (el, target) {
if (target.firstChild) {
exports.before(el, target.firstChild)
} else {
target.appendChild(el)
}
}
/**
* Replace target with el
*
* @param {Element} target
* @param {Element} el
*/
exports.replace = function (target, el) {
var parent = target.parentNode
if (parent) {
parent.replaceChild(el, target)
}
}
/**
* Copy attributes from one element to another.
*
* @param {Element} from
* @param {Element} to
*/
exports.copyAttributes = function (from, to) {
if (from.hasAttributes()) {
var attrs = from.attributes
for (var i = 0, l = attrs.length; i < l; i++) {
var attr = attrs[i]
to.setAttribute(attr.name, attr.value)
}
}
}
/**
* Add event listener shorthand.
*
* @param {Element} el
* @param {String} event
* @param {Function} cb
*/
exports.on = function (el, event, cb) {
el.addEventListener(event, cb)
}
/**
* Remove event listener shorthand.
*
* @param {Element} el
* @param {String} event
* @param {Function} cb
*/
exports.off = function (el, event, cb) {
el.removeEventListener(event, cb)
}
/**
* Compatibility add class for IE9
*
* @param {Element} el
* @param {Strong} cls
*/
exports.addClass = function (el, cls) {
var cur = ' ' + el.className + ' '
if (cur.indexOf(' ' + cls + ' ') < 0) {
el.className = (cur + cls).trim()
}
}
/**
* Compatibility remove class for IE9
*
* @param {Element} el
* @param {Strong} cls
*/
exports.removeClass = function (el, cls) {
var cur = ' ' + el.className + ' '
var tar = ' ' + cls + ' '
while (cur.indexOf(tar) >= 0) {
cur = cur.replace(tar, ' ')
}
el.className = cur.trim()
}
});
require.register(58, function (exports, module) {
/**
* Can we use __proto__?
*
* @type {Boolean}
*/
exports.hasProto = '__proto__' in {}
/**
* Indicates we have a window
*
* @type {Boolean}
*/
var toString = Object.prototype.toString
var inBrowser = exports.inBrowser =
typeof window !== 'undefined' &&
toString.call(window) !== '[object Object]'
/**
* Defer a task to the start of the next event loop
*
* @param {Function} cb
* @param {Object} ctx
*/
var defer = inBrowser
? (window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
setTimeout)
: setTimeout
exports.nextTick = function (cb, ctx) {
if (ctx) {
defer(function () { cb.call(ctx) }, 0)
} else {
defer(cb, 0)
}
}
/**
* Detect if we are in IE9...
*
* @type {Boolean}
*/
exports.isIE9 =
inBrowser &&
navigator.userAgent.indexOf('MSIE 9.0') > 0
/**
* Sniff transition/animation events
*/
if (inBrowser && !exports.isIE9) {
var isWebkitTrans =
window.ontransitionend === undefined &&
window.onwebkittransitionend !== undefined
var isWebkitAnim =
window.onanimationend === undefined &&
window.onwebkitanimationend !== undefined
exports.transitionProp = isWebkitTrans
? 'WebkitTransition'
: 'transition'
exports.transitionEndEvent = isWebkitTrans
? 'webkitTransitionEnd'
: 'transitionend'
exports.animationProp = isWebkitAnim
? 'WebkitAnimation'
: 'animation'
exports.animationEndEvent = isWebkitAnim
? 'webkitAnimationEnd'
: 'animationend'
}
});
require.register(59, function (exports, module) {
var _ = require(56)
/**
* Resolve read & write filters for a vm instance. The
* filters descriptor Array comes from the directive parser.
*
* This is extracted into its own utility so it can
* be used in multiple scenarios.
*
* @param {Vue} vm
* @param {Array<Object>} filters
* @param {Object} [target]
* @return {Object}
*/
exports.resolveFilters = function (vm, filters, target) {
if (!filters) {
return
}
var res = target || {}
// var registry = vm.$options.filters
filters.forEach(function (f) {
var def = vm.$options.filters[f.name]
_.assertAsset(def, 'filter', f.name)
if (!def) return
var args = f.args
var reader, writer
if (typeof def === 'function') {
reader = def
} else {
reader = def.read
writer = def.write
}
if (reader) {
if (!res.read) res.read = []
res.read.push(function (value) {
return args
? reader.apply(vm, [value].concat(args))
: reader.call(vm, value)
})
}
if (writer) {
if (!res.write) res.write = []
res.write.push(function (value, oldVal) {
return args
? writer.apply(vm, [value, oldVal].concat(args))
: writer.call(vm, value, oldVal)
})
}
})
return res
}
/**
* Apply filters to a value
*
* @param {*} value
* @param {Array} filters
* @param {Vue} vm
* @param {*} oldVal
* @return {*}
*/
exports.applyFilters = function (value, filters, vm, oldVal) {
if (!filters) {
return value
}
for (var i = 0, l = filters.length; i < l; i++) {
value = filters[i].call(vm, value, oldVal)
}
return value
}
});
require.register(2, function (exports, module) {
var lang = require(60)
var extend = lang.extend
extend(exports, lang)
extend(exports, require(58))
extend(exports, require(57))
extend(exports, require(59))
extend(exports, require(56))
});
require.register(60, function (exports, module) {
/**
* Check is a string starts with $ or _
*
* @param {String} str
* @return {Boolean}
*/
exports.isReserved = function (str) {
var c = str.charCodeAt(0)
return c === 0x24 || c === 0x5F
}
/**
* Guard text output, make sure undefined outputs
* empty string
*
* @param {*} value
* @return {String}
*/
exports.toString = function (value) {
return value == null
? ''
: value.toString()
}
/**
* Check and convert possible numeric numbers before
* setting back to data
*
* @param {*} value
* @return {*|Number}
*/
exports.toNumber = function (value) {
return (
isNaN(value) ||
value === null ||
typeof value === 'boolean'
) ? value
: Number(value)
}
/**
* Strip quotes from a string
*
* @param {String} str
* @return {String | false}
*/
exports.stripQuotes = function (str) {
var a = str.charCodeAt(0)
var b = str.charCodeAt(str.length - 1)
return a === b && (a === 0x22 || a === 0x27)
? str.slice(1, -1)
: false
}
/**
* Camelize a hyphen-delmited string.
*
* @param {String} str
* @return {String}
*/
var camelRE = /(?:^|[-_])(\w)/g
exports.camelize = function (str) {
return str.replace (camelRE, function (_, c) {
return c ? c.toUpperCase () : '';
})
}
/**
* Simple bind, faster than native
*
* @param {Function} fn
* @param {Object} ctx
* @return {Function}
*/
exports.bind = function (fn, ctx) {
return function () {
return fn.apply(ctx, arguments)
}
}
/**
* Convert an Array-like object to a real Array.
*
* @param {Array-like} list
* @param {Number} [start] - start index
* @return {Array}
*/
exports.toArray = function (list, start) {
start = start || 0
var i = list.length - start
var ret = new Array(i)
while (i--) {
ret[i] = list[i + start]
}
return ret
}
/**
* Mix properties into target object.
*
* @param {Object} to
* @param {Object} from
*/
exports.extend = function (to, from) {
for (var key in from) {
to[key] = from[key]
}
}
/**
* Quick object check - this is primarily used to tell
* Objects from primitive values when we know the value
* is a JSON-compliant type.
*
* @param {*} obj
* @return {Boolean}
*/
exports.isObject = function (obj) {
return obj && typeof obj === 'object'
}
/**
* Strict object type check. Only returns true
* for plain JavaScript objects.
*
* @param {*} obj
* @return {Boolean}
*/
var toString = Object.prototype.toString
exports.isPlainObject = function (obj) {
return toString.call(obj) === '[object Object]'
}
/**
* Array type check.
*
* @param {*} obj
* @return {Boolean}
*/
exports.isArray = function (obj) {
return Array.isArray(obj)
}
/**
* Define a non-enumerable property
*
* @param {Object} obj
* @param {String} key
* @param {*} val
* @param {Boolean} [enumerable]
*/
exports.define = function (obj, key, val, enumerable) {
Object.defineProperty(obj, key, {
value : val,
enumerable : !!enumerable,
writable : true,
configurable : true
})
}
});
require.register(12, function (exports, module) {
var _ = require(2)
var extend = _.extend
/**
* Option overwriting strategies are functions that handle
* how to merge a parent option value and a child option
* value into the final value.
*
* All strategy functions follow the same signature:
*
* @param {*} parentVal
* @param {*} childVal
* @param {Vue} [vm]
*/
var strats = {}
/**
* Data
*/
strats.data = function (parentVal, childVal, vm) {
// in a class merge, both should be functions
// so we just return child if it exists
if (!vm) {
if (childVal && typeof childVal !== 'function') {
_.warn(
'The "data" option should be a function ' +
'that returns a per-instance value in component ' +
'definitions.'
)
return
}
return childVal || parentVal
}
var instanceData = typeof childVal === 'function'
? childVal()
: childVal
var defaultData = typeof parentVal === 'function'
? parentVal()
: undefined
if (instanceData) {
// mix default data into instance data
for (var key in defaultData) {
if (!instanceData.hasOwnProperty(key)) {
instanceData[key] = defaultData[key]
}
}
return instanceData
} else {
return defaultData
}
}
/**
* El
*/
strats.el = function (parentVal, childVal, vm) {
if (!vm && childVal && typeof childVal !== 'function') {
_.warn(
'The "el" option should be a function ' +
'that returns a per-instance value in component ' +
'definitions.'
)
return
}
var ret = childVal || parentVal
// invoke the element factory if this is instance merge
return vm && typeof ret === 'function'
? ret()
: ret
}
/**
* Hooks and param attributes are merged as arrays.
*/
strats.created =
strats.ready =
strats.attached =
strats.detached =
strats.beforeCompile =
strats.compiled =
strats.beforeDestroy =
strats.destroyed =
strats.paramAttributes = function (parentVal, childVal) {
return childVal
? parentVal
? parentVal.concat(childVal)
: _.isArray(childVal)
? childVal
: [childVal]
: parentVal
}
/**
* Assets
*
* When a vm is present (instance creation), we need to do
* a three-way merge between constructor options, instance
* options and parent options.
*/
strats.directives =
strats.filters =
strats.partials =
strats.transitions =
strats.components = function (parentVal, childVal, vm, key) {
var ret = Object.create(
vm && vm.$parent
? vm.$parent.$options[key]
: _.Vue.options[key]
)
if (parentVal) {
var keys = Object.keys(parentVal)
var i = keys.length
var field
while (i--) {
field = keys[i]
ret[field] = parentVal[field]
}
}
if (childVal) extend(ret, childVal)
return ret
}
/**
* Events
*
* Events should not overwrite one another, so we merge
* them as arrays.
*/
strats.events = function (parentVal, childVal) {
if (!childVal) return parentVal
if (!parentVal) return childVal
var ret = {}
extend(ret, parentVal)
for (var key in childVal) {
var parent = ret[key]
var child = childVal[key]
ret[key] = parent
? parent.concat(child)
: [child]
}
return ret
}
/**
* Other object hashes.
*/
strats.methods =
strats.computed = function (parentVal, childVal) {
if (!childVal) return parentVal
if (!parentVal) return childVal
var ret = Object.create(parentVal)
extend(ret, childVal)
return ret
}
/**
* Default strategy.
*/
var defaultStrat = function (parentVal, childVal) {
return childVal === undefined
? parentVal
: childVal
}
/**
* Make sure component options get converted to actual
* constructors.
*
* @param {Object} components
*/
function guardComponents (components) {
if (components) {
var def
for (var key in components) {
def = components[key]
if (_.isPlainObject(def)) {
def.name = key
components[key] = _.Vue.extend(def)
}
}
}
}
/**
* Merge two option objects into a new one.
* Core utility used in both instantiation and inheritance.
*
* @param {Object} parent
* @param {Object} child
* @param {Vue} [vm] - if vm is present, indicates this is
* an instantiation merge.
*/
module.exports = function mergeOptions (parent, child, vm) {
guardComponents(child.components)
var options = {}
var key
for (key in parent) {
merge(parent[key], child[key], key)
}
for (key in child) {
if (!(parent.hasOwnProperty(key))) {
merge(parent[key], child[key], key)
}
}
var mixins = child.mixins
if (mixins) {
for (var i = 0, l = mixins.length; i < l; i++) {
for (key in mixins[i]) {
merge(options[key], mixins[i][key], key)
}
}
}
function merge (parentVal, childVal, key) {
var strat = strats[key] || defaultStrat
options[key] = strat(parentVal, childVal, vm, key)
}
return options
}
});
require.register("vue", function (exports, module) {
var _ = require(2)
var extend = _.extend
/**
* The exposed Vue constructor.
*
* API conventions:
* - public API methods/properties are prefiexed with `$`
* - internal methods/properties are prefixed with `_`
* - non-prefixed properties are assumed to be proxied user
* data.
*
* @constructor
* @param {Object} [options]
* @public
*/
function Vue (options) {
this._init(options)
}
/**
* Mixin global API
*/
extend(Vue, require(11))
/**
* Vue and every constructor that extends Vue has an
* associated options object, which can be accessed during
* compilation steps as `this.constructor.options`.
*
* These can be seen as the default options of every
* Vue instance.
*/
Vue.options = {
directives : require(29),
filters : require(46),
partials : {},
transitions : {},
components : {}
}
/**
* Build up the prototype
*/
var p = Vue.prototype
/**
* $data has a setter which does a bunch of
* teardown/setup work
*/
Object.defineProperty(p, '$data', {
get: function () {
return this._data
},
set: function (newData) {
this._setData(newData)
}
})
/**
* Mixin internal instance methods
*/
extend(p, require(49))
extend(p, require(48))
extend(p, require(50))
extend(p, require(47))
/**
* Mixin public API methods
*/
extend(p, require(3))
extend(p, require(8))
extend(p, require(10))
extend(p, require(1))
extend(p, require(14))
module.exports = _.Vue = Vue
});
require.register(4, function (exports, module) {
var _ = require(2)
var Observer = require(51)
var expParser = require(7)
var Batcher = require(15)
var batcher = new Batcher()
var uid = 0
/**
* A watcher parses an expression, collects dependencies,
* and fires callback when the expression value changes.
* This is used for both the $watch() api and directives.
*
* @param {Vue} vm
* @param {String} expression
* @param {Function} cb
* @param {Array} [filters]
* @param {Boolean} [needSet]
* @param {Boolean} [deep]
* @constructor
*/
function Watcher (vm, expression, cb, filters, needSet, deep) {
this.vm = vm
vm._watcherList.push(this)
this.expression = expression
this.cbs = [cb]
this.id = ++uid // uid for batching
this.active = true
this.deep = deep
this.deps = Object.create(null)
// setup filters if any.
// We delegate directive filters here to the watcher
// because they need to be included in the dependency
// collection process.
this.readFilters = filters && filters.read
this.writeFilters = filters && filters.write
// parse expression for getter/setter
var res = expParser.parse(expression, needSet)
this.getter = res.get
this.setter = res.set
this.value = this.get()
}
var p = Watcher.prototype
/**
* Add a binding dependency to this directive.
*
* @param {Binding} binding
*/
p.addDep = function (binding) {
var id = binding.id
if (!this.newDeps[id]) {
this.newDeps[id] = binding
if (!this.deps[id]) {
this.deps[id] = binding
binding.addSub(this)
}
}
}
/**
* Evaluate the getter, and re-collect dependencies.
*/
p.get = function () {
this.beforeGet()
var vm = this.vm
var value = this.getter.call(vm, vm)
// use JSON.stringify to "touch" every property
// so they are all tracked as dependencies for
// deep watching
if (this.deep) JSON.stringify(value)
value = _.applyFilters(value, this.readFilters, vm)
this.afterGet()
return value
}
/**
* Set the corresponding value with the setter.
*
* @param {*} value
*/
p.set = function (value) {
var vm = this.vm
value = _.applyFilters(
value, this.writeFilters, vm, this.value
)
this.setter.call(vm, vm, value)
}
/**
* Prepare for dependency collection.
*/
p.beforeGet = function () {
Observer.target = this
this.newDeps = {}
}
/**
* Clean up for dependency collection.
*/
p.afterGet = function () {
Observer.target = null
for (var id in this.deps) {
if (!this.newDeps[id]) {
this.deps[id].removeSub(this)
}
}
this.deps = this.newDeps
}
/**
* Subscriber interface.
* Will be called when a dependency changes.
*/
p.update = function () {
batcher.push(this)
}
/**
* Batcher job interface.
* Will be called by the batcher.
*/
p.run = function () {
if (this.active) {
var value = this.get()
if (
(typeof value === 'object' && value !== null) ||
value !== this.value
) {
var oldValue = this.value
this.value = value
var cbs = this.cbs
for (var i = 0, l = cbs.length; i < l; i++) {
cbs[i](value, oldValue)
}
}
}
}
/**
* Add a callback.
*
* @param {Function} cb
*/
p.addCb = function (cb) {
this.cbs.push(cb)
}
/**
* Remove a callback.
*
* @param {Function} cb
*/
p.removeCb = function (cb) {
var cbs = this.cbs
if (cbs.length > 1) {
var i = cbs.indexOf(cb)
if (i > -1) {
cbs.splice(i, 1)
}
} else if (cb === cbs[0]) {
this.teardown()
}
}
/**
* Remove self from all dependencies' subcriber list.
*/
p.teardown = function () {
if (this.active) {
// remove self from vm's watcher list
// we can skip this if the vm if being destroyed
// which can improve teardown performance.
if (!this.vm._isBeingDestroyed) {
var list = this.vm._watcherList
list.splice(list.indexOf(this))
}
for (var id in this.deps) {
this.deps[id].removeSub(this)
}
this.active = false
this.vm = this.cbs = this.value = null
}
}
module.exports = Watcher
});
if (typeof exports == "object") {
module.exports = require("vue");
} else if (typeof define == "function" && define.amd) {
define([], function(){ return require("vue"); });
} else {
window.Vue = require("vue");
}
})()
|
src/stores/MediaSearchStore.js
|
u-wave/web
|
import React from 'react';
import { useDispatch } from 'react-redux';
import PropTypes from 'prop-types';
import { hideSearchResults, showSearchResults } from '../actions/SearchActionCreators';
import { get } from '../actions/RequestActionCreators';
import { IDLE, LOADING, LOADED } from '../constants/LoadingStates';
const {
useCallback,
useContext,
useEffect,
useMemo,
useState,
} = React;
const MediaSearchStoreContext = React.createContext(null);
function useStoreImplementation() {
const [query, setQuery] = useState(null);
const [state, setState] = useState(IDLE);
const [activeSource, setActiveSource] = useState('youtube');
const [results, setResults] = useState(null);
const dispatch = useDispatch();
useEffect(() => {
if (query == null) {
setResults(null);
return () => {};
}
setState(LOADING);
// Maybe this can be pulled into a useFetch hook of some kind?
const controller = new AbortController();
const request = get(`/search/${encodeURIComponent(activeSource)}`, {
qs: { query, include: 'playlists' },
signal: controller.signal,
});
dispatch(request).then(({ data }) => {
setResults(data);
setState(LOADED);
}, () => {
setState(IDLE);
});
return () => {
controller.abort();
setState(IDLE);
};
}, [dispatch, query, activeSource]);
const search = useCallback((newQuery) => {
// For compatibility.
// TODO do this elsewhere.
if (newQuery != null) {
dispatch(showSearchResults());
} else {
dispatch(hideSearchResults());
}
setQuery(newQuery);
}, [dispatch]);
const context = useMemo(() => ({
activeSource,
query,
results,
resultsCount: results ? results.length : 0,
state,
search,
setSource: setActiveSource,
}), [activeSource, query, results, state, search, setActiveSource]);
return context;
}
export function MediaSearchStoreProvider({ children }) {
const context = useStoreImplementation();
return (
<MediaSearchStoreContext.Provider value={context}>
{children}
</MediaSearchStoreContext.Provider>
);
}
MediaSearchStoreProvider.propTypes = {
children: PropTypes.element.isRequired,
};
export function useMediaSearchStore() {
return useContext(MediaSearchStoreContext);
}
|
ajax/libs/can.js/3.11.0/can.js
|
extend1994/cdnjs
|
/*[global-shim-start]*/
(function(exports, global, doEval) {
// jshint ignore:line
var origDefine = global.define;
var get = function(name) {
var parts = name.split("."),
cur = global,
i;
for (i = 0; i < parts.length; i++) {
if (!cur) {
break;
}
cur = cur[parts[i]];
}
return cur;
};
var set = function(name, val) {
var parts = name.split("."),
cur = global,
i,
part,
next;
for (i = 0; i < parts.length - 1; i++) {
part = parts[i];
next = cur[part];
if (!next) {
next = cur[part] = {};
}
cur = next;
}
part = parts[parts.length - 1];
cur[part] = val;
};
var useDefault = function(mod) {
if (!mod || !mod.__esModule) return false;
var esProps = { __esModule: true, default: true };
for (var p in mod) {
if (!esProps[p]) return false;
}
return true;
};
var hasCjsDependencies = function(deps) {
return (
deps[0] === "require" && deps[1] === "exports" && deps[2] === "module"
);
};
var modules =
(global.define && global.define.modules) ||
(global._define && global._define.modules) ||
{};
var ourDefine = (global.define = function(moduleName, deps, callback) {
var module;
if (typeof deps === "function") {
callback = deps;
deps = [];
}
var args = [],
i;
for (i = 0; i < deps.length; i++) {
args.push(
exports[deps[i]]
? get(exports[deps[i]])
: modules[deps[i]] || get(deps[i])
);
}
// CJS has no dependencies but 3 callback arguments
if (hasCjsDependencies(deps) || (!deps.length && callback.length)) {
module = { exports: {} };
args[0] = function(name) {
return exports[name] ? get(exports[name]) : modules[name];
};
args[1] = module.exports;
args[2] = module;
} else if (!args[0] && deps[0] === "exports") {
// Babel uses the exports and module object.
module = { exports: {} };
args[0] = module.exports;
if (deps[1] === "module") {
args[1] = module;
}
} else if (!args[0] && deps[0] === "module") {
args[0] = { id: moduleName };
}
global.define = origDefine;
var result = callback ? callback.apply(null, args) : undefined;
global.define = ourDefine;
// Favor CJS module.exports over the return value
result = module && module.exports ? module.exports : result;
modules[moduleName] = result;
// Set global exports
var globalExport = exports[moduleName];
if (globalExport && !get(globalExport)) {
if (useDefault(result)) {
result = result["default"];
}
set(globalExport, result);
}
});
global.define.orig = origDefine;
global.define.modules = modules;
global.define.amd = true;
ourDefine("@loader", [], function() {
// shim for @@global-helpers
var noop = function() {};
return {
get: function() {
return { prepareGlobal: noop, retrieveGlobal: noop };
},
global: global,
__exec: function(__load) {
doEval(__load.source, global);
}
};
});
})(
{
jquery: "jQuery",
"can-util/namespace": "can",
kefir: "Kefir",
"validate.js": "validate",
react: "React"
},
typeof self == "object" && self.Object == Object ? self : window,
function(__$source__, __$global__) {
// jshint ignore:line
eval("(function() { " + __$source__ + " \n }).call(__$global__);");
}
);
/*can-namespace@1.0.0#can-namespace*/
define('can-namespace', function (require, exports, module) {
module.exports = {};
});
/*can-util@3.10.11#namespace*/
define('can-util/namespace', [
'require',
'exports',
'module',
'can-namespace'
], function (require, exports, module) {
module.exports = require('can-namespace');
});
/*can-assign@1.0.0#can-assign*/
define('can-assign', function (require, exports, module) {
module.exports = function (d, s) {
for (var prop in s) {
d[prop] = s[prop];
}
return d;
};
});
/*can-util@3.10.11#js/assign/assign*/
define('can-util/js/assign/assign', [
'require',
'exports',
'module',
'can-assign'
], function (require, exports, module) {
'use strict';
module.exports = require('can-assign');
});
/*can-util@3.10.11#js/is-function/is-function*/
define('can-util/js/is-function/is-function', function (require, exports, module) {
'use strict';
var isFunction = function () {
if (typeof document !== 'undefined' && typeof document.getElementsByTagName('body') === 'function') {
return function (value) {
return Object.prototype.toString.call(value) === '[object Function]';
};
}
return function (value) {
return typeof value === 'function';
};
}();
module.exports = isFunction;
});
/*can-util@3.10.11#js/is-plain-object/is-plain-object*/
define('can-util/js/is-plain-object/is-plain-object', function (require, exports, module) {
'use strict';
var core_hasOwn = Object.prototype.hasOwnProperty;
function isWindow(obj) {
return obj !== null && obj == obj.window;
}
function isPlainObject(obj) {
if (!obj || typeof obj !== 'object' || obj.nodeType || isWindow(obj) || obj.constructor && obj.constructor.shortName) {
return false;
}
try {
if (obj.constructor && !core_hasOwn.call(obj, 'constructor') && !core_hasOwn.call(obj.constructor.prototype, 'isPrototypeOf')) {
return false;
}
} catch (e) {
return false;
}
var key;
for (key in obj) {
}
return key === undefined || core_hasOwn.call(obj, key);
}
module.exports = isPlainObject;
});
/*can-util@3.10.11#js/deep-assign/deep-assign*/
define('can-util/js/deep-assign/deep-assign', [
'require',
'exports',
'module',
'can-util/js/is-function/is-function',
'can-util/js/is-plain-object/is-plain-object'
], function (require, exports, module) {
'use strict';
var isFunction = require('can-util/js/is-function/is-function');
var isPlainObject = require('can-util/js/is-plain-object/is-plain-object');
function deepAssign() {
var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length;
if (typeof target !== 'object' && !isFunction(target)) {
target = {};
}
if (length === i) {
target = this;
--i;
}
for (; i < length; i++) {
if ((options = arguments[i]) != null) {
for (name in options) {
src = target[name];
copy = options[name];
if (target === copy) {
continue;
}
if (copy && (isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
if (copyIsArray) {
copyIsArray = false;
clone = src && Array.isArray(src) ? src : [];
} else {
clone = src && isPlainObject(src) ? src : {};
}
target[name] = deepAssign(clone, copy);
} else if (copy !== undefined) {
target[name] = copy;
}
}
}
}
return target;
}
module.exports = deepAssign;
});
/*can-util@3.10.11#js/log/log*/
define('can-util/js/log/log', function (require, exports, module) {
'use strict';
exports.warnTimeout = 5000;
exports.logLevel = 0;
exports.warn = function (out) {
var ll = this.logLevel;
if (ll < 2) {
Array.prototype.unshift.call(arguments, 'WARN:');
if (typeof console !== 'undefined' && console.warn) {
this._logger('warn', Array.prototype.slice.call(arguments));
} else if (typeof console !== 'undefined' && console.log) {
this._logger('log', Array.prototype.slice.call(arguments));
} else if (window && window.opera && window.opera.postError) {
window.opera.postError('CanJS WARNING: ' + out);
}
}
};
exports.log = function (out) {
var ll = this.logLevel;
if (ll < 1) {
if (typeof console !== 'undefined' && console.log) {
Array.prototype.unshift.call(arguments, 'INFO:');
this._logger('log', Array.prototype.slice.call(arguments));
} else if (window && window.opera && window.opera.postError) {
window.opera.postError('CanJS INFO: ' + out);
}
}
};
exports.error = function (out) {
var ll = this.logLevel;
if (ll < 1) {
if (typeof console !== 'undefined' && console.error) {
Array.prototype.unshift.call(arguments, 'ERROR:');
this._logger('error', Array.prototype.slice.call(arguments));
} else if (window && window.opera && window.opera.postError) {
window.opera.postError('ERROR: ' + out);
}
}
};
exports._logger = function (type, arr) {
try {
console[type].apply(console, arr);
} catch (e) {
console[type](arr);
}
};
});
/*can-util@3.10.11#js/dev/dev*/
define('can-util/js/dev/dev', [
'require',
'exports',
'module',
'can-util/js/log/log'
], function (require, exports, module) {
'use strict';
var canLog = require('can-util/js/log/log');
module.exports = {
warnTimeout: 5000,
logLevel: 0,
stringify: function (value) {
var flagUndefined = function flagUndefined(key, value) {
return value === undefined ? '/* void(undefined) */' : value;
};
return JSON.stringify(value, flagUndefined, ' ').replace(/"\/\* void\(undefined\) \*\/"/g, 'undefined');
},
warn: function () {
canLog.warn.apply(this, arguments);
},
log: function () {
canLog.log.apply(this, arguments);
},
error: function () {
canLog.error.apply(this, arguments);
},
_logger: canLog._logger
};
});
/*can-util@3.10.11#js/is-array-like/is-array-like*/
define('can-util/js/is-array-like/is-array-like', function (require, exports, module) {
'use strict';
function isArrayLike(obj) {
var type = typeof obj;
if (type === 'string') {
return true;
} else if (type === 'number') {
return false;
}
var length = obj && type !== 'boolean' && typeof obj !== 'number' && 'length' in obj && obj.length;
return typeof obj !== 'function' && (length === 0 || typeof length === 'number' && length > 0 && length - 1 in obj);
}
module.exports = isArrayLike;
});
/*can-symbol@1.2.0#can-symbol*/
define('can-symbol', [
'require',
'exports',
'module',
'can-namespace'
], function (require, exports, module) {
(function (global) {
var namespace = require('can-namespace');
var CanSymbol;
if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {
CanSymbol = Symbol;
} else {
var symbolNum = 0;
CanSymbol = function CanSymbolPolyfill(description) {
var symbolValue = '@@symbol' + symbolNum++ + description;
var symbol = {};
Object.defineProperties(symbol, {
toString: {
value: function () {
return symbolValue;
}
}
});
return symbol;
};
var descriptionToSymbol = {};
var symbolToDescription = {};
CanSymbol.for = function (description) {
var symbol = descriptionToSymbol[description];
if (!symbol) {
symbol = descriptionToSymbol[description] = CanSymbol(description);
symbolToDescription[symbol] = description;
}
return symbol;
};
CanSymbol.keyFor = function (symbol) {
return symbolToDescription[symbol];
};
[
'hasInstance',
'isConcatSpreadable',
'iterator',
'match',
'prototype',
'replace',
'search',
'species',
'split',
'toPrimitive',
'toStringTag',
'unscopables'
].forEach(function (name) {
CanSymbol[name] = CanSymbol.for(name);
});
}
[
'isMapLike',
'isListLike',
'isValueLike',
'isFunctionLike',
'getOwnKeys',
'getOwnKeyDescriptor',
'proto',
'getOwnEnumerableKeys',
'hasOwnKey',
'size',
'assignDeep',
'updateDeep',
'getValue',
'setValue',
'getKeyValue',
'setKeyValue',
'updateValues',
'addValue',
'removeValues',
'apply',
'new',
'onValue',
'offValue',
'onKeyValue',
'offKeyValue',
'getKeyDependencies',
'getValueDependencies',
'keyHasDependencies',
'valueHasDependencies',
'onKeys',
'onKeysAdded',
'onKeysRemoved'
].forEach(function (name) {
CanSymbol.for('can.' + name);
});
module.exports = namespace.Symbol = CanSymbol;
}(function () {
return this;
}()));
});
/*can-util@3.10.11#js/is-iterable/is-iterable*/
define('can-util/js/is-iterable/is-iterable', [
'require',
'exports',
'module',
'can-symbol'
], function (require, exports, module) {
'use strict';
var canSymbol = require('can-symbol');
module.exports = function (obj) {
return obj && !!obj[canSymbol.iterator || canSymbol.for('iterator')];
};
});
/*can-util@3.10.11#js/each/each*/
define('can-util/js/each/each', [
'require',
'exports',
'module',
'can-util/js/is-array-like/is-array-like',
'can-util/js/is-iterable/is-iterable',
'can-symbol'
], function (require, exports, module) {
'use strict';
var isArrayLike = require('can-util/js/is-array-like/is-array-like');
var has = Object.prototype.hasOwnProperty;
var isIterable = require('can-util/js/is-iterable/is-iterable');
var canSymbol = require('can-symbol');
function each(elements, callback, context) {
var i = 0, key, len, item;
if (elements) {
if (isArrayLike(elements)) {
for (len = elements.length; i < len; i++) {
item = elements[i];
if (callback.call(context || item, item, i, elements) === false) {
break;
}
}
} else if (isIterable(elements)) {
var iter = elements[canSymbol.iterator || canSymbol.for('iterator')]();
var res, value;
while (!(res = iter.next()).done) {
value = res.value;
callback.call(context || elements, Array.isArray(value) ? value[1] : value, value[0]);
}
} else if (typeof elements === 'object') {
for (key in elements) {
if (has.call(elements, key) && callback.call(context || elements[key], elements[key], key, elements) === false) {
break;
}
}
}
}
return elements;
}
module.exports = each;
});
/*can-util@3.10.11#js/make-array/make-array*/
define('can-util/js/make-array/make-array', [
'require',
'exports',
'module',
'can-util/js/each/each',
'can-util/js/is-array-like/is-array-like'
], function (require, exports, module) {
'use strict';
var each = require('can-util/js/each/each');
var isArrayLike = require('can-util/js/is-array-like/is-array-like');
function makeArray(element) {
var ret = [];
if (isArrayLike(element)) {
each(element, function (a, i) {
ret[i] = a;
});
} else if (element === 0 || element) {
ret.push(element);
}
return ret;
}
module.exports = makeArray;
});
/*can-util@3.10.11#js/is-container/is-container*/
define('can-util/js/is-container/is-container', function (require, exports, module) {
'use strict';
module.exports = function (current) {
return /^f|^o/.test(typeof current);
};
});
/*can-util@3.10.11#js/get/get*/
define('can-util/js/get/get', [
'require',
'exports',
'module',
'can-util/js/is-container/is-container'
], function (require, exports, module) {
'use strict';
var isContainer = require('can-util/js/is-container/is-container');
function get(obj, name) {
var parts = typeof name !== 'undefined' ? (name + '').replace(/\[/g, '.').replace(/]/g, '').split('.') : [], length = parts.length, current, i, container;
if (!length) {
return obj;
}
current = obj;
for (i = 0; i < length && isContainer(current); i++) {
container = current;
current = container[parts[i]];
}
return current;
}
module.exports = get;
});
/*can-util@3.10.11#js/is-array/is-array*/
define('can-util/js/is-array/is-array', [
'require',
'exports',
'module',
'can-util/js/dev/dev'
], function (require, exports, module) {
'use strict';
var dev = require('can-util/js/dev/dev');
var hasWarned = false;
module.exports = function (arr) {
if (!hasWarned) {
dev.warn('js/is-array/is-array is deprecated; use Array.isArray');
hasWarned = true;
}
return Array.isArray(arr);
};
});
/*can-util@3.10.11#js/string/string*/
define('can-util/js/string/string', [
'require',
'exports',
'module',
'can-util/js/get/get',
'can-util/js/is-container/is-container',
'can-util/js/dev/dev',
'can-util/js/is-array/is-array'
], function (require, exports, module) {
'use strict';
var get = require('can-util/js/get/get');
var isContainer = require('can-util/js/is-container/is-container');
var canDev = require('can-util/js/dev/dev');
var isArray = require('can-util/js/is-array/is-array');
var strUndHash = /_|-/, strColons = /\=\=/, strWords = /([A-Z]+)([A-Z][a-z])/g, strLowUp = /([a-z\d])([A-Z])/g, strDash = /([a-z\d])([A-Z])/g, strReplacer = /\{([^\}]+)\}/g, strQuote = /"/g, strSingleQuote = /'/g, strHyphenMatch = /-+(.)?/g, strCamelMatch = /[a-z][A-Z]/g, convertBadValues = function (content) {
var isInvalid = content === null || content === undefined || isNaN(content) && '' + content === 'NaN';
return '' + (isInvalid ? '' : content);
}, deleteAtPath = function (data, path) {
var parts = path ? path.replace(/\[/g, '.').replace(/]/g, '').split('.') : [];
var current = data;
for (var i = 0; i < parts.length - 1; i++) {
if (current) {
current = current[parts[i]];
}
}
if (current) {
delete current[parts[parts.length - 1]];
}
};
var string = {
esc: function (content) {
return convertBadValues(content).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(strQuote, '"').replace(strSingleQuote, ''');
},
getObject: function (name, roots) {
canDev.warn('string.getObject is deprecated, please use can-util/js/get/get instead.');
roots = isArray(roots) ? roots : [roots || window];
var result, l = roots.length;
for (var i = 0; i < l; i++) {
result = get(roots[i], name);
if (result) {
return result;
}
}
},
capitalize: function (s, cache) {
return s.charAt(0).toUpperCase() + s.slice(1);
},
camelize: function (str) {
return convertBadValues(str).replace(strHyphenMatch, function (match, chr) {
return chr ? chr.toUpperCase() : '';
});
},
hyphenate: function (str) {
return convertBadValues(str).replace(strCamelMatch, function (str, offset) {
return str.charAt(0) + '-' + str.charAt(1).toLowerCase();
});
},
underscore: function (s) {
return s.replace(strColons, '/').replace(strWords, '$1_$2').replace(strLowUp, '$1_$2').replace(strDash, '_').toLowerCase();
},
sub: function (str, data, remove) {
var obs = [];
str = str || '';
obs.push(str.replace(strReplacer, function (whole, inside) {
var ob = get(data, inside);
if (remove === true) {
deleteAtPath(data, inside);
}
if (ob === undefined || ob === null) {
obs = null;
return '';
}
if (isContainer(ob) && obs) {
obs.push(ob);
return '';
}
return '' + ob;
}));
return obs === null ? obs : obs.length <= 1 ? obs[0] : obs;
},
replacer: strReplacer,
undHash: strUndHash
};
module.exports = string;
});
/*can-construct@3.2.1#can-construct*/
define('can-construct', [
'require',
'exports',
'module',
'can-util/js/assign/assign',
'can-util/js/deep-assign/deep-assign',
'can-util/js/dev/dev',
'can-util/js/make-array/make-array',
'can-namespace',
'can-util/js/string/string'
], function (require, exports, module) {
'use strict';
var assign = require('can-util/js/assign/assign');
var deepAssign = require('can-util/js/deep-assign/deep-assign');
var dev = require('can-util/js/dev/dev');
var makeArray = require('can-util/js/make-array/make-array');
var namespace = require('can-namespace');
var CanString = require('can-util/js/string/string');
var reservedWords = {
'abstract': true,
'boolean': true,
'break': true,
'byte': true,
'case': true,
'catch': true,
'char': true,
'class': true,
'const': true,
'continue': true,
'debugger': true,
'default': true,
'delete': true,
'do': true,
'double': true,
'else': true,
'enum': true,
'export': true,
'extends': true,
'false': true,
'final': true,
'finally': true,
'float': true,
'for': true,
'function': true,
'goto': true,
'if': true,
'implements': true,
'import': true,
'in': true,
'instanceof': true,
'int': true,
'interface': true,
'let': true,
'long': true,
'native': true,
'new': true,
'null': true,
'package': true,
'private': true,
'protected': true,
'public': true,
'return': true,
'short': true,
'static': true,
'super': true,
'switch': true,
'synchronized': true,
'this': true,
'throw': true,
'throws': true,
'transient': true,
'true': true,
'try': true,
'typeof': true,
'var': true,
'void': true,
'volatile': true,
'while': true,
'with': true
};
var constructorNameRegex = /[^A-Z0-9_]/gi;
var initializing = 0;
var namedCtor = function (cache) {
return function (name, fn) {
return (name in cache ? cache[name] : cache[name] = new Function('__', 'function ' + name + '(){return __.apply(this,arguments)};return ' + name))(fn);
};
}({});
var Construct = function () {
if (arguments.length) {
return Construct.extend.apply(Construct, arguments);
}
};
var canGetDescriptor;
try {
Object.getOwnPropertyDescriptor({});
canGetDescriptor = true;
} catch (e) {
canGetDescriptor = false;
}
var getDescriptor = function (newProps, name) {
var descriptor = Object.getOwnPropertyDescriptor(newProps, name);
if (descriptor && (descriptor.get || descriptor.set)) {
return descriptor;
}
return null;
}, inheritGetterSetter = function (newProps, oldProps, addTo) {
addTo = addTo || newProps;
var descriptor;
for (var name in newProps) {
if (descriptor = getDescriptor(newProps, name)) {
this._defineProperty(addTo, oldProps, name, descriptor);
} else {
Construct._overwrite(addTo, oldProps, name, newProps[name]);
}
}
}, simpleInherit = function (newProps, oldProps, addTo) {
addTo = addTo || newProps;
for (var name in newProps) {
Construct._overwrite(addTo, oldProps, name, newProps[name]);
}
};
assign(Construct, {
constructorExtends: true,
newInstance: function () {
var inst = this.instance(), args;
if (inst.setup) {
Object.defineProperty(inst, '__inSetup', {
configurable: true,
enumerable: false,
value: true,
writable: true
});
args = inst.setup.apply(inst, arguments);
if (args instanceof Construct.ReturnValue) {
return args.value;
}
inst.__inSetup = false;
}
if (inst.init) {
inst.init.apply(inst, args || arguments);
}
return inst;
},
_inherit: canGetDescriptor ? inheritGetterSetter : simpleInherit,
_defineProperty: function (what, oldProps, propName, descriptor) {
Object.defineProperty(what, propName, descriptor);
},
_overwrite: function (what, oldProps, propName, val) {
Object.defineProperty(what, propName, {
value: val,
configurable: true,
enumerable: true,
writable: true
});
},
setup: function (base) {
this.defaults = deepAssign(true, {}, base.defaults, this.defaults);
},
instance: function () {
initializing = 1;
var inst = new this();
initializing = 0;
return inst;
},
extend: function (name, staticProperties, instanceProperties) {
var shortName = name, klass = staticProperties, proto = instanceProperties;
if (typeof shortName !== 'string') {
proto = klass;
klass = shortName;
shortName = null;
}
if (!proto) {
proto = klass;
klass = null;
}
proto = proto || {};
var _super_class = this, _super = this.prototype, Constructor, prototype;
prototype = this.instance();
Construct._inherit(proto, _super, prototype);
if (shortName) {
} else if (klass && klass.shortName) {
shortName = klass.shortName;
} else if (this.shortName) {
shortName = this.shortName;
}
var constructorName = shortName ? shortName.replace(constructorNameRegex, '_') : 'Constructor';
if (reservedWords[constructorName]) {
constructorName = CanString.capitalize(constructorName);
}
function init() {
if (!initializing) {
if (!this || this.constructor !== Constructor && arguments.length && Constructor.constructorExtends) {
dev.warn('can/construct/construct.js: extending a Construct without calling extend');
}
return (!this || this.constructor !== Constructor) && arguments.length && Constructor.constructorExtends ? Constructor.extend.apply(Constructor, arguments) : Constructor.newInstance.apply(Constructor, arguments);
}
}
Constructor = typeof namedCtor === 'function' ? namedCtor(constructorName, init) : function () {
return init.apply(this, arguments);
};
for (var propName in _super_class) {
if (_super_class.hasOwnProperty(propName)) {
Constructor[propName] = _super_class[propName];
}
}
Construct._inherit(klass, _super_class, Constructor);
assign(Constructor, {
constructor: Constructor,
prototype: prototype
});
if (shortName !== undefined) {
Constructor.shortName = shortName;
}
Constructor.prototype.constructor = Constructor;
var t = [_super_class].concat(makeArray(arguments)), args = Constructor.setup.apply(Constructor, t);
if (Constructor.init) {
Constructor.init.apply(Constructor, args || t);
}
return Constructor;
},
ReturnValue: function (value) {
this.value = value;
}
});
Construct.prototype.setup = function () {
};
Construct.prototype.init = function () {
};
module.exports = namespace.Construct = Construct;
});
/*can-reflect@1.4.5#reflections/helpers*/
define('can-reflect/reflections/helpers', [
'require',
'exports',
'module',
'can-symbol'
], function (require, exports, module) {
var canSymbol = require('can-symbol');
module.exports = {
makeGetFirstSymbolValue: function (symbolNames) {
var symbols = symbolNames.map(function (name) {
return canSymbol.for(name);
});
var length = symbols.length;
return function getFirstSymbol(obj) {
var index = -1;
while (++index < length) {
if (obj[symbols[index]] !== undefined) {
return obj[symbols[index]];
}
}
};
},
hasLength: function (list) {
var type = typeof list;
var length = list && type !== 'boolean' && typeof list !== 'number' && 'length' in list && list.length;
return typeof list !== 'function' && (length === 0 || typeof length === 'number' && length > 0 && length - 1 in list);
}
};
});
/*can-reflect@1.4.5#reflections/type/type*/
define('can-reflect/reflections/type/type', [
'require',
'exports',
'module',
'can-symbol',
'can-reflect/reflections/helpers'
], function (require, exports, module) {
var canSymbol = require('can-symbol');
var helpers = require('can-reflect/reflections/helpers');
var plainFunctionPrototypePropertyNames = Object.getOwnPropertyNames(function () {
}.prototype);
var plainFunctionPrototypeProto = Object.getPrototypeOf(function () {
}.prototype);
function isConstructorLike(func) {
var value = func[canSymbol.for('can.new')];
if (value !== undefined) {
return value;
}
if (typeof func !== 'function') {
return false;
}
var prototype = func.prototype;
if (!prototype) {
return false;
}
if (plainFunctionPrototypeProto !== Object.getPrototypeOf(prototype)) {
return true;
}
var propertyNames = Object.getOwnPropertyNames(prototype);
if (propertyNames.length === plainFunctionPrototypePropertyNames.length) {
for (var i = 0, len = propertyNames.length; i < len; i++) {
if (propertyNames[i] !== plainFunctionPrototypePropertyNames[i]) {
return true;
}
}
return false;
} else {
return true;
}
}
var getNewOrApply = helpers.makeGetFirstSymbolValue([
'can.new',
'can.apply'
]);
function isFunctionLike(obj) {
var result, symbolValue = obj[canSymbol.for('can.isFunctionLike')];
if (symbolValue !== undefined) {
return symbolValue;
}
result = getNewOrApply(obj);
if (result !== undefined) {
return !!result;
}
return typeof obj === 'function';
}
function isPrimitive(obj) {
var type = typeof obj;
if (obj == null || type !== 'function' && type !== 'object') {
return true;
} else {
return false;
}
}
function isBuiltIn(obj) {
if (isPrimitive(obj) || Array.isArray(obj) || isPlainObject(obj) || Object.prototype.toString.call(obj) !== '[object Object]' && Object.prototype.toString.call(obj).indexOf('[object ') !== -1) {
return true;
} else {
return false;
}
}
function isValueLike(obj) {
var symbolValue;
if (isPrimitive(obj)) {
return true;
}
symbolValue = obj[canSymbol.for('can.isValueLike')];
if (typeof symbolValue !== 'undefined') {
return symbolValue;
}
var value = obj[canSymbol.for('can.getValue')];
if (value !== undefined) {
return !!value;
}
}
function isMapLike(obj) {
if (isPrimitive(obj)) {
return false;
}
var isMapLike = obj[canSymbol.for('can.isMapLike')];
if (typeof isMapLike !== 'undefined') {
return !!isMapLike;
}
var value = obj[canSymbol.for('can.getKeyValue')];
if (value !== undefined) {
return !!value;
}
return true;
}
var getObservableLikeSymbol = helpers.makeGetFirstSymbolValue([
'can.onValue',
'can.onKeyValue',
'can.onKeys',
'can.onKeysAdded'
]);
function isObservableLike(obj) {
if (isPrimitive(obj)) {
return false;
}
var result = getObservableLikeSymbol(obj);
if (result !== undefined) {
return !!result;
}
return false;
}
function isListLike(list) {
var symbolValue, type = typeof list;
if (type === 'string') {
return true;
}
if (isPrimitive(list)) {
return false;
}
symbolValue = list[canSymbol.for('can.isListLike')];
if (typeof symbolValue !== 'undefined') {
return symbolValue;
}
var value = list[canSymbol.iterator];
if (value !== undefined) {
return !!value;
}
if (Array.isArray(list)) {
return true;
}
return helpers.hasLength(list);
}
var supportsSymbols = typeof Symbol !== 'undefined' && typeof Symbol.for === 'function';
var isSymbolLike;
if (supportsSymbols) {
isSymbolLike = function (symbol) {
return typeof symbol === 'symbol';
};
} else {
var symbolStart = '@@symbol';
isSymbolLike = function (symbol) {
if (typeof symbol === 'object' && !Array.isArray(symbol)) {
return symbol.toString().substr(0, symbolStart.length) === symbolStart;
} else {
return false;
}
};
}
var coreHasOwn = Object.prototype.hasOwnProperty;
var funcToString = Function.prototype.toString;
var objectCtorString = funcToString.call(Object);
function isPlainObject(obj) {
if (!obj || typeof obj !== 'object') {
return false;
}
var proto = Object.getPrototypeOf(obj);
if (proto === Object.prototype || proto === null) {
return true;
}
var Constructor = coreHasOwn.call(proto, 'constructor') && proto.constructor;
return typeof Constructor === 'function' && Constructor instanceof Constructor && funcToString.call(Constructor) === objectCtorString;
}
module.exports = {
isConstructorLike: isConstructorLike,
isFunctionLike: isFunctionLike,
isListLike: isListLike,
isMapLike: isMapLike,
isObservableLike: isObservableLike,
isPrimitive: isPrimitive,
isBuiltIn: isBuiltIn,
isValueLike: isValueLike,
isSymbolLike: isSymbolLike,
isMoreListLikeThanMapLike: function (obj) {
if (Array.isArray(obj)) {
return true;
}
var value = obj[canSymbol.for('can.isMoreListLikeThanMapLike')];
if (value !== undefined) {
return value;
}
var isListLike = this.isListLike(obj), isMapLike = this.isMapLike(obj);
if (isListLike && !isMapLike) {
return true;
} else if (!isListLike && isMapLike) {
return false;
}
},
isIteratorLike: function (obj) {
return obj && typeof obj === 'object' && typeof obj.next === 'function' && obj.next.length === 0;
},
isPromise: function (obj) {
return obj instanceof Promise || Object.prototype.toString.call(obj) === '[object Promise]';
},
isPlainObject: isPlainObject
};
});
/*can-reflect@1.4.5#reflections/call/call*/
define('can-reflect/reflections/call/call', [
'require',
'exports',
'module',
'can-symbol',
'can-reflect/reflections/type/type'
], function (require, exports, module) {
var canSymbol = require('can-symbol');
var typeReflections = require('can-reflect/reflections/type/type');
module.exports = {
call: function (func, context) {
var args = [].slice.call(arguments, 2);
var apply = func[canSymbol.for('can.apply')];
if (apply) {
return apply.call(func, context, args);
} else {
return func.apply(context, args);
}
},
apply: function (func, context, args) {
var apply = func[canSymbol.for('can.apply')];
if (apply) {
return apply.call(func, context, args);
} else {
return func.apply(context, args);
}
},
'new': function (func) {
var args = [].slice.call(arguments, 1);
var makeNew = func[canSymbol.for('can.new')];
if (makeNew) {
return makeNew.apply(func, args);
} else {
var context = Object.create(func.prototype);
var ret = func.apply(context, args);
if (typeReflections.isPrimitive(ret)) {
return context;
} else {
return ret;
}
}
}
};
});
/*can-reflect@1.4.5#reflections/get-set/get-set*/
define('can-reflect/reflections/get-set/get-set', [
'require',
'exports',
'module',
'can-symbol',
'can-reflect/reflections/type/type'
], function (require, exports, module) {
var canSymbol = require('can-symbol');
var typeReflections = require('can-reflect/reflections/type/type');
var setKeyValueSymbol = canSymbol.for('can.setKeyValue'), getKeyValueSymbol = canSymbol.for('can.getKeyValue'), getValueSymbol = canSymbol.for('can.getValue'), setValueSymbol = canSymbol.for('can.setValue');
var reflections = {
setKeyValue: function (obj, key, value) {
if (typeReflections.isSymbolLike(key)) {
if (typeof key === 'symbol') {
obj[key] = value;
} else {
Object.defineProperty(obj, key, {
enumerable: false,
configurable: true,
value: value,
writable: true
});
}
return;
}
var setKeyValue = obj[setKeyValueSymbol];
if (setKeyValue !== undefined) {
return setKeyValue.call(obj, key, value);
} else {
obj[key] = value;
}
},
getKeyValue: function (obj, key) {
var getKeyValue = obj[getKeyValueSymbol];
if (getKeyValue) {
return getKeyValue.call(obj, key);
}
return obj[key];
},
deleteKeyValue: function (obj, key) {
var deleteKeyValue = obj[canSymbol.for('can.deleteKeyValue')];
if (deleteKeyValue) {
return deleteKeyValue.call(obj, key);
}
delete obj[key];
},
getValue: function (value) {
if (typeReflections.isPrimitive(value)) {
return value;
}
var getValue = value[getValueSymbol];
if (getValue) {
return getValue.call(value);
}
return value;
},
setValue: function (item, value) {
var setValue = item && item[setValueSymbol];
if (setValue) {
return setValue.call(item, value);
} else {
throw new Error('can-reflect.setValue - Can not set value.');
}
},
splice: function (obj, index, removing, adding) {
var howMany;
if (typeof removing !== 'number') {
var updateValues = obj[canSymbol.for('can.updateValues')];
if (updateValues) {
return updateValues.call(obj, index, removing, adding);
}
howMany = removing.length;
} else {
howMany = removing;
}
var splice = obj[canSymbol.for('can.splice')];
if (splice) {
return splice.call(obj, index, howMany, adding);
}
return [].splice.apply(obj, [
index,
howMany
].concat(adding));
},
addValues: function (obj, adding, index) {
var add = obj[canSymbol.for('can.addValues')];
if (add) {
return add.call(obj, adding, index);
}
if (Array.isArray(obj) && index === undefined) {
return obj.push.apply(obj, adding);
}
return reflections.splice(obj, index, [], adding);
},
removeValues: function (obj, removing, index) {
var removeValues = obj[canSymbol.for('can.removeValues')];
if (removeValues) {
return removeValues.call(obj, removing, index);
}
if (Array.isArray(obj) && index === undefined) {
removing.forEach(function (item) {
var index = obj.indexOf(item);
if (index >= 0) {
obj.splice(index, 1);
}
});
return;
}
return reflections.splice(obj, index, removing, []);
}
};
reflections.get = reflections.getKeyValue;
reflections.set = reflections.setKeyValue;
reflections['delete'] = reflections.deleteKeyValue;
module.exports = reflections;
});
/*can-reflect@1.4.5#reflections/observe/observe*/
define('can-reflect/reflections/observe/observe', [
'require',
'exports',
'module',
'can-symbol'
], function (require, exports, module) {
var canSymbol = require('can-symbol');
var slice = [].slice;
function makeFallback(symbolName, fallbackName) {
return function (obj, event, handler, queueName) {
var method = obj[canSymbol.for(symbolName)];
if (method !== undefined) {
return method.call(obj, event, handler, queueName);
}
return this[fallbackName].apply(this, arguments);
};
}
function makeErrorIfMissing(symbolName, errorMessage) {
return function (obj) {
var method = obj[canSymbol.for(symbolName)];
if (method !== undefined) {
var args = slice.call(arguments, 1);
return method.apply(obj, args);
}
throw new Error(errorMessage);
};
}
module.exports = {
onKeyValue: makeFallback('can.onKeyValue', 'onEvent'),
offKeyValue: makeFallback('can.offKeyValue', 'offEvent'),
onKeys: makeErrorIfMissing('can.onKeys', 'can-reflect: can not observe an onKeys event'),
onKeysAdded: makeErrorIfMissing('can.onKeysAdded', 'can-reflect: can not observe an onKeysAdded event'),
onKeysRemoved: makeErrorIfMissing('can.onKeysRemoved', 'can-reflect: can not unobserve an onKeysRemoved event'),
getKeyDependencies: makeErrorIfMissing('can.getKeyDependencies', 'can-reflect: can not determine dependencies'),
keyHasDependencies: makeErrorIfMissing('can.keyHasDependencies', 'can-reflect: can not determine if this has key dependencies'),
onValue: makeErrorIfMissing('can.onValue', 'can-reflect: can not observe value change'),
offValue: makeErrorIfMissing('can.offValue', 'can-reflect: can not unobserve value change'),
getValueDependencies: makeErrorIfMissing('can.getValueDependencies', 'can-reflect: can not determine dependencies'),
valueHasDependencies: makeErrorIfMissing('can.valueHasDependencies', 'can-reflect: can not determine if value has dependencies'),
onEvent: function (obj, eventName, callback, queue) {
if (obj) {
var onEvent = obj[canSymbol.for('can.onEvent')];
if (onEvent !== undefined) {
return onEvent.call(obj, eventName, callback, queue);
} else if (obj.addEventListener) {
obj.addEventListener(eventName, callback, queue);
}
}
},
offEvent: function (obj, eventName, callback, queue) {
if (obj) {
var offEvent = obj[canSymbol.for('can.offEvent')];
if (offEvent !== undefined) {
return offEvent.call(obj, eventName, callback, queue);
} else if (obj.removeEventListener) {
obj.removeEventListener(eventName, callback, queue);
}
}
}
};
});
/*can-reflect@1.4.5#reflections/shape/shape*/
define('can-reflect/reflections/shape/shape', [
'require',
'exports',
'module',
'can-symbol',
'can-reflect/reflections/get-set/get-set',
'can-reflect/reflections/type/type',
'can-reflect/reflections/helpers'
], function (require, exports, module) {
var canSymbol = require('can-symbol');
var getSetReflections = require('can-reflect/reflections/get-set/get-set');
var typeReflections = require('can-reflect/reflections/type/type');
var helpers = require('can-reflect/reflections/helpers');
var shapeReflections;
var shiftFirstArgumentToThis = function (func) {
return function () {
var args = [this];
args.push.apply(args, arguments);
return func.apply(null, args);
};
};
var getKeyValueSymbol = canSymbol.for('can.getKeyValue');
var shiftedGetKeyValue = shiftFirstArgumentToThis(getSetReflections.getKeyValue);
var setKeyValueSymbol = canSymbol.for('can.setKeyValue');
var shiftedSetKeyValue = shiftFirstArgumentToThis(getSetReflections.setKeyValue);
var sizeSymbol = canSymbol.for('can.size');
var serializeMap = null;
var hasUpdateSymbol = helpers.makeGetFirstSymbolValue([
'can.updateDeep',
'can.assignDeep',
'can.setKeyValue'
]);
var shouldUpdateOrAssign = function (obj) {
return typeReflections.isPlainObject(obj) || Array.isArray(obj) || !!hasUpdateSymbol(obj);
};
function isSerializable(obj) {
if (typeReflections.isPrimitive(obj)) {
return true;
}
if (hasUpdateSymbol(obj)) {
return false;
}
return typeReflections.isBuiltIn(obj) && !typeReflections.isPlainObject(obj);
}
var Object_Keys;
try {
Object.keys(1);
Object_Keys = Object.keys;
} catch (e) {
Object_Keys = function (obj) {
if (typeReflections.isPrimitive(obj)) {
return [];
} else {
return Object.keys(obj);
}
};
}
function makeSerializer(methodName, symbolsToCheck) {
return function serializer(value, MapType) {
if (isSerializable(value)) {
return value;
}
var firstSerialize;
if (MapType && !serializeMap) {
serializeMap = {
unwrap: new MapType(),
serialize: new MapType()
};
firstSerialize = true;
}
var serialized;
if (typeReflections.isValueLike(value)) {
serialized = this[methodName](getSetReflections.getValue(value));
} else {
var isListLike = typeReflections.isIteratorLike(value) || typeReflections.isMoreListLikeThanMapLike(value);
serialized = isListLike ? [] : {};
if (serializeMap) {
if (serializeMap[methodName].has(value)) {
return serializeMap[methodName].get(value);
} else {
serializeMap[methodName].set(value, serialized);
}
}
for (var i = 0, len = symbolsToCheck.length; i < len; i++) {
var serializer = value[symbolsToCheck[i]];
if (serializer) {
var result = serializer.call(value, serialized);
if (firstSerialize) {
serializeMap = null;
}
return result;
}
}
if (typeof obj === 'function') {
if (serializeMap) {
serializeMap[methodName].set(value, value);
}
serialized = value;
} else if (isListLike) {
this.eachIndex(value, function (childValue, index) {
serialized[index] = this[methodName](childValue);
}, this);
} else {
this.eachKey(value, function (childValue, prop) {
serialized[prop] = this[methodName](childValue);
}, this);
}
}
if (firstSerialize) {
serializeMap = null;
}
return serialized;
};
}
var makeMap;
if (typeof Map !== 'undefined') {
makeMap = function (keys) {
var map = new Map();
shapeReflections.eachIndex(keys, function (key) {
map.set(key, true);
});
return map;
};
} else {
makeMap = function (keys) {
var map = {};
keys.forEach(function (key) {
map[key] = true;
});
return {
get: function (key) {
return map[key];
},
set: function (key, value) {
map[key] = value;
},
keys: function () {
return keys;
}
};
};
}
var fastHasOwnKey = function (obj) {
var hasOwnKey = obj[canSymbol.for('can.hasOwnKey')];
if (hasOwnKey) {
return hasOwnKey.bind(obj);
} else {
var map = makeMap(shapeReflections.getOwnEnumerableKeys(obj));
return function (key) {
return map.get(key);
};
}
};
function addPatch(patches, patch) {
var lastPatch = patches[patches.length - 1];
if (lastPatch) {
if (lastPatch.deleteCount === lastPatch.insert.length && patch.index - lastPatch.index === lastPatch.deleteCount) {
lastPatch.insert.push.apply(lastPatch.insert, patch.insert);
lastPatch.deleteCount += patch.deleteCount;
return;
}
}
patches.push(patch);
}
function updateDeepList(target, source, isAssign) {
var sourceArray = this.toArray(source);
var patches = [], lastIndex = -1;
this.eachIndex(target, function (curVal, index) {
lastIndex = index;
if (index >= sourceArray.length) {
if (!isAssign) {
addPatch(patches, {
index: index,
deleteCount: sourceArray.length - index + 1,
insert: []
});
}
return false;
}
var newVal = sourceArray[index];
if (typeReflections.isPrimitive(curVal) || typeReflections.isPrimitive(newVal) || shouldUpdateOrAssign(curVal) === false) {
addPatch(patches, {
index: index,
deleteCount: 1,
insert: [newVal]
});
} else {
this.updateDeep(curVal, newVal);
}
}, this);
if (sourceArray.length > lastIndex) {
addPatch(patches, {
index: lastIndex + 1,
deleteCount: 0,
insert: sourceArray.slice(lastIndex + 1)
});
}
for (var i = 0, patchLen = patches.length; i < patchLen; i++) {
var patch = patches[i];
getSetReflections.splice(target, patch.index, patch.deleteCount, patch.insert);
}
return target;
}
shapeReflections = {
each: function (obj, callback, context) {
if (typeReflections.isIteratorLike(obj) || typeReflections.isMoreListLikeThanMapLike(obj)) {
return this.eachIndex(obj, callback, context);
} else {
return this.eachKey(obj, callback, context);
}
},
eachIndex: function (list, callback, context) {
if (Array.isArray(list)) {
return this.eachListLike(list, callback, context);
} else {
var iter, iterator = list[canSymbol.iterator];
if (typeReflections.isIteratorLike(list)) {
iter = list;
} else if (iterator) {
iter = iterator.call(list);
}
if (iter) {
var res, index = 0;
while (!(res = iter.next()).done) {
if (callback.call(context || list, res.value, index++, list) === false) {
break;
}
}
} else {
this.eachListLike(list, callback, context);
}
}
return list;
},
eachListLike: function (list, callback, context) {
var index = -1;
var length = list.length;
if (length === undefined) {
var size = list[sizeSymbol];
if (size) {
length = size.call(list);
} else {
throw new Error('can-reflect: unable to iterate.');
}
}
while (++index < length) {
var item = list[index];
if (callback.call(context || item, item, index, list) === false) {
break;
}
}
return list;
},
toArray: function (obj) {
var arr = [];
this.each(obj, function (value) {
arr.push(value);
});
return arr;
},
eachKey: function (obj, callback, context) {
if (obj) {
var enumerableKeys = this.getOwnEnumerableKeys(obj);
var getKeyValue = obj[getKeyValueSymbol] || shiftedGetKeyValue;
return this.eachIndex(enumerableKeys, function (key) {
var value = getKeyValue.call(obj, key);
return callback.call(context || obj, value, key, obj);
});
}
return obj;
},
'hasOwnKey': function (obj, key) {
var hasOwnKey = obj[canSymbol.for('can.hasOwnKey')];
if (hasOwnKey) {
return hasOwnKey.call(obj, key);
}
var getOwnKeys = obj[canSymbol.for('can.getOwnKeys')];
if (getOwnKeys) {
var found = false;
this.eachIndex(getOwnKeys.call(obj), function (objKey) {
if (objKey === key) {
found = true;
return false;
}
});
return found;
}
return obj.hasOwnProperty(key);
},
getOwnEnumerableKeys: function (obj) {
var getOwnEnumerableKeys = obj[canSymbol.for('can.getOwnEnumerableKeys')];
if (getOwnEnumerableKeys) {
return getOwnEnumerableKeys.call(obj);
}
if (obj[canSymbol.for('can.getOwnKeys')] && obj[canSymbol.for('can.getOwnKeyDescriptor')]) {
var keys = [];
this.eachIndex(this.getOwnKeys(obj), function (key) {
var descriptor = this.getOwnKeyDescriptor(obj, key);
if (descriptor.enumerable) {
keys.push(key);
}
}, this);
return keys;
} else {
return Object_Keys(obj);
}
},
getOwnKeys: function (obj) {
var getOwnKeys = obj[canSymbol.for('can.getOwnKeys')];
if (getOwnKeys) {
return getOwnKeys.call(obj);
} else {
return Object.getOwnPropertyNames(obj);
}
},
getOwnKeyDescriptor: function (obj, key) {
var getOwnKeyDescriptor = obj[canSymbol.for('can.getOwnKeyDescriptor')];
if (getOwnKeyDescriptor) {
return getOwnKeyDescriptor.call(obj, key);
} else {
return Object.getOwnPropertyDescriptor(obj, key);
}
},
unwrap: makeSerializer('unwrap', [canSymbol.for('can.unwrap')]),
serialize: makeSerializer('serialize', [
canSymbol.for('can.serialize'),
canSymbol.for('can.unwrap')
]),
assignMap: function (target, source) {
var hasOwnKey = fastHasOwnKey(target);
var getKeyValue = target[getKeyValueSymbol] || shiftedGetKeyValue;
var setKeyValue = target[setKeyValueSymbol] || shiftedSetKeyValue;
this.eachKey(source, function (value, key) {
if (!hasOwnKey(key) || getKeyValue.call(target, key) !== value) {
setKeyValue.call(target, key, value);
}
});
return target;
},
assignList: function (target, source) {
var inserting = this.toArray(source);
getSetReflections.splice(target, 0, inserting, inserting);
return target;
},
assign: function (target, source) {
if (typeReflections.isIteratorLike(source) || typeReflections.isMoreListLikeThanMapLike(source)) {
this.assignList(target, source);
} else {
this.assignMap(target, source);
}
return target;
},
assignDeepMap: function (target, source) {
var hasOwnKey = fastHasOwnKey(target);
var getKeyValue = target[getKeyValueSymbol] || shiftedGetKeyValue;
var setKeyValue = target[setKeyValueSymbol] || shiftedSetKeyValue;
this.eachKey(source, function (newVal, key) {
if (!hasOwnKey(key)) {
getSetReflections.setKeyValue(target, key, newVal);
} else {
var curVal = getKeyValue.call(target, key);
if (newVal === curVal) {
} else if (typeReflections.isPrimitive(curVal) || typeReflections.isPrimitive(newVal) || shouldUpdateOrAssign(curVal) === false) {
setKeyValue.call(target, key, newVal);
} else {
this.assignDeep(curVal, newVal);
}
}
}, this);
return target;
},
assignDeepList: function (target, source) {
return updateDeepList.call(this, target, source, true);
},
assignDeep: function (target, source) {
var assignDeep = target[canSymbol.for('can.assignDeep')];
if (assignDeep) {
assignDeep.call(target, source);
} else if (typeReflections.isMoreListLikeThanMapLike(source)) {
this.assignDeepList(target, source);
} else {
this.assignDeepMap(target, source);
}
return target;
},
updateMap: function (target, source) {
var sourceKeyMap = makeMap(this.getOwnEnumerableKeys(source));
var sourceGetKeyValue = source[getKeyValueSymbol] || shiftedGetKeyValue;
var targetSetKeyValue = target[setKeyValueSymbol] || shiftedSetKeyValue;
this.eachKey(target, function (curVal, key) {
if (!sourceKeyMap.get(key)) {
getSetReflections.deleteKeyValue(target, key);
return;
}
sourceKeyMap.set(key, false);
var newVal = sourceGetKeyValue.call(source, key);
if (newVal !== curVal) {
targetSetKeyValue.call(target, key, newVal);
}
}, this);
this.eachIndex(sourceKeyMap.keys(), function (key) {
if (sourceKeyMap.get(key)) {
targetSetKeyValue.call(target, key, sourceGetKeyValue.call(source, key));
}
});
return target;
},
updateList: function (target, source) {
var inserting = this.toArray(source);
getSetReflections.splice(target, 0, target, inserting);
return target;
},
update: function (target, source) {
if (typeReflections.isIteratorLike(source) || typeReflections.isMoreListLikeThanMapLike(source)) {
this.updateList(target, source);
} else {
this.updateMap(target, source);
}
return target;
},
updateDeepMap: function (target, source) {
var sourceKeyMap = makeMap(this.getOwnEnumerableKeys(source));
var sourceGetKeyValue = source[getKeyValueSymbol] || shiftedGetKeyValue;
var targetSetKeyValue = target[setKeyValueSymbol] || shiftedSetKeyValue;
this.eachKey(target, function (curVal, key) {
if (!sourceKeyMap.get(key)) {
getSetReflections.deleteKeyValue(target, key);
return;
}
sourceKeyMap.set(key, false);
var newVal = sourceGetKeyValue.call(source, key);
if (typeReflections.isPrimitive(curVal) || typeReflections.isPrimitive(newVal) || shouldUpdateOrAssign(curVal) === false) {
targetSetKeyValue.call(target, key, newVal);
} else {
this.updateDeep(curVal, newVal);
}
}, this);
this.eachIndex(sourceKeyMap.keys(), function (key) {
if (sourceKeyMap.get(key)) {
targetSetKeyValue.call(target, key, sourceGetKeyValue.call(source, key));
}
});
return target;
},
updateDeepList: function (target, source) {
return updateDeepList.call(this, target, source);
},
updateDeep: function (target, source) {
var updateDeep = target[canSymbol.for('can.updateDeep')];
if (updateDeep) {
updateDeep.call(target, source);
} else if (typeReflections.isMoreListLikeThanMapLike(source)) {
this.updateDeepList(target, source);
} else {
this.updateDeepMap(target, source);
}
return target;
},
'in': function () {
},
getAllEnumerableKeys: function () {
},
getAllKeys: function () {
},
assignSymbols: function (target, source) {
this.eachKey(source, function (value, key) {
getSetReflections.setKeyValue(target, canSymbol.for(key), value);
});
return target;
},
isSerializable: isSerializable,
size: function (obj) {
var size = obj[sizeSymbol];
var count = 0;
if (size) {
return size.call(obj);
} else if (helpers.hasLength(obj)) {
return obj.length;
} else if (typeReflections.isListLike(obj)) {
this.each(obj, function () {
count++;
});
return count;
} else if (obj) {
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
count++;
}
}
return count;
} else {
return undefined;
}
}
};
shapeReflections.keys = shapeReflections.getOwnEnumerableKeys;
module.exports = shapeReflections;
});
/*can-reflect@1.4.5#types/map*/
define('can-reflect/types/map', [
'require',
'exports',
'module',
'can-reflect/reflections/shape/shape',
'can-symbol'
], function (require, exports, module) {
var shape = require('can-reflect/reflections/shape/shape');
var CanSymbol = require('can-symbol');
function keysPolyfill() {
var keys = [];
var currentIndex = 0;
this.forEach(function (val, key) {
keys.push(key);
});
return {
next: function () {
return {
value: keys[currentIndex],
done: currentIndex++ === keys.length
};
}
};
}
if (typeof Map !== 'undefined') {
shape.assignSymbols(Map.prototype, {
'can.getOwnEnumerableKeys': Map.prototype.keys,
'can.setKeyValue': Map.prototype.set,
'can.getKeyValue': Map.prototype.get,
'can.deleteKeyValue': Map.prototype['delete'],
'can.hasOwnKey': Map.prototype.has
});
if (typeof Map.prototype.keys !== 'function') {
Map.prototype.keys = Map.prototype[CanSymbol.for('can.getOwnEnumerableKeys')] = keysPolyfill;
}
}
if (typeof WeakMap !== 'undefined') {
shape.assignSymbols(WeakMap.prototype, {
'can.getOwnEnumerableKeys': function () {
throw new Error('can-reflect: WeakMaps do not have enumerable keys.');
},
'can.setKeyValue': WeakMap.prototype.set,
'can.getKeyValue': WeakMap.prototype.get,
'can.deleteKeyValue': WeakMap.prototype['delete'],
'can.hasOwnKey': WeakMap.prototype.has
});
}
});
/*can-reflect@1.4.5#types/set*/
define('can-reflect/types/set', [
'require',
'exports',
'module',
'can-reflect/reflections/shape/shape',
'can-symbol'
], function (require, exports, module) {
var shape = require('can-reflect/reflections/shape/shape');
var CanSymbol = require('can-symbol');
if (typeof Set !== 'undefined') {
shape.assignSymbols(Set.prototype, {
'can.isMoreListLikeThanMapLike': true,
'can.updateValues': function (index, removing, adding) {
if (removing !== adding) {
shape.each(removing, function (value) {
this.delete(value);
}, this);
}
shape.each(adding, function (value) {
this.add(value);
}, this);
},
'can.size': function () {
return this.size;
}
});
if (typeof Set.prototype[CanSymbol.iterator] !== 'function') {
Set.prototype[CanSymbol.iterator] = function () {
var arr = [];
var currentIndex = 0;
this.forEach(function (val) {
arr.push(val);
});
return {
next: function () {
return {
value: arr[currentIndex],
done: currentIndex++ === arr.length
};
}
};
};
}
}
if (typeof WeakSet !== 'undefined') {
shape.assignSymbols(WeakSet.prototype, {
'can.isListLike': true,
'can.isMoreListLikeThanMapLike': true,
'can.updateValues': function (index, removing, adding) {
if (removing !== adding) {
shape.each(removing, function (value) {
this.delete(value);
}, this);
}
shape.each(adding, function (value) {
this.add(value);
}, this);
},
'can.size': function () {
throw new Error('can-reflect: WeakSets do not have enumerable keys.');
}
});
}
});
/*can-reflect@1.4.5#can-reflect*/
define('can-reflect', [
'require',
'exports',
'module',
'can-reflect/reflections/call/call',
'can-reflect/reflections/get-set/get-set',
'can-reflect/reflections/observe/observe',
'can-reflect/reflections/shape/shape',
'can-reflect/reflections/type/type',
'can-namespace',
'can-reflect/types/map',
'can-reflect/types/set'
], function (require, exports, module) {
var functionReflections = require('can-reflect/reflections/call/call');
var getSet = require('can-reflect/reflections/get-set/get-set');
var observe = require('can-reflect/reflections/observe/observe');
var shape = require('can-reflect/reflections/shape/shape');
var type = require('can-reflect/reflections/type/type');
var namespace = require('can-namespace');
var reflect = {};
[
functionReflections,
getSet,
observe,
shape,
type
].forEach(function (reflections) {
for (var prop in reflections) {
reflect[prop] = reflections[prop];
}
});
require('can-reflect/types/map');
require('can-reflect/types/set');
module.exports = namespace.Reflect = reflect;
});
/*can-log@0.1.0#can-log*/
define('can-log', function (require, exports, module) {
'use strict';
exports.warnTimeout = 5000;
exports.logLevel = 0;
exports.warn = function (out) {
var ll = this.logLevel;
if (ll < 2) {
Array.prototype.unshift.call(arguments, 'WARN:');
if (typeof console !== 'undefined' && console.warn) {
this._logger('warn', Array.prototype.slice.call(arguments));
} else if (typeof console !== 'undefined' && console.log) {
this._logger('log', Array.prototype.slice.call(arguments));
} else if (window && window.opera && window.opera.postError) {
window.opera.postError('CanJS WARNING: ' + out);
}
}
};
exports.log = function (out) {
var ll = this.logLevel;
if (ll < 1) {
if (typeof console !== 'undefined' && console.log) {
Array.prototype.unshift.call(arguments, 'INFO:');
this._logger('log', Array.prototype.slice.call(arguments));
} else if (window && window.opera && window.opera.postError) {
window.opera.postError('CanJS INFO: ' + out);
}
}
};
exports.error = function (out) {
var ll = this.logLevel;
if (ll < 1) {
if (typeof console !== 'undefined' && console.error) {
Array.prototype.unshift.call(arguments, 'ERROR:');
this._logger('error', Array.prototype.slice.call(arguments));
} else if (window && window.opera && window.opera.postError) {
window.opera.postError('ERROR: ' + out);
}
}
};
exports._logger = function (type, arr) {
try {
console[type].apply(console, arr);
} catch (e) {
console[type](arr);
}
};
});
/*can-log@0.1.0#dev/dev*/
define('can-log/dev/dev', [
'require',
'exports',
'module',
'can-log'
], function (require, exports, module) {
'use strict';
var canLog = require('can-log');
module.exports = {
warnTimeout: 5000,
logLevel: 0,
stringify: function (value) {
var flagUndefined = function flagUndefined(key, value) {
return value === undefined ? '/* void(undefined) */' : value;
};
return JSON.stringify(value, flagUndefined, ' ').replace(/"\/\* void\(undefined\) \*\/"/g, 'undefined');
},
warn: function () {
canLog.warn.apply(this, arguments);
},
log: function () {
canLog.log.apply(this, arguments);
},
error: function () {
canLog.error.apply(this, arguments);
},
_logger: canLog._logger
};
});
/*can-types@1.1.3#can-types*/
define('can-types', [
'require',
'exports',
'module',
'can-namespace',
'can-reflect',
'can-symbol',
'can-log/dev/dev'
], function (require, exports, module) {
var namespace = require('can-namespace');
var canReflect = require('can-reflect');
var canSymbol = require('can-symbol');
var dev = require('can-log/dev/dev');
var types = {
isMapLike: function (obj) {
dev.warn('can-types.isMapLike(obj) is deprecated, please use `canReflect.isObservableLike(obj) && canReflect.isMapLike(obj)` instead.');
return canReflect.isObservableLike(obj) && canReflect.isMapLike(obj);
},
isListLike: function (obj) {
dev.warn('can-types.isListLike(obj) is deprecated, please use `canReflect.isObservableLike(obj) && canReflect.isListLike(obj)` instead.');
return canReflect.isObservableLike(obj) && canReflect.isListLike(obj);
},
isPromise: function (obj) {
dev.warn('can-types.isPromise is deprecated, please use canReflect.isPromise instead.');
return canReflect.isPromise(obj);
},
isConstructor: function (func) {
dev.warn('can-types.isConstructor is deprecated, please use canReflect.isConstructorLike instead.');
return canReflect.isConstructorLike(func);
},
isCallableForValue: function (obj) {
dev.warn('can-types.isCallableForValue(obj) is deprecated, please use `canReflect.isFunctionLike(obj) && !canReflect.isConstructorLike(obj)` instead.');
return obj && canReflect.isFunctionLike(obj) && !canReflect.isConstructorLike(obj);
},
isCompute: function (obj) {
dev.warn('can-types.isCompute is deprecated.');
return obj && obj.isComputed;
},
get iterator() {
dev.warn('can-types.iterator is deprecated, use `canSymbol.iterator || canSymbol.for("iterator")` instead.');
return canSymbol.iterator || canSymbol.for('iterator');
},
DefaultMap: null,
DefaultList: null,
queueTask: function (task) {
var args = task[2] || [];
task[0].apply(task[1], args);
},
wrapElement: function (element) {
return element;
},
unwrapElement: function (element) {
return element;
}
};
if (namespace.types) {
throw new Error('You can\'t have two versions of can-types, check your dependencies');
} else {
module.exports = namespace.types = types;
}
});
/*can-cid@1.1.1#can-cid*/
define('can-cid', [
'require',
'exports',
'module',
'can-namespace'
], function (require, exports, module) {
var namespace = require('can-namespace');
var _cid = 0;
var domExpando = 'can' + new Date();
var cid = function (object, name) {
var propertyName = object.nodeName ? domExpando : '_cid';
if (!object[propertyName]) {
_cid++;
object[propertyName] = (name || '') + _cid;
}
return object[propertyName];
};
cid.domExpando = domExpando;
cid.get = function (object) {
var type = typeof object;
var isObject = type !== null && (type === 'object' || type === 'function');
return isObject ? cid(object) : type + ':' + object;
};
if (namespace.cid) {
throw new Error('You can\'t have two versions of can-cid, check your dependencies');
} else {
module.exports = namespace.cid = cid;
}
});
/*can-dom-data-state@0.1.1#can-dom-data-state*/
define('can-dom-data-state', [
'require',
'exports',
'module',
'can-namespace',
'can-cid'
], function (require, exports, module) {
'use strict';
var namespace = require('can-namespace');
var CID = require('can-cid');
var data = {};
var isEmptyObject = function (obj) {
for (var prop in obj) {
return false;
}
return true;
};
var setData = function (name, value) {
var id = CID(this), store = data[id], newStore = false;
if (!data[id]) {
newStore = true;
store = data[id] = {};
}
if (name !== undefined) {
store[name] = value;
}
return newStore;
};
var deleteNode = function () {
var id = CID.get(this);
var nodeDeleted = false;
if (id && data[id]) {
nodeDeleted = true;
delete data[id];
}
return nodeDeleted;
};
var domDataState = {
_data: data,
getCid: function () {
return CID.get(this);
},
cid: function () {
return CID(this);
},
expando: CID.domExpando,
get: function (key) {
var id = CID.get(this), store = id && data[id];
return key === undefined ? store || setData(this) : store && store[key];
},
set: setData,
clean: function (prop) {
var id = CID.get(this);
var itemData = data[id];
if (itemData && itemData[prop]) {
delete itemData[prop];
}
if (isEmptyObject(itemData)) {
deleteNode.call(this);
}
},
delete: deleteNode
};
if (namespace.domDataState) {
throw new Error('You can\'t have two versions of can-dom-data-state, check your dependencies');
} else {
module.exports = namespace.domDataState = domDataState;
}
});
/*can-globals@0.2.3#can-globals-proto*/
define('can-globals/can-globals-proto', [
'require',
'exports',
'module',
'can-reflect'
], function (require, exports, module) {
(function (global) {
'use strict';
var canReflect = require('can-reflect');
function dispatch(key, value) {
var handlers = this.eventHandlers[key];
if (handlers) {
var handlersCopy = handlers.slice();
for (var i = 0; i < handlersCopy.length; i++) {
handlersCopy[i](value);
}
}
}
function Globals() {
this.eventHandlers = {};
this.properties = {};
}
Globals.prototype.define = function (key, value, enableCache) {
if (enableCache === undefined) {
enableCache = true;
}
if (!this.properties[key]) {
this.properties[key] = {
default: value,
value: value,
enableCache: enableCache
};
}
return this;
};
Globals.prototype.getKeyValue = function (key) {
var property = this.properties[key];
if (property) {
if (typeof property.value === 'function') {
if (property.cachedValue) {
return property.cachedValue;
}
if (property.enableCache) {
property.cachedValue = property.value();
return property.cachedValue;
} else {
return property.value();
}
}
return property.value;
}
};
Globals.prototype.makeExport = function (key) {
return function (value) {
if (arguments.length === 0) {
return this.getKeyValue(key);
}
if (typeof value === 'undefined' || value === null) {
this.deleteKeyValue(key);
} else {
if (typeof value === 'function') {
this.setKeyValue(key, function () {
return value;
});
} else {
this.setKeyValue(key, value);
}
return value;
}
}.bind(this);
};
Globals.prototype.offKeyValue = function (key, handler) {
if (this.properties[key]) {
var handlers = this.eventHandlers[key];
if (handlers) {
var i = handlers.indexOf(handler);
handlers.splice(i, 1);
}
}
return this;
};
Globals.prototype.onKeyValue = function (key, handler) {
if (this.properties[key]) {
if (!this.eventHandlers[key]) {
this.eventHandlers[key] = [];
}
this.eventHandlers[key].push(handler);
}
return this;
};
Globals.prototype.deleteKeyValue = function (key) {
var property = this.properties[key];
if (property !== undefined) {
property.value = property.default;
property.cachedValue = undefined;
dispatch.call(this, key, property.value);
}
return this;
};
Globals.prototype.setKeyValue = function (key, value) {
if (!this.properties[key]) {
return this.define(key, value);
}
var property = this.properties[key];
property.value = value;
property.cachedValue = undefined;
dispatch.call(this, key, value);
return this;
};
Globals.prototype.reset = function () {
for (var key in this.properties) {
if (this.properties.hasOwnProperty(key)) {
this.properties[key].cachedValue = undefined;
dispatch.call(this, key, this.getKeyValue(key));
}
}
return this;
};
canReflect.assignSymbols(Globals.prototype, {
'can.getKeyValue': Globals.prototype.getKeyValue,
'can.setKeyValue': Globals.prototype.setKeyValue,
'can.deleteKeyValue': Globals.prototype.deleteKeyValue,
'can.onKeyValue': Globals.prototype.onKeyValue,
'can.offKeyValue': Globals.prototype.offKeyValue
});
module.exports = Globals;
}(function () {
return this;
}()));
});
/*can-globals@0.2.3#can-globals-instance*/
define('can-globals/can-globals-instance', [
'require',
'exports',
'module',
'can-namespace',
'can-globals/can-globals-proto'
], function (require, exports, module) {
(function (global) {
'use strict';
var namespace = require('can-namespace');
var Globals = require('can-globals/can-globals-proto');
var globals = new Globals();
if (namespace.globals) {
throw new Error('You can\'t have two versions of can-globals, check your dependencies');
} else {
module.exports = namespace.globals = globals;
}
module.exports = globals;
}(function () {
return this;
}()));
});
/*can-globals@0.2.3#global/global*/
define('can-globals/global/global', [
'require',
'exports',
'module',
'can-globals/can-globals-instance'
], function (require, exports, module) {
(function (global) {
'use strict';
var globals = require('can-globals/can-globals-instance');
globals.define('global', function () {
return typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope ? self : typeof process === 'object' && {}.toString.call(process) === '[object process]' ? global : window;
});
module.exports = globals.makeExport('global');
}(function () {
return this;
}()));
});
/*can-globals@0.2.3#document/document*/
define('can-globals/document/document', [
'require',
'exports',
'module',
'can-globals/global/global',
'can-globals/can-globals-instance'
], function (require, exports, module) {
(function (global) {
'use strict';
require('can-globals/global/global');
var globals = require('can-globals/can-globals-instance');
globals.define('document', function () {
return globals.getKeyValue('global').document;
});
module.exports = globals.makeExport('document');
}(function () {
return this;
}()));
});
/*can-globals@0.2.3#mutation-observer/mutation-observer*/
define('can-globals/mutation-observer/mutation-observer', [
'require',
'exports',
'module',
'can-globals/global/global',
'can-globals/can-globals-instance'
], function (require, exports, module) {
(function (global) {
'use strict';
require('can-globals/global/global');
var globals = require('can-globals/can-globals-instance');
globals.define('MutationObserver', function () {
var GLOBAL = globals.getKeyValue('global');
return GLOBAL.MutationObserver || GLOBAL.WebKitMutationObserver || GLOBAL.MozMutationObserver;
});
module.exports = globals.makeExport('MutationObserver');
}(function () {
return this;
}()));
});
/*can-cid@1.1.1#helpers*/
define('can-cid/helpers', function (require, exports, module) {
module.exports = {
each: function (obj, cb, context) {
for (var prop in obj) {
cb.call(context, obj[prop], prop);
}
return obj;
}
};
});
/*can-cid@1.1.1#set/set*/
define('can-cid/set/set', [
'require',
'exports',
'module',
'can-cid',
'can-cid/helpers'
], function (require, exports, module) {
'use strict';
var getCID = require('can-cid').get;
var helpers = require('can-cid/helpers');
var CIDSet;
if (typeof Set !== 'undefined') {
CIDSet = Set;
} else {
var CIDSet = function () {
this.values = {};
};
CIDSet.prototype.add = function (value) {
this.values[getCID(value)] = value;
};
CIDSet.prototype['delete'] = function (key) {
var has = getCID(key) in this.values;
if (has) {
delete this.values[getCID(key)];
}
return has;
};
CIDSet.prototype.forEach = function (cb, thisArg) {
helpers.each(this.values, cb, thisArg);
};
CIDSet.prototype.has = function (value) {
return getCID(value) in this.values;
};
CIDSet.prototype.clear = function () {
return this.values = {};
};
Object.defineProperty(CIDSet.prototype, 'size', {
get: function () {
var size = 0;
helpers.each(this.values, function () {
size++;
});
return size;
}
});
}
module.exports = CIDSet;
});
/*can-util@3.10.11#dom/mutation-observer/document/document*/
define('can-util/dom/mutation-observer/document/document', [
'require',
'exports',
'module',
'can-globals/document/document',
'can-dom-data-state',
'can-globals/mutation-observer/mutation-observer',
'can-util/js/each/each',
'can-cid/set/set',
'can-util/js/make-array/make-array',
'can-util/js/string/string'
], function (require, exports, module) {
(function (global) {
'use strict';
var getDocument = require('can-globals/document/document');
var domDataState = require('can-dom-data-state');
var getMutationObserver = require('can-globals/mutation-observer/mutation-observer');
var each = require('can-util/js/each/each');
var CIDStore = require('can-cid/set/set');
var makeArray = require('can-util/js/make-array/make-array');
var string = require('can-util/js/string/string');
var dispatchIfListening = function (mutatedNode, nodes, dispatched) {
if (dispatched.has(mutatedNode)) {
return true;
}
dispatched.add(mutatedNode);
if (nodes.name === 'removedNodes') {
var documentElement = getDocument().documentElement;
if (documentElement.contains(mutatedNode)) {
return;
}
}
nodes.handlers.forEach(function (handler) {
handler(mutatedNode);
});
nodes.afterHandlers.forEach(function (handler) {
handler(mutatedNode);
});
};
var mutationObserverDocument = {
add: function (handler) {
var MO = getMutationObserver();
if (MO) {
var documentElement = getDocument().documentElement;
var globalObserverData = domDataState.get.call(documentElement, 'globalObserverData');
if (!globalObserverData) {
var observer = new MO(function (mutations) {
globalObserverData.handlers.forEach(function (handler) {
handler(mutations);
});
});
observer.observe(documentElement, {
childList: true,
subtree: true
});
globalObserverData = {
observer: observer,
handlers: []
};
domDataState.set.call(documentElement, 'globalObserverData', globalObserverData);
}
globalObserverData.handlers.push(handler);
}
},
remove: function (handler) {
var documentElement = getDocument().documentElement;
var globalObserverData = domDataState.get.call(documentElement, 'globalObserverData');
if (globalObserverData) {
var index = globalObserverData.handlers.indexOf(handler);
if (index >= 0) {
globalObserverData.handlers.splice(index, 1);
}
if (globalObserverData.handlers.length === 0) {
globalObserverData.observer.disconnect();
domDataState.clean.call(documentElement, 'globalObserverData');
}
}
}
};
var makeMutationMethods = function (name) {
var mutationName = name.toLowerCase() + 'Nodes';
var getMutationData = function () {
var documentElement = getDocument().documentElement;
var mutationData = domDataState.get.call(documentElement, mutationName + 'MutationData');
if (!mutationData) {
mutationData = {
name: mutationName,
handlers: [],
afterHandlers: [],
hander: null
};
if (getMutationObserver()) {
domDataState.set.call(documentElement, mutationName + 'MutationData', mutationData);
}
}
return mutationData;
};
var setup = function () {
var mutationData = getMutationData();
if (mutationData.handlers.length === 0 || mutationData.afterHandlers.length === 0) {
mutationData.handler = function (mutations) {
var dispatched = new CIDStore();
mutations.forEach(function (mutation) {
each(mutation[mutationName], function (mutatedNode) {
var children = mutatedNode.getElementsByTagName && makeArray(mutatedNode.getElementsByTagName('*'));
var alreadyChecked = dispatchIfListening(mutatedNode, mutationData, dispatched);
if (children && !alreadyChecked) {
for (var j = 0, child; (child = children[j]) !== undefined; j++) {
dispatchIfListening(child, mutationData, dispatched);
}
}
});
});
};
this.add(mutationData.handler);
}
return mutationData;
};
var teardown = function () {
var documentElement = getDocument().documentElement;
var mutationData = getMutationData();
if (mutationData.handlers.length === 0 && mutationData.afterHandlers.length === 0) {
this.remove(mutationData.handler);
domDataState.clean.call(documentElement, mutationName + 'MutationData');
}
};
var createOnOffHandlers = function (name, handlerList) {
mutationObserverDocument['on' + name] = function (handler) {
var mutationData = setup.call(this);
mutationData[handlerList].push(handler);
};
mutationObserverDocument['off' + name] = function (handler) {
var mutationData = getMutationData();
var index = mutationData[handlerList].indexOf(handler);
if (index >= 0) {
mutationData[handlerList].splice(index, 1);
}
teardown.call(this);
};
};
var createHandlers = function (name) {
createOnOffHandlers(name, 'handlers');
createOnOffHandlers('After' + name, 'afterHandlers');
};
createHandlers(string.capitalize(mutationName));
};
makeMutationMethods('added');
makeMutationMethods('removed');
module.exports = mutationObserverDocument;
}(function () {
return this;
}()));
});
/*can-util@3.10.11#dom/data/data*/
define('can-util/dom/data/data', [
'require',
'exports',
'module',
'can-dom-data-state',
'can-util/dom/mutation-observer/document/document'
], function (require, exports, module) {
'use strict';
var domDataState = require('can-dom-data-state');
var mutationDocument = require('can-util/dom/mutation-observer/document/document');
var deleteNode = function () {
return domDataState.delete.call(this);
};
var elementSetCount = 0;
var cleanupDomData = function (node) {
elementSetCount -= deleteNode.call(node) ? 1 : 0;
if (elementSetCount === 0) {
mutationDocument.offAfterRemovedNodes(cleanupDomData);
}
};
module.exports = {
getCid: domDataState.getCid,
cid: domDataState.cid,
expando: domDataState.expando,
clean: domDataState.clean,
get: domDataState.get,
set: function (name, value) {
if (elementSetCount === 0) {
mutationDocument.onAfterRemovedNodes(cleanupDomData);
}
elementSetCount += domDataState.set.call(this, name, value) ? 1 : 0;
},
delete: deleteNode
};
});
/*can-util@3.10.11#dom/class-name/class-name*/
define('can-util/dom/class-name/class-name', function (require, exports, module) {
'use strict';
var has = function (className) {
if (this.classList) {
return this.classList.contains(className);
} else {
return !!this.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'));
}
};
module.exports = {
has: has,
add: function (className) {
if (this.classList) {
this.classList.add(className);
} else if (!has.call(this, className)) {
this.className += ' ' + className;
}
},
remove: function (className) {
if (this.classList) {
this.classList.remove(className);
} else if (has.call(this, className)) {
var reg = new RegExp('(\\s|^)' + className + '(\\s|$)');
this.className = this.className.replace(reg, ' ');
}
}
};
});
/*can-globals@0.2.3#is-browser-window/is-browser-window*/
define('can-globals/is-browser-window/is-browser-window', [
'require',
'exports',
'module',
'can-globals/can-globals-instance'
], function (require, exports, module) {
(function (global) {
'use strict';
var globals = require('can-globals/can-globals-instance');
globals.define('isBrowserWindow', function () {
return typeof window !== 'undefined' && typeof document !== 'undefined' && typeof SimpleDOM === 'undefined';
});
module.exports = globals.makeExport('isBrowserWindow');
}(function () {
return this;
}()));
});
/*can-util@3.10.11#dom/events/events*/
define('can-util/dom/events/events', [
'require',
'exports',
'module',
'can-globals/document/document',
'can-globals/is-browser-window/is-browser-window',
'can-util/js/is-plain-object/is-plain-object',
'can-util/js/dev/dev'
], function (require, exports, module) {
(function (global) {
'use strict';
var getDocument = require('can-globals/document/document');
var isBrowserWindow = require('can-globals/is-browser-window/is-browser-window');
var isPlainObject = require('can-util/js/is-plain-object/is-plain-object');
var fixSyntheticEventsOnDisabled = false;
var dev = require('can-util/js/dev/dev');
function isDispatchingOnDisabled(element, ev) {
var isInsertedOrRemoved = isPlainObject(ev) ? ev.type === 'inserted' || ev.type === 'removed' : ev === 'inserted' || ev === 'removed';
var isDisabled = !!element.disabled;
return isInsertedOrRemoved && isDisabled;
}
module.exports = {
addEventListener: function () {
this.addEventListener.apply(this, arguments);
},
removeEventListener: function () {
this.removeEventListener.apply(this, arguments);
},
canAddEventListener: function () {
return this.nodeName && (this.nodeType === 1 || this.nodeType === 9) || this === window;
},
dispatch: function (event, args, bubbles) {
var ret;
var dispatchingOnDisabled = fixSyntheticEventsOnDisabled && isDispatchingOnDisabled(this, event);
var doc = this.ownerDocument || getDocument();
var ev = doc.createEvent('HTMLEvents');
var isString = typeof event === 'string';
ev.initEvent(isString ? event : event.type, bubbles === undefined ? true : bubbles, false);
if (!isString) {
for (var prop in event) {
if (ev[prop] === undefined) {
ev[prop] = event[prop];
}
}
}
if (this.disabled === true && ev.type !== 'fix_synthetic_events_on_disabled_test') {
dev.warn('can-util/dom/events::dispatch: Dispatching a synthetic event on a disabled is ' + 'problematic in FireFox and Internet Explorer. We recommend avoiding this if at ' + 'all possible. see https://github.com/canjs/can-util/issues/294');
}
ev.args = args;
if (dispatchingOnDisabled) {
this.disabled = false;
}
ret = this.dispatchEvent(ev);
if (dispatchingOnDisabled) {
this.disabled = true;
}
return ret;
}
};
(function () {
if (!isBrowserWindow()) {
return;
}
var testEventName = 'fix_synthetic_events_on_disabled_test';
var input = document.createElement('input');
input.disabled = true;
var timer = setTimeout(function () {
fixSyntheticEventsOnDisabled = true;
}, 50);
var onTest = function onTest() {
clearTimeout(timer);
module.exports.removeEventListener.call(input, testEventName, onTest);
};
module.exports.addEventListener.call(input, testEventName, onTest);
try {
module.exports.dispatch.call(input, testEventName, [], false);
} catch (e) {
onTest();
fixSyntheticEventsOnDisabled = true;
}
}());
}(function () {
return this;
}()));
});
/*can-util@3.10.11#js/is-empty-object/is-empty-object*/
define('can-util/js/is-empty-object/is-empty-object', function (require, exports, module) {
'use strict';
module.exports = function (obj) {
for (var prop in obj) {
return false;
}
return true;
};
});
/*can-util@3.10.11#dom/dispatch/dispatch*/
define('can-util/dom/dispatch/dispatch', [
'require',
'exports',
'module',
'can-util/dom/events/events'
], function (require, exports, module) {
'use strict';
var domEvents = require('can-util/dom/events/events');
module.exports = function () {
return domEvents.dispatch.apply(this, arguments);
};
});
/*can-util@3.10.11#dom/matches/matches*/
define('can-util/dom/matches/matches', function (require, exports, module) {
'use strict';
var matchesMethod = function (element) {
return element.matches || element.webkitMatchesSelector || element.webkitMatchesSelector || element.mozMatchesSelector || element.msMatchesSelector || element.oMatchesSelector;
};
module.exports = function () {
var method = matchesMethod(this);
return method ? method.apply(this, arguments) : false;
};
});
/*can-util@3.10.11#dom/events/delegate/delegate*/
define('can-util/dom/events/delegate/delegate', [
'require',
'exports',
'module',
'can-util/dom/events/events',
'can-util/dom/data/data',
'can-util/dom/matches/matches',
'can-util/js/each/each',
'can-util/js/is-empty-object/is-empty-object'
], function (require, exports, module) {
'use strict';
var domEvents = require('can-util/dom/events/events');
var domData = require('can-util/dom/data/data');
var domMatches = require('can-util/dom/matches/matches');
var each = require('can-util/js/each/each');
var isEmptyObject = require('can-util/js/is-empty-object/is-empty-object');
var dataName = 'delegateEvents';
var useCapture = function (eventType) {
return eventType === 'focus' || eventType === 'blur';
};
var handleEvent = function (ev) {
var events = domData.get.call(this, dataName);
var eventTypeEvents = events[ev.type];
var matches = [];
if (eventTypeEvents) {
var selectorDelegates = [];
each(eventTypeEvents, function (delegates) {
selectorDelegates.push(delegates);
});
var cur = ev.target;
do {
selectorDelegates.forEach(function (delegates) {
if (domMatches.call(cur, delegates[0].selector)) {
matches.push({
target: cur,
delegates: delegates
});
}
});
cur = cur.parentNode;
} while (cur && cur !== ev.currentTarget);
}
var oldStopProp = ev.stopPropagation;
ev.stopPropagation = function () {
oldStopProp.apply(this, arguments);
this.cancelBubble = true;
};
for (var i = 0; i < matches.length; i++) {
var match = matches[i];
var delegates = match.delegates;
for (var d = 0, dLen = delegates.length; d < dLen; d++) {
if (delegates[d].handler.call(match.target, ev) === false) {
return false;
}
if (ev.cancelBubble) {
return;
}
}
}
};
domEvents.addDelegateListener = function (eventType, selector, handler) {
var events = domData.get.call(this, dataName), eventTypeEvents;
if (!events) {
domData.set.call(this, dataName, events = {});
}
if (!(eventTypeEvents = events[eventType])) {
eventTypeEvents = events[eventType] = {};
domEvents.addEventListener.call(this, eventType, handleEvent, useCapture(eventType));
}
if (!eventTypeEvents[selector]) {
eventTypeEvents[selector] = [];
}
eventTypeEvents[selector].push({
handler: handler,
selector: selector
});
};
domEvents.removeDelegateListener = function (eventType, selector, handler) {
var events = domData.get.call(this, dataName);
if (events && events[eventType] && events[eventType][selector]) {
var eventTypeEvents = events[eventType], delegates = eventTypeEvents[selector], i = 0;
while (i < delegates.length) {
if (delegates[i].handler === handler) {
delegates.splice(i, 1);
} else {
i++;
}
}
if (delegates.length === 0) {
delete eventTypeEvents[selector];
if (isEmptyObject(eventTypeEvents)) {
domEvents.removeEventListener.call(this, eventType, handleEvent, useCapture(eventType));
delete events[eventType];
if (isEmptyObject(events)) {
domData.clean.call(this, dataName);
}
}
}
}
};
});
/*can-util@3.10.11#js/single-reference/single-reference*/
define('can-util/js/single-reference/single-reference', [
'require',
'exports',
'module',
'can-cid'
], function (require, exports, module) {
(function (global) {
var CID = require('can-cid');
var singleReference;
function getKeyName(key, extraKey) {
var keyName = extraKey ? CID(key) + ':' + extraKey : CID(key);
return keyName || key;
}
singleReference = {
set: function (obj, key, value, extraKey) {
obj[getKeyName(key, extraKey)] = value;
},
getAndDelete: function (obj, key, extraKey) {
var keyName = getKeyName(key, extraKey);
var value = obj[keyName];
delete obj[keyName];
return value;
}
};
module.exports = singleReference;
}(function () {
return this;
}()));
});
/*can-util@3.10.11#js/cid/get-cid*/
define('can-util/js/cid/get-cid', [
'require',
'exports',
'module',
'can-cid',
'can-dom-data-state'
], function (require, exports, module) {
'use strict';
var CID = require('can-cid');
var domDataState = require('can-dom-data-state');
module.exports = function (obj) {
if (typeof obj.nodeType === 'number') {
return domDataState.cid.call(obj);
} else {
var type = typeof obj;
var isObject = type !== null && (type === 'object' || type === 'function');
return type + ':' + (isObject ? CID(obj) : obj);
}
};
});
/*can-util@3.10.11#dom/events/delegate/enter-leave*/
define('can-util/dom/events/delegate/enter-leave', [
'require',
'exports',
'module',
'can-util/dom/events/events',
'can-util/js/single-reference/single-reference',
'can-util/js/cid/get-cid'
], function (require, exports, module) {
'use strict';
var domEvents = require('can-util/dom/events/events'), singleRef = require('can-util/js/single-reference/single-reference'), cid = require('can-util/js/cid/get-cid');
var eventMap = {
mouseenter: 'mouseover',
mouseleave: 'mouseout',
pointerenter: 'pointerover',
pointerleave: 'pointerout'
}, classMap = {
mouseenter: 'MouseEvent',
mouseleave: 'MouseEvent',
pointerenter: 'PointerEvent',
pointerleave: 'PointerEvent'
}, _addDelegateListener = domEvents.addDelegateListener, _removeDelegateListener = domEvents.removeDelegateListener;
domEvents.addDelegateListener = function (eventType, selector, handler) {
if (eventMap[eventType] !== undefined) {
var origHandler = handler, origType = eventType;
eventType = eventMap[eventType];
handler = function (event) {
var target = this, related = event.relatedTarget;
if (!related || related !== target && !target.contains(related)) {
var eventClass = classMap[origType];
if (eventClass === 'MouseEvent') {
var newEv = document.createEvent(eventClass);
newEv.initMouseEvent(origType, false, false, event.view, event.detail, event.screenX, event.screenY, event.clientX, event.clientY, event.ctrlKey, event.altKey, event.shiftKey, event.metaKey, event.button, event.relatedTarget);
event = newEv;
} else if (eventClass === 'PointerEvent') {
event = new PointerEvent(origType, event);
}
return origHandler.call(this, event);
}
};
singleRef.set(origHandler, cid(this) + eventType, handler);
}
_addDelegateListener.call(this, eventType, selector, handler);
};
domEvents.removeDelegateListener = function (eventType, selector, handler) {
if (eventMap[eventType] !== undefined) {
eventType = eventMap[eventType];
handler = singleRef.getAndDelete(handler, cid(this) + eventType);
}
_removeDelegateListener.call(this, eventType, selector, handler);
};
});
/*can-event@3.7.5#can-event*/
define('can-event', [
'require',
'exports',
'module',
'can-util/dom/events/events',
'can-cid',
'can-util/js/is-empty-object/is-empty-object',
'can-util/dom/dispatch/dispatch',
'can-namespace',
'can-util/dom/events/delegate/delegate',
'can-util/dom/events/delegate/enter-leave'
], function (require, exports, module) {
var domEvents = require('can-util/dom/events/events');
var CID = require('can-cid');
var isEmptyObject = require('can-util/js/is-empty-object/is-empty-object');
var domDispatch = require('can-util/dom/dispatch/dispatch');
var namespace = require('can-namespace');
require('can-util/dom/events/delegate/delegate');
require('can-util/dom/events/delegate/enter-leave');
function makeHandlerArgs(event, args) {
if (typeof event === 'string') {
event = { type: event };
}
var handlerArgs = [event];
if (args) {
handlerArgs.push.apply(handlerArgs, args);
}
return handlerArgs;
}
function getHandlers(eventName) {
var events = this.__bindEvents;
if (!events) {
return;
}
return events[eventName];
}
var canEvent = {
addEventListener: function (event, handler) {
var allEvents = this.__bindEvents || (this.__bindEvents = {}), eventList = allEvents[event] || (allEvents[event] = []);
eventList.push(handler);
return this;
},
removeEventListener: function (event, fn) {
if (!this.__bindEvents) {
return this;
}
if (!arguments.length) {
for (var bindEvent in this.__bindEvents) {
if (bindEvent === '_lifecycleBindings') {
this.__bindEvents._lifecycleBindings = null;
} else if (this.__bindEvents.hasOwnProperty(bindEvent)) {
canEvent.removeEventListener.call(this, bindEvent);
}
}
return this;
}
var handlers = this.__bindEvents[event] || [], i = 0, handler, isFunction = typeof fn === 'function';
while (i < handlers.length) {
handler = handlers[i];
if (isFunction && handler === fn || !isFunction && (handler.cid === fn || !fn)) {
handlers.splice(i, 1);
} else {
i++;
}
}
return this;
},
dispatchSync: function (event, args) {
var handlerArgs = makeHandlerArgs(event, args);
var handlers = getHandlers.call(this, handlerArgs[0].type);
if (!handlers) {
return;
}
handlers = handlers.slice(0);
for (var i = 0, len = handlers.length; i < len; i++) {
handlers[i].apply(this, handlerArgs);
}
return handlerArgs[0];
},
on: function (eventName, selector, handler) {
var method = typeof selector === 'string' ? 'addDelegateListener' : 'addEventListener';
var listenWithDOM = domEvents.canAddEventListener.call(this);
var eventBinder = listenWithDOM ? domEvents[method] : this[method] || canEvent[method];
return eventBinder.apply(this, arguments);
},
off: function (eventName, selector, handler) {
var method = typeof selector === 'string' ? 'removeDelegateListener' : 'removeEventListener';
var listenWithDOM = domEvents.canAddEventListener.call(this);
var eventBinder = listenWithDOM ? domEvents[method] : this[method] || canEvent[method];
return eventBinder.apply(this, arguments);
},
trigger: function () {
var listenWithDOM = domEvents.canAddEventListener.call(this);
var dispatch = listenWithDOM ? domDispatch : canEvent.dispatch;
return dispatch.apply(this, arguments);
},
one: function (event, handler) {
var one = function () {
canEvent.off.call(this, event, one);
return handler.apply(this, arguments);
};
canEvent.on.call(this, event, one);
return this;
},
listenTo: function (other, event, handler) {
var idedEvents = this.__listenToEvents;
if (!idedEvents) {
idedEvents = this.__listenToEvents = {};
}
var otherId = CID(other);
var othersEvents = idedEvents[otherId];
if (!othersEvents) {
othersEvents = idedEvents[otherId] = {
obj: other,
events: {}
};
}
var eventsEvents = othersEvents.events[event];
if (!eventsEvents) {
eventsEvents = othersEvents.events[event] = [];
}
eventsEvents.push(handler);
canEvent.on.call(other, event, handler);
},
stopListening: function (other, event, handler) {
var idedEvents = this.__listenToEvents, iterIdedEvents = idedEvents, i = 0;
if (!idedEvents) {
return this;
}
if (other) {
var othercid = CID(other);
(iterIdedEvents = {})[othercid] = idedEvents[othercid];
if (!idedEvents[othercid]) {
return this;
}
}
for (var cid in iterIdedEvents) {
var othersEvents = iterIdedEvents[cid], eventsEvents;
other = idedEvents[cid].obj;
if (!event) {
eventsEvents = othersEvents.events;
} else {
(eventsEvents = {})[event] = othersEvents.events[event];
}
for (var eventName in eventsEvents) {
var handlers = eventsEvents[eventName] || [];
i = 0;
while (i < handlers.length) {
if (handler && handler === handlers[i] || !handler) {
canEvent.off.call(other, eventName, handlers[i]);
handlers.splice(i, 1);
} else {
i++;
}
}
if (!handlers.length) {
delete othersEvents.events[eventName];
}
}
if (isEmptyObject(othersEvents.events)) {
delete idedEvents[cid];
}
}
return this;
}
};
canEvent.addEvent = canEvent.bind = function () {
return canEvent.addEventListener.apply(this, arguments);
};
canEvent.unbind = canEvent.removeEvent = function () {
return canEvent.removeEventListener.apply(this, arguments);
};
canEvent.delegate = canEvent.on;
canEvent.undelegate = canEvent.off;
canEvent.dispatch = canEvent.dispatchSync;
Object.defineProperty(canEvent, 'makeHandlerArgs', {
enumerable: false,
value: makeHandlerArgs
});
Object.defineProperty(canEvent, 'handlers', {
enumerable: false,
value: getHandlers
});
Object.defineProperty(canEvent, 'flush', {
enumerable: false,
writable: true,
value: function () {
}
});
module.exports = namespace.event = canEvent;
});
/*can-util@3.10.11#js/last/last*/
define('can-util/js/last/last', function (require, exports, module) {
'use strict';
module.exports = function (arr) {
return arr && arr[arr.length - 1];
};
});
/*can-event@3.7.5#batch/batch*/
define('can-event/batch/batch', [
'require',
'exports',
'module',
'can-event',
'can-util/js/last/last',
'can-namespace',
'can-types',
'can-util/js/dev/dev',
'can-util/js/log/log'
], function (require, exports, module) {
'use strict';
var canEvent = require('can-event');
var last = require('can-util/js/last/last');
var namespace = require('can-namespace');
var canTypes = require('can-types');
var canDev = require('can-util/js/dev/dev');
var canLog = require('can-util/js/log/log');
var consoleDefined = typeof console !== 'undefined';
var group = consoleDefined && console.group && console.group.bind(console) || function () {
};
var groupEnd = consoleDefined && console.groupEnd && console.groupEnd.bind(console) || function () {
};
var batchNum = 1, collectionQueue = null, queues = [], dispatchingQueues = false, makeHandlerArgs = canEvent.makeHandlerArgs, getHandlers = canEvent.handlers;
function addToCollectionQueue(item, event, args, handlers) {
var handlerArgs = makeHandlerArgs(event, args);
var tasks = [];
for (var i = 0, len = handlers.length; i < len; i++) {
tasks[i] = [
handlers[i],
item,
handlerArgs
];
}
[].push.apply(collectionQueue.tasks, tasks);
}
var canBatch = {
missingStopWarningTimeout: 5000,
transactions: 0,
start: function (batchStopHandler) {
canBatch.transactions++;
if (canBatch.transactions === 1) {
var queue = {
number: batchNum++,
index: 0,
tasks: [],
batchEnded: false,
callbacksIndex: 0,
callbacks: [],
complete: false
};
var setupWarning = function () {
setTimeout(function () {
if (queue.complete === false) {
canDev.warn('can-even/batch/batch: start called without corresponding stop');
}
}, canBatch.missingStopWarningTimeout);
};
if (typeof CanZone !== 'undefined') {
CanZone.ignore(setupWarning)();
} else {
setupWarning();
}
if (batchStopHandler) {
queue.callbacks.push(batchStopHandler);
}
collectionQueue = queue;
}
},
collecting: function () {
return collectionQueue;
},
dispatching: function () {
return queues[0];
},
stop: function (force, callStart) {
if (force) {
canBatch.transactions = 0;
} else {
canBatch.transactions--;
}
if (canBatch.transactions === 0) {
queues.push(collectionQueue);
collectionQueue = null;
if (!dispatchingQueues) {
canEvent.flush();
}
}
},
flush: function () {
var debug = canDev.logLevel >= 1;
dispatchingQueues = true;
while (queues.length) {
var queue = queues[0];
var tasks = queue.tasks, callbacks = queue.callbacks;
canBatch.batchNum = queue.number;
var len = tasks.length;
if (debug && queue.index === 0 && queue.index < len) {
group('batch running ' + queue.number);
}
while (queue.index < len) {
var task = tasks[queue.index++];
if (debug) {
var context = task[1];
var args = task[2];
if (args && args[0]) {
canLog.log('dispatching', args[0].type, 'on', context);
}
}
task[0].apply(task[1], task[2]);
}
if (!queue.batchEnded) {
if (debug) {
canLog.log('tasks ended');
}
queue.batchEnded = true;
canEvent.dispatchSync.call(canBatch, 'batchEnd', [queue.number]);
}
if (debug && queue.callbacksIndex < callbacks.length) {
canLog.log('calling callbacks');
}
while (queue.callbacksIndex < callbacks.length) {
callbacks[queue.callbacksIndex++]();
}
if (!queue.complete) {
queue.complete = true;
canBatch.batchNum = undefined;
queues.shift();
if (debug) {
groupEnd();
}
}
}
dispatchingQueues = false;
},
dispatch: function (event, args) {
if (arguments.length > 2) {
canDev.warn('Arguments to dispatch should be an array, not multiple arguments.');
args = Array.prototype.slice.call(arguments, 1);
}
if (args && !Array.isArray(args)) {
canDev.warn('Arguments to dispatch should be an array.');
args = [args];
}
var item = this, handlers;
if (!item.__inSetup) {
event = typeof event === 'string' ? { type: event } : event;
if (event.batchNum) {
canBatch.batchNum = event.batchNum;
canEvent.dispatchSync.call(item, event, args);
} else if (collectionQueue) {
handlers = getHandlers.call(this, event.type);
if (handlers) {
event.batchNum = collectionQueue.number;
addToCollectionQueue(item, event, args, handlers);
}
} else if (queues.length) {
handlers = getHandlers.call(this, event.type);
if (handlers) {
canBatch.start();
event.batchNum = collectionQueue.number;
addToCollectionQueue(item, event, args, handlers);
last(queues).callbacks.push(canBatch.stop);
}
} else {
handlers = getHandlers.call(this, event.type);
if (handlers) {
canBatch.start();
event.batchNum = collectionQueue.number;
addToCollectionQueue(item, event, args, handlers);
canBatch.stop();
}
}
}
},
queue: function (task, inCurrentBatch) {
if (collectionQueue) {
collectionQueue.tasks.push(task);
} else if (queues.length) {
if (inCurrentBatch && queues[0].index < queues.tasks.length) {
queues[0].tasks.push(task);
} else {
canBatch.start();
collectionQueue.tasks.push(task);
last(queues).callbacks.push(canBatch.stop);
}
} else {
canBatch.start();
collectionQueue.tasks.push(task);
canBatch.stop();
}
},
queues: function () {
return queues;
},
afterPreviousEvents: function (handler) {
this.queue([handler]);
},
after: function (handler) {
var queue = collectionQueue || queues[0];
if (queue) {
queue.callbacks.push(handler);
} else {
handler({});
}
}
};
Object.defineProperty(canBatch, 'debounce', {
enumerable: false,
value: function (handler) {
var that = null;
var args = null;
return function () {
if (!that) {
canEvent.addEventListener.call(canBatch, 'batchEnd', function listener() {
canEvent.removeEventListener.call(canBatch, 'batchEnd', listener);
handler.apply(that, args);
that = null;
args = null;
});
}
that = this;
args = arguments;
};
}
});
canEvent.flush = canBatch.flush;
canEvent.dispatch = canBatch.dispatch;
canBatch.trigger = function () {
canLog.warn('use canEvent.dispatch instead');
return canEvent.dispatch.apply(this, arguments);
};
canTypes.queueTask = canBatch.queue;
if (namespace.batch) {
throw new Error('You can\'t have two versions of can-event/batch/batch, check your dependencies');
} else {
module.exports = namespace.batch = canBatch;
}
});
/*can-cid@1.1.1#map/map*/
define('can-cid/map/map', [
'require',
'exports',
'module',
'can-cid',
'can-cid/helpers'
], function (require, exports, module) {
'use strict';
var getCID = require('can-cid').get;
var helpers = require('can-cid/helpers');
var CIDMap;
if (typeof Map !== 'undefined') {
CIDMap = Map;
} else {
var CIDMap = function () {
this.values = {};
};
CIDMap.prototype.set = function (key, value) {
this.values[getCID(key)] = {
key: key,
value: value
};
};
CIDMap.prototype['delete'] = function (key) {
var has = getCID(key) in this.values;
if (has) {
delete this.values[getCID(key)];
}
return has;
};
CIDMap.prototype.forEach = function (cb, thisArg) {
helpers.each(this.values, function (pair) {
return cb.call(thisArg || this, pair.value, pair.key, this);
}, this);
};
CIDMap.prototype.has = function (key) {
return getCID(key) in this.values;
};
CIDMap.prototype.get = function (key) {
var obj = this.values[getCID(key)];
return obj && obj.value;
};
CIDMap.prototype.clear = function () {
return this.values = {};
};
Object.defineProperty(CIDMap.prototype, 'size', {
get: function () {
var size = 0;
helpers.each(this.values, function () {
size++;
});
return size;
}
});
}
module.exports = CIDMap;
});
/*can-util@3.10.11#js/cid-map/cid-map*/
define('can-util/js/cid-map/cid-map', [
'require',
'exports',
'module',
'can-cid/map/map'
], function (require, exports, module) {
(function (global) {
'use strict';
module.exports = require('can-cid/map/map');
}(function () {
return this;
}()));
});
/*can-util@3.10.11#js/cid-set/cid-set*/
define('can-util/js/cid-set/cid-set', [
'require',
'exports',
'module',
'can-cid/set/set'
], function (require, exports, module) {
(function (global) {
'use strict';
module.exports = require('can-cid/set/set');
}(function () {
return this;
}()));
});
/*can-observation@3.3.5#can-observation*/
define('can-observation', [
'require',
'exports',
'module',
'can-event',
'can-event',
'can-event/batch/batch',
'can-util/js/assign/assign',
'can-util/js/is-empty-object/is-empty-object',
'can-namespace',
'can-util/js/log/log',
'can-reflect',
'can-symbol',
'can-cid',
'can-util/js/cid-map/cid-map',
'can-util/js/cid-set/cid-set'
], function (require, exports, module) {
(function (global) {
require('can-event');
var canEvent = require('can-event');
var canBatch = require('can-event/batch/batch');
var assign = require('can-util/js/assign/assign');
var isEmptyObject = require('can-util/js/is-empty-object/is-empty-object');
var namespace = require('can-namespace');
var canLog = require('can-util/js/log/log');
var canReflect = require('can-reflect');
var canSymbol = require('can-symbol');
var CID = require('can-cid');
var CIDMap = require('can-util/js/cid-map/cid-map');
var CIDSet = require('can-util/js/cid-set/cid-set');
function Observation(func, context, compute) {
this.newObserved = {};
this.oldObserved = null;
this.func = func;
this.context = context;
this.compute = compute && (compute.updater || 'isObservable' in compute) ? compute : { updater: compute };
this.isObservable = typeof compute === 'object' ? compute.isObservable : true;
var observation = this;
this.onDependencyChange = function (value, legacyValue) {
observation.dependencyChange(this, value, legacyValue);
};
this.ignore = 0;
this.needsUpdate = false;
this.handlers = null;
CID(this);
}
var observationStack = [];
Observation.observationStack = observationStack;
var remaining = {
updates: 0,
notifications: 0
};
Observation.remaining = remaining;
assign(Observation.prototype, {
get: function () {
if (this.isObservable && Observation.isRecording()) {
Observation.add(this);
if (!this.bound) {
Observation.temporarilyBind(this);
}
}
if (this.bound === true) {
canEvent.flush();
if (remaining.updates > 0) {
Observation.updateChildrenAndSelf(this);
}
return this.value;
} else {
return this.func.call(this.context);
}
},
getPrimaryDepth: function () {
return this.compute._primaryDepth || 0;
},
addEdge: function (objEv) {
if (objEv.event === 'undefined') {
canReflect.onValue(objEv.obj, this.onDependencyChange);
} else {
canReflect.onKeyValue(objEv.obj, objEv.event, this.onDependencyChange);
}
},
removeEdge: function (objEv) {
if (objEv.event === 'undefined') {
canReflect.offValue(objEv.obj, this.onDependencyChange);
} else {
canReflect.offKeyValue(objEv.obj, objEv.event, this.onDependencyChange);
}
},
dependencyChange: function () {
if (this.bound === true) {
if (canBatch.batchNum === undefined || canBatch.batchNum !== this.batchNum) {
Observation.registerUpdate(this, canBatch.batchNum);
this.batchNum = canBatch.batchNum;
}
}
},
onDependencyChange: function (value) {
this.dependencyChange(value);
},
update: function (batchNum) {
if (this.needsUpdate === true) {
remaining.updates--;
}
this.needsUpdate = false;
if (this.bound === true) {
var oldValue = this.value;
this.oldValue = null;
this.start();
if (oldValue !== this.value) {
this.compute.updater(this.value, oldValue, batchNum);
return true;
}
}
},
getValueAndBind: function () {
canLog.warn('can-observation: call start instead of getValueAndBind');
return this.start();
},
start: function () {
this.bound = true;
this.oldObserved = this.newObserved || {};
this.ignore = 0;
this.newObserved = {};
observationStack.push(this);
this.value = this.func.call(this.context);
observationStack.pop();
this.updateBindings();
},
updateBindings: function () {
var newObserved = this.newObserved, oldObserved = this.oldObserved, name, obEv;
for (name in newObserved) {
obEv = newObserved[name];
if (!oldObserved[name]) {
this.addEdge(obEv);
} else {
oldObserved[name] = undefined;
}
}
for (name in oldObserved) {
obEv = oldObserved[name];
if (obEv !== undefined) {
this.removeEdge(obEv);
}
}
},
teardown: function () {
canLog.warn('can-observation: call stop instead of teardown');
return this.stop();
},
stop: function () {
this.bound = false;
for (var name in this.newObserved) {
var ob = this.newObserved[name];
this.removeEdge(ob);
}
this.newObserved = {};
}
});
var updateOrder = [], curPrimaryDepth = Infinity, maxPrimaryDepth = 0, currentBatchNum, isUpdating = false;
var updateUpdateOrder = function (observation) {
var primaryDepth = observation.getPrimaryDepth();
if (primaryDepth < curPrimaryDepth) {
curPrimaryDepth = primaryDepth;
}
if (primaryDepth > maxPrimaryDepth) {
maxPrimaryDepth = primaryDepth;
}
var primary = updateOrder[primaryDepth] || (updateOrder[primaryDepth] = []);
return primary;
};
Observation.registerUpdate = function (observation, batchNum) {
if (observation.needsUpdate === true) {
return;
}
remaining.updates++;
observation.needsUpdate = true;
var objs = updateUpdateOrder(observation);
objs.push(observation);
};
var afterCallbacks = [];
Observation.updateAndNotify = function (ev, batchNum) {
currentBatchNum = batchNum;
if (isUpdating === true) {
return;
}
isUpdating = true;
while (true) {
if (curPrimaryDepth <= maxPrimaryDepth) {
var primary = updateOrder[curPrimaryDepth];
var lastUpdate = primary && primary.pop();
if (lastUpdate !== undefined) {
lastUpdate.update(currentBatchNum);
} else {
curPrimaryDepth++;
}
} else {
updateOrder = [];
curPrimaryDepth = Infinity;
maxPrimaryDepth = 0;
isUpdating = false;
var afterCB = afterCallbacks;
afterCallbacks = [];
afterCB.forEach(function (cb) {
cb();
});
return;
}
}
};
canEvent.addEventListener.call(canBatch, 'batchEnd', Observation.updateAndNotify);
Observation.afterUpdateAndNotify = function (callback) {
canBatch.after(function () {
if (isUpdating === true) {
afterCallbacks.push(callback);
} else {
callback();
}
});
};
Observation.updateChildrenAndSelf = function (observation) {
if (observation.needsUpdate === true) {
return Observation.unregisterAndUpdate(observation);
}
var childHasChanged = false;
for (var prop in observation.newObserved) {
if (observation.newObserved[prop].obj.observation) {
if (Observation.updateChildrenAndSelf(observation.newObserved[prop].obj.observation)) {
childHasChanged = true;
}
}
}
if (childHasChanged === true) {
return observation.update(currentBatchNum);
}
};
Observation.unregisterAndUpdate = function (observation) {
var primaryDepth = observation.getPrimaryDepth();
var primary = updateOrder[primaryDepth];
if (primary !== undefined) {
var index = primary.indexOf(observation);
if (index !== -1) {
primary.splice(index, 1);
}
}
return observation.update(currentBatchNum);
};
Observation.add = function (obj, event) {
var top = observationStack[observationStack.length - 1];
if (top !== undefined && !top.ignore) {
var evStr = event + '', name = obj._cid + '|' + evStr;
if (top.traps !== undefined) {
top.traps.push({
obj: obj,
event: evStr,
name: name
});
} else {
top.newObserved[name] = {
obj: obj,
event: evStr
};
}
}
};
Observation.addAll = function (observes) {
var top = observationStack[observationStack.length - 1];
if (top !== undefined) {
if (top.traps !== undefined) {
top.traps.push.apply(top.traps, observes);
} else {
for (var i = 0, len = observes.length; i < len; i++) {
var trap = observes[i], name = trap.name;
if (top.newObserved[name] === undefined) {
top.newObserved[name] = trap;
}
}
}
}
};
Observation.ignore = function (fn) {
return function () {
if (observationStack.length > 0) {
var top = observationStack[observationStack.length - 1];
top.ignore++;
var res = fn.apply(this, arguments);
top.ignore--;
return res;
} else {
return fn.apply(this, arguments);
}
};
};
Observation.trap = function () {
if (observationStack.length > 0) {
var top = observationStack[observationStack.length - 1];
var oldTraps = top.traps;
var traps = top.traps = [];
return function () {
top.traps = oldTraps;
return traps;
};
} else {
return function () {
return [];
};
}
};
Observation.trapsCount = function () {
if (observationStack.length > 0) {
var top = observationStack[observationStack.length - 1];
return top.traps.length;
} else {
return 0;
}
};
Observation.isRecording = function () {
var len = observationStack.length;
var last = len > 0 && observationStack[len - 1];
return last && last.ignore === 0;
};
var noop = function () {
};
var observables;
var unbindComputes = function () {
for (var i = 0, len = observables.length; i < len; i++) {
canReflect.offValue(observables[i], noop);
}
observables = null;
};
Observation.temporarilyBind = function (compute) {
var computeInstance = compute.computeInstance || compute;
canReflect.onValue(computeInstance, noop);
if (!observables) {
observables = [];
setTimeout(unbindComputes, 10);
}
observables.push(computeInstance);
};
var callHandlers = function (newValue) {
this.handlers.forEach(function (handler) {
handler.call(this.compute, newValue);
}, this);
};
canReflect.set(Observation.prototype, canSymbol.for('can.onValue'), function (handler) {
if (!this.handlers) {
this.handlers = [];
if (this.compute.updater) {
canLog.warn('can-observation bound to with an existing handler');
}
this.compute.updater = callHandlers.bind(this);
}
if (!this.handlers.length) {
this.start();
}
this.handlers.push(handler);
});
canReflect.set(Observation.prototype, canSymbol.for('can.offValue'), function (handler) {
if (this.handlers) {
var index = this.handlers.indexOf(handler);
this.handlers.splice(index, 1);
if (this.handlers.length === 0) {
this.stop();
}
}
});
canReflect.set(Observation.prototype, canSymbol.for('can.getValue'), Observation.prototype.get);
Observation.prototype.hasDependencies = function () {
return this.bound ? !isEmptyObject(this.newObserved) : undefined;
};
canReflect.set(Observation.prototype, canSymbol.for('can.isValueLike'), true);
canReflect.set(Observation.prototype, canSymbol.for('can.isMapLike'), false);
canReflect.set(Observation.prototype, canSymbol.for('can.isListLike'), false);
canReflect.set(Observation.prototype, canSymbol.for('can.valueHasDependencies'), Observation.prototype.hasDependencies);
canReflect.set(Observation.prototype, canSymbol.for('can.getValueDependencies'), function () {
var rets;
if (this.bound === true) {
rets = {};
canReflect.eachKey(this.newObserved || {}, function (dep) {
if (canReflect.isValueLike(dep.obj)) {
rets.valueDependencies = rets.valueDependencies || new CIDSet();
rets.valueDependencies.add(dep.obj);
} else {
rets.keyDependencies = rets.keyDependencies || new CIDMap();
if (rets.keyDependencies.get(dep.obj)) {
rets.keyDependencies.get(dep.obj).push(dep.event);
} else {
rets.keyDependencies.set(dep.obj, [dep.event]);
}
}
});
}
return rets;
});
if (namespace.Observation) {
throw new Error('You can\'t have two versions of can-observation, check your dependencies');
} else {
module.exports = namespace.Observation = Observation;
}
}(function () {
return this;
}()));
});
/*can-event@3.7.5#lifecycle/lifecycle*/
define('can-event/lifecycle/lifecycle', [
'require',
'exports',
'module',
'can-event'
], function (require, exports, module) {
var canEvent = require('can-event');
var lifecycle = function (prototype) {
var baseAddEventListener = prototype.addEventListener;
var baseRemoveEventListener = prototype.removeEventListener;
prototype.addEventListener = function () {
var ret = baseAddEventListener.apply(this, arguments);
if (!this.__inSetup) {
this.__bindEvents = this.__bindEvents || {};
if (!this.__bindEvents._lifecycleBindings) {
this.__bindEvents._lifecycleBindings = 1;
if (this._eventSetup) {
this._eventSetup();
}
} else {
this.__bindEvents._lifecycleBindings++;
}
}
return ret;
};
prototype.removeEventListener = function (event, handler) {
if (!this.__bindEvents) {
return this;
}
var handlers = this.__bindEvents[event] || [];
var handlerCount = handlers.length;
var ret = baseRemoveEventListener.apply(this, arguments);
if (this.__bindEvents._lifecycleBindings === null) {
this.__bindEvents._lifecycleBindings = 0;
} else {
this.__bindEvents._lifecycleBindings -= handlerCount - handlers.length;
}
if (!this.__bindEvents._lifecycleBindings && this._eventTeardown) {
this._eventTeardown();
}
return ret;
};
return prototype;
};
var baseEvents = lifecycle({
addEventListener: canEvent.addEventListener,
removeEventListener: canEvent.removeEventListener
});
lifecycle.addAndSetup = baseEvents.addEventListener;
lifecycle.removeAndTeardown = baseEvents.removeEventListener;
module.exports = lifecycle;
});
/*can-util@3.10.11#js/is-promise-like/is-promise-like*/
define('can-util/js/is-promise-like/is-promise-like', function (require, exports, module) {
'use strict';
module.exports = function (obj) {
return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
};
});
/*can-reflect-promise@1.1.4#can-reflect-promise*/
define('can-reflect-promise', [
'require',
'exports',
'module',
'can-reflect',
'can-symbol',
'can-util/js/dev/dev',
'can-observation',
'can-cid',
'can-util/js/assign/assign',
'can-event',
'can-util/js/single-reference/single-reference'
], function (require, exports, module) {
var canReflect = require('can-reflect');
var canSymbol = require('can-symbol');
var dev = require('can-util/js/dev/dev');
var Observation = require('can-observation');
var CID = require('can-cid');
var assign = require('can-util/js/assign/assign');
var canEvent = require('can-event');
var singleReference = require('can-util/js/single-reference/single-reference');
var getValueSymbol = canSymbol.for('can.getValue'), getKeyValueSymbol = canSymbol.for('can.getKeyValue'), onValueSymbol = canSymbol.for('can.onValue'), onKeyValueSymbol = canSymbol.for('can.onKeyValue'), offKeyValueSymbol = canSymbol.for('can.offKeyValue'), observeDataSymbol = canSymbol.for('can.observeData');
var promiseDataPrototype = {
isPending: true,
state: 'pending',
isResolved: false,
isRejected: false,
value: undefined,
reason: undefined
};
assign(promiseDataPrototype, canEvent);
canReflect.set(promiseDataPrototype, onKeyValueSymbol, function (key, handler) {
var observeData = this;
var translated = function () {
handler(observeData[key]);
};
singleReference.set(handler, this, translated, key);
canEvent.on.call(this, 'state', translated);
});
canReflect.set(promiseDataPrototype, offKeyValueSymbol, function (key, handler) {
var translated = singleReference.getAndDelete(handler, this, key);
canEvent.off.call(this, 'state', translated);
});
function initPromise(promise) {
var observeData = promise[observeDataSymbol];
if (!observeData) {
Object.defineProperty(promise, observeDataSymbol, {
enumerable: false,
configurable: false,
writable: false,
value: Object.create(promiseDataPrototype)
});
observeData = promise[observeDataSymbol];
CID(observeData);
}
promise.then(function (value) {
observeData.isPending = false;
observeData.isResolved = true;
observeData.value = value;
observeData.state = 'resolved';
observeData.dispatch('state', [
'resolved',
'pending'
]);
}, function (reason) {
observeData.isPending = false;
observeData.isRejected = true;
observeData.reason = reason;
observeData.state = 'rejected';
observeData.dispatch('state', [
'rejected',
'pending'
]);
dev.error('Failed promise:', reason);
});
}
function setupPromise(value) {
var oldPromiseFn;
var proto = 'getPrototypeOf' in Object ? Object.getPrototypeOf(value) : value.__proto__;
if (value[getKeyValueSymbol] && value[observeDataSymbol]) {
return;
}
if (proto === null || proto === Object.prototype) {
proto = value;
if (typeof proto.promise === 'function') {
oldPromiseFn = proto.promise;
proto.promise = function () {
var result = oldPromiseFn.call(proto);
setupPromise(result);
return result;
};
}
}
[
getKeyValueSymbol,
function (key) {
if (!this[observeDataSymbol]) {
initPromise(this);
}
Observation.add(this[observeDataSymbol], 'state');
switch (key) {
case 'state':
case 'isPending':
case 'isResolved':
case 'isRejected':
case 'value':
case 'reason':
return this[observeDataSymbol][key];
default:
return this[key];
}
},
getValueSymbol,
function () {
return this[getKeyValueSymbol]('value');
},
canSymbol.for('can.isValueLike'),
false,
onValueSymbol,
function (handler) {
return this[onKeyValueSymbol]('value', handler);
},
onKeyValueSymbol,
function (key, handler) {
if (!this[observeDataSymbol]) {
initPromise(this);
}
var promise = this;
var translated = function () {
handler(promise[getKeyValueSymbol](key));
};
singleReference.set(handler, this, translated, key);
canEvent.on.call(this[observeDataSymbol], 'state', translated);
},
canSymbol.for('can.offValue'),
function (handler) {
return this[offKeyValueSymbol]('value', handler);
},
offKeyValueSymbol,
function (key, handler) {
var translated = singleReference.getAndDelete(handler, this, key);
if (translated) {
canEvent.off.call(this[observeDataSymbol], 'state', translated);
}
}
].forEach(function (symbol, index, list) {
if (index % 2 === 0) {
canReflect.set(proto, symbol, list[index + 1]);
}
});
}
module.exports = setupPromise;
});
/*can-stache-key@0.1.0#can-stache-key*/
define('can-stache-key', [
'require',
'exports',
'module',
'can-observation',
'can-util/js/dev/dev',
'can-util/js/each/each',
'can-symbol',
'can-reflect',
'can-util/js/is-promise-like/is-promise-like',
'can-reflect-promise'
], function (require, exports, module) {
var Observation = require('can-observation');
var dev = require('can-util/js/dev/dev');
var each = require('can-util/js/each/each');
var canSymbol = require('can-symbol');
var canReflect = require('can-reflect');
var isPromiseLike = require('can-util/js/is-promise-like/is-promise-like');
var canReflectPromise = require('can-reflect-promise');
var getValueSymbol = canSymbol.for('can.getValue');
var setValueSymbol = canSymbol.for('can.setValue');
var isValueLikeSymbol = canSymbol.for('can.isValueLike');
var observeReader;
var isAt = function (index, reads) {
var prevRead = reads[index - 1];
return prevRead && prevRead.at;
};
var readValue = function (value, index, reads, options, state, prev) {
var usedValueReader;
do {
usedValueReader = false;
for (var i = 0, len = observeReader.valueReaders.length; i < len; i++) {
if (observeReader.valueReaders[i].test(value, index, reads, options)) {
value = observeReader.valueReaders[i].read(value, index, reads, options, state, prev);
}
}
} while (usedValueReader);
return value;
};
var specialRead = {
index: true,
key: true,
event: true,
element: true,
viewModel: true
};
var checkForObservableAndNotify = function (options, state, getObserves, value, index) {
if (options.foundObservable && !state.foundObservable) {
if (Observation.trapsCount()) {
Observation.addAll(getObserves());
options.foundObservable(value, index);
state.foundObservable = true;
}
}
};
observeReader = {
read: function (parent, reads, options) {
options = options || {};
var state = { foundObservable: false };
var getObserves;
if (options.foundObservable) {
getObserves = Observation.trap();
}
var cur = readValue(parent, 0, reads, options, state), type, prev, readLength = reads.length, i = 0, last;
checkForObservableAndNotify(options, state, getObserves, parent, 0);
while (i < readLength) {
prev = cur;
for (var r = 0, readersLength = observeReader.propertyReaders.length; r < readersLength; r++) {
var reader = observeReader.propertyReaders[r];
if (reader.test(cur)) {
cur = reader.read(cur, reads[i], i, options, state);
break;
}
}
checkForObservableAndNotify(options, state, getObserves, prev, i);
last = cur;
i = i + 1;
cur = readValue(cur, i, reads, options, state, prev);
checkForObservableAndNotify(options, state, getObserves, prev, i - 1);
type = typeof cur;
if (i < reads.length && (cur === null || cur === undefined)) {
if (options.earlyExit) {
options.earlyExit(prev, i - 1, cur);
}
return {
value: undefined,
parent: prev
};
}
}
if (cur === undefined) {
if (options.earlyExit) {
options.earlyExit(prev, i - 1);
}
}
return {
value: cur,
parent: prev
};
},
get: function (parent, reads, options) {
return observeReader.read(parent, observeReader.reads(reads), options || {}).value;
},
valueReadersMap: {},
valueReaders: [
{
name: 'function',
test: function (value) {
return value && canReflect.isFunctionLike(value) && !canReflect.isConstructorLike(value);
},
read: function (value, i, reads, options, state, prev) {
if (isAt(i, reads)) {
return i === reads.length ? value.bind(prev) : value;
} else if (options.callMethodsOnObservables && canReflect.isObservableLike(prev) && canReflect.isMapLike(prev)) {
return value.apply(prev, options.args || []);
} else if (options.isArgument && i === reads.length) {
return options.proxyMethods !== false ? value.bind(prev) : value;
}
return value.apply(prev, options.args || []);
}
},
{
name: 'isValueLike',
test: function (value, i, reads, options) {
return value && value[getValueSymbol] && value[isValueLikeSymbol] !== false && (options.foundAt || !isAt(i, reads));
},
read: function (value, i, reads, options) {
if (options.readCompute === false && i === reads.length) {
return value;
}
return canReflect.getValue(value);
},
write: function (base, newVal) {
if (base[setValueSymbol]) {
base[setValueSymbol](newVal);
} else if (base.set) {
base.set(newVal);
} else {
base(newVal);
}
}
}
],
propertyReadersMap: {},
propertyReaders: [
{
name: 'map',
test: function (value) {
if (isPromiseLike(value) || typeof value === 'object' && value && typeof value.then === 'function') {
canReflectPromise(value);
}
return canReflect.isObservableLike(value) && canReflect.isMapLike(value);
},
read: function (value, prop) {
var res = canReflect.getKeyValue(value, prop.key);
if (res !== undefined) {
return res;
} else {
return value[prop.key];
}
},
write: canReflect.setKeyValue
},
{
name: 'object',
test: function () {
return true;
},
read: function (value, prop, i, options) {
if (value == null) {
return undefined;
} else {
if (typeof value === 'object') {
if (prop.key in value) {
return value[prop.key];
} else if (prop.at && specialRead[prop.key] && '@' + prop.key in value) {
options.foundAt = true;
dev.warn('Use %' + prop.key + ' in place of @' + prop.key + '.');
return value['@' + prop.key];
}
} else {
return value[prop.key];
}
}
},
write: function (base, prop, newVal) {
base[prop] = newVal;
}
}
],
reads: function (keyArg) {
var key = '' + keyArg;
var keys = [];
var last = 0;
var at = false;
if (key.charAt(0) === '@') {
last = 1;
at = true;
}
var keyToAdd = '';
for (var i = last; i < key.length; i++) {
var character = key.charAt(i);
if (character === '.' || character === '@') {
if (key.charAt(i - 1) !== '\\') {
keys.push({
key: keyToAdd,
at: at
});
at = character === '@';
keyToAdd = '';
} else {
keyToAdd = keyToAdd.substr(0, keyToAdd.length - 1) + '.';
}
} else {
keyToAdd += character;
}
}
keys.push({
key: keyToAdd,
at: at
});
return keys;
},
write: function (parent, key, value, options) {
var keys = typeof key === 'string' ? observeReader.reads(key) : key;
var last;
options = options || {};
if (keys.length > 1) {
last = keys.pop();
parent = observeReader.read(parent, keys, options).value;
keys.push(last);
} else {
last = keys[0];
}
if (observeReader.valueReadersMap.isValueLike.test(parent[last.key], keys.length - 1, keys, options)) {
observeReader.valueReadersMap.isValueLike.write(parent[last.key], value, options);
} else {
if (observeReader.valueReadersMap.isValueLike.test(parent, keys.length - 1, keys, options)) {
parent = parent[getValueSymbol]();
}
if (observeReader.propertyReadersMap.map.test(parent)) {
observeReader.propertyReadersMap.map.write(parent, last.key, value, options);
} else if (observeReader.propertyReadersMap.object.test(parent)) {
observeReader.propertyReadersMap.object.write(parent, last.key, value, options);
if (options.observation) {
options.observation.update();
}
}
}
}
};
each(observeReader.propertyReaders, function (reader) {
observeReader.propertyReadersMap[reader.name] = reader;
});
each(observeReader.valueReaders, function (reader) {
observeReader.valueReadersMap[reader.name] = reader;
});
observeReader.set = observeReader.write;
module.exports = observeReader;
});
/*can-compute@3.3.4#proto-compute*/
define('can-compute/proto-compute', [
'require',
'exports',
'module',
'can-observation',
'can-event',
'can-event/lifecycle/lifecycle',
'can-event/batch/batch',
'can-stache-key',
'can-util/js/get/get',
'can-cid',
'can-util/js/assign/assign',
'can-util/js/log/log',
'can-reflect',
'can-symbol',
'can-util/js/cid-set/cid-set',
'can-util/js/single-reference/single-reference'
], function (require, exports, module) {
var Observation = require('can-observation');
var canEvent = require('can-event');
var eventLifecycle = require('can-event/lifecycle/lifecycle');
require('can-event/batch/batch');
var observeReader = require('can-stache-key');
var getObject = require('can-util/js/get/get');
var CID = require('can-cid');
var assign = require('can-util/js/assign/assign');
var canLog = require('can-util/js/log/log');
var canReflect = require('can-reflect');
var canSymbol = require('can-symbol');
var CIDSet = require('can-util/js/cid-set/cid-set');
var singleReference = require('can-util/js/single-reference/single-reference');
var Compute = function (getterSetter, context, eventName, bindOnce) {
CID(this, 'compute');
var args = [];
for (var i = 0, arglen = arguments.length; i < arglen; i++) {
args[i] = arguments[i];
}
var contextType = typeof args[1];
if (typeof args[0] === 'function') {
this._setupGetterSetterFn(args[0], args[1], args[2], args[3]);
} else if (args[1] !== undefined) {
if (contextType === 'string' || contextType === 'number') {
var isListLike = canReflect.isObservableLike(args[0]) && canReflect.isListLike(args[0]);
var isMapLike = canReflect.isObservableLike(args[0]) && canReflect.isMapLike(args[0]);
if (isMapLike || isListLike) {
var map = args[0];
var propertyName = args[1];
var mapGetterSetter = function (newValue) {
if (arguments.length) {
observeReader.set(map, propertyName, newValue);
} else {
if (isListLike) {
observeReader.get(map, 'length');
}
return observeReader.get(map, '' + propertyName);
}
};
this._setupGetterSetterFn(mapGetterSetter, args[1], args[2], args[3]);
} else {
this._setupProperty(args[0], args[1], args[2]);
}
} else if (contextType === 'function') {
this._setupSetter(args[0], args[1], args[2]);
} else {
if (args[1] && args[1].fn) {
this._setupAsyncCompute(args[0], args[1]);
} else {
this._setupSettings(args[0], args[1]);
}
}
} else {
this._setupSimpleValue(args[0]);
}
this._args = args;
this._primaryDepth = 0;
this.isComputed = true;
};
var updateOnChange = function (compute, newValue, oldValue, batchNum) {
var valueChanged = newValue !== oldValue && !(newValue !== newValue && oldValue !== oldValue);
if (valueChanged) {
canEvent.dispatch.call(compute, {
type: 'change',
batchNum: batchNum
}, [
newValue,
oldValue
]);
}
};
var setupComputeHandlers = function (compute, func, context) {
var observation = new Observation(func, context, compute);
compute.observation = observation;
return {
_on: function () {
observation.start();
compute.value = observation.value;
},
_off: function () {
observation.stop();
},
getDepth: function () {
return observation.getDepth();
}
};
};
assign(Compute.prototype, {
setPrimaryDepth: function (depth) {
this._primaryDepth = depth;
},
_setupGetterSetterFn: function (getterSetter, context, eventName) {
this._set = context ? getterSetter.bind(context) : getterSetter;
this._get = context ? getterSetter.bind(context) : getterSetter;
this._canObserve = eventName === false ? false : true;
var handlers = setupComputeHandlers(this, getterSetter, context || this);
assign(this, handlers);
},
_setupProperty: function (target, propertyName, eventName) {
var self = this, handler;
handler = function () {
self.updater(self._get(), self.value);
};
this._get = function () {
return getObject(target, propertyName);
};
this._set = function (value) {
var properties = propertyName.split('.'), leafPropertyName = properties.pop();
if (properties.length) {
var targetProperty = getObject(target, properties.join('.'));
targetProperty[leafPropertyName] = value;
} else {
target[propertyName] = value;
}
};
this._on = function (update) {
canEvent.on.call(target, eventName || propertyName, handler);
this.value = this._get();
};
this._off = function () {
return canEvent.off.call(target, eventName || propertyName, handler);
};
},
_setupSetter: function (initialValue, setter, eventName) {
this.value = initialValue;
this._set = setter;
assign(this, eventName);
},
_setupSettings: function (initialValue, settings) {
this.value = initialValue;
this._set = settings.set || this._set;
this._get = settings.get || this._get;
if (!settings.__selfUpdater) {
var self = this, oldUpdater = this.updater;
this.updater = function () {
oldUpdater.call(self, self._get(), self.value);
};
}
this._on = settings.on ? settings.on : this._on;
this._off = settings.off ? settings.off : this._off;
},
_setupAsyncCompute: function (initialValue, settings) {
var self = this;
var getter = settings.fn;
var bindings;
this.value = initialValue;
this._setUpdates = true;
this.lastSetValue = new Compute(initialValue);
this._set = function (newVal) {
if (newVal === self.lastSetValue.get()) {
return this.value;
}
return self.lastSetValue.set(newVal);
};
this._get = function () {
return getter.call(settings.context, self.lastSetValue.get());
};
if (getter.length === 0) {
bindings = setupComputeHandlers(this, getter, settings.context);
} else if (getter.length === 1) {
bindings = setupComputeHandlers(this, function () {
return getter.call(settings.context, self.lastSetValue.get());
}, settings);
} else {
var oldUpdater = this.updater, resolve = Observation.ignore(function (newVal) {
oldUpdater.call(self, newVal, self.value);
});
this.updater = function (newVal) {
oldUpdater.call(self, newVal, self.value);
};
bindings = setupComputeHandlers(this, function () {
var res = getter.call(settings.context, self.lastSetValue.get(), resolve);
return res !== undefined ? res : this.value;
}, this);
}
assign(this, bindings);
},
_setupSimpleValue: function (initialValue) {
this.value = initialValue;
},
_eventSetup: Observation.ignore(function () {
this.bound = true;
this._on(this.updater);
}),
_eventTeardown: function () {
this._off(this.updater);
this.bound = false;
},
addEventListener: eventLifecycle.addAndSetup,
removeEventListener: eventLifecycle.removeAndTeardown,
clone: function (context) {
if (context && typeof this._args[0] === 'function') {
this._args[1] = context;
} else if (context) {
this._args[2] = context;
}
return new Compute(this._args[0], this._args[1], this._args[2], this._args[3]);
},
_on: function () {
},
_off: function () {
},
get: function () {
var recordingObservation = Observation.isRecording();
if (recordingObservation && this._canObserve !== false) {
Observation.add(this, 'change');
if (!this.bound) {
Compute.temporarilyBind(this);
}
}
if (this.bound) {
if (this.observation) {
return this.observation.get();
} else {
return this.value;
}
} else {
return this._get();
}
},
_get: function () {
return this.value;
},
set: function (newVal) {
var old = this.value;
var setVal = this._set(newVal, old);
if (this._setUpdates) {
return this.value;
}
if (this.hasDependencies) {
return this._get();
}
this.updater(setVal === undefined ? this._get() : setVal, old);
return this.value;
},
_set: function (newVal) {
return this.value = newVal;
},
updater: function (newVal, oldVal, batchNum) {
this.value = newVal;
if (this.observation) {
this.observation.value = newVal;
}
updateOnChange(this, newVal, oldVal, batchNum);
},
toFunction: function () {
return this._computeFn.bind(this);
},
_computeFn: function (newVal) {
if (arguments.length) {
return this.set(newVal);
}
return this.get();
},
trace: function () {
var me = {
computeValue: this.get(),
definition: this.observation && this.observation.func,
cid: this._cid
};
if (this.observation) {
var deps = [];
for (var name in this.observation.newObserved) {
var obs = assign({}, this.observation.newObserved[name]);
if (obs.obj.isComputed) {
deps.push(obs.obj.trace());
} else {
deps.push(obs);
}
}
me.dependencies = deps;
}
return me;
},
log: function () {
var log = function (trace) {
var currentTrace = '';
if (trace.dependencies && trace.dependencies.length) {
currentTrace = trace.cid + ' = ' + trace.computeValue;
if (typeof console !== 'undefined' && console.group) {
console.group(currentTrace);
} else {
canLog.log(currentTrace);
}
trace.dependencies.forEach(function (dep) {
if (dep.hasOwnProperty('computeValue')) {
log(dep);
} else {
canLog.log(dep.obj, dep.event);
}
});
if (typeof console !== 'undefined' && console.groupEnd) {
console.groupEnd();
}
} else {
canLog.log(trace.cid + ' - ' + trace.computeValue);
}
return trace;
};
return log(this.trace());
}
});
var hasDependencies = function () {
return this.observation && this.observation.hasDependencies();
};
Object.defineProperty(Compute.prototype, 'hasDependencies', { get: hasDependencies });
canReflect.set(Compute.prototype, canSymbol.for('can.valueHasDependencies'), hasDependencies);
Compute.prototype.on = Compute.prototype.bind = Compute.prototype.addEventListener;
Compute.prototype.off = Compute.prototype.unbind = Compute.prototype.removeEventListener;
canReflect.set(Compute.prototype, canSymbol.for('can.onValue'), function (handler) {
var translationHandler = function (ev, newValue) {
handler(newValue);
};
singleReference.set(handler, this, translationHandler);
this.addEventListener('change', translationHandler);
});
canReflect.set(Compute.prototype, canSymbol.for('can.offValue'), function (handler) {
this.removeEventListener('change', singleReference.getAndDelete(handler, this));
});
canReflect.set(Compute.prototype, canSymbol.for('can.getValue'), Compute.prototype.get);
canReflect.set(Compute.prototype, canSymbol.for('can.setValue'), Compute.prototype.set);
Compute.temporarilyBind = Observation.temporarilyBind;
Compute.async = function (initialValue, asyncComputer, context) {
return new Compute(initialValue, {
fn: asyncComputer,
context: context
});
};
Compute.truthy = function (compute) {
return new Compute(function () {
var res = compute.get();
if (typeof res === 'function') {
res = res.get();
}
return !!res;
});
};
canReflect.set(Compute.prototype, canSymbol.for('can.setValue'), Compute.prototype.set);
canReflect.set(Compute.prototype, canSymbol.for('can.isValueLike'), true);
canReflect.set(Compute.prototype, canSymbol.for('can.isMapLike'), false);
canReflect.set(Compute.prototype, canSymbol.for('can.isListLike'), false);
canReflect.set(Compute.prototype, canSymbol.for('can.valueHasDependencies'), function () {
return !!this.observation;
});
canReflect.set(Compute.prototype, canSymbol.for('can.getValueDependencies'), function () {
var ret;
if (this.observation) {
ret = { valueDependencies: new CIDSet() };
ret.valueDependencies.add(this.observation);
}
return ret;
});
module.exports = exports = Compute;
});
/*can-compute@3.3.4#can-compute*/
define('can-compute', [
'require',
'exports',
'module',
'can-event',
'can-event/batch/batch',
'can-compute/proto-compute',
'can-cid',
'can-namespace',
'can-util/js/single-reference/single-reference',
'can-reflect/reflections/get-set/get-set',
'can-symbol'
], function (require, exports, module) {
require('can-event');
require('can-event/batch/batch');
var Compute = require('can-compute/proto-compute');
var CID = require('can-cid');
var namespace = require('can-namespace');
var singleReference = require('can-util/js/single-reference/single-reference');
var canReflect = require('can-reflect/reflections/get-set/get-set');
var canSymbol = require('can-symbol');
var canOnValueSymbol = canSymbol.for('can.onValue'), canOffValueSymbol = canSymbol.for('can.offValue'), canGetValue = canSymbol.for('can.getValue'), canSetValue = canSymbol.for('can.setValue'), isValueLike = canSymbol.for('can.isValueLike'), isMapLike = canSymbol.for('can.isMapLike'), isListLike = canSymbol.for('can.isListLike'), isFunctionLike = canSymbol.for('can.isFunctionLike'), canValueHasDependencies = canSymbol.for('can.valueHasDependencies'), canGetValueDependencies = canSymbol.for('can.getValueDependencies');
var addEventListener = function (ev, handler) {
var compute = this;
var translationHandler;
if (handler) {
translationHandler = function () {
handler.apply(compute, arguments);
};
singleReference.set(handler, this, translationHandler);
}
return compute.computeInstance.addEventListener(ev, translationHandler);
};
var removeEventListener = function (ev, handler) {
return this.computeInstance.removeEventListener(ev, handler && singleReference.getAndDelete(handler, this));
};
var onValue = function (handler) {
return this.computeInstance[canOnValueSymbol](handler);
}, offValue = function (handler) {
return this.computeInstance[canOffValueSymbol](handler);
}, getValue = function () {
return this.computeInstance.get();
}, setValue = function (value) {
return this.computeInstance.set(value);
}, hasDependencies = function () {
return this.computeInstance.hasDependencies;
}, getDependencies = function () {
return this.computeInstance[canGetValueDependencies]();
};
var COMPUTE = function (getterSetter, context, eventName, bindOnce) {
function compute(val) {
if (arguments.length) {
return compute.computeInstance.set(val);
}
return compute.computeInstance.get();
}
var cid = CID(compute, 'compute');
compute.computeInstance = new Compute(getterSetter, context, eventName, bindOnce);
compute.handlerKey = '__handler' + cid;
compute.on = compute.bind = compute.addEventListener = addEventListener;
compute.off = compute.unbind = compute.removeEventListener = removeEventListener;
compute.isComputed = compute.computeInstance.isComputed;
compute.clone = function (ctx) {
if (typeof getterSetter === 'function') {
context = ctx;
}
return COMPUTE(getterSetter, context, ctx, bindOnce);
};
canReflect.set(compute, canOnValueSymbol, onValue);
canReflect.set(compute, canOffValueSymbol, offValue);
canReflect.set(compute, canGetValue, getValue);
canReflect.set(compute, canSetValue, setValue);
canReflect.set(compute, isValueLike, true);
canReflect.set(compute, isMapLike, false);
canReflect.set(compute, isListLike, false);
canReflect.set(compute, isFunctionLike, false);
canReflect.set(compute, canValueHasDependencies, hasDependencies);
canReflect.set(compute, canGetValueDependencies, getDependencies);
return compute;
};
COMPUTE.truthy = function (compute) {
return COMPUTE(function () {
var res = compute();
return !!res;
});
};
COMPUTE.async = function (initialValue, asyncComputer, context) {
return COMPUTE(initialValue, {
fn: asyncComputer,
context: context
});
};
COMPUTE.temporarilyBind = Compute.temporarilyBind;
module.exports = namespace.compute = COMPUTE;
});
/*can-control@3.2.2#can-control*/
define('can-control', [
'require',
'exports',
'module',
'can-construct',
'can-namespace',
'can-util/js/string/string',
'can-util/js/assign/assign',
'can-util/js/is-function/is-function',
'can-util/js/each/each',
'can-util/js/dev/dev',
'can-types',
'can-util/js/get/get',
'can-util/dom/data/data',
'can-util/dom/class-name/class-name',
'can-util/dom/events/events',
'can-event',
'can-compute',
'can-stache-key',
'can-reflect',
'can-util/dom/dispatch/dispatch',
'can-util/dom/events/delegate/delegate'
], function (require, exports, module) {
var Construct = require('can-construct');
var namespace = require('can-namespace');
var string = require('can-util/js/string/string');
var assign = require('can-util/js/assign/assign');
var isFunction = require('can-util/js/is-function/is-function');
var each = require('can-util/js/each/each');
var dev = require('can-util/js/dev/dev');
var types = require('can-types');
var get = require('can-util/js/get/get');
var domData = require('can-util/dom/data/data');
var className = require('can-util/dom/class-name/class-name');
var domEvents = require('can-util/dom/events/events');
var canEvent = require('can-event');
var canCompute = require('can-compute');
var observeReader = require('can-stache-key');
var canReflect = require('can-reflect');
var processors;
require('can-util/dom/dispatch/dispatch');
require('can-util/dom/events/delegate/delegate');
var bind = function (el, ev, callback) {
canEvent.on.call(el, ev, callback);
return function () {
canEvent.off.call(el, ev, callback);
};
}, slice = [].slice, paramReplacer = /\{([^\}]+)\}/g, delegate = function (el, selector, ev, callback) {
canEvent.on.call(el, ev, selector, callback);
return function () {
canEvent.off.call(el, ev, selector, callback);
};
}, binder = function (el, ev, callback, selector) {
return selector ? delegate(el, selector.trim(), ev, callback) : bind(el, ev, callback);
}, basicProcessor;
var Control = Construct.extend({
setup: function () {
Construct.setup.apply(this, arguments);
if (Control) {
var control = this, funcName;
control.actions = {};
for (funcName in control.prototype) {
if (control._isAction(funcName)) {
control.actions[funcName] = control._action(funcName);
}
}
}
},
_shifter: function (context, name) {
var method = typeof name === 'string' ? context[name] : name;
if (!isFunction(method)) {
method = context[method];
}
return function () {
var wrapped = types.wrapElement(this);
context.called = name;
return method.apply(context, [wrapped].concat(slice.call(arguments, 0)));
};
},
_isAction: function (methodName) {
var val = this.prototype[methodName], type = typeof val;
return methodName !== 'constructor' && (type === 'function' || type === 'string' && isFunction(this.prototype[val])) && !!(Control.isSpecial(methodName) || processors[methodName] || /[^\w]/.test(methodName));
},
_action: function (methodName, options, controlInstance) {
var readyCompute;
paramReplacer.lastIndex = 0;
if (options || !paramReplacer.test(methodName)) {
readyCompute = canCompute(function () {
var delegate;
var name = methodName.replace(paramReplacer, function (matched, key) {
var value, parent;
if (this._isDelegate(options, key)) {
delegate = this._getDelegate(options, key);
return '';
}
key = this._removeDelegateFromKey(key);
parent = this._lookup(options)[0];
value = observeReader.read(parent, observeReader.reads(key), { readCompute: false }).value;
if (value === undefined && typeof window !== 'undefined') {
value = get(window, key);
}
if (!parent || !(canReflect.isObservableLike(parent) && canReflect.isMapLike(parent)) && !value) {
dev.log('can/control/control.js: No property found for handling ' + methodName);
return null;
}
if (typeof value === 'string') {
return value;
} else {
delegate = value;
return '';
}
}.bind(this));
name = name.trim();
var parts = name.split(/\s+/g), event = parts.pop();
return {
processor: this.processors[event] || basicProcessor,
parts: [
name,
parts.join(' '),
event
],
delegate: delegate || undefined
};
}, this);
if (controlInstance) {
var handler = function (ev, ready) {
controlInstance._bindings.control[methodName](controlInstance.element);
controlInstance._bindings.control[methodName] = ready.processor(ready.delegate || controlInstance.element, ready.parts[2], ready.parts[1], methodName, controlInstance);
};
readyCompute.bind('change', handler);
controlInstance._bindings.readyComputes[methodName] = {
compute: readyCompute,
handler: handler
};
}
return readyCompute();
}
},
_lookup: function (options) {
return [
options,
window
];
},
_removeDelegateFromKey: function (key) {
return key;
},
_isDelegate: function (options, key) {
return key === 'element';
},
_getDelegate: function (options, key) {
return undefined;
},
processors: {},
defaults: {},
convertElement: function (element) {
element = typeof element === 'string' ? document.querySelector(element) : element;
return types.wrapElement(element);
},
isSpecial: function (eventName) {
return eventName === 'inserted' || eventName === 'removed';
}
}, {
setup: function (element, options) {
var cls = this.constructor, pluginname = cls.pluginName || cls.shortName, arr;
if (!element) {
throw new Error('Creating an instance of a named control without passing an element');
}
this.element = cls.convertElement(element);
if (pluginname && pluginname !== 'can_control') {
className.add.call(this.element, pluginname);
}
arr = domData.get.call(this.element, 'controls');
if (!arr) {
arr = [];
domData.set.call(this.element, 'controls', arr);
}
arr.push(this);
if (canReflect.isObservableLike(options) && canReflect.isMapLike(options)) {
for (var prop in cls.defaults) {
if (!options.hasOwnProperty(prop)) {
observeReader.set(options, prop, cls.defaults[prop]);
}
}
this.options = options;
} else {
this.options = assign(assign({}, cls.defaults), options);
}
this.on();
return [
this.element,
this.options
];
},
on: function (el, selector, eventName, func) {
if (!el) {
this.off();
var cls = this.constructor, bindings = this._bindings, actions = cls.actions, element = types.unwrapElement(this.element), destroyCB = Control._shifter(this, 'destroy'), funcName, ready;
for (funcName in actions) {
if (actions.hasOwnProperty(funcName)) {
ready = actions[funcName] || cls._action(funcName, this.options, this);
if (ready) {
bindings.control[funcName] = ready.processor(ready.delegate || element, ready.parts[2], ready.parts[1], funcName, this);
}
}
}
domEvents.addEventListener.call(element, 'removed', destroyCB);
bindings.user.push(function (el) {
domEvents.removeEventListener.call(el, 'removed', destroyCB);
});
return bindings.user.length;
}
if (typeof el === 'string') {
func = eventName;
eventName = selector;
selector = el;
el = this.element;
}
if (func === undefined) {
func = eventName;
eventName = selector;
selector = null;
}
if (typeof func === 'string') {
func = Control._shifter(this, func);
}
this._bindings.user.push(binder(el, eventName, func, selector));
return this._bindings.user.length;
},
off: function () {
var el = types.unwrapElement(this.element), bindings = this._bindings;
if (bindings) {
each(bindings.user || [], function (value) {
value(el);
});
each(bindings.control || {}, function (value) {
value(el);
});
each(bindings.readyComputes || {}, function (value) {
value.compute.unbind('change', value.handler);
});
}
this._bindings = {
user: [],
control: {},
readyComputes: {}
};
},
destroy: function () {
if (this.element === null) {
dev.warn('can/control/control.js: Control already destroyed');
return;
}
var Class = this.constructor, pluginName = Class.pluginName || Class.shortName && string.underscore(Class.shortName), controls;
this.off();
if (pluginName && pluginName !== 'can_control') {
className.remove.call(this.element, pluginName);
}
controls = domData.get.call(this.element, 'controls');
if (controls) {
controls.splice(controls.indexOf(this), 1);
}
canEvent.dispatch.call(this, 'destroyed');
this.element = null;
}
});
processors = Control.processors;
basicProcessor = function (el, event, selector, methodName, control) {
return binder(el, event, Control._shifter(control, methodName), selector);
};
each([
'beforeremove',
'change',
'click',
'contextmenu',
'dblclick',
'keydown',
'keyup',
'keypress',
'mousedown',
'mousemove',
'mouseout',
'mouseover',
'mouseup',
'reset',
'resize',
'scroll',
'select',
'submit',
'focusin',
'focusout',
'mouseenter',
'mouseleave',
'touchstart',
'touchmove',
'touchcancel',
'touchend',
'touchleave',
'inserted',
'removed',
'dragstart',
'dragenter',
'dragover',
'dragleave',
'drag',
'drop',
'dragend'
], function (v) {
processors[v] = basicProcessor;
});
module.exports = namespace.Control = Control;
});
/*can-component@3.3.4#control/control*/
define('can-component/control/control', [
'require',
'exports',
'module',
'can-control',
'can-util/js/each/each',
'can-util/js/string/string',
'can-compute',
'can-stache-key'
], function (require, exports, module) {
var Control = require('can-control');
var canEach = require('can-util/js/each/each');
var string = require('can-util/js/string/string');
var canCompute = require('can-compute');
var observeReader = require('can-stache-key');
var paramReplacer = /\{([^\}]+)\}/g;
var ComponentControl = Control.extend({
_lookup: function (options) {
return [
options.scope,
options,
window
];
},
_removeDelegateFromKey: function (key) {
return key.replace(/^(scope|^viewModel)\./, '');
},
_isDelegate: function (options, key) {
return key === 'scope' || key === 'viewModel';
},
_getDelegate: function (options, key) {
return options[key];
},
_action: function (methodName, options, controlInstance) {
var hasObjectLookup;
paramReplacer.lastIndex = 0;
hasObjectLookup = paramReplacer.test(methodName);
if (!controlInstance && hasObjectLookup) {
return;
} else {
return Control._action.apply(this, arguments);
}
}
}, {
setup: function (el, options) {
this.scope = options.scope;
this.viewModel = options.viewModel;
return Control.prototype.setup.call(this, el, options);
},
off: function () {
if (this._bindings) {
canEach(this._bindings.readyComputes || {}, function (value) {
value.compute.unbind('change', value.handler);
});
}
Control.prototype.off.apply(this, arguments);
this._bindings.readyComputes = {};
},
destroy: function () {
Control.prototype.destroy.apply(this, arguments);
if (typeof this.options.destroy === 'function') {
this.options.destroy.apply(this, arguments);
}
}
});
module.exports = ComponentControl;
});
/*can-simple-map@3.3.1#can-simple-map*/
define('can-simple-map', [
'require',
'exports',
'module',
'can-construct',
'can-event',
'can-event/batch/batch',
'can-util/js/assign/assign',
'can-util/js/each/each',
'can-types',
'can-observation',
'can-reflect',
'can-util/js/single-reference/single-reference',
'can-util/js/cid-map/cid-map'
], function (require, exports, module) {
var Construct = require('can-construct');
var canEvent = require('can-event');
var canBatch = require('can-event/batch/batch');
var assign = require('can-util/js/assign/assign');
var each = require('can-util/js/each/each');
var types = require('can-types');
var Observation = require('can-observation');
var canReflect = require('can-reflect');
var singleReference = require('can-util/js/single-reference/single-reference');
var CIDMap = require('can-util/js/cid-map/cid-map');
var SimpleMap = Construct.extend({
setup: function (initialData) {
this._data = {};
this.attr(initialData);
},
attr: function (prop, value) {
var self = this;
if (arguments.length === 0) {
Observation.add(this, '__keys');
var data = {};
each(this._data, function (value, prop) {
Observation.add(this, prop);
data[prop] = value;
}, this);
return data;
} else if (arguments.length > 1) {
var had = this._data.hasOwnProperty(prop);
var old = this._data[prop];
this._data[prop] = value;
canBatch.start();
if (!had) {
canEvent.dispatch.call(this, '__keys', []);
}
canEvent.dispatch.call(this, prop, [
value,
old
]);
canBatch.stop();
} else if (typeof prop === 'object') {
canReflect.eachKey(prop, function (value, key) {
self.attr(key, value);
});
} else {
if (prop !== 'constructor') {
Observation.add(this, prop);
return this._data[prop];
}
return this.constructor;
}
},
serialize: function () {
return canReflect.serialize(this, CIDMap);
},
get: function () {
return this.attr.apply(this, arguments);
},
set: function () {
return this.attr.apply(this, arguments);
}
});
assign(SimpleMap.prototype, canEvent);
if (!types.DefaultMap) {
types.DefaultMap = SimpleMap;
}
canReflect.assignSymbols(SimpleMap.prototype, {
'can.isMapLike': true,
'can.isListLike': false,
'can.isValueLike': false,
'can.getKeyValue': SimpleMap.prototype.get,
'can.setKeyValue': SimpleMap.prototype.set,
'can.deleteKeyValue': function (prop) {
return this.attr(prop, undefined);
},
'can.getOwnEnumerableKeys': function () {
Observation.add(this, '__keys');
return Object.keys(this._data);
},
'can.assignDeep': function (source) {
canBatch.start();
canReflect.assignMap(this, source);
canBatch.stop();
},
'can.updateDeep': function (source) {
canBatch.start();
canReflect.updateMap(this, source);
canBatch.stop();
},
'can.onKeyValue': function (key, handler) {
var translationHandler = function (ev, newValue, oldValue) {
handler.call(this, newValue, oldValue);
};
singleReference.set(handler, this, translationHandler, key);
this.addEventListener(key, translationHandler);
},
'can.offKeyValue': function (key, handler) {
this.removeEventListener(key, singleReference.getAndDelete(handler, this, key));
},
'can.keyHasDependencies': function (key) {
return false;
},
'can.getKeyDependencies': function (key) {
return undefined;
}
});
module.exports = SimpleMap;
});
/*can-view-scope@3.3.8#reference-map*/
define('can-view-scope/reference-map', [
'require',
'exports',
'module',
'can-simple-map'
], function (require, exports, module) {
var SimpleMap = require('can-simple-map');
var ReferenceMap = SimpleMap.extend({});
module.exports = ReferenceMap;
});
/*can-view-scope@3.3.8#compute_data*/
define('can-view-scope/compute_data', [
'require',
'exports',
'module',
'can-observation',
'can-stache-key',
'can-compute',
'can-util/js/assign/assign',
'can-util/js/is-function/is-function',
'can-event/batch/batch',
'can-cid',
'can-reflect',
'can-symbol'
], function (require, exports, module) {
'use strict';
var Observation = require('can-observation');
var observeReader = require('can-stache-key');
var makeCompute = require('can-compute');
var assign = require('can-util/js/assign/assign');
var isFunction = require('can-util/js/is-function/is-function');
var canBatch = require('can-event/batch/batch');
var CID = require('can-cid');
var canReflect = require('can-reflect');
var canSymbol = require('can-symbol');
var getFastPathRoot = function (computeData) {
if (computeData.reads && computeData.reads.length === 1) {
var root = computeData.root;
if (root && root[canSymbol.for('can.getValue')]) {
root = canReflect.getValue(root);
}
return root && canReflect.isObservableLike(root) && canReflect.isMapLike(root) && !isFunction(root[computeData.reads[0].key]) && root;
}
return;
};
var isEventObject = function (obj) {
return obj && typeof obj.batchNum === 'number' && typeof obj.type === 'string';
};
var ScopeKeyData = function (scope, key, options) {
CID(this);
this.startingScope = scope;
this.key = key;
this.observation = new Observation(this.read, this);
this.options = assign({ observation: this.observation }, options);
this.handlers = [];
this.dispatchHandler = this.dispatch.bind(this);
this.fastPath = undefined;
this.root = undefined;
this.initialValue = undefined;
this.reads = undefined;
this.setRoot = undefined;
};
ScopeKeyData.prototype.getValue = function () {
Observation.add(this);
return this.getObservationValue();
};
ScopeKeyData.prototype.getObservationValue = Observation.ignore(function () {
return this.observation.get();
});
ScopeKeyData.prototype.read = function () {
if (this.root) {
return observeReader.read(this.root, this.reads, this.options).value;
}
var data = this.startingScope.read(this.key, this.options);
this.scope = data.scope;
this.reads = data.reads;
this.root = data.rootObserve;
this.setRoot = data.setRoot;
return this.initialValue = data.value;
};
ScopeKeyData.prototype.setValue = function (newVal) {
var root = this.root || this.setRoot;
if (root) {
observeReader.write(root, this.reads, newVal, this.options);
} else {
this.startingScope.set(this.key, newVal, this.options);
}
};
ScopeKeyData.prototype.hasDependencies = function () {
return this.observation.hasDependencies();
};
var canOnValue = canSymbol.for('can.onValue'), canOffValue = canSymbol.for('can.offValue');
canReflect.set(ScopeKeyData.prototype, canOnValue, function (handler) {
if (!this.handlers.length) {
canReflect.onValue(this.observation, this.dispatchHandler);
var fastPathRoot = getFastPathRoot(this);
if (fastPathRoot) {
var self = this, observation = this.observation;
this.fastPath = true;
observation.dependencyChange = function (target, newVal, altNewValue) {
if (isEventObject(newVal)) {
newVal = altNewValue;
}
if (target === fastPathRoot && typeof newVal !== 'function') {
this.newVal = newVal;
} else {
observation.dependencyChange = Observation.prototype.dependencyChange;
observation.start = Observation.prototype.start;
self.fastPath = false;
}
return Observation.prototype.dependencyChange.call(this, target, newVal, altNewValue);
};
observation.start = function () {
this.value = this.newVal;
};
}
}
this.handlers.push(handler);
});
ScopeKeyData.prototype.dispatch = function () {
var handlers = this.handlers.slice(0);
for (var i = 0, len = handlers.length; i < len; i++) {
canBatch.batchNum = this.observation.batchNum;
handlers[i].apply(this, arguments);
}
};
canReflect.set(ScopeKeyData.prototype, canOffValue, function (handler) {
var index = this.handlers.indexOf(handler);
this.handlers.splice(index, 1);
if (!this.handlers.length) {
canReflect.offValue(this.observation, this.dispatchHandler);
this.observation.dependencyChange = Observation.prototype.dependencyChange;
this.observation.start = Observation.prototype.start;
}
});
canReflect.set(ScopeKeyData.prototype, canSymbol.for('can.getValue'), ScopeKeyData.prototype.getValue);
canReflect.set(ScopeKeyData.prototype, canSymbol.for('can.setValue'), ScopeKeyData.prototype.setValue);
canReflect.set(ScopeKeyData.prototype, canSymbol.for('can.valueHasDependencies'), ScopeKeyData.prototype.hasDependencies);
Object.defineProperty(ScopeKeyData.prototype, 'compute', {
get: function () {
var scopeKeyData = this;
var compute = makeCompute(undefined, {
on: function (updater) {
scopeKeyData[canOnValue](updater);
this.value = scopeKeyData.observation.value;
},
off: function (updater) {
scopeKeyData[canOffValue](updater);
},
get: function () {
return scopeKeyData.observation.get();
},
set: function (newValue) {
return scopeKeyData.setValue(newValue);
}
});
compute.computeInstance.observation = this.observation;
compute.computeInstance._canObserve = false;
Object.defineProperty(this, 'compute', {
value: compute,
writable: false,
configurable: false
});
return compute;
},
configurable: true
});
module.exports = function (scope, key, options) {
return new ScopeKeyData(scope, key, options || { args: [] });
};
});
/*can-view-scope@3.3.8#can-view-scope*/
define('can-view-scope', [
'require',
'exports',
'module',
'can-stache-key',
'can-observation',
'can-view-scope/reference-map',
'can-view-scope/compute_data',
'can-util/js/assign/assign',
'can-util/js/each/each',
'can-namespace',
'can-util/js/dev/dev',
'can-reflect',
'can-util/js/log/log'
], function (require, exports, module) {
var observeReader = require('can-stache-key');
var Observation = require('can-observation');
var ReferenceMap = require('can-view-scope/reference-map');
var makeComputeData = require('can-view-scope/compute_data');
var assign = require('can-util/js/assign/assign');
var each = require('can-util/js/each/each');
var namespace = require('can-namespace');
var dev = require('can-util/js/dev/dev');
var canReflect = require('can-reflect');
var canLog = require('can-util/js/log/log');
function Scope(context, parent, meta) {
this._context = context;
this._parent = parent;
this._meta = meta || {};
this.__cache = {};
}
assign(Scope, {
read: observeReader.read,
Refs: ReferenceMap,
refsScope: function () {
return new Scope(new this.Refs());
},
keyInfo: function (attr) {
var info = {};
info.isDotSlash = attr.substr(0, 2) === './';
info.isThisDot = attr.substr(0, 5) === 'this.';
info.isThisAt = attr.substr(0, 5) === 'this@';
info.isInCurrentContext = info.isDotSlash || info.isThisDot || info.isThisAt;
info.isInParentContext = attr.substr(0, 3) === '../';
info.isCurrentContext = attr === '.' || attr === 'this';
info.isParentContext = attr === '..';
info.isContextBased = info.isInCurrentContext || info.isInParentContext || info.isCurrentContext || info.isParentContext;
return info;
}
});
assign(Scope.prototype, {
add: function (context, meta) {
if (context !== this._context) {
return new this.constructor(context, this, meta);
} else {
return this;
}
},
read: function (attr, options) {
if (attr === '%root') {
return { value: this.getRoot() };
}
if (attr === '%scope') {
return { value: this };
}
var keyInfo = Scope.keyInfo(attr);
if (keyInfo.isContextBased && this._meta.notContext) {
return this._parent.read(attr, options);
}
var currentScopeOnly;
if (keyInfo.isInCurrentContext) {
currentScopeOnly = true;
attr = keyInfo.isDotSlash ? attr.substr(2) : attr.substr(5);
} else if (keyInfo.isInParentContext || keyInfo.isParentContext) {
var parent = this._parent;
while (parent._meta.notContext) {
parent = parent._parent;
}
if (keyInfo.isParentContext) {
return observeReader.read(parent._context, [], options);
}
return parent.read(attr.substr(3) || '.', options);
} else if (keyInfo.isCurrentContext) {
return observeReader.read(this._context, [], options);
}
var keyReads = observeReader.reads(attr);
if (keyReads[0].key.charAt(0) === '*') {
return this.getRefs()._read(keyReads, options, true);
} else {
return this._read(keyReads, options, currentScopeOnly);
}
},
_read: function (keyReads, options, currentScopeOnly) {
var currentScope = this, currentContext, undefinedObserves = [], currentObserve, currentReads, setObserveDepth = -1, currentSetReads, currentSetObserve, readOptions = assign({
foundObservable: function (observe, nameIndex) {
currentObserve = observe;
currentReads = keyReads.slice(nameIndex);
},
earlyExit: function (parentValue, nameIndex) {
if (nameIndex > setObserveDepth || nameIndex === setObserveDepth && (typeof parentValue === 'object' && keyReads[nameIndex].key in parentValue)) {
currentSetObserve = currentObserve;
currentSetReads = currentReads;
setObserveDepth = nameIndex;
}
}
}, options);
while (currentScope) {
currentContext = currentScope._context;
if (currentContext !== null && (typeof currentContext === 'object' || typeof currentContext === 'function')) {
var getObserves = Observation.trap();
var data = observeReader.read(currentContext, keyReads, readOptions);
var observes = getObserves();
if (data.value !== undefined) {
Observation.addAll(observes);
return {
scope: currentScope,
rootObserve: currentObserve,
value: data.value,
reads: currentReads
};
} else {
undefinedObserves.push.apply(undefinedObserves, observes);
}
}
if (currentScopeOnly) {
currentScope = null;
} else {
currentScope = currentScope._parent;
}
}
Observation.addAll(undefinedObserves);
return {
setRoot: currentSetObserve,
reads: currentSetReads,
value: undefined
};
},
get: function (key, options) {
options = assign({ isArgument: true }, options);
var res = this.read(key, options);
return res.value;
},
peek: Observation.ignore(function (key, options) {
return this.get(key, options);
}),
peak: Observation.ignore(function (key, options) {
dev.warn('peak is deprecated, please use peek instead');
return this.peek(key, options);
}),
getScope: function (tester) {
var scope = this;
while (scope) {
if (tester(scope)) {
return scope;
}
scope = scope._parent;
}
},
getContext: function (tester) {
var res = this.getScope(tester);
return res && res._context;
},
getRefs: function () {
var lastScope;
var refScope = this.getScope(function (scope) {
lastScope = scope;
return scope._context instanceof Scope.Refs;
});
if (!refScope) {
lastScope._parent = Scope.refsScope();
refScope = lastScope._parent;
}
return refScope;
},
getRoot: function () {
var cur = this, child = this;
while (cur._parent) {
child = cur;
cur = cur._parent;
}
if (cur._context instanceof Scope.Refs) {
cur = child;
}
return cur._context;
},
set: function (key, value, options) {
options = options || {};
var keyInfo = Scope.keyInfo(key);
if (keyInfo.isCurrentContext) {
return canReflect.setValue(this._context, value);
} else if (keyInfo.isInParentContext || keyInfo.isParentContext) {
var parent = this._parent;
while (parent._meta.notContext) {
parent = parent._parent;
}
if (keyInfo.isParentContext) {
return canReflect.setValue(parent._context, value);
}
return parent.set(key.substr(3) || '.', value, options);
}
var dotIndex = key.lastIndexOf('.'), slashIndex = key.lastIndexOf('/'), contextPath, propName;
if (slashIndex > dotIndex) {
contextPath = key.substring(0, slashIndex);
propName = key.substring(slashIndex + 1, key.length);
} else {
if (dotIndex !== -1) {
contextPath = key.substring(0, dotIndex);
propName = key.substring(dotIndex + 1, key.length);
} else {
contextPath = '.';
propName = key;
}
}
if (key.charAt(0) === '*') {
observeReader.write(this.getRefs()._context, key, value, options);
} else {
var context = this.read(contextPath, options).value;
if (context === undefined) {
dev.error('Attempting to set a value at ' + key + ' where ' + contextPath + ' is undefined.');
return;
}
if (!canReflect.isObservableLike(context) && canReflect.isObservableLike(context[propName])) {
if (canReflect.isMapLike(context[propName])) {
dev.warn('can-view-scope: Merging data into "' + propName + '" because its parent is non-observable');
canReflect.updateDeep(context[propName], value);
} else if (canReflect.isValueLike(context[propName])) {
canReflect.setValue(context[propName], value);
} else {
observeReader.write(context, propName, value, options);
}
} else {
observeReader.write(context, propName, value, options);
}
}
},
attr: Observation.ignore(function (key, value, options) {
canLog.warn('can-view-scope::attr is deprecated, please use peek, get or set');
options = assign({ isArgument: true }, options);
if (arguments.length === 2) {
return this.set(key, value, options);
} else {
return this.get(key, options);
}
}),
computeData: function (key, options) {
return makeComputeData(this, key, options);
},
compute: function (key, options) {
return this.computeData(key, options).compute;
},
cloneFromRef: function () {
var contexts = [];
var scope = this, context, parent;
while (scope) {
context = scope._context;
if (context instanceof Scope.Refs) {
parent = scope._parent;
break;
}
contexts.unshift(context);
scope = scope._parent;
}
if (parent) {
each(contexts, function (context) {
parent = parent.add(context);
});
return parent;
} else {
return this;
}
}
});
function Options(data, parent, meta) {
if (!data.helpers && !data.partials && !data.tags) {
data = { helpers: data };
}
Scope.call(this, data, parent, meta);
}
Options.prototype = new Scope();
Options.prototype.constructor = Options;
Scope.Options = Options;
namespace.view = namespace.view || {};
module.exports = namespace.view.Scope = Scope;
});
/*can-stache@3.9.0#src/utils*/
define('can-stache/src/utils', [
'require',
'exports',
'module',
'can-view-scope',
'can-observation',
'can-stache-key',
'can-compute',
'can-reflect',
'can-util/js/is-array-like/is-array-like'
], function (require, exports, module) {
var Scope = require('can-view-scope');
var Observation = require('can-observation');
var observationReader = require('can-stache-key');
var compute = require('can-compute');
var canReflect = require('can-reflect');
var isArrayLike = require('can-util/js/is-array-like/is-array-like');
var Options = Scope.Options;
var noop = function () {
};
module.exports = {
isArrayLike: isArrayLike,
emptyHandler: function () {
},
jsonParse: function (str) {
if (str[0] === '\'') {
return str.substr(1, str.length - 2);
} else if (str === 'undefined') {
return undefined;
} else {
return JSON.parse(str);
}
},
mixins: {
last: function () {
return this.stack[this.stack.length - 1];
},
add: function (chars) {
this.last().add(chars);
},
subSectionDepth: function () {
return this.stack.length - 1;
}
},
convertToScopes: function (helperOptions, scope, options, nodeList, truthyRenderer, falseyRenderer, isStringOnly) {
helperOptions.fn = truthyRenderer ? this.makeRendererConvertScopes(truthyRenderer, scope, options, nodeList, isStringOnly) : noop;
helperOptions.inverse = falseyRenderer ? this.makeRendererConvertScopes(falseyRenderer, scope, options, nodeList, isStringOnly) : noop;
helperOptions.isSection = !!(truthyRenderer || falseyRenderer);
},
makeRendererConvertScopes: function (renderer, parentScope, parentOptions, nodeList, observeObservables) {
var rendererWithScope = function (ctx, opts, parentNodeList) {
return renderer(ctx || parentScope, opts, parentNodeList);
};
var convertedRenderer = function (newScope, newOptions, parentNodeList) {
if (newScope !== undefined && !(newScope instanceof Scope)) {
if (parentScope) {
newScope = parentScope.add(newScope);
} else {
newScope = Scope.refsScope().add(newScope || {});
}
}
if (newOptions !== undefined && !(newOptions instanceof Options)) {
newOptions = parentOptions.add(newOptions);
}
var result = rendererWithScope(newScope, newOptions || parentOptions, parentNodeList || nodeList);
return result;
};
return observeObservables ? convertedRenderer : Observation.ignore(convertedRenderer);
},
getItemsStringContent: function (items, isObserveList, helperOptions, options) {
var txt = '', len = observationReader.get(items, 'length'), isObservable = canReflect.isObservableLike(items);
for (var i = 0; i < len; i++) {
var item = isObservable ? compute(items, '' + i) : items[i];
txt += helperOptions.fn(item, options);
}
return txt;
},
getItemsFragContent: function (items, helperOptions, scope, asVariable) {
var result = [], len = observationReader.get(items, 'length'), isObservable = canReflect.isObservableLike(items);
for (var i = 0; i < len; i++) {
var aliases = {
'%index': i,
'@index': i
};
var item = isObservable ? compute(items, '' + i) : items[i];
if (asVariable) {
aliases[asVariable] = item;
}
result.push(helperOptions.fn(scope.add(aliases, { notContext: true }).add(item)));
}
return result;
},
Options: Options
};
});
/*can-attribute-encoder@0.3.1#can-attribute-encoder*/
define('can-attribute-encoder', [
'require',
'exports',
'module',
'can-namespace',
'can-log/dev/dev'
], function (require, exports, module) {
var namespace = require('can-namespace');
var dev = require('can-log/dev/dev');
function each(items, callback) {
for (var i = 0; i < items.length; i++) {
callback(items[i], i);
}
}
function makeMap(str) {
var obj = {}, items = str.split(',');
each(items, function (name) {
obj[name] = true;
});
return obj;
}
var caseMattersAttributes = makeMap('allowReorder,attributeName,attributeType,autoReverse,baseFrequency,baseProfile,calcMode,clipPathUnits,contentScriptType,contentStyleType,diffuseConstant,edgeMode,externalResourcesRequired,filterRes,filterUnits,glyphRef,gradientTransform,gradientUnits,kernelMatrix,kernelUnitLength,keyPoints,keySplines,keyTimes,lengthAdjust,limitingConeAngle,markerHeight,markerUnits,markerWidth,maskContentUnits,maskUnits,patternContentUnits,patternTransform,patternUnits,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,repeatCount,repeatDur,requiredExtensions,requiredFeatures,specularConstant,specularExponent,spreadMethod,startOffset,stdDeviation,stitchTiles,surfaceScale,systemLanguage,tableValues,textLength,viewBox,viewTarget,xChannelSelector,yChannelSelector');
function camelCaseToSpinalCase(match, lowerCaseChar, upperCaseChar) {
return lowerCaseChar + '-' + upperCaseChar.toLowerCase();
}
function startsWith(allOfIt, startsWith) {
return allOfIt.indexOf(startsWith) === 0;
}
function endsWith(allOfIt, endsWith) {
return allOfIt.length - allOfIt.indexOf(endsWith) === endsWith.length;
}
var regexes = {
leftParens: /\(/g,
rightParens: /\)/g,
leftBrace: /\{/g,
rightBrace: /\}/g,
camelCase: /([a-z])([A-Z])/g,
forwardSlash: /\//g,
space: /\s/g,
uppercase: /[A-Z]/g,
uppercaseDelimiterThenChar: /:u:([a-z])/g,
caret: /\^/g,
dollar: /\$/g,
at: /@/g
};
var delimiters = {
prependUppercase: ':u:',
replaceSpace: ':s:',
replaceForwardSlash: ':f:',
replaceLeftParens: ':lp:',
replaceRightParens: ':rp:',
replaceLeftBrace: ':lb:',
replaceRightBrace: ':rb:',
replaceCaret: ':c:',
replaceDollar: ':d:',
replaceAt: ':at:'
};
var encoder = {};
encoder.encode = function (name) {
var encoded = name;
if (!caseMattersAttributes[encoded] && encoded.match(regexes.camelCase)) {
if (startsWith(encoded, 'on:') || endsWith(encoded, ':to') || endsWith(encoded, ':from') || endsWith(encoded, ':bind')) {
encoded = encoded.replace(regexes.uppercase, function (char) {
return delimiters.prependUppercase + char.toLowerCase();
});
} else {
encoded = encoded.replace(regexes.camelCase, camelCaseToSpinalCase);
dev.warn('can-attribute-encoder: Found attribute with name: ' + name + '. Converting to: ' + encoded + '.');
}
}
encoded = encoded.replace(regexes.space, delimiters.replaceSpace).replace(regexes.forwardSlash, delimiters.replaceForwardSlash).replace(regexes.leftParens, delimiters.replaceLeftParens).replace(regexes.rightParens, delimiters.replaceRightParens).replace(regexes.leftBrace, delimiters.replaceLeftBrace).replace(regexes.rightBrace, delimiters.replaceRightBrace).replace(regexes.caret, delimiters.replaceCaret).replace(regexes.dollar, delimiters.replaceDollar).replace(regexes.at, delimiters.replaceAt);
return encoded;
};
encoder.decode = function (name) {
var decoded = name;
decoded = decoded.replace(delimiters.replaceLeftParens, '(').replace(delimiters.replaceRightParens, ')').replace(delimiters.replaceLeftBrace, '{').replace(delimiters.replaceRightBrace, '}').replace(delimiters.replaceForwardSlash, '/').replace(delimiters.replaceSpace, ' ').replace(delimiters.replaceCaret, '^').replace(delimiters.replaceDollar, '$').replace(delimiters.replaceAt, '@');
if (!caseMattersAttributes[decoded] && decoded.match(regexes.uppercaseDelimiterThenChar)) {
if (startsWith(decoded, 'on:') || endsWith(decoded, ':to') || endsWith(decoded, ':from') || endsWith(decoded, ':bind')) {
decoded = decoded.replace(regexes.uppercaseDelimiterThenChar, function (match, char) {
return char.toUpperCase();
});
}
}
return decoded;
};
if (namespace.encoder) {
throw new Error('You can\'t have two versions of can-attribute-encoder, check your dependencies');
} else {
module.exports = namespace.encoder = encoder;
}
});
/*can-view-parser@3.5.1#can-view-parser*/
define('can-view-parser', [
'require',
'exports',
'module',
'can-namespace',
'can-log/dev/dev',
'can-attribute-encoder'
], function (require, exports, module) {
var namespace = require('can-namespace'), dev = require('can-log/dev/dev'), encoder = require('can-attribute-encoder');
function each(items, callback) {
for (var i = 0; i < items.length; i++) {
callback(items[i], i);
}
}
function makeMap(str) {
var obj = {}, items = str.split(',');
each(items, function (name) {
obj[name] = true;
});
return obj;
}
function handleIntermediate(intermediate, handler) {
for (var i = 0, len = intermediate.length; i < len; i++) {
var item = intermediate[i];
handler[item.tokenType].apply(handler, item.args);
}
return intermediate;
}
var alphaNumeric = 'A-Za-z0-9', alphaNumericHU = '-:_' + alphaNumeric, defaultMagicStart = '{{', endTag = new RegExp('^<\\/([' + alphaNumericHU + ']+)[^>]*>'), defaultMagicMatch = new RegExp('\\{\\{(![\\s\\S]*?!|[\\s\\S]*?)\\}\\}\\}?', 'g'), space = /\s/, alphaRegex = new RegExp('[' + alphaNumeric + ']');
var empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed');
var caseMattersElements = makeMap('altGlyph,altGlyphDef,altGlyphItem,animateColor,animateMotion,animateTransform,clipPath,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,foreignObject,glyphRef,linearGradient,radialGradient,textPath');
var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr');
var special = makeMap('script');
var tokenTypes = 'start,end,close,attrStart,attrEnd,attrValue,chars,comment,special,done'.split(',');
var startOppositesMap = {
'{': '}',
'(': ')'
};
var fn = function () {
};
var HTMLParser = function (html, handler, returnIntermediate) {
if (typeof html === 'object') {
return handleIntermediate(html, handler);
}
var intermediate = [];
handler = handler || {};
if (returnIntermediate) {
each(tokenTypes, function (name) {
var callback = handler[name] || fn;
handler[name] = function () {
if (callback.apply(this, arguments) !== false) {
intermediate.push({
tokenType: name,
args: [].slice.call(arguments, 0)
});
}
};
});
}
var magicMatch = handler.magicMatch || defaultMagicMatch, magicStart = handler.magicStart || defaultMagicStart;
function parseStartTag(tag, tagName, rest, unary) {
tagName = caseMattersElements[tagName] ? tagName : tagName.toLowerCase();
if (closeSelf[tagName] && stack.last() === tagName) {
parseEndTag('', tagName);
}
unary = empty[tagName] || !!unary;
handler.start(tagName, unary);
if (!unary) {
stack.push(tagName);
}
HTMLParser.parseAttrs(rest, handler);
handler.end(tagName, unary);
}
function parseEndTag(tag, tagName) {
var pos;
if (!tagName) {
pos = 0;
} else {
tagName = caseMattersElements[tagName] ? tagName : tagName.toLowerCase();
for (pos = stack.length - 1; pos >= 0; pos--) {
if (stack[pos] === tagName) {
break;
}
}
}
if (typeof tag === 'undefined') {
if (stack.length > 0) {
dev.warn('expected closing tag </' + stack[pos] + '>');
}
} else if (pos < 0 || pos !== stack.length - 1) {
if (stack.length > 0) {
dev.warn('unexpected closing tag ' + tag + ' expected </' + stack[stack.length - 1] + '>');
} else {
dev.warn('unexpected closing tag ' + tag);
}
}
if (pos >= 0) {
for (var i = stack.length - 1; i >= pos; i--) {
if (handler.close) {
handler.close(stack[i]);
}
}
stack.length = pos;
}
}
function parseMustache(mustache, inside) {
if (handler.special) {
handler.special(inside);
}
}
var callChars = function () {
if (charsText) {
if (handler.chars) {
handler.chars(charsText);
}
}
charsText = '';
};
var index, chars, match, stack = [], last = html, charsText = '';
stack.last = function () {
return this[this.length - 1];
};
while (html) {
chars = true;
if (!stack.last() || !special[stack.last()]) {
if (html.indexOf('<!--') === 0) {
index = html.indexOf('-->');
if (index >= 0) {
callChars();
if (handler.comment) {
handler.comment(html.substring(4, index));
}
html = html.substring(index + 3);
chars = false;
}
} else if (html.indexOf('</') === 0) {
match = html.match(endTag);
if (match) {
callChars();
html = html.substring(match[0].length);
match[0].replace(endTag, parseEndTag);
chars = false;
}
} else if (html.indexOf('<') === 0) {
var res = HTMLParser.searchStartTag(html);
if (res) {
callChars();
html = res.html;
parseStartTag.apply(null, res.match);
chars = false;
}
} else if (html.indexOf(magicStart) === 0) {
match = html.match(magicMatch);
if (match) {
callChars();
html = html.substring(match[0].length);
match[0].replace(magicMatch, parseMustache);
}
}
if (chars) {
index = findBreak(html, magicStart);
if (index === 0 && html === last) {
charsText += html.charAt(0);
html = html.substr(1);
index = findBreak(html, magicStart);
}
var text = index < 0 ? html : html.substring(0, index);
html = index < 0 ? '' : html.substring(index);
if (text) {
charsText += text;
}
}
} else {
html = html.replace(new RegExp('([\\s\\S]*?)</' + stack.last() + '[^>]*>'), function (all, text) {
text = text.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, '$1$2');
if (handler.chars) {
handler.chars(text);
}
return '';
});
parseEndTag('', stack.last());
}
if (html === last) {
throw new Error('Parse Error: ' + html);
}
last = html;
}
callChars();
parseEndTag();
handler.done();
return intermediate;
};
var callAttrStart = function (state, curIndex, handler, rest) {
var attrName = rest.substring(typeof state.nameStart === 'number' ? state.nameStart : curIndex, curIndex), newAttrName = encoder.encode(attrName);
state.attrStart = newAttrName;
handler.attrStart(state.attrStart);
state.inName = false;
};
var callAttrEnd = function (state, curIndex, handler, rest) {
if (state.valueStart !== undefined && state.valueStart < curIndex) {
handler.attrValue(rest.substring(state.valueStart, curIndex));
} else if (!state.inValue) {
}
handler.attrEnd(state.attrStart);
state.attrStart = undefined;
state.valueStart = undefined;
state.inValue = false;
state.inName = false;
state.lookingForEq = false;
state.inQuote = false;
state.lookingForName = true;
};
var findBreak = function (str, magicStart) {
var magicLength = magicStart.length;
for (var i = 0, len = str.length; i < len; i++) {
if (str[i] === '<' || str.substr(i, magicLength) === magicStart) {
return i;
}
}
return -1;
};
HTMLParser.parseAttrs = function (rest, handler) {
if (!rest) {
return;
}
var magicMatch = handler.magicMatch || defaultMagicMatch, magicStart = handler.magicStart || defaultMagicStart;
var i = 0;
var curIndex;
var state = {
inName: false,
nameStart: undefined,
inValue: false,
valueStart: undefined,
inQuote: false,
attrStart: undefined,
lookingForName: true,
lookingForValue: false,
lookingForEq: false
};
while (i < rest.length) {
curIndex = i;
var cur = rest.charAt(i);
i++;
if (magicStart === rest.substr(curIndex, magicStart.length)) {
if (state.inValue && curIndex > state.valueStart) {
handler.attrValue(rest.substring(state.valueStart, curIndex));
} else if (state.inName && state.nameStart < curIndex) {
callAttrStart(state, curIndex, handler, rest);
callAttrEnd(state, curIndex, handler, rest);
} else if (state.lookingForValue) {
state.inValue = true;
} else if (state.lookingForEq && state.attrStart) {
callAttrEnd(state, curIndex, handler, rest);
}
magicMatch.lastIndex = curIndex;
var match = magicMatch.exec(rest);
if (match) {
handler.special(match[1]);
i = curIndex + match[0].length;
if (state.inValue) {
state.valueStart = curIndex + match[0].length;
}
}
} else if (state.inValue) {
if (state.inQuote) {
if (cur === state.inQuote) {
callAttrEnd(state, curIndex, handler, rest);
}
} else if (space.test(cur)) {
callAttrEnd(state, curIndex, handler, rest);
}
} else if (cur === '=' && (state.lookingForEq || state.lookingForName || state.inName)) {
if (!state.attrStart) {
callAttrStart(state, curIndex, handler, rest);
}
state.lookingForValue = true;
state.lookingForEq = false;
state.lookingForName = false;
} else if (state.inName) {
var started = rest[state.nameStart], otherStart, otherOpposite;
if (startOppositesMap[started] === cur) {
otherStart = started === '{' ? '(' : '{';
otherOpposite = startOppositesMap[otherStart];
if (rest[curIndex + 1] === otherOpposite) {
callAttrStart(state, curIndex + 2, handler, rest);
i++;
} else {
callAttrStart(state, curIndex + 1, handler, rest);
}
state.lookingForEq = true;
} else if (space.test(cur) && started !== '{' && started !== '(') {
callAttrStart(state, curIndex, handler, rest);
state.lookingForEq = true;
}
} else if (state.lookingForName) {
if (!space.test(cur)) {
if (state.attrStart) {
callAttrEnd(state, curIndex, handler, rest);
}
state.nameStart = curIndex;
state.inName = true;
}
} else if (state.lookingForValue) {
if (!space.test(cur)) {
state.lookingForValue = false;
state.inValue = true;
if (cur === '\'' || cur === '"') {
state.inQuote = cur;
state.valueStart = curIndex + 1;
} else {
state.valueStart = curIndex;
}
} else if (i === rest.length) {
callAttrEnd(state, curIndex, handler, rest);
}
}
}
if (state.inName) {
callAttrStart(state, curIndex + 1, handler, rest);
callAttrEnd(state, curIndex + 1, handler, rest);
} else if (state.lookingForEq || state.lookingForValue || state.inValue) {
callAttrEnd(state, curIndex + 1, handler, rest);
}
magicMatch.lastIndex = 0;
};
HTMLParser.searchStartTag = function (html) {
var closingIndex = html.indexOf('>');
if (closingIndex === -1 || !alphaRegex.test(html[1])) {
return null;
}
var tagName, tagContent, match, rest = '', unary = '';
var startTag = html.substring(0, closingIndex + 1);
var isUnary = startTag[startTag.length - 2] === '/';
var spaceIndex = startTag.search(space);
if (isUnary) {
unary = '/';
tagContent = startTag.substring(1, startTag.length - 2).trim();
} else {
tagContent = startTag.substring(1, startTag.length - 1).trim();
}
if (spaceIndex === -1) {
tagName = tagContent;
} else {
spaceIndex--;
tagName = tagContent.substring(0, spaceIndex);
rest = tagContent.substring(spaceIndex);
}
match = [
startTag,
tagName,
rest,
unary
];
return {
match: match,
html: html.substring(startTag.length)
};
};
module.exports = namespace.HTMLParser = HTMLParser;
});
/*can-util@3.10.11#js/set-immediate/set-immediate*/
define('can-util/js/set-immediate/set-immediate', [
'require',
'exports',
'module',
'can-globals/global/global'
], function (require, exports, module) {
(function (global) {
'use strict';
var global = require('can-globals/global/global')();
module.exports = global.setImmediate || function (cb) {
return setTimeout(cb, 0);
};
}(function () {
return this;
}()));
});
/*can-util@3.10.11#dom/child-nodes/child-nodes*/
define('can-util/dom/child-nodes/child-nodes', function (require, exports, module) {
'use strict';
function childNodes(node) {
var childNodes = node.childNodes;
if ('length' in childNodes) {
return childNodes;
} else {
var cur = node.firstChild;
var nodes = [];
while (cur) {
nodes.push(cur);
cur = cur.nextSibling;
}
return nodes;
}
}
module.exports = childNodes;
});
/*can-util@3.10.11#dom/contains/contains*/
define('can-util/dom/contains/contains', function (require, exports, module) {
'use strict';
module.exports = function (child) {
return this.contains(child);
};
});
/*can-util@3.10.11#dom/mutate/mutate*/
define('can-util/dom/mutate/mutate', [
'require',
'exports',
'module',
'can-util/js/make-array/make-array',
'can-util/js/set-immediate/set-immediate',
'can-cid',
'can-globals/mutation-observer/mutation-observer',
'can-util/dom/child-nodes/child-nodes',
'can-util/dom/contains/contains',
'can-util/dom/dispatch/dispatch',
'can-globals/document/document',
'can-util/dom/data/data'
], function (require, exports, module) {
(function (global) {
'use strict';
var makeArray = require('can-util/js/make-array/make-array');
var setImmediate = require('can-util/js/set-immediate/set-immediate');
var CID = require('can-cid');
var getMutationObserver = require('can-globals/mutation-observer/mutation-observer');
var childNodes = require('can-util/dom/child-nodes/child-nodes');
var domContains = require('can-util/dom/contains/contains');
var domDispatch = require('can-util/dom/dispatch/dispatch');
var getDocument = require('can-globals/document/document');
var domData = require('can-util/dom/data/data');
var mutatedElements;
var checks = {
inserted: function (root, elem) {
return domContains.call(root, elem);
},
removed: function (root, elem) {
return !domContains.call(root, elem);
}
};
var fireOn = function (elems, root, check, event, dispatched) {
if (!elems.length) {
return;
}
var children, cid;
for (var i = 0, elem; (elem = elems[i]) !== undefined; i++) {
cid = CID(elem);
if (elem.getElementsByTagName && check(root, elem) && !dispatched[cid]) {
dispatched[cid] = true;
children = makeArray(elem.getElementsByTagName('*'));
domDispatch.call(elem, event, [], false);
if (event === 'removed') {
domData.delete.call(elem);
}
for (var j = 0, child; (child = children[j]) !== undefined; j++) {
cid = CID(child);
if (!dispatched[cid]) {
domDispatch.call(child, event, [], false);
if (event === 'removed') {
domData.delete.call(child);
}
dispatched[cid] = true;
}
}
}
}
};
var fireMutations = function () {
var mutations = mutatedElements;
mutatedElements = null;
var firstElement = mutations[0][1][0];
var doc = getDocument() || firstElement.ownerDocument || firstElement;
var root = doc.contains ? doc : doc.documentElement;
var dispatched = {
inserted: {},
removed: {}
};
mutations.forEach(function (mutation) {
fireOn(mutation[1], root, checks[mutation[0]], mutation[0], dispatched[mutation[0]]);
});
};
var mutated = function (elements, type) {
if (!getMutationObserver() && elements.length) {
var firstElement = elements[0];
var doc = getDocument() || firstElement.ownerDocument || firstElement;
var root = doc.contains ? doc : doc.documentElement;
if (checks.inserted(root, firstElement)) {
if (!mutatedElements) {
mutatedElements = [];
setImmediate(fireMutations);
}
mutatedElements.push([
type,
elements
]);
}
}
};
module.exports = {
appendChild: function (child) {
if (getMutationObserver()) {
this.appendChild(child);
} else {
var children;
if (child.nodeType === 11) {
children = makeArray(childNodes(child));
} else {
children = [child];
}
this.appendChild(child);
mutated(children, 'inserted');
}
},
insertBefore: function (child, ref, document) {
if (getMutationObserver()) {
this.insertBefore(child, ref);
} else {
var children;
if (child.nodeType === 11) {
children = makeArray(childNodes(child));
} else {
children = [child];
}
this.insertBefore(child, ref);
mutated(children, 'inserted');
}
},
removeChild: function (child) {
if (getMutationObserver()) {
this.removeChild(child);
} else {
mutated([child], 'removed');
this.removeChild(child);
}
},
replaceChild: function (newChild, oldChild) {
if (getMutationObserver()) {
this.replaceChild(newChild, oldChild);
} else {
var children;
if (newChild.nodeType === 11) {
children = makeArray(childNodes(newChild));
} else {
children = [newChild];
}
mutated([oldChild], 'removed');
this.replaceChild(newChild, oldChild);
mutated(children, 'inserted');
}
},
inserted: function (elements) {
mutated(elements, 'inserted');
},
removed: function (elements) {
mutated(elements, 'removed');
}
};
}(function () {
return this;
}()));
});
/*can-view-nodelist@3.1.0#can-view-nodelist*/
define('can-view-nodelist', [
'require',
'exports',
'module',
'can-util/js/make-array/make-array',
'can-util/js/each/each',
'can-namespace',
'can-util/dom/mutate/mutate',
'can-util/js/cid-map/cid-map'
], function (require, exports, module) {
var makeArray = require('can-util/js/make-array/make-array');
var each = require('can-util/js/each/each');
var namespace = require('can-namespace');
var domMutate = require('can-util/dom/mutate/mutate');
var CIDMap = require('can-util/js/cid-map/cid-map');
var nodeMap = new CIDMap(), splice = [].splice, push = [].push, itemsInChildListTree = function (list) {
var count = 0;
for (var i = 0, len = list.length; i < len; i++) {
var item = list[i];
if (item.nodeType) {
count++;
} else {
count += itemsInChildListTree(item);
}
}
return count;
}, replacementMap = function (replacements) {
var map = new CIDMap();
for (var i = 0, len = replacements.length; i < len; i++) {
var node = nodeLists.first(replacements[i]);
map.set(node, replacements[i]);
}
return map;
}, addUnfoundAsDeepChildren = function (list, rMap) {
rMap.forEach(function (replacement) {
list.newDeepChildren.push(replacement);
});
};
var nodeLists = {
update: function (nodeList, newNodes) {
var oldNodes = nodeLists.unregisterChildren(nodeList);
newNodes = makeArray(newNodes);
var oldListLength = nodeList.length;
splice.apply(nodeList, [
0,
oldListLength
].concat(newNodes));
if (nodeList.replacements) {
nodeLists.nestReplacements(nodeList);
nodeList.deepChildren = nodeList.newDeepChildren;
nodeList.newDeepChildren = [];
} else {
nodeLists.nestList(nodeList);
}
return oldNodes;
},
nestReplacements: function (list) {
var index = 0, rMap = replacementMap(list.replacements), rCount = list.replacements.length;
while (index < list.length && rCount) {
var node = list[index], replacement = rMap.get(node);
if (replacement) {
rMap['delete'](node);
list.splice(index, itemsInChildListTree(replacement), replacement);
rCount--;
}
index++;
}
if (rCount) {
addUnfoundAsDeepChildren(list, rMap);
}
list.replacements = [];
},
nestList: function (list) {
var index = 0;
while (index < list.length) {
var node = list[index], childNodeList = nodeMap.get(node);
if (childNodeList) {
if (childNodeList !== list) {
list.splice(index, itemsInChildListTree(childNodeList), childNodeList);
}
} else {
nodeMap.set(node, list);
}
index++;
}
},
last: function (nodeList) {
var last = nodeList[nodeList.length - 1];
if (last.nodeType) {
return last;
} else {
return nodeLists.last(last);
}
},
first: function (nodeList) {
var first = nodeList[0];
if (first.nodeType) {
return first;
} else {
return nodeLists.first(first);
}
},
flatten: function (nodeList) {
var items = [];
for (var i = 0; i < nodeList.length; i++) {
var item = nodeList[i];
if (item.nodeType) {
items.push(item);
} else {
items.push.apply(items, nodeLists.flatten(item));
}
}
return items;
},
register: function (nodeList, unregistered, parent, directlyNested) {
nodeList.unregistered = unregistered;
nodeList.parentList = parent;
nodeList.nesting = parent && typeof parent.nesting !== 'undefined' ? parent.nesting + 1 : 0;
if (parent) {
nodeList.deepChildren = [];
nodeList.newDeepChildren = [];
nodeList.replacements = [];
if (parent !== true) {
if (directlyNested) {
parent.replacements.push(nodeList);
} else {
parent.newDeepChildren.push(nodeList);
}
}
} else {
nodeLists.nestList(nodeList);
}
return nodeList;
},
unregisterChildren: function (nodeList) {
var nodes = [];
each(nodeList, function (node) {
if (node.nodeType) {
if (!nodeList.replacements) {
nodeMap['delete'](node);
}
nodes.push(node);
} else {
push.apply(nodes, nodeLists.unregister(node, true));
}
});
each(nodeList.deepChildren, function (nodeList) {
nodeLists.unregister(nodeList, true);
});
return nodes;
},
unregister: function (nodeList, isChild) {
var nodes = nodeLists.unregisterChildren(nodeList, true);
if (nodeList.unregistered) {
var unregisteredCallback = nodeList.unregistered;
nodeList.replacements = nodeList.unregistered = null;
if (!isChild) {
var deepChildren = nodeList.parentList && nodeList.parentList.deepChildren;
if (deepChildren) {
var index = deepChildren.indexOf(nodeList);
if (index !== -1) {
deepChildren.splice(index, 1);
}
}
}
unregisteredCallback();
}
return nodes;
},
after: function (oldElements, newFrag) {
var last = oldElements[oldElements.length - 1];
if (last.nextSibling) {
domMutate.insertBefore.call(last.parentNode, newFrag, last.nextSibling);
} else {
domMutate.appendChild.call(last.parentNode, newFrag);
}
},
replace: function (oldElements, newFrag) {
var selectedValue, parentNode = oldElements[0].parentNode;
if (parentNode.nodeName.toUpperCase() === 'SELECT' && parentNode.selectedIndex >= 0) {
selectedValue = parentNode.value;
}
if (oldElements.length === 1) {
domMutate.replaceChild.call(parentNode, newFrag, oldElements[0]);
} else {
nodeLists.after(oldElements, newFrag);
nodeLists.remove(oldElements);
}
if (selectedValue !== undefined) {
parentNode.value = selectedValue;
}
},
remove: function (elementsToBeRemoved) {
var parent = elementsToBeRemoved[0] && elementsToBeRemoved[0].parentNode;
each(elementsToBeRemoved, function (child) {
domMutate.removeChild.call(parent, child);
});
},
nodeMap: nodeMap
};
module.exports = namespace.nodeLists = nodeLists;
});
/*can-util@3.10.11#dom/fragment/fragment*/
define('can-util/dom/fragment/fragment', [
'require',
'exports',
'module',
'can-globals/document/document',
'can-util/dom/child-nodes/child-nodes'
], function (require, exports, module) {
(function (global) {
'use strict';
var getDocument = require('can-globals/document/document'), childNodes = require('can-util/dom/child-nodes/child-nodes');
var fragmentRE = /^\s*<(\w+)[^>]*>/, toString = {}.toString, fragment = function (html, name, doc) {
if (name === undefined) {
name = fragmentRE.test(html) && RegExp.$1;
}
if (html && toString.call(html.replace) === '[object Function]') {
html = html.replace(/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, '<$1></$2>');
}
var container = doc.createElement('div'), temp = doc.createElement('div');
if (name === 'tbody' || name === 'tfoot' || name === 'thead' || name === 'colgroup') {
temp.innerHTML = '<table>' + html + '</table>';
container = temp.firstChild.nodeType === 3 ? temp.lastChild : temp.firstChild;
} else if (name === 'col') {
temp.innerHTML = '<table><colgroup>' + html + '</colgroup></table>';
container = temp.firstChild.nodeType === 3 ? temp.lastChild : temp.firstChild.firstChild;
} else if (name === 'tr') {
temp.innerHTML = '<table><tbody>' + html + '</tbody></table>';
container = temp.firstChild.nodeType === 3 ? temp.lastChild : temp.firstChild.firstChild;
} else if (name === 'td' || name === 'th') {
temp.innerHTML = '<table><tbody><tr>' + html + '</tr></tbody></table>';
container = temp.firstChild.nodeType === 3 ? temp.lastChild : temp.firstChild.firstChild.firstChild;
} else if (name === 'option') {
temp.innerHTML = '<select>' + html + '</select>';
container = temp.firstChild.nodeType === 3 ? temp.lastChild : temp.firstChild;
} else {
container.innerHTML = '' + html;
}
var tmp = {}, children = childNodes(container);
tmp.length = children.length;
for (var i = 0; i < children.length; i++) {
tmp[i] = children[i];
}
return [].slice.call(tmp);
};
var buildFragment = function (html, doc) {
if (html && html.nodeType === 11) {
return html;
}
if (!doc) {
doc = getDocument();
} else if (doc.length) {
doc = doc[0];
}
var parts = fragment(html, undefined, doc), frag = (doc || document).createDocumentFragment();
for (var i = 0, length = parts.length; i < length; i++) {
frag.appendChild(parts[i]);
}
return frag;
};
module.exports = buildFragment;
}(function () {
return this;
}()));
});
/*can-util@3.10.11#dom/frag/frag*/
define('can-util/dom/frag/frag', [
'require',
'exports',
'module',
'can-globals/document/document',
'can-util/dom/fragment/fragment',
'can-util/js/each/each',
'can-util/dom/child-nodes/child-nodes'
], function (require, exports, module) {
(function (global) {
'use strict';
var getDocument = require('can-globals/document/document');
var fragment = require('can-util/dom/fragment/fragment');
var each = require('can-util/js/each/each');
var childNodes = require('can-util/dom/child-nodes/child-nodes');
var makeFrag = function (item, doc) {
var document = doc || getDocument();
var frag;
if (!item || typeof item === 'string') {
frag = fragment(item == null ? '' : '' + item, document);
if (!frag.childNodes.length) {
frag.appendChild(document.createTextNode(''));
}
return frag;
} else if (item.nodeType === 11) {
return item;
} else if (typeof item.nodeType === 'number') {
frag = document.createDocumentFragment();
frag.appendChild(item);
return frag;
} else if (typeof item.length === 'number') {
frag = document.createDocumentFragment();
each(item, function (item) {
frag.appendChild(makeFrag(item));
});
if (!childNodes(frag).length) {
frag.appendChild(document.createTextNode(''));
}
return frag;
} else {
frag = fragment('' + item, document);
if (!childNodes(frag).length) {
frag.appendChild(document.createTextNode(''));
}
return frag;
}
};
module.exports = makeFrag;
}(function () {
return this;
}()));
});
/*can-util@3.10.11#dom/is-of-global-document/is-of-global-document*/
define('can-util/dom/is-of-global-document/is-of-global-document', [
'require',
'exports',
'module',
'can-globals/document/document'
], function (require, exports, module) {
(function (global) {
'use strict';
var getDocument = require('can-globals/document/document');
module.exports = function (el) {
return (el.ownerDocument || el) === getDocument();
};
}(function () {
return this;
}()));
});
/*can-util@3.10.11#dom/events/make-mutation-event/make-mutation-event*/
define('can-util/dom/events/make-mutation-event/make-mutation-event', [
'require',
'exports',
'module',
'can-util/dom/events/events',
'can-util/dom/data/data',
'can-globals/mutation-observer/mutation-observer',
'can-util/dom/dispatch/dispatch',
'can-util/dom/mutation-observer/document/document',
'can-globals/document/document',
'can-cid/map/map',
'can-util/js/string/string',
'can-util/dom/is-of-global-document/is-of-global-document'
], function (require, exports, module) {
(function (global) {
'use strict';
var events = require('can-util/dom/events/events');
var domData = require('can-util/dom/data/data');
var getMutationObserver = require('can-globals/mutation-observer/mutation-observer');
var domDispatch = require('can-util/dom/dispatch/dispatch');
var mutationDocument = require('can-util/dom/mutation-observer/document/document');
var getDocument = require('can-globals/document/document');
var CIDMap = require('can-cid/map/map');
var string = require('can-util/js/string/string');
require('can-util/dom/is-of-global-document/is-of-global-document');
module.exports = function (specialEventName, mutationNodesProperty) {
var originalAdd = events.addEventListener, originalRemove = events.removeEventListener;
events.addEventListener = function (eventName) {
if (eventName === specialEventName && getMutationObserver()) {
var documentElement = getDocument().documentElement;
var specialEventData = domData.get.call(documentElement, specialEventName + 'Data');
if (!specialEventData) {
specialEventData = {
handler: function (mutatedNode) {
if (specialEventData.nodeIdsRespondingToInsert.has(mutatedNode)) {
domDispatch.call(mutatedNode, specialEventName, [], false);
specialEventData.nodeIdsRespondingToInsert.delete(mutatedNode);
}
},
nodeIdsRespondingToInsert: new CIDMap()
};
mutationDocument['on' + string.capitalize(mutationNodesProperty)](specialEventData.handler);
domData.set.call(documentElement, specialEventName + 'Data', specialEventData);
}
if (this.nodeType !== 11) {
var count = specialEventData.nodeIdsRespondingToInsert.get(this) || 0;
specialEventData.nodeIdsRespondingToInsert.set(this, count + 1);
}
}
return originalAdd.apply(this, arguments);
};
events.removeEventListener = function (eventName) {
if (eventName === specialEventName && getMutationObserver()) {
var documentElement = getDocument().documentElement;
var specialEventData = domData.get.call(documentElement, specialEventName + 'Data');
if (specialEventData) {
var newCount = specialEventData.nodeIdsRespondingToInsert.get(this) - 1;
if (newCount) {
specialEventData.nodeIdsRespondingToInsert.set(this, newCount);
} else {
specialEventData.nodeIdsRespondingToInsert.delete(this);
}
if (!specialEventData.nodeIdsRespondingToInsert.size) {
mutationDocument['off' + string.capitalize(mutationNodesProperty)](specialEventData.handler);
domData.clean.call(documentElement, specialEventName + 'Data');
}
}
}
return originalRemove.apply(this, arguments);
};
};
}(function () {
return this;
}()));
});
/*can-util@3.10.11#dom/events/removed/removed*/
define('can-util/dom/events/removed/removed', [
'require',
'exports',
'module',
'can-util/dom/events/make-mutation-event/make-mutation-event'
], function (require, exports, module) {
'use strict';
var makeMutationEvent = require('can-util/dom/events/make-mutation-event/make-mutation-event');
makeMutationEvent('removed', 'removedNodes');
});
/*can-view-live@3.2.3#lib/core*/
define('can-view-live/lib/core', [
'require',
'exports',
'module',
'can-view-parser',
'can-util/dom/events/events',
'can-view-nodelist',
'can-util/dom/frag/frag',
'can-util/dom/child-nodes/child-nodes',
'can-reflect',
'can-util/dom/events/removed/removed'
], function (require, exports, module) {
var parser = require('can-view-parser');
var domEvents = require('can-util/dom/events/events');
var nodeLists = require('can-view-nodelist');
var makeFrag = require('can-util/dom/frag/frag');
var childNodes = require('can-util/dom/child-nodes/child-nodes');
var canReflect = require('can-reflect');
require('can-util/dom/events/removed/removed');
var childMutationCallbacks = {};
var live = {
setup: function (el, bind, unbind) {
var tornDown = false, teardown = function () {
if (!tornDown) {
tornDown = true;
unbind(data);
domEvents.removeEventListener.call(el, 'removed', teardown);
}
return true;
}, data = {
teardownCheck: function (parent) {
return parent ? false : teardown();
}
};
domEvents.addEventListener.call(el, 'removed', teardown);
bind(data);
return data;
},
listen: function (el, compute, change) {
return live.setup(el, function () {
canReflect.onValue(compute, change);
}, function (data) {
canReflect.offValue(compute, change);
if (data.nodeList) {
nodeLists.unregister(data.nodeList);
}
});
},
getAttributeParts: function (newVal) {
var attrs = {}, attr;
parser.parseAttrs(newVal, {
attrStart: function (name) {
attrs[name] = '';
attr = name;
},
attrValue: function (value) {
attrs[attr] += value;
},
attrEnd: function () {
}
});
return attrs;
},
isNode: function (obj) {
return obj && obj.nodeType;
},
addTextNodeIfNoChildren: function (frag) {
if (!frag.firstChild) {
frag.appendChild(frag.ownerDocument.createTextNode(''));
}
},
registerChildMutationCallback: function (tag, callback) {
if (callback) {
childMutationCallbacks[tag] = callback;
} else {
return childMutationCallbacks[tag];
}
},
callChildMutationCallback: function (el) {
var callback = el && childMutationCallbacks[el.nodeName.toLowerCase()];
if (callback) {
callback(el);
}
},
replace: function (nodes, val, teardown) {
var oldNodes = nodes.slice(0), frag = makeFrag(val);
nodeLists.register(nodes, teardown);
nodeLists.update(nodes, childNodes(frag));
nodeLists.replace(oldNodes, frag);
return nodes;
},
getParentNode: function (el, defaultParentNode) {
return defaultParentNode && el.parentNode.nodeType === 11 ? defaultParentNode : el.parentNode;
},
makeString: function (txt) {
return txt == null ? '' : '' + txt;
}
};
module.exports = live;
});
/*can-util@3.10.11#js/diff/diff*/
define('can-util/js/diff/diff', function (require, exports, module) {
'use strict';
var slice = [].slice;
var defaultIdentity = function (a, b) {
return a === b;
};
function reverseDiff(oldDiffStopIndex, newDiffStopIndex, oldList, newList, identity) {
var oldIndex = oldList.length - 1, newIndex = newList.length - 1;
while (oldIndex > oldDiffStopIndex && newIndex > newDiffStopIndex) {
var oldItem = oldList[oldIndex], newItem = newList[newIndex];
if (identity(oldItem, newItem)) {
oldIndex--;
newIndex--;
continue;
} else {
return [{
index: newDiffStopIndex,
deleteCount: oldIndex - oldDiffStopIndex + 1,
insert: slice.call(newList, newDiffStopIndex, newIndex + 1)
}];
}
}
return [{
index: newDiffStopIndex,
deleteCount: oldIndex - oldDiffStopIndex + 1,
insert: slice.call(newList, newDiffStopIndex, newIndex + 1)
}];
}
module.exports = exports = function (oldList, newList, identity) {
identity = identity || defaultIdentity;
var oldIndex = 0, newIndex = 0, oldLength = oldList.length, newLength = newList.length, patches = [];
while (oldIndex < oldLength && newIndex < newLength) {
var oldItem = oldList[oldIndex], newItem = newList[newIndex];
if (identity(oldItem, newItem)) {
oldIndex++;
newIndex++;
continue;
}
if (newIndex + 1 < newLength && identity(oldItem, newList[newIndex + 1])) {
patches.push({
index: newIndex,
deleteCount: 0,
insert: [newList[newIndex]]
});
oldIndex++;
newIndex += 2;
continue;
} else if (oldIndex + 1 < oldLength && identity(oldList[oldIndex + 1], newItem)) {
patches.push({
index: newIndex,
deleteCount: 1,
insert: []
});
oldIndex += 2;
newIndex++;
continue;
} else {
patches.push.apply(patches, reverseDiff(oldIndex, newIndex, oldList, newList, identity));
return patches;
}
}
if (newIndex === newLength && oldIndex === oldLength) {
return patches;
}
patches.push({
index: newIndex,
deleteCount: oldLength - oldIndex,
insert: slice.call(newList, newIndex)
});
return patches;
};
});
/*can-util@3.10.11#dom/events/attributes/attributes*/
define('can-util/dom/events/attributes/attributes', [
'require',
'exports',
'module',
'can-util/dom/events/events',
'can-util/dom/is-of-global-document/is-of-global-document',
'can-util/dom/data/data',
'can-globals/mutation-observer/mutation-observer',
'can-assign',
'can-util/dom/dispatch/dispatch'
], function (require, exports, module) {
(function (global) {
'use strict';
var events = require('can-util/dom/events/events');
var isOfGlobalDocument = require('can-util/dom/is-of-global-document/is-of-global-document');
var domData = require('can-util/dom/data/data');
var getMutationObserver = require('can-globals/mutation-observer/mutation-observer');
var assign = require('can-assign');
var domDispatch = require('can-util/dom/dispatch/dispatch');
var originalAdd = events.addEventListener, originalRemove = events.removeEventListener;
events.addEventListener = function (eventName) {
if (eventName === 'attributes') {
var MutationObserver = getMutationObserver();
if (isOfGlobalDocument(this) && MutationObserver) {
var existingObserver = domData.get.call(this, 'canAttributesObserver');
if (!existingObserver) {
var self = this;
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
var copy = assign({}, mutation);
domDispatch.call(self, copy, [], false);
});
});
observer.observe(this, {
attributes: true,
attributeOldValue: true
});
domData.set.call(this, 'canAttributesObserver', observer);
}
} else {
domData.set.call(this, 'canHasAttributesBindings', true);
}
}
return originalAdd.apply(this, arguments);
};
events.removeEventListener = function (eventName) {
if (eventName === 'attributes') {
var MutationObserver = getMutationObserver();
var observer;
if (isOfGlobalDocument(this) && MutationObserver) {
observer = domData.get.call(this, 'canAttributesObserver');
if (observer && observer.disconnect) {
observer.disconnect();
domData.clean.call(this, 'canAttributesObserver');
}
} else {
domData.clean.call(this, 'canHasAttributesBindings');
}
}
return originalRemove.apply(this, arguments);
};
}(function () {
return this;
}()));
});
/*can-util@3.10.11#dom/events/inserted/inserted*/
define('can-util/dom/events/inserted/inserted', [
'require',
'exports',
'module',
'can-util/dom/events/make-mutation-event/make-mutation-event'
], function (require, exports, module) {
'use strict';
var makeMutationEvent = require('can-util/dom/events/make-mutation-event/make-mutation-event');
makeMutationEvent('inserted', 'addedNodes');
});
/*can-util@3.10.11#dom/attr/attr*/
define('can-util/dom/attr/attr', [
'require',
'exports',
'module',
'can-util/js/set-immediate/set-immediate',
'can-globals/document/document',
'can-globals/global/global',
'can-util/dom/is-of-global-document/is-of-global-document',
'can-util/dom/data/data',
'can-util/dom/contains/contains',
'can-util/dom/events/events',
'can-util/dom/dispatch/dispatch',
'can-globals/mutation-observer/mutation-observer',
'can-util/js/each/each',
'can-types',
'can-util/js/diff/diff',
'can-util/dom/events/attributes/attributes',
'can-util/dom/events/inserted/inserted'
], function (require, exports, module) {
(function (global) {
'use strict';
var setImmediate = require('can-util/js/set-immediate/set-immediate');
var getDocument = require('can-globals/document/document');
var global = require('can-globals/global/global')();
var isOfGlobalDocument = require('can-util/dom/is-of-global-document/is-of-global-document');
var setData = require('can-util/dom/data/data');
var domContains = require('can-util/dom/contains/contains');
var domEvents = require('can-util/dom/events/events');
var domDispatch = require('can-util/dom/dispatch/dispatch');
var getMutationObserver = require('can-globals/mutation-observer/mutation-observer');
var each = require('can-util/js/each/each');
var types = require('can-types');
var diff = require('can-util/js/diff/diff');
require('can-util/dom/events/attributes/attributes');
require('can-util/dom/events/inserted/inserted');
var namespaces = { 'xlink': 'http://www.w3.org/1999/xlink' };
var formElements = {
'INPUT': true,
'TEXTAREA': true,
'SELECT': true
}, toString = function (value) {
if (value == null) {
return '';
} else {
return '' + value;
}
}, isSVG = function (el) {
return el.namespaceURI === 'http://www.w3.org/2000/svg';
}, truthy = function () {
return true;
}, getSpecialTest = function (special) {
return special && special.test || truthy;
}, propProp = function (prop, obj) {
obj = obj || {};
obj.get = function () {
return this[prop];
};
obj.set = function (value) {
if (this[prop] !== value) {
this[prop] = value;
}
return value;
};
return obj;
}, booleanProp = function (prop) {
return {
isBoolean: true,
set: function (value) {
if (prop in this) {
this[prop] = value !== false;
} else {
this.setAttribute(prop, '');
}
},
remove: function () {
this[prop] = false;
}
};
}, setupMO = function (el, callback) {
var attrMO = setData.get.call(el, 'attrMO');
if (!attrMO) {
var onMutation = function () {
callback.call(el);
};
var MO = getMutationObserver();
if (MO) {
var observer = new MO(onMutation);
observer.observe(el, {
childList: true,
subtree: true
});
setData.set.call(el, 'attrMO', observer);
} else {
setData.set.call(el, 'attrMO', true);
setData.set.call(el, 'canBindingCallback', { onMutation: onMutation });
}
}
}, _findOptionToSelect = function (parent, value) {
var child = parent.firstChild;
while (child) {
if (child.nodeName === 'OPTION' && value === child.value) {
return child;
}
if (child.nodeName === 'OPTGROUP') {
var groupChild = _findOptionToSelect(child, value);
if (groupChild) {
return groupChild;
}
}
child = child.nextSibling;
}
}, setChildOptions = function (el, value) {
var option;
if (value != null) {
option = _findOptionToSelect(el, value);
}
if (option) {
option.selected = true;
} else {
el.selectedIndex = -1;
}
}, forEachOption = function (parent, fn) {
var child = parent.firstChild;
while (child) {
if (child.nodeName === 'OPTION') {
fn(child);
}
if (child.nodeName === 'OPTGROUP') {
forEachOption(child, fn);
}
child = child.nextSibling;
}
}, collectSelectedOptions = function (parent) {
var selectedValues = [];
forEachOption(parent, function (option) {
if (option.selected) {
selectedValues.push(option.value);
}
});
return selectedValues;
}, markSelectedOptions = function (parent, values) {
forEachOption(parent, function (option) {
option.selected = values.indexOf(option.value) !== -1;
});
}, setChildOptionsOnChange = function (select, aEL) {
var handler = setData.get.call(select, 'attrSetChildOptions');
if (handler) {
return Function.prototype;
}
handler = function () {
setChildOptions(select, select.value);
};
setData.set.call(select, 'attrSetChildOptions', handler);
aEL.call(select, 'change', handler);
return function (rEL) {
setData.clean.call(select, 'attrSetChildOptions');
rEL.call(select, 'change', handler);
};
}, attr = {
special: {
checked: {
get: function () {
return this.checked;
},
set: function (val) {
var notFalse = !!val || val === '' || arguments.length === 0;
this.checked = notFalse;
if (notFalse && this.type === 'radio') {
this.defaultChecked = true;
}
return val;
},
remove: function () {
this.checked = false;
},
test: function () {
return this.nodeName === 'INPUT';
}
},
'class': {
get: function () {
if (isSVG(this)) {
return this.getAttribute('class');
}
return this.className;
},
set: function (val) {
val = val || '';
if (isSVG(this)) {
this.setAttribute('class', '' + val);
} else {
this.className = val;
}
return val;
}
},
disabled: booleanProp('disabled'),
focused: {
get: function () {
return this === document.activeElement;
},
set: function (val) {
var cur = attr.get(this, 'focused');
var docEl = this.ownerDocument.documentElement;
var element = this;
function focusTask() {
if (val) {
element.focus();
} else {
element.blur();
}
}
if (cur !== val) {
if (!domContains.call(docEl, element)) {
var initialSetHandler = function () {
domEvents.removeEventListener.call(element, 'inserted', initialSetHandler);
focusTask();
};
domEvents.addEventListener.call(element, 'inserted', initialSetHandler);
} else {
types.queueTask([
focusTask,
this,
[]
]);
}
}
return !!val;
},
addEventListener: function (eventName, handler, aEL) {
aEL.call(this, 'focus', handler);
aEL.call(this, 'blur', handler);
return function (rEL) {
rEL.call(this, 'focus', handler);
rEL.call(this, 'blur', handler);
};
},
test: function () {
return this.nodeName === 'INPUT';
}
},
'for': propProp('htmlFor'),
innertext: propProp('innerText'),
innerhtml: propProp('innerHTML'),
innerHTML: propProp('innerHTML', {
addEventListener: function (eventName, handler, aEL) {
var handlers = [];
var el = this;
each([
'change',
'blur'
], function (eventName) {
var localHandler = function () {
handler.apply(this, arguments);
};
domEvents.addEventListener.call(el, eventName, localHandler);
handlers.push([
eventName,
localHandler
]);
});
return function (rEL) {
each(handlers, function (info) {
rEL.call(el, info[0], info[1]);
});
};
}
}),
required: booleanProp('required'),
readonly: booleanProp('readOnly'),
selected: {
get: function () {
return this.selected;
},
set: function (val) {
val = !!val;
setData.set.call(this, 'lastSetValue', val);
return this.selected = val;
},
addEventListener: function (eventName, handler, aEL) {
var option = this;
var select = this.parentNode;
var lastVal = option.selected;
var localHandler = function (changeEvent) {
var curVal = option.selected;
lastVal = setData.get.call(option, 'lastSetValue') || lastVal;
if (curVal !== lastVal) {
lastVal = curVal;
domDispatch.call(option, eventName);
}
};
var removeChangeHandler = setChildOptionsOnChange(select, aEL);
domEvents.addEventListener.call(select, 'change', localHandler);
aEL.call(option, eventName, handler);
return function (rEL) {
removeChangeHandler(rEL);
domEvents.removeEventListener.call(select, 'change', localHandler);
rEL.call(option, eventName, handler);
};
},
test: function () {
return this.nodeName === 'OPTION' && this.parentNode && this.parentNode.nodeName === 'SELECT';
}
},
src: {
set: function (val) {
if (val == null || val === '') {
this.removeAttribute('src');
return null;
} else {
this.setAttribute('src', val);
return val;
}
}
},
style: {
set: function () {
var el = global.document && getDocument().createElement('div');
if (el && el.style && 'cssText' in el.style) {
return function (val) {
return this.style.cssText = val || '';
};
} else {
return function (val) {
return this.setAttribute('style', val);
};
}
}()
},
textcontent: propProp('textContent'),
value: {
get: function () {
var value = this.value;
if (this.nodeName === 'SELECT') {
if ('selectedIndex' in this && this.selectedIndex === -1) {
value = undefined;
}
}
return value;
},
set: function (value) {
var nodeName = this.nodeName.toLowerCase();
if (nodeName === 'input') {
value = toString(value);
}
if (this.value !== value || nodeName === 'option') {
this.value = value;
}
if (attr.defaultValue[nodeName]) {
this.defaultValue = value;
}
if (nodeName === 'select') {
setData.set.call(this, 'attrValueLastVal', value);
setChildOptions(this, value === null ? value : this.value);
var docEl = this.ownerDocument.documentElement;
if (!domContains.call(docEl, this)) {
var select = this;
var initialSetHandler = function () {
domEvents.removeEventListener.call(select, 'inserted', initialSetHandler);
setChildOptions(select, value === null ? value : select.value);
};
domEvents.addEventListener.call(this, 'inserted', initialSetHandler);
}
setupMO(this, function () {
var value = setData.get.call(this, 'attrValueLastVal');
attr.set(this, 'value', value);
domDispatch.call(this, 'change');
});
}
return value;
},
test: function () {
return formElements[this.nodeName];
}
},
values: {
get: function () {
return collectSelectedOptions(this);
},
set: function (values) {
values = values || [];
markSelectedOptions(this, values);
setData.set.call(this, 'stickyValues', attr.get(this, 'values'));
setupMO(this, function () {
var previousValues = setData.get.call(this, 'stickyValues');
attr.set(this, 'values', previousValues);
var currentValues = setData.get.call(this, 'stickyValues');
var changes = diff(previousValues.slice().sort(), currentValues.slice().sort());
if (changes.length) {
domDispatch.call(this, 'values');
}
});
return values;
},
addEventListener: function (eventName, handler, aEL) {
var localHandler = function () {
domDispatch.call(this, 'values');
};
domEvents.addEventListener.call(this, 'change', localHandler);
aEL.call(this, eventName, handler);
return function (rEL) {
domEvents.removeEventListener.call(this, 'change', localHandler);
rEL.call(this, eventName, handler);
};
}
}
},
defaultValue: {
input: true,
textarea: true
},
setAttrOrProp: function (el, attrName, val) {
attrName = attrName.toLowerCase();
var special = attr.special[attrName];
if (special && special.isBoolean && !val) {
this.remove(el, attrName);
} else {
this.set(el, attrName, val);
}
},
set: function (el, attrName, val) {
var usingMutationObserver = isOfGlobalDocument(el) && getMutationObserver();
attrName = attrName.toLowerCase();
var oldValue;
if (!usingMutationObserver) {
oldValue = attr.get(el, attrName);
}
var newValue;
var special = attr.special[attrName];
var setter = special && special.set;
var test = getSpecialTest(special);
if (typeof setter === 'function' && test.call(el)) {
if (arguments.length === 2) {
newValue = setter.call(el);
} else {
newValue = setter.call(el, val);
}
} else {
attr.setAttribute(el, attrName, val);
}
if (!usingMutationObserver && newValue !== oldValue) {
attr.trigger(el, attrName, oldValue);
}
},
setSelectValue: function (el, value) {
attr.set(el, 'value', value);
},
setAttribute: function () {
var doc = getDocument();
if (doc && document.createAttribute) {
try {
doc.createAttribute('{}');
} catch (e) {
var invalidNodes = {}, attributeDummy = document.createElement('div');
return function (el, attrName, val) {
var first = attrName.charAt(0), cachedNode, node, attr;
if ((first === '{' || first === '(' || first === '*') && el.setAttributeNode) {
cachedNode = invalidNodes[attrName];
if (!cachedNode) {
attributeDummy.innerHTML = '<div ' + attrName + '=""></div>';
cachedNode = invalidNodes[attrName] = attributeDummy.childNodes[0].attributes[0];
}
node = cachedNode.cloneNode();
node.value = val;
el.setAttributeNode(node);
} else {
attr = attrName.split(':');
if (attr.length !== 1 && namespaces[attr[0]]) {
el.setAttributeNS(namespaces[attr[0]], attrName, val);
} else {
el.setAttribute(attrName, val);
}
}
};
}
}
return function (el, attrName, val) {
el.setAttribute(attrName, val);
};
}(),
trigger: function (el, attrName, oldValue) {
if (setData.get.call(el, 'canHasAttributesBindings')) {
attrName = attrName.toLowerCase();
return setImmediate(function () {
domDispatch.call(el, {
type: 'attributes',
attributeName: attrName,
target: el,
oldValue: oldValue,
bubbles: false
}, []);
});
}
},
get: function (el, attrName) {
attrName = attrName.toLowerCase();
var special = attr.special[attrName];
var getter = special && special.get;
var test = getSpecialTest(special);
if (typeof getter === 'function' && test.call(el)) {
return getter.call(el);
} else {
return el.getAttribute(attrName);
}
},
remove: function (el, attrName) {
attrName = attrName.toLowerCase();
var oldValue;
if (!getMutationObserver()) {
oldValue = attr.get(el, attrName);
}
var special = attr.special[attrName];
var setter = special && special.set;
var remover = special && special.remove;
var test = getSpecialTest(special);
if (typeof remover === 'function' && test.call(el)) {
remover.call(el);
} else if (typeof setter === 'function' && test.call(el)) {
setter.call(el, undefined);
} else {
el.removeAttribute(attrName);
}
if (!getMutationObserver() && oldValue != null) {
attr.trigger(el, attrName, oldValue);
}
},
has: function () {
var el = getDocument() && document.createElement('div');
if (el && el.hasAttribute) {
return function (el, name) {
return el.hasAttribute(name);
};
} else {
return function (el, name) {
return el.getAttribute(name) !== null;
};
}
}()
};
var oldAddEventListener = domEvents.addEventListener;
domEvents.addEventListener = function (eventName, handler) {
var special = attr.special[eventName];
if (special && special.addEventListener) {
var teardown = special.addEventListener.call(this, eventName, handler, oldAddEventListener);
var teardowns = setData.get.call(this, 'attrTeardowns');
if (!teardowns) {
setData.set.call(this, 'attrTeardowns', teardowns = {});
}
if (!teardowns[eventName]) {
teardowns[eventName] = [];
}
teardowns[eventName].push({
teardown: teardown,
handler: handler
});
return;
}
return oldAddEventListener.apply(this, arguments);
};
var oldRemoveEventListener = domEvents.removeEventListener;
domEvents.removeEventListener = function (eventName, handler) {
var special = attr.special[eventName];
if (special && special.addEventListener) {
var teardowns = setData.get.call(this, 'attrTeardowns');
if (teardowns && teardowns[eventName]) {
var eventTeardowns = teardowns[eventName];
for (var i = 0, len = eventTeardowns.length; i < len; i++) {
if (eventTeardowns[i].handler === handler) {
eventTeardowns[i].teardown.call(this, oldRemoveEventListener);
eventTeardowns.splice(i, 1);
break;
}
}
if (eventTeardowns.length === 0) {
delete teardowns[eventName];
}
}
return;
}
return oldRemoveEventListener.apply(this, arguments);
};
module.exports = exports = attr;
}(function () {
return this;
}()));
});
/*can-view-live@3.2.3#lib/attr*/
define('can-view-live/lib/attr', [
'require',
'exports',
'module',
'can-util/dom/attr/attr',
'can-view-live/lib/core',
'can-reflect'
], function (require, exports, module) {
var attr = require('can-util/dom/attr/attr');
var live = require('can-view-live/lib/core');
var canReflect = require('can-reflect');
live.attr = function (el, attributeName, compute) {
live.listen(el, compute, function (newVal) {
attr.set(el, attributeName, newVal);
});
attr.set(el, attributeName, canReflect.getValue(compute));
};
});
/*can-util@3.10.11#js/global/global*/
define('can-util/js/global/global', [
'require',
'exports',
'module',
'can-globals/global/global'
], function (require, exports, module) {
(function (global) {
'use strict';
module.exports = require('can-globals/global/global');
}(function () {
return this;
}()));
});
/*can-view-callbacks@3.2.2#can-view-callbacks*/
define('can-view-callbacks', [
'require',
'exports',
'module',
'can-observation',
'can-util/js/dev/dev',
'can-util/js/global/global',
'can-util/dom/mutate/mutate',
'can-namespace'
], function (require, exports, module) {
(function (global) {
var Observation = require('can-observation');
var dev = require('can-util/js/dev/dev');
var getGlobal = require('can-util/js/global/global');
var domMutate = require('can-util/dom/mutate/mutate');
var namespace = require('can-namespace');
var requestedAttributes = {};
var attr = function (attributeName, attrHandler) {
if (attrHandler) {
if (typeof attributeName === 'string') {
attributes[attributeName] = attrHandler;
if (requestedAttributes[attributeName]) {
dev.warn('can-view-callbacks: ' + attributeName + ' custom attribute behavior requested before it was defined. Make sure ' + attributeName + ' is defined before it is needed.');
}
} else {
regExpAttributes.push({
match: attributeName,
handler: attrHandler
});
Object.keys(requestedAttributes).forEach(function (requested) {
if (attributeName.test(requested)) {
dev.warn('can-view-callbacks: ' + requested + ' custom attribute behavior requested before it was defined. Make sure ' + attributeName + ' is defined before it is needed.');
}
});
}
} else {
var cb = attributes[attributeName];
if (!cb) {
for (var i = 0, len = regExpAttributes.length; i < len; i++) {
var attrMatcher = regExpAttributes[i];
if (attrMatcher.match.test(attributeName)) {
return attrMatcher.handler;
}
}
}
requestedAttributes[attributeName] = true;
return cb;
}
};
var attributes = {}, regExpAttributes = [], automaticCustomElementCharacters = /[-\:]/;
var defaultCallback = function () {
};
var tag = function (tagName, tagHandler) {
if (tagHandler) {
if (typeof tags[tagName.toLowerCase()] !== 'undefined') {
dev.warn('Custom tag: ' + tagName.toLowerCase() + ' is already defined');
}
if (!automaticCustomElementCharacters.test(tagName) && tagName !== 'content') {
dev.warn('Custom tag: ' + tagName.toLowerCase() + ' hyphen missed');
}
if (getGlobal().html5) {
getGlobal().html5.elements += ' ' + tagName;
getGlobal().html5.shivDocument();
}
tags[tagName.toLowerCase()] = tagHandler;
} else {
var cb;
if (tagHandler === null) {
delete tags[tagName.toLowerCase()];
} else {
cb = tags[tagName.toLowerCase()];
}
if (!cb && automaticCustomElementCharacters.test(tagName)) {
cb = defaultCallback;
}
return cb;
}
};
var tags = {};
var callbacks = {
_tags: tags,
_attributes: attributes,
_regExpAttributes: regExpAttributes,
defaultCallback: defaultCallback,
tag: tag,
attr: attr,
tagHandler: function (el, tagName, tagData) {
var helperTagCallback = tagData.options.get('tags.' + tagName, { proxyMethods: false }), tagCallback = helperTagCallback || tags[tagName];
var scope = tagData.scope, res;
if (tagCallback) {
res = Observation.ignore(tagCallback)(el, tagData);
} else {
res = scope;
}
if (!tagCallback) {
dev.warn('can-view-callbacks: No custom element found for ' + tagName);
}
if (res && tagData.subtemplate) {
if (scope !== res) {
scope = scope.add(res);
}
var result = tagData.subtemplate(scope, tagData.options);
var frag = typeof result === 'string' ? can.view.frag(result) : result;
domMutate.appendChild.call(el, frag);
}
}
};
namespace.view = namespace.view || {};
if (namespace.view.callbacks) {
throw new Error('You can\'t have two versions of can-view-callbacks, check your dependencies');
} else {
module.exports = namespace.view.callbacks = callbacks;
}
}(function () {
return this;
}()));
});
/*can-view-live@3.2.3#lib/attrs*/
define('can-view-live/lib/attrs', [
'require',
'exports',
'module',
'can-view-live/lib/core',
'can-view-callbacks',
'can-util/dom/attr/attr',
'can-util/dom/events/events',
'can-types',
'can-reflect'
], function (require, exports, module) {
var live = require('can-view-live/lib/core');
var viewCallbacks = require('can-view-callbacks');
var attr = require('can-util/dom/attr/attr');
var domEvents = require('can-util/dom/events/events');
var types = require('can-types');
var canReflect = require('can-reflect');
live.attrs = function (el, compute, scope, options) {
if (!canReflect.isObservableLike(compute)) {
var attrs = live.getAttributeParts(compute);
for (var name in attrs) {
attr.set(el, name, attrs[name]);
}
return;
}
var oldAttrs = {};
var setAttrs = function (newVal) {
var newAttrs = live.getAttributeParts(newVal), name;
for (name in newAttrs) {
var newValue = newAttrs[name], oldValue = oldAttrs[name];
if (newValue !== oldValue) {
attr.set(el, name, newValue);
var callback = viewCallbacks.attr(name);
if (callback) {
callback(el, {
attributeName: name,
scope: scope,
options: options
});
}
}
delete oldAttrs[name];
}
for (name in oldAttrs) {
attr.remove(el, name);
}
oldAttrs = newAttrs;
};
var handler = function (newVal) {
setAttrs(newVal);
};
canReflect.onValue(compute, handler);
var teardownHandler = function () {
canReflect.offValue(compute, handler);
domEvents.removeEventListener.call(el, 'removed', teardownHandler);
};
domEvents.addEventListener.call(el, 'removed', teardownHandler);
setAttrs(canReflect.getValue(compute));
};
});
/*can-view-live@3.2.3#lib/html*/
define('can-view-live/lib/html', [
'require',
'exports',
'module',
'can-view-live/lib/core',
'can-view-nodelist',
'can-util/dom/frag/frag',
'can-util/js/make-array/make-array',
'can-util/dom/child-nodes/child-nodes',
'can-reflect'
], function (require, exports, module) {
var live = require('can-view-live/lib/core');
var nodeLists = require('can-view-nodelist');
var makeFrag = require('can-util/dom/frag/frag');
var makeArray = require('can-util/js/make-array/make-array');
var childNodes = require('can-util/dom/child-nodes/child-nodes');
var canReflect = require('can-reflect');
live.html = function (el, compute, parentNode, nodeList) {
var data, makeAndPut, nodes;
parentNode = live.getParentNode(el, parentNode);
data = live.listen(parentNode, compute, function (newVal) {
var attached = nodeLists.first(nodes).parentNode;
if (attached) {
makeAndPut(newVal);
}
var pn = nodeLists.first(nodes).parentNode;
data.teardownCheck(pn);
live.callChildMutationCallback(pn);
});
nodes = nodeList || [el];
makeAndPut = function (val) {
var isFunction = typeof val === 'function', frag = makeFrag(isFunction ? '' : val), oldNodes = makeArray(nodes);
live.addTextNodeIfNoChildren(frag);
oldNodes = nodeLists.update(nodes, childNodes(frag));
if (isFunction) {
val(frag.firstChild);
}
nodeLists.replace(oldNodes, frag);
};
data.nodeList = nodes;
if (!nodeList) {
nodeLists.register(nodes, data.teardownCheck);
} else {
nodeList.unregistered = data.teardownCheck;
}
makeAndPut(canReflect.getValue(compute));
};
});
/*can-view-live@3.2.3#lib/util/queueFns*/
define('can-view-live/lib/util/queueFns', [
'require',
'exports',
'module',
'can-observation'
], function (require, exports, module) {
var Observation = require('can-observation');
module.exports = function queueFns(fns, primaryDepth) {
var updateQueue = [], queuedFns = {};
var updateQueueObservation = {
needsUpdate: false,
update: function () {
for (var i = 0; i < updateQueue.length; i++) {
var obj = updateQueue[i];
obj.fn.apply(obj.context, obj.args);
}
updateQueue = [];
},
getPrimaryDepth: function () {
return primaryDepth || 0;
}
};
var wrapFn = function (fn) {
return function () {
updateQueue.push({
fn: fn,
context: this,
args: arguments
});
updateQueueObservation.needsUpdate = false;
Observation.registerUpdate(updateQueueObservation);
};
};
for (var key in fns) {
queuedFns[key] = wrapFn(fns[key]);
}
queuedFns.clear = function () {
updateQueue = [];
};
return queuedFns;
};
});
/*can-view-live@3.2.3#lib/list*/
define('can-view-live/lib/list', [
'require',
'exports',
'module',
'can-view-live/lib/core',
'can-view-live/lib/util/queueFns',
'can-view-nodelist',
'can-compute',
'can-event/batch/batch',
'can-util/dom/frag/frag',
'can-util/dom/mutate/mutate',
'can-util/dom/child-nodes/child-nodes',
'can-util/js/make-array/make-array',
'can-util/js/each/each',
'can-util/js/is-function/is-function',
'can-util/js/diff/diff',
'can-compute/proto-compute',
'can-reflect'
], function (require, exports, module) {
var live = require('can-view-live/lib/core');
var queueFns = require('can-view-live/lib/util/queueFns');
var nodeLists = require('can-view-nodelist');
var makeCompute = require('can-compute');
var canBatch = require('can-event/batch/batch');
var frag = require('can-util/dom/frag/frag');
var domMutate = require('can-util/dom/mutate/mutate');
var childNodes = require('can-util/dom/child-nodes/child-nodes');
var makeArray = require('can-util/js/make-array/make-array');
var each = require('can-util/js/each/each');
var isFunction = require('can-util/js/is-function/is-function');
var diff = require('can-util/js/diff/diff');
var splice = [].splice;
var Compute = require('can-compute/proto-compute');
var canReflect = require('can-reflect');
var renderAndAddToNodeLists = function (newNodeLists, parentNodeList, render, context, args) {
var itemNodeList = [];
if (parentNodeList) {
nodeLists.register(itemNodeList, null, parentNodeList, true);
itemNodeList.parentList = parentNodeList;
itemNodeList.expression = '#each SUBEXPRESSION';
}
var itemHTML = render.apply(context, args.concat([itemNodeList])), itemFrag = frag(itemHTML);
var children = makeArray(childNodes(itemFrag));
if (parentNodeList) {
nodeLists.update(itemNodeList, children);
newNodeLists.push(itemNodeList);
} else {
newNodeLists.push(nodeLists.register(children));
}
return itemFrag;
}, removeFromNodeList = function (masterNodeList, index, length) {
var removedMappings = masterNodeList.splice(index + 1, length), itemsToRemove = [];
each(removedMappings, function (nodeList) {
var nodesToRemove = nodeLists.unregister(nodeList);
[].push.apply(itemsToRemove, nodesToRemove);
});
return itemsToRemove;
}, addFalseyIfEmpty = function (list, falseyRender, masterNodeList, nodeList) {
if (falseyRender && list.length === 0) {
var falseyNodeLists = [];
var falseyFrag = renderAndAddToNodeLists(falseyNodeLists, nodeList, falseyRender, list, [list]);
nodeLists.after([masterNodeList[0]], falseyFrag);
masterNodeList.push(falseyNodeLists[0]);
}
};
live.list = function (el, compute, render, context, parentNode, nodeList, falseyRender) {
var masterNodeList = nodeList || [el], indexMap = [], afterPreviousEvents = false, isTornDown = false, add = function add(ev, items, index) {
if (!afterPreviousEvents) {
return;
}
var frag = text.ownerDocument.createDocumentFragment(), newNodeLists = [], newIndicies = [];
each(items, function (item, key) {
var itemIndex = new Compute(key + index), itemCompute = new Compute(function (newVal) {
if (arguments.length) {
if ('set' in list) {
list.set(itemIndex.get(), newVal);
} else {
list.attr(itemIndex.get(), newVal);
}
} else {
return item;
}
}), itemFrag = renderAndAddToNodeLists(newNodeLists, nodeList, render, context, [
itemCompute,
itemIndex
]);
frag.appendChild(itemFrag);
newIndicies.push(itemIndex);
});
var masterListIndex = index + 1;
if (!indexMap.length) {
var falseyItemsToRemove = removeFromNodeList(masterNodeList, 0, masterNodeList.length - 1);
nodeLists.remove(falseyItemsToRemove);
}
if (!masterNodeList[masterListIndex]) {
nodeLists.after(masterListIndex === 1 ? [text] : [nodeLists.last(masterNodeList[masterListIndex - 1])], frag);
} else {
var el = nodeLists.first(masterNodeList[masterListIndex]);
domMutate.insertBefore.call(el.parentNode, frag, el);
}
splice.apply(masterNodeList, [
masterListIndex,
0
].concat(newNodeLists));
splice.apply(indexMap, [
index,
0
].concat(newIndicies));
for (var i = index + newIndicies.length, len = indexMap.length; i < len; i++) {
indexMap[i].set(i);
}
if (ev.callChildMutationCallback !== false) {
live.callChildMutationCallback(text.parentNode);
}
}, set = function set(ev, newVal, index) {
remove({}, { length: 1 }, index, true);
add({}, [newVal], index);
}, remove = function remove(ev, items, index, duringTeardown, fullTeardown) {
if (!afterPreviousEvents) {
return;
}
if (!duringTeardown && data.teardownCheck(text.parentNode)) {
return;
}
if (index < 0) {
index = indexMap.length + index;
}
var itemsToRemove = removeFromNodeList(masterNodeList, index, items.length);
indexMap.splice(index, items.length);
for (var i = index, len = indexMap.length; i < len; i++) {
indexMap[i].set(i);
}
if (!fullTeardown) {
addFalseyIfEmpty(list, falseyRender, masterNodeList, nodeList);
nodeLists.remove(itemsToRemove);
if (ev.callChildMutationCallback !== false) {
live.callChildMutationCallback(text.parentNode);
}
} else {
nodeLists.unregister(masterNodeList);
}
}, move = function move(ev, item, newIndex, currentIndex) {
if (!afterPreviousEvents) {
return;
}
newIndex = newIndex + 1;
currentIndex = currentIndex + 1;
var referenceNodeList = masterNodeList[newIndex];
var movedElements = frag(nodeLists.flatten(masterNodeList[currentIndex]));
var referenceElement;
if (currentIndex < newIndex) {
referenceElement = nodeLists.last(referenceNodeList).nextSibling;
} else {
referenceElement = nodeLists.first(referenceNodeList);
}
var parentNode = masterNodeList[0].parentNode;
parentNode.insertBefore(movedElements, referenceElement);
var temp = masterNodeList[currentIndex];
[].splice.apply(masterNodeList, [
currentIndex,
1
]);
[].splice.apply(masterNodeList, [
newIndex,
0,
temp
]);
newIndex = newIndex - 1;
currentIndex = currentIndex - 1;
var indexCompute = indexMap[currentIndex];
[].splice.apply(indexMap, [
currentIndex,
1
]);
[].splice.apply(indexMap, [
newIndex,
0,
indexCompute
]);
var i = Math.min(currentIndex, newIndex);
var len = indexMap.length;
for (i, len; i < len; i++) {
indexMap[i].set(i);
}
if (ev.callChildMutationCallback !== false) {
live.callChildMutationCallback(text.parentNode);
}
}, queuedFns = queueFns({
add: add,
set: set,
remove: remove,
move: move
}, nodeList && nodeList.nesting), text = el.ownerDocument.createTextNode(''), list, teardownList = function (fullTeardown) {
if (list && list.removeEventListener) {
list.removeEventListener('add', queuedFns.add);
list.removeEventListener('set', queuedFns.set);
list.removeEventListener('remove', queuedFns.remove);
list.removeEventListener('move', queuedFns.move);
}
remove({ callChildMutationCallback: !!fullTeardown }, { length: masterNodeList.length - 1 }, 0, true, fullTeardown);
queuedFns.clear();
}, oldList, updateList = function (newList) {
if (isTornDown) {
return;
}
afterPreviousEvents = true;
if (newList && oldList) {
list = newList || [];
var patches = diff(oldList, newList);
oldList = newList;
if (oldList.removeEventListener) {
oldList.removeEventListener('add', queuedFns.add);
oldList.removeEventListener('set', queuedFns.set);
oldList.removeEventListener('remove', queuedFns.remove);
oldList.removeEventListener('move', queuedFns.move);
}
for (var i = 0, patchLen = patches.length; i < patchLen; i++) {
var patch = patches[i];
if (patch.deleteCount) {
remove({ callChildMutationCallback: false }, { length: patch.deleteCount }, patch.index, true);
}
if (patch.insert.length) {
add({ callChildMutationCallback: false }, patch.insert, patch.index);
}
}
} else {
if (oldList) {
teardownList();
}
list = newList || [];
oldList = list;
add({ callChildMutationCallback: false }, list, 0);
addFalseyIfEmpty(list, falseyRender, masterNodeList, nodeList);
}
live.callChildMutationCallback(text.parentNode);
afterPreviousEvents = false;
if (list.addEventListener) {
list.addEventListener('add', queuedFns.add);
list.addEventListener('set', queuedFns.set);
list.addEventListener('remove', queuedFns.remove);
list.addEventListener('move', queuedFns.move);
}
canBatch.afterPreviousEvents(function () {
afterPreviousEvents = true;
});
};
var isValueLike = canReflect.isValueLike(compute), isObservableLike = canReflect.isObservableLike(compute);
parentNode = live.getParentNode(el, parentNode);
var data = live.setup(parentNode, function () {
if (isValueLike && isObservableLike) {
canReflect.onValue(compute, updateList);
}
}, function () {
if (isValueLike && isObservableLike) {
canReflect.offValue(compute, updateList);
}
teardownList(true);
});
if (!nodeList) {
live.replace(masterNodeList, text, data.teardownCheck);
} else {
nodeLists.replace(masterNodeList, text);
nodeLists.update(masterNodeList, [text]);
nodeList.unregistered = function () {
data.teardownCheck();
isTornDown = true;
};
}
updateList(isValueLike ? canReflect.getValue(compute) : compute);
};
});
/*can-view-live@3.2.3#lib/text*/
define('can-view-live/lib/text', [
'require',
'exports',
'module',
'can-view-live/lib/core',
'can-view-nodelist',
'can-reflect'
], function (require, exports, module) {
var live = require('can-view-live/lib/core');
var nodeLists = require('can-view-nodelist');
var canReflect = require('can-reflect');
live.text = function (el, compute, parentNode, nodeList) {
var parent = live.getParentNode(el, parentNode);
var data = live.listen(parent, compute, function (newVal) {
if (typeof node.nodeValue !== 'unknown') {
node.nodeValue = live.makeString(newVal);
}
});
var node = el.ownerDocument.createTextNode(live.makeString(canReflect.getValue(compute)));
if (nodeList) {
nodeList.unregistered = data.teardownCheck;
data.nodeList = nodeList;
nodeLists.update(nodeList, [node]);
nodeLists.replace([el], node);
} else {
data.nodeList = live.replace([el], node, data.teardownCheck);
}
};
});
/*can-view-live@3.2.3#can-view-live*/
define('can-view-live', [
'require',
'exports',
'module',
'can-view-live/lib/core',
'can-view-live/lib/attr',
'can-view-live/lib/attrs',
'can-view-live/lib/html',
'can-view-live/lib/list',
'can-view-live/lib/text'
], function (require, exports, module) {
var live = require('can-view-live/lib/core');
require('can-view-live/lib/attr');
require('can-view-live/lib/attrs');
require('can-view-live/lib/html');
require('can-view-live/lib/list');
require('can-view-live/lib/text');
module.exports = live;
});
/*can-util@3.10.11#js/base-url/base-url*/
define('can-util/js/base-url/base-url', [
'require',
'exports',
'module',
'can-globals/global/global',
'can-globals/document/document'
], function (require, exports, module) {
(function (global) {
'use strict';
var getGlobal = require('can-globals/global/global');
var getDomDocument = require('can-globals/document/document');
var setBaseUrl;
module.exports = function (setUrl) {
if (setUrl !== undefined) {
setBaseUrl = setUrl;
}
if (setBaseUrl !== undefined) {
return setBaseUrl;
}
var global = getGlobal();
var domDocument = getDomDocument();
if (domDocument && 'baseURI' in domDocument) {
return domDocument.baseURI;
} else if (global.location) {
var href = global.location.href;
var lastSlash = href.lastIndexOf('/');
return lastSlash !== -1 ? href.substr(0, lastSlash) : href;
} else if (typeof process !== 'undefined') {
return process.cwd();
}
};
}(function () {
return this;
}()));
});
/*can-parse-uri@1.0.0#can-parse-uri*/
define('can-parse-uri', function (require, exports, module) {
module.exports = function (url) {
var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
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;
};
});
/*can-util@3.10.11#js/join-uris/join-uris*/
define('can-util/js/join-uris/join-uris', [
'require',
'exports',
'module',
'can-parse-uri'
], function (require, exports, module) {
'use strict';
var parseURI = require('can-parse-uri');
module.exports = function (base, href) {
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;
};
});
/*can-stache@3.9.0#helpers/-debugger*/
define('can-stache/helpers/-debugger', [
'require',
'exports',
'module',
'can-util/js/log/log',
'can-reflect',
'can-symbol'
], function (require, exports, module) {
var canLog = require('can-util/js/log/log');
function noop() {
}
;
var resolveValue = noop;
var evaluateArgs = noop;
var __testing = {};
var canReflect = require('can-reflect');
var canSymbol = require('can-symbol');
__testing = { allowDebugger: true };
resolveValue = function (value) {
if (value && value.isComputed) {
return value();
}
if (value && value[canSymbol.for('can.isValueLike')] && value[canSymbol.for('can.getValue')]) {
return canReflect.getValue(value);
}
return value;
};
evaluateArgs = function (left, right) {
switch (arguments.length) {
case 0:
return true;
case 1:
return !!resolveValue(left);
case 2:
return resolveValue(left) === resolveValue(right);
default:
canLog.log([
'Usage:',
' {{debugger}}: break any time this helper is evaluated',
' {{debugger condition}}: break when `condition` is truthy',
' {{debugger left right}}: break when `left` === `right`'
].join('\n'));
throw new Error('{{debugger}} must have less than three arguments');
}
};
function debuggerHelper(left, right) {
var shouldBreak = evaluateArgs.apply(null, Array.prototype.slice.call(arguments, 0, -1));
if (!shouldBreak) {
return;
}
var options = arguments[arguments.length - 1];
var get = function (path) {
return options.scope.get(path);
};
canLog.log('Use `get(<path>)` to debug this template');
var allowDebugger = __testing.allowDebugger;
if (allowDebugger) {
debugger;
return;
}
canLog.warn('Forgotten {{debugger}} helper');
}
module.exports = {
helper: debuggerHelper,
evaluateArgs: evaluateArgs,
resolveValue: resolveValue,
__testing: __testing
};
});
/*can-stache@3.9.0#helpers/core*/
define('can-stache/helpers/core', [
'require',
'exports',
'module',
'can-view-live',
'can-view-nodelist',
'can-compute',
'can-stache/src/utils',
'can-util/js/is-function/is-function',
'can-util/js/base-url/base-url',
'can-util/js/join-uris/join-uris',
'can-util/js/each/each',
'can-util/js/assign/assign',
'can-util/js/is-iterable/is-iterable',
'can-util/js/dev/dev',
'can-symbol',
'can-reflect',
'can-util/js/is-empty-object/is-empty-object',
'can-stache/helpers/-debugger',
'can-util/dom/data/data'
], function (require, exports, module) {
var live = require('can-view-live');
var nodeLists = require('can-view-nodelist');
var compute = require('can-compute');
var utils = require('can-stache/src/utils');
var isFunction = require('can-util/js/is-function/is-function');
var getBaseURL = require('can-util/js/base-url/base-url');
var joinURIs = require('can-util/js/join-uris/join-uris');
var each = require('can-util/js/each/each');
var assign = require('can-util/js/assign/assign');
var isIterable = require('can-util/js/is-iterable/is-iterable');
var dev = require('can-util/js/dev/dev');
var canSymbol = require('can-symbol');
var canReflect = require('can-reflect');
var isEmptyObject = require('can-util/js/is-empty-object/is-empty-object');
var debuggerHelper = require('can-stache/helpers/-debugger').helper;
var domData = require('can-util/dom/data/data');
var looksLikeOptions = function (options) {
return options && typeof options.fn === 'function' && typeof options.inverse === 'function';
};
var resolve = function (value) {
if (value && value[canSymbol.for('can.isValueLike')] && value[canSymbol.for('can.getValue')]) {
return canReflect.getValue(value);
} else {
return value;
}
};
var resolveHash = function (hash) {
var params = {};
for (var prop in hash) {
params[prop] = resolve(hash[prop]);
}
return params;
};
var helpers = {
'each': function (items) {
var args = [].slice.call(arguments), options = args.pop(), argsLen = args.length, argExprs = options.exprData.argExprs, hashExprs = options.exprData.hashExprs, resolved = resolve(items), asVariable, hashOptions, aliases, key;
if (argsLen === 2 || argsLen === 3 && argExprs[1].key === 'as') {
asVariable = args[argsLen - 1];
if (typeof asVariable !== 'string') {
asVariable = argExprs[argsLen - 1].key;
}
dev.warn('can-stache: Using the `as` keyword is deprecated in favor of hash expressions. https://canjs.com/doc/can-stache.helpers.each.html');
dev.warn('can-stache: Do not use `{{#' + options.nodeList.expression + '}}`, instead use `{{#' + options.nodeList.expression.split(' ')[0] + ' ' + options.nodeList.expression.split(' ')[1] + ' ' + asVariable + '=value}}`');
}
if (!isEmptyObject(hashExprs)) {
hashOptions = {};
each(hashExprs, function (exprs, key) {
hashOptions[exprs.key] = key;
});
}
if ((canReflect.isObservableLike(resolved) && canReflect.isListLike(resolved) || utils.isArrayLike(resolved) && items.isComputed) && !options.stringOnly) {
return function (el) {
var nodeList = [el];
nodeList.expression = 'live.list';
nodeLists.register(nodeList, null, options.nodeList, true);
nodeLists.update(options.nodeList, [el]);
var cb = function (item, index, parentNodeList) {
var aliases = {
'%index': index,
'@index': index
};
if (asVariable) {
aliases[asVariable] = item;
}
if (!isEmptyObject(hashOptions)) {
if (hashOptions.value) {
aliases[hashOptions.value] = item;
}
if (hashOptions.index) {
aliases[hashOptions.index] = index;
}
}
return options.fn(options.scope.add(aliases, { notContext: true }).add(item), options.options, parentNodeList);
};
live.list(el, items, cb, options.context, el.parentNode, nodeList, function (list, parentNodeList) {
return options.inverse(options.scope.add(list), options.options, parentNodeList);
});
};
}
var expr = resolved, result;
if (!!expr && utils.isArrayLike(expr)) {
result = utils.getItemsFragContent(expr, options, options.scope, asVariable);
return options.stringOnly ? result.join('') : result;
} else if (isIterable(expr)) {
result = [];
each(expr, function (value, key) {
aliases = { '%key': key };
if (asVariable) {
aliases[asVariable] = value;
}
if (!isEmptyObject(hashOptions)) {
if (hashOptions.value) {
aliases[hashOptions.value] = value;
}
if (hashOptions.key) {
aliases[hashOptions.key] = key;
}
}
result.push(options.fn(options.scope.add(aliases, { notContext: true }).add(value)));
});
return options.stringOnly ? result.join('') : result;
} else if (canReflect.isObservableLike(expr) && canReflect.isMapLike(expr)) {
result = [];
(expr.forEach || expr.each).call(expr, function (val, key) {
var value = compute(expr, key);
aliases = {
'%key': key,
'@key': key
};
if (asVariable) {
aliases[asVariable] = expr[key];
}
result.push(options.fn(options.scope.add(aliases, { notContext: true }).add(value)));
});
return options.stringOnly ? result.join('') : result;
} else if (expr instanceof Object) {
result = [];
for (key in expr) {
aliases = {
'%key': key,
'@key': key
};
if (asVariable) {
aliases[asVariable] = expr[key];
}
result.push(options.fn(options.scope.add(aliases, { notContext: true }).add(expr[key])));
}
return options.stringOnly ? result.join('') : result;
}
},
'@index': function (offset, options) {
if (!options) {
options = offset;
offset = 0;
}
var index = options.scope.peek('@index');
return '' + ((isFunction(index) ? index() : index) + offset);
},
'if': function (expr, options) {
var value;
if (expr && expr.isComputed) {
value = compute.truthy(expr)();
} else {
value = !!resolve(expr);
}
if (value) {
return options.fn(options.scope || this);
} else {
return options.inverse(options.scope || this);
}
},
'is': function () {
var lastValue, curValue, options = arguments[arguments.length - 1];
if (arguments.length - 2 <= 0) {
return options.inverse();
}
var args = arguments;
var callFn = compute(function () {
for (var i = 0; i < args.length - 1; i++) {
curValue = resolve(args[i]);
curValue = isFunction(curValue) ? curValue() : curValue;
if (i > 0) {
if (curValue !== lastValue) {
return false;
}
}
lastValue = curValue;
}
return true;
});
return callFn() ? options.fn() : options.inverse();
},
'eq': function () {
return helpers.is.apply(this, arguments);
},
'unless': function (expr, options) {
return helpers['if'].apply(this, [
expr,
assign(assign({}, options), {
fn: options.inverse,
inverse: options.fn
})
]);
},
'with': function (expr, options) {
var ctx = expr;
if (!options) {
options = expr;
expr = true;
ctx = options.hash;
} else {
expr = resolve(expr);
if (options.hash && !isEmptyObject(options.hash)) {
ctx = options.scope.add(options.hash).add(ctx);
}
}
return options.fn(ctx || {});
},
'log': function (options) {
var logs = [];
each(arguments, function (val) {
if (!looksLikeOptions(val)) {
logs.push(val);
}
});
if (typeof console !== 'undefined' && console.log) {
if (!logs.length) {
console.log(options.context);
} else {
console.log.apply(console, logs);
}
}
},
'data': function (attr) {
var data = arguments.length === 2 ? this : arguments[1];
return function (el) {
domData.set.call(el, attr, data || this.context);
};
},
'switch': function (expression, options) {
resolve(expression);
var found = false;
var newOptions = options.helpers.add({
'case': function (value, options) {
if (!found && resolve(expression) === resolve(value)) {
found = true;
return options.fn(options.scope || this);
}
},
'default': function (options) {
if (!found) {
return options.fn(options.scope || this);
}
}
});
return options.fn(options.scope, newOptions);
},
'joinBase': function (firstExpr) {
var args = [].slice.call(arguments);
var options = args.pop();
var moduleReference = args.map(function (expr) {
var value = resolve(expr);
return isFunction(value) ? value() : value;
}).join('');
var templateModule = options.helpers.peek('helpers.module');
var parentAddress = templateModule ? templateModule.uri : undefined;
var isRelative = moduleReference[0] === '.';
if (isRelative && parentAddress) {
return joinURIs(parentAddress, moduleReference);
} else {
var baseURL = typeof System !== 'undefined' && (System.renderingBaseURL || System.baseURL) || getBaseURL();
if (moduleReference[0] !== '/' && baseURL[baseURL.length - 1] !== '/') {
baseURL += '/';
}
return joinURIs(baseURL, moduleReference);
}
}
};
helpers.eachOf = helpers.each;
helpers.debugger = debuggerHelper;
var registerHelper = function (name, callback) {
if (helpers[name]) {
dev.warn('The helper ' + name + ' has already been registered.');
}
helpers[name] = callback;
};
var makeSimpleHelper = function (fn) {
return function () {
var realArgs = [];
each(arguments, function (val) {
while (val && val.isComputed) {
val = val();
}
realArgs.push(val);
});
return fn.apply(this, realArgs);
};
};
module.exports = {
registerHelper: registerHelper,
registerSimpleHelper: function (name, callback) {
registerHelper(name, makeSimpleHelper(callback));
},
getHelper: function (name, options) {
var helper = options && options.get && options.get('helpers.' + name, { proxyMethods: false });
if (!helper) {
helper = helpers[name];
}
if (helper) {
return { fn: helper };
}
},
resolve: resolve,
resolveHash: resolveHash,
looksLikeOptions: looksLikeOptions
};
});
/*can-stache@3.9.0#src/expression*/
define('can-stache/src/expression', [
'require',
'exports',
'module',
'can-compute',
'can-stache-key',
'can-stache/src/utils',
'can-stache/helpers/core',
'can-util/js/each/each',
'can-util/js/is-empty-object/is-empty-object',
'can-util/js/dev/dev',
'can-util/js/assign/assign',
'can-util/js/last/last',
'can-reflect',
'can-symbol'
], function (require, exports, module) {
var compute = require('can-compute');
var observeReader = require('can-stache-key');
var utils = require('can-stache/src/utils');
var mustacheHelpers = require('can-stache/helpers/core');
var each = require('can-util/js/each/each');
var isEmptyObject = require('can-util/js/is-empty-object/is-empty-object');
var dev = require('can-util/js/dev/dev');
var assign = require('can-util/js/assign/assign');
var last = require('can-util/js/last/last');
var canReflect = require('can-reflect');
var canSymbol = require('can-symbol');
var getObservableValue_fromKey = function (key, scope, readOptions) {
var data = scope.computeData(key, readOptions);
compute.temporarilyBind(data);
return data;
}, computeHasDependencies = function (compute) {
return compute[canSymbol.for('can.valueHasDependencies')] ? canReflect.valueHasDependencies(compute) : compute.computeInstance.hasDependencies;
}, lookupValueOrHelper = function (key, scope, helperOptions, readOptions) {
var scopeKeyData = getObservableValue_fromKey(key, scope, readOptions);
var result = { value: scopeKeyData };
if (scopeKeyData.initialValue === undefined) {
if (key.charAt(0) === '@' && key !== '@index') {
key = key.substr(1);
}
var helper = mustacheHelpers.getHelper(key, helperOptions);
result.helper = helper && helper.fn;
}
return result;
}, getObservableValue_fromDynamicKey_fromObservable = function (key, root, helperOptions, readOptions) {
var computeValue = compute(function (newVal) {
var keyValue = canReflect.getValue(key);
var rootValue = canReflect.getValue(root);
keyValue = ('' + keyValue).replace('.', '\\.');
if (arguments.length) {
observeReader.write(rootValue, observeReader.reads(keyValue), newVal);
} else {
return observeReader.get(rootValue, keyValue);
}
});
compute.temporarilyBind(computeValue);
return computeValue;
}, convertToArgExpression = function (expr) {
if (!(expr instanceof Arg) && !(expr instanceof Literal)) {
return new Arg(expr);
} else {
return expr;
}
}, toComputeOrValue = function (value) {
if (canReflect.isObservableLike(value)) {
if (canReflect.valueHasDependencies(value) === false) {
return canReflect.getValue(value);
}
if (value.compute) {
return value.compute;
}
}
return value;
}, toCompute = function (value) {
if (value) {
if (value.isComputed) {
return value;
}
if (value.compute) {
return value.compute;
}
}
return value;
};
var Bracket = function (key, root) {
this.root = root;
this.key = key;
};
Bracket.prototype.value = function (scope, helpers) {
var root = this.root ? this.root.value(scope, helpers) : scope.peek('.');
return getObservableValue_fromDynamicKey_fromObservable(this.key.value(scope, helpers), root, scope, helpers, {});
};
var Literal = function (value) {
this._value = value;
};
Literal.prototype.value = function () {
return this._value;
};
var Lookup = function (key, root) {
this.key = key;
this.rootExpr = root;
};
Lookup.prototype.value = function (scope, helperOptions) {
if (this.rootExpr) {
return getObservableValue_fromDynamicKey_fromObservable(this.key, this.rootExpr.value(scope, helperOptions), scope, {}, {});
} else {
var result = lookupValueOrHelper(this.key, scope, helperOptions);
this.isHelper = result.helper && !result.helper.callAsMethod;
return result.helper || result.value;
}
};
var ScopeLookup = function (key, root) {
Lookup.apply(this, arguments);
};
ScopeLookup.prototype.value = function (scope, helperOptions) {
if (this.rootExpr) {
return getObservableValue_fromDynamicKey_fromObservable(this.key, this.rootExpr.value(scope, helperOptions), scope, {}, {});
}
return getObservableValue_fromKey(this.key, scope, helperOptions);
};
var Arg = function (expression, modifiers) {
this.expr = expression;
this.modifiers = modifiers || {};
this.isCompute = false;
};
Arg.prototype.value = function () {
return this.expr.value.apply(this.expr, arguments);
};
var Hash = function () {
};
var Hashes = function (hashes) {
this.hashExprs = hashes;
};
Hashes.prototype.value = function (scope, helperOptions) {
var hash = {};
for (var prop in this.hashExprs) {
var val = convertToArgExpression(this.hashExprs[prop]), value = val.value.apply(val, arguments);
hash[prop] = {
call: !val.modifiers || !val.modifiers.compute,
value: value
};
}
return compute(function () {
var finalHash = {};
for (var prop in hash) {
finalHash[prop] = hash[prop].call ? canReflect.getValue(hash[prop].value) : toComputeOrValue(hash[prop].value);
}
return finalHash;
});
};
var Call = function (methodExpression, argExpressions) {
this.methodExpr = methodExpression;
this.argExprs = argExpressions.map(convertToArgExpression);
};
Call.prototype.args = function (scope, helperOptions) {
var args = [];
for (var i = 0, len = this.argExprs.length; i < len; i++) {
var arg = this.argExprs[i];
var value = arg.value.apply(arg, arguments);
args.push({
call: !arg.modifiers || !arg.modifiers.compute,
value: value
});
}
return function () {
var finalArgs = [];
for (var i = 0, len = args.length; i < len; i++) {
finalArgs[i] = args[i].call ? canReflect.getValue(args[i].value) : toCompute(args[i].value);
}
return finalArgs;
};
};
Call.prototype.value = function (scope, helperScope, helperOptions) {
var method = this.methodExpr.value(scope, helperScope);
var isHelper = this.isHelper = this.methodExpr.isHelper;
var getArgs = this.args(scope, helperScope);
var computeValue = compute(function (newVal) {
var func = canReflect.getValue(method);
if (typeof func === 'function') {
var args = getArgs();
if (isHelper && helperOptions) {
args.push(helperOptions);
}
if (arguments.length) {
args.unshift(new expression.SetIdentifier(newVal));
}
return func.apply(null, args);
}
});
compute.temporarilyBind(computeValue);
return computeValue;
};
Call.prototype.closingTag = function () {
if (this.methodExpr[canSymbol.for('can-stache.originalKey')]) {
return this.methodExpr[canSymbol.for('can-stache.originalKey')];
}
return this.methodExpr.key;
};
var HelperLookup = function () {
Lookup.apply(this, arguments);
};
HelperLookup.prototype.value = function (scope, helperOptions) {
var result = lookupValueOrHelper(this.key, scope, helperOptions, {
isArgument: true,
args: [
scope.peek('.'),
scope
]
});
return result.helper || result.value;
};
var HelperScopeLookup = function () {
Lookup.apply(this, arguments);
};
HelperScopeLookup.prototype.value = function (scope, helperOptions) {
return getObservableValue_fromKey(this.key, scope, {
callMethodsOnObservables: true,
isArgument: true,
args: [
scope.peek('.'),
scope
]
});
};
var Helper = function (methodExpression, argExpressions, hashExpressions) {
this.methodExpr = methodExpression;
this.argExprs = argExpressions;
this.hashExprs = hashExpressions;
this.mode = null;
};
Helper.prototype.args = function (scope, helperOptions) {
var args = [];
for (var i = 0, len = this.argExprs.length; i < len; i++) {
var arg = this.argExprs[i];
args.push(toComputeOrValue(arg.value.apply(arg, arguments)));
}
return args;
};
Helper.prototype.hash = function (scope, helperOptions) {
var hash = {};
for (var prop in this.hashExprs) {
var val = this.hashExprs[prop];
hash[prop] = toComputeOrValue(val.value.apply(val, arguments));
}
return hash;
};
Helper.prototype.helperAndValue = function (scope, helperOptions) {
var looksLikeAHelper = this.argExprs.length || !isEmptyObject(this.hashExprs), helper, computeData, methodKey = this.methodExpr instanceof Literal ? '' + this.methodExpr._value : this.methodExpr.key, initialValue, args;
if (looksLikeAHelper) {
helper = mustacheHelpers.getHelper(methodKey, helperOptions);
}
if (!helper) {
computeData = getObservableValue_fromKey(methodKey, scope, { isArgument: true });
if (typeof computeData.initialValue === 'function') {
args = this.args(scope, helperOptions).map(toComputeOrValue);
var functionResult = compute(function () {
return computeData.initialValue.apply(null, args);
});
compute.temporarilyBind(functionResult);
return { value: functionResult };
} else if (typeof computeData.initialValue !== 'undefined') {
return { value: computeData };
}
if (!looksLikeAHelper && initialValue === undefined) {
helper = mustacheHelpers.getHelper(methodKey, helperOptions);
}
}
if (!helper) {
if (looksLikeAHelper) {
dev.warn('can-stache/src/expression.js: Unable to find helper "' + methodKey + '".');
} else {
dev.warn('can-stache/src/expression.js: Unable to find key or helper "' + methodKey + '".');
}
}
return {
value: computeData,
args: args,
helper: helper && helper.fn
};
};
Helper.prototype.evaluator = function (helper, scope, helperOptions, readOptions, nodeList, truthyRenderer, falseyRenderer, stringOnly) {
var helperOptionArg = { stringOnly: stringOnly }, context = scope.peek('.'), args = this.args(scope, helperOptions, nodeList, truthyRenderer, falseyRenderer, stringOnly), hash = this.hash(scope, helperOptions, nodeList, truthyRenderer, falseyRenderer, stringOnly);
utils.convertToScopes(helperOptionArg, scope, helperOptions, nodeList, truthyRenderer, falseyRenderer, stringOnly);
assign(helperOptionArg, {
context: context,
scope: scope,
contexts: scope,
hash: hash,
nodeList: nodeList,
exprData: this,
helperOptions: helperOptions,
helpers: helperOptions
});
args.push(helperOptionArg);
return function () {
return helper.apply(context, args);
};
};
Helper.prototype.value = function (scope, helperOptions, nodeList, truthyRenderer, falseyRenderer, stringOnly) {
var helperAndValue = this.helperAndValue(scope, helperOptions);
var helper = helperAndValue.helper;
if (!helper) {
return helperAndValue.value;
}
var fn = this.evaluator(helper, scope, helperOptions, nodeList, truthyRenderer, falseyRenderer, stringOnly);
var computeValue = compute(fn);
compute.temporarilyBind(computeValue);
if (!computeHasDependencies(computeValue)) {
return computeValue();
} else {
return computeValue;
}
};
Helper.prototype.closingTag = function () {
return this.methodExpr.key;
};
var keyRegExp = /[\w\.\\\-_@\/\&%]+/, tokensRegExp = /('.*?'|".*?"|=|[\w\.\\\-_@\/*%\$]+|[\(\)]|,|\~|\[|\]\s*|\s*(?=\[))/g, bracketSpaceRegExp = /\]\s+/, literalRegExp = /^('.*?'|".*?"|[0-9]+\.?[0-9]*|true|false|null|undefined)$/;
var isTokenKey = function (token) {
return keyRegExp.test(token);
};
var testDot = /^[\.@]\w/;
var isAddingToExpression = function (token) {
return isTokenKey(token) && testDot.test(token);
};
var ensureChildren = function (type) {
if (!type.children) {
type.children = [];
}
return type;
};
var Stack = function () {
this.root = {
children: [],
type: 'Root'
};
this.current = this.root;
this.stack = [this.root];
};
assign(Stack.prototype, {
top: function () {
return last(this.stack);
},
isRootTop: function () {
return this.top() === this.root;
},
popTo: function (types) {
this.popUntil(types);
this.pop();
},
pop: function () {
if (!this.isRootTop()) {
this.stack.pop();
}
},
first: function (types) {
var curIndex = this.stack.length - 1;
while (curIndex > 0 && types.indexOf(this.stack[curIndex].type) === -1) {
curIndex--;
}
return this.stack[curIndex];
},
firstParent: function (types) {
var curIndex = this.stack.length - 2;
while (curIndex > 0 && types.indexOf(this.stack[curIndex].type) === -1) {
curIndex--;
}
return this.stack[curIndex];
},
popUntil: function (types) {
while (types.indexOf(this.top().type) === -1 && !this.isRootTop()) {
this.stack.pop();
}
return this.top();
},
addTo: function (types, type) {
var cur = this.popUntil(types);
ensureChildren(cur).children.push(type);
},
addToAndPush: function (types, type) {
this.addTo(types, type);
this.stack.push(type);
},
push: function (type) {
this.stack.push(type);
},
topLastChild: function () {
return last(this.top().children);
},
replaceTopLastChild: function (type) {
var children = ensureChildren(this.top()).children;
children.pop();
children.push(type);
return type;
},
replaceTopLastChildAndPush: function (type) {
this.replaceTopLastChild(type);
this.stack.push(type);
},
replaceTopAndPush: function (type) {
var children;
if (this.top() === this.root) {
children = ensureChildren(this.top()).children;
} else {
this.stack.pop();
children = ensureChildren(this.top()).children;
}
children.pop();
children.push(type);
this.stack.push(type);
return type;
}
});
var convertKeyToLookup = function (key) {
var lastPath = key.lastIndexOf('./');
var lastDot = key.lastIndexOf('.');
if (lastDot > lastPath) {
return key.substr(0, lastDot) + '@' + key.substr(lastDot + 1);
}
var firstNonPathCharIndex = lastPath === -1 ? 0 : lastPath + 2;
var firstNonPathChar = key.charAt(firstNonPathCharIndex);
if (firstNonPathChar === '.' || firstNonPathChar === '@') {
return key.substr(0, firstNonPathCharIndex) + '@' + key.substr(firstNonPathCharIndex + 1);
} else {
return key.substr(0, firstNonPathCharIndex) + '@' + key.substr(firstNonPathCharIndex);
}
};
var convertToAtLookup = function (ast) {
if (ast.type === 'Lookup') {
ast.key = convertKeyToLookup(ast.key);
}
return ast;
};
var convertToHelperIfTopIsLookup = function (stack) {
var top = stack.top();
if (top && top.type === 'Lookup') {
var base = stack.stack[stack.stack.length - 2];
if (base.type !== 'Helper' && base) {
stack.replaceTopAndPush({
type: 'Helper',
method: top
});
}
}
};
var expression = {
toComputeOrValue: toComputeOrValue,
convertKeyToLookup: convertKeyToLookup,
Literal: Literal,
Lookup: Lookup,
ScopeLookup: ScopeLookup,
Arg: Arg,
Hash: Hash,
Hashes: Hashes,
Call: Call,
Helper: Helper,
HelperLookup: HelperLookup,
HelperScopeLookup: HelperScopeLookup,
Bracket: Bracket,
SetIdentifier: function (value) {
this.value = value;
},
tokenize: function (expression) {
var tokens = [];
(expression.trim() + ' ').replace(tokensRegExp, function (whole, arg) {
if (bracketSpaceRegExp.test(arg)) {
tokens.push(arg[0]);
tokens.push(arg.slice(1));
} else {
tokens.push(arg);
}
});
return tokens;
},
lookupRules: {
'default': function (ast, methodType, isArg) {
var name = (methodType === 'Helper' && !ast.root ? 'Helper' : '') + (isArg ? 'Scope' : '') + 'Lookup';
return expression[name];
},
'method': function (ast, methodType, isArg) {
return ScopeLookup;
}
},
methodRules: {
'default': function (ast) {
return ast.type === 'Call' ? Call : Helper;
},
'call': function (ast) {
return Call;
}
},
parse: function (expressionString, options) {
options = options || {};
var ast = this.ast(expressionString);
if (!options.lookupRule) {
options.lookupRule = 'default';
}
if (typeof options.lookupRule === 'string') {
options.lookupRule = expression.lookupRules[options.lookupRule];
}
if (!options.methodRule) {
options.methodRule = 'default';
}
if (typeof options.methodRule === 'string') {
options.methodRule = expression.methodRules[options.methodRule];
}
var expr = this.hydrateAst(ast, options, options.baseMethodType || 'Helper');
return expr;
},
hydrateAst: function (ast, options, methodType, isArg) {
var hashes;
if (ast.type === 'Lookup') {
var lookup = new (options.lookupRule(ast, methodType, isArg))(ast.key, ast.root && this.hydrateAst(ast.root, options, methodType));
canReflect.setKeyValue(lookup, canSymbol.for('can-stache.originalKey'), ast[canSymbol.for('can-stache.originalKey')]);
return lookup;
} else if (ast.type === 'Literal') {
return new Literal(ast.value);
} else if (ast.type === 'Arg') {
return new Arg(this.hydrateAst(ast.children[0], options, methodType, isArg), { compute: true });
} else if (ast.type === 'Hash') {
throw new Error('');
} else if (ast.type === 'Hashes') {
hashes = {};
each(ast.children, function (hash) {
hashes[hash.prop] = this.hydrateAst(hash.children[0], options, methodType, true);
}, this);
return new Hashes(hashes);
} else if (ast.type === 'Call' || ast.type === 'Helper') {
hashes = {};
var args = [], children = ast.children, ExpressionType = options.methodRule(ast);
if (children) {
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (child.type === 'Hashes' && ast.type === 'Helper' && ExpressionType !== Call) {
each(child.children, function (hash) {
hashes[hash.prop] = this.hydrateAst(hash.children[0], options, ast.type, true);
}, this);
} else {
args.push(this.hydrateAst(child, options, ast.type, true));
}
}
}
return new ExpressionType(this.hydrateAst(ast.method, options, ast.type), args, hashes);
} else if (ast.type === 'Bracket') {
return new Bracket(this.hydrateAst(ast.children[0], options), ast.root ? this.hydrateAst(ast.root, options) : undefined);
}
},
ast: function (expression) {
var tokens = this.tokenize(expression);
return this.parseAst(tokens, { index: 0 });
},
parseAst: function (tokens, cursor) {
var stack = new Stack(), top, firstParent, lastToken;
while (cursor.index < tokens.length) {
var token = tokens[cursor.index], nextToken = tokens[cursor.index + 1];
cursor.index++;
if (nextToken === '=') {
top = stack.top();
if (top && top.type === 'Lookup') {
firstParent = stack.firstParent([
'Call',
'Helper',
'Hash'
]);
if (firstParent.type === 'Call' || firstParent.type === 'Root') {
stack.popUntil(['Call']);
top = stack.top();
stack.replaceTopAndPush({
type: 'Helper',
method: top.type === 'Root' ? last(top.children) : top
});
}
}
firstParent = stack.firstParent([
'Call',
'Helper',
'Hashes'
]);
var hash = {
type: 'Hash',
prop: token
};
if (firstParent.type === 'Hashes') {
stack.addToAndPush(['Hashes'], hash);
} else {
stack.addToAndPush([
'Helper',
'Call'
], {
type: 'Hashes',
children: [hash]
});
stack.push(hash);
}
cursor.index++;
} else if (literalRegExp.test(token)) {
convertToHelperIfTopIsLookup(stack);
firstParent = stack.first([
'Helper',
'Call',
'Hash',
'Bracket'
]);
if (firstParent.type === 'Hash' && (firstParent.children && firstParent.children.length > 0)) {
stack.addTo([
'Helper',
'Call',
'Bracket'
], {
type: 'Literal',
value: utils.jsonParse(token)
});
} else if (firstParent.type === 'Bracket' && (firstParent.children && firstParent.children.length > 0)) {
stack.addTo([
'Helper',
'Call',
'Hash'
], {
type: 'Literal',
value: utils.jsonParse(token)
});
} else {
stack.addTo([
'Helper',
'Call',
'Hash',
'Bracket'
], {
type: 'Literal',
value: utils.jsonParse(token)
});
}
} else if (keyRegExp.test(token)) {
lastToken = stack.topLastChild();
firstParent = stack.first([
'Helper',
'Call',
'Hash',
'Bracket'
]);
if (lastToken && (lastToken.type === 'Call' || lastToken.type === 'Bracket') && isAddingToExpression(token)) {
stack.replaceTopLastChildAndPush({
type: 'Lookup',
root: lastToken,
key: token.slice(1)
});
} else if (firstParent.type === 'Bracket') {
if (!(firstParent.children && firstParent.children.length > 0)) {
stack.addToAndPush(['Bracket'], {
type: 'Lookup',
key: token
});
} else {
if (stack.first([
'Helper',
'Call',
'Hash',
'Arg'
]).type === 'Helper' && token[0] !== '.') {
stack.addToAndPush(['Helper'], {
type: 'Lookup',
key: token
});
} else {
stack.replaceTopAndPush({
type: 'Lookup',
key: token.slice(1),
root: firstParent
});
}
}
} else {
convertToHelperIfTopIsLookup(stack);
stack.addToAndPush([
'Helper',
'Call',
'Hash',
'Arg',
'Bracket'
], {
type: 'Lookup',
key: token
});
}
} else if (token === '~') {
convertToHelperIfTopIsLookup(stack);
stack.addToAndPush([
'Helper',
'Call',
'Hash'
], {
type: 'Arg',
key: token
});
} else if (token === '(') {
top = stack.top();
if (top.type === 'Lookup') {
canReflect.setKeyValue(top, canSymbol.for('can-stache.originalKey'), top.key);
stack.replaceTopAndPush({
type: 'Call',
method: convertToAtLookup(top)
});
} else {
throw new Error('Unable to understand expression ' + tokens.join(''));
}
} else if (token === ')') {
stack.popTo(['Call']);
} else if (token === ',') {
stack.popUntil(['Call']);
} else if (token === '[') {
top = stack.top();
lastToken = stack.topLastChild();
if (lastToken && (lastToken.type === 'Call' || lastToken.type === 'Bracket')) {
stack.replaceTopAndPush({
type: 'Bracket',
root: lastToken
});
} else if (top.type === 'Lookup' || top.type === 'Bracket') {
stack.replaceTopAndPush({
type: 'Bracket',
root: top
});
} else if (top.type === 'Call') {
stack.addToAndPush(['Call'], { type: 'Bracket' });
} else if (top === ' ') {
stack.popUntil(['Lookup']);
convertToHelperIfTopIsLookup(stack);
stack.addToAndPush([
'Helper',
'Call',
'Hash'
], { type: 'Bracket' });
} else {
stack.replaceTopAndPush({ type: 'Bracket' });
}
} else if (token === ']') {
stack.pop();
} else if (token === ' ') {
stack.push(token);
}
}
return stack.root.children[0];
}
};
module.exports = expression;
});
/*can-util@3.10.11#dom/document/document*/
define('can-util/dom/document/document', [
'require',
'exports',
'module',
'can-globals/document/document'
], function (require, exports, module) {
(function (global) {
'use strict';
module.exports = require('can-globals/document/document');
}(function () {
return this;
}()));
});
/*can-view-model@3.5.0#can-view-model*/
define('can-view-model', [
'require',
'exports',
'module',
'can-util/dom/data/data',
'can-simple-map',
'can-types',
'can-namespace',
'can-util/dom/document/document',
'can-util/js/is-array-like/is-array-like',
'can-reflect'
], function (require, exports, module) {
'use strict';
var domData = require('can-util/dom/data/data');
var SimpleMap = require('can-simple-map');
var types = require('can-types');
var ns = require('can-namespace');
var getDocument = require('can-util/dom/document/document');
var isArrayLike = require('can-util/js/is-array-like/is-array-like');
var canReflect = require('can-reflect');
module.exports = ns.viewModel = function (el, attr, val) {
var scope;
if (typeof el === 'string') {
el = getDocument().querySelector(el);
} else if (isArrayLike(el) && !el.nodeType) {
el = el[0];
}
if (canReflect.isObservableLike(attr) && canReflect.isMapLike(attr)) {
return domData.set.call(el, 'viewModel', attr);
}
scope = domData.get.call(el, 'viewModel');
if (!scope) {
scope = types.DefaultMap ? new types.DefaultMap() : new SimpleMap();
domData.set.call(el, 'viewModel', scope);
}
switch (arguments.length) {
case 0:
case 1:
return scope;
case 2:
return 'attr' in scope ? scope.attr(attr) : scope[attr];
default:
if ('attr' in scope) {
scope.attr(attr, val);
} else {
scope[attr] = val;
}
return el;
}
};
});
/*can-simple-observable@1.0.1#can-simple-observable*/
define('can-simple-observable', [
'require',
'exports',
'module',
'can-reflect',
'can-event/batch/batch',
'can-observation',
'can-cid',
'can-namespace'
], function (require, exports, module) {
var canReflect = require('can-reflect');
var canBatch = require('can-event/batch/batch');
var Observation = require('can-observation');
var CID = require('can-cid');
var ns = require('can-namespace');
module.exports = ns.simpleObservable = function simpleObservable(initialValue) {
var value = initialValue;
var handlers = [];
var fn = function (newValue) {
if (arguments.length) {
value = newValue;
handlers.forEach(function (handler) {
canBatch.queue([
handler,
fn,
[newValue]
]);
}, this);
} else {
Observation.add(fn);
return value;
}
};
CID(fn);
canReflect.assignSymbols(fn, {
'can.onValue': function (handler) {
handlers.push(handler);
},
'can.offValue': function (handler) {
var index = handlers.indexOf(handler);
handlers.splice(index, 1);
},
'can.setValue': function (newValue) {
return fn(newValue);
},
'can.getValue': function () {
return fn();
}
});
return fn;
};
});
/*can-dom-events@1.0.4#helpers/util*/
define('can-dom-events/helpers/util', [
'require',
'exports',
'module',
'can-globals/document/document',
'can-globals/is-browser-window/is-browser-window'
], function (require, exports, module) {
(function (global) {
'use strict';
var getCurrentDocument = require('can-globals/document/document');
var isBrowserWindow = require('can-globals/is-browser-window/is-browser-window');
function getTargetDocument(target) {
return target.ownerDocument || getCurrentDocument();
}
function createEvent(target, eventData, bubbles, cancelable) {
var doc = getTargetDocument(target);
var event = doc.createEvent('HTMLEvents');
var eventType;
if (typeof eventData === 'string') {
eventType = eventData;
} else {
eventType = eventData.type;
for (var prop in eventData) {
if (event[prop] === undefined) {
event[prop] = eventData[prop];
}
}
}
if (bubbles === undefined) {
bubbles = true;
}
event.initEvent(eventType, bubbles, cancelable);
return event;
}
function isDomEventTarget(obj) {
if (!(obj && obj.nodeName)) {
return obj === window;
}
var nodeType = obj.nodeType;
return nodeType === Node.DOCUMENT_NODE || nodeType === Node.ELEMENT_NODE;
}
function addDomContext(context, args) {
if (isDomEventTarget(context)) {
args = Array.prototype.slice.call(args, 0);
args.unshift(context);
}
return args;
}
function removeDomContext(context, args) {
if (!isDomEventTarget(context)) {
args = Array.prototype.slice.call(args, 0);
context = args.shift();
}
return {
context: context,
args: args
};
}
var fixSyntheticEventsOnDisabled = false;
(function () {
if (!isBrowserWindow()) {
return;
}
var testEventName = 'fix_synthetic_events_on_disabled_test';
var input = document.createElement('input');
input.disabled = true;
var timer = setTimeout(function () {
fixSyntheticEventsOnDisabled = true;
}, 50);
var onTest = function onTest() {
clearTimeout(timer);
input.removeEventListener(testEventName, onTest);
};
input.addEventListener(testEventName, onTest);
try {
var event = document.create('HTMLEvents');
event.initEvent(testEventName, false);
input.dispatchEvent(event);
} catch (e) {
onTest();
fixSyntheticEventsOnDisabled = true;
}
}());
function isDispatchingOnDisabled(element, event) {
var eventType = event.type;
var isInsertedOrRemoved = eventType === 'inserted' || eventType === 'removed';
var isDisabled = !!element.disabled;
return isInsertedOrRemoved && isDisabled;
}
function forceEnabledForDispatch(element, event) {
return fixSyntheticEventsOnDisabled && isDispatchingOnDisabled(element, event);
}
module.exports = {
createEvent: createEvent,
addDomContext: addDomContext,
removeDomContext: removeDomContext,
isDomEventTarget: isDomEventTarget,
getTargetDocument: getTargetDocument,
forceEnabledForDispatch: forceEnabledForDispatch
};
}(function () {
return this;
}()));
});
/*can-dom-events@1.0.4#helpers/add-event-compat*/
define('can-dom-events/helpers/add-event-compat', [
'require',
'exports',
'module',
'can-dom-events/helpers/util'
], function (require, exports, module) {
'use strict';
var util = require('can-dom-events/helpers/util');
var addDomContext = util.addDomContext;
var removeDomContext = util.removeDomContext;
function isDomEvents(obj) {
return !!(obj && obj.addEventListener && obj.removeEventListener && obj.dispatch);
}
function isNewEvents(obj) {
return typeof obj.addEvent === 'function';
}
module.exports = function addEventCompat(domEvents, customEvent, customEventType) {
if (!isDomEvents(domEvents)) {
throw new Error('addEventCompat() must be passed can-dom-events or can-util/dom/events/events');
}
customEventType = customEventType || customEvent.defaultEventType;
if (isNewEvents(domEvents)) {
return domEvents.addEvent(customEvent, customEventType);
}
var registry = domEvents._compatRegistry;
if (!registry) {
registry = domEvents._compatRegistry = {};
}
if (registry[customEventType]) {
return function noopRemoveOverride() {
};
}
registry[customEventType] = customEvent;
var newEvents = {
addEventListener: function () {
var data = removeDomContext(this, arguments);
return domEvents.addEventListener.apply(data.context, data.args);
},
removeEventListener: function () {
var data = removeDomContext(this, arguments);
return domEvents.removeEventListener.apply(data.context, data.args);
},
dispatch: function () {
var data = removeDomContext(this, arguments);
var eventData = data.args[0];
var eventArgs = typeof eventData === 'object' ? eventData.args : [];
data.args.splice(1, 0, eventArgs);
return domEvents.dispatch.apply(data.context, data.args);
}
};
var isOverriding = true;
var oldAddEventListener = domEvents.addEventListener;
var addEventListener = domEvents.addEventListener = function addEventListener(eventName) {
if (isOverriding && eventName === customEventType) {
var args = addDomContext(this, arguments);
customEvent.addEventListener.apply(newEvents, args);
}
return oldAddEventListener.apply(this, arguments);
};
var oldRemoveEventListener = domEvents.removeEventListener;
var removeEventListener = domEvents.removeEventListener = function removeEventListener(eventName) {
if (isOverriding && eventName === customEventType) {
var args = addDomContext(this, arguments);
customEvent.removeEventListener.apply(newEvents, args);
}
return oldRemoveEventListener.apply(this, arguments);
};
return function removeOverride() {
isOverriding = false;
registry[customEventType] = null;
if (domEvents.addEventListener === addEventListener) {
domEvents.addEventListener = oldAddEventListener;
}
if (domEvents.removeEventListener === removeEventListener) {
domEvents.removeEventListener = oldRemoveEventListener;
}
};
};
});
/*can-event-dom-enter@1.0.2#can-event-dom-enter*/
define('can-event-dom-enter', [
'require',
'exports',
'module',
'can-dom-data-state',
'can-cid'
], function (require, exports, module) {
'use strict';
var domData = require('can-dom-data-state');
var canCid = require('can-cid');
var baseEventType = 'keyup';
function isEnterEvent(event) {
var hasEnterKey = event.key === 'Enter';
var hasEnterCode = event.keyCode === 13;
return hasEnterKey || hasEnterCode;
}
function getHandlerKey(eventType, handler) {
return eventType + ':' + canCid(handler);
}
function associateHandler(target, eventType, handler, otherHandler) {
var key = getHandlerKey(eventType, handler);
domData.set.call(target, key, otherHandler);
}
function disassociateHandler(target, eventType, handler) {
var key = getHandlerKey(eventType, handler);
var otherHandler = domData.get.call(target, key);
if (otherHandler) {
domData.clean.call(target, key);
}
return otherHandler;
}
module.exports = {
defaultEventType: 'enter',
addEventListener: function (target, eventType, handler) {
var keyHandler = function (event) {
if (isEnterEvent(event)) {
return handler.apply(this, arguments);
}
};
associateHandler(target, eventType, handler, keyHandler);
this.addEventListener(target, baseEventType, keyHandler);
},
removeEventListener: function (target, eventType, handler) {
var keyHandler = disassociateHandler(target, eventType, handler);
if (keyHandler) {
this.removeEventListener(target, baseEventType, keyHandler);
}
}
};
});
/*can-event-dom-enter@1.0.2#compat*/
define('can-event-dom-enter/compat', [
'require',
'exports',
'module',
'can-dom-events/helpers/add-event-compat',
'can-event-dom-enter'
], function (require, exports, module) {
var addEventCompat = require('can-dom-events/helpers/add-event-compat');
var radioChange = require('can-event-dom-enter');
module.exports = function (domEvents, eventType) {
return addEventCompat(domEvents, radioChange, eventType);
};
});
/*can-dom-events@1.0.4#helpers/make-event-registry*/
define('can-dom-events/helpers/make-event-registry', function (require, exports, module) {
'use strict';
function EventRegistry() {
this._registry = {};
}
module.exports = function makeEventRegistry() {
return new EventRegistry();
};
EventRegistry.prototype.has = function (eventType) {
return !!this._registry[eventType];
};
EventRegistry.prototype.get = function (eventType) {
return this._registry[eventType];
};
EventRegistry.prototype.add = function (event, eventType) {
if (!event) {
throw new Error('An EventDefinition must be provided');
}
if (typeof event.addEventListener !== 'function') {
throw new TypeError('EventDefinition addEventListener must be a function');
}
if (typeof event.removeEventListener !== 'function') {
throw new TypeError('EventDefinition removeEventListener must be a function');
}
eventType = eventType || event.defaultEventType;
if (typeof eventType !== 'string') {
throw new TypeError('Event type must be a string, not ' + eventType);
}
if (this.has(eventType)) {
throw new Error('Event "' + eventType + '" is already registered');
}
this._registry[eventType] = event;
var self = this;
return function remove() {
self._registry[eventType] = undefined;
};
};
});
/*can-dom-events@1.0.4#can-dom-events*/
define('can-dom-events', [
'require',
'exports',
'module',
'can-namespace',
'can-dom-events/helpers/util',
'can-dom-events/helpers/make-event-registry'
], function (require, exports, module) {
(function (global) {
'use strict';
var namespace = require('can-namespace');
var util = require('can-dom-events/helpers/util');
var makeEventRegistry = require('can-dom-events/helpers/make-event-registry');
var domEvents = {
_eventRegistry: makeEventRegistry(),
addEvent: function (event, eventType) {
return this._eventRegistry.add(event, eventType);
},
addEventListener: function (target, eventType) {
var hasCustomEvent = domEvents._eventRegistry.has(eventType);
if (hasCustomEvent) {
var event = domEvents._eventRegistry.get(eventType);
return event.addEventListener.apply(domEvents, arguments);
}
var eventArgs = Array.prototype.slice.call(arguments, 1);
return target.addEventListener.apply(target, eventArgs);
},
removeEventListener: function (target, eventType) {
var hasCustomEvent = domEvents._eventRegistry.has(eventType);
if (hasCustomEvent) {
var event = domEvents._eventRegistry.get(eventType);
return event.removeEventListener.apply(domEvents, arguments);
}
var eventArgs = Array.prototype.slice.call(arguments, 1);
return target.removeEventListener.apply(target, eventArgs);
},
dispatch: function (target, eventData, bubbles, cancelable) {
var event = util.createEvent(target, eventData, bubbles, cancelable);
var enableForDispatch = util.forceEnabledForDispatch(target, event);
if (enableForDispatch) {
target.disabled = false;
}
var ret = target.dispatchEvent(event);
if (enableForDispatch) {
target.disabled = true;
}
return ret;
}
};
module.exports = namespace.domEvents = domEvents;
}(function () {
return this;
}()));
});
/*can-event-dom-radiochange@1.0.2#can-event-dom-radiochange*/
define('can-event-dom-radiochange', [
'require',
'exports',
'module',
'can-dom-data-state',
'can-globals/document/document',
'can-dom-events',
'can-cid/map/map'
], function (require, exports, module) {
(function (global) {
'use strict';
var domData = require('can-dom-data-state');
var getDocument = require('can-globals/document/document');
var domEvents = require('can-dom-events');
var CIDMap = require('can-cid/map/map');
function getRoot(el) {
return el.ownerDocument || getDocument().documentElement;
}
function getRegistryName(eventName) {
return 'can-event-radiochange:' + eventName + ':registry';
}
function getListenerName(eventName) {
return 'can-event-radiochange:' + eventName + ':listener';
}
function getRegistry(root, eventName) {
var name = getRegistryName(eventName);
var registry = domData.get.call(root, name);
if (!registry) {
registry = new CIDMap();
domData.set.call(root, name, registry);
}
return registry;
}
function findParentForm(el) {
while (el) {
if (el.nodeName === 'FORM') {
break;
}
el = el.parentNode;
}
return el;
}
function shouldReceiveEventFromRadio(source, dest) {
var name = source.getAttribute('name');
return name && name === dest.getAttribute('name') && findParentForm(source) === findParentForm(dest);
}
function isRadioInput(el) {
return el.nodeName === 'INPUT' && el.type === 'radio';
}
function dispatch(eventName, target) {
var root = getRoot(target);
var registry = getRegistry(root, eventName);
registry.forEach(function (el) {
if (shouldReceiveEventFromRadio(target, el)) {
domEvents.dispatch(el, eventName);
}
});
}
function attachRootListener(root, eventName, events) {
var listenerName = getListenerName(eventName);
var listener = domData.get.call(root, listenerName);
if (listener) {
return;
}
var newListener = function (event) {
var target = event.target;
if (isRadioInput(target)) {
dispatch(eventName, target);
}
};
events.addEventListener(root, 'change', newListener);
domData.set.call(root, listenerName, newListener);
}
function detachRootListener(root, eventName, events) {
var listenerName = getListenerName(eventName);
var listener = domData.get.call(root, listenerName);
if (!listener) {
return;
}
var registry = getRegistry(root, eventName);
if (registry.size > 0) {
return;
}
events.removeEventListener(root, 'change', listener);
domData.clean.call(root, listenerName);
}
function addListener(eventName, el, events) {
if (!isRadioInput(el)) {
throw new Error('Listeners for ' + eventName + ' must be radio inputs');
}
var root = getRoot(el);
getRegistry(root, eventName).set(el, el);
attachRootListener(root, eventName, events);
}
function removeListener(eventName, el, events) {
var root = getRoot(el);
getRegistry(root, eventName).delete(el);
detachRootListener(root, eventName, events);
}
module.exports = {
defaultEventType: 'radiochange',
addEventListener: function (target, eventName, handler) {
addListener(eventName, target, this);
target.addEventListener(eventName, handler);
},
removeEventListener: function (target, eventName, handler) {
removeListener(eventName, target, this);
target.removeEventListener(eventName, handler);
}
};
}(function () {
return this;
}()));
});
/*can-event-dom-radiochange@1.0.2#compat*/
define('can-event-dom-radiochange/compat', [
'require',
'exports',
'module',
'can-dom-events/helpers/add-event-compat',
'can-event-dom-radiochange'
], function (require, exports, module) {
var addEventCompat = require('can-dom-events/helpers/add-event-compat');
var radioChange = require('can-event-dom-radiochange');
module.exports = function (domEvents, eventType) {
return addEventCompat(domEvents, radioChange, eventType);
};
});
/*can-stache-bindings@3.9.5#can-stache-bindings*/
define('can-stache-bindings', [
'require',
'exports',
'module',
'can-stache/src/expression',
'can-view-callbacks',
'can-view-live',
'can-view-scope',
'can-view-model',
'can-event',
'can-compute',
'can-stache-key',
'can-observation',
'can-simple-observable',
'can-util/js/assign/assign',
'can-util/js/make-array/make-array',
'can-util/js/each/each',
'can-util/js/string/string',
'can-util/js/dev/dev',
'can-types',
'can-util/js/last/last',
'can-globals/mutation-observer/mutation-observer',
'can-util/dom/events/events',
'can-util/dom/events/removed/removed',
'can-util/dom/data/data',
'can-util/dom/attr/attr',
'can-util/js/log/log',
'can-stache/helpers/core',
'can-symbol',
'can-reflect',
'can-util/js/single-reference/single-reference',
'can-attribute-encoder',
'can-event-dom-enter/compat',
'can-event-dom-radiochange/compat'
], function (require, exports, module) {
(function (global) {
var expression = require('can-stache/src/expression');
var viewCallbacks = require('can-view-callbacks');
var live = require('can-view-live');
var Scope = require('can-view-scope');
var canViewModel = require('can-view-model');
var canEvent = require('can-event');
var compute = require('can-compute');
var observeReader = require('can-stache-key');
var Observation = require('can-observation');
var observable = require('can-simple-observable');
var assign = require('can-util/js/assign/assign');
var makeArray = require('can-util/js/make-array/make-array');
var each = require('can-util/js/each/each');
var string = require('can-util/js/string/string');
var dev = require('can-util/js/dev/dev');
var types = require('can-types');
var last = require('can-util/js/last/last');
var getMutationObserver = require('can-globals/mutation-observer/mutation-observer');
var domEvents = require('can-util/dom/events/events');
require('can-util/dom/events/removed/removed');
var domData = require('can-util/dom/data/data');
var attr = require('can-util/dom/attr/attr');
var canLog = require('can-util/js/log/log');
var stacheHelperCore = require('can-stache/helpers/core');
var canSymbol = require('can-symbol');
var canReflect = require('can-reflect');
var singleReference = require('can-util/js/single-reference/single-reference');
var encoder = require('can-attribute-encoder');
var addEnterEvent = require('can-event-dom-enter/compat');
addEnterEvent(domEvents);
var addRadioChange = require('can-event-dom-radiochange/compat');
addRadioChange(domEvents);
var noop = function () {
};
var onMatchStr = 'on:', vmMatchStr = 'vm:', elMatchStr = 'el:', byMatchStr = ':by:', toMatchStr = ':to', fromMatchStr = ':from', bindMatchStr = ':bind', attributesEventStr = 'attributes', removedStr = 'removed', viewModelBindingStr = 'viewModel', attributeBindingStr = 'attribute', scopeBindingStr = 'scope', viewModelOrAttributeBindingStr = 'viewModelOrAttribute', getValueSymbol = 'can.getValue', setValueSymbol = 'can.setValue', onValueSymbol = 'can.onValue', offValueSymbol = 'can.offValue';
function setPriority(observable, priority) {
if (observable instanceof Observation) {
observable.compute._primaryDepth = priority;
} else if (observable.computeInstance) {
observable.computeInstance.setPrimaryDepth(priority);
} else if (observable.observation) {
observable.observation.compute._primaryDepth = priority;
}
}
var throwOnlyOneTypeOfBindingError = function () {
throw new Error('can-stache-bindings - you can not have contextual bindings ( this:from=\'value\' ) and key bindings ( prop:from=\'value\' ) on one element.');
};
var checkBindingState = function (bindingState, dataBinding) {
var isSettingOnViewModel = dataBinding.bindingInfo.parentToChild && dataBinding.bindingInfo.child === viewModelBindingStr;
if (isSettingOnViewModel) {
var bindingName = dataBinding.bindingInfo.childName;
var isSettingViewModel = isSettingOnViewModel && (bindingName === 'this' || bindingName === '.');
if (isSettingViewModel) {
if (bindingState.isSettingViewModel || bindingState.isSettingOnViewModel) {
throwOnlyOneTypeOfBindingError();
} else {
return {
isSettingViewModel: true,
initialViewModelData: undefined
};
}
} else {
if (bindingState.isSettingViewModel) {
throwOnlyOneTypeOfBindingError();
} else {
return {
isSettingOnViewModel: true,
initialViewModelData: bindingState.initialViewModelData
};
}
}
} else {
return bindingState;
}
};
var behaviors = {
viewModel: function (el, tagData, makeViewModel, initialViewModelData, staticDataBindingsOnly) {
var bindingsSemaphore = {}, viewModel, onCompleteBindings = [], onTeardowns = {}, bindingInfos = {}, attributeViewModelBindings = assign({}, initialViewModelData), bindingsState = {
isSettingOnViewModel: false,
isSettingViewModel: false,
initialViewModelData: initialViewModelData || {}
}, hasDataBinding = false;
each(makeArray(el.attributes), function (node) {
var dataBinding = makeDataBinding(node, el, {
templateType: tagData.templateType,
scope: tagData.scope,
semaphore: bindingsSemaphore,
getViewModel: function () {
return viewModel;
},
attributeViewModelBindings: attributeViewModelBindings,
alreadyUpdatedChild: true,
nodeList: tagData.parentNodeList,
favorViewModel: true
});
if (dataBinding) {
bindingsState = checkBindingState(bindingsState, dataBinding);
hasDataBinding = true;
if (dataBinding.onCompleteBinding) {
if (dataBinding.bindingInfo.parentToChild && dataBinding.value !== undefined) {
if (bindingsState.isSettingViewModel) {
bindingsState.initialViewModelData = dataBinding.value;
} else {
bindingsState.initialViewModelData[cleanVMName(dataBinding.bindingInfo.childName)] = dataBinding.value;
}
}
onCompleteBindings.push(dataBinding.onCompleteBinding);
}
onTeardowns[node.name] = dataBinding.onTeardown;
}
});
if (staticDataBindingsOnly && !hasDataBinding) {
return;
}
viewModel = makeViewModel(bindingsState.initialViewModelData, hasDataBinding);
for (var i = 0, len = onCompleteBindings.length; i < len; i++) {
onCompleteBindings[i]();
}
if (!bindingsState.isSettingViewModel) {
domEvents.addEventListener.call(el, attributesEventStr, function (ev) {
var attrName = ev.attributeName, value = el.getAttribute(attrName);
if (onTeardowns[attrName]) {
onTeardowns[attrName]();
}
var parentBindingWasAttribute = bindingInfos[attrName] && bindingInfos[attrName].parent === attributeBindingStr;
if (value !== null || parentBindingWasAttribute) {
var dataBinding = makeDataBinding({
name: attrName,
value: value
}, el, {
templateType: tagData.templateType,
scope: tagData.scope,
semaphore: {},
getViewModel: function () {
return viewModel;
},
attributeViewModelBindings: attributeViewModelBindings,
initializeValues: true,
nodeList: tagData.parentNodeList
});
if (dataBinding) {
if (dataBinding.onCompleteBinding) {
dataBinding.onCompleteBinding();
}
bindingInfos[attrName] = dataBinding.bindingInfo;
onTeardowns[attrName] = dataBinding.onTeardown;
}
}
});
}
return function () {
for (var attrName in onTeardowns) {
onTeardowns[attrName]();
}
};
},
data: function (el, attrData) {
if (domData.get.call(el, 'preventDataBindings')) {
return;
}
var viewModel, getViewModel = function () {
return viewModel || (viewModel = canViewModel(el));
}, semaphore = {}, teardown;
var legacyBindings = bindingsRegExp.exec(attrData.attributeName);
var twoWay = legacyBindings && legacyBindings[1];
var dataBinding = makeDataBinding({
name: attrData.attributeName,
value: el.getAttribute(attrData.attributeName),
nodeList: attrData.nodeList
}, el, {
templateType: attrData.templateType,
scope: attrData.scope,
semaphore: semaphore,
getViewModel: getViewModel,
syncChildWithParent: twoWay
});
if (dataBinding.bindingInfo.child === 'viewModel' && !domData.get(el, 'viewModel')) {
dev.warn('This element does not have a viewModel. (Attempting to bind `' + dataBinding.bindingInfo.bindingAttributeName + '="' + dataBinding.bindingInfo.parentName + '"`)');
}
if (dataBinding.onCompleteBinding) {
dataBinding.onCompleteBinding();
}
teardown = dataBinding.onTeardown;
canEvent.one.call(el, removedStr, function () {
teardown();
});
domEvents.addEventListener.call(el, attributesEventStr, function (ev) {
var attrName = ev.attributeName, value = el.getAttribute(attrName);
if (attrName === attrData.attributeName) {
if (teardown) {
teardown();
}
if (value !== null) {
var dataBinding = makeDataBinding({
name: attrName,
value: value
}, el, {
templateType: attrData.templateType,
scope: attrData.scope,
semaphore: semaphore,
getViewModel: getViewModel,
initializeValues: true,
nodeList: attrData.nodeList,
syncChildWithParent: twoWay
});
if (dataBinding) {
if (dataBinding.onCompleteBinding) {
dataBinding.onCompleteBinding();
}
teardown = dataBinding.onTeardown;
}
}
}
});
},
reference: function (el, attrData) {
if (el.getAttribute(attrData.attributeName)) {
canLog.warn('*reference attributes can only export the view model.');
}
var name = string.camelize(attrData.attributeName.substr(1).toLowerCase());
var viewModel = canViewModel(el);
var refs = attrData.scope.getRefs();
refs._context.attr('*' + name, viewModel);
},
event: function (el, data) {
var attributeName = encoder.decode(data.attributeName), event, bindingContext;
if (attributeName.indexOf(toMatchStr + ':') !== -1 || attributeName.indexOf(fromMatchStr + ':') !== -1 || attributeName.indexOf(bindMatchStr + ':') !== -1) {
return this.data(el, data);
}
if (startsWith.call(attributeName, 'can-')) {
event = attributeName.substr('can-'.length);
bindingContext = el;
} else if (startsWith.call(attributeName, onMatchStr)) {
event = attributeName.substr(onMatchStr.length);
var viewModel = domData.get.call(el, viewModelBindingStr);
var byParent = data.scope;
if (startsWith.call(event, elMatchStr)) {
event = event.substr(elMatchStr.length);
bindingContext = el;
} else {
if (startsWith.call(event, vmMatchStr)) {
event = event.substr(vmMatchStr.length);
bindingContext = viewModel;
byParent = viewModel;
} else {
bindingContext = viewModel || el;
}
var byIndex = event.indexOf(byMatchStr);
if (byIndex >= 0) {
bindingContext = byParent.get(decodeAttrName(event.substr(byIndex + byMatchStr.length)));
event = event.substr(0, byIndex);
}
}
} else {
event = removeBrackets(attributeName, '(', ')');
dev.warn('can-stache-bindings: the event binding format (' + event + ') is deprecated. Use on:' + string.camelize(event[0] === '$' ? event.slice(1) : event.split(' ').reverse().filter(function (s) {
return s;
}).join(':by:')) + ' instead');
if (event.charAt(0) === '$') {
event = event.substr(1);
bindingContext = el;
} else {
if (event.indexOf(' ') >= 0) {
var eventSplit = event.split(' ');
bindingContext = data.scope.get(decodeAttrName(eventSplit[0]));
event = eventSplit[1];
} else {
bindingContext = canViewModel(el);
}
}
}
event = decodeAttrName(event);
var handler = function (ev) {
var attrVal = el.getAttribute(encoder.encode(attributeName));
if (!attrVal) {
return;
}
var viewModel = canViewModel(el);
var expr = expression.parse(removeBrackets(attrVal), {
lookupRule: function () {
return expression.Lookup;
},
methodRule: 'call'
});
if (!(expr instanceof expression.Call) && !(expr instanceof expression.Helper)) {
var defaultArgs = [
data.scope._context,
el
].concat(makeArray(arguments)).map(function (data) {
return new expression.Arg(new expression.Literal(data));
});
expr = new expression.Call(expr, defaultArgs, {});
}
var localScope = data.scope.add({
'@element': el,
'@event': ev,
'@viewModel': viewModel,
'@scope': data.scope,
'@context': data.scope._context,
'%element': this,
'$element': types.wrapElement(el),
'%event': ev,
'%viewModel': viewModel,
'%scope': data.scope,
'%context': data.scope._context,
'%arguments': arguments
}, { notContext: true });
var scopeData = localScope.read(expr.methodExpr.key, { isArgument: true }), args, stacheHelper, stacheHelperResult;
if (!scopeData.value) {
var name = observeReader.reads(expr.methodExpr.key).map(function (part) {
return part.key;
}).join('.');
stacheHelper = stacheHelperCore.getHelper(name);
if (stacheHelper) {
args = expr.args(localScope, null)();
stacheHelperResult = stacheHelper.fn.apply(localScope.peek('.'), args);
if (typeof stacheHelperResult === 'function') {
stacheHelperResult(el);
}
return stacheHelperResult;
}
dev.warn('can-stache-bindings: ' + attributeName + ' couldn\'t find method named ' + expr.methodExpr.key, {
element: el,
scope: data.scope
});
return null;
}
args = expr.args(localScope, null)();
return scopeData.value.apply(scopeData.parent, args);
};
var attributesHandler = function (ev) {
var isEventAttribute = ev.attributeName === attributeName;
var isRemoved = !this.getAttribute(attributeName);
var isEventAttributeRemoved = isEventAttribute && isRemoved;
if (isEventAttributeRemoved) {
unbindEvent();
}
};
var removedHandler = function (ev) {
unbindEvent();
};
var unbindEvent = function () {
canEvent.off.call(bindingContext, event, handler);
canEvent.off.call(el, attributesEventStr, attributesHandler);
canEvent.off.call(el, removedStr, removedHandler);
};
canEvent.on.call(bindingContext, event, handler);
canEvent.on.call(el, attributesEventStr, attributesHandler);
canEvent.on.call(el, removedStr, removedHandler);
},
value: function (el, data) {
var propName = '$value', attrValue = removeBrackets(el.getAttribute('can-value')).trim(), nodeName = el.nodeName.toLowerCase(), elType = nodeName === 'input' && (el.type || el.getAttribute('type')), getterSetter;
if (nodeName === 'input' && (elType === 'checkbox' || elType === 'radio')) {
var property = getObservableFrom.scope(el, data.scope, attrValue, {}, true);
if (el.type === 'checkbox') {
var trueValue = attr.has(el, 'can-true-value') ? el.getAttribute('can-true-value') : true, falseValue = attr.has(el, 'can-false-value') ? el.getAttribute('can-false-value') : false;
getterSetter = compute(function (newValue) {
var isSet = arguments.length !== 0;
if (property && property[canSymbol.for(getValueSymbol)]) {
if (isSet) {
canReflect.setValue(property, newValue ? trueValue : falseValue);
} else {
return canReflect.getValue(property) == trueValue;
}
} else {
if (isSet) {
} else {
return property == trueValue;
}
}
});
} else if (elType === 'radio') {
getterSetter = compute(function (newValue) {
var isSet = arguments.length !== 0 && newValue;
if (property && property[canSymbol.for(getValueSymbol)]) {
if (isSet) {
canReflect.setValue(property, el.value);
} else {
return canReflect.getValue(property) == el.value;
}
} else {
if (isSet) {
} else {
return property == el.value;
}
}
});
}
propName = '$checked';
attrValue = 'getterSetter';
data.scope = new Scope({ getterSetter: getterSetter });
} else if (isContentEditable(el)) {
propName = '$innerHTML';
}
var dataBinding = makeDataBinding({
name: '{(' + propName + ')}',
value: attrValue
}, el, {
templateType: data.templateType,
scope: data.scope,
semaphore: {},
initializeValues: true,
legacyBindings: true
});
canEvent.one.call(el, removedStr, function () {
dataBinding.onTeardown();
});
}
};
function syntaxWarning(el, attrData) {
dev.warn('can-stache-bindings: mismatched binding syntax - ' + encoder.decode(attrData.attributeName));
}
viewCallbacks.attr(/^(:lp:).+(:rb:)$/, syntaxWarning);
viewCallbacks.attr(/^(:lb:).+(:rp:)$/, syntaxWarning);
viewCallbacks.attr(/^(:lp:)(:lb:).+(:rb:)(:rp:)$/, syntaxWarning);
viewCallbacks.attr(/^(:lb:)[(:c:)\w-]+(:rb:)$/, behaviors.data);
viewCallbacks.attr(/[\w\.:]+:to$/, behaviors.data);
viewCallbacks.attr(/[\w\.:]+:from$/, behaviors.data);
viewCallbacks.attr(/[\w\.:]+:bind$/, behaviors.data);
viewCallbacks.attr(/[\w\.:]+:to:on:[\w\.:]+/, behaviors.data);
viewCallbacks.attr(/[\w\.:]+:from:on:[\w\.:]+/, behaviors.data);
viewCallbacks.attr(/[\w\.:]+:bind:on:[\w\.:]+/, behaviors.data);
viewCallbacks.attr(/\*[\w\.\-_]+/, behaviors.reference);
viewCallbacks.attr(/on:[\w\.:]+/, behaviors.event);
viewCallbacks.attr(/^(:lp:)[(:d:)?\w\.\\]+(:rp:)$/, behaviors.event);
viewCallbacks.attr(/can-[\w\.]+/, behaviors.event);
viewCallbacks.attr('can-value', behaviors.value);
var getObservableFrom = {
viewModelOrAttribute: function (el, scope, vmNameOrProp, bindingData, mustBeSettable, stickyCompute, event) {
var viewModel = domData.get.call(el, viewModelBindingStr);
if (viewModel) {
return this.viewModel.apply(this, arguments);
} else {
return this.attribute.apply(this, arguments);
}
},
scope: function (el, scope, scopeProp, bindingData, mustBeSettable, stickyCompute) {
if (!scopeProp) {
return observable();
} else {
if (mustBeSettable) {
var parentExpression = expression.parse(scopeProp, { baseMethodType: 'Call' });
return parentExpression.value(scope, new Scope.Options({}));
} else {
var observation = new Observation(function () {
});
observation[canSymbol.for(setValueSymbol)] = function (newVal) {
scope.set(cleanVMName(scopeProp), newVal);
};
return observation;
}
}
},
viewModel: function (el, scope, vmName, bindingData, mustBeSettable, stickyCompute) {
var setName = cleanVMName(vmName);
var isBoundToContext = vmName === '.' || vmName === 'this';
var keysToRead = isBoundToContext ? [] : observeReader.reads(vmName);
var observation = new Observation(function () {
var viewModel = bindingData.getViewModel();
return observeReader.read(viewModel, keysToRead, {}).value;
});
observation[canSymbol.for(setValueSymbol)] = function (newVal) {
var viewModel = bindingData.getViewModel();
if (arguments.length) {
if (stickyCompute) {
var oldValue = canReflect.getKeyValue(viewModel, setName);
if (canReflect.isObservableLike(oldValue)) {
canReflect.setValue(oldValue, newVal);
} else {
canReflect.setKeyValue(viewModel, setName, observable(canReflect.getValue(stickyCompute)));
}
} else {
if (isBoundToContext) {
canReflect.setValue(viewModel, newVal);
} else {
canReflect.setKeyValue(viewModel, setName, newVal);
}
}
}
};
return observation;
},
attribute: function (el, scope, prop, bindingData, mustBeSettable, stickyCompute, event) {
if (!event) {
event = 'change';
var isRadioInput = el.nodeName === 'INPUT' && el.type === 'radio';
var isValidProp = prop === 'checked' && !bindingData.legacyBindings;
if (isRadioInput && isValidProp) {
event = 'radiochange';
}
var isSpecialProp = attr.special[prop] && attr.special[prop].addEventListener;
if (isSpecialProp) {
event = prop;
}
}
var hasChildren = el.nodeName.toLowerCase() === 'select', isMultiselectValue = prop === 'value' && hasChildren && el.multiple, set = function (newVal) {
if (bindingData.legacyBindings && hasChildren && 'selectedIndex' in el && prop === 'value') {
attr.setAttrOrProp(el, prop, newVal == null ? '' : newVal);
} else {
attr.setAttrOrProp(el, prop, newVal);
}
return newVal;
}, get = function () {
return attr.get(el, prop);
};
if (isMultiselectValue) {
prop = 'values';
}
var observation = new Observation(get);
observation[canSymbol.for(setValueSymbol)] = set;
observation[canSymbol.for(getValueSymbol)] = get;
observation[canSymbol.for(onValueSymbol)] = function (updater) {
var translationHandler = function () {
updater(get());
};
singleReference.set(updater, this, translationHandler);
if (event === 'radiochange') {
canEvent.on.call(el, 'change', translationHandler);
}
canEvent.on.call(el, event, translationHandler);
};
observation[canSymbol.for(offValueSymbol)] = function (updater) {
var translationHandler = singleReference.getAndDelete(updater, this);
if (event === 'radiochange') {
canEvent.off.call(el, 'change', translationHandler);
}
canEvent.off.call(el, event, translationHandler);
};
return observation;
}
};
var bind = {
childToParent: function (el, parentObservable, childObservable, bindingsSemaphore, attrName, syncChild) {
var updateParent = function (newVal) {
if (!bindingsSemaphore[attrName]) {
if (parentObservable && parentObservable[canSymbol.for(getValueSymbol)]) {
if (canReflect.getValue(parentObservable) !== newVal) {
canReflect.setValue(parentObservable, newVal);
}
if (syncChild) {
if (canReflect.getValue(parentObservable) !== canReflect.getValue(childObservable)) {
bindingsSemaphore[attrName] = (bindingsSemaphore[attrName] || 0) + 1;
canReflect.setValue(childObservable, canReflect.getValue(parentObservable));
Observation.afterUpdateAndNotify(function () {
--bindingsSemaphore[attrName];
});
}
}
} else if (canReflect.isMapLike(parentObservable)) {
var attrValue = el.getAttribute(attrName);
dev.warn('can-stache-bindings: Merging ' + attrName + ' into ' + attrValue + ' because its parent is non-observable');
canReflect.eachKey(parentObservable, function (prop) {
canReflect.deleteKeyValue(parentObservable, prop);
});
canReflect.setValue(parentObservable, newVal && newVal.serialize ? newVal.serialize() : newVal, true);
}
}
};
if (childObservable && childObservable[canSymbol.for(getValueSymbol)]) {
canReflect.onValue(childObservable, updateParent);
}
return updateParent;
},
parentToChild: function (el, parentObservable, childUpdate, bindingsSemaphore, attrName) {
var updateChild = function (newValue) {
bindingsSemaphore[attrName] = (bindingsSemaphore[attrName] || 0) + 1;
canReflect.setValue(childUpdate, newValue);
Observation.afterUpdateAndNotify(function () {
--bindingsSemaphore[attrName];
});
};
if (parentObservable && parentObservable[canSymbol.for(getValueSymbol)]) {
canReflect.onValue(parentObservable, updateChild);
}
return updateChild;
}
};
var startsWith = String.prototype.startsWith || function (text) {
return this.indexOf(text) === 0;
};
function getEventName(result) {
if (result.special.on !== undefined) {
return result.tokens[result.special.on + 1];
}
}
var bindingRules = {
to: {
childToParent: true,
parentToChild: false,
syncChildWithParent: false
},
from: {
childToParent: false,
parentToChild: true,
syncChildWithParent: false
},
bind: {
childToParent: true,
parentToChild: true,
syncChildWithParent: true
}
};
var bindingNames = [];
var special = {
vm: true,
on: true
};
each(bindingRules, function (value, key) {
bindingNames.push(key);
special[key] = true;
});
function tokenize(source) {
var splitByColon = source.split(':');
var result = {
tokens: [],
special: {}
};
splitByColon.forEach(function (token) {
if (special[token]) {
result.special[token] = result.tokens.push(token) - 1;
} else {
result.tokens.push(token);
}
});
return result;
}
var bindingsRegExp = /\{(\()?(\^)?([^\}\)]+)\)?\}/, ignoreAttributesRegExp = /^(data-view-id|class|name|id|\[[\w\.-]+\]|#[\w\.-])$/i, DOUBLE_CURLY_BRACE_REGEX = /\{\{/g, encodedSpacesRegExp = /\\s/g, encodedForwardSlashRegExp = /\\f/g;
var getChildBindingStr = function (tokens, favorViewModel) {
if (tokens.indexOf('vm') >= 0) {
return viewModelBindingStr;
} else if (tokens.indexOf('el') >= 0) {
return attributeBindingStr;
} else {
return favorViewModel ? viewModelBindingStr : viewModelOrAttributeBindingStr;
}
};
var getBindingInfo = function (node, attributeViewModelBindings, templateType, tagName, favorViewModel) {
var bindingInfo, attributeName = encoder.decode(node.name), attributeValue = node.value || '', childName;
var result = tokenize(attributeName), dataBindingName, specialIndex;
bindingNames.forEach(function (name) {
if (result.special[name] !== undefined && result.special[name] > 0) {
dataBindingName = name;
specialIndex = result.special[name];
return false;
}
});
if (dataBindingName) {
var childEventName = getEventName(result);
var initializeValues = childEventName ? false : true;
return assign({
parent: scopeBindingStr,
child: getChildBindingStr(result.tokens, favorViewModel),
childName: result.tokens[specialIndex - 1],
childEvent: childEventName,
bindingAttributeName: attributeName,
parentName: attributeValue,
initializeValues: initializeValues
}, bindingRules[dataBindingName]);
}
var matches = attributeName.match(bindingsRegExp);
if (!matches) {
var ignoreAttribute = ignoreAttributesRegExp.test(attributeName);
var vmName = string.camelize(attributeName);
if (ignoreAttribute && node.value.replace(DOUBLE_CURLY_BRACE_REGEX, '').indexOf('{') > -1) {
dev.warn('can-component: looks like you\'re trying to pass ' + attributeName + ' as an attribute into a component, ' + 'but it is not a supported attribute');
}
if (ignoreAttribute || viewCallbacks.attr(encoder.encode(attributeName))) {
return;
}
var syntaxRight = attributeValue[0] === '{' && last(attributeValue) === '}';
var isAttributeToChild = templateType === 'legacy' ? attributeViewModelBindings[vmName] : !syntaxRight;
var scopeName = syntaxRight ? attributeValue.substr(1, attributeValue.length - 2) : attributeValue;
if (isAttributeToChild) {
return {
bindingAttributeName: attributeName,
parent: attributeBindingStr,
parentName: attributeName,
child: viewModelBindingStr,
childName: vmName,
parentToChild: true,
childToParent: true,
syncChildWithParent: true
};
} else {
return {
bindingAttributeName: attributeName,
parent: scopeBindingStr,
parentName: scopeName,
child: viewModelBindingStr,
childName: vmName,
parentToChild: true,
childToParent: true,
syncChildWithParent: true
};
}
}
var twoWay = !!matches[1], childToParent = twoWay || !!matches[2], parentToChild = twoWay || !childToParent;
childName = matches[3];
var newLookup = {
'^': ':to',
'(': ':bind'
};
dev.warn('can-stache-bindings: the data binding format ' + attributeName + ' is deprecated. Use ' + string.camelize(matches[3][0] === '$' ? matches[3].slice(1) : matches[3]) + (newLookup[attributeName.charAt(1)] || ':from') + ' instead');
var isDOM = childName.charAt(0) === '$';
if (isDOM) {
bindingInfo = {
parent: scopeBindingStr,
child: attributeBindingStr,
childToParent: childToParent,
parentToChild: parentToChild,
bindingAttributeName: attributeName,
childName: childName.substr(1),
parentName: attributeValue,
initializeValues: true,
syncChildWithParent: twoWay
};
if (tagName === 'select') {
bindingInfo.stickyParentToChild = true;
}
return bindingInfo;
} else {
bindingInfo = {
parent: scopeBindingStr,
child: viewModelBindingStr,
childToParent: childToParent,
parentToChild: parentToChild,
bindingAttributeName: attributeName,
childName: decodeAttrName(string.camelize(childName)),
parentName: attributeValue,
initializeValues: true,
syncChildWithParent: twoWay
};
if (attributeValue.trim().charAt(0) === '~') {
bindingInfo.stickyParentToChild = true;
}
return bindingInfo;
}
};
var decodeAttrName = function (name) {
return name.replace(encodedSpacesRegExp, ' ').replace(encodedForwardSlashRegExp, '/');
};
var makeDataBinding = function (node, el, bindingData) {
var bindingInfo = getBindingInfo(node, bindingData.attributeViewModelBindings, bindingData.templateType, el.nodeName.toLowerCase(), bindingData.favorViewModel);
if (!bindingInfo) {
return;
}
bindingInfo.alreadyUpdatedChild = bindingData.alreadyUpdatedChild;
if (bindingData.initializeValues) {
bindingInfo.initializeValues = true;
}
var parentObservable = getObservableFrom[bindingInfo.parent](el, bindingData.scope, bindingInfo.parentName, bindingData, bindingInfo.parentToChild), childObservable = getObservableFrom[bindingInfo.child](el, bindingData.scope, bindingInfo.childName, bindingData, bindingInfo.childToParent, bindingInfo.stickyParentToChild && parentObservable, bindingInfo.childEvent), updateParent, updateChild;
if (bindingData.nodeList) {
if (parentObservable) {
setPriority(parentObservable, bindingData.nodeList.nesting + 1);
}
if (childObservable) {
setPriority(childObservable, bindingData.nodeList.nesting + 1);
}
}
if (bindingInfo.parentToChild) {
updateChild = bind.parentToChild(el, parentObservable, childObservable, bindingData.semaphore, bindingInfo.bindingAttributeName);
}
var completeBinding = function () {
if (bindingInfo.childToParent) {
updateParent = bind.childToParent(el, parentObservable, childObservable, bindingData.semaphore, bindingInfo.bindingAttributeName, bindingInfo.syncChildWithParent);
} else if (bindingInfo.stickyParentToChild && childObservable[canSymbol.for(onValueSymbol)]) {
canReflect.onValue(childObservable, noop);
}
if (bindingInfo.initializeValues) {
initializeValues(bindingInfo, childObservable, parentObservable, updateChild, updateParent);
}
};
var onTeardown = function () {
unbindUpdate(parentObservable, updateChild);
unbindUpdate(childObservable, updateParent);
unbindUpdate(childObservable, noop);
};
if (bindingInfo.child === viewModelBindingStr) {
return {
value: bindingInfo.stickyParentToChild ? observable(getValue(parentObservable)) : getValue(parentObservable),
onCompleteBinding: completeBinding,
bindingInfo: bindingInfo,
onTeardown: onTeardown
};
} else {
completeBinding();
return {
bindingInfo: bindingInfo,
onTeardown: onTeardown
};
}
};
var initializeValues = function (bindingInfo, childObservable, parentObservable, updateChild, updateParent) {
var doUpdateParent = false;
if (bindingInfo.parentToChild && !bindingInfo.childToParent) {
} else if (!bindingInfo.parentToChild && bindingInfo.childToParent) {
doUpdateParent = true;
} else if (getValue(childObservable) === undefined) {
} else if (getValue(parentObservable) === undefined) {
doUpdateParent = true;
}
if (doUpdateParent) {
updateParent(getValue(childObservable));
} else {
if (!bindingInfo.alreadyUpdatedChild) {
updateChild(getValue(parentObservable));
}
}
};
if (!getMutationObserver()) {
var updateSelectValue = function (el) {
var bindingCallback = domData.get.call(el, 'canBindingCallback');
if (bindingCallback) {
bindingCallback.onMutation(el);
}
};
live.registerChildMutationCallback('select', updateSelectValue);
live.registerChildMutationCallback('optgroup', function (el) {
updateSelectValue(el.parentNode);
});
}
var isContentEditable = function () {
var values = {
'': true,
'true': true,
'false': false
};
var editable = function (el) {
if (!el || !el.getAttribute) {
return;
}
var attr = el.getAttribute('contenteditable');
return values[attr];
};
return function (el) {
var val = editable(el);
if (typeof val === 'boolean') {
return val;
} else {
return !!editable(el.parentNode);
}
};
}(), removeBrackets = function (value, open, close) {
open = open || '{';
close = close || '}';
if (value[0] === open && value[value.length - 1] === close) {
return value.substr(1, value.length - 2);
}
return value;
}, getValue = function (value) {
return value && value[canSymbol.for(getValueSymbol)] ? canReflect.getValue(value) : value;
}, unbindUpdate = function (observable, updater) {
if (observable && observable[canSymbol.for(getValueSymbol)] && typeof updater === 'function') {
canReflect.offValue(observable, updater);
}
}, cleanVMName = function (name) {
return name.replace(/@/g, '');
};
module.exports = {
behaviors: behaviors,
getBindingInfo: getBindingInfo
};
}(function () {
return this;
}()));
});
/*can-component@3.3.4#can-component*/
define('can-component', [
'require',
'exports',
'module',
'can-component/control/control',
'can-namespace',
'can-construct',
'can-stache-bindings',
'can-view-scope',
'can-view-callbacks',
'can-view-nodelist',
'can-compute',
'can-util/dom/data/data',
'can-util/dom/mutate/mutate',
'can-util/dom/child-nodes/child-nodes',
'can-util/dom/dispatch/dispatch',
'can-types',
'can-util/js/string/string',
'can-reflect',
'can-util/js/each/each',
'can-util/js/assign/assign',
'can-util/js/is-function/is-function',
'can-util/js/log/log',
'can-util/js/dev/dev',
'can-util/js/make-array/make-array',
'can-util/js/is-empty-object/is-empty-object',
'can-util/dom/events/inserted/inserted',
'can-util/dom/events/removed/removed',
'can-view-model'
], function (require, exports, module) {
var ComponentControl = require('can-component/control/control');
var namespace = require('can-namespace');
var Construct = require('can-construct');
var stacheBindings = require('can-stache-bindings');
var Scope = require('can-view-scope');
var viewCallbacks = require('can-view-callbacks');
var nodeLists = require('can-view-nodelist');
var compute = require('can-compute');
var domData = require('can-util/dom/data/data');
var domMutate = require('can-util/dom/mutate/mutate');
var getChildNodes = require('can-util/dom/child-nodes/child-nodes');
var domDispatch = require('can-util/dom/dispatch/dispatch');
var types = require('can-types');
var string = require('can-util/js/string/string');
var canReflect = require('can-reflect');
var canEach = require('can-util/js/each/each');
var assign = require('can-util/js/assign/assign');
var isFunction = require('can-util/js/is-function/is-function');
var canLog = require('can-util/js/log/log');
var canDev = require('can-util/js/dev/dev');
var makeArray = require('can-util/js/make-array/make-array');
var isEmptyObject = require('can-util/js/is-empty-object/is-empty-object');
require('can-util/dom/events/inserted/inserted');
require('can-util/dom/events/removed/removed');
require('can-view-model');
function addContext(el, tagData, insertionElementTagData) {
var vm;
domData.set.call(el, 'preventDataBindings', true);
var teardown = stacheBindings.behaviors.viewModel(el, insertionElementTagData, function (initialData) {
return vm = compute(initialData);
}, undefined, true);
if (!teardown) {
return tagData;
} else {
return assign(assign({}, tagData), {
teardown: teardown,
scope: tagData.scope.add(vm)
});
}
}
function makeInsertionTagCallback(tagName, componentTagData, shadowTagData, leakScope, getPrimaryTemplate) {
var options = shadowTagData.options._context;
return function hookupFunction(el, insertionElementTagData) {
var template = getPrimaryTemplate(el) || insertionElementTagData.subtemplate, renderingLightContent = template !== insertionElementTagData.subtemplate;
if (template) {
delete options.tags[tagName];
var tagData;
if (renderingLightContent) {
if (leakScope.toLightContent) {
tagData = addContext(el, {
scope: insertionElementTagData.scope.cloneFromRef(),
options: insertionElementTagData.options
}, insertionElementTagData);
} else {
tagData = addContext(el, componentTagData, insertionElementTagData);
}
} else {
tagData = addContext(el, insertionElementTagData, insertionElementTagData);
}
var nodeList = nodeLists.register([el], function () {
if (tagData.teardown) {
tagData.teardown();
}
}, insertionElementTagData.parentNodeList || true, false);
nodeList.expression = '<can-slot name=\'' + el.getAttribute('name') + '\'/>';
var frag = template(tagData.scope, tagData.options, nodeList);
var newNodes = makeArray(getChildNodes(frag));
nodeLists.replace(nodeList, frag);
nodeLists.update(nodeList, newNodes);
options.tags[tagName] = hookupFunction;
}
};
}
var Component = Construct.extend({
setup: function () {
Construct.setup.apply(this, arguments);
if (Component) {
var self = this;
if (!isEmptyObject(this.prototype.events)) {
this.Control = ComponentControl.extend(this.prototype.events);
}
if (this.prototype.viewModel && canReflect.isConstructorLike(this.prototype.viewModel)) {
canDev.warn('can-component: Assigning a DefineMap or constructor type to the viewModel property may not be what you intended. Did you mean ViewModel instead? More info: https://canjs.com/doc/can-component.prototype.ViewModel.html');
}
var protoViewModel = this.prototype.viewModel || this.prototype.scope;
if (protoViewModel && this.prototype.ViewModel) {
throw new Error('Cannot provide both a ViewModel and a viewModel property');
}
var vmName = string.capitalize(string.camelize(this.prototype.tag)) + 'VM';
if (this.prototype.ViewModel) {
if (typeof this.prototype.ViewModel === 'function') {
this.ViewModel = this.prototype.ViewModel;
} else {
this.ViewModel = types.DefaultMap.extend(vmName, this.prototype.ViewModel);
}
} else {
if (protoViewModel) {
if (typeof protoViewModel === 'function') {
if (canReflect.isObservableLike(protoViewModel.prototype) && canReflect.isMapLike(protoViewModel.prototype)) {
this.ViewModel = protoViewModel;
} else {
this.viewModelHandler = protoViewModel;
}
} else {
if (canReflect.isObservableLike(protoViewModel) && canReflect.isMapLike(protoViewModel)) {
canLog.warn('can-component: ' + this.prototype.tag + ' is sharing a single map across all component instances');
this.viewModelInstance = protoViewModel;
} else {
this.ViewModel = types.DefaultMap.extend(vmName, protoViewModel);
}
}
} else {
this.ViewModel = types.DefaultMap.extend(vmName, {});
}
}
if (this.prototype.template) {
canLog.warn('can-component.prototype.template: is deprecated and will be removed in a future release. Use can-component.prototype.view');
this.renderer = this.prototype.template;
}
if (this.prototype.view) {
this.renderer = this.prototype.view;
}
viewCallbacks.tag(this.prototype.tag, function (el, options) {
new self(el, options);
});
}
}
}, {
setup: function (el, componentTagData) {
var component = this;
var teardownFunctions = [];
var initialViewModelData = {};
var callTeardownFunctions = function () {
for (var i = 0, len = teardownFunctions.length; i < len; i++) {
teardownFunctions[i]();
}
};
var setupBindings = !domData.get.call(el, 'preventDataBindings');
var viewModel, frag;
var teardownBindings;
if (setupBindings) {
var setupFn = componentTagData.setupBindings || function (el, callback, data) {
return stacheBindings.behaviors.viewModel(el, componentTagData, callback, data);
};
teardownBindings = setupFn(el, function (initialViewModelData) {
var ViewModel = component.constructor.ViewModel, viewModelHandler = component.constructor.viewModelHandler, viewModelInstance = component.constructor.viewModelInstance;
if (viewModelHandler) {
var scopeResult = viewModelHandler.call(component, initialViewModelData, componentTagData.scope, el);
if (canReflect.isObservableLike(scopeResult) && canReflect.isMapLike(scopeResult)) {
viewModelInstance = scopeResult;
} else if (canReflect.isObservableLike(scopeResult.prototype) && canReflect.isMapLike(scopeResult.prototype)) {
ViewModel = scopeResult;
} else {
ViewModel = types.DefaultMap.extend(scopeResult);
}
}
if (ViewModel) {
viewModelInstance = new component.constructor.ViewModel(initialViewModelData);
}
viewModel = viewModelInstance;
return viewModelInstance;
}, initialViewModelData);
}
this.viewModel = viewModel;
domData.set.call(el, 'viewModel', viewModel);
domData.set.call(el, 'preventDataBindings', true);
var options = {
helpers: {},
tags: {}
};
canEach(this.helpers || {}, function (val, prop) {
if (isFunction(val)) {
options.helpers[prop] = val.bind(viewModel);
}
});
var optionsScopeWithHelpers = componentTagData.options.add(options);
if (this.constructor.Control) {
this._control = new this.constructor.Control(el, {
scope: this.viewModel,
viewModel: this.viewModel,
destroy: callTeardownFunctions
});
}
var leakScope = {
toLightContent: this.leakScope === true,
intoShadowContent: this.leakScope === true
};
var hasShadowTemplate = !!this.constructor.renderer;
var betweenTagsRenderer;
var betweenTagsTagData;
if (hasShadowTemplate) {
var shadowTagData;
if (leakScope.intoShadowContent) {
shadowTagData = {
scope: componentTagData.scope.add(new Scope.Refs()).add(this.viewModel, { viewModel: true }),
options: optionsScopeWithHelpers
};
} else {
shadowTagData = {
scope: Scope.refsScope().add(this.viewModel, { viewModel: true }),
options: optionsScopeWithHelpers
};
}
options.tags['can-slot'] = makeInsertionTagCallback('can-slot', componentTagData, shadowTagData, leakScope, function (el) {
return componentTagData.templates[el.getAttribute('name')];
});
options.tags.content = makeInsertionTagCallback('content', componentTagData, shadowTagData, leakScope, function () {
return componentTagData.subtemplate;
});
betweenTagsRenderer = this.constructor.renderer;
betweenTagsTagData = shadowTagData;
} else {
var lightTemplateTagData = {
scope: componentTagData.scope.add(this.viewModel, { viewModel: true }),
options: optionsScopeWithHelpers
};
betweenTagsTagData = lightTemplateTagData;
betweenTagsRenderer = componentTagData.subtemplate || el.ownerDocument.createDocumentFragment.bind(el.ownerDocument);
}
var nodeList = nodeLists.register([], function () {
domDispatch.call(el, 'beforeremove', [], false);
if (teardownBindings) {
teardownBindings();
}
}, componentTagData.parentNodeList || true, false);
nodeList.expression = '<' + this.tag + '>';
teardownFunctions.push(function () {
nodeLists.unregister(nodeList);
});
frag = betweenTagsRenderer(betweenTagsTagData.scope, betweenTagsTagData.options, nodeList);
domMutate.appendChild.call(el, frag);
nodeLists.update(nodeList, getChildNodes(el));
}
});
module.exports = namespace.Component = Component;
});
/*can-connect@1.5.9#connect*/
define('can-connect/connect', [
'require',
'exports',
'module',
'can-util/js/assign/assign'
], function (require, exports, module) {
var assign = require('can-util/js/assign/assign');
var connect = function (behaviors, options) {
behaviors = behaviors.map(function (behavior, index) {
var sortedIndex = -1;
if (typeof behavior === 'string') {
sortedIndex = connect.order.indexOf(behavior);
behavior = behaviorsMap[behavior];
} else if (behavior.isBehavior) {
sortedIndex = connect.order.indexOf(behavior.behaviorName);
} else {
behavior = connect.behavior(behavior);
}
return {
originalIndex: index,
sortedIndex: sortedIndex,
behavior: behavior
};
});
behaviors.sort(function (b1, b2) {
if (~b1.sortedIndex && ~b2.sortedIndex) {
return b1.sortedIndex - b2.sortedIndex;
}
return b1.originalIndex - b2.originalIndex;
});
behaviors = behaviors.map(function (b) {
return b.behavior;
});
var behavior = connect.base(connect.behavior('options', function () {
return options;
})());
behaviors.forEach(function (behave) {
behavior = behave(behavior);
});
if (behavior.init) {
behavior.init();
}
return behavior;
};
connect.order = [
'data/localstorage-cache',
'data/url',
'data/parse',
'cache-requests',
'data/combine-requests',
'constructor',
'constructor/store',
'can/map',
'can/ref',
'fall-through-cache',
'data/worker',
'real-time',
'data/callbacks-cache',
'data/callbacks',
'constructor/callbacks-once'
];
connect.behavior = function (name, behavior) {
if (typeof name !== 'string') {
behavior = name;
name = undefined;
}
var behaviorMixin = function (base) {
var Behavior = function () {
};
Behavior.name = name;
Behavior.prototype = base;
var newBehavior = new Behavior();
var res = typeof behavior === 'function' ? behavior.apply(newBehavior, arguments) : behavior;
assign(newBehavior, res);
newBehavior.__behaviorName = name;
return newBehavior;
};
if (name) {
behaviorMixin.behaviorName = name;
behaviorsMap[name] = behaviorMixin;
}
behaviorMixin.isBehavior = true;
return behaviorMixin;
};
var behaviorsMap = {};
module.exports = connect;
});
/*can-connect@1.5.9#base/base*/
define('can-connect/base/base', [
'require',
'exports',
'module',
'can-connect/connect'
], function (require, exports, module) {
var connect = require('can-connect/connect');
module.exports = connect.behavior('base', function (baseConnection) {
return {
id: function (instance) {
var ids = [], algebra = this.algebra;
if (algebra && algebra.clauses && algebra.clauses.id) {
for (var prop in algebra.clauses.id) {
ids.push(instance[prop]);
}
}
if (this.idProp && !ids.length) {
ids.push(instance[this.idProp]);
}
if (!ids.length) {
ids.push(instance.id);
}
return ids.length > 1 ? ids.join('@|@') : ids[0];
},
idProp: baseConnection.idProp || 'id',
listSet: function (list) {
return list[this.listSetProp];
},
listSetProp: '__listSet',
init: function () {
}
};
});
});
/*can-connect@1.5.9#can-connect*/
define('can-connect', [
'require',
'exports',
'module',
'can-connect/connect',
'can-connect/base/base',
'can-namespace'
], function (require, exports, module) {
var connect = require('can-connect/connect');
var base = require('can-connect/base/base');
var ns = require('can-namespace');
connect.base = base;
module.exports = ns.connect = connect;
});
/*can-connect@1.5.9#helpers/get-items*/
define('can-connect/helpers/get-items', function (require, exports, module) {
module.exports = function (data) {
if (Array.isArray(data)) {
return data;
} else {
return data.data;
}
};
});
/*can-set@1.3.2#src/helpers*/
define('can-set/src/helpers', [
'require',
'exports',
'module',
'can-util/js/assign/assign',
'can-util/js/each/each',
'can-util/js/last/last'
], function (require, exports, module) {
var assign = require('can-util/js/assign/assign');
var each = require('can-util/js/each/each');
var last = require('can-util/js/last/last');
var IgnoreType = function () {
};
var helpers;
module.exports = helpers = {
eachInUnique: function (a, acb, b, bcb, defaultReturn) {
var bCopy = assign({}, b), res;
for (var prop in a) {
res = acb(a[prop], b[prop], a, b, prop);
if (res !== undefined) {
return res;
}
delete bCopy[prop];
}
for (prop in bCopy) {
res = bcb(undefined, b[prop], a, b, prop);
if (res !== undefined) {
return res;
}
}
return defaultReturn;
},
doubleLoop: function (arr, callbacks) {
if (typeof callbacks === 'function') {
callbacks = { iterate: callbacks };
}
var i = 0;
while (i < arr.length) {
if (callbacks.start) {
callbacks.start(arr[i]);
}
var j = i + 1;
while (j < arr.length) {
if (callbacks.iterate(arr[j], j, arr[i], i) === false) {
arr.splice(j, 1);
} else {
j++;
}
}
if (callbacks.end) {
callbacks.end(arr[i]);
}
i++;
}
},
identityMap: function (arr) {
var map = {};
each(arr, function (value) {
map[value] = 1;
});
return map;
},
arrayUnionIntersectionDifference: function (arr1, arr2) {
var map = {};
var intersection = [];
var union = [];
var difference = arr1.slice(0);
each(arr1, function (value) {
map[value] = true;
union.push(value);
});
each(arr2, function (value) {
if (map[value]) {
intersection.push(value);
var index = helpers.indexOf.call(difference, value);
if (index !== -1) {
difference.splice(index, 1);
}
} else {
union.push(value);
}
});
return {
intersection: intersection,
union: union,
difference: difference
};
},
arraySame: function (arr1, arr2) {
if (arr1.length !== arr2.length) {
return false;
}
var map = helpers.identityMap(arr1);
for (var i = 0; i < arr2.length; i++) {
var val = map[arr2[i]];
if (!val) {
return false;
} else if (val > 1) {
return false;
} else {
map[arr2[i]]++;
}
}
return true;
},
indexOf: Array.prototype.indexOf || function (item) {
for (var i = 0, thisLen = this.length; i < thisLen; i++) {
if (this[i] === item) {
return i;
}
}
return -1;
},
map: Array.prototype.map || function (cb) {
var out = [];
for (var i = 0, len = this.length; i < len; i++) {
out.push(cb(this[i], i, this));
}
return out;
},
filter: Array.prototype.filter || function (cb) {
var out = [];
for (var i = 0, len = this.length; i < len; i++) {
if (cb(this[i], i, this)) {
out.push(this[i]);
}
}
return out;
},
ignoreType: new IgnoreType(),
firstProp: function (set) {
for (var prop in set) {
return prop;
}
},
index: function (compare, items, props) {
if (!items || !items.length) {
return undefined;
}
if (compare(props, items[0]) === -1) {
return 0;
} else if (compare(props, last(items)) === 1) {
return items.length;
}
var low = 0, high = items.length;
while (low < high) {
var mid = low + high >>> 1, item = items[mid], computed = compare(props, item);
if (computed === -1) {
high = mid;
} else {
low = mid + 1;
}
}
return high;
},
defaultSort: function (sortPropValue, item1, item2) {
var parts = sortPropValue.split(' ');
var sortProp = parts[0];
var item1Value = item1[sortProp];
var item2Value = item2[sortProp];
var temp;
var desc = parts[1] || '';
desc = desc.toLowerCase() === 'desc';
if (desc) {
temp = item1Value;
item1Value = item2Value;
item2Value = temp;
}
if (item1Value < item2Value) {
return -1;
}
if (item1Value > item2Value) {
return 1;
}
return 0;
}
};
});
/*can-set@1.3.2#src/clause*/
define('can-set/src/clause', [
'require',
'exports',
'module',
'can-util/js/assign/assign',
'can-util/js/each/each'
], function (require, exports, module) {
var assign = require('can-util/js/assign/assign');
var each = require('can-util/js/each/each');
var clause = {};
module.exports = clause;
clause.TYPES = [
'where',
'order',
'paginate',
'id'
];
each(clause.TYPES, function (type) {
var className = type.charAt(0).toUpperCase() + type.substr(1);
clause[className] = function (compare) {
assign(this, compare);
};
clause[className].type = type;
});
});
/*can-set@1.3.2#src/compare*/
define('can-set/src/compare', [
'require',
'exports',
'module',
'can-set/src/helpers',
'can-util/js/assign/assign',
'can-util/js/each/each',
'can-util/js/make-array/make-array'
], function (require, exports, module) {
var h = require('can-set/src/helpers');
var assign = require('can-util/js/assign/assign');
var each = require('can-util/js/each/each');
var makeArray = require('can-util/js/make-array/make-array');
var compareHelpers;
var loop = function (a, b, aParent, bParent, prop, compares, options) {
var checks = options.checks;
for (var i = 0; i < checks.length; i++) {
var res = checks[i](a, b, aParent, bParent, prop, compares || {}, options);
if (res !== undefined) {
return res;
}
}
return options['default'];
};
var addIntersectedPropertyToResult = function (a, b, aParent, bParent, prop, compares, options) {
var subsetCheck;
if (!(prop in aParent)) {
subsetCheck = 'subsetB';
} else if (prop in bParent) {
return false;
}
if (!(prop in bParent)) {
subsetCheck = 'subsetA';
}
if (subsetCheck === 'subsetB') {
options.result[prop] = b;
} else {
options.result[prop] = a;
}
return undefined;
};
var addToResult = function (fn, name) {
return function (a, b, aParent, bParent, prop, compares, options) {
var res = fn.apply(this, arguments);
if (res === true) {
if (prop !== undefined && !(prop in options.result)) {
options.result[prop] = a;
}
return true;
} else {
return res;
}
};
};
module.exports = compareHelpers = {
equal: function (a, b, aParent, bParent, prop, compares, options) {
options.checks = [
compareHelpers.equalComparesType,
compareHelpers.equalBasicTypes,
compareHelpers.equalArrayLike,
compareHelpers.equalObject
];
options['default'] = false;
return loop(a, b, aParent, bParent, prop, compares, options);
},
equalComparesType: function (a, b, aParent, bParent, prop, compares, options) {
if (typeof compares === 'function') {
var compareResult = compares(a, b, aParent, bParent, prop, options);
if (typeof compareResult === 'boolean') {
return compareResult;
} else if (compareResult && typeof compareResult === 'object') {
if ('intersection' in compareResult && !('difference' in compareResult)) {
var reverseResult = compares(b, a, bParent, aParent, prop, options);
return 'intersection' in reverseResult && !('difference' in reverseResult);
}
return false;
}
return compareResult;
}
},
equalBasicTypes: function (a, b, aParent, bParent, prop, compares, options) {
if (a === null || b === null) {
return a === b;
}
if (a instanceof Date && b instanceof Date) {
return a.getTime() === b.getTime();
}
if (options.deep === -1) {
return typeof a === 'object' || a === b;
}
if (typeof a !== typeof b || Array.isArray(a) !== Array.isArray(b)) {
return false;
}
if (a === b) {
return true;
}
},
equalArrayLike: function (a, b, aParent, bParent, prop, compares, options) {
if (Array.isArray(a) && Array.isArray(b)) {
if (a.length !== b.length) {
return false;
}
for (var i = 0; i < a.length; i++) {
var compare = compares[i] === undefined ? compares['*'] : compares[i];
if (!loop(a[i], b[i], a, b, i, compare, options)) {
return false;
}
}
return true;
}
},
equalObject: function (a, b, aParent, bParent, parentProp, compares, options) {
var aType = typeof a;
if (aType === 'object' || aType === 'function') {
var bCopy = assign({}, b);
if (options.deep === false) {
options.deep = -1;
}
for (var prop in a) {
var compare = compares[prop] === undefined ? compares['*'] : compares[prop];
if (!loop(a[prop], b[prop], a, b, prop, compare, options)) {
return false;
}
delete bCopy[prop];
}
for (prop in bCopy) {
if (compares[prop] === undefined || !loop(undefined, b[prop], a, b, prop, compares[prop], options)) {
return false;
}
}
return true;
}
},
subset: function (a, b, aParent, bParent, prop, compares, options) {
options.checks = [
compareHelpers.subsetComparesType,
compareHelpers.equalBasicTypes,
compareHelpers.equalArrayLike,
compareHelpers.subsetObject
];
options.getSubsets = [];
options['default'] = false;
return loop(a, b, aParent, bParent, prop, compares, options);
},
subsetObject: function (a, b, aParent, bParent, parentProp, compares, options) {
var aType = typeof a;
if (aType === 'object' || aType === 'function') {
return h.eachInUnique(a, function (a, b, aParent, bParent, prop) {
var compare = compares[prop] === undefined ? compares['*'] : compares[prop];
if (!loop(a, b, aParent, bParent, prop, compare, options) && prop in bParent) {
return false;
}
}, b, function (a, b, aParent, bParent, prop) {
var compare = compares[prop] === undefined ? compares['*'] : compares[prop];
if (!loop(a, b, aParent, bParent, prop, compare, options)) {
return false;
}
}, true);
}
},
subsetComparesType: function (a, b, aParent, bParent, prop, compares, options) {
if (typeof compares === 'function') {
var compareResult = compares(a, b, aParent, bParent, prop, options);
if (typeof compareResult === 'boolean') {
return compareResult;
} else if (compareResult && typeof compareResult === 'object') {
if (compareResult.getSubset) {
if (h.indexOf.call(options.getSubsets, compareResult.getSubset) === -1) {
options.getSubsets.push(compareResult.getSubset);
}
}
if (compareResult.intersection === h.ignoreType || compareResult.difference === h.ignoreType) {
return true;
}
if ('intersection' in compareResult && !('difference' in compareResult)) {
var reverseResult = compares(b, a, bParent, aParent, prop, options);
return 'intersection' in reverseResult;
}
return false;
}
return compareResult;
}
},
properSupersetObject: function (a, b, aParent, bParent, parentProp, compares, options) {
var bType = typeof b;
var hasAdditionalProp = false;
if (bType === 'object' || bType === 'function') {
var aCopy = assign({}, a);
if (options.deep === false) {
options.deep = -1;
}
for (var prop in b) {
var compare = compares[prop] === undefined ? compares['*'] : compares[prop];
var compareResult = loop(a[prop], b[prop], a, b, prop, compare, options);
if (compareResult === h.ignoreType) {
} else if (!(prop in a) || options.performedDifference) {
hasAdditionalProp = true;
} else if (!compareResult) {
return false;
}
delete aCopy[prop];
}
for (prop in aCopy) {
if (compares[prop] === undefined || !loop(a[prop], undefined, a, b, prop, compares[prop], options)) {
return false;
}
}
return hasAdditionalProp;
}
},
properSubsetComparesType: function (a, b, aParent, bParent, prop, compares, options) {
if (typeof compares === 'function') {
var compareResult = compares(a, b, aParent, bParent, prop, options);
if (typeof compareResult === 'boolean') {
return compareResult;
} else if (compareResult && typeof compareResult === 'object') {
if ('intersection' in compareResult && !('difference' in compareResult)) {
var reverseResult = compares(b, a, bParent, aParent, prop, options);
return 'intersection' in reverseResult && 'difference' in reverseResult;
}
return false;
}
return compareResult;
}
},
difference: function (a, b, aParent, bParent, prop, compares, options) {
options.result = {};
options.performedDifference = 0;
options.checks = [
compareHelpers.differenceComparesType,
addToResult(compareHelpers.equalBasicTypes, 'equalBasicTypes'),
addToResult(compareHelpers.equalArrayLike, 'equalArrayLike'),
addToResult(compareHelpers.properSupersetObject, 'properSubsetObject')
];
options['default'] = true;
var res = loop(a, b, aParent, bParent, prop, compares, options);
if (res === true && options.performedDifference) {
return options.result;
}
return res;
},
differenceComparesType: function (a, b, aParent, bParent, prop, compares, options) {
if (typeof compares === 'function') {
var compareResult = compares(a, b, aParent, bParent, prop, options);
if (typeof compareResult === 'boolean') {
if (compareResult === true) {
options.result[prop] = a;
return true;
} else {
return compareResult;
}
} else if (compareResult && typeof compareResult === 'object') {
if ('difference' in compareResult) {
if (compareResult.difference === h.ignoreType) {
return h.ignoreType;
} else if (compareResult.difference != null) {
options.result[prop] = compareResult.difference;
options.performedDifference++;
return true;
} else {
return true;
}
} else {
if (compareHelpers.equalComparesType.apply(this, arguments)) {
options.performedDifference++;
options.result[prop] = compareResult.union;
} else {
return false;
}
}
}
}
},
union: function (a, b, aParent, bParent, prop, compares, options) {
options.result = {};
options.performedUnion = 0;
options.checks = [
compareHelpers.unionComparesType,
addToResult(compareHelpers.equalBasicTypes, 'equalBasicTypes'),
addToResult(compareHelpers.unionArrayLike, 'unionArrayLike'),
addToResult(compareHelpers.unionObject, 'unionObject')
];
options.getUnions = [];
options['default'] = false;
var res = loop(a, b, aParent, bParent, prop, compares, options);
if (res === true) {
return options.result;
}
return false;
},
unionComparesType: function (a, b, aParent, bParent, prop, compares, options) {
if (typeof compares === 'function') {
var compareResult = compares(a, b, aParent, bParent, prop, options);
if (typeof compareResult === 'boolean') {
if (compareResult === true) {
options.result[prop] = a;
return true;
} else {
return compareResult;
}
} else if (compareResult && typeof compareResult === 'object') {
if (compareResult.getUnion) {
if (h.indexOf.call(options.getUnions, compareResult.getUnion) === -1) {
options.getUnions.push(compareResult.getUnion);
}
}
if ('union' in compareResult) {
if (compareResult.union === h.ignoreType) {
return compareResult.union;
}
if (compareResult.union !== undefined) {
options.result[prop] = compareResult.union;
}
options.performedUnion++;
return true;
}
}
}
},
unionObject: function (a, b, aParent, bParent, prop, compares, options) {
var subsetCompare = function (a, b, aParent, bParent, prop) {
var compare = compares[prop] === undefined ? compares['*'] : compares[prop];
if (!loop(a, b, aParent, bParent, prop, compare, options)) {
var subsetCheck;
if (!(prop in aParent)) {
subsetCheck = 'subsetB';
}
if (!(prop in bParent)) {
subsetCheck = 'subsetA';
}
if (subsetCheck) {
if (!options.subset) {
options.subset = subsetCheck;
}
return options.subset === subsetCheck ? undefined : false;
}
return false;
}
};
var aType = typeof a;
if (aType === 'object' || aType === 'function') {
return h.eachInUnique(a, subsetCompare, b, subsetCompare, true);
}
},
unionArrayLike: function (a, b, aParent, bParent, prop, compares, options) {
if (Array.isArray(a) && Array.isArray(b)) {
var combined = makeArray(a).concat(makeArray(b));
h.doubleLoop(combined, function (item, j, cur, i) {
var res = !compareHelpers.equal(cur, item, aParent, bParent, undefined, compares['*'], { 'default': false });
return res;
});
options.result[prop] = combined;
return true;
}
},
count: function (a, b, aParent, bParent, prop, compares, options) {
options.checks = [
compareHelpers.countComparesType,
compareHelpers.equalBasicTypes,
compareHelpers.equalArrayLike,
compareHelpers.loopObject
];
options['default'] = false;
loop(a, b, aParent, bParent, prop, compares, options);
if (typeof options.count === 'number') {
return options.count;
}
return Infinity;
},
countComparesType: function (a, b, aParent, bParent, prop, compares, options) {
if (typeof compares === 'function') {
var compareResult = compares(a, b, aParent, bParent, prop, options);
if (typeof compareResult === 'boolean') {
return true;
} else if (compareResult && typeof compareResult === 'object') {
if (typeof compareResult.count === 'number') {
if (!('count' in options) || compareResult.count === options.count) {
options.count = compareResult.count;
} else {
options.count = Infinity;
}
}
return true;
}
}
},
loopObject: function (a, b, aParent, bParent, prop, compares, options) {
var aType = typeof a;
if (aType === 'object' || aType === 'function') {
each(a, function (aValue, prop) {
var compare = compares[prop] === undefined ? compares['*'] : compares[prop];
loop(aValue, b[prop], a, b, prop, compare, options);
});
return true;
}
},
intersection: function (a, b, aParent, bParent, prop, compares, options) {
options.result = {};
options.performedIntersection = 0;
options.checks = [
compareHelpers.intersectionComparesType,
addToResult(compareHelpers.equalBasicTypes, 'equalBasicTypes'),
addToResult(compareHelpers.intersectionArrayLike, 'intersectionArrayLike'),
compareHelpers.intersectionObject
];
options['default'] = false;
var res = loop(a, b, aParent, bParent, prop, compares, options);
if (res === true) {
return options.result;
}
return false;
},
intersectionComparesType: function (a, b, aParent, bParent, prop, compares, options) {
if (typeof compares === 'function') {
var compareResult = compares(a, b, aParent, bParent, prop, options);
if (typeof compareResult === 'boolean') {
if (compareResult === true) {
options.result[prop] = a;
return true;
} else {
return compareResult;
}
} else if (compareResult && typeof compareResult === 'object') {
if ('intersection' in compareResult) {
if (compareResult.intersection !== undefined) {
options.result[prop] = compareResult.intersection;
}
options.performedIntersection++;
return true;
}
}
}
},
intersectionObject: function (a, b, aParent, bParent, prop, compares, options) {
var subsetCompare = function (a, b, aParent, bParent, prop) {
var compare = compares[prop] === undefined ? compares['*'] : compares[prop];
if (!loop(a, b, aParent, bParent, prop, compare, options)) {
return addIntersectedPropertyToResult(a, b, aParent, bParent, prop, compares, options);
}
};
var aType = typeof a;
if (aType === 'object' || aType === 'function') {
return h.eachInUnique(a, subsetCompare, b, subsetCompare, true);
}
},
intersectionArrayLike: function (a, b, aParent, bParent, prop, compares, options) {
if (Array.isArray(a) && Array.isArray(b)) {
var intersection = [];
each(makeArray(a), function (cur) {
for (var i = 0; i < b.length; i++) {
if (compareHelpers.equal(cur, b[i], aParent, bParent, undefined, compares['*'], { 'default': false })) {
intersection.push(cur);
break;
}
}
});
options.result[prop] = intersection;
return true;
}
}
};
});
/*can-set@1.3.2#src/get*/
define('can-set/src/get', [
'require',
'exports',
'module',
'can-set/src/compare',
'can-set/src/helpers',
'can-util/js/each/each'
], function (require, exports, module) {
var compare = require('can-set/src/compare');
var h = require('can-set/src/helpers');
var each = require('can-util/js/each/each');
var filterData = function (data, clause, props) {
return h.filter.call(data, function (item) {
var isSubset = compare.subset(item, clause, undefined, undefined, undefined, props, {});
return isSubset;
});
};
module.exports = {
subsetData: function (a, b, bData, algebra) {
var aClauseProps = algebra.getClauseProperties(a);
var bClauseProps = algebra.getClauseProperties(b);
var options = {};
var aData = filterData(bData, aClauseProps.where, algebra.clauses.where);
if (aData.length && (aClauseProps.enabled.order || bClauseProps.enabled.order)) {
options = {};
var propName = h.firstProp(aClauseProps.order), compareOrder = algebra.clauses.order[propName];
aData = aData.sort(function (aItem, bItem) {
return compareOrder(a[propName], aItem, bItem);
});
}
if (aData.length && (aClauseProps.enabled.paginate || bClauseProps.enabled.paginate)) {
options = {};
compare.subset(aClauseProps.paginate, bClauseProps.paginate, undefined, undefined, undefined, algebra.clauses.paginate, options);
each(options.getSubsets, function (filter) {
aData = filter(a, b, aData, algebra, options);
});
}
return aData;
}
};
});
/*can-set@1.3.2#src/set-core*/
define('can-set/src/set-core', [
'require',
'exports',
'module',
'can-set/src/helpers',
'can-set/src/clause',
'can-set/src/compare',
'can-set/src/get',
'can-util/js/assign/assign',
'can-util/js/each/each',
'can-util/js/make-array/make-array',
'can-util/js/is-empty-object/is-empty-object'
], function (require, exports, module) {
var h = require('can-set/src/helpers');
var clause = require('can-set/src/clause');
var compare = require('can-set/src/compare');
var get = require('can-set/src/get');
var assign = require('can-util/js/assign/assign');
var each = require('can-util/js/each/each');
var makeArray = require('can-util/js/make-array/make-array');
var isEmptyObject = require('can-util/js/is-empty-object/is-empty-object');
function Translate(clause, options) {
if (typeof options === 'string') {
var path = options;
options = {
fromSet: function (set, setRemainder) {
return set[path] || {};
},
toSet: function (set, wheres) {
set[path] = wheres;
return set;
}
};
}
this.clause = clause;
assign(this, options);
}
var Algebra = function () {
var clauses = this.clauses = {
where: {},
order: {},
paginate: {},
id: {}
};
this.translators = {
where: new Translate('where', {
fromSet: function (set, setRemainder) {
return setRemainder;
},
toSet: function (set, wheres) {
return assign(set, wheres);
}
})
};
var self = this;
each(arguments, function (arg) {
if (arg) {
if (arg instanceof Translate) {
self.translators[arg.clause] = arg;
} else {
assign(clauses[arg.constructor.type || 'where'], arg);
}
}
});
};
Algebra.make = function (compare, count) {
if (compare instanceof Algebra) {
return compare;
} else {
return new Algebra(compare, count);
}
};
assign(Algebra.prototype, {
getClauseProperties: function (set, options) {
options = options || {};
var setClone = assign({}, set);
var clauses = this.clauses;
var checkClauses = [
'order',
'paginate',
'id'
];
var clauseProps = {
enabled: {
where: true,
order: false,
paginate: false,
id: false
}
};
if (options.omitClauses) {
checkClauses = h.arrayUnionIntersectionDifference(checkClauses, options.omitClauses).difference;
}
each(checkClauses, function (clauseName) {
var valuesForClause = {};
var prop;
for (prop in clauses[clauseName]) {
if (prop in setClone) {
valuesForClause[prop] = setClone[prop];
delete setClone[prop];
}
}
clauseProps[clauseName] = valuesForClause;
clauseProps.enabled[clauseName] = !isEmptyObject(valuesForClause);
});
clauseProps.where = options.isProperties ? setClone : this.translators.where.fromSet(set, setClone);
return clauseProps;
},
getDifferentClauseTypes: function (aClauses, bClauses) {
var self = this;
var differentTypes = [];
each(clause.TYPES, function (type) {
if (!self.evaluateOperator(compare.equal, aClauses[type], bClauses[type], { isProperties: true }, { isProperties: true })) {
differentTypes.push(type);
}
});
return differentTypes;
},
updateSet: function (set, clause, result, useSet) {
if (result && typeof result === 'object' && useSet !== false) {
if (this.translators[clause]) {
set = this.translators.where.toSet(set, result);
} else {
set = assign(set, result);
}
return true;
} else if (result) {
return useSet === undefined ? undefined : false;
} else {
return false;
}
},
evaluateOperator: function (operator, a, b, aOptions, bOptions, evaluateOptions) {
aOptions = aOptions || {};
bOptions = bOptions || {};
evaluateOptions = assign({
evaluateWhere: operator,
evaluatePaginate: operator,
evaluateOrder: operator,
shouldEvaluatePaginate: function (aClauseProps, bClauseProps) {
return aClauseProps.enabled.paginate || bClauseProps.enabled.paginate;
},
shouldEvaluateOrder: function (aClauseProps, bClauseProps) {
return aClauseProps.enabled.order && compare.equal(aClauseProps.order, bClauseProps.order, undefined, undefined, undefined, {}, {});
}
}, evaluateOptions || {});
var aClauseProps = this.getClauseProperties(a, aOptions), bClauseProps = this.getClauseProperties(b, bOptions), set = {}, useSet;
var result = evaluateOptions.evaluateWhere(aClauseProps.where, bClauseProps.where, undefined, undefined, undefined, this.clauses.where, {});
useSet = this.updateSet(set, 'where', result, useSet);
if (result && evaluateOptions.shouldEvaluatePaginate(aClauseProps, bClauseProps)) {
if (evaluateOptions.shouldEvaluateOrder(aClauseProps, bClauseProps)) {
result = evaluateOptions.evaluateOrder(aClauseProps.order, bClauseProps.order, undefined, undefined, undefined, {}, {});
useSet = this.updateSet(set, 'order', result, useSet);
}
if (result) {
result = evaluateOptions.evaluatePaginate(aClauseProps.paginate, bClauseProps.paginate, undefined, undefined, undefined, this.clauses.paginate, {});
useSet = this.updateSet(set, 'paginate', result, useSet);
}
} else if (result && evaluateOptions.shouldEvaluateOrder(aClauseProps, bClauseProps)) {
result = operator(aClauseProps.order, bClauseProps.order, undefined, undefined, undefined, {}, {});
useSet = this.updateSet(set, 'order', result, useSet);
}
return result && useSet ? set : result;
},
equal: function (a, b) {
return this.evaluateOperator(compare.equal, a, b);
},
subset: function (a, b) {
var aClauseProps = this.getClauseProperties(a);
var bClauseProps = this.getClauseProperties(b);
var compatibleSort = true;
var result;
if (bClauseProps.enabled.paginate && (aClauseProps.enabled.order || bClauseProps.enabled.order)) {
compatibleSort = compare.equal(aClauseProps.order, bClauseProps.order, undefined, undefined, undefined, {}, {});
}
if (!compatibleSort) {
result = false;
} else {
result = this.evaluateOperator(compare.subset, a, b);
}
return result;
},
properSubset: function (a, b) {
return this.subset(a, b) && !this.equal(a, b);
},
difference: function (a, b) {
var aClauseProps = this.getClauseProperties(a);
var bClauseProps = this.getClauseProperties(b);
var differentClauses = this.getDifferentClauseTypes(aClauseProps, bClauseProps);
var result;
switch (differentClauses.length) {
case 0: {
result = false;
break;
}
case 1: {
var clause = differentClauses[0];
result = compare.difference(aClauseProps[clause], bClauseProps[clause], undefined, undefined, undefined, this.clauses[clause], {});
if (this.translators[clause] && typeof result === 'object') {
result = this.translators[clause].toSet({}, result);
}
break;
}
}
return result;
},
union: function (a, b) {
return this.evaluateOperator(compare.union, a, b);
},
intersection: function (a, b) {
return this.evaluateOperator(compare.intersection, a, b);
},
count: function (set) {
return this.evaluateOperator(compare.count, set, {});
},
has: function (set, props) {
var aClauseProps = this.getClauseProperties(set);
var propsClauseProps = this.getClauseProperties(props, { isProperties: true });
var compatibleSort = true;
var result;
if ((propsClauseProps.enabled.paginate || aClauseProps.enabled.paginate) && (propsClauseProps.enabled.order || aClauseProps.enabled.order)) {
compatibleSort = compare.equal(propsClauseProps.order, aClauseProps.order, undefined, undefined, undefined, {}, {});
}
if (!compatibleSort) {
result = false;
} else {
result = this.evaluateOperator(compare.subset, props, set, { isProperties: true }, undefined, {
shouldEvaluatePaginate: function () {
return false;
}
});
}
return result;
},
index: function (set, items, item) {
var aClauseProps = this.getClauseProperties(set);
var propName = h.firstProp(aClauseProps.order), compare, orderValue;
if (propName) {
compare = this.clauses.order[propName];
orderValue = set[propName];
return h.index(function (itemA, itemB) {
return compare(orderValue, itemA, itemB);
}, items, item);
}
propName = h.firstProp(this.clauses.id);
if (propName) {
compare = h.defaultSort;
orderValue = propName;
return h.index(function (itemA, itemB) {
return compare(orderValue, itemA, itemB);
}, items, item);
}
return;
},
getSubset: function (a, b, bData) {
var aClauseProps = this.getClauseProperties(a);
var bClauseProps = this.getClauseProperties(b);
var isSubset = this.subset(assign({}, aClauseProps.where, aClauseProps.paginate), assign({}, bClauseProps.where, bClauseProps.paginate));
if (isSubset) {
return get.subsetData(a, b, bData, this);
}
},
getUnion: function (a, b, aItems, bItems) {
var aClauseProps = this.getClauseProperties(a);
var bClauseProps = this.getClauseProperties(b);
var algebra = this;
var options;
if (this.subset(a, b)) {
return bItems;
} else if (this.subset(b, a)) {
return aItems;
}
var combined;
if (aClauseProps.enabled.paginate || bClauseProps.enabled.paginate) {
options = {};
var isUnion = compare.union(aClauseProps.paginate, bClauseProps.paginate, undefined, undefined, undefined, this.clauses.paginate, options);
if (!isUnion) {
return;
} else {
each(options.getUnions, function (filter) {
var items = filter(a, b, aItems, bItems, algebra, options);
aItems = items[0];
bItems = items[1];
});
combined = aItems.concat(bItems);
}
} else {
combined = aItems.concat(bItems);
}
if (combined.length && aClauseProps.enabled.order && compare.equal(aClauseProps.order, bClauseProps.order, undefined, undefined, undefined, {}, {})) {
options = {};
var propName = h.firstProp(aClauseProps.order), compareOrder = algebra.clauses.order[propName];
combined = combined.sort(function (aItem, bItem) {
return compareOrder(a[propName], aItem, bItem);
});
}
return combined;
},
id: function (props) {
var keys = Object.keys(this.clauses.id);
if (keys.length === 1) {
return props[keys[0]];
} else {
var id = {};
keys.forEach(function (key) {
id[key] = props[key];
});
return JSON.stringify(id);
}
}
});
var callOnAlgebra = function (methodName, algebraArgNumber) {
return function () {
var args = makeArray(arguments).slice(0, algebraArgNumber);
var algebra = Algebra.make(arguments[algebraArgNumber]);
return algebra[methodName].apply(algebra, args);
};
};
module.exports = {
Algebra: Algebra,
Translate: Translate,
difference: callOnAlgebra('difference', 2),
equal: callOnAlgebra('equal', 2),
subset: callOnAlgebra('subset', 2),
properSubset: callOnAlgebra('properSubset', 2),
union: callOnAlgebra('union', 2),
intersection: callOnAlgebra('intersection', 2),
count: callOnAlgebra('count', 1),
has: callOnAlgebra('has', 2),
index: callOnAlgebra('index', 3),
getSubset: callOnAlgebra('getSubset', 3),
getUnion: callOnAlgebra('getUnion', 4)
};
});
/*can-set@1.3.2#src/props*/
define('can-set/src/props', [
'require',
'exports',
'module',
'can-set/src/helpers',
'can-set/src/clause',
'can-util/js/each/each'
], function (require, exports, module) {
var h = require('can-set/src/helpers');
var clause = require('can-set/src/clause');
var each = require('can-util/js/each/each');
var within = function (value, range) {
return value >= range[0] && value <= range[1];
};
var numericProperties = function (setA, setB, property1, property2) {
return {
sAv1: +setA[property1],
sAv2: +setA[property2],
sBv1: +setB[property1],
sBv2: +setB[property2]
};
};
var diff = function (setA, setB, property1, property2) {
var numProps = numericProperties(setA, setB, property1, property2);
var sAv1 = numProps.sAv1, sAv2 = numProps.sAv2, sBv1 = numProps.sBv1, sBv2 = numProps.sBv2, count = sAv2 - sAv1 + 1;
var after = {
difference: [
sBv2 + 1,
sAv2
],
intersection: [
sAv1,
sBv2
],
union: [
sBv1,
sAv2
],
count: count,
meta: 'after'
};
var before = {
difference: [
sAv1,
sBv1 - 1
],
intersection: [
sBv1,
sAv2
],
union: [
sAv1,
sBv2
],
count: count,
meta: 'before'
};
if (sAv1 === sBv1 && sAv2 === sBv2) {
return {
intersection: [
sAv1,
sAv2
],
union: [
sAv1,
sAv2
],
count: count,
meta: 'equal'
};
} else if (sAv1 === sBv1 && sBv2 < sAv2) {
return after;
} else if (sAv2 === sBv2 && sBv1 > sAv1) {
return before;
} else if (within(sAv1, [
sBv1,
sBv2
]) && within(sAv2, [
sBv1,
sBv2
])) {
return {
intersection: [
sAv1,
sAv2
],
union: [
sBv1,
sBv2
],
count: count,
meta: 'subset'
};
} else if (within(sBv1, [
sAv1,
sAv2
]) && within(sBv2, [
sAv1,
sAv2
])) {
return {
intersection: [
sBv1,
sBv2
],
difference: [
null,
null
],
union: [
sAv1,
sAv2
],
count: count,
meta: 'superset'
};
} else if (sAv1 < sBv1 && within(sAv2, [
sBv1,
sBv2
])) {
return before;
} else if (sBv1 < sAv1 && within(sBv2, [
sAv1,
sAv2
])) {
return after;
} else if (sAv2 === sBv1 - 1) {
return {
difference: [
sAv1,
sAv2
],
union: [
sAv1,
sBv2
],
count: count,
meta: 'disjoint-before'
};
} else if (sBv2 === sAv1 - 1) {
return {
difference: [
sAv1,
sAv2
],
union: [
sBv1,
sAv2
],
count: count,
meta: 'disjoint-after'
};
}
if (!isNaN(count)) {
return {
count: count,
meta: 'disjoint'
};
}
};
var cleanUp = function (value, enumData) {
if (!value) {
return enumData;
}
if (!Array.isArray(value)) {
value = [value];
}
if (!value.length) {
return enumData;
}
return value;
};
var stringConvert = {
'0': false,
'false': false,
'null': undefined,
'undefined': undefined
};
var convertToBoolean = function (value) {
if (typeof value === 'string') {
return value.toLowerCase() in stringConvert ? stringConvert[value.toLowerCase()] : true;
}
return value;
};
var props = {
'enum': function (prop, enumData) {
var compares = new clause.Where({});
compares[prop] = function (vA, vB, A, B) {
vA = cleanUp(vA, enumData);
vB = cleanUp(vB, enumData);
var data = h.arrayUnionIntersectionDifference(vA, vB);
if (!data.difference.length) {
delete data.difference;
}
each(data, function (value, prop) {
if (Array.isArray(value)) {
if (h.arraySame(enumData, value)) {
data[prop] = undefined;
} else if (value.length === 1) {
data[prop] = value[0];
}
}
});
return data;
};
return compares;
},
paginate: function (propStart, propEnd, translateToStartEnd, reverseTranslate) {
var compares = {};
var makeResult = function (result, index) {
var res = {};
each([
'intersection',
'difference',
'union'
], function (prop) {
if (result[prop]) {
var set = {
start: result[prop][0],
end: result[prop][1]
};
res[prop] = reverseTranslate(set)[index === 0 ? propStart : propEnd];
}
});
if (result.count) {
res.count = result.count;
}
return res;
};
compares[propStart] = function (vA, vB, A, B) {
if (vA === undefined) {
return;
}
var res = diff(translateToStartEnd(A), translateToStartEnd(B), 'start', 'end');
var result = makeResult(res, 0);
result.getSubset = function (a, b, bItems, algebra, options) {
return bItems;
};
result.getUnion = function (a, b, aItems, bItems, algebra, options) {
return [
aItems,
bItems
];
};
return result;
};
compares[propEnd] = function (vA, vB, A, B) {
if (vA === undefined) {
return;
}
var data = diff(translateToStartEnd(A), translateToStartEnd(B), 'start', 'end');
var res = makeResult(data, 1);
res.getSubset = function (a, b, bItems, algebra, options) {
var tA = translateToStartEnd(a);
var tB = translateToStartEnd(b);
var numProps = numericProperties(tA, tB, 'start', 'end');
var aStartValue = numProps.sAv1, aEndValue = numProps.sAv2;
var bStartValue = numProps.sBv1;
if (!('end' in tB) || !('end' in tA)) {
return bItems.slice(aStartValue, aEndValue + 1);
}
return bItems.slice(aStartValue - bStartValue, aEndValue - bStartValue + 1);
};
res.getUnion = function (a, b, aItems, bItems, algebra, options) {
var tA = translateToStartEnd(a);
var tB = translateToStartEnd(b);
if (data.meta.indexOf('after') >= 0) {
if (data.intersection) {
bItems = bItems.slice(0, data.intersection[0] - +tB.start);
}
return [
bItems,
aItems
];
}
if (data.intersection) {
aItems = aItems.slice(0, data.intersection[0] - +tA.start);
}
return [
aItems,
bItems
];
};
return res;
};
return new clause.Paginate(compares);
},
'boolean': function (propertyName) {
var compares = new clause.Where({});
compares[propertyName] = function (propA, propB) {
propA = convertToBoolean(propA);
propB = convertToBoolean(propB);
var notA = !propA, notB = !propB;
if (propA === notB && propB === notA) {
return {
difference: !propB,
union: undefined
};
} else if (propA === undefined) {
return {
difference: !propB,
intersection: propB,
union: undefined
};
} else if (propA === propB) {
return true;
}
};
return compares;
},
'sort': function (prop, sortFunc) {
if (!sortFunc) {
sortFunc = h.defaultSort;
}
var compares = {};
compares[prop] = sortFunc;
return new clause.Order(compares);
},
'id': function (prop) {
var compares = {};
compares[prop] = prop;
return new clause.Id(compares);
}
};
var assignExcept = function (d, s, props) {
for (var prop in s) {
if (!props[prop]) {
d[prop] = s[prop];
}
}
return d;
};
var translateToOffsetLimit = function (set, offsetProp, limitProp) {
var newSet = assignExcept({}, set, {
start: 1,
end: 1
});
if ('start' in set) {
newSet[offsetProp] = set.start;
}
if ('end' in set) {
newSet[limitProp] = set.end - set.start + 1;
}
return newSet;
};
var translateToStartEnd = function (set, offsetProp, limitProp) {
var except = {};
except[offsetProp] = except[limitProp] = 1;
var newSet = assignExcept({}, set, except);
if (offsetProp in set) {
newSet.start = parseInt(set[offsetProp], 10);
}
if (limitProp in set) {
newSet.end = newSet.start + parseInt(set[limitProp]) - 1;
}
return newSet;
};
props.offsetLimit = function (offsetProp, limitProp) {
offsetProp = offsetProp || 'offset';
limitProp = limitProp || 'limit';
return props.paginate(offsetProp, limitProp, function (set) {
return translateToStartEnd(set, offsetProp, limitProp);
}, function (set) {
return translateToOffsetLimit(set, offsetProp, limitProp);
});
};
props.rangeInclusive = function (startIndexProperty, endIndexProperty) {
startIndexProperty = startIndexProperty || 'start';
endIndexProperty = endIndexProperty || 'end';
return props.paginate(startIndexProperty, endIndexProperty, function (set) {
var except = {};
except[startIndexProperty] = except[endIndexProperty] = 1;
var newSet = assignExcept({}, set, except);
if (startIndexProperty in set) {
newSet.start = set[startIndexProperty];
}
if (endIndexProperty in set) {
newSet.end = set[endIndexProperty];
}
return newSet;
}, function (set) {
var except = {
start: 1,
end: 1
};
var newSet = assignExcept({}, set, except);
newSet[startIndexProperty] = set.start;
newSet[endIndexProperty] = set.end;
return newSet;
});
};
var nestedLookup = function (obj, propNameArray) {
if (obj === undefined) {
return undefined;
}
if (propNameArray.length === 1) {
return obj[propNameArray[0]];
} else {
return nestedLookup(obj[propNameArray[0]], propNameArray.slice(1));
}
};
props.dotNotation = function (dotProperty) {
var compares = new clause.Where({});
compares[dotProperty] = function (aVal, bVal, a, b, propertyName) {
if (aVal === undefined) {
aVal = nestedLookup(a, propertyName.split('.'));
}
if (bVal === undefined) {
bVal = nestedLookup(b, propertyName.split('.'));
}
return aVal === bVal;
};
return compares;
};
module.exports = props;
});
/*can-set@1.3.2#src/set*/
define('can-set', [
'require',
'exports',
'module',
'can-set/src/set-core',
'can-namespace',
'can-set/src/props',
'can-set/src/clause',
'can-set/src/helpers'
], function (require, exports, module) {
var set = require('can-set/src/set-core');
var ns = require('can-namespace');
var props = require('can-set/src/props');
var clause = require('can-set/src/clause');
set.comparators = props;
set.props = props;
set.helpers = require('can-set/src/helpers');
set.clause = clause;
module.exports = ns.set = set;
});
/*can-validate-interface@0.1.0#index*/
define('can-validate-interface', function (require, exports, module) {
function makeInterfaceValidator(interfacePropArrays) {
var props = flatten(interfacePropArrays);
return function (base) {
var missingProps = props.reduce(function (missing, prop) {
return prop in base ? missing : missing.concat(prop);
}, []);
return missingProps.length ? {
message: 'missing expected properties',
related: missingProps
} : undefined;
};
}
function flatten(arrays) {
return arrays.reduce(function (ret, val) {
return ret.concat(val);
}, []);
}
module.exports = makeInterfaceValidator;
});
/*can-connect@1.5.9#helpers/validate*/
define('can-connect/helpers/validate', [
'require',
'exports',
'module',
'can-validate-interface'
], function (require, exports, module) {
var makeInterfaceValidator = require('can-validate-interface');
module.exports = function (extendingBehavior, interfaces) {
var validatedBehaviour = validateArgumentInterface(extendingBehavior, 0, interfaces, function (errors, baseBehavior) {
throw new BehaviorInterfaceError(baseBehavior, extendingBehavior, errors);
});
Object.keys(extendingBehavior).forEach(function (k) {
validatedBehaviour[k] = extendingBehavior[k];
});
validatedBehaviour.__interfaces = interfaces;
return validatedBehaviour;
};
function validateArgumentInterface(func, argIndex, interfaces, errorHandler) {
return function () {
var errors = makeInterfaceValidator(interfaces)(arguments[argIndex]);
if (errors && errorHandler) {
errorHandler(errors, arguments[argIndex]);
}
return func.apply(this, arguments);
};
}
function BehaviorInterfaceError(baseBehavior, extendingBehavior, missingProps) {
var extendingName = extendingBehavior.behaviorName || 'anonymous behavior', baseName = baseBehavior.__behaviorName || 'anonymous behavior', message = 'can-connect: Extending behavior "' + extendingName + '" found base behavior "' + baseName + '" was missing required properties: ' + JSON.stringify(missingProps.related), instance = new Error(message);
if (Object.setPrototypeOf) {
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
}
return instance;
}
BehaviorInterfaceError.prototype = Object.create(Error.prototype, { constructor: { value: Error } });
if (Object.setPrototypeOf) {
Object.setPrototypeOf(BehaviorInterfaceError, Error);
} else {
BehaviorInterfaceError.__proto__ = Error;
}
});
/*can-connect@1.5.9#cache-requests/cache-requests*/
define('can-connect/cache-requests/cache-requests', [
'require',
'exports',
'module',
'can-connect',
'can-connect/helpers/get-items',
'can-set',
'can-connect/helpers/validate'
], function (require, exports, module) {
var connect = require('can-connect');
var getItems = require('can-connect/helpers/get-items');
var canSet = require('can-set');
var forEach = [].forEach;
var cacheRequestsBehaviour = connect.behavior('cache-requests', function (baseConnection) {
return {
getDiff: function (params, availableSets) {
var minSets, self = this;
forEach.call(availableSets, function (set) {
var curSets;
var difference = canSet.difference(params, set, self.algebra);
if (typeof difference === 'object') {
curSets = {
needed: difference,
cached: canSet.intersection(params, set, self.algebra),
count: canSet.count(difference, self.algebra)
};
} else if (canSet.subset(params, set, self.algebra)) {
curSets = {
cached: params,
count: 0
};
}
if (curSets) {
if (!minSets || curSets.count < minSets.count) {
minSets = curSets;
}
}
});
if (!minSets) {
return { needed: params };
} else {
return {
needed: minSets.needed,
cached: minSets.cached
};
}
},
getUnion: function (params, diff, neededItems, cachedItems) {
return { data: canSet.getUnion(diff.needed, diff.cached, getItems(neededItems), getItems(cachedItems), this.algebra) };
},
getListData: function (set) {
set = set || {};
var self = this;
return this.cacheConnection.getSets(set).then(function (sets) {
var diff = self.getDiff(set, sets);
if (!diff.needed) {
return self.cacheConnection.getListData(diff.cached);
} else if (!diff.cached) {
return baseConnection.getListData(diff.needed).then(function (data) {
return self.cacheConnection.updateListData(getItems(data), diff.needed).then(function () {
return data;
});
});
} else {
var cachedPromise = self.cacheConnection.getListData(diff.cached);
var needsPromise = baseConnection.getListData(diff.needed);
var savedPromise = needsPromise.then(function (data) {
return self.cacheConnection.updateListData(getItems(data), diff.needed).then(function () {
return data;
});
});
var combinedPromise = Promise.all([
cachedPromise,
needsPromise
]).then(function (result) {
var cached = result[0], needed = result[1];
return self.getUnion(set, diff, needed, cached);
});
return Promise.all([
combinedPromise,
savedPromise
]).then(function (data) {
return data[0];
});
}
});
}
};
});
module.exports = cacheRequestsBehaviour;
var validate = require('can-connect/helpers/validate');
module.exports = validate(cacheRequestsBehaviour, [
'getListData',
'cacheConnection'
]);
});
/*can-connect@1.5.9#helpers/weak-reference-map*/
define('can-connect/helpers/weak-reference-map', [
'require',
'exports',
'module',
'can-util/js/assign/assign'
], function (require, exports, module) {
var assign = require('can-util/js/assign/assign');
var WeakReferenceMap = function () {
this.set = {};
};
assign(WeakReferenceMap.prototype, {
has: function (key) {
return !!this.set[key];
},
addReference: function (key, item, referenceCount) {
if (typeof key === 'undefined') {
throw new Error('can-connect: You must provide a key to store a value in a WeakReferenceMap');
}
var data = this.set[key];
if (!data) {
data = this.set[key] = {
item: item,
referenceCount: 0,
key: key
};
}
data.referenceCount += referenceCount || 1;
},
referenceCount: function (key) {
var data = this.set[key];
if (data) {
return data.referenceCount;
}
},
deleteReference: function (key) {
var data = this.set[key];
if (data) {
data.referenceCount--;
if (data.referenceCount === 0) {
delete this.set[key];
}
}
},
get: function (key) {
var data = this.set[key];
if (data) {
return data.item;
}
},
forEach: function (cb) {
for (var id in this.set) {
cb(this.set[id].item, id);
}
}
});
module.exports = WeakReferenceMap;
});
/*can-connect@1.5.9#helpers/overwrite*/
define('can-connect/helpers/overwrite', function (require, exports, module) {
module.exports = function (d, s, id) {
for (var prop in d) {
if (d.hasOwnProperty(prop) && !(prop.substr(0, 2) === '__') && prop !== id && !(prop in s)) {
delete d[prop];
}
}
for (prop in s) {
d[prop] = s[prop];
}
return d;
};
});
/*can-connect@1.5.9#helpers/id-merge*/
define('can-connect/helpers/id-merge', function (require, exports, module) {
var map = [].map;
module.exports = function (list, update, id, make) {
var listIndex = 0, updateIndex = 0;
while (listIndex < list.length && updateIndex < update.length) {
var listItem = list[listIndex], updateItem = update[updateIndex], lID = id(listItem), uID = id(updateItem);
if (id(listItem) === id(updateItem)) {
listIndex++;
updateIndex++;
continue;
}
if (updateIndex + 1 < update.length && id(update[updateIndex + 1]) === lID) {
list.splice(listIndex, 0, make(update[updateIndex]));
listIndex++;
updateIndex++;
continue;
} else if (listIndex + 1 < list.length && id(list[listIndex + 1]) === uID) {
list.splice(listIndex, 1);
listIndex++;
updateIndex++;
continue;
} else {
list.splice.apply(list, [
listIndex,
list.length - listIndex
].concat(map.call(update.slice(updateIndex), make)));
return list;
}
}
if (updateIndex === update.length && listIndex === list.length) {
return;
}
list.splice.apply(list, [
listIndex,
list.length - listIndex
].concat(map.call(update.slice(updateIndex), make)));
return;
};
});
/*can-connect@1.5.9#constructor/constructor*/
define('can-connect/constructor/constructor', [
'require',
'exports',
'module',
'can-util/js/make-array/make-array',
'can-util/js/assign/assign',
'can-connect',
'can-connect/helpers/weak-reference-map',
'can-connect/helpers/overwrite',
'can-connect/helpers/id-merge'
], function (require, exports, module) {
var makeArray = require('can-util/js/make-array/make-array');
var assign = require('can-util/js/assign/assign');
var connect = require('can-connect');
var WeakReferenceMap = require('can-connect/helpers/weak-reference-map');
var overwrite = require('can-connect/helpers/overwrite');
var idMerge = require('can-connect/helpers/id-merge');
module.exports = connect.behavior('constructor', function (baseConnection) {
var behavior = {
cidStore: new WeakReferenceMap(),
_cid: 0,
get: function (params) {
var self = this;
return this.getData(params).then(function (data) {
return self.hydrateInstance(data);
});
},
getList: function (set) {
set = set || {};
var self = this;
return this.getListData(set).then(function (data) {
return self.hydrateList(data, set);
});
},
hydrateList: function (listData, set) {
if (Array.isArray(listData)) {
listData = { data: listData };
}
var arr = [];
for (var i = 0; i < listData.data.length; i++) {
arr.push(this.hydrateInstance(listData.data[i]));
}
listData.data = arr;
if (this.list) {
return this.list(listData, set);
} else {
var list = listData.data.slice(0);
list[this.listSetProp || '__listSet'] = set;
copyMetadata(listData, list);
return list;
}
},
hydrateInstance: function (props) {
if (this.instance) {
return this.instance(props);
} else {
return assign({}, props);
}
},
save: function (instance) {
var serialized = this.serializeInstance(instance);
var id = this.id(instance);
var self = this;
if (id === undefined) {
var cid = this._cid++;
this.cidStore.addReference(cid, instance);
return this.createData(serialized, cid).then(function (data) {
if (data !== undefined) {
self.createdInstance(instance, data);
}
self.cidStore.deleteReference(cid, instance);
return instance;
});
} else {
return this.updateData(serialized).then(function (data) {
if (data !== undefined) {
self.updatedInstance(instance, data);
}
return instance;
});
}
},
destroy: function (instance) {
var serialized = this.serializeInstance(instance), self = this;
return this.destroyData(serialized).then(function (data) {
if (data !== undefined) {
self.destroyedInstance(instance, data);
}
return instance;
});
},
createdInstance: function (instance, props) {
assign(instance, props);
},
updatedInstance: function (instance, data) {
overwrite(instance, data, this.idProp);
},
updatedList: function (list, listData, set) {
var instanceList = [];
for (var i = 0; i < listData.data.length; i++) {
instanceList.push(this.hydrateInstance(listData.data[i]));
}
idMerge(list, instanceList, this.id.bind(this), this.hydrateInstance.bind(this));
copyMetadata(listData, list);
},
destroyedInstance: function (instance, data) {
overwrite(instance, data, this.idProp);
},
serializeInstance: function (instance) {
return assign({}, instance);
},
serializeList: function (list) {
var self = this;
return makeArray(list).map(function (instance) {
return self.serializeInstance(instance);
});
},
isNew: function (instance) {
var id = this.id(instance);
return !(id || id === 0);
}
};
return behavior;
});
function copyMetadata(listData, list) {
for (var prop in listData) {
if (prop !== 'data') {
if (typeof list.set === 'function') {
list.set(prop, listData[prop]);
} else if (typeof list.attr === 'function') {
list.attr(prop, listData[prop]);
} else {
list[prop] = listData[prop];
}
}
}
}
});
/*can-connect@1.5.9#helpers/sorted-set-json*/
define('can-connect/helpers/sorted-set-json', function (require, exports, module) {
var forEach = [].forEach;
var keys = Object.keys;
module.exports = function (set) {
if (set == null) {
return set;
} else {
var sorted = {};
forEach.call(keys(set).sort(), function (prop) {
sorted[prop] = set[prop];
});
return JSON.stringify(sorted);
}
};
});
/*can-connect@1.5.9#constructor/callbacks-once/callbacks-once*/
define('can-connect/constructor/callbacks-once/callbacks-once', [
'require',
'exports',
'module',
'can-connect',
'can-connect/helpers/sorted-set-json',
'can-connect/helpers/validate'
], function (require, exports, module) {
var connect = require('can-connect');
var sortedSetJSON = require('can-connect/helpers/sorted-set-json');
var forEach = [].forEach;
var callbacks = [
'createdInstance',
'updatedInstance',
'destroyedInstance'
];
var callbacksOnceBehavior = connect.behavior('constructor/callbacks-once', function (baseConnection) {
var behavior = {};
forEach.call(callbacks, function (name) {
behavior[name] = function (instance, data) {
var lastSerialized = this.getInstanceMetaData(instance, 'last-data-' + name);
var serialize = sortedSetJSON(data);
if (lastSerialized !== serialize) {
var result = baseConnection[name].apply(this, arguments);
this.addInstanceMetaData(instance, 'last-data-' + name, serialize);
return result;
}
};
});
return behavior;
});
module.exports = callbacksOnceBehavior;
var validate = require('can-connect/helpers/validate');
module.exports = validate(callbacksOnceBehavior, callbacks);
});
/*can-connect@1.5.9#helpers/weak-reference-set*/
define('can-connect/helpers/weak-reference-set', [
'require',
'exports',
'module',
'can-util/js/assign/assign'
], function (require, exports, module) {
var assign = require('can-util/js/assign/assign');
var WeakReferenceSet = function () {
this.set = [];
};
assign(WeakReferenceSet.prototype, {
has: function (item) {
return this._getIndex(item) !== -1;
},
addReference: function (item, referenceCount) {
var index = this._getIndex(item);
var data = this.set[index];
if (!data) {
data = {
item: item,
referenceCount: 0
};
this.set.push(data);
}
data.referenceCount += referenceCount || 1;
},
deleteReference: function (item) {
var index = this._getIndex(item);
var data = this.set[index];
if (data) {
data.referenceCount--;
if (data.referenceCount === 0) {
this.set.splice(index, 1);
}
}
},
delete: function (item) {
var index = this._getIndex(item);
if (index !== -1) {
this.set.splice(index, 1);
}
},
get: function (item) {
var data = this.set[this._getIndex(item)];
if (data) {
return data.item;
}
},
referenceCount: function (item) {
var data = this.set[this._getIndex(item)];
if (data) {
return data.referenceCount;
}
},
_getIndex: function (item) {
var index;
this.set.every(function (data, i) {
if (data.item === item) {
index = i;
return false;
}
});
return index !== undefined ? index : -1;
},
forEach: function (cb) {
return this.set.forEach(cb);
}
});
module.exports = WeakReferenceSet;
});
/*can-connect@1.5.9#constructor/store/store*/
define('can-connect/constructor/store/store', [
'require',
'exports',
'module',
'can-connect',
'can-connect/helpers/weak-reference-map',
'can-connect/helpers/weak-reference-set',
'can-connect/helpers/sorted-set-json',
'can-event',
'can-util/js/assign/assign',
'can-connect/helpers/validate'
], function (require, exports, module) {
var connect = require('can-connect');
var WeakReferenceMap = require('can-connect/helpers/weak-reference-map');
var WeakReferenceSet = require('can-connect/helpers/weak-reference-set');
var sortedSetJSON = require('can-connect/helpers/sorted-set-json');
var canEvent = require('can-event');
var assign = require('can-util/js/assign/assign');
var pendingRequests = 0;
var noRequestsTimer = null;
var requests = {
increment: function (connection) {
pendingRequests++;
clearTimeout(noRequestsTimer);
},
decrement: function (connection) {
pendingRequests--;
if (pendingRequests === 0) {
noRequestsTimer = setTimeout(function () {
requests.dispatch('end');
}, 10);
}
},
count: function () {
return pendingRequests;
}
};
assign(requests, canEvent);
var constructorStore = connect.behavior('constructor/store', function (baseConnection) {
var behavior = {
instanceStore: new WeakReferenceMap(),
newInstanceStore: new WeakReferenceSet(),
listStore: new WeakReferenceMap(),
_requestInstances: {},
_requestLists: {},
_finishedRequest: function () {
var id;
requests.decrement(this);
if (requests.count() === 0) {
for (id in this._requestInstances) {
this.instanceStore.deleteReference(id);
}
this._requestInstances = {};
for (id in this._requestLists) {
this.listStore.deleteReference(id);
}
this._requestLists = {};
}
},
addInstanceReference: function (instance, id) {
var ID = id || this.id(instance);
if (ID === undefined) {
this.newInstanceStore.addReference(instance);
} else {
this.instanceStore.addReference(ID, instance);
}
},
createdInstance: function (instance, props) {
baseConnection.createdInstance.apply(this, arguments);
this.moveCreatedInstanceToInstanceStore(instance);
},
moveCreatedInstanceToInstanceStore: function (instance) {
var ID = this.id(instance);
if (this.newInstanceStore.has(instance) && ID !== undefined) {
var referenceCount = this.newInstanceStore.referenceCount(instance);
this.newInstanceStore.delete(instance);
this.instanceStore.addReference(ID, instance, referenceCount);
}
},
addInstanceMetaData: function (instance, name, value) {
var data = this.instanceStore.set[this.id(instance)];
if (data) {
data[name] = value;
}
},
getInstanceMetaData: function (instance, name) {
var data = this.instanceStore.set[this.id(instance)];
if (data) {
return data[name];
}
},
deleteInstanceMetaData: function (instance, name) {
var data = this.instanceStore.set[this.id(instance)];
delete data[name];
},
deleteInstanceReference: function (instance) {
var ID = this.id(instance);
if (ID === undefined) {
this.newInstanceStore.deleteReference(instance);
} else {
this.instanceStore.deleteReference(this.id(instance), instance);
}
},
addListReference: function (list, set) {
var id = sortedSetJSON(set || this.listSet(list));
if (id) {
this.listStore.addReference(id, list);
}
},
deleteListReference: function (list, set) {
var id = sortedSetJSON(set || this.listSet(list));
if (id) {
this.listStore.deleteReference(id, list);
}
},
hydratedInstance: function (instance) {
if (requests.count() > 0) {
var id = this.id(instance);
if (!this._requestInstances[id]) {
this.addInstanceReference(instance);
this._requestInstances[id] = instance;
}
}
},
hydrateInstance: function (props) {
var id = this.id(props);
if ((id || id === 0) && this.instanceStore.has(id)) {
var storeInstance = this.instanceStore.get(id);
this.updatedInstance(storeInstance, props);
return storeInstance;
}
var instance = baseConnection.hydrateInstance.call(this, props);
this.hydratedInstance(instance);
return instance;
},
hydratedList: function (list, set) {
if (requests.count() > 0) {
var id = sortedSetJSON(set || this.listSet(list));
if (id) {
if (!this._requestLists[id]) {
this.addListReference(list, set);
this._requestLists[id] = list;
}
}
}
},
hydrateList: function (listData, set) {
set = set || this.listSet(listData);
var id = sortedSetJSON(set);
if (id && this.listStore.has(id)) {
var storeList = this.listStore.get(id);
this.updatedList(storeList, listData, set);
return storeList;
}
var list = baseConnection.hydrateList.call(this, listData, set);
this.hydratedList(list, set);
return list;
},
getList: function (listSet) {
var self = this;
requests.increment(this);
var promise = baseConnection.getList.call(this, listSet);
promise.then(function (instances) {
self._finishedRequest();
}, function () {
self._finishedRequest();
});
return promise;
},
get: function (params) {
var self = this;
requests.increment(this);
var promise = baseConnection.get.call(this, params);
promise.then(function (instance) {
self._finishedRequest();
}, function () {
self._finishedRequest();
});
return promise;
},
save: function (instance) {
var self = this;
requests.increment(this);
var updating = !this.isNew(instance);
if (updating) {
this.addInstanceReference(instance);
}
var promise = baseConnection.save.call(this, instance);
promise.then(function (instances) {
if (updating) {
self.deleteInstanceReference(instance);
}
self._finishedRequest();
}, function () {
self._finishedRequest();
});
return promise;
},
destroy: function (instance) {
var self = this;
requests.increment(this);
var promise = baseConnection.destroy.call(this, instance);
promise.then(function (instance) {
self._finishedRequest();
}, function () {
self._finishedRequest();
});
return promise;
}
};
return behavior;
});
constructorStore.requests = requests;
module.exports = constructorStore;
var validate = require('can-connect/helpers/validate');
module.exports = validate(constructorStore, [
'hydrateInstance',
'hydrateList',
'getList',
'get',
'save',
'destroy'
]);
});
/*can-connect@1.5.9#data/callbacks/callbacks*/
define('can-connect/data/callbacks/callbacks', [
'require',
'exports',
'module',
'can-connect',
'can-util/js/each/each',
'can-connect/helpers/validate'
], function (require, exports, module) {
var connect = require('can-connect');
var each = require('can-util/js/each/each');
var pairs = {
getListData: 'gotListData',
createData: 'createdData',
updateData: 'updatedData',
destroyData: 'destroyedData'
};
var dataCallbackBehavior = connect.behavior('data/callbacks', function (baseConnection) {
var behavior = {};
each(pairs, function (callbackName, name) {
behavior[name] = function (params, cid) {
var self = this;
return baseConnection[name].call(this, params).then(function (data) {
if (self[callbackName]) {
return self[callbackName].call(self, data, params, cid);
} else {
return data;
}
});
};
});
return behavior;
});
module.exports = dataCallbackBehavior;
var validate = require('can-connect/helpers/validate');
module.exports = validate(dataCallbackBehavior, [
'getListData',
'createData',
'updateData',
'destroyData'
]);
});
/*can-connect@1.5.9#data/callbacks-cache/callbacks-cache*/
define('can-connect/data/callbacks-cache/callbacks-cache', [
'require',
'exports',
'module',
'can-connect',
'can-util/js/assign/assign',
'can-util/js/each/each',
'can-connect/helpers/validate'
], function (require, exports, module) {
var connect = require('can-connect');
var assign = require('can-util/js/assign/assign');
var each = require('can-util/js/each/each');
var pairs = {
createdData: 'createData',
updatedData: 'updateData',
destroyedData: 'destroyData'
};
var callbackCache = connect.behavior('data/callbacks-cache', function (baseConnection) {
var behavior = {};
each(pairs, function (crudMethod, dataCallback) {
behavior[dataCallback] = function (data, params, cid) {
this.cacheConnection[crudMethod](assign(assign({}, params), data));
if (baseConnection[dataCallback]) {
return baseConnection[dataCallback].call(this, data, params, cid);
} else {
return data;
}
};
});
return behavior;
});
module.exports = callbackCache;
var validate = require('can-connect/helpers/validate');
module.exports = validate(callbackCache, []);
});
/*can-connect@1.5.9#helpers/deferred*/
define('can-connect/helpers/deferred', function (require, exports, module) {
module.exports = function () {
var def = {};
def.promise = new Promise(function (resolve, reject) {
def.resolve = resolve;
def.reject = reject;
});
return def;
};
});
/*can-connect@1.5.9#data/combine-requests/combine-requests*/
define('can-connect/data/combine-requests/combine-requests', [
'require',
'exports',
'module',
'can-connect',
'can-set',
'can-connect/helpers/get-items',
'can-util/js/deep-assign/deep-assign',
'can-connect/helpers/deferred',
'can-connect/helpers/validate'
], function (require, exports, module) {
var connect = require('can-connect');
var canSet = require('can-set');
var getItems = require('can-connect/helpers/get-items');
var deepAssign = require('can-util/js/deep-assign/deep-assign');
var makeDeferred = require('can-connect/helpers/deferred');
var forEach = [].forEach;
var combineRequests = connect.behavior('data/combine-requests', function (baseConnection) {
var pendingRequests;
return {
unionPendingRequests: function (pendingRequests) {
var self = this;
pendingRequests.sort(function (pReq1, pReq2) {
if (canSet.subset(pReq1.set, pReq2.set, self.algebra)) {
return 1;
} else if (canSet.subset(pReq2.set, pReq1.set, self.algebra)) {
return -1;
} else {
return 0;
}
});
var combineData = [];
var current;
doubleLoop(pendingRequests, {
start: function (pendingRequest) {
current = {
set: pendingRequest.set,
pendingRequests: [pendingRequest]
};
combineData.push(current);
},
iterate: function (pendingRequest) {
var combined = canSet.union(current.set, pendingRequest.set, self.algebra);
if (combined) {
current.set = combined;
current.pendingRequests.push(pendingRequest);
return true;
}
}
});
return Promise.resolve(combineData);
},
time: 1,
getListData: function (set) {
set = set || {};
var self = this;
if (!pendingRequests) {
pendingRequests = [];
setTimeout(function () {
var combineDataPromise = self.unionPendingRequests(pendingRequests);
pendingRequests = null;
combineDataPromise.then(function (combinedData) {
forEach.call(combinedData, function (combined) {
var combinedSet = deepAssign({}, combined.set);
baseConnection.getListData(combinedSet).then(function (data) {
if (combined.pendingRequests.length === 1) {
combined.pendingRequests[0].deferred.resolve(data);
} else {
forEach.call(combined.pendingRequests, function (pending) {
pending.deferred.resolve({ data: canSet.getSubset(pending.set, combined.set, getItems(data), self.algebra) });
});
}
}, function (err) {
if (combined.pendingRequests.length === 1) {
combined.pendingRequests[0].deferred.reject(err);
} else {
forEach.call(combined.pendingRequests, function (pending) {
pending.deferred.reject(err);
});
}
});
});
});
}, this.time || 1);
}
var deferred = makeDeferred();
pendingRequests.push({
deferred: deferred,
set: set
});
return deferred.promise;
}
};
});
module.exports = combineRequests;
var validate = require('can-connect/helpers/validate');
module.exports = validate(combineRequests, ['getListData']);
var doubleLoop = function (arr, callbacks) {
var i = 0;
while (i < arr.length) {
callbacks.start(arr[i]);
var j = i + 1;
while (j < arr.length) {
if (callbacks.iterate(arr[j]) === true) {
arr.splice(j, 1);
} else {
j++;
}
}
i++;
}
};
});
/*can-connect@1.5.9#helpers/set-add*/
define('can-connect/helpers/set-add', [
'require',
'exports',
'module',
'can-set'
], function (require, exports, module) {
var canSet = require('can-set');
module.exports = function (connection, setItems, items, item, algebra) {
var index = canSet.index(setItems, items, item, algebra);
if (index === undefined) {
index = items.length;
}
var copy = items.slice(0);
copy.splice(index, 0, item);
return copy;
};
});
/*can-connect@1.5.9#helpers/get-index-by-id*/
define('can-connect/helpers/get-index-by-id', function (require, exports, module) {
module.exports = function (connection, props, items) {
var id = connection.id(props);
for (var i = 0; i < items.length; i++) {
var connId = connection.id(items[i]);
if (id == connId) {
return i;
}
}
return -1;
};
});
/*can-connect@1.5.9#data/localstorage-cache/localstorage-cache*/
define('can-connect/data/localstorage-cache/localstorage-cache', [
'require',
'exports',
'module',
'can-connect/helpers/get-items',
'can-connect',
'can-connect/helpers/sorted-set-json',
'can-set',
'can-connect/helpers/set-add',
'can-connect/helpers/get-index-by-id',
'can-util/js/assign/assign',
'can-connect/helpers/overwrite'
], function (require, exports, module) {
var getItems = require('can-connect/helpers/get-items');
var connect = require('can-connect');
var sortedSetJSON = require('can-connect/helpers/sorted-set-json');
var canSet = require('can-set');
var forEach = [].forEach;
var map = [].map;
var setAdd = require('can-connect/helpers/set-add');
var indexOf = require('can-connect/helpers/get-index-by-id');
var assign = require('can-util/js/assign/assign');
var overwrite = require('can-connect/helpers/overwrite');
module.exports = connect.behavior('data/localstorage-cache', function (baseConnection) {
var behavior = {
_instances: {},
getSetData: function () {
var sets = {};
var self = this;
forEach.call(JSON.parse(localStorage.getItem(this.name + '-sets')) || [], function (set) {
var setKey = sortedSetJSON(set);
if (localStorage.getItem(self.name + '/set/' + setKey)) {
sets[setKey] = {
set: set,
setKey: setKey
};
}
});
return sets;
},
_getSets: function (setData) {
var sets = [];
setData = setData || this.getSetData();
for (var setKey in setData) {
sets.push(JSON.parse(setKey));
}
return sets;
},
getInstance: function (id) {
var res = localStorage.getItem(this.name + '/instance/' + id);
if (res) {
return JSON.parse(res);
}
},
updateInstance: function (props) {
var id = this.id(props);
var instance = this.getInstance(id);
if (!instance) {
instance = props;
} else {
overwrite(instance, props, this.idProp);
}
localStorage.setItem(this.name + '/instance/' + id, JSON.stringify(instance));
return instance;
},
getInstances: function (ids) {
var self = this;
return map.call(ids, function (id) {
return self.getInstance(id);
});
},
removeSet: function (setKey) {
var sets = this.getSetData();
localStorage.removeItem(this.name + '/set/' + setKey);
delete sets[setKey];
},
updateSets: function (sets) {
var setData = this._getSets(sets);
localStorage.setItem(this.name + '-sets', JSON.stringify(setData));
},
updateSet: function (setDatum, items, newSet) {
var newSetKey = newSet ? sortedSetJSON(newSet) : setDatum.setKey;
if (newSet) {
if (newSetKey !== setDatum.setKey) {
var sets = this.getSetData();
localStorage.removeItem(this.name + '/set/' + setDatum.setKey);
delete sets[setDatum.setKey];
sets[newSetKey] = {
setKey: newSetKey,
set: newSet
};
this.updateSets(sets);
}
}
setDatum.items = items;
var self = this;
var ids = map.call(items, function (item) {
var id = self.id(item);
localStorage.setItem(self.name + '/instance/' + id, JSON.stringify(item));
return id;
});
localStorage.setItem(this.name + '/set/' + newSetKey, JSON.stringify(ids));
},
addSet: function (set, data) {
var items = getItems(data);
var sets = this.getSetData();
var setKey = sortedSetJSON(set);
sets[setKey] = {
setKey: setKey,
items: items,
set: set
};
var self = this;
var ids = map.call(items, function (item) {
var id = self.id(item);
localStorage.setItem(self.name + '/instance/' + id, JSON.stringify(item));
return id;
});
localStorage.setItem(this.name + '/set/' + setKey, JSON.stringify(ids));
this.updateSets(sets);
},
_eachSet: function (cb) {
var sets = this.getSetData();
var self = this;
var loop = function (setDatum, setKey) {
return cb.call(self, setDatum, setKey, function () {
if (!('items' in setDatum)) {
var ids = JSON.parse(localStorage.getItem(self.name + '/set/' + setKey));
setDatum.items = self.getInstances(ids);
}
return setDatum.items;
});
};
for (var setKey in sets) {
var setDatum = sets[setKey];
var result = loop(setDatum, setKey);
if (result !== undefined) {
return result;
}
}
},
clear: function () {
var sets = this.getSetData();
for (var setKey in sets) {
localStorage.removeItem(this.name + '/set/' + setKey);
}
localStorage.removeItem(this.name + '-sets');
var keys = [];
for (var i = 0, len = localStorage.length; i < len; ++i) {
if (localStorage.key(i).indexOf(this.name + '/instance/') === 0) {
keys.push(localStorage.key(i));
}
}
forEach.call(keys, function (key) {
localStorage.removeItem(key);
});
this._instances = {};
},
getSets: function () {
return Promise.resolve(this._getSets());
},
getListData: function (set) {
set = set || {};
var listData = this.getListDataSync(set);
if (listData) {
return Promise.resolve(listData);
}
return Promise.reject({
message: 'no data',
error: 404
});
},
getListDataSync: function (set) {
var sets = this._getSets();
for (var i = 0; i < sets.length; i++) {
var checkSet = sets[i];
if (canSet.subset(set, checkSet, this.algebra)) {
var items = canSet.getSubset(set, checkSet, this.__getListData(checkSet), this.algebra);
return { data: items };
}
}
},
__getListData: function (set) {
var setKey = sortedSetJSON(set);
var setDatum = this.getSetData()[setKey];
if (setDatum) {
var localData = localStorage.getItem(this.name + '/set/' + setKey);
if (localData) {
return this.getInstances(JSON.parse(localData));
}
}
},
getData: function (params) {
var id = this.id(params);
var res = localStorage.getItem(this.name + '/instance/' + id);
if (res) {
return Promise.resolve(JSON.parse(res));
} else {
return Promise.reject({
message: 'no data',
error: 404
});
}
},
updateListData: function (data, set) {
set = set || {};
var items = getItems(data);
var sets = this.getSetData();
var self = this;
for (var setKey in sets) {
var setDatum = sets[setKey];
var union = canSet.union(setDatum.set, set, this.algebra);
if (union) {
return this.getListData(setDatum.set).then(function (setData) {
self.updateSet(setDatum, canSet.getUnion(setDatum.set, set, getItems(setData), items, this.algebra), union);
});
}
}
this.addSet(set, data);
return Promise.resolve();
},
createData: function (props) {
var self = this;
var instance = this.updateInstance(props);
this._eachSet(function (setDatum, setKey, getItems) {
if (canSet.has(setDatum.set, instance, this.algebra)) {
self.updateSet(setDatum, setAdd(self, setDatum.set, getItems(), instance, self.algebra), setDatum.set);
}
});
return Promise.resolve(assign({}, instance));
},
updateData: function (props) {
var self = this;
var instance = this.updateInstance(props);
this._eachSet(function (setDatum, setKey, getItems) {
var items = getItems();
var index = indexOf(self, instance, items);
if (canSet.has(setDatum.set, instance, this.algebra)) {
if (index === -1) {
self.updateSet(setDatum, setAdd(self, setDatum.set, getItems(), instance, self.algebra));
} else {
items.splice(index, 1, instance);
self.updateSet(setDatum, items);
}
} else if (index !== -1) {
items.splice(index, 1);
self.updateSet(setDatum, items);
}
});
return Promise.resolve(assign({}, instance));
},
destroyData: function (props) {
var self = this;
var instance = this.updateInstance(props);
this._eachSet(function (setDatum, setKey, getItems) {
var items = getItems();
var index = indexOf(self, instance, items);
if (index !== -1) {
items.splice(index, 1);
self.updateSet(setDatum, items);
}
});
var id = this.id(instance);
localStorage.removeItem(this.name + '/instance/' + id);
return Promise.resolve(assign({}, instance));
}
};
return behavior;
});
});
/*can-connect@1.5.9#helpers/clone-data*/
define('can-connect/helpers/clone-data', [
'require',
'exports',
'module',
'can-util/js/deep-assign/deep-assign'
], function (require, exports, module) {
var deepAssign = require('can-util/js/deep-assign/deep-assign');
module.exports = function (data) {
return Array.isArray(data) ? data.slice(0) : deepAssign({}, data);
};
});
/*can-connect@1.5.9#data/memory-cache/memory-cache*/
define('can-connect/data/memory-cache/memory-cache', [
'require',
'exports',
'module',
'can-connect/helpers/get-items',
'can-connect',
'can-connect/helpers/sorted-set-json',
'can-set',
'can-connect/helpers/overwrite',
'can-connect/helpers/set-add',
'can-connect/helpers/get-index-by-id',
'can-util/js/assign/assign',
'can-connect/helpers/clone-data'
], function (require, exports, module) {
var getItems = require('can-connect/helpers/get-items');
var connect = require('can-connect');
var sortedSetJSON = require('can-connect/helpers/sorted-set-json');
var canSet = require('can-set');
var overwrite = require('can-connect/helpers/overwrite');
var setAdd = require('can-connect/helpers/set-add');
var indexOf = require('can-connect/helpers/get-index-by-id');
var assign = require('can-util/js/assign/assign');
var cloneData = require('can-connect/helpers/clone-data');
module.exports = connect.behavior('data/memory-cache', function (baseConnection) {
var behavior = {
_sets: {},
getSetData: function () {
return this._sets;
},
__getListData: function (set) {
var setsData = this.getSetData();
var setData = setsData[sortedSetJSON(set)];
if (setData) {
return setData.items;
}
},
_instances: {},
getInstance: function (id) {
return this._instances[id];
},
removeSet: function (setKey, noUpdate) {
var sets = this.getSetData();
delete sets[setKey];
if (noUpdate !== true) {
this.updateSets();
}
},
updateSets: function () {
},
updateInstance: function (props) {
var id = this.id(props);
if (!(id in this._instances)) {
this._instances[id] = props;
} else {
overwrite(this._instances[id], props, this.idProp);
}
return this._instances[id];
},
updateSet: function (setDatum, items, newSet) {
var newSetKey = newSet ? sortedSetJSON(newSet) : setDatum.setKey;
if (newSet) {
if (newSetKey !== setDatum.setKey) {
var sets = this.getSetData();
var oldSetKey = setDatum.setKey;
sets[newSetKey] = setDatum;
setDatum.setKey = newSetKey;
setDatum.set = assign({}, newSet);
this.removeSet(oldSetKey);
}
}
setDatum.items = items;
var self = this;
items.forEach(function (item) {
self.updateInstance(item);
});
},
addSet: function (set, data) {
var items = getItems(data);
var sets = this.getSetData();
var setKey = sortedSetJSON(set);
sets[setKey] = {
setKey: setKey,
items: items,
set: assign({}, set)
};
var self = this;
items.forEach(function (item) {
self.updateInstance(item);
});
this.updateSets();
},
_eachSet: function (cb) {
var sets = this.getSetData();
var self = this;
var loop = function (setDatum, setKey) {
return cb.call(self, setDatum, setKey, function () {
return setDatum.items;
});
};
for (var setKey in sets) {
var setDatum = sets[setKey];
var result = loop(setDatum, setKey);
if (result !== undefined) {
return result;
}
}
},
_getSets: function () {
var sets = [], setsData = this.getSetData();
for (var prop in setsData) {
sets.push(setsData[prop].set);
}
return sets;
},
getSets: function () {
return Promise.resolve(this._getSets());
},
clear: function () {
this._instances = {};
this._sets = {};
},
getListData: function (set) {
set = set || {};
var listData = this.getListDataSync(set);
if (listData) {
return Promise.resolve(listData);
}
return Promise.reject({
message: 'no data',
error: 404
});
},
getListDataSync: function (set) {
var sets = this._getSets();
for (var i = 0; i < sets.length; i++) {
var checkSet = sets[i];
if (canSet.subset(set, checkSet, this.algebra)) {
var source = this.__getListData(checkSet);
var items = canSet.getSubset(set, checkSet, source, this.algebra);
return {
data: items,
count: source.length
};
}
}
},
_getListData: function (set) {
return this.getListDataSync(set);
},
updateListData: function (data, set) {
set = set || {};
var clonedData = cloneData(data);
var items = getItems(clonedData);
var sets = this.getSetData();
var self = this;
for (var setKey in sets) {
var setDatum = sets[setKey];
var union = canSet.union(setDatum.set, set, this.algebra);
if (union) {
var getSet = assign({}, setDatum.set);
return this.getListData(getSet).then(function (setData) {
self.updateSet(setDatum, canSet.getUnion(getSet, set, getItems(setData), items, self.algebra), union);
});
}
}
this.addSet(set, clonedData);
return Promise.resolve();
},
getData: function (params) {
var id = this.id(params);
var res = this.getInstance(id);
if (res) {
return Promise.resolve(res);
} else {
return Promise.reject({
message: 'no data',
error: 404
});
}
},
createData: function (props) {
var self = this;
var instance = this.updateInstance(props);
this._eachSet(function (setDatum, setKey, getItems) {
if (canSet.has(setDatum.set, instance, this.algebra)) {
self.updateSet(setDatum, setAdd(self, setDatum.set, getItems(), instance, self.algebra), setDatum.set);
}
});
return Promise.resolve(assign({}, instance));
},
updateData: function (props) {
var self = this;
var instance = this.updateInstance(props);
this._eachSet(function (setDatum, setKey, getItems) {
var items = getItems();
var index = indexOf(self, instance, items);
if (canSet.subset(instance, setDatum.set, this.algebra)) {
if (index === -1) {
self.updateSet(setDatum, setAdd(self, setDatum.set, getItems(), instance, self.algebra));
} else {
items.splice(index, 1, instance);
self.updateSet(setDatum, items);
}
} else if (index !== -1) {
items.splice(index, 1);
self.updateSet(setDatum, items);
}
});
return Promise.resolve(assign({}, instance));
},
destroyData: function (props) {
var self = this;
this._eachSet(function (setDatum, setKey, getItems) {
var items = getItems();
var index = indexOf(self, props, items);
if (index !== -1) {
items.splice(index, 1);
self.updateSet(setDatum, items);
}
});
var id = this.id(props);
delete this._instances[id];
return Promise.resolve(assign({}, props));
}
};
return behavior;
});
});
/*can-connect@1.5.9#data/parse/parse*/
define('can-connect/data/parse/parse', [
'require',
'exports',
'module',
'can-connect',
'can-util/js/each/each',
'can-util/js/get/get'
], function (require, exports, module) {
var connect = require('can-connect');
var each = require('can-util/js/each/each');
var getObject = require('can-util/js/get/get');
module.exports = connect.behavior('data/parse', function (baseConnection) {
var behavior = {
parseListData: function (responseData) {
if (baseConnection.parseListData) {
responseData = baseConnection.parseListData.apply(this, arguments);
}
var result;
if (Array.isArray(responseData)) {
result = { data: responseData };
} else {
var prop = this.parseListProp || 'data';
responseData.data = getObject(responseData, prop);
result = responseData;
if (prop !== 'data') {
delete responseData[prop];
}
if (!Array.isArray(result.data)) {
throw new Error('Could not get any raw data while converting using .parseListData');
}
}
var arr = [];
for (var i = 0; i < result.data.length; i++) {
arr.push(this.parseInstanceData(result.data[i]));
}
result.data = arr;
return result;
},
parseInstanceData: function (props) {
if (baseConnection.parseInstanceData) {
props = baseConnection.parseInstanceData.apply(this, arguments) || props;
}
return this.parseInstanceProp ? getObject(props, this.parseInstanceProp) || props : props;
}
};
each(pairs, function (parseFunction, name) {
behavior[name] = function (params) {
var self = this;
return baseConnection[name].call(this, params).then(function () {
return self[parseFunction].apply(self, arguments);
});
};
});
return behavior;
});
var pairs = {
getListData: 'parseListData',
getData: 'parseInstanceData',
createData: 'parseInstanceData',
updateData: 'parseInstanceData',
destroyData: 'parseInstanceData'
};
});
/*can-param@1.0.1#can-param*/
define('can-param', [
'require',
'exports',
'module',
'can-namespace'
], function (require, exports, module) {
var namespace = require('can-namespace');
function buildParam(prefix, obj, add) {
if (Array.isArray(obj)) {
for (var i = 0, l = obj.length; i < l; ++i) {
add(prefix + '[]', obj[i]);
}
} else if (obj && typeof obj === 'object') {
for (var name in obj) {
buildParam(prefix + '[' + name + ']', obj[name], add);
}
} else {
add(prefix, obj);
}
}
module.exports = namespace.param = function param(object) {
var pairs = [], add = function (key, value) {
pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
};
for (var name in object) {
buildParam(name, object[name], add);
}
return pairs.join('&').replace(/%20/g, '+');
};
});
/*can-ajax@1.0.9#can-ajax*/
define('can-ajax', [
'require',
'exports',
'module',
'can-globals/global/global',
'can-assign',
'can-namespace',
'can-parse-uri',
'can-param'
], function (require, exports, module) {
(function (global) {
'use strict';
var Global = require('can-globals/global/global');
var assign = require('can-assign');
var namespace = require('can-namespace');
var parseURI = require('can-parse-uri');
var param = require('can-param');
var xhrs = [
function () {
return new XMLHttpRequest();
},
function () {
return new ActiveXObject('Microsoft.XMLHTTP');
},
function () {
return new ActiveXObject('MSXML2.XMLHTTP.3.0');
},
function () {
return new ActiveXObject('MSXML2.XMLHTTP');
}
], _xhrf = null;
var originUrl = parseURI(Global().location.href);
var makeXhr = function () {
if (_xhrf != null) {
return _xhrf();
}
for (var i = 0, l = xhrs.length; i < l; i++) {
try {
var f = xhrs[i], req = f();
if (req != null) {
_xhrf = f;
return req;
}
} catch (e) {
continue;
}
}
return function () {
};
};
var contentTypes = {
json: 'application/json',
form: 'application/x-www-form-urlencoded'
};
var _xhrResp = function (xhr, options) {
switch (options.dataType || xhr.getResponseHeader('Content-Type').split(';')[0]) {
case 'text/xml':
case 'xml':
return xhr.responseXML;
case 'text/json':
case 'application/json':
case 'text/javascript':
case 'application/javascript':
case 'application/x-javascript':
case 'json':
return JSON.parse(xhr.responseText);
default:
return xhr.responseText;
}
};
module.exports = namespace.ajax = function (o) {
var xhr = makeXhr(), timer, n = 0;
var deferred = {};
var promise = new Promise(function (resolve, reject) {
deferred.resolve = resolve;
deferred.reject = reject;
});
var requestUrl;
promise.abort = function () {
xhr.abort();
};
o = assign({
userAgent: 'XMLHttpRequest',
lang: 'en',
type: 'GET',
data: null,
dataType: 'json'
}, o);
if (!o.contentType) {
o.contentType = o.type.toUpperCase() === 'GET' ? contentTypes.form : contentTypes.json;
}
if (o.crossDomain == null) {
try {
requestUrl = parseURI(o.url);
o.crossDomain = !!(requestUrl.protocol && requestUrl.protocol !== originUrl.protocol || requestUrl.host && requestUrl.host !== originUrl.host);
} catch (e) {
o.crossDomain = true;
}
}
if (o.timeout) {
timer = setTimeout(function () {
xhr.abort();
if (o.timeoutFn) {
o.timeoutFn(o.url);
}
}, o.timeout);
}
xhr.onreadystatechange = function () {
try {
if (xhr.readyState === 4) {
if (timer) {
clearTimeout(timer);
}
if (xhr.status < 300) {
if (o.success) {
o.success(_xhrResp(xhr, o));
}
} else if (o.error) {
o.error(xhr, xhr.status, xhr.statusText);
}
if (o.complete) {
o.complete(xhr, xhr.statusText);
}
if (xhr.status >= 200 && xhr.status < 300) {
deferred.resolve(_xhrResp(xhr, o));
} else {
deferred.reject(xhr);
}
} else if (o.progress) {
o.progress(++n);
}
} catch (e) {
deferred.reject(e);
}
};
var url = o.url, data = null, type = o.type.toUpperCase();
var isJsonContentType = o.contentType === contentTypes.json;
var isPost = type === 'POST' || type === 'PUT';
if (!isPost && o.data) {
url += '?' + (isJsonContentType ? JSON.stringify(o.data) : param(o.data));
}
xhr.open(type, url);
var isSimpleCors = o.crossDomain && [
'GET',
'POST',
'HEAD'
].indexOf(type) !== -1;
if (isPost) {
data = isJsonContentType && !isSimpleCors ? typeof o.data === 'object' ? JSON.stringify(o.data) : o.data : param(o.data);
var setContentType = isJsonContentType && !isSimpleCors ? 'application/json' : 'application/x-www-form-urlencoded';
xhr.setRequestHeader('Content-Type', setContentType);
} else {
xhr.setRequestHeader('Content-Type', o.contentType);
}
if (!isSimpleCors) {
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
}
xhr.send(data);
return promise;
};
}(function () {
return this;
}()));
});
/*can-connect@1.5.9#helpers/get-id-props*/
define('can-connect/helpers/get-id-props', function (require, exports, module) {
module.exports = function (connection) {
var ids = [], algebra = connection.algebra;
if (algebra && algebra.clauses && algebra.clauses.id) {
for (var prop in algebra.clauses.id) {
ids.push(prop);
}
}
if (connection.idProp && !ids.length) {
ids.push(connection.idProp);
}
if (!ids.length) {
ids.push('id');
}
return ids;
};
});
/*can-make-rest@0.1.1#can-make-rest*/
define('can-make-rest', [
'require',
'exports',
'module',
'can-util/js/each/each'
], function (require, exports, module) {
var each = require('can-util/js/each/each');
var methodMapping = {
item: {
'GET': 'getData',
'PUT': 'updateData',
'DELETE': 'destroyData'
},
list: {
'GET': 'getListData',
'POST': 'createData'
}
};
function inferIdProp(url) {
var wrappedInBraces = /\{(.*)\}/;
var matches = url.match(wrappedInBraces);
var isUniqueMatch = matches && matches.length === 2;
if (isUniqueMatch) {
return matches[1];
}
}
function getItemAndListUrls(url, idProp) {
idProp = idProp || inferIdProp(url) || 'id';
var itemRegex = new RegExp('\\/\\{' + idProp + '\\}.*');
var rootIsItemUrl = itemRegex.test(url);
var listUrl = rootIsItemUrl ? url.replace(itemRegex, '') : url;
var itemUrl = rootIsItemUrl ? url : url.trim() + '/{' + idProp + '}';
return {
item: itemUrl,
list: listUrl
};
}
module.exports = function (url, idProp) {
var data = {};
each(getItemAndListUrls(url, idProp), function (url, type) {
each(methodMapping[type], function (interfaceMethod, method) {
data[interfaceMethod] = {
method: method,
url: url
};
});
});
return data;
};
});
/*can-util@3.10.11#js/is-promise/is-promise*/
define('can-util/js/is-promise/is-promise', [
'require',
'exports',
'module',
'can-reflect'
], function (require, exports, module) {
'use strict';
var canReflect = require('can-reflect');
module.exports = function (obj) {
return canReflect.isPromise(obj);
};
});
/*can-util@3.10.11#js/make-promise/make-promise*/
define('can-util/js/make-promise/make-promise', [
'require',
'exports',
'module',
'can-util/js/is-promise-like/is-promise-like',
'can-util/js/is-promise/is-promise'
], function (require, exports, module) {
'use strict';
var isPromiseLike = require('can-util/js/is-promise-like/is-promise-like');
var isPromise = require('can-util/js/is-promise/is-promise');
module.exports = function (obj) {
if (isPromiseLike(obj) && !isPromise(obj)) {
return new Promise(function (resolve, reject) {
obj.then(resolve, reject);
});
} else {
return obj;
}
};
});
/*can-connect@1.5.9#data/url/url*/
define('can-connect/data/url/url', [
'require',
'exports',
'module',
'can-util/js/assign/assign',
'can-util/js/each/each',
'can-ajax',
'can-util/js/string/string',
'can-connect/helpers/get-id-props',
'can-util/js/dev/dev',
'can-connect',
'can-make-rest',
'can-util/js/make-promise/make-promise',
'can-connect/helpers/validate'
], function (require, exports, module) {
var assign = require('can-util/js/assign/assign');
var each = require('can-util/js/each/each');
var ajax = require('can-ajax');
var string = require('can-util/js/string/string');
var getIdProps = require('can-connect/helpers/get-id-props');
var dev = require('can-util/js/dev/dev');
var connect = require('can-connect');
var makeRest = require('can-make-rest');
var defaultRest = makeRest('/resource/{id}');
var makePromise = require('can-util/js/make-promise/make-promise');
var urlBehavior = connect.behavior('data/url', function (baseConnection) {
var behavior = {};
each(defaultRest, function (defaultData, dataInterfaceName) {
behavior[dataInterfaceName] = function (params) {
var meta = methodMetaData[dataInterfaceName];
if (typeof this.url === 'object') {
if (typeof this.url[dataInterfaceName] === 'function') {
return makePromise(this.url[dataInterfaceName](params));
} else if (this.url[dataInterfaceName]) {
var promise = makeAjax(this.url[dataInterfaceName], params, defaultData.method, this.ajax || ajax, findContentType(this.url, defaultData.method), meta);
return makePromise(promise);
}
}
var resource = typeof this.url === 'string' ? this.url : this.url.resource;
if (resource) {
var idProps = getIdProps(this);
var resourceWithoutTrailingSlashes = resource.replace(/\/+$/, '');
var result = makeRest(resourceWithoutTrailingSlashes, idProps[0])[dataInterfaceName];
return makePromise(makeAjax(result.url, params, result.method, this.ajax || ajax, findContentType(this.url, result.method), meta));
}
return baseConnection[name].call(this, params);
};
});
return behavior;
});
var methodMetaData = {
getListData: {},
getData: {},
createData: {},
updateData: {},
destroyData: { includeData: false }
};
var findContentType = function (url, method) {
if (typeof url === 'object' && url.contentType) {
var acceptableType = url.contentType === 'application/x-www-form-urlencoded' || url.contentType === 'application/json';
if (acceptableType) {
return url.contentType;
} else {
dev.warn('Unacceptable contentType on can-connect request. ' + 'Use \'application/json\' or \'application/x-www-form-urlencoded\'');
}
}
return method === 'GET' ? 'application/x-www-form-urlencoded' : 'application/json';
};
var makeAjax = function (ajaxOb, data, type, ajax, contentType, reqOptions) {
var params = {};
if (typeof ajaxOb === 'string') {
var parts = ajaxOb.split(/\s+/);
params.url = parts.pop();
if (parts.length) {
params.type = parts.pop();
}
} else {
assign(params, ajaxOb);
}
params.data = typeof data === 'object' && !Array.isArray(data) ? assign(params.data || {}, data) : data;
params.url = string.sub(params.url, params.data, true);
params.contentType = contentType;
if (reqOptions.includeData === false) {
delete params.data;
}
return ajax(assign({
type: type || 'post',
dataType: 'json'
}, params));
};
module.exports = urlBehavior;
var validate = require('can-connect/helpers/validate');
module.exports = validate(urlBehavior, ['url']);
});
/*can-connect@1.5.9#fall-through-cache/fall-through-cache*/
define('can-connect/fall-through-cache/fall-through-cache', [
'require',
'exports',
'module',
'can-connect',
'can-connect/helpers/sorted-set-json',
'can-util/js/log/log',
'can-connect/helpers/validate'
], function (require, exports, module) {
var connect = require('can-connect');
var sortedSetJSON = require('can-connect/helpers/sorted-set-json');
var canLog = require('can-util/js/log/log');
var fallThroughCache = connect.behavior('fall-through-cache', function (baseConnection) {
var behavior = {
hydrateList: function (listData, set) {
set = set || this.listSet(listData);
var id = sortedSetJSON(set);
var list = baseConnection.hydrateList.call(this, listData, set);
if (this._getHydrateListCallbacks[id]) {
this._getHydrateListCallbacks[id].shift()(list);
if (!this._getHydrateListCallbacks[id].length) {
delete this._getHydrateListCallbacks[id];
}
}
return list;
},
_getHydrateListCallbacks: {},
_getHydrateList: function (set, callback) {
var id = sortedSetJSON(set);
if (!this._getHydrateListCallbacks[id]) {
this._getHydrateListCallbacks[id] = [];
}
this._getHydrateListCallbacks[id].push(callback);
},
getListData: function (set) {
set = set || {};
var self = this;
return this.cacheConnection.getListData(set).then(function (data) {
self._getHydrateList(set, function (list) {
self.addListReference(list, set);
setTimeout(function () {
baseConnection.getListData.call(self, set).then(function (listData) {
self.cacheConnection.updateListData(listData, set);
self.updatedList(list, listData, set);
self.deleteListReference(list, set);
}, function (e) {
canLog.log('REJECTED', e);
});
}, 1);
});
return data;
}, function () {
var listData = baseConnection.getListData.call(self, set);
listData.then(function (listData) {
self.cacheConnection.updateListData(listData, set);
});
return listData;
});
},
hydrateInstance: function (props) {
var id = this.id(props);
var instance = baseConnection.hydrateInstance.apply(this, arguments);
if (this._getMakeInstanceCallbacks[id]) {
this._getMakeInstanceCallbacks[id].shift()(instance);
if (!this._getMakeInstanceCallbacks[id].length) {
delete this._getMakeInstanceCallbacks[id];
}
}
return instance;
},
_getMakeInstanceCallbacks: {},
_getMakeInstance: function (id, callback) {
if (!this._getMakeInstanceCallbacks[id]) {
this._getMakeInstanceCallbacks[id] = [];
}
this._getMakeInstanceCallbacks[id].push(callback);
},
getData: function (params) {
var self = this;
return this.cacheConnection.getData(params).then(function (instanceData) {
self._getMakeInstance(self.id(instanceData) || self.id(params), function (instance) {
self.addInstanceReference(instance);
setTimeout(function () {
baseConnection.getData.call(self, params).then(function (instanceData2) {
self.cacheConnection.updateData(instanceData2);
self.updatedInstance(instance, instanceData2);
self.deleteInstanceReference(instance);
}, function (e) {
canLog.log('REJECTED', e);
});
}, 1);
});
return instanceData;
}, function () {
var listData = baseConnection.getData.call(self, params);
listData.then(function (instanceData) {
self.cacheConnection.updateData(instanceData);
});
return listData;
});
}
};
return behavior;
});
module.exports = fallThroughCache;
var validate = require('can-connect/helpers/validate');
module.exports = validate(fallThroughCache, [
'hydrateList',
'hydrateInstance',
'getListData',
'getData'
]);
});
/*can-connect@1.5.9#real-time/real-time*/
define('can-connect/real-time/real-time', [
'require',
'exports',
'module',
'can-connect',
'can-set',
'can-connect/helpers/set-add',
'can-connect/helpers/get-index-by-id',
'can-util/js/dev/dev'
], function (require, exports, module) {
var connect = require('can-connect');
var canSet = require('can-set');
var setAdd = require('can-connect/helpers/set-add');
var indexOf = require('can-connect/helpers/get-index-by-id');
var canDev = require('can-util/js/dev/dev');
module.exports = connect.behavior('real-time', function (baseConnection) {
var createPromise = Promise.resolve();
return {
createData: function () {
var promise = baseConnection.createData.apply(this, arguments);
var cleanPromise = promise.catch(function () {
return '';
});
createPromise = Promise.all([
createPromise,
cleanPromise
]);
return promise;
},
createInstance: function (props) {
var self = this;
return new Promise(function (resolve, reject) {
createPromise.then(function () {
setTimeout(function () {
var id = self.id(props);
var instance = self.instanceStore.get(id);
var serialized;
if (instance) {
resolve(self.updateInstance(props));
} else {
instance = self.hydrateInstance(props);
serialized = self.serializeInstance(instance);
self.addInstanceReference(instance);
Promise.resolve(self.createdData(props, serialized)).then(function () {
self.deleteInstanceReference(instance);
resolve(instance);
});
}
}, 1);
});
});
},
createdData: function (props, params, cid) {
var instance;
if (cid !== undefined) {
instance = this.cidStore.get(cid);
} else {
instance = this.instanceStore.get(this.id(props));
}
this.addInstanceReference(instance, this.id(props));
this.createdInstance(instance, props);
create.call(this, this.serializeInstance(instance));
this.deleteInstanceReference(instance);
return undefined;
},
updatedData: function (props, params) {
var instance = this.instanceStore.get(this.id(params));
this.updatedInstance(instance, props);
update.call(this, this.serializeInstance(instance));
return undefined;
},
updateInstance: function (props) {
var id = this.id(props);
var instance = this.instanceStore.get(id);
if (!instance) {
instance = this.hydrateInstance(props);
}
this.addInstanceReference(instance);
var serialized = this.serializeInstance(instance), self = this;
return Promise.resolve(this.updatedData(props, serialized)).then(function () {
self.deleteInstanceReference(instance);
return instance;
});
},
destroyedData: function (props, params) {
var id = this.id(params || props);
var instance = this.instanceStore.get(id);
if (!instance) {
instance = this.hydrateInstance(props);
}
var serialized = this.serializeInstance(instance);
this.destroyedInstance(instance, props);
destroy.call(this, serialized);
return undefined;
},
destroyInstance: function (props) {
var id = this.id(props);
var instance = this.instanceStore.get(id);
if (!instance) {
instance = this.hydrateInstance(props);
}
this.addInstanceReference(instance);
var serialized = this.serializeInstance(instance), self = this;
return Promise.resolve(this.destroyedData(props, serialized)).then(function () {
self.deleteInstanceReference(instance);
return instance;
});
},
gotListData: function (items, set) {
var self = this;
if (this.algebra) {
for (var item, i = 0, l = items.data.length; i < l; i++) {
item = items.data[i];
if (!self.algebra.has(set, item)) {
var msg = 'One or more items were retrieved which do not match the \'Set\' parameters used to load them. ' + 'Read the docs for more information: https://canjs.com/doc/can-set.html#SolvingCommonIssues' + '\n\nBelow are the \'Set\' parameters:' + '\n' + canDev.stringify(set) + '\n\nAnd below is an item which does not match those parameters:' + '\n' + canDev.stringify(item);
canDev.warn(msg);
break;
}
}
}
return Promise.resolve(items);
}
};
});
var create = function (props) {
var self = this;
this.listStore.forEach(function (list, id) {
var set = JSON.parse(id);
var index = indexOf(self, props, list);
if (canSet.has(set, props, self.algebra)) {
if (index === -1) {
var items = self.serializeList(list);
self.updatedList(list, { data: setAdd(self, set, items, props, self.algebra) }, set);
} else {
}
}
});
};
var update = function (props) {
var self = this;
this.listStore.forEach(function (list, id) {
var items;
var set = JSON.parse(id);
var index = indexOf(self, props, list);
if (canSet.has(set, props, self.algebra)) {
items = self.serializeList(list);
if (index === -1) {
self.updatedList(list, { data: setAdd(self, set, items, props, self.algebra) }, set);
} else {
var sortedIndex = canSet.index(set, items, props, self.algebra);
if (sortedIndex !== undefined && sortedIndex !== index) {
var copy = items.slice(0);
if (index < sortedIndex) {
copy.splice(sortedIndex, 0, props);
copy.splice(index, 1);
} else {
copy.splice(index, 1);
copy.splice(sortedIndex, 0, props);
}
self.updatedList(list, { data: copy }, set);
}
}
} else if (index !== -1) {
items = self.serializeList(list);
items.splice(index, 1);
self.updatedList(list, { data: items }, set);
}
});
};
var destroy = function (props) {
var self = this;
this.listStore.forEach(function (list, id) {
var set = JSON.parse(id);
var index = indexOf(self, props, list);
if (index !== -1) {
var items = self.serializeList(list);
items.splice(index, 1);
self.updatedList(list, { data: items }, set);
}
});
};
});
/*can-connect@1.5.9#can/map/map*/
define('can-connect/can/map/map', [
'require',
'exports',
'module',
'can-util/js/each/each',
'can-connect',
'can-event/batch/batch',
'can-event',
'can-observation',
'can-util/js/is-plain-object/is-plain-object',
'can-types',
'can-util/js/each/each',
'can-util/js/is-function/is-function',
'can-util/js/dev/dev',
'can-reflect',
'can-connect/helpers/validate'
], function (require, exports, module) {
'use strict';
var each = require('can-util/js/each/each');
var connect = require('can-connect');
var canBatch = require('can-event/batch/batch');
var canEvent = require('can-event');
var Observation = require('can-observation');
var isPlainObject = require('can-util/js/is-plain-object/is-plain-object');
var types = require('can-types');
var each = require('can-util/js/each/each');
var isFunction = require('can-util/js/is-function/is-function');
var dev = require('can-util/js/dev/dev');
var canReflect = require('can-reflect');
var setExpando = function (map, prop, value) {
if ('attr' in map) {
map[prop] = value;
} else {
map._data[prop] = value;
}
};
var getExpando = function (map, prop) {
if ('attr' in map) {
return map[prop];
} else {
return map._data[prop];
}
};
var canMapBehavior = connect.behavior('can/map', function (baseConnection) {
var behavior = {
init: function () {
this.Map = this.Map || types.DefaultMap.extend({});
this.List = this.List || types.DefaultList.extend({});
overwrite(this, this.Map, mapOverwrites, mapStaticOverwrites);
overwrite(this, this.List, listPrototypeOverwrites, listStaticOverwrites);
baseConnection.init.apply(this, arguments);
},
id: function (instance) {
if (!isPlainObject(instance)) {
var ids = [], algebra = this.algebra;
if (algebra && algebra.clauses && algebra.clauses.id) {
for (var prop in algebra.clauses.id) {
ids.push(readObservable(instance, prop));
}
}
if (this.idProp && !ids.length) {
ids.push(readObservable(instance, this.idProp));
}
if (!ids.length) {
ids.push(readObservable(instance, 'id'));
}
return ids.length > 1 ? ids.join('@|@') : ids[0];
} else {
return baseConnection.id(instance);
}
},
serializeInstance: function (instance) {
return instance.serialize();
},
serializeList: function (list) {
return list.serialize();
},
instance: function (props) {
var _Map = this.Map || types.DefaultMap;
return new _Map(props);
},
list: function (listData, set) {
var _List = this.List || this.Map && this.Map.List || types.DefaultList;
var list = new _List(listData.data);
each(listData, function (val, prop) {
if (prop !== 'data') {
list[list.set ? 'set' : 'attr'](prop, val);
}
});
list.__listSet = set;
return list;
},
updatedList: function () {
canBatch.start();
var res = baseConnection.updatedList.apply(this, arguments);
canBatch.stop();
return res;
},
save: function (instance) {
setExpando(instance, '_saving', true);
canEvent.dispatch.call(instance, '_saving', [
true,
false
]);
var done = function () {
setExpando(instance, '_saving', false);
canEvent.dispatch.call(instance, '_saving', [
false,
true
]);
};
var base = baseConnection.save.apply(this, arguments);
base.then(done, done);
return base;
},
destroy: function (instance) {
setExpando(instance, '_destroying', true);
canEvent.dispatch.call(instance, '_destroying', [
true,
false
]);
var done = function () {
setExpando(instance, '_destroying', false);
canEvent.dispatch.call(instance, '_destroying', [
false,
true
]);
};
var base = baseConnection.destroy.apply(this, arguments);
base.then(done, done);
return base;
}
};
each([
'created',
'updated',
'destroyed'
], function (funcName) {
behavior[funcName + 'Instance'] = function (instance, props) {
if (props && typeof props === 'object') {
if (this.constructor.removeAttr) {
canReflect.updateDeep(instance, props);
} else {
canReflect.assignDeep(instance, props);
}
}
if (funcName === 'created' && this.moveCreatedInstanceToInstanceStore) {
this.moveCreatedInstanceToInstanceStore(instance);
}
canMapBehavior.callbackInstanceEvents(funcName, instance);
};
});
return behavior;
});
canMapBehavior.callbackInstanceEvents = function (funcName, instance) {
var constructor = instance.constructor;
canEvent.dispatch.call(instance, {
type: funcName,
target: instance
});
if (this.id) {
dev.log('can-connect/can/map/map.js - ' + (constructor.shortName || this.name) + ' ' + this.id(instance) + ' ' + funcName);
}
canEvent.dispatch.call(constructor, funcName, [instance]);
};
var callCanReadingOnIdRead = true;
var mapStaticOverwrites = {
getList: function (base, connection) {
return function (set) {
return connection.getList(set);
};
},
findAll: function (base, connection) {
return function (set) {
return connection.getList(set);
};
},
get: function (base, connection) {
return function (params) {
return connection.get(params);
};
},
findOne: function (base, connection) {
return function (params) {
return connection.get(params);
};
}
};
var mapOverwrites = {
_eventSetup: function (base, connection) {
return function () {
callCanReadingOnIdRead = false;
if (connection.addInstanceReference) {
connection.addInstanceReference(this);
}
callCanReadingOnIdRead = true;
return base.apply(this, arguments);
};
},
_eventTeardown: function (base, connection) {
return function () {
callCanReadingOnIdRead = false;
if (connection.deleteInstanceReference) {
connection.deleteInstanceReference(this);
}
callCanReadingOnIdRead = true;
return base.apply(this, arguments);
};
},
___set: function (base, connection) {
return function (prop, val) {
base.apply(this, arguments);
if (prop === connection.idProp && this.__bindEvents && this.__bindEvents._lifecycleBindings) {
connection.addInstanceReference(this);
}
};
},
isNew: function (base, connection) {
return function () {
return connection.isNew(this);
};
},
isSaving: function (base, connection) {
return function () {
Observation.add(this, '_saving');
return !!getExpando(this, '_saving');
};
},
isDestroying: function (base, connection) {
return function () {
Observation.add(this, '_destroying');
return !!getExpando(this, '_destroying');
};
},
save: function (base, connection) {
return function (success, error) {
var promise = connection.save(this);
promise.then(success, error);
return promise;
};
},
destroy: function (base, connection) {
return function (success, error) {
var promise;
if (this.isNew()) {
promise = Promise.resolve(this);
connection.destroyedInstance(this, {});
} else {
promise = connection.destroy(this);
}
promise.then(success, error);
return promise;
};
}
};
var listPrototypeOverwrites = {
setup: function (base, connection) {
return function (params) {
if (isPlainObject(params) && !Array.isArray(params)) {
this.__listSet = params;
base.apply(this);
this.replace(canReflect.isPromise(params) ? params : connection.getList(params));
} else {
base.apply(this, arguments);
}
};
},
_eventSetup: function (base, connection) {
return function () {
if (connection.addListReference) {
connection.addListReference(this);
}
if (base) {
return base.apply(this, arguments);
}
};
},
_eventTeardown: function (base, connection) {
return function () {
if (connection.deleteListReference) {
connection.deleteListReference(this);
}
if (base) {
return base.apply(this, arguments);
}
};
}
};
var listStaticOverwrites = {
_bubbleRule: function (base, connection) {
return function (eventName, list) {
var bubbleRules = base(eventName, list);
bubbleRules.push('destroyed');
return bubbleRules;
};
}
};
var readObservable = function (instance, prop) {
if ('__get' in instance) {
if (callCanReadingOnIdRead) {
Observation.add(instance, prop);
}
return instance.__get(prop);
} else {
if (callCanReadingOnIdRead) {
return instance[prop];
} else {
return Observation.ignore(function () {
return instance[prop];
})();
}
}
};
var overwrite = function (connection, Constructor, prototype, statics) {
var prop;
for (prop in prototype) {
Constructor.prototype[prop] = prototype[prop](Constructor.prototype[prop], connection);
}
if (statics) {
for (prop in statics) {
Constructor[prop] = statics[prop](Constructor[prop], connection);
}
}
};
module.exports = canMapBehavior;
var validate = require('can-connect/helpers/validate');
module.exports = validate(canMapBehavior, [
'id',
'get',
'updatedList',
'destroy',
'save',
'getList'
]);
});
/*can-util@3.10.11#js/defaults/defaults*/
define('can-util/js/defaults/defaults', function (require, exports, module) {
'use strict';
module.exports = function (target) {
var length = arguments.length;
for (var i = 1; i < length; i++) {
for (var prop in arguments[i]) {
if (target[prop] === undefined) {
target[prop] = arguments[i][prop];
}
}
}
return target;
};
});
/*can-util@3.10.11#js/string-to-any/string-to-any*/
define('can-util/js/string-to-any/string-to-any', function (require, exports, module) {
'use strict';
module.exports = function (str) {
switch (str) {
case 'NaN':
case 'Infinity':
return +str;
case 'null':
return null;
case 'undefined':
return undefined;
case 'true':
case 'false':
return str === 'true';
default:
var val = +str;
if (!isNaN(val)) {
return val;
} else {
return str;
}
}
};
});
/*can-define-lazy-value@1.0.0#define-lazy-value*/
define('can-define-lazy-value', function (require, exports, module) {
module.exports = function defineLazyValue(obj, prop, initializer, writable) {
Object.defineProperty(obj, prop, {
configurable: true,
get: function () {
Object.defineProperty(this, prop, {
value: undefined,
writable: true
});
var value = initializer.call(this, obj, prop);
Object.defineProperty(this, prop, {
value: value,
writable: !!writable
});
return value;
},
set: function (value) {
Object.defineProperty(this, prop, {
value: value,
writable: !!writable
});
return value;
}
});
};
});
/*can-define@1.5.1#can-define*/
define('can-define', [
'require',
'exports',
'module',
'can-event/lifecycle/lifecycle',
'can-event/batch/batch',
'can-event',
'can-compute',
'can-observation',
'can-util/js/is-empty-object/is-empty-object',
'can-util/js/assign/assign',
'can-util/js/dev/dev',
'can-cid',
'can-util/js/is-plain-object/is-plain-object',
'can-types',
'can-util/js/each/each',
'can-util/js/defaults/defaults',
'can-util/js/string-to-any/string-to-any',
'can-namespace',
'can-symbol',
'can-reflect',
'can-util/js/single-reference/single-reference',
'can-simple-observable',
'can-define-lazy-value'
], function (require, exports, module) {
'use strict';
'format cjs';
var eventLifecycle = require('can-event/lifecycle/lifecycle');
var canBatch = require('can-event/batch/batch');
var canEvent = require('can-event');
var compute = require('can-compute');
var Observation = require('can-observation');
var isEmptyObject = require('can-util/js/is-empty-object/is-empty-object');
var assign = require('can-util/js/assign/assign');
var dev = require('can-util/js/dev/dev');
var CID = require('can-cid');
var isPlainObject = require('can-util/js/is-plain-object/is-plain-object');
var types = require('can-types');
var each = require('can-util/js/each/each');
var defaults = require('can-util/js/defaults/defaults');
var stringToAny = require('can-util/js/string-to-any/string-to-any');
var ns = require('can-namespace');
var canSymbol = require('can-symbol');
var canReflect = require('can-reflect');
var singleReference = require('can-util/js/single-reference/single-reference');
var simpleObervable = require('can-simple-observable');
var defineLazyValue = require('can-define-lazy-value');
var eventsProto, define, make, makeDefinition, getDefinitionsAndMethods, isDefineType, getDefinitionOrMethod;
var defineConfigurableAndNotEnumerable = function (obj, prop, value) {
Object.defineProperty(obj, prop, {
configurable: true,
enumerable: false,
writable: true,
value: value
});
};
var eachPropertyDescriptor = function (map, cb) {
for (var prop in map) {
if (map.hasOwnProperty(prop)) {
cb(prop, Object.getOwnPropertyDescriptor(map, prop));
}
}
};
function trapSets(observableValue) {
return {
observable: observableValue,
lastSetValue: simpleObervable(),
setValue: function (value) {
canReflect.setValue(this.lastSetValue, value);
if (this.observable) {
if (canSymbol.for('can.setValue') in this.observable) {
canReflect.setValue(this.observable, value);
} else {
this.observable.update();
}
}
}
};
}
module.exports = define = ns.define = function (objPrototype, defines, baseDefine) {
var prop, dataInitializers = Object.create(baseDefine ? baseDefine.dataInitializers : null), computedInitializers = Object.create(baseDefine ? baseDefine.computedInitializers : null);
var result = getDefinitionsAndMethods(defines, baseDefine);
result.dataInitializers = dataInitializers;
result.computedInitializers = computedInitializers;
each(result.definitions, function (definition, property) {
define.property(objPrototype, property, definition, dataInitializers, computedInitializers);
});
if (objPrototype.hasOwnProperty('_data')) {
for (prop in dataInitializers) {
defineLazyValue(objPrototype._data, prop, dataInitializers[prop].bind(objPrototype), true);
}
} else {
defineLazyValue(objPrototype, '_data', function () {
var map = this;
var data = {};
for (var prop in dataInitializers) {
defineLazyValue(data, prop, dataInitializers[prop].bind(map), true);
}
return data;
});
}
if (objPrototype.hasOwnProperty('_computed')) {
for (prop in computedInitializers) {
defineLazyValue(objPrototype._computed, prop, computedInitializers[prop].bind(objPrototype));
}
} else {
defineLazyValue(objPrototype, '_computed', function () {
var map = this;
var data = Object.create(null);
for (var prop in computedInitializers) {
defineLazyValue(data, prop, computedInitializers[prop].bind(map));
}
return data;
});
}
if (!objPrototype.hasOwnProperty('_cid')) {
defineLazyValue(objPrototype, '_cid', function () {
return CID({});
});
}
for (prop in eventsProto) {
Object.defineProperty(objPrototype, prop, {
enumerable: false,
value: eventsProto[prop],
configurable: true,
writable: true
});
}
Object.defineProperty(objPrototype, '_define', {
enumerable: false,
value: result,
configurable: true,
writable: true
});
var iteratorSymbol = canSymbol.iterator || canSymbol.for('iterator');
if (!objPrototype[iteratorSymbol]) {
defineConfigurableAndNotEnumerable(objPrototype, iteratorSymbol, function () {
return new define.Iterator(this);
});
}
return result;
};
define.extensions = function () {
};
var onlyType = function (obj) {
for (var prop in obj) {
if (prop !== 'type') {
return false;
}
}
return true;
};
define.property = function (objPrototype, prop, definition, dataInitializers, computedInitializers) {
var propertyDefinition = define.extensions.apply(this, arguments);
if (propertyDefinition) {
definition = propertyDefinition;
}
var type = definition.type;
if (type && canReflect.isConstructorLike(type)) {
dev.warn('can-define: the definition for ' + prop + (objPrototype.constructor.shortName ? ' on ' + objPrototype.constructor.shortName : '') + ' uses a constructor for "type". Did you mean "Type"?');
}
if (type && onlyType(definition) && type === define.types['*']) {
Object.defineProperty(objPrototype, prop, {
get: make.get.data(prop),
set: make.set.events(prop, make.get.data(prop), make.set.data(prop), make.eventType.data(prop)),
enumerable: true,
configurable: true
});
return;
}
definition.type = type;
var dataProperty = definition.get ? 'computed' : 'data', reader = make.read[dataProperty](prop), getter = make.get[dataProperty](prop), setter = make.set[dataProperty](prop), getInitialValue;
var typeConvert = function (val) {
return val;
};
if (definition.Type) {
typeConvert = make.set.Type(prop, definition.Type, typeConvert);
}
if (type) {
typeConvert = make.set.type(prop, type, typeConvert);
}
var eventsSetter = make.set.events(prop, reader, setter, make.eventType[dataProperty](prop));
if (definition.value !== undefined || definition.Value !== undefined) {
if (definition.value !== null && typeof definition.value === 'object') {
dev.warn('can-define: The value for ' + prop + ' is set to an object. This will be shared by all instances of the DefineMap. Use a function that returns the object instead.');
}
if (definition.value && canReflect.isConstructorLike(definition.value)) {
dev.warn('can-define: The "value" for ' + prop + ' is set to a constructor. Did you mean "Value" instead?');
}
getInitialValue = Observation.ignore(make.get.defaultValue(prop, definition, typeConvert, eventsSetter));
}
if (definition.get) {
computedInitializers[prop] = make.compute(prop, definition.get, getInitialValue);
} else if (getInitialValue) {
dataInitializers[prop] = getInitialValue;
}
if (definition.get && definition.set) {
setter = make.set.setter(prop, definition.set, make.read.lastSet(prop), setter, true);
} else if (definition.set) {
setter = make.set.setter(prop, definition.set, reader, eventsSetter, false);
} else if (!definition.get) {
setter = eventsSetter;
} else if (definition.get.length < 1) {
setter = function () {
dev.warn('can-define: Set value for property ' + prop + (objPrototype.constructor.shortName ? ' on ' + objPrototype.constructor.shortName : '') + ' ignored, as its definition has a zero-argument getter and no setter');
};
}
if (type) {
setter = make.set.type(prop, type, setter);
}
if (definition.Type) {
setter = make.set.Type(prop, definition.Type, setter);
}
Object.defineProperty(objPrototype, prop, {
get: getter,
set: setter,
enumerable: 'serialize' in definition ? !!definition.serialize : !definition.get,
configurable: true
});
};
define.Constructor = function (defines) {
var constructor = function (props) {
define.setup.call(this, props);
};
define(constructor.prototype, defines);
return constructor;
};
make = {
compute: function (prop, get, defaultValueFn) {
return function () {
var map = this, defaultValue = defaultValueFn && defaultValueFn.call(this), computeFn, valueTrap, computeObj;
var boundGet = function () {
return get.call(map, canReflect.getValue(computeObj.valueTrap.lastSetValue));
};
if (get.length < 2) {
if (defaultValue && defaultValue.isComputed) {
computeFn = defaultValue;
valueTrap = trapSets(computeFn);
} else {
computeFn = new Observation(boundGet, map);
valueTrap = trapSets(computeFn);
canReflect.setValue(valueTrap.lastSetValue, defaultValue);
}
} else {
if (defaultValue) {
computeFn = defaultValue.isComputed ? defaultValue : compute.async(defaultValue, get, map);
} else {
computeFn = compute.async(defaultValue, get, map);
}
valueTrap = trapSets(computeFn);
}
computeObj = {
oldValue: undefined,
compute: computeFn,
count: 0,
handler: function (newVal) {
var oldValue = computeObj.oldValue;
computeObj.oldValue = newVal;
canEvent.dispatch.call(map, {
type: prop,
target: map,
batchNum: canBatch.batchNum
}, [
newVal,
oldValue
]);
},
valueTrap: valueTrap
};
return computeObj;
};
},
set: {
data: function (prop) {
return function (newVal) {
this._data[prop] = newVal;
};
},
computed: function (prop) {
return function (val) {
this._computed[prop].valueTrap.setValue(val);
};
},
events: function (prop, getCurrent, setData, eventType) {
return function (newVal) {
if (this.__inSetup) {
setData.call(this, newVal);
} else {
var current = getCurrent.call(this);
if (newVal !== current) {
setData.call(this, newVal);
canEvent.dispatch.call(this, {
type: prop,
target: this
}, [
newVal,
current
]);
}
}
};
},
setter: function (prop, setter, getCurrent, setEvents, hasGetter) {
return function (value) {
var asyncTimer;
var self = this;
canBatch.start();
var setterCalled = false, current = getCurrent.call(this), setValue = setter.call(this, value, function (value) {
setEvents.call(self, value);
setterCalled = true;
clearTimeout(asyncTimer);
}, current);
if (setterCalled) {
canBatch.stop();
} else {
if (hasGetter) {
if (setValue !== undefined) {
if (current !== setValue) {
setEvents.call(this, setValue);
}
canBatch.stop();
} else if (setter.length === 0) {
setEvents.call(this, value);
canBatch.stop();
return;
} else if (setter.length === 1) {
canBatch.stop();
} else {
asyncTimer = setTimeout(function () {
dev.warn('can/map/setter.js: Setter "' + prop + '" did not return a value or call the setter callback.');
}, dev.warnTimeout);
canBatch.stop();
return;
}
} else {
if (setValue !== undefined) {
setEvents.call(this, setValue);
canBatch.stop();
} else if (setter.length === 0) {
setEvents.call(this, value);
canBatch.stop();
return;
} else if (setter.length === 1) {
setEvents.call(this, undefined);
canBatch.stop();
} else {
asyncTimer = setTimeout(function () {
dev.warn('can/map/setter.js: Setter "' + prop + '" did not return a value or call the setter callback.');
}, dev.warnTimeout);
canBatch.stop();
return;
}
}
}
};
},
type: function (prop, type, set) {
if (typeof type === 'object') {
return make.set.Type(prop, type, set);
} else {
return function (newValue) {
return set.call(this, type.call(this, newValue, prop));
};
}
},
Type: function (prop, Type, set) {
if (Array.isArray(Type) && types.DefineList) {
Type = types.DefineList.extend({ '#': Type[0] });
} else if (typeof Type === 'object') {
if (types.DefineMap) {
Type = types.DefineMap.extend(Type);
} else {
Type = define.constructor(Type);
}
}
return function (newValue) {
if (newValue instanceof Type || newValue == null) {
return set.call(this, newValue);
} else {
return set.call(this, new Type(newValue));
}
};
}
},
eventType: {
data: function (prop) {
return function (newVal, oldVal) {
return oldVal !== undefined || this._data.hasOwnProperty(prop) ? 'set' : 'add';
};
},
computed: function () {
return function () {
return 'set';
};
}
},
read: {
data: function (prop) {
return function () {
return this._data[prop];
};
},
computed: function (prop) {
return function () {
return canReflect.getValue(this._computed[prop].compute);
};
},
lastSet: function (prop) {
return function () {
var lastSetValue = this._computed[prop].valueTrap.lastSetValue;
return canReflect.getValue(lastSetValue);
};
}
},
get: {
defaultValue: function (prop, definition, typeConvert, callSetter) {
return function () {
var value = definition.value;
if (value !== undefined) {
if (typeof value === 'function') {
value = value.call(this);
}
value = typeConvert(value);
} else {
var Value = definition.Value;
if (Value) {
value = typeConvert(new Value());
}
}
if (definition.set) {
var VALUE;
var sync = true;
var setter = make.set.setter(prop, definition.set, function () {
}, function (value) {
if (sync) {
VALUE = value;
} else {
callSetter.call(this, value);
}
}, definition.get);
setter.call(this, value);
sync = false;
return VALUE;
}
return value;
};
},
data: function (prop) {
return function () {
if (!this.__inSetup) {
Observation.add(this, prop);
}
return this._data[prop];
};
},
computed: function (prop) {
return function () {
return canReflect.getValue(this._computed[prop].compute);
};
}
}
};
define.behaviors = [
'get',
'set',
'value',
'Value',
'type',
'Type',
'serialize'
];
var addDefinition = function (definition, behavior, value) {
if (behavior === 'type') {
var behaviorDef = value;
if (typeof behaviorDef === 'string') {
behaviorDef = define.types[behaviorDef];
if (typeof behaviorDef === 'object') {
assign(definition, behaviorDef);
behaviorDef = behaviorDef[behavior];
}
}
definition[behavior] = behaviorDef;
} else {
definition[behavior] = value;
}
};
makeDefinition = function (prop, def, defaultDefinition) {
var definition = {};
each(def, function (value, behavior) {
addDefinition(definition, behavior, value);
});
each(defaultDefinition, function (value, prop) {
if (definition[prop] === undefined) {
if (prop !== 'type' && prop !== 'Type') {
definition[prop] = value;
}
}
});
if (!definition.type && !definition.Type) {
defaults(definition, defaultDefinition);
}
if (isEmptyObject(definition)) {
definition.type = define.types['*'];
}
return definition;
};
getDefinitionOrMethod = function (prop, value, defaultDefinition) {
var definition;
if (typeof value === 'string') {
definition = { type: value };
} else if (typeof value === 'function') {
if (canReflect.isConstructorLike(value)) {
definition = { Type: value };
} else if (isDefineType(value)) {
definition = { type: value };
}
} else if (Array.isArray(value)) {
definition = { Type: value };
} else if (isPlainObject(value)) {
definition = value;
}
if (definition) {
return makeDefinition(prop, definition, defaultDefinition);
} else {
return value;
}
};
getDefinitionsAndMethods = function (defines, baseDefines) {
var definitions = Object.create(baseDefines ? baseDefines.definitions : null);
var methods = {};
var defaults = defines['*'], defaultDefinition;
if (defaults) {
delete defines['*'];
defaultDefinition = getDefinitionOrMethod('*', defaults, {});
} else {
defaultDefinition = Object.create(null);
}
eachPropertyDescriptor(defines, function (prop, propertyDescriptor) {
var value;
if (propertyDescriptor.get || propertyDescriptor.set) {
value = {
get: propertyDescriptor.get,
set: propertyDescriptor.set
};
} else {
value = propertyDescriptor.value;
}
if (prop === 'constructor') {
methods[prop] = value;
return;
} else {
var result = getDefinitionOrMethod(prop, value, defaultDefinition);
if (result && typeof result === 'object') {
definitions[prop] = result;
} else {
methods[prop] = result;
}
}
});
if (defaults) {
defines['*'] = defaults;
}
return {
definitions: definitions,
methods: methods,
defaultDefinition: defaultDefinition
};
};
eventsProto = assign({}, canEvent);
assign(eventsProto, {
_eventSetup: function () {
},
_eventTeardown: function () {
},
addEventListener: function (eventName, handler) {
var computedBinding = this._computed && this._computed[eventName];
if (computedBinding && computedBinding.compute) {
if (!computedBinding.count) {
computedBinding.count = 1;
canReflect.onValue(computedBinding.compute, computedBinding.handler);
computedBinding.oldValue = canReflect.getValue(computedBinding.compute);
} else {
computedBinding.count++;
}
}
return eventLifecycle.addAndSetup.apply(this, arguments);
},
removeEventListener: function (eventName, handler) {
var computedBinding = this._computed && this._computed[eventName];
if (computedBinding) {
if (computedBinding.count === 1) {
computedBinding.count = 0;
canReflect.offValue(computedBinding.compute, computedBinding.handler);
} else {
computedBinding.count--;
}
}
return eventLifecycle.removeAndTeardown.apply(this, arguments);
}
});
eventsProto.on = eventsProto.bind = eventsProto.addEventListener;
eventsProto.off = eventsProto.unbind = eventsProto.removeEventListener;
canReflect.set(eventsProto, canSymbol.for('can.onKeyValue'), function (key, handler) {
var translationHandler = function (ev, newValue, oldValue) {
handler(newValue, oldValue);
};
singleReference.set(handler, this, translationHandler, key);
this.addEventListener(key, translationHandler);
});
canReflect.set(eventsProto, canSymbol.for('can.offKeyValue'), function (key, handler) {
this.removeEventListener(key, singleReference.getAndDelete(handler, this, key));
});
delete eventsProto.one;
define.setup = function (props, sealed) {
CID(this);
Object.defineProperty(this, '_cid', {
value: this._cid,
enumerable: false,
writable: false
});
Object.defineProperty(this, 'constructor', {
value: this.constructor,
enumerable: false,
writable: false
});
Object.defineProperty(this, '__bindEvents', {
value: Object.create(null),
enumerable: false,
writable: false
});
var definitions = this._define.definitions;
var instanceDefinitions = Object.create(null);
var map = this;
canReflect.eachKey(props, function (value, prop) {
if (definitions[prop] !== undefined) {
map[prop] = value;
} else {
var def = define.makeSimpleGetterSetter(prop);
instanceDefinitions[prop] = {};
Object.defineProperty(map, prop, def);
map[prop] = define.types.observable(value);
}
});
if (!isEmptyObject(instanceDefinitions)) {
defineConfigurableAndNotEnumerable(this, '_instanceDefinitions', instanceDefinitions);
}
this._data;
this._computed;
if (sealed !== false) {
Object.seal(this);
}
};
define.replaceWith = defineLazyValue;
define.eventsProto = eventsProto;
define.defineConfigurableAndNotEnumerable = defineConfigurableAndNotEnumerable;
define.make = make;
define.getDefinitionOrMethod = getDefinitionOrMethod;
var simpleGetterSetters = {};
define.makeSimpleGetterSetter = function (prop) {
if (!simpleGetterSetters[prop]) {
var setter = make.set.events(prop, make.get.data(prop), make.set.data(prop), make.eventType.data(prop));
simpleGetterSetters[prop] = {
get: make.get.data(prop),
set: function (newVal) {
return setter.call(this, define.types.observable(newVal));
},
enumerable: true
};
}
return simpleGetterSetters[prop];
};
define.Iterator = function (obj) {
this.obj = obj;
this.definitions = Object.keys(obj._define.definitions);
this.instanceDefinitions = obj._instanceDefinitions ? Object.keys(obj._instanceDefinitions) : Object.keys(obj);
this.hasGet = typeof obj.get === 'function';
};
define.Iterator.prototype.next = function () {
var key;
if (this.definitions.length) {
key = this.definitions.shift();
var def = this.obj._define.definitions[key];
if (def.get) {
return this.next();
}
} else if (this.instanceDefinitions.length) {
key = this.instanceDefinitions.shift();
} else {
return {
value: undefined,
done: true
};
}
return {
value: [
key,
this.hasGet ? this.obj.get(key) : this.obj[key]
],
done: false
};
};
isDefineType = function (func) {
return func && func.canDefineType === true;
};
define.types = {
'date': function (str) {
var type = typeof str;
if (type === 'string') {
str = Date.parse(str);
return isNaN(str) ? null : new Date(str);
} else if (type === 'number') {
return new Date(str);
} else {
return str;
}
},
'number': function (val) {
if (val == null) {
return val;
}
return +val;
},
'boolean': function (val) {
if (val == null) {
return val;
}
if (val === 'false' || val === '0' || !val) {
return false;
}
return true;
},
'observable': function (newVal) {
if (Array.isArray(newVal) && types.DefineList) {
newVal = new types.DefineList(newVal);
} else if (isPlainObject(newVal) && types.DefineMap) {
newVal = new types.DefineMap(newVal);
}
return newVal;
},
'stringOrObservable': function (newVal) {
if (Array.isArray(newVal)) {
return new types.DefaultList(newVal);
} else if (isPlainObject(newVal)) {
return new types.DefaultMap(newVal);
} else {
return define.types.string(newVal);
}
},
'htmlbool': function (val) {
if (val === '') {
return true;
}
return !!stringToAny(val);
},
'*': function (val) {
return val;
},
'any': function (val) {
return val;
},
'string': function (val) {
if (val == null) {
return val;
}
return '' + val;
},
'compute': {
set: function (newValue, setVal, setErr, oldValue) {
if (newValue && newValue.isComputed) {
return newValue;
}
if (oldValue && oldValue.isComputed) {
oldValue(newValue);
return oldValue;
}
return newValue;
},
get: function (value) {
return value && value.isComputed ? value() : value;
}
}
};
});
/*can-connect@1.5.9#can/ref/ref*/
define('can-connect/can/ref/ref', [
'require',
'exports',
'module',
'can-connect',
'can-connect/helpers/get-id-props',
'can-connect/helpers/weak-reference-map',
'can-observation',
'can-connect/constructor/store/store',
'can-define'
], function (require, exports, module) {
var connect = require('can-connect');
var getIdProps = require('can-connect/helpers/get-id-props');
var WeakReferenceMap = require('can-connect/helpers/weak-reference-map');
var Observation = require('can-observation');
var constructorStore = require('can-connect/constructor/store/store');
var define = require('can-define');
var makeRef = function (connection) {
var idProp = getIdProps(connection)[0];
var Ref = function (id, value) {
if (typeof id === 'object') {
value = id;
id = value[idProp];
}
var storeRef = Ref.store.get(id);
if (storeRef) {
if (value && !storeRef._value) {
if (value instanceof connection.Map) {
storeRef._value = value;
} else {
storeRef._value = connection.hydrateInstance(value);
}
}
return storeRef;
}
this[idProp] = id;
if (value) {
if (value instanceof connection.Map) {
this._value = value;
} else {
this._value = connection.hydrateInstance(value);
}
}
if (constructorStore.requests.count() > 0) {
if (!Ref._requestInstances[id]) {
Ref.store.addReference(id, this);
Ref._requestInstances[id] = this;
}
}
};
Ref.store = new WeakReferenceMap();
Ref._requestInstances = {};
Ref.type = function (ref) {
if (ref && typeof ref !== 'object') {
return new Ref(ref);
} else {
return new Ref(ref[idProp], ref);
}
};
var defs = {
promise: {
get: function () {
if (this._value) {
return Promise.resolve(this._value);
} else {
var props = {};
props[idProp] = this[idProp];
return connection.Map.get(props);
}
}
},
_state: {
get: function (lastSet, resolve) {
if (resolve) {
this.promise.then(function () {
resolve('resolved');
}, function () {
resolve('rejected');
});
}
return 'pending';
}
},
value: {
get: function (lastSet, resolve) {
if (this._value) {
return this._value;
} else if (resolve) {
this.promise.then(function (value) {
resolve(value);
});
}
}
},
reason: {
get: function (lastSet, resolve) {
if (this._value) {
return undefined;
} else {
this.promise.catch(function (value) {
resolve(value);
});
}
}
}
};
defs[idProp] = {
type: '*',
set: function () {
this._value = undefined;
}
};
define(Ref.prototype, defs);
Ref.prototype.unobservedId = Observation.ignore(function () {
return this[idProp];
});
Ref.prototype.isResolved = function () {
return !!this._value || this._state === 'resolved';
};
Ref.prototype.isRejected = function () {
return this._state === 'rejected';
};
Ref.prototype.isPending = function () {
return !this._value && (this._state !== 'resolved' || this._state !== 'rejected');
};
Ref.prototype.serialize = function () {
return this[idProp];
};
var baseEventSetup = Ref.prototype._eventSetup;
Ref.prototype._eventSetup = function () {
Ref.store.addReference(this.unobservedId(), this);
return baseEventSetup.apply(this, arguments);
};
var baseTeardown = Ref.prototype._eventTeardown;
Ref.prototype._eventTeardown = function () {
Ref.store.deleteReference(this.unobservedId(), this);
return baseTeardown.apply(this, arguments);
};
constructorStore.requests.on('end', function () {
for (var id in Ref._requestInstances) {
Ref.store.deleteReference(id);
}
Ref._requestInstances = {};
});
return Ref;
};
module.exports = connect.behavior('can/ref', function (baseConnection) {
return {
init: function () {
baseConnection.init.apply(this, arguments);
this.Map.Ref = makeRef(this);
}
};
});
});
/*can-connect@1.5.9#can/super-map/super-map*/
define('can-connect/can/super-map/super-map', [
'require',
'exports',
'module',
'can-connect',
'can-connect/constructor/constructor',
'can-connect/can/map/map',
'can-connect/can/ref/ref',
'can-connect/constructor/store/store',
'can-connect/data/callbacks/callbacks',
'can-connect/data/callbacks-cache/callbacks-cache',
'can-connect/data/combine-requests/combine-requests',
'can-connect/data/localstorage-cache/localstorage-cache',
'can-connect/data/parse/parse',
'can-connect/data/url/url',
'can-connect/fall-through-cache/fall-through-cache',
'can-connect/real-time/real-time',
'can-connect/constructor/callbacks-once/callbacks-once',
'can-util/js/global/global'
], function (require, exports, module) {
(function (global) {
var connect = require('can-connect');
var constructor = require('can-connect/constructor/constructor');
var canMap = require('can-connect/can/map/map');
var canRef = require('can-connect/can/ref/ref');
var constructorStore = require('can-connect/constructor/store/store');
var dataCallbacks = require('can-connect/data/callbacks/callbacks');
var callbacksCache = require('can-connect/data/callbacks-cache/callbacks-cache');
var combineRequests = require('can-connect/data/combine-requests/combine-requests');
var localCache = require('can-connect/data/localstorage-cache/localstorage-cache');
var dataParse = require('can-connect/data/parse/parse');
var dataUrl = require('can-connect/data/url/url');
var fallThroughCache = require('can-connect/fall-through-cache/fall-through-cache');
var realTime = require('can-connect/real-time/real-time');
var callbacksOnce = require('can-connect/constructor/callbacks-once/callbacks-once');
var GLOBAL = require('can-util/js/global/global');
var $ = GLOBAL().$;
connect.superMap = function (options) {
var behaviors = [
constructor,
canMap,
canRef,
constructorStore,
dataCallbacks,
combineRequests,
dataParse,
dataUrl,
realTime,
callbacksOnce
];
if (typeof localStorage !== 'undefined') {
if (!options.cacheConnection) {
options.cacheConnection = connect([localCache], {
name: options.name + 'Cache',
idProp: options.idProp,
algebra: options.algebra
});
}
behaviors.push(callbacksCache, fallThroughCache);
}
if ($ && $.ajax) {
options.ajax = $.ajax;
}
return connect(behaviors, options);
};
module.exports = connect.superMap;
}(function () {
return this;
}()));
});
/*can-connect@1.5.9#can/tag/tag*/
define('can-connect/can/tag/tag', [
'require',
'exports',
'module',
'can-stache-bindings',
'can-connect',
'can-compute',
'can-stache/src/expression',
'can-view-callbacks',
'can-observation',
'can-view-nodelist',
'can-event',
'can-util/js/each/each',
'can-util/dom/mutate/mutate',
'can-util/dom/data/data',
'can-util/dom/events/removed/removed'
], function (require, exports, module) {
require('can-stache-bindings');
var connect = require('can-connect');
var compute = require('can-compute');
var expression = require('can-stache/src/expression');
var viewCallbacks = require('can-view-callbacks');
var Observation = require('can-observation');
var nodeLists = require('can-view-nodelist');
var canEvent = require('can-event');
var each = require('can-util/js/each/each');
var domMutate = require('can-util/dom/mutate/mutate');
var domData = require('can-util/dom/data/data');
require('can-util/dom/events/removed/removed');
var convertToValue = function (arg) {
if (typeof arg === 'function') {
return convertToValue(arg());
} else {
return arg;
}
};
connect.tag = function (tagName, connection) {
var removeBrackets = function (value, open, close) {
open = open || '{';
close = close || '}';
if (value[0] === open && value[value.length - 1] === close) {
return value.substr(1, value.length - 2);
}
return value;
};
viewCallbacks.tag(tagName, function (el, tagData) {
var getList = el.getAttribute('getList') || el.getAttribute('get-list');
var getInstance = el.getAttribute('get');
var attrValue = getList || getInstance;
var method = getList ? 'getList' : 'get';
var attrInfo = expression.parse('tmp(' + removeBrackets(attrValue) + ')', { baseMethodType: 'Call' });
var addedToPageData = false;
var addToPageData = Observation.ignore(function (set, promise) {
if (!addedToPageData) {
var root = tagData.scope.peek('%root') || tagData.scope.peek('@root');
if (root && root.pageData) {
if (method === 'get') {
set = connection.id(set);
}
root.pageData(connection.name, set, promise);
}
}
addedToPageData = true;
});
var request = compute(function () {
var hash = {};
if (typeof attrInfo.hash === 'object') {
each(attrInfo.hash, function (val, key) {
if (val && val.hasOwnProperty('get')) {
hash[key] = tagData.scope.read(val.get, {}).value;
} else {
hash[key] = val;
}
});
} else if (typeof attrInfo.hash === 'function') {
var getHash = attrInfo.hash(tagData.scope, tagData.options, {});
each(getHash(), function (val, key) {
hash[key] = convertToValue(val);
});
} else {
hash = attrInfo.argExprs.length ? attrInfo.argExprs[0].value(tagData.scope, tagData.options)() : {};
}
var promise = connection[method](hash);
addToPageData(hash, promise);
return promise;
});
domData.set.call(el, 'viewModel', request);
var nodeList = nodeLists.register([], undefined, tagData.parentNodeList || true);
var frag = tagData.subtemplate ? tagData.subtemplate(tagData.scope.add(request), tagData.options, nodeList) : document.createDocumentFragment();
domMutate.appendChild.call(el, frag);
nodeLists.update(nodeList, el.childNodes);
canEvent.one.call(el, 'removed', function () {
nodeLists.unregister(nodeList);
});
});
};
module.exports = connect.tag;
});
/*can-connect@1.5.9#can/base-map/base-map*/
define('can-connect/can/base-map/base-map', [
'require',
'exports',
'module',
'can-connect',
'can-connect/constructor/constructor',
'can-connect/can/map/map',
'can-connect/can/ref/ref',
'can-connect/constructor/store/store',
'can-connect/data/callbacks/callbacks',
'can-connect/data/callbacks-cache/callbacks-cache',
'can-connect/data/parse/parse',
'can-connect/data/url/url',
'can-connect/real-time/real-time',
'can-connect/constructor/callbacks-once/callbacks-once',
'can-util/js/global/global'
], function (require, exports, module) {
(function (global) {
var connect = require('can-connect');
var constructor = require('can-connect/constructor/constructor');
var canMap = require('can-connect/can/map/map');
var canRef = require('can-connect/can/ref/ref');
var constructorStore = require('can-connect/constructor/store/store');
var dataCallbacks = require('can-connect/data/callbacks/callbacks');
var callbacksCache = require('can-connect/data/callbacks-cache/callbacks-cache');
var dataParse = require('can-connect/data/parse/parse');
var dataUrl = require('can-connect/data/url/url');
var realTime = require('can-connect/real-time/real-time');
var callbacksOnce = require('can-connect/constructor/callbacks-once/callbacks-once');
var GLOBAL = require('can-util/js/global/global');
var $ = GLOBAL().$;
connect.baseMap = function (options) {
var behaviors = [
constructor,
canMap,
canRef,
constructorStore,
dataCallbacks,
dataParse,
dataUrl,
realTime,
callbacksOnce
];
if ($ && $.ajax) {
options.ajax = $.ajax;
}
return connect(behaviors, options);
};
module.exports = connect.baseMap;
}(function () {
return this;
}()));
});
/*can-connect@1.5.9#all*/
define('can-connect/all', [
'require',
'exports',
'module',
'can-connect',
'can-connect/cache-requests/cache-requests',
'can-connect/constructor/constructor',
'can-connect/constructor/callbacks-once/callbacks-once',
'can-connect/constructor/store/store',
'can-connect/data/callbacks/callbacks',
'can-connect/data/callbacks-cache/callbacks-cache',
'can-connect/data/combine-requests/combine-requests',
'can-connect/data/localstorage-cache/localstorage-cache',
'can-connect/data/memory-cache/memory-cache',
'can-connect/data/parse/parse',
'can-connect/data/url/url',
'can-connect/fall-through-cache/fall-through-cache',
'can-connect/real-time/real-time',
'can-connect/can/super-map/super-map',
'can-connect/can/tag/tag',
'can-connect/can/base-map/base-map'
], function (require, exports, module) {
var connect = require('can-connect');
connect.cacheRequests = require('can-connect/cache-requests/cache-requests');
connect.constructor = require('can-connect/constructor/constructor');
connect.constructorCallbacksOnce = require('can-connect/constructor/callbacks-once/callbacks-once');
connect.constructorStore = require('can-connect/constructor/store/store');
connect.dataCallbacks = require('can-connect/data/callbacks/callbacks');
connect.dataCallbacksCache = require('can-connect/data/callbacks-cache/callbacks-cache');
connect.dataCombineRequests = require('can-connect/data/combine-requests/combine-requests');
connect.dataLocalStorageCache = require('can-connect/data/localstorage-cache/localstorage-cache');
connect.dataMemoryCache = require('can-connect/data/memory-cache/memory-cache');
connect.dataParse = require('can-connect/data/parse/parse');
connect.dataUrl = require('can-connect/data/url/url');
connect.fallThroughCache = require('can-connect/fall-through-cache/fall-through-cache');
connect.realTime = require('can-connect/real-time/real-time');
connect.superMap = require('can-connect/can/super-map/super-map');
connect.tag = require('can-connect/can/tag/tag');
connect.baseMap = require('can-connect/can/base-map/base-map');
module.exports = connect;
});
/*can-define@1.5.1#define-helpers/define-helpers*/
define('can-define/define-helpers/define-helpers', [
'require',
'exports',
'module',
'can-define',
'can-event/batch/batch',
'can-event',
'can-reflect'
], function (require, exports, module) {
var define = require('can-define');
var canBatch = require('can-event/batch/batch');
var canEvent = require('can-event');
var canReflect = require('can-reflect');
var defineHelpers = {
defineExpando: function (map, prop, value) {
var constructorDefines = map._define.definitions;
if (constructorDefines && constructorDefines[prop]) {
return;
}
var instanceDefines = map._instanceDefinitions;
if (!instanceDefines) {
Object.defineProperty(map, '_instanceDefinitions', {
configurable: true,
enumerable: false,
value: {}
});
instanceDefines = map._instanceDefinitions;
}
if (!instanceDefines[prop]) {
var defaultDefinition = map._define.defaultDefinition || { type: define.types.observable };
define.property(map, prop, defaultDefinition, {}, {});
map._data[prop] = defaultDefinition.type ? defaultDefinition.type(value) : define.types.observable(value);
instanceDefines[prop] = defaultDefinition;
canBatch.start();
canEvent.dispatch.call(map, {
type: '__keys',
target: map
});
if (map._data[prop] !== undefined) {
canEvent.dispatch.call(map, {
type: prop,
target: map
}, [
map._data[prop],
undefined
]);
}
canBatch.stop();
return true;
}
},
reflectSerialize: function (unwrapped) {
var constructorDefinitions = this._define.definitions;
var defaultDefinition = this._define.defaultDefinition;
this.each(function (val, name) {
var propDef = constructorDefinitions[name];
if (propDef && typeof propDef.serialize === 'function') {
val = propDef.serialize.call(this, val, name);
} else if (defaultDefinition && typeof defaultDefinition.serialize === 'function') {
val = defaultDefinition.serialize.call(this, val, name);
} else {
val = canReflect.serialize(val);
}
if (val !== undefined) {
unwrapped[name] = val;
}
}, this);
return unwrapped;
},
reflectUnwrap: function (unwrapped) {
this.forEach(function (value, key) {
if (value !== undefined) {
unwrapped[key] = canReflect.unwrap(value);
}
});
return unwrapped;
}
};
module.exports = defineHelpers;
});
/*can-define@1.5.1#map/map*/
define('can-define/map/map', [
'require',
'exports',
'module',
'can-construct',
'can-define',
'can-define/define-helpers/define-helpers',
'can-observation',
'can-types',
'can-event/batch/batch',
'can-namespace',
'can-util/js/log/log',
'can-reflect',
'can-symbol',
'can-util/js/cid-set/cid-set',
'can-util/js/cid-map/cid-map',
'can-util/js/dev/dev'
], function (require, exports, module) {
var Construct = require('can-construct');
var define = require('can-define');
var defineHelpers = require('can-define/define-helpers/define-helpers');
var Observation = require('can-observation');
var types = require('can-types');
var canBatch = require('can-event/batch/batch');
var ns = require('can-namespace');
var canLog = require('can-util/js/log/log');
var canReflect = require('can-reflect');
var canSymbol = require('can-symbol');
var CIDSet = require('can-util/js/cid-set/cid-set');
var CIDMap = require('can-util/js/cid-map/cid-map');
var canDev = require('can-util/js/dev/dev');
var keysForDefinition = function (definitions) {
var keys = [];
for (var prop in definitions) {
var definition = definitions[prop];
if (typeof definition !== 'object' || ('serialize' in definition ? !!definition.serialize : !definition.get)) {
keys.push(prop);
}
}
return keys;
};
function assign(source) {
canBatch.start();
canReflect.assignMap(this, source || {});
canBatch.stop();
}
function update(source) {
canBatch.start();
canReflect.updateMap(this, source || {});
canBatch.stop();
}
function assignDeep(source) {
canBatch.start();
canReflect.assignDeepMap(this, source || {});
canBatch.stop();
}
function updateDeep(source) {
canBatch.start();
canReflect.updateDeepMap(this, source || {});
canBatch.stop();
}
function setKeyValue(key, value) {
var defined = defineHelpers.defineExpando(this, key, value);
if (!defined) {
this[key] = value;
}
}
function getKeyValue(key) {
var value = this[key];
if (value !== undefined || key in this || Object.isSealed(this)) {
return value;
} else {
Observation.add(this, key);
return this[key];
}
}
var DefineMap = Construct.extend('DefineMap', {
setup: function (base) {
var key, prototype = this.prototype;
if (DefineMap) {
define(prototype, prototype, base.prototype._define);
for (key in DefineMap.prototype) {
define.defineConfigurableAndNotEnumerable(prototype, key, prototype[key]);
}
this.prototype.setup = function (props) {
define.setup.call(this, props || {}, this.constructor.seal);
};
} else {
for (key in prototype) {
define.defineConfigurableAndNotEnumerable(prototype, key, prototype[key]);
}
}
define.defineConfigurableAndNotEnumerable(prototype, 'constructor', this);
}
}, {
setup: function (props, sealed) {
if (!this._define) {
Object.defineProperty(this, '_define', {
enumerable: false,
value: { definitions: {} }
});
Object.defineProperty(this, '_data', {
enumerable: false,
value: {}
});
}
define.setup.call(this, props || {}, sealed === true);
},
get: function (prop) {
if (prop) {
return getKeyValue.call(this, prop);
} else {
return canReflect.unwrap(this, CIDMap);
}
},
set: function (prop, value) {
if (typeof prop === 'object') {
canDev.warn('can-define/map/map.prototype.set is deprecated; please use can-define/map/map.prototype.assign or can-define/map/map.prototype.update instead');
if (value === true) {
updateDeep.call(this, prop);
} else {
assignDeep.call(this, prop);
}
} else {
setKeyValue.call(this, prop, value);
}
return this;
},
assignDeep: function (prop) {
assignDeep.call(this, prop);
return this;
},
updateDeep: function (prop) {
updateDeep.call(this, prop);
return this;
},
assign: function (prop) {
assign.call(this, prop);
return this;
},
update: function (prop) {
update.call(this, prop);
return this;
},
serialize: function () {
return canReflect.serialize(this, CIDMap);
},
forEach: function () {
var forEach = function (list, cb, thisarg) {
return canReflect.eachKey(list, cb, thisarg);
}, noObserve = Observation.ignore(forEach);
return function (cb, thisarg, observe) {
return observe === false ? noObserve(this, cb, thisarg) : forEach(this, cb, thisarg);
};
}(),
'*': { type: define.types.observable }
});
canReflect.assignSymbols(DefineMap.prototype, {
'can.isMapLike': true,
'can.isListLike': false,
'can.isValueLike': false,
'can.getKeyValue': getKeyValue,
'can.setKeyValue': setKeyValue,
'can.deleteKeyValue': function (prop) {
this.set(prop, undefined);
return this;
},
'can.getOwnEnumerableKeys': function () {
Observation.add(this, '__keys');
return keysForDefinition(this._define.definitions).concat(keysForDefinition(this._instanceDefinitions));
},
'can.assignDeep': assignDeep,
'can.updateDeep': updateDeep,
'can.unwrap': defineHelpers.reflectUnwrap,
'can.serialize': defineHelpers.reflectSerialize,
'can.keyHasDependencies': function (key) {
return !!(this._computed && this._computed[key] && this._computed[key].compute);
},
'can.getKeyDependencies': function (key) {
var ret;
if (this._computed && this._computed[key] && this._computed[key].compute) {
ret = {};
ret.valueDependencies = new CIDSet();
ret.valueDependencies.add(this._computed[key].compute);
}
return ret;
}
});
canReflect.setKeyValue(DefineMap.prototype, canSymbol.iterator, function () {
return new define.Iterator(this);
});
for (var prop in define.eventsProto) {
DefineMap[prop] = define.eventsProto[prop];
Object.defineProperty(DefineMap.prototype, prop, {
enumerable: false,
value: define.eventsProto[prop],
writable: true
});
}
var eventsProtoSymbols = 'getOwnPropertySymbols' in Object ? Object.getOwnPropertySymbols(define.eventsProto) : [
canSymbol.for('can.onKeyValue'),
canSymbol.for('can.offKeyValue')
];
eventsProtoSymbols.forEach(function (sym) {
Object.defineProperty(DefineMap.prototype, sym, {
enumerable: false,
value: define.eventsProto[sym],
writable: true
});
});
types.DefineMap = DefineMap;
types.DefaultMap = DefineMap;
Object.defineProperty(DefineMap.prototype, 'toObject', {
enumerable: false,
writable: true,
value: function () {
canLog.warn('Use DefineMap::get instead of DefineMap::toObject');
return this.get();
}
});
Object.defineProperty(DefineMap.prototype, 'each', {
enumerable: false,
writable: true,
value: DefineMap.prototype.forEach
});
module.exports = ns.DefineMap = DefineMap;
});
/*can-define@1.5.1#list/list*/
define('can-define/list/list', [
'require',
'exports',
'module',
'can-construct',
'can-define',
'can-event',
'can-event/batch/batch',
'can-observation',
'can-util/js/log/log',
'can-util/js/dev/dev',
'can-define/define-helpers/define-helpers',
'can-util/js/assign/assign',
'can-util/js/diff/diff',
'can-util/js/each/each',
'can-util/js/make-array/make-array',
'can-types',
'can-namespace',
'can-reflect',
'can-symbol',
'can-util/js/cid-set/cid-set',
'can-util/js/cid-map/cid-map',
'can-util/js/single-reference/single-reference'
], function (require, exports, module) {
var Construct = require('can-construct');
var define = require('can-define');
var make = define.make;
var canEvent = require('can-event');
var canBatch = require('can-event/batch/batch');
var Observation = require('can-observation');
var canLog = require('can-util/js/log/log');
var canDev = require('can-util/js/dev/dev');
var defineHelpers = require('can-define/define-helpers/define-helpers');
var assign = require('can-util/js/assign/assign');
var diff = require('can-util/js/diff/diff');
var each = require('can-util/js/each/each');
var makeArray = require('can-util/js/make-array/make-array');
var types = require('can-types');
var ns = require('can-namespace');
var canReflect = require('can-reflect');
var canSymbol = require('can-symbol');
var CIDSet = require('can-util/js/cid-set/cid-set');
var CIDMap = require('can-util/js/cid-map/cid-map');
var singleReference = require('can-util/js/single-reference/single-reference');
var splice = [].splice;
var runningNative = false;
var identity = function (x) {
return x;
};
var makeFilterCallback = function (props) {
return function (item) {
for (var prop in props) {
if (item[prop] !== props[prop]) {
return false;
}
}
return true;
};
};
var DefineList = Construct.extend('DefineList', {
setup: function (base) {
if (DefineList) {
var prototype = this.prototype;
var result = define(prototype, prototype, base.prototype._define);
var itemsDefinition = result.definitions['#'] || result.defaultDefinition;
if (itemsDefinition) {
if (itemsDefinition.Type) {
this.prototype.__type = make.set.Type('*', itemsDefinition.Type, identity);
} else if (itemsDefinition.type) {
this.prototype.__type = make.set.type('*', itemsDefinition.type, identity);
}
}
}
}
}, {
setup: function (items) {
if (!this._define) {
Object.defineProperty(this, '_define', {
enumerable: false,
value: {
definitions: {
length: { type: 'number' },
_length: { type: 'number' }
}
}
});
Object.defineProperty(this, '_data', {
enumerable: false,
value: {}
});
}
define.setup.call(this, {}, false);
Object.defineProperty(this, '_length', {
enumerable: false,
configurable: true,
writable: true,
value: 0
});
if (items) {
this.splice.apply(this, [
0,
0
].concat(canReflect.toArray(items)));
}
},
__type: define.types.observable,
_triggerChange: function (attr, how, newVal, oldVal) {
var index = +attr;
if (!~('' + attr).indexOf('.') && !isNaN(index)) {
var itemsDefinition = this._define.definitions['#'];
if (how === 'add') {
if (itemsDefinition && typeof itemsDefinition.added === 'function') {
Observation.ignore(itemsDefinition.added).call(this, newVal, index);
}
canEvent.dispatch.call(this, how, [
newVal,
index
]);
} else if (how === 'remove') {
if (itemsDefinition && typeof itemsDefinition.removed === 'function') {
Observation.ignore(itemsDefinition.removed).call(this, oldVal, index);
}
canEvent.dispatch.call(this, how, [
oldVal,
index
]);
} else {
canEvent.dispatch.call(this, how, [
newVal,
index
]);
}
} else {
canEvent.dispatch.call(this, {
type: '' + attr,
target: this
}, [
newVal,
oldVal
]);
}
},
get: function (index) {
if (arguments.length) {
Observation.add(this, '' + index);
return this[index];
} else {
return canReflect.unwrap(this, CIDMap);
}
},
set: function (prop, value) {
if (typeof prop !== 'object') {
prop = isNaN(+prop) || prop % 1 ? prop : +prop;
if (typeof prop === 'number') {
if (typeof prop === 'number' && prop > this._length - 1) {
var newArr = new Array(prop + 1 - this._length);
newArr[newArr.length - 1] = value;
this.push.apply(this, newArr);
return newArr;
}
this.splice(prop, 1, value);
} else {
var defined = defineHelpers.defineExpando(this, prop, value);
if (!defined) {
this[prop] = value;
}
}
} else {
canDev.warn('can-define/list/list.prototype.set is deprecated; please use can-define/list/list.prototype.assign or can-define/list/list.prototype.update instead');
if (canReflect.isListLike(prop)) {
if (value) {
this.replace(prop);
} else {
canReflect.assignList(this, prop);
}
} else {
canReflect.assignMap(this, prop);
}
}
return this;
},
assign: function (prop) {
if (canReflect.isListLike(prop)) {
canReflect.assignList(this, prop);
} else {
canReflect.assignMap(this, prop);
}
return this;
},
update: function (prop) {
if (canReflect.isListLike(prop)) {
canReflect.updateList(this, prop);
} else {
canReflect.updateMap(this, prop);
}
return this;
},
assignDeep: function (prop) {
if (canReflect.isListLike(prop)) {
canReflect.assignDeepList(this, prop);
} else {
canReflect.assignDeepMap(this, prop);
}
return this;
},
updateDeep: function (prop) {
if (canReflect.isListLike(prop)) {
canReflect.updateDeepList(this, prop);
} else {
canReflect.updateDeepMap(this, prop);
}
return this;
},
_items: function () {
var arr = [];
this._each(function (item) {
arr.push(item);
});
return arr;
},
_each: function (callback) {
for (var i = 0, len = this._length; i < len; i++) {
callback(this[i], i);
}
},
splice: function (index, howMany) {
var args = makeArray(arguments), added = [], i, len, listIndex, allSame = args.length > 2;
index = index || 0;
for (i = 0, len = args.length - 2; i < len; i++) {
listIndex = i + 2;
args[listIndex] = this.__type(args[listIndex], listIndex);
added.push(args[listIndex]);
if (this[i + index] !== args[listIndex]) {
allSame = false;
}
}
if (allSame && this._length <= added.length) {
return added;
}
if (howMany === undefined) {
howMany = args[1] = this._length - index;
}
runningNative = true;
var removed = splice.apply(this, args);
runningNative = false;
canBatch.start();
if (howMany > 0) {
this._triggerChange('' + index, 'remove', undefined, removed);
}
if (args.length > 2) {
this._triggerChange('' + index, 'add', added, removed);
}
canEvent.dispatch.call(this, 'length', [this._length]);
canBatch.stop();
return removed;
},
serialize: function () {
return canReflect.serialize(this, CIDMap);
}
});
var getArgs = function (args) {
return args[0] && Array.isArray(args[0]) ? args[0] : makeArray(args);
};
each({
push: 'length',
unshift: 0
}, function (where, name) {
var orig = [][name];
DefineList.prototype[name] = function () {
var args = [], len = where ? this._length : 0, i = arguments.length, res, val;
while (i--) {
val = arguments[i];
args[i] = this.__type(val, i);
}
runningNative = true;
res = orig.apply(this, args);
runningNative = false;
if (!this.comparator || args.length) {
canBatch.start();
this._triggerChange('' + len, 'add', args, undefined);
canEvent.dispatch.call(this, 'length', [this._length]);
canBatch.stop();
}
return res;
};
});
each({
pop: 'length',
shift: 0
}, function (where, name) {
var orig = [][name];
DefineList.prototype[name] = function () {
if (!this._length) {
return undefined;
}
var args = getArgs(arguments), len = where && this._length ? this._length - 1 : 0, res;
runningNative = true;
res = orig.apply(this, args);
runningNative = false;
canBatch.start();
this._triggerChange('' + len, 'remove', undefined, [res]);
canEvent.dispatch.call(this, 'length', [this._length]);
canBatch.stop();
return res;
};
});
each({
'map': 3,
'filter': 3,
'reduce': 4,
'reduceRight': 4,
'every': 3,
'some': 3
}, function a(fnLength, fnName) {
DefineList.prototype[fnName] = function () {
var self = this;
var args = [].slice.call(arguments, 0);
var callback = args[0];
var thisArg = args[fnLength - 1] || self;
if (typeof callback === 'object') {
callback = makeFilterCallback(callback);
}
args[0] = function () {
var cbArgs = [].slice.call(arguments, 0);
cbArgs[fnLength - 3] = self.get(cbArgs[fnLength - 2]);
return callback.apply(thisArg, cbArgs);
};
var ret = Array.prototype[fnName].apply(this, args);
if (fnName === 'map') {
return new DefineList(ret);
} else if (fnName === 'filter') {
return new self.constructor(ret);
} else {
return ret;
}
};
});
assign(DefineList.prototype, {
indexOf: function (item, fromIndex) {
for (var i = fromIndex || 0, len = this.length; i < len; i++) {
if (this.get(i) === item) {
return i;
}
}
return -1;
},
lastIndexOf: function (item, fromIndex) {
fromIndex = typeof fromIndex === 'undefined' ? this.length - 1 : fromIndex;
for (var i = fromIndex; i >= 0; i--) {
if (this.get(i) === item) {
return i;
}
}
return -1;
},
join: function () {
Observation.add(this, 'length');
return [].join.apply(this, arguments);
},
reverse: function () {
var list = [].reverse.call(this._items());
return this.replace(list);
},
slice: function () {
Observation.add(this, 'length');
var temp = Array.prototype.slice.apply(this, arguments);
return new this.constructor(temp);
},
concat: function () {
var args = [];
each(arguments, function (arg) {
if (canReflect.isListLike(arg)) {
var arr = Array.isArray(arg) ? arg : makeArray(arg);
arr.forEach(function (innerArg) {
args.push(this.__type(innerArg));
}, this);
} else {
args.push(this.__type(arg));
}
}, this);
return new this.constructor(Array.prototype.concat.apply(makeArray(this), args));
},
forEach: function (cb, thisarg) {
var item;
for (var i = 0, len = this.length; i < len; i++) {
item = this.get(i);
if (cb.call(thisarg || item, item, i, this) === false) {
break;
}
}
return this;
},
replace: function (newList) {
var patches = diff(this, newList);
canBatch.start();
for (var i = 0, len = patches.length; i < len; i++) {
this.splice.apply(this, [
patches[i].index,
patches[i].deleteCount
].concat(patches[i].insert));
}
canBatch.stop();
return this;
},
sort: function (compareFunction) {
var removed = Array.prototype.slice.call(this);
Array.prototype.sort.call(this, compareFunction);
var added = Array.prototype.slice.call(this);
canBatch.start();
canEvent.dispatch.call(this, 'remove', [
removed,
0
]);
canEvent.dispatch.call(this, 'add', [
added,
0
]);
canEvent.dispatch.call(this, 'length', [
this._length,
this._length
]);
canBatch.stop();
return this;
}
});
for (var prop in define.eventsProto) {
DefineList[prop] = define.eventsProto[prop];
Object.defineProperty(DefineList.prototype, prop, {
enumerable: false,
value: define.eventsProto[prop],
writable: true
});
}
Object.defineProperty(DefineList.prototype, 'length', {
get: function () {
if (!this.__inSetup) {
Observation.add(this, 'length');
}
return this._length;
},
set: function (newVal) {
if (runningNative) {
this._length = newVal;
return;
}
if (newVal == null || isNaN(+newVal) || newVal === this._length) {
return;
}
if (newVal > this._length - 1) {
var newArr = new Array(newVal - this._length);
this.push.apply(this, newArr);
} else {
this.splice(newVal);
}
},
enumerable: true
});
Object.defineProperty(DefineList.prototype, 'each', {
enumerable: false,
writable: true,
value: DefineList.prototype.forEach
});
DefineList.prototype.attr = function (prop, value) {
canLog.warn('DefineMap::attr shouldn\'t be called');
if (arguments.length === 0) {
return this.get();
} else if (prop && typeof prop === 'object') {
return this.set.apply(this, arguments);
} else if (arguments.length === 1) {
return this.get(prop);
} else {
return this.set(prop, value);
}
};
DefineList.prototype.item = function (index, value) {
if (arguments.length === 1) {
return this.get(index);
} else {
return this.set(index, value);
}
};
DefineList.prototype.items = function () {
canLog.warn('DefineList::get should should be used instead of DefineList::items');
return this.get();
};
canReflect.assignSymbols(DefineList.prototype, {
'can.isMoreListLikeThanMapLike': true,
'can.isMapLike': true,
'can.isListLike': true,
'can.isValueLike': false,
'can.getKeyValue': DefineList.prototype.get,
'can.setKeyValue': DefineList.prototype.set,
'can.onKeyValue': function (key, handler) {
var translationHandler;
if (isNaN(key)) {
translationHandler = function (ev, newValue, oldValue) {
handler(newValue, oldValue);
};
this.addEventListener(key, translationHandler);
} else {
translationHandler = function () {
handler(this[key]);
};
singleReference.set(handler, this, translationHandler, key);
this.addEventListener('length', translationHandler);
}
},
'can.offKeyValue': function (key, handler) {
var translationHandler;
if (isNaN(key)) {
translationHandler = function (ev, newValue, oldValue) {
handler(newValue, oldValue);
};
this.removeEventListener(key, translationHandler);
} else {
translationHandler = singleReference.getAndDelete(handler, this, key);
this.removeEventListener('length', translationHandler);
}
},
'can.deleteKeyValue': function (prop) {
prop = isNaN(+prop) || prop % 1 ? prop : +prop;
if (typeof prop === 'number') {
this.splice(prop, 1);
} else if (prop === 'length' || prop === '_length') {
return;
} else {
this.set(prop, undefined);
}
return this;
},
'can.assignDeep': function (source) {
canBatch.start();
canReflect.assignList(this, source);
canBatch.stop();
},
'can.updateDeep': function (source) {
canBatch.start();
this.replace(source);
canBatch.stop();
},
'can.keyHasDependencies': function (key) {
return !!(this._computed && this._computed[key] && this._computed[key].compute);
},
'can.getKeyDependencies': function (key) {
var ret;
if (this._computed && this._computed[key] && this._computed[key].compute) {
ret = {};
ret.valueDependencies = new CIDSet();
ret.valueDependencies.add(this._computed[key].compute);
}
return ret;
},
'can.onKeysAdded': function (handler) {
this[canSymbol.for('can.onKeyValue')]('add', handler);
},
'can.onKeysRemoved': function (handler) {
this[canSymbol.for('can.onKeyValue')]('remove', handler);
},
'can.splice': function (index, deleteCount, insert) {
this.splice.apply(this, [
index,
deleteCount
].concat(insert));
}
});
canReflect.setKeyValue(DefineList.prototype, canSymbol.iterator, function () {
var index = -1;
if (typeof this._length !== 'number') {
this._length = 0;
}
return {
next: function () {
index++;
return {
value: this[index],
done: index >= this._length
};
}.bind(this)
};
});
types.DefineList = DefineList;
types.DefaultList = DefineList;
module.exports = ns.DefineList = DefineList;
});
/*can-deparam@1.0.1#can-deparam*/
define('can-deparam', [
'require',
'exports',
'module',
'can-namespace'
], function (require, exports, module) {
var namespace = require('can-namespace');
var digitTest = /^\d+$/, keyBreaker = /([^\[\]]+)|(\[\])/g, paramTest = /([^?#]*)(#.*)?$/, entityRegex = /%([^0-9a-f][0-9a-f]|[0-9a-f][^0-9a-f]|[^0-9a-f][^0-9a-f])/i, prep = function (str) {
str = str.replace(/\+/g, ' ');
try {
return decodeURIComponent(str);
} catch (e) {
return decodeURIComponent(str.replace(entityRegex, function (match, hex) {
return '%25' + hex;
}));
}
};
module.exports = namespace.deparam = function (params) {
var data = {}, pairs, lastPart;
if (params && paramTest.test(params)) {
pairs = params.split('&');
pairs.forEach(function (pair) {
var parts = pair.split('='), key = prep(parts.shift()), value = prep(parts.join('=')), current = data;
if (key) {
parts = key.match(keyBreaker);
for (var j = 0, l = parts.length - 1; j < l; j++) {
if (!current[parts[j]]) {
current[parts[j]] = digitTest.test(parts[j + 1]) || parts[j + 1] === '[]' ? [] : {};
}
current = current[parts[j]];
}
lastPart = parts.pop();
if (lastPart === '[]') {
current.push(value);
} else {
current[lastPart] = value;
}
}
});
}
return data;
};
});
/*can-util@3.10.11#js/is-web-worker/is-web-worker*/
define('can-util/js/is-web-worker/is-web-worker', function (require, exports, module) {
(function (global) {
'use strict';
module.exports = function () {
return typeof WorkerGlobalScope !== 'undefined' && this instanceof WorkerGlobalScope;
};
}(function () {
return this;
}()));
});
/*can-util@3.10.11#js/is-browser-window/is-browser-window*/
define('can-util/js/is-browser-window/is-browser-window', [
'require',
'exports',
'module',
'can-globals/is-browser-window/is-browser-window'
], function (require, exports, module) {
(function (global) {
'use strict';
module.exports = require('can-globals/is-browser-window/is-browser-window');
}(function () {
return this;
}()));
});
/*can-util@3.10.11#js/diff-object/diff-object*/
define('can-util/js/diff-object/diff-object', [
'require',
'exports',
'module',
'can-assign'
], function (require, exports, module) {
'use strict';
var assign = require('can-assign');
module.exports = exports = function (oldObject, newObject) {
var oldObjectClone, patches = [];
oldObjectClone = assign({}, oldObject);
for (var newProp in newObject) {
if (!oldObject || !oldObject.hasOwnProperty(newProp)) {
patches.push({
property: newProp,
type: 'add',
value: newObject[newProp]
});
} else if (newObject[newProp] !== oldObject[newProp]) {
patches.push({
property: newProp,
type: 'set',
value: newObject[newProp]
});
}
delete oldObjectClone[newProp];
}
for (var oldProp in oldObjectClone) {
patches.push({
property: oldProp,
type: 'remove'
});
}
return patches;
};
});
/*can-route@3.2.3#can-route*/
define('can-route', [
'require',
'exports',
'module',
'can-event/batch/batch',
'can-event',
'can-observation',
'can-compute',
'can-namespace',
'can-param',
'can-deparam',
'can-util/js/each/each',
'can-util/js/string/string',
'can-util/js/is-function/is-function',
'can-util/js/is-empty-object/is-empty-object',
'can-util/js/deep-assign/deep-assign',
'can-util/js/is-web-worker/is-web-worker',
'can-util/js/is-browser-window/is-browser-window',
'can-util/js/make-array/make-array',
'can-util/js/assign/assign',
'can-types',
'can-util/js/dev/dev',
'can-util/js/diff/diff',
'can-util/js/diff-object/diff-object',
'can-reflect',
'can-symbol'
], function (require, exports, module) {
var canBatch = require('can-event/batch/batch');
var canEvent = require('can-event');
var Observation = require('can-observation');
var compute = require('can-compute');
var namespace = require('can-namespace');
var param = require('can-param');
var deparam = require('can-deparam');
var each = require('can-util/js/each/each');
var string = require('can-util/js/string/string');
var isFunction = require('can-util/js/is-function/is-function');
var isEmptyObject = require('can-util/js/is-empty-object/is-empty-object');
var deepAssign = require('can-util/js/deep-assign/deep-assign');
var isWebWorker = require('can-util/js/is-web-worker/is-web-worker');
var isBrowserWindow = require('can-util/js/is-browser-window/is-browser-window');
var makeArray = require('can-util/js/make-array/make-array');
var assign = require('can-util/js/assign/assign');
var types = require('can-types');
var dev = require('can-util/js/dev/dev');
var diff = require('can-util/js/diff/diff');
var diffObject = require('can-util/js/diff-object/diff-object');
var canReflect = require('can-reflect');
var canSymbol = require('can-symbol');
var curliesMatcher = /\{\s*([\w.]+)\s*\}/g;
var colonMatcher = /\:([\w.]+)/g;
var paramsMatcher = /^(?:&[^=]+=[^&]*)+/;
var makeProps = function (props) {
var tags = [];
each(props, function (val, name) {
tags.push((name === 'className' ? 'class' : name) + '="' + (name === 'href' ? val : string.esc(val)) + '"');
});
return tags.join(' ');
};
var matchesData = function (route, data) {
var count = 0, i = 0, defaults = {};
for (var name in route.defaults) {
if (route.defaults[name] === data[name]) {
defaults[name] = 1;
count++;
}
}
for (; i < route.names.length; i++) {
if (!data.hasOwnProperty(route.names[i])) {
return -1;
}
if (!defaults[route.names[i]]) {
count++;
}
}
return count;
};
var location = typeof window !== 'undefined' ? window.location : {};
var wrapQuote = function (str) {
return (str + '').replace(/([.?*+\^$\[\]\\(){}|\-])/g, '\\$1');
};
var attrHelper = function (prop, value) {
if ('attr' in this) {
return this.attr.apply(this, arguments);
} else {
if (arguments.length > 1) {
canReflect.setKeyValue(this, prop, value);
return this;
} else if (typeof prop === 'object') {
canReflect.assignDeep(this, prop);
return this;
} else if (arguments.length === 1) {
return canReflect.getKeyValue(this, prop);
} else {
return canReflect.unwrap(this);
}
}
};
var stringify = function (obj) {
if (obj && typeof obj === 'object') {
if (obj && typeof obj === 'object' && 'serialize' in obj) {
obj = obj.serialize();
} else {
obj = isFunction(obj.slice) ? obj.slice() : assign({}, obj);
}
each(obj, function (val, prop) {
obj[prop] = stringify(val);
});
} else if (obj !== undefined && obj !== null && isFunction(obj.toString)) {
obj = obj.toString();
}
return obj;
};
var removeBackslash = function (str) {
return str.replace(/\\/g, '');
};
var timer;
var curParams;
var lastHash;
var changingData;
var changedAttrs = [];
var eventsObject = assign({}, canEvent);
var canRoute = function (url, defaults) {
var root = canRoute._call('root');
if (root.lastIndexOf('/') === root.length - 1 && url.indexOf('/') === 0) {
url = url.substr(1);
}
defaults = defaults || {};
var names = [], res, test = '', matcher, lastIndex, next, querySeparator = canRoute._call('querySeparator'), matchSlashes = canRoute._call('matchSlashes');
if (colonMatcher.test(url)) {
matcher = colonMatcher;
dev.warn('update route "' + url + '" to "' + url.replace(colonMatcher, function (name, key) {
return '{' + key + '}';
}) + '"');
} else {
matcher = curliesMatcher;
}
lastIndex = matcher.lastIndex = 0;
while (res = matcher.exec(url)) {
names.push(res[1]);
test += removeBackslash(url.substring(lastIndex, matcher.lastIndex - res[0].length));
next = '\\' + (removeBackslash(url.substr(matcher.lastIndex, 1)) || querySeparator + (matchSlashes ? '' : '|/'));
test += '([^' + next + ']' + (defaults[res[1]] ? '*' : '+') + ')';
lastIndex = matcher.lastIndex;
}
test += url.substr(lastIndex).replace('\\', '');
each(canRoute.routes, function (r) {
var existingKeys = r.names.concat(Object.keys(r.defaults)).sort();
var keys = names.concat(Object.keys(defaults)).sort();
var sameMapKeys = !diff(existingKeys, keys).length;
var sameDefaultValues = !diffObject(r.defaults, defaults).length;
var matchingRoutesWithoutTrailingSlash = r.route.replace(/\/$/, '') === url.replace(/\/$/, '');
if (sameMapKeys && sameDefaultValues && !matchingRoutesWithoutTrailingSlash) {
dev.warn('two routes were registered with matching keys:\n' + '\t(1) route("' + r.route + '", ' + JSON.stringify(r.defaults) + ')\n' + '\t(2) route("' + url + '", ' + JSON.stringify(defaults) + ')\n' + '(1) will always be chosen since it was registered first');
}
});
canRoute.routes[url] = {
test: new RegExp('^' + test + '($|' + wrapQuote(querySeparator) + ')'),
route: url,
names: names,
defaults: defaults,
length: url.split('/').length
};
return canRoute;
};
var oldProperties = null;
var onRouteDataChange = function (ev, newProps, oldProps) {
changingData = 1;
if (!oldProperties) {
oldProperties = oldProps;
}
clearTimeout(timer);
timer = setTimeout(function () {
var old = oldProperties;
oldProperties = null;
changingData = 0;
var serialized = canRoute.data.serialize(), path = canRoute.param(serialized, true);
canRoute._call('setURL', path, newProps, old);
canEvent.dispatch.call(eventsObject, '__url', [
path,
lastHash
]);
lastHash = path;
changedAttrs = [];
}, 10);
};
var stringCoercingMapDecorator = function (map) {
var sym = canSymbol.for('can.route.stringCoercingMapDecorator');
if (!map.attr[sym]) {
var attrSuper = map.attr;
map.attr = function (prop, val) {
var serializable = this.define === undefined || this.define[prop] === undefined || !!this.define[prop].serialize, args;
if (serializable) {
args = stringify(Array.apply(null, arguments));
} else {
args = arguments;
}
return attrSuper.apply(this, args);
};
canReflect.setKeyValue(map.attr, sym, true);
}
return map;
};
var recursiveClean = function (old, cur, data) {
for (var attr in old) {
if (cur[attr] === undefined) {
if ('removeAttr' in data) {
data.removeAttr(attr);
} else {
cur[attr] = undefined;
}
} else if (Object.prototype.toString.call(old[attr]) === '[object Object]') {
recursiveClean(old[attr], cur[attr], attrHelper.call(data, attr));
}
}
};
var matchCheck = function (source, matcher) {
for (var prop in source) {
var s = source[prop], m = matcher[prop];
if (s && m && typeof s === 'object' && typeof matcher === 'object') {
return matchCheck(s, m);
}
if (s != m) {
return false;
}
}
return true;
};
var setState = canRoute.setState = function () {
var hash = canRoute._call('matchingPartOfURL');
var oldParams = curParams;
curParams = canRoute.deparam(hash);
var matched;
if (!changingData || hash !== lastHash) {
canRoute.batch.start();
recursiveClean(oldParams, curParams, canRoute.data);
matched = curParams.route;
delete curParams.route;
canRoute.matched(matched);
canRoute.attr(curParams);
curParams.route = matched;
canEvent.dispatch.call(eventsObject, '__url', [
hash,
lastHash
]);
canRoute.batch.stop();
}
};
var decode = function (str) {
try {
return decodeURIComponent(str);
} catch (ex) {
return unescape(str);
}
};
assign(canRoute, {
param: function (data, _setRoute) {
var route, matches = 0, matchCount, routeName = data.route, propCount = 0, cpy, res, after, matcher;
delete data.route;
each(data, function () {
propCount++;
});
each(canRoute.routes, function (temp, name) {
matchCount = matchesData(temp, data);
if (matchCount > matches) {
route = temp;
matches = matchCount;
}
if (matchCount >= propCount) {
return false;
}
});
if (canRoute.routes[routeName] && matchesData(canRoute.routes[routeName], data) === matches) {
route = canRoute.routes[routeName];
}
if (route) {
cpy = assign({}, data);
matcher = colonMatcher.test(route.route) ? colonMatcher : curliesMatcher;
res = route.route.replace(matcher, function (whole, name) {
delete cpy[name];
return data[name] === route.defaults[name] ? '' : encodeURIComponent(data[name]);
}).replace('\\', '');
each(route.defaults, function (val, name) {
if (cpy[name] === val) {
delete cpy[name];
}
});
after = param(cpy);
if (_setRoute) {
canRoute.matched(route.route);
}
return res + (after ? canRoute._call('querySeparator') + after : '');
}
return isEmptyObject(data) ? '' : canRoute._call('querySeparator') + param(data);
},
deparam: function (url) {
var root = canRoute._call('root');
if (root.lastIndexOf('/') === root.length - 1 && url.indexOf('/') === 0) {
url = url.substr(1);
}
var route = { length: -1 }, querySeparator = canRoute._call('querySeparator'), paramsMatcher = canRoute._call('paramsMatcher');
each(canRoute.routes, function (temp, name) {
if (temp.test.test(url) && temp.length > route.length) {
route = temp;
}
});
if (route.length > -1) {
var parts = url.match(route.test), start = parts.shift(), remainder = url.substr(start.length - (parts[parts.length - 1] === querySeparator ? 1 : 0)), obj = remainder && paramsMatcher.test(remainder) ? deparam(remainder.slice(1)) : {};
obj = deepAssign(true, {}, route.defaults, obj);
each(parts, function (part, i) {
if (part && part !== querySeparator) {
obj[route.names[i]] = decode(part);
}
});
obj.route = route.route;
return obj;
}
if (url.charAt(0) !== querySeparator) {
url = querySeparator + url;
}
return paramsMatcher.test(url) ? deparam(url.slice(1)) : {};
},
map: function (data) {
dev.warn('Set route.data directly instead of calling route.map');
canRoute.data = data;
},
routes: {},
ready: function (val) {
if (val !== true) {
canRoute._setup();
if (isBrowserWindow() || isWebWorker()) {
canRoute.setState();
}
}
return canRoute;
},
url: function (options, merge) {
if (merge) {
Observation.add(eventsObject, '__url');
var baseOptions = canRoute.deparam(canRoute._call('matchingPartOfURL'));
options = assign(assign({}, baseOptions), options);
}
return canRoute._call('root') + canRoute.param(options);
},
link: function (name, options, props, merge) {
return '<a ' + makeProps(assign({ href: canRoute.url(options, merge) }, props)) + '>' + name + '</a>';
},
current: function (options, subsetMatch) {
Observation.add(eventsObject, '__url');
if (subsetMatch) {
var baseOptions = canRoute.deparam(canRoute._call('matchingPartOfURL'));
return matchCheck(options, baseOptions);
} else {
return this._call('matchingPartOfURL') === canRoute.param(options);
}
},
bindings: {
hashchange: {
paramsMatcher: paramsMatcher,
querySeparator: '&',
matchSlashes: false,
bind: function () {
canEvent.on.call(window, 'hashchange', setState);
},
unbind: function () {
canEvent.on.call(window, 'hashchange', setState);
},
matchingPartOfURL: function () {
var loc = canRoute.location || location;
return loc.href.split(/#!?/)[1] || '';
},
setURL: function (path) {
if (location.hash !== '#' + path) {
location.hash = '!' + path;
}
return path;
},
root: '#!'
}
},
defaultBinding: 'hashchange',
currentBinding: null,
_setup: function () {
if (!canRoute.currentBinding) {
canRoute._call('bind');
canRoute.serializedCompute.addEventListener('change', onRouteDataChange);
canRoute.currentBinding = canRoute.defaultBinding;
}
},
_teardown: function () {
if (canRoute.currentBinding) {
canRoute._call('unbind');
canRoute.serializedCompute.removeEventListener('change', onRouteDataChange);
canRoute.currentBinding = null;
}
clearTimeout(timer);
changingData = 0;
},
_call: function () {
var args = makeArray(arguments), prop = args.shift(), binding = canRoute.bindings[canRoute.currentBinding || canRoute.defaultBinding], method = binding[prop];
if (method.apply) {
return method.apply(binding, args);
} else {
return method;
}
},
matched: compute()
});
each([
'addEventListener',
'removeEventListener',
'bind',
'unbind',
'on',
'off',
'delegate',
'undelegate',
'removeAttr',
'compute',
'_get',
'___get',
'each'
], function (name) {
canRoute[name] = function () {
if (!canRoute.data[name]) {
return;
}
return canRoute.data[name].apply(canRoute.data, arguments);
};
});
var routeData;
var setRouteData = function (data) {
routeData = data;
return routeData;
};
var serializedCompute;
Object.defineProperty(canRoute, 'serializedCompute', {
get: function () {
if (!serializedCompute) {
serializedCompute = compute(function () {
return canRoute.data.serialize();
});
}
return serializedCompute;
}
});
Object.defineProperty(canRoute, 'data', {
get: function () {
if (routeData) {
return routeData;
} else if (types.DefaultMap) {
if (types.DefaultMap.prototype.toObject) {
var DefaultRouteMap = types.DefaultMap.extend({ seal: false }, { '*': 'stringOrObservable' });
return setRouteData(new DefaultRouteMap());
} else {
return setRouteData(stringCoercingMapDecorator(new types.DefaultMap()));
}
} else {
throw new Error('can.route.data accessed without being set');
}
},
set: function (data) {
if (canReflect.isConstructorLike(data)) {
data = new data();
}
if ('attr' in data) {
setRouteData(stringCoercingMapDecorator(data));
} else {
setRouteData(data);
}
}
});
canRoute.attr = function () {
return attrHelper.apply(canRoute.data, arguments);
};
canRoute.batch = canBatch;
canReflect.setKeyValue(canRoute, canSymbol.for('can.isFunctionLike'), false);
module.exports = namespace.route = canRoute;
});
/*can-view-target@3.1.4#can-view-target*/
define('can-view-target', [
'require',
'exports',
'module',
'can-util/dom/child-nodes/child-nodes',
'can-util/dom/attr/attr',
'can-util/js/each/each',
'can-util/js/make-array/make-array',
'can-util/dom/document/document',
'can-util/dom/mutate/mutate',
'can-namespace',
'can-globals/mutation-observer/mutation-observer'
], function (require, exports, module) {
(function (global) {
var childNodes = require('can-util/dom/child-nodes/child-nodes');
var domAttr = require('can-util/dom/attr/attr');
var each = require('can-util/js/each/each');
var makeArray = require('can-util/js/make-array/make-array');
var getDocument = require('can-util/dom/document/document');
var domMutate = require('can-util/dom/mutate/mutate');
var namespace = require('can-namespace');
var MUTATION_OBSERVER = require('can-globals/mutation-observer/mutation-observer');
var processNodes = function (nodes, paths, location, document) {
var frag = document.createDocumentFragment();
for (var i = 0, len = nodes.length; i < len; i++) {
var node = nodes[i];
frag.appendChild(processNode(node, paths, location.concat(i), document));
}
return frag;
}, keepsTextNodes = typeof document !== 'undefined' && function () {
var testFrag = document.createDocumentFragment();
var div = document.createElement('div');
div.appendChild(document.createTextNode(''));
div.appendChild(document.createTextNode(''));
testFrag.appendChild(div);
var cloned = testFrag.cloneNode(true);
return childNodes(cloned.firstChild).length === 2;
}(), clonesWork = typeof document !== 'undefined' && function () {
var el = document.createElement('a');
el.innerHTML = '<xyz></xyz>';
var clone = el.cloneNode(true);
var works = clone.innerHTML === '<xyz></xyz>';
var MO, observer;
if (works) {
el = document.createDocumentFragment();
el.appendChild(document.createTextNode('foo-bar'));
MO = MUTATION_OBSERVER();
if (MO) {
observer = new MO(function () {
});
observer.observe(document.documentElement, {
childList: true,
subtree: true
});
clone = el.cloneNode(true);
observer.disconnect();
} else {
clone = el.cloneNode(true);
}
return clone.childNodes.length === 1;
}
return works;
}(), namespacesWork = typeof document !== 'undefined' && !!document.createElementNS;
var cloneNode = clonesWork ? function (el) {
return el.cloneNode(true);
} : function (node) {
var document = node.ownerDocument;
var copy;
if (node.nodeType === 1) {
if (node.namespaceURI !== 'http://www.w3.org/1999/xhtml' && namespacesWork && document.createElementNS) {
copy = document.createElementNS(node.namespaceURI, node.nodeName);
} else {
copy = document.createElement(node.nodeName);
}
} else if (node.nodeType === 3) {
copy = document.createTextNode(node.nodeValue);
} else if (node.nodeType === 8) {
copy = document.createComment(node.nodeValue);
} else if (node.nodeType === 11) {
copy = document.createDocumentFragment();
}
if (node.attributes) {
var attributes = makeArray(node.attributes);
each(attributes, function (node) {
if (node && node.specified) {
domAttr.setAttribute(copy, node.nodeName || node.name, node.nodeValue || node.value);
}
});
}
if (node && node.firstChild) {
var child = node.firstChild;
while (child) {
copy.appendChild(cloneNode(child));
child = child.nextSibling;
}
}
return copy;
};
function processNode(node, paths, location, document) {
var callback, loc = location, nodeType = typeof node, el, p, i, len;
var getCallback = function () {
if (!callback) {
callback = {
path: location,
callbacks: []
};
paths.push(callback);
loc = [];
}
return callback;
};
if (nodeType === 'object') {
if (node.tag) {
if (namespacesWork && node.namespace) {
el = document.createElementNS(node.namespace, node.tag);
} else {
el = document.createElement(node.tag);
}
if (node.attrs) {
for (var attrName in node.attrs) {
var value = node.attrs[attrName];
if (typeof value === 'function') {
getCallback().callbacks.push({ callback: value });
} else {
domAttr.setAttribute(el, attrName, value);
}
}
}
if (node.attributes) {
for (i = 0, len = node.attributes.length; i < len; i++) {
getCallback().callbacks.push({ callback: node.attributes[i] });
}
}
if (node.children && node.children.length) {
if (callback) {
p = callback.paths = [];
} else {
p = paths;
}
el.appendChild(processNodes(node.children, p, loc, document));
}
} else if (node.comment) {
el = document.createComment(node.comment);
if (node.callbacks) {
for (i = 0, len = node.attributes.length; i < len; i++) {
getCallback().callbacks.push({ callback: node.callbacks[i] });
}
}
}
} else if (nodeType === 'string') {
el = document.createTextNode(node);
} else if (nodeType === 'function') {
if (keepsTextNodes) {
el = document.createTextNode('');
getCallback().callbacks.push({ callback: node });
} else {
el = document.createComment('~');
getCallback().callbacks.push({
callback: function () {
var el = document.createTextNode('');
domMutate.replaceChild.call(this.parentNode, el, this);
return node.apply(el, arguments);
}
});
}
}
return el;
}
function getCallbacks(el, pathData, elementCallbacks) {
var path = pathData.path, callbacks = pathData.callbacks, paths = pathData.paths, child = el, pathLength = path ? path.length : 0, pathsLength = paths ? paths.length : 0;
for (var i = 0; i < pathLength; i++) {
child = child.childNodes.item(path[i]);
}
for (i = 0; i < pathsLength; i++) {
getCallbacks(child, paths[i], elementCallbacks);
}
elementCallbacks.push({
element: child,
callbacks: callbacks
});
}
function hydrateCallbacks(callbacks, args) {
var len = callbacks.length, callbacksLength, callbackElement, callbackData;
for (var i = 0; i < len; i++) {
callbackData = callbacks[i];
callbacksLength = callbackData.callbacks.length;
callbackElement = callbackData.element;
for (var c = 0; c < callbacksLength; c++) {
callbackData.callbacks[c].callback.apply(callbackElement, args);
}
}
}
function makeTarget(nodes, doc) {
var paths = [];
var frag = processNodes(nodes, paths, [], doc || getDocument());
return {
paths: paths,
clone: frag,
hydrate: function () {
var cloned = cloneNode(this.clone);
var args = makeArray(arguments);
var callbacks = [];
for (var i = 0; i < paths.length; i++) {
getCallbacks(cloned, paths[i], callbacks);
}
hydrateCallbacks(callbacks, args);
return cloned;
}
};
}
makeTarget.keepsTextNodes = keepsTextNodes;
makeTarget.cloneNode = cloneNode;
namespace.view = namespace.view || {};
module.exports = namespace.view.target = makeTarget;
}(function () {
return this;
}()));
});
/*can-stache@3.9.0#src/mustache_core*/
define('can-stache/src/mustache_core', [
'require',
'exports',
'module',
'can-view-live',
'can-view-nodelist',
'can-compute',
'can-observation',
'can-stache/src/utils',
'can-stache/src/expression',
'can-util/dom/frag/frag',
'can-util/dom/attr/attr',
'can-symbol',
'can-reflect'
], function (require, exports, module) {
var live = require('can-view-live');
var nodeLists = require('can-view-nodelist');
var compute = require('can-compute');
var Observation = require('can-observation');
var utils = require('can-stache/src/utils');
var expression = require('can-stache/src/expression');
var frag = require('can-util/dom/frag/frag');
var attr = require('can-util/dom/attr/attr');
var canSymbol = require('can-symbol');
var canReflect = require('can-reflect');
var mustacheLineBreakRegExp = /(?:(^|\r?\n)(\s*)(\{\{([\s\S]*)\}\}\}?)([^\S\n\r]*)($|\r?\n))|(\{\{([\s\S]*)\}\}\}?)/g, mustacheWhitespaceRegExp = /(\s*)(\{\{\{?)(-?)([\s\S]*?)(-?)(\}\}\}?)(\s*)/g, k = function () {
};
var core = {
expression: expression,
makeEvaluator: function (scope, helperOptions, nodeList, mode, exprData, truthyRenderer, falseyRenderer, stringOnly) {
if (mode === '^') {
var temp = truthyRenderer;
truthyRenderer = falseyRenderer;
falseyRenderer = temp;
}
var value, helperOptionArg;
if (exprData instanceof expression.Call) {
helperOptionArg = {
context: scope.peek('.'),
scope: scope,
nodeList: nodeList,
exprData: exprData,
helpersScope: helperOptions
};
utils.convertToScopes(helperOptionArg, scope, helperOptions, nodeList, truthyRenderer, falseyRenderer, stringOnly);
value = exprData.value(scope, helperOptions, helperOptionArg);
if (exprData.isHelper) {
return value;
}
} else if (exprData instanceof expression.Bracket) {
value = exprData.value(scope);
if (exprData.isHelper) {
return value;
}
} else if (exprData instanceof expression.Lookup) {
value = exprData.value(scope);
if (exprData.isHelper) {
return value;
}
} else if (exprData instanceof expression.Helper && exprData.methodExpr instanceof expression.Bracket) {
value = exprData.methodExpr.value(scope);
if (exprData.isHelper) {
return value;
}
} else {
var readOptions = {
isArgument: true,
args: [
scope.peek('.'),
scope
],
asCompute: true
};
var helperAndValue = exprData.helperAndValue(scope, helperOptions, readOptions, nodeList, truthyRenderer, falseyRenderer, stringOnly);
var helper = helperAndValue.helper;
value = helperAndValue.value;
if (helper) {
return exprData.evaluator(helper, scope, helperOptions, readOptions, nodeList, truthyRenderer, falseyRenderer, stringOnly);
}
}
if (!mode) {
return value;
} else if (mode === '#' || mode === '^') {
helperOptionArg = {};
utils.convertToScopes(helperOptionArg, scope, helperOptions, nodeList, truthyRenderer, falseyRenderer, stringOnly);
return function () {
var finalValue = canReflect.getValue(value);
if (typeof finalValue === 'function') {
return finalValue;
} else if (typeof finalValue !== 'string' && utils.isArrayLike(finalValue)) {
var isObserveList = canReflect.isObservableLike(finalValue) && canReflect.isListLike(finalValue);
if (isObserveList ? finalValue.attr('length') : finalValue.length) {
if (stringOnly) {
return utils.getItemsStringContent(finalValue, isObserveList, helperOptionArg, helperOptions);
} else {
return frag(utils.getItemsFragContent(finalValue, helperOptionArg, scope));
}
} else {
return helperOptionArg.inverse(scope, helperOptions);
}
} else {
return finalValue ? helperOptionArg.fn(finalValue || scope, helperOptions) : helperOptionArg.inverse(scope, helperOptions);
}
};
} else {
}
},
makeLiveBindingPartialRenderer: function (expressionString, state) {
expressionString = expressionString.trim();
var exprData, partialName = expressionString.split(/\s+/).shift();
if (partialName !== expressionString) {
exprData = core.expression.parse(expressionString);
}
return function (scope, options, parentSectionNodeList) {
var nodeList = [this];
nodeList.expression = '>' + partialName;
nodeLists.register(nodeList, null, parentSectionNodeList || true, state.directlyNested);
var partialFrag = compute(function () {
var localPartialName = partialName;
if (exprData && exprData.argExprs.length === 1) {
var newContext = canReflect.getValue(exprData.argExprs[0].value(scope, options));
if (typeof newContext === 'undefined') {
dev.warn('The context (' + exprData.argExprs[0].key + ') you passed into the' + 'partial (' + partialName + ') is not defined in the scope!');
} else {
scope = scope.add(newContext);
}
}
var partial = options.peek('partials.' + localPartialName);
partial = partial || options.inlinePartials && options.inlinePartials[localPartialName];
var renderer;
if (partial) {
renderer = function () {
return partial.render ? partial.render(scope, options, nodeList) : partial(scope, options);
};
} else {
var scopePartialName = scope.read(localPartialName, { isArgument: true }).value;
if (scopePartialName === null || !scopePartialName && localPartialName[0] === '*') {
return frag('');
}
if (scopePartialName) {
localPartialName = scopePartialName;
}
renderer = function () {
if (typeof localPartialName === 'function') {
return localPartialName(scope, options, nodeList);
} else {
return core.getTemplateById(localPartialName)(scope, options, nodeList);
}
};
}
var res = Observation.ignore(renderer)();
return frag(res);
});
partialFrag.computeInstance.setPrimaryDepth(nodeList.nesting);
live.html(this, partialFrag, this.parentNode, nodeList);
};
},
makeStringBranchRenderer: function (mode, expressionString) {
var exprData = core.expression.parse(expressionString), fullExpression = mode + expressionString;
if (!(exprData instanceof expression.Helper) && !(exprData instanceof expression.Call)) {
exprData = new expression.Helper(exprData, [], {});
}
var branchRenderer = function branchRenderer(scope, options, truthyRenderer, falseyRenderer) {
var evaluator = scope.__cache[fullExpression];
if (mode || !evaluator) {
evaluator = makeEvaluator(scope, options, null, mode, exprData, truthyRenderer, falseyRenderer, true);
if (!mode) {
scope.__cache[fullExpression] = evaluator;
}
}
var gotObservableValue = evaluator[canSymbol.for('can.onValue')], res;
if (gotObservableValue) {
res = canReflect.getValue(evaluator);
} else {
res = evaluator();
}
return res == null ? '' : '' + res;
};
branchRenderer.exprData = exprData;
return branchRenderer;
},
makeLiveBindingBranchRenderer: function (mode, expressionString, state) {
var exprData = core.expression.parse(expressionString);
if (!(exprData instanceof expression.Helper) && !(exprData instanceof expression.Call) && !(exprData instanceof expression.Bracket) && !(exprData instanceof expression.Lookup)) {
exprData = new expression.Helper(exprData, [], {});
}
var branchRenderer = function branchRenderer(scope, options, parentSectionNodeList, truthyRenderer, falseyRenderer) {
var nodeList = [this];
nodeList.expression = expressionString;
nodeLists.register(nodeList, null, parentSectionNodeList || true, state.directlyNested);
var evaluator = makeEvaluator(scope, options, nodeList, mode, exprData, truthyRenderer, falseyRenderer, state.tag);
var gotObservableValue = evaluator[canSymbol.for('can.onValue')];
var observable;
if (gotObservableValue) {
observable = evaluator;
} else {
observable = new Observation(evaluator, null, { isObservable: false });
}
if (observable instanceof Observation) {
observable.compute._primaryDepth = nodeList.nesting;
} else if (observable.computeInstance) {
observable.computeInstance.setPrimaryDepth(nodeList.nesting);
} else if (observable.observation) {
observable.observation.compute._primaryDepth = nodeList.nesting;
}
canReflect.onValue(observable, k);
var value = canReflect.getValue(observable);
if (typeof value === 'function') {
Observation.ignore(value)(this);
} else if (canReflect.valueHasDependencies(observable)) {
if (state.attr) {
live.attr(this, state.attr, observable);
} else if (state.tag) {
live.attrs(this, observable);
} else if (state.text && typeof value !== 'object') {
live.text(this, observable, this.parentNode, nodeList);
} else {
live.html(this, observable, this.parentNode, nodeList);
}
} else {
if (state.attr) {
attr.set(this, state.attr, value);
} else if (state.tag) {
live.attrs(this, value);
} else if (state.text && typeof value === 'string') {
this.nodeValue = value;
} else if (value != null) {
nodeLists.replace([this], frag(value, this.ownerDocument));
}
}
canReflect.offValue(observable, k);
};
branchRenderer.exprData = exprData;
return branchRenderer;
},
splitModeFromExpression: function (expression, state) {
expression = expression.trim();
var mode = expression.charAt(0);
if ('#/{&^>!<'.indexOf(mode) >= 0) {
expression = expression.substr(1).trim();
} else {
mode = null;
}
if (mode === '{' && state.node) {
mode = null;
}
return {
mode: mode,
expression: expression
};
},
cleanLineEndings: function (template) {
return template.replace(mustacheLineBreakRegExp, function (whole, returnBefore, spaceBefore, special, expression, spaceAfter, returnAfter, spaceLessSpecial, spaceLessExpression, matchIndex) {
spaceAfter = spaceAfter || '';
returnBefore = returnBefore || '';
spaceBefore = spaceBefore || '';
var modeAndExpression = splitModeFromExpression(expression || spaceLessExpression, {});
if (spaceLessSpecial || '>{'.indexOf(modeAndExpression.mode) >= 0) {
return whole;
} else if ('^#!/'.indexOf(modeAndExpression.mode) >= 0) {
spaceBefore = returnBefore + spaceBefore && ' ';
return spaceBefore + special + (matchIndex !== 0 && returnAfter.length ? returnBefore + '\n' : '');
} else {
return spaceBefore + special + spaceAfter + (spaceBefore.length || matchIndex !== 0 ? returnBefore + '\n' : '');
}
});
},
cleanWhitespaceControl: function (template) {
return template.replace(mustacheWhitespaceRegExp, function (whole, spaceBefore, bracketBefore, controlBefore, expression, controlAfter, bracketAfter, spaceAfter, matchIndex) {
if (controlBefore === '-') {
spaceBefore = '';
}
if (controlAfter === '-') {
spaceAfter = '';
}
return spaceBefore + bracketBefore + expression + bracketAfter + spaceAfter;
});
},
Options: utils.Options,
getTemplateById: function () {
}
};
var makeEvaluator = core.makeEvaluator, splitModeFromExpression = core.splitModeFromExpression;
module.exports = core;
});
/*can-stache@3.9.0#src/html_section*/
define('can-stache/src/html_section', [
'require',
'exports',
'module',
'can-view-target',
'can-view-scope',
'can-observation',
'can-stache/src/utils',
'can-stache/src/mustache_core',
'can-util/dom/document/document',
'can-util/js/assign/assign',
'can-util/js/last/last'
], function (require, exports, module) {
var target = require('can-view-target');
var Scope = require('can-view-scope');
var Observation = require('can-observation');
var utils = require('can-stache/src/utils');
var mustacheCore = require('can-stache/src/mustache_core');
var getDocument = require('can-util/dom/document/document');
var assign = require('can-util/js/assign/assign');
var last = require('can-util/js/last/last');
var decodeHTML = typeof document !== 'undefined' && function () {
var el = getDocument().createElement('div');
return function (html) {
if (html.indexOf('&') === -1) {
return html.replace(/\r\n/g, '\n');
}
el.innerHTML = html;
return el.childNodes.length === 0 ? '' : el.childNodes.item(0).nodeValue;
};
}();
var HTMLSectionBuilder = function () {
this.stack = [new HTMLSection()];
};
HTMLSectionBuilder.scopify = function (renderer) {
return Observation.ignore(function (scope, options, nodeList) {
if (!(scope instanceof Scope)) {
scope = Scope.refsScope().add(scope || {});
}
if (!(options instanceof mustacheCore.Options)) {
options = new mustacheCore.Options(options || {});
}
return renderer(scope, options, nodeList);
});
};
assign(HTMLSectionBuilder.prototype, utils.mixins);
assign(HTMLSectionBuilder.prototype, {
startSubSection: function (process) {
var newSection = new HTMLSection(process);
this.stack.push(newSection);
return newSection;
},
endSubSectionAndReturnRenderer: function () {
if (this.last().isEmpty()) {
this.stack.pop();
return null;
} else {
var htmlSection = this.endSection();
return htmlSection.compiled.hydrate.bind(htmlSection.compiled);
}
},
startSection: function (process) {
var newSection = new HTMLSection(process);
this.last().add(newSection.targetCallback);
this.stack.push(newSection);
},
endSection: function () {
this.last().compile();
return this.stack.pop();
},
inverse: function () {
this.last().inverse();
},
compile: function () {
var compiled = this.stack.pop().compile();
return Observation.ignore(function (scope, options, nodeList) {
if (!(scope instanceof Scope)) {
scope = Scope.refsScope().add(scope || {});
}
if (!(options instanceof mustacheCore.Options)) {
options = new mustacheCore.Options(options || {});
}
return compiled.hydrate(scope, options, nodeList);
});
},
push: function (chars) {
this.last().push(chars);
},
pop: function () {
return this.last().pop();
},
removeCurrentNode: function () {
this.last().removeCurrentNode();
}
});
var HTMLSection = function (process) {
this.data = 'targetData';
this.targetData = [];
this.targetStack = [];
var self = this;
this.targetCallback = function (scope, options, sectionNode) {
process.call(this, scope, options, sectionNode, self.compiled.hydrate.bind(self.compiled), self.inverseCompiled && self.inverseCompiled.hydrate.bind(self.inverseCompiled));
};
};
assign(HTMLSection.prototype, {
inverse: function () {
this.inverseData = [];
this.data = 'inverseData';
},
push: function (data) {
this.add(data);
this.targetStack.push(data);
},
pop: function () {
return this.targetStack.pop();
},
add: function (data) {
if (typeof data === 'string') {
data = decodeHTML(data);
}
if (this.targetStack.length) {
last(this.targetStack).children.push(data);
} else {
this[this.data].push(data);
}
},
compile: function () {
this.compiled = target(this.targetData, getDocument());
if (this.inverseData) {
this.inverseCompiled = target(this.inverseData, getDocument());
delete this.inverseData;
}
this.targetStack = this.targetData = null;
return this.compiled;
},
removeCurrentNode: function () {
var children = this.children();
return children.pop();
},
children: function () {
if (this.targetStack.length) {
return last(this.targetStack).children;
} else {
return this[this.data];
}
},
isEmpty: function () {
return !this.targetData.length;
}
});
HTMLSectionBuilder.HTMLSection = HTMLSection;
module.exports = HTMLSectionBuilder;
});
/*can-stache@3.9.0#src/text_section*/
define('can-stache/src/text_section', [
'require',
'exports',
'module',
'can-compute',
'can-view-live',
'can-stache/src/utils',
'can-util/dom/attr/attr',
'can-util/js/assign/assign',
'can-reflect',
'can-observation'
], function (require, exports, module) {
var compute = require('can-compute');
var live = require('can-view-live');
var utils = require('can-stache/src/utils');
var attr = require('can-util/dom/attr/attr');
var assign = require('can-util/js/assign/assign');
var canReflect = require('can-reflect');
var Observation = require('can-observation');
var noop = function () {
};
var TextSectionBuilder = function () {
this.stack = [new TextSection()];
};
assign(TextSectionBuilder.prototype, utils.mixins);
assign(TextSectionBuilder.prototype, {
startSection: function (process) {
var subSection = new TextSection();
this.last().add({
process: process,
truthy: subSection
});
this.stack.push(subSection);
},
endSection: function () {
this.stack.pop();
},
inverse: function () {
this.stack.pop();
var falseySection = new TextSection();
this.last().last().falsey = falseySection;
this.stack.push(falseySection);
},
compile: function (state) {
var renderer = this.stack[0].compile();
return function (scope, options) {
var observation = new Observation(function () {
return renderer(scope, options);
}, null, { isObservable: false });
canReflect.onValue(observation, noop);
var value = canReflect.getValue(observation);
if (canReflect.valueHasDependencies(observation)) {
if (state.textContentOnly) {
live.text(this, observation);
} else if (state.attr) {
live.attr(this, state.attr, observation);
} else {
live.attrs(this, observation, scope, options);
}
canReflect.offValue(observation, noop);
} else {
if (state.textContentOnly) {
this.nodeValue = value;
} else if (state.attr) {
attr.set(this, state.attr, value);
} else {
live.attrs(this, value);
}
}
};
}
});
var passTruthyFalsey = function (process, truthy, falsey) {
return function (scope, options) {
return process.call(this, scope, options, truthy, falsey);
};
};
var TextSection = function () {
this.values = [];
};
assign(TextSection.prototype, {
add: function (data) {
this.values.push(data);
},
last: function () {
return this.values[this.values.length - 1];
},
compile: function () {
var values = this.values, len = values.length;
for (var i = 0; i < len; i++) {
var value = this.values[i];
if (typeof value === 'object') {
values[i] = passTruthyFalsey(value.process, value.truthy && value.truthy.compile(), value.falsey && value.falsey.compile());
}
}
return function (scope, options) {
var txt = '', value;
for (var i = 0; i < len; i++) {
value = values[i];
txt += typeof value === 'string' ? value : value.call(this, scope, options);
}
return txt;
};
}
});
module.exports = TextSectionBuilder;
});
/*can-stache@3.9.0#helpers/converter*/
define('can-stache/helpers/converter', [
'require',
'exports',
'module',
'can-stache/helpers/core',
'can-stache/src/expression',
'can-util/js/make-array/make-array'
], function (require, exports, module) {
var helpers = require('can-stache/helpers/core');
var expression = require('can-stache/src/expression');
var makeArray = require('can-util/js/make-array/make-array');
helpers.registerConverter = function (name, getterSetter) {
getterSetter = getterSetter || {};
helpers.registerHelper(name, function (newVal, source) {
var args = makeArray(arguments);
if (newVal instanceof expression.SetIdentifier) {
return typeof getterSetter.set === 'function' ? getterSetter.set.apply(this, [newVal.value].concat(args.slice(1))) : source(newVal.value);
} else {
return typeof getterSetter.get === 'function' ? getterSetter.get.apply(this, args) : args[0];
}
});
};
module.exports = helpers;
});
/*can-stache@3.9.0#src/intermediate_and_imports*/
define('can-stache/src/intermediate_and_imports', [
'require',
'exports',
'module',
'can-stache/src/mustache_core',
'can-view-parser'
], function (require, exports, module) {
var mustacheCore = require('can-stache/src/mustache_core');
var parser = require('can-view-parser');
module.exports = function (source) {
var template = source;
template = mustacheCore.cleanWhitespaceControl(template);
template = mustacheCore.cleanLineEndings(template);
var imports = [], dynamicImports = [], ases = {}, inImport = false, inFrom = false, inAs = false, isUnary = false, importIsDynamic = false, currentAs = '', currentFrom = '';
function processImport() {
if (currentAs) {
ases[currentAs] = currentFrom;
currentAs = '';
}
if (importIsDynamic) {
dynamicImports.push(currentFrom);
} else {
imports.push(currentFrom);
}
}
var intermediate = parser(template, {
start: function (tagName, unary) {
if (tagName === 'can-import') {
isUnary = unary;
importIsDynamic = false;
inImport = true;
} else if (tagName === 'can-dynamic-import') {
isUnary = unary;
importIsDynamic = true;
inImport = true;
} else if (inImport) {
importIsDynamic = true;
inImport = false;
}
},
attrStart: function (attrName) {
if (attrName === 'from') {
inFrom = true;
} else if (attrName === 'as' || attrName === 'export-as') {
inAs = true;
}
},
attrEnd: function (attrName) {
if (attrName === 'from') {
inFrom = false;
} else if (attrName === 'as' || attrName === 'export-as') {
inAs = false;
}
},
attrValue: function (value) {
if (inFrom && inImport) {
currentFrom = value;
} else if (inAs && inImport) {
currentAs = value;
}
},
end: function (tagName) {
if ((tagName === 'can-import' || tagName === 'can-dymamic-import') && isUnary) {
processImport();
}
},
close: function (tagName) {
if (tagName === 'can-import' || tagName === 'can-dymamic-import') {
processImport();
}
},
chars: function (text) {
if (text.trim().length > 0) {
importIsDynamic = true;
}
},
special: function (text) {
importIsDynamic = true;
}
}, true);
return {
intermediate: intermediate,
imports: imports,
dynamicImports: dynamicImports,
ases: ases,
exports: ases
};
};
});
/*can-util@3.10.11#js/import/import*/
define('can-util/js/import/import', [
'require',
'exports',
'module',
'can-util/js/is-function/is-function',
'can-globals/global/global'
], function (require, exports, module) {
(function (global) {
'use strict';
var isFunction = require('can-util/js/is-function/is-function');
var global = require('can-globals/global/global')();
module.exports = function (moduleName, parentName) {
return new Promise(function (resolve, reject) {
try {
if (typeof global.System === 'object' && isFunction(global.System['import'])) {
global.System['import'](moduleName, { name: parentName }).then(resolve, reject);
} else if (global.define && global.define.amd) {
global.require([moduleName], function (value) {
resolve(value);
});
} else if (global.require) {
resolve(global.require(moduleName));
} else {
resolve();
}
} catch (err) {
reject(err);
}
});
};
}(function () {
return this;
}()));
});
/*can-stache@3.9.0#can-stache*/
define('can-stache', [
'require',
'exports',
'module',
'can-view-parser',
'can-view-callbacks',
'can-stache/src/html_section',
'can-stache/src/text_section',
'can-stache/src/mustache_core',
'can-stache/helpers/core',
'can-stache/helpers/converter',
'can-stache/src/intermediate_and_imports',
'can-stache/src/utils',
'can-attribute-encoder',
'can-util/js/dev/dev',
'can-namespace',
'can-util/dom/document/document',
'can-util/js/assign/assign',
'can-util/js/last/last',
'can-util/js/import/import',
'can-view-target',
'can-view-nodelist'
], function (require, exports, module) {
var parser = require('can-view-parser');
var viewCallbacks = require('can-view-callbacks');
var HTMLSectionBuilder = require('can-stache/src/html_section');
var TextSectionBuilder = require('can-stache/src/text_section');
var mustacheCore = require('can-stache/src/mustache_core');
var mustacheHelpers = require('can-stache/helpers/core');
require('can-stache/helpers/converter');
var getIntermediateAndImports = require('can-stache/src/intermediate_and_imports');
var makeRendererConvertScopes = require('can-stache/src/utils').makeRendererConvertScopes;
var attributeEncoder = require('can-attribute-encoder');
var dev = require('can-util/js/dev/dev');
var namespace = require('can-namespace');
var DOCUMENT = require('can-util/dom/document/document');
var assign = require('can-util/js/assign/assign');
var last = require('can-util/js/last/last');
var importer = require('can-util/js/import/import');
require('can-view-target');
require('can-view-nodelist');
viewCallbacks.tag('content', function (el, tagData) {
return tagData.scope;
});
var wrappedAttrPattern = /[{(].*[)}]/;
var colonWrappedAttrPattern = /^on:|(:to|:from|:bind)$|.*:to:on:.*/;
var svgNamespace = 'http://www.w3.org/2000/svg';
var namespaces = {
'svg': svgNamespace,
'g': svgNamespace
}, textContentOnlyTag = {
style: true,
script: true
};
function stache(template) {
var inlinePartials = {};
if (typeof template === 'string') {
template = mustacheCore.cleanWhitespaceControl(template);
template = mustacheCore.cleanLineEndings(template);
}
var section = new HTMLSectionBuilder(), state = {
node: null,
attr: null,
sectionElementStack: [],
text: false,
namespaceStack: [],
textContentOnly: null
}, makeRendererAndUpdateSection = function (section, mode, stache) {
if (mode === '>') {
section.add(mustacheCore.makeLiveBindingPartialRenderer(stache, copyState()));
} else if (mode === '/') {
var createdSection = section.last();
if (createdSection.startedWith === '<') {
inlinePartials[stache] = section.endSubSectionAndReturnRenderer();
section.removeCurrentNode();
} else {
section.endSection();
}
if (section instanceof HTMLSectionBuilder) {
var last = state.sectionElementStack[state.sectionElementStack.length - 1].tag;
if (stache !== '' && stache !== last) {
dev.warn('unexpected closing tag {{/' + stache + '}} expected {{/' + last + '}}');
}
state.sectionElementStack.pop();
}
} else if (mode === 'else') {
section.inverse();
} else {
var makeRenderer = section instanceof HTMLSectionBuilder ? mustacheCore.makeLiveBindingBranchRenderer : mustacheCore.makeStringBranchRenderer;
if (mode === '{' || mode === '&') {
section.add(makeRenderer(null, stache, copyState()));
} else if (mode === '#' || mode === '^' || mode === '<') {
var renderer = makeRenderer(mode, stache, copyState());
section.startSection(renderer);
section.last().startedWith = mode;
if (section instanceof HTMLSectionBuilder) {
var tag = typeof renderer.exprData.closingTag === 'function' ? renderer.exprData.closingTag() : '';
state.sectionElementStack.push({
type: 'section',
tag: tag
});
}
} else {
section.add(makeRenderer(null, stache, copyState({ text: true })));
}
}
}, copyState = function (overwrites) {
var lastElement = state.sectionElementStack[state.sectionElementStack.length - 1];
var cur = {
tag: state.node && state.node.tag,
attr: state.attr && state.attr.name,
directlyNested: state.sectionElementStack.length ? lastElement.type === 'section' || lastElement.type === 'custom' : true,
textContentOnly: !!state.textContentOnly
};
return overwrites ? assign(cur, overwrites) : cur;
}, addAttributesCallback = function (node, callback) {
if (!node.attributes) {
node.attributes = [];
}
node.attributes.unshift(callback);
};
parser(template, {
start: function (tagName, unary) {
var matchedNamespace = namespaces[tagName];
if (matchedNamespace && !unary) {
state.namespaceStack.push(matchedNamespace);
}
state.node = {
tag: tagName,
children: [],
namespace: matchedNamespace || last(state.namespaceStack)
};
},
end: function (tagName, unary) {
var isCustomTag = viewCallbacks.tag(tagName);
if (unary) {
section.add(state.node);
if (isCustomTag) {
addAttributesCallback(state.node, function (scope, options, parentNodeList) {
viewCallbacks.tagHandler(this, tagName, {
scope: scope,
options: options,
subtemplate: null,
templateType: 'stache',
parentNodeList: parentNodeList
});
});
}
} else {
section.push(state.node);
state.sectionElementStack.push({
type: isCustomTag ? 'custom' : null,
tag: isCustomTag ? null : tagName,
templates: {}
});
if (isCustomTag) {
section.startSubSection();
} else if (textContentOnlyTag[tagName]) {
state.textContentOnly = new TextSectionBuilder();
}
}
state.node = null;
},
close: function (tagName) {
var matchedNamespace = namespaces[tagName];
if (matchedNamespace) {
state.namespaceStack.pop();
}
var isCustomTag = viewCallbacks.tag(tagName), renderer;
if (isCustomTag) {
renderer = section.endSubSectionAndReturnRenderer();
}
if (textContentOnlyTag[tagName]) {
section.last().add(state.textContentOnly.compile(copyState()));
state.textContentOnly = null;
}
var oldNode = section.pop();
if (isCustomTag) {
if (tagName === 'can-template') {
var parent = state.sectionElementStack[state.sectionElementStack.length - 2];
parent.templates[oldNode.attrs.name] = makeRendererConvertScopes(renderer);
section.removeCurrentNode();
} else {
var current = state.sectionElementStack[state.sectionElementStack.length - 1];
addAttributesCallback(oldNode, function (scope, options, parentNodeList) {
viewCallbacks.tagHandler(this, tagName, {
scope: scope,
options: options,
subtemplate: renderer ? makeRendererConvertScopes(renderer) : renderer,
templateType: 'stache',
parentNodeList: parentNodeList,
templates: current.templates
});
});
}
}
state.sectionElementStack.pop();
},
attrStart: function (attrName) {
if (state.node.section) {
state.node.section.add(attrName + '="');
} else {
state.attr = {
name: attrName,
value: ''
};
}
},
attrEnd: function (attrName) {
if (state.node.section) {
state.node.section.add('" ');
} else {
if (!state.node.attrs) {
state.node.attrs = {};
}
state.node.attrs[state.attr.name] = state.attr.section ? state.attr.section.compile(copyState()) : state.attr.value;
var attrCallback = viewCallbacks.attr(attrName);
var decodedAttrName = attributeEncoder.decode(attrName);
weirdAttribute = !!wrappedAttrPattern.test(decodedAttrName) || !!colonWrappedAttrPattern.test(decodedAttrName);
if (weirdAttribute && !attrCallback) {
dev.warn('unknown attribute binding ' + decodedAttrName + '. Is can-stache-bindings imported?');
}
if (attrCallback) {
if (!state.node.attributes) {
state.node.attributes = [];
}
state.node.attributes.push(function (scope, options, nodeList) {
attrCallback(this, {
attributeName: attrName,
scope: scope,
options: options,
nodeList: nodeList
});
});
}
state.attr = null;
}
},
attrValue: function (value) {
var section = state.node.section || state.attr.section;
if (section) {
section.add(value);
} else {
state.attr.value += value;
}
},
chars: function (text) {
(state.textContentOnly || section).add(text);
},
special: function (text) {
var firstAndText = mustacheCore.splitModeFromExpression(text, state), mode = firstAndText.mode, expression = firstAndText.expression;
if (expression === 'else') {
var inverseSection;
if (state.attr && state.attr.section) {
inverseSection = state.attr.section;
} else if (state.node && state.node.section) {
inverseSection = state.node.section;
} else {
inverseSection = state.textContentOnly || section;
}
inverseSection.inverse();
return;
}
if (mode === '!') {
return;
}
if (state.node && state.node.section) {
makeRendererAndUpdateSection(state.node.section, mode, expression);
if (state.node.section.subSectionDepth() === 0) {
state.node.attributes.push(state.node.section.compile(copyState()));
delete state.node.section;
}
} else if (state.attr) {
if (!state.attr.section) {
state.attr.section = new TextSectionBuilder();
if (state.attr.value) {
state.attr.section.add(state.attr.value);
}
}
makeRendererAndUpdateSection(state.attr.section, mode, expression);
} else if (state.node) {
if (!state.node.attributes) {
state.node.attributes = [];
}
if (!mode) {
state.node.attributes.push(mustacheCore.makeLiveBindingBranchRenderer(null, expression, copyState()));
} else if (mode === '#' || mode === '^') {
if (!state.node.section) {
state.node.section = new TextSectionBuilder();
}
makeRendererAndUpdateSection(state.node.section, mode, expression);
} else {
throw new Error(mode + ' is currently not supported within a tag.');
}
} else {
makeRendererAndUpdateSection(state.textContentOnly || section, mode, expression);
}
},
comment: function (text) {
section.add({ comment: text });
},
done: function () {
}
});
var renderer = section.compile();
var scopifiedRenderer = HTMLSectionBuilder.scopify(function (scope, optionsScope, nodeList) {
if (Object.keys(inlinePartials).length) {
optionsScope.inlinePartials = optionsScope.inlinePartials || {};
assign(optionsScope.inlinePartials, inlinePartials);
}
scope.set('*self', scopifiedRenderer);
return renderer.apply(this, arguments);
});
return scopifiedRenderer;
}
assign(stache, mustacheHelpers);
stache.safeString = function (text) {
return {
toString: function () {
return text;
}
};
};
stache.async = function (source) {
var iAi = getIntermediateAndImports(source);
var importPromises = iAi.imports.map(function (moduleName) {
return importer(moduleName);
});
return Promise.all(importPromises).then(function () {
return stache(iAi.intermediate);
});
};
var templates = {};
stache.from = mustacheCore.getTemplateById = function (id) {
if (!templates[id]) {
var el = DOCUMENT().getElementById(id);
templates[id] = stache(el.innerHTML);
}
return templates[id];
};
stache.registerPartial = function (id, partial) {
templates[id] = typeof partial === 'string' ? stache(partial) : partial;
};
module.exports = namespace.stache = stache;
});
/*can-stache@3.9.0#helpers/route*/
define('can-stache/helpers/route', [
'require',
'exports',
'module',
'can-stache/helpers/core',
'can-route',
'can-util/js/last/last',
'can-stache/src/expression',
'can-util/js/each/each'
], function (require, exports, module) {
var helpers = require('can-stache/helpers/core');
var route = require('can-route');
var getLast = require('can-util/js/last/last');
var stacheExpression = require('can-stache/src/expression');
var each = require('can-util/js/each/each');
var looksLikeOptions = helpers.looksLikeOptions;
var calculateArgs = function () {
var finalParams, finalMerge, optionsArg;
each(arguments, function (arg) {
if (typeof arg === 'boolean') {
finalMerge = arg;
} else if (arg && typeof arg === 'object') {
if (!looksLikeOptions(arg)) {
finalParams = helpers.resolveHash(arg);
} else {
optionsArg = arg;
}
}
});
if (!finalParams && optionsArg) {
finalParams = helpers.resolveHash(optionsArg.hash);
}
return {
finalParams: finalParams || {},
finalMerge: finalMerge,
optionsArg: optionsArg
};
};
helpers.registerHelper('routeUrl', function () {
var args = calculateArgs.apply(this, arguments);
return route.url(args.finalParams, typeof args.finalMerge === 'boolean' ? args.finalMerge : undefined);
});
var routeCurrent = function () {
var args = calculateArgs.apply(this, arguments);
var result = route.current(args.finalParams, typeof args.finalMerge === 'boolean' ? args.finalMerge : undefined);
if (args.optionsArg && !(args.optionsArg instanceof stacheExpression.Call)) {
if (result) {
return args.optionsArg.fn();
} else {
return args.optionsArg.inverse();
}
} else {
return result;
}
};
routeCurrent.callAsMethod = true;
helpers.registerHelper('routeCurrent', routeCurrent);
});
/*can-globals@0.2.3#location/location*/
define('can-globals/location/location', [
'require',
'exports',
'module',
'can-globals/global/global',
'can-globals/can-globals-instance'
], function (require, exports, module) {
(function (global) {
'use strict';
require('can-globals/global/global');
var globals = require('can-globals/can-globals-instance');
globals.define('location', function () {
return globals.getKeyValue('global').location;
});
module.exports = globals.makeExport('location');
}(function () {
return this;
}()));
});
/*can-globals@0.2.3#can-globals*/
define('can-globals', [
'require',
'exports',
'module',
'can-globals/can-globals-instance',
'can-globals/global/global',
'can-globals/document/document',
'can-globals/location/location',
'can-globals/mutation-observer/mutation-observer',
'can-globals/is-browser-window/is-browser-window'
], function (require, exports, module) {
(function (global) {
'use strict';
var globals = require('can-globals/can-globals-instance');
require('can-globals/global/global');
require('can-globals/document/document');
require('can-globals/location/location');
require('can-globals/mutation-observer/mutation-observer');
require('can-globals/is-browser-window/is-browser-window');
module.exports = globals;
}(function () {
return this;
}()));
});
/*can@3.11.0#can*/
define('can', [
'require',
'exports',
'module',
'can-util/namespace',
'can-component',
'can-compute',
'can-connect/all',
'can-define/map/map',
'can-define/list/list',
'can-route',
'can-set',
'can-simple-observable',
'can-stache',
'can-stache/helpers/route',
'can-stache-bindings',
'can-attribute-encoder',
'can-ajax',
'can-globals',
'can-reflect',
'can-define-lazy-value'
], function (require, exports, module) {
(function (global) {
var can = require('can-util/namespace');
require('can-component');
require('can-compute');
require('can-connect/all');
require('can-define/map/map');
require('can-define/list/list');
require('can-route');
require('can-set');
require('can-simple-observable');
require('can-stache');
require('can-stache/helpers/route');
require('can-stache-bindings');
require('can-attribute-encoder');
require('can-ajax');
require('can-globals');
require('can-reflect');
require('can-define-lazy-value');
module.exports = can;
}(function () {
return this;
}()));
});
/*[global-shim-end]*/
(function(global) { // jshint ignore:line
global._define = global.define;
global.define = global.define.orig;
}
)(typeof self == "object" && self.Object == Object ? self : window);
|
app/javascript/mastodon/features/home_timeline/components/column_settings.js
|
NS-Kazuki/mastodon
|
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { injectIntl, FormattedMessage } from 'react-intl';
import SettingToggle from '../../notifications/components/setting_toggle';
export default @injectIntl
class ColumnSettings extends React.PureComponent {
static propTypes = {
settings: ImmutablePropTypes.map.isRequired,
onChange: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
};
render () {
const { settings, onChange } = this.props;
return (
<div>
<span className='column-settings__section'><FormattedMessage id='home.column_settings.basic' defaultMessage='Basic' /></span>
<div className='column-settings__row'>
<SettingToggle prefix='home_timeline' settings={settings} settingPath={['shows', 'reblog']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_reblogs' defaultMessage='Show boosts' />} />
</div>
<div className='column-settings__row'>
<SettingToggle prefix='home_timeline' settings={settings} settingPath={['shows', 'reply']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_replies' defaultMessage='Show replies' />} />
</div>
</div>
);
}
}
|
ajax/libs/yui/3.5.1/event-custom-base/event-custom-base.js
|
kood1/cdnjs
|
YUI.add('event-custom-base', function(Y) {
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
*/
Y.Env.evt = {
handles: {},
plugins: {}
};
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
/**
* Allows for the insertion of methods that are executed before or after
* a specified method
* @class Do
* @static
*/
var DO_BEFORE = 0,
DO_AFTER = 1,
DO = {
/**
* Cache of objects touched by the utility
* @property objs
* @static
*/
objs: {},
/**
* <p>Execute the supplied method before the specified function. Wrapping
* function may optionally return an instance of the following classes to
* further alter runtime behavior:</p>
* <dl>
* <dt></code>Y.Do.Halt(message, returnValue)</code></dt>
* <dd>Immediatly stop execution and return
* <code>returnValue</code>. No other wrapping functions will be
* executed.</dd>
* <dt></code>Y.Do.AlterArgs(message, newArgArray)</code></dt>
* <dd>Replace the arguments that the original function will be
* called with.</dd>
* <dt></code>Y.Do.Prevent(message)</code></dt>
* <dd>Don't execute the wrapped function. Other before phase
* wrappers will be executed.</dd>
* </dl>
*
* @method before
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {string} handle for the subscription
* @static
*/
before: function(fn, obj, sFn, c) {
var f = fn, a;
if (c) {
a = [fn, c].concat(Y.Array(arguments, 4, true));
f = Y.rbind.apply(Y, a);
}
return this._inject(DO_BEFORE, f, obj, sFn);
},
/**
* <p>Execute the supplied method after the specified function. Wrapping
* function may optionally return an instance of the following classes to
* further alter runtime behavior:</p>
* <dl>
* <dt></code>Y.Do.Halt(message, returnValue)</code></dt>
* <dd>Immediatly stop execution and return
* <code>returnValue</code>. No other wrapping functions will be
* executed.</dd>
* <dt></code>Y.Do.AlterReturn(message, returnValue)</code></dt>
* <dd>Return <code>returnValue</code> instead of the wrapped
* method's original return value. This can be further altered by
* other after phase wrappers.</dd>
* </dl>
*
* <p>The static properties <code>Y.Do.originalRetVal</code> and
* <code>Y.Do.currentRetVal</code> will be populated for reference.</p>
*
* @method after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* @return {string} handle for the subscription
* @static
*/
after: function(fn, obj, sFn, c) {
var f = fn, a;
if (c) {
a = [fn, c].concat(Y.Array(arguments, 4, true));
f = Y.rbind.apply(Y, a);
}
return this._inject(DO_AFTER, f, obj, sFn);
},
/**
* Execute the supplied method before or after the specified function.
* Used by <code>before</code> and <code>after</code>.
*
* @method _inject
* @param when {string} before or after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @return {string} handle for the subscription
* @private
* @static
*/
_inject: function(when, fn, obj, sFn) {
// object id
var id = Y.stamp(obj), o, sid;
if (! this.objs[id]) {
// create a map entry for the obj if it doesn't exist
this.objs[id] = {};
}
o = this.objs[id];
if (! o[sFn]) {
// create a map entry for the method if it doesn't exist
o[sFn] = new Y.Do.Method(obj, sFn);
// re-route the method to our wrapper
obj[sFn] =
function() {
return o[sFn].exec.apply(o[sFn], arguments);
};
}
// subscriber id
sid = id + Y.stamp(fn) + sFn;
// register the callback
o[sFn].register(sid, fn, when);
return new Y.EventHandle(o[sFn], sid);
},
/**
* Detach a before or after subscription.
*
* @method detach
* @param handle {string} the subscription handle
* @static
*/
detach: function(handle) {
if (handle.detach) {
handle.detach();
}
},
_unload: function(e, me) {
}
};
Y.Do = DO;
//////////////////////////////////////////////////////////////////////////
/**
* Contains the return value from the wrapped method, accessible
* by 'after' event listeners.
*
* @property originalRetVal
* @static
* @since 3.2.0
*/
/**
* Contains the current state of the return value, consumable by
* 'after' event listeners, and updated if an after subscriber
* changes the return value generated by the wrapped function.
*
* @property currentRetVal
* @static
* @since 3.2.0
*/
//////////////////////////////////////////////////////////////////////////
/**
* Wrapper for a displaced method with aop enabled
* @class Do.Method
* @constructor
* @param obj The object to operate on
* @param sFn The name of the method to displace
*/
DO.Method = function(obj, sFn) {
this.obj = obj;
this.methodName = sFn;
this.method = obj[sFn];
this.before = {};
this.after = {};
};
/**
* Register a aop subscriber
* @method register
* @param sid {string} the subscriber id
* @param fn {Function} the function to execute
* @param when {string} when to execute the function
*/
DO.Method.prototype.register = function (sid, fn, when) {
if (when) {
this.after[sid] = fn;
} else {
this.before[sid] = fn;
}
};
/**
* Unregister a aop subscriber
* @method delete
* @param sid {string} the subscriber id
* @param fn {Function} the function to execute
* @param when {string} when to execute the function
*/
DO.Method.prototype._delete = function (sid) {
delete this.before[sid];
delete this.after[sid];
};
/**
* <p>Execute the wrapped method. All arguments are passed into the wrapping
* functions. If any of the before wrappers return an instance of
* <code>Y.Do.Halt</code> or <code>Y.Do.Prevent</code>, neither the wrapped
* function nor any after phase subscribers will be executed.</p>
*
* <p>The return value will be the return value of the wrapped function or one
* provided by a wrapper function via an instance of <code>Y.Do.Halt</code> or
* <code>Y.Do.AlterReturn</code>.
*
* @method exec
* @param arg* {any} Arguments are passed to the wrapping and wrapped functions
* @return {any} Return value of wrapped function unless overwritten (see above)
*/
DO.Method.prototype.exec = function () {
var args = Y.Array(arguments, 0, true),
i, ret, newRet,
bf = this.before,
af = this.after,
prevented = false;
// execute before
for (i in bf) {
if (bf.hasOwnProperty(i)) {
ret = bf[i].apply(this.obj, args);
if (ret) {
switch (ret.constructor) {
case DO.Halt:
return ret.retVal;
case DO.AlterArgs:
args = ret.newArgs;
break;
case DO.Prevent:
prevented = true;
break;
default:
}
}
}
}
// execute method
if (!prevented) {
ret = this.method.apply(this.obj, args);
}
DO.originalRetVal = ret;
DO.currentRetVal = ret;
// execute after methods.
for (i in af) {
if (af.hasOwnProperty(i)) {
newRet = af[i].apply(this.obj, args);
// Stop processing if a Halt object is returned
if (newRet && newRet.constructor == DO.Halt) {
return newRet.retVal;
// Check for a new return value
} else if (newRet && newRet.constructor == DO.AlterReturn) {
ret = newRet.newRetVal;
// Update the static retval state
DO.currentRetVal = ret;
}
}
}
return ret;
};
//////////////////////////////////////////////////////////////////////////
/**
* Return an AlterArgs object when you want to change the arguments that
* were passed into the function. Useful for Do.before subscribers. An
* example would be a service that scrubs out illegal characters prior to
* executing the core business logic.
* @class Do.AlterArgs
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param newArgs {Array} Call parameters to be used for the original method
* instead of the arguments originally passed in.
*/
DO.AlterArgs = function(msg, newArgs) {
this.msg = msg;
this.newArgs = newArgs;
};
/**
* Return an AlterReturn object when you want to change the result returned
* from the core method to the caller. Useful for Do.after subscribers.
* @class Do.AlterReturn
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param newRetVal {any} Return value passed to code that invoked the wrapped
* function.
*/
DO.AlterReturn = function(msg, newRetVal) {
this.msg = msg;
this.newRetVal = newRetVal;
};
/**
* Return a Halt object when you want to terminate the execution
* of all subsequent subscribers as well as the wrapped method
* if it has not exectued yet. Useful for Do.before subscribers.
* @class Do.Halt
* @constructor
* @param msg {String} (optional) Explanation of why the termination was done
* @param retVal {any} Return value passed to code that invoked the wrapped
* function.
*/
DO.Halt = function(msg, retVal) {
this.msg = msg;
this.retVal = retVal;
};
/**
* Return a Prevent object when you want to prevent the wrapped function
* from executing, but want the remaining listeners to execute. Useful
* for Do.before subscribers.
* @class Do.Prevent
* @constructor
* @param msg {String} (optional) Explanation of why the termination was done
*/
DO.Prevent = function(msg) {
this.msg = msg;
};
/**
* Return an Error object when you want to terminate the execution
* of all subsequent method calls.
* @class Do.Error
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param retVal {any} Return value passed to code that invoked the wrapped
* function.
* @deprecated use Y.Do.Halt or Y.Do.Prevent
*/
DO.Error = DO.Halt;
//////////////////////////////////////////////////////////////////////////
// Y["Event"] && Y.Event.addListener(window, "unload", Y.Do._unload, Y.Do);
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
// var onsubscribeType = "_event:onsub",
var AFTER = 'after',
CONFIGS = [
'broadcast',
'monitored',
'bubbles',
'context',
'contextFn',
'currentTarget',
'defaultFn',
'defaultTargetOnly',
'details',
'emitFacade',
'fireOnce',
'async',
'host',
'preventable',
'preventedFn',
'queuable',
'silent',
'stoppedFn',
'target',
'type'
],
YUI3_SIGNATURE = 9,
YUI_LOG = 'yui:log';
/**
* The CustomEvent class lets you define events for your application
* that can be subscribed to by one or more independent component.
*
* @param {String} type The type of event, which is passed to the callback
* when the event fires.
* @param {object} o configuration object.
* @class CustomEvent
* @constructor
*/
Y.CustomEvent = function(type, o) {
// if (arguments.length > 2) {
// this.log('CustomEvent context and silent are now in the config', 'warn', 'Event');
// }
o = o || {};
this.id = Y.stamp(this);
/**
* The type of event, returned to subscribers when the event fires
* @property type
* @type string
*/
this.type = type;
/**
* The context the the event will fire from by default. Defaults to the YUI
* instance.
* @property context
* @type object
*/
this.context = Y;
/**
* Monitor when an event is attached or detached.
*
* @property monitored
* @type boolean
*/
// this.monitored = false;
this.logSystem = (type == YUI_LOG);
/**
* If 0, this event does not broadcast. If 1, the YUI instance is notified
* every time this event fires. If 2, the YUI instance and the YUI global
* (if event is enabled on the global) are notified every time this event
* fires.
* @property broadcast
* @type int
*/
// this.broadcast = 0;
/**
* By default all custom events are logged in the debug build, set silent
* to true to disable debug outpu for this event.
* @property silent
* @type boolean
*/
this.silent = this.logSystem;
/**
* Specifies whether this event should be queued when the host is actively
* processing an event. This will effect exectution order of the callbacks
* for the various events.
* @property queuable
* @type boolean
* @default false
*/
// this.queuable = false;
/**
* The subscribers to this event
* @property subscribers
* @type Subscriber {}
*/
this.subscribers = {};
/**
* 'After' subscribers
* @property afters
* @type Subscriber {}
*/
this.afters = {};
/**
* This event has fired if true
*
* @property fired
* @type boolean
* @default false;
*/
// this.fired = false;
/**
* An array containing the arguments the custom event
* was last fired with.
* @property firedWith
* @type Array
*/
// this.firedWith;
/**
* This event should only fire one time if true, and if
* it has fired, any new subscribers should be notified
* immediately.
*
* @property fireOnce
* @type boolean
* @default false;
*/
// this.fireOnce = false;
/**
* fireOnce listeners will fire syncronously unless async
* is set to true
* @property async
* @type boolean
* @default false
*/
//this.async = false;
/**
* Flag for stopPropagation that is modified during fire()
* 1 means to stop propagation to bubble targets. 2 means
* to also stop additional subscribers on this target.
* @property stopped
* @type int
*/
// this.stopped = 0;
/**
* Flag for preventDefault that is modified during fire().
* if it is not 0, the default behavior for this event
* @property prevented
* @type int
*/
// this.prevented = 0;
/**
* Specifies the host for this custom event. This is used
* to enable event bubbling
* @property host
* @type EventTarget
*/
// this.host = null;
/**
* The default function to execute after event listeners
* have fire, but only if the default action was not
* prevented.
* @property defaultFn
* @type Function
*/
// this.defaultFn = null;
/**
* The function to execute if a subscriber calls
* stopPropagation or stopImmediatePropagation
* @property stoppedFn
* @type Function
*/
// this.stoppedFn = null;
/**
* The function to execute if a subscriber calls
* preventDefault
* @property preventedFn
* @type Function
*/
// this.preventedFn = null;
/**
* Specifies whether or not this event's default function
* can be cancelled by a subscriber by executing preventDefault()
* on the event facade
* @property preventable
* @type boolean
* @default true
*/
this.preventable = true;
/**
* Specifies whether or not a subscriber can stop the event propagation
* via stopPropagation(), stopImmediatePropagation(), or halt()
*
* Events can only bubble if emitFacade is true.
*
* @property bubbles
* @type boolean
* @default true
*/
this.bubbles = true;
/**
* Supports multiple options for listener signatures in order to
* port YUI 2 apps.
* @property signature
* @type int
* @default 9
*/
this.signature = YUI3_SIGNATURE;
this.subCount = 0;
this.afterCount = 0;
// this.hasSubscribers = false;
// this.hasAfters = false;
/**
* If set to true, the custom event will deliver an EventFacade object
* that is similar to a DOM event object.
* @property emitFacade
* @type boolean
* @default false
*/
// this.emitFacade = false;
this.applyConfig(o, true);
// this.log("Creating " + this.type);
};
Y.CustomEvent.prototype = {
constructor: Y.CustomEvent,
/**
* Returns the number of subscribers for this event as the sum of the on()
* subscribers and after() subscribers.
*
* @method hasSubs
* @return Number
*/
hasSubs: function(when) {
var s = this.subCount, a = this.afterCount, sib = this.sibling;
if (sib) {
s += sib.subCount;
a += sib.afterCount;
}
if (when) {
return (when == 'after') ? a : s;
}
return (s + a);
},
/**
* Monitor the event state for the subscribed event. The first parameter
* is what should be monitored, the rest are the normal parameters when
* subscribing to an event.
* @method monitor
* @param what {string} what to monitor ('detach', 'attach', 'publish').
* @return {EventHandle} return value from the monitor event subscription.
*/
monitor: function(what) {
this.monitored = true;
var type = this.id + '|' + this.type + '_' + what,
args = Y.Array(arguments, 0, true);
args[0] = type;
return this.host.on.apply(this.host, args);
},
/**
* Get all of the subscribers to this event and any sibling event
* @method getSubs
* @return {Array} first item is the on subscribers, second the after.
*/
getSubs: function() {
var s = Y.merge(this.subscribers), a = Y.merge(this.afters), sib = this.sibling;
if (sib) {
Y.mix(s, sib.subscribers);
Y.mix(a, sib.afters);
}
return [s, a];
},
/**
* Apply configuration properties. Only applies the CONFIG whitelist
* @method applyConfig
* @param o hash of properties to apply.
* @param force {boolean} if true, properties that exist on the event
* will be overwritten.
*/
applyConfig: function(o, force) {
if (o) {
Y.mix(this, o, force, CONFIGS);
}
},
/**
* Create the Subscription for subscribing function, context, and bound
* arguments. If this is a fireOnce event, the subscriber is immediately
* notified.
*
* @method _on
* @param fn {Function} Subscription callback
* @param [context] {Object} Override `this` in the callback
* @param [args] {Array} bound arguments that will be passed to the callback after the arguments generated by fire()
* @param [when] {String} "after" to slot into after subscribers
* @return {EventHandle}
* @protected
*/
_on: function(fn, context, args, when) {
if (!fn) {
this.log('Invalid callback for CE: ' + this.type);
}
var s = new Y.Subscriber(fn, context, args, when);
if (this.fireOnce && this.fired) {
if (this.async) {
setTimeout(Y.bind(this._notify, this, s, this.firedWith), 0);
} else {
this._notify(s, this.firedWith);
}
}
if (when == AFTER) {
this.afters[s.id] = s;
this.afterCount++;
} else {
this.subscribers[s.id] = s;
this.subCount++;
}
return new Y.EventHandle(this, s);
},
/**
* Listen for this event
* @method subscribe
* @param {Function} fn The function to execute.
* @return {EventHandle} Unsubscribe handle.
* @deprecated use on.
*/
subscribe: function(fn, context) {
var a = (arguments.length > 2) ? Y.Array(arguments, 2, true) : null;
return this._on(fn, context, a, true);
},
/**
* Listen for this event
* @method on
* @param {Function} fn The function to execute.
* @param {object} context optional execution context.
* @param {mixed} arg* 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} An object with a detach method to detch the handler(s).
*/
on: function(fn, context) {
var a = (arguments.length > 2) ? Y.Array(arguments, 2, true) : null;
if (this.host) {
this.host._monitor('attach', this.type, {
args: arguments
});
}
return this._on(fn, context, a, true);
},
/**
* Listen for this event after the normal subscribers have been notified and
* the default behavior has been applied. If a normal subscriber prevents the
* default behavior, it also prevents after listeners from firing.
* @method after
* @param {Function} fn The function to execute.
* @param {object} context optional execution context.
* @param {mixed} arg* 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} handle Unsubscribe handle.
*/
after: function(fn, context) {
var a = (arguments.length > 2) ? Y.Array(arguments, 2, true) : null;
return this._on(fn, context, a, AFTER);
},
/**
* Detach listeners.
* @method detach
* @param {Function} fn The subscribed function to remove, if not supplied
* all will be removed.
* @param {Object} context The context object passed to subscribe.
* @return {int} returns the number of subscribers unsubscribed.
*/
detach: function(fn, context) {
// unsubscribe handle
if (fn && fn.detach) {
return fn.detach();
}
var i, s,
found = 0,
subs = Y.merge(this.subscribers, this.afters);
for (i in subs) {
if (subs.hasOwnProperty(i)) {
s = subs[i];
if (s && (!fn || fn === s.fn)) {
this._delete(s);
found++;
}
}
}
return found;
},
/**
* Detach listeners.
* @method unsubscribe
* @param {Function} fn The subscribed function to remove, if not supplied
* all will be removed.
* @param {Object} context The context object passed to subscribe.
* @return {int|undefined} returns the number of subscribers unsubscribed.
* @deprecated use detach.
*/
unsubscribe: function() {
return this.detach.apply(this, arguments);
},
/**
* Notify a single subscriber
* @method _notify
* @param {Subscriber} s the subscriber.
* @param {Array} args the arguments array to apply to the listener.
* @protected
*/
_notify: function(s, args, ef) {
this.log(this.type + '->' + 'sub: ' + s.id);
var ret;
ret = s.notify(args, this);
if (false === ret || this.stopped > 1) {
this.log(this.type + ' cancelled by subscriber');
return false;
}
return true;
},
/**
* Logger abstraction to centralize the application of the silent flag
* @method log
* @param {string} msg message to log.
* @param {string} cat log category.
*/
log: function(msg, cat) {
if (!this.silent) {
}
},
/**
* Notifies the subscribers. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters:
* <ul>
* <li>The type of event</li>
* <li>All of the arguments fire() was executed with as an array</li>
* <li>The custom object (if any) that was passed into the subscribe()
* method</li>
* </ul>
* @method fire
* @param {Object*} arguments an arbitrary set of parameters to pass to
* the handler.
* @return {boolean} false if one of the subscribers returned false,
* true otherwise.
*
*/
fire: function() {
if (this.fireOnce && this.fired) {
this.log('fireOnce event: ' + this.type + ' already fired');
return true;
} else {
var args = Y.Array(arguments, 0, true);
// this doesn't happen if the event isn't published
// this.host._monitor('fire', this.type, args);
this.fired = true;
this.firedWith = args;
if (this.emitFacade) {
return this.fireComplex(args);
} else {
return this.fireSimple(args);
}
}
},
/**
* Set up for notifying subscribers of non-emitFacade events.
*
* @method fireSimple
* @param args {Array} Arguments passed to fire()
* @return Boolean false if a subscriber returned false
* @protected
*/
fireSimple: function(args) {
this.stopped = 0;
this.prevented = 0;
if (this.hasSubs()) {
// this._procSubs(Y.merge(this.subscribers, this.afters), args);
var subs = this.getSubs();
this._procSubs(subs[0], args);
this._procSubs(subs[1], args);
}
this._broadcast(args);
return this.stopped ? false : true;
},
// Requires the event-custom-complex module for full funcitonality.
fireComplex: function(args) {
args[0] = args[0] || {};
return this.fireSimple(args);
},
/**
* Notifies a list of subscribers.
*
* @method _procSubs
* @param subs {Array} List of subscribers
* @param args {Array} Arguments passed to fire()
* @param ef {}
* @return Boolean false if a subscriber returns false or stops the event
* propagation via e.stopPropagation(),
* e.stopImmediatePropagation(), or e.halt()
* @private
*/
_procSubs: function(subs, args, ef) {
var s, i;
for (i in subs) {
if (subs.hasOwnProperty(i)) {
s = subs[i];
if (s && s.fn) {
if (false === this._notify(s, args, ef)) {
this.stopped = 2;
}
if (this.stopped == 2) {
return false;
}
}
}
}
return true;
},
/**
* Notifies the YUI instance if the event is configured with broadcast = 1,
* and both the YUI instance and Y.Global if configured with broadcast = 2.
*
* @method _broadcast
* @param args {Array} Arguments sent to fire()
* @private
*/
_broadcast: function(args) {
if (!this.stopped && this.broadcast) {
var a = Y.Array(args);
a.unshift(this.type);
if (this.host !== Y) {
Y.fire.apply(Y, a);
}
if (this.broadcast == 2) {
Y.Global.fire.apply(Y.Global, a);
}
}
},
/**
* Removes all listeners
* @method unsubscribeAll
* @return {int} The number of listeners unsubscribed.
* @deprecated use detachAll.
*/
unsubscribeAll: function() {
return this.detachAll.apply(this, arguments);
},
/**
* Removes all listeners
* @method detachAll
* @return {int} The number of listeners unsubscribed.
*/
detachAll: function() {
return this.detach();
},
/**
* Deletes the subscriber from the internal store of on() and after()
* subscribers.
*
* @method _delete
* @param subscriber object.
* @private
*/
_delete: function(s) {
if (s) {
if (this.subscribers[s.id]) {
delete this.subscribers[s.id];
this.subCount--;
}
if (this.afters[s.id]) {
delete this.afters[s.id];
this.afterCount--;
}
}
if (this.host) {
this.host._monitor('detach', this.type, {
ce: this,
sub: s
});
}
if (s) {
// delete s.fn;
// delete s.context;
s.deleted = true;
}
}
};
/**
* Stores the subscriber information to be used when the event fires.
* @param {Function} fn The wrapped function to execute.
* @param {Object} context The value of the keyword 'this' in the listener.
* @param {Array} args* 0..n additional arguments to supply the listener.
*
* @class Subscriber
* @constructor
*/
Y.Subscriber = function(fn, context, args) {
/**
* The callback that will be execute when the event fires
* This is wrapped by Y.rbind if obj was supplied.
* @property fn
* @type Function
*/
this.fn = fn;
/**
* Optional 'this' keyword for the listener
* @property context
* @type Object
*/
this.context = context;
/**
* Unique subscriber id
* @property id
* @type String
*/
this.id = Y.stamp(this);
/**
* Additional arguments to propagate to the subscriber
* @property args
* @type Array
*/
this.args = args;
/**
* Custom events for a given fire transaction.
* @property events
* @type {EventTarget}
*/
// this.events = null;
/**
* This listener only reacts to the event once
* @property once
*/
// this.once = false;
};
Y.Subscriber.prototype = {
constructor: Y.Subscriber,
_notify: function(c, args, ce) {
if (this.deleted && !this.postponed) {
if (this.postponed) {
delete this.fn;
delete this.context;
} else {
delete this.postponed;
return null;
}
}
var a = this.args, ret;
switch (ce.signature) {
case 0:
ret = this.fn.call(c, ce.type, args, c);
break;
case 1:
ret = this.fn.call(c, args[0] || null, c);
break;
default:
if (a || args) {
args = args || [];
a = (a) ? args.concat(a) : args;
ret = this.fn.apply(c, a);
} else {
ret = this.fn.call(c);
}
}
if (this.once) {
ce._delete(this);
}
return ret;
},
/**
* Executes the subscriber.
* @method notify
* @param args {Array} Arguments array for the subscriber.
* @param ce {CustomEvent} The custom event that sent the notification.
*/
notify: function(args, ce) {
var c = this.context,
ret = true;
if (!c) {
c = (ce.contextFn) ? ce.contextFn() : ce.context;
}
// only catch errors if we will not re-throw them.
if (Y.config.throwFail) {
ret = this._notify(c, args, ce);
} else {
try {
ret = this._notify(c, args, ce);
} catch (e) {
Y.error(this + ' failed: ' + e.message, e);
}
}
return ret;
},
/**
* Returns true if the fn and obj match this objects properties.
* Used by the unsubscribe method to match the right subscriber.
*
* @method contains
* @param {Function} fn the function to execute.
* @param {Object} context optional 'this' keyword for the listener.
* @return {boolean} true if the supplied arguments match this
* subscriber's signature.
*/
contains: function(fn, context) {
if (context) {
return ((this.fn == fn) && this.context == context);
} else {
return (this.fn == fn);
}
}
};
/**
* Return value from all subscribe operations
* @class EventHandle
* @constructor
* @param {CustomEvent} evt the custom event.
* @param {Subscriber} sub the subscriber.
*/
Y.EventHandle = function(evt, sub) {
/**
* The custom event
*
* @property evt
* @type CustomEvent
*/
this.evt = evt;
/**
* The subscriber object
*
* @property sub
* @type Subscriber
*/
this.sub = sub;
};
Y.EventHandle.prototype = {
batch: function(f, c) {
f.call(c || this, this);
if (Y.Lang.isArray(this.evt)) {
Y.Array.each(this.evt, function(h) {
h.batch.call(c || h, f);
});
}
},
/**
* Detaches this subscriber
* @method detach
* @return {int} the number of detached listeners
*/
detach: function() {
var evt = this.evt, detached = 0, i;
if (evt) {
if (Y.Lang.isArray(evt)) {
for (i = 0; i < evt.length; i++) {
detached += evt[i].detach();
}
} else {
evt._delete(this.sub);
detached = 1;
}
}
return detached;
},
/**
* Monitor the event state for the subscribed event. The first parameter
* is what should be monitored, the rest are the normal parameters when
* subscribing to an event.
* @method monitor
* @param what {string} what to monitor ('attach', 'detach', 'publish').
* @return {EventHandle} return value from the monitor event subscription.
*/
monitor: function(what) {
return this.evt.monitor.apply(this.evt, arguments);
}
};
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
/**
* EventTarget provides the implementation for any object to
* publish, subscribe and fire to custom events, and also
* alows other EventTargets to target the object with events
* sourced from the other object.
* EventTarget is designed to be used with Y.augment to wrap
* EventCustom in an interface that allows events to be listened to
* and fired by name. This makes it possible for implementing code to
* subscribe to an event that either has not been created yet, or will
* not be created at all.
* @class EventTarget
* @param opts a configuration object
* @config emitFacade {boolean} if true, all events will emit event
* facade payloads by default (default false)
* @config prefix {String} the prefix to apply to non-prefixed event names
*/
var L = Y.Lang,
PREFIX_DELIMITER = ':',
CATEGORY_DELIMITER = '|',
AFTER_PREFIX = '~AFTER~',
YArray = Y.Array,
_wildType = Y.cached(function(type) {
return type.replace(/(.*)(:)(.*)/, "*$2$3");
}),
/**
* If the instance has a prefix attribute and the
* event type is not prefixed, the instance prefix is
* applied to the supplied type.
* @method _getType
* @private
*/
_getType = Y.cached(function(type, pre) {
if (!pre || !L.isString(type) || type.indexOf(PREFIX_DELIMITER) > -1) {
return type;
}
return pre + PREFIX_DELIMITER + type;
}),
/**
* Returns an array with the detach key (if provided),
* and the prefixed event name from _getType
* Y.on('detachcategory| menu:click', fn)
* @method _parseType
* @private
*/
_parseType = Y.cached(function(type, pre) {
var t = type, detachcategory, after, i;
if (!L.isString(t)) {
return t;
}
i = t.indexOf(AFTER_PREFIX);
if (i > -1) {
after = true;
t = t.substr(AFTER_PREFIX.length);
}
i = t.indexOf(CATEGORY_DELIMITER);
if (i > -1) {
detachcategory = t.substr(0, (i));
t = t.substr(i+1);
if (t == '*') {
t = null;
}
}
// detach category, full type with instance prefix, is this an after listener, short type
return [detachcategory, (pre) ? _getType(t, pre) : t, after, t];
}),
ET = function(opts) {
var o = (L.isObject(opts)) ? opts : {};
this._yuievt = this._yuievt || {
id: Y.guid(),
events: {},
targets: {},
config: o,
chain: ('chain' in o) ? o.chain : Y.config.chain,
bubbling: false,
defaults: {
context: o.context || this,
host: this,
emitFacade: o.emitFacade,
fireOnce: o.fireOnce,
queuable: o.queuable,
monitored: o.monitored,
broadcast: o.broadcast,
defaultTargetOnly: o.defaultTargetOnly,
bubbles: ('bubbles' in o) ? o.bubbles : true
}
};
};
ET.prototype = {
constructor: ET,
/**
* Listen to a custom event hosted by this object one time.
* This is the equivalent to <code>on</code> except the
* listener is immediatelly detached when it is executed.
* @method once
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching the
* subscription
*/
once: function() {
var handle = this.on.apply(this, arguments);
handle.batch(function(hand) {
if (hand.sub) {
hand.sub.once = true;
}
});
return handle;
},
/**
* Listen to a custom event hosted by this object one time.
* This is the equivalent to <code>after</code> except the
* listener is immediatelly detached when it is executed.
* @method onceAfter
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching that
* subscription
*/
onceAfter: function() {
var handle = this.after.apply(this, arguments);
handle.batch(function(hand) {
if (hand.sub) {
hand.sub.once = true;
}
});
return handle;
},
/**
* Takes the type parameter passed to 'on' and parses out the
* various pieces that could be included in the type. If the
* event type is passed without a prefix, it will be expanded
* to include the prefix one is supplied or the event target
* is configured with a default prefix.
* @method parseType
* @param {String} type the type
* @param {String} [pre=this._yuievt.config.prefix] the prefix
* @since 3.3.0
* @return {Array} an array containing:
* * the detach category, if supplied,
* * the prefixed event type,
* * whether or not this is an after listener,
* * the supplied event type
*/
parseType: function(type, pre) {
return _parseType(type, pre || this._yuievt.config.prefix);
},
/**
* Subscribe a callback function to a custom event fired by this object or
* from an object that bubbles its events to this object.
*
* Callback functions for events published with `emitFacade = true` will
* receive an `EventFacade` as the first argument (typically named "e").
* These callbacks can then call `e.preventDefault()` to disable the
* behavior published to that event's `defaultFn`. See the `EventFacade`
* API for all available properties and methods. Subscribers to
* non-`emitFacade` events will receive the arguments passed to `fire()`
* after the event name.
*
* To subscribe to multiple events at once, pass an object as the first
* argument, where the key:value pairs correspond to the eventName:callback,
* or pass an array of event names as the first argument to subscribe to
* all listed events with the same callback.
*
* Returning `false` from a callback is supported as an alternative to
* calling `e.preventDefault(); e.stopPropagation();`. However, it is
* recommended to use the event methods whenever possible.
*
* @method on
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching that
* subscription
*/
on: function(type, fn, context) {
var parts = _parseType(type, this._yuievt.config.prefix), f, c, args, ret, ce,
detachcategory, handle, store = Y.Env.evt.handles, after, adapt, shorttype,
Node = Y.Node, n, domevent, isArr;
// full name, args, detachcategory, after
this._monitor('attach', parts[1], {
args: arguments,
category: parts[0],
after: parts[2]
});
if (L.isObject(type)) {
if (L.isFunction(type)) {
return Y.Do.before.apply(Y.Do, arguments);
}
f = fn;
c = context;
args = YArray(arguments, 0, true);
ret = [];
if (L.isArray(type)) {
isArr = true;
}
after = type._after;
delete type._after;
Y.each(type, function(v, k) {
if (L.isObject(v)) {
f = v.fn || ((L.isFunction(v)) ? v : f);
c = v.context || c;
}
var nv = (after) ? AFTER_PREFIX : '';
args[0] = nv + ((isArr) ? v : k);
args[1] = f;
args[2] = c;
ret.push(this.on.apply(this, args));
}, this);
return (this._yuievt.chain) ? this : new Y.EventHandle(ret);
}
detachcategory = parts[0];
after = parts[2];
shorttype = parts[3];
// extra redirection so we catch adaptor events too. take a look at this.
if (Node && Y.instanceOf(this, Node) && (shorttype in Node.DOM_EVENTS)) {
args = YArray(arguments, 0, true);
args.splice(2, 0, Node.getDOMNode(this));
return Y.on.apply(Y, args);
}
type = parts[1];
if (Y.instanceOf(this, YUI)) {
adapt = Y.Env.evt.plugins[type];
args = YArray(arguments, 0, true);
args[0] = shorttype;
if (Node) {
n = args[2];
if (Y.instanceOf(n, Y.NodeList)) {
n = Y.NodeList.getDOMNodes(n);
} else if (Y.instanceOf(n, Node)) {
n = Node.getDOMNode(n);
}
domevent = (shorttype in Node.DOM_EVENTS);
// Captures both DOM events and event plugins.
if (domevent) {
args[2] = n;
}
}
// check for the existance of an event adaptor
if (adapt) {
handle = adapt.on.apply(Y, args);
} else if ((!type) || domevent) {
handle = Y.Event._attach(args);
}
}
if (!handle) {
ce = this._yuievt.events[type] || this.publish(type);
handle = ce._on(fn, context, (arguments.length > 3) ? YArray(arguments, 3, true) : null, (after) ? 'after' : true);
}
if (detachcategory) {
store[detachcategory] = store[detachcategory] || {};
store[detachcategory][type] = store[detachcategory][type] || [];
store[detachcategory][type].push(handle);
}
return (this._yuievt.chain) ? this : handle;
},
/**
* subscribe to an event
* @method subscribe
* @deprecated use on
*/
subscribe: function() {
return this.on.apply(this, arguments);
},
/**
* Detach one or more listeners the from the specified event
* @method detach
* @param type {string|Object} Either the handle to the subscriber or the
* type of event. If the type
* is not specified, it will attempt to remove
* the listener from all hosted events.
* @param fn {Function} The subscribed function to unsubscribe, if not
* supplied, all subscribers will be removed.
* @param context {Object} The custom object passed to subscribe. This is
* optional, but if supplied will be used to
* disambiguate multiple listeners that are the same
* (e.g., you subscribe many object using a function
* that lives on the prototype)
* @return {EventTarget} the host
*/
detach: function(type, fn, context) {
var evts = this._yuievt.events, i,
Node = Y.Node, isNode = Node && (Y.instanceOf(this, Node));
// detachAll disabled on the Y instance.
if (!type && (this !== Y)) {
for (i in evts) {
if (evts.hasOwnProperty(i)) {
evts[i].detach(fn, context);
}
}
if (isNode) {
Y.Event.purgeElement(Node.getDOMNode(this));
}
return this;
}
var parts = _parseType(type, this._yuievt.config.prefix),
detachcategory = L.isArray(parts) ? parts[0] : null,
shorttype = (parts) ? parts[3] : null,
adapt, store = Y.Env.evt.handles, detachhost, cat, args,
ce,
keyDetacher = function(lcat, ltype, host) {
var handles = lcat[ltype], ce, i;
if (handles) {
for (i = handles.length - 1; i >= 0; --i) {
ce = handles[i].evt;
if (ce.host === host || ce.el === host) {
handles[i].detach();
}
}
}
};
if (detachcategory) {
cat = store[detachcategory];
type = parts[1];
detachhost = (isNode) ? Y.Node.getDOMNode(this) : this;
if (cat) {
if (type) {
keyDetacher(cat, type, detachhost);
} else {
for (i in cat) {
if (cat.hasOwnProperty(i)) {
keyDetacher(cat, i, detachhost);
}
}
}
return this;
}
// If this is an event handle, use it to detach
} else if (L.isObject(type) && type.detach) {
type.detach();
return this;
// extra redirection so we catch adaptor events too. take a look at this.
} else if (isNode && ((!shorttype) || (shorttype in Node.DOM_EVENTS))) {
args = YArray(arguments, 0, true);
args[2] = Node.getDOMNode(this);
Y.detach.apply(Y, args);
return this;
}
adapt = Y.Env.evt.plugins[shorttype];
// The YUI instance handles DOM events and adaptors
if (Y.instanceOf(this, YUI)) {
args = YArray(arguments, 0, true);
// use the adaptor specific detach code if
if (adapt && adapt.detach) {
adapt.detach.apply(Y, args);
return this;
// DOM event fork
} else if (!type || (!adapt && Node && (type in Node.DOM_EVENTS))) {
args[0] = type;
Y.Event.detach.apply(Y.Event, args);
return this;
}
}
// ce = evts[type];
ce = evts[parts[1]];
if (ce) {
ce.detach(fn, context);
}
return this;
},
/**
* detach a listener
* @method unsubscribe
* @deprecated use detach
*/
unsubscribe: function() {
return this.detach.apply(this, arguments);
},
/**
* Removes all listeners from the specified event. If the event type
* is not specified, all listeners from all hosted custom events will
* be removed.
* @method detachAll
* @param type {String} The type, or name of the event
*/
detachAll: function(type) {
return this.detach(type);
},
/**
* Removes all listeners from the specified event. If the event type
* is not specified, all listeners from all hosted custom events will
* be removed.
* @method unsubscribeAll
* @param type {String} The type, or name of the event
* @deprecated use detachAll
*/
unsubscribeAll: function() {
return this.detachAll.apply(this, arguments);
},
/**
* Creates a new custom event of the specified type. If a custom event
* by that name already exists, it will not be re-created. In either
* case the custom event is returned.
*
* @method publish
*
* @param type {String} the type, or name of the event
* @param opts {object} optional config params. Valid properties are:
*
* <ul>
* <li>
* 'broadcast': whether or not the YUI instance and YUI global are notified when the event is fired (false)
* </li>
* <li>
* 'bubbles': whether or not this event bubbles (true)
* Events can only bubble if emitFacade is true.
* </li>
* <li>
* 'context': the default execution context for the listeners (this)
* </li>
* <li>
* 'defaultFn': the default function to execute when this event fires if preventDefault was not called
* </li>
* <li>
* 'emitFacade': whether or not this event emits a facade (false)
* </li>
* <li>
* 'prefix': the prefix for this targets events, e.g., 'menu' in 'menu:click'
* </li>
* <li>
* 'fireOnce': if an event is configured to fire once, new subscribers after
* the fire will be notified immediately.
* </li>
* <li>
* 'async': fireOnce event listeners will fire synchronously if the event has already
* fired unless async is true.
* </li>
* <li>
* 'preventable': whether or not preventDefault() has an effect (true)
* </li>
* <li>
* 'preventedFn': a function that is executed when preventDefault is called
* </li>
* <li>
* 'queuable': whether or not this event can be queued during bubbling (false)
* </li>
* <li>
* 'silent': if silent is true, debug messages are not provided for this event.
* </li>
* <li>
* 'stoppedFn': a function that is executed when stopPropagation is called
* </li>
*
* <li>
* 'monitored': specifies whether or not this event should send notifications about
* when the event has been attached, detached, or published.
* </li>
* <li>
* 'type': the event type (valid option if not provided as the first parameter to publish)
* </li>
* </ul>
*
* @return {CustomEvent} the custom event
*
*/
publish: function(type, opts) {
var events, ce, ret, defaults,
edata = this._yuievt,
pre = edata.config.prefix;
if (L.isObject(type)) {
ret = {};
Y.each(type, function(v, k) {
ret[k] = this.publish(k, v || opts);
}, this);
return ret;
}
type = (pre) ? _getType(type, pre) : type;
this._monitor('publish', type, {
args: arguments
});
events = edata.events;
ce = events[type];
if (ce) {
// ce.log("publish applying new config to published event: '"+type+"' exists", 'info', 'event');
if (opts) {
ce.applyConfig(opts, true);
}
} else {
defaults = edata.defaults;
// apply defaults
ce = new Y.CustomEvent(type,
(opts) ? Y.merge(defaults, opts) : defaults);
events[type] = ce;
}
// make sure we turn the broadcast flag off if this
// event was published as a result of bubbling
// if (opts instanceof Y.CustomEvent) {
// events[type].broadcast = false;
// }
return events[type];
},
/**
* This is the entry point for the event monitoring system.
* You can monitor 'attach', 'detach', 'fire', and 'publish'.
* When configured, these events generate an event. click ->
* click_attach, click_detach, click_publish -- these can
* be subscribed to like other events to monitor the event
* system. Inividual published events can have monitoring
* turned on or off (publish can't be turned off before it
* it published) by setting the events 'monitor' config.
*
* @method _monitor
* @param what {String} 'attach', 'detach', 'fire', or 'publish'
* @param type {String} Name of the event being monitored
* @param o {Object} Information about the event interaction, such as
* fire() args, subscription category, publish config
* @private
*/
_monitor: function(what, type, o) {
var monitorevt, ce = this.getEvent(type);
if ((this._yuievt.config.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) {
monitorevt = type + '_' + what;
o.monitored = what;
this.fire.call(this, monitorevt, o);
}
},
/**
* Fire a custom event by name. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters.
*
* If the custom event object hasn't been created, then the event hasn't
* been published and it has no subscribers. For performance sake, we
* immediate exit in this case. This means the event won't bubble, so
* if the intention is that a bubble target be notified, the event must
* be published on this object first.
*
* The first argument is the event type, and any additional arguments are
* passed to the listeners as parameters. If the first of these is an
* object literal, and the event is configured to emit an event facade,
* that object is mixed into the event facade and the facade is provided
* in place of the original object.
*
* @method fire
* @param type {String|Object} The type of the event, or an object that contains
* a 'type' property.
* @param arguments {Object*} an arbitrary set of parameters to pass to
* the handler. If the first of these is an object literal and the event is
* configured to emit an event facade, the event facade will replace that
* parameter after the properties the object literal contains are copied to
* the event facade.
* @return {EventTarget} the event host
*
*/
fire: function(type) {
var typeIncluded = L.isString(type),
t = (typeIncluded) ? type : (type && type.type),
ce, ret, pre = this._yuievt.config.prefix, ce2,
args = (typeIncluded) ? YArray(arguments, 1, true) : arguments;
t = (pre) ? _getType(t, pre) : t;
this._monitor('fire', t, {
args: args
});
ce = this.getEvent(t, true);
ce2 = this.getSibling(t, ce);
if (ce2 && !ce) {
ce = this.publish(t);
}
// this event has not been published or subscribed to
if (!ce) {
if (this._yuievt.hasTargets) {
return this.bubble({ type: t }, args, this);
}
// otherwise there is nothing to be done
ret = true;
} else {
ce.sibling = ce2;
ret = ce.fire.apply(ce, args);
}
return (this._yuievt.chain) ? this : ret;
},
getSibling: function(type, ce) {
var ce2;
// delegate to *:type events if there are subscribers
if (type.indexOf(PREFIX_DELIMITER) > -1) {
type = _wildType(type);
// console.log(type);
ce2 = this.getEvent(type, true);
if (ce2) {
// console.log("GOT ONE: " + type);
ce2.applyConfig(ce);
ce2.bubbles = false;
ce2.broadcast = 0;
// ret = ce2.fire.apply(ce2, a);
}
}
return ce2;
},
/**
* Returns the custom event of the provided type has been created, a
* falsy value otherwise
* @method getEvent
* @param type {String} the type, or name of the event
* @param prefixed {String} if true, the type is prefixed already
* @return {CustomEvent} the custom event or null
*/
getEvent: function(type, prefixed) {
var pre, e;
if (!prefixed) {
pre = this._yuievt.config.prefix;
type = (pre) ? _getType(type, pre) : type;
}
e = this._yuievt.events;
return e[type] || null;
},
/**
* Subscribe to a custom event hosted by this object. The
* supplied callback will execute after any listeners add
* via the subscribe method, and after the default function,
* if configured for the event, has executed.
*
* @method after
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching the
* subscription
*/
after: function(type, fn) {
var a = YArray(arguments, 0, true);
switch (L.type(type)) {
case 'function':
return Y.Do.after.apply(Y.Do, arguments);
case 'array':
// YArray.each(a[0], function(v) {
// v = AFTER_PREFIX + v;
// });
// break;
case 'object':
a[0]._after = true;
break;
default:
a[0] = AFTER_PREFIX + type;
}
return this.on.apply(this, a);
},
/**
* Executes the callback before a DOM event, custom event
* or method. If the first argument is a function, it
* is assumed the target is a method. For DOM and custom
* events, this is an alias for Y.on.
*
* For DOM and custom events:
* type, callback, context, 0-n arguments
*
* For methods:
* callback, object (method host), methodName, context, 0-n arguments
*
* @method before
* @return detach handle
*/
before: function() {
return this.on.apply(this, arguments);
}
};
Y.EventTarget = ET;
// make Y an event target
Y.mix(Y, ET.prototype);
ET.call(Y, { bubbles: false });
YUI.Env.globalEvents = YUI.Env.globalEvents || new ET();
/**
* Hosts YUI page level events. This is where events bubble to
* when the broadcast config is set to 2. This property is
* only available if the custom event module is loaded.
* @property Global
* @type EventTarget
* @for YUI
*/
Y.Global = YUI.Env.globalEvents;
// @TODO implement a global namespace function on Y.Global?
/**
`Y.on()` can do many things:
<ul>
<li>Subscribe to custom events `publish`ed and `fire`d from Y</li>
<li>Subscribe to custom events `publish`ed with `broadcast` 1 or 2 and
`fire`d from any object in the YUI instance sandbox</li>
<li>Subscribe to DOM events</li>
<li>Subscribe to the execution of a method on any object, effectively
treating that method as an event</li>
</ul>
For custom event subscriptions, pass the custom event name as the first argument and callback as the second. The `this` object in the callback will be `Y` unless an override is passed as the third argument.
Y.on('io:complete', function () {
Y.MyApp.updateStatus('Transaction complete');
});
To subscribe to DOM events, pass the name of a DOM event as the first argument
and a CSS selector string as the third argument after the callback function.
Alternately, the third argument can be a `Node`, `NodeList`, `HTMLElement`,
array, or simply omitted (the default is the `window` object).
Y.on('click', function (e) {
e.preventDefault();
// proceed with ajax form submission
var url = this.get('action');
...
}, '#my-form');
The `this` object in DOM event callbacks will be the `Node` targeted by the CSS
selector or other identifier.
`on()` subscribers for DOM events or custom events `publish`ed with a
`defaultFn` can prevent the default behavior with `e.preventDefault()` from the
event object passed as the first parameter to the subscription callback.
To subscribe to the execution of an object method, pass arguments corresponding to the call signature for
<a href="../classes/Do.html#methods_before">`Y.Do.before(...)`</a>.
NOTE: The formal parameter list below is for events, not for function
injection. See `Y.Do.before` for that signature.
@method on
@param {String} type DOM or custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@see Do.before
@for YUI
**/
/**
Listen for an event one time. Equivalent to `on()`, except that
the listener is immediately detached when executed.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
@see on
@method once
@param {String} type DOM or custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
/**
Listen for an event one time. Equivalent to `once()`, except, like `after()`,
the subscription callback executes after all `on()` subscribers and the event's
`defaultFn` (if configured) have executed. Like `after()` if any `on()` phase
subscriber calls `e.preventDefault()`, neither the `defaultFn` nor the `after()`
subscribers will execute.
The listener is immediately detached when executed.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
@see once
@method onceAfter
@param {String} type The custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
/**
Like `on()`, this method creates a subscription to a custom event or to the
execution of a method on an object.
For events, `after()` subscribers are executed after the event's
`defaultFn` unless `e.preventDefault()` was called from an `on()` subscriber.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
NOTE: The subscription signature shown is for events, not for function
injection. See <a href="../classes/Do.html#methods_after">`Y.Do.after`</a>
for that signature.
@see on
@see Do.after
@method after
@param {String} type The custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [args*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
}, '@VERSION@' ,{requires:['oop']});
|
assets/jqwidgets/demos/react/app/treegrid/nestedjsondata/app.js
|
juannelisalde/holter
|
import React from 'react';
import ReactDOM from 'react-dom';
import JqxTreeGrid from '../../../jqwidgets-react/react_jqxtreegrid.js';
class App extends React.Component {
render () {
let employees = [
{
'EmployeeID': 2, 'FirstName': 'Andrew', 'LastName': 'Fuller', 'Country': 'USA', 'Title': 'Vice President, Sales', 'HireDate': '1992-08-14 00:00:00', 'BirthDate': '1952-02-19 00:00:00', 'City': 'Tacoma', 'Address': '908 W. Capital Way', 'expanded': 'true',
'children': [
{ 'EmployeeID': 8, 'FirstName': 'Laura', 'LastName': 'Callahan', 'Country': 'USA', 'Title': 'Inside Sales Coordinator', 'HireDate': '1994-03-05 00:00:00', 'BirthDate': '1958-01-09 00:00:00', 'City': 'Seattle', 'Address': '4726 - 11th Ave. N.E.' },
{ 'EmployeeID': 1, 'FirstName': 'Nancy', 'LastName': 'Davolio', 'Country': 'USA', 'Title': 'Sales Representative', 'HireDate': '1992-05-01 00:00:00', 'BirthDate': '1948-12-08 00:00:00', 'City': 'Seattle', 'Address': '507 - 20th Ave. E.Apt. 2A' },
{ 'EmployeeID': 3, 'FirstName': 'Janet', 'LastName': 'Leverling', 'Country': 'USA', 'Title': 'Sales Representative', 'HireDate': '1992-04-01 00:00:00', 'BirthDate': '1963-08-30 00:00:00', 'City': 'Kirkland', 'Address': '722 Moss Bay Blvd.' },
{ 'EmployeeID': 4, 'FirstName': 'Margaret', 'LastName': 'Peacock', 'Country': 'USA', 'Title': 'Sales Representative', 'HireDate': '1993-05-03 00:00:00', 'BirthDate': '1937-09-19 00:00:00', 'City': 'Redmond', 'Address': '4110 Old Redmond Rd.' },
{
'EmployeeID': 5, 'FirstName': 'Steven', 'LastName': 'Buchanan', 'Country': 'UK', 'Title': 'Sales Manager', 'HireDate': '1993-10-17 00:00:00', 'BirthDate': '1955-03-04 00:00:00', 'City': 'London', 'Address': '14 Garrett Hill', 'expanded': 'true',
'children': [
{ 'EmployeeID': 6, 'FirstName': 'Michael', 'LastName': 'Suyama', 'Country': 'UK', 'Title': 'Sales Representative', 'HireDate': '1993-10-17 00:00:00', 'BirthDate': '1963-07-02 00:00:00', 'City': 'London', 'Address': 'Coventry House Miner Rd.' },
{ 'EmployeeID': 7, 'FirstName': 'Robert', 'LastName': 'King', 'Country': 'UK', 'Title': 'Sales Representative', 'HireDate': '1994-01-02 00:00:00', 'BirthDate': '1960-05-29 00:00:00', 'City': 'London', 'Address': 'Edgeham Hollow Winchester Way' },
{ 'EmployeeID': 9, 'FirstName': 'Anne', 'LastName': 'Dodsworth', 'Country': 'UK', 'Title': 'Sales Representative', 'HireDate': '1994-11-15 00:00:00', 'BirthDate': '1966-01-27 00:00:00', 'City': 'London', 'Address': '7 Houndstooth Rd.' }
]
}
]
}
];
// prepare the data
let source =
{
dataType: 'json',
dataFields: [
{ name: 'EmployeeID', type: 'number' },
{ name: 'FirstName', type: 'string' },
{ name: 'LastName', type: 'string' },
{ name: 'Country', type: 'string' },
{ name: 'City', type: 'string' },
{ name: 'Address', type: 'string' },
{ name: 'Title', type: 'string' },
{ name: 'HireDate', type: 'date' },
{ name: 'children', type: 'array' },
{ name: 'expanded', type: 'bool' },
{ name: 'BirthDate', type: 'date' }
],
hierarchy:
{
root: 'children'
},
id: 'EmployeeID',
localData: employees
};
let dataAdapter = new $.jqx.dataAdapter(source);
// create Tree Grid
let columns = [
{ text: 'FirstName', dataField: 'FirstName', width: 200 },
{ text: 'LastName', dataField: 'LastName', width: 120 },
{ text: 'Title', dataField: 'Title', width: 160 },
{ text: 'Birth Date', dataField: 'BirthDate', cellsFormat: 'd', width: 120 },
{ text: 'Hire Date', dataField: 'HireDate', cellsFormat: 'd', width: 120 },
{ text: 'Address', dataField: 'Address', width: 250 },
{ text: 'City', dataField: 'City', width: 120 },
{ text: 'Country', dataField: 'Country' }
];
let columnGroups = [{ text: 'Name', name: 'Name' }];
return (
<JqxTreeGrid
ref='myTreeGrid'
width={850}
source={dataAdapter}
sortable={true}
columns={columns}
/>
)
}
}
ReactDOM.render(<App />, document.getElementById('app'));
|
app/javascript/mastodon/components/status_list.js
|
ikuradon/mastodon
|
import { debounce } from 'lodash';
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import StatusContainer from '../containers/status_container';
import ImmutablePureComponent from 'react-immutable-pure-component';
import LoadGap from './load_gap';
import ScrollableList from './scrollable_list';
import RegenerationIndicator from 'mastodon/components/regeneration_indicator';
export default class StatusList extends ImmutablePureComponent {
static propTypes = {
scrollKey: PropTypes.string.isRequired,
statusIds: ImmutablePropTypes.list.isRequired,
featuredStatusIds: ImmutablePropTypes.list,
onLoadMore: PropTypes.func,
onScrollToTop: PropTypes.func,
onScroll: PropTypes.func,
trackScroll: PropTypes.bool,
isLoading: PropTypes.bool,
isPartial: PropTypes.bool,
hasMore: PropTypes.bool,
prepend: PropTypes.node,
emptyMessage: PropTypes.node,
alwaysPrepend: PropTypes.bool,
timelineId: PropTypes.string,
};
static defaultProps = {
trackScroll: true,
};
getFeaturedStatusCount = () => {
return this.props.featuredStatusIds ? this.props.featuredStatusIds.size : 0;
}
getCurrentStatusIndex = (id, featured) => {
if (featured) {
return this.props.featuredStatusIds.indexOf(id);
} else {
return this.props.statusIds.indexOf(id) + this.getFeaturedStatusCount();
}
}
handleMoveUp = (id, featured) => {
const elementIndex = this.getCurrentStatusIndex(id, featured) - 1;
this._selectChild(elementIndex, true);
}
handleMoveDown = (id, featured) => {
const elementIndex = this.getCurrentStatusIndex(id, featured) + 1;
this._selectChild(elementIndex, false);
}
handleLoadOlder = debounce(() => {
this.props.onLoadMore(this.props.statusIds.size > 0 ? this.props.statusIds.last() : undefined);
}, 300, { leading: true })
_selectChild (index, align_top) {
const container = this.node.node;
const element = container.querySelector(`article:nth-of-type(${index + 1}) .focusable`);
if (element) {
if (align_top && container.scrollTop > element.offsetTop) {
element.scrollIntoView(true);
} else if (!align_top && container.scrollTop + container.clientHeight < element.offsetTop + element.offsetHeight) {
element.scrollIntoView(false);
}
element.focus();
}
}
setRef = c => {
this.node = c;
}
render () {
const { statusIds, featuredStatusIds, onLoadMore, timelineId, ...other } = this.props;
const { isLoading, isPartial } = other;
if (isPartial) {
return <RegenerationIndicator />;
}
let scrollableContent = (isLoading || statusIds.size > 0) ? (
statusIds.map((statusId, index) => statusId === null ? (
<LoadGap
key={'gap:' + statusIds.get(index + 1)}
disabled={isLoading}
maxId={index > 0 ? statusIds.get(index - 1) : null}
onClick={onLoadMore}
/>
) : (
<StatusContainer
key={statusId}
id={statusId}
onMoveUp={this.handleMoveUp}
onMoveDown={this.handleMoveDown}
contextType={timelineId}
scrollKey={this.props.scrollKey}
showThread
/>
))
) : null;
if (scrollableContent && featuredStatusIds) {
scrollableContent = featuredStatusIds.map(statusId => (
<StatusContainer
key={`f-${statusId}`}
id={statusId}
featured
onMoveUp={this.handleMoveUp}
onMoveDown={this.handleMoveDown}
contextType={timelineId}
showThread
/>
)).concat(scrollableContent);
}
return (
<ScrollableList {...other} showLoading={isLoading && statusIds.size === 0} onLoadMore={onLoadMore && this.handleLoadOlder} ref={this.setRef}>
{scrollableContent}
</ScrollableList>
);
}
}
|
node_modules/reactify/node_modules/react-tools/src/core/ReactCompositeComponent.js
|
belongco/react-multi-select-dropdown
|
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactCompositeComponent
*/
'use strict';
var ReactComponentEnvironment = require('ReactComponentEnvironment');
var ReactContext = require('ReactContext');
var ReactCurrentOwner = require('ReactCurrentOwner');
var ReactElement = require('ReactElement');
var ReactElementValidator = require('ReactElementValidator');
var ReactInstanceMap = require('ReactInstanceMap');
var ReactLifeCycle = require('ReactLifeCycle');
var ReactNativeComponent = require('ReactNativeComponent');
var ReactPerf = require('ReactPerf');
var ReactPropTypeLocations = require('ReactPropTypeLocations');
var ReactPropTypeLocationNames = require('ReactPropTypeLocationNames');
var ReactReconciler = require('ReactReconciler');
var ReactUpdates = require('ReactUpdates');
var assign = require('Object.assign');
var emptyObject = require('emptyObject');
var invariant = require('invariant');
var shouldUpdateReactComponent = require('shouldUpdateReactComponent');
var warning = require('warning');
function getDeclarationErrorAddendum(component) {
var owner = component._currentElement._owner || null;
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
* - constructor: Initialization of state. The instance is now retained.
* - componentWillMount
* - render
* - [children's constructors]
* - [children's componentWillMount and render]
* - [children's componentDidMount]
* - componentDidMount
*
* Update Phases:
* - componentWillReceiveProps (only called if parent updated)
* - shouldComponentUpdate
* - componentWillUpdate
* - render
* - [children's constructors or receive props phases]
* - componentDidUpdate
*
* - componentWillUnmount
* - [children's componentWillUnmount]
* - [children destroyed]
* - (destroyed): The instance is now blank, released by React and ready for GC.
*
* -----------------------------------------------------------------------------
*/
/**
* An incrementing ID assigned to each component when it is mounted. This is
* used to enforce the order in which `ReactUpdates` updates dirty components.
*
* @private
*/
var nextMountID = 1;
/**
* @lends {ReactCompositeComponent.prototype}
*/
var ReactCompositeComponentMixin = {
/**
* Base constructor for all composite component.
*
* @param {ReactElement} element
* @final
* @internal
*/
construct: function(element) {
this._currentElement = element;
this._rootNodeID = null;
this._instance = null;
// See ReactUpdateQueue
this._pendingElement = null;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
this._renderedComponent = null;
this._context = null;
this._mountOrder = 0;
this._isTopLevel = false;
// See ReactUpdates and ReactUpdateQueue.
this._pendingCallbacks = null;
},
/**
* Initializes the component, renders markup, and registers event listeners.
*
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
mountComponent: function(rootID, transaction, context) {
this._context = context;
this._mountOrder = nextMountID++;
this._rootNodeID = rootID;
var publicProps = this._processProps(this._currentElement.props);
var publicContext = this._processContext(this._currentElement._context);
var Component = ReactNativeComponent.getComponentClassForElement(
this._currentElement
);
// Initialize the public class
var inst = new Component(publicProps, publicContext);
if (__DEV__) {
// This will throw later in _renderValidatedComponent, but add an early
// warning now to help debugging
warning(
inst.render != null,
'%s(...): No `render` method found on the returned component ' +
'instance: you may have forgotten to define `render` in your ' +
'component or you may have accidentally tried to render an element ' +
'whose type is a function that isn\'t a React component.',
Component.displayName || Component.name || 'Component'
);
}
// These should be set up in the constructor, but as a convenience for
// simpler class abstractions, we set them up after the fact.
inst.props = publicProps;
inst.context = publicContext;
inst.refs = emptyObject;
this._instance = inst;
// Store a reference from the instance back to the internal representation
ReactInstanceMap.set(inst, this);
if (__DEV__) {
this._warnIfContextsDiffer(this._currentElement._context, context);
}
if (__DEV__) {
// Since plain JS classes are defined without any special initialization
// logic, we can not catch common errors early. Therefore, we have to
// catch them here, at initialization time, instead.
warning(
!inst.getInitialState ||
inst.getInitialState.isReactClassApproved,
'getInitialState was defined on %s, a plain JavaScript class. ' +
'This is only supported for classes created using React.createClass. ' +
'Did you mean to define a state property instead?',
this.getName() || 'a component'
);
warning(
!inst.getDefaultProps ||
inst.getDefaultProps.isReactClassApproved,
'getDefaultProps was defined on %s, a plain JavaScript class. ' +
'This is only supported for classes created using React.createClass. ' +
'Use a static property to define defaultProps instead.',
this.getName() || 'a component'
);
warning(
!inst.propTypes,
'propTypes was defined as an instance property on %s. Use a static ' +
'property to define propTypes instead.',
this.getName() || 'a component'
);
warning(
!inst.contextTypes,
'contextTypes was defined as an instance property on %s. Use a ' +
'static property to define contextTypes instead.',
this.getName() || 'a component'
);
warning(
typeof inst.componentShouldUpdate !== 'function',
'%s has a method called ' +
'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
'The name is phrased as a question because the function is ' +
'expected to return a value.',
(this.getName() || 'A component')
);
}
var initialState = inst.state;
if (initialState === undefined) {
inst.state = initialState = null;
}
invariant(
typeof initialState === 'object' && !Array.isArray(initialState),
'%s.state: must be set to an object or null',
this.getName() || 'ReactCompositeComponent'
);
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
var childContext;
var renderedElement;
var previouslyMounting = ReactLifeCycle.currentlyMountingInstance;
ReactLifeCycle.currentlyMountingInstance = this;
try {
if (inst.componentWillMount) {
inst.componentWillMount();
// When mounting, calls to `setState` by `componentWillMount` will set
// `this._pendingStateQueue` without triggering a re-render.
if (this._pendingStateQueue) {
inst.state = this._processPendingState(inst.props, inst.context);
}
}
childContext = this._getValidatedChildContext(context);
renderedElement = this._renderValidatedComponent(childContext);
} finally {
ReactLifeCycle.currentlyMountingInstance = previouslyMounting;
}
this._renderedComponent = this._instantiateReactComponent(
renderedElement,
this._currentElement.type // The wrapping type
);
var markup = ReactReconciler.mountComponent(
this._renderedComponent,
rootID,
transaction,
this._mergeChildContext(context, childContext)
);
if (inst.componentDidMount) {
transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
}
return markup;
},
/**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
unmountComponent: function() {
var inst = this._instance;
if (inst.componentWillUnmount) {
var previouslyUnmounting = ReactLifeCycle.currentlyUnmountingInstance;
ReactLifeCycle.currentlyUnmountingInstance = this;
try {
inst.componentWillUnmount();
} finally {
ReactLifeCycle.currentlyUnmountingInstance = previouslyUnmounting;
}
}
ReactReconciler.unmountComponent(this._renderedComponent);
this._renderedComponent = null;
// Reset pending fields
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
this._pendingCallbacks = null;
this._pendingElement = null;
// These fields do not really need to be reset since this object is no
// longer accessible.
this._context = null;
this._rootNodeID = null;
// Delete the reference from the instance to this internal representation
// which allow the internals to be properly cleaned up even if the user
// leaks a reference to the public instance.
ReactInstanceMap.remove(inst);
// Some existing components rely on inst.props even after they've been
// destroyed (in event handlers).
// TODO: inst.props = null;
// TODO: inst.state = null;
// TODO: inst.context = null;
},
/**
* Schedule a partial update to the props. Only used for internal testing.
*
* @param {object} partialProps Subset of the next props.
* @param {?function} callback Called after props are updated.
* @final
* @internal
*/
_setPropsInternal: function(partialProps, callback) {
// This is a deoptimized path. We optimize for always having an element.
// This creates an extra internal element.
var element = this._pendingElement || this._currentElement;
this._pendingElement = ReactElement.cloneAndReplaceProps(
element,
assign({}, element.props, partialProps)
);
ReactUpdates.enqueueUpdate(this, callback);
},
/**
* Filters the context object to only contain keys specified in
* `contextTypes`
*
* @param {object} context
* @return {?object}
* @private
*/
_maskContext: function(context) {
var maskedContext = null;
// This really should be getting the component class for the element,
// but we know that we're not going to need it for built-ins.
if (typeof this._currentElement.type === 'string') {
return emptyObject;
}
var contextTypes = this._currentElement.type.contextTypes;
if (!contextTypes) {
return emptyObject;
}
maskedContext = {};
for (var contextName in contextTypes) {
maskedContext[contextName] = context[contextName];
}
return maskedContext;
},
/**
* Filters the context object to only contain keys specified in
* `contextTypes`, and asserts that they are valid.
*
* @param {object} context
* @return {?object}
* @private
*/
_processContext: function(context) {
var maskedContext = this._maskContext(context);
if (__DEV__) {
var Component = ReactNativeComponent.getComponentClassForElement(
this._currentElement
);
if (Component.contextTypes) {
this._checkPropTypes(
Component.contextTypes,
maskedContext,
ReactPropTypeLocations.context
);
}
}
return maskedContext;
},
/**
* @param {object} currentContext
* @return {object}
* @private
*/
_getValidatedChildContext: function(currentContext) {
var inst = this._instance;
var childContext = inst.getChildContext && inst.getChildContext();
if (childContext) {
invariant(
typeof inst.constructor.childContextTypes === 'object',
'%s.getChildContext(): childContextTypes must be defined in order to ' +
'use getChildContext().',
this.getName() || 'ReactCompositeComponent'
);
if (__DEV__) {
this._checkPropTypes(
inst.constructor.childContextTypes,
childContext,
ReactPropTypeLocations.childContext
);
}
for (var name in childContext) {
invariant(
name in inst.constructor.childContextTypes,
'%s.getChildContext(): key "%s" is not defined in childContextTypes.',
this.getName() || 'ReactCompositeComponent',
name
);
}
return childContext;
}
return null;
},
_mergeChildContext: function(currentContext, childContext) {
if (childContext) {
return assign({}, currentContext, childContext);
}
return currentContext;
},
/**
* Processes props by setting default values for unspecified props and
* asserting that the props are valid. Does not mutate its argument; returns
* a new props object with defaults merged in.
*
* @param {object} newProps
* @return {object}
* @private
*/
_processProps: function(newProps) {
if (__DEV__) {
var Component = ReactNativeComponent.getComponentClassForElement(
this._currentElement
);
if (Component.propTypes) {
this._checkPropTypes(
Component.propTypes,
newProps,
ReactPropTypeLocations.prop
);
}
}
return newProps;
},
/**
* Assert that the props are valid
*
* @param {object} propTypes Map of prop name to a ReactPropType
* @param {object} props
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
_checkPropTypes: function(propTypes, props, location) {
// TODO: Stop validating prop types here and only use the element
// validation.
var componentName = this.getName();
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error;
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
invariant(
typeof propTypes[propName] === 'function',
'%s: %s type `%s` is invalid; it must be a function, usually ' +
'from React.PropTypes.',
componentName || 'React class',
ReactPropTypeLocationNames[location],
propName
);
error = propTypes[propName](props, propName, componentName, location);
} catch (ex) {
error = ex;
}
if (error instanceof Error) {
// We may want to extend this logic for similar errors in
// React.render calls, so I'm abstracting it away into
// a function to minimize refactoring in the future
var addendum = getDeclarationErrorAddendum(this);
if (location === ReactPropTypeLocations.prop) {
// Preface gives us something to blacklist in warning module
warning(
false,
'Failed Composite propType: %s%s',
error.message,
addendum
);
} else {
warning(
false,
'Failed Context Types: %s%s',
error.message,
addendum
);
}
}
}
}
},
receiveComponent: function(nextElement, transaction, nextContext) {
var prevElement = this._currentElement;
var prevContext = this._context;
this._pendingElement = null;
this.updateComponent(
transaction,
prevElement,
nextElement,
prevContext,
nextContext
);
},
/**
* If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
* is set, update the component.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function(transaction) {
if (this._pendingElement != null) {
ReactReconciler.receiveComponent(
this,
this._pendingElement || this._currentElement,
transaction,
this._context
);
}
if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
if (__DEV__) {
ReactElementValidator.checkAndWarnForMutatedProps(
this._currentElement
);
}
this.updateComponent(
transaction,
this._currentElement,
this._currentElement,
this._context,
this._context
);
}
},
/**
* Compare two contexts, warning if they are different
* TODO: Remove this check when owner-context is removed
*/
_warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {
ownerBasedContext = this._maskContext(ownerBasedContext);
parentBasedContext = this._maskContext(parentBasedContext);
var parentKeys = Object.keys(parentBasedContext).sort();
var displayName = this.getName() || 'ReactCompositeComponent';
for (var i = 0; i < parentKeys.length; i++) {
var key = parentKeys[i];
warning(
ownerBasedContext[key] === parentBasedContext[key],
'owner-based and parent-based contexts differ ' +
'(values: `%s` vs `%s`) for key (%s) while mounting %s ' +
'(see: http://fb.me/react-context-by-parent)',
ownerBasedContext[key],
parentBasedContext[key],
key,
displayName
);
}
},
/**
* Perform an update to a mounted component. The componentWillReceiveProps and
* shouldComponentUpdate methods are called, then (assuming the update isn't
* skipped) the remaining update lifecycle methods are called and the DOM
* representation is updated.
*
* By default, this implements React's rendering and reconciliation algorithm.
* Sophisticated clients may wish to override this.
*
* @param {ReactReconcileTransaction} transaction
* @param {ReactElement} prevParentElement
* @param {ReactElement} nextParentElement
* @internal
* @overridable
*/
updateComponent: function(
transaction,
prevParentElement,
nextParentElement,
prevUnmaskedContext,
nextUnmaskedContext
) {
var inst = this._instance;
var nextContext = inst.context;
var nextProps = inst.props;
// Distinguish between a props update versus a simple state update
if (prevParentElement !== nextParentElement) {
nextContext = this._processContext(nextParentElement._context);
nextProps = this._processProps(nextParentElement.props);
if (__DEV__) {
if (nextUnmaskedContext != null) {
this._warnIfContextsDiffer(
nextParentElement._context,
nextUnmaskedContext
);
}
}
// An update here will schedule an update but immediately set
// _pendingStateQueue which will ensure that any state updates gets
// immediately reconciled instead of waiting for the next batch.
if (inst.componentWillReceiveProps) {
inst.componentWillReceiveProps(nextProps, nextContext);
}
}
var nextState = this._processPendingState(nextProps, nextContext);
var shouldUpdate =
this._pendingForceUpdate ||
!inst.shouldComponentUpdate ||
inst.shouldComponentUpdate(nextProps, nextState, nextContext);
if (__DEV__) {
warning(
typeof shouldUpdate !== 'undefined',
'%s.shouldComponentUpdate(): Returned undefined instead of a ' +
'boolean value. Make sure to return true or false.',
this.getName() || 'ReactCompositeComponent'
);
}
if (shouldUpdate) {
this._pendingForceUpdate = false;
// Will set `this.props`, `this.state` and `this.context`.
this._performComponentUpdate(
nextParentElement,
nextProps,
nextState,
nextContext,
transaction,
nextUnmaskedContext
);
} else {
// If it's determined that a component should not update, we still want
// to set props and state but we shortcut the rest of the update.
this._currentElement = nextParentElement;
this._context = nextUnmaskedContext;
inst.props = nextProps;
inst.state = nextState;
inst.context = nextContext;
}
},
_processPendingState: function(props, context) {
var inst = this._instance;
var queue = this._pendingStateQueue;
var replace = this._pendingReplaceState;
this._pendingReplaceState = false;
this._pendingStateQueue = null;
if (!queue) {
return inst.state;
}
if (replace && queue.length === 1) {
return queue[0];
}
var nextState = assign({}, replace ? queue[0] : inst.state);
for (var i = replace ? 1 : 0; i < queue.length; i++) {
var partial = queue[i];
assign(
nextState,
typeof partial === 'function' ?
partial.call(inst, nextState, props, context) :
partial
);
}
return nextState;
},
/**
* Merges new props and state, notifies delegate methods of update and
* performs update.
*
* @param {ReactElement} nextElement Next element
* @param {object} nextProps Next public object to set as properties.
* @param {?object} nextState Next object to set as state.
* @param {?object} nextContext Next public object to set as context.
* @param {ReactReconcileTransaction} transaction
* @param {?object} unmaskedContext
* @private
*/
_performComponentUpdate: function(
nextElement,
nextProps,
nextState,
nextContext,
transaction,
unmaskedContext
) {
var inst = this._instance;
var prevProps = inst.props;
var prevState = inst.state;
var prevContext = inst.context;
if (inst.componentWillUpdate) {
inst.componentWillUpdate(nextProps, nextState, nextContext);
}
this._currentElement = nextElement;
this._context = unmaskedContext;
inst.props = nextProps;
inst.state = nextState;
inst.context = nextContext;
this._updateRenderedComponent(transaction, unmaskedContext);
if (inst.componentDidUpdate) {
transaction.getReactMountReady().enqueue(
inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext),
inst
);
}
},
/**
* Call the component's `render` method and update the DOM accordingly.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
_updateRenderedComponent: function(transaction, context) {
var prevComponentInstance = this._renderedComponent;
var prevRenderedElement = prevComponentInstance._currentElement;
var childContext = this._getValidatedChildContext();
var nextRenderedElement = this._renderValidatedComponent(childContext);
if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
ReactReconciler.receiveComponent(
prevComponentInstance,
nextRenderedElement,
transaction,
this._mergeChildContext(context, childContext)
);
} else {
// These two IDs are actually the same! But nothing should rely on that.
var thisID = this._rootNodeID;
var prevComponentID = prevComponentInstance._rootNodeID;
ReactReconciler.unmountComponent(prevComponentInstance);
this._renderedComponent = this._instantiateReactComponent(
nextRenderedElement,
this._currentElement.type
);
var nextMarkup = ReactReconciler.mountComponent(
this._renderedComponent,
thisID,
transaction,
this._mergeChildContext(context, childContext)
);
this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
}
},
/**
* @protected
*/
_replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) {
ReactComponentEnvironment.replaceNodeWithMarkupByID(
prevComponentID,
nextMarkup
);
},
/**
* @protected
*/
_renderValidatedComponentWithoutOwnerOrContext: function() {
var inst = this._instance;
var renderedComponent = inst.render();
if (__DEV__) {
// We allow auto-mocks to proceed as if they're returning null.
if (typeof renderedComponent === 'undefined' &&
inst.render._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
renderedComponent = null;
}
}
return renderedComponent;
},
/**
* @private
*/
_renderValidatedComponent: function(childContext) {
var renderedComponent;
var previousContext = ReactContext.current;
ReactContext.current = this._mergeChildContext(
this._currentElement._context,
childContext
);
ReactCurrentOwner.current = this;
try {
renderedComponent =
this._renderValidatedComponentWithoutOwnerOrContext();
} finally {
ReactContext.current = previousContext;
ReactCurrentOwner.current = null;
}
invariant(
// TODO: An `isValidNode` function would probably be more appropriate
renderedComponent === null || renderedComponent === false ||
ReactElement.isValidElement(renderedComponent),
'%s.render(): A valid ReactComponent must be returned. You may have ' +
'returned undefined, an array or some other invalid object.',
this.getName() || 'ReactCompositeComponent'
);
return renderedComponent;
},
/**
* Lazily allocates the refs object and stores `component` as `ref`.
*
* @param {string} ref Reference name.
* @param {component} component Component to store as `ref`.
* @final
* @private
*/
attachRef: function(ref, component) {
var inst = this.getPublicInstance();
var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs;
refs[ref] = component.getPublicInstance();
},
/**
* Detaches a reference name.
*
* @param {string} ref Name to dereference.
* @final
* @private
*/
detachRef: function(ref) {
var refs = this.getPublicInstance().refs;
delete refs[ref];
},
/**
* Get a text description of the component that can be used to identify it
* in error messages.
* @return {string} The name or null.
* @internal
*/
getName: function() {
var type = this._currentElement.type;
var constructor = this._instance && this._instance.constructor;
return (
type.displayName || (constructor && constructor.displayName) ||
type.name || (constructor && constructor.name) ||
null
);
},
/**
* Get the publicly accessible representation of this component - i.e. what
* is exposed by refs and returned by React.render. Can be null for stateless
* components.
*
* @return {ReactComponent} the public component instance.
* @internal
*/
getPublicInstance: function() {
return this._instance;
},
// Stub
_instantiateReactComponent: null
};
ReactPerf.measureMethods(
ReactCompositeComponentMixin,
'ReactCompositeComponent',
{
mountComponent: 'mountComponent',
updateComponent: 'updateComponent',
_renderValidatedComponent: '_renderValidatedComponent'
}
);
var ReactCompositeComponent = {
Mixin: ReactCompositeComponentMixin
};
module.exports = ReactCompositeComponent;
|
src/clincoded/static/components/software.js
|
ClinGen/clincoded
|
'use strict';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import _ from 'underscore';
import { content_views, panel_views, listing_titles, itemClass } from './globals';
import { AuditMixin, AuditIndicators, AuditDetail } from './audit';
import StatusLabel from './statuslabel';
import PubReferenceList from './reference';
var search = require('./search');
var pipeline = require('./pipeline');
var fetched = require('./fetched');
var PipelineTable = pipeline.PipelineTable;
var FetchedItems = fetched.FetchedItems;
var Software = module.exports.Software = createReactClass({
mixins: [AuditMixin],
render: function() {
var context = this.props.context;
var pipeline_url = '/search/?type=pipeline&analysis_steps.software_versions.software.uuid=' + context.uuid;
return (
<div className={itemClass(context, 'view-item')}>
<header className="row">
<div className="col-sm-12">
<h2>{context.title}</h2>
<div className="characterization-status-labels">
<StatusLabel title="Status" status={context.status} />
</div>
<AuditIndicators audits={context.audit} id="publication-audit" />
</div>
</header>
<AuditDetail context={context} id="publication-audit" />
<div className="panel data-display">
<dl className="key-value">
<div data-test="title">
<dt>Title</dt>
{context.source_url ?
<dd><a href={context.source_url}>{context.title}</a></dd> :
<dd>{context.title}</dd>
}
</div>
<div data-test="description">
<dt>Description</dt>
<dd>{context.description}</dd>
</div>
{context.software_type && context.software_type.length ?
<div data-test="type">
<dt>Software type</dt>
<dd>{context.software_type.join(", ")}</dd>
</div>
: null}
{context.purpose && context.purpose.length ?
<div data-test="purpose">
<dt>Used for</dt>
<dd>{context.purpose.join(", ")}</dd>
</div>
: null}
{context.references && context.references.length ?
<div data-test="references">
<dt>Publications</dt>
<dd>
<PubReferenceList values={context.references} />
</dd>
</div>
: null}
</dl>
</div>
{context.versions && context.versions.length ?
<div>
<h3>Software Versions</h3>
<SoftwareVersionTable items={context.versions} />
</div>
: null }
</div>
);
}
});
globals.content_views.register(Software, 'software');
// Commenting out until pipelines are used.
var PipelinesUsingSoftwareVersion = module.exports.PipelinesUsingSoftwareVersion = createReactClass({
render: function () {
var context = this.props.context;
return (
<div>
<h3>Pipelines using software {context.title}</h3>
<PipelineTable {...this.props} />
</div>
);
}
});
var SoftwareVersionTable = module.exports.SoftwareVersionTable = createReactClass({
render: function() {
var rows = {};
this.props.items.forEach(function (version) {
rows[version['@id']] = (
<tr>
<td>
{version.downloaded_url ?
<a href={version.downloaded_url}>{version.version}</a>
:
<span>{version.version}</span>
}
</td>
<td>{version.download_checksum}</td>
</tr>
);
});
return (
<div className="table-responsive">
<table className="table table-panel table-striped table-hover">
<thead>
<tr>
<th>Version</th>
<th>Download checksum</th>
</tr>
</thead>
<tbody>
{rows}
</tbody>
<tfoot>
</tfoot>
</table>
</div>
);
}
});
var Listing = createReactClass({
mixins: [search.PickerActionsMixin, AuditMixin],
render: function() {
var result = this.props.context;
return (
<li>
<div className="clearfix">
{this.renderActions()}
<div className="pull-right search-meta">
<p className="type meta-title">Software</p>
{result.status ? <p className="type meta-status">{' ' + result.status}</p> : ''}
<AuditIndicators audits={result.audit} id={result['@id']} search />
</div>
<div className="accession">
<a href={result['@id']}>{result.title}</a>
{result.source_url ? <span className="accession-note"> — <a href={result.source_url}>source</a></span> : ''}
</div>
<div className="data-row">
<div>{result.description}</div>
{result.software_type && result.software_type.length ?
<div>
<strong>Software type: </strong>
{result.software_type.join(", ")}
</div>
: null}
</div>
</div>
<AuditDetail context={result} id={result['@id']} forcedEditLink />
</li>
);
}
});
globals.listing_views.register(Listing, 'software');
|
examples/BeaconsDemo/index.android.js
|
MacKentoch/react-native-beacons-manager
|
/**
* @flow
*/
// #region imports
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
SectionList,
View,
TouchableHighlight,
ToastAndroid,
Image,
} from 'react-native';
import Beacons from 'react-native-beacons-manager';
import { Avatar } from 'react-native-elements';
import moment from 'moment';
import beaconIMAGE from './images/beacons/ibeacon.png';
import { hashCode } from './helpers';
// import altBeaconIMAGE from './images/beacons/altbeacon.png';
// import eddystoneURLIMAGE from './images/beacons/eddystoneURL.png';
// import eddystoneTLMIMAGE from './images/beacons/eddystone_TLM.png';
// import eddystoneUIDIMAGE from './images/beacons/eddystone_UID.png';
// #endregion
// #region flow types
export type DetectedBeacon = {
identifier: string,
uuid?: string,
major?: number,
minor?: number,
proximity?: string,
rssi?: string,
distance?: number,
};
export type Section = {
key: number,
data: Array<DetectedBeacon>,
title: string,
sectionId: string,
};
export type Props = any;
export type State = {
// region information
uuid?: string,
identifier: string,
// all detected beacons:
beacons: Array<Section>,
};
// #endregion
// #region constants
// const UUID = '7b44b47b-52a1-5381-90c2-f09b6838c5d4';
const IDENTIFIER = '123456';
const TIME_FORMAT = 'MM/DD/YYYY HH:mm:ss';
const UUID = '7b44b47b-52a1-5381-90c2-f09b6838c5d4';
const RANGING_TITLE = 'ranging beacons in the area:';
const RANGING_SECTION_ID = 1;
const MONITORING_ENTER_TITLE = 'monitoring enter information:';
const MONITORING_ENTER_SECTION_ID = 2;
const MONITORING_LEAVE_TITLE = 'monitoring exit information:';
const MONITORING_LEAVE_SECTION_ID = 3;
// #endregion
class BeaconsDemo extends Component<Props, State> {
// will be set as a reference to "beaconsDidRange" event:
beaconsDidRangeEvent = null;
// will be set as a reference to "regionDidEnter" event:
beaconsDidEnterEvent = null;
// will be set as a reference to "regionDidExit" event:
beaconsDidLeaveEvent = null;
// will be set as a reference to service did connect event:
beaconsServiceDidConnect: any = null;
state = {
// region information
uuid: UUID,
identifier: IDENTIFIER,
// all detected beacons:
beacons: [
{ key: 1, data: [], title: RANGING_TITLE, sectionId: RANGING_SECTION_ID },
{
key: 2,
data: [],
title: MONITORING_ENTER_TITLE,
sectionId: MONITORING_ENTER_SECTION_ID,
},
{
key: 3,
data: [],
title: MONITORING_LEAVE_TITLE,
sectionId: MONITORING_LEAVE_SECTION_ID,
},
],
};
// #region lifecycle methods
componentDidMount() {
//
// ONLY non component state aware here in componentWillMount
//
// Beacons.addParsersListToDetection([
// Beacons.PARSER_IBEACON,
// Beacons.PARSER_ALTBEACON,
// Beacons.PARSER_EDDYSTONE_TLM,
// Beacons.PARSER_EDDYSTONE_UID,
// Beacons.PARSER_EDDYSTONE_URL
// ])
// start iBeacon detection
Beacons.addIBeaconsDetection()
.then(() => Beacons.addEddystoneUIDDetection())
.then(() => Beacons.addEddystoneURLDetection())
.then(() => Beacons.addEddystoneTLMDetection())
.then(() => Beacons.addAltBeaconsDetection())
.then(() => Beacons.addEstimotesDetection())
.catch(error =>
console.log(`something went wrong during initialization: ${error}`),
);
//
// component state aware here - attach events
//
// we need to wait for service connection to ensure synchronization:
this.beaconsServiceDidConnect = Beacons.BeaconsEventEmitter.addListener(
'beaconServiceConnected',
() => {
console.log('service connected');
this.startRangingAndMonitoring();
},
);
// Ranging: Listen for beacon changes
this.beaconsDidRangeEvent = Beacons.BeaconsEventEmitter.addListener(
'beaconsDidRange',
(response: {
beacons: Array<{
distance: number,
proximity: string,
rssi: string,
uuid: string,
}>,
uuid: string,
indetifier: string,
}) => {
console.log('BEACONS: ', response);
response.beacons.forEach(beacon =>
this.updateBeaconState(RANGING_SECTION_ID, {
identifier: response.identifier,
uuid: String(beacon.uuid),
major: parseInt(beacon.major, 10) >= 0 ? beacon.major : '',
minor: parseInt(beacon.minor, 10) >= 0 ? beacon.minor : '',
proximity: beacon.proximity ? beacon.proximity : '',
rssi: beacon.rssi ? beacon.rssi : '',
distance: beacon.distance ? beacon.distance : '',
}),
);
},
);
// monitoring:
this.beaconsDidEnterEvent = Beacons.BeaconsEventEmitter.addListener(
'regionDidEnter',
({ identifier, uuid, minor, major }) => {
console.log('regionDidEnter: ', { identifier, uuid, minor, major });
this.updateBeaconState(MONITORING_ENTER_SECTION_ID, {
identifier,
uuid,
minor,
major,
});
},
);
this.beaconsDidLeaveEvent = Beacons.BeaconsEventEmitter.addListener(
'regionDidExit',
({ identifier, uuid, minor, major }) => {
console.log('regionDidExit: ', { identifier, uuid, minor, major });
this.updateBeaconState(MONITORING_LEAVE_SECTION_ID, {
identifier,
uuid,
minor,
major,
});
},
);
}
componentWillUnMount() {
this.stopRangingAndMonitoring();
// remove monitiring events we registered at componentDidMount::
this.beaconsDidEnterEvent.remove();
this.beaconsDidLeaveEvent.remove();
// remove ranging event we registered at componentDidMount:
this.beaconsDidRangeEvent.remove();
}
render() {
const { beacons } = this.state;
console.log('beacons: ', beacons);
return (
<Image
style={styles.backgroundImage}
resizeMode="center"
source={require('./bluetooth-300-300-opacity-45.png')}
>
<View style={styles.container}>
<View style={styles.actionsContainer}>
<TouchableHighlight
style={styles.actionButton}
onPress={this.handlesOnRemoveIbeacon}
>
<Text style={styles.actionText}>remove IBeacon detection</Text>
</TouchableHighlight>
<TouchableHighlight
style={styles.actionButton}
onPress={this.handlesOnAddIbeacon}
>
<Text style={styles.actionText}>add IBeacon detection</Text>
</TouchableHighlight>
</View>
<SectionList
sections={beacons}
keyExtractor={this.sectionListKeyExtractor}
renderSectionHeader={this.renderHeader}
renderItem={this.renderRow}
ListEmptyComponent={this.renderEmpty}
// SectionSeparatorComponent={this.renderSeparator}
ItemSeparatorComponent={this.renderSeparator}
// shouldItemUpdate={this.shouldItemUpdate}
/>
</View>
</Image>
);
}
// #endregion
// #region SectionList related
sectionListKeyExtractor = (item: DetectedBeacon, index: number) => {
const UUID = item.uuid ? item.uuid : 'NONE';
const ID = item.identifier ? item.identifier : 'NONE';
return `${UUID}-${ID}`;
};
renderHeader = ({ section }) => (
<Text style={styles.headline}>{section.title}</Text>
);
renderSeparator = () => (
<View style={{ height: 1, backgroundColor: '#E1E1E1', marginLeft: 80 }} />
);
renderRow = ({ item }) => {
console.log('rowData: ', item);
return (
<View style={styles.row}>
<View style={styles.iconContainer}>
<Avatar
medium
rounded
source={beaconIMAGE}
onPress={() => console.log('no use')}
activeOpacity={0.7}
/>
</View>
<View style={styles.infoContainer}>
<Text style={styles.smallText}>
indentifier: {item.identifier ? item.identifier : 'NA'}
</Text>
<Text style={styles.smallText}>
UUID: {item.uuid ? item.uuid : 'NA'}
</Text>
<View style={styles.majorMinorContainer}>
<Text style={styles.smallText}>
Major: {parseInt(item.major, 10) >= 0 ? item.major : 'NA'}
</Text>
<Text style={[styles.smallText, { marginLeft: 10 }]}>
Minor: {parseInt(item.minor, 10) >= 0 ? item.minor : 'NA'}
</Text>
<Text style={[styles.smallText, { marginLeft: 10 }]}>
RSSI: {item.rssi ? item.rssi : 'NA'}
</Text>
</View>
<Text style={styles.smallText}>
Proximity: {item.proximity ? item.proximity : 'NA'}
</Text>
<Text style={styles.smallText}>
Distance: {item.distance ? item.distance.toFixed(2) : 'NA'}
</Text>
</View>
</View>
);
};
renderEmpty = () => (
<View
style={{ height: 40, alignItems: 'center', justifyContent: 'center' }}
>
<Text>no beacon detected</Text>
</View>
);
// #endregion
updateBeaconState = (
forSectionId: number = 0, // section identifier
{ identifier, uuid, minor, major, ...rest }, // beacon
) => {
const { beacons } = this.state;
const time = moment().format(TIME_FORMAT);
const updatedBeacons = beacons.map(beacon => {
if (beacon.sectionId === forSectionId) {
const sameBeacon = data =>
!(
data.UUID === uuid &&
data.identifier === identifier &&
data.minor === minor &&
data.major === major
);
const updatedData = [].concat(...beacon.data.filter(sameBeacon), {
identifier,
uuid,
minor,
major,
time,
...rest,
});
return { ...beacon, data: updatedData };
}
return beacon;
});
this.setState({ beacons: updatedBeacons });
};
startRangingAndMonitoring = async () => {
const { identifier, uuid } = this.state;
const region = { identifier, uuid }; // minor and major are null here
try {
await Beacons.startRangingBeaconsInRegion(region);
console.log('Beacons ranging started successfully');
await Beacons.startMonitoringForRegion(region);
console.log('Beacons monitoring started successfully');
} catch (error) {
throw error;
}
};
stopRangingAndMonitoring = async () => {
const { identifier, uuid } = this.state;
const region = { identifier, uuid }; // minor and major are null here
try {
await Beacons.stopRangingBeaconsInRegion(region);
console.log('Beacons ranging stopped successfully');
await Beacons.stopMonitoringForRegion(region);
console.log('Beacons monitoring stopped successfully');
} catch (error) {
throw error;
}
};
handlesOnAddIbeacon = async () => {
try {
await this.stopRangingAndMonitoring();
await Beacons.addIBeaconsDetection();
await this.startRangingAndMonitoring();
ToastAndroid.showWithGravity(
'add IBeacon detection',
ToastAndroid.SHORT,
ToastAndroid.CENTER,
);
} catch (error) {
ToastAndroid.show(
`Error: add IBeacon detection failed: ${error.message}`,
ToastAndroid.SHORT,
);
}
};
handlesOnRemoveIbeacon = async () => {
try {
await this.stopRangingAndMonitoring();
await Beacons.removeIBeaconsDetection();
await this.startRangingAndMonitoring();
ToastAndroid.showWithGravity(
'removed IBeacon detection',
ToastAndroid.SHORT,
ToastAndroid.CENTER,
);
} catch (error) {
ToastAndroid.show(
`Error: remove IBeacon detection failed: ${error.message}`,
ToastAndroid.SHORT,
);
}
};
}
const styles = StyleSheet.create({
backgroundImage: {
flex: 1,
width: null,
height: null,
},
container: {
flex: 1,
},
btleConnectionStatus: {
// fontSize: 20,
// paddingTop: 20
},
headline: {
fontSize: 20,
marginHorizontal: 5,
},
row: {
flexDirection: 'row',
padding: 8,
paddingBottom: 16,
},
iconContainer: {
flexDirection: 'column',
marginRight: 10,
},
infoContainer: {
flex: 1,
flexDirection: 'column',
},
majorMinorContainer: {
flexDirection: 'row',
},
smallText: {
fontSize: 11,
},
actionsContainer: {
marginVertical: 10,
marginHorizontal: 5,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
},
actionButton: {
width: 160,
backgroundColor: '#A6A6A6',
paddingHorizontal: 5,
paddingVertical: 10,
},
actionText: {
alignSelf: 'center',
fontSize: 11,
color: '#F1F1F1',
},
});
AppRegistry.registerComponent('BeaconsDemo', () => BeaconsDemo);
|
src/components/NavLink.js
|
abdulhannanali/github-organization-repos
|
/**
* NavLink
*
* Contains the Navigational links to be displayed at the root of
* the application
*/
import React from 'react';
import { Link } from 'react-router-dom';
import '../styles/NavLink.css';
const NavLink = () => {
return (
<div className="NavLink">
<div className="row">
<div className="col-sm-12 col-md-offset-4 col-md-4">
<Link className="NavLink-item" to="/">Home</Link>
<Link className="NavLink-item" to="/about">About</Link>
</div>
</div>
</div>
);
};
export default NavLink;
|
src/svg-icons/image/switch-video.js
|
owencm/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageSwitchVideo = (props) => (
<SvgIcon {...props}>
<path d="M18 9.5V6c0-.55-.45-1-1-1H3c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h14c.55 0 1-.45 1-1v-3.5l4 4v-13l-4 4zm-5 6V13H7v2.5L3.5 12 7 8.5V11h6V8.5l3.5 3.5-3.5 3.5z"/>
</SvgIcon>
);
ImageSwitchVideo = pure(ImageSwitchVideo);
ImageSwitchVideo.displayName = 'ImageSwitchVideo';
ImageSwitchVideo.muiName = 'SvgIcon';
export default ImageSwitchVideo;
|
config/webpack.client.config.js
|
Pirolf/nekochan
|
module.exports = {
node: {
fs: "empty",
net: "empty",
tls: "empty"
},
module: {
loaders: [{
test: /\.js/,
loader: 'babel',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react', 'stage-0', 'stage-1', 'stage-2', 'stage-3'],
plugins: ['transform-runtime', 'syntax-async-functions']
}
},
{ test: /\.json$/, loader: 'json-loader' },
{
test: /\.scss$/,
loaders: ["style", "css", "sass"]
}]
},
output: {
filename: 'bundle.js'
}
}
|
app/components/Console.js
|
Ribeiro/fil
|
import _ from 'underscore';
import React from 'react';
import OutputLine from 'components/OutputLine';
import ConsoleToolbar from 'components/ConsoleToolbar';
import ErrorLine from 'components/ErrorLine';
export default class Console extends React.Component {
renderLine(line, i) {
return <OutputLine
output={line}
key={i} />
}
render() {
var block = "console",
error = this.props.error;
return (
<div className={block}>
<ConsoleToolbar
className={block + "__toolbar"}
onRun={this.props.onRun} />
<div className={block + "__output"}>
{this.props.lines.map(this.renderLine.bind(this))}
</div>
{error && <ErrorLine error={error} />}
</div>
);
}
}
|
ajax/libs/webshim/1.15.3/dev/shims/moxie/js/moxie-html4.js
|
aaqibrasheed/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 <fyzlman@gmail.com>
// 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/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/image/Image.js
/**
* Image.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/image/Image", [
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/Exceptions",
"moxie/file/FileReaderSync",
"moxie/xhr/XMLHttpRequest",
"moxie/runtime/Runtime",
"moxie/runtime/RuntimeClient",
"moxie/runtime/Transporter",
"moxie/core/utils/Env",
"moxie/core/EventTarget",
"moxie/file/Blob",
"moxie/file/File",
"moxie/core/utils/Encode"
], function(Basic, Dom, x, FileReaderSync, XMLHttpRequest, Runtime, RuntimeClient, Transporter, Env, EventTarget, Blob, File, Encode) {
/**
Image preloading and manipulation utility. Additionally it provides access to image meta info (Exif, GPS) and raw binary data.
@class Image
@constructor
@extends EventTarget
*/
var dispatches = [
'progress',
/**
Dispatched when loading is complete.
@event load
@param {Object} event
*/
'load',
'error',
/**
Dispatched when resize operation is complete.
@event resize
@param {Object} event
*/
'resize',
/**
Dispatched when visual representation of the image is successfully embedded
into the corresponsing container.
@event embedded
@param {Object} event
*/
'embedded'
];
function Image() {
RuntimeClient.call(this);
Basic.extend(this, {
/**
Unique id of the component
@property uid
@type {String}
*/
uid: Basic.guid('uid_'),
/**
Unique id of the connected runtime, if any.
@property ruid
@type {String}
*/
ruid: null,
/**
Name of the file, that was used to create an image, if available. If not equals to empty string.
@property name
@type {String}
@default ""
*/
name: "",
/**
Size of the image in bytes. Actual value is set only after image is preloaded.
@property size
@type {Number}
@default 0
*/
size: 0,
/**
Width of the image. Actual value is set only after image is preloaded.
@property width
@type {Number}
@default 0
*/
width: 0,
/**
Height of the image. Actual value is set only after image is preloaded.
@property height
@type {Number}
@default 0
*/
height: 0,
/**
Mime type of the image. Currently only image/jpeg and image/png are supported. Actual value is set only after image is preloaded.
@property type
@type {String}
@default ""
*/
type: "",
/**
Holds meta info (Exif, GPS). Is populated only for image/jpeg. Actual value is set only after image is preloaded.
@property meta
@type {Object}
@default {}
*/
meta: {},
/**
Alias for load method, that takes another mOxie.Image object as a source (see load).
@method clone
@param {Image} src Source for the image
@param {Boolean} [exact=false] Whether to activate in-depth clone mode
*/
clone: function() {
this.load.apply(this, arguments);
},
/**
Loads image from various sources. Currently the source for new image can be: mOxie.Image, mOxie.Blob/mOxie.File,
native Blob/File, dataUrl or URL. Depending on the type of the source, arguments - differ. When source is URL,
Image will be downloaded from remote destination and loaded in memory.
@example
var img = new mOxie.Image();
img.onload = function() {
var blob = img.getAsBlob();
var formData = new mOxie.FormData();
formData.append('file', blob);
var xhr = new mOxie.XMLHttpRequest();
xhr.onload = function() {
// upload complete
};
xhr.open('post', 'upload.php');
xhr.send(formData);
};
img.load("http://www.moxiecode.com/images/mox-logo.jpg"); // notice file extension (.jpg)
@method load
@param {Image|Blob|File|String} src Source for the image
@param {Boolean|Object} [mixed]
*/
load: function() {
// this is here because to bind properly we need an uid first, which is created above
this.bind('Load Resize', function() {
_updateInfo.call(this);
}, 999);
this.convertEventPropsToHandlers(dispatches);
_load.apply(this, arguments);
},
/**
Downsizes the image to fit the specified width/height. If crop is supplied, image will be cropped to exact dimensions.
@method downsize
@param {Number} width Resulting width
@param {Number} [height=width] Resulting height (optional, if not supplied will default to width)
@param {Boolean} [crop=false] Whether to crop the image to exact dimensions
@param {Boolean} [preserveHeaders=true] Whether to preserve meta headers (on JPEGs after resize)
*/
downsize: function(opts) {
var defaults = {
width: this.width,
height: this.height,
crop: false,
preserveHeaders: true
};
if (typeof(opts) === 'object') {
opts = Basic.extend(defaults, opts);
} else {
opts = Basic.extend(defaults, {
width: arguments[0],
height: arguments[1],
crop: arguments[2],
preserveHeaders: arguments[3]
});
}
try {
if (!this.size) { // only preloaded image objects can be used as source
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// no way to reliably intercept the crash due to high resolution, so we simply avoid it
if (this.width > Image.MAX_RESIZE_WIDTH || this.height > Image.MAX_RESIZE_HEIGHT) {
throw new x.ImageError(x.ImageError.MAX_RESOLUTION_ERR);
}
this.getRuntime().exec.call(this, 'Image', 'downsize', opts.width, opts.height, opts.crop, opts.preserveHeaders);
} catch(ex) {
// for now simply trigger error event
this.trigger('error', ex.code);
}
},
/**
Alias for downsize(width, height, true). (see downsize)
@method crop
@param {Number} width Resulting width
@param {Number} [height=width] Resulting height (optional, if not supplied will default to width)
@param {Boolean} [preserveHeaders=true] Whether to preserve meta headers (on JPEGs after resize)
*/
crop: function(width, height, preserveHeaders) {
this.downsize(width, height, true, preserveHeaders);
},
getAsCanvas: function() {
if (!Env.can('create_canvas')) {
throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR);
}
var runtime = this.connectRuntime(this.ruid);
return runtime.exec.call(this, 'Image', 'getAsCanvas');
},
/**
Retrieves image in it's current state as mOxie.Blob object. Cannot be run on empty or image in progress (throws
DOMException.INVALID_STATE_ERR).
@method getAsBlob
@param {String} [type="image/jpeg"] Mime type of resulting blob. Can either be image/jpeg or image/png
@param {Number} [quality=90] Applicable only together with mime type image/jpeg
@return {Blob} Image as Blob
*/
getAsBlob: function(type, quality) {
if (!this.size) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
if (!type) {
type = 'image/jpeg';
}
if (type === 'image/jpeg' && !quality) {
quality = 90;
}
return this.getRuntime().exec.call(this, 'Image', 'getAsBlob', type, quality);
},
/**
Retrieves image in it's current state as dataURL string. Cannot be run on empty or image in progress (throws
DOMException.INVALID_STATE_ERR).
@method getAsDataURL
@param {String} [type="image/jpeg"] Mime type of resulting blob. Can either be image/jpeg or image/png
@param {Number} [quality=90] Applicable only together with mime type image/jpeg
@return {String} Image as dataURL string
*/
getAsDataURL: function(type, quality) {
if (!this.size) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
return this.getRuntime().exec.call(this, 'Image', 'getAsDataURL', type, quality);
},
/**
Retrieves image in it's current state as binary string. Cannot be run on empty or image in progress (throws
DOMException.INVALID_STATE_ERR).
@method getAsBinaryString
@param {String} [type="image/jpeg"] Mime type of resulting blob. Can either be image/jpeg or image/png
@param {Number} [quality=90] Applicable only together with mime type image/jpeg
@return {String} Image as binary string
*/
getAsBinaryString: function(type, quality) {
var dataUrl = this.getAsDataURL(type, quality);
return Encode.atob(dataUrl.substring(dataUrl.indexOf('base64,') + 7));
},
/**
Embeds a visual representation of the image into the specified node. Depending on the runtime,
it might be a canvas, an img node or a thrid party shim object (Flash or SilverLight - very rare,
can be used in legacy browsers that do not have canvas or proper dataURI support).
@method embed
@param {DOMElement} el DOM element to insert the image object into
@param {Object} [options]
@param {Number} [options.width] The width of an embed (defaults to the image width)
@param {Number} [options.height] The height of an embed (defaults to the image height)
@param {String} [type="image/jpeg"] Mime type
@param {Number} [quality=90] Quality of an embed, if mime type is image/jpeg
@param {Boolean} [crop=false] Whether to crop an embed to the specified dimensions
*/
embed: function(el) {
var self = this
, imgCopy
, type, quality, crop
, options = arguments[1] || {}
, width = this.width
, height = this.height
, runtime // this has to be outside of all the closures to contain proper runtime
;
function onResize() {
// if possible, embed a canvas element directly
if (Env.can('create_canvas')) {
var canvas = imgCopy.getAsCanvas();
if (canvas) {
el.appendChild(canvas);
canvas = null;
imgCopy.destroy();
self.trigger('embedded');
return;
}
}
var dataUrl = imgCopy.getAsDataURL(type, quality);
if (!dataUrl) {
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
}
if (Env.can('use_data_uri_of', dataUrl.length)) {
el.innerHTML = '<img src="' + dataUrl + '" width="' + imgCopy.width + '" height="' + imgCopy.height + '" />';
imgCopy.destroy();
self.trigger('embedded');
} else {
var tr = new Transporter();
tr.bind("TransportingComplete", function() {
runtime = self.connectRuntime(this.result.ruid);
self.bind("Embedded", function() {
// position and size properly
Basic.extend(runtime.getShimContainer().style, {
//position: 'relative',
top: '0px',
left: '0px',
width: imgCopy.width + 'px',
height: imgCopy.height + 'px'
});
// some shims (Flash/SilverLight) reinitialize, if parent element is hidden, reordered or it's
// position type changes (in Gecko), but since we basically need this only in IEs 6/7 and
// sometimes 8 and they do not have this problem, we can comment this for now
/*tr.bind("RuntimeInit", function(e, runtime) {
tr.destroy();
runtime.destroy();
onResize.call(self); // re-feed our image data
});*/
runtime = null;
}, 999);
runtime.exec.call(self, "ImageView", "display", this.result.uid, width, height);
imgCopy.destroy();
});
tr.transport(Encode.atob(dataUrl.substring(dataUrl.indexOf('base64,') + 7)), type, Basic.extend({}, options, {
required_caps: {
display_media: true
},
runtime_order: 'flash,silverlight',
container: el
}));
}
}
try {
if (!(el = Dom.get(el))) {
throw new x.DOMException(x.DOMException.INVALID_NODE_TYPE_ERR);
}
if (!this.size) { // only preloaded image objects can be used as source
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
if (this.width > Image.MAX_RESIZE_WIDTH || this.height > Image.MAX_RESIZE_HEIGHT) {
throw new x.ImageError(x.ImageError.MAX_RESOLUTION_ERR);
}
type = options.type || this.type || 'image/jpeg';
quality = options.quality || 90;
crop = Basic.typeOf(options.crop) !== 'undefined' ? options.crop : false;
// figure out dimensions for the thumb
if (options.width) {
width = options.width;
height = options.height || width;
} else {
// if container element has measurable dimensions, use them
var dimensions = Dom.getSize(el);
if (dimensions.w && dimensions.h) { // both should be > 0
width = dimensions.w;
height = dimensions.h;
}
}
imgCopy = new Image();
imgCopy.bind("Resize", function() {
onResize.call(self);
});
imgCopy.bind("Load", function() {
imgCopy.downsize(width, height, crop, false);
});
imgCopy.clone(this, false);
return imgCopy;
} catch(ex) {
// for now simply trigger error event
this.trigger('error', ex.code);
}
},
/**
Properly destroys the image and frees resources in use. If any. Recommended way to dispose mOxie.Image object.
@method destroy
*/
destroy: function() {
if (this.ruid) {
this.getRuntime().exec.call(this, 'Image', 'destroy');
this.disconnectRuntime();
}
this.unbindAll();
}
});
function _updateInfo(info) {
if (!info) {
info = this.getRuntime().exec.call(this, 'Image', 'getInfo');
}
this.size = info.size;
this.width = info.width;
this.height = info.height;
this.type = info.type;
this.meta = info.meta;
// update file name, only if empty
if (this.name === '') {
this.name = info.name;
}
}
function _load(src) {
var srcType = Basic.typeOf(src);
try {
// if source is Image
if (src instanceof Image) {
if (!src.size) { // only preloaded image objects can be used as source
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
_loadFromImage.apply(this, arguments);
}
// if source is o.Blob/o.File
else if (src instanceof Blob) {
if (!~Basic.inArray(src.type, ['image/jpeg', 'image/png'])) {
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
}
_loadFromBlob.apply(this, arguments);
}
// if native blob/file
else if (Basic.inArray(srcType, ['blob', 'file']) !== -1) {
_load.call(this, new File(null, src), arguments[1]);
}
// if String
else if (srcType === 'string') {
// if dataUrl String
if (/^data:[^;]*;base64,/.test(src)) {
_load.call(this, new Blob(null, { data: src }), arguments[1]);
}
// else assume Url, either relative or absolute
else {
_loadFromUrl.apply(this, arguments);
}
}
// if source seems to be an img node
else if (srcType === 'node' && src.nodeName.toLowerCase() === 'img') {
_load.call(this, src.src, arguments[1]);
}
else {
throw new x.DOMException(x.DOMException.TYPE_MISMATCH_ERR);
}
} catch(ex) {
// for now simply trigger error event
this.trigger('error', ex.code);
}
}
function _loadFromImage(img, exact) {
var runtime = this.connectRuntime(img.ruid);
this.ruid = runtime.uid;
runtime.exec.call(this, 'Image', 'loadFromImage', img, (Basic.typeOf(exact) === 'undefined' ? true : exact));
}
function _loadFromBlob(blob, options) {
var self = this;
self.name = blob.name || '';
function exec(runtime) {
self.ruid = runtime.uid;
runtime.exec.call(self, 'Image', 'loadFromBlob', blob);
}
if (blob.isDetached()) {
this.bind('RuntimeInit', function(e, runtime) {
exec(runtime);
});
// convert to object representation
if (options && typeof(options.required_caps) === 'string') {
options.required_caps = Runtime.parseCaps(options.required_caps);
}
this.connectRuntime(Basic.extend({
required_caps: {
access_image_binary: true,
resize_image: true
}
}, options));
} else {
exec(this.connectRuntime(blob.ruid));
}
}
function _loadFromUrl(url, options) {
var self = this, xhr;
xhr = new XMLHttpRequest();
xhr.open('get', url);
xhr.responseType = 'blob';
xhr.onprogress = function(e) {
self.trigger(e);
};
xhr.onload = function() {
_loadFromBlob.call(self, xhr.response, true);
};
xhr.onerror = function(e) {
self.trigger(e);
};
xhr.onloadend = function() {
xhr.destroy();
};
xhr.bind('RuntimeError', function(e, err) {
self.trigger('RuntimeError', err);
});
xhr.send(null, options);
}
}
// virtual world will crash on you if image has a resolution higher than this:
Image.MAX_RESIZE_WIDTH = 6500;
Image.MAX_RESIZE_HEIGHT = 6500;
Image.prototype = EventTarget.instance;
return Image;
});
// 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/html5/utils/BinaryReader.js
/**
* BinaryReader.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/utils/BinaryReader
@private
*/
define("moxie/runtime/html5/utils/BinaryReader", [], function() {
return function() {
var II = false, bin;
// Private functions
function read(idx, size) {
var mv = II ? 0 : -8 * (size - 1), sum = 0, i;
for (i = 0; i < size; i++) {
sum |= (bin.charCodeAt(idx + i) << Math.abs(mv + i*8));
}
return sum;
}
function putstr(segment, idx, length) {
length = arguments.length === 3 ? length : bin.length - idx - 1;
bin = bin.substr(0, idx) + segment + bin.substr(length + idx);
}
function write(idx, num, size) {
var str = '', mv = II ? 0 : -8 * (size - 1), i;
for (i = 0; i < size; i++) {
str += String.fromCharCode((num >> Math.abs(mv + i*8)) & 255);
}
putstr(str, idx, size);
}
// Public functions
return {
II: function(order) {
if (order === undefined) {
return II;
} else {
II = order;
}
},
init: function(binData) {
II = false;
bin = binData;
},
SEGMENT: function(idx, length, segment) {
switch (arguments.length) {
case 1:
return bin.substr(idx, bin.length - idx - 1);
case 2:
return bin.substr(idx, length);
case 3:
putstr(segment, idx, length);
break;
default: return bin;
}
},
BYTE: function(idx) {
return read(idx, 1);
},
SHORT: function(idx) {
return read(idx, 2);
},
LONG: function(idx, num) {
if (num === undefined) {
return read(idx, 4);
} else {
write(idx, num, 4);
}
},
SLONG: function(idx) { // 2's complement notation
var num = read(idx, 4);
return (num > 2147483647 ? num - 4294967296 : num);
},
STRING: function(idx, size) {
var str = '';
for (size += idx; idx < size; idx++) {
str += String.fromCharCode(read(idx, 1));
}
return str;
}
};
};
});
// Included from: src/javascript/runtime/html5/image/JPEGHeaders.js
/**
* JPEGHeaders.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/image/JPEGHeaders
@private
*/
define("moxie/runtime/html5/image/JPEGHeaders", [
"moxie/runtime/html5/utils/BinaryReader"
], function(BinaryReader) {
return function JPEGHeaders(data) {
var headers = [], read, idx, marker, length = 0;
read = new BinaryReader();
read.init(data);
// Check if data is jpeg
if (read.SHORT(0) !== 0xFFD8) {
return;
}
idx = 2;
while (idx <= data.length) {
marker = read.SHORT(idx);
// omit RST (restart) markers
if (marker >= 0xFFD0 && marker <= 0xFFD7) {
idx += 2;
continue;
}
// no headers allowed after SOS marker
if (marker === 0xFFDA || marker === 0xFFD9) {
break;
}
length = read.SHORT(idx + 2) + 2;
// APPn marker detected
if (marker >= 0xFFE1 && marker <= 0xFFEF) {
headers.push({
hex: marker,
name: 'APP' + (marker & 0x000F),
start: idx,
length: length,
segment: read.SEGMENT(idx, length)
});
}
idx += length;
}
read.init(null); // free memory
return {
headers: headers,
restore: function(data) {
var max, i;
read.init(data);
idx = read.SHORT(2) == 0xFFE0 ? 4 + read.SHORT(4) : 2;
for (i = 0, max = headers.length; i < max; i++) {
read.SEGMENT(idx, 0, headers[i].segment);
idx += headers[i].length;
}
data = read.SEGMENT();
read.init(null);
return data;
},
strip: function(data) {
var headers, jpegHeaders, i;
jpegHeaders = new JPEGHeaders(data);
headers = jpegHeaders.headers;
jpegHeaders.purge();
read.init(data);
i = headers.length;
while (i--) {
read.SEGMENT(headers[i].start, headers[i].length, '');
}
data = read.SEGMENT();
read.init(null);
return data;
},
get: function(name) {
var array = [];
for (var i = 0, max = headers.length; i < max; i++) {
if (headers[i].name === name.toUpperCase()) {
array.push(headers[i].segment);
}
}
return array;
},
set: function(name, segment) {
var array = [], i, ii, max;
if (typeof(segment) === 'string') {
array.push(segment);
} else {
array = segment;
}
for (i = ii = 0, max = headers.length; i < max; i++) {
if (headers[i].name === name.toUpperCase()) {
headers[i].segment = array[ii];
headers[i].length = array[ii].length;
ii++;
}
if (ii >= array.length) {
break;
}
}
},
purge: function() {
headers = [];
read.init(null);
read = null;
}
};
};
});
// Included from: src/javascript/runtime/html5/image/ExifParser.js
/**
* ExifParser.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/image/ExifParser
@private
*/
define("moxie/runtime/html5/image/ExifParser", [
"moxie/core/utils/Basic",
"moxie/runtime/html5/utils/BinaryReader"
], function(Basic, BinaryReader) {
return function ExifParser() {
// Private ExifParser fields
var data, tags, Tiff, offsets = {}, tagDescs;
data = new BinaryReader();
tags = {
tiff : {
/*
The image orientation viewed in terms of rows and columns.
1 = The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.
2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.
3 = The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.
4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.
5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.
6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.
7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.
8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.
*/
0x0112: 'Orientation',
0x010E: 'ImageDescription',
0x010F: 'Make',
0x0110: 'Model',
0x0131: 'Software',
0x8769: 'ExifIFDPointer',
0x8825: 'GPSInfoIFDPointer'
},
exif : {
0x9000: 'ExifVersion',
0xA001: 'ColorSpace',
0xA002: 'PixelXDimension',
0xA003: 'PixelYDimension',
0x9003: 'DateTimeOriginal',
0x829A: 'ExposureTime',
0x829D: 'FNumber',
0x8827: 'ISOSpeedRatings',
0x9201: 'ShutterSpeedValue',
0x9202: 'ApertureValue' ,
0x9207: 'MeteringMode',
0x9208: 'LightSource',
0x9209: 'Flash',
0x920A: 'FocalLength',
0xA402: 'ExposureMode',
0xA403: 'WhiteBalance',
0xA406: 'SceneCaptureType',
0xA404: 'DigitalZoomRatio',
0xA408: 'Contrast',
0xA409: 'Saturation',
0xA40A: 'Sharpness'
},
gps : {
0x0000: 'GPSVersionID',
0x0001: 'GPSLatitudeRef',
0x0002: 'GPSLatitude',
0x0003: 'GPSLongitudeRef',
0x0004: 'GPSLongitude'
}
};
tagDescs = {
'ColorSpace': {
1: 'sRGB',
0: 'Uncalibrated'
},
'MeteringMode': {
0: 'Unknown',
1: 'Average',
2: 'CenterWeightedAverage',
3: 'Spot',
4: 'MultiSpot',
5: 'Pattern',
6: 'Partial',
255: 'Other'
},
'LightSource': {
1: 'Daylight',
2: 'Fliorescent',
3: 'Tungsten',
4: 'Flash',
9: 'Fine weather',
10: 'Cloudy weather',
11: 'Shade',
12: 'Daylight fluorescent (D 5700 - 7100K)',
13: 'Day white fluorescent (N 4600 -5400K)',
14: 'Cool white fluorescent (W 3900 - 4500K)',
15: 'White fluorescent (WW 3200 - 3700K)',
17: 'Standard light A',
18: 'Standard light B',
19: 'Standard light C',
20: 'D55',
21: 'D65',
22: 'D75',
23: 'D50',
24: 'ISO studio tungsten',
255: 'Other'
},
'Flash': {
0x0000: 'Flash did not fire.',
0x0001: 'Flash fired.',
0x0005: 'Strobe return light not detected.',
0x0007: 'Strobe return light detected.',
0x0009: 'Flash fired, compulsory flash mode',
0x000D: 'Flash fired, compulsory flash mode, return light not detected',
0x000F: 'Flash fired, compulsory flash mode, return light detected',
0x0010: 'Flash did not fire, compulsory flash mode',
0x0018: 'Flash did not fire, auto mode',
0x0019: 'Flash fired, auto mode',
0x001D: 'Flash fired, auto mode, return light not detected',
0x001F: 'Flash fired, auto mode, return light detected',
0x0020: 'No flash function',
0x0041: 'Flash fired, red-eye reduction mode',
0x0045: 'Flash fired, red-eye reduction mode, return light not detected',
0x0047: 'Flash fired, red-eye reduction mode, return light detected',
0x0049: 'Flash fired, compulsory flash mode, red-eye reduction mode',
0x004D: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected',
0x004F: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light detected',
0x0059: 'Flash fired, auto mode, red-eye reduction mode',
0x005D: 'Flash fired, auto mode, return light not detected, red-eye reduction mode',
0x005F: 'Flash fired, auto mode, return light detected, red-eye reduction mode'
},
'ExposureMode': {
0: 'Auto exposure',
1: 'Manual exposure',
2: 'Auto bracket'
},
'WhiteBalance': {
0: 'Auto white balance',
1: 'Manual white balance'
},
'SceneCaptureType': {
0: 'Standard',
1: 'Landscape',
2: 'Portrait',
3: 'Night scene'
},
'Contrast': {
0: 'Normal',
1: 'Soft',
2: 'Hard'
},
'Saturation': {
0: 'Normal',
1: 'Low saturation',
2: 'High saturation'
},
'Sharpness': {
0: 'Normal',
1: 'Soft',
2: 'Hard'
},
// GPS related
'GPSLatitudeRef': {
N: 'North latitude',
S: 'South latitude'
},
'GPSLongitudeRef': {
E: 'East longitude',
W: 'West longitude'
}
};
function extractTags(IFD_offset, tags2extract) {
var length = data.SHORT(IFD_offset), i, ii,
tag, type, count, tagOffset, offset, value, values = [], hash = {};
for (i = 0; i < length; i++) {
// Set binary reader pointer to beginning of the next tag
offset = tagOffset = IFD_offset + 12 * i + 2;
tag = tags2extract[data.SHORT(offset)];
if (tag === undefined) {
continue; // Not the tag we requested
}
type = data.SHORT(offset+=2);
count = data.LONG(offset+=2);
offset += 4;
values = [];
switch (type) {
case 1: // BYTE
case 7: // UNDEFINED
if (count > 4) {
offset = data.LONG(offset) + offsets.tiffHeader;
}
for (ii = 0; ii < count; ii++) {
values[ii] = data.BYTE(offset + ii);
}
break;
case 2: // STRING
if (count > 4) {
offset = data.LONG(offset) + offsets.tiffHeader;
}
hash[tag] = data.STRING(offset, count - 1);
continue;
case 3: // SHORT
if (count > 2) {
offset = data.LONG(offset) + offsets.tiffHeader;
}
for (ii = 0; ii < count; ii++) {
values[ii] = data.SHORT(offset + ii*2);
}
break;
case 4: // LONG
if (count > 1) {
offset = data.LONG(offset) + offsets.tiffHeader;
}
for (ii = 0; ii < count; ii++) {
values[ii] = data.LONG(offset + ii*4);
}
break;
case 5: // RATIONAL
offset = data.LONG(offset) + offsets.tiffHeader;
for (ii = 0; ii < count; ii++) {
values[ii] = data.LONG(offset + ii*4) / data.LONG(offset + ii*4 + 4);
}
break;
case 9: // SLONG
offset = data.LONG(offset) + offsets.tiffHeader;
for (ii = 0; ii < count; ii++) {
values[ii] = data.SLONG(offset + ii*4);
}
break;
case 10: // SRATIONAL
offset = data.LONG(offset) + offsets.tiffHeader;
for (ii = 0; ii < count; ii++) {
values[ii] = data.SLONG(offset + ii*4) / data.SLONG(offset + ii*4 + 4);
}
break;
default:
continue;
}
value = (count == 1 ? values[0] : values);
if (tagDescs.hasOwnProperty(tag) && typeof value != 'object') {
hash[tag] = tagDescs[tag][value];
} else {
hash[tag] = value;
}
}
return hash;
}
function getIFDOffsets() {
var idx = offsets.tiffHeader;
// Set read order of multi-byte data
data.II(data.SHORT(idx) == 0x4949);
// Check if always present bytes are indeed present
if (data.SHORT(idx+=2) !== 0x002A) {
return false;
}
offsets.IFD0 = offsets.tiffHeader + data.LONG(idx += 2);
Tiff = extractTags(offsets.IFD0, tags.tiff);
if ('ExifIFDPointer' in Tiff) {
offsets.exifIFD = offsets.tiffHeader + Tiff.ExifIFDPointer;
delete Tiff.ExifIFDPointer;
}
if ('GPSInfoIFDPointer' in Tiff) {
offsets.gpsIFD = offsets.tiffHeader + Tiff.GPSInfoIFDPointer;
delete Tiff.GPSInfoIFDPointer;
}
return true;
}
// At the moment only setting of simple (LONG) values, that do not require offset recalculation, is supported
function setTag(ifd, tag, value) {
var offset, length, tagOffset, valueOffset = 0;
// If tag name passed translate into hex key
if (typeof(tag) === 'string') {
var tmpTags = tags[ifd.toLowerCase()];
for (var hex in tmpTags) {
if (tmpTags[hex] === tag) {
tag = hex;
break;
}
}
}
offset = offsets[ifd.toLowerCase() + 'IFD'];
length = data.SHORT(offset);
for (var i = 0; i < length; i++) {
tagOffset = offset + 12 * i + 2;
if (data.SHORT(tagOffset) == tag) {
valueOffset = tagOffset + 8;
break;
}
}
if (!valueOffset) {
return false;
}
data.LONG(valueOffset, value);
return true;
}
// Public functions
return {
init: function(segment) {
// Reset internal data
offsets = {
tiffHeader: 10
};
if (segment === undefined || !segment.length) {
return false;
}
data.init(segment);
// Check if that's APP1 and that it has EXIF
if (data.SHORT(0) === 0xFFE1 && data.STRING(4, 5).toUpperCase() === "EXIF\0") {
return getIFDOffsets();
}
return false;
},
TIFF: function() {
return Tiff;
},
EXIF: function() {
var Exif;
// Populate EXIF hash
Exif = extractTags(offsets.exifIFD, tags.exif);
// Fix formatting of some tags
if (Exif.ExifVersion && Basic.typeOf(Exif.ExifVersion) === 'array') {
for (var i = 0, exifVersion = ''; i < Exif.ExifVersion.length; i++) {
exifVersion += String.fromCharCode(Exif.ExifVersion[i]);
}
Exif.ExifVersion = exifVersion;
}
return Exif;
},
GPS: function() {
var GPS;
GPS = extractTags(offsets.gpsIFD, tags.gps);
// iOS devices (and probably some others) do not put in GPSVersionID tag (why?..)
if (GPS.GPSVersionID && Basic.typeOf(GPS.GPSVersionID) === 'array') {
GPS.GPSVersionID = GPS.GPSVersionID.join('.');
}
return GPS;
},
setExif: function(tag, value) {
// Right now only setting of width/height is possible
if (tag !== 'PixelXDimension' && tag !== 'PixelYDimension') {return false;}
return setTag('exif', tag, value);
},
getBinary: function() {
return data.SEGMENT();
},
purge: function() {
data.init(null);
data = Tiff = null;
offsets = {};
}
};
};
});
// Included from: src/javascript/runtime/html5/image/JPEG.js
/**
* JPEG.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/image/JPEG
@private
*/
define("moxie/runtime/html5/image/JPEG", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/html5/image/JPEGHeaders",
"moxie/runtime/html5/utils/BinaryReader",
"moxie/runtime/html5/image/ExifParser"
], function(Basic, x, JPEGHeaders, BinaryReader, ExifParser) {
function JPEG(binstr) {
var _binstr, _br, _hm, _ep, _info, hasExif;
function _getDimensions() {
var idx = 0, marker, length;
// examine all through the end, since some images might have very large APP segments
while (idx <= _binstr.length) {
marker = _br.SHORT(idx += 2);
if (marker >= 0xFFC0 && marker <= 0xFFC3) { // SOFn
idx += 5; // marker (2 bytes) + length (2 bytes) + Sample precision (1 byte)
return {
height: _br.SHORT(idx),
width: _br.SHORT(idx += 2)
};
}
length = _br.SHORT(idx += 2);
idx += length - 2;
}
return null;
}
_binstr = binstr;
_br = new BinaryReader();
_br.init(_binstr);
// check if it is jpeg
if (_br.SHORT(0) !== 0xFFD8) {
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
}
// backup headers
_hm = new JPEGHeaders(binstr);
// extract exif info
_ep = new ExifParser();
hasExif = !!_ep.init(_hm.get('app1')[0]);
// get dimensions
_info = _getDimensions.call(this);
Basic.extend(this, {
type: 'image/jpeg',
size: _binstr.length,
width: _info && _info.width || 0,
height: _info && _info.height || 0,
setExif: function(tag, value) {
if (!hasExif) {
return false; // or throw an exception
}
if (Basic.typeOf(tag) === 'object') {
Basic.each(tag, function(value, tag) {
_ep.setExif(tag, value);
});
} else {
_ep.setExif(tag, value);
}
// update internal headers
_hm.set('app1', _ep.getBinary());
},
writeHeaders: function() {
if (!arguments.length) {
// if no arguments passed, update headers internally
return (_binstr = _hm.restore(_binstr));
}
return _hm.restore(arguments[0]);
},
stripHeaders: function(binstr) {
return _hm.strip(binstr);
},
purge: function() {
_purge.call(this);
}
});
if (hasExif) {
this.meta = {
tiff: _ep.TIFF(),
exif: _ep.EXIF(),
gps: _ep.GPS()
};
}
function _purge() {
if (!_ep || !_hm || !_br) {
return; // ignore any repeating purge requests
}
_ep.purge();
_hm.purge();
_br.init(null);
_binstr = _info = _hm = _ep = _br = null;
}
}
return JPEG;
});
// Included from: src/javascript/runtime/html5/image/PNG.js
/**
* PNG.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/image/PNG
@private
*/
define("moxie/runtime/html5/image/PNG", [
"moxie/core/Exceptions",
"moxie/core/utils/Basic",
"moxie/runtime/html5/utils/BinaryReader"
], function(x, Basic, BinaryReader) {
function PNG(binstr) {
var _binstr, _br, _hm, _ep, _info;
_binstr = binstr;
_br = new BinaryReader();
_br.init(_binstr);
// check if it's png
(function() {
var idx = 0, i = 0
, signature = [0x8950, 0x4E47, 0x0D0A, 0x1A0A]
;
for (i = 0; i < signature.length; i++, idx += 2) {
if (signature[i] != _br.SHORT(idx)) {
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
}
}
}());
function _getDimensions() {
var chunk, idx;
chunk = _getChunkAt.call(this, 8);
if (chunk.type == 'IHDR') {
idx = chunk.start;
return {
width: _br.LONG(idx),
height: _br.LONG(idx += 4)
};
}
return null;
}
function _purge() {
if (!_br) {
return; // ignore any repeating purge requests
}
_br.init(null);
_binstr = _info = _hm = _ep = _br = null;
}
_info = _getDimensions.call(this);
Basic.extend(this, {
type: 'image/png',
size: _binstr.length,
width: _info.width,
height: _info.height,
purge: function() {
_purge.call(this);
}
});
// for PNG we can safely trigger purge automatically, as we do not keep any data for later
_purge.call(this);
function _getChunkAt(idx) {
var length, type, start, CRC;
length = _br.LONG(idx);
type = _br.STRING(idx += 4, 4);
start = idx += 4;
CRC = _br.LONG(idx + length);
return {
length: length,
type: type,
start: start,
CRC: CRC
};
}
}
return PNG;
});
// Included from: src/javascript/runtime/html5/image/ImageInfo.js
/**
* ImageInfo.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/image/ImageInfo
@private
*/
define("moxie/runtime/html5/image/ImageInfo", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/html5/image/JPEG",
"moxie/runtime/html5/image/PNG"
], function(Basic, x, JPEG, PNG) {
/**
Optional image investigation tool for HTML5 runtime. Provides the following features:
- ability to distinguish image type (JPEG or PNG) by signature
- ability to extract image width/height directly from it's internals, without preloading in memory (fast)
- ability to extract APP headers from JPEGs (Exif, GPS, etc)
- ability to replace width/height tags in extracted JPEG headers
- ability to restore APP headers, that were for example stripped during image manipulation
@class ImageInfo
@constructor
@param {String} binstr Image source as binary string
*/
return function(binstr) {
var _cs = [JPEG, PNG], _img;
// figure out the format, throw: ImageError.WRONG_FORMAT if not supported
_img = (function() {
for (var i = 0; i < _cs.length; i++) {
try {
return new _cs[i](binstr);
} catch (ex) {
// console.info(ex);
}
}
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
}());
Basic.extend(this, {
/**
Image Mime Type extracted from it's depths
@property type
@type {String}
@default ''
*/
type: '',
/**
Image size in bytes
@property size
@type {Number}
@default 0
*/
size: 0,
/**
Image width extracted from image source
@property width
@type {Number}
@default 0
*/
width: 0,
/**
Image height extracted from image source
@property height
@type {Number}
@default 0
*/
height: 0,
/**
Sets Exif tag. Currently applicable only for width and height tags. Obviously works only with JPEGs.
@method setExif
@param {String} tag Tag to set
@param {Mixed} value Value to assign to the tag
*/
setExif: function() {},
/**
Restores headers to the source.
@method writeHeaders
@param {String} data Image source as binary string
@return {String} Updated binary string
*/
writeHeaders: function(data) {
return data;
},
/**
Strip all headers from the source.
@method stripHeaders
@param {String} data Image source as binary string
@return {String} Updated binary string
*/
stripHeaders: function(data) {
return data;
},
/**
Dispose resources.
@method purge
*/
purge: function() {}
});
Basic.extend(this, _img);
this.purge = function() {
_img.purge();
_img = null;
};
};
});
// Included from: src/javascript/runtime/html5/image/MegaPixel.js
/**
(The MIT License)
Copyright (c) 2012 Shinichi Tomita <shinichi.tomita@gmail.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.
*/
/**
* Mega pixel image rendering library for iOS6 Safari
*
* Fixes iOS6 Safari's image file rendering issue for large size image (over mega-pixel),
* which causes unexpected subsampling when drawing it in canvas.
* By using this library, you can safely render the image with proper stretching.
*
* Copyright (c) 2012 Shinichi Tomita <shinichi.tomita@gmail.com>
* Released under the MIT license
*/
/**
@class moxie/runtime/html5/image/MegaPixel
@private
*/
define("moxie/runtime/html5/image/MegaPixel", [], function() {
/**
* Rendering image element (with resizing) into the canvas element
*/
function renderImageToCanvas(img, canvas, options) {
var iw = img.naturalWidth, ih = img.naturalHeight;
var width = options.width, height = options.height;
var x = options.x || 0, y = options.y || 0;
var ctx = canvas.getContext('2d');
if (detectSubsampling(img)) {
iw /= 2;
ih /= 2;
}
var d = 1024; // size of tiling canvas
var tmpCanvas = document.createElement('canvas');
tmpCanvas.width = tmpCanvas.height = d;
var tmpCtx = tmpCanvas.getContext('2d');
var vertSquashRatio = detectVerticalSquash(img, iw, ih);
var sy = 0;
while (sy < ih) {
var sh = sy + d > ih ? ih - sy : d;
var sx = 0;
while (sx < iw) {
var sw = sx + d > iw ? iw - sx : d;
tmpCtx.clearRect(0, 0, d, d);
tmpCtx.drawImage(img, -sx, -sy);
var dx = (sx * width / iw + x) << 0;
var dw = Math.ceil(sw * width / iw);
var dy = (sy * height / ih / vertSquashRatio + y) << 0;
var dh = Math.ceil(sh * height / ih / vertSquashRatio);
ctx.drawImage(tmpCanvas, 0, 0, sw, sh, dx, dy, dw, dh);
sx += d;
}
sy += d;
}
tmpCanvas = tmpCtx = null;
}
/**
* Detect subsampling in loaded image.
* In iOS, larger images than 2M pixels may be subsampled in rendering.
*/
function detectSubsampling(img) {
var iw = img.naturalWidth, ih = img.naturalHeight;
if (iw * ih > 1024 * 1024) { // subsampling may happen over megapixel image
var canvas = document.createElement('canvas');
canvas.width = canvas.height = 1;
var ctx = canvas.getContext('2d');
ctx.drawImage(img, -iw + 1, 0);
// subsampled image becomes half smaller in rendering size.
// check alpha channel value to confirm image is covering edge pixel or not.
// if alpha value is 0 image is not covering, hence subsampled.
return ctx.getImageData(0, 0, 1, 1).data[3] === 0;
} else {
return false;
}
}
/**
* Detecting vertical squash in loaded image.
* Fixes a bug which squash image vertically while drawing into canvas for some images.
*/
function detectVerticalSquash(img, iw, ih) {
var canvas = document.createElement('canvas');
canvas.width = 1;
canvas.height = ih;
var ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0);
var data = ctx.getImageData(0, 0, 1, ih).data;
// search image edge pixel position in case it is squashed vertically.
var sy = 0;
var ey = ih;
var py = ih;
while (py > sy) {
var alpha = data[(py - 1) * 4 + 3];
if (alpha === 0) {
ey = py;
} else {
sy = py;
}
py = (ey + sy) >> 1;
}
canvas = null;
var ratio = (py / ih);
return (ratio === 0) ? 1 : ratio;
}
return {
isSubsampled: detectSubsampling,
renderTo: renderImageToCanvas
};
});
// Included from: src/javascript/runtime/html5/image/Image.js
/**
* Image.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/image/Image
@private
*/
define("moxie/runtime/html5/image/Image", [
"moxie/runtime/html5/Runtime",
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/core/utils/Encode",
"moxie/file/File",
"moxie/runtime/html5/image/ImageInfo",
"moxie/runtime/html5/image/MegaPixel",
"moxie/core/utils/Mime",
"moxie/core/utils/Env"
], function(extensions, Basic, x, Encode, File, ImageInfo, MegaPixel, Mime, Env) {
function HTML5Image() {
var me = this
, _img, _imgInfo, _canvas, _binStr, _blob
, _modified = false // is set true whenever image is modified
, _preserveHeaders = true
;
Basic.extend(this, {
loadFromBlob: function(blob) {
var comp = this, I = comp.getRuntime()
, asBinary = arguments.length > 1 ? arguments[1] : true
;
if (!I.can('access_binary')) {
throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR);
}
_blob = blob;
if (blob.isDetached()) {
_binStr = blob.getSource();
_preload.call(this, _binStr);
return;
} else {
_readAsDataUrl.call(this, blob.getSource(), function(dataUrl) {
if (asBinary) {
_binStr = _toBinary(dataUrl);
}
_preload.call(comp, dataUrl);
});
}
},
loadFromImage: function(img, exact) {
this.meta = img.meta;
_blob = new File(null, {
name: img.name,
size: img.size,
type: img.type
});
_preload.call(this, exact ? (_binStr = img.getAsBinaryString()) : img.getAsDataURL());
},
getInfo: function() {
var I = this.getRuntime(), info;
if (!_imgInfo && _binStr && I.can('access_image_binary')) {
_imgInfo = new ImageInfo(_binStr);
}
info = {
width: _getImg().width || 0,
height: _getImg().height || 0,
type: _blob.type || Mime.getFileMime(_blob.name),
size: _binStr && _binStr.length || _blob.size || 0,
name: _blob.name || '',
meta: _imgInfo && _imgInfo.meta || this.meta || {}
};
return info;
},
downsize: function() {
_downsize.apply(this, arguments);
},
getAsCanvas: function() {
if (_canvas) {
_canvas.id = this.uid + '_canvas';
}
return _canvas;
},
getAsBlob: function(type, quality) {
if (type !== this.type) {
// if different mime type requested prepare image for conversion
_downsize.call(this, this.width, this.height, false);
}
return new File(null, {
name: _blob.name || '',
type: type,
data: me.getAsBinaryString.call(this, type, quality)
});
},
getAsDataURL: function(type) {
var quality = arguments[1] || 90;
// if image has not been modified, return the source right away
if (!_modified) {
return _img.src;
}
if ('image/jpeg' !== type) {
return _canvas.toDataURL('image/png');
} else {
try {
// older Geckos used to result in an exception on quality argument
return _canvas.toDataURL('image/jpeg', quality/100);
} catch (ex) {
return _canvas.toDataURL('image/jpeg');
}
}
},
getAsBinaryString: function(type, quality) {
// if image has not been modified, return the source right away
if (!_modified) {
// if image was not loaded from binary string
if (!_binStr) {
_binStr = _toBinary(me.getAsDataURL(type, quality));
}
return _binStr;
}
if ('image/jpeg' !== type) {
_binStr = _toBinary(me.getAsDataURL(type, quality));
} else {
var dataUrl;
// if jpeg
if (!quality) {
quality = 90;
}
try {
// older Geckos used to result in an exception on quality argument
dataUrl = _canvas.toDataURL('image/jpeg', quality/100);
} catch (ex) {
dataUrl = _canvas.toDataURL('image/jpeg');
}
_binStr = _toBinary(dataUrl);
if (_imgInfo) {
_binStr = _imgInfo.stripHeaders(_binStr);
if (_preserveHeaders) {
// update dimensions info in exif
if (_imgInfo.meta && _imgInfo.meta.exif) {
_imgInfo.setExif({
PixelXDimension: this.width,
PixelYDimension: this.height
});
}
// re-inject the headers
_binStr = _imgInfo.writeHeaders(_binStr);
}
// will be re-created from fresh on next getInfo call
_imgInfo.purge();
_imgInfo = null;
}
}
_modified = false;
return _binStr;
},
destroy: function() {
me = null;
_purge.call(this);
this.getRuntime().getShim().removeInstance(this.uid);
}
});
function _getImg() {
if (!_canvas && !_img) {
throw new x.ImageError(x.DOMException.INVALID_STATE_ERR);
}
return _canvas || _img;
}
function _toBinary(str) {
return Encode.atob(str.substring(str.indexOf('base64,') + 7));
}
function _toDataUrl(str, type) {
return 'data:' + (type || '') + ';base64,' + Encode.btoa(str);
}
function _preload(str) {
var comp = this;
_img = new Image();
_img.onerror = function() {
_purge.call(this);
comp.trigger('error', x.ImageError.WRONG_FORMAT);
};
_img.onload = function() {
comp.trigger('load');
};
_img.src = /^data:[^;]*;base64,/.test(str) ? str : _toDataUrl(str, _blob.type);
}
function _readAsDataUrl(file, callback) {
var comp = this, fr;
// use FileReader if it's available
if (window.FileReader) {
fr = new FileReader();
fr.onload = function() {
callback(this.result);
};
fr.onerror = function() {
comp.trigger('error', x.ImageError.WRONG_FORMAT);
};
fr.readAsDataURL(file);
} else {
return callback(file.getAsDataURL());
}
}
function _downsize(width, height, crop, preserveHeaders) {
var self = this
, scale
, mathFn
, x = 0
, y = 0
, img
, destWidth
, destHeight
, orientation
;
_preserveHeaders = preserveHeaders; // we will need to check this on export (see getAsBinaryString())
// take into account orientation tag
orientation = (this.meta && this.meta.tiff && this.meta.tiff.Orientation) || 1;
if (Basic.inArray(orientation, [5,6,7,8]) !== -1) { // values that require 90 degree rotation
// swap dimensions
var tmp = width;
width = height;
height = tmp;
}
img = _getImg();
// unify dimensions
if (!crop) {
scale = Math.min(width/img.width, height/img.height);
} else {
// one of the dimensions may exceed the actual image dimensions - we need to take the smallest value
width = Math.min(width, img.width);
height = Math.min(height, img.height);
scale = Math.max(width/img.width, height/img.height);
}
// we only downsize here
if (scale > 1 && !crop && preserveHeaders) {
this.trigger('Resize');
return;
}
// prepare canvas if necessary
if (!_canvas) {
_canvas = document.createElement("canvas");
}
// calculate dimensions of proportionally resized image
destWidth = Math.round(img.width * scale);
destHeight = Math.round(img.height * scale);
// scale image and canvas
if (crop) {
_canvas.width = width;
_canvas.height = height;
// if dimensions of the resulting image still larger than canvas, center it
if (destWidth > width) {
x = Math.round((destWidth - width) / 2);
}
if (destHeight > height) {
y = Math.round((destHeight - height) / 2);
}
} else {
_canvas.width = destWidth;
_canvas.height = destHeight;
}
// rotate if required, according to orientation tag
if (!_preserveHeaders) {
_rotateToOrientaion(_canvas.width, _canvas.height, orientation);
}
_drawToCanvas.call(this, img, _canvas, -x, -y, destWidth, destHeight);
this.width = _canvas.width;
this.height = _canvas.height;
_modified = true;
self.trigger('Resize');
}
function _drawToCanvas(img, canvas, x, y, w, h) {
if (Env.OS === 'iOS') {
// avoid squish bug in iOS6
MegaPixel.renderTo(img, canvas, { width: w, height: h, x: x, y: y });
} else {
var ctx = canvas.getContext('2d');
ctx.drawImage(img, x, y, w, h);
}
}
/**
* Transform canvas coordination according to specified frame size and orientation
* Orientation value is from EXIF tag
* @author Shinichi Tomita <shinichi.tomita@gmail.com>
*/
function _rotateToOrientaion(width, height, orientation) {
switch (orientation) {
case 5:
case 6:
case 7:
case 8:
_canvas.width = height;
_canvas.height = width;
break;
default:
_canvas.width = width;
_canvas.height = height;
}
/**
1 = The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.
2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.
3 = The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.
4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.
5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.
6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.
7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.
8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.
*/
var ctx = _canvas.getContext('2d');
switch (orientation) {
case 2:
// horizontal flip
ctx.translate(width, 0);
ctx.scale(-1, 1);
break;
case 3:
// 180 rotate left
ctx.translate(width, height);
ctx.rotate(Math.PI);
break;
case 4:
// vertical flip
ctx.translate(0, height);
ctx.scale(1, -1);
break;
case 5:
// vertical flip + 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.scale(1, -1);
break;
case 6:
// 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.translate(0, -height);
break;
case 7:
// horizontal flip + 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.translate(width, -height);
ctx.scale(-1, 1);
break;
case 8:
// 90 rotate left
ctx.rotate(-0.5 * Math.PI);
ctx.translate(-width, 0);
break;
}
}
function _purge() {
if (_imgInfo) {
_imgInfo.purge();
_imgInfo = null;
}
_binStr = _img = _canvas = _blob = null;
_modified = false;
}
}
return (extensions.Image = HTML5Image);
});
// Included from: src/javascript/runtime/html4/image/Image.js
/**
* Image.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/image/Image
@private
*/
define("moxie/runtime/html4/image/Image", [
"moxie/runtime/html4/Runtime",
"moxie/runtime/html5/image/Image"
], function(extensions, Image) {
return (extensions.Image = Image);
});
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/image/Image","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);
|
frontend/src/index.js
|
Svjard/sagedesk
|
/*eslint-disable import/default*/
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import Root from './containers/Root';
import configureStore from './store/configureStore';
import { loginUserSuccess } from './actions';
const target = document.getElementById('root');
const store = configureStore(window.__INITIAL_STATE__);
const node = (
<Root store={store} />
);
ReactDOM.render(node, target);
|
ajax/libs/rxjs/2.3.25/rx.lite.js
|
noraesae/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
},
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;
}());
// Errors
var sequenceContainsNoElements = 'Sequence contains no elements.';
var argumentOutOfRange = 'Argument out of range';
var objectDisposed = 'Object has been disposed';
function checkDisposed(self) { if (self.isDisposed) { throw new Error(objectDisposed); } }
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])]; }
}
// 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;
}
// 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 = [];
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
}
this.disposables = args;
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;
for(var currentDisposables = [], i = 0, len = this.disposables.length; i < len; i++) { currentDisposables.push(this.disposables[i]); }
this.disposables = [];
this.length = 0;
for (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 () {
for(var currentDisposables = [], ix = 0, len = this.disposables.length; i < len; i++) { currentDisposables.push(this.disposables[i]); }
return currentDisposables;
};
/**
* 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;
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;
})();
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](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 = this.now() + 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) {
while (q.length > 0) {
var item = q.dequeue();
if (!item.isCancelled()) {
// Note, do not schedule blocking work!
while (item.dueTime - Scheduler.now() > 0) {
}
!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 (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 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);
};
/**
* 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) {
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 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 ObservableBase = Rx.ObservableBase = (function (__super__) {
inherits(ObservableBase, __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 setDisposable(s, state) {
var ado = state[0], self = state[1];
try {
ado.setDisposable(fixSubscriber(self.subscribeCore(ado)));
} catch (e) {
if (!ado.fail(e)) { throw e; }
}
}
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 = function(observer) {
throw new Error('Not implemeneted');
}
return ObservableBase;
}(Observable));
/**
* 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 source = this;
return new AnonymousObservable(function(observer) {
var arr = [];
return source.subscribe(
function (x) { arr.push(x); },
function (e) { observer.onError(e); },
function () {
observer.onNext(arr);
observer.onCompleted();
});
}, source);
};
/**
* 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 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');
}
if (mapFn) {
var mapper = bindCallback(mapFn, thisArg, 2);
}
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
var list = Object(iterable), it = getIterable(list);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleRecursiveWithState(0, function (i, self) {
try {
var next = it.next();
} catch (e) {
observer.onError(e);
return;
}
if (next.done) {
observer.onCompleted();
return;
}
var result = next.value;
if (mapper) {
try {
result = mapper(result, i);
} catch (e) {
observer.onError(e);
return;
}
}
observer.onNext(result);
self(i + 1);
});
});
};
var FromArrayObservable = (function(__super__) {
inherits(FromArrayObservable, __super__);
function FromArrayObservable(args, scheduler) {
this.args = args;
this.scheduler = scheduler || currentThreadScheduler;
__super__.call(this);
}
FromArrayObservable.prototype.subscribeCore = function (observer) {
var sink = new FromArraySink(observer, this);
return sink.run();
};
return FromArrayObservable;
}(ObservableBase));
var FromArraySink = (function () {
function FromArraySink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
function loopRecursive(state, recurse) {
if (state.i < state.len) {
state.observer.onNext(state.args[state.i++]);
recurse(state);
} else {
state.observer.onCompleted();
}
}
FromArraySink.prototype.run = function () {
return this.parent.scheduler.scheduleRecursiveWithState(
{i: 0, args: this.parent.args, len: this.parent.args.length, observer: this.observer },
loopRecursive);
};
return FromArraySink;
}());
/**
* 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) {
return new FromArrayObservable(array, scheduler)
};
/**
* 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 () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
return observableOf(null, args);
};
/**
* 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) {
for(var args = [], i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
return observableOf(scheduler, args);
};
/**
* 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();
}
});
});
};
/**
* 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.
* @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);
};
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;
}, 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 = 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'] = 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 () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(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 () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
var 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);
},
function(e) { observer.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 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).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);
};
/**
* 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 (o) {
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(function (x) { o.onNext(x); }, function (e) { o.onError(e); }, function () {
group.remove(subscription);
if (q.length > 0) {
subscribe(q.shift());
} else {
activeCount--;
isStopped && activeCount === 0 && o.onCompleted();
}
}));
}
group.add(sources.subscribe(function (innerSource) {
if (activeCount < maxConcurrentOrOther) {
activeCount++;
subscribe(innerSource);
} else {
q.push(innerSource);
}
}, function (e) { o.onError(e); }, function () {
isStopped = true;
activeCount === 0 && o.onCompleted();
}));
return group;
}, sources);
};
/**
* 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();
};
/**
* 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 (o) {
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(function (x) { o.onNext(x); }, function (e) { o.onError(e); }, function () {
group.remove(innerSubscription);
isStopped && group.length === 1 && o.onCompleted();
}));
}, function (e) { o.onError(e); }, function () {
isStopped = true;
group.length === 1 && o.onCompleted();
}));
return group;
}, sources);
};
/**
* @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 (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 () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(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 () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
if (Array.isArray(args[0])) { return zipArray.apply(this, args); }
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 () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(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 {
for(var i = 0, len = arguments.length; i < len; i++) { sources.push(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);
};
/**
* 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) {
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) {
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);
};
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; });
};
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.index = 0;
this.isStopped = false;
}
MapObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
try {
var result = this.selector(x, this.index++, 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(selector, 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;
});
};
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 Error(argumentOutOfRange); }
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 RangeError(argumentOutOfRange); }
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.index = 0;
this.isStopped = false;
}
FilterObserver.prototype.onNext = function(x) {
try {
var shouldYield = this.predicate(x, this.index++, this.source);
} catch(e) {
return this.observer.onError(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);
};
/**
* 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 () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
return new AnonymousObservable(function (observer) {
function handler() {
var results = arguments;
if (selector) {
try {
results = selector(results);
} catch (err) {
return observer.onError(err);
}
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 () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
return new AnonymousObservable(function (observer) {
function handler(err) {
if (err) {
observer.onError(err);
return;
}
for(var results = [], i = 1, len = arguments.length; i < len; i++) { results.push(arguments[i]); }
if (selector) {
try {
results = selector(results);
} catch (e) {
return observer.onError(e);
}
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 createListener (element, name, handler) {
if (element.addEventListener) {
element.addEventListener(name, handler, false);
return disposableCreate(function () {
element.removeEventListener(name, handler, false);
});
}
throw new Error('No listener found');
}
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;
/**
* 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) {
// Handles jq, Angular.js, Zepto, Marionette
if (typeof element.on === 'function' && typeof element.off === 'function') {
return fromEventPattern(
function (h) { element.on(eventName, h); },
function (h) { element.off(eventName, h); },
selector);
}
if (!!root.Ember && typeof root.Ember.addListener === 'function') {
return fromEventPattern(
function (h) { Ember.addListener(element, eventName, h); },
function (h) { Ember.removeListener(element, 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());
}, source) :
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.
* @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.
* @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, function (o) { return subject.subscribe(o); });
}
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 d = dueTime, p = normalizeTime(period);
return scheduler.scheduleRecursiveWithAbsoluteAndState(0, d, function (count, self) {
if (p > 0) {
var now = scheduler.now();
d = d + p;
d <= now && (d = now + p);
}
observer.onNext(count);
self(count + 1, 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);
}, source);
}
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);
}, this);
};
/**
* @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)
);
}, source);
}
/**
* 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);
}, source);
};
/**
* 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 (o) {
var lastOnNext = 0;
return source.subscribe(
function (x) {
var now = scheduler.now();
if (lastOnNext === 0 || now - lastOnNext >= duration) {
lastOnNext = now;
o.onNext(x);
}
},function (e) { o.onError(e); }, function () { o.onCompleted(); }
);
}, source);
};
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, source);
}
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 (o) {
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) {
o.onError(err);
return;
}
try {
res = resultSelector.apply(null, values);
} catch (ex) {
o.onError(ex);
return;
}
o.onNext(res);
}
if (isDone && values[1]) {
o.onCompleted();
}
}
return new CompositeDisposable(
source.subscribe(
function (x) {
next(x, 0);
},
function (e) {
if (values[1]) {
o.onError(e);
} else {
err = e;
}
},
function () {
isDone = true;
values[1] && o.onCompleted();
}),
subject.subscribe(
function (x) {
next(x, 1);
},
function (e) { o.onError(e); },
function () {
isDone = true;
next(true, 1);
})
);
}, source);
}
var PausableBufferedObservable = (function (__super__) {
inherits(PausableBufferedObservable, __super__);
function subscribe(o) {
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) {
o.onNext(q.shift());
}
}
} else {
previousShouldFire = results.shouldFire;
// new data
if (results.shouldFire) {
o.onNext(results.data);
} else {
q.push(results.data);
}
}
},
function (err) {
// Empty buffer before sending error
while (q.length > 0) {
o.onNext(q.shift());
}
o.onError(err);
},
function () {
// Empty buffer before sending completion
while (q.length > 0) {
o.onNext(q.shift());
}
o.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, source);
}
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);
};
var ControlledObservable = (function (__super__) {
inherits(ControlledObservable, __super__);
function subscribe (observer) {
return this.source.subscribe(observer);
}
function ControlledObservable (source, enableQueue) {
__super__.call(this, subscribe, source);
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 = (function (__super__) {
function subscribe (observer) {
return this.subject.subscribe(observer);
}
inherits(ControlledSubject, __super__);
function ControlledSubject(enableQueue) {
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 () {
this.hasCompleted = true;
(!this.enableQueue || this.queue.length === 0) && this.subject.onCompleted();
},
onError: function (error) {
this.hasFailed = true;
this.error = error;
(!this.enableQueue || this.queue.length === 0) && this.subject.onError(error);
},
onNext: function (value) {
var hasRequested = false;
if (this.requestedCount === 0) {
this.enableQueue && this.queue.push(value);
} else {
(this.requestedCount !== -1 && this.requestedCount-- === 0) && this.disposeCurrentRequest();
hasRequested = true;
}
hasRequested && this.subject.onNext(value);
},
_processRequest: function (numberOfItems) {
if (this.enableQueue) {
while (this.queue.length >= numberOfItems && numberOfItems > 0) {
this.subject.onNext(this.queue.shift());
numberOfItems--;
}
return this.queue.length !== 0 ?
{ numberOfItems: numberOfItems, returnValue: true } :
{ 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) {
this.disposeCurrentRequest();
var self = this, r = this._processRequest(number);
var 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;
}
});
return ControlledSubject;
}(Observable));
/**
* 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);
};
/**
* 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) {
if (subscriber && typeof subscriber.dispose === 'function') { return subscriber; }
return typeof subscriber === 'function' ?
disposableCreate(subscriber) :
disposableEmpty;
}
function setDisposable(s, state) {
var ado = state[0], subscribe = state[1];
try {
ado.setDisposable(fixSubscriber(subscribe(ado)));
} catch (e) {
if (!ado.fail(e)) { throw e; }
}
}
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 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 () { 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));
/**
* 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(this);
if (!this.isStopped) {
this.observers.push(observer);
observer.onNext(this.value);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(BehaviorSubject, __super__);
/**
* 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.hasError = false;
}
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(this);
if (this.isStopped) { return; }
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) { return; }
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;
},
/**
* 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) { return; }
this.value = value;
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;
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(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.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;
},
_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(this);
if (this.isStopped) { return; }
var now = this.scheduler.now();
this.q.push({ interval: now, value: value });
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[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(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.error = error;
this.hasError = true;
var now = this.scheduler.now();
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onError(error);
observer.ensureActive();
}
this.observers.length = 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
var now = this.scheduler.now();
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onCompleted();
observer.ensureActive();
}
this.observers.length = 0;
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
return ReplaySubject;
}(Observable));
/**
* Used to pause and resume streams.
*/
Rx.Pauser = (function (__super__) {
inherits(Pauser, __super__);
function Pauser() {
__super__.call(this);
}
/**
* Pauses the underlying sequence.
*/
Pauser.prototype.pause = function () { this.onNext(false); };
/**
* Resumes the underlying sequence.
*/
Pauser.prototype.resume = function () { this.onNext(true); };
return Pauser;
}(Subject));
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/components/App/setViewport.js
|
elurye/ReactJestBoiler
|
/*
* React.js Starter Kit
* Copyright (c) 2014 Konstantin Tarkus (@koistya), KriaSoft LLC.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
'use strict';
import React, { Component } from 'react';
import { canUseDOM } from 'react/lib/ExecutionEnvironment';
export default function setViewport(ComposedComponent) {
return class AppViewport extends Component {
constructor() {
super();
this.state = {
viewport: canUseDOM ?
{width: window.innerWidth, height: window.innerHeight} :
{width: 1366, height: 768} // Default size for server-side rendering
};
this.handleResize = () => {
let viewport = {width: window.innerWidth, height: window.innerHeight};
if (this.state.viewport.width !== viewport.width ||
this.state.viewport.height !== viewport.height) {
this.setState({viewport: viewport});
}
};
}
componentDidMount() {
window.addEventListener('resize', this.handleResize);
window.addEventListener('orientationchange', this.handleResize);
}
componentWillUnmount() {
window.removeEventListener('resize', this.handleResize);
window.removeEventListener('orientationchange', this.handleResize);
}
render() {
return <ComposedComponent {...this.props} viewport={this.state.viewport}/>;
}
};
};
|
ajax/libs/rxjs/2.5.2/rx.lite.js
|
zhangbg/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
},
helpers: { }
};
// Defaults
var noop = Rx.helpers.noop = function () { },
notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; },
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) {
var len = arr.length, a = new Array(len);
for(var i = 0; i < len; i++) { a[i] = 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 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;
}
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;
}
// 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(); }
};
// Single assignment
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () {
this.isDisposed = false;
this.current = null;
};
SingleAssignmentDisposable.prototype.getDisposable = function () {
return this.current;
};
SingleAssignmentDisposable.prototype.setDisposable = function (value) {
if (this.current) { throw new Error('Disposable has already been assigned'); }
var shouldDispose = this.isDisposed;
!shouldDispose && (this.current = value);
shouldDispose && value && value.dispose();
};
SingleAssignmentDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var old = this.current;
this.current = null;
}
old && old.dispose();
};
// Multiple assignment disposable
var SerialDisposable = Rx.SerialDisposable = function () {
this.isDisposed = false;
this.current = null;
};
SerialDisposable.prototype.getDisposable = function () {
return this.current;
};
SerialDisposable.prototype.setDisposable = function (value) {
var shouldDispose = this.isDisposed;
if (!shouldDispose) {
var old = this.current;
this.current = value;
}
old && old.dispose();
shouldDispose && value && value.dispose();
};
SerialDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var old = this.current;
this.current = null;
}
old && old.dispose();
};
/**
* 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;
})();
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;
}
/** Determines whether the given object is a scheduler */
Scheduler.isScheduler = function (s) {
return s instanceof Scheduler;
}
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, isScheduler = Scheduler.isScheduler;
(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));
/** 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 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;
var localTimer = (function () {
var localSetTimeout, localClearTimeout = noop;
if (!!root.setTimeout) {
localSetTimeout = root.setTimeout;
localClearTimeout = root.clearTimeout;
} else if (!!root.WScript) {
localSetTimeout = function (fn, time) {
root.WScript.Sleep(time);
fn();
};
} else {
throw new NotSupportedError();
}
return {
setTimeout: localSetTimeout,
clearTimeout: localClearTimeout
};
}());
var localSetTimeout = localTimer.setTimeout,
localClearTimeout = localTimer.clearTimeout;
(function () {
var nextHandle = 1, tasksByHandle = {}, currentlyRunning = false;
clearMethod = function (handle) {
delete tasksByHandle[handle];
};
function runTask(handle) {
if (currentlyRunning) {
localSetTimeout(function () { runTask(handle) }, 0);
} else {
var task = tasksByHandle[handle];
if (task) {
currentlyRunning = true;
var result = tryCatch(task)();
clearMethod(handle);
currentlyRunning = false;
if (result === errorObj) { return thrower(result.e); }
}
}
}
var reNative = RegExp('^' +
String(toString)
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/toString| for [^\]]+/g, '.*?') + '$'
);
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
!reNative.test(setImmediate) && setImmediate;
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 (isFunction(setImmediate)) {
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
setImmediate(function () { runTask(id); });
return id;
};
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
process.nextTick(function () { runTask(id); });
return id;
};
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random();
function onGlobalPostMessage(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) {
runTask(event.data.substring(MSG_PREFIX.length));
}
}
if (root.addEventListener) {
root.addEventListener('message', onGlobalPostMessage, false);
} else if (root.attachEvent) {
root.attachEvent('onmessage', onGlobalPostMessage);
} else {
root.onmessage = onGlobalPostMessage;
}
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
root.postMessage(MSG_PREFIX + currentId, '*');
return id;
};
} else if (!!root.MessageChannel) {
var channel = new root.MessageChannel();
channel.port1.onmessage = function (e) { runTask(e.data); };
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
channel.port2.postMessage(id);
return id;
};
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
scheduleMethod = function (action) {
var scriptElement = root.document.createElement('script');
var id = nextHandle++;
tasksByHandle[id] = action;
scriptElement.onreadystatechange = function () {
runTask(id);
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
root.document.documentElement.appendChild(scriptElement);
return id;
};
} else {
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
localSetTimeout(function () {
runTask(id);
}, 0);
return id;
};
}
}());
/**
* 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 () {
!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), disposable = new SingleAssignmentDisposable();
if (dt === 0) { return scheduler.scheduleWithState(state, action); }
var id = localSetTimeout(function () {
!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, 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 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);
};
/**
* 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 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 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 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));
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);
});
};
var EmptyObservable = (function(__super__) {
inherits(EmptyObservable, __super__);
function EmptyObservable(scheduler) {
this.scheduler = scheduler;
__super__.call(this);
}
EmptyObservable.prototype.subscribeCore = function (observer) {
var sink = new EmptySink(observer, this);
return sink.run();
};
function EmptySink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
function scheduleItem(s, state) {
state.onCompleted();
}
EmptySink.prototype.run = function () {
return this.parent.scheduler.scheduleWithState(this.observer, scheduleItem);
};
return EmptyObservable;
}(ObservableBase));
/**
* 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 EmptyObservable(scheduler);
};
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)
};
var NeverObservable = (function(__super__) {
inherits(NeverObservable, __super__);
function NeverObservable() {
__super__.call(this);
}
NeverObservable.prototype.subscribeCore = function (observer) {
return disposableEmpty;
};
return NeverObservable;
}(ObservableBase));
/**
* 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 NeverObservable();
};
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);
};
var PairsObservable = (function(__super__) {
inherits(PairsObservable, __super__);
function PairsObservable(obj, scheduler) {
this.obj = obj;
this.keys = Object.keys(obj);
this.scheduler = scheduler;
__super__.call(this);
}
PairsObservable.prototype.subscribeCore = function (observer) {
var sink = new PairsSink(observer, this);
return sink.run();
};
return PairsObservable;
}(ObservableBase));
function PairsSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
PairsSink.prototype.run = function () {
var observer = this.observer, obj = this.parent.obj, keys = this.parent.keys, len = keys.length;
function loopRecursive(i, recurse) {
if (i < len) {
var key = keys[i];
observer.onNext([key, obj[key]]);
recurse(i + 1);
} else {
observer.onCompleted();
}
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
/**
* 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 = currentThreadScheduler);
return new PairsObservable(obj, scheduler);
};
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);
};
var RepeatObservable = (function(__super__) {
inherits(RepeatObservable, __super__);
function RepeatObservable(value, repeatCount, scheduler) {
this.value = value;
this.repeatCount = repeatCount == null ? -1 : repeatCount;
this.scheduler = scheduler;
__super__.call(this);
}
RepeatObservable.prototype.subscribeCore = function (observer) {
var sink = new RepeatSink(observer, this);
return sink.run();
};
return RepeatObservable;
}(ObservableBase));
function RepeatSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
RepeatSink.prototype.run = function () {
var observer = this.observer, value = this.parent.value;
function loopRecursive(i, recurse) {
if (i === -1 || i > 0) {
observer.onNext(value);
i > 0 && i--;
}
if (i === 0) { return observer.onCompleted(); }
recurse(i);
}
return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount, loopRecursive);
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
* @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 new RepeatObservable(value, repeatCount, scheduler);
};
var JustObservable = (function(__super__) {
inherits(JustObservable, __super__);
function JustObservable(value, scheduler) {
this.value = value;
this.scheduler = scheduler;
__super__.call(this);
}
JustObservable.prototype.subscribeCore = function (observer) {
var sink = new JustSink(observer, this);
return sink.run();
};
function JustSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
function scheduleItem(s, state) {
var value = state[0], observer = state[1];
observer.onNext(value);
observer.onCompleted();
}
JustSink.prototype.run = function () {
return this.parent.scheduler.scheduleWithState([this.parent.value, this.observer], scheduleItem);
};
return JustObservable;
}(ObservableBase));
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
* There is an alias called 'just' or 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 = Observable.returnValue = function (value, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new JustObservable(value, scheduler);
};
var ThrowObservable = (function(__super__) {
inherits(ThrowObservable, __super__);
function ThrowObservable(error, scheduler) {
this.error = error;
this.scheduler = scheduler;
__super__.call(this);
}
ThrowObservable.prototype.subscribeCore = function (observer) {
var sink = new ThrowSink(observer, this);
return sink.run();
};
function ThrowSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
function scheduleItem(s, state) {
var error = state[0], observer = state[1];
observer.onError(error);
}
ThrowSink.prototype.run = function () {
return this.parent.scheduler.scheduleWithState([this.parent.error, this.observer], scheduleItem);
};
return ThrowObservable;
}(ObservableBase));
/**
* 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 = Observable.throwException = function (error, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new ThrowObservable(error, scheduler);
};
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);
};
/**
* 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);
};
/**
* 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;
return new AnonymousObservable(function (observer) {
var tapObserver = !observerOrOnNext || isFunction(observerOrOnNext) ?
observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) :
observerOrOnNext;
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);
};
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; });
};
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.call(this, 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);
};
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;
});
};
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.call(this, 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);
};
/**
* 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 len = arguments.length, args = new Array(len)
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return new AnonymousObservable(function (observer) {
function handler() {
var len = arguments.length, results = new Array(len);
for(var i = 0; i < len; i++) { results[i] = arguments[i]; }
if (selector) {
try {
results = selector.apply(context, results);
} catch (e) {
return observer.onError(e);
}
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 len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return new AnonymousObservable(function (observer) {
function handler(err) {
if (err) {
observer.onError(err);
return;
}
var len = arguments.length, results = [];
for(var i = 1; i < len; i++) { results[i - 1] = arguments[i]; }
if (selector) {
try {
results = selector.apply(context, results);
} catch (e) {
return observer.onError(e);
}
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 createListener (element, name, handler) {
if (element.addEventListener) {
element.addEventListener(name, handler, false);
return disposableCreate(function () {
element.removeEventListener(name, handler, false);
});
}
throw new Error('No listener found');
}
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;
/**
* 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) {
// Handles jq, Angular.js, Zepto, Marionette, Ember.js
if (typeof element.on === 'function' && typeof element.off === 'function') {
return fromEventPattern(
function (h) { element.on(eventName, h); },
function (h) { element.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) {
return observer.onError(err);
}
}
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) {
return observer.onError(err);
}
}
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 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);
});
});
};
/**
* 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());
}, source) :
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.
* @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.
* @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 windowSize [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, windowSize, scheduler) {
return selector && isFunction(selector) ?
this.multicast(function () { return new ReplaySubject(bufferSize, windowSize, scheduler); }, selector) :
this.multicast(new ReplaySubject(bufferSize, windowSize, 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, windowSize, scheduler) {
return this.replay(null, bufferSize, windowSize, 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, function (o) { return subject.subscribe(o); });
}
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 d = dueTime, p = normalizeTime(period);
return scheduler.scheduleRecursiveWithAbsoluteAndState(0, d, function (count, self) {
if (p > 0) {
var now = scheduler.now();
d = d + p;
d <= now && (d = now + p);
}
observer.onNext(count);
self(count + 1, 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);
}, source);
}
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);
}, this);
};
/**
* @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.default);
*
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the default 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)
);
}, source);
}
/**
* 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);
}, source);
};
/**
* 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 (o) {
var lastOnNext = 0;
return source.subscribe(
function (x) {
var now = scheduler.now();
if (lastOnNext === 0 || now - lastOnNext >= duration) {
lastOnNext = now;
o.onNext(x);
}
},function (e) { o.onError(e); }, function () { o.onCompleted(); }
);
}, source);
};
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, source);
}
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 (o) {
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) {
o.onError(err);
return;
}
try {
res = resultSelector.apply(null, values);
} catch (ex) {
o.onError(ex);
return;
}
o.onNext(res);
}
if (isDone && values[1]) {
o.onCompleted();
}
}
return new CompositeDisposable(
source.subscribe(
function (x) {
next(x, 0);
},
function (e) {
if (values[1]) {
o.onError(e);
} else {
err = e;
}
},
function () {
isDone = true;
values[1] && o.onCompleted();
}),
subject.subscribe(
function (x) {
next(x, 1);
},
function (e) { o.onError(e); },
function () {
isDone = true;
next(true, 1);
})
);
}, source);
}
var PausableBufferedObservable = (function (__super__) {
inherits(PausableBufferedObservable, __super__);
function subscribe(o) {
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) {
o.onNext(q.shift());
}
}
} else {
previousShouldFire = results.shouldFire;
// new data
if (results.shouldFire) {
o.onNext(results.data);
} else {
q.push(results.data);
}
}
},
function (err) {
// Empty buffer before sending error
while (q.length > 0) {
o.onNext(q.shift());
}
o.onError(err);
},
function () {
// Empty buffer before sending completion
while (q.length > 0) {
o.onNext(q.shift());
}
o.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, source);
}
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);
};
var ControlledObservable = (function (__super__) {
inherits(ControlledObservable, __super__);
function subscribe (observer) {
return this.source.subscribe(observer);
}
function ControlledObservable (source, enableQueue, scheduler) {
__super__.call(this, subscribe, source);
this.subject = new ControlledSubject(enableQueue, scheduler);
this.source = source.multicast(this.subject).refCount();
}
ControlledObservable.prototype.request = function (numberOfItems) {
return this.subject.request(numberOfItems == null ? -1 : numberOfItems);
};
return ControlledObservable;
}(Observable));
var ControlledSubject = (function (__super__) {
function subscribe (observer) {
return this.subject.subscribe(observer);
}
inherits(ControlledSubject, __super__);
function ControlledSubject(enableQueue, scheduler) {
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.scheduler = scheduler || currentThreadScheduler;
}
addProperties(ControlledSubject.prototype, Observer, {
onCompleted: function () {
this.hasCompleted = true;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onCompleted();
} else {
this.queue.push(Notification.createOnCompleted());
}
},
onError: function (error) {
this.hasFailed = true;
this.error = error;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onError(error);
} else {
this.queue.push(Notification.createOnError(error));
}
},
onNext: function (value) {
var hasRequested = false;
if (this.requestedCount === 0) {
this.enableQueue && this.queue.push(Notification.createOnNext(value));
} else {
(this.requestedCount !== -1 && this.requestedCount-- === 0) && this.disposeCurrentRequest();
hasRequested = true;
}
hasRequested && this.subject.onNext(value);
},
_processRequest: function (numberOfItems) {
if (this.enableQueue) {
while ((this.queue.length >= numberOfItems && numberOfItems > 0) ||
(this.queue.length > 0 && this.queue[0].kind !== 'N')) {
var first = this.queue.shift();
first.accept(this.subject);
if (first.kind === 'N') {
numberOfItems--;
} else {
this.disposeCurrentRequest();
this.queue = [];
}
}
return { numberOfItems : numberOfItems, returnValue: this.queue.length !== 0};
}
return { numberOfItems: numberOfItems, returnValue: false };
},
request: function (number) {
this.disposeCurrentRequest();
var self = this;
this.requestedDisposable = this.scheduler.scheduleWithState(number,
function(s, i) {
var r = self._processRequest(i), remaining = r.numberOfItems;
if (!r.returnValue) {
self.requestedCount = remaining;
self.requestedDisposable = disposableCreate(function () {
self.requestedCount = 0;
});
}
});
return this.requestedDisposable;
},
disposeCurrentRequest: function () {
this.requestedDisposable.dispose();
this.requestedDisposable = disposableEmpty;
}
});
return ControlledSubject;
}(Observable));
/**
* 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 {bool} enableQueue truthy value to determine if values should be queued pending the next request
* @param {Scheduler} scheduler determines how the requests will be scheduled
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.controlled = function (enableQueue, scheduler) {
if (enableQueue && isScheduler(enableQueue)) {
scheduler = enableQueue;
enableQueue = true;
}
if (enableQueue == null) { enableQueue = true; }
return new ControlledObservable(this, enableQueue, scheduler);
};
/**
* Pipes the existing Observable sequence into a Node.js Stream.
* @param {Stream} dest The destination Node.js stream.
* @returns {Stream} The destination stream.
*/
observableProto.pipe = function (dest) {
var source = this.pausableBuffered();
function onDrain() {
source.resume();
}
dest.addListener('drain', onDrain);
source.subscribe(
function (x) {
!dest.write(String(x)) && source.pause();
},
function (err) {
dest.emit('error', err);
},
function () {
// Hack check because STDIO is not closable
!dest._isStdio && dest.end();
dest.removeListener('drain', onDrain);
});
source.resume();
return dest;
};
/**
* 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(o) {
return {
'@@transducer/init': function() {
return o;
},
'@@transducer/step': function(obs, input) {
return obs.onNext(input);
},
'@@transducer/result': function(obs) {
return obs.onCompleted();
}
};
}
return new AnonymousObservable(function(o) {
var xform = transducer(transformForObserver(o));
return source.subscribe(
function(v) {
try {
xform['@@transducer/step'](o, v);
} catch (e) {
o.onError(e);
}
},
function (e) { o.onError(e); },
function() { xform['@@transducer/result'](o); }
);
}, 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));
/**
* 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(this);
if (!this.isStopped) {
this.observers.push(observer);
observer.onNext(this.value);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(BehaviorSubject, __super__);
/**
* 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.hasError = false;
}
addProperties(BehaviorSubject.prototype, Observer, {
/**
* Gets the current value or throws an exception.
* Value is frozen after onCompleted is called.
* After onError is called always throws the specified exception.
* An exception is always thrown after dispose is called.
* @returns {Mixed} The initial value passed to the constructor until onNext is called; after which, the last value passed to onNext.
*/
getValue: function () {
checkDisposed(this);
if (this.hasError) {
throw this.error;
}
return this.value;
},
/**
* 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) { return; }
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) { return; }
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;
},
/**
* 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) { return; }
this.value = value;
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;
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__) {
var maxSafeInteger = Math.pow(2, 53) - 1;
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(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 ? maxSafeInteger : bufferSize;
this.windowSize = windowSize == null ? maxSafeInteger : 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.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;
},
_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(this);
if (this.isStopped) { return; }
var now = this.scheduler.now();
this.q.push({ interval: now, value: value });
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[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(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.error = error;
this.hasError = true;
var now = this.scheduler.now();
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onError(error);
observer.ensureActive();
}
this.observers.length = 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
var now = this.scheduler.now();
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onCompleted();
observer.ensureActive();
}
this.observers.length = 0;
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
return ReplaySubject;
}(Observable));
/**
* Used to pause and resume streams.
*/
Rx.Pauser = (function (__super__) {
inherits(Pauser, __super__);
function Pauser() {
__super__.call(this);
}
/**
* Pauses the underlying sequence.
*/
Pauser.prototype.pause = function () { this.onNext(false); };
/**
* Resumes the underlying sequence.
*/
Pauser.prototype.resume = function () { this.onNext(true); };
return Pauser;
}(Subject));
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));
|
ajax/libs/react/0.13.0-alpha.2/react-with-addons.min.js
|
janpaepke/cdnjs
|
/**
* React (with addons) v0.13.0-alpha.2
*
* Copyright 2013-2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.React=e()}}(function(){return function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t){"use strict";var n=e(25),r=e(31),o=e(43),i=e(34),a=e(92),s=e(93),u=e(121),l=e(116),c=e(161);r.addons={CSSTransitionGroup:i,LinkedStateMixin:n,PureRenderMixin:o,TransitionGroup:a,batchedUpdates:s.batchedUpdates,classSet:u,cloneWithProps:l,update:c},t.exports=r},{}],2:[function(e,t){"use strict";var n=e(128),r={componentDidMount:function(){this.props.autoFocus&&n(this.getDOMNode())}};t.exports=r},{}],3:[function(e,t){"use strict";function n(){var e=window.opera;return"object"==typeof e&&"function"==typeof e.version&&parseInt(e.version(),10)<=12}function r(e){return(e.ctrlKey||e.altKey||e.metaKey)&&!(e.ctrlKey&&e.altKey)}function o(e){switch(e){case T.topCompositionStart:return P.compositionStart;case T.topCompositionEnd:return P.compositionEnd;case T.topCompositionUpdate:return P.compositionUpdate}}function i(e,t){return e===T.topKeyDown&&t.keyCode===E}function a(e,t){switch(e){case T.topKeyUp:return-1!==C.indexOf(t.keyCode);case T.topKeyDown:return t.keyCode!==E;case T.topKeyPress:case T.topMouseDown:case T.topBlur:return!0;default:return!1}}function s(e){var t=e.detail;return"object"==typeof t&&"data"in t?t.data:null}function u(e,t,n,r){var u,l;if(_?u=o(e):O?a(e,r)&&(u=P.compositionEnd):i(e,r)&&(u=P.compositionStart),!u)return null;D&&(O||u!==P.compositionStart?u===P.compositionEnd&&O&&(l=O.getData()):O=m.getPooled(t));var c=v.getPooled(u,n,r);if(l)c.data=l;else{var p=s(r);null!==p&&(c.data=p)}return f.accumulateTwoPhaseDispatches(c),c}function l(e,t){switch(e){case T.topCompositionEnd:return s(t);case T.topKeyPress:var n=t.which;return n!==M?null:(I=!0,N);case T.topTextInput:var r=t.data;return r===N&&I?null:r;default:return null}}function c(e,t){if(O){if(e===T.topCompositionEnd||a(e,t)){var n=O.getData();return m.release(O),O=null,n}return null}switch(e){case T.topPaste:return null;case T.topKeyPress:return t.which&&!r(t)?String.fromCharCode(t.which):null;case T.topCompositionEnd:return D?null:t.data;default:return null}}function p(e,t,n,r){var o;if(o=x?l(e,r):c(e,r),!o)return null;var i=g.getPooled(P.beforeInput,n,r);return i.data=o,w=null,f.accumulateTwoPhaseDispatches(i),i}var d=e(16),f=e(21),h=e(22),m=e(23),v=e(99),g=e(103),y=e(151),C=[9,13,27,32],E=229,_=h.canUseDOM&&"CompositionEvent"in window,b=null;h.canUseDOM&&"documentMode"in document&&(b=document.documentMode);var x=h.canUseDOM&&"TextEvent"in window&&!b&&!n(),D=h.canUseDOM&&(!_||b&&b>8&&11>=b),M=32,N=String.fromCharCode(M),T=d.topLevelTypes,P={beforeInput:{phasedRegistrationNames:{bubbled:y({onBeforeInput:null}),captured:y({onBeforeInputCapture:null})},dependencies:[T.topCompositionEnd,T.topKeyPress,T.topTextInput,T.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:y({onCompositionEnd:null}),captured:y({onCompositionEndCapture:null})},dependencies:[T.topBlur,T.topCompositionEnd,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:y({onCompositionStart:null}),captured:y({onCompositionStartCapture:null})},dependencies:[T.topBlur,T.topCompositionStart,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:y({onCompositionUpdate:null}),captured:y({onCompositionUpdateCapture:null})},dependencies:[T.topBlur,T.topCompositionUpdate,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]}},w=null,I=!1,O=null,R={eventTypes:P,extractEvents:function(e,t,n,r){return[u(e,t,n,r),p(e,t,n,r)]}};t.exports=R},{}],4:[function(e,t){var n=e(144),r={addClass:function(e,t){return n(!/\s/.test(t)),t&&(e.classList?e.classList.add(t):r.hasClass(e,t)||(e.className=e.className+" "+t)),e},removeClass:function(e,t){return n(!/\s/.test(t)),t&&(e.classList?e.classList.remove(t):r.hasClass(e,t)&&(e.className=e.className.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,""))),e},conditionClass:function(e,t,n){return(n?r.addClass:r.removeClass)(e,t)},hasClass:function(e,t){return n(!/\s/.test(t)),e.classList?!!t&&e.classList.contains(t):(" "+e.className+" ").indexOf(" "+t+" ")>-1}};t.exports=r},{}],5:[function(e,t){"use strict";function n(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var r={columnCount:!0,flex:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,strokeOpacity:!0},o=["Webkit","ms","Moz","O"];Object.keys(r).forEach(function(e){o.forEach(function(t){r[n(t,e)]=r[e]})});var i={background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}},a={isUnitlessNumber:r,shorthandPropertyExpansions:i};t.exports=a},{}],6:[function(e,t){"use strict";var n=e(5),r=e(22),o=(e(115),e(122)),i=e(142),a=e(153),s=(e(162),a(function(e){return i(e)})),u="cssFloat";r.canUseDOM&&void 0===document.documentElement.style.cssFloat&&(u="styleFloat");var l={createMarkupForStyles:function(e){var t="";for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];null!=r&&(t+=s(n)+":",t+=o(n,r)+";")}return t||null},setValueForStyles:function(e,t){var r=e.style;for(var i in t)if(t.hasOwnProperty(i)){var a=o(i,t[i]);if("float"===i&&(i=u),a)r[i]=a;else{var s=n.shorthandPropertyExpansions[i];if(s)for(var l in s)r[l]="";else r[i]=""}}}};t.exports=l},{}],7:[function(e,t){"use strict";function n(){this._callbacks=null,this._contexts=null}var r=e(30),o=e(29),i=e(144);o(n.prototype,{enqueue:function(e,t){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(e),this._contexts.push(t)},notifyAll:function(){var e=this._callbacks,t=this._contexts;if(e){i(e.length===t.length),this._callbacks=null,this._contexts=null;for(var n=0,r=e.length;r>n;n++)e[n].call(t[n]);e.length=0,t.length=0}},reset:function(){this._callbacks=null,this._contexts=null},destructor:function(){this.reset()}}),r.addPoolingTo(n),t.exports=n},{}],8:[function(e,t){"use strict";function n(e){return"SELECT"===e.nodeName||"INPUT"===e.nodeName&&"file"===e.type}function r(e){var t=b.getPooled(T.change,w,e);C.accumulateTwoPhaseDispatches(t),_.batchedUpdates(o,t)}function o(e){y.enqueueEvents(e),y.processEventQueue()}function i(e,t){P=e,w=t,P.attachEvent("onchange",r)}function a(){P&&(P.detachEvent("onchange",r),P=null,w=null)}function s(e,t,n){return e===N.topChange?n:void 0}function u(e,t,n){e===N.topFocus?(a(),i(t,n)):e===N.topBlur&&a()}function l(e,t){P=e,w=t,I=e.value,O=Object.getOwnPropertyDescriptor(e.constructor.prototype,"value"),Object.defineProperty(P,"value",A),P.attachEvent("onpropertychange",p)}function c(){P&&(delete P.value,P.detachEvent("onpropertychange",p),P=null,w=null,I=null,O=null)}function p(e){if("value"===e.propertyName){var t=e.srcElement.value;t!==I&&(I=t,r(e))}}function d(e,t,n){return e===N.topInput?n:void 0}function f(e,t,n){e===N.topFocus?(c(),l(t,n)):e===N.topBlur&&c()}function h(e){return e!==N.topSelectionChange&&e!==N.topKeyUp&&e!==N.topKeyDown||!P||P.value===I?void 0:(I=P.value,w)}function m(e){return"INPUT"===e.nodeName&&("checkbox"===e.type||"radio"===e.type)}function v(e,t,n){return e===N.topClick?n:void 0}var g=e(16),y=e(18),C=e(21),E=e(22),_=e(93),b=e(101),x=e(145),D=e(147),M=e(151),N=g.topLevelTypes,T={change:{phasedRegistrationNames:{bubbled:M({onChange:null}),captured:M({onChangeCapture:null})},dependencies:[N.topBlur,N.topChange,N.topClick,N.topFocus,N.topInput,N.topKeyDown,N.topKeyUp,N.topSelectionChange]}},P=null,w=null,I=null,O=null,R=!1;E.canUseDOM&&(R=x("change")&&(!("documentMode"in document)||document.documentMode>8));var S=!1;E.canUseDOM&&(S=x("input")&&(!("documentMode"in document)||document.documentMode>9));var A={get:function(){return O.get.call(this)},set:function(e){I=""+e,O.set.call(this,e)}},k={eventTypes:T,extractEvents:function(e,t,r,o){var i,a;if(n(t)?R?i=s:a=u:D(t)?S?i=d:(i=h,a=f):m(t)&&(i=v),i){var l=i(e,t,r);if(l){var c=b.getPooled(T.change,l,o);return C.accumulateTwoPhaseDispatches(c),c}}a&&a(e,t,r)}};t.exports=k},{}],9:[function(e,t){"use strict";var n=0,r={createReactRootIndex:function(){return n++}};t.exports=r},{}],10:[function(e,t){"use strict";function n(e,t,n){e.insertBefore(t,e.childNodes[n]||null)}var r,o=e(13),i=e(75),a=e(139),s=e(144),u=a();r="textContent"===u?function(e,t){e.textContent=t}:function(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);if(t){var n=e.ownerDocument||document;e.appendChild(n.createTextNode(t))}};var l={dangerouslyReplaceNodeWithMarkup:o.dangerouslyReplaceNodeWithMarkup,updateTextContent:r,processUpdates:function(e,t){for(var a,u=null,l=null,c=0;c<e.length;c++)if(a=e[c],a.type===i.MOVE_EXISTING||a.type===i.REMOVE_NODE){var p=a.fromIndex,d=a.parentNode.childNodes[p],f=a.parentID;s(d),u=u||{},u[f]=u[f]||[],u[f][p]=d,l=l||[],l.push(d)}var h=o.dangerouslyRenderMarkup(t);if(l)for(var m=0;m<l.length;m++)l[m].parentNode.removeChild(l[m]);for(var v=0;v<e.length;v++)switch(a=e[v],a.type){case i.INSERT_MARKUP:n(a.parentNode,h[a.markupIndex],a.toIndex);break;case i.MOVE_EXISTING:n(a.parentNode,u[a.parentID][a.fromIndex],a.toIndex);break;case i.TEXT_CONTENT:r(a.parentNode,a.textContent);break;case i.REMOVE_NODE:}}};t.exports=l},{}],11:[function(e,t){"use strict";function n(e,t){return(e&t)===t}var r=e(144),o={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var t=e.Properties||{},i=e.DOMAttributeNames||{},s=e.DOMPropertyNames||{},u=e.DOMMutationMethods||{};e.isCustomAttribute&&a._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var l in t){r(!a.isStandardName.hasOwnProperty(l)),a.isStandardName[l]=!0;var c=l.toLowerCase();if(a.getPossibleStandardName[c]=l,i.hasOwnProperty(l)){var p=i[l];a.getPossibleStandardName[p]=l,a.getAttributeName[l]=p}else a.getAttributeName[l]=c;a.getPropertyName[l]=s.hasOwnProperty(l)?s[l]:l,a.getMutationMethod[l]=u.hasOwnProperty(l)?u[l]:null;var d=t[l];a.mustUseAttribute[l]=n(d,o.MUST_USE_ATTRIBUTE),a.mustUseProperty[l]=n(d,o.MUST_USE_PROPERTY),a.hasSideEffects[l]=n(d,o.HAS_SIDE_EFFECTS),a.hasBooleanValue[l]=n(d,o.HAS_BOOLEAN_VALUE),a.hasNumericValue[l]=n(d,o.HAS_NUMERIC_VALUE),a.hasPositiveNumericValue[l]=n(d,o.HAS_POSITIVE_NUMERIC_VALUE),a.hasOverloadedBooleanValue[l]=n(d,o.HAS_OVERLOADED_BOOLEAN_VALUE),r(!a.mustUseAttribute[l]||!a.mustUseProperty[l]),r(a.mustUseProperty[l]||!a.hasSideEffects[l]),r(!!a.hasBooleanValue[l]+!!a.hasNumericValue[l]+!!a.hasOverloadedBooleanValue[l]<=1)}}},i={},a={ID_ATTRIBUTE_NAME:"data-reactid",isStandardName:{},getPossibleStandardName:{},getAttributeName:{},getPropertyName:{},getMutationMethod:{},mustUseAttribute:{},mustUseProperty:{},hasSideEffects:{},hasBooleanValue:{},hasNumericValue:{},hasPositiveNumericValue:{},hasOverloadedBooleanValue:{},_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t<a._isCustomAttributeFunctions.length;t++){var n=a._isCustomAttributeFunctions[t];if(n(e))return!0}return!1},getDefaultValueForProperty:function(e,t){var n,r=i[e];return r||(i[e]=r={}),t in r||(n=document.createElement(e),r[t]=n[t]),r[t]},injection:o};t.exports=a},{}],12:[function(e,t){"use strict";function n(e,t){return null==t||r.hasBooleanValue[e]&&!t||r.hasNumericValue[e]&&isNaN(t)||r.hasPositiveNumericValue[e]&&1>t||r.hasOverloadedBooleanValue[e]&&t===!1}var r=e(11),o=e(125),i=e(153),a=(e(162),i(function(e){return o(e)+'="'})),s={createMarkupForID:function(e){return a(r.ID_ATTRIBUTE_NAME)+o(e)+'"'},createMarkupForProperty:function(e,t){if(r.isStandardName.hasOwnProperty(e)&&r.isStandardName[e]){if(n(e,t))return"";var i=r.getAttributeName[e];return r.hasBooleanValue[e]||r.hasOverloadedBooleanValue[e]&&t===!0?o(i):a(i)+o(t)+'"'}return r.isCustomAttribute(e)?null==t?"":a(e)+o(t)+'"':null},setValueForProperty:function(e,t,o){if(r.isStandardName.hasOwnProperty(t)&&r.isStandardName[t]){var i=r.getMutationMethod[t];if(i)i(e,o);else if(n(t,o))this.deleteValueForProperty(e,t);else if(r.mustUseAttribute[t])e.setAttribute(r.getAttributeName[t],""+o);else{var a=r.getPropertyName[t];r.hasSideEffects[t]&&""+e[a]==""+o||(e[a]=o)}}else r.isCustomAttribute(t)&&(null==o?e.removeAttribute(t):e.setAttribute(t,""+o))},deleteValueForProperty:function(e,t){if(r.isStandardName.hasOwnProperty(t)&&r.isStandardName[t]){var n=r.getMutationMethod[t];if(n)n(e,void 0);else if(r.mustUseAttribute[t])e.removeAttribute(r.getAttributeName[t]);else{var o=r.getPropertyName[t],i=r.getDefaultValueForProperty(e.nodeName,o);r.hasSideEffects[t]&&""+e[o]===i||(e[o]=i)}}else r.isCustomAttribute(t)&&e.removeAttribute(t)}};t.exports=s},{}],13:[function(e,t){"use strict";function n(e){return e.substring(1,e.indexOf(" "))}var r=e(22),o=e(120),i=e(123),a=e(136),s=e(144),u=/^(<[^ \/>]+)/,l="data-danger-index",c={dangerouslyRenderMarkup:function(e){s(r.canUseDOM);for(var t,c={},p=0;p<e.length;p++)s(e[p]),t=n(e[p]),t=a(t)?t:"*",c[t]=c[t]||[],c[t][p]=e[p];var d=[],f=0;for(t in c)if(c.hasOwnProperty(t)){var h,m=c[t];for(h in m)if(m.hasOwnProperty(h)){var v=m[h];m[h]=v.replace(u,"$1 "+l+'="'+h+'" ')}for(var g=o(m.join(""),i),y=0;y<g.length;++y){var C=g[y];C.hasAttribute&&C.hasAttribute(l)&&(h=+C.getAttribute(l),C.removeAttribute(l),s(!d.hasOwnProperty(h)),d[h]=C,f+=1)}}return s(f===d.length),s(d.length===e.length),d},dangerouslyReplaceNodeWithMarkup:function(e,t){s(r.canUseDOM),s(t),s("html"!==e.tagName.toLowerCase());var n=o(t,i)[0];e.parentNode.replaceChild(n,e)}};t.exports=c},{}],14:[function(e,t){"use strict";var n=e(151),r=[n({ResponderEventPlugin:null}),n({SimpleEventPlugin:null}),n({TapEventPlugin:null}),n({EnterLeaveEventPlugin:null}),n({ChangeEventPlugin:null}),n({SelectEventPlugin:null}),n({BeforeInputEventPlugin:null}),n({AnalyticsEventPlugin:null}),n({MobileSafariClickEventPlugin:null})];t.exports=r},{}],15:[function(e,t){"use strict";var n=e(16),r=e(21),o=e(105),i=e(73),a=e(151),s=n.topLevelTypes,u=i.getFirstReactDOM,l={mouseEnter:{registrationName:a({onMouseEnter:null}),dependencies:[s.topMouseOut,s.topMouseOver]},mouseLeave:{registrationName:a({onMouseLeave:null}),dependencies:[s.topMouseOut,s.topMouseOver]}},c=[null,null],p={eventTypes:l,extractEvents:function(e,t,n,a){if(e===s.topMouseOver&&(a.relatedTarget||a.fromElement))return null;if(e!==s.topMouseOut&&e!==s.topMouseOver)return null;var p;if(t.window===t)p=t;else{var d=t.ownerDocument;p=d?d.defaultView||d.parentWindow:window}var f,h;if(e===s.topMouseOut?(f=t,h=u(a.relatedTarget||a.toElement)||p):(f=p,h=t),f===h)return null;var m=f?i.getID(f):"",v=h?i.getID(h):"",g=o.getPooled(l.mouseLeave,m,a);g.type="mouseleave",g.target=f,g.relatedTarget=h;var y=o.getPooled(l.mouseEnter,v,a);return y.type="mouseenter",y.target=h,y.relatedTarget=f,r.accumulateEnterLeaveDispatches(g,y,m,v),c[0]=g,c[1]=y,c}};t.exports=p},{}],16:[function(e,t){"use strict";var n=e(150),r=n({bubbled:null,captured:null}),o=n({topBlur:null,topChange:null,topClick:null,topCompositionEnd:null,topCompositionStart:null,topCompositionUpdate:null,topContextMenu:null,topCopy:null,topCut:null,topDoubleClick:null,topDrag:null,topDragEnd:null,topDragEnter:null,topDragExit:null,topDragLeave:null,topDragOver:null,topDragStart:null,topDrop:null,topError:null,topFocus:null,topInput:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topLoad:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topPaste:null,topReset:null,topScroll:null,topSelectionChange:null,topSubmit:null,topTextInput:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topWheel:null}),i={topLevelTypes:o,PropagationPhases:r};t.exports=i},{}],17:[function(e,t){var n=e(123),r={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,r){return e.addEventListener?(e.addEventListener(t,r,!0),{remove:function(){e.removeEventListener(t,r,!0)}}):{remove:n}},registerDefault:function(){}};t.exports=r},{}],18:[function(e,t){"use strict";var n=e(19),r=e(20),o=e(112),i=e(129),a=e(144),s={},u=null,l=function(e){if(e){var t=r.executeDispatch,o=n.getPluginModuleForEvent(e);o&&o.executeDispatch&&(t=o.executeDispatch),r.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e)}},c=null,p={injection:{injectMount:r.injection.injectMount,injectInstanceHandle:function(e){c=e},getInstanceHandle:function(){return c},injectEventPluginOrder:n.injectEventPluginOrder,injectEventPluginsByName:n.injectEventPluginsByName},eventNameDispatchConfigs:n.eventNameDispatchConfigs,registrationNameModules:n.registrationNameModules,putListener:function(e,t,n){a(!n||"function"==typeof n);var r=s[t]||(s[t]={});r[e]=n},getListener:function(e,t){var n=s[t];return n&&n[e]},deleteListener:function(e,t){var n=s[t];n&&delete n[e]},deleteAllListeners:function(e){for(var t in s)delete s[t][e]},extractEvents:function(e,t,r,i){for(var a,s=n.plugins,u=0,l=s.length;l>u;u++){var c=s[u];if(c){var p=c.extractEvents(e,t,r,i);p&&(a=o(a,p))}}return a},enqueueEvents:function(e){e&&(u=o(u,e))},processEventQueue:function(){var e=u;u=null,i(e,l),a(!u)},__purge:function(){s={}},__getListenerBank:function(){return s}};t.exports=p},{}],19:[function(e,t){"use strict";function n(){if(a)for(var e in s){var t=s[e],n=a.indexOf(e);if(i(n>-1),!u.plugins[n]){i(t.extractEvents),u.plugins[n]=t;var o=t.eventTypes;for(var l in o)i(r(o[l],t,l))}}}function r(e,t,n){i(!u.eventNameDispatchConfigs.hasOwnProperty(n)),u.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var a in r)if(r.hasOwnProperty(a)){var s=r[a];o(s,t,n)}return!0}return e.registrationName?(o(e.registrationName,t,n),!0):!1}function o(e,t,n){i(!u.registrationNameModules[e]),u.registrationNameModules[e]=t,u.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var i=e(144),a=null,s={},u={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){i(!a),a=Array.prototype.slice.call(e),n()},injectEventPluginsByName:function(e){var t=!1;for(var r in e)if(e.hasOwnProperty(r)){var o=e[r];s.hasOwnProperty(r)&&s[r]===o||(i(!s[r]),s[r]=o,t=!0)}t&&n()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return u.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=u.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){a=null;for(var e in s)s.hasOwnProperty(e)&&delete s[e];u.plugins.length=0;var t=u.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=u.registrationNameModules;for(var o in r)r.hasOwnProperty(o)&&delete r[o]}};t.exports=u},{}],20:[function(e,t){"use strict";function n(e){return e===m.topMouseUp||e===m.topTouchEnd||e===m.topTouchCancel}function r(e){return e===m.topMouseMove||e===m.topTouchMove}function o(e){return e===m.topMouseDown||e===m.topTouchStart}function i(e,t){var n=e._dispatchListeners,r=e._dispatchIDs;if(Array.isArray(n))for(var o=0;o<n.length&&!e.isPropagationStopped();o++)t(e,n[o],r[o]);else n&&t(e,n,r)}function a(e,t,n){e.currentTarget=h.Mount.getNode(n);var r=t(e,n);return e.currentTarget=null,r}function s(e,t){i(e,t),e._dispatchListeners=null,e._dispatchIDs=null}function u(e){var t=e._dispatchListeners,n=e._dispatchIDs;if(Array.isArray(t)){for(var r=0;r<t.length&&!e.isPropagationStopped();r++)if(t[r](e,n[r]))return n[r]}else if(t&&t(e,n))return n;return null}function l(e){var t=u(e);return e._dispatchIDs=null,e._dispatchListeners=null,t}function c(e){var t=e._dispatchListeners,n=e._dispatchIDs;f(!Array.isArray(t));var r=t?t(e,n):null;return e._dispatchListeners=null,e._dispatchIDs=null,r}function p(e){return!!e._dispatchListeners}var d=e(16),f=e(144),h={Mount:null,injectMount:function(e){h.Mount=e}},m=d.topLevelTypes,v={isEndish:n,isMoveish:r,isStartish:o,executeDirectDispatch:c,executeDispatch:a,executeDispatchesInOrder:s,executeDispatchesInOrderStopAtTrue:l,hasDispatches:p,injection:h,useTouchEvents:!1};t.exports=v},{}],21:[function(e,t){"use strict";function n(e,t,n){var r=t.dispatchConfig.phasedRegistrationNames[n];return m(e,r)}function r(e,t,r){var o=t?h.bubbled:h.captured,i=n(e,r,o);i&&(r._dispatchListeners=d(r._dispatchListeners,i),r._dispatchIDs=d(r._dispatchIDs,e))}function o(e){e&&e.dispatchConfig.phasedRegistrationNames&&p.injection.getInstanceHandle().traverseTwoPhase(e.dispatchMarker,r,e)}function i(e,t,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,o=m(e,r);o&&(n._dispatchListeners=d(n._dispatchListeners,o),n._dispatchIDs=d(n._dispatchIDs,e))}}function a(e){e&&e.dispatchConfig.registrationName&&i(e.dispatchMarker,null,e)}function s(e){f(e,o)}function u(e,t,n,r){p.injection.getInstanceHandle().traverseEnterLeave(n,r,i,e,t)}function l(e){f(e,a)}var c=e(16),p=e(18),d=e(112),f=e(129),h=c.PropagationPhases,m=p.getListener,v={accumulateTwoPhaseDispatches:s,accumulateDirectDispatches:l,accumulateEnterLeaveDispatches:u};t.exports=v},{}],22:[function(e,t){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};t.exports=r},{}],23:[function(e,t){"use strict";function n(e){this._root=e,this._startText=this.getText(),this._fallbackText=null}var r=e(30),o=e(29),i=e(139);o(n.prototype,{getText:function(){return"value"in this._root?this._root.value:this._root[i()]},getData:function(){if(this._fallbackText)return this._fallbackText;var e,t,n=this._startText,r=n.length,o=this.getText(),i=o.length;for(e=0;r>e&&n[e]===o[e];e++);var a=r-e;for(t=1;a>=t&&n[r-t]===o[i-t];t++);var s=t>1?1-t:void 0;return this._fallbackText=o.slice(e,s),this._fallbackText}}),r.addPoolingTo(n),t.exports=n},{}],24:[function(e,t){"use strict";var n,r=e(11),o=e(22),i=r.injection.MUST_USE_ATTRIBUTE,a=r.injection.MUST_USE_PROPERTY,s=r.injection.HAS_BOOLEAN_VALUE,u=r.injection.HAS_SIDE_EFFECTS,l=r.injection.HAS_NUMERIC_VALUE,c=r.injection.HAS_POSITIVE_NUMERIC_VALUE,p=r.injection.HAS_OVERLOADED_BOOLEAN_VALUE;if(o.canUseDOM){var d=document.implementation;n=d&&d.hasFeature&&d.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}var f={isCustomAttribute:RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),Properties:{accept:null,acceptCharset:null,accessKey:null,action:null,allowFullScreen:i|s,allowTransparency:i,alt:null,async:s,autoComplete:null,autoPlay:s,cellPadding:null,cellSpacing:null,charSet:i,checked:a|s,classID:i,className:n?i:a,cols:i|c,colSpan:null,content:null,contentEditable:null,contextMenu:i,controls:a|s,coords:null,crossOrigin:null,data:null,dateTime:i,defer:s,dir:null,disabled:i|s,download:p,draggable:null,encType:null,form:i,formAction:i,formEncType:i,formMethod:i,formNoValidate:s,formTarget:i,frameBorder:i,headers:null,height:i,hidden:i|s,href:null,hrefLang:null,htmlFor:null,httpEquiv:null,icon:null,id:a,label:null,lang:null,list:i,loop:a|s,manifest:i,marginHeight:null,marginWidth:null,max:null,maxLength:i,media:i,mediaGroup:null,method:null,min:null,multiple:a|s,muted:a|s,name:null,noValidate:s,open:null,pattern:null,placeholder:null,poster:null,preload:null,radioGroup:null,readOnly:a|s,rel:null,required:s,role:i,rows:i|c,rowSpan:null,sandbox:null,scope:null,scrolling:null,seamless:i|s,selected:a|s,shape:null,size:i|c,sizes:i,span:c,spellCheck:null,src:null,srcDoc:a,srcSet:i,start:l,step:null,style:null,tabIndex:null,target:null,title:null,type:null,useMap:null,value:a|u,width:i,wmode:i,autoCapitalize:null,autoCorrect:null,itemProp:i,itemScope:i|s,itemType:i,property:null},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{autoCapitalize:"autocapitalize",autoComplete:"autocomplete",autoCorrect:"autocorrect",autoFocus:"autofocus",autoPlay:"autoplay",encType:"enctype",hrefLang:"hreflang",radioGroup:"radiogroup",spellCheck:"spellcheck",srcDoc:"srcdoc",srcSet:"srcset"}};t.exports=f},{}],25:[function(e,t){"use strict";var n=e(71),r=e(89),o={linkState:function(e){return new n(this.state[e],r.createStateKeySetter(this,e))}};t.exports=o},{}],26:[function(e,t){"use strict";function n(e){u(null==e.props.checkedLink||null==e.props.valueLink)}function r(e){n(e),u(null==e.props.value&&null==e.props.onChange)}function o(e){n(e),u(null==e.props.checked&&null==e.props.onChange)}function i(e){this.props.valueLink.requestChange(e.target.value)}function a(e){this.props.checkedLink.requestChange(e.target.checked)}var s=e(82),u=e(144),l={button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0},c={Mixin:{propTypes:{value:function(e,t){return!e[t]||l[e.type]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(e,t){return!e[t]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:s.func}},getValue:function(e){return e.props.valueLink?(r(e),e.props.valueLink.value):e.props.value},getChecked:function(e){return e.props.checkedLink?(o(e),e.props.checkedLink.value):e.props.checked},getOnChange:function(e){return e.props.valueLink?(r(e),i):e.props.checkedLink?(o(e),a):e.props.onChange}};t.exports=c},{}],27:[function(e,t){"use strict";function n(e){e.remove()}var r=e(33),o=e(112),i=e(129),a=e(144),s={trapBubbledEvent:function(e,t){a(this.isMounted());var n=r.trapBubbledEvent(e,t,this.getDOMNode());this._localEventListeners=o(this._localEventListeners,n)},componentWillUnmount:function(){this._localEventListeners&&i(this._localEventListeners,n)}};t.exports=s},{}],28:[function(e,t){"use strict";var n=e(16),r=e(123),o=n.topLevelTypes,i={eventTypes:null,extractEvents:function(e,t,n,i){if(e===o.topTouchStart){var a=i.target;a&&!a.onclick&&(a.onclick=r)}}};t.exports=i},{}],29:[function(e,t){"use strict";function n(e){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var t=Object(e),n=Object.prototype.hasOwnProperty,r=1;r<arguments.length;r++){var o=arguments[r];if(null!=o){var i=Object(o);for(var a in i)n.call(i,a)&&(t[a]=i[a])}}return t}t.exports=n},{}],30:[function(e,t){"use strict";var n=e(144),r=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)},o=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},i=function(e,t,n){var r=this;if(r.instancePool.length){var o=r.instancePool.pop();return r.call(o,e,t,n),o}return new r(e,t,n)},a=function(e,t,n,r,o){var i=this;if(i.instancePool.length){var a=i.instancePool.pop();return i.call(a,e,t,n,r,o),a}return new i(e,t,n,r,o)},s=function(e){var t=this;n(e instanceof t),e.destructor&&e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},u=10,l=r,c=function(e,t){var n=e;return n.instancePool=[],n.getPooled=t||l,n.poolSize||(n.poolSize=u),n.release=s,n},p={addPoolingTo:c,oneArgumentPooler:r,twoArgumentPooler:o,threeArgumentPooler:i,fiveArgumentPooler:a};t.exports=p},{}],31:[function(e,t){"use strict";var n=e(12),r=e(20),o=e(37),i=e(39),a=e(40),s=e(38),u=e(45),l=e(46),c=e(61),p=(e(62),e(47)),d=e(49),f=e(57),h=e(60),m=e(69),v=e(73),g=e(74),y=e(78),C=e(82),E=e(85),_=e(87),b=e(29),x=e(126),D=e(155);h.inject();var M=c.createElement,N=c.createFactory,T=y.measure("React","render",v.render),P={Children:{map:o.map,forEach:o.forEach,count:o.count,only:D},Component:a,DOM:p,PropTypes:C,initializeTouchEvents:function(e){r.useTouchEvents=e},createClass:s.createClass,createElement:M,createFactory:N,createRef:function(){return new E},constructAndRenderComponent:v.constructAndRenderComponent,constructAndRenderComponentByID:v.constructAndRenderComponentByID,findDOMNode:x,render:T,renderToString:_.renderToString,renderToStaticMarkup:_.renderToStaticMarkup,unmountComponentAtNode:v.unmountComponentAtNode,isValidElement:c.isValidElement,withContext:u.withContext,__spread:b};"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({Component:i,CurrentOwner:l,DOMComponent:d,DOMPropertyOperations:n,InstanceHandles:m,Mount:v,MultiChild:g,TextComponent:f});P.version="0.13.0-alpha.2",t.exports=P},{}],32:[function(e,t){"use strict";var n=e(126),r={getDOMNode:function(){return n(this)}};t.exports=r},{}],33:[function(e,t){"use strict";function n(e){return Object.prototype.hasOwnProperty.call(e,h)||(e[h]=d++,c[e[h]]={}),c[e[h]]}var r=e(16),o=e(18),i=e(19),a=e(65),s=e(110),u=e(29),l=e(145),c={},p=!1,d=0,f={topBlur:"blur",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topScroll:"scroll",topSelectionChange:"selectionchange",topTextInput:"textInput",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topWheel:"wheel"},h="_reactListenersID"+String(Math.random()).slice(2),m=u({},a,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(m.handleTopLevel),m.ReactEventListener=e}},setEnabled:function(e){m.ReactEventListener&&m.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!m.ReactEventListener||!m.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var o=t,a=n(o),s=i.registrationNameDependencies[e],u=r.topLevelTypes,c=0,p=s.length;p>c;c++){var d=s[c];a.hasOwnProperty(d)&&a[d]||(d===u.topWheel?l("wheel")?m.ReactEventListener.trapBubbledEvent(u.topWheel,"wheel",o):l("mousewheel")?m.ReactEventListener.trapBubbledEvent(u.topWheel,"mousewheel",o):m.ReactEventListener.trapBubbledEvent(u.topWheel,"DOMMouseScroll",o):d===u.topScroll?l("scroll",!0)?m.ReactEventListener.trapCapturedEvent(u.topScroll,"scroll",o):m.ReactEventListener.trapBubbledEvent(u.topScroll,"scroll",m.ReactEventListener.WINDOW_HANDLE):d===u.topFocus||d===u.topBlur?(l("focus",!0)?(m.ReactEventListener.trapCapturedEvent(u.topFocus,"focus",o),m.ReactEventListener.trapCapturedEvent(u.topBlur,"blur",o)):l("focusin")&&(m.ReactEventListener.trapBubbledEvent(u.topFocus,"focusin",o),m.ReactEventListener.trapBubbledEvent(u.topBlur,"focusout",o)),a[u.topBlur]=!0,a[u.topFocus]=!0):f.hasOwnProperty(d)&&m.ReactEventListener.trapBubbledEvent(d,f[d],o),a[d]=!0)
}},trapBubbledEvent:function(e,t,n){return m.ReactEventListener.trapBubbledEvent(e,t,n)},trapCapturedEvent:function(e,t,n){return m.ReactEventListener.trapCapturedEvent(e,t,n)},ensureScrollValueMonitoring:function(){if(!p){var e=s.refreshScrollValues;m.ReactEventListener.monitorScrollValue(e),p=!0}},eventNameDispatchConfigs:o.eventNameDispatchConfigs,registrationNameModules:o.registrationNameModules,putListener:o.putListener,getListener:o.getListener,deleteListener:o.deleteListener,deleteAllListeners:o.deleteAllListeners});t.exports=m},{}],34:[function(e,t){"use strict";var n=e(31),r=e(29),o=n.createFactory(e(92)),i=n.createFactory(e(35)),a=n.createClass({displayName:"ReactCSSTransitionGroup",propTypes:{transitionName:n.PropTypes.string.isRequired,transitionAppear:n.PropTypes.bool,transitionEnter:n.PropTypes.bool,transitionLeave:n.PropTypes.bool},getDefaultProps:function(){return{transitionAppear:!1,transitionEnter:!0,transitionLeave:!0}},_wrapChild:function(e){return i({name:this.props.transitionName,appear:this.props.transitionAppear,enter:this.props.transitionEnter,leave:this.props.transitionLeave},e)},render:function(){return o(r({},this.props,{childFactory:this._wrapChild}))}});t.exports=a},{}],35:[function(e,t){"use strict";var n=e(31),r=e(4),o=e(91),i=e(155),a=17,s=n.createClass({displayName:"ReactCSSTransitionGroupChild",transition:function(e,t){var n=this.getDOMNode(),i=this.props.name+"-"+e,a=i+"-active",s=function(e){e&&e.target!==n||(r.removeClass(n,i),r.removeClass(n,a),o.removeEndEventListener(n,s),t&&t())};o.addEndEventListener(n,s),r.addClass(n,i),this.queueClass(a)},queueClass:function(e){this.classNameQueue.push(e),this.timeout||(this.timeout=setTimeout(this.flushClassNameQueue,a))},flushClassNameQueue:function(){this.isMounted()&&this.classNameQueue.forEach(r.addClass.bind(r,this.getDOMNode())),this.classNameQueue.length=0,this.timeout=null},componentWillMount:function(){this.classNameQueue=[]},componentWillUnmount:function(){this.timeout&&clearTimeout(this.timeout)},componentWillAppear:function(e){this.props.appear?this.transition("appear",e):e()},componentWillEnter:function(e){this.props.enter?this.transition("enter",e):e()},componentWillLeave:function(e){this.props.leave?this.transition("leave",e):e()},render:function(){return i(this.props.children)}});t.exports=s},{}],36:[function(e,t){"use strict";var n=e(127),r=e(143),o=e(158),i={instantiateChildren:function(e){var t=n(e);for(var o in t)if(t.hasOwnProperty(o)){var i=t[o],a=r(i,null);t[o]=a}return t},updateChildren:function(e,t,i,a){var s=n(t);if(!s&&!e)return null;var u;for(u in s)if(s.hasOwnProperty(u)){var l=e&&e[u],c=l&&l._currentElement,p=s[u];if(o(c,p))l.receiveComponent(p,i,a),s[u]=l;else{l&&l.unmountComponent();var d=r(p,null);s[u]=d}}for(u in e)!e.hasOwnProperty(u)||s&&s.hasOwnProperty(u)||e[u].unmountComponent();return s},unmountChildren:function(e){for(var t in e){var n=e[t];n.unmountComponent()}}};t.exports=i},{}],37:[function(e,t){"use strict";function n(e,t){this.forEachFunction=e,this.forEachContext=t}function r(e,t,n,r){var o=e;o.forEachFunction.call(o.forEachContext,t,r)}function o(e,t,o){if(null==e)return e;var i=n.getPooled(t,o);p(e,r,i),n.release(i)}function i(e,t,n){this.mapResult=e,this.mapFunction=t,this.mapContext=n}function a(e,t,n,r){var o=e,i=o.mapResult,a=!i.hasOwnProperty(n);if(a){var s=o.mapFunction.call(o.mapContext,t,r);i[n]=s}}function s(e,t,n){if(null==e)return e;var r={},o=i.getPooled(r,t,n);return p(e,a,o),i.release(o),r}function u(){return null}function l(e){return p(e,u,null)}var c=e(30),p=e(160),d=(e(162),c.twoArgumentPooler),f=c.threeArgumentPooler;c.addPoolingTo(n,d),c.addPoolingTo(i,f);var h={forEach:o,map:s,count:l};t.exports=h},{}],38:[function(e,t){"use strict";function n(e,t){for(var n in t)t.hasOwnProperty(n)&&g("function"==typeof t[n])}function r(e,t){var n=x.hasOwnProperty(t)?x[t]:null;M.hasOwnProperty(t)&&g(n===_.OVERRIDE_BASE),e.hasOwnProperty(t)&&g(n===_.DEFINE_MANY||n===_.DEFINE_MANY_MERGED)}function o(e,t){if(t){g("function"!=typeof t),g(!d.isValidElement(t));var n=e.prototype;t.hasOwnProperty(E)&&D.mixins(e,t.mixins);for(var o in t)if(t.hasOwnProperty(o)&&o!==E){var i=t[o];if(r(n,o),D.hasOwnProperty(o))D[o](e,i);else{var a=x.hasOwnProperty(o),l=n.hasOwnProperty(o),c=i&&i.__reactDontBind,p="function"==typeof i,f=p&&!a&&!l&&!c;if(f)n.__reactAutoBindMap||(n.__reactAutoBindMap={}),n.__reactAutoBindMap[o]=i,n[o]=i;else if(l){var h=x[o];g(a&&(h===_.DEFINE_MANY_MERGED||h===_.DEFINE_MANY)),h===_.DEFINE_MANY_MERGED?n[o]=s(n[o],i):h===_.DEFINE_MANY&&(n[o]=u(n[o],i))}else n[o]=i}}}}function i(e,t){if(t)for(var n in t){var r=t[n];if(t.hasOwnProperty(n)){var o=n in D;g(!o);var i=n in e;g(!i),e[n]=r}}}function a(e,t){g(e&&t&&"object"==typeof e&&"object"==typeof t);for(var n in t)t.hasOwnProperty(n)&&(g(void 0===e[n]),e[n]=t[n]);return e}function s(e,t){return function(){var n=e.apply(this,arguments),r=t.apply(this,arguments);if(null==n)return r;if(null==r)return n;var o={};return a(o,n),a(o,r),o}}function u(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function l(e,t){var n=t.bind(e);return n}function c(e){for(var t in e.__reactAutoBindMap)if(e.__reactAutoBindMap.hasOwnProperty(t)){var n=e.__reactAutoBindMap[t];e[t]=l(e,f.guard(n,e.constructor.displayName+"."+t))}}var p=e(40),d=e(61),f=e(64),h=e(70),m=e(81),v=(e(80),e(29)),g=e(144),y=e(150),C=e(151),E=(e(154),C({mixins:null})),_=y({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),b=[],x={mixins:_.DEFINE_MANY,statics:_.DEFINE_MANY,propTypes:_.DEFINE_MANY,contextTypes:_.DEFINE_MANY,childContextTypes:_.DEFINE_MANY,getDefaultProps:_.DEFINE_MANY_MERGED,getInitialState:_.DEFINE_MANY_MERGED,getChildContext:_.DEFINE_MANY_MERGED,render:_.DEFINE_ONCE,componentWillMount:_.DEFINE_MANY,componentDidMount:_.DEFINE_MANY,componentWillReceiveProps:_.DEFINE_MANY,shouldComponentUpdate:_.DEFINE_ONCE,componentWillUpdate:_.DEFINE_MANY,componentDidUpdate:_.DEFINE_MANY,componentWillUnmount:_.DEFINE_MANY,updateComponent:_.OVERRIDE_BASE},D={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n<t.length;n++)o(e,t[n])},childContextTypes:function(e,t){n(e,t,m.childContext),e.childContextTypes=v({},e.childContextTypes,t)},contextTypes:function(e,t){n(e,t,m.context),e.contextTypes=v({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps=e.getDefaultProps?s(e.getDefaultProps,t):t},propTypes:function(e,t){n(e,t,m.prop),e.propTypes=v({},e.propTypes,t)},statics:function(e,t){i(e,t)}},M={replaceState:function(e,t){var n=h.get(this);g(n),n.replaceState(e,t)},isMounted:function(){var e=h.get(this);return e&&e.isMounted()},setProps:function(e,t){var n=h.get(this);g(n),n.setProps(e,t)},replaceProps:function(e,t){h.get(this).replaceProps(e,t)}},N=function(){};v(N.prototype,p.prototype,M);var T={createClass:function(e){var t=function(){this.__reactAutoBindMap&&c(this)};t.prototype=new N,t.prototype.constructor=t,b.forEach(o.bind(null,t)),o(t,e),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),g(t.prototype.render);for(var n in x)t.prototype[n]||(t.prototype[n]=null);return t.type=t,t},injection:{injectMixin:function(e){b.push(e)}}};t.exports=T},{}],39:[function(e,t){"use strict";function n(e,t,n){e instanceof i?i.attachRef(e,t):o.addComponentAsRefTo(t,e,n)}function r(e,t,n){e instanceof i?i.detachRef(e,t):o.removeComponentAsRefFrom(t,e,n)}var o=(e(62),e(77)),i=e(85),a=e(144),s={BackendIDOperations:null,Mixin:{construct:function(e){this._currentElement=e,this._mountIndex=0,this._mountImage=null},mountComponent:function(){var e=this._currentElement.ref;if(null!=e){var t=this._currentElement._owner;n(e,this,t)}},unmountComponent:function(){var e=this._currentElement.ref;null!=e&&r(e,this,this._currentElement._owner)},updateComponent:function(e,t,o){(o._owner!==t._owner||o.ref!==t.ref)&&(null!=t.ref&&r(t.ref,this,t._owner),null!=o.ref&&n(o.ref,this,o._owner))},getPublicInstance:function(){a(!1)}}};t.exports=s},{}],40:[function(e,t){"use strict";function n(e){this.props=e}{var r=e(70),o=e(144);e(162)}n.prototype.setState=function(e,t){o("object"==typeof e||null==e);var n=r.get(this);o(n),n.setState(e,t)},n.prototype.forceUpdate=function(e){var t=r.get(this);o(t),t.forceUpdate(e)};t.exports=n},{}],41:[function(e,t){"use strict";var n=e(51),r=e(73),o={processChildrenUpdates:n.dangerouslyProcessChildrenUpdates,replaceNodeWithMarkupByID:n.dangerouslyReplaceNodeWithMarkupByID,unmountIDFromEnvironment:function(e){r.purgeID(e)}};t.exports=o},{}],42:[function(e,t){"use strict";var n=e(144),r=!1,o={unmountIDFromEnvironment:null,replaceNodeWithMarkupByID:null,processChildrenUpdates:null,injection:{injectEnvironment:function(e){n(!r),o.unmountIDFromEnvironment=e.unmountIDFromEnvironment,o.replaceNodeWithMarkupByID=e.replaceNodeWithMarkupByID,o.processChildrenUpdates=e.processChildrenUpdates,r=!0}}};t.exports=o},{}],43:[function(e,t){"use strict";var n=e(157),r={shouldComponentUpdate:function(e,t){return!n(this.props,e)||!n(this.state,t)}};t.exports=r},{}],44:[function(e,t){"use strict";function n(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" Check the render method of `"+n+"`."}return""}function r(e){var t=e._compositeLifeCycleState;h(null==s.current),h(t!==g.UNMOUNTING)}var o=e(39),i=e(42),a=e(45),s=e(46),u=e(61),l=e(70),c=e(78),p=(e(81),e(80),e(93)),d=e(29),f=e(124),h=e(144),m=e(150),v=e(158),g=(e(162),m({MOUNTING:null,UNMOUNTING:null,RECEIVING_PROPS:null})),y=1,C=d({},o.Mixin,{construct:function(e){this._rootNodeID=null,this._instance.props=e.props,this._instance.state=null,this._instance.context=null,this._instance.refs=f,this._pendingElement=null,this._pendingContext=null,this._pendingState=null,this._pendingForceUpdate=!1,this._compositeLifeCycleState=null,this._renderedComponent=null,o.Mixin.construct.apply(this,arguments),this._context=null,this._mountOrder=0,this._isTopLevel=!1,this._pendingCallbacks=null},isMounted:function(){return this._compositeLifeCycleState!==g.MOUNTING},mountComponent:function(e,t,n){o.Mixin.mountComponent.call(this,e,t,n),this._context=n,this._mountOrder=y++,this._rootNodeID=e;var r=this._instance;l.set(r,this),this._compositeLifeCycleState=g.MOUNTING,r.context=this._processContext(this._currentElement._context),r.props=this._processProps(this._currentElement.props);var i=r.getInitialState?r.getInitialState():null;h("object"==typeof i&&!Array.isArray(i)),r.state=i,this._pendingState=null,this._pendingForceUpdate=!1,r.componentWillMount&&(r.componentWillMount(),this._pendingState&&(r.state=this._pendingState,this._pendingState=null));var a=this._renderValidatedComponent();this._renderedComponent=this._instantiateReactComponent(a,this._currentElement.type),this._compositeLifeCycleState=null;var s=this._renderedComponent.mountComponent(e,t,this._processChildContext(n));return r.componentDidMount&&t.getReactMountReady().enqueue(r.componentDidMount,r),s},unmountComponent:function(){var e=this._instance;this._compositeLifeCycleState=g.UNMOUNTING,e.componentWillUnmount&&e.componentWillUnmount(),this._compositeLifeCycleState=null,this._renderedComponent.unmountComponent(),this._renderedComponent=null,this._pendingState=null,this._pendingForceUpdate=!1,this._pendingCallbacks=null,this._pendingElement=null,o.Mixin.unmountComponent.call(this),i.unmountIDFromEnvironment(this._rootNodeID),this._context=null,this._rootNodeID=null,l.remove(e)},setProps:function(e,t){var n=this._pendingElement||this._currentElement;this.replaceProps(d({},n.props,e),t)},replaceProps:function(e,t){h(this._isTopLevel),this._pendingElement=u.cloneAndReplaceProps(this._pendingElement||this._currentElement,e),p.enqueueUpdate(this,t)},_setPropsInternal:function(e,t){var n=this._pendingElement||this._currentElement;this._pendingElement=u.cloneAndReplaceProps(n,d({},n.props,e)),p.enqueueUpdate(this,t)},setState:function(e,t){this.replaceState(d({},this._pendingState||this._instance.state,e),t)},replaceState:function(e,t){r(this),this._pendingState=e,this._compositeLifeCycleState!==g.MOUNTING&&p.enqueueUpdate(this,t)},forceUpdate:function(e){var t=this._compositeLifeCycleState;h(t!==g.RECEIVING_STATE&&t!==g.UNMOUNTING),this._pendingForceUpdate=!0,p.enqueueUpdate(this,e)},_processContext:function(e){var t=null,n=this._instance.constructor.contextTypes;if(!n)return f;t={};for(var r in n)t[r]=e[r];return t},_processChildContext:function(e){var t=this._instance,n=t.getChildContext&&t.getChildContext();if(n){h("object"==typeof t.constructor.childContextTypes);for(var r in n)h(r in t.constructor.childContextTypes);return d({},e,n)}return e},_processProps:function(e){return e},_checkPropTypes:function(e,t,r){var o=this.getName();for(var i in e)if(e.hasOwnProperty(i)){var a;try{h("function"==typeof e[i]),a=e[i](t,i,o,r)}catch(s){a=s}a instanceof Error&&n(this)}},receiveComponent:function(e,t,n){(e!==this._currentElement||null==e._owner)&&(this._pendingElement=e,this._pendingContext=n,this.performUpdateIfNecessary(t))},performUpdateIfNecessary:function(e){var t=this._compositeLifeCycleState;if(t!==g.MOUNTING&&t!==g.RECEIVING_PROPS&&(null!=this._pendingElement||null!=this._pendingState||null!=this._pendingContext||this._pendingForceUpdate)){var n=this._currentElement,r=n;null!=this._pendingElement&&(r=this._pendingElement,this._pendingElement=null);var o=this._context,i=o;null!=this._pendingContext&&(i=this._pendingContext,this._pendingContext=null),this.updateComponent(e,n,r,o,i)}},_warnIfContextsDiffer:function(e,t){var n=Object.keys(e).sort(),r=Object.keys(t).sort();if(this.getName()||"ReactCompositeComponent",n.length!==r.length||n.toString()!==r.toString());else for(var o=0;o<r.length;o++)r[o]},updateComponent:function(e,t,n,r,i){o.Mixin.updateComponent.call(this,e,t,n,r,i);var a=this._instance,s=a.context,u=a.props,l=s,c=u;t!==n&&(l=this._processContext(n._context),c=this._processProps(n.props),this._compositeLifeCycleState=g.RECEIVING_PROPS,a.componentWillReceiveProps&&a.componentWillReceiveProps(c,l)),this._compositeLifeCycleState=null;var p=this._pendingState||a.state;this._pendingState=null;var d=this._pendingForceUpdate||!a.shouldComponentUpdate||a.shouldComponentUpdate(c,p,l);return d?(this._pendingForceUpdate=!1,void this._performComponentUpdate(n,c,p,l,e,i)):(this._currentElement=n,this._context=i,a.props=c,a.state=p,void(a.context=l))},_performComponentUpdate:function(e,t,n,r,o,i){var a=this._instance,s=a.props,u=a.state,l=a.context;a.componentWillUpdate&&a.componentWillUpdate(t,n,r),this._currentElement=e,this._context=i,a.props=t,a.state=n,a.context=r,this._updateRenderedComponent(o,i),a.componentDidUpdate&&o.getReactMountReady().enqueue(a.componentDidUpdate.bind(a,s,u,l),a)},_updateRenderedComponent:function(e,t){var n=this._renderedComponent,r=n._currentElement,o=this._renderValidatedComponent();if(v(r,o))n.receiveComponent(o,e,this._processChildContext(t));else{var a=this._rootNodeID,s=n._rootNodeID;n.unmountComponent(),this._renderedComponent=this._instantiateReactComponent(o,this._currentElement.type);var u=this._renderedComponent.mountComponent(a,e,t);i.replaceNodeWithMarkupByID(s,u)}},_renderValidatedComponentWithoutOwnerOrContext:function(){var e=this._instance,t=e.render();return t},_renderValidatedComponent:function(){var e,t=a.current;a.current=this._processChildContext(this._currentElement._context),s.current=this,this._instance;try{e=this._renderValidatedComponentWithoutOwnerOrContext()}finally{a.current=t,s.current=null}return h(null===e||e===!1||u.isValidElement(e)),e},attachRef:function(e,t){var n=this.getPublicInstance(),r=n.refs===f?n.refs={}:n.refs;r[e]=t.getPublicInstance()},detachRef:function(e){var t=this.getPublicInstance().refs;delete t[e]},getName:function(){var e=this._currentElement.type,t=this._instance.constructor;return e.displayName||t&&t.displayName||e.name||t&&t.name||null},getPublicInstance:function(){return this._instance},_instantiateReactComponent:null}),E=d({},C,{mountComponent:function(e,t,n){o.Mixin.mountComponent.call(this,e,t,n);var r=this._instance;l.set(r,this),this._compositeLifeCycleState=g.MOUNTING,r.props=this._processProps(this._currentElement.props);var i=r.getInitialState?r.getInitialState():null;return h("object"==typeof i&&!Array.isArray(i)),r.state=i,this._pendingState=null,this._pendingForceUpdate=!1,r.componentWillMount&&(r.componentWillMount(),this._pendingState&&(r.state=this._pendingState,this._pendingState=null)),this._renderedComponent=this._renderValidatedComponentWithoutOwnerOrContext(),this._compositeLifeCycleState=null,r.componentDidMount&&t.getReactMountReady().enqueue(r.componentDidMount,r),this._renderedComponent},_updateRenderedComponent:function(){var e=this._renderedComponent,t=e._currentElement,n=this._renderValidatedComponentWithoutOwnerOrContext();v(t,n),this._renderedComponent=n}});c.measureMethods(C,"ReactCompositeComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent",_renderValidatedComponent:"_renderValidatedComponent"});var _={LifeCycle:g,Mixin:C,ShallowMixin:E};t.exports=_},{}],45:[function(e,t){"use strict";var n=e(29),r=e(124),o=e(154),i={current:r,withContext:function(e,t){o("react_with_context",{newContext:e});var r,a=i.current;i.current=n({},a,e);try{r=t()}finally{i.current=a}return r}};t.exports=i},{}],46:[function(e,t){"use strict";var n={current:null};t.exports=n},{}],47:[function(e,t){"use strict";function n(e){return r.createFactory(e)}var r=e(61),o=(e(62),e(152)),i=o({a:"a",abbr:"abbr",address:"address",area:"area",article:"article",aside:"aside",audio:"audio",b:"b",base:"base",bdi:"bdi",bdo:"bdo",big:"big",blockquote:"blockquote",body:"body",br:"br",button:"button",canvas:"canvas",caption:"caption",cite:"cite",code:"code",col:"col",colgroup:"colgroup",data:"data",datalist:"datalist",dd:"dd",del:"del",details:"details",dfn:"dfn",dialog:"dialog",div:"div",dl:"dl",dt:"dt",em:"em",embed:"embed",fieldset:"fieldset",figcaption:"figcaption",figure:"figure",footer:"footer",form:"form",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",head:"head",header:"header",hr:"hr",html:"html",i:"i",iframe:"iframe",img:"img",input:"input",ins:"ins",kbd:"kbd",keygen:"keygen",label:"label",legend:"legend",li:"li",link:"link",main:"main",map:"map",mark:"mark",menu:"menu",menuitem:"menuitem",meta:"meta",meter:"meter",nav:"nav",noscript:"noscript",object:"object",ol:"ol",optgroup:"optgroup",option:"option",output:"output",p:"p",param:"param",picture:"picture",pre:"pre",progress:"progress",q:"q",rp:"rp",rt:"rt",ruby:"ruby",s:"s",samp:"samp",script:"script",section:"section",select:"select",small:"small",source:"source",span:"span",strong:"strong",style:"style",sub:"sub",summary:"summary",sup:"sup",table:"table",tbody:"tbody",td:"td",textarea:"textarea",tfoot:"tfoot",th:"th",thead:"thead",time:"time",title:"title",tr:"tr",track:"track",u:"u",ul:"ul","var":"var",video:"video",wbr:"wbr",circle:"circle",defs:"defs",ellipse:"ellipse",g:"g",line:"line",linearGradient:"linearGradient",mask:"mask",path:"path",pattern:"pattern",polygon:"polygon",polyline:"polyline",radialGradient:"radialGradient",rect:"rect",stop:"stop",svg:"svg",text:"text",tspan:"tspan"},n);t.exports=i},{}],48:[function(e,t){"use strict";var n=e(2),r=e(32),o=e(38),i=e(61),a=e(150),s=i.createFactory("button"),u=a({onClick:!0,onDoubleClick:!0,onMouseDown:!0,onMouseMove:!0,onMouseUp:!0,onClickCapture:!0,onDoubleClickCapture:!0,onMouseDownCapture:!0,onMouseMoveCapture:!0,onMouseUpCapture:!0}),l=o.createClass({displayName:"ReactDOMButton",tagName:"BUTTON",mixins:[n,r],render:function(){var e={};for(var t in this.props)!this.props.hasOwnProperty(t)||this.props.disabled&&u[t]||(e[t]=this.props[t]);return s(e,this.props.children)}});t.exports=l},{}],49:[function(e,t){"use strict";function n(e){e&&(null!=e.dangerouslySetInnerHTML&&(v(null==e.children),v(null!=e.dangerouslySetInnerHTML.__html)),v(null==e.style||"object"==typeof e.style))}function r(e,t,n,r){var o=p.findReactContainerForID(e);if(o){var i=o.nodeType===x?o.ownerDocument:o;C(t,i)}r.getPutListenerQueue().enqueuePutListener(e,t,n)}function o(e){P.call(T,e)||(v(N.test(e)),T[e]=!0)}function i(e){o(e),this._tag=e,this._renderedChildren=null,this._previousStyleCopy=null,this._rootNodeID=null}var a=e(6),s=e(11),u=e(12),l=e(39),c=e(33),p=e(73),d=e(74),f=e(78),h=e(29),m=e(125),v=e(144),g=(e(145),e(151)),y=(e(154),e(162),c.deleteListener),C=c.listenTo,E=c.registrationNameModules,_={string:!0,number:!0},b=g({style:null}),x=1,D=null,M={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},N=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,T={},P={}.hasOwnProperty;i.displayName="ReactDOMComponent",i.Mixin={mountComponent:function(e,t,r){l.Mixin.mountComponent.call(this,e,t,r),this._rootNodeID=e,n(this._currentElement.props);var o=M[this._tag]?"":"</"+this._tag+">";return this._createOpenTagMarkupAndPutListeners(t)+this._createContentMarkup(t,r)+o},_createOpenTagMarkupAndPutListeners:function(e){var t=this._currentElement.props,n="<"+this._tag;for(var o in t)if(t.hasOwnProperty(o)){var i=t[o];if(null!=i)if(E.hasOwnProperty(o))r(this._rootNodeID,o,i,e);else{o===b&&(i&&(i=this._previousStyleCopy=h({},t.style)),i=a.createMarkupForStyles(i));var s=u.createMarkupForProperty(o,i);s&&(n+=" "+s)}}if(e.renderToStaticMarkup)return n+">";var l=u.createMarkupForID(this._rootNodeID);return n+" "+l+">"},_createContentMarkup:function(e,t){var n="";("listing"===this._tag||"pre"===this._tag||"textarea"===this._tag)&&(n="\n");var r=this._currentElement.props,o=r.dangerouslySetInnerHTML;if(null!=o){if(null!=o.__html)return n+o.__html}else{var i=_[typeof r.children]?r.children:null,a=null!=i?null:r.children;if(null!=i)return n+m(i);if(null!=a){var s=this.mountChildren(a,e,t);return n+s.join("")}}return n},receiveComponent:function(e,t,n){if(e!==this._currentElement||null==e._owner){var r=this._currentElement;this._currentElement=e,this.updateComponent(t,r,e,n)}},updateComponent:function(e,t,r,o){n(this._currentElement.props),l.Mixin.updateComponent.call(this,e,t,r,o),this._updateDOMProperties(t.props,e),this._updateDOMChildren(t.props,e,o)},_updateDOMProperties:function(e,t){var n,o,i,a=this._currentElement.props;for(n in e)if(!a.hasOwnProperty(n)&&e.hasOwnProperty(n))if(n===b){var u=this._previousStyleCopy;for(o in u)u.hasOwnProperty(o)&&(i=i||{},i[o]="")}else E.hasOwnProperty(n)?y(this._rootNodeID,n):(s.isStandardName[n]||s.isCustomAttribute(n))&&D.deletePropertyByID(this._rootNodeID,n);for(n in a){var l=a[n],c=n===b?this._previousStyleCopy:e[n];if(a.hasOwnProperty(n)&&l!==c)if(n===b)if(l&&(l=this._previousStyleCopy=h({},l)),c){for(o in c)!c.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(i=i||{},i[o]="");for(o in l)l.hasOwnProperty(o)&&c[o]!==l[o]&&(i=i||{},i[o]=l[o])}else i=l;else E.hasOwnProperty(n)?r(this._rootNodeID,n,l,t):(s.isStandardName[n]||s.isCustomAttribute(n))&&D.updatePropertyByID(this._rootNodeID,n,l)}i&&D.updateStylesByID(this._rootNodeID,i)},_updateDOMChildren:function(e,t,n){var r=this._currentElement.props,o=_[typeof e.children]?e.children:null,i=_[typeof r.children]?r.children:null,a=e.dangerouslySetInnerHTML&&e.dangerouslySetInnerHTML.__html,s=r.dangerouslySetInnerHTML&&r.dangerouslySetInnerHTML.__html,u=null!=o?null:e.children,l=null!=i?null:r.children,c=null!=o||null!=a,p=null!=i||null!=s;null!=u&&null==l?this.updateChildren(null,t,n):c&&!p&&this.updateTextContent(""),null!=i?o!==i&&this.updateTextContent(""+i):null!=s?a!==s&&D.updateInnerHTMLByID(this._rootNodeID,s):null!=l&&this.updateChildren(l,t,n)},unmountComponent:function(){this.unmountChildren(),c.deleteAllListeners(this._rootNodeID),l.Mixin.unmountComponent.call(this),p.purgeID(this._rootNodeID),this._rootNodeID=null}},f.measureMethods(i,"ReactDOMComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent"}),h(i.prototype,l.Mixin,i.Mixin,d.Mixin),i.injection={injectIDOperations:function(e){i.BackendIDOperations=D=e}},t.exports=i},{}],50:[function(e,t){"use strict";var n=e(16),r=e(27),o=e(32),i=e(38),a=e(61),s=a.createFactory("form"),u=i.createClass({displayName:"ReactDOMForm",tagName:"FORM",mixins:[o,r],render:function(){return s(this.props)},componentDidMount:function(){this.trapBubbledEvent(n.topLevelTypes.topReset,"reset"),this.trapBubbledEvent(n.topLevelTypes.topSubmit,"submit")}});t.exports=u},{}],51:[function(e,t){"use strict";var n=e(6),r=e(10),o=e(12),i=e(73),a=e(78),s=e(144),u=e(156),l={dangerouslySetInnerHTML:"`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.",style:"`style` must be set using `updateStylesByID()`."},c={updatePropertyByID:function(e,t,n){var r=i.getNode(e);s(!l.hasOwnProperty(t)),null!=n?o.setValueForProperty(r,t,n):o.deleteValueForProperty(r,t)},deletePropertyByID:function(e,t,n){var r=i.getNode(e);s(!l.hasOwnProperty(t)),o.deleteValueForProperty(r,t,n)},updateStylesByID:function(e,t){var r=i.getNode(e);n.setValueForStyles(r,t)},updateInnerHTMLByID:function(e,t){var n=i.getNode(e);u(n,t)},updateTextContentByID:function(e,t){var n=i.getNode(e);r.updateTextContent(n,t)},dangerouslyReplaceNodeWithMarkupByID:function(e,t){var n=i.getNode(e);r.dangerouslyReplaceNodeWithMarkup(n,t)},dangerouslyProcessChildrenUpdates:function(e,t){for(var n=0;n<e.length;n++)e[n].parentNode=i.getNode(e[n].parentID);r.processUpdates(e,t)}};a.measureMethods(c,"ReactDOMIDOperations",{updatePropertyByID:"updatePropertyByID",deletePropertyByID:"deletePropertyByID",updateStylesByID:"updateStylesByID",updateInnerHTMLByID:"updateInnerHTMLByID",updateTextContentByID:"updateTextContentByID",dangerouslyReplaceNodeWithMarkupByID:"dangerouslyReplaceNodeWithMarkupByID",dangerouslyProcessChildrenUpdates:"dangerouslyProcessChildrenUpdates"}),t.exports=c},{}],52:[function(e,t){"use strict";var n=e(16),r=e(27),o=e(32),i=e(38),a=e(61),s=a.createFactory("img"),u=i.createClass({displayName:"ReactDOMImg",tagName:"IMG",mixins:[o,r],render:function(){return s(this.props)},componentDidMount:function(){this.trapBubbledEvent(n.topLevelTypes.topLoad,"load"),this.trapBubbledEvent(n.topLevelTypes.topError,"error")}});t.exports=u},{}],53:[function(e,t){"use strict";function n(){this.isMounted()&&this.forceUpdate()}var r=e(2),o=e(12),i=e(26),a=e(32),s=e(38),u=e(61),l=e(73),c=e(93),p=e(29),d=e(144),f=u.createFactory("input"),h={},m=s.createClass({displayName:"ReactDOMInput",tagName:"INPUT",mixins:[r,i.Mixin,a],getInitialState:function(){var e=this.props.defaultValue;return{initialChecked:this.props.defaultChecked||!1,initialValue:null!=e?e:null}},render:function(){var e=p({},this.props);e.defaultChecked=null,e.defaultValue=null;var t=i.getValue(this);e.value=null!=t?t:this.state.initialValue;var n=i.getChecked(this);return e.checked=null!=n?n:this.state.initialChecked,e.onChange=this._handleChange,f(e,this.props.children)},componentDidMount:function(){var e=l.getID(this.getDOMNode());h[e]=this},componentWillUnmount:function(){var e=this.getDOMNode(),t=l.getID(e);delete h[t]},componentDidUpdate:function(){var e=this.getDOMNode();null!=this.props.checked&&o.setValueForProperty(e,"checked",this.props.checked||!1);var t=i.getValue(this);null!=t&&o.setValueForProperty(e,"value",""+t)},_handleChange:function(e){var t,r=i.getOnChange(this);r&&(t=r.call(this,e)),c.asap(n,this);var o=this.props.name;if("radio"===this.props.type&&null!=o){for(var a=this.getDOMNode(),s=a;s.parentNode;)s=s.parentNode;for(var u=s.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),p=0,f=u.length;f>p;p++){var m=u[p];if(m!==a&&m.form===a.form){var v=l.getID(m);d(v);var g=h[v];d(g),c.asap(n,g)}}}return t}});t.exports=m},{}],54:[function(e,t){"use strict";var n=e(32),r=e(38),o=e(61),i=(e(162),o.createFactory("option")),a=r.createClass({displayName:"ReactDOMOption",tagName:"OPTION",mixins:[n],componentWillMount:function(){},render:function(){return i(this.props,this.props.children)}});t.exports=a},{}],55:[function(e,t){"use strict";function n(){if(this._pendingUpdate){this._pendingUpdate=!1;var e=a.getValue(this);null!=e&&this.isMounted()&&o(this,e)}}function r(e,t){if(null==e[t])return null;if(e.multiple){if(!Array.isArray(e[t]))return new Error("The `"+t+"` prop supplied to <select> must be an array if `multiple` is true.")}else if(Array.isArray(e[t]))return new Error("The `"+t+"` prop supplied to <select> must be a scalar value if `multiple` is false.")}function o(e,t){var n,r,o,i=e.getDOMNode().options;if(e.props.multiple){for(n={},r=0,o=t.length;o>r;r++)n[""+t[r]]=!0;for(r=0,o=i.length;o>r;r++){var a=n.hasOwnProperty(i[r].value);i[r].selected!==a&&(i[r].selected=a)}}else{for(n=""+t,r=0,o=i.length;o>r;r++)if(i[r].value===n)return void(i[r].selected=!0);i[0].selected=!0}}var i=e(2),a=e(26),s=e(32),u=e(38),l=e(61),c=e(93),p=e(29),d=l.createFactory("select"),f=u.createClass({displayName:"ReactDOMSelect",tagName:"SELECT",mixins:[i,a.Mixin,s],propTypes:{defaultValue:r,value:r},render:function(){var e=p({},this.props);return e.onChange=this._handleChange,e.value=null,d(e,this.props.children)},componentWillMount:function(){this._pendingUpdate=!1},componentDidMount:function(){var e=a.getValue(this);null!=e?o(this,e):null!=this.props.defaultValue&&o(this,this.props.defaultValue)},componentDidUpdate:function(e){var t=a.getValue(this);null!=t?(this._pendingUpdate=!1,o(this,t)):!e.multiple!=!this.props.multiple&&(null!=this.props.defaultValue?o(this,this.props.defaultValue):o(this,this.props.multiple?[]:""))},_handleChange:function(e){var t,r=a.getOnChange(this);return r&&(t=r.call(this,e)),this._pendingUpdate=!0,c.asap(n,this),t}});t.exports=f},{}],56:[function(e,t){"use strict";function n(e,t,n,r){return e===n&&t===r}function r(e){var t=document.selection,n=t.createRange(),r=n.text.length,o=n.duplicate();o.moveToElementText(e),o.setEndPoint("EndToStart",n);var i=o.text.length,a=i+r;return{start:i,end:a}}function o(e){var t=window.getSelection&&window.getSelection();if(!t||0===t.rangeCount)return null;var r=t.anchorNode,o=t.anchorOffset,i=t.focusNode,a=t.focusOffset,s=t.getRangeAt(0),u=n(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),l=u?0:s.toString().length,c=s.cloneRange();c.selectNodeContents(e),c.setEnd(s.startContainer,s.startOffset);var p=n(c.startContainer,c.startOffset,c.endContainer,c.endOffset),d=p?0:c.toString().length,f=d+l,h=document.createRange();h.setStart(r,o),h.setEnd(i,a);var m=h.collapsed;return{start:m?f:d,end:m?d:f}}function i(e,t){var n,r,o=document.selection.createRange().duplicate();"undefined"==typeof t.end?(n=t.start,r=n):t.start>t.end?(n=t.end,r=t.start):(n=t.start,r=t.end),o.moveToElementText(e),o.moveStart("character",n),o.setEndPoint("EndToStart",o),o.moveEnd("character",r-n),o.select()}function a(e,t){if(window.getSelection){var n=window.getSelection(),r=e[l()].length,o=Math.min(t.start,r),i="undefined"==typeof t.end?o:Math.min(t.end,r);if(!n.extend&&o>i){var a=i;i=o,o=a}var s=u(e,o),c=u(e,i);if(s&&c){var p=document.createRange();p.setStart(s.node,s.offset),n.removeAllRanges(),o>i?(n.addRange(p),n.extend(c.node,c.offset)):(p.setEnd(c.node,c.offset),n.addRange(p))}}}var s=e(22),u=e(137),l=e(139),c=s.canUseDOM&&"selection"in document&&!("getSelection"in window),p={getOffsets:c?r:o,setOffsets:c?i:a};t.exports=p},{}],57:[function(e,t){"use strict";var n=e(12),r=e(41),o=e(49),i=e(29),a=e(125),s=e(144),u=function(){};i(u.prototype,{construct:function(e){this._currentElement=e,this._stringText=""+e,this._rootNodeID=null,this._mountIndex=0},mountComponent:function(e,t){this._rootNodeID=e;var r=a(this._stringText);return t.renderToStaticMarkup?r:"<span "+n.createMarkupForID(e)+">"+r+"</span>"},receiveComponent:function(e){if(e!==this._currentElement){this._currentElement=e;var t=""+e;t!==this._stringText&&(this._stringText=t,o.BackendIDOperations.updateTextContentByID(this._rootNodeID,t))}},updateComponent:function(){s(!1)},unmountComponent:function(){r.unmountIDFromEnvironment(this._rootNodeID)}}),t.exports=u},{}],58:[function(e,t){"use strict";function n(){this.isMounted()&&this.forceUpdate()}var r=e(2),o=e(12),i=e(26),a=e(32),s=e(38),u=e(61),l=e(93),c=e(29),p=e(144),d=(e(162),u.createFactory("textarea")),f=s.createClass({displayName:"ReactDOMTextarea",tagName:"TEXTAREA",mixins:[r,i.Mixin,a],getInitialState:function(){var e=this.props.defaultValue,t=this.props.children;
null!=t&&(p(null==e),Array.isArray(t)&&(p(t.length<=1),t=t[0]),e=""+t),null==e&&(e="");var n=i.getValue(this);return{initialValue:""+(null!=n?n:e)}},render:function(){var e=c({},this.props);return p(null==e.dangerouslySetInnerHTML),e.defaultValue=null,e.value=null,e.onChange=this._handleChange,d(e,this.state.initialValue)},componentDidUpdate:function(){var e=i.getValue(this);if(null!=e){var t=this.getDOMNode();o.setValueForProperty(t,"value",""+e)}},_handleChange:function(e){var t,r=i.getOnChange(this);return r&&(t=r.call(this,e)),l.asap(n,this),t}});t.exports=f},{}],59:[function(e,t){"use strict";function n(){this.reinitializeTransaction()}var r=e(93),o=e(109),i=e(29),a=e(123),s={initialize:a,close:function(){p.isBatchingUpdates=!1}},u={initialize:a,close:r.flushBatchedUpdates.bind(r)},l=[u,s];i(n.prototype,o.Mixin,{getTransactionWrappers:function(){return l}});var c=new n,p={isBatchingUpdates:!1,batchedUpdates:function(e,t,n){var r=p.isBatchingUpdates;p.isBatchingUpdates=!0,r?e(t,n):c.perform(e,null,t,n)}};t.exports=p},{}],60:[function(e,t){"use strict";function n(){M.EventEmitter.injectReactEventListener(D),M.EventPluginHub.injectEventPluginOrder(a),M.EventPluginHub.injectInstanceHandle(N),M.EventPluginHub.injectMount(T),M.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:O,EnterLeaveEventPlugin:s,ChangeEventPlugin:o,MobileSafariClickEventPlugin:c,SelectEventPlugin:w,BeforeInputEventPlugin:r}),M.NativeComponent.injectGenericComponentClass(h),M.NativeComponent.injectTextComponentClass(x),M.Class.injectMixin(p),M.NativeComponent.injectComponentClasses({button:m,form:v,img:g,input:C,option:E,select:_,textarea:b,html:S("html"),head:S("head"),body:S("body")}),M.DOMProperty.injectDOMPropertyConfig(l),M.DOMProperty.injectDOMPropertyConfig(R),M.EmptyComponent.injectEmptyComponent("noscript"),M.Updates.injectReconcileTransaction(P),M.Updates.injectBatchingStrategy(f),M.RootIndex.injectCreateReactRootIndex(u.canUseDOM?i.createReactRootIndex:I.createReactRootIndex),M.Component.injectEnvironment(d),M.DOMComponent.injectIDOperations(y)}var r=e(3),o=e(8),i=e(9),a=e(14),s=e(15),u=e(22),l=e(24),c=e(28),p=e(32),d=e(41),f=e(59),h=e(49),m=e(48),v=e(50),g=e(52),y=e(51),C=e(53),E=e(54),_=e(55),b=e(58),x=e(57),D=e(66),M=e(67),N=e(69),T=e(73),P=e(84),w=e(95),I=e(96),O=e(97),R=e(94),S=e(119);t.exports={inject:n}},{}],61:[function(e,t){"use strict";var n=e(45),r=e(46),o=(e(29),e(162),{key:!0,ref:!0}),i=function(e,t,n,r,o,i){this.type=e,this.key=t,this.ref=n,this._owner=r,this._context=o,this.props=i};i.prototype={_isReactElement:!0},i.createElement=function(e,t,a){var s,u={},l=null,c=null;if(null!=t){c=void 0===t.ref?null:t.ref,l=void 0===t.key?null:""+t.key;for(s in t)t.hasOwnProperty(s)&&!o.hasOwnProperty(s)&&(u[s]=t[s])}var p=arguments.length-2;if(1===p)u.children=a;else if(p>1){for(var d=Array(p),f=0;p>f;f++)d[f]=arguments[f+2];u.children=d}if(e&&e.defaultProps){var h=e.defaultProps;for(s in h)"undefined"==typeof u[s]&&(u[s]=h[s])}return new i(e,l,c,r.current,n.current,u)},i.createFactory=function(e){var t=i.createElement.bind(null,e);return t.type=e,t},i.cloneAndReplaceProps=function(e,t){var n=new i(e.type,e.key,e.ref,e._owner,e._context,t);return n},i.isValidElement=function(e){var t=!(!e||!e._isReactElement);return t},t.exports=i},{}],62:[function(e,t){"use strict";function n(e){var t=e&&e.getPublicInstance();if(!t)return void 0;var n=t.constructor;return n?n.displayName||n.name||void 0:void 0}function r(){var e=h.current;return e&&n(e)||void 0}function o(e,t){e._store.validated||null!=e.key||(e._store.validated=!0,a("react_key_warning",'Each child in an array or iterator should have a unique "key" prop.',e,t))}function i(e,t,n){_.test(e)&&a("react_numeric_key_warning","Child objects should have non-numeric keys so ordering is preserved.",t,n)}function a(e,t,o,i){var a=r(),s=i.displayName||i.name,u=a||s,l=y[e];if(!l.hasOwnProperty(u)){l[u]=!0,t+=a?" Check the render method of "+a+".":" Check the React.render call using <"+s+">.";var c=null;o&&o._owner&&o._owner!==h.current&&(c=n(o._owner),t+=" It was passed a child from "+c+"."),t+=" See http://fb.me/react-warning-keys for more information.",v(e,{component:u,componentOwner:c}),console.warn(t)}}function s(){var e=r()||"";C.hasOwnProperty(e)||(C[e]=!0,v("react_object_map_children"))}function u(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++){var r=e[n];d.isValidElement(r)&&o(r,t)}else if(d.isValidElement(e))e._store.validated=!0;else if(e){var a=m(e);if(a&&a!==e.entries)for(var u,l=a.call(e);!(u=l.next()).done;)d.isValidElement(u.value)&&o(u.value,t);else if("object"==typeof e){s();for(var c in e)e.hasOwnProperty(c)&&i(c,e[c],t)}}}function l(e,t,n,r){for(var o in t)if(t.hasOwnProperty(o)){var i;try{g("function"==typeof t[o]),i=t[o](n,o,e,r)}catch(a){i=a}i instanceof Error&&!(i.message in E)&&(E[i.message]=!0,v("react_failed_descriptor_type_check",{message:i.message}))}}function c(e,t){var n=t.type,r="string"==typeof n?n:n.displayName,o=t._owner?t._owner.getPublicInstance().constructor.displayName:null,i=e+"|"+r+"|"+o;if(!b.hasOwnProperty(i)){b[i]=!0;var a="";r&&(a=" <"+r+" />");var s="";o&&(s=" The element was created by "+o+".")}}function p(e){if(e._store){var t=e._store.originalProps,n=e.props;for(var r in n)n.hasOwnProperty(r)&&(t.hasOwnProperty(r)&&t[r]===n[r]||(c(r,e),t[r]=n[r]))}}var d=e(61),f=e(81),h=(e(80),e(46)),m=e(135),v=e(154),g=e(144),y=(e(162),{react_key_warning:{},react_numeric_key_warning:{}}),C={},E={},_=/^\d+$/,b={},x={checkAndWarnForMutatedProps:p,createElement:function(e){var t=d.createElement.apply(this,arguments);if(null==t)return t;for(var n=2;n<arguments.length;n++)u(arguments[n],e);if(e){var r=e.displayName||e.name;e.propTypes&&l(r,e.propTypes,t.props,f.prop),e.contextTypes&&l(r,e.contextTypes,t._context,f.context),"function"==typeof e.getDefaultProps}return t},createFactory:function(e){var t=x.createElement.bind(null,e);return t.type=e,t}};t.exports=x},{}],63:[function(e,t){"use strict";function n(e){l[e]=!0}function r(e){delete l[e]}function o(e){return!!l[e]}var i,a=e(61),s=e(70),u=e(144),l={},c={injectEmptyComponent:function(e){i=a.createFactory(e)}},p=function(){};p.prototype.componentDidMount=function(){var e=s.get(this);e&&n(e._rootNodeID)},p.prototype.componentWillUnmount=function(){var e=s.get(this);e&&r(e._rootNodeID)},p.prototype.render=function(){return u(i),i()};var d=a.createElement(p),f={emptyElement:d,injection:c,isNullComponentID:o};t.exports=f},{}],64:[function(e,t){"use strict";var n={guard:function(e){return e}};t.exports=n},{}],65:[function(e,t){"use strict";function n(e){r.enqueueEvents(e),r.processEventQueue()}var r=e(18),o={handleTopLevel:function(e,t,o,i){var a=r.extractEvents(e,t,o,i);n(a)}};t.exports=o},{}],66:[function(e,t){"use strict";function n(e){var t=c.getID(e),n=l.getReactRootIDFromNodeID(t),r=c.findReactContainerForID(n),o=c.getFirstReactDOM(r);return o}function r(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function o(e){for(var t=c.getFirstReactDOM(f(e.nativeEvent))||window,r=t;r;)e.ancestors.push(r),r=n(r);for(var o=0,i=e.ancestors.length;i>o;o++){t=e.ancestors[o];var a=c.getID(t)||"";m._handleTopLevel(e.topLevelType,t,a,e.nativeEvent)}}function i(e){var t=h(window);e(t)}var a=e(17),s=e(22),u=e(30),l=e(69),c=e(73),p=e(93),d=e(29),f=e(134),h=e(140);d(r.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),u.addPoolingTo(r,u.twoArgumentPooler);var m={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:s.canUseDOM?window:null,setHandleTopLevel:function(e){m._handleTopLevel=e},setEnabled:function(e){m._enabled=!!e},isEnabled:function(){return m._enabled},trapBubbledEvent:function(e,t,n){var r=n;return r?a.listen(r,t,m.dispatchEvent.bind(null,e)):null},trapCapturedEvent:function(e,t,n){var r=n;return r?a.capture(r,t,m.dispatchEvent.bind(null,e)):null},monitorScrollValue:function(e){var t=i.bind(null,e);a.listen(window,"scroll",t),a.listen(window,"resize",t)},dispatchEvent:function(e,t){if(m._enabled){var n=r.getPooled(e,t);try{p.batchedUpdates(o,n)}finally{r.release(n)}}}};t.exports=m},{}],67:[function(e,t){"use strict";var n=e(11),r=e(18),o=e(42),i=e(38),a=e(63),s=e(33),u=e(76),l=e(49),c=e(78),p=e(86),d=e(93),f={Component:o.injection,Class:i.injection,DOMComponent:l.injection,DOMProperty:n.injection,EmptyComponent:a.injection,EventPluginHub:r.injection,EventEmitter:s.injection,NativeComponent:u.injection,Perf:c.injection,RootIndex:p.injection,Updates:d.injection};t.exports=f},{}],68:[function(e,t){"use strict";function n(e){return o(document.documentElement,e)}var r=e(56),o=e(117),i=e(128),a=e(130),s={hasSelectionCapabilities:function(e){return e&&("INPUT"===e.nodeName&&"text"===e.type||"TEXTAREA"===e.nodeName||"true"===e.contentEditable)},getSelectionInformation:function(){var e=a();return{focusedElem:e,selectionRange:s.hasSelectionCapabilities(e)?s.getSelection(e):null}},restoreSelection:function(e){var t=a(),r=e.focusedElem,o=e.selectionRange;t!==r&&n(r)&&(s.hasSelectionCapabilities(r)&&s.setSelection(r,o),i(r))},getSelection:function(e){var t;if("selectionStart"in e)t={start:e.selectionStart,end:e.selectionEnd};else if(document.selection&&"INPUT"===e.nodeName){var n=document.selection.createRange();n.parentElement()===e&&(t={start:-n.moveStart("character",-e.value.length),end:-n.moveEnd("character",-e.value.length)})}else t=r.getOffsets(e);return t||{start:0,end:0}},setSelection:function(e,t){var n=t.start,o=t.end;if("undefined"==typeof o&&(o=n),"selectionStart"in e)e.selectionStart=n,e.selectionEnd=Math.min(o,e.value.length);else if(document.selection&&"INPUT"===e.nodeName){var i=e.createTextRange();i.collapse(!0),i.moveStart("character",n),i.moveEnd("character",o-n),i.select()}else r.setOffsets(e,t)}};t.exports=s},{}],69:[function(e,t){"use strict";function n(e){return d+e.toString(36)}function r(e,t){return e.charAt(t)===d||t===e.length}function o(e){return""===e||e.charAt(0)===d&&e.charAt(e.length-1)!==d}function i(e,t){return 0===t.indexOf(e)&&r(t,e.length)}function a(e){return e?e.substr(0,e.lastIndexOf(d)):""}function s(e,t){if(p(o(e)&&o(t)),p(i(e,t)),e===t)return e;var n,a=e.length+f;for(n=a;n<t.length&&!r(t,n);n++);return t.substr(0,n)}function u(e,t){var n=Math.min(e.length,t.length);if(0===n)return"";for(var i=0,a=0;n>=a;a++)if(r(e,a)&&r(t,a))i=a;else if(e.charAt(a)!==t.charAt(a))break;var s=e.substr(0,i);return p(o(s)),s}function l(e,t,n,r,o,u){e=e||"",t=t||"",p(e!==t);var l=i(t,e);p(l||i(e,t));for(var c=0,d=l?a:s,f=e;;f=d(f,t)){var m;if(o&&f===e||u&&f===t||(m=n(f,l,r)),m===!1||f===t)break;p(c++<h)}}var c=e(86),p=e(144),d=".",f=d.length,h=100,m={createReactRootID:function(){return n(c.createReactRootIndex())},createReactID:function(e,t){return e+t},getReactRootIDFromNodeID:function(e){if(e&&e.charAt(0)===d&&e.length>1){var t=e.indexOf(d,1);return t>-1?e.substr(0,t):e}return null},traverseEnterLeave:function(e,t,n,r,o){var i=u(e,t);i!==e&&l(e,i,n,r,!1,!0),i!==t&&l(i,t,n,o,!0,!1)},traverseTwoPhase:function(e,t,n){e&&(l("",e,t,n,!0,!1),l(e,"",t,n,!1,!0))},traverseAncestors:function(e,t,n){l("",e,t,n,!0,!1)},_getFirstCommonAncestorID:u,_getNextDescendantID:s,isAncestorIDOf:i,SEPARATOR:d};t.exports=m},{}],70:[function(e,t){"use strict";var n={remove:function(e){e._reactInternalInstance=void 0},get:function(e){return e._reactInternalInstance},has:function(e){return void 0!==e._reactInternalInstance},set:function(e,t){e._reactInternalInstance=t}};t.exports=n},{}],71:[function(e,t){"use strict";function n(e,t){this.value=e,this.requestChange=t}function r(e){var t={value:"undefined"==typeof e?o.PropTypes.any.isRequired:e.isRequired,requestChange:o.PropTypes.func.isRequired};return o.PropTypes.shape(t)}var o=e(31);n.PropTypes={link:r},t.exports=n},{}],72:[function(e,t){"use strict";var n=e(113),r={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=n(e);return e.replace(">"," "+r.CHECKSUM_ATTR_NAME+'="'+t+'">')},canReuseMarkup:function(e,t){var o=t.getAttribute(r.CHECKSUM_ATTR_NAME);o=o&&parseInt(o,10);var i=n(e);return i===o}};t.exports=r},{}],73:[function(e,t){"use strict";function n(e,t){for(var n=Math.min(e.length,t.length),r=0;n>r;r++)if(e.charAt(r)!==t.charAt(r))return r;return e.length===t.length?-1:n}function r(e){var t=M(e);return t&&B.getID(t)}function o(e){var t=i(e);if(t)if(R.hasOwnProperty(t)){var n=R[t];n!==e&&(T(!l(n,t)),R[t]=e)}else R[t]=e;return t}function i(e){return e&&e.getAttribute&&e.getAttribute(O)||""}function a(e,t){var n=i(e);n!==t&&delete R[n],e.setAttribute(O,t),R[t]=e}function s(e){return R.hasOwnProperty(e)&&l(R[e],e)||(R[e]=B.findReactNodeByID(e)),R[e]}function u(e){var t=C.get(e)._rootNodeID;return g.isNullComponentID(t)?null:(R.hasOwnProperty(t)&&l(R[t],t)||(R[t]=B.findReactNodeByID(t)),R[t])}function l(e,t){if(e){T(i(e)===t);var n=B.findReactContainerForID(t);if(n&&D(n,e))return!0}return!1}function c(e){delete R[e]}function p(e){var t=R[e];return t&&l(t,e)?void(F=t):!1}function d(e){F=null,y.traverseAncestors(e,p);var t=F;return F=null,t}function f(e,t,n,r){var o=this.mountComponent(e,n,x);this._isTopLevel=!0,B._mountImageIntoNode(o,t,r)}var h=e(11),m=e(33),v=(e(46),e(61)),g=(e(62),e(63)),y=e(69),C=e(70),E=e(72),_=e(78),b=e(93),x=e(124),D=e(117),M=e(138),N=e(143),T=e(144),P=e(156),w=e(158),I=(e(162),y.SEPARATOR),O=h.ID_ATTRIBUTE_NAME,R={},S=1,A=9,k={},L={},U=[],F=null,B={_instancesByReactRootID:k,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,n,r){var o=t.props;return B.scrollMonitor(n,function(){e.replaceProps(o,r)}),e},_registerComponent:function(e,t){T(t&&(t.nodeType===S||t.nodeType===A)),m.ensureScrollValueMonitoring();var n=B.registerContainer(t);return k[n]=e,n},_renderNewRootComponent:function(e,t,n){var r=N(e,null),o=B._registerComponent(r,t),i=b.ReactReconcileTransaction.getPooled();return i.perform(f,r,o,t,i,n),b.ReactReconcileTransaction.release(i),r},render:function(e,t,n){T(v.isValidElement(e));var o=k[r(t)];if(o){var i=o._currentElement;if(w(i,e))return B._updateRootComponent(o,e,t,n).getPublicInstance();B.unmountComponentAtNode(t)}var a=M(t),s=a&&B.isRenderedByReact(a),u=s&&!o,l=B._renderNewRootComponent(e,t,u).getPublicInstance();return n&&n.call(l),l},constructAndRenderComponent:function(e,t,n){var r=v.createElement(e,t);return B.render(r,n)},constructAndRenderComponentByID:function(e,t,n){var r=document.getElementById(n);return T(r),B.constructAndRenderComponent(e,t,r)},registerContainer:function(e){var t=r(e);return t&&(t=y.getReactRootIDFromNodeID(t)),t||(t=y.createReactRootID()),L[t]=e,t},unmountComponentAtNode:function(e){T(e&&(e.nodeType===S||e.nodeType===A));var t=r(e),n=k[t];return n?(B.unmountComponentFromNode(n,e),delete k[t],delete L[t],!0):!1},unmountComponentFromNode:function(e,t){for(e.unmountComponent(),t.nodeType===A&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)},findReactContainerForID:function(e){var t=y.getReactRootIDFromNodeID(e),n=L[t];return n},findReactNodeByID:function(e){var t=B.findReactContainerForID(e);return B.findComponentRoot(t,e)},isRenderedByReact:function(e){if(1!==e.nodeType)return!1;var t=B.getID(e);return t?t.charAt(0)===I:!1},getFirstReactDOM:function(e){for(var t=e;t&&t.parentNode!==t;){if(B.isRenderedByReact(t))return t;t=t.parentNode}return null},findComponentRoot:function(e,t){var n=U,r=0,o=d(t)||e;for(n[0]=o.firstChild,n.length=1;r<n.length;){for(var i,a=n[r++];a;){var s=B.getID(a);s?t===s?i=a:y.isAncestorIDOf(s,t)&&(n.length=r=0,n.push(a.firstChild)):n.push(a.firstChild),a=a.nextSibling}if(i)return n.length=0,i}n.length=0,T(!1)},_mountImageIntoNode:function(e,t,r){if(T(t&&(t.nodeType===S||t.nodeType===A)),r){var o=M(t);if(E.canReuseMarkup(e,o))return;var i=o.getAttribute(E.CHECKSUM_ATTR_NAME);o.removeAttribute(E.CHECKSUM_ATTR_NAME);var a=o.outerHTML;o.setAttribute(E.CHECKSUM_ATTR_NAME,i);var s=n(e,a);" (client) "+e.substring(s-20,s+20)+"\n (server) "+a.substring(s-20,s+20),T(t.nodeType!==A)}T(t.nodeType!==A),P(t,e)},getReactRootID:r,getID:o,setID:a,getNode:s,getNodeFromInstance:u,purgeID:c};_.measureMethods(B,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),t.exports=B},{}],74:[function(e,t){"use strict";function n(e,t,n){d.push({parentID:e,parentNode:null,type:l.INSERT_MARKUP,markupIndex:f.push(t)-1,textContent:null,fromIndex:null,toIndex:n})}function r(e,t,n){d.push({parentID:e,parentNode:null,type:l.MOVE_EXISTING,markupIndex:null,textContent:null,fromIndex:t,toIndex:n})}function o(e,t){d.push({parentID:e,parentNode:null,type:l.REMOVE_NODE,markupIndex:null,textContent:null,fromIndex:t,toIndex:null})}function i(e,t){d.push({parentID:e,parentNode:null,type:l.TEXT_CONTENT,markupIndex:null,textContent:t,fromIndex:null,toIndex:null})}function a(){d.length&&(u.processChildrenUpdates(d,f),s())}function s(){d.length=0,f.length=0}var u=e(42),l=e(75),c=e(36),p=0,d=[],f=[],h={Mixin:{mountChildren:function(e,t,n){var r=c.instantiateChildren(e,t,n);this._renderedChildren=r;var o=[],i=0;for(var a in r){var s=r[a];if(r.hasOwnProperty(a)){var u=this._rootNodeID+a,l=s.mountComponent(u,t,n);s._mountIndex=i,o.push(l),i++}}return o},updateTextContent:function(e){p++;var t=!0;try{var n=this._renderedChildren;c.unmountChildren(n);for(var r in n)n.hasOwnProperty(r)&&this._unmountChildByName(n[r],r);this.setTextContent(e),t=!1}finally{p--,p||(t?s():a())}},updateChildren:function(e,t,n){p++;var r=!0;try{this._updateChildren(e,t,n),r=!1}finally{p--,p||(r?s():a())}},_updateChildren:function(e,t,n){var r=this._renderedChildren,o=c.updateChildren(r,e,t,n);if(this._renderedChildren=o,o||r){var i,a=0,s=0;for(i in o)if(o.hasOwnProperty(i)){var u=r&&r[i],l=o[i];u===l?(this.moveChild(u,s,a),a=Math.max(u._mountIndex,a),u._mountIndex=s):(u&&(a=Math.max(u._mountIndex,a),this._unmountChildByName(u,i)),this._mountChildByNameAtIndex(l,i,s,t,n)),s++}for(i in r)!r.hasOwnProperty(i)||o&&o.hasOwnProperty(i)||this._unmountChildByName(r[i],i)}},unmountChildren:function(){var e=this._renderedChildren;c.unmountChildren(e),this._renderedChildren=null},moveChild:function(e,t,n){e._mountIndex<n&&r(this._rootNodeID,e._mountIndex,t)},createChild:function(e,t){n(this._rootNodeID,t,e._mountIndex)},removeChild:function(e){o(this._rootNodeID,e._mountIndex)},setTextContent:function(e){i(this._rootNodeID,e)},_mountChildByNameAtIndex:function(e,t,n,r,o){var i=this._rootNodeID+t,a=e.mountComponent(i,r,o);e._mountIndex=n,this.createChild(e,a)},_unmountChildByName:function(e){this.removeChild(e),e._mountIndex=null}}};t.exports=h},{}],75:[function(e,t){"use strict";var n=e(150),r=n({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,TEXT_CONTENT:null});t.exports=r},{}],76:[function(e,t){"use strict";function n(e){return a.createClass({tagName:e.toUpperCase(),render:function(){return new s(e,null,null,null,null,this.props)}})}function r(e,t,r){var o=p[e];return null==o&&(p[e]=o=n(e)),r===e?(l(c),new c(e,t)):new o(t)}function o(e){return new d(e)}function i(e){return e instanceof d}var a=e(38),s=e(61),u=e(29),l=e(144),c=null,p={},d=null,f={injectGenericComponentClass:function(e){c=e},injectTextComponentClass:function(e){d=e},injectComponentClasses:function(e){u(p,e)}},h={createInstanceForTag:r,createInstanceForText:o,isTextComponent:i,injection:f};t.exports=h},{}],77:[function(e,t){"use strict";var n=e(144),r={isValidOwner:function(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)},addComponentAsRefTo:function(e,t,o){n(r.isValidOwner(o)),o.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,o){n(r.isValidOwner(o)),o.getPublicInstance().refs[t]===e.getPublicInstance()&&o.detachRef(t)}};t.exports=r},{}],78:[function(e,t){"use strict";function n(e,t,n){return n}var r={enableMeasure:!1,storedMeasure:n,measureMethods:function(){},measure:function(e,t,n){return n},injection:{injectMeasure:function(e){r.storedMeasure=e}}};t.exports=r},{}],79:[function(e,t){"use strict";function n(e){return function(t,n,r){t[n]=t.hasOwnProperty(n)?e(t[n],r):r}}function r(e,t){for(var n in t)if(t.hasOwnProperty(n)){var r=u[n];r&&u.hasOwnProperty(n)?r(e,n,t[n]):e.hasOwnProperty(n)||(e[n]=t[n])}return e}var o=e(29),i=e(123),a=e(149),s=n(function(e,t){return o({},t,e)}),u={children:i,className:n(a),style:s},l={mergeProps:function(e,t){return r(o({},e),t)}};t.exports=l},{}],80:[function(e,t){"use strict";var n={};t.exports=n},{}],81:[function(e,t){"use strict";var n=e(150),r=n({prop:null,context:null,childContext:null});t.exports=r},{}],82:[function(e,t){"use strict";function n(e){function t(t,n,r,o,i){if(o=o||C,null==n[r]){var a=g[i];return t?new Error("Required "+a+" `"+r+"` was not specified in "+("`"+o+"`.")):null}return e(n,r,o,i)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function r(e){function t(t,n,r,o){var i=t[n],a=h(i);if(a!==e){var s=g[o],u=m(i);return new Error("Invalid "+s+" `"+n+"` of type `"+u+"` "+("supplied to `"+r+"`, expected `"+e+"`."))}return null}return n(t)}function o(){return n(y.thatReturns(null))}function i(e){function t(t,n,r,o){var i=t[n];if(!Array.isArray(i)){var a=g[o],s=h(i);return new Error("Invalid "+a+" `"+n+"` of type "+("`"+s+"` supplied to `"+r+"`, expected an array."))}for(var u=0;u<i.length;u++){var l=e(i,u,r,o);if(l instanceof Error)return l}return null}return n(t)}function a(){function e(e,t,n,r){if(!v.isValidElement(e[t])){var o=g[r];return new Error("Invalid "+o+" `"+t+"` supplied to "+("`"+n+"`, expected a ReactElement."))}return null}return n(e)}function s(e){function t(t,n,r,o){if(!(t[n]instanceof e)){var i=g[o],a=e.name||C;return new Error("Invalid "+i+" `"+n+"` supplied to "+("`"+r+"`, expected instance of `"+a+"`."))}return null}return n(t)}function u(e){function t(t,n,r,o){for(var i=t[n],a=0;a<e.length;a++)if(i===e[a])return null;var s=g[o],u=JSON.stringify(e);return new Error("Invalid "+s+" `"+n+"` of value `"+i+"` "+("supplied to `"+r+"`, expected one of "+u+"."))}return n(t)}function l(e){function t(t,n,r,o){var i=t[n],a=h(i);if("object"!==a){var s=g[o];return new Error("Invalid "+s+" `"+n+"` of type "+("`"+a+"` supplied to `"+r+"`, expected an object."))}for(var u in i)if(i.hasOwnProperty(u)){var l=e(i,u,r,o);if(l instanceof Error)return l}return null}return n(t)}function c(e){function t(t,n,r,o){for(var i=0;i<e.length;i++){var a=e[i];if(null==a(t,n,r,o))return null}var s=g[o];return new Error("Invalid "+s+" `"+n+"` supplied to "+("`"+r+"`."))}return n(t)}function p(){function e(e,t,n,r){if(!f(e[t])){var o=g[r];return new Error("Invalid "+o+" `"+t+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return null}return n(e)}function d(e){function t(t,n,r,o){var i=t[n],a=h(i);if("object"!==a){var s=g[o];return new Error("Invalid "+s+" `"+n+"` of type `"+a+"` "+("supplied to `"+r+"`, expected `object`."))}for(var u in e){var l=e[u];if(l){var c=l(i,u,r,o);if(c)return c}}return null}return n(t,"expected `object`")}function f(e){switch(typeof e){case"number":case"string":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(f);if(v.isValidElement(e))return!0;for(var t in e)if(!f(e[t]))return!1;return!0;default:return!1}}function h(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":t}function m(e){var t=h(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}var v=e(61),g=e(80),y=e(123),C="<<anonymous>>",E=a(),_=p(),b={array:r("array"),bool:r("boolean"),func:r("function"),number:r("number"),object:r("object"),string:r("string"),any:o(),arrayOf:i,element:E,instanceOf:s,node:_,objectOf:l,oneOf:u,oneOfType:c,shape:d};t.exports=b},{}],83:[function(e,t){"use strict";function n(){this.listenersToPut=[]}var r=e(30),o=e(33),i=e(29);i(n.prototype,{enqueuePutListener:function(e,t,n){this.listenersToPut.push({rootNodeID:e,propKey:t,propValue:n})},putListeners:function(){for(var e=0;e<this.listenersToPut.length;e++){var t=this.listenersToPut[e];o.putListener(t.rootNodeID,t.propKey,t.propValue)}},reset:function(){this.listenersToPut.length=0},destructor:function(){this.reset()}}),r.addPoolingTo(n),t.exports=n},{}],84:[function(e,t){"use strict";function n(){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=r.getPooled(null),this.putListenerQueue=s.getPooled()}var r=e(7),o=e(30),i=e(33),a=e(68),s=e(83),u=e(109),l=e(29),c={initialize:a.getSelectionInformation,close:a.restoreSelection},p={initialize:function(){var e=i.isEnabled();return i.setEnabled(!1),e},close:function(e){i.setEnabled(e)}},d={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},f={initialize:function(){this.putListenerQueue.reset()},close:function(){this.putListenerQueue.putListeners()}},h=[f,c,p,d],m={getTransactionWrappers:function(){return h},getReactMountReady:function(){return this.reactMountReady},getPutListenerQueue:function(){return this.putListenerQueue},destructor:function(){r.release(this.reactMountReady),this.reactMountReady=null,s.release(this.putListenerQueue),this.putListenerQueue=null}};l(n.prototype,u.Mixin,m),o.addPoolingTo(n),t.exports=n},{}],85:[function(e,t){"use strict";function n(){this._value=null,this._successCallbacks=null,this._failureCallbacks=null}function r(){var e=this._successCallbacks,t=this._failureCallbacks;this._successCallbacks=null,this._failureCallbacks=null,this._value?l(e,o,this):l(t,i)}function o(e){e(this._value)}function i(e){e()}var a=e(93),s=e(111),u=e(29),l=e(129),c=e(144);u(n.prototype,{then:function(e,t){c("function"==typeof e),null==this._successCallbacks&&a.asap(r,this),this._successCallbacks=s(this._successCallbacks,e),t&&(this._failureCallbacks=s(this._failureCallbacks,t))}}),n.attachRef=function(e,t){e._value=t.getPublicInstance()},n.detachRef=function(e,t){e._value===t&&(e._value=null)},t.exports=n},{}],86:[function(e,t){"use strict";var n={injectCreateReactRootIndex:function(e){r.createReactRootIndex=e}},r={createReactRootIndex:null,injection:n};t.exports=r},{}],87:[function(e,t){"use strict";function n(e){c(o.isValidElement(e));var t;try{var n=i.createReactRootID();return t=s.getPooled(!1),t.perform(function(){var r=l(e,null),o=r.mountComponent(n,t,u);return a.addChecksumToMarkup(o)},null)}finally{s.release(t)}}function r(e){c(o.isValidElement(e));var t;try{var n=i.createReactRootID();return t=s.getPooled(!0),t.perform(function(){var r=l(e,null);return r.mountComponent(n,t,u)},null)}finally{s.release(t)}}var o=e(61),i=e(69),a=e(72),s=e(88),u=e(124),l=e(143),c=e(144);t.exports={renderToString:n,renderToStaticMarkup:r}},{}],88:[function(e,t){"use strict";function n(e){this.reinitializeTransaction(),this.renderToStaticMarkup=e,this.reactMountReady=o.getPooled(null),this.putListenerQueue=i.getPooled()}var r=e(30),o=e(7),i=e(83),a=e(109),s=e(29),u=e(123),l={initialize:function(){this.reactMountReady.reset()},close:u},c={initialize:function(){this.putListenerQueue.reset()},close:u},p=[c,l],d={getTransactionWrappers:function(){return p},getReactMountReady:function(){return this.reactMountReady},getPutListenerQueue:function(){return this.putListenerQueue},destructor:function(){o.release(this.reactMountReady),this.reactMountReady=null,i.release(this.putListenerQueue),this.putListenerQueue=null}};s(n.prototype,a.Mixin,d),r.addPoolingTo(n),t.exports=n},{}],89:[function(e,t){"use strict";function n(e,t){var n={};return function(r){n[t]=r,e.setState(n)}}var r={createStateSetter:function(e,t){return function(n,r,o,i,a,s){var u=t.call(e,n,r,o,i,a,s);u&&e.setState(u)}},createStateKeySetter:function(e,t){var r=e.__keySetters||(e.__keySetters={});return r[t]||(r[t]=n(e,t))}};r.Mixin={createStateSetter:function(e){return r.createStateSetter(this,e)},createStateKeySetter:function(e){return r.createStateKeySetter(this,e)}},t.exports=r},{}],90:[function(e,t){"use strict";var n=e(37),r={getChildMapping:function(e){return n.map(e,function(e){return e})},mergeChildMappings:function(e,t){function n(n){return t.hasOwnProperty(n)?t[n]:e[n]}e=e||{},t=t||{};var r={},o=[];for(var i in e)t.hasOwnProperty(i)?o.length&&(r[i]=o,o=[]):o.push(i);var a,s={};for(var u in t){if(r.hasOwnProperty(u))for(a=0;a<r[u].length;a++){var l=r[u][a];s[r[u][a]]=n(l)}s[u]=n(u)}for(a=0;a<o.length;a++)s[o[a]]=n(o[a]);return s}};t.exports=r},{}],91:[function(e,t){"use strict";function n(){var e=document.createElement("div"),t=e.style;"AnimationEvent"in window||delete a.animationend.animation,"TransitionEvent"in window||delete a.transitionend.transition;for(var n in a){var r=a[n];for(var o in r)if(o in t){s.push(r[o]);break}}}function r(e,t,n){e.addEventListener(t,n,!1)}function o(e,t,n){e.removeEventListener(t,n,!1)}var i=e(22),a={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},s=[];i.canUseDOM&&n();var u={addEndEventListener:function(e,t){return 0===s.length?void window.setTimeout(t,0):void s.forEach(function(n){r(e,n,t)})},removeEndEventListener:function(e,t){0!==s.length&&s.forEach(function(n){o(e,n,t)})}};t.exports=u},{}],92:[function(e,t){"use strict";var n=e(31),r=e(90),o=e(29),i=e(116),a=e(123),s=n.createClass({displayName:"ReactTransitionGroup",propTypes:{component:n.PropTypes.any,childFactory:n.PropTypes.func},getDefaultProps:function(){return{component:"span",childFactory:a.thatReturnsArgument}},getInitialState:function(){return{children:r.getChildMapping(this.props.children)}},componentWillMount:function(){this.currentlyTransitioningKeys={},this.keysToEnter=[],this.keysToLeave=[]},componentDidMount:function(){var e=this.state.children;for(var t in e)e[t]&&this.performAppear(t)},componentWillReceiveProps:function(e){var t=r.getChildMapping(e.children),n=this.state.children;this.setState({children:r.mergeChildMappings(n,t)});var o;for(o in t){var i=n&&n.hasOwnProperty(o);!t[o]||i||this.currentlyTransitioningKeys[o]||this.keysToEnter.push(o)}for(o in n){var a=t&&t.hasOwnProperty(o);!n[o]||a||this.currentlyTransitioningKeys[o]||this.keysToLeave.push(o)}},componentDidUpdate:function(){var e=this.keysToEnter;this.keysToEnter=[],e.forEach(this.performEnter);var t=this.keysToLeave;this.keysToLeave=[],t.forEach(this.performLeave)},performAppear:function(e){this.currentlyTransitioningKeys[e]=!0;var t=this.refs[e];t.componentWillAppear?t.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)},_handleDoneAppearing:function(e){var t=this.refs[e];t.componentDidAppear&&t.componentDidAppear(),delete this.currentlyTransitioningKeys[e];var n=r.getChildMapping(this.props.children);n&&n.hasOwnProperty(e)||this.performLeave(e)},performEnter:function(e){this.currentlyTransitioningKeys[e]=!0;var t=this.refs[e];t.componentWillEnter?t.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)},_handleDoneEntering:function(e){var t=this.refs[e];t.componentDidEnter&&t.componentDidEnter(),delete this.currentlyTransitioningKeys[e];var n=r.getChildMapping(this.props.children);n&&n.hasOwnProperty(e)||this.performLeave(e)},performLeave:function(e){this.currentlyTransitioningKeys[e]=!0;var t=this.refs[e];t.componentWillLeave?t.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)},_handleDoneLeaving:function(e){var t=this.refs[e];t.componentDidLeave&&t.componentDidLeave(),delete this.currentlyTransitioningKeys[e];var n=r.getChildMapping(this.props.children);if(n&&n.hasOwnProperty(e))this.performEnter(e);else{var i=o({},this.state.children);delete i[e],this.setState({children:i})}},render:function(){var e={};for(var t in this.state.children){var r=this.state.children[t];r&&(e[t]=i(this.props.childFactory(r),{ref:t}))}return n.createElement(this.props.component,this.props,e)}});t.exports=s},{}],93:[function(e,t){"use strict";function n(){h(D.ReactReconcileTransaction&&y)}function r(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=l.getPooled(),this.reconcileTransaction=D.ReactReconcileTransaction.getPooled()
}function o(e,t,r){n(),y.batchedUpdates(e,t,r)}function i(e,t){return e._mountOrder-t._mountOrder}function a(e){var t=e.dirtyComponentsLength;h(t===m.length),m.sort(i);for(var n=0;t>n;n++){var r=m[n],o=r._pendingCallbacks;if(r._pendingCallbacks=null,r.performUpdateIfNecessary(e.reconcileTransaction),o)for(var a=0;a<o.length;a++)e.callbackQueue.enqueue(o[a],r.getPublicInstance())}}function s(e,t){return h(!t||"function"==typeof t),n(),y.isBatchingUpdates?(m.push(e),void(t&&(e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t]))):void y.batchedUpdates(s,e,t)}function u(e,t){h(y.isBatchingUpdates),v.enqueue(e,t),g=!0}var l=e(7),c=e(30),p=(e(46),e(78)),d=e(109),f=e(29),h=e(144),m=(e(162),[]),v=l.getPooled(),g=!1,y=null,C={initialize:function(){this.dirtyComponentsLength=m.length},close:function(){this.dirtyComponentsLength!==m.length?(m.splice(0,this.dirtyComponentsLength),b()):m.length=0}},E={initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}},_=[C,E];f(r.prototype,d.Mixin,{getTransactionWrappers:function(){return _},destructor:function(){this.dirtyComponentsLength=null,l.release(this.callbackQueue),this.callbackQueue=null,D.ReactReconcileTransaction.release(this.reconcileTransaction),this.reconcileTransaction=null},perform:function(e,t,n){return d.Mixin.perform.call(this,this.reconcileTransaction.perform,this.reconcileTransaction,e,t,n)}}),c.addPoolingTo(r);var b=function(){for(;m.length||g;){if(m.length){var e=r.getPooled();e.perform(a,null,e),r.release(e)}if(g){g=!1;var t=v;v=l.getPooled(),t.notifyAll(),l.release(t)}}};b=p.measure("ReactUpdates","flushBatchedUpdates",b);var x={injectReconcileTransaction:function(e){h(e),D.ReactReconcileTransaction=e},injectBatchingStrategy:function(e){h(e),h("function"==typeof e.batchedUpdates),h("boolean"==typeof e.isBatchingUpdates),y=e}},D={ReactReconcileTransaction:null,batchedUpdates:o,enqueueUpdate:s,flushBatchedUpdates:b,injection:x,asap:u};t.exports=D},{}],94:[function(e,t){"use strict";var n=e(11),r=n.injection.MUST_USE_ATTRIBUTE,o={Properties:{cx:r,cy:r,d:r,dx:r,dy:r,fill:r,fillOpacity:r,fontFamily:r,fontSize:r,fx:r,fy:r,gradientTransform:r,gradientUnits:r,markerEnd:r,markerMid:r,markerStart:r,offset:r,opacity:r,patternContentUnits:r,patternUnits:r,points:r,preserveAspectRatio:r,r:r,rx:r,ry:r,spreadMethod:r,stopColor:r,stopOpacity:r,stroke:r,strokeDasharray:r,strokeLinecap:r,strokeOpacity:r,strokeWidth:r,textAnchor:r,transform:r,version:r,viewBox:r,x1:r,x2:r,x:r,y1:r,y2:r,y:r},DOMAttributeNames:{fillOpacity:"fill-opacity",fontFamily:"font-family",fontSize:"font-size",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",patternContentUnits:"patternContentUnits",patternUnits:"patternUnits",preserveAspectRatio:"preserveAspectRatio",spreadMethod:"spreadMethod",stopColor:"stop-color",stopOpacity:"stop-opacity",strokeDasharray:"stroke-dasharray",strokeLinecap:"stroke-linecap",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",viewBox:"viewBox"}};t.exports=o},{}],95:[function(e,t){"use strict";function n(e){if("selectionStart"in e&&a.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function r(e){if(g||null==h||h!==u())return null;var t=n(h);if(!v||!p(v,t)){v=t;var r=s.getPooled(f.select,m,e);return r.type="select",r.target=h,i.accumulateTwoPhaseDispatches(r),r}}var o=e(16),i=e(21),a=e(68),s=e(101),u=e(130),l=e(147),c=e(151),p=e(157),d=o.topLevelTypes,f={select:{phasedRegistrationNames:{bubbled:c({onSelect:null}),captured:c({onSelectCapture:null})},dependencies:[d.topBlur,d.topContextMenu,d.topFocus,d.topKeyDown,d.topMouseDown,d.topMouseUp,d.topSelectionChange]}},h=null,m=null,v=null,g=!1,y={eventTypes:f,extractEvents:function(e,t,n,o){switch(e){case d.topFocus:(l(t)||"true"===t.contentEditable)&&(h=t,m=n,v=null);break;case d.topBlur:h=null,m=null,v=null;break;case d.topMouseDown:g=!0;break;case d.topContextMenu:case d.topMouseUp:return g=!1,r(o);case d.topSelectionChange:case d.topKeyDown:case d.topKeyUp:return r(o)}}};t.exports=y},{}],96:[function(e,t){"use strict";var n=Math.pow(2,53),r={createReactRootIndex:function(){return Math.ceil(Math.random()*n)}};t.exports=r},{}],97:[function(e,t){"use strict";var n=e(16),r=e(20),o=e(21),i=e(98),a=e(101),s=e(102),u=e(104),l=e(105),c=e(100),p=e(106),d=e(107),f=e(108),h=e(131),m=e(144),v=e(151),g=(e(162),n.topLevelTypes),y={blur:{phasedRegistrationNames:{bubbled:v({onBlur:!0}),captured:v({onBlurCapture:!0})}},click:{phasedRegistrationNames:{bubbled:v({onClick:!0}),captured:v({onClickCapture:!0})}},contextMenu:{phasedRegistrationNames:{bubbled:v({onContextMenu:!0}),captured:v({onContextMenuCapture:!0})}},copy:{phasedRegistrationNames:{bubbled:v({onCopy:!0}),captured:v({onCopyCapture:!0})}},cut:{phasedRegistrationNames:{bubbled:v({onCut:!0}),captured:v({onCutCapture:!0})}},doubleClick:{phasedRegistrationNames:{bubbled:v({onDoubleClick:!0}),captured:v({onDoubleClickCapture:!0})}},drag:{phasedRegistrationNames:{bubbled:v({onDrag:!0}),captured:v({onDragCapture:!0})}},dragEnd:{phasedRegistrationNames:{bubbled:v({onDragEnd:!0}),captured:v({onDragEndCapture:!0})}},dragEnter:{phasedRegistrationNames:{bubbled:v({onDragEnter:!0}),captured:v({onDragEnterCapture:!0})}},dragExit:{phasedRegistrationNames:{bubbled:v({onDragExit:!0}),captured:v({onDragExitCapture:!0})}},dragLeave:{phasedRegistrationNames:{bubbled:v({onDragLeave:!0}),captured:v({onDragLeaveCapture:!0})}},dragOver:{phasedRegistrationNames:{bubbled:v({onDragOver:!0}),captured:v({onDragOverCapture:!0})}},dragStart:{phasedRegistrationNames:{bubbled:v({onDragStart:!0}),captured:v({onDragStartCapture:!0})}},drop:{phasedRegistrationNames:{bubbled:v({onDrop:!0}),captured:v({onDropCapture:!0})}},focus:{phasedRegistrationNames:{bubbled:v({onFocus:!0}),captured:v({onFocusCapture:!0})}},input:{phasedRegistrationNames:{bubbled:v({onInput:!0}),captured:v({onInputCapture:!0})}},keyDown:{phasedRegistrationNames:{bubbled:v({onKeyDown:!0}),captured:v({onKeyDownCapture:!0})}},keyPress:{phasedRegistrationNames:{bubbled:v({onKeyPress:!0}),captured:v({onKeyPressCapture:!0})}},keyUp:{phasedRegistrationNames:{bubbled:v({onKeyUp:!0}),captured:v({onKeyUpCapture:!0})}},load:{phasedRegistrationNames:{bubbled:v({onLoad:!0}),captured:v({onLoadCapture:!0})}},error:{phasedRegistrationNames:{bubbled:v({onError:!0}),captured:v({onErrorCapture:!0})}},mouseDown:{phasedRegistrationNames:{bubbled:v({onMouseDown:!0}),captured:v({onMouseDownCapture:!0})}},mouseMove:{phasedRegistrationNames:{bubbled:v({onMouseMove:!0}),captured:v({onMouseMoveCapture:!0})}},mouseOut:{phasedRegistrationNames:{bubbled:v({onMouseOut:!0}),captured:v({onMouseOutCapture:!0})}},mouseOver:{phasedRegistrationNames:{bubbled:v({onMouseOver:!0}),captured:v({onMouseOverCapture:!0})}},mouseUp:{phasedRegistrationNames:{bubbled:v({onMouseUp:!0}),captured:v({onMouseUpCapture:!0})}},paste:{phasedRegistrationNames:{bubbled:v({onPaste:!0}),captured:v({onPasteCapture:!0})}},reset:{phasedRegistrationNames:{bubbled:v({onReset:!0}),captured:v({onResetCapture:!0})}},scroll:{phasedRegistrationNames:{bubbled:v({onScroll:!0}),captured:v({onScrollCapture:!0})}},submit:{phasedRegistrationNames:{bubbled:v({onSubmit:!0}),captured:v({onSubmitCapture:!0})}},touchCancel:{phasedRegistrationNames:{bubbled:v({onTouchCancel:!0}),captured:v({onTouchCancelCapture:!0})}},touchEnd:{phasedRegistrationNames:{bubbled:v({onTouchEnd:!0}),captured:v({onTouchEndCapture:!0})}},touchMove:{phasedRegistrationNames:{bubbled:v({onTouchMove:!0}),captured:v({onTouchMoveCapture:!0})}},touchStart:{phasedRegistrationNames:{bubbled:v({onTouchStart:!0}),captured:v({onTouchStartCapture:!0})}},wheel:{phasedRegistrationNames:{bubbled:v({onWheel:!0}),captured:v({onWheelCapture:!0})}}},C={topBlur:y.blur,topClick:y.click,topContextMenu:y.contextMenu,topCopy:y.copy,topCut:y.cut,topDoubleClick:y.doubleClick,topDrag:y.drag,topDragEnd:y.dragEnd,topDragEnter:y.dragEnter,topDragExit:y.dragExit,topDragLeave:y.dragLeave,topDragOver:y.dragOver,topDragStart:y.dragStart,topDrop:y.drop,topError:y.error,topFocus:y.focus,topInput:y.input,topKeyDown:y.keyDown,topKeyPress:y.keyPress,topKeyUp:y.keyUp,topLoad:y.load,topMouseDown:y.mouseDown,topMouseMove:y.mouseMove,topMouseOut:y.mouseOut,topMouseOver:y.mouseOver,topMouseUp:y.mouseUp,topPaste:y.paste,topReset:y.reset,topScroll:y.scroll,topSubmit:y.submit,topTouchCancel:y.touchCancel,topTouchEnd:y.touchEnd,topTouchMove:y.touchMove,topTouchStart:y.touchStart,topWheel:y.wheel};for(var E in C)C[E].dependencies=[E];var _={eventTypes:y,executeDispatch:function(e,t,n){var o=r.executeDispatch(e,t,n);o===!1&&(e.stopPropagation(),e.preventDefault())},extractEvents:function(e,t,n,r){var v=C[e];if(!v)return null;var y;switch(e){case g.topInput:case g.topLoad:case g.topError:case g.topReset:case g.topSubmit:y=a;break;case g.topKeyPress:if(0===h(r))return null;case g.topKeyDown:case g.topKeyUp:y=u;break;case g.topBlur:case g.topFocus:y=s;break;case g.topClick:if(2===r.button)return null;case g.topContextMenu:case g.topDoubleClick:case g.topMouseDown:case g.topMouseMove:case g.topMouseOut:case g.topMouseOver:case g.topMouseUp:y=l;break;case g.topDrag:case g.topDragEnd:case g.topDragEnter:case g.topDragExit:case g.topDragLeave:case g.topDragOver:case g.topDragStart:case g.topDrop:y=c;break;case g.topTouchCancel:case g.topTouchEnd:case g.topTouchMove:case g.topTouchStart:y=p;break;case g.topScroll:y=d;break;case g.topWheel:y=f;break;case g.topCopy:case g.topCut:case g.topPaste:y=i}m(y);var E=y.getPooled(v,n,r);return o.accumulateTwoPhaseDispatches(E),E}};t.exports=_},{}],98:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e(101),o={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};r.augmentClass(n,o),t.exports=n},{}],99:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e(101),o={data:null};r.augmentClass(n,o),t.exports=n},{}],100:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e(105),o={dataTransfer:null};r.augmentClass(n,o),t.exports=n},{}],101:[function(e,t){"use strict";function n(e,t,n){this.dispatchConfig=e,this.dispatchMarker=t,this.nativeEvent=n;var r=this.constructor.Interface;for(var o in r)if(r.hasOwnProperty(o)){var a=r[o];this[o]=a?a(n):n[o]}var s=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;this.isDefaultPrevented=s?i.thatReturnsTrue:i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse}var r=e(30),o=e(29),i=e(123),a=e(134),s={type:null,target:a,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};o(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e.preventDefault?e.preventDefault():e.returnValue=!1,this.isDefaultPrevented=i.thatReturnsTrue},stopPropagation:function(){var e=this.nativeEvent;e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this.isPropagationStopped=i.thatReturnsTrue},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;this.dispatchConfig=null,this.dispatchMarker=null,this.nativeEvent=null}}),n.Interface=s,n.augmentClass=function(e,t){var n=this,i=Object.create(n.prototype);o(i,e.prototype),e.prototype=i,e.prototype.constructor=e,e.Interface=o({},n.Interface,t),e.augmentClass=n.augmentClass,r.addPoolingTo(e,r.threeArgumentPooler)},r.addPoolingTo(n,r.threeArgumentPooler),t.exports=n},{}],102:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e(107),o={relatedTarget:null};r.augmentClass(n,o),t.exports=n},{}],103:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e(101),o={data:null};r.augmentClass(n,o),t.exports=n},{}],104:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e(107),o=e(131),i=e(132),a=e(133),s={key:i,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:a,charCode:function(e){return"keypress"===e.type?o(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?o(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};r.augmentClass(n,s),t.exports=n},{}],105:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e(107),o=e(110),i=e(133),a={screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:i,button:function(e){var t=e.button;return"which"in e?t:2===t?2:4===t?1:0},buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},pageX:function(e){return"pageX"in e?e.pageX:e.clientX+o.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+o.currentScrollTop}};r.augmentClass(n,a),t.exports=n},{}],106:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e(107),o=e(133),i={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:o};r.augmentClass(n,i),t.exports=n},{}],107:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e(101),o=e(134),i={view:function(e){if(e.view)return e.view;var t=o(e);if(null!=t&&t.window===t)return t;var n=t.ownerDocument;return n?n.defaultView||n.parentWindow:window},detail:function(e){return e.detail||0}};r.augmentClass(n,i),t.exports=n},{}],108:[function(e,t){"use strict";function n(e,t,n){r.call(this,e,t,n)}var r=e(105),o={deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null};r.augmentClass(n,o),t.exports=n},{}],109:[function(e,t){"use strict";var n=e(144),r={reinitializeTransaction:function(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function(){return!!this._isInTransaction},perform:function(e,t,r,o,i,a,s,u){n(!this.isInTransaction());var l,c;try{this._isInTransaction=!0,l=!0,this.initializeAll(0),c=e.call(t,r,o,i,a,s,u),l=!1}finally{try{if(l)try{this.closeAll(0)}catch(p){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return c},initializeAll:function(e){for(var t=this.transactionWrappers,n=e;n<t.length;n++){var r=t[n];try{this.wrapperInitData[n]=o.OBSERVED_ERROR,this.wrapperInitData[n]=r.initialize?r.initialize.call(this):null}finally{if(this.wrapperInitData[n]===o.OBSERVED_ERROR)try{this.initializeAll(n+1)}catch(i){}}}},closeAll:function(e){n(this.isInTransaction());for(var t=this.transactionWrappers,r=e;r<t.length;r++){var i,a=t[r],s=this.wrapperInitData[r];try{i=!0,s!==o.OBSERVED_ERROR&&a.close&&a.close.call(this,s),i=!1}finally{if(i)try{this.closeAll(r+1)}catch(u){}}}this.wrapperInitData.length=0}},o={Mixin:r,OBSERVED_ERROR:{}};t.exports=o},{}],110:[function(e,t){"use strict";var n={currentScrollLeft:0,currentScrollTop:0,refreshScrollValues:function(e){n.currentScrollLeft=e.x,n.currentScrollTop=e.y}};t.exports=n},{}],111:[function(e,t){"use strict";function n(e,t){if(r(null!=t),null==e)return t;var n=Array.isArray(e),o=Array.isArray(t);return n?e.concat(t):o?[e].concat(t):[e,t]}var r=e(144);t.exports=n},{}],112:[function(e,t){"use strict";function n(e,t){if(r(null!=t),null==e)return t;var n=Array.isArray(e),o=Array.isArray(t);return n&&o?(e.push.apply(e,t),e):n?(e.push(t),e):o?[e].concat(t):[e,t]}var r=e(144);t.exports=n},{}],113:[function(e,t){"use strict";function n(e){for(var t=1,n=0,o=0;o<e.length;o++)t=(t+e.charCodeAt(o))%r,n=(n+t)%r;return t|n<<16}var r=65521;t.exports=n},{}],114:[function(e,t){function n(e){return e.replace(r,function(e,t){return t.toUpperCase()})}var r=/-(.)/g;t.exports=n},{}],115:[function(e,t){"use strict";function n(e){return r(e.replace(o,"ms-"))}var r=e(114),o=/^-ms-/;t.exports=n},{}],116:[function(e,t){"use strict";function n(e,t){var n=o.mergeProps(t,e.props);return!n.hasOwnProperty(a)&&e.props.hasOwnProperty(a)&&(n.children=e.props.children),r.createElement(e.type,n)}var r=e(61),o=e(79),i=e(151),a=(e(162),i({children:null}));t.exports=n},{}],117:[function(e,t){function n(e,t){return e&&t?e===t?!0:r(e)?!1:r(t)?n(e,t.parentNode):e.contains?e.contains(t):e.compareDocumentPosition?!!(16&e.compareDocumentPosition(t)):!1:!1}var r=e(148);t.exports=n},{}],118:[function(e,t){function n(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}function r(e){return n(e)?Array.isArray(e)?e.slice():o(e):[e]}var o=e(159);t.exports=r},{}],119:[function(e,t){"use strict";function n(e){var t=o.createFactory(e),n=r.createClass({displayName:"ReactFullPageComponent"+e,componentWillUnmount:function(){i(!1)},render:function(){return t(this.props)}});return n}var r=e(38),o=e(61),i=e(144);t.exports=n},{}],120:[function(e,t){function n(e){var t=e.match(l);return t&&t[1].toLowerCase()}function r(e,t){var r=u;s(!!u);var o=n(e),l=o&&a(o);if(l){r.innerHTML=l[1]+e+l[2];for(var c=l[0];c--;)r=r.lastChild}else r.innerHTML=e;var p=r.getElementsByTagName("script");p.length&&(s(t),i(p).forEach(t));for(var d=i(r.childNodes);r.lastChild;)r.removeChild(r.lastChild);return d}var o=e(22),i=e(118),a=e(136),s=e(144),u=o.canUseDOM?document.createElement("div"):null,l=/^\s*<(\w+)/;t.exports=r},{}],121:[function(e,t){function n(e){return"object"==typeof e?Object.keys(e).filter(function(t){return e[t]}).join(" "):Array.prototype.join.call(arguments," ")}t.exports=n},{}],122:[function(e,t){"use strict";function n(e,t){var n=null==t||"boolean"==typeof t||""===t;if(n)return"";var r=isNaN(t);return r||0===t||o.hasOwnProperty(e)&&o[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}var r=e(5),o=r.isUnitlessNumber;t.exports=n},{}],123:[function(e,t){function n(e){return function(){return e}}function r(){}r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},t.exports=r},{}],124:[function(e,t){"use strict";var n={};t.exports=n},{}],125:[function(e,t){"use strict";function n(e){return o[e]}function r(e){return(""+e).replace(i,n)}var o={"&":"&",">":">","<":"<",'"':""","'":"'"},i=/[&><"']/g;t.exports=r},{}],126:[function(e,t){"use strict";function n(e){return null==e?null:a(e)?e:r.has(e)?o.getNodeFromInstance(e):(i(null==e.render||"function"!=typeof e.render),void i(!1))}var r=e(70),o=e(73),i=e(144),a=e(146);t.exports=n},{}],127:[function(e,t){"use strict";function n(e,t,n){var r=e,o=!r.hasOwnProperty(n);o&&null!=t&&(r[n]=t)}function r(e){if(null==e)return e;var t={};return o(e,n,t),t}{var o=e(160);e(162)}t.exports=r},{}],128:[function(e,t){"use strict";function n(e){try{e.focus()}catch(t){}}t.exports=n},{}],129:[function(e,t){"use strict";var n=function(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)};t.exports=n},{}],130:[function(e,t){function n(){try{return document.activeElement||document.body}catch(e){return document.body}}t.exports=n},{}],131:[function(e,t){"use strict";function n(e){var t,n=e.keyCode;return"charCode"in e?(t=e.charCode,0===t&&13===n&&(t=13)):t=n,t>=32||13===t?t:0}t.exports=n},{}],132:[function(e,t){"use strict";function n(e){if(e.key){var t=o[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=r(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?i[e.keyCode]||"Unidentified":""}var r=e(131),o={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},i={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};t.exports=n},{}],133:[function(e,t){"use strict";function n(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var r=o[e];return r?!!n[r]:!1}function r(){return n}var o={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};t.exports=r},{}],134:[function(e,t){"use strict";function n(e){var t=e.target||e.srcElement||window;return 3===t.nodeType?t.parentNode:t}t.exports=n},{}],135:[function(e,t){"use strict";function n(e){var t=e&&(r&&e[r]||e[o]);return"function"==typeof t?t:void 0}var r="function"==typeof Symbol&&Symbol.iterator,o="@@iterator";t.exports=n},{}],136:[function(e,t){function n(e){return o(!!i),p.hasOwnProperty(e)||(e="*"),a.hasOwnProperty(e)||(i.innerHTML="*"===e?"<link />":"<"+e+"></"+e+">",a[e]=!i.firstChild),a[e]?p[e]:null}var r=e(22),o=e(144),i=r.canUseDOM?document.createElement("div"):null,a={circle:!0,defs:!0,ellipse:!0,g:!0,line:!0,linearGradient:!0,path:!0,polygon:!0,polyline:!0,radialGradient:!0,rect:!0,stop:!0,text:!0},s=[1,'<select multiple="true">',"</select>"],u=[1,"<table>","</table>"],l=[3,"<table><tbody><tr>","</tr></tbody></table>"],c=[1,"<svg>","</svg>"],p={"*":[1,"?<div>","</div>"],area:[1,"<map>","</map>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],legend:[1,"<fieldset>","</fieldset>"],param:[1,"<object>","</object>"],tr:[2,"<table><tbody>","</tbody></table>"],optgroup:s,option:s,caption:u,colgroup:u,tbody:u,tfoot:u,thead:u,td:l,th:l,circle:c,defs:c,ellipse:c,g:c,line:c,linearGradient:c,path:c,polygon:c,polyline:c,radialGradient:c,rect:c,stop:c,text:c};t.exports=n},{}],137:[function(e,t){"use strict";function n(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function r(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function o(e,t){for(var o=n(e),i=0,a=0;o;){if(3===o.nodeType){if(a=i+o.textContent.length,t>=i&&a>=t)return{node:o,offset:t-i};i=a}o=n(r(o))}}t.exports=o},{}],138:[function(e,t){"use strict";function n(e){return e?e.nodeType===r?e.documentElement:e.firstChild:null}var r=9;t.exports=n},{}],139:[function(e,t){"use strict";function n(){return!o&&r.canUseDOM&&(o="textContent"in document.documentElement?"textContent":"innerText"),o}var r=e(22),o=null;t.exports=n},{}],140:[function(e,t){"use strict";function n(e){return e===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:e.scrollLeft,y:e.scrollTop}}t.exports=n},{}],141:[function(e,t){function n(e){return e.replace(r,"-$1").toLowerCase()}var r=/([A-Z])/g;t.exports=n},{}],142:[function(e,t){"use strict";function n(e){return r(e).replace(o,"-ms-")}var r=e(141),o=/^ms-/;t.exports=n},{}],143:[function(e,t){"use strict";function n(e){return"function"==typeof e&&"function"==typeof e.prototype.mountComponent&&"function"==typeof e.prototype.receiveComponent}function r(e,t){var r;if((null===e||e===!1)&&(e=i.emptyElement),"object"==typeof e){var o=e;if("string"==typeof o.type)r=a.createInstanceForTag(o.type,o.props,t),"function"!=typeof r.mountComponent&&(r=new l(r));else if(n(o.type))r=new o.type(o);else{var s=new o.type(o.props);r=new l(s)}}else"string"==typeof e||"number"==typeof e?r=a.createInstanceForText(e):u(!1);return r.construct(e),r}var o=e(44),i=e(63),a=e(76),s=e(29),u=e(144),l=(e(162),function(e){this._instance=e});s(l.prototype,o.Mixin,{_instantiateReactComponent:r}),t.exports=r},{}],144:[function(e,t){"use strict";var n=function(e,t,n,r,o,i,a,s){if(!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,i,a,s],c=0;u=new Error("Invariant Violation: "+t.replace(/%s/g,function(){return l[c++]}))}throw u.framesToPop=1,u}};t.exports=n},{}],145:[function(e,t){"use strict";function n(e,t){if(!o.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,i=n in document;if(!i){var a=document.createElement("div");a.setAttribute(n,"return;"),i="function"==typeof a[n]}return!i&&r&&"wheel"===e&&(i=document.implementation.hasFeature("Events.wheel","3.0")),i}var r,o=e(22);o.canUseDOM&&(r=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),t.exports=n},{}],146:[function(e,t){function n(e){return!(!e||!("function"==typeof Node?e instanceof Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}t.exports=n},{}],147:[function(e,t){"use strict";function n(e){return e&&("INPUT"===e.nodeName&&r[e.type]||"TEXTAREA"===e.nodeName)}var r={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};t.exports=n},{}],148:[function(e,t){function n(e){return r(e)&&3==e.nodeType}var r=e(146);t.exports=n},{}],149:[function(e,t){"use strict";function n(e){e||(e="");var t,n=arguments.length;if(n>1)for(var r=1;n>r;r++)t=arguments[r],t&&(e=(e?e+" ":"")+t);return e}t.exports=n},{}],150:[function(e,t){"use strict";var n=e(144),r=function(e){var t,r={};n(e instanceof Object&&!Array.isArray(e));for(t in e)e.hasOwnProperty(t)&&(r[t]=t);return r};t.exports=r},{}],151:[function(e,t){var n=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};t.exports=n},{}],152:[function(e,t){"use strict";function n(e,t,n){if(!e)return null;var o={};for(var i in e)r.call(e,i)&&(o[i]=t.call(n,e[i],i,e));return o}var r=Object.prototype.hasOwnProperty;t.exports=n},{}],153:[function(e,t){"use strict";function n(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}t.exports=n},{}],154:[function(e,t){"use strict";function n(e){r(e&&!/[^a-z0-9_]/.test(e))}var r=e(144);t.exports=n},{}],155:[function(e,t){"use strict";function n(e){return o(r.isValidElement(e)),e}var r=e(61),o=e(144);t.exports=n},{}],156:[function(e,t){"use strict";var n=e(22),r=/^[ \r\n\t\f]/,o=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,i=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(i=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),n.canUseDOM){var a=document.createElement("div");a.innerHTML=" ",""===a.innerHTML&&(i=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),r.test(t)||"<"===t[0]&&o.test(t)){e.innerHTML=""+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}t.exports=i},{}],157:[function(e,t){"use strict";function n(e,t){if(e===t)return!0;var n;for(n in e)if(e.hasOwnProperty(n)&&(!t.hasOwnProperty(n)||e[n]!==t[n]))return!1;for(n in t)if(t.hasOwnProperty(n)&&!e.hasOwnProperty(n))return!1;return!0}t.exports=n},{}],158:[function(e,t){"use strict";function n(e,t){if(null!=e&&null!=t){var n=typeof e,r=typeof t;if("string"===n||"number"===n)return"string"===r||"number"===r;if("object"===r&&e.type===t.type&&e.key===t.key){var o=e._owner===t._owner;return o}}return!1}e(154);t.exports=n},{}],159:[function(e,t){function n(e){var t=e.length;if(r(!Array.isArray(e)&&("object"==typeof e||"function"==typeof e)),r("number"==typeof t),r(0===t||t-1 in e),e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(n){}for(var o=Array(t),i=0;t>i;i++)o[i]=e[i];return o}var r=e(144);t.exports=n},{}],160:[function(e,t){"use strict";function n(e){return h[e]}function r(e,t){return e&&null!=e.key?i(e.key):t.toString(36)}function o(e){return(""+e).replace(m,n)}function i(e){return"$"+o(e)}function a(e,t,n,o,s){var l=typeof e;if(("undefined"===l||"boolean"===l)&&(e=null),null===e||"string"===l||"number"===l||u.isValidElement(e))return o(s,e,""===t?d+r(e,0):t,n),1;var h,m,v,g=0;if(Array.isArray(e))for(var y=0;y<e.length;y++)h=e[y],m=(""!==t?t+f:d)+r(h,y),v=n+g,g+=a(h,m,v,o,s);else{var C=c(e);if(C){var E,_=C.call(e);if(C!==e.entries)for(var b=0;!(E=_.next()).done;)h=E.value,m=(""!==t?t+f:d)+r(h,b++),v=n+g,g+=a(h,m,v,o,s);else for(;!(E=_.next()).done;){var x=E.value;x&&(h=x[1],m=(""!==t?t+f:d)+i(x[0])+f+r(h,0),v=n+g,g+=a(h,m,v,o,s))}}else if("object"===l){p(1!==e.nodeType);for(var D in e)e.hasOwnProperty(D)&&(h=e[D],m=(""!==t?t+f:d)+i(D)+f+r(h,0),v=n+g,g+=a(h,m,v,o,s))}}return g}function s(e,t,n){return null==e?0:a(e,"",0,t,n)}var u=e(61),l=e(69),c=e(135),p=e(144),d=l.SEPARATOR,f=":",h={"=":"=0",".":"=1",":":"=2"},m=/[=.:]/g;t.exports=s},{}],161:[function(e,t){"use strict";function n(e){return Array.isArray(e)?e.concat():e&&"object"==typeof e?i(new e.constructor,e):e}function r(e,t,n){s(Array.isArray(e));var r=t[n];s(Array.isArray(r))}function o(e,t){if(s("object"==typeof t),t.hasOwnProperty(p))return s(1===Object.keys(t).length),t[p];var a=n(e);if(t.hasOwnProperty(d)){var h=t[d];s(h&&"object"==typeof h),s(a&&"object"==typeof a),i(a,t[d])}t.hasOwnProperty(u)&&(r(e,t,u),t[u].forEach(function(e){a.push(e)})),t.hasOwnProperty(l)&&(r(e,t,l),t[l].forEach(function(e){a.unshift(e)})),t.hasOwnProperty(c)&&(s(Array.isArray(e)),s(Array.isArray(t[c])),t[c].forEach(function(e){s(Array.isArray(e)),a.splice.apply(a,e)})),t.hasOwnProperty(f)&&(s("function"==typeof t[f]),a=t[f](a));for(var v in t)m.hasOwnProperty(v)&&m[v]||(a[v]=o(e[v],t[v]));return a}var i=e(29),a=e(151),s=e(144),u=a({$push:null}),l=a({$unshift:null}),c=a({$splice:null}),p=a({$set:null}),d=a({$merge:null}),f=a({$apply:null}),h=[u,l,c,p,d,f],m={};h.forEach(function(e){m[e]=!0}),t.exports=o},{}],162:[function(e,t){"use strict";var n=e(123),r=n;t.exports=r},{}]},{},[1])(1)});
|
src/icons/settings-open.js
|
leonardosnt/jar-string-editor
|
import React from "react";
export default () => (
<svg height="16" width="16" viewBox="0 0 16 16">
<path
d="M15 7h-2.1a4.967 4.967 0 0 0-.732-1.753l1.49-1.49a1 1 0 0 0-1.414-1.414l-1.49 1.49A4.968 4.968 0 0 0 9 3.1V1a1 1 0 0 0-2 0v2.1a4.968 4.968 0 0 0-1.753.732l-1.49-1.49a1 1 0 0 0-1.414 1.415l1.49 1.49A4.967 4.967 0 0 0 3.1 7H1a1 1 0 0 0 0 2h2.1a4.968 4.968 0 0 0 .737 1.763c-.014.013-.032.017-.045.03l-1.45 1.45a1 1 0 1 0 1.414 1.414l1.45-1.45c.013-.013.018-.031.03-.045A4.968 4.968 0 0 0 7 12.9V15a1 1 0 0 0 2 0v-2.1a4.968 4.968 0 0 0 1.753-.732l1.49 1.49a1 1 0 0 0 1.414-1.414l-1.49-1.49A4.967 4.967 0 0 0 12.9 9H15a1 1 0 0 0 0-2zM5 8a3 3 0 1 1 3 3 3 3 0 0 1-3-3z"
fill="context-fill"
fillOpacity="context-fill-opacity"
/>
</svg>
);
|
js/components/button/outline.js
|
bengaara/simbapp
|
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Container, Header, Title, Content, Button, Icon, Left, Right, Body, Text, H3 } from 'native-base';
import { Actions } from 'react-native-router-flux';
import { actions } from 'react-native-navigation-redux-helpers';
import { openDrawer } from '../../actions/drawer';
import styles from './styles';
const {
popRoute,
} = actions;
class Outline extends Component { // eslint-disable-line
static propTypes = {
openDrawer: React.PropTypes.func,
popRoute: React.PropTypes.func,
navigation: React.PropTypes.shape({
key: React.PropTypes.string,
}),
}
popRoute() {
this.props.popRoute(this.props.navigation.key);
}
render() {
return (
<Container style={styles.container}>
<Header>
<Left>
<Button transparent onPress={() => Actions.pop()}>
<Icon name="arrow-back" />
</Button>
</Left>
<Body>
<Title>Outline</Title>
</Body>
<Right />
</Header>
<Content padder style={{ backgroundColor: '#fff', padding: 20 }}>
<Button bordered light style={styles.mb15}><Text>Light</Text></Button>
<Button bordered info style={styles.mb15}><Text>Info</Text></Button>
<Button bordered danger style={styles.mb15}><Text>Danger</Text></Button>
<Button bordered primary style={styles.mb15}><Text>Primary</Text></Button>
<Button bordered warning style={styles.mb15}><Text>Warning</Text></Button>
<Button bordered success style={styles.mb15}><Text>Success</Text></Button>
<Button bordered dark style={styles.mb15}><Text>Dark</Text></Button>
</Content>
</Container>
);
}
}
function bindAction(dispatch) {
return {
openDrawer: () => dispatch(openDrawer()),
popRoute: key => dispatch(popRoute(key)),
};
}
const mapStateToProps = state => ({
navigation: state.cardNavigation,
themeState: state.drawer.themeState,
});
export default connect(mapStateToProps, bindAction)(Outline);
|
blueocean-material-icons/src/js/components/svg-icons/image/navigate-before.js
|
jenkinsci/blueocean-plugin
|
import React from 'react';
import SvgIcon from '../../SvgIcon';
const ImageNavigateBefore = (props) => (
<SvgIcon {...props}>
<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
</SvgIcon>
);
ImageNavigateBefore.displayName = 'ImageNavigateBefore';
ImageNavigateBefore.muiName = 'SvgIcon';
export default ImageNavigateBefore;
|
web-ui/src/backup_account/backup_email/backup_email.spec.js
|
pixelated-project/pixelated-user-agent
|
import { shallow } from 'enzyme';
import expect from 'expect';
import React from 'react';
import fetchMock from 'fetch-mock';
import { BackupEmail } from 'src/backup_account/backup_email/backup_email';
describe('BackupEmail', () => {
let backupEmail;
let mockOnSubmit;
let mockTranslations;
let backupEmailInstance;
beforeEach(() => {
mockOnSubmit = expect.createSpy();
mockTranslations = key => key;
backupEmail = shallow(<BackupEmail t={mockTranslations} onSubmit={mockOnSubmit} />);
});
it('renders backup email title', () => {
expect(backupEmail.find('h1').text()).toEqual('backup-account.backup-email.title');
});
it('renders backup account email input field', () => {
expect(backupEmail.find('InputField').props().name).toEqual('email');
});
it('renders backup account submit button', () => {
expect(backupEmail.find('SubmitButton').props().buttonText).toEqual('backup-account.backup-email.button');
});
describe('Email validation', () => {
beforeEach(() => {
backupEmailInstance = backupEmail.instance();
});
it('verify initial state', () => {
expect(backupEmailInstance.state.error).toEqual('');
expect(backupEmail.find('SubmitButton').props().disabled).toBe(true);
});
context('with invalid email', () => {
beforeEach(() => {
backupEmailInstance.validateEmail({ target: { value: 'test' } });
});
it('sets error in state', () => {
expect(backupEmailInstance.state.error).toEqual('backup-account.backup-email.error.invalid-email');
});
it('disables submit button', () => {
expect(backupEmail.find('SubmitButton').props().disabled).toBe(true);
});
});
context('with valid email', () => {
beforeEach(() => {
backupEmailInstance.validateEmail({ target: { value: 'test@test.com' } });
});
it('does not set error in state', () => {
expect(backupEmailInstance.state.error).toEqual('');
});
it('submit button is enabled', () => {
expect(backupEmail.find('SubmitButton').props().disabled).toBe(false);
});
});
context('with empty email', () => {
beforeEach(() => {
backupEmailInstance.validateEmail({ target: { value: '' } });
});
it('not set error in state', () => {
expect(backupEmailInstance.state.error).toEqual('');
});
it('disables submit button', () => {
expect(backupEmail.find('SubmitButton').props().disabled).toBe(true);
});
});
});
describe('Email changing handler', () => {
beforeEach(() => {
backupEmailInstance = backupEmail.instance();
});
it('sets user backup email in the state', () => {
backupEmailInstance.handleChange({ target: { value: 'test@test.com' } });
expect(backupEmailInstance.state.backupEmail).toEqual('test@test.com');
});
});
describe('Submit', () => {
let preventDefaultSpy;
beforeEach(() => {
preventDefaultSpy = expect.createSpy();
});
context('on success', () => {
beforeEach((done) => {
mockOnSubmit = expect.createSpy().andCall(() => done());
fetchMock.post('/backup-account', 204);
backupEmail = shallow(<BackupEmail t={mockTranslations} onSubmit={mockOnSubmit} />);
backupEmail.find('InputField').simulate('change', { target: { value: 'test@test.com' } });
backupEmail.find('form').simulate('submit', { preventDefault: preventDefaultSpy });
});
it('posts backup email', () => {
expect(fetchMock.called('/backup-account')).toBe(true, 'Backup account POST was not called');
});
it('sends user email as content', () => {
expect(fetchMock.lastOptions('/backup-account').body).toContain('"backupEmail":"test@test.com"');
});
it('calls onSubmit from props with success', () => {
expect(mockOnSubmit).toHaveBeenCalledWith('success');
});
});
context('on error', () => {
beforeEach((done) => {
mockOnSubmit = expect.createSpy().andCall(() => done());
fetchMock.post('/backup-account', 500);
backupEmail = shallow(<BackupEmail t={mockTranslations} onSubmit={mockOnSubmit} />);
backupEmail.find('form').simulate('submit', { preventDefault: preventDefaultSpy });
});
it('calls onSubmit from props with error', () => {
expect(mockOnSubmit).toHaveBeenCalledWith('error');
});
});
});
afterEach(() => {
fetchMock.restore();
});
});
|
examples/huge-apps/routes/Course/routes/Announcements/components/Sidebar.js
|
ryardley/react-router
|
import React from 'react';
import { Link } from 'react-router';
export default class AnnouncementsSidebar extends React.Component {
render () {
var announcements = COURSES[this.props.params.courseId].announcements;
return (
<div>
<h3>Sidebar Assignments</h3>
<ul>
{announcements.map(announcement => (
<li key={announcement.id}>
<Link to={`/course/${this.props.params.courseId}/announcements/${announcement.id}`}>
{announcement.title}
</Link>
</li>
))}
</ul>
</div>
);
}
}
|
node_modules/react-height/lib/ReactHeight.js
|
dgferreira/demo
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _createReactClass = require('create-react-class');
var _createReactClass2 = _interopRequireDefault(_createReactClass);
var _ReactComponentWithPureRenderMixin = require('react/lib/ReactComponentWithPureRenderMixin');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } /* eslint "react/no-did-mount-set-state":0 */
/* eslint "react/no-did-update-set-state":0 */
var getElementHeight = function getElementHeight(el) {
return el.clientHeight;
};
var ReactHeight = (0, _createReactClass2.default)({
propTypes: {
children: _propTypes2.default.node.isRequired,
onHeightReady: _propTypes2.default.func.isRequired,
hidden: _propTypes2.default.bool,
dirty: _propTypes2.default.bool,
getElementHeight: _propTypes2.default.func
},
getDefaultProps: function getDefaultProps() {
return {
hidden: false,
dirty: true,
getElementHeight: getElementHeight
};
},
getInitialState: function getInitialState() {
return {
height: 0, dirty: this.props.dirty
};
},
componentDidMount: function componentDidMount() {
var _this = this;
var height = this.props.getElementHeight(this.wrapper);
var dirty = false;
this.setState({ height: height, dirty: dirty }, function () {
return _this.props.onHeightReady(_this.state.height);
});
},
componentWillReceiveProps: function componentWillReceiveProps(_ref) {
var children = _ref.children,
dirty = _ref.dirty;
if (children !== this.props.children || dirty) {
this.setState({ dirty: true });
}
},
shouldComponentUpdate: _ReactComponentWithPureRenderMixin.shouldComponentUpdate,
componentDidUpdate: function componentDidUpdate() {
var _this2 = this;
var height = this.props.getElementHeight(this.wrapper);
var dirty = false;
if (height === this.state.height) {
this.setState({ dirty: dirty });
} else {
this.setState({ height: height, dirty: dirty }, function () {
return _this2.props.onHeightReady(_this2.state.height);
});
}
},
setWrapperRef: function setWrapperRef(el) {
this.wrapper = el;
},
render: function render() {
var _props = this.props,
_onHeightReady = _props.onHeightReady,
_getElementHeight = _props.getElementHeight,
_dirty = _props.dirty,
hidden = _props.hidden,
children = _props.children,
props = _objectWithoutProperties(_props, ['onHeightReady', 'getElementHeight', 'dirty', 'hidden', 'children']);
var dirty = this.state.dirty;
if (hidden && !dirty) {
return null;
}
if (hidden) {
return _react2.default.createElement(
'div',
{ style: { height: 0, overflow: 'hidden' } },
_react2.default.createElement(
'div',
_extends({ ref: this.setWrapperRef }, props),
children
)
);
}
return _react2.default.createElement(
'div',
_extends({ ref: this.setWrapperRef }, props),
children
);
}
});
exports.default = ReactHeight;
//# sourceMappingURL=ReactHeight.js.map
|
dnim-client/src/components/InfoItem.js
|
zhangmingkai4315/DNIS-Project
|
import React from 'react';
export default class InfoItem extends React.Component {
constructor(props) {
super(props);
this.state={
value:this.props.value
};
this.changeItem=this.changeItem.bind(this);
}
componentWillReceiveProps(nextProps){
this.setState({
value:nextProps.value
});
}
changeItem(event){
const value=event.target.value;
this.setState({
value:value
});
this.props.onChangeitem(this.props.title,value);
}
render() {
const value=this.state.value;
return (
<div className="pure-u-1 pure-u-md-1-3">
<label htmlFor="dnis-id">{this.props.title}</label>
<input id="dnis-id"
type="text"
ref=''
value={value}
onChange={this.changeItem}
readOnly={this.props.readonly}/>
</div>
);
}
}
InfoItem.propTypes = {
value:React.PropTypes.number,
title:React.PropTypes.string,
readonly:React.PropTypes.bool,
onChangeitem:React.PropTypes.func
};
InfoItem.defaultProps={
value:'未知',
title:'Unknown',
readonly:true
};
|
services/ui/src/components/TableDisplay/index.js
|
amazeeio/lagoon
|
import React, { Component } from 'react';
class TableDisplay extends Component {
render() {
const { columns, data } = this.props;
let headers = <tr>{columns.map((name, n) => <th key={n}>{name}</th>)}</tr>
let rows = data.map((item, i) => {
return <tr key={i}>
<td>{item.name}</td>
<td>{item.version}</td>
<td>{item.latest}</td>
</tr>
})
return (
<table className="table">
<thead>{headers}</thead>
<tbody>{rows}</tbody>
</table>
)
}
}
export default TableDisplay;
|
ajax/libs/primeui/4.1.10/primeui.min.js
|
sashberd/cdnjs
|
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){var e={zindex:1e3,gridColumns:{1:"ui-grid-col-12",2:"ui-grid-col-6",3:"ui-grid-col-4",4:"ui-grid-col-3",6:"ui-grid-col-2",12:"ui-grid-col-11"},charSet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",scrollInView:function(t,e){var i=parseFloat(t.css("borderTopWidth"))||0,s=parseFloat(t.css("paddingTop"))||0,n=e.offset().top-t.offset().top-i-s,o=t.scrollTop(),a=t.height(),l=e.outerHeight(!0);0>n?t.scrollTop(o+n):n+l>a&&t.scrollTop(o+n-a+l)},generateRandomId:function(){for(var t="",e=1;10>=e;e++){var i=Math.floor(Math.random()*this.charSet.length);t+=this.charSet[i]}return t},isIE:function(t){return this.browser.msie&&parseInt(this.browser.version,10)===t},escapeRegExp:function(t){return t.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},escapeHTML:function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},escapeClientId:function(t){return"#"+t.replace(/:/g,"\\:")},clearSelection:function(){window.getSelection?window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges():document.selection&&document.selection.empty&&document.selection.empty()},inArray:function(t,e){for(var i=0;i<t.length;i++)if(t[i]===e)return!0;return!1},calculateScrollbarWidth:function(){if(!this.scrollbarWidth)if(this.browser.msie){var e=t('<textarea cols="10" rows="2"></textarea>').css({position:"absolute",top:-1e3,left:-1e3}).appendTo("body"),i=t('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({position:"absolute",top:-1e3,left:-1e3}).appendTo("body");this.scrollbarWidth=e.width()-i.width(),e.add(i).remove()}else{var s=t("<div />").css({width:100,height:100,overflow:"auto",position:"absolute",top:-1e3,left:-1e3}).prependTo("body").append("<div />").find("div").css({width:"100%",height:200});this.scrollbarWidth=100-s.width(),s.parent().remove()}return this.scrollbarWidth},resolveUserAgent:function(e){var i,s;if(e.uaMatch=function(t){t=t.toLowerCase();var e=/(opr)[\/]([\w.]+)/.exec(t)||/(chrome)[ \/]([\w.]+)/.exec(t)||/(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(t)||/(webkit)[ \/]([\w.]+)/.exec(t)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||t.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(t)||t.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(t)||[],i=/(ipad)/.exec(t)||/(iphone)/.exec(t)||/(android)/.exec(t)||/(windows phone)/.exec(t)||/(win)/.exec(t)||/(mac)/.exec(t)||/(linux)/.exec(t)||/(cros)/i.exec(t)||[];return{browser:e[3]||e[1]||"",version:e[2]||"0",platform:i[0]||""}},i=e.uaMatch(window.navigator.userAgent),s={},i.browser&&(s[i.browser]=!0,s.version=i.version,s.versionNumber=parseInt(i.version)),i.platform&&(s[i.platform]=!0),(s.android||s.ipad||s.iphone||s["windows phone"])&&(s.mobile=!0),(s.cros||s.mac||s.linux||s.win)&&(s.desktop=!0),(s.chrome||s.opr||s.safari)&&(s.webkit=!0),s.rv){var n="msie";i.browser=n,s[n]=!0}if(s.opr){var o="opera";i.browser=o,s[o]=!0}if(s.safari&&s.android){var a="android";i.browser=a,s[a]=!0}s.name=i.browser,s.platform=i.platform,this.browser=s,t.browser=s},getGridColumn:function(t){return this.gridColumns[t+""]},executeFunctionByName:function(t){for(var e=[].slice.call(arguments).splice(1),i=window,s=t.split("."),n=s.pop(),o=0;o<s.length;o++)i=i[s[o]];return i[n].apply(this,e)},resolveObjectByName:function(t){if(t){for(var e=t.split("."),i=0,s=e.length,n=window;s>i;++i)n=n[e[i]];return n}return null},getCookie:function(e){return t.cookie(e)},setCookie:function(e,i,s){t.cookie(e,i,s)},deleteCookie:function(e,i){t.removeCookie(e,i)}};e.resolveUserAgent(t),window.PUI=e}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puiaccordion",{options:{activeIndex:0,multiple:!1},_create:function(){this.options.multiple&&(this.options.activeIndex=this.options.activeIndex||[0]);var e=this;this.element.addClass("ui-accordion ui-widget ui-helper-reset");var i=this.element.children();i.is("div")?(this.panelMode="native",this.headers=this.element.children("h3"),this.panels=this.element.children("div")):(this.panelMode="wrapped",this.headers=i.children("h3"),this.panels=i.children("div")),this.headers.addClass("ui-accordion-header ui-helper-reset ui-state-default").each(function(i){var s=t(this),n=s.html(),o=e.options.multiple?-1!==t.inArray(i,e.options.activeIndex):i==e.options.activeIndex,a=o?"ui-state-active ui-corner-top":"ui-corner-all",l=o?"fa fa-fw fa-caret-down":"fa fa-fw fa-caret-right";s.addClass(a).html('<span class="'+l+'"></span><a href="#">'+n+"</a>")}),this.panels.each(function(i){var s=t(this);s.addClass("ui-accordion-content ui-helper-reset ui-widget-content"),active=e.options.multiple?-1!==t.inArray(i,e.options.activeIndex):i==e.options.activeIndex,active||s.addClass("ui-helper-hidden")}),this.headers.children("a").disableSelection(),this._bindEvents()},_destroy:function(){this._unbindEvents(),this.element.removeClass("ui-accordion ui-widget ui-helper-reset"),this.headers.removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-state-hover ui-state-active ui-state-disabled ui-corner-all ui-corner-top"),this.panels.removeClass("ui-accordion-content ui-helper-reset ui-widget-content ui-helper-hidden"),this.headers.children(".fa").remove(),this.headers.children("a").contents().unwrap()},_bindEvents:function(){var e=this;this.headers.on("mouseover.puiaccordion",function(){var e=t(this);e.hasClass("ui-state-active")||e.hasClass("ui-state-disabled")||e.addClass("ui-state-hover")}).on("mouseout.puiaccordion",function(){var e=t(this);e.hasClass("ui-state-active")||e.hasClass("ui-state-disabled")||e.removeClass("ui-state-hover")}).on("click.puiaccordion",function(i){var s=t(this);if(!s.hasClass("ui-state-disabled")){var n="native"===e.panelMode?s.index()/2:s.parent().index();s.hasClass("ui-state-active")?e.unselect(n):e.select(n,!1)}i.preventDefault()})},_unbindEvents:function(){this.headers.off("mouseover.puiaccordion mouseout.puiaccordion click.puiaccordion")},select:function(t,e){var i=this.panels.eq(t);e||this._trigger("change",null,{index:t}),this.options.multiple?this._addToSelection(t):this.options.activeIndex=t,this._show(i)},unselect:function(t){var e=this.panels.eq(t),i=e.prev();i.attr("aria-expanded",!1).children(".fa").removeClass("fa-caret-down").addClass("fa-caret-right"),i.removeClass("ui-state-active ui-corner-top").addClass("ui-corner-all"),e.attr("aria-hidden",!0).slideUp(),this._removeFromSelection(t)},_show:function(t){if(!this.options.multiple){var e=this.headers.filter(".ui-state-active");e.children(".fa").removeClass("fa-caret-down").addClass("fa-caret-right"),e.attr("aria-expanded",!1).removeClass("ui-state-active ui-corner-top").addClass("ui-corner-all").next().attr("aria-hidden",!0).slideUp()}var i=t.prev();i.attr("aria-expanded",!0).addClass("ui-state-active ui-corner-top").removeClass("ui-state-hover ui-corner-all").children(".fa").removeClass("fa-caret-right").addClass("fa-caret-down"),t.attr("aria-hidden",!1).slideDown("normal")},_addToSelection:function(t){this.options.activeIndex.push(t)},_removeFromSelection:function(e){this.options.activeIndex=t.grep(this.options.activeIndex,function(t){return t!=e})},_setOption:function(e,i){"activeIndex"===e?this.select(i,!0):t.Widget.prototype._setOption.apply(this,arguments)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puiautocomplete",{options:{delay:300,minQueryLength:1,multiple:!1,dropdown:!1,scrollHeight:200,forceSelection:!1,effect:null,effectOptions:{},effectSpeed:"normal",content:null,caseSensitive:!1},_create:function(){this.element.wrap('<span class="ui-autocomplete ui-widget" />'),this.element.puiinputtext(),this.panel=t('<div class="ui-autocomplete-panel ui-widget-content ui-corner-all ui-helper-hidden ui-shadow"></div>').appendTo("body"),this.options.multiple?(this.element.wrap('<ul class="ui-autocomplete-multiple ui-widget ui-inputtext ui-state-default ui-corner-all"><li class="ui-autocomplete-input-token"></li></ul>'),this.inputContainer=this.element.parent(),this.multiContainer=this.inputContainer.parent()):this.options.dropdown&&(this.dropdown=t('<button type="button" class="ui-autocomplete-dropdown ui-button ui-widget ui-state-default ui-corner-right ui-button-icon-only"><span class="fa fa-fw fa-caret-down"></span><span class="ui-button-text"> </span></button>').insertAfter(this.element),this.element.removeClass("ui-corner-all").addClass("ui-corner-left")),this._bindEvents()},_bindEvents:function(){var e=this;this._bindKeyEvents(),this.options.dropdown&&this.dropdown.on("mouseenter.puiautocomplete",function(){e.element.prop("disabled")||e.dropdown.addClass("ui-state-hover")}).on("mouseleave.puiautocomplete",function(){e.dropdown.removeClass("ui-state-hover")}).on("mousedown.puiautocomplete",function(){e.element.prop("disabled")||e.dropdown.addClass("ui-state-active")}).on("mouseup.puiautocomplete",function(){e.element.prop("disabled")||(e.dropdown.removeClass("ui-state-active"),e.search(""),e.element.focus())}).on("focus.puiautocomplete",function(){e.dropdown.addClass("ui-state-focus")}).on("blur.puiautocomplete",function(){e.dropdown.removeClass("ui-state-focus")}).on("keydown.puiautocomplete",function(i){var s=t.ui.keyCode;i.which!=s.ENTER&&i.which!=s.NUMPAD_ENTER||(e.search(""),e.input.focus(),i.preventDefault())}),this.options.multiple&&(this.multiContainer.on("hover.puiautocomplete",function(){t(this).toggleClass("ui-state-hover")}).on("click.puiautocomplete",function(){e.element.trigger("focus")}),this.element.on("focus.ui-autocomplete",function(){e.multiContainer.addClass("ui-state-focus")}).on("blur.ui-autocomplete",function(t){e.multiContainer.removeClass("ui-state-focus")})),this.options.forceSelection&&(this.currentItems=[this.element.val()],this.element.on("blur.puiautocomplete",function(){for(var i=t(this).val(),s=!1,n=0;n<e.currentItems.length;n++)if(e.currentItems[n]===i){s=!0;break}s||e.element.val("")})),t(document.body).bind("mousedown.puiautocomplete",function(t){if(!e.panel.is(":hidden")&&t.target!==e.element.get(0)){var i=e.panel.offset();(t.pageX<i.left||t.pageX>i.left+e.panel.width()||t.pageY<i.top||t.pageY>i.top+e.panel.height())&&e.hide()}}),t(window).bind("resize."+this.element.id,function(){e.panel.is(":visible")&&e._alignPanel()})},_bindKeyEvents:function(){var e=this;this.element.on("keyup.puiautocomplete",function(i){var s=t.ui.keyCode,n=i.which,o=!0;if(n!=s.UP&&n!=s.LEFT&&n!=s.DOWN&&n!=s.RIGHT&&n!=s.TAB&&n!=s.SHIFT&&n!=s.ENTER&&n!=s.NUMPAD_ENTER||(o=!1),o){var a=e.element.val();a.length||e.hide(),a.length>=e.options.minQueryLength&&(e.timeout&&window.clearTimeout(e.timeout),e.timeout=window.setTimeout(function(){e.search(a)},e.options.delay))}}).on("keydown.puiautocomplete",function(i){if(e.panel.is(":visible")){var s=t.ui.keyCode,n=e.items.filter(".ui-state-highlight");switch(i.which){case s.UP:case s.LEFT:var o=n.prev();1==o.length&&(n.removeClass("ui-state-highlight"),o.addClass("ui-state-highlight"),e.options.scrollHeight&&PUI.scrollInView(e.panel,o)),i.preventDefault();break;case s.DOWN:case s.RIGHT:var a=n.next();1==a.length&&(n.removeClass("ui-state-highlight"),a.addClass("ui-state-highlight"),e.options.scrollHeight&&PUI.scrollInView(e.panel,a)),i.preventDefault();break;case s.ENTER:case s.NUMPAD_ENTER:n.trigger("click"),i.preventDefault();break;case s.ALT:case 224:break;case s.TAB:n.trigger("click"),e.hide()}}})},_bindDynamicEvents:function(){var e=this;this.items.on("mouseover.puiautocomplete",function(){var i=t(this);i.hasClass("ui-state-highlight")||(e.items.filter(".ui-state-highlight").removeClass("ui-state-highlight"),i.addClass("ui-state-highlight"))}).on("click.puiautocomplete",function(i){var s=t(this);if(e.options.multiple){var n='<li class="ui-autocomplete-token ui-state-active ui-corner-all ui-helper-hidden">';n+='<span class="ui-autocomplete-token-icon fa fa-fw fa-close" />',n+='<span class="ui-autocomplete-token-label">'+s.data("label")+"</span></li>",t(n).data(s.data()).insertBefore(e.inputContainer).fadeIn().children(".ui-autocomplete-token-icon").on("click.ui-autocomplete",function(i){var s=t(this).parent();e._removeItem(s),e._trigger("unselect",i,s)}),e.element.val("").trigger("focus")}else e.element.val(s.data("label")).focus();e._trigger("select",i,s),e.hide()})},search:function(e){this.query=this.options.caseSensitive?e:e.toLowerCase();var i={query:this.query};if(this.options.completeSource)if(t.isArray(this.options.completeSource)){for(var s=this.options.completeSource,n=[],o=""===t.trim(e),a=0;a<s.length;a++){var l=s[a],r=l.label||l;this.options.caseSensitive||(r=r.toLowerCase()),(o||0===r.indexOf(this.query))&&n.push({label:s[a],value:l})}this._handleData(n)}else this.options.completeSource.call(this,i,this._handleData)},_handleData:function(e){var i=this;this.panel.html(""),this.listContainer=t('<ul class="ui-autocomplete-items ui-autocomplete-list ui-widget-content ui-widget ui-corner-all ui-helper-reset"></ul>').appendTo(this.panel);for(var s=0;s<e.length;s++){var n=t('<li class="ui-autocomplete-item ui-autocomplete-list-item ui-corner-all"></li>');n.data(e[s]),this.options.content?n.html(this.options.content.call(this,e[s])):n.text(e[s].label),this.listContainer.append(n)}if(this.items=this.listContainer.children(".ui-autocomplete-item"),this._bindDynamicEvents(),this.items.length>0){var o=i.items.eq(0),a=this.panel.is(":hidden");if(o.addClass("ui-state-highlight"),i.query.length>0&&!i.options.content&&i.items.each(function(){var e=t(this),s=e.html(),n=new RegExp(PUI.escapeRegExp(i.query),"gi"),o=s.replace(n,'<span class="ui-autocomplete-query">$&</span>');e.html(o)}),this.options.forceSelection&&(this.currentItems=[],t.each(e,function(t,e){i.currentItems.push(e.label)})),i.options.scrollHeight){var l=a?i.panel.height():i.panel.children().height();l>i.options.scrollHeight?i.panel.height(i.options.scrollHeight):i.panel.css("height","auto")}a?i.show():i._alignPanel()}else this.panel.hide()},show:function(){this._alignPanel(),this.options.effect?this.panel.show(this.options.effect,{},this.options.effectSpeed):this.panel.show()},hide:function(){this.panel.hide(),this.panel.css("height","auto")},_removeItem:function(e){e.fadeOut("fast",function(){var e=t(this);e.remove()})},_alignPanel:function(){var t=null;if(this.options.multiple)t=this.multiContainer.innerWidth()-(this.element.position().left-this.multiContainer.position().left);else{this.panel.is(":visible")?t=this.panel.children(".ui-autocomplete-items").outerWidth():(this.panel.css({visibility:"hidden",display:"block"}),t=this.panel.children(".ui-autocomplete-items").outerWidth(),this.panel.css({visibility:"visible",display:"none"}));var e=this.element.outerWidth();e>t&&(t=e)}this.panel.css({left:"",top:"",width:t,"z-index":++PUI.zindex}).position({my:"left top",at:"left bottom",of:this.element})}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puibutton",{options:{value:null,icon:null,iconPos:"left",click:null},_create:function(){var t=this.element;this.elementText=this.element.text();var e=this.options.value||(""===this.elementText?"ui-button":this.elementText),i=t.prop("disabled"),s=null;s=this.options.icon?"ui-button"===e?"ui-button-icon-only":"ui-button-text-icon-"+this.options.iconPos:"ui-button-text-only",i&&(s+=" ui-state-disabled"),this.element.addClass("ui-button ui-widget ui-state-default ui-corner-all "+s).text(""),this.options.icon&&this.element.append('<span class="ui-button-icon-'+this.options.iconPos+" ui-c fa fa-fw "+this.options.icon+'" />'),this.element.append('<span class="ui-button-text ui-c">'+e+"</span>"),i||this._bindEvents()},_destroy:function(){this.element.removeClass("ui-button ui-widget ui-state-default ui-state-hover ui-state-active ui-state-disabled ui-state-focus ui-corner-all ui-button-text-only ui-button-icon-only ui-button-text-icon-right ui-button-text-icon-left"),this._unbindEvents(),this.element.children(".fa").remove(),this.element.children(".ui-button-text").remove(),this.element.text(this.elementText)},_bindEvents:function(){var e=this.element,i=this;return e.on("mouseover.puibutton",function(){e.prop("disabled")||e.addClass("ui-state-hover")}).on("mouseout.puibutton",function(){t(this).removeClass("ui-state-active ui-state-hover")}).on("mousedown.puibutton",function(){e.hasClass("ui-state-disabled")||e.addClass("ui-state-active").removeClass("ui-state-hover")}).on("mouseup.puibutton",function(t){e.removeClass("ui-state-active").addClass("ui-state-hover"),i._trigger("click",t)}).on("focus.puibutton",function(){e.addClass("ui-state-focus")}).on("blur.puibutton",function(){e.removeClass("ui-state-focus")}).on("keydown.puibutton",function(i){i.keyCode!=t.ui.keyCode.SPACE&&i.keyCode!=t.ui.keyCode.ENTER&&i.keyCode!=t.ui.keyCode.NUMPAD_ENTER||e.addClass("ui-state-active")}).on("keyup.puibutton",function(){e.removeClass("ui-state-active")}),this},_unbindEvents:function(){this.element.off("mouseover.puibutton mouseout.puibutton mousedown.puibutton mouseup.puibutton focus.puibutton blur.puibutton keydown.puibutton keyup.puibutton")},disable:function(){this._unbindEvents(),this.element.addClass("ui-state-disabled").prop("disabled",!0)},enable:function(){this.element.prop("disabled")&&(this._bindEvents(),this.element.prop("disabled",!1).removeClass("ui-state-disabled"))},_setOption:function(e,i){"disabled"===e?i?this.disable():this.enable():t.Widget.prototype._setOption.apply(this,arguments)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puicarousel",{options:{datasource:null,numVisible:3,firstVisible:0,headerText:null,effectDuration:500,circular:!1,breakpoint:560,itemContent:null,responsive:!0,autoplayInterval:0,easing:"easeInOutCirc",pageLinks:3,style:null,styleClass:null,template:null,enhanced:!1},_create:function(){this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this.options.enhanced||this.element.wrap('<div class="ui-carousel ui-widget ui-widget-content ui-corner-all"><div class="ui-carousel-viewport"></div></div>'),this.container=this.element.parent().parent(),this.element.addClass("ui-carousel-items"),this.viewport=this.element.parent(),this.container.prepend('<div class="ui-carousel-header ui-widget-header"><div class="ui-carousel-header-title"></div></div>'),this.header=this.container.children(".ui-carousel-header"),this.header.append('<span class="ui-carousel-button ui-carousel-next-button fa fa-arrow-circle-right"></span><span class="ui-carousel-button ui-carousel-prev-button fa fa-arrow-circle-left"></span>'),this.options.headerText&&this.header.children(".ui-carousel-header-title").html(this.options.headerText),this.options.styleClass&&this.container.addClass(this.options.styleClass),this.options.style&&this.container.attr("style",this.options.style),this.options.datasource?this._loadData():this._render()},_destroy:function(){this._unbindEvents(),this.header.remove(),this.items.removeClass("ui-carousel-item ui-widget-content ui-corner-all").css("width","auto"),this.element.removeClass("ui-carousel-items").css("left","auto"),this.options.enhanced||this.element.unwrap().unwrap(),this.options.datasource&&this.items.remove()},_loadData:function(){t.isArray(this.options.datasource)?this._render(this.options.datasource):"function"===t.type(this.options.datasource)&&this.options.datasource.call(this,this._render)},_updateDatasource:function(t){this.options.datasource=t,this.element.children().remove(),this.header.children(".ui-carousel-page-links").remove(),this.header.children("select").remove(),this._loadData()},_render:function(e){if(this.data=e,this.data)for(var i=0;i<e.length;i++){var s=this._createItemContent(e[i]);"string"===t.type(s)?this.element.append("<li>"+s+"</li>"):this.element.append(t("<li></li>").wrapInner(s))}this.items=this.element.children("li"),this.items.addClass("ui-carousel-item ui-widget-content ui-corner-all"),this.itemsCount=this.items.length,this.columns=this.options.numVisible,this.first=this.options.firstVisible,this.page=parseInt(this.first/this.columns),this.totalPages=Math.ceil(this.itemsCount/this.options.numVisible),this._renderPageLinks(),this.prevNav=this.header.children(".ui-carousel-prev-button"),this.nextNav=this.header.children(".ui-carousel-next-button"),this.pageLinks=this.header.find("> .ui-carousel-page-links > .ui-carousel-page-link"),this.dropdown=this.header.children(".ui-carousel-dropdown"),this.mobileDropdown=this.header.children(".ui-carousel-mobiledropdown"),this._bindEvents(),this.options.responsive?this.refreshDimensions():(this.calculateItemWidths(),this.container.width(this.container.width()),this.updateNavigators())},_renderPageLinks:function(){if(this.totalPages<=this.options.pageLinks){this.pageLinksContainer=t('<div class="ui-carousel-page-links"></div>');for(var e=0;e<this.totalPages;e++)this.pageLinksContainer.append('<a href="#" class="ui-carousel-page-link fa fa-circle-o"></a>');this.header.append(this.pageLinksContainer)}else{this.dropdown=t('<select class="ui-carousel-dropdown ui-widget ui-state-default ui-corner-left"></select>');for(var e=0;e<this.totalPages;e++){var i=e+1;this.dropdown.append('<option value="'+i+'">'+i+"</option>")}this.header.append(this.dropdown)}if(this.options.responsive){this.mobileDropdown=t('<select class="ui-carousel-mobiledropdown ui-widget ui-state-default ui-corner-left"></select>');for(var e=0;e<this.itemsCount;e++){var i=e+1;this.mobileDropdown.append('<option value="'+i+'">'+i+"</option>")}this.header.append(this.mobileDropdown)}},calculateItemWidths:function(){var t=this.items.eq(0);if(t.length){var e=t.outerWidth(!0)-t.outerWidth();this.items.css({width:(this.viewport.innerWidth()-e*this.columns)/this.columns})}},refreshDimensions:function(){var e=t(window);e.width()<=this.options.breakpoint?(this.columns=1,this.calculateItemWidths(this.columns),this.totalPages=this.itemsCount,this.mobileDropdown.show(),this.pageLinks.hide()):(this.columns=this.options.numVisible,this.calculateItemWidths(),this.totalPages=Math.ceil(this.itemsCount/this.options.numVisible),this.mobileDropdown.hide(),this.pageLinks.show()),this.page=parseInt(this.first/this.columns),this.updateNavigators(),this.element.css("left",-1*(this.viewport.innerWidth()*this.page))},_bindEvents:function(){var e=this;if(!this.eventsBound){if(this.prevNav.on("click.puicarousel",function(){0!==e.page?e.setPage(e.page-1):e.options.circular&&e.setPage(e.totalPages-1)}),this.nextNav.on("click.puicarousel",function(){var t=e.page===e.totalPages-1;t?e.options.circular&&e.setPage(0):e.setPage(e.page+1)}),t.swipe&&this.element.swipe({swipe:function(t,i){"left"===i?e.page===e.totalPages-1?e.options.circular&&e.setPage(0):e.setPage(e.page+1):"right"===i&&(0===e.page?e.options.circular&&e.setPage(e.totalPages-1):e.setPage(e.page-1))}}),this.pageLinks.length&&this.pageLinks.on("click.puicarousel",function(i){e.setPage(t(this).index()),i.preventDefault()}),this.header.children("select").on("change.puicarousel",function(){e.setPage(parseInt(t(this).val())-1)}),this.options.autoplayInterval&&(this.options.circular=!0,this.startAutoplay()),this.options.responsive){var i="resize."+this.id;t(window).off(i).on(i,function(){e.refreshDimensions()})}this.eventsBound=!0}},_unbindEvents:function(){this.prevNav.off("click.puicarousel"),this.nextNav.off("click.puicarousel"),this.pageLinks.length&&this.pageLinks.off("click.puicarousel"),this.header.children("select").off("change.puicarousel"),this.options.autoplayInterval&&this.stopAutoplay(),this.options.responsive&&t(window).off("resize."+this.id)},updateNavigators:function(){this.options.circular||(0===this.page?(this.prevNav.addClass("ui-state-disabled"),this.nextNav.removeClass("ui-state-disabled")):this.page===this.totalPages-1?(this.prevNav.removeClass("ui-state-disabled"),this.nextNav.addClass("ui-state-disabled")):(this.prevNav.removeClass("ui-state-disabled"),this.nextNav.removeClass("ui-state-disabled"))),this.pageLinks.length&&(this.pageLinks.filter(".fa-dot-circle-o").removeClass("fa-dot-circle-o"),this.pageLinks.eq(this.page).addClass("fa-dot-circle-o")),this.dropdown.length&&this.dropdown.val(this.page+1),this.mobileDropdown.length&&this.mobileDropdown.val(this.page+1)},setPage:function(t){if(t!==this.page&&!this.element.is(":animated")){var e=this;this.element.animate({left:-1*(this.viewport.innerWidth()*t),easing:this.options.easing},{duration:this.options.effectDuration,easing:this.options.easing,complete:function(){e.page=t,e.first=e.page*e.columns,e.updateNavigators(),e._trigger("pageChange",null,{page:t})}})}},startAutoplay:function(){var t=this;this.interval=setInterval(function(){t.page===t.totalPages-1?t.setPage(0):t.setPage(t.page+1)},this.options.autoplayInterval)},stopAutoplay:function(){clearInterval(this.interval)},_setOption:function(e,i){"datasource"===e?this._updateDatasource(i):t.Widget.prototype._setOption.apply(this,arguments)},_createItemContent:function(t){if(this.options.template){var e=this.options.template.html();return Mustache.parse(e),Mustache.render(e,t)}return this.options.itemContent.call(this,t)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puicheckbox",{_create:function(){this.element.wrap('<div class="ui-chkbox ui-widget"><div class="ui-helper-hidden-accessible"></div></div>'),this.container=this.element.parent().parent(),this.box=t('<div class="ui-chkbox-box ui-widget ui-corner-all ui-state-default">').appendTo(this.container),this.icon=t('<span class="ui-chkbox-icon ui-c"></span>').appendTo(this.box),this.disabled=this.element.prop("disabled"),this.label=t('label[for="'+this.element.attr("id")+'"]'),this.isChecked()&&(this.box.addClass("ui-state-active"),this.icon.addClass("fa fa-fw fa-check")),this.disabled?this.box.addClass("ui-state-disabled"):this._bindEvents()},_bindEvents:function(){var e=this;this.box.on("mouseover.puicheckbox",function(){e.isChecked()||e.box.addClass("ui-state-hover")}).on("mouseout.puicheckbox",function(){e.box.removeClass("ui-state-hover")}).on("click.puicheckbox",function(){e.toggle()}),this.element.on("focus.puicheckbox",function(){e.isChecked()&&e.box.removeClass("ui-state-active"),e.box.addClass("ui-state-focus")}).on("blur.puicheckbox",function(){e.isChecked()&&e.box.addClass("ui-state-active"),e.box.removeClass("ui-state-focus")}).on("keydown.puicheckbox",function(e){var i=t.ui.keyCode;e.which==i.SPACE&&e.preventDefault()}).on("keyup.puicheckbox",function(i){var s=t.ui.keyCode;i.which==s.SPACE&&(e.toggle(!0),i.preventDefault())}),this.label.on("click.puicheckbox",function(t){e.toggle(),t.preventDefault()})},toggle:function(t){this.isChecked()?this.uncheck(t):this.check(t),this._trigger("change",null,this.isChecked())},isChecked:function(){return this.element.prop("checked")},check:function(t,e){this.isChecked()||(this.element.prop("checked",!0),this.icon.addClass("fa fa-fw fa-check"),t||this.box.addClass("ui-state-active"),e||this.element.trigger("change"))},uncheck:function(){this.isChecked()&&(this.element.prop("checked",!1),this.box.removeClass("ui-state-active"),this.icon.removeClass("fa fa-fw fa-check"),this.element.trigger("change"))},_unbindEvents:function(){this.box.off("mouseover.puicheckbox mouseout.puicheckbox click.puicheckbox"),this.element.off("focus.puicheckbox blur.puicheckbox keydown.puicheckbox keyup.puicheckbox"),this.label.length&&this.label.off("click.puicheckbox")},disable:function(){this.box.prop("disabled",!0),this.box.attr("aria-disabled",!0),this.box.addClass("ui-state-disabled").removeClass("ui-state-hover"),this._unbindEvents()},enable:function(){this.box.prop("disabled",!1),this.box.attr("aria-disabled",!1),this.box.removeClass("ui-state-disabled"),this._bindEvents()},_destroy:function(){this._unbindEvents(),this.container.removeClass("ui-chkbox ui-widget"),this.box.remove(),this.element.unwrap().unwrap()}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puidatagrid",{options:{columns:3,datasource:null,paginator:null,header:null,footer:null,content:null,lazy:!1,template:null},_create:function(){this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this.element.addClass("ui-datagrid ui-widget"),this.options.header&&this.element.append('<div class="ui-datagrid-header ui-widget-header ui-corner-top">'+this.options.header+"</div>"),this.content=t('<div class="ui-datagrid-content ui-widget-content ui-datagrid-col-'+this.options.columns+'"></div>').appendTo(this.element),this.options.footer&&this.element.append('<div class="ui-datagrid-footer ui-widget-header ui-corner-top">'+this.options.footer+"</div>"),this.options.datasource&&this._initDatasource()},_onDataInit:function(t){this._onDataUpdate(t),this._initPaginator()},_onDataUpdate:function(t){this.data=t,this.data||(this.data=[]),this.reset(),this._renderData()},_onLazyLoad:function(t){this.data=t,this.data||(this.data=[]),this._renderData()},reset:function(){this.paginator&&this.paginator.puipaginator("setState",{page:0,totalRecords:this.options.lazy?this.options.paginator.totalRecords:this.data.length})},paginate:function(){this.options.lazy?this.options.datasource.call(this,this._onLazyLoad,this._createStateMeta()):this._renderData()},_renderData:function(){if(this.data){this.content.html("");for(var e=this._getFirst(),i=this.options.lazy?0:e,s=this._getRows(),n=i;i+s>n;n++){var o=this.data[n];if(o){var a=t("<div></div>").appendTo(this.content),l=this._createItemContent(o);a.append(l)}}}},_getFirst:function(){if(this.paginator){var t=this.paginator.puipaginator("option","page"),e=this.paginator.puipaginator("option","rows");return t*e}return 0},_getRows:function(){return this.options.paginator?this.paginator?this.paginator.puipaginator("option","rows"):this.options.paginator.rows:this.data?this.data.length:0},_createStateMeta:function(){var t={first:this._getFirst(),rows:this._getRows()};return t},_initPaginator:function(){var e=this;this.options.paginator&&(this.options.paginator.paginate=function(t,i){e.paginate()},this.options.paginator.totalRecords=this.options.lazy?this.options.paginator.totalRecords:this.data.length,this.paginator=t("<div></div>").insertAfter(this.content).puipaginator(this.options.paginator))},_initDatasource:function(){if(t.isArray(this.options.datasource))this._onDataInit(this.options.datasource);else{if("string"===t.type(this.options.datasource)){var e=this,i=this.options.datasource;this.options.datasource=function(){t.ajax({type:"GET",url:i,dataType:"json",context:e,success:function(t){this._onDataInit(t)}})}}"function"===t.type(this.options.datasource)&&(this.options.lazy?this.options.datasource.call(this,this._onDataInit,{first:0,rows:this._getRows()}):this.options.datasource.call(this,this._onDataInit))}},_updateDatasource:function(e){this.options.datasource=e,t.isArray(this.options.datasource)?this._onDataUpdate(this.options.datasource):"function"===t.type(this.options.datasource)&&(this.options.lazy?this.options.datasource.call(this,this._onDataUpdate,{first:0,rows:this._getRows()}):this.options.datasource.call(this,this._onDataUpdate))},_setOption:function(e,i){
"datasource"===e?this._updateDatasource(i):t.Widget.prototype._setOption.apply(this,arguments)},_createItemContent:function(t){if(this.options.template){var e=this.options.template.html();return Mustache.parse(e),Mustache.render(e,t)}return this.options.content.call(this,t)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puidatascroller",{options:{header:null,buffer:.9,chunkSize:10,datasource:null,lazy:!1,content:null,template:null,mode:"document",loader:null,scrollHeight:null,totalSize:null},_create:function(){if(this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this.element.addClass("ui-datascroller ui-widget"),this.options.header&&(this.header=this.element.append('<div class="ui-datascroller-header ui-widget-header ui-corner-top">'+this.options.header+"</div>").children(".ui-datascroller-header")),this.content=this.element.append('<div class="ui-datascroller-content ui-widget-content ui-corner-bottom"></div>').children(".ui-datascroller-content"),this.list=this.content.append('<ul class="ui-datascroller-list"></ul>').children(".ui-datascroller-list"),this.loaderContainer=this.content.append('<div class="ui-datascroller-loader"></div>').children(".ui-datascroller-loader"),this.loadStatus=t('<div class="ui-datascroller-loading"></div>'),this.loading=!1,this.allLoaded=!1,this.offset=0,"self"===this.options.mode&&(this.element.addClass("ui-datascroller-inline"),this.options.scrollHeight&&this.content.css("height",this.options.scrollHeight)),this.options.loader?this.bindManualLoader():this.bindScrollListener(),this.options.datasource)if(t.isArray(this.options.datasource))this._onDataInit(this.options.datasource);else{if("string"===t.type(this.options.datasource)){var e=this,i=this.options.datasource;this.options.datasource=function(){t.ajax({type:"GET",url:i,dataType:"json",context:e,success:function(t){this._onDataInit(t)}})}}"function"===t.type(this.options.datasource)&&(this.options.lazy?this.options.datasource.call(this,this._onLazyLoad,{first:this.offset}):this.options.datasource.call(this,this._onDataInit))}},_onDataInit:function(t){this.data=t||[],this.options.totalSize=this.data.length,this._load()},_onLazyLoad:function(t){this._renderData(t,0,this.options.chunkSize),this._onloadComplete()},bindScrollListener:function(){var e=this;if("document"===this.options.mode){var i=t(window),s=t(document),e=this,n="scroll."+this.id;i.off(n).on(n,function(){i.scrollTop()>=s.height()*e.options.buffer-i.height()&&e.shouldLoad()&&e._load()})}else this.content.on("scroll",function(){var t=this.scrollTop,i=this.scrollHeight,s=this.clientHeight;t>=i*e.options.buffer-s&&e.shouldLoad()&&e._load()})},bindManualLoader:function(){var t=this;this.options.loader.on("click.dataScroller",function(e){t._load(),e.preventDefault()})},_load:function(){this.loading=!0,this.loadStatus.appendTo(this.loaderContainer),this.options.loader&&this.options.loader.hide(),this.options.lazy?this.options.datasource.call(this,this._onLazyLoad,{first:this.offset}):(this._renderData(this.data,this.offset,this.offset+this.options.chunkSize),this._onloadComplete())},_renderData:function(e,i,s){if(e&&e.length)for(var n=i;s>n;n++){var o=t('<li class="ui-datascroller-item"></li>'),a=this._createItemContent(e[n]);o.append(a),this.list.append(o)}},shouldLoad:function(){return!this.loading&&!this.allLoaded},_createItemContent:function(t){if(this.options.template){var e=this.options.template.html();return Mustache.parse(e),Mustache.render(e,t)}return this.options.content.call(this,t)},_onloadComplete:function(){this.offset+=this.options.chunkSize,this.loading=!1,this.allLoaded=this.offset>=this.options.totalSize,this.loadStatus.remove(),this.options.loader&&!this.allLoaded&&this.options.loader.show()}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puidatatable",{options:{columns:null,datasource:null,paginator:null,globalFilter:null,selectionMode:null,caption:null,footer:null,sortField:null,sortOrder:1,sortMeta:[],sortMode:null,scrollable:!1,scrollHeight:null,scrollWidth:null,responsive:!1,expandableRows:!1,expandedRowContent:null,rowExpandMode:"multiple",draggableColumns:!1,resizableColumns:!1,columnResizeMode:"fit",draggableRows:!1,filterDelay:300,stickyHeader:!1,editMode:null,tabindex:0,emptyMessage:"No records found",sort:null,rowSelect:null,rowUnselect:null,rowSelectContextMenu:null,rowCollapse:null,rowExpand:null,colReorder:null,colResize:null,rowReorder:null,cellEdit:null},_create:function(){if(this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this.element.addClass("ui-datatable ui-widget"),this.options.responsive&&this.element.addClass("ui-datatable-reflow"),this.options.scrollable?this._createScrollableDatatable():this._createRegularDatatable(),this.options.datasource)if(t.isArray(this.options.datasource))this._onDataInit(this.options.datasource);else{if("string"===t.type(this.options.datasource)){var e=this,i=this.options.datasource;this.options.datasource=function(){t.ajax({type:"GET",url:i,dataType:"json",context:e,success:function(t){this._onDataInit(t)}})}}"function"===t.type(this.options.datasource)&&(this.options.lazy?this.options.datasource.call(this,this._onDataInit,{first:0,rows:this._getRows(),sortField:this.options.sortField,sortOrder:this.options.sortOrder,filters:this._createFilterMap()}):this.options.datasource.call(this,this._onDataInit))}},_createRegularDatatable:function(){this.tableWrapper=t('<div class="ui-datatable-tablewrapper" />').appendTo(this.element),this.table=t("<table><thead></thead><tbody></tbody></table>").appendTo(this.tableWrapper),this.thead=this.table.children("thead"),this.tbody=this.table.children("tbody").addClass("ui-datatable-data ui-widget-content"),this.containsFooter()&&(this.tfoot=this.thead.after("<tfoot></tfoot>").next())},_createScrollableDatatable:function(){this.element.append('<div class="ui-widget-header ui-datatable-scrollable-header"><div class="ui-datatable-scrollable-header-box"><table><thead></thead></table></div></div>').append('<div class="ui-datatable-scrollable-body"><table><tbody></tbody></table></div>'),this.thead=this.element.find("> .ui-datatable-scrollable-header > .ui-datatable-scrollable-header-box > table > thead"),this.tbody=this.element.find("> .ui-datatable-scrollable-body > table > tbody"),this.containsFooter()&&(this.element.append('<div class="ui-widget-header ui-datatable-scrollable-footer"><div class="ui-datatable-scrollable-footer-box"><table><tfoot></tfoot></table></div></div>'),this.tfoot=this.element.find("> .ui-datatable-scrollable-footer > .ui-datatable-scrollable-footer-box > table > tfoot"))},_initialize:function(){var e=this;this._initHeader(),this._initFooter(),this.options.caption&&this.element.prepend('<div class="ui-datatable-header ui-widget-header">'+this.options.caption+"</div>"),this.options.paginator&&(this.options.paginator.paginate=function(t,i){e.paginate()},this.options.paginator.totalRecords=this.options.lazy?this.options.paginator.totalRecords:this.data.length,this.paginator=t("<div></div>").insertAfter(this.tableWrapper).puipaginator(this.options.paginator),this.options.paginator.contentLeft&&this.paginator.prepend(this.options.paginator.contentLeft.call()),this.options.paginator.contentRight&&this.paginator.append(this.options.paginator.contentRight.call())),this.options.footer&&this.element.append('<div class="ui-datatable-footer ui-widget-header">'+this.options.footer+"</div>"),this._isSortingEnabled()&&this._initSorting(),this.hasFiltering&&this._initFiltering(),this.options.selectionMode&&this._initSelection(),this.options.expandableRows&&this._initExpandableRows(),this.options.draggableColumns&&this._initDraggableColumns(),this.options.stickyHeader&&this._initStickyHeader(),this.options.sortField&&this.options.sortOrder||this.options.sortMeta.length?this.sortByDefault():this._renderData(),this.options.scrollable&&this._initScrolling(),this.options.resizableColumns&&this._initResizableColumns(),this.options.draggableRows&&this._initDraggableRows(),this.options.editMode&&this._initEditing()},_initHeader:function(){if(this.options.headerRows)for(var t=0;t<this.options.headerRows.length;t++)this._initHeaderColumns(this.options.headerRows[t].columns);else this.options.columns&&this._initHeaderColumns(this.options.columns)},_initFooter:function(){if(this.containsFooter())if(this.options.footerRows)for(var t=0;t<this.options.footerRows.length;t++)this._initFooterColumns(this.options.footerRows[t].columns);else this.options.columns&&this._initFooterColumns(this.options.columns)},_initHeaderColumns:function(e){var i=t('<tr class="ui-state-default"></tr>').appendTo(this.thead),s=this;t.each(e,function(e,n){var o=t('<th class="ui-state-default"><span class="ui-column-title"></span></th>').data("field",n.field).uniqueId().appendTo(i);if(n.headerClass&&o.addClass(n.headerClass),n.headerStyle&&o.attr("style",n.headerStyle),n.headerText?o.children(".ui-column-title").text(n.headerText):n.headerContent&&o.children(".ui-column-title").append(n.headerContent.call(this,n)),n.rowspan&&o.attr("rowspan",n.rowspan),n.colspan&&o.attr("colspan",n.colspan),n.sortable&&o.addClass("ui-sortable-column").data("order",0).append('<span class="ui-sortable-column-icon fa fa-fw fa-sort"></span>'),n.filter){s.hasFiltering=!0;var a=t('<input type="text" class="ui-column-filter" />').puiinputtext().data({field:n.field,filtermatchmode:n.filterMatchMode||"startsWith"}).appendTo(o);n.filterFunction&&a.on("filter",function(t,e,i){return n.filterFunction.call(s,e,i)})}})},_initFooterColumns:function(e){var i=t("<tr></tr>").appendTo(this.tfoot);t.each(e,function(e,s){var n=t('<td class="ui-state-default"></td>');s.footerText&&n.text(s.footerText),s.rowspan&&n.attr("rowspan",s.rowspan),s.colspan&&n.attr("colspan",s.colspan),n.appendTo(i)})},_indicateInitialSortColumn:function(e,i){t.each(this.sortableColumns,function(s,n){var o=t(n),a=o.data();if(e===a.field){var l=o.children(".ui-sortable-column-icon");o.data("order",i).removeClass("ui-state-hover").addClass("ui-state-active"),-1==i?l.removeClass("fa-sort fa-sort-asc").addClass("fa-sort-desc"):1==i&&l.removeClass("fa-sort fa-sort-desc").addClass("fa-sort-asc")}})},_indicateInitialSortColumns:function(){for(var t=0;t<this.options.sortMeta.length;t++){var e=this.options.sortMeta[t];this._indicateInitialSortColumn(e.field,e.order)}},_onDataInit:function(t){this.data=t,this.data||(this.data=[]),this._initialize()},_onDataUpdate:function(t){this.data=t,this.data||(this.data=[]),this.reset(),this._renderData()},_onLazyLoad:function(t){this.data=t,this.data||(this.data=[]),this._renderData()},reset:function(){this.options.selectionMode&&(this.selection=[]),this.paginator&&this.paginator.puipaginator("setState",{page:0,totalRecords:this.options.lazy?this.options.paginator.totalRecords:this.data.length}),this.thead.find("> tr > th.ui-sortable-column").data("order",0).filter(".ui-state-active").removeClass("ui-state-active").children("span.ui-sortable-column-icon").removeClass("fa-sort-asc fa-sort-desc").addClass("fa-sort")},_isMultiSort:function(){return"multiple"===this.options.sortMode},_resetSortState:function(t){this.sortableColumns.filter(".ui-state-active").data("order",0).removeClass("ui-state-active").children("span.ui-sortable-column-icon").removeClass("fa-sort-asc fa-sort-desc").addClass("fa-sort")},_initSorting:function(){var e=this;this.sortableColumns=this.thead.find("> tr > th.ui-sortable-column"),this.sortableColumns.on("mouseover.puidatatable",function(){var e=t(this);e.hasClass("ui-state-active")||e.addClass("ui-state-hover")}).on("mouseout.puidatatable",function(){var e=t(this);e.hasClass("ui-state-active")||e.removeClass("ui-state-hover")}).on("click.puidatatable",function(i){if(t(i.target).is("th,span")){var s=t(this),n=s.data("field"),o=s.data("order"),a=0===o?1:-1*o,l=s.children(".ui-sortable-column-icon"),r=i.metaKey||i.ctrlKey;e._isMultiSort()?r?(e._addSortMeta({field:n,order:a}),e.sort()):(e.options.sortMeta=[],e._addSortMeta({field:n,order:a}),e._resetSortState(s),e.sort()):(e.options.sortField=n,e.options.sortOrder=a,e._resetSortState(s),e.sort()),s.data("order",a).removeClass("ui-state-hover").addClass("ui-state-active"),-1===a?l.removeClass("fa-sort fa-sort-asc").addClass("fa-sort-desc"):1===a&&l.removeClass("fa-sort fa-sort-desc").addClass("fa-sort-asc"),e._trigger("sort",i,{sortOrder:a,sortField:n})}})},_addSortMeta:function(t){for(var e=-1,i=0;i<this.options.sortMeta.length;i++)this.options.sortMeta[i].field===t.field&&(e=i);e>=0?this.options.sortMeta[e]=t:this.options.sortMeta.push(t)},paginate:function(){this.options.lazy?this.options.datasource.call(this,this._onLazyLoad,this._createStateMeta()):this._renderData()},_multipleSort:function(){function t(e,i,s,n){var o=e[s[n].field],a=i[s[n].field],l=null;if("string"==typeof o||o instanceof String){if(o.localeCompare&&o!=a)return s[n].order*o.localeCompare(a)}else l=a>o?-1:1;return o==a?s.length-1>n?t(e,i,s,n+1):0:s[n].order*l}var e=this;this.data.sort(function(i,s){return t(i,s,e.options.sortMeta,0)}),this._renderData()},sort:function(){this.options.lazy?this.options.datasource.call(this,this._onLazyLoad,this._createStateMeta()):this._isMultiSort()?this._multipleSort():this._singleSort()},_singleSort:function(){var t=this;this.data.sort(function(e,i){var s=e[t.options.sortField],n=i[t.options.sortField],o=null;if("string"==typeof s||s instanceof String){if(s.localeCompare)return t.options.sortOrder*s.localeCompare(n);s.toLowerCase&&(s=s.toLowerCase()),n.toLowerCase&&(n=n.toLowerCase()),o=n>s?-1:s>n?1:0}else o=n>s?-1:s>n?1:0;return t.options.sortOrder*o}),this.paginator&&this.paginator.puipaginator("option","page",0),this._renderData()},sortByField:function(t,e){var i=t.name.toLowerCase(),s=e.name.toLowerCase();return s>i?-1:i>s?1:0},sortByDefault:function(){this._isMultiSort()?this.options.sortMeta&&(this._indicateInitialSortColumns(),this.sort()):(this._indicateInitialSortColumn(this.options.sortField,this.options.sortOrder),this.sort())},_renderData:function(){this.tbody.html("");var e=this.filteredData||this.data;if(e&&e.length)for(var i=this._getFirst(),s=this.options.lazy?0:i,n=this._getRows(),o=s;s+n>o;o++){var a=e[o];if(a){var l=t('<tr class="ui-widget-content" />').appendTo(this.tbody),r=o%2===0?"ui-datatable-even":"ui-datatable-odd";l.addClass(r),l.data("rowdata",a),this.options.selectionMode&&this._isSelected(a)&&l.addClass("ui-state-highlight");for(var h=0;h<this.options.columns.length;h++){var u=t("<td />").appendTo(l),d=this.options.columns[h];if(d.bodyClass&&u.addClass(d.bodyClass),d.bodyStyle&&u.attr("style",d.bodyStyle),d.editor&&u.addClass("ui-editable-column").data({editor:d.editor,rowdata:a,field:d.field}),d.content){var c=d.content.call(this,a,d);"string"===t.type(c)?u.html(c):u.append(c)}else d.rowToggler?u.append('<div class="ui-row-toggler fa fa-fw fa-chevron-circle-right ui-c"></div>'):d.field&&u.text(a[d.field]);this.options.responsive&&d.headerText&&u.prepend('<span class="ui-column-title">'+d.headerText+"</span>")}}}else{var p=t('<tr class="ui-widget-content"></tr>').appendTo(this.tbody),f=t("<td></td>").attr("colspan",this.options.columns.length).appendTo(p);f.html(this.options.emptyMessage)}},_getFirst:function(){if(this.paginator){var t=this.paginator.puipaginator("option","page"),e=this.paginator.puipaginator("option","rows");return t*e}return 0},_getRows:function(){return this.paginator?this.paginator.puipaginator("option","rows"):this.data?this.data.length:0},_isSortingEnabled:function(){var t=this.options.columns;if(t)for(var e=0;e<t.length;e++)if(t[e].sortable)return!0;return!1},_initSelection:function(){var e=this;this.selection=[],this.rowSelector="> tr.ui-widget-content:not(.ui-datatable-empty-message,.ui-datatable-unselectable)",this._isMultipleSelection()&&(this.originRowIndex=0,this.cursorIndex=null),this.tbody.off("mouseover.puidatatable mouseout.puidatatable mousedown.puidatatable click.puidatatable",this.rowSelector).on("mouseover.datatable",this.rowSelector,null,function(){var e=t(this);e.hasClass("ui-state-highlight")||e.addClass("ui-state-hover")}).on("mouseout.datatable",this.rowSelector,null,function(){var e=t(this);e.hasClass("ui-state-highlight")||e.removeClass("ui-state-hover")}).on("mousedown.datatable",this.rowSelector,null,function(){e.mousedownOnRow=!0}).on("click.datatable",this.rowSelector,null,function(t){e._onRowClick(t,this),e.mousedownOnRow=!1}),this._bindSelectionKeyEvents()},_onRowClick:function(e,i){if(!t(e.target).is(":input,:button,a,.ui-c")){var s=t(i),n=s.hasClass("ui-state-highlight"),o=e.metaKey||e.ctrlKey,a=e.shiftKey;if(this.focusedRow=s,n&&o)this.unselectRow(s);else{if(this._isSingleSelection()||this._isMultipleSelection()&&!o&&!a){if(this._isMultipleSelection())for(var l=this.getSelection(),r=0;r<l.length;r++)this._trigger("rowUnselect",null,l[r]);this.unselectAllRows()}this.selectRow(s,!1,e)}PUI.clearSelection()}},onRowRightClick:function(e,i){var s=t(i),n=s.data("rowdata"),o=s.hasClass("ui-state-highlight");!this._isSingleSelection()&&o||this.unselectAllRows(),this.selectRow(s,!0),this.dataSelectedByContextMenu=n,this._trigger("rowSelectContextMenu",e,n),PUI.clearSelection()},_bindSelectionKeyEvents:function(){var e=this;this.tbody.attr("tabindex",this.options.tabindex).on("focus",function(t){e.mousedownOnRow||(e.focusedRow=e.tbody.children("tr.ui-widget-content").eq(0),e.focusedRow.addClass("ui-state-hover"))}).on("blur",function(){e.focusedRow&&(e.focusedRow.removeClass("ui-state-hover"),e.focusedRow=null)}).on("keydown",function(i){var s=t.ui.keyCode,n=i.which;if(e.focusedRow)switch(n){case s.UP:var o=e.focusedRow.prev("tr.ui-widget-content");o.length&&(e.focusedRow.removeClass("ui-state-hover"),e.focusedRow=o,e.focusedRow.addClass("ui-state-hover")),i.preventDefault();break;case s.DOWN:var a=e.focusedRow.next("tr.ui-widget-content");a.length&&(e.focusedRow.removeClass("ui-state-hover"),e.focusedRow=a,e.focusedRow.addClass("ui-state-hover")),i.preventDefault();break;case s.ENTER:case s.NUMPAD_ENTER:case s.SPACE:i.target=e.focusedRow.children().eq(0).get(0),e._onRowClick(i,e.focusedRow.get(0)),i.preventDefault()}})},_isSingleSelection:function(){return"single"===this.options.selectionMode},_isMultipleSelection:function(){return"multiple"===this.options.selectionMode},unselectAllRows:function(){this.tbody.children("tr.ui-state-highlight").removeClass("ui-state-highlight").attr("aria-selected",!1),this.selection=[]},unselectRow:function(t,e){var i=t.data("rowdata");t.removeClass("ui-state-highlight").attr("aria-selected",!1),this._removeSelection(i),e||this._trigger("rowUnselect",null,i)},selectRow:function(t,e,i){var s=t.data("rowdata");t.removeClass("ui-state-hover").addClass("ui-state-highlight").attr("aria-selected",!0),this._addSelection(s),e||this._trigger("rowSelect",i,s)},getSelection:function(){return this.selection},_removeSelection:function(e){this.selection=t.grep(this.selection,function(t){return t!==e})},_addSelection:function(t){this._isSelected(t)||this.selection.push(t)},_isSelected:function(t){return PUI.inArray(this.selection,t)},_initExpandableRows:function(){var e=this,i="> tr > td > div.ui-row-toggler";this.tbody.off("click",i).on("click",i,null,function(){e.toggleExpansion(t(this))}).on("keydown",i,null,function(i){var s=i.which,n=t.ui.keyCode;s!==n.ENTER&&s!==n.NUMPAD_ENTER||(e.toggleExpansion(t(this)),i.preventDefault())})},toggleExpansion:function(t){var e=t.closest("tr"),i=t.hasClass("fa-chevron-circle-down");i?(t.addClass("fa-chevron-circle-right").removeClass("fa-chevron-circle-down").attr("aria-expanded",!1),this.collapseRow(e),this._trigger("rowCollapse",null,e.data("rowdata"))):("single"===this.options.rowExpandMode&&this.collapseAllRows(),t.addClass("fa-chevron-circle-down").removeClass("fa-chevron-circle-right").attr("aria-expanded",!0),this.loadExpandedRowContent(e))},loadExpandedRowContent:function(e){var i=t('<tr class="ui-expanded-row-content ui-datatable-unselectable ui-widget-content"><td colspan="'+this.options.columns.length+'"></td></tr>');i.children("td").append(this.options.expandedRowContent.call(this,e.data("rowdata"))),e.addClass("ui-expanded-row").after(i),this._trigger("rowExpand",null,e.data("rowdata"))},collapseRow:function(t){t.removeClass("ui-expanded-row").next(".ui-expanded-row-content").remove()},collapseAllRows:function(){var e=this;this.getExpandedRows().each(function(){var i=t(this);e.collapseRow(i);for(var s=i.children("td"),n=0;n<s.length;n++){var o=s.eq(n),a=o.children(".ui-row-toggler");a.length&&a.addClass("fa-chevron-circle-right").removeClass("fa-chevron-circle-down")}})},getExpandedRows:function(){return this.tbody.children(".ui-expanded-row")},_createStateMeta:function(){var t={first:this._getFirst(),rows:this._getRows(),sortField:this.options.sortField,sortOrder:this.options.sortOrder,sortMeta:this.options.sortMeta,filters:this.filterMetaMap};return t},_updateDatasource:function(e){this.options.datasource=e,t.isArray(this.options.datasource)?this._onDataUpdate(this.options.datasource):"function"===t.type(this.options.datasource)&&(this.options.lazy?this.options.datasource.call(this,this._onDataUpdate,{first:0,rows:this._getRows(),sortField:this.options.sortField,sortorder:this.options.sortOrder,filters:this._createFilterMap()}):this.options.datasource.call(this,this._onDataUpdate))},_setOption:function(e,i){"datasource"===e?this._updateDatasource(i):t.Widget.prototype._setOption.apply(this,arguments)},_initScrolling:function(){this.scrollHeader=this.element.children(".ui-datatable-scrollable-header"),this.scrollBody=this.element.children(".ui-datatable-scrollable-body"),this.scrollFooter=this.element.children(".ui-datatable-scrollable-footer"),this.scrollHeaderBox=this.scrollHeader.children(".ui-datatable-scrollable-header-box"),this.headerTable=this.scrollHeaderBox.children("table"),this.bodyTable=this.scrollBody.children("table"),this.percentageScrollHeight=this.options.scrollHeight&&-1!==this.options.scrollHeight.indexOf("%"),this.percentageScrollWidth=this.options.scrollWidth&&-1!==this.options.scrollWidth.indexOf("%");var e=this,i=this.getScrollbarWidth()+"px";this.options.scrollHeight&&(this.percentageScrollHeight?this.adjustScrollHeight():this.scrollBody.css("max-height",this.options.scrollHeight+"px"),this.hasVerticalOverflow()&&this.scrollHeaderBox.css("margin-right",i)),this.fixColumnWidths(),this.options.scrollWidth&&(this.percentageScrollWidth?this.adjustScrollWidth():this.setScrollWidth(parseInt(this.options.scrollWidth))),this.cloneHead(),this.scrollBody.on("scroll.dataTable",function(){var t=e.scrollBody.scrollLeft();e.scrollHeaderBox.css("margin-left",-t)}),this.scrollHeader.on("scroll.dataTable",function(){e.scrollHeader.scrollLeft(0)});var s="resize."+this.id;t(window).off(s).on(s,function(){e.element.is(":visible")&&(e.percentageScrollHeight&&e.adjustScrollHeight(),e.percentageScrollWidth&&e.adjustScrollWidth())})},cloneHead:function(){if(this.theadClone=this.thead.clone(),this.theadClone.find("th").each(function(){var e=t(this);e.attr("id",e.attr("id")+"_clone"),t(this).children().not(".ui-column-title").remove()}),this.theadClone.removeAttr("id").addClass("ui-datatable-scrollable-theadclone").height(0).prependTo(this.bodyTable),this.options.scrollWidth){var e=this.theadClone.find("> tr > th.ui-sortable-column");e.each(function(){t(this).data("original",t(this).attr("id").split("_clone")[0])}),e.on("blur.dataTable",function(){t(PUI.escapeClientId(t(this).data("original"))).removeClass("ui-state-focus")}).on("focus.dataTable",function(){t(PUI.escapeClientId(t(this).data("original"))).addClass("ui-state-focus")}).on("keydown.dataTable",function(e){var i=e.which,s=t.ui.keyCode;i!==s.ENTER&&i!==s.NUMPAD_ENTER||!t(e.target).is(":not(:input)")||(t(PUI.escapeClientId(t(this).data("original"))).trigger("click.dataTable",e.metaKey||e.ctrlKey),e.preventDefault())})}},adjustScrollHeight:function(){var t=this.element.parent().innerHeight()*(parseInt(this.options.scrollHeight)/100),e=this.element.children(".ui-datatable-header").outerHeight(!0),i=this.element.children(".ui-datatable-footer").outerHeight(!0),s=this.scrollHeader.outerHeight(!0)+this.scrollFooter.outerHeight(!0),n=this.paginator?this.paginator.getContainerHeight(!0):0,o=t-(s+n+e+i);this.scrollBody.css("max-height",o+"px")},adjustScrollWidth:function(){var t=parseInt(this.element.parent().innerWidth()*(parseInt(this.options.scrollWidth)/100));this.setScrollWidth(t)},setOuterWidth:function(t,e){var i=t.outerWidth()-t.width();t.width(e-i)},setScrollWidth:function(e){var i=this;this.element.children(".ui-widget-header").each(function(){i.setOuterWidth(t(this),e)}),this.scrollHeader.width(e),this.scrollBody.css("margin-right",0).width(e)},alignScrollBody:function(){var t=this.hasVerticalOverflow()?this.getScrollbarWidth()+"px":"0px";this.scrollHeaderBox.css("margin-right",t)},getScrollbarWidth:function(){return this.scrollbarWidth||(this.scrollbarWidth=PUI.browser.webkit?"15":PUI.calculateScrollbarWidth()),this.scrollbarWidth},hasVerticalOverflow:function(){return this.options.scrollHeight&&this.bodyTable.outerHeight()>this.scrollBody.outerHeight()},restoreScrollState:function(){var t=this.scrollStateHolder.val(),e=t.split(",");this.scrollBody.scrollLeft(e[0]),this.scrollBody.scrollTop(e[1])},saveScrollState:function(){var t=this.scrollBody.scrollLeft()+","+this.scrollBody.scrollTop();this.scrollStateHolder.val(t)},clearScrollState:function(){this.scrollStateHolder.val("0,0")},fixColumnWidths:function(){this.columnWidthsFixed||(this.options.scrollable?this.scrollHeaderBox.find("> table > thead > tr > th").each(function(){var e=t(this),i=e.width();e.width(i)}):this.element.find("> .ui-datatable-tablewrapper > table > thead > tr > th").each(function(){var e=t(this);e.width(e.width())}),this.columnWidthsFixed=!0)},_initDraggableColumns:function(){var e=this;this.dragIndicatorTop=t('<span class="fa fa-arrow-down" style="position:absolute"/></span>').hide().appendTo(this.element),this.dragIndicatorBottom=t('<span class="fa fa-arrow-up" style="position:absolute"/></span>').hide().appendTo(this.element),this.thead.find("> tr > th").draggable({appendTo:"body",opacity:.75,cursor:"move",scope:this.id,cancel:":input,.ui-column-resizer",drag:function(t,i){var s=i.helper.data("droppable-column");if(s){var n=s.offset(),o=n.top-10,a=n.top+s.height()+8,l=null;if(t.originalEvent.pageX>=n.left+s.width()/2){var r=s.next();l=1==r.length?r.offset().left-9:s.offset().left+s.innerWidth()-9,i.helper.data("drop-location",1)}else l=n.left-9,i.helper.data("drop-location",-1);e.dragIndicatorTop.offset({left:l,top:o-3}).show(),e.dragIndicatorBottom.offset({left:l,top:a-3}).show()}},stop:function(t,i){e.dragIndicatorTop.css({left:0,top:0}).hide(),e.dragIndicatorBottom.css({left:0,top:0}).hide()},helper:function(){var e=t(this),i=t('<div class="ui-widget ui-state-default" style="padding:4px 10px;text-align:center;"></div>');return i.width(e.width()),i.height(e.height()),i.html(e.html()),i.get(0)}}).droppable({hoverClass:"ui-state-highlight",tolerance:"pointer",scope:this.id,over:function(e,i){i.helper.data("droppable-column",t(this))},drop:function(i,s){var n=s.draggable,o=s.helper.data("drop-location"),a=t(this),l=null,r=null,h=e.tbody.find("> tr:not(.ui-expanded-row-content) > td:nth-child("+(n.index()+1)+")"),u=e.tbody.find("> tr:not(.ui-expanded-row-content) > td:nth-child("+(a.index()+1)+")");if(e.containsFooter())var d=e.tfoot.find("> tr > td"),l=d.eq(n.index()),r=d.eq(a.index());if(o>0){if(n.insertAfter(a),h.each(function(e,i){t(this).insertAfter(u.eq(e))}),l&&r&&l.insertAfter(r),e.options.scrollable){var c=t(document.getElementById(n.attr("id")+"_clone")),p=t(document.getElementById(a.attr("id")+"_clone"));c.insertAfter(p)}}else if(n.insertBefore(a),h.each(function(e,i){t(this).insertBefore(u.eq(e))}),l&&r&&l.insertBefore(r),e.options.scrollable){var c=t(document.getElementById(n.attr("id")+"_clone")),p=t(document.getElementById(a.attr("id")+"_clone"));c.insertBefore(p)}e._trigger("colReorder",null,{dragIndex:n.index(),dropIndex:a.index()})}})},containsFooter:function(){if(void 0===this.hasFooter&&(this.hasFooter=void 0!==this.options.footerRows,!this.hasFooter&&this.options.columns))for(var t=0;t<this.options.columns.length;t++)if(void 0!==this.options.columns[t].footerText){this.hasFooter=!0;break}return this.hasFooter},_initResizableColumns:function(){this.element.addClass("ui-datatable-resizable"),this.thead.find("> tr > th").addClass("ui-resizable-column"),this.resizerHelper=t('<div class="ui-column-resizer-helper ui-state-highlight"></div>').appendTo(this.element),this.addResizers();var e=this.thead.find("> tr > th > span.ui-column-resizer"),i=this;setTimeout(function(){i.fixColumnWidths()},5),e.draggable({axis:"x",start:function(t,e){e.helper.data("originalposition",e.helper.offset());var s=i.options.stickyHeader?i.clone:i.thead,n=i.options.scrollable?i.scrollBody.height():s.parent().height()-s.height()-1;i.options.stickyHeader&&(n-=i.relativeHeight),i.resizerHelper.height(n),i.resizerHelper.show()},drag:function(t,e){i.resizerHelper.offset({left:e.helper.offset().left+e.helper.width()/2,top:i.thead.offset().top+i.thead.height()})},stop:function(t,e){e.helper.css({left:"",top:"0px",right:"0px"}),i.resize(t,e),i.resizerHelper.hide(),"expand"===i.options.columnResizeMode?setTimeout(function(){i._trigger("colResize",null,{element:e.helper.parent()})},5):i._trigger("colResize",null,{element:e.helper.parent()}),i.options.stickyHeader&&i.reclone()},containment:this.element})},resize:function(t,e){var i,s,n=null,o=null,a=null,l="expand"===this.options.columnResizeMode,r=this.thead.parent(),i=e.helper.parent(),s=i.next();if(n=e.position.left-e.originalPosition.left,o=i.width()+n,a=s.width()-n,(o>15&&a>15||l&&o>15)&&(l?(r.width(r.width()+n),setTimeout(function(){i.width(o)},1)):(i.width(o),s.width(a)),this.options.scrollable)){var h=this.theadClone.parent(),u=i.index();if(l){var d=this;h.width(h.width()+n),this.footerTable.width(this.footerTable.width()+n),setTimeout(function(){d.hasColumnGroup?(d.theadClone.find("> tr:first").children("th").eq(u).width(o),d.footerTable.find("> tfoot > tr:first").children("th").eq(u).width(o)):(d.theadClone.find(PUI.escapeClientId(i.attr("id")+"_clone")).width(o),d.footerCols.eq(u).width(o))},1)}else this.theadClone.find(PUI.escapeClientId(i.attr("id")+"_clone")).width(o),this.theadClone.find(PUI.escapeClientId(s.attr("id")+"_clone")).width(a)}},addResizers:function(){var t=this.thead.find("> tr > th.ui-resizable-column");t.prepend('<span class="ui-column-resizer"> </span>'),"fit"===this.options.columnResizeMode&&t.filter(":last-child").children("span.ui-column-resizer").hide()},_initDraggableRows:function(){var e=this;this.tbody.sortable({placeholder:"ui-datatable-rowordering ui-state-active",cursor:"move",handle:"td,span:not(.ui-c)",appendTo:document.body,helper:function(e,i){for(var s=i.children(),n=t('<div class="ui-datatable ui-widget"><table><tbody></tbody></table></div>'),o=i.clone(),a=o.children(),l=0;l<a.length;l++)a.eq(l).width(s.eq(l).width());return o.appendTo(n.find("tbody")),n},update:function(t,i){e.syncRowParity(),e._trigger("rowReorder",null,{fromIndex:i.item.data("ri"),toIndex:e._getFirst()+i.item.index()})},change:function(t,i){e.options.scrollable&&PUI.scrollInView(e.scrollBody,i.placeholder)}})},syncRowParity:function(){for(var t=this.tbody.children("tr.ui-widget-content"),e=this._getFirst();e<t.length;e++){var i=t.eq(e);i.data("ri",e).removeClass("ui-datatable-even ui-datatable-odd"),e%2===0?i.addClass("ui-datatable-even"):i.addClass("ui-datatable-odd")}},getContextMenuSelection:function(t){return this.dataSelectedByContextMenu;
},_initFiltering:function(){var e=this;this.filterElements=this.thead.find(".ui-column-filter"),this.filterElements.on("keyup",function(){e.filterTimeout&&clearTimeout(e.filterTimeout),e.filterTimeout=setTimeout(function(){e.filter(),e.filterTimeout=null},e.options.filterDelay)}),this.options.globalFilter&&t(this.options.globalFilter).on("keyup.puidatatable",function(){e.filter()})},filter:function(){this.filterMetaMap=[];for(var e=0;e<this.filterElements.length;e++){var i=this.filterElements.eq(e),s=i.val();this.filterMetaMap.push({field:i.data("field"),filterMatchMode:i.data("filtermatchmode"),value:s.toLowerCase(),element:i})}if(this.options.lazy)this.options.datasource.call(this,this._onLazyLoad,this._createStateMeta());else{var n=t(this.options.globalFilter).val();this.filteredData=[];for(var e=0;e<this.data.length;e++){for(var o=!0,a=!1,l=0;l<this.filterMetaMap.length;l++){var r=this.filterMetaMap[l],h=r.value,u=r.field,d=this.data[e][u],c=this.filterConstraints[r.filterMatchMode];if(this.options.globalFilter&&!a){var c=this.filterConstraints.contains;a=c(d,n)}if("custom"===r.filterMatchMode)o=r.element.triggerHandler("filter",[d,h]);else{var c=this.filterConstraints[r.filterMatchMode];c(d,h)||(o=!1)}if(!o)break}var p=o;this.options.globalFilter&&(p=o&&a),p&&this.filteredData.push(this.data[e])}this.filteredData.length===this.data.length&&(this.filteredData=null),this.paginator&&this.paginator.puipaginator("option","totalRecords",this.filteredData?this.filteredData.length:this.data?this.data.length:0),this._renderData()}},filterConstraints:{startsWith:function(e,i){return void 0===i||null===i||""===t.trim(i)?!0:void 0===e||null===e?!1:e.toString().toLowerCase().slice(0,i.length)===i},contains:function(e,i){return void 0===i||null===i||""===t.trim(i)?!0:void 0===e||null===e?!1:-1!==e.toString().toLowerCase().indexOf(i)}},_initStickyHeader:function(){var e=this.thead.parent(),i=e.offset(),s=t(window),n=this,o="scroll."+this.id,a="resize.sticky-"+this.id;this.stickyContainer=t('<div class="ui-datatable ui-datatable-sticky ui-widget"><table></table></div>'),this.clone=this.thead.clone(!1),this.stickyContainer.children("table").append(this.thead),e.prepend(this.clone),setTimeout(function(){n.stickyContainer.css({position:"absolute",width:e.outerWidth(),top:i.top,left:i.left,"z-index":++PUI.zindex})},5),this.element.prepend(this.stickyContainer),this.options.resizableColumns&&(this.relativeHeight=0),s.off(o).on(o,function(){var t=s.scrollTop(),i=e.offset();t>i.top?(n.stickyContainer.css({position:"fixed",top:"0px"}).addClass("ui-shadow ui-sticky"),n.options.resizableColumns&&(n.relativeHeight=t-i.top),t>=i.top+n.tbody.height()?n.stickyContainer.hide():n.stickyContainer.show()):(n.stickyContainer.css({position:"absolute",top:i.top}).removeClass("ui-shadow ui-sticky"),n.stickyContainer.is(":hidden")&&n.stickyContainer.show(),n.options.resizableColumns&&(n.relativeHeight=0))}).off(a).on(a,function(){n.stickyContainer.width(e.outerWidth())}),this.clone.find(".ui-column-filter").prop("disabled",!0)},_initEditing:function(){var e="> tr > td.ui-editable-column",i=this;this.tbody.off("click",e).on("click",e,null,function(e){var s=t(this);s.hasClass("ui-cell-editing")||(i._showCellEditor(s),e.stopPropagation())})},_showCellEditor:function(e){var i=this.editors[e.data("editor")].call(),s=this;i.val(e.data("rowdata")[e.data("field")]),e.addClass("ui-cell-editing").html("").append(i),i.focus().on("change",function(){s._onCellEditorChange(e)}).on("blur",function(){s._onCellEditorBlur(e)}).on("keydown",function(i){var n=i.which,o=t.ui.keyCode;if(n===o.ENTER||n===o.NUMPAD_ENTER)t(this).trigger("change").trigger("blur"),i.preventDefault();else if(n===o.TAB){if(i.shiftKey){var a=e.prevAll("td.ui-editable-column").eq(0);a.length||(a=e.parent().prev("tr").children("td.ui-editable-column:last")),a.length&&s._showCellEditor(a)}else{var l=e.nextAll("td.ui-editable-column").eq(0);l.length||(l=e.parent().next("tr").children("td.ui-editable-column").eq(0)),l.length&&s._showCellEditor(l)}i.preventDefault()}else n===o.ESCAPE&&s._onCellEditorBlur(e)})},_onCellEditorChange:function(t){var e=t.children(".ui-cell-editor").val(),i=this._trigger("cellEdit",null,{oldValue:t.data("rowdata")[t.data("field")],newValue:e,data:t.data("rowdata"),field:t.data("field")});i!==!1&&(t.data("rowdata")[t.data("field")]=e)},_onCellEditorBlur:function(t){t.removeClass("ui-cell-editing").text(t.data("rowdata")[t.data("field")]).children(".ui-cell-editor").remove()},reload:function(){this._updateDatasource(this.options.datasource)},getPaginator:function(){return this.paginator},setTotalRecords:function(t){this.paginator.puipaginator("option","totalRecords",t)},_createFilterMap:function(){var e=null;if(this.filterElements){e={};for(var i=0;i<this.filterElements.length;i++){var s=this.filterElements.eq(i),n=s.val();t.trim(n).length&&(e[s.data("field")]=n)}}return e},editors:{input:function(){return t('<input type="text" class="ui-cell-editor"/>')}},reclone:function(){this.clone.remove(),this.clone=this.thead.clone(!1),this.element.find(".ui-datatable-tablewrapper > table").prepend(this.clone)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puidialog",{options:{draggable:!0,resizable:!0,location:"center",minWidth:150,minHeight:25,height:"auto",width:"300px",visible:!1,modal:!1,showEffect:null,hideEffect:null,effectOptions:{},effectSpeed:"normal",closeOnEscape:!0,rtl:!1,closable:!0,minimizable:!1,maximizable:!1,appendTo:null,buttons:null,responsive:!1,title:null,enhanced:!1},_create:function(){if(this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),!this.options.enhanced){this.element.addClass("ui-dialog ui-widget ui-widget-content ui-helper-hidden ui-corner-all ui-shadow").contents().wrapAll('<div class="ui-dialog-content ui-widget-content" />');var e=this.options.title||this.element.attr("title");if(this.element.prepend('<div class="ui-dialog-titlebar ui-widget-header ui-helper-clearfix ui-corner-top"><span id="'+this.element.attr("id")+'_label" class="ui-dialog-title">'+e+"</span>").removeAttr("title"),this.options.buttons){this.footer=t('<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"></div>').appendTo(this.element);for(var i=0;i<this.options.buttons.length;i++){var s=this.options.buttons[i],n=t('<button type="button"></button>').appendTo(this.footer);s.text&&n.text(s.text),n.puibutton(s)}}this.options.rtl&&this.element.addClass("ui-dialog-rtl")}this.content=this.element.children(".ui-dialog-content"),this.titlebar=this.element.children(".ui-dialog-titlebar"),this.options.enhanced||(this.options.closable&&this._renderHeaderIcon("ui-dialog-titlebar-close","fa-close"),this.options.maximizable&&this._renderHeaderIcon("ui-dialog-titlebar-maximize","fa-sort"),this.options.minimizable&&this._renderHeaderIcon("ui-dialog-titlebar-minimize","fa-minus")),this.icons=this.titlebar.children(".ui-dialog-titlebar-icon"),this.closeIcon=this.titlebar.children(".ui-dialog-titlebar-close"),this.minimizeIcon=this.titlebar.children(".ui-dialog-titlebar-minimize"),this.maximizeIcon=this.titlebar.children(".ui-dialog-titlebar-maximize"),this.blockEvents="focus.puidialog mousedown.puidialog mouseup.puidialog keydown.puidialog keyup.puidialog",this.parent=this.element.parent(),this.element.css({width:this.options.width,height:"auto"}),this.content.height(this.options.height),this._bindEvents(),this.options.draggable&&this._setupDraggable(),this.options.resizable&&this._setupResizable(),this.options.appendTo&&this.element.appendTo(this.options.appendTo),this.options.responsive&&(this.resizeNS="resize."+this.id),0===t(document.body).children(".ui-dialog-docking-zone").length&&t(document.body).append('<div class="ui-dialog-docking-zone"></div>'),this._applyARIA(),this.options.visible&&this.show()},_destroy:function(){if(!this.options.enhanced){this.element.removeClass("ui-dialog ui-widget ui-widget-content ui-helper-hidden ui-corner-all ui-shadow"),this.options.buttons&&(this.footer.children("button").puibutton("destroy"),this.footer.remove()),this.options.rtl&&this.element.removeClass("ui-dialog-rtl");var t=this.titlebar.children(".ui-dialog-title").text()||this.options.title;t&&this.element.attr("title",t),this.titlebar.remove(),this.content.contents().unwrap()}this._unbindEvents(),this.options.draggable&&this.element.draggable("destroy"),this.options.resizable&&this.element.resizable("destroy"),this.options.appendTo&&this.element.appendTo(this.parent),this._unbindResizeListener(),this.options.modal&&this._disableModality(),this._removeARIA(),this.element.css({width:"auto",height:"auto"})},_renderHeaderIcon:function(t,e){this.titlebar.append('<a class="ui-dialog-titlebar-icon '+t+' ui-corner-all" href="#" role="button"><span class="fa fa-fw '+e+'"></span></a>')},_enableModality:function(){var e=this,i=t(document);this.modality=t('<div id="'+this.element.attr("id")+'_modal" class="ui-widget-overlay ui-dialog-mask"></div>').appendTo(document.body).css("z-index",this.element.css("z-index")-1),i.on("keydown.puidialog",function(i){if(i.keyCode==t.ui.keyCode.TAB){var s=e.content.find(":tabbable"),n=s.filter(":first"),o=s.filter(":last");if(i.target===o[0]&&!i.shiftKey)return n.focus(1),!1;if(i.target===n[0]&&i.shiftKey)return o.focus(1),!1}}).bind(this.blockEvents,function(i){return t(i.target).zIndex()<e.element.zIndex()?!1:void 0})},_disableModality:function(){this.modality&&(this.modality.remove(),this.modality=null),t(document).off(this.blockEvents).off("keydown.dialog")},show:function(){if(!this.element.is(":visible")){if(this.positionInitialized||this._initPosition(),this._trigger("beforeShow",null),this.options.showEffect){var t=this;this.element.show(this.options.showEffect,this.options.effectOptions,this.options.effectSpeed,function(){t._postShow()})}else this.element.show(),this._postShow();this._moveToTop(),this.options.modal&&this._enableModality()}},_postShow:function(){this._trigger("afterShow",null),this.element.attr({"aria-hidden":!1,"aria-live":"polite"}),this._applyFocus(),this.options.responsive&&this._bindResizeListener()},hide:function(){if(!this.element.is(":hidden")){if(this._trigger("beforeHide",null),this.options.hideEffect){var t=this;this.element.hide(this.options.hideEffect,this.options.effectOptions,this.options.effectSpeed,function(){t._postHide()})}else this.element.hide(),this._postHide();this.options.modal&&this._disableModality()}},_postHide:function(){this._trigger("afterHide",null),this.element.attr({"aria-hidden":!0,"aria-live":"off"}),this.options.responsive&&this._unbindResizeListener()},_applyFocus:function(){this.element.find(":not(:submit):not(:button):input:visible:enabled:first").focus()},_bindEvents:function(){var e=this;this.element.on("mousedown.puidialog",function(i){t(i.target).data("ui-widget-overlay")||e._moveToTop()}),this.icons.mouseover(function(){t(this).addClass("ui-state-hover")}).mouseout(function(){t(this).removeClass("ui-state-hover")}),this.closeIcon.on("click.puidialog",function(t){e.hide(),e._trigger("clickClose"),t.preventDefault()}),this.maximizeIcon.click(function(t){e.toggleMaximize(),t.preventDefault()}),this.minimizeIcon.click(function(t){e.toggleMinimize(),t.preventDefault()}),this.options.closeOnEscape&&t(document).on("keydown.dialog_"+this.id,function(i){var s=t.ui.keyCode,n=parseInt(e.element.css("z-index"),10)===PUI.zindex;i.which===s.ESCAPE&&e.element.is(":visible")&&n&&(e.hide(),e._trigger("hideWithEscape"))})},_unbindEvents:function(){this.element.off("mousedown.puidialog"),this.icons.off(),t(document).off("keydown.dialog_"+this.id)},_setupDraggable:function(){this.element.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document"})},_setupResizable:function(){var t=this;this.element.resizable({minWidth:this.options.minWidth,minHeight:this.options.minHeight,alsoResize:this.content,containment:"document",start:function(e,i){t.element.data("offset",t.element.offset())},stop:function(e,i){var s=t.element.data("offset");t.element.css("position","fixed"),t.element.offset(s)}}),this.resizers=this.element.children(".ui-resizable-handle")},_initPosition:function(){if(this.element.css({left:0,top:0}),/(center|left|top|right|bottom)/.test(this.options.location))this.options.location=this.options.location.replace(","," "),this.element.position({my:"center",at:this.options.location,collision:"fit",of:window,using:function(e){var i=e.left<0?0:e.left,s=e.top<0?0:e.top;t(this).css({left:i,top:s})}});else{var e=this.options.position.split(","),i=t.trim(e[0]),s=t.trim(e[1]);this.element.offset({left:i,top:s})}this.positionInitialized=!0},_moveToTop:function(){this.element.css("z-index",++PUI.zindex)},toggleMaximize:function(){if(this.minimized&&this.toggleMinimize(),this.maximized)this.element.removeClass("ui-dialog-maximized"),this._restoreState(),this.maximizeIcon.removeClass("ui-state-hover"),this.maximized=!1;else{this._saveState();var e=t(window);this.element.addClass("ui-dialog-maximized").css({width:e.width()-6,height:e.height()}).offset({top:e.scrollTop(),left:e.scrollLeft()}),this.content.css({width:"auto",height:"auto"}),this.maximizeIcon.removeClass("ui-state-hover"),this.maximized=!0,this._trigger("maximize")}},toggleMinimize:function(){var e=!0,i=t(document.body).children(".ui-dialog-docking-zone");this.maximized&&(this.toggleMaximize(),e=!1);var s=this;this.minimized?(this.element.appendTo(this.parent).removeClass("ui-dialog-minimized").css({position:"fixed","float":"none"}),this._restoreState(),this.content.show(),this.minimizeIcon.removeClass("ui-state-hover").children(".fa").removeClass("fa-plus").addClass("fa-minus"),this.minimized=!1,this.options.resizable&&this.resizers.show(),this.footer&&this.footer.show()):(this._saveState(),e?this.element.effect("transfer",{to:i,className:"ui-dialog-minimizing"},500,function(){s._dock(i),s.element.addClass("ui-dialog-minimized")}):this._dock(i))},_dock:function(t){this.element.appendTo(t).css("position","static"),this.element.css({height:"auto",width:"auto","float":"left"}),this.content.hide(),this.minimizeIcon.removeClass("ui-state-hover").children(".fa").removeClass("fa-minus").addClass("fa-plus"),this.minimized=!0,this.options.resizable&&this.resizers.hide(),this.footer&&this.footer.hide(),t.css("z-index",++PUI.zindex),this._trigger("minimize")},_saveState:function(){this.state={width:this.element.width(),height:this.element.height()};var e=t(window);this.state.offset=this.element.offset(),this.state.windowScrollLeft=e.scrollLeft(),this.state.windowScrollTop=e.scrollTop()},_restoreState:function(){this.element.width(this.state.width).height(this.state.height);var e=t(window);this.element.offset({top:this.state.offset.top+(e.scrollTop()-this.state.windowScrollTop),left:this.state.offset.left+(e.scrollLeft()-this.state.windowScrollLeft)})},_applyARIA:function(){this.element.attr({role:"dialog","aria-labelledby":this.element.attr("id")+"_title","aria-hidden":!this.options.visible}),this.titlebar.children("a.ui-dialog-titlebar-icon").attr("role","button")},_removeARIA:function(){this.element.removeAttr("role").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-live").removeAttr("aria-hidden")},_bindResizeListener:function(){var e=this;t(window).on(this.resizeNS,function(t){t.target===window&&e._initPosition()})},_unbindResizeListener:function(){t(window).off(this.resizeNS)},_setOption:function(e,i){"visible"===e?i?this.show():this.hide():t.Widget.prototype._setOption.apply(this,arguments)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puidropdown",{options:{effect:"fade",effectSpeed:"normal",filter:!1,filterMatchMode:"startsWith",caseSensitiveFilter:!1,filterFunction:null,data:null,content:null,scrollHeight:200,appendTo:"body",editable:!1,value:null,style:null,styleClass:null},_create:function(){if(this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this.options.enhanced){this.choices=this.element.children("option"),this.container=this.element.closest(".ui-dropdown"),this.focusElementContainer=this.container.children(".ui-helper-hidden-accessible:last"),this.focusElement=this.focusElementContainer.children("input"),this.label=this.container.children(".ui-dropdown-label"),this.menuIcon=this.container.children(".ui-dropdown-trigger"),this.panel=this.container.children(".ui-dropdown-panel"),this.itemsWrapper=this.panel.children(".ui-dropdown-items-wrapper"),this.itemsContainer=this.itemsWrapper.children("ul"),this.itemsContainer.addClass("ui-dropdown-items ui-dropdown-list ui-widget-content ui-widget ui-corner-all ui-helper-reset"),this.items=this.itemsContainer.children("li").addClass("ui-dropdown-item ui-corner-all");var e=this;this.items.each(function(i){t(this).data("label",e.choices.eq(i).text())}),this.options.filter&&(this.filterContainer=this.panel.children(".ui-dropdown-filter-container"),this.filterInput=this.filterContainer.children("input"))}else{if(this.options.data){if(!t.isArray(this.options.data)){if("function"===t.type(this.options.data))return void this.options.data.call(this,this._onRemoteOptionsLoad);if("string"===t.type(this.options.data)){var e=this,i=this.options.data,s=function(){t.ajax({type:"GET",url:i,dataType:"json",context:e,success:function(t){this._onRemoteOptionsLoad(t)}})};s.call(this)}return}this._generateOptionElements(this.options.data)}this._render()}this._postRender()},_render:function(){this.choices=this.element.children("option"),this.element.attr("tabindex","-1").wrap('<div class="ui-dropdown ui-widget ui-state-default ui-corner-all ui-helper-clearfix" />').wrap('<div class="ui-helper-hidden-accessible" />'),this.container=this.element.closest(".ui-dropdown"),this.focusElementContainer=t('<div class="ui-helper-hidden-accessible"><input type="text" /></div>').appendTo(this.container),this.focusElement=this.focusElementContainer.children("input"),this.label=t(this.options.editable?'<input type="text" class="ui-dropdown-label ui-inputtext ui-corner-all"">':'<label class="ui-dropdown-label ui-inputtext ui-corner-all"/>'),this.label.appendTo(this.container),this.menuIcon=t('<div class="ui-dropdown-trigger ui-state-default ui-corner-right"><span class="fa fa-fw fa-caret-down"></span></div>').appendTo(this.container),this.panel=t('<div class="ui-dropdown-panel ui-widget-content ui-corner-all ui-helper-hidden ui-shadow" />'),this.itemsWrapper=t('<div class="ui-dropdown-items-wrapper" />').appendTo(this.panel),this.itemsContainer=t('<ul class="ui-dropdown-items ui-dropdown-list ui-widget-content ui-widget ui-corner-all ui-helper-reset"></ul>').appendTo(this.itemsWrapper),this.optGroupsSize=this.itemsContainer.children("li.puiselectonemenu-item-group").length,this.options.filter&&(this.filterContainer=t('<div class="ui-dropdown-filter-container" />').prependTo(this.panel),this.filterInput=t('<input type="text" autocomplete="off" class="ui-dropdown-filter ui-inputtext ui-widget ui-state-default ui-corner-all" />').appendTo(this.filterContainer),this.filterContainer.append('<span class="fa fa-search"></span>')),this._generateItems()},_postRender:function(){this.options.style&&this.container.attr("style",this.options.style),this.options.styleClass&&this.container.addClass(this.options.styleClass),this.disabled=this.element.prop("disabled")||this.options.disabled,"self"===this.options.appendTo?this.panel.appendTo(this.container):this.panel.appendTo(this.options.appendTo),this.options.scrollHeight&&this.panel.outerHeight()>this.options.scrollHeight&&this.itemsWrapper.height(this.options.scrollHeight);var e=this;this.options.value&&this.choices.filter('[value="'+this.options.value+'"]').prop("selected",!0);var i=this.choices.filter(":selected");if(this.choices.filter(":disabled").each(function(){e.items.eq(t(this).index()).addClass("ui-state-disabled")}),this.triggers=this.options.editable?this.menuIcon:this.container.children(".ui-dropdown-trigger, .ui-dropdown-label"),this.options.editable){var s=this.label.val();s===i.text()?this._highlightItem(this.items.eq(i.index())):(this.items.eq(0).addClass("ui-state-highlight"),this.customInput=!0,this.customInputVal=s)}else this._highlightItem(this.items.eq(i.index()));this.disabled||(this._bindEvents(),this._bindConstantEvents())},_onRemoteOptionsLoad:function(t){this._generateOptionElements(t),this._render(),this._postRender()},_generateOptionElements:function(t){for(var e=0;e<t.length;e++){var i=t[e];i.label?this.element.append('<option value="'+i.value+'">'+i.label+"</option>"):this.element.append('<option value="'+i+'">'+i+"</option>")}},_generateItems:function(){for(var t=0;t<this.choices.length;t++){var e=this.choices.eq(t),i=e.text(),s=this.options.content?this.options.content.call(this,this.options.data[t]):i;this.itemsContainer.append('<li data-label="'+i+'" class="ui-dropdown-item ui-corner-all">'+s+"</li>")}this.items=this.itemsContainer.children(".ui-dropdown-item")},_bindEvents:function(){var e=this;this.items.filter(":not(.ui-state-disabled)").each(function(i,s){e._bindItemEvents(t(s))}),this.triggers.on("mouseenter.puidropdown",function(){e.container.hasClass("ui-state-focus")||(e.container.addClass("ui-state-hover"),e.menuIcon.addClass("ui-state-hover"))}).on("mouseleave.puidropdown",function(){e.container.removeClass("ui-state-hover"),e.menuIcon.removeClass("ui-state-hover")}).on("click.puidropdown",function(t){e.panel.is(":hidden")?e._show():(e._hide(),e._revert()),e.container.removeClass("ui-state-hover"),e.menuIcon.removeClass("ui-state-hover"),e.focusElement.trigger("focus.puidropdown"),t.preventDefault()}),this.focusElement.on("focus.puidropdown",function(){e.container.addClass("ui-state-focus"),e.menuIcon.addClass("ui-state-focus")}).on("blur.puidropdown",function(){e.container.removeClass("ui-state-focus"),e.menuIcon.removeClass("ui-state-focus")}),this.options.editable&&this.label.on("change.ui-dropdown",function(){e._triggerChange(!0),e.customInput=!0,e.customInputVal=t(this).val(),e.items.filter(".ui-state-highlight").removeClass("ui-state-highlight"),e.items.eq(0).addClass("ui-state-highlight")}),this._bindKeyEvents(),this.options.filter&&(this._setupFilterMatcher(),this.filterInput.puiinputtext(),this.filterInput.on("keyup.ui-dropdown",function(){e._filter(t(this).val())}))},_bindItemEvents:function(e){var i=this;e.on("mouseover.puidropdown",function(){var e=t(this);e.hasClass("ui-state-highlight")||t(this).addClass("ui-state-hover")}).on("mouseout.puidropdown",function(){t(this).removeClass("ui-state-hover")}).on("click.puidropdown",function(){i._selectItem(t(this))})},_bindConstantEvents:function(){var e=this;t(document.body).on("mousedown.ui-dropdown-"+this.id,function(t){if(!e.panel.is(":hidden")){var i=e.panel.offset();t.target!==e.label.get(0)&&t.target!==e.menuIcon.get(0)&&t.target!==e.menuIcon.children().get(0)&&(t.pageX<i.left||t.pageX>i.left+e.panel.width()||t.pageY<i.top||t.pageY>i.top+e.panel.height())&&(e._hide(),e._revert())}}),this.resizeNS="resize."+this.id,this._unbindResize(),this._bindResize()},_bindKeyEvents:function(){var e=this;this.focusElement.on("keydown.puidropdown",function(i){var s,n=t.ui.keyCode,o=i.which;switch(o){case n.UP:case n.LEFT:s=e._getActiveItem();var a=s.prevAll(":not(.ui-state-disabled,.ui-selectonemenu-item-group):first");1==a.length&&(e.panel.is(":hidden")?e._selectItem(a):(e._highlightItem(a),PUI.scrollInView(e.itemsWrapper,a))),i.preventDefault();break;case n.DOWN:case n.RIGHT:s=e._getActiveItem();var l=s.nextAll(":not(.ui-state-disabled,.ui-selectonemenu-item-group):first");1==l.length&&(e.panel.is(":hidden")?i.altKey?e._show():e._selectItem(l):(e._highlightItem(l),PUI.scrollInView(e.itemsWrapper,l))),i.preventDefault();break;case n.ENTER:case n.NUMPAD_ENTER:e.panel.is(":hidden")?e._show():e._selectItem(e._getActiveItem()),i.preventDefault();break;case n.TAB:e.panel.is(":visible")&&(e._revert(),e._hide());break;case n.ESCAPE:e.panel.is(":visible")&&(e._revert(),e._hide());break;default:var r=String.fromCharCode(o>=96&&105>=o?o-48:o),h=e.items.filter(".ui-state-highlight"),u=e._search(r,h.index()+1,e.options.length);u||(u=e._search(r,0,h.index())),u&&(e.panel.is(":hidden")?e._selectItem(u):(e._highlightItem(u),PUI.scrollInView(e.itemsWrapper,u)))}})},_unbindEvents:function(){this.items.off("mouseover.puidropdown mouseout.puidropdown click.puidropdown"),this.triggers.off("mouseenter.puidropdown mouseleave.puidropdown click.puidropdown"),this.focusElement.off("keydown.puidropdown focus.puidropdown blur.puidropdown"),this.options.editable&&this.label.off("change.puidropdown"),this.options.filter&&this.filterInput.off("keyup.ui-dropdown"),t(document.body).off("mousedown.ui-dropdown-"+this.id),this._unbindResize()},_selectItem:function(t,e){var i=this.choices.eq(this._resolveItemIndex(t)),s=this.choices.filter(":selected"),n=i.val()==s.val(),o=null;o=this.options.editable?!n||i.text()!=this.label.val():!n,o&&(this._highlightItem(t),this.element.val(i.val()),this._triggerChange(),this.options.editable&&(this.customInput=!1)),e||this.focusElement.trigger("focus.puidropdown"),this.panel.is(":visible")&&this._hide()},_highlightItem:function(t){this.items.filter(".ui-state-highlight").removeClass("ui-state-highlight"),t.length?(t.addClass("ui-state-highlight"),this._setLabel(t.data("label"))):this._setLabel(" ")},_triggerChange:function(t){this.changed=!1;var e=this.choices.filter(":selected");this.options.change&&this._trigger("change",null,{value:e.val(),index:e.index()}),t||(this.value=this.choices.filter(":selected").val())},_resolveItemIndex:function(t){return 0===this.optGroupsSize?t.index():t.index()-t.prevAll("li.ui-dropdown-item-group").length},_setLabel:function(t){this.options.editable?this.label.val(t):" "===t?this.label.html(" "):this.label.text(t)},_bindResize:function(){var e=this;t(window).bind(this.resizeNS,function(t){e.panel.is(":visible")&&e._alignPanel()})},_unbindResize:function(){t(window).unbind(this.resizeNS)},_alignPanelWidth:function(){if(!this.panelWidthAdjusted){var t=this.container.outerWidth();this.panel.outerWidth()<t&&this.panel.width(t),this.panelWidthAdjusted=!0}},_alignPanel:function(){this.panel.parent().is(this.container)?this.panel.css({left:"0px",top:this.container.outerHeight()+"px"}).width(this.container.outerWidth()):(this._alignPanelWidth(),this.panel.css({left:"",top:""}).position({my:"left top",at:"left bottom",of:this.container,collision:"flipfit"}))},_show:function(){this._alignPanel(),this.panel.css("z-index",++PUI.zindex),"none"!==this.options.effect?this.panel.show(this.options.effect,{},this.options.effectSpeed):this.panel.show(),this.preShowValue=this.choices.filter(":selected")},_hide:function(){this.panel.hide()},_revert:function(){this.options.editable&&this.customInput?(this._setLabel(this.customInputVal),this.items.filter(".ui-state-active").removeClass("ui-state-active"),this.items.eq(0).addClass("ui-state-active")):this._highlightItem(this.items.eq(this.preShowValue.index()))},_getActiveItem:function(){return this.items.filter(".ui-state-highlight")},_setupFilterMatcher:function(){this.filterMatchers={startsWith:this._startsWithFilter,contains:this._containsFilter,endsWith:this._endsWithFilter,custom:this.options.filterFunction},this.filterMatcher=this.filterMatchers[this.options.filterMatchMode]},_startsWithFilter:function(t,e){return 0===t.indexOf(e)},_containsFilter:function(t,e){return-1!==t.indexOf(e)},_endsWithFilter:function(t,e){return-1!==t.indexOf(e,t.length-e.length)},_filter:function(e){this.initialHeight=this.initialHeight||this.itemsWrapper.height();var i=this.options.caseSensitiveFilter?t.trim(e):t.trim(e).toLowerCase();if(""===i)this.items.filter(":hidden").show();else for(var s=0;s<this.choices.length;s++){var n=this.choices.eq(s),o=this.options.caseSensitiveFilter?n.text():n.text().toLowerCase(),a=this.items.eq(s);this.filterMatcher(o,i)?a.show():a.hide()}this.itemsContainer.height()<this.initialHeight?this.itemsWrapper.css("height","auto"):this.itemsWrapper.height(this.initialHeight),this._alignPanel()},_search:function(t,e,i){for(var s=e;i>s;s++){var n=this.choices.eq(s);if(0===n.text().indexOf(t))return this.items.eq(s)}return null},getSelectedValue:function(){return this.element.val()},getSelectedLabel:function(){return this.choices.filter(":selected").text()},selectValue:function(t){var e=this.choices.filter('[value="'+t+'"]');this._selectItem(this.items.eq(e.index()),!0)},addOption:function(e,i){var s,n;void 0!==i&&null!==i?(s=i,n=e):(s=void 0!==e.value&&null!==e.value?e.value:e,n=void 0!==e.label&&null!==e.label?e.label:e);var o=this.options.content?this.options.content.call(this,e):n,a=t('<li data-label="'+n+'" class="ui-dropdown-item ui-corner-all">'+o+"</li>"),l=t('<option value="'+s+'">'+n+"</option>");l.appendTo(this.element),this._bindItemEvents(a),a.appendTo(this.itemsContainer),this.items.push(a[0]),this.choices=this.element.children("option"),1===this.items.length&&(this.selectValue(s),this._highlightItem(a))},removeAllOptions:function(){this.element.empty(),this.itemsContainer.empty(),this.items.length=0,this.choices.length=0,this.element.val(""),this.label.text("")},_setOption:function(e,i){if("data"===e||"options"===e){this.options.data=i,this.removeAllOptions();for(var s=0;s<this.options.data.length;s++)this.addOption(this.options.data[s]);this.options.scrollHeight&&this.panel.outerHeight()>this.options.scrollHeight&&this.itemsWrapper.height(this.options.scrollHeight)}else if("value"===e){this.options.value=i,this.choices.prop("selected",!1);var n=this.choices.filter('[value="'+this.options.value+'"]');n.length&&(n.prop("selected",!0),this._highlightItem(this.items.eq(n.index())))}else t.Widget.prototype._setOption.apply(this,arguments)},disable:function(){this._unbindEvents(),this.label.addClass("ui-state-disabled"),this.menuIcon.addClass("ui-state-disabled")},enable:function(){this._bindEvents(),this.label.removeClass("ui-state-disabled"),this.menuIcon.removeClass("ui-state-disabled")},getEditableText:function(){return this.label.val()},_destroy:function(){this._unbindEvents(),this.options.enhanced?("body"==this.options.appendTo&&this.panel.appendTo(this.container),this.options.style&&this.container.removeAttr("style"),this.options.styleClass&&this.container.removeClass(this.options.styleClass)):(this.panel.remove(),this.label.remove(),this.menuIcon.remove(),this.focusElementContainer.remove(),this.element.unwrap().unwrap())}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puifieldset",{options:{toggleable:!1,toggleDuration:"normal",collapsed:!1,enhanced:!1},_create:function(){this.options.enhanced?(this.legend=this.element.children("legend"),this.content=this.element.children("div.ui-fieldset-content")):(this.element.addClass("ui-fieldset ui-widget ui-widget-content ui-corner-all").children("legend").addClass("ui-fieldset-legend ui-corner-all ui-state-default"),this.element.contents().wrapAll('<div class="ui-fieldset-content" />'),this.content=this.element.children("div.ui-fieldset-content"),this.legend=this.content.children("legend.ui-fieldset-legend").prependTo(this.element)),this.options.toggleable&&(this.options.enhanced?this.toggler=this.legend.children(".ui-fieldset-toggler"):(this.element.addClass("ui-fieldset-toggleable"),this.toggler=t('<span class="ui-fieldset-toggler fa fa-fw" />').prependTo(this.legend)),this._bindEvents(),this.options.collapsed?(this.content.hide(),this.toggler.addClass("fa-plus")):this.toggler.addClass("fa-minus"))},_bindEvents:function(){var t=this;this.legend.on("click.puifieldset",function(e){
t.toggle(e)}).on("mouseover.puifieldset",function(){t.legend.addClass("ui-state-hover")}).on("mouseout.puifieldset",function(){t.legend.removeClass("ui-state-hover ui-state-active")}).on("mousedown.puifieldset",function(){t.legend.removeClass("ui-state-hover").addClass("ui-state-active")}).on("mouseup.puifieldset",function(){t.legend.removeClass("ui-state-active").addClass("ui-state-hover")})},_unbindEvents:function(){this.legend.off("click.puifieldset mouseover.puifieldset mouseout.puifieldset mousedown.puifieldset mouseup.puifieldset")},toggle:function(t){var e=this;this._trigger("beforeToggle",t,this.options.collapsed),this.options.collapsed?this.toggler.removeClass("fa-plus").addClass("fa-minus"):this.toggler.removeClass("fa-minus").addClass("fa-plus"),this.content.slideToggle(this.options.toggleSpeed,"easeInOutCirc",function(){e.options.collapsed=!e.options.collapsed,e._trigger("afterToggle",t,e.options.collapsed)})},_destroy:function(){this.options.enhanced||(this.element.removeClass("ui-fieldset ui-widget ui-widget-content ui-corner-all").children("legend").removeClass("ui-fieldset-legend ui-corner-all ui-state-default ui-state-hover ui-state-active"),this.content.contents().unwrap(),this.options.toggleable&&(this.element.removeClass("ui-fieldset-toggleable"),this.toggler.remove())),this._unbindEvents()}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puigalleria",{options:{panelWidth:600,panelHeight:400,frameWidth:60,frameHeight:40,activeIndex:0,showFilmstrip:!0,autoPlay:!0,transitionInterval:4e3,effect:"fade",effectSpeed:250,effectOptions:{},showCaption:!0,customContent:!1},_create:function(){this.element.addClass("ui-galleria ui-widget ui-widget-content ui-corner-all"),this.panelWrapper=this.element.children("ul"),this.panelWrapper.addClass("ui-galleria-panel-wrapper"),this.panels=this.panelWrapper.children("li"),this.panels.addClass("ui-galleria-panel ui-helper-hidden"),this.element.width(this.options.panelWidth),this.panelWrapper.width(this.options.panelWidth).height(this.options.panelHeight),this.panels.width(this.options.panelWidth).height(this.options.panelHeight),this.options.showFilmstrip&&(this._renderStrip(),this._bindEvents()),this.options.customContent&&(this.panels.children("img").hide(),this.panels.children("div").addClass("ui-galleria-panel-content"));var t=this.panels.eq(this.options.activeIndex);t.removeClass("ui-helper-hidden"),this.options.showCaption&&this._showCaption(t),this.element.css("visibility","visible"),this.options.autoPlay&&this.startSlideshow()},_destroy:function(){this.stopSlideshow(),this._unbindEvents(),this.element.removeClass("ui-galleria ui-widget ui-widget-content ui-corner-all").removeAttr("style"),this.panelWrapper.removeClass("ui-galleria-panel-wrapper").removeAttr("style"),this.panels.removeClass("ui-galleria-panel ui-helper-hidden").removeAttr("style"),this.strip.remove(),this.stripWrapper.remove(),this.element.children(".fa").remove(),this.options.showCaption&&this.caption.remove(),this.panels.children("img").show()},_renderStrip:function(){var e='style="width:'+this.options.frameWidth+"px;height:"+this.options.frameHeight+'px;"';this.stripWrapper=t('<div class="ui-galleria-filmstrip-wrapper"></div>').width(this.element.width()-50).height(this.options.frameHeight).appendTo(this.element),this.strip=t('<ul class="ui-galleria-filmstrip"></div>').appendTo(this.stripWrapper);for(var i=0;i<this.panels.length;i++){var s=this.panels.eq(i).children("img"),n=i==this.options.activeIndex?"ui-galleria-frame ui-galleria-frame-active":"ui-galleria-frame",o='<li class="'+n+'" '+e+'><div class="ui-galleria-frame-content" '+e+'><img src="'+s.attr("src")+'" class="ui-galleria-frame-image" '+e+"/></div></li>";this.strip.append(o)}this.frames=this.strip.children("li.ui-galleria-frame"),this.element.append('<div class="ui-galleria-nav-prev fa fa-fw fa-chevron-circle-left" style="bottom:'+this.options.frameHeight/2+'px"></div><div class="ui-galleria-nav-next fa fa-fw fa-chevron-circle-right" style="bottom:'+this.options.frameHeight/2+'px"></div>'),this.options.showCaption&&(this.caption=t('<div class="ui-galleria-caption"></div>').css({bottom:this.stripWrapper.outerHeight()+10,width:this.panelWrapper.width()}).appendTo(this.element))},_bindEvents:function(){var e=this;this.element.children("div.ui-galleria-nav-prev").on("click.puigalleria",function(){e.slideshowActive&&e.stopSlideshow(),e.isAnimating()||e.prev()}),this.element.children("div.ui-galleria-nav-next").on("click.puigalleria",function(){e.slideshowActive&&e.stopSlideshow(),e.isAnimating()||e.next()}),this.strip.children("li.ui-galleria-frame").on("click.puigalleria",function(){e.slideshowActive&&e.stopSlideshow(),e.select(t(this).index(),!1)})},_unbindEvents:function(){this.element.children("div.ui-galleria-nav-prev").off("click.puigalleria"),this.element.children("div.ui-galleria-nav-next").off("click.puigalleria"),this.strip.children("li.ui-galleria-frame").off("click.puigalleria")},startSlideshow:function(){var t=this;this.interval=window.setInterval(function(){t.next()},this.options.transitionInterval),this.slideshowActive=!0},stopSlideshow:function(){this.interval&&window.clearInterval(this.interval),this.slideshowActive=!1},isSlideshowActive:function(){return this.slideshowActive},select:function(e,i){if(e!==this.options.activeIndex){this.options.showCaption&&this._hideCaption();var s=this.panels.eq(this.options.activeIndex),n=this.panels.eq(e);if(s.hide(this.options.effect,this.options.effectOptions,this.options.effectSpeed),n.show(this.options.effect,this.options.effectOptions,this.options.effectSpeed),this.options.showFilmstrip){var o=this.frames.eq(this.options.activeIndex),a=this.frames.eq(e);if(o.removeClass("ui-galleria-frame-active").css("opacity",""),a.animate({opacity:1},this.options.effectSpeed,null,function(){t(this).addClass("ui-galleria-frame-active")}),void 0===i||i===!0){var l=a.position().left,r=this.options.frameWidth+parseInt(a.css("margin-right"),10),h=this.strip.position().left,u=l+h,d=u+this.options.frameWidth;d>this.stripWrapper.width()?this.strip.animate({left:"-="+r},this.options.effectSpeed,"easeInOutCirc"):0>u&&this.strip.animate({left:"+="+r},this.options.effectSpeed,"easeInOutCirc")}}this.options.showCaption&&this._showCaption(n),this.options.activeIndex=e}},_hideCaption:function(){this.caption.slideUp(this.options.effectSpeed)},_showCaption:function(t){var e=t.children("img");this.caption.html("<h4>"+e.attr("title")+"</h4><p>"+e.attr("alt")+"</p>").slideDown(this.options.effectSpeed)},prev:function(){0!==this.options.activeIndex&&this.select(this.options.activeIndex-1)},next:function(){this.options.activeIndex!==this.panels.length-1?this.select(this.options.activeIndex+1):(this.select(0,!1),this.strip.animate({left:0},this.options.effectSpeed,"easeInOutCirc"))},isAnimating:function(){return this.strip.is(":animated")}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puigrowl",{options:{sticky:!1,life:3e3,messages:null,appendTo:document.body},_create:function(){var t=this.element;this.originalParent=this.element.parent(),t.addClass("ui-growl ui-widget"),this.options.appendTo&&t.appendTo(this.options.appendTo),this.options.messages&&this.show(this.options.messages)},show:function(e){var i=this;this.element.css("z-index",++PUI.zindex),this.clear(),e&&e.length&&t.each(e,function(t,e){i._renderMessage(e)})},clear:function(){for(var t=this.element.children("div.ui-growl-item-container"),e=0;e<t.length;e++)this._unbindMessageEvents(t.eq(e));t.remove()},_renderMessage:function(e){var i='<div class="ui-growl-item-container ui-state-highlight ui-corner-all ui-helper-hidden" aria-live="polite">';i+='<div class="ui-growl-item ui-shadow">',i+='<div class="ui-growl-icon-close fa fa-close" style="display:none"></div>',i+='<span class="ui-growl-image fa fa-2x '+this._getIcon(e.severity)+" ui-growl-image-"+e.severity+'"/>',i+='<div class="ui-growl-message">',i+='<span class="ui-growl-title">'+e.summary+"</span>",i+="<p>"+(e.detail||"")+"</p>",i+='</div><div style="clear: both;"></div></div></div>';var s=t(i);s.addClass("ui-growl-message-"+e.severity),this._bindMessageEvents(s),s.appendTo(this.element).fadeIn()},_removeMessage:function(t){t.fadeTo("normal",0,function(){t.slideUp("normal","easeInOutCirc",function(){t.remove()})})},_bindMessageEvents:function(e){var i=this,s=this.options.sticky;e.on("mouseover.puigrowl",function(){var e=t(this);e.is(":animated")||e.find("div.ui-growl-icon-close:first").show()}).on("mouseout.puigrowl",function(){t(this).find("div.ui-growl-icon-close:first").hide()}),e.find("div.ui-growl-icon-close").on("click.puigrowl",function(){i._removeMessage(e),s||window.clearTimeout(e.data("timeout"))}),s||this._setRemovalTimeout(e)},_unbindMessageEvents:function(t){var e=this.options.sticky;if(t.off("mouseover.puigrowl mouseout.puigrowl"),t.find("div.ui-growl-icon-close").off("click.puigrowl"),!e){var i=t.data("timeout");i&&window.clearTimeout(i)}},_setRemovalTimeout:function(t){var e=this,i=window.setTimeout(function(){e._removeMessage(t)},this.options.life);t.data("timeout",i)},_getIcon:function(t){switch(t){case"info":return"fa-info-circle";case"warn":return"fa-warning";case"error":return"fa-close";default:return"fa-info-circle"}},_setOption:function(e,i){"value"===e||"messages"===e?this.show(i):t.Widget.prototype._setOption.apply(this,arguments)},_destroy:function(){this.clear(),this.element.removeClass("ui-growl ui-widget"),this.options.appendTo&&this.element.appendTo(this.originalParent)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puiinputtext",{options:{disabled:!1},_create:function(){var t=this.element;t.prop("disabled");t.addClass("ui-inputtext ui-widget ui-state-default ui-corner-all"),t.prop("disabled")?t.addClass("ui-state-disabled"):this.options.disabled?this.disable():this._enableMouseEffects()},_destroy:function(){this.element.removeClass("ui-inputtext ui-widget ui-state-default ui-state-disabled ui-state-hover ui-state-focus ui-corner-all"),this._disableMouseEffects()},_enableMouseEffects:function(){var t=this.element;t.on("mouseover.puiinputtext",function(){t.addClass("ui-state-hover")}).on("mouseout.puiinputtext",function(){t.removeClass("ui-state-hover")}).on("focus.puiinputtext",function(){t.addClass("ui-state-focus")}).on("blur.puiinputtext",function(){t.removeClass("ui-state-focus")})},_disableMouseEffects:function(){this.element.off("mouseover.puiinputtext mouseout.puiinputtext focus.puiinputtext blur.puiinputtext")},disable:function(){this.element.prop("disabled",!0),this.element.addClass("ui-state-disabled"),this.element.removeClass("ui-state-focus ui-state-hover"),this._disableMouseEffects()},enable:function(){this.element.prop("disabled",!1),this.element.removeClass("ui-state-disabled"),this._enableMouseEffects()},_setOption:function(e,i){"disabled"===e?i?this.disable():this.enable():t.Widget.prototype._setOption.apply(this,arguments)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puiinputtextarea",{options:{autoResize:!1,autoComplete:!1,maxlength:null,counter:null,counterTemplate:"{0}",minQueryLength:3,queryDelay:700,completeSource:null},_create:function(){var t=this;this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this.element.puiinputtext(),this.options.autoResize&&(this.options.rowsDefault=this.element.attr("rows"),this.options.colsDefault=this.element.attr("cols"),this.element.addClass("ui-inputtextarea-resizable"),this.element.on("keyup.puiinputtextarea-resize",function(){t._resize()}).on("focus.puiinputtextarea-resize",function(){t._resize()}).on("blur.puiinputtextarea-resize",function(){t._resize()})),this.options.maxlength&&this.element.on("keyup.puiinputtextarea-maxlength",function(e){var i=t.element.val(),s=i.length;s>t.options.maxlength&&t.element.val(i.substr(0,t.options.maxlength)),t.options.counter&&t._updateCounter()}),this.options.counter&&this._updateCounter(),this.options.autoComplete&&this._initAutoComplete()},_destroy:function(){this.element.puiinputtext("destroy"),this.options.autoResize&&this.element.removeClass("ui-inputtextarea-resizable").off("keyup.puiinputtextarea-resize focus.puiinputtextarea-resize blur.puiinputtextarea-resize"),this.options.maxlength&&this.element.off("keyup.puiinputtextarea-maxlength"),this.options.autoComplete&&(this.element.off("keyup.puiinputtextarea-autocomplete keydown.puiinputtextarea-autocomplete"),t(document.body).off("mousedown.puiinputtextarea-"+this.id),t(window).off("resize.puiinputtextarea-"+this.id),this.items&&this.items.off(),this.panel.remove())},_updateCounter:function(){var t=this.element.val(),e=t.length;if(this.options.counter){var i=this.options.maxlength-e,s=this.options.counterTemplate.replace("{0}",i);this.options.counter.text(s)}},_resize:function(){for(var t=0,e=this.element.val().split("\n"),i=e.length-1;i>=0;--i)t+=Math.floor(e[i].length/this.options.colsDefault+1);var s=t>=this.options.rowsDefault?t+1:this.options.rowsDefault;this.element.attr("rows",s)},_initAutoComplete:function(){var e='<div id="'+this.id+'_panel" class="ui-autocomplete-panel ui-widget-content ui-corner-all ui-helper-hidden ui-shadow"></div>',i=this;this.panel=t(e).appendTo(document.body),this.element.on("keyup.puiinputtextarea-autocomplete",function(e){var s=t.ui.keyCode;switch(e.which){case s.UP:case s.LEFT:case s.DOWN:case s.RIGHT:case s.ENTER:case s.NUMPAD_ENTER:case s.TAB:case s.SPACE:case s.CONTROL:case s.ALT:case s.ESCAPE:case 224:break;default:var n=i._extractQuery();n&&n.length>=i.options.minQueryLength&&(i.timeout&&i._clearTimeout(i.timeout),i.timeout=window.setTimeout(function(){i.search(n)},i.options.queryDelay))}}).on("keydown.puiinputtextarea-autocomplete",function(e){var s,n=i.panel.is(":visible"),o=t.ui.keyCode;switch(e.which){case o.UP:case o.LEFT:if(n){s=i.items.filter(".ui-state-highlight");var a=0===s.length?i.items.eq(0):s.prev();1==a.length&&(s.removeClass("ui-state-highlight"),a.addClass("ui-state-highlight"),i.options.scrollHeight&&PUI.scrollInView(i.panel,a)),e.preventDefault()}else i._clearTimeout();break;case o.DOWN:case o.RIGHT:if(n){s=i.items.filter(".ui-state-highlight");var l=0===s.length?_self.items.eq(0):s.next();1==l.length&&(s.removeClass("ui-state-highlight"),l.addClass("ui-state-highlight"),i.options.scrollHeight&&PUI.scrollInView(i.panel,l)),e.preventDefault()}else i._clearTimeout();break;case o.ENTER:case o.NUMPAD_ENTER:n?(i.items.filter(".ui-state-highlight").trigger("click"),e.preventDefault()):i._clearTimeout();break;case o.SPACE:case o.CONTROL:case o.ALT:case o.BACKSPACE:case o.ESCAPE:case 224:i._clearTimeout(),n&&i._hide();break;case o.TAB:i._clearTimeout(),n&&(i.items.filter(".ui-state-highlight").trigger("click"),i._hide())}}),t(document.body).on("mousedown.puiinputtextarea-"+this.id,function(t){if(!i.panel.is(":hidden")){var e=i.panel.offset();t.target!==i.element.get(0)&&(t.pageX<e.left||t.pageX>e.left+i.panel.width()||t.pageY<e.top||t.pageY>e.top+i.panel.height())&&i._hide()}});var s="resize.puiinputtextarea-"+this.id;t(window).off(s).on(s,function(){i.panel.is(":visible")&&i._hide()})},_bindDynamicEvents:function(){var e=this;this.items.on("mouseover",function(){var i=t(this);i.hasClass("ui-state-highlight")||(e.items.filter(".ui-state-highlight").removeClass("ui-state-highlight"),i.addClass("ui-state-highlight"))}).on("click",function(i){var s=t(this),n=s.attr("data-item-value"),o=n.substring(e.query.length);e.element.focus(),e.element.insertText(o,e.element.getSelection().start,!0),e._hide(),e._trigger("itemselect",i,s)})},_clearTimeout:function(){this.timeout&&window.clearTimeout(this.timeout),this.timeout=null},_extractQuery:function(){var t=this.element.getSelection().end,e=/\S+$/.exec(this.element.get(0).value.slice(0,t)),i=e?e[0]:null;return i},search:function(t){this.query=t;var e={query:t};this.options.completeSource&&this.options.completeSource.call(this,e,this._handleResponse)},_handleResponse:function(e){this.panel.html("");for(var i=t('<ul class="ui-autocomplete-items ui-autocomplete-list ui-widget-content ui-widget ui-corner-all ui-helper-reset"></ul>'),s=0;s<e.length;s++){var n=t('<li class="ui-autocomplete-item ui-autocomplete-list-item ui-corner-all"></li>');n.attr("data-item-value",e[s].value),n.text(e[s].label),i.append(n)}this.panel.append(i),this.items=this.panel.find(".ui-autocomplete-item"),this._bindDynamicEvents(),this.items.length>0?(this.items.eq(0).addClass("ui-state-highlight"),this.options.scrollHeight&&this.panel.height()>this.options.scrollHeight&&this.panel.height(this.options.scrollHeight),this.panel.is(":hidden")?this._show():this._alignPanel()):this.panel.hide()},_alignPanel:function(){var t=this.element.getCaretPosition(),e=this.element.offset();this.panel.css({left:e.left+t.left,top:e.top+t.top,width:this.element.innerWidth()})},_show:function(){this._alignPanel(),this.panel.show()},_hide:function(){this.panel.hide()},disable:function(){this.element.puiinputtext("disable")},enable:function(){this.element.puiinputtext("enable")}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puilightbox",{options:{iframeWidth:640,iframeHeight:480,iframe:!1},_create:function(){this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this.options.mode=this.options.iframe?"iframe":1==this.element.children("div").length?"inline":"image";var e='<div class="ui-lightbox ui-widget ui-helper-hidden ui-corner-all ui-shadow">';e+='<div class="ui-lightbox-content-wrapper">',e+='<a class="ui-state-default ui-lightbox-nav-left ui-corner-right ui-helper-hidden"><span class="fa fa-fw fa-caret-left"></span></a>',e+='<div class="ui-lightbox-content ui-corner-all"></div>',e+='<a class="ui-state-default ui-lightbox-nav-right ui-corner-left ui-helper-hidden"><span class="fa fa-fw fa-caret-right"></span></a>',e+="</div>",e+='<div class="ui-lightbox-caption ui-widget-header"><span class="ui-lightbox-caption-text"></span>',e+='<a class="ui-lightbox-close ui-corner-all" href="#"><span class="fa fa-fw fa-close"></span></a><div style="clear:both" /></div>',e+="</div>",this.panel=t(e).appendTo(document.body),this.contentWrapper=this.panel.children(".ui-lightbox-content-wrapper"),this.content=this.contentWrapper.children(".ui-lightbox-content"),this.caption=this.panel.children(".ui-lightbox-caption"),this.captionText=this.caption.children(".ui-lightbox-caption-text"),this.closeIcon=this.caption.children(".ui-lightbox-close"),"image"===this.options.mode?this._setupImaging():"inline"===this.options.mode?this._setupInline():"iframe"===this.options.mode&&this._setupIframe(),this._bindCommonEvents(),this.links.data("puilightbox-trigger",!0).find("*").data("puilightbox-trigger",!0),this.closeIcon.data("puilightbox-trigger",!0).find("*").data("puilightbox-trigger",!0)},_bindCommonEvents:function(){var e=this;this.closeIcon.on("hover.ui-lightbox",function(){t(this).toggleClass("ui-state-hover")}).on("click.ui-lightbox",function(t){e.hide(),t.preventDefault()}),t(document.body).on("click.ui-lightbox-"+this.id,function(i){if(!e.isHidden()){var s=t(i.target);if(!s.data("puilightbox-trigger")){var n=e.panel.offset();(i.pageX<n.left||i.pageX>n.left+e.panel.width()||i.pageY<n.top||i.pageY>n.top+e.panel.height())&&e.hide()}}}),t(window).on("resize.ui-lightbox-"+this.id,function(){e.isHidden()||t(document.body).children(".ui-widget-overlay").css({width:t(document).width(),height:t(document).height()})})},_destroy:function(){this.links.removeData("puilightbox-trigger").find("*").removeData("puilightbox-trigger"),this._unbindEvents(),this.panel.remove(),this.modality&&this._disableModality()},_unbindEvents:function(){this.closeIcon.off("hover.ui-lightbox click.ui-lightbox"),t(document.body).off("click.ui-lightbox-"+this.id),t(window).off("resize.ui-lightbox-"+this.id),this.links.off("click.ui-lightbox"),"image"===this.options.mode&&(this.imageDisplay.off("load.ui-lightbox"),this.navigators.off("hover.ui-lightbox click.ui-lightbox"))},_setupImaging:function(){var e=this;this.links=this.element.children("a"),this.content.append('<img class="ui-helper-hidden"></img>'),this.imageDisplay=this.content.children("img"),this.navigators=this.contentWrapper.children("a"),this.imageDisplay.on("load.ui-lightbox",function(){var i=t(this);e._scaleImage(i);var s=(e.panel.width()-i.width())/2,n=(e.panel.height()-i.height())/2;e.content.removeClass("ui-lightbox-loading").animate({width:i.width(),height:i.height()},500,function(){i.fadeIn(),e._showNavigators(),e.caption.slideDown()}),e.panel.animate({left:"+="+s,top:"+="+n},500)}),this.navigators.on("hover.ui-lightbox",function(){t(this).toggleClass("ui-state-hover")}).on("click.ui-lightbox",function(i){var s,n=t(this);e._hideNavigators(),n.hasClass("ui-lightbox-nav-left")?(s=0===e.current?e.links.length-1:e.current-1,e.links.eq(s).trigger("click")):(s=e.current==e.links.length-1?0:e.current+1,e.links.eq(s).trigger("click")),i.preventDefault()}),this.links.on("click.ui-lightbox",function(i){var s=t(this);e.isHidden()?(e.content.addClass("ui-lightbox-loading").width(32).height(32),e.show()):(e.imageDisplay.fadeOut(function(){t(this).css({width:"auto",height:"auto"}),e.content.addClass("ui-lightbox-loading")}),e.caption.slideUp()),window.setTimeout(function(){e.imageDisplay.attr("src",s.attr("href")),e.current=s.index();var t=s.attr("title");t&&e.captionText.html(t)},1e3),i.preventDefault()})},_scaleImage:function(e){var i=t(window),s=i.width(),n=i.height(),o=e.width(),a=e.height(),l=a/o;o>=s&&1>=l?(o=.75*s,a=o*l):a>=n&&(a=.75*n,o=a/l),e.css({width:o+"px",height:a+"px"})},_setupInline:function(){this.links=this.element.children("a"),this.inline=this.element.children("div").addClass("ui-lightbox-inline"),this.inline.appendTo(this.content).show();var e=this;this.links.on("click.ui-lightbox",function(i){e.show();var s=t(this).attr("title");s&&(e.captionText.html(s),e.caption.slideDown()),i.preventDefault()})},_setupIframe:function(){var e=this;this.links=this.element,this.iframe=t('<iframe frameborder="0" style="width:'+this.options.iframeWidth+"px;height:"+this.options.iframeHeight+'px;border:0 none; display: block;"></iframe>').appendTo(this.content),this.options.iframeTitle&&this.iframe.attr("title",this.options.iframeTitle),this.element.click(function(t){e.iframeLoaded?e.show():(e.content.addClass("ui-lightbox-loading").css({width:e.options.iframeWidth,height:e.options.iframeHeight}),e.show(),e.iframe.on("load",function(){e.iframeLoaded=!0,e.content.removeClass("ui-lightbox-loading")}).attr("src",e.element.attr("href")));var i=e.element.attr("title");i&&(e.caption.html(i),e.caption.slideDown()),t.preventDefault()})},show:function(){this.center(),this.panel.css("z-index",++PUI.zindex).show(),this.modality||this._enableModality(),this._trigger("show")},hide:function(){this.panel.fadeOut(),this._disableModality(),this.caption.hide(),"image"===this.options.mode&&(this.imageDisplay.hide().attr("src","").removeAttr("style"),this._hideNavigators()),this._trigger("hide")},center:function(){var e=t(window),i=e.width()/2-this.panel.width()/2,s=e.height()/2-this.panel.height()/2;this.panel.css({left:i,top:s})},_enableModality:function(){this.modality=t('<div class="ui-widget-overlay"></div>').css({width:t(document).width(),height:t(document).height(),"z-index":this.panel.css("z-index")-1}).appendTo(document.body)},_disableModality:function(){this.modality.remove(),this.modality=null},_showNavigators:function(){this.navigators.zIndex(this.imageDisplay.zIndex()+1).show()},_hideNavigators:function(){this.navigators.hide()},isHidden:function(){return this.panel.is(":hidden")},showURL:function(t){t.width&&this.iframe.attr("width",t.width),t.height&&this.iframe.attr("height",t.height),this.iframe.attr("src",t.src),this.show()}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puilistbox",{options:{value:null,scrollHeight:200,content:null,data:null,template:null,style:null,styleClass:null,multiple:!1,enhanced:!1,change:null},_create:function(){this.options.enhanced?(this.container=this.element.parent().parent(),this.listContainer=this.container.children("ul").addClass("ui-listbox-list"),this.items=this.listContainer.children("li").addClass("ui-listbox-item ui-corner-all"),this.choices=this.element.children("option")):(this.element.wrap('<div class="ui-listbox ui-inputtext ui-widget ui-widget-content ui-corner-all"><div class="ui-helper-hidden-accessible"></div></div>'),this.container=this.element.parent().parent(),this.listContainer=t('<ul class="ui-listbox-list"></ul>').appendTo(this.container),this.options.data&&this._populateInputFromData(),this._populateContainerFromOptions()),this.options.style&&this.container.attr("style",this.options.style),this.options.styleClass&&this.container.addClass(this.options.styleClass),this.options.multiple?this.element.prop("multiple",!0):this.options.multiple=this.element.prop("multiple"),null!==this.options.value&&void 0!==this.options.value&&this._updateSelection(this.options.value),this._restrictHeight(),this._bindEvents()},_populateInputFromData:function(){for(var t=0;t<this.options.data.length;t++){var e=this.options.data[t];e.label?this.element.append('<option value="'+e.value+'">'+e.label+"</option>"):this.element.append('<option value="'+e+'">'+e+"</option>")}},_populateContainerFromOptions:function(){this.choices=this.element.children("option");for(var t=0;t<this.choices.length;t++){var e=this.choices.eq(t);this.listContainer.append('<li class="ui-listbox-item ui-corner-all">'+this._createItemContent(e.get(0))+"</li>")}this.items=this.listContainer.find(".ui-listbox-item:not(.ui-state-disabled)")},_restrictHeight:function(){this.container.height()>this.options.scrollHeight&&this.container.height(this.options.scrollHeight)},_bindEvents:function(){var t=this;this._bindItemEvents(this.items),this.element.on("focus.puilistbox",function(){t.container.addClass("ui-state-focus")}).on("blur.puilistbox",function(){t.container.removeClass("ui-state-focus")})},_bindItemEvents:function(e){var i=this;e.on("mouseover.puilistbox",function(){var e=t(this);e.hasClass("ui-state-highlight")||e.addClass("ui-state-hover")}).on("mouseout.puilistbox",function(){t(this).removeClass("ui-state-hover")}).on("dblclick.puilistbox",function(t){i.element.trigger("dblclick"),PUI.clearSelection(),t.preventDefault()}).on("click.puilistbox",function(e){i.options.multiple?i._clickMultiple(e,t(this)):i._clickSingle(e,t(this))})},_unbindEvents:function(){this._unbindItemEvents(),this.element.off("focus.puilistbox blur.puilistbox")},_unbindItemEvents:function(){this.items.off("mouseover.puilistbox mouseout.puilistbox dblclick.puilistbox click.puilistbox")},_clickSingle:function(t,e){var i=this.items.filter(".ui-state-highlight");e.index()!==i.index()&&(i.length&&this.unselectItem(i),this.selectItem(e),this._trigger("change",t,{value:this.choices.eq(e.index()).attr("value"),index:e.index()})),this.element.trigger("click"),PUI.clearSelection(),t.preventDefault()},_clickMultiple:function(t,e){var i=this.items.filter(".ui-state-highlight"),s=t.metaKey||t.ctrlKey,n=!s&&1===i.length&&i.index()===e.index();if(t.shiftKey)if(this.cursorItem){this.unselectAll();for(var o=e.index(),a=this.cursorItem.index(),l=o>a?a:o,r=o>a?o+1:a+1,h=l;r>h;h++)this.selectItem(this.items.eq(h))}else this.selectItem(e),this.cursorItem=e;else s||this.unselectAll(),s&&e.hasClass("ui-state-highlight")?this.unselectItem(e):(this.selectItem(e),this.cursorItem=e);if(!n){for(var u=[],d=[],h=0;h<this.choices.length;h++)this.choices.eq(h).prop("selected")&&(u.push(this.choices.eq(h).attr("value")),d.push(h));this._trigger("change",t,{value:u,index:d})}this.element.trigger("click"),PUI.clearSelection(),t.preventDefault()},unselectAll:function(){this.items.removeClass("ui-state-highlight ui-state-hover"),this.choices.filter(":selected").prop("selected",!1)},selectItem:function(e){var i=null;i="number"===t.type(e)?this.items.eq(e):e,i.addClass("ui-state-highlight").removeClass("ui-state-hover"),this.choices.eq(i.index()).prop("selected",!0),this._trigger("itemSelect",null,this.choices.eq(i.index()))},unselectItem:function(e){var i=null;i="number"===t.type(e)?this.items.eq(e):e,i.removeClass("ui-state-highlight"),this.choices.eq(i.index()).prop("selected",!1),this._trigger("itemUnselect",null,this.choices.eq(i.index()))},_setOption:function(e,i){"data"===e?(this.element.empty(),this.listContainer.empty(),this._populateInputFromData(),this._populateContainerFromOptions(),this._restrictHeight(),this._bindEvents()):"value"===e?this._updateSelection(i):"options"===e?this._updateOptions(i):t.Widget.prototype._setOption.apply(this,arguments)},disable:function(){this._unbindEvents(),this.items.addClass("ui-state-disabled")},enable:function(){this._bindEvents(),this.items.removeClass("ui-state-disabled")},_createItemContent:function(t){if(this.options.template){var e=this.options.template.html();return Mustache.parse(e),Mustache.render(e,t)}return this.options.content?this.options.content.call(this,t):t.label},_updateSelection:function(e){this.choices.prop("selected",!1),this.items.removeClass("ui-state-highlight");for(var i=0;i<this.choices.length;i++){var s=this.choices.eq(i);if(this.options.multiple)t.inArray(s.attr("value"),e)>=0&&(s.prop("selected",!0),this.items.eq(i).addClass("ui-state-highlight"));else if(s.attr("value")==e){s.prop("selected",!0),this.items.eq(i).addClass("ui-state-highlight");break}}},_updateOptions:function(t){var e=this;setTimeout(function(){e.items=e.listContainer.children("li").addClass("ui-listbox-item ui-corner-all"),e.choices=e.element.children("option"),e._unbindItemEvents(),e._bindItemEvents(this.items)},50)},_destroy:function(){this._unbindEvents(),this.options.enhanced||(this.listContainer.remove(),this.element.unwrap().unwrap()),this.options.style&&this.container.removeAttr("style"),this.options.styleClass&&this.container.removeClass(this.options.styleClass),this.options.multiple&&this.element.prop("multiple",!1),this.choices&&this.choices.prop("selected",!1)},removeAllOptions:function(){this.element.empty(),this.listContainer.empty(),this.container.empty(),this.element.val("")},addOption:function(e,i){var s;if(this.options.content){var n=i?{label:i,value:e}:{label:e,value:e};s=t('<li class="ui-listbox-item ui-corner-all"></li>').append(this.options.content(n)).appendTo(this.listContainer)}else{var o=i?i:e;s=t('<li class="ui-listbox-item ui-corner-all">'+o+"</li>").appendTo(this.listContainer)}i?this.element.append('<option value="'+e+'">'+i+"</option>"):this.element.append('<option value="'+e+'">'+e+"</option>"),this._bindItemEvents(s),this.choices=this.element.children("option"),this.items=this.items.add(s)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puibasemenu",{options:{popup:!1,trigger:null,my:"left top",at:"left bottom",triggerEvent:"click"},_create:function(){this.options.popup&&this._initPopup()},_initPopup:function(){var e=this;this.element.closest(".ui-menu").addClass("ui-menu-dynamic ui-shadow").appendTo(document.body),
"string"===t.type(this.options.trigger)&&(this.options.trigger=t(this.options.trigger)),this.positionConfig={my:this.options.my,at:this.options.at,of:this.options.trigger},this.options.trigger.on(this.options.triggerEvent+".ui-menu",function(t){e.element.is(":visible")?e.hide():e.show(),t.preventDefault()}),t(document.body).on("click.ui-menu-"+this.id,function(i){var s=e.element.closest(".ui-menu");if(!s.is(":hidden")){var n=t(i.target);if(!(n.is(e.options.trigger.get(0))||e.options.trigger.has(n).length>0)){var o=s.offset();(i.pageX<o.left||i.pageX>o.left+s.width()||i.pageY<o.top||i.pageY>o.top+s.height())&&e.hide(i)}}}),t(window).on("resize.ui-menu-"+this.id,function(){e.element.closest(".ui-menu").is(":visible")&&e.align()})},show:function(){this.align(),this.element.closest(".ui-menu").css("z-index",++PUI.zindex).show()},hide:function(){this.element.closest(".ui-menu").fadeOut("fast")},align:function(){this.element.closest(".ui-menu").css({left:"",top:""}).position(this.positionConfig)},_destroy:function(){this.options.popup&&(t(document.body).off("click.ui-menu-"+this.id),t(window).off("resize.ui-menu-"+this.id),this.options.trigger.off(this.options.triggerEvent+".ui-menu"))}}),t.widget("primeui.puimenu",t.primeui.puibasemenu,{options:{enhanced:!1},_create:function(){var e=this;this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this.options.enhanced||this.element.wrap('<div class="ui-menu ui-widget ui-widget-content ui-corner-all ui-helper-clearfix"></div>'),this.container=this.element.parent(),this.originalParent=this.container.parent(),this.element.addClass("ui-menu-list ui-helper-reset"),this.element.children("li").each(function(){var i=t(this);if(i.children("h3").length>0)i.addClass("ui-widget-header ui-corner-all");else{i.addClass("ui-menuitem ui-widget ui-corner-all");var s=i.children("a"),n=s.data("icon");s.addClass("ui-menuitem-link ui-corner-all"),e.options.enhanced?s.children("span").addClass("ui-menuitem-text"):s.contents().wrap('<span class="ui-menuitem-text" />'),n&&s.prepend('<span class="ui-menuitem-icon fa fa-fw '+n+'"></span>')}}),this.menuitemLinks=this.element.find(".ui-menuitem-link:not(.ui-state-disabled)"),this._bindEvents(),this._super()},_bindEvents:function(){var e=this;this.menuitemLinks.on("mouseenter.ui-menu",function(e){t(this).addClass("ui-state-hover")}).on("mouseleave.ui-menu",function(e){t(this).removeClass("ui-state-hover")}),this.options.popup&&this.menuitemLinks.on("click.ui-menu",function(){e.hide()})},_unbindEvents:function(){this.menuitemLinks.off("mouseenter.ui-menu mouseleave.ui-menu"),this.options.popup&&this.menuitemLinks.off("click.ui-menu")},_destroy:function(){this._super();var e=this;this._unbindEvents(),this.element.removeClass("ui-menu-list ui-helper-reset"),this.element.children("li.ui-widget-header").removeClass("ui-widget-header ui-corner-all"),this.element.children("li:not(.ui-widget-header)").removeClass("ui-menuitem ui-widget ui-corner-all").children("a").removeClass("ui-menuitem-link ui-corner-all").each(function(){var i=t(this);i.children(".ui-menuitem-icon").remove(),e.options.enhanced?i.children(".ui-menuitem-text").removeClass("ui-menuitem-text"):i.children(".ui-menuitem-text").contents().unwrap()}),this.options.popup&&this.container.appendTo(this.originalParent),this.options.enhanced||this.element.unwrap()}}),t.widget("primeui.puibreadcrumb",{_create:function(){var e=this;this.options.enhanced||this.element.wrap('<div class="ui-breadcrumb ui-module ui-widget ui-widget-header ui-helper-clearfix ui-corner-all" role="menu">'),this.element.children("li").each(function(i){var s=t(this);s.attr("role","menuitem");var n=s.children("a");n.addClass("ui-menuitem-link"),e.options.enhanced?n.children("span").addClass("ui-menuitem-text"):n.contents().wrap('<span class="ui-menuitem-text" />'),i>0?s.before('<li class="ui-breadcrumb-chevron fa fa-chevron-right"></li>'):s.before('<li class="fa fa-home"></li>')})},_destroy:function(){var e=this;this.options.enhanced||this.unwrap(),this.element.children("li.ui-breadcrumb-chevron,.fa-home").remove(),this.element.children("li").each(function(){var i=t(this),s=i.children("a");s.removeClass("ui-menuitem-link"),e.options.enhanced?s.children(".ui-menuitem-text").removeClass("ui-menuitem-text"):s.children(".ui-menuitem-text").contents().unwrap()})}}),t.widget("primeui.puitieredmenu",t.primeui.puibasemenu,{options:{autoDisplay:!0},_create:function(){var e=this;this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this.options.enhanced||this.element.wrap('<div class="ui-tieredmenu ui-menu ui-widget ui-widget-content ui-corner-all ui-helper-clearfix"></div>'),this.container=this.element.parent(),this.originalParent=this.container.parent(),this.element.addClass("ui-menu-list ui-helper-reset"),this.element.find("li").each(function(){var i=t(this),s=i.children("a"),n=s.data("icon");if(s.addClass("ui-menuitem-link ui-corner-all"),e.options.enhanced?s.children("span").addClass("ui-menuitem-text"):s.contents().wrap('<span class="ui-menuitem-text" />'),n&&s.prepend('<span class="ui-menuitem-icon fa fa-fw '+n+'"></span>'),i.addClass("ui-menuitem ui-widget ui-corner-all"),i.children("ul").length>0){var o=i.parent().hasClass("ui-menu-child")?"fa-caret-right":e._getRootSubmenuIcon();i.addClass("ui-menu-parent"),i.children("ul").addClass("ui-widget-content ui-menu-list ui-corner-all ui-helper-clearfix ui-menu-child ui-shadow"),s.prepend('<span class="ui-submenu-icon fa fa-fw '+o+'"></span>')}}),this.links=this.element.find(".ui-menuitem-link:not(.ui-state-disabled)"),this._bindEvents(),this._super()},_bindEvents:function(){this._bindItemEvents(),this._bindDocumentHandler()},_bindItemEvents:function(){var e=this;this.links.on("mouseenter.ui-menu",function(){var i=t(this),s=i.parent(),n=e.options.autoDisplay,o=s.siblings(".ui-menuitem-active");1===o.length&&e._deactivate(o),n||e.active?s.hasClass("ui-menuitem-active")?e._reactivate(s):e._activate(s):e._highlight(s)}),this.options.autoDisplay===!1&&(this.rootLinks=this.element.find("> .ui-menuitem > .ui-menuitem-link"),this.rootLinks.data("primeui-tieredmenu-rootlink",this.id).find("*").data("primeui-tieredmenu-rootlink",this.id),this.rootLinks.on("click.ui-menu",function(i){var s=t(this),n=s.parent(),o=n.children("ul.ui-menu-child");1===o.length&&(o.is(":visible")?(e.active=!1,e._deactivate(n)):(e.active=!0,e._highlight(n),e._showSubmenu(n,o)))})),this.element.parent().find("ul.ui-menu-list").on("mouseleave.ui-menu",function(t){e.activeitem&&e._deactivate(e.activeitem),t.stopPropagation()})},_bindDocumentHandler:function(){var e=this;t(document.body).on("click.ui-menu-"+this.id,function(i){var s=t(i.target);s.data("primeui-tieredmenu-rootlink")!==e.id&&(e.active=!1,e.element.find("li.ui-menuitem-active").each(function(){e._deactivate(t(this),!0)}))})},_unbindEvents:function(){this.links.off("mouseenter.ui-menu"),this.options.autoDisplay===!1&&this.rootLinks.off("click.ui-menu"),this.element.parent().find("ul.ui-menu-list").off("mouseleave.ui-menu"),t(document.body).off("click.ui-menu-"+this.id)},_deactivate:function(t,e){this.activeitem=null,t.children("a.ui-menuitem-link").removeClass("ui-state-hover"),t.removeClass("ui-menuitem-active"),e?t.children("ul.ui-menu-child:visible").fadeOut("fast"):t.children("ul.ui-menu-child:visible").hide()},_activate:function(t){this._highlight(t);var e=t.children("ul.ui-menu-child");1===e.length&&this._showSubmenu(t,e)},_reactivate:function(t){this.activeitem=t;var e=t.children("ul.ui-menu-child"),i=e.children("li.ui-menuitem-active:first"),s=this;1===i.length&&s._deactivate(i)},_highlight:function(t){this.activeitem=t,t.children("a.ui-menuitem-link").addClass("ui-state-hover"),t.addClass("ui-menuitem-active")},_showSubmenu:function(t,e){e.css({left:t.outerWidth(),top:0,"z-index":++PUI.zindex}),e.show()},_getRootSubmenuIcon:function(){return"fa-caret-right"},_destroy:function(){this._super();var e=this;this._unbindEvents(),this.element.removeClass("ui-menu-list ui-helper-reset"),this.element.find("li").removeClass("ui-menuitem ui-widget ui-corner-all ui-menu-parent").each(function(){var i=t(this),s=i.children("a");s.removeClass("ui-menuitem-link ui-corner-all").children(".fa").remove(),e.options.enhanced?s.children(".ui-menuitem-text").removeClass("ui-menuitem-text"):s.children(".ui-menuitem-text").contents().unwrap(),i.children("ul").removeClass("ui-widget-content ui-menu-list ui-corner-all ui-helper-clearfix ui-menu-child ui-shadow")}),this.options.popup&&this.container.appendTo(this.originalParent),this.options.enhanced||this.element.unwrap()}}),t.widget("primeui.puimenubar",t.primeui.puitieredmenu,{options:{autoDisplay:!0,enhanced:!1},_create:function(){this._super(),this.options.enhanced||this.element.parent().removeClass("ui-tieredmenu").addClass("ui-menubar")},_showSubmenu:function(e,i){var s=t(window),n=null,o={"z-index":++PUI.zindex};e.parent().hasClass("ui-menu-child")?(o.left=e.outerWidth(),o.top=0,n=e.offset().top-s.scrollTop()):(o.left=0,o.top=e.outerHeight(),n=e.offset().top+o.top-s.scrollTop()),i.css("height","auto"),n+i.outerHeight()>s.height()&&(o.overflow="auto",o.height=s.height()-(n+20)),i.css(o).show()},_getRootSubmenuIcon:function(){return"fa-caret-down"}}),t.widget("primeui.puislidemenu",t.primeui.puibasemenu,{_create:function(){if(this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this._render(),this.rootList=this.element,this.content=this.element.parent(),this.wrapper=this.content.parent(),this.container=this.wrapper.parent(),this.originalParent=this.container.parent(),this.submenus=this.container.find("ul.ui-menu-list"),this.links=this.element.find("a.ui-menuitem-link:not(.ui-state-disabled)"),this.backward=this.wrapper.children("div.ui-slidemenu-backward"),this.stack=[],this.jqWidth=this.container.width(),!this.options.popup){var t=this;setTimeout(function(){t._applyDimensions()},100)}this._bindEvents(),this._super()},_render:function(){var e=this;this.options.enhanced||(this.element.wrap('<div class="ui-menu ui-slidemenu ui-widget ui-widget-content ui-corner-all"></div>').wrap('<div class="ui-slidemenu-wrapper"></div>').wrap('<div class="ui-slidemenu-content"></div>'),this.element.parent().after('<div class="ui-slidemenu-backward ui-widget-header ui-corner-all"><span class="fa fa-fw fa-caret-left"></span>Back</div>')),this.element.addClass("ui-menu-list ui-helper-reset"),this.element.find("li").each(function(){var i=t(this),s=i.children("a"),n=s.data("icon");s.addClass("ui-menuitem-link ui-corner-all"),e.options.enhanced?s.children("span").addClass("ui-menuitem-text"):s.contents().wrap('<span class="ui-menuitem-text" />'),n&&s.prepend('<span class="ui-menuitem-icon fa fa-fw '+n+'"></span>'),i.addClass("ui-menuitem ui-widget ui-corner-all"),i.children("ul").length&&(i.addClass("ui-menu-parent"),i.children("ul").addClass("ui-widget-content ui-menu-list ui-corner-all ui-helper-clearfix ui-menu-child ui-shadow"),s.prepend('<span class="ui-submenu-icon fa fa-fw fa-caret-right"></span>'))})},_destroy:function(){this._super(),this._unbindEvents();var e=this;this.element.removeClass("ui-menu-list ui-helper-reset"),this.element.find("li").removeClass("ui-menuitem ui-widget ui-corner-all ui-menu-parent").each(function(){var i=t(this),s=i.children("a");s.removeClass("ui-menuitem-link ui-corner-all").children(".fa").remove(),e.options.enhanced?s.children(".ui-menuitem-text").removeClass("ui-menuitem-text"):s.children(".ui-menuitem-text").contents().unwrap(),i.children("ul").removeClass("ui-widget-content ui-menu-list ui-corner-all ui-helper-clearfix ui-menu-child ui-shadow")}),this.options.popup&&this.container.appendTo(this.originalParent),this.options.enhanced||(this.content.next(".ui-slidemenu-backward").remove(),this.element.unwrap().unwrap().unwrap())},_bindEvents:function(){var e=this;this.links.on("mouseenter.ui-menu",function(){t(this).addClass("ui-state-hover")}).on("mouseleave.ui-menu",function(){t(this).removeClass("ui-state-hover")}).on("click.ui-menu",function(){var i=t(this),s=i.next();1==s.length&&e._forward(s)}),this.backward.on("click.ui-menu",function(){e._back()})},_unbindEvents:function(){this.links.off("mouseenter.ui-menu mouseleave.ui-menu click.ui-menu"),this.backward.off("click.ui-menu")},_forward:function(t){var e=this;this._push(t);var i=-1*(this._depth()*this.jqWidth);t.show().css({left:this.jqWidth}),this.rootList.animate({left:i},500,"easeInOutCirc",function(){e.backward.is(":hidden")&&e.backward.fadeIn("fast")})},_back:function(){if(!this.rootList.is(":animated")){var t=this,e=this._pop(),i=this._depth(),s=-1*(i*this.jqWidth);this.rootList.animate({left:s},500,"easeInOutCirc",function(){e&&e.hide(),0===i&&t.backward.fadeOut("fast")})}},_push:function(t){this.stack.push(t)},_pop:function(){return this.stack.pop()},_last:function(){return this.stack[this.stack.length-1]},_depth:function(){return this.stack.length},_applyDimensions:function(){this.submenus.width(this.container.width()),this.wrapper.height(this.rootList.outerHeight(!0)+this.backward.outerHeight(!0)),this.content.height(this.rootList.outerHeight(!0)),this.rendered=!0},show:function(){this.align(),this.container.css("z-index",++PUI.zindex).show(),this.rendered||this._applyDimensions()}}),t.widget("primeui.puicontextmenu",t.primeui.puitieredmenu,{options:{autoDisplay:!0,target:null,event:"contextmenu"},_create:function(){this._super(),this.element.parent().removeClass("ui-tieredmenu").addClass("ui-contextmenu ui-menu-dynamic ui-shadow");var e=this;this.options.target&&(this.options.target=t(this.options.target),this.options.target.hasClass("ui-datatable")?e._bindDataTable():this.options.target.on(this.options.event+".ui-contextmenu",function(t){e.show(t)})),this.element.parent().parent().is(document.body)||this.element.parent().appendTo("body")},_bindDocumentHandler:function(){var e=this;t(document.body).on("click.ui-contextmenu."+this.id,function(t){e.element.parent().is(":hidden")||e._hide()})},_bindDataTable:function(){var e="#"+this.options.target.attr("id")+" tbody.ui-datatable-data > tr.ui-widget-content:not(.ui-datatable-empty-message)",i=this.options.event+".ui-datatable",s=this;t(document).off(i,e).on(i,e,null,function(e){s.options.target.puidatatable("onRowRightClick",i,t(this)),s.show(e)})},_unbindDataTable:function(){t(document).off(this.options.event+".ui-datatable","#"+this.options.target.attr("id")+" tbody.ui-datatable-data > tr.ui-widget-content:not(.ui-datatable-empty-message)")},_unbindEvents:function(){this._super(),this.options.target&&(this.options.target.hasClass("ui-datatable")?this._unbindDataTable():this.options.target.off(this.options.event+".ui-contextmenu")),t(document.body).off("click.ui-contextmenu."+this.id)},show:function(e){t(document.body).children(".ui-contextmenu:visible").hide();var i=t(window),s=e.pageX,n=e.pageY,o=this.element.parent().outerWidth(),a=this.element.parent().outerHeight();s+o>i.width()+i.scrollLeft()&&(s-=o),n+a>i.height()+i.scrollTop()&&(n-=a),this.options.beforeShow&&this.options.beforeShow.call(this),this.element.parent().css({left:s,top:n,"z-index":++PUI.zindex}).show(),e.preventDefault(),e.stopPropagation()},_hide:function(){var e=this;this.element.parent().find("li.ui-menuitem-active").each(function(){e._deactivate(t(this),!0)}),this.element.parent().fadeOut("fast")},isVisible:function(){return this.element.parent().is(":visible")},getTarget:function(){return this.jqTarget},_destroy:function(){var e=this;this._unbindEvents(),this.element.removeClass("ui-menu-list ui-helper-reset"),this.element.find("li").removeClass("ui-menuitem ui-widget ui-corner-all ui-menu-parent").each(function(){var i=t(this),s=i.children("a");s.removeClass("ui-menuitem-link ui-corner-all").children(".fa").remove(),e.options.enhanced?s.children(".ui-menuitem-text").removeClass("ui-menuitem-text"):s.children(".ui-menuitem-text").contents().unwrap(),i.children("ul").removeClass("ui-widget-content ui-menu-list ui-corner-all ui-helper-clearfix ui-menu-child ui-shadow")}),this.container.appendTo(this.originalParent),this.options.enhanced||this.element.unwrap()}}),t.widget("primeui.puimegamenu",t.primeui.puibasemenu,{options:{autoDisplay:!0,orientation:"horizontal",enhanced:!1},_create:function(){this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this._render(),this.rootList=this.element.children("ul"),this.rootLinks=this.rootList.children("li").children("a"),this.subLinks=this.element.find(".ui-megamenu-panel a.ui-menuitem-link"),this.keyboardTarget=this.element.children(".ui-helper-hidden-accessible"),this._bindEvents(),this._bindKeyEvents()},_render:function(){var e=this;this.options.enhanced||(this.element.prepend('<div tabindex="0" class="ui-helper-hidden-accessible"></div>'),this.element.addClass("ui-menu ui-menubar ui-megamenu ui-widget ui-widget-content ui-corner-all ui-helper-clearfix"),this._isVertical()&&this.element.addClass("ui-megamenu-vertical")),this.element.children("ul").addClass("ui-menu-list ui-helper-reset"),this.element.find("li").each(function(){var i=t(this),s=i.children("a"),n=s.data("icon");if(s.addClass("ui-menuitem-link ui-corner-all"),e.options.enhanced?s.children("span").addClass("ui-menuitem-text"):s.contents().wrap('<span class="ui-menuitem-text" />'),n&&s.prepend('<span class="ui-menuitem-icon fa fa-fw '+n+'"></span>'),i.addClass("ui-menuitem ui-widget ui-corner-all"),i.parent().addClass("ui-menu-list ui-helper-reset"),i.children("h3").length)i.addClass("ui-widget-header ui-corner-all"),i.removeClass("ui-widget ui-menuitem");else if(i.children("div").length){var o=e._isVertical()?"fa-caret-right":"fa-caret-down";i.addClass("ui-menu-parent"),i.children("div").addClass("ui-megamenu-panel ui-widget-content ui-menu-list ui-corner-all ui-helper-clearfix ui-menu-child ui-shadow"),s.addClass("ui-submenu-link").prepend('<span class="ui-submenu-icon fa fa-fw '+o+'"></span>')}})},_destroy:function(){var e=this;this._unbindEvents(),this.options.enhanced||(this.element.children(".ui-helper-hidden-accessible").remove(),this.element.removeClass("ui-menu ui-menubar ui-megamenu ui-widget ui-widget-content ui-corner-all ui-helper-clearfix ui-megamenu-vertical")),this.element.find("li").each(function(){var i=t(this),s=i.children("a");if(s.removeClass("ui-menuitem-link ui-corner-all"),e.options.enhanced?s.children("span").removeClass("ui-menuitem-text"):s.contents().unwrap(),s.children(".ui-menuitem-icon").remove(),i.removeClass("ui-menuitem ui-widget ui-corner-all").parent().removeClass("ui-menu-list ui-helper-reset"),i.children("h3").length)i.removeClass("ui-widget-header ui-corner-all");else if(i.children("div").length){e._isVertical()?"fa-caret-right":"fa-caret-down";i.removeClass("ui-menu-parent"),i.children("div").removeClass("ui-megamenu-panel ui-widget-content ui-menu-list ui-corner-all ui-helper-clearfix ui-menu-child ui-shadow"),s.removeClass("ui-submenu-link").children(".ui-submenu-icon").remove()}})},_bindEvents:function(){var e=this;this.rootLinks.on("mouseenter.ui-megamenu",function(i){var s=t(this),n=s.parent(),o=n.siblings(".ui-menuitem-active");o.length>0&&(o.find("li.ui-menuitem-active").each(function(){e._deactivate(t(this))}),e._deactivate(o,!1)),e.options.autoDisplay||e.active?e._activate(n):e._highlight(n)}),this.options.autoDisplay===!1?(this.rootLinks.data("primefaces-megamenu",this.id).find("*").data("primefaces-megamenu",this.id),this.rootLinks.on("click.ui-megamenu",function(i){var s=t(this),n=s.parent(),o=s.next();1===o.length&&(o.is(":visible")?(e.active=!1,e._deactivate(n,!0)):(e.active=!0,e._activate(n))),i.preventDefault()})):this.rootLinks.filter(".ui-submenu-link").on("click.ui-megamenu",function(t){t.preventDefault()}),this.subLinks.on("mouseenter.ui-megamenu",function(){e.activeitem&&!e.isRootLink(e.activeitem)&&e._deactivate(e.activeitem),e._highlight(t(this).parent())}).on("mouseleave.ui-megamenu",function(){e.activeitem&&!e.isRootLink(e.activeitem)&&e._deactivate(e.activeitem),t(this).removeClass("ui-state-hover")}),this.rootList.on("mouseleave.ui-megamenu",function(t){var i=e.rootList.children(".ui-menuitem-active");1===i.length&&e._deactivate(i,!1)}),this.rootList.find("> li.ui-menuitem > ul.ui-menu-child").on("mouseleave.ui-megamenu",function(t){t.stopPropagation()}),t(document.body).on("click."+this.id,function(i){var s=t(i.target);s.data("primefaces-megamenu")!==e.id&&(e.active=!1,e._deactivate(e.rootList.children("li.ui-menuitem-active"),!0))})},_unbindEvents:function(){this.rootLinks.off("mouseenter.ui-megamenu mouselave.ui-megamenu click.ui-megamenu"),this.subLinks.off("mouseenter.ui-megamenu mouselave.ui-megamenu"),this.rootList.off("mouseleave.ui-megamenu"),this.rootList.find("> li.ui-menuitem > ul.ui-menu-child").off("mouseleave.ui-megamenu"),t(document.body).off("click."+this.id)},_isVertical:function(){return"vertical"===this.options.orientation},_deactivate:function(t,e){var i=t.children("a.ui-menuitem-link"),s=i.next();t.removeClass("ui-menuitem-active"),i.removeClass("ui-state-hover"),this.activeitem=null,s.length>0&&(e?s.fadeOut("fast"):s.hide())},_activate:function(t){var e=t.children(".ui-megamenu-panel"),i=this;i._highlight(t),e.length>0&&i._showSubmenu(t,e)},_highlight:function(t){var e=t.children("a.ui-menuitem-link");t.addClass("ui-menuitem-active"),e.addClass("ui-state-hover"),this.activeitem=t},_showSubmenu:function(t,e){var i=null;i=this._isVertical()?{my:"left top",at:"right top",of:t,collision:"flipfit"}:{my:"left top",at:"left bottom",of:t,collision:"flipfit"},e.css({"z-index":++PUI.zindex}),e.show().position(i)},_bindKeyEvents:function(){var e=this;this.keyboardTarget.on("focus.ui-megamenu",function(t){e._highlight(e.rootLinks.eq(0).parent())}).on("blur.ui-megamenu",function(){e._reset()}).on("keydown.ui-megamenu",function(i){var s=e.activeitem;if(s){var n=e._isRootLink(s),o=t.ui.keyCode;switch(i.which){case o.LEFT:if(n&&!e._isVertical()){var a=s.prevAll(".ui-menuitem:first");a.length&&(e._deactivate(s),e._highlight(a)),i.preventDefault()}else if(s.hasClass("ui-menu-parent")&&s.children(".ui-menu-child").is(":visible"))e._deactivate(s),e._highlight(s);else{var l=s.closest(".ui-menu-child").parent();l.length&&(e._deactivate(s),e._deactivate(l),e._highlight(l))}break;case o.RIGHT:if(n&&!e._isVertical()){var r=s.nextAll(".ui-menuitem:visible:first");r.length&&(e._deactivate(s),e._highlight(r)),i.preventDefault()}else if(s.hasClass("ui-menu-parent")){var h=s.children(".ui-menu-child");h.is(":visible")?e._highlight(h.find(".ui-menu-list:visible > .ui-menuitem:visible:first")):e._activate(s)}break;case o.UP:if(!n||e._isVertical()){var a=e._findPrevItem(s);a.length&&(e._deactivate(s),e._highlight(a))}i.preventDefault();break;case o.DOWN:if(n&&!e._isVertical()){var h=s.children(".ui-menu-child");if(h.is(":visible")){var u=e._getFirstMenuList(h);e._highlight(u.children(".ui-menuitem:visible:first"))}else e._activate(s)}else{var r=e._findNextItem(s);r.length&&(e._deactivate(s),e._highlight(r))}i.preventDefault();break;case o.ENTER:case o.NUMPAD_ENTER:var d=s.children(".ui-menuitem-link");d.trigger("click"),e.element.blur();var c=d.attr("href");c&&"#"!==c&&(window.location.href=c),e._deactivate(s),i.preventDefault();break;case o.ESCAPE:if(s.hasClass("ui-menu-parent")){var h=s.children(".ui-menu-list:visible");h.length>0&&h.hide()}else{var l=s.closest(".ui-menu-child").parent();l.length&&(e._deactivate(s),e._deactivate(l),e._highlight(l))}i.preventDefault()}}})},_findPrevItem:function(t){var e=t.prev(".ui-menuitem");if(!e.length){var i=t.closest("ul.ui-menu-list").prev(".ui-menu-list");i.length||(i=t.closest("div").prev("div").children(".ui-menu-list:visible:last")),i.length&&(e=i.find("li.ui-menuitem:visible:last"))}return e},_findNextItem:function(t){var e=t.next(".ui-menuitem");if(!e.length){var i=t.closest("ul.ui-menu-list").next(".ui-menu-list");i.length||(i=t.closest("div").next("div").children(".ui-menu-list:visible:first")),i.length&&(e=i.find("li.ui-menuitem:visible:first"))}return e},_getFirstMenuList:function(t){return t.find(".ui-menu-list:not(.ui-state-disabled):first")},_isRootLink:function(t){var e=t.closest("ul");return e.parent().hasClass("ui-menu")},_reset:function(){var e=this;this.active=!1,this.element.find("li.ui-menuitem-active").each(function(){e._deactivate(t(this),!0)})},isRootLink:function(t){var e=t.closest("ul");return e.parent().hasClass("ui-menu")}}),t.widget("primeui.puipanelmenu",t.primeui.puibasemenu,{options:{stateful:!1,enhanced:!1},_create:function(){this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this.panels=this.element.children("div"),this._render(),this.headers=this.element.find("> .ui-panelmenu-panel > div.ui-panelmenu-header:not(.ui-state-disabled)"),this.contents=this.element.find("> .ui-panelmenu-panel > .ui-panelmenu-content"),this.menuitemLinks=this.contents.find(".ui-menuitem-link:not(.ui-state-disabled)"),this.treeLinks=this.contents.find(".ui-menu-parent > .ui-menuitem-link:not(.ui-state-disabled)"),this._bindEvents(),this.options.stateful&&(this.stateKey="panelMenu-"+this.id),this._restoreState()},_render:function(){var e=this;this.options.enhanced||this.element.addClass("ui-panelmenu ui-widget"),this.panels.addClass("ui-panelmenu-panel"),this.element.find("li").each(function(){var i=t(this),s=i.children("a"),n=s.data("icon");s.addClass("ui-menuitem-link ui-corner-all"),e.options.enhanced?s.children("span").addClass("ui-menuitem-text"):s.contents().wrap('<span class="ui-menuitem-text" />'),n&&s.prepend('<span class="ui-menuitem-icon fa fa-fw '+n+'"></span>'),i.children("ul").length&&(i.addClass("ui-menu-parent"),s.prepend('<span class="ui-panelmenu-icon fa fa-fw fa-caret-right"></span>'),i.children("ul").addClass("ui-helper-hidden"),n&&s.addClass("ui-menuitem-link-hasicon")),i.addClass("ui-menuitem ui-widget ui-corner-all"),i.parent().addClass("ui-menu-list ui-helper-reset")}),this.panels.children(":first-child").attr("tabindex","0").each(function(){var e=t(this),i=e.children("a"),s=i.data("icon");s&&i.addClass("ui-panelmenu-headerlink-hasicon").prepend('<span class="ui-menuitem-icon fa fa-fw '+s+'"></span>'),e.addClass("ui-widget ui-panelmenu-header ui-state-default ui-corner-all").prepend('<span class="ui-panelmenu-icon fa fa-fw fa-caret-right"></span>')}),this.panels.children(":last-child").attr("tabindex","0").addClass("ui-panelmenu-content ui-widget-content ui-helper-hidden")},_destroy:function(){var e=this;this._unbindEvents(),this.options.enhanced||this.element.removeClass("ui-panelmenu ui-widget"),this.panels.removeClass("ui-panelmenu-panel"),this.headers.removeClass("ui-widget ui-panelmenu-header ui-state-default ui-state-hover ui-state-active ui-corner-all ui-corner-top").removeAttr("tabindex"),this.contents.removeClass("ui-panelmenu-content ui-widget-content ui-helper-hidden").removeAttr("tabindex"),this.contents.find("ul").removeClass("ui-menu-list ui-helper-reset ui-helper-hidden"),this.headers.each(function(){var e=t(this),i=e.children("a");e.children(".fa").remove(),i.removeClass("ui-panelmenu-headerlink-hasicon"),i.children(".fa").remove()}),this.element.find("li").each(function(){var i=t(this),s=i.children("a");s.removeClass("ui-menuitem-link ui-corner-all ui-menuitem-link-hasicon"),e.options.enhanced?s.children("span").removeClass("ui-menuitem-text"):s.contents().unwrap(),s.children(".fa").remove(),i.removeClass("ui-menuitem ui-widget ui-corner-all ui-menu-parent").parent().removeClass("ui-menu-list ui-helper-reset ui-helper-hidden ")})},_unbindEvents:function(){this.headers.off("mouseover.ui-panelmenu mouseout.ui-panelmenu click.ui-panelmenu"),this.menuitemLinks.off("mouseover.ui-panelmenu mouseout.ui-panelmenu click.ui-panelmenu"),this.treeLinks.off("click.ui-panelmenu"),this._unbindKeyEvents()},_bindEvents:function(){var e=this;this.headers.on("mouseover.ui-panelmenu",function(){var e=t(this);e.hasClass("ui-state-active")||e.addClass("ui-state-hover")}).on("mouseout.ui-panelmenu",function(){var e=t(this);e.hasClass("ui-state-active")||e.removeClass("ui-state-hover")}).on("click.ui-panelmenu",function(i){var s=t(this);s.hasClass("ui-state-active")?e._collapseRootSubmenu(t(this)):e._expandRootSubmenu(t(this),!1),e._removeFocusedItem(),s.focus(),i.preventDefault()}),this.menuitemLinks.on("mouseover.ui-panelmenu",function(){t(this).addClass("ui-state-hover")}).on("mouseout.ui-panelmenu",function(){t(this).removeClass("ui-state-hover")}).on("click.ui-panelmenu",function(i){var s=t(this);e._focusItem(s.closest(".ui-menuitem"));var n=s.attr("href");n&&"#"!==n&&(window.location.href=n),i.preventDefault()}),this.treeLinks.on("click.ui-panelmenu",function(i){var s=t(this),n=s.parent(),o=s.next();o.is(":visible")?(s.children("span.fa-caret-down").length&&s.children("span.fa-caret-down").removeClass("fa-caret-down").addClass("fa-caret-right"),e._collapseTreeItem(n)):(s.children("span.fa-caret-right").length&&s.children("span.fa-caret-right").removeClass("fa-caret-right").addClass("fa-caret-down"),e._expandTreeItem(n,!1)),i.preventDefault()}),this._bindKeyEvents()},_bindKeyEvents:function(){var e=this;PUI.isIE()&&(this.focusCheck=!1),this.headers.on("focus.panelmenu",function(){t(this).addClass("ui-menuitem-outline")}).on("blur.panelmenu",function(){t(this).removeClass("ui-menuitem-outline ui-state-hover")}).on("keydown.panelmenu",function(e){var i=t.ui.keyCode,s=e.which;s!==i.SPACE&&s!==i.ENTER&&s!==i.NUMPAD_ENTER||(t(this).trigger("click"),e.preventDefault())}),this.contents.on("mousedown.panelmenu",function(e){t(e.target).is(":not(:input:enabled)")&&e.preventDefault()}).on("focus.panelmenu",function(){e.focusedItem||(e._focusItem(e._getFirstItemOfContent(t(this))),PUI.isIE()&&(e.focusCheck=!1))}).on("keydown.panelmenu",function(i){if(e.focusedItem){var s=t.ui.keyCode;switch(i.which){case s.LEFT:if(e._isExpanded(e.focusedItem))e.focusedItem.children(".ui-menuitem-link").trigger("click");else{var n=e.focusedItem.closest("ul.ui-menu-list");n.parent().is(":not(.ui-panelmenu-content)")&&e._focusItem(n.closest("li.ui-menuitem"))}i.preventDefault();break;case s.RIGHT:e.focusedItem.hasClass("ui-menu-parent")&&!e._isExpanded(e.focusedItem)&&e.focusedItem.children(".ui-menuitem-link").trigger("click"),i.preventDefault();break;case s.UP:var o=null,a=e.focusedItem.prev();a.length?(o=a.find("li.ui-menuitem:visible:last"),o.length||(o=a)):o=e.focusedItem.closest("ul").parent("li"),o.length&&e._focusItem(o),i.preventDefault();break;case s.DOWN:var o=null,l=e.focusedItem.find("> ul > li:visible:first");l.length?o=l:e.focusedItem.next().length?o=e.focusedItem.next():0===e.focusedItem.next().length&&(o=e._searchDown(e.focusedItem)),o&&o.length&&e._focusItem(o),i.preventDefault();break;case s.ENTER:case s.NUMPAD_ENTER:case s.SPACE:var r=e.focusedItem.children(".ui-menuitem-link");setTimeout(function(){r.trigger("click")},1),e.element.blur();var h=r.attr("href");h&&"#"!==h&&(window.location.href=h),i.preventDefault();break;case s.TAB:e.focusedItem&&(PUI.isIE()&&(e.focusCheck=!0),t(this).focus())}}}).on("blur.panelmenu",function(t){PUI.isIE()&&!e.focusCheck||e._removeFocusedItem()});var i="click."+this.id;t(document.body).off(i).on(i,function(i){t(i.target).closest(".ui-panelmenu").length||e._removeFocusedItem()})},_unbindKeyEvents:function(){this.headers.off("focus.panelmenu blur.panelmenu keydown.panelmenu"),this.contents.off("mousedown.panelmenu focus.panelmenu keydown.panelmenu blur.panelmenu"),t(document.body).off("click."+this.id)},_isExpanded:function(t){return t.children("ul.ui-menu-list").is(":visible")},_searchDown:function(t){var e=t.closest("ul").parent("li").next(),i=null;return i=e.length?e:0===t.closest("ul").parent("li").length?t:this._searchDown(t.closest("ul").parent("li"))},_getFirstItemOfContent:function(t){return t.find("> .ui-menu-list > .ui-menuitem:visible:first-child")},_collapseRootSubmenu:function(t){var e=t.next();t.attr("aria-expanded",!1).removeClass("ui-state-active ui-corner-top").addClass("ui-state-hover ui-corner-all"),
t.children("span.fa").removeClass("fa-caret-down").addClass("fa-caret-right"),e.attr("aria-hidden",!0).slideUp("normal","easeInOutCirc"),this._removeAsExpanded(e)},_expandRootSubmenu:function(t,e){var i=t.next();t.attr("aria-expanded",!0).addClass("ui-state-active ui-corner-top").removeClass("ui-state-hover ui-corner-all"),t.children("span.fa").removeClass("fa-caret-right").addClass("fa-caret-down"),e?i.attr("aria-hidden",!1).show():(i.attr("aria-hidden",!1).slideDown("normal","easeInOutCirc"),this._addAsExpanded(i))},_restoreState:function(){var e=null;if(this.options.stateful&&(e=PUI.getCookie(this.stateKey)),e){this._collapseAll(),this.expandedNodes=e.split(",");for(var i=0;i<this.expandedNodes.length;i++){var s=t(PUI.escapeClientId(this.expandedNodes[i]));s.is("div.ui-panelmenu-content")?this._expandRootSubmenu(s.prev(),!0):s.is("li.ui-menu-parent")&&this._expandTreeItem(s,!0)}}else{this.expandedNodes=[];for(var n=this.headers.filter(".ui-state-active"),o=this.element.find(".ui-menu-parent > .ui-menu-list:not(.ui-helper-hidden)"),i=0;i<n.length;i++)this.expandedNodes.push(n.eq(i).next().attr("id"));for(var i=0;i<o.length;i++)this.expandedNodes.push(o.eq(i).parent().attr("id"))}},_collapseAll:function(){this.headers.filter(".ui-state-active").each(function(){var e=t(this);e.removeClass("ui-state-active").next().addClass("ui-helper-hidden")}),this.element.find(".ui-menu-parent > .ui-menu-list:not(.ui-helper-hidden)").each(function(){t(this).addClass("ui-helper-hidden")})},_removeAsExpanded:function(e){var i=e.attr("id");this.expandedNodes=t.grep(this.expandedNodes,function(t){return t!=i}),this._saveState()},_addAsExpanded:function(t){this.expandedNodes.push(t.attr("id")),this._saveState()},_removeFocusedItem:function(){this.focusedItem&&(this._getItemText(this.focusedItem).removeClass("ui-menuitem-outline"),this.focusedItem=null)},_focusItem:function(t){this._removeFocusedItem(),this._getItemText(t).addClass("ui-menuitem-outline").focus(),this.focusedItem=t},_getItemText:function(t){return t.find("> .ui-menuitem-link > span.ui-menuitem-text")},_expandTreeItem:function(t,e){var i=t.find("> .ui-menuitem-link");i.find("> .ui-menuitem-text").attr("aria-expanded",!0),t.children(".ui-menu-list").show(),e||this._addAsExpanded(t)},_collapseTreeItem:function(t){var e=t.find("> .ui-menuitem-link");e.find("> .ui-menuitem-text").attr("aria-expanded",!1),t.children(".ui-menu-list").hide(),this._removeAsExpanded(t)},_removeAsExpanded:function(e){var i=e.attr("id");this.expandedNodes=t.grep(this.expandedNodes,function(t){return t!=i}),this._saveState()},_addAsExpanded:function(t){this.expandedNodes.push(t.attr("id")),this._saveState()},_saveState:function(){if(this.options.stateful){var t=this.expandedNodes.join(",");PUI.setCookie(this.stateKey,t,{path:"/"})}},_clearState:function(){this.options.stateful&&PUI.deleteCookie(this.stateKey,{path:"/"})}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puimessages",{options:{closable:!0},_create:function(){this.element.addClass("ui-messages ui-widget ui-corner-all"),this.options.closable&&(this.closer=t('<a href="#" class="ui-messages-close"><i class="fa fa-close"></i></a>').appendTo(this.element)),this.element.append('<span class="ui-messages-icon fa fa-2x"></span>'),this.msgContainer=t("<ul></ul>").appendTo(this.element),this._bindEvents()},_bindEvents:function(){var t=this;this.options.closable&&this.closer.on("click",function(e){t.element.slideUp(),e.preventDefault()})},show:function(e,i){if(this.clear(),this.element.removeClass("ui-messages-info ui-messages-warn ui-messages-error").addClass("ui-messages-"+e),this.element.children(".ui-messages-icon").removeClass("fa-info-circle fa-close fa-warning").addClass(this._getIcon(e)),t.isArray(i))for(var s=0;s<i.length;s++)this._showMessage(i[s]);else this._showMessage(i);this.element.show()},_showMessage:function(t){this.msgContainer.append('<li><span class="ui-messages-summary">'+t.summary+'</span><span class="ui-messages-detail">'+t.detail+"</span></li>")},clear:function(){this.msgContainer.children().remove(),this.element.hide()},_getIcon:function(t){switch(t){case"info":return"fa-info-circle";case"warn":return"fa-warning";case"error":return"fa-close";default:return"fa-info-circle"}}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puimultiselect",{options:{defaultLabel:"Choose",caseSensitive:!1,filterMatchMode:"startsWith",filterFunction:null,data:null,scrollHeight:200,style:null,styleClass:null,value:null},_create:function(){if(this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this.options.data&&t.isArray(this.options.data)&&this._generateOptionElements(this.options.data),this._render(),this.options.style&&this.container.attr("style",this.options.style),this.options.styleClass&&this.container.addClass(this.options.styleClass),this.triggers=this.container.find(".ui-multiselect-trigger, .ui-multiselect-label"),this.label=this.labelContainer.find(".ui-multiselect-label"),this._generateItems(),this.options.value&&this.options.value.length){for(var e=(this.items.find(".ui-chkbox-box"),0);e<this.options.value.length;e++){var i=this.findSelectionIndex(this.options.value[e]);this.selectItem(this.items.eq(i))}this.updateLabel()}this._bindEvents()},_render:function(){this.choices=this.element.children("option"),this.element.attr("tabindex","0").wrap('<div class="ui-multiselect ui-widget ui-state-default ui-corner-all ui-shadow" />').wrap('<div class="ui-helper-hidden-accessible" />'),this.container=this.element.closest(".ui-multiselect"),this.container.append('<div class="ui-helper-hidden-accessible"><input readonly="readonly" type="text" /></div>'),this.labelContainer=t('<div class="ui-multiselect-label-container"><label class="ui-multiselect-label ui-corner-all">'+this.options.defaultLabel+"</label></div>").appendTo(this.container),this.menuIcon=t('<div class="ui-multiselect-trigger ui-state-default ui-corner-right"><span class="fa fa-fw fa-caret-down"></span></div>').appendTo(this.container),this._renderPanel(),this.filterContainer=t('<div class="ui-multiselect-filter-container" />').appendTo(this.panelHeader),this.filterInput=t('<input type="text" aria-readonly="false" aria-disabled="false" aria-multiline="false" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" />').appendTo(this.filterContainer),this.filterContainer.append('<span class="fa fa-search"></span>'),this.closeIcon=t('<a class="ui-multiselect-close ui-corner-all" href="#"><span class="fa fa-close"></span></a>').appendTo(this.panelHeader),this.container.append(this.panel)},_renderPanel:function(){this.panel=t('<div id="'+this.element.attr("id")+'_panel"class="ui-multiselect-panel ui-widget ui-widget-content ui-corner-all ui-helper-hidden"/>'),this.panelHeader=t('<div class="ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix"></div>').appendTo(this.panel),this.toggler=t('<div class="ui-chkbox ui-widget"><div class="ui-helper-hidden-accessible"><input readonly="readonly" type="checkbox"/></div><div class="ui-chkbox-box ui-widget ui-corner-all ui-state-default"><span class="ui-chkbox-icon ui-c fa fa-fw"></span></div></div>'),this.togglerBox=this.toggler.children(".ui-chkbox-box"),this.panelHeader.append(this.toggler),this.itemsWrapper=t('<div class="ui-multiselect-items-wrapper" />').appendTo(this.panel),this.itemContainer=t('<ul class="ui-multiselect-items ui-multiselect-list ui-widget-content ui-widget ui-corner-all ui-helper-reset"></ul>').appendTo(this.itemsWrapper),this.itemsWrapper.css("max-height",this.options.scrollHeight)},_generateItems:function(){for(var e=0;e<this.choices.length;e++){var i=this.choices.eq(e),s=i.text();this.listItems=t('<li data-label="'+s+'" class="ui-multiselect-item ui-corner-all"><div class="ui-chkbox ui-widget"><div class="ui-helper-hidden-accessible"><input readonly="readonly" type="checkbox"/></div><div class="ui-chkbox-box ui-widget ui-corner-all ui-state-default"><span class="ui-chkbox-icon ui-c fa fa-fw"></span></div></div><label>'+s+"</label></li>").appendTo(this.itemContainer)}this.items=this.itemContainer.children(".ui-multiselect-item")},_generateOptionElements:function(t){for(var e=0;e<t.length;e++){var i=t[e];i.label?this.element.append('<option value="'+i.value+'">'+i.label+"</option>"):this.element.append('<option value="'+i+'">'+i+"</option>")}},_bindEvents:function(){var e=this,i="click."+this.id,s="resize."+this.id;this._bindItemEvents(this.items.filter(":not(.ui-state-disabled)")),this._bindCheckboxHover(this.togglerBox),this.togglerBox.on("click.puimultiselect",function(){var i=t(this);i.children(".ui-chkbox-icon").hasClass("fa-check")?e.uncheckAll():e.checkAll(),e.updateLabel()}),this._setupFilterMatcher(),this.filterInput.on("keyup.puimultiselect",function(){t(this).trigger("focus"),e.filter(t(this).val())}).on("focus.puimultiselect",function(){t(this).addClass("ui-state-focus")}).on("blur.puimultiselect",function(){t(this).removeClass("ui-state-focus")}),this.element.on("focus.puimultiselect",function(){e.container.addClass("ui-state-focus")}).on("blur.puimultiselect",function(){e.container.removeClass("ui-state-focus")}),this.closeIcon.on("mouseenter.puimultiselect",function(){t(this).addClass("ui-state-hover")}).on("mouseleave.puimultiselect",function(){t(this).removeClass("ui-state-hover")}).on("click.puimultiselect",function(t){e.hide(!0),t.preventDefault()}),this.triggers.on("mouseover.puimultiselect",function(){e.disabled||e.triggers.hasClass("ui-state-focus")||e.triggers.addClass("ui-state-hover")}).on("mouseout.puimultiselect",function(){e.disabled||e.triggers.removeClass("ui-state-hover")}).on("click.puimultiselect",function(t){e.disabled||(e.panel.is(":hidden")?e.show():e.hide(!0))}).on("focus.puimultiselect",function(){t(this).addClass("ui-state-focus")}).on("blur.puimultiselect",function(){t(this).removeClass("ui-state-focus")}).on("click.puimultiselect",function(t){e.element.trigger("focus.puimultiselect"),t.preventDefault()}),this._bindKeyEvents(),t(document.body).off(i).on(i,function(i){if(!e.panel.is(":hidden")){var s=t(i.target);if(!(e.triggers.is(s)||e.triggers.has(s).length>0)){var n=e.panel.offset();(i.pageX<n.left||i.pageX>n.left+e.panel.width()||i.pageY<n.top||i.pageY>n.top+e.panel.height())&&e.hide(!0)}}}),t(window).off(s).on(s,function(){e.panel.is(":visible")&&e.alignPanel()})},_bindItemEvents:function(e){var i=this;e.on("mouseover.puimultiselect",function(){var e=t(this);e.hasClass("ui-state-highlight")||t(this).addClass("ui-state-hover")}).on("mouseout.puimultiselect",function(){t(this).removeClass("ui-state-hover")}).on("click.puimultiselect",function(){i._toggleItem(t(this)),PUI.clearSelection()})},_bindKeyEvents:function(){var e=this;this.element.on("focus.puimultiselect",function(){t(this).addClass("ui-state-focus"),e.menuIcon.addClass("ui-state-focus")}).on("blur.puimultiselect",function(){t(this).removeClass("ui-state-focus"),e.menuIcon.removeClass("ui-state-focus")}).on("keydown.puimultiselect",function(i){var s=t.ui.keyCode,n=i.which;switch(n){case s.ENTER:case s.NUMPAD_ENTER:e.panel.is(":hidden")?e.show():e.hide(!0),i.preventDefault();break;case s.TAB:e.panel.is(":visible")&&(e.toggler.find("> div.ui-helper-hidden-accessible > input").trigger("focus"),i.preventDefault())}}),this.closeIcon.on("focus.puimultiselect",function(t){e.closeIcon.addClass("ui-state-focus")}).on("blur.puimultiselect",function(t){e.closeIcon.removeClass("ui-state-focus")}).on("keydown.puimultiselect",function(i){var s=t.ui.keyCode,n=i.which;n!==s.ENTER&&n!==s.NUMPAD_ENTER||(e.hide(!0),i.preventDefault())});var i=this.toggler.find("> div.ui-helper-hidden-accessible > input");this._bindCheckboxKeyEvents(i),i.on("keyup.puimultiselect",function(i){if(i.which===t.ui.keyCode.SPACE){var s=t(this);s.prop("checked")?e.uncheckAll():e.checkAll(),i.preventDefault()}});var s=this.itemContainer.find("> li > div.ui-chkbox > div.ui-helper-hidden-accessible > input");this._bindCheckboxKeyEvents(s),s.on("keyup.selectCheckboxMenu",function(i){if(i.which===t.ui.keyCode.SPACE){var s=t(this);s.parent().next();e._toggleItem(s.closest("li")),i.preventDefault()}})},_bindCheckboxHover:function(e){e.on("mouseenter.puimultiselect",function(){var e=t(this);e.hasClass("ui-state-active")||e.hasClass("ui-state-disabled")||e.addClass("ui-state-hover")}).on("mouseleave.puimultiselect",function(){t(this).removeClass("ui-state-hover")})},_bindCheckboxKeyEvents:function(e){e.on("focus.puimultiselect",function(e){var i=t(this),s=i.parent().next();i.prop("checked")&&s.removeClass("ui-state-active"),s.addClass("ui-state-focus")}).on("blur.puimultiselect",function(e){var i=t(this),s=i.parent().next();i.prop("checked")&&s.addClass("ui-state-active"),s.removeClass("ui-state-focus")}).on("keydown.puimultiselect",function(e){e.which===t.ui.keyCode.SPACE&&e.preventDefault()})},_toggleItem:function(t){t.hasClass("ui-state-highlight")?this.unselectItem(t):this.selectItem(t),this.updateLabel(),this.updateToggler()},selectItem:function(t){var e=t.find("> .ui-chkbox");t.addClass("ui-state-highlight"),e.find(":checkbox").prop("checked",!0),e.find("> .ui-chkbox-box > .ui-chkbox-icon").addClass("fa-check"),this.choices.eq(t.index()).prop("selected",!0)},unselectItem:function(t){var e=t.find("> .ui-chkbox");t.removeClass("ui-state-highlight"),e.find(":checkbox").prop("checked",!1),e.find("> .ui-chkbox-box > .ui-chkbox-icon").removeClass("fa-check"),this.choices.eq(t.index()).prop("selected",!1)},filter:function(e){var i=this.options.caseSensitive?t.trim(e):t.trim(e).toLowerCase();if(""===i)this.itemContainer.children("li.ui-multiselect-item").filter(":hidden").show();else for(var s=0;s<this.choices.length;s++){var n=this.choices.eq(s),o=this.items.eq(s),a=this.options.caseSensitive?n.text():n.text().toLowerCase();this.filterMatcher(a,i)?o.show():o.hide()}this.updateToggler()},_setupFilterMatcher:function(){this.options.filterMatchMode=this.options.filterMatchMode||"startsWith",this.filterMatchers={startsWith:this.startsWithFilter,contains:this.containsFilter,endsWith:this.endsWithFilter,custom:this.options.filterFunction},this.filterMatcher=this.filterMatchers[this.options.filterMatchMode]},startsWithFilter:function(t,e){return 0===t.indexOf(e)},containsFilter:function(t,e){return-1!==t.indexOf(e)},endsWithFilter:function(t,e){return-1!==t.indexOf(e,t.length-e.length)},show:function(){this.alignPanel(),this.panel.show(),this.postShow()},hide:function(t){var e=this;t?this.panel.fadeOut("fast",function(){e.postHide()}):(this.panel.hide(),this.postHide())},postShow:function(){this.panel.trigger("onShow.puimultiselect")},postHide:function(){this.panel.trigger("onHide.puimultiselect")},findSelectionIndex:function(t){var e=-1;if(this.choices)for(var i=0;i<this.choices.length;i++)if(this.choices.eq(i).val()==t){e=i;break}return e},updateLabel:function(){var t=this.choices.filter(":selected"),e=null;if(t.length){e="";for(var i=0;i<t.length;i++)0!=i&&(e+=","),e+=t.eq(i).text()}else e=this.options.defaultLabel;this.label.text(e)},updateToggler:function(){var t=this.itemContainer.children("li.ui-multiselect-item:visible");t.length&&t.filter(".ui-state-highlight").length===t.length?(this.toggler.find(":checkbox").prop("checked",!0),this.togglerBox.children(".ui-chkbox-icon").addClass("fa-check")):(this.toggler.find(":checkbox").prop("checked",!1),this.togglerBox.children(".ui-chkbox-icon").removeClass("fa-check"))},checkAll:function(){var e=this.items.filter(":visible"),i=this;e.each(function(){i.selectItem(t(this))}),this.toggler.find(":checkbox").prop("checked",!0),this.togglerBox.children(".ui-chkbox-icon").addClass("fa-check")},uncheckAll:function(){var e=this.items.filter(":visible"),i=this;e.each(function(){i.unselectItem(t(this))}),this.toggler.find(":checkbox").prop("checked",!1),this.togglerBox.children(".ui-chkbox-icon").removeClass("fa-check")},alignPanel:function(){this.panel.css({left:"",top:"","z-index":++PUI.zindex}),this.panel.show().position({my:"left top",at:"left bottom",of:this.container})}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puimultiselectlistbox",{options:{caption:null,choices:null,effect:"fade",name:null,value:null},_create:function(){this.element.addClass("ui-multiselectlistbox ui-widget ui-helper-clearfix"),this.element.append('<input type="hidden"></input>'),this.element.append('<div class="ui-multiselectlistbox-listcontainer"></div>'),this.container=this.element.children("div"),this.input=this.element.children("input");var t=this.options.choices;if(this.options.name&&this.input.attr("name",this.options.name),t){this.options.caption&&this.container.append('<div class="ui-multiselectlistbox-header ui-widget-header ui-corner-top">'+this.options.caption+"</div>"),this.container.append('<ul class="ui-multiselectlistbox-list ui-inputfield ui-widget-content ui-corner-bottom"></ul>'),this.rootList=this.container.children("ul");for(var e=0;e<t.length;e++)this._createItemNode(t[e],this.rootList);this.items=this.element.find("li.ui-multiselectlistbox-item"),this._bindEvents(),void 0===this.options.value&&null===this.options.value||this.preselect(this.options.value)}},_createItemNode:function(e,i){var s=t('<li class="ui-multiselectlistbox-item"><span>'+e.label+"</span></li>");if(s.appendTo(i),e.items){s.append('<ul class="ui-helper-hidden"></ul>');for(var n=s.children("ul"),o=0;o<e.items.length;o++)this._createItemNode(e.items[o],n)}else s.attr("data-value",e.value)},_unbindEvents:function(){this.items.off("mouseover.multiSelectListbox mouseout.multiSelectListbox click.multiSelectListbox")},_bindEvents:function(){var e=this;this.items.on("mouseover.multiSelectListbox",function(){var e=t(this);e.hasClass("ui-state-highlight")||t(this).addClass("ui-state-hover")}).on("mouseout.multiSelectListbox",function(){var e=t(this);e.hasClass("ui-state-highlight")||t(this).removeClass("ui-state-hover")}).on("click.multiSelectListbox",function(){var i=t(this);i.hasClass("ui-state-highlight")||e.showOptionGroup(i)})},showOptionGroup:function(e){e.addClass("ui-state-highlight").removeClass("ui-state-hover").siblings().filter(".ui-state-highlight").removeClass("ui-state-highlight"),e.closest(".ui-multiselectlistbox-listcontainer").nextAll().remove();var i=e.children("ul"),s=e.attr("data-value");if(s&&this.input.val(s),i.length){var n=t('<div class="ui-multiselectlistbox-listcontainer" style="display:none"></div>');i.clone(!0).appendTo(n).addClass("ui-multiselectlistbox-list ui-inputfield ui-widget-content").removeClass("ui-helper-hidden"),n.prepend('<div class="ui-multiselectlistbox-header ui-widget-header ui-corner-top">'+e.children("span").text()+"</div>").children(".ui-multiselectlistbox-list").addClass("ui-corner-bottom"),this.element.append(n),this.options.effect?n.show(this.options.effect):n.show()}},disable:function(){this.options.disabled||(this.options.disabled=!0,this.element.addClass("ui-state-disabled"),this._unbindEvents(),this.container.nextAll().remove())},getValue:function(){return this.input.val()},preselect:function(e){var i=this,s=this.items.filter('[data-value="'+e+'"]');if(0!==s.length){for(var n=s.parentsUntil(".ui-multiselectlistbox-list"),o=[],a=n.length-1;a>=0;a--){var l=n.eq(a);if(l.is("li"))o.push(l.index());else if(l.is("ul")){var r=t('<div class="ui-multiselectlistbox-listcontainer" style="display:none"></div>');l.clone(!0).appendTo(r).addClass("ui-multiselectlistbox-list ui-widget-content ui-corner-all").removeClass("ui-helper-hidden"),r.prepend('<div class="ui-multiselectlistbox-header ui-widget-header ui-corner-top">'+l.prev("span").text()+"</div>").children(".ui-multiselectlistbox-list").addClass("ui-corner-bottom").removeClass("ui-corner-all"),i.element.append(r)}}var h=this.element.children("div.ui-multiselectlistbox-listcontainer"),u=h.find(" > ul.ui-multiselectlistbox-list > li.ui-multiselectlistbox-item").filter('[data-value="'+e+'"]');u.addClass("ui-state-highlight");for(var a=0;a<o.length;a++)h.eq(a).find("> .ui-multiselectlistbox-list > li.ui-multiselectlistbox-item").eq(o[a]).addClass("ui-state-highlight");i.element.children("div.ui-multiselectlistbox-listcontainer:hidden").show()}}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puinotify",{options:{position:"top",visible:!1,animate:!0,effectSpeed:"normal",easing:"swing"},_create:function(){this.element.addClass("ui-notify ui-notify-"+this.options.position+" ui-widget ui-widget-content ui-shadow").wrapInner('<div class="ui-notify-content" />').appendTo(document.body),this.content=this.element.children(".ui-notify-content"),this.closeIcon=t('<span class="ui-notify-close fa fa-close"></span>').appendTo(this.element),this._bindEvents(),this.options.visible&&this.show()},_bindEvents:function(){var t=this;this.closeIcon.on("click.puinotify",function(){t.hide()})},show:function(t){var e=this;t&&this.update(t),this.element.css("z-index",++PUI.zindex),this._trigger("beforeShow"),this.options.animate?this.element.slideDown(this.options.effectSpeed,this.options.easing,function(){e._trigger("afterShow")}):(this.element.show(),e._trigger("afterShow"))},hide:function(){var t=this;this._trigger("beforeHide"),this.options.animate?this.element.slideUp(this.options.effectSpeed,this.options.easing,function(){t._trigger("afterHide")}):(this.element.hide(),t._trigger("afterHide"))},update:function(t){this.content.html(t)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puiorderlist",{options:{controlsLocation:"none",dragdrop:!0,effect:"fade",caption:null,responsive:!1,datasource:null,content:null,template:null},_create:function(){this._createDom(),this.options.datasource&&(t.isArray(this.options.datasource)?this._generateOptionElements(this.options.datasource):"function"===t.type(this.options.datasource)&&this.options.datasource.call(this,this._generateOptionElements)),this.optionElements=this.element.children("option"),this._createListElement(),this._bindEvents()},_createDom:function(){this.element.addClass("ui-helper-hidden"),"none"!==this.options.controlsLocation?this.element.wrap('<div class="ui-grid-col-10"></div>'):this.element.wrap('<div class="ui-grid-col-12"></div>'),this.element.parent().wrap('<div class="ui-orderlist ui-grid ui-widget"><div class="ui-grid-row"></div></div>'),this.container=this.element.closest(".ui-orderlist"),"none"!==this.options.controlsLocation&&(this.element.parent().before('<div class="ui-orderlist-controls ui-grid-col-2"></div>'),this._createButtons()),this.options.responsive&&this.container.addClass("ui-grid-responsive")},_generateOptionElements:function(t){for(var e=0;e<t.length;e++){var i=t[e];i.label?this.element.append('<option value="'+i.value+'">'+i.label+"</option>"):this.element.append('<option value="'+i+'">'+i+"</option>")}},_createListElement:function(){this.list=t('<ul class="ui-widget-content ui-orderlist-list"></ul>').insertBefore(this.element);for(var e=0;e<this.optionElements.length;e++){var i=this.optionElements.eq(e),s=this._createItemContent(i.get(0)),n=t('<li class="ui-orderlist-item ui-corner-all"></li>');"string"===t.type(s)?n.html(s):n.append(s),n.data("item-value",i.attr("value")).appendTo(this.list)}this.items=this.list.children(".ui-orderlist-item"),this.options.caption?this.list.addClass("ui-corner-bottom").before('<div class="ui-orderlist-caption ui-widget-header ui-corner-top">'+this.options.caption+"</div>"):this.list.addClass("ui-corner-all")},_createButtons:function(){var t=this;this.buttonContainer=this.element.parent().prev(),this.moveUpButton=this._createButton("fa-angle-up","ui-orderlist-button-moveup",function(){t._moveUp()}),this.moveTopButton=this._createButton("fa-angle-double-up","ui-orderlist-button-move-top",function(){t._moveTop()}),this.moveDownButton=this._createButton("fa-angle-down","ui-orderlist-button-move-down",function(){t._moveDown()}),this.moveBottomButton=this._createButton("fa-angle-double-down","ui-orderlist-move-bottom",function(){t._moveBottom()}),this.buttonContainer.append(this.moveUpButton).append(this.moveTopButton).append(this.moveDownButton).append(this.moveBottomButton)},_createButton:function(e,i,s){var n=t('<button class="'+i+'" type="button"></button>').puibutton({icon:e,click:function(){s(),t(this).removeClass("ui-state-hover ui-state-focus")}});return n},_bindEvents:function(){this._bindButtonEvents(),this._bindItemEvents(this.items),this.options.dragdrop&&this._initDragDrop()},_initDragDrop:function(){var t=this;this.list.sortable({revert:1,start:function(t,e){PUI.clearSelection()},update:function(e,i){t.onDragDrop(e,i)}})},_moveUp:function(){var e=this,i=this.items.filter(".ui-state-highlight"),s=i.length,n=0;i.each(function(){var i=t(this);i.is(":first-child")?s--:i.hide(e.options.effect,{},"fast",function(){i.insertBefore(i.prev()).show(e.options.effect,{},"fast",function(){n++,s===n&&(e._saveState(),e._fireReorderEvent())})})})},_moveTop:function(){var e=this,i=this.items.filter(".ui-state-highlight"),s=i.length,n=0;i.each(function(){var i=t(this);i.is(":first-child")?s--:i.hide(e.options.effect,{},"fast",function(){i.prependTo(i.parent()).show(e.options.effect,{},"fast",function(){n++,s===n&&(e._saveState(),e._fireReorderEvent())})})})},_moveDown:function(){var e=this,i=t(this.items.filter(".ui-state-highlight").get().reverse()),s=i.length,n=0;i.each(function(){var i=t(this);i.is(":last-child")?s--:i.hide(e.options.effect,{},"fast",function(){i.insertAfter(i.next()).show(e.options.effect,{},"fast",function(){n++,s===n&&(e._saveState(),e._fireReorderEvent())})})})},_moveBottom:function(){var e=this,i=this.items.filter(".ui-state-highlight"),s=i.length,n=0;i.each(function(){var i=t(this);i.is(":last-child")?s--:i.hide(e.options.effect,{},"fast",function(){i.appendTo(i.parent()).show(e.options.effect,{},"fast",function(){n++,s===n&&(e._saveState(),e._fireReorderEvent())})})})},_saveState:function(){this.element.children().remove(),this._generateOptions()},_fireReorderEvent:function(){this._trigger("reorder",null)},onDragDrop:function(t,e){e.item.removeClass("ui-state-highlight"),this._saveState(),this._fireReorderEvent()},_generateOptions:function(){var e=this;this.list.children(".ui-orderlist-item").each(function(){var i=t(this),s=i.data("item-value");e.element.append('<option value="'+s+'" selected="selected">'+s+"</option>")})},_createItemContent:function(t){if(this.options.template){var e=this.options.template.html();return Mustache.parse(e),Mustache.render(e,t)}return this.options.content?this.options.content.call(this,t):t.label},addOption:function(e,i){var s;if(this.options.content){var n=i?{label:i,value:e}:{label:e,value:e};s=t('<li class="ui-orderlist-item ui-corner-all"></li>').append(this.options.content(n)).appendTo(this.list)}else{var o=i?i:e;s=t('<li class="ui-orderlist-item ui-corner-all">'+o+"</li>").appendTo(this.list)}i?this.element.append('<option value="'+e+'">'+i+"</option>"):this.element.append('<option value="'+e+'">'+e+"</option>"),this._bindItemEvents(s),this.optionElements=this.element.children("option"),this.items=this.items.add(s),this.options.dragdrop&&this.list.sortable("refresh")},removeOption:function(t){for(var e=0;e<this.optionElements.length;e++)this.optionElements[e].value==t&&(this.optionElements[e].remove(e),this._unbindItemEvents(this.items.eq(e)),this.items[e].remove(e));this.optionElements=this.element.children("option"),this.items=this.list.children(".ui-orderlist-item"),this.options.dragdrop&&this.list.sortable("refresh")},_unbindEvents:function(){this._unbindItemEvents(this.items),this._unbindButtonEvents()},_unbindItemEvents:function(t){t.off("mouseover.puiorderlist mouseout.puiorderlist mousedown.puiorderlist")},_bindItemEvents:function(e){e.on("mouseover.puiorderlist",function(e){var i=t(this);i.hasClass("ui-state-highlight")||t(this).addClass("ui-state-hover")}).on("mouseout.puiorderlist",function(e){var i=t(this);i.hasClass("ui-state-highlight")||t(this).removeClass("ui-state-hover")}).on("mousedown.puiorderlist",function(e){var i=t(this),s=e.metaKey||e.ctrlKey;s?i.hasClass("ui-state-highlight")?i.removeClass("ui-state-highlight"):i.removeClass("ui-state-hover").addClass("ui-state-highlight"):i.removeClass("ui-state-hover").addClass("ui-state-highlight").siblings(".ui-state-highlight").removeClass("ui-state-highlight")})},getSelection:function(){var e=[];return this.items.filter(".ui-state-highlight").each(function(){e.push(t(this).data("item-value"))}),e},setSelection:function(t){for(var e=0;e<this.items.length;e++)for(var i=0;i<t.length;i++)this.items.eq(e).data("item-value")==t[i]&&this.items.eq(e).addClass("ui-state-highlight")},disable:function(){this._unbindEvents(),this.items.addClass("ui-state-disabled"),this.container.addClass("ui-state-disabled"),this.options.dragdrop&&this.list.sortable("destroy")},enable:function(){this._bindEvents(),this.items.removeClass("ui-state-disabled"),this.container.removeClass("ui-state-disabled"),this.options.dragdrop&&this._initDragDrop()},_unbindButtonEvents:function(){this.buttonContainer&&(this.moveUpButton.puibutton("disable"),this.moveTopButton.puibutton("disable"),this.moveDownButton.puibutton("disable"),this.moveBottomButton.puibutton("disable"))},_bindButtonEvents:function(){this.buttonContainer&&(this.moveUpButton.puibutton("enable"),this.moveTopButton.puibutton("enable"),this.moveDownButton.puibutton("enable"),this.moveBottomButton.puibutton("enable"))}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puioverlaypanel",{options:{target:null,showEvent:"click",hideEvent:"click",showCloseIcon:!1,dismissable:!0,my:"left top",at:"left bottom",preShow:null,postShow:null,onHide:null,shared:!1,delegatedTarget:null},_create:function(){this.element.addClass("ui-overlaypanel ui-widget ui-widget-content ui-corner-all ui-shadow ui-helper-hidden"),this.container=t('<div class="ui-overlaypanel-content"></div>').appendTo(this.element),this.container.append(this.element.contents()),this.options.showCloseIcon&&(this.closerIcon=t('<a href="#" class="ui-overlaypanel-close ui-state-default" href="#"><span class="fa fa-fw fa-close"></span></a>').appendTo(this.container)),this._bindCommonEvents(),this.options.target&&(this.target=t(this.options.target),this._bindTargetEvents())},_bindCommonEvents:function(){var e=this;if(this.options.showCloseIcon&&this.closerIcon.on("mouseover.puioverlaypanel",function(){t(this).addClass("ui-state-hover")}).on("mouseout.puioverlaypanel",function(){t(this).removeClass("ui-state-hover")}).on("click.puioverlaypanel",function(t){e._isVisible()?e.hide():e.show(),t.preventDefault()}),this.options.dismissable){var i="mousedown."+this.id;t(document.body).off(i).on(i,function(i){if(e._isVisible()){if(e.target){var s=t(i.target);if(e.target.is(s)||e.target.has(s).length>0)return}var n=e.element.offset();(i.pageX<n.left||i.pageX>n.left+e.element.outerWidth()||i.pageY<n.top||i.pageY>n.top+e.element.outerHeight())&&e.hide()}})}var s="resize."+this.id;t(window).off(s).on(s,function(){e._isVisible()&&e._align()})},_bindTargetEvents:function(){var t=this;if(this.options.showEvent===this.options.hideEvent){var e=this.options.showEvent;this.options.shared?this.target.on(e,this.options.delegatedTarget,null,function(e){
t._toggle(e.currentTarget)}):this.target.on(e,function(e){t._toggle()})}else{var i=this.options.showEvent+".puioverlaypanel",s=this.options.hideEvent+".puioverlaypanel";this.options.shared?this.target.off(i+".puioverlaypanel "+s+".puioverlaypanel",this.options.delegatedTarget).on(i,this.options.delegatedTarget,null,function(e){t._onShowEvent(e)}).on(s,this.options.delegatedTarget,null,function(e){t._onHideEvent()}):this.target.off(i+".puioverlaypanel "+s+".puioverlaypanel").on(i,function(e){t._onShowEvent(e)}).on(s,function(e){t._onHideEvent()})}this.options.shared?t.target.off("keydown.puioverlaypanel keyup.puioverlaypanel",this.options.delegatedTarget).on("keydown.puioverlaypanel",this.options.delegatedTarget,null,function(e){t._onTargetKeydown(e)}).on("keyup.puioverlaypanel",this.options.delegatedTarget,null,function(e){t._onTargetKeyup(e)}):t.target.off("keydown.puioverlaypanel keyup.puioverlaypanel").on("keydown.puioverlaypanel",function(e){t._onTargetKeydown(e)}).on("keyup.puioverlaypanel",function(e){t._onTargetKeyup(e)})},_toggle:function(t){this.options.shared?this.show(t):this._isVisible()?this.hide():this.show(t)},_onShowEvent:function(t){this._isVisible()||(this.show(t.currentTarget),"contextmenu.puioverlaypanel"===this.options.showEvent&&t.preventDefault())},_onHideEvent:function(){this._isVisible()&&this.hide()},_onTargetKeydown:function(e){var i=t.ui.keyCode,s=e.which;s!==i.ENTER&&s!==i.NUMPAD_ENTER||e.preventDefault()},_onTargetKeyup:function(e){var i=t.ui.keyCode,s=e.which;s!==i.ENTER&&s!==i.NUMPAD_ENTER||($this._toggle(),e.preventDefault())},_isVisible:function(){return"visible"==this.element.css("visibility")&&this.element.is(":visible")},show:function(t){var e=this;e._trigger("preShow",null,{target:t}),this._align(t),this.element.css({display:"none",visibility:"visible"}),this.options.showEffect?this.element.show(this.options.showEffect,{},200,function(){e.postShow()}):(this.element.show(),this.postShow())},hide:function(){var t=this;this.options.hideEffect?this.element.hide(this.options.hideEffect,{},200,function(){t.postHide()}):(this.element.hide(),this.postHide())},postShow:function(){this._trigger("postShow"),this._applyFocus()},postHide:function(){this.element.css({display:"block",visibility:"hidden"}),this._trigger("onHide")},_align:function(e){var i=(t(window),e||this.target);this.element.css({left:"",top:"","z-index":PUI.zindex}).position({my:this.options.my,at:this.options.at,of:i})},_applyFocus:function(){this.element.find(":not(:submit):not(:button):input:visible:enabled:first").focus()}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){var e={"{FirstPageLink}":{markup:'<span class="ui-paginator-first ui-paginator-element ui-state-default ui-corner-all"><span class="fa fa-step-backward"></span></span>',create:function(e){var i=t(this.markup);return 0===e.options.page&&i.addClass("ui-state-disabled"),i.on("click.puipaginator",function(){t(this).hasClass("ui-state-disabled")||e.option("page",0)}),i},update:function(t,e){0===e.page?t.addClass("ui-state-disabled").removeClass("ui-state-hover ui-state-active"):t.removeClass("ui-state-disabled")}},"{PreviousPageLink}":{markup:'<span class="ui-paginator-prev ui-paginator-element ui-state-default ui-corner-all"><span class="fa fa-backward"></span></span>',create:function(e){var i=t(this.markup);return 0===e.options.page&&i.addClass("ui-state-disabled"),i.on("click.puipaginator",function(){t(this).hasClass("ui-state-disabled")||e.option("page",e.options.page-1)}),i},update:function(t,e){0===e.page?t.addClass("ui-state-disabled").removeClass("ui-state-hover ui-state-active"):t.removeClass("ui-state-disabled")}},"{NextPageLink}":{markup:'<span class="ui-paginator-next ui-paginator-element ui-state-default ui-corner-all"><span class="fa fa-forward"></span></span>',create:function(e){var i=t(this.markup);return e.options.page===e.getPageCount()-1&&i.addClass("ui-state-disabled").removeClass("ui-state-hover ui-state-active"),i.on("click.puipaginator",function(){t(this).hasClass("ui-state-disabled")||e.option("page",e.options.page+1)}),i},update:function(t,e){e.page===e.pageCount-1?t.addClass("ui-state-disabled").removeClass("ui-state-hover ui-state-active"):t.removeClass("ui-state-disabled")}},"{LastPageLink}":{markup:'<span class="ui-paginator-last ui-paginator-element ui-state-default ui-corner-all"><span class="fa fa-step-forward"></span></span>',create:function(e){var i=t(this.markup);return e.options.page===e.getPageCount()-1&&i.addClass("ui-state-disabled").removeClass("ui-state-hover ui-state-active"),i.on("click.puipaginator",function(){t(this).hasClass("ui-state-disabled")||e.option("page",e.getPageCount()-1)}),i},update:function(t,e){e.page===e.pageCount-1?t.addClass("ui-state-disabled").removeClass("ui-state-hover ui-state-active"):t.removeClass("ui-state-disabled")}},"{PageLinks}":{markup:'<span class="ui-paginator-pages"></span>',create:function(e){for(var i=t(this.markup),s=this.calculateBoundaries({page:e.options.page,pageLinks:e.options.pageLinks,pageCount:e.getPageCount()}),n=s[0],o=s[1],a=n;o>=a;a++){var l=a+1,r=t('<span class="ui-paginator-page ui-paginator-element ui-state-default ui-corner-all">'+l+"</span>");a===e.options.page&&r.addClass("ui-state-active"),r.on("click.puipaginator",function(i){var s=t(this);s.hasClass("ui-state-disabled")||s.hasClass("ui-state-active")||e.option("page",parseInt(s.text(),10)-1)}),i.append(r)}return i},update:function(e,i,s){var n=e.children(),o=this.calculateBoundaries({page:i.page,pageLinks:i.pageLinks,pageCount:i.pageCount}),a=o[0],l=o[1];n.remove();for(var r=a;l>=r;r++){var h=r+1,u=t('<span class="ui-paginator-page ui-paginator-element ui-state-default ui-corner-all">'+h+"</span>");r===i.page&&u.addClass("ui-state-active"),u.on("click.puipaginator",function(e){var i=t(this);i.hasClass("ui-state-disabled")||i.hasClass("ui-state-active")||s.option("page",parseInt(i.text(),10)-1)}),s._bindHover(u),e.append(u)}},calculateBoundaries:function(t){var e=t.page,i=t.pageLinks,s=t.pageCount,n=Math.min(i,s),o=Math.max(0,parseInt(Math.ceil(e-n/2),10)),a=Math.min(s-1,o+n-1),l=i-(a-o+1);return o=Math.max(0,o-l),[o,a]}}};t.widget("primeui.puipaginator",{options:{pageLinks:5,totalRecords:0,page:0,rows:0,template:"{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"},_create:function(){this.element.addClass("ui-paginator ui-widget-header"),this.paginatorElements=[];for(var t=this.options.template.split(/[ ]+/),i=0;i<t.length;i++){var s=t[i],n=e[s];if(n){var o=n.create(this);this.paginatorElements[s]=o,this.element.append(o)}}this._bindEvents()},_bindEvents:function(){this._bindHover(this.element.find("span.ui-paginator-element"))},_bindHover:function(e){e.on("mouseover.puipaginator",function(){var e=t(this);e.hasClass("ui-state-active")||e.hasClass("ui-state-disabled")||e.addClass("ui-state-hover")}).on("mouseout.puipaginator",function(){var e=t(this);e.hasClass("ui-state-hover")&&e.removeClass("ui-state-hover")})},_setOption:function(e,i){"page"===e?this.setPage(i):"totalRecords"===e?this.setTotalRecords(i):t.Widget.prototype._setOption.apply(this,arguments)},setPage:function(t,e){var i=this.getPageCount();if(t>=0&&i>t){var s={first:this.options.rows*t,rows:this.options.rows,page:t,pageCount:i,pageLinks:this.options.pageLinks};this.options.page=t,e||this._trigger("paginate",null,s),this.updateUI(s)}},setState:function(t){this.options.totalRecords=t.totalRecords,this.setPage(t.page,!0)},updateUI:function(t){for(var i in this.paginatorElements)this.paginatorElements.hasOwnProperty(i)&&e[i].update(this.paginatorElements[i],t,this)},getPageCount:function(){return Math.ceil(this.options.totalRecords/this.options.rows)||1},setTotalRecords:function(t){this.options.totalRecords=t,this.setPage(0,!0)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puipanel",{options:{toggleable:!1,toggleDuration:"normal",toggleOrientation:"vertical",collapsed:!1,closable:!1,closeDuration:"normal",title:null,footer:null},_create:function(){this.element.addClass("ui-panel ui-widget ui-widget-content ui-corner-all").contents().wrapAll('<div class="ui-panel-content ui-widget-content" />'),this.element.attr("title")&&(this.options.title=this.element.attr("title"),this.element.removeAttr("title")),this.options.title&&this.element.prepend('<div class="ui-panel-titlebar ui-widget-header ui-helper-clearfix ui-corner-all"><span class="ui-panel-title"></span></div>'),this.options.footer&&this.element.append('<div class="ui-panel-footer ui-widget-content"></div>'),this.header=this.element.children("div.ui-panel-titlebar"),this.title=this.header.children("span.ui-panel-title"),this.content=this.element.children("div.ui-panel-content"),this.footer=this.element.children("div.ui-panel-footer");var e=this;if(this.options.title&&this._createFacetContent(this.title,this.options.title),this.options.footer&&this._createFacetContent(this.footer,this.options.footer),this.options.closable&&(this.closer=t('<a class="ui-panel-titlebar-icon ui-panel-titlebar-closer ui-corner-all ui-state-default" href="#"><span class="fa fa-fw fa-close"></span></a>').appendTo(this.header),this.closer.on("click.puipanel",function(t){e.close(),t.preventDefault()})),this.options.toggleable){var i=this.options.collapsed?"fa-plus":"fa-minus";this.toggler=t('<a class="ui-panel-titlebar-icon ui-panel-titlebar-toggler ui-corner-all ui-state-default" href="#"><span class="fa fa-fw '+i+'"></span></a>').appendTo(this.header),this.toggler.on("click.puipanel",function(t){e.toggle(),t.preventDefault()}),this.options.collapsed&&this.content.hide()}this._bindEvents()},_bindEvents:function(){this.header.children("a.ui-panel-titlebar-icon").on("mouseenter.puipanel",function(){t(this).addClass("ui-state-hover")}).on("mouseleave.puipanel",function(){t(this).removeClass("ui-state-hover")})},_unbindEvents:function(){this.header.children("a.ui-panel-titlebar-icon").off()},close:function(){var t=this;this._trigger("beforeClose",null),this.element.fadeOut(this.options.closeDuration,function(){t._trigger("afterClose",null)})},toggle:function(){this.options.collapsed?this.expand():this.collapse()},expand:function(){this.toggler.children(".fa").removeClass("fa-plus").addClass("fa-minus"),"vertical"===this.options.toggleOrientation?this._slideDown():"horizontal"===this.options.toggleOrientation&&this._slideRight()},collapse:function(){this.toggler.children(".fa").removeClass("fa-minus").addClass("fa-plus"),"vertical"===this.options.toggleOrientation?this._slideUp():"horizontal"===this.options.toggleOrientation&&this._slideLeft()},_slideUp:function(){var t=this;this._trigger("beforeCollapse"),this.content.slideUp(this.options.toggleDuration,"easeInOutCirc",function(){t._trigger("afterCollapse"),t.options.collapsed=!t.options.collapsed})},_slideDown:function(){var t=this;this._trigger("beforeExpand"),this.content.slideDown(this.options.toggleDuration,"easeInOutCirc",function(){t._trigger("afterExpand"),t.options.collapsed=!t.options.collapsed})},_slideLeft:function(){var t=this;this.originalWidth=this.element.width(),this.title.hide(),this.toggler.hide(),this.content.hide(),this.element.animate({width:"42px"},this.options.toggleSpeed,"easeInOutCirc",function(){t.toggler.show(),t.element.addClass("ui-panel-collapsed-h"),t.options.collapsed=!t.options.collapsed})},_slideRight:function(){var t=this,e=this.originalWidth||"100%";this.toggler.hide(),this.element.animate({width:e},this.options.toggleSpeed,"easeInOutCirc",function(){t.element.removeClass("ui-panel-collapsed-h"),t.title.show(),t.toggler.show(),t.options.collapsed=!t.options.collapsed,t.content.css({visibility:"visible",display:"block",height:"auto"})})},_destroy:function(){this._unbindEvents(),this.toggler&&this.toggler.children(".fa").removeClass("fa-minus fa-plus")},_createFacetContent:function(e,i){var s;"string"===t.type(i)?s=i:"function"===t.type(i)&&(s=i.call()),e.append(s)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puipassword",{options:{promptLabel:"Please enter a password",weakLabel:"Weak",mediumLabel:"Medium",strongLabel:"Strong",inline:!1},_create:function(){if(this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this.element.puiinputtext().addClass("ui-password"),!this.element.prop(":disabled")){var e='<div class="ui-password-panel ui-widget ui-state-highlight ui-corner-all ui-helper-hidden">';e+='<div class="ui-password-meter" style="background-position:0pt 0pt"> </div>',e+='<div class="ui-password-info">'+this.options.promptLabel+"</div>",e+="</div>",this.panel=t(e).insertAfter(this.element),this.meter=this.panel.children("div.ui-password-meter"),this.infoText=this.panel.children("div.ui-password-info"),this.options.inline?this.panel.addClass("ui-password-panel-inline"):this.panel.addClass("ui-password-panel-overlay").appendTo("body"),this._bindEvents()}},_destroy:function(){this.element.puiinputtext("destroy").removeClass("ui-password"),this._unbindEvents(),this.panel.remove(),t(window).off("resize."+this.id)},_bindEvents:function(){var e=this;if(this.element.on("focus.puipassword",function(){e.show()}).on("blur.puipassword",function(){e.hide()}).on("keyup.puipassword",function(){var t=e.element.val(),i=null,s=null;if(0===t.length)i=e.options.promptLabel,s="0px 0px";else{var n=e._testStrength(e.element.val());30>n?(i=e.options.weakLabel,s="0px -10px"):n>=30&&80>n?(i=e.options.mediumLabel,s="0px -20px"):n>=80&&(i=e.options.strongLabel,s="0px -30px")}e.meter.css("background-position",s),e.infoText.text(i)}),!this.options.inline){var i="resize."+this.id;t(window).off(i).on(i,function(){e.panel.is(":visible")&&e.align()})}},_unbindEvents:function(){this.element.off("focus.puipassword blur.puipassword keyup.puipassword")},_testStrength:function(t){var e=0,i=0,s=this;return i=t.match("[0-9]"),e+=25*s._normalize(i?i.length:.25,1),i=t.match("[a-zA-Z]"),e+=10*s._normalize(i?i.length:.5,3),i=t.match("[!@#$%^&*?_~.,;=]"),e+=35*s._normalize(i?i.length:1/6,1),i=t.match("[A-Z]"),e+=30*s._normalize(i?i.length:1/6,1),e*=t.length/8,e>100?100:e},_normalize:function(t,e){var i=t-e;return 0>=i?t/e:1+.5*(t/(t+e/4))},align:function(){this.panel.css({left:"",top:"","z-index":++PUI.zindex}).position({my:"left top",at:"right top",of:this.element})},show:function(){this.options.inline?this.panel.slideDown():(this.align(),this.panel.fadeIn())},hide:function(){this.options.inline?this.panel.slideUp():this.panel.fadeOut()},disable:function(){this.element.puiinputtext("disable"),this._unbindEvents()},enable:function(){this.element.puiinputtext("enable"),this._bindEvents()},_setOption:function(e,i){"disabled"===e?i?this.disable():this.enable():t.Widget.prototype._setOption.apply(this,arguments)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puipicklist",{options:{effect:"fade",effectSpeed:"fast",sourceCaption:null,targetCaption:null,filter:!1,filterFunction:null,filterMatchMode:"startsWith",dragdrop:!0,sourceData:null,targetData:null,content:null,template:null,responsive:!1},_create:function(){this.element.uniqueId().addClass("ui-picklist ui-widget ui-helper-clearfix"),this.options.responsive&&this.element.addClass("ui-picklist-responsive"),this.inputs=this.element.children("select"),this.items=t(),this.sourceInput=this.inputs.eq(0),this.targetInput=this.inputs.eq(1),this.options.sourceData&&this._populateInputFromData(this.sourceInput,this.options.sourceData),this.options.targetData&&this._populateInputFromData(this.targetInput,this.options.targetData),this.sourceList=this._createList(this.sourceInput,"ui-picklist-source",this.options.sourceCaption),this._createButtons(),this.targetList=this._createList(this.targetInput,"ui-picklist-target",this.options.targetCaption),this.options.showSourceControls&&this.element.prepend(this._createListControls(this.sourceList,"ui-picklist-source-controls")),this.options.showTargetControls&&this.element.append(this._createListControls(this.targetList,"ui-picklist-target-controls")),this._bindEvents()},_populateInputFromData:function(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.label?t.append('<option value="'+s.value+'">'+s.label+"</option>"):t.append('<option value="'+s+'">'+s+"</option>")}},_createList:function(e,i,s){var n=t('<div class="ui-picklist-listwrapper '+i+'-wrapper"></div>'),o=t('<ul class="ui-widget-content ui-picklist-list '+i+'"></ul>');return this.options.filter&&(n.append('<div class="ui-picklist-filter-container"><input type="text" class="ui-picklist-filter" /><span class="fa fa-fw fa-search"></span></div>'),n.find("> .ui-picklist-filter-container > input").puiinputtext()),s?(n.append('<div class="ui-picklist-caption ui-widget-header ui-corner-tl ui-corner-tr">'+s+"</div>"),o.addClass("ui-corner-bottom")):o.addClass("ui-corner-all"),this._populateContainerFromOptions(e,o),n.append(o),e.addClass("ui-helper-hidden").appendTo(n),n.appendTo(this.element),o},_populateContainerFromOptions:function(e,i,s){for(var n=e.children("option"),o=0;o<n.length;o++){var a=n.eq(o),l=this._createItemContent(a.get(0)),r=t('<li class="ui-picklist-item ui-corner-all"></li>').data({"item-label":a.text(),"item-value":a.val()});"string"===t.type(l)?r.html(l):r.append(l),this.items=this.items.add(r),i.append(r)}},_createButtons:function(){var e=this,i=t('<div class="ui-picklist-buttons"><div class="ui-picklist-buttons-cell"></div>');i.children("div").append(this._createButton("fa-angle-right","ui-picklist-button-add",function(){e._add()})).append(this._createButton("fa-angle-double-right","ui-picklist-button-addall",function(){e._addAll()})).append(this._createButton("fa-angle-left","ui-picklist-button-remove",function(){e._remove()})).append(this._createButton("fa-angle-double-left","ui-picklist-button-removeall",function(){e._removeAll()})),this.element.append(i)},_createListControls:function(e,i){var s=this,n=t('<div class="'+i+' ui-picklist-buttons"><div class="ui-picklist-buttons-cell"></div>');return n.children("div").append(this._createButton("fa-angle-up","ui-picklist-button-move-up",function(){s._moveUp(e)})).append(this._createButton("fa-angle-double-up","ui-picklist-button-move-top",function(){s._moveTop(e)})).append(this._createButton("fa-angle-down","ui-picklist-button-move-down",function(){s._moveDown(e)})).append(this._createButton("fa-angle-double-down","ui-picklist-button-move-bottom",function(){s._moveBottom(e)})),n},_createButton:function(e,i,s){var n=t('<button class="'+i+'" type="button"></button>').puibutton({icon:e,click:function(){s(),t(this).removeClass("ui-state-hover ui-state-focus")}});return n},_bindEvents:function(){var e=this;this.items.on("mouseover.puipicklist",function(e){var i=t(this);i.hasClass("ui-state-highlight")||t(this).addClass("ui-state-hover")}).on("mouseout.puipicklist",function(e){t(this).removeClass("ui-state-hover")}).on("click.puipicklist",function(i){var s=t(this),n=i.metaKey||i.ctrlKey;if(i.shiftKey)if(e.unselectAll(),e.cursorItem&&e.cursorItem.parent().is(s.parent()))for(var o=s.index(),a=e.cursorItem.index(),l=o>a?a:o,r=o>a?o+1:a+1,h=s.parent(),u=l;r>u;u++)e.selectItem(h.children("li.ui-picklist-item").eq(u));else e.selectItem(s),e.cursorItem=s;else n||e.unselectAll(),n&&s.hasClass("ui-state-highlight")?e.unselectItem(s):(e.selectItem(s),e.cursorItem=s)}).on("dblclick.pickList",function(){var i=t(this);t(this).closest(".ui-picklist-listwrapper").hasClass("ui-picklist-source-wrapper")?e._transfer(i,e.sourceList,e.targetList,"dblclick"):e._transfer(i,e.targetList,e.sourceList,"dblclick"),PUI.clearSelection()}),this.options.filter&&(this._setupFilterMatcher(),this.element.find("> .ui-picklist-source-wrapper > .ui-picklist-filter-container > input").on("keyup",function(t){e._filter(this.value,e.sourceList)}),this.element.find("> .ui-picklist-target-wrapper > .ui-picklist-filter-container > input").on("keyup",function(t){e._filter(this.value,e.targetList)})),this.options.dragdrop&&this.element.find("> .ui-picklist-listwrapper > ul.ui-picklist-list").sortable({cancel:".ui-state-disabled",connectWith:"#"+this.element.attr("id")+" .ui-picklist-list",revert:1,update:function(t,i){e.unselectItem(i.item),e._saveState()},receive:function(t,i){e._triggerTransferEvent(i.item,i.sender,i.item.closest("ul.ui-picklist-list"),"dragdrop")}})},selectItem:function(t){t.removeClass("ui-state-hover").addClass("ui-state-highlight")},unselectItem:function(t){t.removeClass("ui-state-highlight")},unselectAll:function(){for(var t=this.items.filter(".ui-state-highlight"),e=0;e<t.length;e++)this.unselectItem(t.eq(e))},_add:function(){var t=this.sourceList.children("li.ui-picklist-item.ui-state-highlight");this._transfer(t,this.sourceList,this.targetList,"command")},_addAll:function(){var t=this.sourceList.children("li.ui-picklist-item:visible:not(.ui-state-disabled)");this._transfer(t,this.sourceList,this.targetList,"command")},_remove:function(){var t=this.targetList.children("li.ui-picklist-item.ui-state-highlight");this._transfer(t,this.targetList,this.sourceList,"command")},_removeAll:function(){var t=this.targetList.children("li.ui-picklist-item:visible:not(.ui-state-disabled)");this._transfer(t,this.targetList,this.sourceList,"command")},_moveUp:function(e){var i=this,s=i.options.effect,n=e.children(".ui-state-highlight"),o=n.length,a=0;n.each(function(){var e=t(this);e.is(":first-child")||(s?e.hide(i.options.effect,{},i.options.effectSpeed,function(){e.insertBefore(e.prev()).show(i.options.effect,{},i.options.effectSpeed,function(){a++,a===o&&i._saveState()})}):e.hide().insertBefore(e.prev()).show())}),s||this._saveState()},_moveTop:function(e){var i=this,s=i.options.effect,n=e.children(".ui-state-highlight"),o=n.length,a=0;e.children(".ui-state-highlight").each(function(){var e=t(this);e.is(":first-child")||(s?e.hide(i.options.effect,{},i.options.effectSpeed,function(){e.prependTo(e.parent()).show(i.options.effect,{},i.options.effectSpeed,function(){a++,a===o&&i._saveState()})}):e.hide().prependTo(e.parent()).show())}),s||this._saveState()},_moveDown:function(e){var i=this,s=i.options.effect,n=e.children(".ui-state-highlight"),o=n.length,a=0;t(e.children(".ui-state-highlight").get().reverse()).each(function(){var e=t(this);e.is(":last-child")||(s?e.hide(i.options.effect,{},i.options.effectSpeed,function(){e.insertAfter(e.next()).show(i.options.effect,{},i.options.effectSpeed,function(){a++,a===o&&i._saveState()})}):e.hide().insertAfter(e.next()).show())}),s||this._saveState()},_moveBottom:function(e){var i=this,s=i.options.effect,n=e.children(".ui-state-highlight"),o=n.length,a=0;e.children(".ui-state-highlight").each(function(){var e=t(this);e.is(":last-child")||(s?e.hide(i.options.effect,{},i.options.effectSpeed,function(){e.appendTo(e.parent()).show(i.options.effect,{},i.options.effectSpeed,function(){a++,a===o&&i._saveState()})}):e.hide().appendTo(e.parent()).show())}),s||this._saveState()},_transfer:function(e,i,s,n){var o=this,a=e.length,l=0;this.options.effect?e.hide(this.options.effect,{},this.options.effectSpeed,function(){var r=t(this);o.unselectItem(r),r.appendTo(s).show(o.options.effect,{},o.options.effectSpeed,function(){l++,l===a&&(o._saveState(),o._triggerTransferEvent(e,i,s,n))})}):(e.hide().removeClass("ui-state-highlight ui-state-hover").appendTo(s).show(),this._saveState(),this._triggerTransferEvent(e,i,s,n))},_triggerTransferEvent:function(t,e,i,s){var n={};n.items=t,n.from=e,n.to=i,n.type=s,this._trigger("transfer",null,n)},_saveState:function(){this.sourceInput.children().remove(),this.targetInput.children().remove(),this._generateItems(this.sourceList,this.sourceInput),this._generateItems(this.targetList,this.targetInput),this.cursorItem=null},_generateItems:function(e,i){e.children(".ui-picklist-item").each(function(){var e=t(this),s=e.data("item-value"),n=e.data("item-label");i.append('<option value="'+s+'" selected="selected">'+n+"</option>")})},_setupFilterMatcher:function(){this.filterMatchers={startsWith:this._startsWithFilter,contains:this._containsFilter,endsWith:this._endsWithFilter,custom:this.options.filterFunction},this.filterMatcher=this.filterMatchers[this.options.filterMatchMode]},_filter:function(e,i){var s=t.trim(e).toLowerCase(),n=i.children("li.ui-picklist-item");if(""===s)n.filter(":hidden").show();else for(var o=0;o<n.length;o++){var a=n.eq(o),l=a.data("item-label");this.filterMatcher(l,s)?a.show():a.hide()}},_startsWithFilter:function(t,e){return 0===t.toLowerCase().indexOf(e)},_containsFilter:function(t,e){return-1!==t.toLowerCase().indexOf(e)},_endsWithFilter:function(t,e){return-1!==t.indexOf(e,t.length-e.length)},_setOption:function(e,i){t.Widget.prototype._setOption.apply(this,arguments),"sourceData"===e&&this._setOptionData(this.sourceInput,this.sourceList,this.options.sourceData),"targetData"===e&&this._setOptionData(this.targetInput,this.targetList,this.options.targetData)},_setOptionData:function(t,e,i){t.empty(),e.empty(),this._populateInputFromData(t,i),this._populateContainerFromOptions(t,e,i),this._bindEvents()},_unbindEvents:function(){this.items.off("mouseover.puipicklist mouseout.puipicklist click.puipicklist dblclick.pickList")},disable:function(){this._unbindEvents(),this.items.addClass("ui-state-disabled"),this.element.find(".ui-picklist-buttons > button").each(function(e,i){t(i).puibutton("disable")})},enable:function(){this._bindEvents(),this.items.removeClass("ui-state-disabled"),this.element.find(".ui-picklist-buttons > button").each(function(e,i){t(i).puibutton("enable")})},_createItemContent:function(t){if(this.options.template){var e=this.options.template.html();return Mustache.parse(e),Mustache.render(e,t)}return this.options.content?this.options.content.call(this,t):t.label}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puiprogressbar",{options:{value:0,labelTemplate:"{value}%",complete:null,easing:"easeInOutCirc",effectSpeed:"normal",showLabel:!0},_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").append('<div class="ui-progressbar-value ui-widget-header ui-corner-all"></div>').append('<div class="ui-progressbar-label"></div>'),this.jqValue=this.element.children(".ui-progressbar-value"),this.jqLabel=this.element.children(".ui-progressbar-label"),0!==this.options.value&&this._setValue(this.options.value,!1),this.enableARIA()},_setValue:function(t,e){var i=!(void 0!==e&&!e);if(t>=0&&100>=t){if(0===t)this.jqValue.hide().css("width","0%").removeClass("ui-corner-right"),this.jqLabel.hide();else{if(i?this.jqValue.show().animate({width:t+"%"},this.options.effectSpeed,this.options.easing):this.jqValue.show().css("width",t+"%"),this.options.labelTemplate&&this.options.showLabel){var s=this.options.labelTemplate.replace(/{value}/gi,t);this.jqLabel.html(s).show()}100===t&&this._trigger("complete")}this.options.value=t,this.element.attr("aria-valuenow",t)}},_getValue:function(){return this.options.value},enableARIA:function(){this.element.attr("role","progressbar").attr("aria-valuemin",0).attr("aria-valuenow",this.options.value).attr("aria-valuemax",100)},_setOption:function(e,i){"value"===e&&this._setValue(i),t.Widget.prototype._setOption.apply(this,arguments)},_destroy:function(){}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){var e={};t.widget("primeui.puiradiobutton",{_create:function(){this.element.wrap('<div class="ui-radiobutton ui-widget"><div class="ui-helper-hidden-accessible"></div></div>'),this.container=this.element.parent().parent(),this.box=t('<div class="ui-radiobutton-box ui-widget ui-radiobutton-relative ui-state-default">').appendTo(this.container),this.icon=t('<span class="ui-radiobutton-icon"></span>').appendTo(this.box),this.disabled=this.element.prop("disabled"),this.label=t('label[for="'+this.element.attr("id")+'"]'),this.element.prop("checked")&&(this.box.addClass("ui-state-active"),this.icon.addClass("fa fa-fw fa-circle"),e[this.element.attr("name")]=this.box),this.disabled?this.box.addClass("ui-state-disabled"):this._bindEvents()},_bindEvents:function(){var t=this;this.box.on("mouseover.puiradiobutton",function(){t._isChecked()||t.box.addClass("ui-state-hover")}).on("mouseout.puiradiobutton",function(){t._isChecked()||t.box.removeClass("ui-state-hover")}).on("click.puiradiobutton",function(){t._isChecked()||(t.element.trigger("click"),PUI.browser.msie&&parseInt(PUI.browser.version,10)<9&&t.element.trigger("change"))}),this.label.length>0&&this.label.on("click.puiradiobutton",function(e){t.element.trigger("click"),e.preventDefault()}),this.element.on("focus.puiradiobutton",function(){t._isChecked()&&t.box.removeClass("ui-state-active"),t.box.addClass("ui-state-focus")}).on("blur.puiradiobutton",function(){t._isChecked()&&t.box.addClass("ui-state-active"),t.box.removeClass("ui-state-focus")}).on("change.puiradiobutton",function(i){var s=t.element.attr("name");e[s]&&e[s].removeClass("ui-state-active ui-state-focus ui-state-hover").children(".ui-radiobutton-icon").removeClass("fa fa-fw fa-circle"),t.icon.addClass("fa fa-fw fa-circle"),t.element.is(":focus")||t.box.addClass("ui-state-active"),e[s]=t.box,t._trigger("change",null)})},_isChecked:function(){return this.element.prop("checked")},_unbindEvents:function(){this.box.off("mouseover.puiradiobutton mouseout.puiradiobutton click.puiradiobutton"),this.element.off("focus.puiradiobutton blur.puiradiobutton change.puiradiobutton"),this.label.length&&this.label.off("click.puiradiobutton")},enable:function(){this._bindEvents(),this.box.removeClass("ui-state-disabled")},disable:function(){this._unbindEvents(),this.box.addClass("ui-state-disabled")},_destroy:function(){this._unbindEvents(),this.container.removeClass("ui-radiobutton ui-widget"),this.box.remove(),this.element.unwrap().unwrap()}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puirating",{options:{stars:5,cancel:!0,readonly:!1,disabled:!1,value:0},_create:function(){var t=this.element;t.wrap("<div />"),this.container=t.parent(),this.container.addClass("ui-rating");var e=t.val(),i=""===e?this.options.value:parseInt(e,10);this.options.cancel&&this.container.append('<div class="ui-rating-cancel"><a></a></div>');for(var s=0;s<this.options.stars;s++){var n=i>s?"ui-rating-star ui-rating-star-on":"ui-rating-star";this.container.append('<div class="'+n+'"><a></a></div>')}this.stars=this.container.children(".ui-rating-star"),t.prop("disabled")||this.options.disabled?this.container.addClass("ui-state-disabled"):t.prop("readonly")||this.options.readonly||this._bindEvents()},_bindEvents:function(){var e=this;this.stars.click(function(){var t=e.stars.index(this)+1;e.setValue(t)}),this.container.children(".ui-rating-cancel").hover(function(){t(this).toggleClass("ui-rating-cancel-hover")}).click(function(){e.cancel()})},cancel:function(){this.element.val(""),this.stars.filter(".ui-rating-star-on").removeClass("ui-rating-star-on"),this._trigger("oncancel",null)},getValue:function(){var t=this.element.val();return""===t?null:parseInt(t,10)},setValue:function(t){this.element.val(t),this.stars.removeClass("ui-rating-star-on");for(var e=0;t>e;e++)this.stars.eq(e).addClass("ui-rating-star-on");
this._trigger("rate",null,t)},enable:function(){this.container.removeClass("ui-state-disabled"),this._bindEvents()},disable:function(){this.container.addClass("ui-state-disabled"),this._unbindEvents()},_unbindEvents:function(){this.stars.off(),this.container.children(".ui-rating-cancel").off()},_updateValue:function(t){var e=this.container.children("div.ui-rating-star");e.removeClass("ui-rating-star-on");for(var i=0;i<e.length;i++)t>i&&e.eq(i).addClass("ui-rating-star-on");this.element.val(t)},_setOption:function(e,i){"value"===e?(this.options.value=i,this._updateValue(i)):t.Widget.prototype._setOption.apply(this,arguments)},_destroy:function(){this._unbindEvents(),this.stars.remove(),this.container.children(".ui-rating-cancel").remove(),this.element.unwrap()}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puiselectbutton",{options:{value:null,choices:null,formfield:null,tabindex:"0",multiple:!1,enhanced:!1},_create:function(){if(this.options.enhanced){var e=this;this.options.choices=[],this.element.children(".ui-button").each(function(){var i=t(this),s=i.attr("data-value"),n=i.children("span").text();e.options.choices.push({label:n,value:s})})}else if(this.element.addClass("ui-selectbutton ui-buttonset ui-widget ui-corner-all").attr("tabindex"),this.options.choices){this.element.addClass("ui-buttonset-"+this.options.choices.length);for(var i=0;i<this.options.choices.length;i++)this.element.append('<div class="ui-button ui-widget ui-state-default ui-button-text-only" tabindex="'+this.options.tabindex+'" data-value="'+this.options.choices[i].value+'"><span class="ui-button-text ui-c">'+this.options.choices[i].label+"</span></div>")}if(this.buttons=this.element.children("div.ui-button"),this.buttons.filter(":first-child").addClass("ui-corner-left"),this.buttons.filter(":last-child").addClass("ui-corner-right"),this.options.multiple){this.input=t('<select class="ui-helper-hidden-accessible" multiple></select>').appendTo(this.element);for(var i=0;i<this.options.choices.length;i++){var s='<option value = "'+this.options.choices[i].value+'"></option>';this.input.append(s)}this.selectOptions=this.input.children("option")}else this.input=t('<input type="hidden" />').appendTo(this.element);this.options.formfield&&this.input.attr("name",this.options.formfield),null!==this.options.value&&void 0!==this.options.value&&this._updateSelection(this.options.value),this._bindEvents()},_destroy:function(){this._unbindEvents(),this.options.enhanced?this.buttons.removeClass("ui-state-focus ui-state-hover ui-state-active ui-corner-left ui-corner-right"):(this.buttons.remove(),this.element.removeClass("ui-selectbutton ui-buttonset ui-widget ui-corner-all").removeAttr("tabindex")),this.input.remove()},_triggerChangeEvent:function(t){var e=this;if(this.options.multiple){for(var i=[],s=[],n=0;n<e.buttons.length;n++){var o=e.buttons.eq(n);o.hasClass("ui-state-active")&&(i.push(o.data("value")),s.push(n))}e._trigger("change",t,{value:i,index:s})}else for(var n=0;n<e.buttons.length;n++){var o=e.buttons.eq(n);if(o.hasClass("ui-state-active")){e._trigger("change",t,{value:o.data("value"),index:n});break}}},_bindEvents:function(){var e=this;this.buttons.on("mouseover.puiselectbutton",function(){var e=t(this);e.hasClass("ui-state-active")||e.addClass("ui-state-hover")}).on("mouseout.puiselectbutton",function(){t(this).removeClass("ui-state-hover")}).on("click.puiselectbutton",function(i){var s=t(this);t(this).hasClass("ui-state-active")?e.unselectOption(s):e.options.multiple?e.selectOption(s):(e.unselectOption(s.siblings(".ui-state-active")),e.selectOption(s)),e._triggerChangeEvent(i)}).on("focus.puiselectbutton",function(){t(this).addClass("ui-state-focus")}).on("blur.puiselectbutton",function(){t(this).removeClass("ui-state-focus")}).on("keydown.puiselectbutton",function(e){var i=t.ui.keyCode;e.which!==i.SPACE&&e.which!==i.ENTER&&e.which!==i.NUMPAD_ENTER||(t(this).trigger("click"),e.preventDefault())})},_unbindEvents:function(){this.buttons.off("mouseover.puiselectbutton mouseout.puiselectbutton focus.puiselectbutton blur.puiselectbutton keydown.puiselectbutton click.puiselectbutton")},selectOption:function(e){var i=t.isNumeric(e)?this.element.children(".ui-button").eq(e):e;this.options.multiple?this.selectOptions.eq(i.index()).prop("selected",!0):this.input.val(i.data("value")),i.addClass("ui-state-active")},unselectOption:function(e){var i=t.isNumeric(e)?this.element.children(".ui-button").eq(e):e;this.options.multiple?this.selectOptions.eq(i.index()).prop("selected",!1):this.input.val(""),i.removeClass("ui-state-active"),i.removeClass("ui-state-focus")},_setOption:function(e,i){"data"===e?(this.element.empty(),this._bindEvents()):"value"===e?this._updateSelection(i):t.Widget.prototype._setOption.apply(this,arguments)},_updateSelection:function(e){this.buttons.removeClass("ui-state-active");for(var i=0;i<this.buttons.length;i++){var s=this.buttons.eq(i),n=s.attr("data-value");if(this.options.multiple)t.inArray(n,e)>=0&&s.addClass("ui-state-active");else if(n==e){s.addClass("ui-state-active");break}}}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puispinner",{options:{step:1,min:void 0,max:void 0,prefix:null,suffix:null},_create:function(){var t=this.element,e=t.prop("disabled");t.puiinputtext().addClass("ui-spinner-input").wrap('<span class="ui-spinner ui-widget ui-corner-all" />'),this.wrapper=t.parent(),this.wrapper.append('<a class="ui-spinner-button ui-spinner-up ui-corner-tr ui-button ui-widget ui-state-default ui-button-text-only"><span class="ui-button-text"><span class="fa fa-fw fa-caret-up"></span></span></a><a class="ui-spinner-button ui-spinner-down ui-corner-br ui-button ui-widget ui-state-default ui-button-text-only"><span class="ui-button-text"><span class="fa fa-fw fa-caret-down"></span></span></a>'),this.upButton=this.wrapper.children("a.ui-spinner-up"),this.downButton=this.wrapper.children("a.ui-spinner-down"),this.options.step=this.options.step||1,0===parseInt(this.options.step,10)&&(this.options.precision=this.options.step.toString().split(/[,]|[.]/)[1].length),this._initValue(),e||t.prop("readonly")||this._bindEvents(),e&&this.wrapper.addClass("ui-state-disabled"),void 0!==this.options.min&&t.attr("aria-valuemin",this.options.min),void 0!==this.options.max&&t.attr("aria-valuemax",this.options.max)},_destroy:function(){this.element.puiinputtext("destroy").removeClass("ui-spinner-input").off("keydown.puispinner keyup.puispinner blur.puispinner focus.puispinner mousewheel.puispinner"),this.wrapper.children(".ui-spinner-button").off().remove(),this.element.unwrap()},_bindEvents:function(){var e=this;this.wrapper.children(".ui-spinner-button").mouseover(function(){t(this).addClass("ui-state-hover")}).mouseout(function(){t(this).removeClass("ui-state-hover ui-state-active"),e.timer&&window.clearInterval(e.timer)}).mouseup(function(){window.clearInterval(e.timer),t(this).removeClass("ui-state-active").addClass("ui-state-hover")}).mousedown(function(i){var s=t(this),n=s.hasClass("ui-spinner-up")?1:-1;s.removeClass("ui-state-hover").addClass("ui-state-active"),e.element.is(":not(:focus)")&&e.element.focus(),e._repeat(null,n),i.preventDefault()}),this.element.on("keydown.puispinner",function(i){var s=t.ui.keyCode;switch(i.which){case s.UP:e._spin(e.options.step);break;case s.DOWN:e._spin(-1*e.options.step)}}).on("keyup.puispinner",function(){e._updateValue()}).on("blur.puispinner",function(){e._format()}).on("focus.puispinner",function(){e.element.val(e.value)}),this.element.on("mousewheel.puispinner",function(t,i){return e.element.is(":focus")?(i>0?e._spin(e.options.step):e._spin(-1*e.options.step),!1):void 0})},_repeat:function(t,e){var i=this,s=t||500;window.clearTimeout(this.timer),this.timer=window.setTimeout(function(){i._repeat(40,e)},s),this._spin(this.options.step*e)},_toFixed:function(t,e){var i=Math.pow(10,e||0);return String(Math.round(t*i)/i)},_spin:function(t){var e,i=this.value?this.value:0;e=this.options.precision?parseFloat(this._toFixed(i+t,this.options.precision)):parseInt(i+t,10),void 0!==this.options.min&&e<this.options.min&&(e=this.options.min),void 0!==this.options.max&&e>this.options.max&&(e=this.options.max),this.element.val(e).attr("aria-valuenow",e),this.value=e,this.element.trigger("change")},_updateValue:function(){var t=this.element.val();""===t?void 0!==this.options.min?this.value=this.options.min:this.value=0:(t=this.options.step?parseFloat(t):parseInt(t,10),isNaN(t)||(this.value=t))},_initValue:function(){var t=this.element.val();""===t?void 0!==this.options.min?this.value=this.options.min:this.value=0:(this.options.prefix&&(t=t.split(this.options.prefix)[1]),this.options.suffix&&(t=t.split(this.options.suffix)[0]),this.options.step?this.value=parseFloat(t):this.value=parseInt(t,10))},_format:function(){var t=this.value;this.options.prefix&&(t=this.options.prefix+t),this.options.suffix&&(t+=this.options.suffix),this.element.val(t)},_unbindEvents:function(){this.wrapper.children(".ui-spinner-button").off(),this.element.off()},enable:function(){this.wrapper.removeClass("ui-state-disabled"),this.element.puiinputtext("enable"),this._bindEvents()},disable:function(){this.wrapper.addClass("ui-state-disabled"),this.element.puiinputtext("disable"),this._unbindEvents()},_setOption:function(e,i){"disabled"===e?i?this.disable():this.enable():t.Widget.prototype._setOption.apply(this,arguments)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puisplitbutton",{options:{icon:null,iconPos:"left",items:null},_create:function(){this.element.wrap('<div class="ui-splitbutton ui-buttonset ui-widget"></div>'),this.container=this.element.parent().uniqueId(),this.menuButton=this.container.append('<button class="ui-splitbutton-menubutton" type="button"></button>').children(".ui-splitbutton-menubutton"),this.options.disabled=this.element.prop("disabled"),this.options.disabled&&this.menuButton.prop("disabled",!0),this.element.puibutton(this.options).removeClass("ui-corner-all").addClass("ui-corner-left"),this.menuButton.puibutton({icon:"fa-caret-down"}).removeClass("ui-corner-all").addClass("ui-corner-right"),this.options.items&&this.options.items.length&&(this._renderPanel(),this._bindEvents())},_renderPanel:function(){this.menu=t('<div class="ui-menu ui-menu-dynamic ui-widget ui-widget-content ui-corner-all ui-helper-clearfix ui-shadow"></div>').append('<ul class="ui-menu-list ui-helper-reset"></ul>'),this.menuList=this.menu.children(".ui-menu-list");for(var e=0;e<this.options.items.length;e++){var i=this.options.items[e],s=t('<li class="ui-menuitem ui-widget ui-corner-all" role="menuitem"></li>'),n=t('<a class="ui-menuitem-link ui-corner-all"><span class="ui-menuitem-icon fa fa-fw '+i.icon+'"></span><span class="ui-menuitem-text">'+i.text+"</span></a>");i.url&&n.attr("href",i.url),i.click&&n.on("click.puisplitbutton",i.click),s.append(n).appendTo(this.menuList)}this.menu.appendTo(this.options.appendTo||this.container),this.options.position={my:"left top",at:"left bottom",of:this.element.parent()}},_bindEvents:function(){var e=this;this.menuButton.on("click.puisplitbutton",function(){e.menu.is(":hidden")?e.show():e.hide()}),this.menuList.children().on("mouseover.puisplitbutton",function(e){t(this).addClass("ui-state-hover")}).on("mouseout.puisplitbutton",function(e){t(this).removeClass("ui-state-hover")}).on("click.puisplitbutton",function(){e.hide()}),t(document.body).bind("mousedown."+this.container.attr("id"),function(i){if(!e.menu.is(":hidden")){var s=t(i.target);if(!(s.is(e.element)||e.element.has(s).length>0)){var n=e.menu.offset();(i.pageX<n.left||i.pageX>n.left+e.menu.width()||i.pageY<n.top||i.pageY>n.top+e.menu.height())&&(e.element.removeClass("ui-state-focus ui-state-hover"),e.hide())}}});var i="resize."+this.container.attr("id");t(window).unbind(i).bind(i,function(){e.menu.is(":visible")&&e._alignPanel()})},show:function(){this.menuButton.trigger("focus"),this.menu.show(),this._alignPanel(),this._trigger("show",null)},hide:function(){this.menuButton.removeClass("ui-state-focus"),this.menu.fadeOut("fast"),this._trigger("hide",null)},_alignPanel:function(){this.menu.css({left:"",top:"","z-index":++PUI.zindex}).position(this.options.position)},disable:function(){this.element.puibutton("disable"),this.menuButton.puibutton("disable")},enable:function(){this.element.puibutton("enable"),this.menuButton.puibutton("enable")}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puisticky",{_create:function(){this.initialState={top:this.element.offset().top,height:this.element.height()},this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this._bindEvents()},_bindEvents:function(){var e=this,i=t(window),s="scroll."+this.id,n="resize."+this.id;i.off(s).on(s,function(){i.scrollTop()>e.initialState.top?e._fix():e._restore()}).off(n).on(n,function(){e.fixed&&e.element.width(e.ghost.outerWidth()-(e.element.outerWidth()-e.element.width()))})},_fix:function(){this.fixed||(this.element.css({position:"fixed",top:0,"z-index":1e4}).addClass("ui-shadow ui-sticky"),this.ghost=t('<div class="ui-sticky-ghost"></div>').height(this.initialState.height).insertBefore(this.element),this.element.width(this.ghost.outerWidth()-(this.element.outerWidth()-this.element.width())),this.fixed=!0)},_restore:function(){this.fixed&&(this.element.css({position:"static",top:"auto",width:"auto"}).removeClass("ui-shadow ui-sticky"),this.ghost.remove(),this.fixed=!1)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puiswitch",{options:{onLabel:"On",offLabel:"Off",checked:!1,change:null,enhanced:!1},_create:function(){this.options.enhanced?(this.container=this.element.closest(".ui-inputswitch"),this.onContainer=this.container.children(".ui-inputswitch-on"),this.offContainer=this.container.children(".ui-inputswitch-off")):(this.element.wrap('<div class="ui-inputswitch ui-widget ui-widget-content ui-corner-all"></div>'),this.container=this.element.parent(),this.element.wrap('<div class="ui-helper-hidden-accessible"></div>'),this.container.prepend('<div class="ui-inputswitch-off"></div><div class="ui-inputswitch-on ui-state-active"></div><div class="ui-inputswitch-handle ui-state-default"></div>'),this.onContainer=this.container.children(".ui-inputswitch-on"),this.offContainer=this.container.children(".ui-inputswitch-off"),this.onContainer.append("<span>"+this.options.onLabel+"</span>"),this.offContainer.append("<span>"+this.options.offLabel+"</span>")),this.onLabel=this.onContainer.children("span"),this.offLabel=this.offContainer.children("span"),this.handle=this.container.children(".ui-inputswitch-handle");var t=this.onContainer.width(),e=this.offContainer.width(),i=this.offLabel.innerWidth()-this.offLabel.width(),s=this.handle.outerWidth()-this.handle.innerWidth(),n=t>e?t:e,o=n;this.handle.css({width:o}),o=this.handle.width(),n=n+o+6;var a=n-o-i-s;this.container.css({width:n}),this.onLabel.width(a),this.offLabel.width(a),this.offContainer.css({width:this.container.width()-5}),this.offset=this.container.width()-this.handle.outerWidth(),this.element.prop("checked")||this.options.checked?(this.handle.css({left:this.offset}),this.onContainer.css({width:this.offset}),this.offLabel.css({"margin-right":-this.offset})):(this.onContainer.css({width:0}),this.onLabel.css({"margin-left":-this.offset})),this.element.prop("disabled")||this._bindEvents()},_bindEvents:function(){var e=this;this.container.on("click.puiswitch",function(t){e.toggle(),e.element.trigger("focus")}),this.element.on("focus.puiswitch",function(t){e.handle.addClass("ui-state-focus")}).on("blur.puiswitch",function(t){e.handle.removeClass("ui-state-focus")}).on("keydown.puiswitch",function(e){var i=t.ui.keyCode;e.which===i.SPACE&&e.preventDefault()}).on("keyup.puiswitch",function(i){var s=t.ui.keyCode;i.which===s.SPACE&&(e.toggle(),i.preventDefault())}).on("change.puiswitch",function(t){e.element.prop("checked")||e.options.checked?e._checkUI():e._uncheckUI(),e._trigger("change",t,{checked:e.options.checked})})},_unbindEvents:function(){this.container.off("click.puiswitch"),this.element.off("focus.puiswitch blur.puiswitch keydown.puiswitch keyup.puiswitch change.puiswitch")},_destroy:function(){this._unbindEvents(),this.options.enhanced?(this.container.css("width","auto"),this.onContainer.css("width","auto"),this.onLabel.css("width","auto").css("margin-left",0),this.offContainer.css("width","auto"),this.offLabel.css("width","auto").css("margin-left",0)):(this.onContainer.remove(),this.offContainer.remove(),this.handle.remove(),this.element.unwrap().unwrap())},toggle:function(){this.element.prop("checked")||this.options.checked?this.uncheck():this.check()},check:function(){this.options.checked=!0,this.element.prop("checked",!0).trigger("change")},uncheck:function(){this.options.checked=!1,this.element.prop("checked",!1).trigger("change")},_checkUI:function(){this.onContainer.animate({width:this.offset},200),this.onLabel.animate({marginLeft:0},200),this.offLabel.animate({marginRight:-this.offset},200),this.handle.animate({left:this.offset},200)},_uncheckUI:function(){this.onContainer.animate({width:0},200),this.onLabel.animate({marginLeft:-this.offset},200),this.offLabel.animate({marginRight:0},200),this.handle.animate({left:0},200)},_setOption:function(e,i){"checked"===e?i?this.check():this.uncheck():t.Widget.prototype._setOption.apply(this,arguments)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puitabview",{options:{activeIndex:0,orientation:"top"},_create:function(){var t=this.element;this.navContainer=t.children("ul"),this.tabHeaders=this.navContainer.children("li"),this.panelContainer=t.children("div"),this._resolvePanelMode(),this.panels=this._findPanels(),t.addClass("ui-tabview ui-widget ui-widget-content ui-corner-all ui-hidden-container ui-tabview-"+this.options.orientation),this.navContainer.addClass("ui-tabview-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.tabHeaders.addClass("ui-state-default ui-corner-top"),this.panelContainer.addClass("ui-tabview-panels"),this.panels.addClass("ui-tabview-panel ui-widget-content ui-corner-bottom"),this.tabHeaders.eq(this.options.activeIndex).addClass("ui-tabview-selected ui-state-active"),this.panels.filter(":not(:eq("+this.options.activeIndex+"))").addClass("ui-helper-hidden"),this._bindEvents()},_destroy:function(){this.element.removeClass("ui-tabview ui-widget ui-widget-content ui-corner-all ui-hidden-container ui-tabview-"+this.options.orientation),this.navContainer.removeClass("ui-tabview-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.tabHeaders.removeClass("ui-state-default ui-corner-top ui-tabview-selected ui-state-active"),this.panelContainer.removeClass("ui-tabview-panels"),this.panels.removeClass("ui-tabview-panel ui-widget-content ui-corner-bottom ui-helper-hidden").removeData("loaded"),this._unbindEvents()},_bindEvents:function(){var e=this;this.tabHeaders.on("mouseover.puitabview",function(e){var i=t(this);i.hasClass("ui-state-disabled")||i.hasClass("ui-state-active")||i.addClass("ui-state-hover")}).on("mouseout.puitabview",function(e){var i=t(this);i.hasClass("ui-state-disabled")||i.hasClass("ui-state-active")||i.removeClass("ui-state-hover")}).on("click.puitabview",function(i){var s=t(this);if(t(i.target).is(":not(.fa-close)")){var n=s.index();s.hasClass("ui-state-disabled")||s.hasClass("ui-state-active")||e.select(n)}i.preventDefault()}),this.navContainer.find("li .fa-close").on("click.puitabview",function(i){var s=t(this).parent().index();e.remove(s),i.preventDefault()})},_unbindEvents:function(){this.tabHeaders.off("mouseover.puitabview mouseout.puitabview click.puitabview"),this.navContainer.find("li .fa-close").off("click.puitabview")},select:function(t){this.options.activeIndex=t;var e=this.panels.eq(t),i=this.tabHeaders.filter(".ui-state-active"),s=this._getHeaderOfPanel(e),n=this.panels.filter(".ui-tabview-panel:visible"),o=this;n.attr("aria-hidden",!0),i.attr("aria-expanded",!1),e.attr("aria-hidden",!1),s.attr("aria-expanded",!0),this.options.effect?n.hide(this.options.effect.name,null,this.options.effect.duration,function(){i.removeClass("ui-tabview-selected ui-state-active"),s.removeClass("ui-state-hover").addClass("ui-tabview-selected ui-state-active"),e.show(o.options.name,null,o.options.effect.duration,function(){o._trigger("change",null,{index:t})})}):(i.removeClass("ui-tabview-selected ui-state-active"),n.hide(),s.removeClass("ui-state-hover").addClass("ui-tabview-selected ui-state-active"),e.show(),o._trigger("change",null,{index:t}))},remove:function(t){var e=this.tabHeaders.eq(t),i=this.panels.eq(t);if(this._trigger("close",null,{index:t}),e.remove(),i.remove(),this.tabHeaders=this.navContainer.children("li"),this.panels=this._findPanels(),t<this.options.activeIndex)this.options.activeIndex--;else if(t==this.options.activeIndex){var s=this.options.activeIndex==this.getLength()?this.options.activeIndex-1:this.options.activeIndex,n=this.tabHeaders.eq(s),o=this.panels.eq(s);n.removeClass("ui-state-hover").addClass("ui-tabview-selected ui-state-active"),o.show()}},getLength:function(){return this.tabHeaders.length},getActiveIndex:function(){return this.options.activeIndex},_markAsLoaded:function(t){t.data("loaded",!0)},_isLoaded:function(t){return t.data("loaded")===!0},disable:function(t){this.tabHeaders.eq(t).addClass("ui-state-disabled")},enable:function(t){this.tabHeaders.eq(t).removeClass("ui-state-disabled")},_findPanels:function(){var t=this.panelContainer.children();return"native"===this.panelMode?t:"wrapped"===this.panelMode?t.children(":first-child"):void 0},_resolvePanelMode:function(){var t=this.panelContainer.children();this.panelMode=t.is("div")?"native":"wrapped"},_getHeaderOfPanel:function(t){return"native"===this.panelMode?this.tabHeaders.eq(t.index()):"wrapped"===this.panelMode?this.tabHeaders.eq(t.parent().index()):void 0},_setOption:function(e,i){"activeIndex"===e?this.select(i):t.Widget.prototype._setOption.apply(this,arguments)}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puiterminal",{options:{welcomeMessage:"",prompt:"prime $",handler:null},_create:function(){this.element.addClass("ui-terminal ui-widget ui-widget-content ui-corner-all").append("<div>"+this.options.welcomeMessage+"</div>").append('<div class="ui-terminal-content"></div>').append('<div><span class="ui-terminal-prompt">'+this.options.prompt+'</span><input type="text" class="ui-terminal-input" autocomplete="off"></div>'),this.promptContainer=this.element.find("> div:last-child > span.ui-terminal-prompt"),this.content=this.element.children(".ui-terminal-content"),this.input=this.promptContainer.next(),this.commands=[],this.commandIndex=0,this._bindEvents()},_bindEvents:function(){var e=this;this.input.on("keydown.terminal",function(i){var s=t.ui.keyCode;switch(i.which){case s.UP:e.commandIndex>0&&e.input.val(e.commands[--e.commandIndex]),i.preventDefault();break;case s.DOWN:e.commandIndex<e.commands.length-1?e.input.val(e.commands[++e.commandIndex]):(e.commandIndex=e.commands.length,e.input.val("")),i.preventDefault();break;case s.ENTER:case s.NUMPAD_ENTER:e._processCommand(),i.preventDefault()}}),this.element.on("click",function(){e.input.trigger("focus")})},_processCommand:function(){var e=this.input.val();this.commands.push(),this.commandIndex++,this.options.handler&&"function"===t.type(this.options.handler)&&this.options.handler.call(this,e,this._updateContent)},_updateContent:function(e){var i=t("<div></div>");i.append("<span>"+this.options.prompt+'</span><span class="ui-terminal-command">'+this.input.val()+"</span>").append("<div>"+e+"</div>").appendTo(this.content),this.input.val(""),this.element.scrollTop(this.content.height())},clear:function(){this.content.html(""),this.input.val("")}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puitogglebutton",{options:{onLabel:"Yes",offLabel:"No",onIcon:null,offIcon:null,checked:!1},_create:function(){this.element.wrap('<div class="ui-button ui-togglebutton ui-widget ui-state-default ui-corner-all" />'),this.container=this.element.parent(),this.element.addClass("ui-helper-hidden-accessible"),this.options.onIcon&&this.options.offIcon?(this.container.addClass("ui-button-text-icon-left"),this.container.append('<span class="ui-button-icon-left fa fa-fw"></span>')):this.container.addClass("ui-button-text-only"),this.container.append('<span class="ui-button-text"></span>'),this.options.style&&this.container.attr("style",this.options.style),this.options.styleClass&&this.container.attr("class",this.options.styleClass),this.label=this.container.children(".ui-button-text"),this.icon=this.container.children(".fa"),this.element.prop("checked")||this.options.checked?this.check(!0):this.uncheck(!0),this.element.prop("disabled")||this._bindEvents()},_bindEvents:function(){var e=this;this.container.on("mouseover.puitogglebutton",function(){e.container.hasClass("ui-state-active")||e.container.addClass("ui-state-hover")}).on("mouseout.puitogglebutton",function(){e.container.removeClass("ui-state-hover")}).on("click.puitogglebutton",function(){e.toggle(),e.element.trigger("focus")}),this.element.on("focus.puitogglebutton",function(){e.container.addClass("ui-state-focus")}).on("blur.puitogglebutton",function(){e.container.removeClass("ui-state-focus")}).on("keydown.puitogglebutton",function(e){var i=t.ui.keyCode;e.which===i.SPACE&&e.preventDefault()}).on("keyup.puitogglebutton",function(i){var s=t.ui.keyCode;i.which===s.SPACE&&(e.toggle(),i.preventDefault())})},_unbindEvents:function(){this.container.off("mouseover.puitogglebutton mouseout.puitogglebutton click.puitogglebutton"),this.element.off("focus.puitogglebutton blur.puitogglebutton keydown.puitogglebutton keyup.puitogglebutton")},toggle:function(){this.element.prop("checked")?this.uncheck():this.check()},check:function(t){this.container.addClass("ui-state-active"),this.label.text(this.options.onLabel),this.element.prop("checked",!0),this.options.onIcon&&this.icon.removeClass(this.options.offIcon).addClass(this.options.onIcon),t||this._trigger("change",null,{checked:!0})},uncheck:function(t){this.container.removeClass("ui-state-active"),this.label.text(this.options.offLabel),this.element.prop("checked",!1),this.options.offIcon&&this.icon.removeClass(this.options.onIcon).addClass(this.options.offIcon),t||this._trigger("change",null,{checked:!1})},disable:function(){this.element.prop("disabled",!0),this.container.attr("aria-disabled",!0),this.container.addClass("ui-state-disabled").removeClass("ui-state-focus ui-state-hover"),this._unbindEvents()},enable:function(){this.element.prop("disabled",!1),this.container.attr("aria-disabled",!1),this.container.removeClass("ui-state-disabled"),this._bindEvents()},isChecked:function(){return this.element.prop("checked")},_setOption:function(e,i){"checked"===e?(this.options.checked=i,i?this.check(!0):this.uncheck(!0)):"disabled"===e?i?this.disable():this.enable():t.Widget.prototype._setOption.apply(this,arguments)},_destroy:function(){this._unbindEvents(),this.container.children("span").remove(),this.element.removeClass("ui-helper-hidden-accessible").unwrap()}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puitooltip",{options:{showEvent:"mouseover",hideEvent:"mouseout",showEffect:"fade",hideEffect:null,showEffectSpeed:"normal",hideEffectSpeed:"normal",my:"left top",at:"right bottom",showDelay:150,content:null},_create:function(){this.options.showEvent=this.options.showEvent+".puitooltip",this.options.hideEvent=this.options.hideEvent+".puitooltip",this.element.get(0)===document?this._bindGlobal():this._bindTarget()},_bindGlobal:function(){this.container=t('<div class="ui-tooltip ui-tooltip-global ui-widget ui-widget-content ui-corner-all ui-shadow" />').appendTo(document.body),this.globalSelector="a,:input,:button,img";var e=this;t(document).off(this.options.showEvent+" "+this.options.hideEvent,this.globalSelector).on(this.options.showEvent,this.globalSelector,null,function(){var i=t(this),s=i.attr("title");s&&(e.container.text(s),e.globalTitle=s,e.target=i,i.attr("title",""),e.show())}).on(this.options.hideEvent,this.globalSelector,null,function(){var i=t(this);e.globalTitle&&(e.container.hide(),i.attr("title",e.globalTitle),e.globalTitle=null,e.target=null)});var i="resize.puitooltip";t(window).unbind(i).bind(i,function(){e.container.is(":visible")&&e._align()})},_bindTarget:function(){this.container=t('<div class="ui-tooltip ui-widget ui-widget-content ui-corner-all ui-shadow" />').appendTo(document.body);var e=this;this.element.off(this.options.showEvent+" "+this.options.hideEvent).on(this.options.showEvent,function(){e.show()}).on(this.options.hideEvent,function(){e.hide()}),this.container.html(this.options.content),this.element.removeAttr("title"),this.target=this.element;var i="resize."+this.element.attr("id");t(window).unbind(i).bind(i,function(){e.container.is(":visible")&&e._align()})},_align:function(){this.container.css({left:"",top:"","z-index":++PUI.zindex}).position({my:this.options.my,at:this.options.at,of:this.target})},show:function(){var t=this;this.timeout=window.setTimeout(function(){t._align(),t.container.show(t.options.showEffect,{},t.options.showEffectSpeed)},this.options.showDelay)},hide:function(){window.clearTimeout(this.timeout),this.container.hide(this.options.hideEffect,{},this.options.hideEffectSpeed,function(){t(this).css("z-index","")})}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puitree",{options:{nodes:null,lazy:!1,animate:!1,selectionMode:null,icons:null},_create:function(){if(this.element.uniqueId().addClass("ui-tree ui-widget ui-widget-content ui-corner-all").append('<ul class="ui-tree-container"></ul>'),this.rootContainer=this.element.children(".ui-tree-container"),this.options.selectionMode&&(this.selection=[]),this._bindEvents(),"array"===t.type(this.options.nodes))this._renderNodes(this.options.nodes,this.rootContainer);else{if("function"!==t.type(this.options.nodes))throw"Unsupported type. nodes option can be either an array or a function";this.options.nodes.call(this,{},this._initData)}},_renderNodes:function(t,e){for(var i=0;i<t.length;i++)this._renderNode(t[i],e)},_renderNode:function(e,i){var s=this.options.lazy?e.leaf:!(e.children&&e.children.length),n=e.iconType||"def",o=e.expanded,a=this.options.selectionMode?e.selectable!==!1:!1,l=s?"ui-treenode-leaf-icon":e.expanded?"ui-tree-toggler fa fa-fw fa-caret-down":"ui-tree-toggler fa fa-fw fa-caret-right",r=s?"ui-treenode ui-treenode-leaf":"ui-treenode ui-treenode-parent",h=t('<li class="'+r+'"></li>'),u=t('<span class="ui-treenode-content"></span>');
h.data("puidata",e.data).appendTo(i),a&&u.addClass("ui-treenode-selectable"),u.append('<span class="'+l+'"></span>').append('<span class="ui-treenode-icon"></span>').append('<span class="ui-treenode-label ui-corner-all">'+e.label+"</span>").appendTo(h);var d=this.options.icons&&this.options.icons[n];if(d){var c=u.children(".ui-treenode-icon"),p="string"===t.type(d)?d:o?d.expanded:d.collapsed;c.addClass("fa fa-fw "+p)}if(!s){var f=t('<ul class="ui-treenode-children"></ul>');if(e.expanded||f.hide(),f.appendTo(h),e.children)for(var m=0;m<e.children.length;m++)this._renderNode(e.children[m],f)}},_initData:function(t){this._renderNodes(t,this.rootContainer)},_handleNodeData:function(t,e){this._renderNodes(t,e.children(".ui-treenode-children")),this._showNodeChildren(e),e.data("puiloaded",!0)},_bindEvents:function(){var e=this,i=this.element.attr("id"),s="#"+i+" .ui-tree-toggler";if(t(document).off("click.puitree-"+i,s).on("click.puitree-"+i,s,null,function(i){var s=t(this),n=s.closest("li");n.hasClass("ui-treenode-expanded")?e.collapseNode(n):e.expandNode(n)}),this.options.selectionMode){var n="#"+i+" .ui-treenode-selectable .ui-treenode-label",o="#"+i+" .ui-treenode-selectable.ui-treenode-content";t(document).off("mouseout.puitree-"+i+" mouseover.puitree-"+i,n).on("mouseout.puitree-"+i,n,null,function(){t(this).removeClass("ui-state-hover")}).on("mouseover.puitree-"+i,n,null,function(){t(this).addClass("ui-state-hover")}).off("click.puitree-"+i,o).on("click.puitree-"+i,o,null,function(i){e._nodeClick(i,t(this))})}},expandNode:function(t){this._trigger("beforeExpand",null,{node:t,data:t.data("puidata")}),this.options.lazy&&!t.data("puiloaded")?this.options.nodes.call(this,{node:t,data:t.data("puidata")},this._handleNodeData):this._showNodeChildren(t)},collapseNode:function(e){this._trigger("beforeCollapse",null,{node:e,data:e.data("puidata")}),e.removeClass("ui-treenode-expanded");var i=e.iconType||"def",s=this.options.icons&&this.options.icons[i];s&&"string"!==t.type(s)&&e.find("> .ui-treenode-content > .ui-treenode-icon").removeClass(s.expanded).addClass(s.collapsed);var n=e.find("> .ui-treenode-content > .ui-tree-toggler"),o=e.children(".ui-treenode-children");n.addClass("fa-caret-right").removeClass("fa-caret-down"),this.options.animate?o.slideUp("fast"):o.hide(),this._trigger("afterCollapse",null,{node:e,data:e.data("puidata")})},_showNodeChildren:function(e){e.addClass("ui-treenode-expanded").attr("aria-expanded",!0);var i=e.iconType||"def",s=this.options.icons&&this.options.icons[i];s&&"string"!==t.type(s)&&e.find("> .ui-treenode-content > .ui-treenode-icon").removeClass(s.collapsed).addClass(s.expanded);var n=e.find("> .ui-treenode-content > .ui-tree-toggler");n.addClass("fa-caret-down").removeClass("fa-caret-right"),this.options.animate?e.children(".ui-treenode-children").slideDown("fast"):e.children(".ui-treenode-children").show(),this._trigger("afterExpand",null,{node:e,data:e.data("puidata")})},_nodeClick:function(e,i){if(PUI.clearSelection(),t(e.target).is(":not(.ui-tree-toggler)")){var s=i.parent(),n=this._isNodeSelected(s.data("puidata")),o=e.metaKey||e.ctrlKey;n&&o?this.unselectNode(s):((this._isSingleSelection()||this._isMultipleSelection()&&!o)&&this.unselectAllNodes(),this.selectNode(s))}},selectNode:function(t){t.attr("aria-selected",!0).find("> .ui-treenode-content > .ui-treenode-label").removeClass("ui-state-hover").addClass("ui-state-highlight"),this._addToSelection(t.data("puidata")),this._trigger("nodeSelect",null,{node:t,data:t.data("puidata")})},unselectNode:function(t){t.attr("aria-selected",!1).find("> .ui-treenode-content > .ui-treenode-label").removeClass("ui-state-highlight ui-state-hover"),this._removeFromSelection(t.data("puidata")),this._trigger("nodeUnselect",null,{node:t,data:t.data("puidata")})},unselectAllNodes:function(){this.selection=[],this.element.find(".ui-treenode-label.ui-state-highlight").each(function(){t(this).removeClass("ui-state-highlight").closest(".ui-treenode").attr("aria-selected",!1)})},_addToSelection:function(t){if(t){var e=this._isNodeSelected(t);e||this.selection.push(t)}},_removeFromSelection:function(t){if(t){for(var e=-1,i=0;i<this.selection.length;i++){var s=this.selection[i];if(s&&JSON.stringify(s)===JSON.stringify(t)){e=i;break}}e>=0&&this.selection.splice(e,1)}},_isNodeSelected:function(t){var e=!1;if(t)for(var i=0;i<this.selection.length;i++){var s=this.selection[i];if(s&&JSON.stringify(s)===JSON.stringify(t)){e=!0;break}}return e},_isSingleSelection:function(){return this.options.selectionMode&&"single"===this.options.selectionMode},_isMultipleSelection:function(){return this.options.selectionMode&&"multiple"===this.options.selectionMode}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puitreetable",{options:{nodes:null,lazy:!1,selectionMode:null,header:null},_create:function(){this.id=this.element.attr("id"),this.id||(this.id=this.element.uniqueId().attr("id")),this.element.addClass("ui-treetable ui-widget"),this.tableWrapper=t('<div class="ui-treetable-tablewrapper" />').appendTo(this.element),this.table=t("<table><thead></thead><tbody></tbody></table>").appendTo(this.tableWrapper),this.thead=this.table.children("thead"),this.tbody=this.table.children("tbody").addClass("ui-treetable-data");if(this.options.columns){var e=t("<tr></tr>").appendTo(this.thead);t.each(this.options.columns,function(i,s){var n=t('<th class="ui-state-default"></th>').data("field",s.field).appendTo(e);s.headerClass&&n.addClass(s.headerClass),s.headerStyle&&n.attr("style",s.headerStyle),s.headerText&&n.text(s.headerText)})}if(this.options.header&&this.element.prepend('<div class="ui-treetable-header ui-widget-header ui-corner-top">'+this.options.header+"</div>"),this.options.footer&&this.element.append('<div class="ui-treetable-footer ui-widget-header ui-corner-bottom">'+this.options.footer+"</div>"),t.isArray(this.options.nodes))this._renderNodes(this.options.nodes,null,!0);else{if("function"!==t.type(this.options.nodes))throw"Unsupported type. nodes option can be either an array or a function";this.options.nodes.call(this,{},this._initData)}this._bindEvents()},_initData:function(t){this._renderNodes(t,null,!0)},_renderNodes:function(e,i,s){for(var n=0;n<e.length;n++){var o=e[n],a=o.data,l=this.options.lazy?o.leaf:!(o.children&&o.children.length),r=t('<tr class="ui-widget-content"></tr>'),h=i?i.data("depth")+1:0,u=i?i.data("rowkey"):null,d=u?u+"_"+n:n.toString();r.data({depth:h,rowkey:d,parentrowkey:u,puidata:a}),s||r.addClass("ui-helper-hidden");for(var c=0;c<this.options.columns.length;c++){var p=t("<td />").appendTo(r),f=this.options.columns[c];if(f.bodyClass&&p.addClass(f.bodyClass),f.bodyStyle&&p.attr("style",f.bodyStyle),0===c){var m=t('<span class="ui-treetable-toggler fa fa-fw fa-caret-right ui-c"></span>');m.css("margin-left",16*h+"px"),l&&m.css("visibility","hidden"),m.appendTo(p)}if(f.content){var v=f.content.call(this,a);"string"===t.type(v)?p.text(v):p.append(v)}else p.append(a[f.field])}i?r.insertAfter(i):r.appendTo(this.tbody),l||this._renderNodes(o.children,r,o.expanded)}},_bindEvents:function(){var e=this,i="> tr > td:first-child > .ui-treetable-toggler";if(this.tbody.off("click.puitreetable",i).on("click.puitreetable",i,null,function(i){var s=t(this),n=s.closest("tr");n.data("processing")||(n.data("processing",!0),s.hasClass("fa-caret-right")?e.expandNode(n):e.collapseNode(n))}),this.options.selectionMode){this.selection=[];var s="> tr";this.tbody.off("mouseover.puitreetable mouseout.puitreetable click.puitreetable",s).on("mouseover.puitreetable",s,null,function(e){var i=t(this);i.hasClass("ui-state-highlight")||i.addClass("ui-state-hover")}).on("mouseout.puitreetable",s,null,function(e){var i=t(this);i.hasClass("ui-state-highlight")||i.removeClass("ui-state-hover")}).on("click.puitreetable",s,null,function(i){e.onRowClick(i,t(this))})}},expandNode:function(t){this._trigger("beforeExpand",null,{node:t,data:t.data("puidata")}),this.options.lazy&&!t.data("puiloaded")?this.options.nodes.call(this,{node:t,data:t.data("puidata")},this._handleNodeData):(this._showNodeChildren(t,!1),this._trigger("afterExpand",null,{node:t,data:t.data("puidata")}))},_handleNodeData:function(t,e){this._renderNodes(t,e,!0),this._showNodeChildren(e,!1),e.data("puiloaded",!0),this._trigger("afterExpand",null,{node:e,data:e.data("puidata")})},_showNodeChildren:function(t,e){e||t.data("expanded",!0).attr("aria-expanded",!0).find(".ui-treetable-toggler:first").addClass("fa-caret-down").removeClass("fa-caret-right");for(var i=this._getChildren(t),s=0;s<i.length;s++){var n=i[s];n.removeClass("ui-helper-hidden"),n.data("expanded")&&this._showNodeChildren(n,!0)}t.data("processing",!1)},collapseNode:function(t){this._trigger("beforeCollapse",null,{node:t,data:t.data("puidata")}),this._hideNodeChildren(t,!1),t.data("processing",!1),this._trigger("afterCollapse",null,{node:t,data:t.data("puidata")})},_hideNodeChildren:function(t,e){e||t.data("expanded",!1).attr("aria-expanded",!1).find(".ui-treetable-toggler:first").addClass("fa-caret-right").removeClass("fa-caret-down");for(var i=this._getChildren(t),s=0;s<i.length;s++){var n=i[s];n.addClass("ui-helper-hidden"),n.data("expanded")&&this._hideNodeChildren(n,!0)}},onRowClick:function(e,i){if(!t(e.target).is(":input,:button,a,.ui-c")){var s=i.hasClass("ui-state-highlight"),n=e.metaKey||e.ctrlKey;s&&n?this.unselectNode(i):((this.isSingleSelection()||this.isMultipleSelection()&&!n)&&this.unselectAllNodes(),this.selectNode(i)),PUI.clearSelection()}},selectNode:function(t,e){t.removeClass("ui-state-hover").addClass("ui-state-highlight").attr("aria-selected",!0),e||this._trigger("nodeSelect",{},{node:t,data:t.data("puidata")})},unselectNode:function(t,e){t.removeClass("ui-state-highlight").attr("aria-selected",!1),e||this._trigger("nodeUnselect",{},{node:t,data:t.data("puidata")})},unselectAllNodes:function(){for(var t=this.tbody.children("tr.ui-state-highlight"),e=0;e<t.length;e++)this.unselectNode(t.eq(e),!0)},isSingleSelection:function(){return"single"===this.options.selectionMode},isMultipleSelection:function(){return"multiple"===this.options.selectionMode},_getChildren:function(t){for(var e=t.data("rowkey"),i=t.nextAll(),s=[],n=0;n<i.length;n++){var o=i.eq(n),a=o.data("parentrowkey");a===e&&s.push(o)}return s}})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,i){return t(i),i}:t(jQuery)}(function(t){t.widget("primeui.puicolresize",{options:{mode:"fit"},_create:function(){this.element.addClass("ui-datatable-resizable"),this.thead=this.element.find("> .ui-datatable-tablewrapper > table > thead"),this.thead.find("> tr > th").addClass("ui-resizable-column"),this.resizerHelper=t('<div class="ui-column-resizer-helper ui-state-highlight"></div>').appendTo(this.element),this.addResizers();var e=this.thead.find("> tr > th > span.ui-column-resizer"),i=this;setTimeout(function(){i.fixColumnWidths()},5),e.draggable({axis:"x",start:function(t,e){e.helper.data("originalposition",e.helper.offset());var s=i.options.scrollable?i.scrollBody.height():i.thead.parent().height()-i.thead.height()-1;i.resizerHelper.height(s),i.resizerHelper.show()},drag:function(t,e){i.resizerHelper.offset({left:e.helper.offset().left+e.helper.width()/2,top:i.thead.offset().top+i.thead.height()})},stop:function(t,e){e.helper.css({left:"",top:"0px",right:"0px"}),i.resize(t,e),i.resizerHelper.hide(),"expand"===i.options.mode?setTimeout(function(){i._trigger("colResize",null,{element:e.helper.parent().get(0)})},5):i._trigger("colResize",null,{element:e.helper.parent().get(0)})},containment:this.element})},resize:function(t,e){var i,s,n=null,o=null,a=null,l="expand"===this.options.mode,r=this.thead.parent(),i=e.helper.parent(),s=i.next();n=e.position.left-e.originalPosition.left,o=i.width()+n,a=s.width()-n,(o>15&&a>15||l&&o>15)&&(l?(r.width(r.width()+n),setTimeout(function(){i.width(o)},1)):(i.width(o),s.width(a)))},addResizers:function(){var t=this.thead.find("> tr > th.ui-resizable-column");t.prepend('<span class="ui-column-resizer"> </span>'),"fit"===this.options.columnResizeMode&&t.filter(":last-child").children("span.ui-column-resizer").hide()},fixColumnWidths:function(){this.columnWidthsFixed||(this.element.find("> .ui-datatable-tablewrapper > table > thead > tr > th").each(function(){var e=t(this);e.width(e.width())}),this.columnWidthsFixed=!0)},_destroy:function(){this.element.removeClass("ui-datatable-resizable"),this.thead.find("> tr > th").removeClass("ui-resizable-column"),this.resizerHelper.remove(),this.thead.find("> tr > th > span.ui-column-resizer").draggable("destroy").remove()}}),t.widget("primeui.puicolreorder",{_create:function(){var e=this;this.thead=this.element.find("> .ui-datatable-tablewrapper > table > thead"),this.tbody=this.element.find("> .ui-datatable-tablewrapper > table > tbody"),this.dragIndicatorTop=t('<span class="fa fa-arrow-down" style="position:absolute"/></span>').hide().appendTo(this.element),this.dragIndicatorBottom=t('<span class="fa fa-arrow-up" style="position:absolute"/></span>').hide().appendTo(this.element),this.thead.find("> tr > th").draggable({appendTo:"body",opacity:.75,cursor:"move",scope:this.id,cancel:":input,.ui-column-resizer",drag:function(t,i){var s=i.helper.data("droppable-column");if(s){var n=s.offset(),o=n.top-10,a=n.top+s.height()+8,l=null;if(t.originalEvent.pageX>=n.left+s.width()/2){var r=s.next();l=1==r.length?r.offset().left-9:s.offset().left+s.innerWidth()-9,i.helper.data("drop-location",1)}else l=n.left-9,i.helper.data("drop-location",-1);e.dragIndicatorTop.offset({left:l,top:o-3}).show(),e.dragIndicatorBottom.offset({left:l,top:a-3}).show()}},stop:function(t,i){e.dragIndicatorTop.css({left:0,top:0}).hide(),e.dragIndicatorBottom.css({left:0,top:0}).hide()},helper:function(){var e=t(this),i=t('<div class="ui-widget ui-state-default" style="padding:4px 10px;text-align:center;"></div>');return i.width(e.width()),i.height(e.height()),i.html(e.html()),i.get(0)}}).droppable({hoverClass:"ui-state-highlight",tolerance:"pointer",scope:this.id,over:function(e,i){i.helper.data("droppable-column",t(this))},drop:function(i,s){var n=s.draggable,o=t(this),a=s.helper.data("drop-location");e._trigger("colReorder",null,{dragIndex:n.index(),dropIndex:o.index(),dropSide:a})}})},_destroy:function(){this.dragIndicatorTop.remove(),this.dragIndicatorBottom.remove(),this.thead.find("> tr > th").draggable("destroy").droppable("destroy")}}),t.widget("primeui.puitablescroll",{options:{scrollHeight:null,scrollWidth:null},_create:function(){this.id=PUI.generateRandomId(),this.scrollHeader=this.element.children(".ui-datatable-scrollable-header"),this.scrollBody=this.element.children(".ui-datatable-scrollable-body"),this.scrollFooter=this.element.children(".ui-datatable-scrollable-footer"),this.scrollHeaderBox=this.scrollHeader.children(".ui-datatable-scrollable-header-box"),this.bodyTable=this.scrollBody.children("table"),this.percentageScrollHeight=this.options.scrollHeight&&-1!==this.options.scrollHeight.indexOf("%"),this.percentageScrollWidth=this.options.scrollWidth&&-1!==this.options.scrollWidth.indexOf("%");var e=this,i=this.getScrollbarWidth()+"px";this.options.scrollHeight&&(this.percentageScrollHeight?this.adjustScrollHeight():this.scrollBody.css("max-height",this.options.scrollHeight+"px"),this.scrollHeaderBox.css("margin-right",i)),this.options.scrollWidth&&(this.percentageScrollWidth?this.adjustScrollWidth():this.setScrollWidth(parseInt(this.options.scrollWidth))),this.scrollBody.on("scroll.dataTable",function(){var t=e.scrollBody.scrollLeft();e.scrollHeaderBox.css("margin-left",-t)}),this.scrollHeader.on("scroll.dataTable",function(){e.scrollHeader.scrollLeft(0)}),t(window).on("resize."+this.id,function(){e.element.is(":visible")&&(e.percentageScrollHeight&&e.adjustScrollHeight(),e.percentageScrollWidth&&e.adjustScrollWidth())})},_destroy:function(){t(window).off("resize."+this.id),this.scrollHeader.off("scroll.dataTable"),this.scrollBody.off("scroll.dataTable")},adjustScrollHeight:function(){var t=this.element.parent().parent().innerHeight()*(parseInt(this.options.scrollHeight)/100),e=this.element.children(".ui-datatable-header").outerHeight(!0),i=this.element.children(".ui-datatable-footer").outerHeight(!0),s=this.scrollHeader.outerHeight(!0)+this.scrollFooter.outerHeight(!0),n=this.paginator?this.paginator.getContainerHeight(!0):0,o=t-(s+n+e+i);this.scrollBody.css("max-height",o+"px")},adjustScrollWidth:function(){var t=parseInt(this.element.parent().parent().innerWidth()*(parseInt(this.options.scrollWidth)/100));this.setScrollWidth(t)},setOuterWidth:function(t,e){var i=t.outerWidth()-t.width();t.width(e-i)},setScrollWidth:function(e){var i=this;this.element.children(".ui-widget-header").each(function(){i.setOuterWidth(t(this),e)}),this.scrollHeader.width(e),this.scrollBody.css("margin-right",0).width(e)},getScrollbarWidth:function(){return this.scrollbarWidth||(this.scrollbarWidth=PUI.calculateScrollbarWidth()),this.scrollbarWidth}})});
|
ajax/libs/forerunnerdb/1.3.875/fdb-core+persist.min.js
|
froala/cdnjs
|
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){var d=a("./core");a("../lib/Persist");"undefined"!=typeof window&&(window.ForerunnerDB=d),b.exports=d},{"../lib/Persist":29,"./core":2}],2:[function(a,b,c){var d=a("../lib/Core");a("../lib/Shim.IE8");"undefined"!=typeof window&&(window.ForerunnerDB=d),b.exports=d},{"../lib/Core":8,"../lib/Shim.IE8":35}],3:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=new e,g=function(a,b,c){this.init.apply(this,arguments)};g.prototype.init=function(a,b,c,d,e){this._store=[],this._keys=[],void 0!==c&&this.primaryKey(c),void 0!==b&&this.index(b),void 0!==d&&this.compareFunc(d),void 0!==e&&this.hashFunc(e),void 0!==a&&this.data(a)},d.addModule("BinaryTree",g),d.mixin(g.prototype,"Mixin.ChainReactor"),d.mixin(g.prototype,"Mixin.Sorting"),d.mixin(g.prototype,"Mixin.Common"),d.synthesize(g.prototype,"compareFunc"),d.synthesize(g.prototype,"hashFunc"),d.synthesize(g.prototype,"indexDir"),d.synthesize(g.prototype,"primaryKey"),d.synthesize(g.prototype,"keys"),d.synthesize(g.prototype,"index",function(a){return void 0!==a&&(this.debug()&&console.log("Setting index",a,f.parse(a,!0)),this.keys(f.parse(a,!0))),this.$super.call(this,a)}),g.prototype.clear=function(){delete this._data,delete this._left,delete this._right,this._store=[]},g.prototype.data=function(a){return void 0!==a?(this._data=a,this._hashFunc&&(this._hash=this._hashFunc(a)),this):this._data},g.prototype.push=function(a){return void 0!==a&&(this._store.push(a),this)},g.prototype.pull=function(a){if(void 0!==a){var b=this._store.indexOf(a);if(b>-1)return this._store.splice(b,1),this}return!1},g.prototype._compareFunc=function(a,b){var c,d,e=0;for(c=0;c<this._keys.length;c++)if(d=this._keys[c],1===d.value?e=this.sortAsc(f.get(a,d.path),f.get(b,d.path)):d.value===-1&&(e=this.sortDesc(f.get(a,d.path),f.get(b,d.path))),this.debug()&&console.log("Compared %s with %s order %d in path %s and result was %d",f.get(a,d.path),f.get(b,d.path),d.value,d.path,e),0!==e)return this.debug()&&console.log("Retuning result %d",e),e;return this.debug()&&console.log("Retuning result %d",e),e},g.prototype._hashFunc=function(a){return a[this._keys[0].path]},g.prototype.removeChildNode=function(a){this._left===a?delete this._left:this._right===a&&delete this._right},g.prototype.nodeBranch=function(a){return this._left===a?"left":this._right===a?"right":void 0},g.prototype.insert=function(a){var b,c,d,e;if(a instanceof Array){for(c=[],d=[],e=0;e<a.length;e++)this.insert(a[e])?c.push(a[e]):d.push(a[e]);return{inserted:c,failed:d}}return this.debug()&&console.log("Inserting",a),this._data?(b=this._compareFunc(this._data,a),0===b?(this.debug()&&console.log("Data is equal (currrent, new)",this._data,a),this._left?this._left.insert(a):(this._left=new g(a,this._index,this._binaryTree,this._compareFunc,this._hashFunc),this._left._parent=this),!0):b===-1?(this.debug()&&console.log("Data is greater (currrent, new)",this._data,a),this._right?this._right.insert(a):(this._right=new g(a,this._index,this._binaryTree,this._compareFunc,this._hashFunc),this._right._parent=this),!0):1===b&&(this.debug()&&console.log("Data is less (currrent, new)",this._data,a),this._left?this._left.insert(a):(this._left=new g(a,this._index,this._binaryTree,this._compareFunc,this._hashFunc),this._left._parent=this),!0)):(this.debug()&&console.log("Node has no data, setting data",a),this.data(a),!0)},g.prototype.remove=function(a){var b,c,d,e=this.primaryKey();if(a instanceof Array){for(c=[],d=0;d<a.length;d++)this.remove(a[d])&&c.push(a[d]);return c}return this.debug()&&console.log("Removing",a),this._data[e]===a[e]?this._remove(this):(b=this._compareFunc(this._data,a),b===-1&&this._right?this._right.remove(a):!(1!==b||!this._left)&&this._left.remove(a))},g.prototype._remove=function(a){var b,c;return this._left?(b=this._left,c=this._right,this._left=b._left,this._right=b._right,this._data=b._data,this._store=b._store,c&&(b.rightMost()._right=c)):this._right?(c=this._right,this._left=c._left,this._right=c._right,this._data=c._data,this._store=c._store):this.clear(),!0},g.prototype.leftMost=function(){return this._left?this._left.leftMost():this},g.prototype.rightMost=function(){return this._right?this._right.rightMost():this},g.prototype.lookup=function(a,b,c,d){var e=this._compareFunc(this._data,a);return d=d||[],0===e&&(this._left&&this._left.lookup(a,b,c,d),d.push(this._data),this._right&&this._right.lookup(a,b,c,d)),e===-1&&this._right&&this._right.lookup(a,b,c,d),1===e&&this._left&&this._left.lookup(a,b,c,d),d},g.prototype.inOrder=function(a,b){switch(b=b||[],this._left&&this._left.inOrder(a,b),a){case"hash":b.push(this._hash);break;case"data":b.push(this._data);break;default:b.push({key:this._data,arr:this._store})}return this._right&&this._right.inOrder(a,b),b},g.prototype.startsWith=function(a,b,c,d){var e,g,h=f.get(this._data,a),i=h.substr(0,b.length);return d=d||[],void 0===d._visitedCount&&(d._visitedCount=0),d._visitedCount++,d._visitedNodes=d._visitedNodes||[],d._visitedNodes.push(h),g=this.sortAsc(i,b),e=i===b,0===g&&(this._left&&this._left.startsWith(a,b,c,d),e&&d.push(this._data),this._right&&this._right.startsWith(a,b,c,d)),g===-1&&(e&&d.push(this._data),this._right&&this._right.startsWith(a,b,c,d)),1===g&&(this._left&&this._left.startsWith(a,b,c,d),e&&d.push(this._data)),d},g.prototype.findRange=function(a,b,c,d,f,g){f=f||[],g=g||new e(b),this._left&&this._left.findRange(a,b,c,d,f,g);var h=g.value(this._data),i=this.sortAsc(h,c),j=this.sortAsc(h,d);if(!(0!==i&&1!==i||0!==j&&j!==-1))switch(a){case"hash":f.push(this._hash);break;case"data":f.push(this._data);break;default:f.push({key:this._data,arr:this._store})}return this._right&&this._right.findRange(a,b,c,d,f,g),f},g.prototype.match=function(a,b,c){var d,e,g,h=[],i=0;for(d=f.parseArr(this._index,{verbose:!0}),e=f.parseArr(a,c&&c.pathOptions?c.pathOptions:{ignore:/\$/,verbose:!0}),g=0;g<d.length;g++)e[g]===d[g]&&(i++,h.push(e[g]));return{matchedKeys:h,totalKeyCount:e.length,score:i}},d.finishModule("BinaryTree"),b.exports=g},{"./Path":28,"./Shared":34}],4:[function(a,b,c){"use strict";var d,e;d=function(){var a,b,c,d=[];for(b=0;b<256;b++){for(a=b,c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;d[b]=a}return d}(),e=function(a){var b,c=-1;for(b=0;b<a.length;b++)c=c>>>8^d[255&(c^a.charCodeAt(b))];return(c^-1)>>>0},b.exports=e},{}],5:[function(a,b,c){"use strict";var d,e,f,g,h,i,j,k,l,m,n,o;d=a("./Shared");var p=function(a,b){this.init.apply(this,arguments)};p.prototype.init=function(a,b){this.sharedPathSolver=o,this._primaryKey="_id",this._primaryIndex=new g("primary"),this._primaryCrc=new g("primaryCrc"),this._crcLookup=new g("crcLookup"),this._name=a,this._data=[],this._metrics=new f,this._options=b||{changeTimestamp:!1},this._options.db&&this.db(this._options.db),this._metaData={},this._deferQueue={insert:[],update:[],remove:[],upsert:[],async:[]},this._deferThreshold={insert:100,update:100,remove:100,upsert:100},this._deferTime={insert:1,update:1,remove:1,upsert:1},this._deferredCalls=!0,this.subsetOf(this)},d.addModule("Collection",p),d.mixin(p.prototype,"Mixin.Common"),d.mixin(p.prototype,"Mixin.Events"),d.mixin(p.prototype,"Mixin.ChainReactor"),d.mixin(p.prototype,"Mixin.CRUD"),d.mixin(p.prototype,"Mixin.Constants"),d.mixin(p.prototype,"Mixin.Triggers"),d.mixin(p.prototype,"Mixin.Sorting"),d.mixin(p.prototype,"Mixin.Matching"),d.mixin(p.prototype,"Mixin.Updating"),d.mixin(p.prototype,"Mixin.Tags"),f=a("./Metrics"),g=a("./KeyValueStore"),h=a("./Path"),i=a("./IndexHashMap"),j=a("./IndexBinaryTree"),k=a("./Index2d"),e=d.modules.Db,l=a("./Overload"),m=a("./ReactorIO"),n=a("./Condition"),o=new h,d.synthesize(p.prototype,"deferredCalls"),d.synthesize(p.prototype,"state"),d.synthesize(p.prototype,"name"),d.synthesize(p.prototype,"metaData"),d.synthesize(p.prototype,"capped"),d.synthesize(p.prototype,"cappedSize"),p.prototype._asyncPending=function(a){this._deferQueue.async.push(a)},p.prototype._asyncComplete=function(a){for(var b=this._deferQueue.async.indexOf(a);b>-1;)this._deferQueue.async.splice(b,1),b=this._deferQueue.async.indexOf(a);0===this._deferQueue.async.length&&this.deferEmit("ready")},p.prototype.data=function(){return this._data},p.prototype.drop=function(a){var b;if(this.isDropped())return a&&a.call(this,!1,!0),!0;if(this._db&&this._db._collection&&this._name){if(this.debug()&&console.log(this.logIdentifier()+" Dropping"),this._state="dropped",this.emit("drop",this),delete this._db._collection[this._name],this._collate)for(b in this._collate)this._collate.hasOwnProperty(b)&&this.collateRemove(b);return delete this._primaryKey,delete this._primaryIndex,delete this._primaryCrc,delete this._crcLookup,delete this._data,delete this._metrics,delete this._listeners,a&&a.call(this,!1,!0),!0}return a&&a.call(this,!1,!0),!1},p.prototype.primaryKey=function(a){if(void 0!==a){if(this._primaryKey!==a){var b=this._primaryKey;this._primaryKey=a,this._primaryIndex.primaryKey(a),this.rebuildPrimaryKeyIndex(),this.chainSend("primaryKey",{keyName:a,oldData:b})}return this}return this._primaryKey},p.prototype._onInsert=function(a,b){this.emit("insert",a,b)},p.prototype._onUpdate=function(a){this.emit("update",a)},p.prototype._onRemove=function(a){this.emit("remove",a)},p.prototype._onChange=function(){this._options.changeTimestamp&&(this._metaData.lastChange=this.serialiser.convert(new Date))},d.synthesize(p.prototype,"db",function(a){return a&&"_id"===this.primaryKey()&&(this.primaryKey(a.primaryKey()),this.debug(a.debug())),this.$super.apply(this,arguments)}),d.synthesize(p.prototype,"mongoEmulation"),p.prototype.setData=new l("Collection.prototype.setData",{"*":function(a){return this.$main.call(this,a,{})},"*, object":function(a,b){return this.$main.call(this,a,b)},"*, function":function(a,b){return this.$main.call(this,a,{},b)},"*, *, function":function(a,b,c){return this.$main.call(this,a,b,c)},"*, *, *":function(a,b,c){return this.$main.call(this,a,b,c)},$main:function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";if(a){var d=this.deferredCalls(),e=[].concat(this._data);this.deferredCalls(!1),b=this.options(b),b.$decouple&&(a=this.decouple(a)),a instanceof Array||(a=[a]),this.remove({}),this.insert(a),this.deferredCalls(d),this._onChange(),this.emit("setData",this._data,e)}return c&&c.call(this),this}}),p.prototype.rebuildPrimaryKeyIndex=function(a){a=a||{$ensureKeys:void 0,$violationCheck:void 0};var b,c,d,e,f=!a||void 0===a.$ensureKeys||a.$ensureKeys,g=!a||void 0===a.$violationCheck||a.$violationCheck,h=this._primaryIndex,i=this._primaryCrc,j=this._crcLookup,k=this._primaryKey;for(h.truncate(),i.truncate(),j.truncate(),b=this._data,c=b.length;c--;){if(d=b[c],f&&this.ensurePrimaryKey(d),g){if(!h.uniqueSet(d[k],d))throw this.logIdentifier()+" Call to setData on collection failed because your data violates the primary key unique constraint. One or more documents are using the same primary key: "+d[this._primaryKey]}else h.set(d[k],d);e=this.hash(d),i.set(d[k],e),j.set(e,d)}},p.prototype.ensurePrimaryKey=function(a){void 0===a[this._primaryKey]&&(a[this._primaryKey]=this.objectId())},p.prototype.truncate=function(){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";return this.emit("truncate",this._data),this._data.length=0,this._primaryIndex=new g("primary"),this._primaryCrc=new g("primaryCrc"),this._crcLookup=new g("crcLookup"),this._onChange(),this.emit("immediateChange",{type:"truncate"}),this.deferEmit("change",{type:"truncate"}),this},p.prototype.upsert=function(a,b){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";if(a){var c,d,e=this._deferQueue.upsert,f=this._deferThreshold.upsert,g={};if(a instanceof Array){if(this._deferredCalls&&a.length>f)return this._deferQueue.upsert=e.concat(a),this._asyncPending("upsert"),this.processQueue("upsert",b),{};for(g=[],d=0;d<a.length;d++)g.push(this.upsert(a[d]));return b&&b.call(this),g}switch(a[this._primaryKey]?(c={},c[this._primaryKey]=a[this._primaryKey],this._primaryIndex.lookup(c)[0]?g.op="update":g.op="insert"):g.op="insert",g.op){case"insert":g.result=this.insert(a,b);break;case"update":g.result=this.update(c,a,{},b)}return g}return b&&b.call(this),{}},p.prototype.filter=function(a,b,c){return this.find(a,c).filter(b)},p.prototype.filterUpdate=function(a,b,c){var d,e,f,g,h=this.find(a,c),i=[],j=this.primaryKey();for(g=0;g<h.length;g++)d=h[g],f=b(d),f&&(e={},e[j]=d[j],i.push(this.update(e,f)));return i},p.prototype.update=function(a,b,c,d){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";return this.mongoEmulation()?(this.convertToFdb(a),this.convertToFdb(b)):b=this.decouple(b),b.$replace&&(c=c||{},c.$replace=!0,b=b.$replace),b=this.transformIn(b),this._handleUpdate(a,b,c,d)},p.prototype._handleUpdate=function(a,b,c,d){var e,f,g=this,h=this._metrics.create("update"),i=function(d){var e,f,i,j=g.decouple(d);return g.willTrigger(g.TYPE_UPDATE,g.PHASE_BEFORE)||g.willTrigger(g.TYPE_UPDATE,g.PHASE_AFTER)?(e=g.decouple(d),f={type:"update",query:g.decouple(a),update:g.decouple(b),options:g.decouple(c),op:h},i=g.updateObject(e,f.update,f.query,f.options,""),g.processTrigger(f,g.TYPE_UPDATE,g.PHASE_BEFORE,d,e)!==!1?(g._removeFromIndexes(d),i=g.updateObject(d,e,f.query,f.options,""),g._insertIntoIndexes(d),g.processTrigger(f,g.TYPE_UPDATE,g.PHASE_AFTER,j,e)):i=!1):(g._removeFromIndexes(d),i=g.updateObject(d,b,a,c,""),g._insertIntoIndexes(d)),i};return h.start(),h.time("Retrieve documents to update"),e=this.find(a,{$decouple:!1}),h.time("Retrieve documents to update"),e.length?(h.time("Update documents"),f=e.filter(i),h.time("Update documents"),f.length?(this.debug()&&console.log(this.logIdentifier()+" Updated some data"),h.time("Resolve chains"),this.chainWillSend()&&this.chainSend("update",{query:a,update:b,dataSet:this.decouple(f)},c),h.time("Resolve chains"),this._onUpdate(f),this._onChange(),d&&d.call(this,f||[]),this.emit("immediateChange",{type:"update",data:f}),this.deferEmit("change",{type:"update",data:f})):d&&d.call(this,f||[])):d&&d.call(this,f||[]),h.stop(),f||[]},p.prototype._replaceObj=function(a,b){var c;this._removeFromIndexes(a);for(c in a)a.hasOwnProperty(c)&&delete a[c];for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);if(!this._insertIntoIndexes(a))throw this.logIdentifier()+" Primary key violation in update! Key violated: "+a[this._primaryKey];return this},p.prototype.updateById=function(a,b){var c={};return c[this._primaryKey]=a,this.update(c,b)[0]},p.prototype.updateObject=function(a,b,c,d,e,f){b=this.decouple(b),e=e||"","."===e.substr(0,1)&&(e=e.substr(1,e.length-1));var g,i,j,k,l,m,n,o,p,q,r,s,t=!1,u=!1;if(d&&d.$replace===!0){g=!0,n=b,o=this.primaryKey();for(m in a)a.hasOwnProperty(m)&&m!==o&&void 0===n[m]&&(this._updateUnset(a,m),t=!0);for(m in n)n.hasOwnProperty(m)&&m!==o&&(this._updateOverwrite(a,m,n[m]),t=!0);return t}for(s in b)if(b.hasOwnProperty(s)){if(g=!1,!g&&"$"===s.substr(0,1))switch(s){case"$key":case"$index":case"$data":case"$min":case"$max":g=!0;break;case"$each":for(g=!0,k=b.$each.length,j=0;j<k;j++)u=this.updateObject(a,b.$each[j],c,d,e),u&&(t=!0);t=t||u;break;case"$replace":g=!0,n=b.$replace,o=this.primaryKey();for(m in a)a.hasOwnProperty(m)&&m!==o&&void 0===n[m]&&(this._updateUnset(a,m),t=!0);for(m in n)n.hasOwnProperty(m)&&m!==o&&(this._updateOverwrite(a,m,n[m]),t=!0);break;default:g=!0,u=this.updateObject(a,b[s],c,d,e,s),t=t||u}if(!g&&this._isPositionalKey(s)&&(g=!0,s=s.substr(0,s.length-2),p=new h(e+"."+s),a[s]&&a[s]instanceof Array&&a[s].length)){for(i=[],j=0;j<a[s].length;j++)this._match(a[s][j],p.value(c)[0],d,"",{})&&i.push(j);for(j=0;j<i.length;j++)u=this.updateObject(a[s][i[j]],b[s+".$"],c,d,e+"."+s,f),t=t||u}if(!g)if(f||"object"!=typeof b[s])switch(f){case"$inc":var v=!0;b[s]>0?b.$max&&a[s]>=b.$max&&(v=!1):b[s]<0&&b.$min&&a[s]<=b.$min&&(v=!1),v&&(this._updateIncrement(a,s,b[s]),t=!0);break;case"$cast":switch(b[s]){case"array":a[s]instanceof Array||(this._updateProperty(a,s,b.$data||[]),t=!0);break;case"object":a[s]instanceof Object&&!(a[s]instanceof Array)||(this._updateProperty(a,s,b.$data||{}),t=!0);break;case"number":"number"!=typeof a[s]&&(this._updateProperty(a,s,Number(a[s])),t=!0);break;case"string":"string"!=typeof a[s]&&(this._updateProperty(a,s,String(a[s])),t=!0);break;default:throw this.logIdentifier()+" Cannot update cast to unknown type: "+b[s]}break;case"$push":if(void 0===a[s]&&this._updateProperty(a,s,[]),!(a[s]instanceof Array))throw this.logIdentifier()+" Cannot push to a key that is not an array! ("+s+")";if(void 0!==b[s].$position&&b[s].$each instanceof Array)for(l=b[s].$position,k=b[s].$each.length,j=0;j<k;j++)this._updateSplicePush(a[s],l+j,b[s].$each[j]);else if(b[s].$each instanceof Array)for(k=b[s].$each.length,j=0;j<k;j++)this._updatePush(a[s],b[s].$each[j]);else this._updatePush(a[s],b[s]);t=!0;break;case"$pull":if(a[s]instanceof Array){for(i=[],j=0;j<a[s].length;j++)this._match(a[s][j],b[s],d,"",{})&&i.push(j);for(k=i.length;k--;)this._updatePull(a[s],i[k]),t=!0}break;case"$pullAll":if(a[s]instanceof Array){if(!(b[s]instanceof Array))throw this.logIdentifier()+" Cannot pullAll without being given an array of values to pull! ("+s+")";if(i=a[s],k=i.length,k>0)for(;k--;){for(l=0;l<b[s].length;l++)i[k]===b[s][l]&&(this._updatePull(a[s],k),k--,t=!0);if(k<0)break}}break;case"$addToSet":if(void 0===a[s]&&this._updateProperty(a,s,[]),!(a[s]instanceof Array))throw this.logIdentifier()+" Cannot addToSet on a key that is not an array! ("+s+")";var w,x,y,z,A=a[s],B=A.length,C=!0,D=d&&d.$addToSet;for(b[s].$key?(y=!1,z=new h(b[s].$key),x=z.value(b[s])[0],delete b[s].$key):D&&D.key?(y=!1,z=new h(D.key),x=z.value(b[s])[0]):(x=this.jStringify(b[s]),y=!0),w=0;w<B;w++)if(y){if(this.jStringify(A[w])===x){C=!1;break}}else if(x===z.value(A[w])[0]){C=!1;break}C&&(this._updatePush(a[s],b[s]),t=!0);break;case"$splicePush":if(void 0===a[s]&&this._updateProperty(a,s,[]),!(a[s]instanceof Array))throw this.logIdentifier()+" Cannot splicePush with a key that is not an array! ("+s+")";if(l=b.$index,void 0===l)throw this.logIdentifier()+" Cannot splicePush without a $index integer value!";delete b.$index,l>a[s].length&&(l=a[s].length),this._updateSplicePush(a[s],l,b[s]),t=!0;break;case"$splicePull":if(void 0!==a[s]){if(!(a[s]instanceof Array))throw this.logIdentifier()+" Cannot splicePull from a key that is not an array! ("+s+")";if(l=b[s].$index,void 0===l)throw this.logIdentifier()+" Cannot splicePull without a $index integer value!";l<a[s].length&&(this._updateSplicePull(a[s],l),t=!0)}break;case"$move":if(!(a[s]instanceof Array))throw this.logIdentifier()+" Cannot move on a key that is not an array! ("+s+")";for(j=0;j<a[s].length;j++)if(this._match(a[s][j],b[s],d,"",{})){var E=b.$index;if(void 0===E)throw this.logIdentifier()+" Cannot move without a $index integer value!";delete b.$index,this._updateSpliceMove(a[s],j,E),t=!0;break}break;case"$mul":this._updateMultiply(a,s,b[s]),t=!0;break;case"$rename":this._updateRename(a,s,b[s]),t=!0;break;case"$overwrite":this._updateOverwrite(a,s,b[s]),t=!0;break;case"$unset":this._updateUnset(a,s),t=!0;break;case"$clear":this._updateClear(a,s),t=!0;break;case"$pop":if(!(a[s]instanceof Array))throw this.logIdentifier()+" Cannot pop from a key that is not an array! ("+s+")";this._updatePop(a[s],b[s])&&(t=!0);break;case"$toggle":this._updateProperty(a,s,!a[s]),t=!0;break;default:a[s]!==b[s]&&(this._updateProperty(a,s,b[s]),t=!0)}else if(null!==a[s]&&"object"==typeof a[s])if(q=a[s]instanceof Array,r=b[s]instanceof Array,q||r)if(!r&&q)for(j=0;j<a[s].length;j++)u=this.updateObject(a[s][j],b[s],c,d,e+"."+s,f),t=t||u;else a[s]!==b[s]&&(this._updateProperty(a,s,b[s]),t=!0);else u=this.updateObject(a[s],b[s],c,d,e+"."+s,f),t=t||u;else a[s]!==b[s]&&(this._updateProperty(a,s,b[s]),t=!0)}return t},p.prototype._isPositionalKey=function(a){return".$"===a.substr(a.length-2,2)},p.prototype.remove=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";var d,e,f,g,h,i,j,k,l=this;if("function"==typeof b&&(c=b,b={}),this.mongoEmulation()&&this.convertToFdb(a),a instanceof Array){for(g=[],f=0;f<a.length;f++)g.push(this.remove(a[f],{noEmit:!0}));return(!b||b&&!b.noEmit)&&this._onRemove(g),c&&c.call(this,!1,g),g}if(g=[],d=this.find(a,{$decouple:!1}),d.length){h=function(a){l._removeFromIndexes(a),e=l._data.indexOf(a),l._dataRemoveAtIndex(e),g.push(a)};for(var m=0;m<d.length;m++)j=d[m],l.willTrigger(l.TYPE_REMOVE,l.PHASE_BEFORE)||l.willTrigger(l.TYPE_REMOVE,l.PHASE_AFTER)?(i={type:"remove"},k=l.decouple(j),l.processTrigger(i,l.TYPE_REMOVE,l.PHASE_BEFORE,k,k)!==!1&&(h(j),l.processTrigger(i,l.TYPE_REMOVE,l.PHASE_AFTER,k,k))):h(j);g.length&&(l.chainSend("remove",{query:a,dataSet:g},b),(!b||b&&!b.noEmit)&&this._onRemove(g),this._onChange(),this.emit("immediateChange",{type:"remove",data:g}),this.deferEmit("change",{type:"remove",data:g}))}return c&&c.call(this,!1,g),g},p.prototype.removeById=function(a){var b={};return b[this._primaryKey]=a,this.remove(b)[0]},p.prototype.processQueue=function(a,b,c){var d,e,f=this,g=this._deferQueue[a],h=this._deferThreshold[a],i=this._deferTime[a];if(c=c||{deferred:!0},g.length){switch(d=g.length>h?g.splice(0,h):g.splice(0,g.length),e=f[a](d),a){case"insert":c.inserted=c.inserted||[],c.failed=c.failed||[],c.inserted=c.inserted.concat(e.inserted),c.failed=c.failed.concat(e.failed)}setTimeout(function(){f.processQueue.call(f,a,b,c)},i)}else b&&b.call(this,c),this._asyncComplete(a);this.isProcessingQueue()||this.deferEmit("queuesComplete")},p.prototype.isProcessingQueue=function(){var a;for(a in this._deferQueue)if(this._deferQueue.hasOwnProperty(a)&&this._deferQueue[a].length)return!0;return!1},p.prototype.insert=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";return"function"==typeof b?(c=b,b=this._data.length):void 0===b&&(b=this._data.length),a=this.transformIn(a),this._insertHandle(a,b,c)},p.prototype._insertHandle=function(a,b,c){var d,e,f,g=this._deferQueue.insert,h=this._deferThreshold.insert,i=[],j=[];if(a instanceof Array){if(this._deferredCalls&&a.length>h)return this._deferQueue.insert=g.concat(a),this._asyncPending("insert"),void this.processQueue("insert",c);for(f=0;f<a.length;f++)d=this._insert(a[f],b+f),d===!0?i.push(a[f]):j.push({doc:a[f],reason:d})}else d=this._insert(a,b),d===!0?i.push(a):j.push({doc:a,reason:d});return e={deferred:!1,inserted:i,failed:j},this._onInsert(i,j),c&&c.call(this,e),this._onChange(),this.emit("immediateChange",{type:"insert",data:i,failed:j}),this.deferEmit("change",{type:"insert",data:i,failed:j}),e},p.prototype._insert=function(a,b){if(a){var c,d,e,f,g=this,h=this.capped(),i=this.cappedSize();if(this.ensurePrimaryKey(a),c=this.insertIndexViolation(a),e=function(a){g._insertIntoIndexes(a),b>g._data.length&&(b=g._data.length),g._dataInsertAtIndex(b,a),h&&g._data.length>i&&g.removeById(g._data[0][g._primaryKey]),g.chainWillSend()&&g.chainSend("insert",{dataSet:g.decouple([a])},{index:b})},c)return"Index violation in index: "+c;if(g.willTrigger(g.TYPE_INSERT,g.PHASE_BEFORE)||g.willTrigger(g.TYPE_INSERT,g.PHASE_AFTER)){if(d={type:"insert"},g.processTrigger(d,g.TYPE_INSERT,g.PHASE_BEFORE,{},a)===!1)return"Trigger cancelled operation";e(a),g.willTrigger(g.TYPE_INSERT,g.PHASE_AFTER)&&(f=g.decouple(a),g.processTrigger(d,g.TYPE_INSERT,g.PHASE_AFTER,{},f))}else e(a);return!0}return"No document passed to insert"},p.prototype._dataInsertAtIndex=function(a,b){this._data.splice(a,0,b)},p.prototype._dataRemoveAtIndex=function(a){this._data.splice(a,1)},p.prototype._dataReplace=function(a){for(;this._data.length;)this._data.pop();this._data=this._data.concat(a)},p.prototype._insertIntoIndexes=function(a){var b,c,d=this._indexByName,e=this.hash(a),f=this._primaryKey;c=this._primaryIndex.uniqueSet(a[f],a),this._primaryCrc.uniqueSet(a[f],e),this._crcLookup.uniqueSet(e,a);for(b in d)d.hasOwnProperty(b)&&d[b].insert(a);return c},p.prototype._removeFromIndexes=function(a){var b,c=this._indexByName,d=this.hash(a),e=this._primaryKey;this._primaryIndex.unSet(a[e]),this._primaryCrc.unSet(a[e]),this._crcLookup.unSet(d);for(b in c)c.hasOwnProperty(b)&&c[b].remove(a)},p.prototype._updateIndexes=function(a,b){this._removeFromIndexes(a),this._insertIntoIndexes(b)},p.prototype._rebuildIndexes=function(){var a,b=this._indexByName;for(a in b)b.hasOwnProperty(a)&&b[a].rebuild()},p.prototype.subset=function(a,b){var c,d=this.find(a,b);return c=new p,c.db(this._db),c.subsetOf(this).primaryKey(this._primaryKey).setData(d),c},d.synthesize(p.prototype,"subsetOf"),p.prototype.isSubsetOf=function(a){return this._subsetOf===a},p.prototype.distinct=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";var d,e,f=this.find(b,c),g=new h(a),i={},j=[];for(e=0;e<f.length;e++)d=g.value(f[e])[0],d&&!i[d]&&(i[d]=!0,j.push(d));return j},p.prototype.findById=function(a,b){var c={};return c[this._primaryKey]=a,this.find(c,b)[0]},p.prototype.peek=function(a,b){var c,d,e=this._data,f=e.length,g=new p,h=typeof a;if("string"===h){for(c=0;c<f;c++)d=this.jStringify(e[c]),d.indexOf(a)>-1&&g.insert(e[c]);return g.find({},b)}return this.find(a,b)},p.prototype.explain=function(a,b){var c=this.find(a,b);return c.__fdbOp._data},p.prototype.options=function(a){return a=a||{},a.$decouple=void 0===a.$decouple||a.$decouple,a.$explain=void 0!==a.$explain&&a.$explain,a},p.prototype.find=function(a,b,c){return this.mongoEmulation()&&this.convertToFdb(a),c?(c.call(this,"Callbacks for the find() operation are not yet implemented!",[]),[]):this._find.call(this,a,b,c)},p.prototype._find=function(a,b){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";a=a||{};var c,d,e,f,g,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x=this._metrics.create("find"),y=this.primaryKey(),z=this,A=!0,B={},C=[],D=[],E=[],F={},G={};if(b instanceof Array||(b=this.options(b)),w=function(c){return z._match(c,a,b,"and",F)},x.start(),a){if(a instanceof Array){for(v=this,n=0;n<a.length;n++)v=v.subset(a[n],b&&b[n]?b[n]:{});return v.find()}if(a.$findSub){if(!a.$findSub.$path)throw"$findSub missing $path property!";return this.findSub(a.$findSub.$query,a.$findSub.$path,a.$findSub.$subQuery,a.$findSub.$subOptions)}if(a.$findSubOne){if(!a.$findSubOne.$path)throw"$findSubOne missing $path property!";return this.findSubOne(a.$findSubOne.$query,a.$findSubOne.$path,a.$findSubOne.$subQuery,a.$findSubOne.$subOptions)}if(x.time("analyseQuery"),c=this._analyseQuery(z.decouple(a),b,x),x.time("analyseQuery"),x.data("analysis",c),c.hasJoin&&c.queriesJoin){for(x.time("joinReferences"),f=0;f<c.joinsOn.length;f++)m=c.joinsOn[f],j=m.key,k=m.type,l=m.id,i=new h(c.joinQueries[j]),g=i.value(a)[0],B[l]=this._db[k](j).subset(g),delete a[c.joinQueries[j]];x.time("joinReferences")}if(c.indexMatch.length&&(!b||b&&!b.$skipIndex)?(x.data("index.potential",c.indexMatch),x.data("index.used",c.indexMatch[0].index),x.time("indexLookup"),e=[].concat(c.indexMatch[0].lookup)||[],x.time("indexLookup"),c.indexMatch[0].keyData.totalKeyCount===c.indexMatch[0].keyData.score&&(A=!1)):x.flag("usedIndex",!1),A&&(e&&e.length?(d=e.length,x.time("tableScan: "+d),e=e.filter(w)):(d=this._data.length,x.time("tableScan: "+d),e=this._data.filter(w)),x.time("tableScan: "+d)),b.$orderBy&&(x.time("sort"),e=this.sort(b.$orderBy,e),x.time("sort")),void 0!==b.$page&&void 0!==b.$limit&&(G.page=b.$page,G.pages=Math.ceil(e.length/b.$limit),G.records=e.length,b.$page&&b.$limit>0&&(x.data("cursor",G),e.splice(0,b.$page*b.$limit))),b.$skip&&(G.skip=b.$skip,e.splice(0,b.$skip),x.data("skip",b.$skip)),b.$limit&&e&&e.length>b.$limit&&(G.limit=b.$limit,e.length=b.$limit,x.data("limit",b.$limit)),b.$decouple&&(x.time("decouple"),e=this.decouple(e),x.time("decouple"),x.data("flag.decouple",!0)),b.$join&&(C=C.concat(this.applyJoin(e,b.$join,B)),x.data("flag.join",!0)),C.length&&(x.time("removalQueue"),this.spliceArrayByIndexList(e,C),x.time("removalQueue")),b.$transform){for(x.time("transform"),n=0;n<e.length;n++)e.splice(n,1,b.$transform(e[n]));x.time("transform"),x.data("flag.transform",!0)}this._transformEnabled&&this._transformOut&&(x.time("transformOut"),e=this.transformOut(e),x.time("transformOut")),x.data("results",e.length)}else e=[];if(!b.$aggregate){x.time("scanFields");for(n in b)b.hasOwnProperty(n)&&0!==n.indexOf("$")&&(1===b[n]?D.push(n):0===b[n]&&E.push(n));if(x.time("scanFields"),D.length||E.length){for(x.data("flag.limitFields",!0),x.data("limitFields.on",D),x.data("limitFields.off",E),x.time("limitFields"),n=0;n<e.length;n++){t=e[n];for(o in t)t.hasOwnProperty(o)&&(D.length&&o!==y&&D.indexOf(o)===-1&&delete t[o],E.length&&E.indexOf(o)>-1&&delete t[o])}x.time("limitFields")}if(b.$elemMatch){x.data("flag.elemMatch",!0),x.time("projection-elemMatch");for(n in b.$elemMatch)if(b.$elemMatch.hasOwnProperty(n))for(q=new h(n),o=0;o<e.length;o++)if(r=q.value(e[o])[0],r&&r.length)for(p=0;p<r.length;p++)if(z._match(r[p],b.$elemMatch[n],b,"",{})){q.set(e[o],n,[r[p]]);break}x.time("projection-elemMatch")}if(b.$elemsMatch){x.data("flag.elemsMatch",!0),x.time("projection-elemsMatch");for(n in b.$elemsMatch)if(b.$elemsMatch.hasOwnProperty(n))for(q=new h(n),o=0;o<e.length;o++)if(r=q.value(e[o])[0],r&&r.length){for(s=[],p=0;p<r.length;p++)z._match(r[p],b.$elemsMatch[n],b,"",{})&&s.push(r[p]);q.set(e[o],n,s)}x.time("projection-elemsMatch")}}return b.$aggregate&&(x.data("flag.aggregate",!0),x.time("aggregate"),u=new h(b.$aggregate),e=u.value(e),x.time("aggregate")),b.$groupBy&&(x.data("flag.group",!0),x.time("group"),e=this.group(b.$groupBy,e),x.time("group")),x.stop(),e.__fdbOp=x,e.$cursor=G,e},p.prototype.findOne=function(){return this.find.apply(this,arguments)[0]},p.prototype.indexOf=function(a,b){var c,d=this.find(a,{$decouple:!1})[0];return d?!b||b&&!b.$orderBy?this._data.indexOf(d):(b.$decouple=!1,c=this.find(a,b),c.indexOf(d)):-1},p.prototype.indexOfDocById=function(a,b){var c,d;return c="object"!=typeof a?this._primaryIndex.get(a):this._primaryIndex.get(a[this._primaryKey]),c?!b||b&&!b.$orderBy?this._data.indexOf(c):(b.$decouple=!1,d=this.find({},b),d.indexOf(c)):-1},p.prototype.removeByIndex=function(a){var b,c;return b=this._data[a],void 0!==b&&(b=this.decouple(b),c=b[this.primaryKey()],this.removeById(c))},p.prototype.transform=function(a){return void 0!==a?("object"==typeof a?(void 0!==a.enabled&&(this._transformEnabled=a.enabled),void 0!==a.dataIn&&(this._transformIn=a.dataIn),void 0!==a.dataOut&&(this._transformOut=a.dataOut)):this._transformEnabled=a!==!1,this):{enabled:this._transformEnabled,dataIn:this._transformIn,dataOut:this._transformOut}},p.prototype.transformIn=function(a){if(this._transformEnabled&&this._transformIn){if(a instanceof Array){var b,c,d=[];for(c=0;c<a.length;c++)b=this._transformIn(a[c]),b instanceof Array?d=d.concat(b):d.push(b);return d}return this._transformIn(a)}return a},p.prototype.transformOut=function(a){if(this._transformEnabled&&this._transformOut){if(a instanceof Array){var b,c,d=[];for(c=0;c<a.length;c++)b=this._transformOut(a[c]),b instanceof Array?d=d.concat(b):d.push(b);return d}return this._transformOut(a)}return a},p.prototype.sort=function(a,b){var c=this,d=o.parse(a,!0);return d.length&&b.sort(function(a,b){var e,f,g=0;for(e=0;e<d.length;e++)if(f=d[e],1===f.value?g=c.sortAsc(o.get(a,f.path),o.get(b,f.path)):f.value===-1&&(g=c.sortDesc(o.get(a,f.path),o.get(b,f.path))),0!==g)return g;return g}),b},p.prototype.group=function(a,b){var c,d,e,f=o.parse(a,!0),g=new h,i={};if(f.length)for(d=0;d<f.length;d++)for(g.path(f[d].path),
e=0;e<b.length;e++)c=g.get(b[e]),i[c]=i[c]||[],i[c].push(b[e]);return i},p.prototype._sort=function(a,b){var c,d=this,e=new h,f=e.parse(a,!0)[0];if(e.path(f.path),1===f.value)c=function(a,b){var c=e.value(a)[0],f=e.value(b)[0];return d.sortAsc(c,f)};else{if(f.value!==-1)throw this.logIdentifier()+" $orderBy clause has invalid direction: "+f.value+", accepted values are 1 or -1 for ascending or descending!";c=function(a,b){var c=e.value(a)[0],f=e.value(b)[0];return d.sortDesc(c,f)}}return b.sort(c)},p.prototype._analyseQuery=function(a,b,c){var d,e,f,g,i,j,k,l,m,n,o,p,q,r,s,t,u={queriesOn:[{id:"$collection."+this._name,type:"colletion",key:this._name}],indexMatch:[],hasJoin:!1,queriesJoin:!1,joinQueries:{},query:a,options:b},v=[],w=[];if(c.time("checkIndexes"),p=new h,q=p.parseArr(a,{ignore:/\$/,verbose:!0}).length){void 0!==a[this._primaryKey]&&(r=typeof a[this._primaryKey],("string"===r||"number"===r||a[this._primaryKey]instanceof Array)&&(c.time("checkIndexMatch: Primary Key"),s=[].concat(this._primaryIndex.lookup(a,b,c)),u.indexMatch.push({lookup:s,keyData:{matchedKeys:[this._primaryKey],totalKeyCount:q,score:1},index:this._primaryIndex}),c.time("checkIndexMatch: Primary Key")));for(t in this._indexById)if(this._indexById.hasOwnProperty(t)&&(m=this._indexById[t],n=m.name(),c.time("checkIndexMatch: "+n),l=m.match(a,b),l.score>0&&(o=[].concat(m.lookup(a,b,c)),u.indexMatch.push({lookup:o,keyData:l,index:m})),c.time("checkIndexMatch: "+n),l.score===q))break;c.time("checkIndexes"),u.indexMatch.length>1&&(c.time("findOptimalIndex"),u.indexMatch.sort(function(a,b){return a.keyData.score>b.keyData.score?-1:a.keyData.score<b.keyData.score?1:a.keyData.score===b.keyData.score?a.lookup.length-b.lookup.length:void 0}),c.time("findOptimalIndex"))}if(b.$join){for(u.hasJoin=!0,d=0;d<b.$join.length;d++)for(e in b.$join[d])b.$join[d].hasOwnProperty(e)&&(i=b.$join[d][e],f=i.$sourceType||"collection",g="$"+f+"."+e,v.push({id:g,type:f,key:e}),void 0!==b.$join[d][e].$as?w.push(b.$join[d][e].$as):w.push(e));for(k=0;k<w.length;k++)j=this._queryReferencesSource(a,w[k],""),j&&(u.joinQueries[v[k].key]=j,u.queriesJoin=!0);u.joinsOn=v,u.queriesOn=u.queriesOn.concat(v)}return u},p.prototype._queryReferencesSource=function(a,b,c){var d;for(d in a)if(a.hasOwnProperty(d)){if(d===b)return c&&(c+="."),c+d;if("object"==typeof a[d])return c&&(c+="."),c+=d,this._queryReferencesSource(a[d],b,c)}return!1},p.prototype.count=function(a,b){return a?this.find(a,b).length:this._data.length},p.prototype.findSub=function(a,b,c,d){return this._findSub(this.find(a),b,c,d)},p.prototype._findSub=function(a,b,c,d){var e,f,g,i=new h(b),j=a.length,k=new p("__FDB_temp_"+this.objectId()).db(this._db),l={parents:j,subDocTotal:0,subDocs:[],pathFound:!1,err:""};for(d=d||{},e=0;e<j;e++)if(f=i.value(a[e])[0]){if(k.setData(f),g=k.find(c,d),d.returnFirst&&g.length)return g[0];d.$split?l.subDocs.push(g):l.subDocs=l.subDocs.concat(g),l.subDocTotal+=g.length,l.pathFound=!0}return k.drop(),l.pathFound||(l.err="No objects found in the parent documents with a matching path of: "+b),d.$stats?l:l.subDocs},p.prototype.findSubOne=function(a,b,c,d){return this.findSub(a,b,c,d)[0]},p.prototype.insertIndexViolation=function(a){var b,c,d,e=this._indexByName;if(this._primaryIndex.get(a[this._primaryKey]))b=this._primaryIndex;else for(c in e)if(e.hasOwnProperty(c)&&(d=e[c],d.unique()&&d.violation(a))){b=d;break}return!!b&&b.name()},p.prototype.ensureIndex=function(a,b){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";this._indexByName=this._indexByName||{},this._indexById=this._indexById||{};var c,e={start:(new Date).getTime()};if(b)if(b.type){if(!d.index[b.type])throw this.logIdentifier()+' Cannot create index of type "'+b.type+'", type not found in the index type register (Shared.index)';c=new d.index[b.type](a,b,this)}else c=new i(a,b,this);else c=new i(a,b,this);return this._indexByName[c.name()]?{err:"Index with that name already exists"}:(c.rebuild(),this._indexByName[c.name()]=c,this._indexById[c.id()]=c,e.end=(new Date).getTime(),e.total=e.end-e.start,this._lastOp={type:"ensureIndex",stats:{time:e}},{index:c,id:c.id(),name:c.name(),state:c.state()})},p.prototype.index=function(a){if(this._indexByName)return this._indexByName[a]},p.prototype.lastOp=function(){return this._metrics.list()},p.prototype.diff=function(a){var b,c,d,e,f={insert:[],update:[],remove:[]},g=this.primaryKey();if(g!==a.primaryKey())throw this.logIdentifier()+" Diffing requires that both collections have the same primary key!";for(b=a._data;b&&!(b instanceof Array);)a=b,b=a._data;for(e=b.length,c=0;c<e;c++)d=b[c],this._primaryIndex.get(d[g])?this._primaryCrc.get(d[g])!==a._primaryCrc.get(d[g])&&f.update.push(d):f.insert.push(d);for(b=this._data,e=b.length,c=0;c<e;c++)d=b[c],a._primaryIndex.get(d[g])||f.remove.push(d);return f},p.prototype.collateAdd=new l("Collection.prototype.collateAdd",{"object, string":function(a,b){var c=this;c.collateAdd(a,function(d){var e,f;switch(d.type){case"insert":b?(e={$push:{}},e.$push[b]=c.decouple(d.data.dataSet),c.update({},e)):c.insert(d.data.dataSet);break;case"update":b?(e={},f={},e[b]=d.data.query,f[b+".$"]=d.data.update,c.update(e,f)):c.update(d.data.query,d.data.update);break;case"remove":b?(e={$pull:{}},e.$pull[b]={},e.$pull[b][c.primaryKey()]=d.data.dataSet[0][a.primaryKey()],c.update({},e)):c.remove(d.data.dataSet)}})},"object, function":function(a,b){if("string"==typeof a&&(a=this._db.collection(a,{autoCreate:!1,throwError:!1})),a)return this._collate=this._collate||{},this._collate[a.name()]=new m(a,this,b),this;throw"Cannot collate from a non-existent collection!"}}),p.prototype.collateRemove=function(a){if("object"==typeof a&&(a=a.name()),a)return this._collate[a].drop(),delete this._collate[a],this;throw"No collection name passed to collateRemove() or collection not found!"},p.prototype.when=function(a){var b=this.objectId();return this._when=this._when||{},this._when[b]=this._when[b]||new n(this,b,a),this._when[b]},e.prototype.collection=new l("Db.prototype.collection",{"":function(){return this.$main.call(this,{name:this.objectId()})},object:function(a){return a instanceof p?"droppped"!==a.state()?a:this.$main.call(this,{name:a.name()}):this.$main.call(this,a)},string:function(a){return this.$main.call(this,{name:a})},"string, string":function(a,b){return this.$main.call(this,{name:a,primaryKey:b})},"string, object":function(a,b){return b.name=a,this.$main.call(this,b)},"string, string, object":function(a,b,c){return c.name=a,c.primaryKey=b,this.$main.call(this,c)},$main:function(a){var b=this,c=a.name;if(c){if(this._collection[c])return this._collection[c];if(a&&a.autoCreate===!1){if(a&&a.throwError!==!1)throw this.logIdentifier()+" Cannot get collection "+c+" because it does not exist and auto-create has been disabled!";return}if(this.debug()&&console.log(this.logIdentifier()+" Creating collection "+c),this._collection[c]=this._collection[c]||new p(c,a).db(this),this._collection[c].mongoEmulation(this.mongoEmulation()),void 0!==a.primaryKey&&this._collection[c].primaryKey(a.primaryKey),void 0!==a.capped){if(void 0===a.size)throw this.logIdentifier()+" Cannot create a capped collection without specifying a size!";this._collection[c].capped(a.capped),this._collection[c].cappedSize(a.size)}return b._collection[c].on("change",function(){b.emit("change",b._collection[c],"collection",c)}),b.deferEmit("create",b._collection[c],"collection",c),this._collection[c]}if(!a||a&&a.throwError!==!1)throw this.logIdentifier()+" Cannot get collection with undefined name!"}}),e.prototype.collectionExists=function(a){return Boolean(this._collection[a])},e.prototype.collections=function(a){var b,c,d=[],e=this._collection;a&&(a instanceof RegExp||(a=new RegExp(a)));for(c in e)e.hasOwnProperty(c)&&(b=e[c],a?a.exec(c)&&d.push({name:c,count:b.count(),linked:void 0!==b.isLinked&&b.isLinked()}):d.push({name:c,count:b.count(),linked:void 0!==b.isLinked&&b.isLinked()}));return d.sort(function(a,b){return a.name.localeCompare(b.name)}),d},d.finishModule("Collection"),b.exports=p},{"./Condition":7,"./Index2d":11,"./IndexBinaryTree":12,"./IndexHashMap":13,"./KeyValueStore":14,"./Metrics":15,"./Overload":27,"./Path":28,"./ReactorIO":32,"./Shared":34}],6:[function(a,b,c){"use strict";var d,e,f,g;d=a("./Shared");var h=function(){this.init.apply(this,arguments)};h.prototype.init=function(a){var b=this;b._name=a,b._data=new g("__FDB__cg_data_"+b._name),b._collections=[],b._view=[]},d.addModule("CollectionGroup",h),d.mixin(h.prototype,"Mixin.Common"),d.mixin(h.prototype,"Mixin.ChainReactor"),d.mixin(h.prototype,"Mixin.Constants"),d.mixin(h.prototype,"Mixin.Triggers"),d.mixin(h.prototype,"Mixin.Tags"),d.mixin(h.prototype,"Mixin.Events"),g=a("./Collection"),e=d.modules.Db,f=d.modules.Db.prototype.init,h.prototype.on=function(){this._data.on.apply(this._data,arguments)},h.prototype.off=function(){this._data.off.apply(this._data,arguments)},h.prototype.emit=function(){this._data.emit.apply(this._data,arguments)},h.prototype.primaryKey=function(a){return void 0!==a?(this._primaryKey=a,this):this._primaryKey},d.synthesize(h.prototype,"state"),d.synthesize(h.prototype,"db"),d.synthesize(h.prototype,"name"),h.prototype.addCollection=function(a){if(a&&this._collections.indexOf(a)===-1){if(this._collections.length){if(this._primaryKey!==a.primaryKey())throw this.logIdentifier()+" All collections in a collection group must have the same primary key!"}else this.primaryKey(a.primaryKey());this._collections.push(a),a._groups=a._groups||[],a._groups.push(this),a.chain(this),a.on("drop",function(){if(a._groups&&a._groups.length){var b,c=[];for(b=0;b<a._groups.length;b++)c.push(a._groups[b]);for(b=0;b<c.length;b++)a._groups[b].removeCollection(a)}delete a._groups}),this._data.insert(a.find())}return this},h.prototype.removeCollection=function(a){if(a){var b,c=this._collections.indexOf(a);c!==-1&&(a.unChain(this),this._collections.splice(c,1),a._groups=a._groups||[],b=a._groups.indexOf(this),b!==-1&&a._groups.splice(b,1),a.off("drop")),0===this._collections.length&&delete this._primaryKey}return this},h.prototype._chainHandler=function(a){switch(a.type){case"setData":a.data.dataSet=this.decouple(a.data.dataSet),this._data.remove(a.data.oldData),this._data.insert(a.data.dataSet);break;case"insert":a.data.dataSet=this.decouple(a.data.dataSet),this._data.insert(a.data.dataSet);break;case"update":this._data.update(a.data.query,a.data.update,a.options);break;case"remove":this._data.remove(a.data.query,a.options)}},h.prototype.insert=function(){this._collectionsRun("insert",arguments)},h.prototype.update=function(){this._collectionsRun("update",arguments)},h.prototype.updateById=function(){this._collectionsRun("updateById",arguments)},h.prototype.remove=function(){this._collectionsRun("remove",arguments)},h.prototype._collectionsRun=function(a,b){for(var c=0;c<this._collections.length;c++)this._collections[c][a].apply(this._collections[c],b)},h.prototype.find=function(a,b){return this._data.find(a,b)},h.prototype.removeById=function(a){for(var b=0;b<this._collections.length;b++)this._collections[b].removeById(a)},h.prototype.subset=function(a,b){var c=this.find(a,b);return(new g).subsetOf(this).primaryKey(this._primaryKey).setData(c)},h.prototype.drop=function(a){if(!this.isDropped()){var b,c,d;if(this._debug&&console.log(this.logIdentifier()+" Dropping"),this._state="dropped",this._collections&&this._collections.length)for(c=[].concat(this._collections),b=0;b<c.length;b++)this.removeCollection(c[b]);if(this._view&&this._view.length)for(d=[].concat(this._view),b=0;b<d.length;b++)this._removeView(d[b]);this.emit("drop",this),delete this._listeners,a&&a(!1,!0)}return!0},e.prototype.init=function(){this._collectionGroup={},f.apply(this,arguments)},e.prototype.collectionGroup=function(a){var b=this;return a?a instanceof h?a:this._collectionGroup&&this._collectionGroup[a]?this._collectionGroup[a]:(this._collectionGroup[a]=new h(a).db(this),b.deferEmit("create",b._collectionGroup[a],"collectionGroup",a),this._collectionGroup[a]):this._collectionGroup},e.prototype.collectionGroups=function(){var a,b=[];for(a in this._collectionGroup)this._collectionGroup.hasOwnProperty(a)&&b.push({name:a});return b},b.exports=h},{"./Collection":5,"./Shared":34}],7:[function(a,b,c){"use strict";var d,e;d=a("./Shared"),e=function(){this.init.apply(this,arguments)},e.prototype.init=function(a,b,c){this._dataSource=a,this._id=b,this._query=[c],this._started=!1,this._state=[!1],this._satisfied=!1,this.earlyExit(!0)},d.addModule("Condition",e),d.mixin(e.prototype,"Mixin.Common"),d.mixin(e.prototype,"Mixin.ChainReactor"),d.synthesize(e.prototype,"id"),d.synthesize(e.prototype,"then"),d.synthesize(e.prototype,"else"),d.synthesize(e.prototype,"earlyExit"),d.synthesize(e.prototype,"debug"),e.prototype.and=function(a){return this._query.push(a),this._state.push(!1),this},e.prototype.start=function(a){if(!this._started){var b=this;0!==arguments.length&&(this._satisfied=a),this._updateStates(),b._onChange=function(){b._updateStates()},this._dataSource.on("change",b._onChange),this._started=!0}return this},e.prototype._updateStates=function(){var a,b=!0;for(a=0;a<this._query.length&&(this._state[a]=this._dataSource.count(this._query[a])>0,this._debug&&console.log(this.logIdentifier()+" Evaluating",this._query[a],"=",this._query[a]),this._state[a]||(b=!1,!this._earlyExit));a++);this._satisfied!==b&&(b?this._then&&this._then():this._else&&this._else(),this._satisfied=b)},e.prototype.stop=function(){return this._started&&(this._dataSource.off("change",this._onChange),delete this._onChange,this._started=!1),this},e.prototype.drop=function(){return this.stop(),delete this._dataSource.when[this._id],this},d.finishModule("Condition"),b.exports=e},{"./Shared":34}],8:[function(a,b,c){"use strict";var d,e,f,g,h=[];d=a("./Shared"),g=a("./Overload");var i=function(a){this.init.apply(this,arguments)};i.prototype.init=function(a){this._db={},this._debug={},this._name=a||"ForerunnerDB",h.push(this)},i.prototype.instantiatedCount=function(){return h.length},i.prototype.instances=function(a){return void 0!==a?h[a]:h},i.prototype.namedInstances=function(a){var b,c;{if(void 0===a){for(c=[],b=0;b<h.length;b++)c.push(h[b].name);return c}for(b=0;b<h.length;b++)if(h[b].name===a)return h[b]}},i.prototype.moduleLoaded=new g({string:function(a){if(void 0!==a){a=a.replace(/ /g,"");var b,c=a.split(",");for(b=0;b<c.length;b++)if(!d.modules[c[b]])return!1;return!0}return!1},"string, function":function(a,b){if(void 0!==a){a=a.replace(/ /g,"");var c,e=a.split(",");for(c=0;c<e.length;c++)if(!d.modules[e[c]])return!1;b&&b()}},"array, function":function(a,b){var c,e;for(e=0;e<a.length;e++)if(c=a[e],void 0!==c){c=c.replace(/ /g,"");var f,g=c.split(",");for(f=0;f<g.length;f++)if(!d.modules[g[f]])return!1}b&&b()},"string, function, function":function(a,b,c){if(void 0!==a){a=a.replace(/ /g,"");var e,f=a.split(",");for(e=0;e<f.length;e++)if(!d.modules[f[e]])return c(),!1;b()}}}),i.prototype.version=function(a,b){return void 0!==a?0===d.version.indexOf(a)&&(b&&b(),!0):d.version},i.moduleLoaded=i.prototype.moduleLoaded,i.version=i.prototype.version,i.instances=i.prototype.instances,i.instantiatedCount=i.prototype.instantiatedCount,i.shared=d,i.prototype.shared=d,d.addModule("Core",i),d.mixin(i.prototype,"Mixin.Common"),d.mixin(i.prototype,"Mixin.Constants"),e=a("./Db.js"),f=a("./Metrics.js"),d.synthesize(i.prototype,"name"),d.synthesize(i.prototype,"mongoEmulation"),i.prototype._isServer=!1,i.prototype.isClient=function(){return!this._isServer},i.prototype.isServer=function(){return this._isServer},i.prototype.collection=function(){throw"ForerunnerDB's instantiation has changed since version 1.3.36 to support multiple database instances. Please see the readme.md file for the minor change you have to make to get your project back up and running, or see the issue related to this change at https://github.com/Irrelon/ForerunnerDB/issues/44"},b.exports=i},{"./Db.js":9,"./Metrics.js":15,"./Overload":27,"./Shared":34}],9:[function(a,b,c){"use strict";var d,e,f,g,h,i;d=a("./Shared"),i=a("./Overload");var j=function(a,b){this.init.apply(this,arguments)};j.prototype.init=function(a,b){this.core(b),this._primaryKey="_id",this._name=a,this._collection={},this._debug={}},d.addModule("Db",j),j.prototype.moduleLoaded=new i({string:function(a){if(void 0!==a){a=a.replace(/ /g,"");var b,c=a.split(",");for(b=0;b<c.length;b++)if(!d.modules[c[b]])return!1;return!0}return!1},"string, function":function(a,b){if(void 0!==a){a=a.replace(/ /g,"");var c,e=a.split(",");for(c=0;c<e.length;c++)if(!d.modules[e[c]])return!1;b&&b()}},"string, function, function":function(a,b,c){if(void 0!==a){a=a.replace(/ /g,"");var e,f=a.split(",");for(e=0;e<f.length;e++)if(!d.modules[f[e]])return c(),!1;b()}}}),j.prototype.version=function(a,b){return void 0!==a?0===d.version.indexOf(a)&&(b&&b(),!0):d.version},j.moduleLoaded=j.prototype.moduleLoaded,j.version=j.prototype.version,j.shared=d,j.prototype.shared=d,d.addModule("Db",j),d.mixin(j.prototype,"Mixin.Common"),d.mixin(j.prototype,"Mixin.ChainReactor"),d.mixin(j.prototype,"Mixin.Constants"),d.mixin(j.prototype,"Mixin.Tags"),d.mixin(j.prototype,"Mixin.Events"),e=d.modules.Core,f=a("./Collection.js"),g=a("./Metrics.js"),h=a("./Checksum.js"),j.prototype._isServer=!1,d.synthesize(j.prototype,"core"),d.synthesize(j.prototype,"primaryKey"),d.synthesize(j.prototype,"state"),d.synthesize(j.prototype,"name"),d.synthesize(j.prototype,"mongoEmulation"),j.prototype.isClient=function(){return!this._isServer},j.prototype.isServer=function(){return this._isServer},j.prototype.Checksum=h,j.prototype.isClient=function(){return!this._isServer},j.prototype.isServer=function(){return this._isServer},j.prototype.arrayToCollection=function(a){return(new f).setData(a)},j.prototype.peek=function(a){var b,c,d=[],e=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],d="string"===e?d.concat(c.peek(a)):d.concat(c.find(a)));return d},j.prototype.peek=function(a){var b,c,d=[],e=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],d="string"===e?d.concat(c.peek(a)):d.concat(c.find(a)));return d},j.prototype.peekCat=function(a){var b,c,d,e={},f=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],"string"===f?(d=c.peek(a),d&&d.length&&(e[c.name()]=d)):(d=c.find(a),d&&d.length&&(e[c.name()]=d)));return e},j.prototype.drop=new i({"":function(){if(!this.isDropped()){var a,b=this.collections(),c=b.length;for(this._state="dropped",a=0;a<c;a++)this.collection(b[a].name).drop(),delete this._collection[b[a].name];this.emit("drop",this),delete this._listeners,delete this._core._db[this._name]}return!0},function:function(a){if(!this.isDropped()){var b,c=this.collections(),d=c.length,e=0,f=function(){e++,e===d&&a&&a()};for(this._state="dropped",b=0;b<d;b++)this.collection(c[b].name).drop(f),delete this._collection[c[b].name];this.emit("drop",this),delete this._listeners,delete this._core._db[this._name]}return!0},boolean:function(a){if(!this.isDropped()){var b,c=this.collections(),d=c.length;for(this._state="dropped",b=0;b<d;b++)this.collection(c[b].name).drop(a),delete this._collection[c[b].name];this.emit("drop",this),delete this._listeners,delete this._core._db[this._name]}return!0},"boolean, function":function(a,b){if(!this.isDropped()){var c,d=this.collections(),e=d.length,f=0,g=function(){f++,f===e&&b&&b()};for(this._state="dropped",c=0;c<e;c++)this.collection(d[c].name).drop(a,g),delete this._collection[d[c].name];this.emit("drop",this),delete this._listeners,delete this._core._db[this._name]}return!0}}),e.prototype.db=function(a){return a instanceof j?a:(a||(a=this.objectId()),this._db[a]=this._db[a]||new j(a,this),this._db[a].mongoEmulation(this.mongoEmulation()),this._db[a])},e.prototype.databases=function(a){var b,c,d,e=[];a&&(a instanceof RegExp||(a=new RegExp(a)));for(d in this._db)this._db.hasOwnProperty(d)&&(c=!0,a&&(a.exec(d)||(c=!1)),c&&(b={name:d,children:[]},this.shared.moduleExists("Collection")&&b.children.push({module:"collection",moduleName:"Collections",count:this._db[d].collections().length}),this.shared.moduleExists("CollectionGroup")&&b.children.push({module:"collectionGroup",moduleName:"Collection Groups",count:this._db[d].collectionGroups().length}),this.shared.moduleExists("Document")&&b.children.push({module:"document",moduleName:"Documents",count:this._db[d].documents().length}),this.shared.moduleExists("Grid")&&b.children.push({module:"grid",moduleName:"Grids",count:this._db[d].grids().length}),this.shared.moduleExists("Overview")&&b.children.push({module:"overview",moduleName:"Overviews",count:this._db[d].overviews().length}),this.shared.moduleExists("View")&&b.children.push({module:"view",moduleName:"Views",count:this._db[d].views().length}),e.push(b)));return e.sort(function(a,b){return a.name.localeCompare(b.name)}),e},d.finishModule("Db"),b.exports=j},{"./Checksum.js":4,"./Collection.js":5,"./Metrics.js":15,"./Overload":27,"./Shared":34}],10:[function(a,b,c){"use strict";var d,e,f,g,h=Math.PI/180,i=180/Math.PI,j=6371;d=[16,8,4,2,1],e="0123456789bcdefghjkmnpqrstuvwxyz",f={right:{even:"bc01fg45238967deuvhjyznpkmstqrwx"},left:{even:"238967debc01fg45kmstqrwxuvhjyznp"},top:{even:"p0r21436x8zb9dcf5h7kjnmqesgutwvy"},bottom:{even:"14365h7k9dcfesgujnmqp0r2twvyx8zb"}},g={right:{even:"bcfguvyz"},left:{even:"0145hjnp"},top:{even:"prxz"},bottom:{even:"028b"}},f.bottom.odd=f.left.even,f.top.odd=f.right.even,f.left.odd=f.bottom.even,f.right.odd=f.top.even,g.bottom.odd=g.left.even,g.top.odd=g.right.even,g.left.odd=g.bottom.even,g.right.odd=g.top.even;var k=function(){};k.prototype.radians=function(a){return a*h},k.prototype.degrees=function(a){return a*i},k.prototype.refineInterval=function(a,b,c){b&c?a[0]=(a[0]+a[1])/2:a[1]=(a[0]+a[1])/2},k.prototype.calculateNeighbours=function(a,b){var c;return b&&"object"!==b.type?(c=[],c[4]=a,c[3]=this.calculateAdjacent(a,"left"),c[5]=this.calculateAdjacent(a,"right"),c[1]=this.calculateAdjacent(a,"top"),c[7]=this.calculateAdjacent(a,"bottom"),c[0]=this.calculateAdjacent(c[3],"top"),c[2]=this.calculateAdjacent(c[5],"top"),c[6]=this.calculateAdjacent(c[3],"bottom"),c[8]=this.calculateAdjacent(c[5],"bottom")):(c={center:a,left:this.calculateAdjacent(a,"left"),right:this.calculateAdjacent(a,"right"),top:this.calculateAdjacent(a,"top"),bottom:this.calculateAdjacent(a,"bottom")},c.topLeft=this.calculateAdjacent(c.left,"top"),c.topRight=this.calculateAdjacent(c.right,"top"),c.bottomLeft=this.calculateAdjacent(c.left,"bottom"),c.bottomRight=this.calculateAdjacent(c.right,"bottom")),c},k.prototype.calculateLatLngByDistanceBearing=function(a,b,c){var d=a[1],e=a[0],f=Math.asin(Math.sin(this.radians(e))*Math.cos(b/j)+Math.cos(this.radians(e))*Math.sin(b/j)*Math.cos(this.radians(c))),g=this.radians(d)+Math.atan2(Math.sin(this.radians(c))*Math.sin(b/j)*Math.cos(this.radians(e)),Math.cos(b/j)-Math.sin(this.radians(e))*Math.sin(f)),h=(g+3*Math.PI)%(2*Math.PI)-Math.PI;return{lat:this.degrees(f),lng:this.degrees(h)}},k.prototype.calculateExtentByRadius=function(a,b){var c,d,e,f,g=[],h=[];return e=this.calculateLatLngByDistanceBearing(a,b,0),d=this.calculateLatLngByDistanceBearing(a,b,90),f=this.calculateLatLngByDistanceBearing(a,b,180),c=this.calculateLatLngByDistanceBearing(a,b,270),g[0]=e.lat,g[1]=f.lat,h[0]=c.lng,h[1]=d.lng,{lat:g,lng:h}},k.prototype.calculateHashArrayByRadius=function(a,b,c){var d,e,f,g=this.calculateExtentByRadius(a,b),h=[g.lat[0],g.lng[0]],i=[g.lat[0],g.lng[1]],j=[g.lat[1],g.lng[0]],k=this.encode(h[0],h[1],c),l=this.encode(i[0],i[1],c),m=this.encode(j[0],j[1],c),n=0,o=0,p=[];for(d=k,p.push(d);d!==l;)d=this.calculateAdjacent(d,"right"),n++,p.push(d);for(d=k;d!==m;)d=this.calculateAdjacent(d,"bottom"),o++;for(e=0;e<=n;e++)for(d=p[e],f=0;f<o;f++)d=this.calculateAdjacent(d,"bottom"),p.push(d);return p},k.prototype.calculateAdjacent=function(a,b){a=a.toLowerCase();var c=a.charAt(a.length-1),d=a.length%2?"odd":"even",h=a.substring(0,a.length-1);return g[b][d].indexOf(c)!==-1&&(h=this.calculateAdjacent(h,b)),h+e[f[b][d].indexOf(c)]},k.prototype.decode=function(a){var b,c,f,g,h,i,j,k=1,l=[],m=[];for(l[0]=-90,l[1]=90,m[0]=-180,m[1]=180,i=90,j=180,b=0;b<a.length;b++)for(c=a[b],f=e.indexOf(c),g=0;g<5;g++)h=d[g],k?(j/=2,this.refineInterval(m,f,h)):(i/=2,this.refineInterval(l,f,h)),k=!k;return l[2]=(l[0]+l[1])/2,m[2]=(m[0]+m[1])/2,{lat:l,lng:m}},k.prototype.encode=function(a,b,c){var f,g=1,h=[],i=[],j=0,k=0,l="";for(c||(c=12),h[0]=-90,h[1]=90,i[0]=-180,i[1]=180;l.length<c;)g?(f=(i[0]+i[1])/2,b>f?(k|=d[j],i[0]=f):i[1]=f):(f=(h[0]+h[1])/2,a>f?(k|=d[j],h[0]=f):h[1]=f),g=!g,j<4?j++:(l+=e[k],j=0,k=0);return l},"undefined"!=typeof b&&(b.exports=k)},{}],11:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=a("./BinaryTree"),g=a("./GeoHash"),h=new e,i=new g,j=[5e3,1250,156,39.1,4.89,1.22,.153,.0382,.00477,.00119,149e-6,372e-7],k=function(){this.init.apply(this,arguments)};k.prototype.init=function(a,b,c){this._btree=new f,this._btree.index(a),this._size=0,this._id=this._itemKeyHash(a,a),this._debug=!(!b||!b.debug)&&b.debug,this.unique(!(!b||!b.unique)&&b.unique),void 0!==a&&this.keys(a),void 0!==c&&(this.collection(c),this._btree.primaryKey(c.primaryKey())),this.name(b&&b.name?b.name:this._id),this._btree.debug(this._debug)},d.addModule("Index2d",k),d.mixin(k.prototype,"Mixin.Common"),d.mixin(k.prototype,"Mixin.ChainReactor"),d.mixin(k.prototype,"Mixin.Sorting"),k.prototype.id=function(){return this._id},k.prototype.state=function(){return this._state},k.prototype.size=function(){return this._size},d.synthesize(k.prototype,"data"),d.synthesize(k.prototype,"name"),d.synthesize(k.prototype,"collection"),d.synthesize(k.prototype,"type"),d.synthesize(k.prototype,"unique"),k.prototype.keys=function(a){return void 0!==a?(this._keys=a,this._keyCount=h.parse(this._keys).length,this):this._keys},k.prototype.rebuild=function(){if(this._collection){var a,b=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}),c=b.find(),d=c.length;for(this._btree.clear(),this._size=0,this._unique&&(this._uniqueLookup={}),a=0;a<d;a++)this.insert(c[a])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}},k.prototype.insert=function(a,b){var c,d=this._unique;a=this.decouple(a),d&&(c=this._itemHash(a,this._keys),this._uniqueLookup[c]=a);var e,f,g,j,k,l=this._btree.keys();for(k=0;k<l.length;k++)e=h.get(a,l[k].path),e instanceof Array&&(g=e[0],j=e[1],f=i.encode(g,j),h.set(a,l[k].path,f));return!!this._btree.insert(a)&&(this._size++,!0)},k.prototype.remove=function(a,b){var c,d=this._unique;return d&&(c=this._itemHash(a,this._keys),delete this._uniqueLookup[c]),!!this._btree.remove(a)&&(this._size--,!0)},k.prototype.violation=function(a){var b=this._itemHash(a,this._keys);return Boolean(this._uniqueLookup[b])},k.prototype.hashViolation=function(a){return Boolean(this._uniqueLookup[a])},k.prototype.lookup=function(a,b,c){var d,e,f,g,i=this._btree.keys();for(g=0;g<i.length;g++)if(d=i[g].path,e=h.get(a,d),"object"==typeof e)return e.$near&&(f=[],f=f.concat(this.near(d,e.$near,b,c))),e.$geoWithin&&(f=[],f=f.concat(this.geoWithin(d,e.$geoWithin,b,c))),f;return this._btree.lookup(a,b)},k.prototype.near=function(a,b,c,d){var e,f,g,k,l,m,n,o,p,q,r,s,t=this,u=[],v=this._collection.primaryKey();if("km"===b.$distanceUnits){for(o=b.$maxDistance,s=0;s<j.length;s++)if(o>j[s]){n=s+1;break}}else if("miles"===b.$distanceUnits)for(o=1.60934*b.$maxDistance,s=0;s<j.length;s++)if(o>j[s]){n=s+1;break}for(0===n&&(n=1),d&&d.time("index2d.calculateHashArea"),e=i.calculateHashArrayByRadius(b.$point,o,n),d&&d.time("index2d.calculateHashArea"),d&&(d.data("index2d.near.precision",n),d.data("index2d.near.hashArea",e),d.data("index2d.near.maxDistanceKm",o),d.data("index2d.near.centerPointCoords",[b.$point[0],b.$point[1]])),m=[],f=0,k={},g=[],d&&d.time("index2d.near.getDocsInsideHashArea"),s=0;s<e.length;s++)l=this._btree.startsWith(a,e[s]),k[e[s]]=l,f+=l._visitedCount,g=g.concat(l._visitedNodes),m=m.concat(l);if(d&&(d.time("index2d.near.getDocsInsideHashArea"),d.data("index2d.near.startsWith",k),d.data("index2d.near.visitedTreeNodes",g)),d&&d.time("index2d.near.lookupDocsById"),m=this._collection._primaryIndex.lookup(m),d&&d.time("index2d.near.lookupDocsById"),b.$distanceField&&(m=this.decouple(m)),m.length){for(p={},d&&d.time("index2d.near.calculateDistanceFromCenter"),s=0;s<m.length;s++)r=h.get(m[s],a),q=p[m[s][v]]=this.distanceBetweenPoints(b.$point[0],b.$point[1],r[0],r[1]),q<=o&&(b.$distanceField&&h.set(m[s],b.$distanceField,"km"===b.$distanceUnits?q:Math.round(.621371*q)),b.$geoHashField&&h.set(m[s],b.$geoHashField,i.encode(r[0],r[1],n)),u.push(m[s]));d&&d.time("index2d.near.calculateDistanceFromCenter"),d&&d.time("index2d.near.sortResultsByDistance"),u.sort(function(a,b){return t.sortAsc(p[a[v]],p[b[v]])}),d&&d.time("index2d.near.sortResultsByDistance")}return u},k.prototype.geoWithin=function(a,b,c){return console.log("geoWithin() is currently a prototype method with no actual implementation... it just returns a blank array."),[]},k.prototype.distanceBetweenPoints=function(a,b,c,d){var e=6371,f=this.toRadians(a),g=this.toRadians(c),h=this.toRadians(c-a),i=this.toRadians(d-b),j=Math.sin(h/2)*Math.sin(h/2)+Math.cos(f)*Math.cos(g)*Math.sin(i/2)*Math.sin(i/2),k=2*Math.atan2(Math.sqrt(j),Math.sqrt(1-j));return e*k},k.prototype.toRadians=function(a){return.01747722222222*a},k.prototype.match=function(a,b){return this._btree.match(a,b)},k.prototype._itemHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.value(a,c[d].path).join(":");return g},k.prototype._itemKeyHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.keyValue(a,c[d].path);return g},k.prototype._itemHashArr=function(a,b){var c,d,f,g,h,i=new e,j=[];for(c=i.parse(b),g=0;g<c.length;g++)for(d=i.value(a,c[g].path),f=0;f<d.length;f++)if(0===g)j.push(d[f]);else for(h=0;h<j.length;h++)j[h]=j[h]+"_"+d[f];return j},d.index["2d"]=k,d.finishModule("Index2d"),b.exports=k},{"./BinaryTree":3,"./GeoHash":10,"./Path":28,"./Shared":34}],12:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=a("./BinaryTree"),g=function(){this.init.apply(this,arguments)};g.prototype.init=function(a,b,c){this._btree=new f,this._btree.index(a),this._size=0,this._id=this._itemKeyHash(a,a),this._debug=!(!b||!b.debug)&&b.debug,this.unique(!(!b||!b.unique)&&b.unique),void 0!==a&&this.keys(a),void 0!==c&&(this.collection(c),this._btree.primaryKey(c.primaryKey())),this.name(b&&b.name?b.name:this._id),this._btree.debug(this._debug)},d.addModule("IndexBinaryTree",g),d.mixin(g.prototype,"Mixin.ChainReactor"),d.mixin(g.prototype,"Mixin.Sorting"),g.prototype.id=function(){return this._id},g.prototype.state=function(){return this._state},g.prototype.size=function(){return this._size},d.synthesize(g.prototype,"data"),d.synthesize(g.prototype,"name"),d.synthesize(g.prototype,"collection"),d.synthesize(g.prototype,"type"),d.synthesize(g.prototype,"unique"),g.prototype.keys=function(a){return void 0!==a?(this._keys=a,this._keyCount=(new e).parse(this._keys).length,this):this._keys},g.prototype.rebuild=function(){if(this._collection){var a,b=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}),c=b.find(),d=c.length;for(this._btree.clear(),this._size=0,this._unique&&(this._uniqueLookup={}),a=0;a<d;a++)this.insert(c[a])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}},g.prototype.insert=function(a,b){var c,d=this._unique;return d&&(c=this._itemHash(a,this._keys),this._uniqueLookup[c]=a),!!this._btree.insert(a)&&(this._size++,!0)},g.prototype.remove=function(a,b){var c,d=this._unique;return d&&(c=this._itemHash(a,this._keys),delete this._uniqueLookup[c]),!!this._btree.remove(a)&&(this._size--,!0)},g.prototype.violation=function(a){
var b=this._itemHash(a,this._keys);return Boolean(this._uniqueLookup[b])},g.prototype.hashViolation=function(a){return Boolean(this._uniqueLookup[a])},g.prototype.lookup=function(a,b,c){return this._btree.lookup(a,b,c)},g.prototype.match=function(a,b){return this._btree.match(a,b)},g.prototype._itemHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.value(a,c[d].path).join(":");return g},g.prototype._itemKeyHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.keyValue(a,c[d].path);return g},g.prototype._itemHashArr=function(a,b){var c,d,f,g,h,i=new e,j=[];for(c=i.parse(b),g=0;g<c.length;g++)for(d=i.value(a,c[g].path),f=0;f<d.length;f++)if(0===g)j.push(d[f]);else for(h=0;h<j.length;h++)j[h]=j[h]+"_"+d[f];return j},d.index.btree=g,d.finishModule("IndexBinaryTree"),b.exports=g},{"./BinaryTree":3,"./Path":28,"./Shared":34}],13:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(a,b,c){this._crossRef={},this._size=0,this._id=this._itemKeyHash(a,a),this.data({}),this.unique(!(!b||!b.unique)&&b.unique),void 0!==a&&this.keys(a),void 0!==c&&this.collection(c),this.name(b&&b.name?b.name:this._id)},d.addModule("IndexHashMap",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.id=function(){return this._id},f.prototype.state=function(){return this._state},f.prototype.size=function(){return this._size},d.synthesize(f.prototype,"data"),d.synthesize(f.prototype,"name"),d.synthesize(f.prototype,"collection"),d.synthesize(f.prototype,"type"),d.synthesize(f.prototype,"unique"),f.prototype.keys=function(a){return void 0!==a?(this._keys=a,this._keyCount=(new e).parse(this._keys).length,this):this._keys},f.prototype.rebuild=function(){if(this._collection){var a,b=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}),c=b.find(),d=c.length;for(this._data={},this._size=0,this._unique&&(this._uniqueLookup={}),a=0;a<d;a++)this.insert(c[a])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}},f.prototype.insert=function(a,b){var c,d,e,f=this._unique;for(f&&(c=this._itemHash(a,this._keys),this._uniqueLookup[c]=a),d=this._itemHashArr(a,this._keys),e=0;e<d.length;e++)this.pushToPathValue(d[e],a)},f.prototype.update=function(a,b){},f.prototype.remove=function(a,b){var c,d,e,f=this._unique;for(f&&(c=this._itemHash(a,this._keys),delete this._uniqueLookup[c]),d=this._itemHashArr(a,this._keys),e=0;e<d.length;e++)this.pullFromPathValue(d[e],a)},f.prototype.violation=function(a){var b=this._itemHash(a,this._keys);return Boolean(this._uniqueLookup[b])},f.prototype.hashViolation=function(a){return Boolean(this._uniqueLookup[a])},f.prototype.pushToPathValue=function(a,b){var c=this._data[a]=this._data[a]||[];c.indexOf(b)===-1&&(c.push(b),this._size++,this.pushToCrossRef(b,c))},f.prototype.pullFromPathValue=function(a,b){var c,d=this._data[a];c=d.indexOf(b),c>-1&&(d.splice(c,1),this._size--,this.pullFromCrossRef(b,d)),d.length||delete this._data[a]},f.prototype.pull=function(a){var b,c,d=a[this._collection.primaryKey()],e=this._crossRef[d],f=e.length;for(b=0;b<f;b++)c=e[b],this._pullFromArray(c,a);this._size--,delete this._crossRef[d]},f.prototype._pullFromArray=function(a,b){for(var c=a.length;c--;)a[c]===b&&a.splice(c,1)},f.prototype.pushToCrossRef=function(a,b){var c,d=a[this._collection.primaryKey()];this._crossRef[d]=this._crossRef[d]||[],c=this._crossRef[d],c.indexOf(b)===-1&&c.push(b)},f.prototype.pullFromCrossRef=function(a,b){var c=a[this._collection.primaryKey()];delete this._crossRef[c]},f.prototype.lookup=function(a){return this._data[this._itemHash(a,this._keys)]||[]},f.prototype.match=function(a,b){var c,d=new e,f=d.parseArr(this._keys),g=d.parseArr(a),h=[],i=0;for(c=0;c<f.length;c++){if(g[c]!==f[c])return{matchedKeys:[],totalKeyCount:g.length,score:0};i++,h.push(g[c])}return{matchedKeys:h,totalKeyCount:g.length,score:i}},f.prototype._itemHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.value(a,c[d].path).join(":");return g},f.prototype._itemKeyHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.keyValue(a,c[d].path);return g},f.prototype._itemHashArr=function(a,b){var c,d,f,g,h,i=new e,j=[];for(c=i.parse(b),g=0;g<c.length;g++)for(d=i.value(a,c[g].path),f=0;f<d.length;f++)if(0===g)j.push(d[f]);else for(h=0;h<j.length;h++)j[h]=j[h]+"_"+d[f];return j},d.index.hashed=f,d.finishModule("IndexHashMap"),b.exports=f},{"./Path":28,"./Shared":34}],14:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a){this.init.apply(this,arguments)};e.prototype.init=function(a){this._name=a,this._data={},this._primaryKey="_id"},d.addModule("KeyValueStore",e),d.mixin(e.prototype,"Mixin.ChainReactor"),d.synthesize(e.prototype,"name"),e.prototype.primaryKey=function(a){return void 0!==a?(this._primaryKey=a,this):this._primaryKey},e.prototype.truncate=function(){return this._data={},this},e.prototype.set=function(a,b){return this._data[a]=!b||b,this},e.prototype.get=function(a){return this._data[a]},e.prototype.lookup=function(a){var b,c,d,e=this._primaryKey,f=typeof a,g=[];if("string"===f||"number"===f)return d=this.get(a),void 0!==d?[d]:[];if("object"===f){if(a instanceof Array){for(c=a.length,g=[],b=0;b<c;b++)d=this.lookup(a[b]),d&&(d instanceof Array?g=g.concat(d):g.push(d));return g}if(void 0!==a[e]&&null!==a[e])return this.lookup(a[e])}},e.prototype.unSet=function(a){return delete this._data[a],this},e.prototype.uniqueSet=function(a,b){return void 0===this._data[a]&&(this._data[a]=b,!0)},d.finishModule("KeyValueStore"),b.exports=e},{"./Shared":34}],15:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Operation"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(){this._data=[]},d.addModule("Metrics",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.create=function(a){var b=new e(a);return this._enabled&&this._data.push(b),b},f.prototype.start=function(){return this._enabled=!0,this},f.prototype.stop=function(){return this._enabled=!1,this},f.prototype.clear=function(){return this._data=[],this},f.prototype.list=function(){return this._data},d.finishModule("Metrics"),b.exports=f},{"./Operation":26,"./Shared":34}],16:[function(a,b,c){"use strict";var d={preSetData:function(){},postSetData:function(){}};b.exports=d},{}],17:[function(a,b,c){"use strict";var d={chain:function(a){this.debug&&this.debug()&&(a._reactorIn&&a._reactorOut?console.log(a._reactorIn.logIdentifier()+' Adding target "'+a._reactorOut.instanceIdentifier()+'" to the chain reactor target list'):console.log(this.logIdentifier()+' Adding target "'+a.instanceIdentifier()+'" to the chain reactor target list')),this._chain=this._chain||[];var b=this._chain.indexOf(a);b===-1&&this._chain.push(a)},unChain:function(a){if(this.debug&&this.debug()&&(a._reactorIn&&a._reactorOut?console.log(a._reactorIn.logIdentifier()+' Removing target "'+a._reactorOut.instanceIdentifier()+'" from the chain reactor target list'):console.log(this.logIdentifier()+' Removing target "'+a.instanceIdentifier()+'" from the chain reactor target list')),this._chain){var b=this._chain.indexOf(a);b>-1&&this._chain.splice(b,1)}},chainEnabled:function(a){return void 0!==a?(this._chainDisabled=!a,this):!this._chainDisabled},chainWillSend:function(){return Boolean(this._chain&&!this._chainDisabled)},chainSend:function(a,b,c){if(this._chain&&!this._chainDisabled){var d,e,f=this._chain,g=f.length,h=this.decouple(b,g);for(e=0;e<g;e++){if(d=f[e],d._state&&(!d._state||d.isDropped()))throw console.log("Reactor Data:",a,b,c),console.log("Reactor Node:",d),"Chain reactor attempting to send data to target reactor node that is in a dropped state!";this.debug&&this.debug()&&(d._reactorIn&&d._reactorOut?console.log(d._reactorIn.logIdentifier()+' Sending data down the chain reactor pipe to "'+d._reactorOut.instanceIdentifier()+'"'):console.log(this.logIdentifier()+' Sending data down the chain reactor pipe to "'+d.instanceIdentifier()+'"')),d.chainReceive&&d.chainReceive(this,a,h[e],c)}}},chainReceive:function(a,b,c,d){var e={sender:a,type:b,data:c,options:d},f=!1;this.debug&&this.debug()&&console.log(this.logIdentifier()+" Received data from parent reactor node"),this._chainHandler&&(f=this._chainHandler(e)),f||this.chainSend(e.type,e.data,e.options)}};b.exports=d},{}],18:[function(a,b,c){"use strict";var d,e=0,f=a("./Overload"),g=a("./Serialiser"),h=new g;d={serialiser:h,make:function(a){return h.convert(a)},store:function(a,b){if(void 0!==a){if(void 0!==b)return this._store=this._store||{},this._store[a]=b,this;if(this._store)return this._store[a]}},unStore:function(a){return void 0!==a&&delete this._store[a],this},decouple:function(a,b){if(void 0!==a&&""!==a){if(b){var c,d=this.jStringify(a),e=[];for(c=0;c<b;c++)e.push(this.jParse(d));return e}return this.jParse(this.jStringify(a))}},jParse:function(a){return JSON.parse(a,h.reviver())},jStringify:function(a){return JSON.stringify(a)},objectId:function(a){var b,c=Math.pow(10,17);if(a){var d,f=0,g=a.length;for(d=0;d<g;d++)f+=a.charCodeAt(d)*c;b=f.toString(16)}else e++,b=(e+(Math.random()*c+Math.random()*c+Math.random()*c+Math.random()*c)).toString(16);return b},hash:function(a){return JSON.stringify(a)},debug:new f([function(){return this._debug&&this._debug.all},function(a){return void 0!==a?"boolean"==typeof a?(this._debug=this._debug||{},this._debug.all=a,this.chainSend("debug",this._debug),this):this._debug&&this._debug[a]||this._db&&this._db._debug&&this._db._debug[a]||this._debug&&this._debug.all:this._debug&&this._debug.all},function(a,b){return void 0!==a?void 0!==b?(this._debug=this._debug||{},this._debug[a]=b,this.chainSend("debug",this._debug),this):this._debug&&this._debug[b]||this._db&&this._db._debug&&this._db._debug[a]:this._debug&&this._debug.all}]),classIdentifier:function(){return"ForerunnerDB."+this.className},instanceIdentifier:function(){return"["+this.className+"]"+this.name()},logIdentifier:function(){return"ForerunnerDB "+this.instanceIdentifier()},convertToFdb:function(a){var b,c,d,e;for(e in a)if(a.hasOwnProperty(e)&&(d=a,e.indexOf(".")>-1)){for(e=e.replace(".$","[|$|]"),c=e.split(".");b=c.shift();)b=b.replace("[|$|]",".$"),c.length?d[b]={}:d[b]=a[e],d=d[b];delete a[e]}},isDropped:function(){return"dropped"===this._state},debounce:function(a,b,c){var d,e=this;e._debounce=e._debounce||{},e._debounce[a]&&clearTimeout(e._debounce[a].timeout),d={callback:b,timeout:setTimeout(function(){delete e._debounce[a],b()},c)},e._debounce[a]=d}},b.exports=d},{"./Overload":27,"./Serialiser":33}],19:[function(a,b,c){"use strict";var d={TYPE_INSERT:0,TYPE_UPDATE:1,TYPE_REMOVE:2,PHASE_BEFORE:0,PHASE_AFTER:1};b.exports=d},{}],20:[function(a,b,c){"use strict";var d=a("./Overload"),e={on:new d({"string, function":function(a,b){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||{},this._listeners[a]["*"]=this._listeners[a]["*"]||[],this._listeners[a]["*"].push(b),this},"string, *, function":function(a,b,c){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||{},this._listeners[a][b]=this._listeners[a][b]||[],this._listeners[a][b].push(c),this}}),once:new d({"string, function":function(a,b){var c=this,d=!1,e=function(){d||(c.off(a,e),b.apply(c,arguments),d=!0)};return this.on(a,e)},"string, *, function":function(a,b,c){var d=this,e=!1,f=function(){e||(d.off(a,b,f),c.apply(d,arguments),e=!0)};return this.on(a,b,f)}}),off:new d({string:function(a){var b=this;return this._emitting?(this._eventRemovalQueue=this._eventRemovalQueue||[],this._eventRemovalQueue.push(function(){b.off(a)})):this._listeners&&this._listeners[a]&&a in this._listeners&&delete this._listeners[a],this},"string, function":function(a,b){var c,d,e=this;return this._emitting?(this._eventRemovalQueue=this._eventRemovalQueue||[],this._eventRemovalQueue.push(function(){e.off(a,b)})):"string"==typeof b?this._listeners&&this._listeners[a]&&this._listeners[a][b]&&delete this._listeners[a][b]:this._listeners&&a in this._listeners&&(c=this._listeners[a]["*"],d=c.indexOf(b),d>-1&&c.splice(d,1)),this},"string, *, function":function(a,b,c){var d=this;if(this._emitting)this._eventRemovalQueue=this._eventRemovalQueue||[],this._eventRemovalQueue.push(function(){d.off(a,b,c)});else if(this._listeners&&a in this._listeners&&b in this.listeners[a]){var e=this._listeners[a][b],f=e.indexOf(c);f>-1&&e.splice(f,1)}},"string, *":function(a,b){var c=this;this._emitting?(this._eventRemovalQueue=this._eventRemovalQueue||[],this._eventRemovalQueue.push(function(){c.off(a,b)})):this._listeners&&a in this._listeners&&b in this._listeners[a]&&delete this._listeners[a][b]}}),emit:function(a,b){if(this._listeners=this._listeners||{},this._emitting=!0,a in this._listeners){var c,d,e,f,g,h,i;if(this._listeners[a]["*"])for(f=this._listeners[a]["*"],d=f.length,c=0;c<d;c++)e=f[c],"function"==typeof e&&e.apply(this,Array.prototype.slice.call(arguments,1));if(b instanceof Array&&b[0]&&b[0][this._primaryKey])for(g=this._listeners[a],d=b.length,c=0;c<d;c++)if(g[b[c][this._primaryKey]])for(h=g[b[c][this._primaryKey]].length,i=0;i<h;i++)e=g[b[c][this._primaryKey]][i],"function"==typeof e&&g[b[c][this._primaryKey]][i].apply(this,Array.prototype.slice.call(arguments,1))}return this._emitting=!1,this._processRemovalQueue(),this},_processRemovalQueue:function(){var a;if(this._eventRemovalQueue&&this._eventRemovalQueue.length){for(a=0;a<this._eventRemovalQueue.length;a++)this._eventRemovalQueue[a]();this._eventRemovalQueue=[]}},deferEmit:function(a,b){var c,d=this;return this._noEmitDefer||this._db&&(!this._db||this._db._noEmitDefer)?this.emit.apply(this,arguments):(c=arguments,this._deferTimeout=this._deferTimeout||{},this._deferTimeout[a]&&clearTimeout(this._deferTimeout[a]),this._deferTimeout[a]=setTimeout(function(){d.debug()&&console.log(d.logIdentifier()+" Emitting "+c[0]),d.emit.apply(d,c)},1)),this}};b.exports=e},{"./Overload":27}],21:[function(a,b,c){"use strict";var d={_match:function(a,b,c,d,e){var f,g,h,i,j,k,l=d,m=typeof a,n=typeof b,o=!0;if("object"===m&&null===a&&(m="null"),"object"===n&&null===b&&(n="null"),e=e||{},c=c||{},e.$rootQuery||(e.$rootQuery=b),e.$rootSource||(e.$rootSource=a),e.$currentQuery=b,e.$rootData=e.$rootData||{},"string"!==m&&"number"!==m&&"null"!==m||"string"!==n&&"number"!==n&&"null"!==n){if(("string"===m||"number"===m)&&"object"===n&&b instanceof RegExp)b.test(a)||(o=!1);else for(k in b)if(b.hasOwnProperty(k)){if(e.$previousQuery=e.$parent,e.$parent={query:b[k],key:k,parent:e.$previousQuery},f=!1,j=k.substr(0,2),"//"===j)continue;if(0===j.indexOf("$")&&(i=this._matchOp(k,a,b[k],c,e),i>-1)){if(i){if("or"===d)return!0}else o=i;f=!0}if(!f&&b[k]instanceof RegExp)if(f=!0,"object"===m&&void 0!==a[k]&&b[k].test(a[k])){if("or"===d)return!0}else o=!1;if(!f)if("object"==typeof b[k])if(void 0!==a[k])if(a[k]instanceof Array&&!(b[k]instanceof Array)){for(g=!1,h=0;h<a[k].length&&!(g=this._match(a[k][h],b[k],c,l,e));h++);if(g){if("or"===d)return!0}else o=!1}else if(!(a[k]instanceof Array)&&b[k]instanceof Array){for(g=!1,h=0;h<b[k].length&&!(g=this._match(a[k],b[k][h],c,l,e));h++);if(g){if("or"===d)return!0}else o=!1}else if("object"==typeof a)if(g=this._match(a[k],b[k],c,l,e)){if("or"===d)return!0}else o=!1;else if(g=this._match(void 0,b[k],c,l,e)){if("or"===d)return!0}else o=!1;else if(b[k]&&void 0!==b[k].$exists)if(g=this._match(void 0,b[k],c,l,e)){if("or"===d)return!0}else o=!1;else o=!1;else if(a&&a[k]===b[k]){if("or"===d)return!0}else if(a&&a[k]&&a[k]instanceof Array&&b[k]&&"object"!=typeof b[k]){for(g=!1,h=0;h<a[k].length&&!(g=this._match(a[k][h],b[k],c,l,e));h++);if(g){if("or"===d)return!0}else o=!1}else o=!1;if("and"===d&&!o)return!1}}else"number"===m||"null"===m||"null"===n?a!==b&&(o=!1):a.localeCompare(b)&&(o=!1);return o},_matchOp:function(a,b,c,d,e){switch(a){case"$gt":return b>c;case"$gte":return b>=c;case"$lt":return b<c;case"$lte":return b<=c;case"$exists":return void 0===b!==c;case"$eq":return b==c;case"$eeq":return b===c;case"$ne":return b!=c;case"$nee":return b!==c;case"$or":for(var f=0;f<c.length;f++)if(this._match(b,c[f],d,"and",e))return!0;return!1;case"$and":for(var g=0;g<c.length;g++)if(!this._match(b,c[g],d,"and",e))return!1;return!0;case"$in":if(c instanceof Array){var h,i=c,j=i.length;for(h=0;h<j;h++)if(this._match(b,i[h],d,"and",e))return!0;return!1}return"object"==typeof c?this._match(b,c,d,"and",e):(console.log(this.logIdentifier()+" Cannot use an $in operator on a non-array key: "+a,e.$rootQuery),!1);case"$nin":if(c instanceof Array){var k,l=c,m=l.length;for(k=0;k<m;k++)if(this._match(b,l[k],d,"and",e))return!1;return!0}return"object"==typeof c?this._match(b,c,d,"and",e):(console.log(this.logIdentifier()+" Cannot use a $nin operator on a non-array key: "+a,e.$rootQuery),!1);case"$fastIn":return c instanceof Array?c.indexOf(b)!==-1:(console.log(this.logIdentifier()+" Cannot use an $fastIn operator on a non-array key: "+a,e.$rootQuery),!1);case"$distinct":e.$rootData["//distinctLookup"]=e.$rootData["//distinctLookup"]||{};for(var n in c)if(c.hasOwnProperty(n))return e.$rootData["//distinctLookup"][n]=e.$rootData["//distinctLookup"][n]||{},!e.$rootData["//distinctLookup"][n][b[n]]&&(e.$rootData["//distinctLookup"][n][b[n]]=!0,!0);break;case"$count":var o,p,q;for(o in c)if(c.hasOwnProperty(o)&&(p=b[o],q="object"==typeof p&&p instanceof Array?p.length:0,!this._match(q,c[o],d,"and",e)))return!1;return!0;case"$find":case"$findOne":case"$findSub":var r,s,t,u,v,w,x="collection",y={};if(!c.$from)throw a+" missing $from property!";if(c.$fromType&&(x=c.$fromType,!this.db()[x]||"function"!=typeof this.db()[x]))throw a+' cannot operate against $fromType "'+x+'" because the database does not recognise this type of object!';if(r=c.$query||{},s=c.$options||{},"$findSub"===a){if(!c.$path)throw a+" missing $path property!";if(v=c.$path,t=c.$subQuery||{},u=c.$subOptions||{},!(e.$parent&&e.$parent.parent&&e.$parent.parent.key))return this._match(b,r,{},"and",e)&&(w=this._findSub([b],v,t,u)),w&&w.length>0;w=this.db()[x](c.$from).findSub(r,v,t,u)}else w=this.db()[x](c.$from)[a.substr(1)](r,s);return y[e.$parent.parent.key]=w,this._match(b,y,d,"and",e)}return-1},applyJoin:function(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x=this,y=[];for(a instanceof Array||(a=[a]),e=0;e<b.length;e++)for(f in b[e])if(b[e].hasOwnProperty(f))for(g=b[e][f],h=g.$sourceType||"collection",i="$"+h+"."+f,j=f,c[i]?k=c[i]:this._db[h]&&"function"==typeof this._db[h]&&(k=this._db[h](f)),l=0;l<a.length;l++){m={},n=!1,o=!1,p="";for(q in g)if(g.hasOwnProperty(q))if(r=g[q],"$"===q.substr(0,1))switch(q){case"$where":if(!r.$query&&!r.$options)throw'$join $where clause requires "$query" and / or "$options" keys to work!';r.$query&&(m=x.resolveDynamicQuery(r.$query,a[l])),r.$options&&(s=r.$options);break;case"$as":j=r;break;case"$multi":n=r;break;case"$require":o=r;break;case"$prefix":p=r}else m[q]=x.resolveDynamicQuery(r,a[l]);if(t=k.find(m,s),!o||o&&t[0])if("$root"===j){if(n!==!1)throw this.logIdentifier()+' Cannot combine [$as: "$root"] with [$multi: true] in $join clause!';u=t[0],v=a[l];for(w in u)u.hasOwnProperty(w)&&void 0===v[p+w]&&(v[p+w]=u[w])}else a[l][j]=n===!1?t[0]:t;else y.push(l)}return y},resolveDynamicQuery:function(a,b){var c,d,e,f,g,h=this;if("string"==typeof a)return f="$$."===a.substr(0,3)?this.sharedPathSolver.value(b,a.substr(3,a.length-3)):this.sharedPathSolver.value(b,a),f.length>1?{$in:f}:f[0];c={};for(g in a)if(a.hasOwnProperty(g))switch(d=typeof a[g],e=a[g],d){case"string":"$$."===e.substr(0,3)?c[g]=this.sharedPathSolver.value(b,e.substr(3,e.length-3))[0]:c[g]=e;break;case"object":c[g]=h.resolveDynamicQuery(e,b);break;default:c[g]=e}return c},spliceArrayByIndexList:function(a,b){var c;for(c=b.length-1;c>=0;c--)a.splice(b[c],1)}};b.exports=d},{}],22:[function(a,b,c){"use strict";var d={sortAsc:function(a,b){return"string"==typeof a&&"string"==typeof b?a.localeCompare(b):a>b?1:a<b?-1:0},sortDesc:function(a,b){return"string"==typeof a&&"string"==typeof b?b.localeCompare(a):a>b?-1:a<b?1:0}};b.exports=d},{}],23:[function(a,b,c){"use strict";var d,e={};d={tagAdd:function(a){var b,c=this,d=e[a]=e[a]||[];for(b=0;b<d.length;b++)if(d[b]===c)return!0;return d.push(c),c.on&&c.on("drop",function(){c.tagRemove(a)}),!0},tagRemove:function(a){var b,c=e[a];if(c)for(b=0;b<c.length;b++)if(c[b]===this)return c.splice(b,1),!0;return!1},tagLookup:function(a){return e[a]||[]},tagDrop:function(a,b){var c,d,e,f=this.tagLookup(a);if(c=function(){d--,b&&0===d&&b(!1)},f.length)for(d=f.length,e=f.length-1;e>=0;e--)f[e].drop(c);return!0}},b.exports=d},{}],24:[function(a,b,c){"use strict";var d=a("./Overload"),e={addTrigger:function(a,b,c,d){var e,f=this;return e=f._triggerIndexOf(a,b,c),e===-1&&(f.triggerStack={},f._trigger=f._trigger||{},f._trigger[b]=f._trigger[b]||{},f._trigger[b][c]=f._trigger[b][c]||[],f._trigger[b][c].push({id:a,method:d,enabled:!0}),!0)},removeTrigger:function(a,b,c){var d,e=this;return d=e._triggerIndexOf(a,b,c),d>-1&&e._trigger[b][c].splice(d,1),!1},ignoreTriggers:function(a){return void 0!==a?(this._ignoreTriggers=a,this):this._ignoreTriggers},addLinkIO:function(a,b){var c,d,e,f,g,h,i,j,k,l=this;if(l._linkIO=l._linkIO||{},l._linkIO[a]=b,d=b.export,e=b.import,d&&(h=l.db().collection(d.to)),e&&(i=l.db().collection(e.from)),j=[l.TYPE_INSERT,l.TYPE_UPDATE,l.TYPE_REMOVE],c=function(a,b){b(!1,!0)},d&&(d.match||(d.match=c),d.types||(d.types=j),f=function(a,b,c){d.match(c,function(b,e){!b&&e&&d.data(c,a.type,function(b,c,d){!b&&c&&(h.ignoreTriggers(!0),"remove"!==a.type?h.upsert(c,d):h.remove(c,d),h.ignoreTriggers(!1))})})}),e&&(e.match||(e.match=c),e.types||(e.types=j),g=function(a,b,c){e.match(c,function(b,d){!b&&d&&e.data(c,a.type,function(b,c,d){!b&&c&&(h.ignoreTriggers(!0),"remove"!==a.type?l.upsert(c,d):l.remove(c,d),h.ignoreTriggers(!1))})})}),d)for(k=0;k<d.types.length;k++)l.addTrigger(a+"export"+d.types[k],d.types[k],l.PHASE_AFTER,f);if(e)for(k=0;k<e.types.length;k++)i.addTrigger(a+"import"+e.types[k],e.types[k],l.PHASE_AFTER,g)},removeLinkIO:function(a){var b,c,d,e,f=this,g=f._linkIO[a];if(g){if(b=g.export,c=g.import,b)for(e=0;e<b.types.length;e++)f.removeTrigger(a+"export"+b.types[e],b.types[e],f.db.PHASE_AFTER);if(c)for(d=f.db().collection(c.from),e=0;e<c.types.length;e++)d.removeTrigger(a+"import"+c.types[e],c.types[e],f.db.PHASE_AFTER);return delete f._linkIO[a],!0}return!1},enableTrigger:new d({string:function(a){var b,c,d,e,f,g=this,h=g._trigger,i=!1;if(h)for(f in h)if(h.hasOwnProperty(f)&&(b=h[f]))for(d in b)if(b.hasOwnProperty(d))for(c=b[d],e=0;e<c.length;e++)c[e].id===a&&(c[e].enabled=!0,i=!0);return i},number:function(a){var b,c,d,e=this,f=e._trigger[a],g=!1;if(f)for(c in f)if(f.hasOwnProperty(c))for(b=f[c],d=0;d<b.length;d++)b[d].enabled=!0,g=!0;return g},"number, number":function(a,b){var c,d,e=this,f=e._trigger[a],g=!1;if(f&&(c=f[b]))for(d=0;d<c.length;d++)c[d].enabled=!0,g=!0;return g},"string, number, number":function(a,b,c){var d=this,e=d._triggerIndexOf(a,b,c);return e>-1&&(d._trigger[b][c][e].enabled=!0,!0)}}),disableTrigger:new d({string:function(a){var b,c,d,e,f,g=this,h=g._trigger,i=!1;if(h)for(f in h)if(h.hasOwnProperty(f)&&(b=h[f]))for(d in b)if(b.hasOwnProperty(d))for(c=b[d],e=0;e<c.length;e++)c[e].id===a&&(c[e].enabled=!1,i=!0);return i},number:function(a){var b,c,d,e=this,f=e._trigger[a],g=!1;if(f)for(c in f)if(f.hasOwnProperty(c))for(b=f[c],d=0;d<b.length;d++)b[d].enabled=!1,g=!0;return g},"number, number":function(a,b){var c,d,e=this,f=e._trigger[a],g=!1;if(f&&(c=f[b]))for(d=0;d<c.length;d++)c[d].enabled=!1,g=!0;return g},"string, number, number":function(a,b,c){var d=this,e=d._triggerIndexOf(a,b,c);return e>-1&&(d._trigger[b][c][e].enabled=!1,!0)}}),willTrigger:function(a,b){if(!this._ignoreTriggers&&this._trigger&&this._trigger[a]&&this._trigger[a][b]&&this._trigger[a][b].length){var c,d=this._trigger[a][b];for(c=0;c<d.length;c++)if(d[c].enabled)return!0}return!1},processTrigger:function(a,b,c,d,e){var f,g,h,i,j,k,l,m=this;if(!m._ignoreTriggers&&m._trigger&&m._trigger[b]&&m._trigger[b][c]){for(f=m._trigger[b][c],h=f.length,g=0;g<h;g++)if(i=f[g],i.enabled){if(m.debug()){switch(b){case this.TYPE_INSERT:k="insert";break;case this.TYPE_UPDATE:k="update";break;case this.TYPE_REMOVE:k="remove";break;default:k=""}switch(c){case this.PHASE_BEFORE:l="before";break;case this.PHASE_AFTER:l="after";break;default:l=""}console.log('Triggers: Processing trigger "'+i.id+'" for '+k+' in phase "'+l+'"')}if(m.triggerStack&&m.triggerStack[b]&&m.triggerStack[b][c]&&m.triggerStack[b][c][i.id]){m.debug()&&console.log('Triggers: Will not run trigger "'+i.id+'" for '+k+' in phase "'+l+'" as it is already in the stack!');continue}if(m.triggerStack=m.triggerStack||{},m.triggerStack[b]={},m.triggerStack[b][c]={},m.triggerStack[b][c][i.id]=!0,j=i.method.call(m,a,d,e),m.triggerStack=m.triggerStack||{},m.triggerStack[b]={},m.triggerStack[b][c]={},m.triggerStack[b][c][i.id]=!1,j===!1)return!1;if(void 0!==j&&j!==!0&&j!==!1)throw"ForerunnerDB.Mixin.Triggers: Trigger error: "+j}return!0}},_triggerIndexOf:function(a,b,c){var d,e,f,g=this;if(g._trigger&&g._trigger[b]&&g._trigger[b][c])for(d=g._trigger[b][c],e=d.length,f=0;f<e;f++)if(d[f].id===a)return f;return-1}};b.exports=e},{"./Overload":27}],25:[function(a,b,c){"use strict";var d={_updateProperty:function(a,b,c){a[b]=c,this.debug()&&console.log(this.logIdentifier()+' Setting non-data-bound document property "'+b+'" to val "'+c+'"')},_updateIncrement:function(a,b,c){a[b]+=c},_updateSpliceMove:function(a,b,c){a.splice(c,0,a.splice(b,1)[0]),this.debug()&&console.log(this.logIdentifier()+' Moving non-data-bound document array index from "'+b+'" to "'+c+'"')},_updateSplicePush:function(a,b,c){a.length>b?a.splice(b,0,c):a.push(c)},_updateSplicePull:function(a,b,c){c||(c=1),a.splice(b,c)},_updatePush:function(a,b){a.push(b)},_updatePull:function(a,b){a.splice(b,1)},_updateMultiply:function(a,b,c){a[b]*=c},_updateRename:function(a,b,c){a[c]=a[b],delete a[b]},_updateOverwrite:function(a,b,c){a[b]=c},_updateUnset:function(a,b){delete a[b]},_updateClear:function(a,b){var c,d=a[b];if(d&&"object"==typeof d)for(c in d)d.hasOwnProperty(c)&&this._updateUnset(d,c)},_updatePop:function(a,b){var c,d=!1;if(a.length>0)if(b>0){for(c=0;c<b;c++)a.pop();d=!0}else if(b<0){for(c=0;c>b;c--)a.shift();d=!0}return d}};b.exports=d},{}],26:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(a){this.pathSolver=new e,this.counter=0,this.init.apply(this,arguments)};f.prototype.init=function(a){this._data={operation:a,index:{potential:[],used:!1},steps:[],time:{startMs:0,stopMs:0,totalMs:0,process:{}},flag:{},log:[]}},d.addModule("Operation",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.start=function(){this._data.time.startMs=(new Date).getTime()},f.prototype.log=function(a){if(a){var b=this._log.length>0?this._data.log[this._data.log.length-1].time:0,c={event:a,time:(new Date).getTime(),delta:0};return this._data.log.push(c),b&&(c.delta=c.time-b),this}return this._data.log},f.prototype.time=function(a){if(void 0!==a){var b=this._data.time.process,c=b[a]=b[a]||{};return c.startMs?(c.stopMs=(new Date).getTime(),c.totalMs=c.stopMs-c.startMs,c.stepObj.totalMs=c.totalMs,delete c.stepObj):(c.startMs=(new Date).getTime(),c.stepObj={name:a},this._data.steps.push(c.stepObj)),this}return this._data.time},f.prototype.flag=function(a,b){return void 0===a||void 0===b?void 0!==a?this._data.flag[a]:this._data.flag:void(this._data.flag[a]=b)},f.prototype.data=function(a,b,c){return void 0!==b?(this.pathSolver.set(this._data,a,b),this):this.pathSolver.get(this._data,a)},f.prototype.pushData=function(a,b,c){this.pathSolver.push(this._data,a,b)},f.prototype.stop=function(){this._data.time.stopMs=(new Date).getTime(),this._data.time.totalMs=this._data.time.stopMs-this._data.time.startMs},d.finishModule("Operation"),b.exports=f},{"./Path":28,"./Shared":34}],27:[function(a,b,c){"use strict";var d=function(a,b){if(b||(b=a,a=void 0),b){var c,d,e,f,g,h,i=this;if(!(b instanceof Array)){e={};for(c in b)if(b.hasOwnProperty(c))if(f=c.replace(/ /g,""),f.indexOf("*")===-1)e[f]=b[c];else for(h=this.generateSignaturePermutations(f),g=0;g<h.length;g++)e[h[g]]||(e[h[g]]=b[c]);b=e}return function(){var e,f,g,h=[];if(b instanceof Array){for(d=b.length,c=0;c<d;c++)if(b[c].length===arguments.length)return i.callExtend(this,"$main",b,b[c],arguments)}else{for(c=0;c<arguments.length&&(f=typeof arguments[c],"object"===f&&arguments[c]instanceof Array&&(f="array"),1!==arguments.length||"undefined"!==f);c++)h.push(f);if(e=h.join(","),b[e])return i.callExtend(this,"$main",b,b[e],arguments);for(c=h.length;c>=0;c--)if(e=h.slice(0,c).join(","),b[e+",..."])return i.callExtend(this,"$main",b,b[e+",..."],arguments)}throw g=void 0!==a?a:"function"==typeof this.name?this.name():"Unknown",console.log("Overload Definition:",b),'ForerunnerDB.Overload "'+g+'": Overloaded method does not have a matching signature "'+e+'" for the passed arguments: '+this.jStringify(h)}}return function(){}};d.prototype.generateSignaturePermutations=function(a){var b,c,d=[],e=["array","string","object","number","function","undefined"];if(a.indexOf("*")>-1)for(c=0;c<e.length;c++)b=a.replace("*",e[c]),d=d.concat(this.generateSignaturePermutations(b));else d.push(a);return d},d.prototype.callExtend=function(a,b,c,d,e){var f,g;return a&&c[b]?(f=a[b],a[b]=c[b],g=d.apply(a,e),a[b]=f,g):d.apply(a,e)},b.exports=d},{}],28:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a){this.init.apply(this,arguments)};e.prototype.init=function(a){a&&this.path(a)},d.addModule("Path",e),d.mixin(e.prototype,"Mixin.Common"),d.mixin(e.prototype,"Mixin.ChainReactor"),e.prototype.path=function(a){return void 0!==a?(this._path=this.clean(a),this._pathParts=this._path.split("."),this):this._path},e.prototype.hasObjectPaths=function(a,b){var c,d=!0;for(c in a)if(a.hasOwnProperty(c)){if(void 0===b[c])return!1;if("object"==typeof a[c]&&(d=this.hasObjectPaths(a[c],b[c]),!d))return!1}return d},e.prototype.countKeys=function(a){var b,c=0;for(b in a)a.hasOwnProperty(b)&&void 0!==a[b]&&("object"!=typeof a[b]?c++:c+=this.countKeys(a[b]));return c},e.prototype.countObjectPaths=function(a,b){var c,d,e={},f=0,g=0;for(d in b)b.hasOwnProperty(d)&&("object"==typeof b[d]?(c=this.countObjectPaths(a[d],b[d]),e[d]=c.matchedKeys,g+=c.totalKeyCount,f+=c.matchedKeyCount):(g++,a&&a[d]&&"object"!=typeof a[d]?(e[d]=!0,f++):e[d]=!1));return{matchedKeys:e,matchedKeyCount:f,totalKeyCount:g}},e.prototype.parse=function(a,b){var c,d,e,f=[],g="";for(d in a)if(a.hasOwnProperty(d))if(g=d,"object"==typeof a[d])if(b)for(c=this.parse(a[d],b),e=0;e<c.length;e++)f.push({path:g+"."+c[e].path,value:c[e].value});else for(c=this.parse(a[d]),e=0;e<c.length;e++)f.push({path:g+"."+c[e].path});else b?f.push({path:g,value:a[d]}):f.push({path:g});return f},e.prototype.parseArr=function(a,b){return b=b||{},this._parseArr(a,"",[],b)},e.prototype._parseArr=function(a,b,c,d){var e,f="";b=b||"",c=c||[];for(e in a)a.hasOwnProperty(e)&&(!d.ignore||d.ignore&&!d.ignore.test(e))&&(f=b?b+"."+e:e,"object"==typeof a[e]?(d.verbose&&c.push(f),this._parseArr(a[e],f,c,d)):c.push(f));return c},e.prototype.set=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;b=this.clean(b),d=b.split("."),e=d.shift(),d.length?(a[e]=a[e]||{},this.set(a[e],d.join("."),c)):a[e]=c}return a},e.prototype.get=function(a,b){return this.value(a,b)[0]},e.prototype.value=function(a,b,c){var d,e,f,g,h,i,j,k,l;if(b&&b.indexOf(".")===-1)return[a[b]];if(void 0!==a&&"object"==typeof a){if((!c||c&&!c.skipArrCheck)&&a instanceof Array){for(j=[],k=0;k<a.length;k++)j.push(this.get(a[k],b));return j}for(i=[],void 0!==b&&(b=this.clean(b),d=b.split(".")),e=d||this._pathParts,f=e.length,g=a,k=0;k<f;k++){if(g=g[e[k]],h instanceof Array){for(l=0;l<h.length;l++)i=i.concat(this.value(h,l+"."+e[k],{skipArrCheck:!0}));return i}if(!g||"object"!=typeof g)break;h=g}return[g];
}return[]},e.prototype.push=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;if(b=this.clean(b),d=b.split("."),e=d.shift(),d.length)a[e]=a[e]||{},this.set(a[e],d.join("."),c);else{if(a[e]=a[e]||[],!(a[e]instanceof Array))throw"ForerunnerDB.Path: Cannot push to a path whose endpoint is not an array!";a[e].push(c)}}return a},e.prototype.keyValue=function(a,b){var c,d,e,f,g,h,i;for(void 0!==b&&(b=this.clean(b),c=b.split(".")),d=c||this._pathParts,e=d.length,f=a,i=0;i<e;i++){if(f=f[d[i]],!f||"object"!=typeof f){h=d[i]+":"+f;break}g=f}return h},e.prototype.set=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;b=this.clean(b),d=b.split("."),e=d.shift(),d.length?(a[e]=a[e]||{},this.set(a[e],d.join("."),c)):a[e]=c}return a},e.prototype.clean=function(a){return"."===a.substr(0,1)&&(a=a.substr(1,a.length-1)),a},d.finishModule("Path"),b.exports=e},{"./Shared":34}],29:[function(a,b,c){"use strict";var d,e,f,g,h,i,j,k,l,m=a("./Shared"),n=a("async"),o=a("localforage");a("./PersistCompress"),a("./PersistCrypto");k=function(){this.init.apply(this,arguments)},k.prototype.localforage=o,k.prototype.init=function(a){var b=this;this._encodeSteps=[function(){return b._encode.apply(b,arguments)}],this._decodeSteps=[function(){return b._decode.apply(b,arguments)}],a.isClient()&&void 0!==window.Storage&&(this.mode("localforage"),o.config({driver:[o.INDEXEDDB,o.WEBSQL,o.LOCALSTORAGE],name:String(a.core().name()),storeName:"FDB"}))},m.addModule("Persist",k),m.mixin(k.prototype,"Mixin.ChainReactor"),m.mixin(k.prototype,"Mixin.Common"),d=m.modules.Db,e=a("./Collection"),f=e.prototype.drop,g=a("./CollectionGroup"),h=e.prototype.init,i=d.prototype.init,j=d.prototype.drop,l=m.overload,m.synthesize(k.prototype,"auto",function(a){var b=this;return void 0!==a&&(a?(this._db.on("create",function(){b._autoLoad.apply(b,arguments)}),this._db.on("change",function(){b._autoSave.apply(b,arguments)}),this._db.debug()&&console.log(this._db.logIdentifier()+" Automatic load/save enabled")):(this._db.off("create",this._autoLoad),this._db.off("change",this._autoSave),this._db.debug()&&console.log(this._db.logIdentifier()+" Automatic load/save disbled"))),this.$super.call(this,a)}),k.prototype._autoLoad=function(a,b,c){var d=this;"function"==typeof a.load?(d._db.debug()&&console.log(d._db.logIdentifier()+" Auto-loading data for "+b+":",c),a.load(function(a,b){a&&d._db.debug()&&console.log(d._db.logIdentifier()+" Automatic load failed:",a),d.emit("load",a,b)})):d._db.debug()&&console.log(d._db.logIdentifier()+" Auto-load for "+b+":",c,"no load method, skipping")},k.prototype._autoSave=function(a,b,c){var d=this;"function"==typeof a.save&&(d._db.debug()&&console.log(d._db.logIdentifier()+" Auto-saving data for "+b+":",c),a.save(function(a,b){a&&d._db.debug()&&console.log(d._db.logIdentifier()+" Automatic save failed:",a),d.emit("save",a,b)}))},k.prototype.mode=function(a){return void 0!==a?(this._mode=a,this):this._mode},k.prototype.driver=function(a){if(void 0!==a){switch(a.toUpperCase()){case"LOCALSTORAGE":o.setDriver(o.LOCALSTORAGE);break;case"WEBSQL":o.setDriver(o.WEBSQL);break;case"INDEXEDDB":o.setDriver(o.INDEXEDDB);break;default:throw"ForerunnerDB.Persist: The persistence driver you have specified is not found. Please use either IndexedDB, WebSQL or LocalStorage!"}return this}return o.driver()},k.prototype.decode=function(a,b){n.waterfall([function(b){b&&b(!1,a,{})}].concat(this._decodeSteps),b)},k.prototype.encode=function(a,b){n.waterfall([function(b){b&&b(!1,a,{})}].concat(this._encodeSteps),b)},m.synthesize(k.prototype,"encodeSteps"),m.synthesize(k.prototype,"decodeSteps"),k.prototype.addStep=new l({object:function(a){this.$main.call(this,function(){a.encode.apply(a,arguments)},function(){a.decode.apply(a,arguments)},0)},"function, function":function(a,b){this.$main.call(this,a,b,0)},"function, function, number":function(a,b,c){this.$main.call(this,a,b,c)},$main:function(a,b,c){0===c||void 0===c?(this._encodeSteps.push(a),this._decodeSteps.unshift(b)):(this._encodeSteps.splice(c,0,a),this._decodeSteps.splice(this._decodeSteps.length-c,0,b))}}),k.prototype.unwrap=function(a){var b,c=a.split("::fdb::");switch(c[0]){case"json":b=this.jParse(c[1]);break;case"raw":b=c[1]}},k.prototype._decode=function(a,b,c){var d,e;if(a){switch(d=a.split("::fdb::"),d[0]){case"json":e=this.jParse(d[1]);break;case"raw":e=d[1]}e?(b.foundData=!0,b.rowCount=e.length||0):(b.foundData=!1,b.rowCount=0),c&&c(!1,e,b)}else b.foundData=!1,b.rowCount=0,c&&c(!1,a,b)},k.prototype._encode=function(a,b,c){var d=a;a="object"==typeof a?"json::fdb::"+this.jStringify(a):"raw::fdb::"+a,d?(b.foundData=!0,b.rowCount=d.length||0):(b.foundData=!1,b.rowCount=0),c&&c(!1,a,b)},k.prototype.save=function(a,b,c){switch(this.mode()){case"localforage":this.encode(b,function(b,d,e){b?c(b):o.setItem(a,d).then(function(a){c&&c(!1,a,e)},function(a){c&&c(a)})});break;default:c&&c("No data handler.")}},k.prototype.load=function(a,b){var c=this;switch(this.mode()){case"localforage":o.getItem(a).then(function(a){c.decode(a,b)},function(a){b&&b(a)});break;default:b&&b("No data handler or unrecognised data type.")}},k.prototype.drop=function(a,b){switch(this.mode()){case"localforage":o.removeItem(a).then(function(){b&&b(!1)},function(a){b&&b(a)});break;default:b&&b("No data handler or unrecognised data type.")}},e.prototype.drop=new l({"":function(){this.isDropped()||this.drop(!0)},function:function(a){this.isDropped()||this.drop(!0,a)},boolean:function(a){if(!this.isDropped()){if(a){if(!this._name)throw"ForerunnerDB.Persist: Cannot drop a collection's persistent storage when no name assigned to collection!";this._db&&(this._db.persist.drop(this._db._name+"-"+this._name),this._db.persist.drop(this._db._name+"-"+this._name+"-metaData"))}f.call(this)}},"boolean, function":function(a,b){var c=this;if(!this.isDropped()){if(!a)return f.call(this,b);if(this._name){if(this._db)return this._db.persist.drop(this._db._name+"-"+this._name,function(){c._db.persist.drop(c._db._name+"-"+c._name+"-metaData",b)}),f.call(this);b&&b("Cannot drop a collection's persistent storage when the collection is not attached to a database!")}else b&&b("Cannot drop a collection's persistent storage when no name assigned to collection!")}}}),e.prototype.save=function(a){var b,c=this;c._name?c._db?(b=function(){c._db.persist.save(c._db._name+"-"+c._name,c._data,function(b,d,e){b?a&&a(b):c._db.persist.save(c._db._name+"-"+c._name+"-metaData",c.metaData(),function(b,f,g){a&&a(b,e,g,{tableData:d,metaData:f,tableDataName:c._db._name+"-"+c._name,metaDataName:c._db._name+"-"+c._name+"-metaData"})})})},c.isProcessingQueue()?c.on("queuesComplete",function(){b()}):b()):a&&a("Cannot save a collection that is not attached to a database!"):a&&a("Cannot save a collection with no assigned name!")},e.prototype.load=function(a){var b=this;b._name?b._db?b._db.persist.load(b._db._name+"-"+b._name,function(c,d,e){c?(b.deferEmit("load",e),a&&a(c)):b.remove({},function(){d=d||[],b.insert(d,function(){b._db.persist.load(b._db._name+"-"+b._name+"-metaData",function(c,d,f){c||d&&b.metaData(d),b.deferEmit("load",e,f),a&&a(c,e,f)})})})}):a&&a("Cannot load a collection that is not attached to a database!"):a&&a("Cannot load a collection with no assigned name!")},e.prototype.saveCustom=function(a){var b,c=this,d={};c._name?c._db?(b=function(){c.encode(c._data,function(b,e,f){b?a(b):(d.data={name:c._db._name+"-"+c._name,store:e,tableStats:f},c.encode(c._data,function(b,e,f){b?a(b):(d.metaData={name:c._db._name+"-"+c._name+"-metaData",store:e,tableStats:f},a(!1,d))}))})},c.isProcessingQueue()?c.on("queuesComplete",function(){b()}):b()):a&&a("Cannot save a collection that is not attached to a database!"):a&&a("Cannot save a collection with no assigned name!")},e.prototype.loadCustom=function(a,b){var c=this;c._name?c._db?a.data&&a.data.store?a.metaData&&a.metaData.store?c.decode(a.data.store,function(d,e,f){d?b(d):e&&(c.remove({}),c.insert(e),c.decode(a.metaData.store,function(a,d,e){a?b(a):d&&(c.metaData(d),b&&b(a,f,e))}))}):b('No "metaData" key found in passed object!'):b('No "data" key found in passed object!'):b&&b("Cannot load a collection that is not attached to a database!"):b&&b("Cannot load a collection with no assigned name!")},d.prototype.init=function(){i.apply(this,arguments),this.persist=new k(this)},d.prototype.load=new l({function:function(a){this.$main.call(this,{},a)},"object, function":function(a,b){this.$main.call(this,a,b)},$main:function(a,b){var c,d,e=this._collection,f=e.keys(),g=f.length;c=function(a){a?b&&b(a):(g--,0===g&&b&&b(!1))};for(d in e)e.hasOwnProperty(d)&&(a?e[d].loadCustom(a,c):e[d].load(c))}}),d.prototype.save=new l({function:function(a){this.$main.call(this,{},a)},"object, function":function(a,b){this.$main.call(this,a,b)},$main:function(a,b){var c,d,e=this._collection,f=e.keys(),g=f.length;c=function(a){a?b&&b(a):(g--,0===g&&b&&b(!1))};for(d in e)e.hasOwnProperty(d)&&(a.custom?e[d].saveCustom(c):e[d].save(c))}}),m.finishModule("Persist"),b.exports=k},{"./Collection":5,"./CollectionGroup":6,"./PersistCompress":30,"./PersistCrypto":31,"./Shared":34,async:37,localforage:75}],30:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("pako"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(a){},d.mixin(f.prototype,"Mixin.Common"),f.prototype.encode=function(a,b,c){var d,f,g,h={data:a,type:"fdbCompress",enabled:!1};d=a.length,g=e.deflate(a,{to:"string"}),f=g.length,f<d&&(h.data=g,h.enabled=!0),b.compression={enabled:h.enabled,compressedBytes:f,uncompressedBytes:d,effect:Math.round(100/d*f)+"%"},c(!1,this.jStringify(h),b)},f.prototype.decode=function(a,b,c){var d,f=!1;a?(a=this.jParse(a),a.enabled?(d=e.inflate(a.data,{to:"string"}),f=!0):(d=a.data,f=!1),b.compression={enabled:f},c&&c(!1,d,b)):c&&c(!1,d,b)},d.plugins.FdbCompress=f,b.exports=f},{"./Shared":34,pako:77}],31:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("crypto-js"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(a){if(!a||!a.pass)throw'Cannot initialise persistent storage encryption without a passphrase provided in the passed options object as the "pass" field.';this._algo=a.algo||"AES",this._pass=a.pass},d.mixin(f.prototype,"Mixin.Common"),d.synthesize(f.prototype,"pass"),f.prototype.stringify=function(a){var b={ct:a.ciphertext.toString(e.enc.Base64)};return a.iv&&(b.iv=a.iv.toString()),a.salt&&(b.s=a.salt.toString()),this.jStringify(b)},f.prototype.parse=function(a){var b=this.jParse(a),c=e.lib.CipherParams.create({ciphertext:e.enc.Base64.parse(b.ct)});return b.iv&&(c.iv=e.enc.Hex.parse(b.iv)),b.s&&(c.salt=e.enc.Hex.parse(b.s)),c},f.prototype.encode=function(a,b,c){var d,f=this,g={type:"fdbCrypto"};d=e[this._algo].encrypt(a,this._pass,{format:{stringify:function(){return f.stringify.apply(f,arguments)},parse:function(){return f.parse.apply(f,arguments)}}}),g.data=d.toString(),g.enabled=!0,b.encryption={enabled:g.enabled},c&&c(!1,this.jStringify(g),b)},f.prototype.decode=function(a,b,c){var d,f=this;a?(a=this.jParse(a),d=e[this._algo].decrypt(a.data,this._pass,{format:{stringify:function(){return f.stringify.apply(f,arguments)},parse:function(){return f.parse.apply(f,arguments)}}}).toString(e.enc.Utf8),c&&c(!1,d,b)):c&&c(!1,a,b)},d.plugins.FdbCrypto=f,b.exports=f},{"./Shared":34,"crypto-js":46}],32:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a,b,c){if(!(a&&b&&c))throw"ForerunnerDB.ReactorIO: ReactorIO requires in, out and process arguments to instantiate!";if(this._reactorIn=a,this._reactorOut=b,this._chainHandler=c,!a.chain)throw"ForerunnerDB.ReactorIO: ReactorIO requires passed in and out objects to implement the ChainReactor mixin!";a.chain(this),this.chain(b)};d.addModule("ReactorIO",e),e.prototype.drop=function(){return this.isDropped()||(this._state="dropped",this._reactorIn&&this._reactorIn.unChain(this),this._reactorOut&&this.unChain(this._reactorOut),delete this._reactorIn,delete this._reactorOut,delete this._chainHandler,this.emit("drop",this),delete this._listeners),!0},d.synthesize(e.prototype,"state"),d.mixin(e.prototype,"Mixin.Common"),d.mixin(e.prototype,"Mixin.ChainReactor"),d.mixin(e.prototype,"Mixin.Events"),d.finishModule("ReactorIO"),b.exports=e},{"./Shared":34}],33:[function(a,b,c){"use strict";var d=function(){this.init.apply(this,arguments)};d.prototype.init=function(){var a=this;this._encoder=[],this._decoder=[],this.registerHandler("$date",function(a){return a instanceof Date&&(a.toJSON=function(){return"$date:"+this.toISOString()},!0)},function(b){if("string"==typeof b&&0===b.indexOf("$date:"))return a.convert(new Date(b.substr(6)))}),this.registerHandler("$regexp",function(a){return a instanceof RegExp&&(a.toJSON=function(){return"$regexp:"+this.source.length+":"+this.source+":"+(this.global?"g":"")+(this.ignoreCase?"i":"")},!0)},function(b){if("string"==typeof b&&0===b.indexOf("$regexp:")){var c=b.substr(8),d=c.indexOf(":"),e=Number(c.substr(0,d)),f=c.substr(d+1,e),g=c.substr(d+e+2);return a.convert(new RegExp(f,g))}})},d.prototype.registerHandler=function(a,b,c){void 0!==a&&(this._encoder.push(b),this._decoder.push(c))},d.prototype.convert=function(a){var b,c=this._encoder;for(b=0;b<c.length;b++)if(c[b](a))return a;return a},d.prototype.reviver=function(){var a=this._decoder;return function(b,c){var d,e;for(e=0;e<a.length;e++)if(d=a[e](c),void 0!==d)return d;return c}},b.exports=d},{}],34:[function(a,b,c){"use strict";var d=a("./Overload"),e={version:"1.3.875",modules:{},plugins:{},index:{},_synth:{},addModule:function(a,b){this.modules[a]=b,this.emit("moduleLoad",[a,b])},finishModule:function(a){if(!this.modules[a])throw"ForerunnerDB.Shared: finishModule called on a module that has not been registered with addModule(): "+a;this.modules[a]._fdbFinished=!0,this.modules[a].prototype?this.modules[a].prototype.className=a:this.modules[a].className=a,this.emit("moduleFinished",[a,this.modules[a]])},moduleFinished:function(a,b){this.modules[a]&&this.modules[a]._fdbFinished?b&&b(a,this.modules[a]):this.on("moduleFinished",b)},moduleExists:function(a){return Boolean(this.modules[a])},mixin:new d({"object, string":function(a,b){var c;if("string"==typeof b&&(c=this.mixins[b],!c))throw"ForerunnerDB.Shared: Cannot find mixin named: "+b;return this.$main.call(this,a,c)},"object, *":function(a,b){return this.$main.call(this,a,b)},$main:function(a,b){if(b&&"object"==typeof b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}}),synthesize:function(a,b,c){if(this._synth[b]=this._synth[b]||function(a){return void 0!==a?(this["_"+b]=a,this):this["_"+b]},c){var d=this;a[b]=function(){var a,e=this.$super;return this.$super=d._synth[b],a=c.apply(this,arguments),this.$super=e,a}}else a[b]=this._synth[b]},overload:d,mixins:{"Mixin.Common":a("./Mixin.Common"),"Mixin.Events":a("./Mixin.Events"),"Mixin.ChainReactor":a("./Mixin.ChainReactor"),"Mixin.CRUD":a("./Mixin.CRUD"),"Mixin.Constants":a("./Mixin.Constants"),"Mixin.Triggers":a("./Mixin.Triggers"),"Mixin.Sorting":a("./Mixin.Sorting"),"Mixin.Matching":a("./Mixin.Matching"),"Mixin.Updating":a("./Mixin.Updating"),"Mixin.Tags":a("./Mixin.Tags")}};e.mixin(e,"Mixin.Events"),b.exports=e},{"./Mixin.CRUD":16,"./Mixin.ChainReactor":17,"./Mixin.Common":18,"./Mixin.Constants":19,"./Mixin.Events":20,"./Mixin.Matching":21,"./Mixin.Sorting":22,"./Mixin.Tags":23,"./Mixin.Triggers":24,"./Mixin.Updating":25,"./Overload":27}],35:[function(a,b,c){Array.prototype.filter||(Array.prototype.filter=function(a){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=arguments.length>=2?arguments[1]:void 0,f=0;f<c;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g)}return d}),"function"!=typeof Object.create&&(Object.create=function(){var a=function(){};return function(b){if(arguments.length>1)throw Error("Second argument not supported");if("object"!=typeof b)throw TypeError("Argument must be an object");a.prototype=b;var c=new a;return a.prototype=null,c}}()),Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var c;if(null===this)throw new TypeError('"this" is null or not defined');var d=Object(this),e=d.length>>>0;if(0===e)return-1;var f=+b||0;if(Math.abs(f)===1/0&&(f=0),f>=e)return-1;for(c=Math.max(f>=0?f:e-Math.abs(f),0);c<e;){if(c in d&&d[c]===a)return c;c++}return-1}),b.exports={}},{}],36:[function(a,b,c){(function(a){function c(){for(;e.next;){e=e.next;var a=e.task;e.task=void 0;var b=e.domain;b&&(e.domain=void 0,b.enter());try{a()}catch(a){if(i)throw b&&b.exit(),setTimeout(c,0),b&&b.enter(),a;setTimeout(function(){throw a},0)}b&&b.exit()}g=!1}function d(b){f=f.next={task:b,domain:i&&a.domain,next:null},g||(g=!0,h())}var e={task:void 0,next:null},f=e,g=!1,h=void 0,i=!1;if("undefined"!=typeof a&&a.nextTick)i=!0,h=function(){a.nextTick(c)};else if("function"==typeof setImmediate)h="undefined"!=typeof window?setImmediate.bind(window,c):function(){setImmediate(c)};else if("undefined"!=typeof MessageChannel){var j=new MessageChannel;j.port1.onmessage=c,h=function(){j.port2.postMessage(0)}}else h=function(){setTimeout(c,0)};b.exports=d}).call(this,a("_process"))},{_process:93}],37:[function(a,b,c){(function(a,d){!function(a,d){"object"==typeof c&&"undefined"!=typeof b?d(c):"function"==typeof define&&define.amd?define(["exports"],d):d(a.async=a.async||{})}(this,function(b){"use strict";function c(a,b,c){var d=c.length;switch(d){case 0:return a.call(b);case 1:return a.call(b,c[0]);case 2:return a.call(b,c[0],c[1]);case 3:return a.call(b,c[0],c[1],c[2])}return a.apply(b,c)}function e(a){var b=typeof a;return!!a&&("object"==b||"function"==b)}function f(a){var b=e(a)?mb.call(a):"";return b==jb||b==kb}function g(a){return!!a&&"object"==typeof a}function h(a){return"symbol"==typeof a||g(a)&&pb.call(a)==nb}function i(a){if("number"==typeof a)return a;if(h(a))return qb;if(e(a)){var b=f(a.valueOf)?a.valueOf():a;a=e(b)?b+"":b}if("string"!=typeof a)return 0===a?a:+a;a=a.replace(rb,"");var c=tb.test(a);return c||ub.test(a)?vb(a.slice(2),c?2:8):sb.test(a)?qb:+a}function j(a){if(!a)return 0===a?a:0;if(a=i(a),a===wb||a===-wb){var b=a<0?-1:1;return b*xb}return a===a?a:0}function k(a){var b=j(a),c=b%1;return b===b?c?b-c:b:0}function l(a,b){if("function"!=typeof a)throw new TypeError(yb);return b=zb(void 0===b?a.length-1:k(b),0),function(){for(var d=arguments,e=-1,f=zb(d.length-b,0),g=Array(f);++e<f;)g[e]=d[b+e];switch(b){case 0:return a.call(this,g);case 1:return a.call(this,d[0],g);case 2:return a.call(this,d[0],d[1],g)}var h=Array(b+1);for(e=-1;++e<b;)h[e]=d[e];return h[b]=g,c(a,this,h)}}function m(a){return l(function(b){var c=b.pop();a.call(this,b,c)})}function n(a){return l(function(b,c){var d=m(function(c,d){var e=this;return a(b,function(a,b){a.apply(e,c.concat([b]))},d)});return c.length?d.apply(this,c):d})}function o(a){return function(b){return null==b?void 0:b[a]}}function p(a){return"number"==typeof a&&a>-1&&a%1==0&&a<=Bb}function q(a){return null!=a&&p(Ab(a))&&!f(a)}function r(){}function s(a){return function(){if(null!==a){var b=a;a=null,b.apply(this,arguments)}}}function t(a){return Cb&&a[Cb]&&a[Cb]()}function u(a){return Db(Object(a))}function v(a,b){return null!=a&&(Fb.call(a,b)||"object"==typeof a&&b in a&&null===u(a))}function w(a){return Gb(Object(a))}function x(a,b){for(var c=-1,d=Array(a);++c<a;)d[c]=b(c);return d}function y(a){return g(a)&&q(a)}function z(a){return y(a)&&Jb.call(a,"callee")&&(!Lb.call(a,"callee")||Kb.call(a)==Hb)}function A(a){return"string"==typeof a||!Mb(a)&&g(a)&&Pb.call(a)==Nb}function B(a){var b=a?a.length:void 0;return p(b)&&(Mb(a)||A(a)||z(a))?x(b,String):null}function C(a,b){return b=null==b?Qb:b,!!b&&("number"==typeof a||Rb.test(a))&&a>-1&&a%1==0&&a<b}function D(a){var b=a&&a.constructor,c="function"==typeof b&&b.prototype||Sb;return a===c}function E(a){var b=D(a);if(!b&&!q(a))return w(a);var c=B(a),d=!!c,e=c||[],f=e.length;for(var g in a)!v(a,g)||d&&("length"==g||C(g,f))||b&&"constructor"==g||e.push(g);return e}function F(a){var b=-1,c=a.length;return function(){return++b<c?{value:a[b],key:b}:null}}function G(a){var b=-1;return function(){var c=a.next();return c.done?null:(b++,{value:c.value,key:b})}}function H(a){var b=E(a),c=-1,d=b.length;return function(){var e=b[++c];return c<d?{value:a[e],key:e}:null}}function I(a){if(q(a))return F(a);var b=t(a);return b?G(b):H(a)}function J(a){return function(){if(null===a)throw new Error("Callback was already called.");var b=a;a=null,b.apply(this,arguments)}}function K(a){return function(b,c,d){function e(a){if(i-=1,a)h=!0,d(a);else{if(h&&i<=0)return d(null);f()}}function f(){for(;i<a&&!h;){var b=g();if(null===b)return h=!0,void(i<=0&&d(null));i+=1,c(b.value,b.key,J(e))}}if(d=s(d||r),a<=0||!b)return d(null);var g=I(b),h=!1,i=0;f()}}function L(a,b,c,d){K(b)(a,c,d)}function M(a,b){return function(c,d,e){return a(c,b,d,e)}}function N(a,b){var c;if("function"!=typeof b)throw new TypeError(Tb);return a=k(a),function(){return--a>0&&(c=b.apply(this,arguments)),a<=1&&(b=void 0),c}}function O(a){return N(2,a)}function P(a,b,c){function d(a){a?c(a):++f===g&&c(null)}c=O(c||r);var e=0,f=0,g=a.length;for(0===g&&c(null);e<g;e++)b(a[e],e,J(d))}function Q(a,b,c){var d=q(a)?P:Ub;d(a,b,c)}function R(a){return function(b,c,d){return a(Q,b,c,d)}}function S(a,b,c,d){d=s(d||r),b=b||[];var e=[],f=0;a(b,function(a,b,d){var g=f++;c(a,function(a,b){e[g]=b,d(a)})},function(a){d(a,e)})}function T(a){return function(b,c,d,e){return a(K(c),b,d,e)}}function U(a){return m(function(b,c){var d;try{d=a.apply(this,b)}catch(a){return c(a)}e(d)&&"function"==typeof d.then?d.then(function(a){c(null,a)},function(a){c(a.message?a:new Error(a))}):c(null,d)})}function V(a,b){for(var c=-1,d=a?a.length:0;++c<d&&b(a[c],c,a)!==!1;);return a}function W(a){return function(b,c,d){for(var e=-1,f=Object(b),g=d(b),h=g.length;h--;){var i=g[a?h:++e];if(c(f[i],i,f)===!1)break}return b}}function X(a,b){return a&&_b(a,b,E)}function Y(a,b,c){for(var d=a.length,e=b+(c?1:-1);c?e--:++e<d;){var f=a[e];if(f!==f)return e}return-1}function Z(a,b,c){if(b!==b)return Y(a,c);for(var d=c-1,e=a.length;++d<e;)if(a[d]===b)return d;return-1}function $(a,b,c){function d(a,b){t.push(function(){h(a,b)})}function e(){if(0===t.length&&0===o)return c(null,n);for(;t.length&&o<b;){var a=t.shift();a()}}function f(a,b){var c=q[a];c||(c=q[a]=[]),c.push(b)}function g(a){var b=q[a]||[];V(b,function(a){a()}),e()}function h(a,b){if(!p){var d=J(l(function(b,d){if(o--,d.length<=1&&(d=d[0]),b){var e={};X(n,function(a,b){e[b]=a}),e[a]=d,p=!0,q=[],c(b,e)}else n[a]=d,g(a)}));o++;var e=b[b.length-1];b.length>1?e(n,d):e(d)}}function i(){for(var a,b=0;u.length;)a=u.pop(),b++,V(j(a),function(a){0===--v[a]&&u.push(a)});if(b!==m)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function j(b){var c=[];return X(a,function(a,d){Mb(a)&&Z(a,b,0)>=0&&c.push(d)}),c}"function"==typeof b&&(c=b,b=null),c=s(c||r);var k=E(a),m=k.length;if(!m)return c(null);b||(b=m);var n={},o=0,p=!1,q={},t=[],u=[],v={};X(a,function(b,c){if(!Mb(b))return d(c,[b]),void u.push(c);var e=b.slice(0,b.length-1),g=e.length;return 0===g?(d(c,b),void u.push(c)):(v[c]=g,void V(e,function(h){if(!a[h])throw new Error("async.auto task `"+c+"` has a non-existent dependency in "+e.join(", "));f(h,function(){g--,0===g&&d(c,b)})}))}),i(),e()}function _(a,b){for(var c=-1,d=a?a.length:0,e=Array(d);++c<d;)e[c]=b(a[c],c,a);return e}function aa(a,b){var c=-1,d=a.length;for(b||(b=Array(d));++c<d;)b[c]=a[c];return b}function ba(a){return a&&a.Object===Object?a:null}function ca(a){if("string"==typeof a)return a;if(h(a))return hc?hc.call(a):"";var b=a+"";return"0"==b&&1/a==-fc?"-0":b}function da(a,b,c){var d=-1,e=a.length;b<0&&(b=-b>e?0:e+b),c=c>e?e:c,c<0&&(c+=e),e=b>c?0:c-b>>>0,b>>>=0;for(var f=Array(e);++d<e;)f[d]=a[d+b];return f}function ea(a,b,c){var d=a.length;return c=void 0===c?d:c,!b&&c>=d?a:da(a,b,c)}function fa(a,b){for(var c=a.length;c--&&Z(b,a[c],0)>-1;);return c}function ga(a,b){for(var c=-1,d=a.length;++c<d&&Z(b,a[c],0)>-1;);return c}function ha(a){return a.match(zc)}function ia(a){return null==a?"":ca(a)}function ja(a,b,c){if(a=ia(a),a&&(c||void 0===b))return a.replace(Ac,"");if(!a||!(b=ca(b)))return a;var d=ha(a),e=ha(b),f=ga(d,e),g=fa(d,e)+1;return ea(d,f,g).join("")}function ka(a){return a=a.toString().replace(Ec,""),a=a.match(Bc)[2].replace(" ",""),a=a?a.split(Cc):[],a=a.map(function(a){return ja(a.replace(Dc,""))})}function la(a,b){var c={};X(a,function(a,b){function d(b,c){var d=_(e,function(a){return b[a]});d.push(c),a.apply(null,d)}var e;if(Mb(a))e=aa(a),a=e.pop(),c[b]=e.concat(e.length>0?d:a);else if(1===a.length)c[b]=a;else{if(e=ka(a),0===a.length&&0===e.length)throw new Error("autoInject task functions require explicit parameters.");e.pop(),c[b]=e.concat(d)}}),$(c,b)}function ma(a){setTimeout(a,0)}function na(a){return l(function(b,c){a(function(){b.apply(null,c)})})}function oa(){this.head=this.tail=null,this.length=0}function pa(a,b){a.length=1,a.head=a.tail=b}function qa(a,b,c){function d(a,b,c){if(null!=c&&"function"!=typeof c)throw new Error("task callback must be a function");return h.started=!0,Mb(a)||(a=[a]),0===a.length&&h.idle()?Hc(function(){h.drain()}):(V(a,function(a){var d={data:a,callback:c||r};b?h._tasks.unshift(d):h._tasks.push(d)}),void Hc(h.process))}function e(a){return l(function(b){f-=1,V(a,function(a){V(g,function(b,c){if(b===a)return g.splice(c,1),!1}),a.callback.apply(a,b),null!=b[0]&&h.error(b[0],a.data)}),f<=h.concurrency-h.buffer&&h.unsaturated(),h.idle()&&h.drain(),h.process()})}if(null==b)b=1;else if(0===b)throw new Error("Concurrency must not be zero");var f=0,g=[],h={_tasks:new oa,concurrency:b,payload:c,saturated:r,unsaturated:r,buffer:b/4,empty:r,drain:r,error:r,started:!1,paused:!1,push:function(a,b){d(a,!1,b)},kill:function(){h.drain=r,h._tasks.empty()},unshift:function(a,b){d(a,!0,b)},process:function(){for(;!h.paused&&f<h.concurrency&&h._tasks.length;){var b=[],c=[],d=h._tasks.length;h.payload&&(d=Math.min(d,h.payload));for(var i=0;i<d;i++){var j=h._tasks.shift();b.push(j),c.push(j.data)}0===h._tasks.length&&h.empty(),f+=1,g.push(b[0]),f===h.concurrency&&h.saturated();var k=J(e(b));a(c,k)}},length:function(){return h._tasks.length},running:function(){return f},workersList:function(){return g},idle:function(){return h._tasks.length+f===0},pause:function(){h.paused=!0},resume:function(){if(h.paused!==!1){h.paused=!1;for(var a=Math.min(h.concurrency,h._tasks.length),b=1;b<=a;b++)Hc(h.process)}}};return h}function ra(a,b){return qa(a,1,b)}function sa(a,b,c,d){d=s(d||r),Jc(a,function(a,d,e){c(b,a,function(a,c){b=c,e(a)})},function(a){d(a,b)})}function ta(a,b,c,d){var e=[];a(b,function(a,b,d){c(a,function(a,b){e=e.concat(b||[]),d(a)})},function(a){d(a,e)})}function ua(a){return function(b,c,d){return a(Jc,b,c,d)}}function va(a){return a}function wa(a,b,c){return function(d,e,f,g){function h(a){g&&(a?g(a):g(null,c(!1)))}function i(a,d,e){return g?void f(a,function(d,h){g&&(d?(g(d),g=f=!1):b(h)&&(g(null,c(!0,a)),g=f=!1)),e()}):e()}arguments.length>3?(g=g||r,a(d,e,i,h)):(g=f,g=g||r,f=e,a(d,i,h))}}function xa(a,b){return b}function ya(a){return l(function(b,c){b.apply(null,c.concat([l(function(b,c){"object"==typeof console&&(b?console.error&&console.error(b):console[a]&&V(c,function(b){console[a](b)}))})]))})}function za(a,b,c){function d(b,d){return b?c(b):d?void a(e):c(null)}c=J(c||r);var e=l(function(a,e){return a?c(a):(e.push(d),void b.apply(this,e))});d(null,!0)}function Aa(a,b,c){c=J(c||r);var d=l(function(e,f){return e?c(e):b.apply(this,f)?a(d):void c.apply(null,[null].concat(f))});a(d)}function Ba(a,b,c){Aa(a,function(){return!b.apply(this,arguments)},c)}function Ca(a,b,c){function d(b){return b?c(b):void a(e)}function e(a,e){return a?c(a):e?void b(d):c(null)}c=J(c||r),a(e)}function Da(a){return function(b,c,d){return a(b,d)}}function Ea(a,b,c){Q(a,Da(b),c)}function Fa(a,b,c,d){K(b)(a,Da(c),d)}function Ga(a){return m(function(b,c){var d=!0;b.push(function(){var a=arguments;d?Hc(function(){c.apply(null,a)}):c.apply(null,a)}),a.apply(this,b),d=!1})}function Ha(a){return!a}function Ia(a,b,c,d){d=s(d||r);var e=[];a(b,function(a,b,d){c(a,function(c,f){c?d(c):(f&&e.push({index:b,value:a}),d())})},function(a){a?d(a):d(null,_(e.sort(function(a,b){return a.index-b.index}),o("value")))})}function Ja(a,b){function c(a){return a?d(a):void e(c)}var d=J(b||r),e=Ga(a);c()}function Ka(a,b,c,d){d=s(d||r);var e={};L(a,b,function(a,b,d){c(a,b,function(a,c){return a?d(a):(e[b]=c,void d())})},function(a){d(a,e)})}function La(a,b){return b in a}function Ma(a,b){var c=Object.create(null),d=Object.create(null);b=b||va;var e=m(function(e,f){var g=b.apply(null,e);La(c,g)?Hc(function(){f.apply(null,c[g])}):La(d,g)?d[g].push(f):(d[g]=[f],a.apply(null,e.concat([l(function(a){c[g]=a;var b=d[g];delete d[g];for(var e=0,f=b.length;e<f;e++)b[e].apply(null,a)})])))});return e.memo=c,e.unmemoized=a,e}function Na(a,b,c){c=c||r;var d=q(b)?[]:{};a(b,function(a,b,c){a(l(function(a,e){e.length<=1&&(e=e[0]),d[b]=e,c(a)}))},function(a){c(a,d)})}function Oa(a,b){Na(Q,a,b)}function Pa(a,b,c){Na(K(b),a,c)}function Qa(a,b){return qa(function(b,c){a(b[0],c)},b,1)}function Ra(a,b){var c=Qa(a,b);return c.push=function(a,b,d){if(null==d&&(d=r),"function"!=typeof d)throw new Error("task callback must be a function");if(c.started=!0,Mb(a)||(a=[a]),0===a.length)return Hc(function(){c.drain()});b=b||0;for(var e=c._tasks.head;e&&b>=e.priority;)e=e.next;V(a,function(a){var f={data:a,priority:b,callback:d};e?c._tasks.insertBefore(e,f):c._tasks.push(f)}),Hc(c.process)},delete c.unshift,c}function Sa(a,b){return b=s(b||r),Mb(a)?a.length?void V(a,function(a){a(b)}):b():b(new TypeError("First argument to race must be an array of functions"))}function Ta(a,b,c,d){var e=cd.call(a).reverse();sa(e,b,c,d)}function Ua(a){return m(function(b,c){return b.push(l(function(a,b){if(a)c(null,{error:a});else{var d=null;1===b.length?d=b[0]:b.length>1&&(d=b),c(null,{value:d})}})),a.apply(this,b)})}function Va(a,b,c,d){Ia(a,b,function(a,b){c(a,function(a,c){a?b(a):b(null,!c)})},d)}function Wa(a){var b;return Mb(a)?b=_(a,Ua):(b={},X(a,function(a,c){b[c]=Ua.call(this,a)})),b}function Xa(a){return function(){return a}}function Ya(a,b,c){function d(a,b){if("object"==typeof b)a.times=+b.times||f,a.intervalFunc="function"==typeof b.interval?b.interval:Xa(+b.interval||g);else{if("number"!=typeof b&&"string"!=typeof b)throw new Error("Invalid arguments for async.retry");a.times=+b||f}}function e(){b(function(a){a&&i++<h.times?setTimeout(e,h.intervalFunc(i)):c.apply(null,arguments)})}var f=5,g=0,h={times:f,intervalFunc:Xa(g)};if(arguments.length<3&&"function"==typeof a?(c=b||r,b=a):(d(h,a),c=c||r),"function"!=typeof b)throw new Error("Invalid arguments for async.retry");var i=1;e()}function Za(a,b){return b||(b=a,a=null),m(function(c,d){function e(a){b.apply(null,c.concat([a]))}a?Ya(a,e,d):Ya(e,d)})}function $a(a,b){Na(Jc,a,b)}function _a(a,b,c){function d(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}Vb(a,function(a,c){b(a,function(b,d){return b?c(b):void c(null,{value:a,criteria:d})})},function(a,b){return a?c(a):void c(null,_(b.sort(d),o("value")))})}function ab(a,b,c){function d(){h||(f.apply(null,arguments),clearTimeout(g))}function e(){var b=a.name||"anonymous",d=new Error('Callback function "'+b+'" timed out.');d.code="ETIMEDOUT",c&&(d.info=c),h=!0,f(d)}var f,g,h=!1;return m(function(c,h){f=h,g=setTimeout(e,b),a.apply(null,c.concat(d))})}function bb(a,b,c,d){for(var e=-1,f=kd(jd((b-a)/(c||1)),0),g=Array(f);f--;)g[d?f:++e]=a,a+=c;return g}function cb(a,b,c,d){Xb(bb(0,a,1),b,c,d)}function db(a,b,c,d){3===arguments.length&&(d=c,c=b,b=Mb(a)?[]:{}),d=s(d||r),Q(a,function(a,d,e){c(b,a,d,e)},function(a){d(a,b)})}function eb(a){return function(){return(a.unmemoized||a).apply(null,arguments)}}function fb(a,b,c){if(c=J(c||r),!a())return c(null);var d=l(function(e,f){return e?c(e):a()?b(d):void c.apply(null,[null].concat(f))});b(d)}function gb(a,b,c){fb(function(){return!a.apply(this,arguments)},b,c)}function hb(a,b){
function c(e){if(d===a.length)return b.apply(null,[null].concat(e));var f=J(l(function(a,d){return a?b.apply(null,[a].concat(d)):void c(d)}));e.push(f);var g=a[d++];g.apply(null,e)}if(b=s(b||r),!Mb(a))return b(new Error("First argument to waterfall must be an array of functions"));if(!a.length)return b();var d=0;c([])}var ib,jb="[object Function]",kb="[object GeneratorFunction]",lb=Object.prototype,mb=lb.toString,nb="[object Symbol]",ob=Object.prototype,pb=ob.toString,qb=NaN,rb=/^\s+|\s+$/g,sb=/^[-+]0x[0-9a-f]+$/i,tb=/^0b[01]+$/i,ub=/^0o[0-7]+$/i,vb=parseInt,wb=1/0,xb=1.7976931348623157e308,yb="Expected a function",zb=Math.max,Ab=o("length"),Bb=9007199254740991,Cb="function"==typeof Symbol&&Symbol.iterator,Db=Object.getPrototypeOf,Eb=Object.prototype,Fb=Eb.hasOwnProperty,Gb=Object.keys,Hb="[object Arguments]",Ib=Object.prototype,Jb=Ib.hasOwnProperty,Kb=Ib.toString,Lb=Ib.propertyIsEnumerable,Mb=Array.isArray,Nb="[object String]",Ob=Object.prototype,Pb=Ob.toString,Qb=9007199254740991,Rb=/^(?:0|[1-9]\d*)$/,Sb=Object.prototype,Tb="Expected a function",Ub=M(L,1/0),Vb=R(S),Wb=n(Vb),Xb=T(S),Yb=M(Xb,1),Zb=n(Yb),$b=l(function(a,b){return l(function(c){return a.apply(null,b.concat(c))})}),_b=W(),ac=ba("object"==typeof d&&d),bc=ba("object"==typeof self&&self),cc=ba("object"==typeof this&&this),dc=ac||bc||cc||Function("return this")(),ec=dc.Symbol,fc=1/0,gc=ec?ec.prototype:void 0,hc=gc?gc.toString:void 0,ic="\\ud800-\\udfff",jc="\\u0300-\\u036f\\ufe20-\\ufe23",kc="\\u20d0-\\u20f0",lc="\\ufe0e\\ufe0f",mc="["+ic+"]",nc="["+jc+kc+"]",oc="\\ud83c[\\udffb-\\udfff]",pc="(?:"+nc+"|"+oc+")",qc="[^"+ic+"]",rc="(?:\\ud83c[\\udde6-\\uddff]){2}",sc="[\\ud800-\\udbff][\\udc00-\\udfff]",tc="\\u200d",uc=pc+"?",vc="["+lc+"]?",wc="(?:"+tc+"(?:"+[qc,rc,sc].join("|")+")"+vc+uc+")*",xc=vc+uc+wc,yc="(?:"+[qc+nc+"?",nc,rc,sc,mc].join("|")+")",zc=RegExp(oc+"(?="+oc+")|"+yc+xc,"g"),Ac=/^\s+|\s+$/g,Bc=/^(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,Cc=/,/,Dc=/(=.+)?(\s*)$/,Ec=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,Fc="function"==typeof setImmediate&&setImmediate,Gc="object"==typeof a&&"function"==typeof a.nextTick;ib=Fc?setImmediate:Gc?a.nextTick:ma;var Hc=na(ib);oa.prototype.removeLink=function(a){return a.prev?a.prev.next=a.next:this.head=a.next,a.next?a.next.prev=a.prev:this.tail=a.prev,a.prev=a.next=null,this.length-=1,a},oa.prototype.empty=oa,oa.prototype.insertAfter=function(a,b){b.prev=a,b.next=a.next,a.next?a.next.prev=b:this.tail=b,a.next=b,this.length+=1},oa.prototype.insertBefore=function(a,b){b.prev=a.prev,b.next=a,a.prev?a.prev.next=b:this.head=b,a.prev=b,this.length+=1},oa.prototype.unshift=function(a){this.head?this.insertBefore(this.head,a):pa(this,a)},oa.prototype.push=function(a){this.tail?this.insertAfter(this.tail,a):pa(this,a)},oa.prototype.shift=function(){return this.head&&this.removeLink(this.head)},oa.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)};var Ic,Jc=M(L,1),Kc=l(function(a){return l(function(b){var c=this,d=b[b.length-1];"function"==typeof d?b.pop():d=r,sa(a,b,function(a,b,d){b.apply(c,a.concat([l(function(a,b){d(a,b)})]))},function(a,b){d.apply(c,[a].concat(b))})})}),Lc=l(function(a){return Kc.apply(null,a.reverse())}),Mc=R(ta),Nc=ua(ta),Oc=l(function(a){var b=[null].concat(a);return m(function(a,c){return c.apply(this,b)})}),Pc=wa(Q,va,xa),Qc=wa(L,va,xa),Rc=wa(Jc,va,xa),Sc=ya("dir"),Tc=M(Fa,1),Uc=wa(Q,Ha,Ha),Vc=wa(L,Ha,Ha),Wc=M(Vc,1),Xc=R(Ia),Yc=T(Ia),Zc=M(Yc,1),$c=ya("log"),_c=M(Ka,1/0),ad=M(Ka,1);Ic=Gc?a.nextTick:Fc?setImmediate:ma;var bd=na(Ic),cd=Array.prototype.slice,dd=R(Va),ed=T(Va),fd=M(ed,1),gd=wa(Q,Boolean,va),hd=wa(L,Boolean,va),id=M(hd,1),jd=Math.ceil,kd=Math.max,ld=M(cb,1/0),md=M(cb,1),nd={applyEach:Wb,applyEachSeries:Zb,apply:$b,asyncify:U,auto:$,autoInject:la,cargo:ra,compose:Lc,concat:Mc,concatSeries:Nc,constant:Oc,detect:Pc,detectLimit:Qc,detectSeries:Rc,dir:Sc,doDuring:za,doUntil:Ba,doWhilst:Aa,during:Ca,each:Ea,eachLimit:Fa,eachOf:Q,eachOfLimit:L,eachOfSeries:Jc,eachSeries:Tc,ensureAsync:Ga,every:Uc,everyLimit:Vc,everySeries:Wc,filter:Xc,filterLimit:Yc,filterSeries:Zc,forever:Ja,log:$c,map:Vb,mapLimit:Xb,mapSeries:Yb,mapValues:_c,mapValuesLimit:Ka,mapValuesSeries:ad,memoize:Ma,nextTick:bd,parallel:Oa,parallelLimit:Pa,priorityQueue:Ra,queue:Qa,race:Sa,reduce:sa,reduceRight:Ta,reflect:Ua,reflectAll:Wa,reject:dd,rejectLimit:ed,rejectSeries:fd,retry:Ya,retryable:Za,seq:Kc,series:$a,setImmediate:Hc,some:gd,someLimit:hd,someSeries:id,sortBy:_a,timeout:ab,times:ld,timesLimit:cb,timesSeries:md,transform:db,unmemoize:eb,until:gb,waterfall:hb,whilst:fb,all:Uc,any:gd,forEach:Ea,forEachSeries:Tc,forEachLimit:Fa,forEachOf:Q,forEachOfSeries:Jc,forEachOfLimit:L,inject:sa,foldl:sa,foldr:Ta,select:Xc,selectLimit:Yc,selectSeries:Zc,wrapSync:U};b.default=nd,b.applyEach=Wb,b.applyEachSeries=Zb,b.apply=$b,b.asyncify=U,b.auto=$,b.autoInject=la,b.cargo=ra,b.compose=Lc,b.concat=Mc,b.concatSeries=Nc,b.constant=Oc,b.detect=Pc,b.detectLimit=Qc,b.detectSeries=Rc,b.dir=Sc,b.doDuring=za,b.doUntil=Ba,b.doWhilst=Aa,b.during=Ca,b.each=Ea,b.eachLimit=Fa,b.eachOf=Q,b.eachOfLimit=L,b.eachOfSeries=Jc,b.eachSeries=Tc,b.ensureAsync=Ga,b.every=Uc,b.everyLimit=Vc,b.everySeries=Wc,b.filter=Xc,b.filterLimit=Yc,b.filterSeries=Zc,b.forever=Ja,b.log=$c,b.map=Vb,b.mapLimit=Xb,b.mapSeries=Yb,b.mapValues=_c,b.mapValuesLimit=Ka,b.mapValuesSeries=ad,b.memoize=Ma,b.nextTick=bd,b.parallel=Oa,b.parallelLimit=Pa,b.priorityQueue=Ra,b.queue=Qa,b.race=Sa,b.reduce=sa,b.reduceRight=Ta,b.reflect=Ua,b.reflectAll=Wa,b.reject=dd,b.rejectLimit=ed,b.rejectSeries=fd,b.retry=Ya,b.retryable=Za,b.seq=Kc,b.series=$a,b.setImmediate=Hc,b.some=gd,b.someLimit=hd,b.someSeries=id,b.sortBy=_a,b.timeout=ab,b.times=ld,b.timesLimit=cb,b.timesSeries=md,b.transform=db,b.unmemoize=eb,b.until=gb,b.waterfall=hb,b.whilst=fb,b.all=Uc,b.allLimit=Vc,b.allSeries=Wc,b.any=gd,b.anyLimit=hd,b.anySeries=id,b.find=Pc,b.findLimit=Qc,b.findSeries=Rc,b.forEach=Ea,b.forEachSeries=Tc,b.forEachLimit=Fa,b.forEachOf=Q,b.forEachOfSeries=Jc,b.forEachOfLimit=L,b.inject=sa,b.foldl=sa,b.foldr=Ta,b.select=Xc,b.selectLimit=Yc,b.selectSeries=Zc,b.wrapSync=U})}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:93}],38:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./enc-base64"),a("./md5"),a("./evpkdf"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return function(){var b=a,c=b.lib,d=c.BlockCipher,e=b.algo,f=[],g=[],h=[],i=[],j=[],k=[],l=[],m=[],n=[],o=[];!function(){for(var a=[],b=0;b<256;b++)b<128?a[b]=b<<1:a[b]=b<<1^283;for(var c=0,d=0,b=0;b<256;b++){var e=d^d<<1^d<<2^d<<3^d<<4;e=e>>>8^255&e^99,f[c]=e,g[e]=c;var p=a[c],q=a[p],r=a[q],s=257*a[e]^16843008*e;h[c]=s<<24|s>>>8,i[c]=s<<16|s>>>16,j[c]=s<<8|s>>>24,k[c]=s;var s=16843009*r^65537*q^257*p^16843008*c;l[e]=s<<24|s>>>8,m[e]=s<<16|s>>>16,n[e]=s<<8|s>>>24,o[e]=s,c?(c=p^a[a[a[r^p]]],d^=a[a[d]]):c=d=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],q=e.AES=d.extend({_doReset:function(){for(var a=this._key,b=a.words,c=a.sigBytes/4,d=this._nRounds=c+6,e=4*(d+1),g=this._keySchedule=[],h=0;h<e;h++)if(h<c)g[h]=b[h];else{var i=g[h-1];h%c?c>6&&h%c==4&&(i=f[i>>>24]<<24|f[i>>>16&255]<<16|f[i>>>8&255]<<8|f[255&i]):(i=i<<8|i>>>24,i=f[i>>>24]<<24|f[i>>>16&255]<<16|f[i>>>8&255]<<8|f[255&i],i^=p[h/c|0]<<24),g[h]=g[h-c]^i}for(var j=this._invKeySchedule=[],k=0;k<e;k++){var h=e-k;if(k%4)var i=g[h];else var i=g[h-4];k<4||h<=4?j[k]=i:j[k]=l[f[i>>>24]]^m[f[i>>>16&255]]^n[f[i>>>8&255]]^o[f[255&i]]}},encryptBlock:function(a,b){this._doCryptBlock(a,b,this._keySchedule,h,i,j,k,f)},decryptBlock:function(a,b){var c=a[b+1];a[b+1]=a[b+3],a[b+3]=c,this._doCryptBlock(a,b,this._invKeySchedule,l,m,n,o,g);var c=a[b+1];a[b+1]=a[b+3],a[b+3]=c},_doCryptBlock:function(a,b,c,d,e,f,g,h){for(var i=this._nRounds,j=a[b]^c[0],k=a[b+1]^c[1],l=a[b+2]^c[2],m=a[b+3]^c[3],n=4,o=1;o<i;o++){var p=d[j>>>24]^e[k>>>16&255]^f[l>>>8&255]^g[255&m]^c[n++],q=d[k>>>24]^e[l>>>16&255]^f[m>>>8&255]^g[255&j]^c[n++],r=d[l>>>24]^e[m>>>16&255]^f[j>>>8&255]^g[255&k]^c[n++],s=d[m>>>24]^e[j>>>16&255]^f[k>>>8&255]^g[255&l]^c[n++];j=p,k=q,l=r,m=s}var p=(h[j>>>24]<<24|h[k>>>16&255]<<16|h[l>>>8&255]<<8|h[255&m])^c[n++],q=(h[k>>>24]<<24|h[l>>>16&255]<<16|h[m>>>8&255]<<8|h[255&j])^c[n++],r=(h[l>>>24]<<24|h[m>>>16&255]<<16|h[j>>>8&255]<<8|h[255&k])^c[n++],s=(h[m>>>24]<<24|h[j>>>16&255]<<16|h[k>>>8&255]<<8|h[255&l])^c[n++];a[b]=p,a[b+1]=q,a[b+2]=r,a[b+3]=s},keySize:8});b.AES=d._createHelper(q)}(),a.AES})},{"./cipher-core":39,"./core":40,"./enc-base64":41,"./evpkdf":43,"./md5":48}],39:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){a.lib.Cipher||function(b){var c=a,d=c.lib,e=d.Base,f=d.WordArray,g=d.BufferedBlockAlgorithm,h=c.enc,i=(h.Utf8,h.Base64),j=c.algo,k=j.EvpKDF,l=d.Cipher=g.extend({cfg:e.extend(),createEncryptor:function(a,b){return this.create(this._ENC_XFORM_MODE,a,b)},createDecryptor:function(a,b){return this.create(this._DEC_XFORM_MODE,a,b)},init:function(a,b,c){this.cfg=this.cfg.extend(c),this._xformMode=a,this._key=b,this.reset()},reset:function(){g.reset.call(this),this._doReset()},process:function(a){return this._append(a),this._process()},finalize:function(a){a&&this._append(a);var b=this._doFinalize();return b},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function a(a){return"string"==typeof a?x:u}return function(b){return{encrypt:function(c,d,e){return a(d).encrypt(b,c,d,e)},decrypt:function(c,d,e){return a(d).decrypt(b,c,d,e)}}}}()}),m=(d.StreamCipher=l.extend({_doFinalize:function(){var a=this._process(!0);return a},blockSize:1}),c.mode={}),n=d.BlockCipherMode=e.extend({createEncryptor:function(a,b){return this.Encryptor.create(a,b)},createDecryptor:function(a,b){return this.Decryptor.create(a,b)},init:function(a,b){this._cipher=a,this._iv=b}}),o=m.CBC=function(){function a(a,c,d){var e=this._iv;if(e){var f=e;this._iv=b}else var f=this._prevBlock;for(var g=0;g<d;g++)a[c+g]^=f[g]}var c=n.extend();return c.Encryptor=c.extend({processBlock:function(b,c){var d=this._cipher,e=d.blockSize;a.call(this,b,c,e),d.encryptBlock(b,c),this._prevBlock=b.slice(c,c+e)}}),c.Decryptor=c.extend({processBlock:function(b,c){var d=this._cipher,e=d.blockSize,f=b.slice(c,c+e);d.decryptBlock(b,c),a.call(this,b,c,e),this._prevBlock=f}}),c}(),p=c.pad={},q=p.Pkcs7={pad:function(a,b){for(var c=4*b,d=c-a.sigBytes%c,e=d<<24|d<<16|d<<8|d,g=[],h=0;h<d;h+=4)g.push(e);var i=f.create(g,d);a.concat(i)},unpad:function(a){var b=255&a.words[a.sigBytes-1>>>2];a.sigBytes-=b}},r=(d.BlockCipher=l.extend({cfg:l.cfg.extend({mode:o,padding:q}),reset:function(){l.reset.call(this);var a=this.cfg,b=a.iv,c=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var d=c.createEncryptor;else{var d=c.createDecryptor;this._minBufferSize=1}this._mode=d.call(c,this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else{var b=this._process(!0);a.unpad(b)}return b},blockSize:4}),d.CipherParams=e.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}})),s=c.format={},t=s.OpenSSL={stringify:function(a){var b=a.ciphertext,c=a.salt;if(c)var d=f.create([1398893684,1701076831]).concat(c).concat(b);else var d=b;return d.toString(i)},parse:function(a){var b=i.parse(a),c=b.words;if(1398893684==c[0]&&1701076831==c[1]){var d=f.create(c.slice(2,4));c.splice(0,4),b.sigBytes-=16}return r.create({ciphertext:b,salt:d})}},u=d.SerializableCipher=e.extend({cfg:e.extend({format:t}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=a.createEncryptor(c,d),f=e.finalize(b),g=e.cfg;return r.create({ciphertext:f,key:c,iv:g.iv,algorithm:a,mode:g.mode,padding:g.padding,blockSize:a.blockSize,formatter:d.format})},decrypt:function(a,b,c,d){d=this.cfg.extend(d),b=this._parse(b,d.format);var e=a.createDecryptor(c,d).finalize(b.ciphertext);return e},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),v=c.kdf={},w=v.OpenSSL={execute:function(a,b,c,d){d||(d=f.random(8));var e=k.create({keySize:b+c}).compute(a,d),g=f.create(e.words.slice(b),4*c);return e.sigBytes=4*b,r.create({key:e,iv:g,salt:d})}},x=d.PasswordBasedCipher=u.extend({cfg:u.cfg.extend({kdf:w}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=d.kdf.execute(c,a.keySize,a.ivSize);d.iv=e.iv;var f=u.encrypt.call(this,a,b,e.key,d);return f.mixIn(e),f},decrypt:function(a,b,c,d){d=this.cfg.extend(d),b=this._parse(b,d.format);var e=d.kdf.execute(c,a.keySize,a.ivSize,b.salt);d.iv=e.iv;var f=u.decrypt.call(this,a,b,e.key,d);return f}})}()})},{"./core":40}],40:[function(a,b,c){!function(a,d){"object"==typeof c?b.exports=c=d():"function"==typeof define&&define.amd?define([],d):a.CryptoJS=d()}(this,function(){var a=a||function(a,b){var c={},d=c.lib={},e=d.Base=function(){function a(){}return{extend:function(b){a.prototype=this;var c=new a;return b&&c.mixIn(b),c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)}),c.init.prototype=c,c.$super=this,c},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),f=d.WordArray=e.extend({init:function(a,c){a=this.words=a||[],c!=b?this.sigBytes=c:this.sigBytes=4*a.length},toString:function(a){return(a||h).stringify(this)},concat:function(a){var b=this.words,c=a.words,d=this.sigBytes,e=a.sigBytes;if(this.clamp(),d%4)for(var f=0;f<e;f++){var g=c[f>>>2]>>>24-f%4*8&255;b[d+f>>>2]|=g<<24-(d+f)%4*8}else for(var f=0;f<e;f+=4)b[d+f>>>2]=c[f>>>2];return this.sigBytes+=e,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=4294967295<<32-c%4*8,b.length=a.ceil(c/4)},clone:function(){var a=e.clone.call(this);return a.words=this.words.slice(0),a},random:function(b){for(var c,d=[],e=function(b){var b=b,c=987654321,d=4294967295;return function(){c=36969*(65535&c)+(c>>16)&d,b=18e3*(65535&b)+(b>>16)&d;var e=(c<<16)+b&d;return e/=4294967296,e+=.5,e*(a.random()>.5?1:-1)}},g=0;g<b;g+=4){var h=e(4294967296*(c||a.random()));c=987654071*h(),d.push(4294967296*h()|0)}return new f.init(d,b)}}),g=c.enc={},h=g.Hex={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;e<c;e++){var f=b[e>>>2]>>>24-e%4*8&255;d.push((f>>>4).toString(16)),d.push((15&f).toString(16))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d+=2)c[d>>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new f.init(c,b/2)}},i=g.Latin1={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;e<c;e++){var f=b[e>>>2]>>>24-e%4*8&255;d.push(String.fromCharCode(f))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d++)c[d>>>2]|=(255&a.charCodeAt(d))<<24-d%4*8;return new f.init(c,b)}},j=g.Utf8={stringify:function(a){try{return decodeURIComponent(escape(i.stringify(a)))}catch(a){throw new Error("Malformed UTF-8 data")}},parse:function(a){return i.parse(unescape(encodeURIComponent(a)))}},k=d.BufferedBlockAlgorithm=e.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=j.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c=this._data,d=c.words,e=c.sigBytes,g=this.blockSize,h=4*g,i=e/h;i=b?a.ceil(i):a.max((0|i)-this._minBufferSize,0);var j=i*g,k=a.min(4*j,e);if(j){for(var l=0;l<j;l+=g)this._doProcessBlock(d,l);var m=d.splice(0,j);c.sigBytes-=k}return new f.init(m,k)},clone:function(){var a=e.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0}),l=(d.Hasher=k.extend({cfg:e.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset()},reset:function(){k.reset.call(this),this._doReset()},update:function(a){return this._append(a),this._process(),this},finalize:function(a){a&&this._append(a);var b=this._doFinalize();return b},blockSize:16,_createHelper:function(a){return function(b,c){return new a.init(c).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return new l.HMAC.init(a,c).finalize(b)}}}),c.algo={});return c}(Math);return a})},{}],41:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(){var b=a,c=b.lib,d=c.WordArray,e=b.enc;e.Base64={stringify:function(a){var b=a.words,c=a.sigBytes,d=this._map;a.clamp();for(var e=[],f=0;f<c;f+=3)for(var g=b[f>>>2]>>>24-f%4*8&255,h=b[f+1>>>2]>>>24-(f+1)%4*8&255,i=b[f+2>>>2]>>>24-(f+2)%4*8&255,j=g<<16|h<<8|i,k=0;k<4&&f+.75*k<c;k++)e.push(d.charAt(j>>>6*(3-k)&63));var l=d.charAt(64);if(l)for(;e.length%4;)e.push(l);return e.join("")},parse:function(a){var b=a.length,c=this._map,e=c.charAt(64);if(e){var f=a.indexOf(e);f!=-1&&(b=f)}for(var g=[],h=0,i=0;i<b;i++)if(i%4){var j=c.indexOf(a.charAt(i-1))<<i%4*2,k=c.indexOf(a.charAt(i))>>>6-i%4*2,l=j|k;g[h>>>2]|=l<<24-h%4*8,h++}return d.create(g,h)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),a.enc.Base64})},{"./core":40}],42:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(){function b(a){return a<<8&4278255360|a>>>8&16711935}var c=a,d=c.lib,e=d.WordArray,f=c.enc;f.Utf16=f.Utf16BE={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;e<c;e+=2){var f=b[e>>>2]>>>16-e%4*8&65535;d.push(String.fromCharCode(f))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d++)c[d>>>1]|=a.charCodeAt(d)<<16-d%2*16;return e.create(c,2*b)}};f.Utf16LE={stringify:function(a){for(var c=a.words,d=a.sigBytes,e=[],f=0;f<d;f+=2){var g=b(c[f>>>2]>>>16-f%4*8&65535);e.push(String.fromCharCode(g))}return e.join("")},parse:function(a){for(var c=a.length,d=[],f=0;f<c;f++)d[f>>>1]|=b(a.charCodeAt(f)<<16-f%2*16);return e.create(d,2*c)}}}(),a.enc.Utf16})},{"./core":40}],43:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./sha1"),a("./hmac")):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],e):e(d.CryptoJS)}(this,function(a){return function(){var b=a,c=b.lib,d=c.Base,e=c.WordArray,f=b.algo,g=f.MD5,h=f.EvpKDF=d.extend({cfg:d.extend({keySize:4,hasher:g,iterations:1}),init:function(a){this.cfg=this.cfg.extend(a)},compute:function(a,b){for(var c=this.cfg,d=c.hasher.create(),f=e.create(),g=f.words,h=c.keySize,i=c.iterations;g.length<h;){j&&d.update(j);var j=d.update(a).finalize(b);d.reset();for(var k=1;k<i;k++)j=d.finalize(j),d.reset();f.concat(j)}return f.sigBytes=4*h,f}});b.EvpKDF=function(a,b,c){return h.create(c).compute(a,b)}}(),a.EvpKDF})},{"./core":40,"./hmac":45,"./sha1":64}],44:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return function(b){var c=a,d=c.lib,e=d.CipherParams,f=c.enc,g=f.Hex,h=c.format;h.Hex={stringify:function(a){return a.ciphertext.toString(g)},parse:function(a){var b=g.parse(a);return e.create({ciphertext:b})}}}(),a.format.Hex})},{"./cipher-core":39,"./core":40}],45:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){!function(){var b=a,c=b.lib,d=c.Base,e=b.enc,f=e.Utf8,g=b.algo;g.HMAC=d.extend({init:function(a,b){a=this._hasher=new a.init,"string"==typeof b&&(b=f.parse(b));var c=a.blockSize,d=4*c;b.sigBytes>d&&(b=a.finalize(b)),b.clamp();for(var e=this._oKey=b.clone(),g=this._iKey=b.clone(),h=e.words,i=g.words,j=0;j<c;j++)h[j]^=1549556828,i[j]^=909522486;e.sigBytes=g.sigBytes=d,this.reset()},reset:function(){var a=this._hasher;a.reset(),a.update(this._iKey)},update:function(a){return this._hasher.update(a),this},finalize:function(a){var b=this._hasher,c=b.finalize(a);b.reset();var d=b.finalize(this._oKey.clone().concat(c));return d}})}()})},{"./core":40}],46:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./x64-core"),a("./lib-typedarrays"),a("./enc-utf16"),a("./enc-base64"),a("./md5"),a("./sha1"),a("./sha256"),a("./sha224"),a("./sha512"),a("./sha384"),a("./sha3"),a("./ripemd160"),a("./hmac"),a("./pbkdf2"),a("./evpkdf"),a("./cipher-core"),a("./mode-cfb"),a("./mode-ctr"),a("./mode-ctr-gladman"),a("./mode-ofb"),a("./mode-ecb"),a("./pad-ansix923"),a("./pad-iso10126"),a("./pad-iso97971"),a("./pad-zeropadding"),a("./pad-nopadding"),a("./format-hex"),a("./aes"),a("./tripledes"),a("./rc4"),a("./rabbit"),a("./rabbit-legacy")):"function"==typeof define&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy"],e):d.CryptoJS=e(d.CryptoJS)}(this,function(a){return a})},{"./aes":38,"./cipher-core":39,"./core":40,"./enc-base64":41,"./enc-utf16":42,"./evpkdf":43,"./format-hex":44,"./hmac":45,"./lib-typedarrays":47,"./md5":48,"./mode-cfb":49,"./mode-ctr":51,"./mode-ctr-gladman":50,"./mode-ecb":52,"./mode-ofb":53,"./pad-ansix923":54,"./pad-iso10126":55,"./pad-iso97971":56,"./pad-nopadding":57,"./pad-zeropadding":58,"./pbkdf2":59,"./rabbit":61,"./rabbit-legacy":60,"./rc4":62,"./ripemd160":63,"./sha1":64,"./sha224":65,"./sha256":66,"./sha3":67,"./sha384":68,"./sha512":69,"./tripledes":70,"./x64-core":71}],47:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(){if("function"==typeof ArrayBuffer){var b=a,c=b.lib,d=c.WordArray,e=d.init,f=d.init=function(a){if(a instanceof ArrayBuffer&&(a=new Uint8Array(a)),(a instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&a instanceof Uint8ClampedArray||a instanceof Int16Array||a instanceof Uint16Array||a instanceof Int32Array||a instanceof Uint32Array||a instanceof Float32Array||a instanceof Float64Array)&&(a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength)),a instanceof Uint8Array){for(var b=a.byteLength,c=[],d=0;d<b;d++)c[d>>>2]|=a[d]<<24-d%4*8;e.call(this,c,b)}else e.apply(this,arguments)};f.prototype=d}}(),a.lib.WordArray})},{"./core":40}],48:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(b){function c(a,b,c,d,e,f,g){var h=a+(b&c|~b&d)+e+g;return(h<<f|h>>>32-f)+b}function d(a,b,c,d,e,f,g){var h=a+(b&d|c&~d)+e+g;return(h<<f|h>>>32-f)+b}function e(a,b,c,d,e,f,g){var h=a+(b^c^d)+e+g;return(h<<f|h>>>32-f)+b}function f(a,b,c,d,e,f,g){var h=a+(c^(b|~d))+e+g;return(h<<f|h>>>32-f)+b}var g=a,h=g.lib,i=h.WordArray,j=h.Hasher,k=g.algo,l=[];!function(){for(var a=0;a<64;a++)l[a]=4294967296*b.abs(b.sin(a+1))|0}();var m=k.MD5=j.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(a,b){for(var g=0;g<16;g++){var h=b+g,i=a[h];a[h]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var j=this._hash.words,k=a[b+0],m=a[b+1],n=a[b+2],o=a[b+3],p=a[b+4],q=a[b+5],r=a[b+6],s=a[b+7],t=a[b+8],u=a[b+9],v=a[b+10],w=a[b+11],x=a[b+12],y=a[b+13],z=a[b+14],A=a[b+15],B=j[0],C=j[1],D=j[2],E=j[3];B=c(B,C,D,E,k,7,l[0]),E=c(E,B,C,D,m,12,l[1]),D=c(D,E,B,C,n,17,l[2]),C=c(C,D,E,B,o,22,l[3]),B=c(B,C,D,E,p,7,l[4]),E=c(E,B,C,D,q,12,l[5]),D=c(D,E,B,C,r,17,l[6]),C=c(C,D,E,B,s,22,l[7]),B=c(B,C,D,E,t,7,l[8]),E=c(E,B,C,D,u,12,l[9]),D=c(D,E,B,C,v,17,l[10]),C=c(C,D,E,B,w,22,l[11]),B=c(B,C,D,E,x,7,l[12]),E=c(E,B,C,D,y,12,l[13]),D=c(D,E,B,C,z,17,l[14]),C=c(C,D,E,B,A,22,l[15]),B=d(B,C,D,E,m,5,l[16]),E=d(E,B,C,D,r,9,l[17]),D=d(D,E,B,C,w,14,l[18]),C=d(C,D,E,B,k,20,l[19]),B=d(B,C,D,E,q,5,l[20]),E=d(E,B,C,D,v,9,l[21]),D=d(D,E,B,C,A,14,l[22]),C=d(C,D,E,B,p,20,l[23]),B=d(B,C,D,E,u,5,l[24]),E=d(E,B,C,D,z,9,l[25]),D=d(D,E,B,C,o,14,l[26]),C=d(C,D,E,B,t,20,l[27]),B=d(B,C,D,E,y,5,l[28]),E=d(E,B,C,D,n,9,l[29]),D=d(D,E,B,C,s,14,l[30]),C=d(C,D,E,B,x,20,l[31]),B=e(B,C,D,E,q,4,l[32]),E=e(E,B,C,D,t,11,l[33]),D=e(D,E,B,C,w,16,l[34]),C=e(C,D,E,B,z,23,l[35]),B=e(B,C,D,E,m,4,l[36]),E=e(E,B,C,D,p,11,l[37]),D=e(D,E,B,C,s,16,l[38]),C=e(C,D,E,B,v,23,l[39]),B=e(B,C,D,E,y,4,l[40]),E=e(E,B,C,D,k,11,l[41]),D=e(D,E,B,C,o,16,l[42]),C=e(C,D,E,B,r,23,l[43]),B=e(B,C,D,E,u,4,l[44]),E=e(E,B,C,D,x,11,l[45]),D=e(D,E,B,C,A,16,l[46]),C=e(C,D,E,B,n,23,l[47]),B=f(B,C,D,E,k,6,l[48]),E=f(E,B,C,D,s,10,l[49]),D=f(D,E,B,C,z,15,l[50]),C=f(C,D,E,B,q,21,l[51]),B=f(B,C,D,E,x,6,l[52]),E=f(E,B,C,D,o,10,l[53]),D=f(D,E,B,C,v,15,l[54]),C=f(C,D,E,B,m,21,l[55]),B=f(B,C,D,E,t,6,l[56]),E=f(E,B,C,D,A,10,l[57]),D=f(D,E,B,C,r,15,l[58]),C=f(C,D,E,B,y,21,l[59]),B=f(B,C,D,E,p,6,l[60]),E=f(E,B,C,D,w,10,l[61]),D=f(D,E,B,C,n,15,l[62]),C=f(C,D,E,B,u,21,l[63]),j[0]=j[0]+B|0,j[1]=j[1]+C|0,j[2]=j[2]+D|0,j[3]=j[3]+E|0},_doFinalize:function(){var a=this._data,c=a.words,d=8*this._nDataBytes,e=8*a.sigBytes;c[e>>>5]|=128<<24-e%32;var f=b.floor(d/4294967296),g=d;c[(e+64>>>9<<4)+15]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),c[(e+64>>>9<<4)+14]=16711935&(g<<8|g>>>24)|4278255360&(g<<24|g>>>8),a.sigBytes=4*(c.length+1),this._process();for(var h=this._hash,i=h.words,j=0;j<4;j++){var k=i[j];i[j]=16711935&(k<<8|k>>>24)|4278255360&(k<<24|k>>>8)}return h},clone:function(){var a=j.clone.call(this);return a._hash=this._hash.clone(),a}});g.MD5=j._createHelper(m),g.HmacMD5=j._createHmacHelper(m)}(Math),a.MD5})},{"./core":40}],49:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.mode.CFB=function(){function b(a,b,c,d){var e=this._iv;if(e){var f=e.slice(0);this._iv=void 0}else var f=this._prevBlock;d.encryptBlock(f,0);for(var g=0;g<c;g++)a[b+g]^=f[g]}var c=a.lib.BlockCipherMode.extend();return c.Encryptor=c.extend({processBlock:function(a,c){var d=this._cipher,e=d.blockSize;b.call(this,a,c,e,d),this._prevBlock=a.slice(c,c+e)}}),c.Decryptor=c.extend({processBlock:function(a,c){var d=this._cipher,e=d.blockSize,f=a.slice(c,c+e);b.call(this,a,c,e,d),this._prevBlock=f}}),c}(),a.mode.CFB})},{"./cipher-core":39,"./core":40}],50:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.mode.CTRGladman=function(){function b(a){if(255===(a>>24&255)){var b=a>>16&255,c=a>>8&255,d=255&a;255===b?(b=0,255===c?(c=0,255===d?d=0:++d):++c):++b,a=0,a+=b<<16,a+=c<<8,a+=d}else a+=1<<24;return a}function c(a){return 0===(a[0]=b(a[0]))&&(a[1]=b(a[1])),a}var d=a.lib.BlockCipherMode.extend(),e=d.Encryptor=d.extend({processBlock:function(a,b){var d=this._cipher,e=d.blockSize,f=this._iv,g=this._counter;f&&(g=this._counter=f.slice(0),this._iv=void 0),c(g);var h=g.slice(0);d.encryptBlock(h,0);for(var i=0;i<e;i++)a[b+i]^=h[i]}});return d.Decryptor=e,d}(),a.mode.CTRGladman})},{"./cipher-core":39,"./core":40}],51:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.mode.CTR=function(){var b=a.lib.BlockCipherMode.extend(),c=b.Encryptor=b.extend({processBlock:function(a,b){var c=this._cipher,d=c.blockSize,e=this._iv,f=this._counter;e&&(f=this._counter=e.slice(0),this._iv=void 0);var g=f.slice(0);c.encryptBlock(g,0),f[d-1]=f[d-1]+1|0;for(var h=0;h<d;h++)a[b+h]^=g[h]}});return b.Decryptor=c,b}(),a.mode.CTR})},{"./cipher-core":39,"./core":40}],52:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.mode.ECB=function(){var b=a.lib.BlockCipherMode.extend();return b.Encryptor=b.extend({processBlock:function(a,b){this._cipher.encryptBlock(a,b)}}),b.Decryptor=b.extend({processBlock:function(a,b){this._cipher.decryptBlock(a,b)}}),b}(),a.mode.ECB})},{"./cipher-core":39,"./core":40}],53:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.mode.OFB=function(){var b=a.lib.BlockCipherMode.extend(),c=b.Encryptor=b.extend({processBlock:function(a,b){var c=this._cipher,d=c.blockSize,e=this._iv,f=this._keystream;e&&(f=this._keystream=e.slice(0),this._iv=void 0),c.encryptBlock(f,0);for(var g=0;g<d;g++)a[b+g]^=f[g]}});return b.Decryptor=c,b}(),a.mode.OFB})},{"./cipher-core":39,"./core":40}],54:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.pad.AnsiX923={pad:function(a,b){var c=a.sigBytes,d=4*b,e=d-c%d,f=c+e-1;a.clamp(),a.words[f>>>2]|=e<<24-f%4*8,a.sigBytes+=e},unpad:function(a){var b=255&a.words[a.sigBytes-1>>>2];a.sigBytes-=b}},a.pad.Ansix923})},{"./cipher-core":39,"./core":40}],55:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.pad.Iso10126={pad:function(b,c){var d=4*c,e=d-b.sigBytes%d;b.concat(a.lib.WordArray.random(e-1)).concat(a.lib.WordArray.create([e<<24],1))},unpad:function(a){var b=255&a.words[a.sigBytes-1>>>2];a.sigBytes-=b}},a.pad.Iso10126})},{"./cipher-core":39,"./core":40}],56:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.pad.Iso97971={pad:function(b,c){b.concat(a.lib.WordArray.create([2147483648],1)),a.pad.ZeroPadding.pad(b,c)},unpad:function(b){a.pad.ZeroPadding.unpad(b),b.sigBytes--}},a.pad.Iso97971})},{"./cipher-core":39,"./core":40}],57:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.pad.NoPadding={pad:function(){},unpad:function(){}},a.pad.NoPadding})},{"./cipher-core":39,"./core":40}],58:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.pad.ZeroPadding={pad:function(a,b){var c=4*b;a.clamp(),a.sigBytes+=c-(a.sigBytes%c||c)},unpad:function(a){for(var b=a.words,c=a.sigBytes-1;!(b[c>>>2]>>>24-c%4*8&255);)c--;a.sigBytes=c+1}},a.pad.ZeroPadding})},{"./cipher-core":39,"./core":40}],59:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./sha1"),a("./hmac")):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],e):e(d.CryptoJS)}(this,function(a){return function(){var b=a,c=b.lib,d=c.Base,e=c.WordArray,f=b.algo,g=f.SHA1,h=f.HMAC,i=f.PBKDF2=d.extend({cfg:d.extend({keySize:4,hasher:g,iterations:1}),init:function(a){this.cfg=this.cfg.extend(a)},compute:function(a,b){for(var c=this.cfg,d=h.create(c.hasher,a),f=e.create(),g=e.create([1]),i=f.words,j=g.words,k=c.keySize,l=c.iterations;i.length<k;){
var m=d.update(b).finalize(g);d.reset();for(var n=m.words,o=n.length,p=m,q=1;q<l;q++){p=d.finalize(p),d.reset();for(var r=p.words,s=0;s<o;s++)n[s]^=r[s]}f.concat(m),j[0]++}return f.sigBytes=4*k,f}});b.PBKDF2=function(a,b,c){return i.create(c).compute(a,b)}}(),a.PBKDF2})},{"./core":40,"./hmac":45,"./sha1":64}],60:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./enc-base64"),a("./md5"),a("./evpkdf"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return function(){function b(){for(var a=this._X,b=this._C,c=0;c<8;c++)h[c]=b[c];b[0]=b[0]+1295307597+this._b|0,b[1]=b[1]+3545052371+(b[0]>>>0<h[0]>>>0?1:0)|0,b[2]=b[2]+886263092+(b[1]>>>0<h[1]>>>0?1:0)|0,b[3]=b[3]+1295307597+(b[2]>>>0<h[2]>>>0?1:0)|0,b[4]=b[4]+3545052371+(b[3]>>>0<h[3]>>>0?1:0)|0,b[5]=b[5]+886263092+(b[4]>>>0<h[4]>>>0?1:0)|0,b[6]=b[6]+1295307597+(b[5]>>>0<h[5]>>>0?1:0)|0,b[7]=b[7]+3545052371+(b[6]>>>0<h[6]>>>0?1:0)|0,this._b=b[7]>>>0<h[7]>>>0?1:0;for(var c=0;c<8;c++){var d=a[c]+b[c],e=65535&d,f=d>>>16,g=((e*e>>>17)+e*f>>>15)+f*f,j=((4294901760&d)*d|0)+((65535&d)*d|0);i[c]=g^j}a[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,a[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,a[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,a[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,a[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,a[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,a[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,a[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}var c=a,d=c.lib,e=d.StreamCipher,f=c.algo,g=[],h=[],i=[],j=f.RabbitLegacy=e.extend({_doReset:function(){var a=this._key.words,c=this.cfg.iv,d=this._X=[a[0],a[3]<<16|a[2]>>>16,a[1],a[0]<<16|a[3]>>>16,a[2],a[1]<<16|a[0]>>>16,a[3],a[2]<<16|a[1]>>>16],e=this._C=[a[2]<<16|a[2]>>>16,4294901760&a[0]|65535&a[1],a[3]<<16|a[3]>>>16,4294901760&a[1]|65535&a[2],a[0]<<16|a[0]>>>16,4294901760&a[2]|65535&a[3],a[1]<<16|a[1]>>>16,4294901760&a[3]|65535&a[0]];this._b=0;for(var f=0;f<4;f++)b.call(this);for(var f=0;f<8;f++)e[f]^=d[f+4&7];if(c){var g=c.words,h=g[0],i=g[1],j=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),k=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),l=j>>>16|4294901760&k,m=k<<16|65535&j;e[0]^=j,e[1]^=l,e[2]^=k,e[3]^=m,e[4]^=j,e[5]^=l,e[6]^=k,e[7]^=m;for(var f=0;f<4;f++)b.call(this)}},_doProcessBlock:function(a,c){var d=this._X;b.call(this),g[0]=d[0]^d[5]>>>16^d[3]<<16,g[1]=d[2]^d[7]>>>16^d[5]<<16,g[2]=d[4]^d[1]>>>16^d[7]<<16,g[3]=d[6]^d[3]>>>16^d[1]<<16;for(var e=0;e<4;e++)g[e]=16711935&(g[e]<<8|g[e]>>>24)|4278255360&(g[e]<<24|g[e]>>>8),a[c+e]^=g[e]},blockSize:4,ivSize:2});c.RabbitLegacy=e._createHelper(j)}(),a.RabbitLegacy})},{"./cipher-core":39,"./core":40,"./enc-base64":41,"./evpkdf":43,"./md5":48}],61:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./enc-base64"),a("./md5"),a("./evpkdf"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return function(){function b(){for(var a=this._X,b=this._C,c=0;c<8;c++)h[c]=b[c];b[0]=b[0]+1295307597+this._b|0,b[1]=b[1]+3545052371+(b[0]>>>0<h[0]>>>0?1:0)|0,b[2]=b[2]+886263092+(b[1]>>>0<h[1]>>>0?1:0)|0,b[3]=b[3]+1295307597+(b[2]>>>0<h[2]>>>0?1:0)|0,b[4]=b[4]+3545052371+(b[3]>>>0<h[3]>>>0?1:0)|0,b[5]=b[5]+886263092+(b[4]>>>0<h[4]>>>0?1:0)|0,b[6]=b[6]+1295307597+(b[5]>>>0<h[5]>>>0?1:0)|0,b[7]=b[7]+3545052371+(b[6]>>>0<h[6]>>>0?1:0)|0,this._b=b[7]>>>0<h[7]>>>0?1:0;for(var c=0;c<8;c++){var d=a[c]+b[c],e=65535&d,f=d>>>16,g=((e*e>>>17)+e*f>>>15)+f*f,j=((4294901760&d)*d|0)+((65535&d)*d|0);i[c]=g^j}a[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,a[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,a[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,a[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,a[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,a[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,a[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,a[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}var c=a,d=c.lib,e=d.StreamCipher,f=c.algo,g=[],h=[],i=[],j=f.Rabbit=e.extend({_doReset:function(){for(var a=this._key.words,c=this.cfg.iv,d=0;d<4;d++)a[d]=16711935&(a[d]<<8|a[d]>>>24)|4278255360&(a[d]<<24|a[d]>>>8);var e=this._X=[a[0],a[3]<<16|a[2]>>>16,a[1],a[0]<<16|a[3]>>>16,a[2],a[1]<<16|a[0]>>>16,a[3],a[2]<<16|a[1]>>>16],f=this._C=[a[2]<<16|a[2]>>>16,4294901760&a[0]|65535&a[1],a[3]<<16|a[3]>>>16,4294901760&a[1]|65535&a[2],a[0]<<16|a[0]>>>16,4294901760&a[2]|65535&a[3],a[1]<<16|a[1]>>>16,4294901760&a[3]|65535&a[0]];this._b=0;for(var d=0;d<4;d++)b.call(this);for(var d=0;d<8;d++)f[d]^=e[d+4&7];if(c){var g=c.words,h=g[0],i=g[1],j=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),k=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),l=j>>>16|4294901760&k,m=k<<16|65535&j;f[0]^=j,f[1]^=l,f[2]^=k,f[3]^=m,f[4]^=j,f[5]^=l,f[6]^=k,f[7]^=m;for(var d=0;d<4;d++)b.call(this)}},_doProcessBlock:function(a,c){var d=this._X;b.call(this),g[0]=d[0]^d[5]>>>16^d[3]<<16,g[1]=d[2]^d[7]>>>16^d[5]<<16,g[2]=d[4]^d[1]>>>16^d[7]<<16,g[3]=d[6]^d[3]>>>16^d[1]<<16;for(var e=0;e<4;e++)g[e]=16711935&(g[e]<<8|g[e]>>>24)|4278255360&(g[e]<<24|g[e]>>>8),a[c+e]^=g[e]},blockSize:4,ivSize:2});c.Rabbit=e._createHelper(j)}(),a.Rabbit})},{"./cipher-core":39,"./core":40,"./enc-base64":41,"./evpkdf":43,"./md5":48}],62:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./enc-base64"),a("./md5"),a("./evpkdf"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return function(){function b(){for(var a=this._S,b=this._i,c=this._j,d=0,e=0;e<4;e++){b=(b+1)%256,c=(c+a[b])%256;var f=a[b];a[b]=a[c],a[c]=f,d|=a[(a[b]+a[c])%256]<<24-8*e}return this._i=b,this._j=c,d}var c=a,d=c.lib,e=d.StreamCipher,f=c.algo,g=f.RC4=e.extend({_doReset:function(){for(var a=this._key,b=a.words,c=a.sigBytes,d=this._S=[],e=0;e<256;e++)d[e]=e;for(var e=0,f=0;e<256;e++){var g=e%c,h=b[g>>>2]>>>24-g%4*8&255;f=(f+d[e]+h)%256;var i=d[e];d[e]=d[f],d[f]=i}this._i=this._j=0},_doProcessBlock:function(a,c){a[c]^=b.call(this)},keySize:8,ivSize:0});c.RC4=e._createHelper(g);var h=f.RC4Drop=g.extend({cfg:g.cfg.extend({drop:192}),_doReset:function(){g._doReset.call(this);for(var a=this.cfg.drop;a>0;a--)b.call(this)}});c.RC4Drop=e._createHelper(h)}(),a.RC4})},{"./cipher-core":39,"./core":40,"./enc-base64":41,"./evpkdf":43,"./md5":48}],63:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(b){function c(a,b,c){return a^b^c}function d(a,b,c){return a&b|~a&c}function e(a,b,c){return(a|~b)^c}function f(a,b,c){return a&c|b&~c}function g(a,b,c){return a^(b|~c)}function h(a,b){return a<<b|a>>>32-b}var i=a,j=i.lib,k=j.WordArray,l=j.Hasher,m=i.algo,n=k.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),o=k.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),p=k.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),q=k.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),r=k.create([0,1518500249,1859775393,2400959708,2840853838]),s=k.create([1352829926,1548603684,1836072691,2053994217,0]),t=m.RIPEMD160=l.extend({_doReset:function(){this._hash=k.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(a,b){for(var i=0;i<16;i++){var j=b+i,k=a[j];a[j]=16711935&(k<<8|k>>>24)|4278255360&(k<<24|k>>>8)}var l,m,t,u,v,w,x,y,z,A,B=this._hash.words,C=r.words,D=s.words,E=n.words,F=o.words,G=p.words,H=q.words;w=l=B[0],x=m=B[1],y=t=B[2],z=u=B[3],A=v=B[4];for(var I,i=0;i<80;i+=1)I=l+a[b+E[i]]|0,I+=i<16?c(m,t,u)+C[0]:i<32?d(m,t,u)+C[1]:i<48?e(m,t,u)+C[2]:i<64?f(m,t,u)+C[3]:g(m,t,u)+C[4],I=0|I,I=h(I,G[i]),I=I+v|0,l=v,v=u,u=h(t,10),t=m,m=I,I=w+a[b+F[i]]|0,I+=i<16?g(x,y,z)+D[0]:i<32?f(x,y,z)+D[1]:i<48?e(x,y,z)+D[2]:i<64?d(x,y,z)+D[3]:c(x,y,z)+D[4],I=0|I,I=h(I,H[i]),I=I+A|0,w=A,A=z,z=h(y,10),y=x,x=I;I=B[1]+t+z|0,B[1]=B[2]+u+A|0,B[2]=B[3]+v+w|0,B[3]=B[4]+l+x|0,B[4]=B[0]+m+y|0,B[0]=I},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;b[d>>>5]|=128<<24-d%32,b[(d+64>>>9<<4)+14]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),a.sigBytes=4*(b.length+1),this._process();for(var e=this._hash,f=e.words,g=0;g<5;g++){var h=f[g];f[g]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return e},clone:function(){var a=l.clone.call(this);return a._hash=this._hash.clone(),a}});i.RIPEMD160=l._createHelper(t),i.HmacRIPEMD160=l._createHmacHelper(t)}(Math),a.RIPEMD160})},{"./core":40}],64:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(){var b=a,c=b.lib,d=c.WordArray,e=c.Hasher,f=b.algo,g=[],h=f.SHA1=e.extend({_doReset:function(){this._hash=new d.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],h=c[3],i=c[4],j=0;j<80;j++){if(j<16)g[j]=0|a[b+j];else{var k=g[j-3]^g[j-8]^g[j-14]^g[j-16];g[j]=k<<1|k>>>31}var l=(d<<5|d>>>27)+i+g[j];l+=j<20?(e&f|~e&h)+1518500249:j<40?(e^f^h)+1859775393:j<60?(e&f|e&h|f&h)-1894007588:(e^f^h)-899497514,i=h,h=f,f=e<<30|e>>>2,e=d,d=l}c[0]=c[0]+d|0,c[1]=c[1]+e|0,c[2]=c[2]+f|0,c[3]=c[3]+h|0,c[4]=c[4]+i|0},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;return b[d>>>5]|=128<<24-d%32,b[(d+64>>>9<<4)+14]=Math.floor(c/4294967296),b[(d+64>>>9<<4)+15]=c,a.sigBytes=4*b.length,this._process(),this._hash},clone:function(){var a=e.clone.call(this);return a._hash=this._hash.clone(),a}});b.SHA1=e._createHelper(h),b.HmacSHA1=e._createHmacHelper(h)}(),a.SHA1})},{"./core":40}],65:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./sha256")):"function"==typeof define&&define.amd?define(["./core","./sha256"],e):e(d.CryptoJS)}(this,function(a){return function(){var b=a,c=b.lib,d=c.WordArray,e=b.algo,f=e.SHA256,g=e.SHA224=f.extend({_doReset:function(){this._hash=new d.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var a=f._doFinalize.call(this);return a.sigBytes-=4,a}});b.SHA224=f._createHelper(g),b.HmacSHA224=f._createHmacHelper(g)}(),a.SHA224})},{"./core":40,"./sha256":66}],66:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(b){var c=a,d=c.lib,e=d.WordArray,f=d.Hasher,g=c.algo,h=[],i=[];!function(){function a(a){for(var c=b.sqrt(a),d=2;d<=c;d++)if(!(a%d))return!1;return!0}function c(a){return 4294967296*(a-(0|a))|0}for(var d=2,e=0;e<64;)a(d)&&(e<8&&(h[e]=c(b.pow(d,.5))),i[e]=c(b.pow(d,1/3)),e++),d++}();var j=[],k=g.SHA256=f.extend({_doReset:function(){this._hash=new e.init(h.slice(0))},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],g=c[3],h=c[4],k=c[5],l=c[6],m=c[7],n=0;n<64;n++){if(n<16)j[n]=0|a[b+n];else{var o=j[n-15],p=(o<<25|o>>>7)^(o<<14|o>>>18)^o>>>3,q=j[n-2],r=(q<<15|q>>>17)^(q<<13|q>>>19)^q>>>10;j[n]=p+j[n-7]+r+j[n-16]}var s=h&k^~h&l,t=d&e^d&f^e&f,u=(d<<30|d>>>2)^(d<<19|d>>>13)^(d<<10|d>>>22),v=(h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25),w=m+v+s+i[n]+j[n],x=u+t;m=l,l=k,k=h,h=g+w|0,g=f,f=e,e=d,d=w+x|0}c[0]=c[0]+d|0,c[1]=c[1]+e|0,c[2]=c[2]+f|0,c[3]=c[3]+g|0,c[4]=c[4]+h|0,c[5]=c[5]+k|0,c[6]=c[6]+l|0,c[7]=c[7]+m|0},_doFinalize:function(){var a=this._data,c=a.words,d=8*this._nDataBytes,e=8*a.sigBytes;return c[e>>>5]|=128<<24-e%32,c[(e+64>>>9<<4)+14]=b.floor(d/4294967296),c[(e+64>>>9<<4)+15]=d,a.sigBytes=4*c.length,this._process(),this._hash},clone:function(){var a=f.clone.call(this);return a._hash=this._hash.clone(),a}});c.SHA256=f._createHelper(k),c.HmacSHA256=f._createHmacHelper(k)}(Math),a.SHA256})},{"./core":40}],67:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],e):e(d.CryptoJS)}(this,function(a){return function(b){var c=a,d=c.lib,e=d.WordArray,f=d.Hasher,g=c.x64,h=g.Word,i=c.algo,j=[],k=[],l=[];!function(){for(var a=1,b=0,c=0;c<24;c++){j[a+5*b]=(c+1)*(c+2)/2%64;var d=b%5,e=(2*a+3*b)%5;a=d,b=e}for(var a=0;a<5;a++)for(var b=0;b<5;b++)k[a+5*b]=b+(2*a+3*b)%5*5;for(var f=1,g=0;g<24;g++){for(var i=0,m=0,n=0;n<7;n++){if(1&f){var o=(1<<n)-1;o<32?m^=1<<o:i^=1<<o-32}128&f?f=f<<1^113:f<<=1}l[g]=h.create(i,m)}}();var m=[];!function(){for(var a=0;a<25;a++)m[a]=h.create()}();var n=i.SHA3=f.extend({cfg:f.cfg.extend({outputLength:512}),_doReset:function(){for(var a=this._state=[],b=0;b<25;b++)a[b]=new h.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(a,b){for(var c=this._state,d=this.blockSize/2,e=0;e<d;e++){var f=a[b+2*e],g=a[b+2*e+1];f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),g=16711935&(g<<8|g>>>24)|4278255360&(g<<24|g>>>8);var h=c[e];h.high^=g,h.low^=f}for(var i=0;i<24;i++){for(var n=0;n<5;n++){for(var o=0,p=0,q=0;q<5;q++){var h=c[n+5*q];o^=h.high,p^=h.low}var r=m[n];r.high=o,r.low=p}for(var n=0;n<5;n++)for(var s=m[(n+4)%5],t=m[(n+1)%5],u=t.high,v=t.low,o=s.high^(u<<1|v>>>31),p=s.low^(v<<1|u>>>31),q=0;q<5;q++){var h=c[n+5*q];h.high^=o,h.low^=p}for(var w=1;w<25;w++){var h=c[w],x=h.high,y=h.low,z=j[w];if(z<32)var o=x<<z|y>>>32-z,p=y<<z|x>>>32-z;else var o=y<<z-32|x>>>64-z,p=x<<z-32|y>>>64-z;var A=m[k[w]];A.high=o,A.low=p}var B=m[0],C=c[0];B.high=C.high,B.low=C.low;for(var n=0;n<5;n++)for(var q=0;q<5;q++){var w=n+5*q,h=c[w],D=m[w],E=m[(n+1)%5+5*q],F=m[(n+2)%5+5*q];h.high=D.high^~E.high&F.high,h.low=D.low^~E.low&F.low}var h=c[0],G=l[i];h.high^=G.high,h.low^=G.low}},_doFinalize:function(){var a=this._data,c=a.words,d=(8*this._nDataBytes,8*a.sigBytes),f=32*this.blockSize;c[d>>>5]|=1<<24-d%32,c[(b.ceil((d+1)/f)*f>>>5)-1]|=128,a.sigBytes=4*c.length,this._process();for(var g=this._state,h=this.cfg.outputLength/8,i=h/8,j=[],k=0;k<i;k++){var l=g[k],m=l.high,n=l.low;m=16711935&(m<<8|m>>>24)|4278255360&(m<<24|m>>>8),n=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),j.push(n),j.push(m)}return new e.init(j,h)},clone:function(){for(var a=f.clone.call(this),b=a._state=this._state.slice(0),c=0;c<25;c++)b[c]=b[c].clone();return a}});c.SHA3=f._createHelper(n),c.HmacSHA3=f._createHmacHelper(n)}(Math),a.SHA3})},{"./core":40,"./x64-core":71}],68:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./x64-core"),a("./sha512")):"function"==typeof define&&define.amd?define(["./core","./x64-core","./sha512"],e):e(d.CryptoJS)}(this,function(a){return function(){var b=a,c=b.x64,d=c.Word,e=c.WordArray,f=b.algo,g=f.SHA512,h=f.SHA384=g.extend({_doReset:function(){this._hash=new e.init([new d.init(3418070365,3238371032),new d.init(1654270250,914150663),new d.init(2438529370,812702999),new d.init(355462360,4144912697),new d.init(1731405415,4290775857),new d.init(2394180231,1750603025),new d.init(3675008525,1694076839),new d.init(1203062813,3204075428)])},_doFinalize:function(){var a=g._doFinalize.call(this);return a.sigBytes-=16,a}});b.SHA384=g._createHelper(h),b.HmacSHA384=g._createHmacHelper(h)}(),a.SHA384})},{"./core":40,"./sha512":69,"./x64-core":71}],69:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],e):e(d.CryptoJS)}(this,function(a){return function(){function b(){return g.create.apply(g,arguments)}var c=a,d=c.lib,e=d.Hasher,f=c.x64,g=f.Word,h=f.WordArray,i=c.algo,j=[b(1116352408,3609767458),b(1899447441,602891725),b(3049323471,3964484399),b(3921009573,2173295548),b(961987163,4081628472),b(1508970993,3053834265),b(2453635748,2937671579),b(2870763221,3664609560),b(3624381080,2734883394),b(310598401,1164996542),b(607225278,1323610764),b(1426881987,3590304994),b(1925078388,4068182383),b(2162078206,991336113),b(2614888103,633803317),b(3248222580,3479774868),b(3835390401,2666613458),b(4022224774,944711139),b(264347078,2341262773),b(604807628,2007800933),b(770255983,1495990901),b(1249150122,1856431235),b(1555081692,3175218132),b(1996064986,2198950837),b(2554220882,3999719339),b(2821834349,766784016),b(2952996808,2566594879),b(3210313671,3203337956),b(3336571891,1034457026),b(3584528711,2466948901),b(113926993,3758326383),b(338241895,168717936),b(666307205,1188179964),b(773529912,1546045734),b(1294757372,1522805485),b(1396182291,2643833823),b(1695183700,2343527390),b(1986661051,1014477480),b(2177026350,1206759142),b(2456956037,344077627),b(2730485921,1290863460),b(2820302411,3158454273),b(3259730800,3505952657),b(3345764771,106217008),b(3516065817,3606008344),b(3600352804,1432725776),b(4094571909,1467031594),b(275423344,851169720),b(430227734,3100823752),b(506948616,1363258195),b(659060556,3750685593),b(883997877,3785050280),b(958139571,3318307427),b(1322822218,3812723403),b(1537002063,2003034995),b(1747873779,3602036899),b(1955562222,1575990012),b(2024104815,1125592928),b(2227730452,2716904306),b(2361852424,442776044),b(2428436474,593698344),b(2756734187,3733110249),b(3204031479,2999351573),b(3329325298,3815920427),b(3391569614,3928383900),b(3515267271,566280711),b(3940187606,3454069534),b(4118630271,4000239992),b(116418474,1914138554),b(174292421,2731055270),b(289380356,3203993006),b(460393269,320620315),b(685471733,587496836),b(852142971,1086792851),b(1017036298,365543100),b(1126000580,2618297676),b(1288033470,3409855158),b(1501505948,4234509866),b(1607167915,987167468),b(1816402316,1246189591)],k=[];!function(){for(var a=0;a<80;a++)k[a]=b()}();var l=i.SHA512=e.extend({_doReset:function(){this._hash=new h.init([new g.init(1779033703,4089235720),new g.init(3144134277,2227873595),new g.init(1013904242,4271175723),new g.init(2773480762,1595750129),new g.init(1359893119,2917565137),new g.init(2600822924,725511199),new g.init(528734635,4215389547),new g.init(1541459225,327033209)])},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],g=c[3],h=c[4],i=c[5],l=c[6],m=c[7],n=d.high,o=d.low,p=e.high,q=e.low,r=f.high,s=f.low,t=g.high,u=g.low,v=h.high,w=h.low,x=i.high,y=i.low,z=l.high,A=l.low,B=m.high,C=m.low,D=n,E=o,F=p,G=q,H=r,I=s,J=t,K=u,L=v,M=w,N=x,O=y,P=z,Q=A,R=B,S=C,T=0;T<80;T++){var U=k[T];if(T<16)var V=U.high=0|a[b+2*T],W=U.low=0|a[b+2*T+1];else{var X=k[T-15],Y=X.high,Z=X.low,$=(Y>>>1|Z<<31)^(Y>>>8|Z<<24)^Y>>>7,_=(Z>>>1|Y<<31)^(Z>>>8|Y<<24)^(Z>>>7|Y<<25),aa=k[T-2],ba=aa.high,ca=aa.low,da=(ba>>>19|ca<<13)^(ba<<3|ca>>>29)^ba>>>6,ea=(ca>>>19|ba<<13)^(ca<<3|ba>>>29)^(ca>>>6|ba<<26),fa=k[T-7],ga=fa.high,ha=fa.low,ia=k[T-16],ja=ia.high,ka=ia.low,W=_+ha,V=$+ga+(W>>>0<_>>>0?1:0),W=W+ea,V=V+da+(W>>>0<ea>>>0?1:0),W=W+ka,V=V+ja+(W>>>0<ka>>>0?1:0);U.high=V,U.low=W}var la=L&N^~L&P,ma=M&O^~M&Q,na=D&F^D&H^F&H,oa=E&G^E&I^G&I,pa=(D>>>28|E<<4)^(D<<30|E>>>2)^(D<<25|E>>>7),qa=(E>>>28|D<<4)^(E<<30|D>>>2)^(E<<25|D>>>7),ra=(L>>>14|M<<18)^(L>>>18|M<<14)^(L<<23|M>>>9),sa=(M>>>14|L<<18)^(M>>>18|L<<14)^(M<<23|L>>>9),ta=j[T],ua=ta.high,va=ta.low,wa=S+sa,xa=R+ra+(wa>>>0<S>>>0?1:0),wa=wa+ma,xa=xa+la+(wa>>>0<ma>>>0?1:0),wa=wa+va,xa=xa+ua+(wa>>>0<va>>>0?1:0),wa=wa+W,xa=xa+V+(wa>>>0<W>>>0?1:0),ya=qa+oa,za=pa+na+(ya>>>0<qa>>>0?1:0);R=P,S=Q,P=N,Q=O,N=L,O=M,M=K+wa|0,L=J+xa+(M>>>0<K>>>0?1:0)|0,J=H,K=I,H=F,I=G,F=D,G=E,E=wa+ya|0,D=xa+za+(E>>>0<wa>>>0?1:0)|0}o=d.low=o+E,d.high=n+D+(o>>>0<E>>>0?1:0),q=e.low=q+G,e.high=p+F+(q>>>0<G>>>0?1:0),s=f.low=s+I,f.high=r+H+(s>>>0<I>>>0?1:0),u=g.low=u+K,g.high=t+J+(u>>>0<K>>>0?1:0),w=h.low=w+M,h.high=v+L+(w>>>0<M>>>0?1:0),y=i.low=y+O,i.high=x+N+(y>>>0<O>>>0?1:0),A=l.low=A+Q,l.high=z+P+(A>>>0<Q>>>0?1:0),C=m.low=C+S,m.high=B+R+(C>>>0<S>>>0?1:0)},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;b[d>>>5]|=128<<24-d%32,b[(d+128>>>10<<5)+30]=Math.floor(c/4294967296),b[(d+128>>>10<<5)+31]=c,a.sigBytes=4*b.length,this._process();var e=this._hash.toX32();return e},clone:function(){var a=e.clone.call(this);return a._hash=this._hash.clone(),a},blockSize:32});c.SHA512=e._createHelper(l),c.HmacSHA512=e._createHmacHelper(l)}(),a.SHA512})},{"./core":40,"./x64-core":71}],70:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./enc-base64"),a("./md5"),a("./evpkdf"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return function(){function b(a,b){var c=(this._lBlock>>>a^this._rBlock)&b;this._rBlock^=c,this._lBlock^=c<<a}function c(a,b){var c=(this._rBlock>>>a^this._lBlock)&b;this._lBlock^=c,this._rBlock^=c<<a}var d=a,e=d.lib,f=e.WordArray,g=e.BlockCipher,h=d.algo,i=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],j=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],k=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],m=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],n=h.DES=g.extend({_doReset:function(){for(var a=this._key,b=a.words,c=[],d=0;d<56;d++){var e=i[d]-1;c[d]=b[e>>>5]>>>31-e%32&1}for(var f=this._subKeys=[],g=0;g<16;g++){for(var h=f[g]=[],l=k[g],d=0;d<24;d++)h[d/6|0]|=c[(j[d]-1+l)%28]<<31-d%6,h[4+(d/6|0)]|=c[28+(j[d+24]-1+l)%28]<<31-d%6;h[0]=h[0]<<1|h[0]>>>31;for(var d=1;d<7;d++)h[d]=h[d]>>>4*(d-1)+3;h[7]=h[7]<<5|h[7]>>>27}for(var m=this._invSubKeys=[],d=0;d<16;d++)m[d]=f[15-d]},encryptBlock:function(a,b){this._doCryptBlock(a,b,this._subKeys)},decryptBlock:function(a,b){this._doCryptBlock(a,b,this._invSubKeys)},_doCryptBlock:function(a,d,e){this._lBlock=a[d],this._rBlock=a[d+1],b.call(this,4,252645135),b.call(this,16,65535),c.call(this,2,858993459),c.call(this,8,16711935),b.call(this,1,1431655765);for(var f=0;f<16;f++){for(var g=e[f],h=this._lBlock,i=this._rBlock,j=0,k=0;k<8;k++)j|=l[k][((i^g[k])&m[k])>>>0];this._lBlock=i,this._rBlock=h^j}var n=this._lBlock;this._lBlock=this._rBlock,this._rBlock=n,b.call(this,1,1431655765),c.call(this,8,16711935),c.call(this,2,858993459),b.call(this,16,65535),b.call(this,4,252645135),a[d]=this._lBlock,a[d+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});d.DES=g._createHelper(n);var o=h.TripleDES=g.extend({_doReset:function(){var a=this._key,b=a.words;this._des1=n.createEncryptor(f.create(b.slice(0,2))),this._des2=n.createEncryptor(f.create(b.slice(2,4))),this._des3=n.createEncryptor(f.create(b.slice(4,6)))},encryptBlock:function(a,b){this._des1.encryptBlock(a,b),this._des2.decryptBlock(a,b),this._des3.encryptBlock(a,b)},decryptBlock:function(a,b){this._des3.decryptBlock(a,b),this._des2.encryptBlock(a,b),this._des1.decryptBlock(a,b)},keySize:6,ivSize:2,blockSize:2});d.TripleDES=g._createHelper(o)}(),a.TripleDES})},{"./cipher-core":39,"./core":40,"./enc-base64":41,"./evpkdf":43,"./md5":48}],71:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(b){var c=a,d=c.lib,e=d.Base,f=d.WordArray,g=c.x64={};g.Word=e.extend({init:function(a,b){this.high=a,this.low=b}}),g.WordArray=e.extend({init:function(a,c){a=this.words=a||[],c!=b?this.sigBytes=c:this.sigBytes=8*a.length},toX32:function(){for(var a=this.words,b=a.length,c=[],d=0;d<b;d++){var e=a[d];c.push(e.high),c.push(e.low)}return f.create(c,this.sigBytes)},clone:function(){for(var a=e.clone.call(this),b=a.words=this.words.slice(0),c=b.length,d=0;d<c;d++)b[d]=b[d].clone();return a}})}(),a})},{"./core":40}],72:[function(a,b,c){(function(){"use strict";function c(a,b){a=a||[],b=b||{};try{return new Blob(a,b)}catch(f){if("TypeError"!==f.name)throw f;for(var c=window.BlobBuilder||window.MSBlobBuilder||window.MozBlobBuilder||window.WebKitBlobBuilder,d=new c,e=0;e<a.length;e+=1)d.append(a[e]);
return d.getBlob(b.type)}}function d(a){for(var b=a.length,c=new ArrayBuffer(b),d=new Uint8Array(c),e=0;e<b;e++)d[e]=a.charCodeAt(e);return c}function e(a){return new u(function(b,c){var d=new XMLHttpRequest;d.open("GET",a),d.withCredentials=!0,d.responseType="arraybuffer",d.onreadystatechange=function(){if(4===d.readyState)return 200===d.status?b({response:d.response,type:d.getResponseHeader("Content-Type")}):void c({status:d.status,response:d.response})},d.send()})}function f(a){return new u(function(b,d){var f=c([""],{type:"image/png"}),g=a.transaction([x],"readwrite");g.objectStore(x).put(f,"key"),g.oncomplete=function(){var c=a.transaction([x],"readwrite"),f=c.objectStore(x).get("key");f.onerror=d,f.onsuccess=function(a){var c=a.target.result,d=URL.createObjectURL(c);e(d).then(function(a){b(!(!a||"image/png"!==a.type))},function(){b(!1)}).then(function(){URL.revokeObjectURL(d)})}}}).catch(function(){return!1})}function g(a){return"boolean"==typeof w?u.resolve(w):f(a).then(function(a){return w=a})}function h(a){return new u(function(b,c){var d=new FileReader;d.onerror=c,d.onloadend=function(c){var d=btoa(c.target.result||"");b({__local_forage_encoded_blob:!0,data:d,type:a.type})},d.readAsBinaryString(a)})}function i(a){var b=d(atob(a.data));return c([b],{type:a.type})}function j(a){return a&&a.__local_forage_encoded_blob}function k(a){var b=this,c={db:null};if(a)for(var d in a)c[d]=a[d];return new u(function(a,d){var e=v.open(c.name,c.version);e.onerror=function(){d(e.error)},e.onupgradeneeded=function(a){e.result.createObjectStore(c.storeName),a.oldVersion<=1&&e.result.createObjectStore(x)},e.onsuccess=function(){c.db=e.result,b._dbInfo=c,a()}})}function l(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new u(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=f.get(a);g.onsuccess=function(){var a=g.result;void 0===a&&(a=null),j(a)&&(a=i(a)),b(a)},g.onerror=function(){d(g.error)}}).catch(d)});return t(d,b),d}function m(a,b){var c=this,d=new u(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=f.openCursor(),h=1;g.onsuccess=function(){var c=g.result;if(c){var d=c.value;j(d)&&(d=i(d));var e=a(d,c.key,h++);void 0!==e?b(e):c.continue()}else b()},g.onerror=function(){d(g.error)}}).catch(d)});return t(d,b),d}function n(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new u(function(c,e){var f;d.ready().then(function(){return f=d._dbInfo,g(f.db)}).then(function(a){return!a&&b instanceof Blob?h(b):b}).then(function(b){var d=f.db.transaction(f.storeName,"readwrite"),g=d.objectStore(f.storeName);null===b&&(b=void 0);var h=g.put(b,a);d.oncomplete=function(){void 0===b&&(b=null),c(b)},d.onabort=d.onerror=function(){var a=h.error?h.error:h.transaction.error;e(a)}}).catch(e)});return t(e,c),e}function o(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new u(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readwrite"),g=f.objectStore(e.storeName),h=g.delete(a);f.oncomplete=function(){b()},f.onerror=function(){d(h.error)},f.onabort=function(){var a=h.error?h.error:h.transaction.error;d(a)}}).catch(d)});return t(d,b),d}function p(a){var b=this,c=new u(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readwrite"),f=e.objectStore(d.storeName),g=f.clear();e.oncomplete=function(){a()},e.onabort=e.onerror=function(){var a=g.error?g.error:g.transaction.error;c(a)}}).catch(c)});return t(c,a),c}function q(a){var b=this,c=new u(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.count();f.onsuccess=function(){a(f.result)},f.onerror=function(){c(f.error)}}).catch(c)});return t(c,a),c}function r(a,b){var c=this,d=new u(function(b,d){return a<0?void b(null):void c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=!1,h=f.openCursor();h.onsuccess=function(){var c=h.result;return c?void(0===a?b(c.key):g?b(c.key):(g=!0,c.advance(a))):void b(null)},h.onerror=function(){d(h.error)}}).catch(d)});return t(d,b),d}function s(a){var b=this,c=new u(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.openCursor(),g=[];f.onsuccess=function(){var b=f.result;return b?(g.push(b.key),void b.continue()):void a(g)},f.onerror=function(){c(f.error)}}).catch(c)});return t(c,a),c}function t(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var u="undefined"!=typeof b&&b.exports&&"undefined"!=typeof a?a("promise"):this.Promise,v=v||this.indexedDB||this.webkitIndexedDB||this.mozIndexedDB||this.OIndexedDB||this.msIndexedDB;if(v){var w,x="local-forage-detect-blob-support",y={_driver:"asyncStorage",_initStorage:k,iterate:m,getItem:l,setItem:n,removeItem:o,clear:p,length:q,key:r,keys:s};"undefined"!=typeof b&&b.exports&&"undefined"!=typeof a?b.exports=y:"function"==typeof define&&define.amd?define("asyncStorage",function(){return y}):this.asyncStorage=y}}).call(window)},{promise:95}],73:[function(a,b,c){(function(){"use strict";function c(b){var c=this,d={};if(b)for(var e in b)d[e]=b[e];d.keyPrefix=d.name+"/",c._dbInfo=d;var f=new m(function(b){r===q.DEFINE?a(["localforageSerializer"],b):b(r===q.EXPORT?a("./../utils/serializer"):n.localforageSerializer)});return f.then(function(a){return o=a,m.resolve()})}function d(a){var b=this,c=b.ready().then(function(){for(var a=b._dbInfo.keyPrefix,c=p.length-1;c>=0;c--){var d=p.key(c);0===d.indexOf(a)&&p.removeItem(d)}});return l(c,a),c}function e(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=c.ready().then(function(){var b=c._dbInfo,d=p.getItem(b.keyPrefix+a);return d&&(d=o.deserialize(d)),d});return l(d,b),d}function f(a,b){var c=this,d=c.ready().then(function(){for(var b=c._dbInfo.keyPrefix,d=b.length,e=p.length,f=1,g=0;g<e;g++){var h=p.key(g);if(0===h.indexOf(b)){var i=p.getItem(h);if(i&&(i=o.deserialize(i)),i=a(i,h.substring(d),f++),void 0!==i)return i}}});return l(d,b),d}function g(a,b){var c=this,d=c.ready().then(function(){var b,d=c._dbInfo;try{b=p.key(a)}catch(a){b=null}return b&&(b=b.substring(d.keyPrefix.length)),b});return l(d,b),d}function h(a){var b=this,c=b.ready().then(function(){for(var a=b._dbInfo,c=p.length,d=[],e=0;e<c;e++)0===p.key(e).indexOf(a.keyPrefix)&&d.push(p.key(e).substring(a.keyPrefix.length));return d});return l(c,a),c}function i(a){var b=this,c=b.keys().then(function(a){return a.length});return l(c,a),c}function j(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=c.ready().then(function(){var b=c._dbInfo;p.removeItem(b.keyPrefix+a)});return l(d,b),d}function k(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=d.ready().then(function(){void 0===b&&(b=null);var c=b;return new m(function(e,f){o.serialize(b,function(b,g){if(g)f(g);else try{var h=d._dbInfo;p.setItem(h.keyPrefix+a,b),e(c)}catch(a){"QuotaExceededError"!==a.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==a.name||f(a),f(a)}})})});return l(e,c),e}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m="undefined"!=typeof b&&b.exports&&"undefined"!=typeof a?a("promise"):this.Promise,n=this,o=null,p=null;try{if(!(this.localStorage&&"setItem"in this.localStorage))return;p=this.localStorage}catch(a){return}var q={DEFINE:1,EXPORT:2,WINDOW:3},r=q.WINDOW;"undefined"!=typeof b&&b.exports&&"undefined"!=typeof a?r=q.EXPORT:"function"==typeof define&&define.amd&&(r=q.DEFINE);var s={_driver:"localStorageWrapper",_initStorage:c,iterate:f,getItem:e,setItem:k,removeItem:j,clear:d,length:i,key:g,keys:h};r===q.EXPORT?b.exports=s:r===q.DEFINE?define("localStorageWrapper",function(){return s}):this.localStorageWrapper=s}).call(window)},{"./../utils/serializer":76,promise:95}],74:[function(a,b,c){(function(){"use strict";function c(b){var c=this,d={db:null};if(b)for(var e in b)d[e]="string"!=typeof b[e]?b[e].toString():b[e];var f=new m(function(b){r===q.DEFINE?a(["localforageSerializer"],b):b(r===q.EXPORT?a("./../utils/serializer"):n.localforageSerializer)}),g=new m(function(a,e){try{d.db=p(d.name,String(d.version),d.description,d.size)}catch(d){return c.setDriver(c.LOCALSTORAGE).then(function(){return c._initStorage(b)}).then(a).catch(e)}d.db.transaction(function(b){b.executeSql("CREATE TABLE IF NOT EXISTS "+d.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],function(){c._dbInfo=d,a()},function(a,b){e(b)})})});return f.then(function(a){return o=a,g})}function d(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new m(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[a],function(a,c){var d=c.rows.length?c.rows.item(0).value:null;d&&(d=o.deserialize(d)),b(d)},function(a,b){d(b)})})}).catch(d)});return l(d,b),d}function e(a,b){var c=this,d=new m(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT * FROM "+e.storeName,[],function(c,d){for(var e=d.rows,f=e.length,g=0;g<f;g++){var h=e.item(g),i=h.value;if(i&&(i=o.deserialize(i)),i=a(i,h.key,g+1),void 0!==i)return void b(i)}b()},function(a,b){d(b)})})}).catch(d)});return l(d,b),d}function f(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new m(function(c,e){d.ready().then(function(){void 0===b&&(b=null);var f=b;o.serialize(b,function(b,g){if(g)e(g);else{var h=d._dbInfo;h.db.transaction(function(d){d.executeSql("INSERT OR REPLACE INTO "+h.storeName+" (key, value) VALUES (?, ?)",[a,b],function(){c(f)},function(a,b){e(b)})},function(a){a.code===a.QUOTA_ERR&&e(a)})}})}).catch(e)});return l(e,c),e}function g(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new m(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("DELETE FROM "+e.storeName+" WHERE key = ?",[a],function(){b()},function(a,b){d(b)})})}).catch(d)});return l(d,b),d}function h(a){var b=this,c=new m(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})}).catch(c)});return l(c,a),c}function i(a){var b=this,c=new m(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){var d=c.rows.item(0).c;a(d)},function(a,b){c(b)})})}).catch(c)});return l(c,a),c}function j(a,b){var c=this,d=new m(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){var d=c.rows.length?c.rows.item(0).key:null;b(d)},function(a,b){d(b)})})}).catch(d)});return l(d,b),d}function k(a){var b=this,c=new m(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT key FROM "+d.storeName,[],function(b,c){for(var d=[],e=0;e<c.rows.length;e++)d.push(c.rows.item(e).key);a(d)},function(a,b){c(b)})})}).catch(c)});return l(c,a),c}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m="undefined"!=typeof b&&b.exports&&"undefined"!=typeof a?a("promise"):this.Promise,n=this,o=null,p=this.openDatabase;if(p){var q={DEFINE:1,EXPORT:2,WINDOW:3},r=q.WINDOW;"undefined"!=typeof b&&b.exports&&"undefined"!=typeof a?r=q.EXPORT:"function"==typeof define&&define.amd&&(r=q.DEFINE);var s={_driver:"webSQLStorage",_initStorage:c,iterate:e,getItem:d,setItem:f,removeItem:g,clear:h,length:i,key:j,keys:k};r===q.DEFINE?define("webSQLStorage",function(){return s}):r===q.EXPORT?b.exports=s:this.webSQLStorage=s}}).call(window)},{"./../utils/serializer":76,promise:95}],75:[function(a,b,c){(function(){"use strict";function c(a,b){a[b]=function(){var c=arguments;return a.ready().then(function(){return a[b].apply(a,c)})}}function d(){for(var a=1;a<arguments.length;a++){var b=arguments[a];if(b)for(var c in b)b.hasOwnProperty(c)&&(p(b[c])?arguments[0][c]=b[c].slice():arguments[0][c]=b[c])}return arguments[0]}function e(a){for(var b in i)if(i.hasOwnProperty(b)&&i[b]===a)return!0;return!1}function f(a){this._config=d({},m,a),this._driverSet=null,this._ready=!1,this._dbInfo=null;for(var b=0;b<k.length;b++)c(this,k[b]);this.setDriver(this._config.driver)}var g="undefined"!=typeof b&&b.exports&&"undefined"!=typeof a?a("promise"):this.Promise,h={},i={INDEXEDDB:"asyncStorage",LOCALSTORAGE:"localStorageWrapper",WEBSQL:"webSQLStorage"},j=[i.INDEXEDDB,i.WEBSQL,i.LOCALSTORAGE],k=["clear","getItem","iterate","key","keys","length","removeItem","setItem"],l={DEFINE:1,EXPORT:2,WINDOW:3},m={description:"",driver:j.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1},n=l.WINDOW;"undefined"!=typeof b&&b.exports&&"undefined"!=typeof a?n=l.EXPORT:"function"==typeof define&&define.amd&&(n=l.DEFINE);var o=function(a){var b=b||a.indexedDB||a.webkitIndexedDB||a.mozIndexedDB||a.OIndexedDB||a.msIndexedDB,c={};return c[i.WEBSQL]=!!a.openDatabase,c[i.INDEXEDDB]=!!function(){if("undefined"!=typeof a.openDatabase&&a.navigator&&a.navigator.userAgent&&/Safari/.test(a.navigator.userAgent)&&!/Chrome/.test(a.navigator.userAgent))return!1;try{return b&&"function"==typeof b.open&&"undefined"!=typeof a.IDBKeyRange}catch(a){return!1}}(),c[i.LOCALSTORAGE]=!!function(){try{return a.localStorage&&"setItem"in a.localStorage&&a.localStorage.setItem}catch(a){return!1}}(),c}(this),p=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},q=this;f.prototype.INDEXEDDB=i.INDEXEDDB,f.prototype.LOCALSTORAGE=i.LOCALSTORAGE,f.prototype.WEBSQL=i.WEBSQL,f.prototype.config=function(a){if("object"==typeof a){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var b in a)"storeName"===b&&(a[b]=a[b].replace(/\W/g,"_")),this._config[b]=a[b];return"driver"in a&&a.driver&&this.setDriver(this._config.driver),!0}return"string"==typeof a?this._config[a]:this._config},f.prototype.defineDriver=function(a,b,c){var d=new g(function(b,c){try{var d=a._driver,f=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver"),i=new Error("Custom driver name already in use: "+a._driver);if(!a._driver)return void c(f);if(e(a._driver))return void c(i);for(var j=k.concat("_initStorage"),l=0;l<j.length;l++){var m=j[l];if(!m||!a[m]||"function"!=typeof a[m])return void c(f)}var n=g.resolve(!0);"_support"in a&&(n=a._support&&"function"==typeof a._support?a._support():g.resolve(!!a._support)),n.then(function(c){o[d]=c,h[d]=a,b()},c)}catch(a){c(a)}});return d.then(b,c),d},f.prototype.driver=function(){return this._driver||null},f.prototype.ready=function(a){var b=this,c=new g(function(a,c){b._driverSet.then(function(){null===b._ready&&(b._ready=b._initStorage(b._config)),b._ready.then(a,c)}).catch(c)});return c.then(a,a),c},f.prototype.setDriver=function(b,c,d){function f(){i._config.driver=i.driver()}var i=this;return"string"==typeof b&&(b=[b]),this._driverSet=new g(function(c,d){var f=i._getFirstSupportedDriver(b),j=new Error("No available storage method found.");if(!f)return i._driverSet=g.reject(j),void d(j);if(i._dbInfo=null,i._ready=null,e(f)){var k=new g(function(b){if(n===l.DEFINE)a([f],b);else if(n===l.EXPORT)switch(f){case i.INDEXEDDB:b(a("./drivers/indexeddb"));break;case i.LOCALSTORAGE:b(a("./drivers/localstorage"));break;case i.WEBSQL:b(a("./drivers/websql"))}else b(q[f])});k.then(function(a){i._extend(a),c()})}else h[f]?(i._extend(h[f]),c()):(i._driverSet=g.reject(j),d(j))}),this._driverSet.then(f,f),this._driverSet.then(c,d),this._driverSet},f.prototype.supports=function(a){return!!o[a]},f.prototype._extend=function(a){d(this,a)},f.prototype._getFirstSupportedDriver=function(a){if(a&&p(a))for(var b=0;b<a.length;b++){var c=a[b];if(this.supports(c))return c}return null},f.prototype.createInstance=function(a){return new f(a)};var r=new f;n===l.DEFINE?define("localforage",function(){return r}):n===l.EXPORT?b.exports=r:this.localforage=r}).call(window)},{"./drivers/indexeddb":72,"./drivers/localstorage":73,"./drivers/websql":74,promise:95}],76:[function(a,b,c){(function(){"use strict";function c(a,b){a=a||[],b=b||{};try{return new Blob(a,b)}catch(f){if("TypeError"!==f.name)throw f;for(var c=y.BlobBuilder||y.MSBlobBuilder||y.MozBlobBuilder||y.WebKitBlobBuilder,d=new c,e=0;e<a.length;e+=1)d.append(a[e]);return d.getBlob(b.type)}}function d(a,b){var c="";if(a&&(c=a.toString()),a&&("[object ArrayBuffer]"===a.toString()||a.buffer&&"[object ArrayBuffer]"===a.buffer.toString())){var d,e=k;a instanceof ArrayBuffer?(d=a,e+=m):(d=a.buffer,"[object Int8Array]"===c?e+=o:"[object Uint8Array]"===c?e+=p:"[object Uint8ClampedArray]"===c?e+=q:"[object Int16Array]"===c?e+=r:"[object Uint16Array]"===c?e+=t:"[object Int32Array]"===c?e+=s:"[object Uint32Array]"===c?e+=u:"[object Float32Array]"===c?e+=v:"[object Float64Array]"===c?e+=w:b(new Error("Failed to get type for BinaryArray"))),b(e+g(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var c=i+a.type+"~"+g(this.result);b(k+n+c)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(c){console.error("Couldn't convert value into a JSON string: ",a),b(null,c)}}function e(a){if(a.substring(0,l)!==k)return JSON.parse(a);var b,d=a.substring(x),e=a.substring(l,x);if(e===n&&j.test(d)){var g=d.match(j);b=g[1],d=d.substring(g[0].length)}var h=f(d);switch(e){case m:return h;case n:return c([h],{type:b});case o:return new Int8Array(h);case p:return new Uint8Array(h);case q:return new Uint8ClampedArray(h);case r:return new Int16Array(h);case t:return new Uint16Array(h);case s:return new Int32Array(h);case u:return new Uint32Array(h);case v:return new Float32Array(h);case w:return new Float64Array(h);default:throw new Error("Unkown type: "+e)}}function f(a){var b,c,d,e,f,g=.75*a.length,i=a.length,j=0;"="===a[a.length-1]&&(g--,"="===a[a.length-2]&&g--);var k=new ArrayBuffer(g),l=new Uint8Array(k);for(b=0;b<i;b+=4)c=h.indexOf(a[b]),d=h.indexOf(a[b+1]),e=h.indexOf(a[b+2]),f=h.indexOf(a[b+3]),l[j++]=c<<2|d>>4,l[j++]=(15&d)<<4|e>>2,l[j++]=(3&e)<<6|63&f;return k}function g(a){var b,c=new Uint8Array(a),d="";for(b=0;b<c.length;b+=3)d+=h[c[b]>>2],d+=h[(3&c[b])<<4|c[b+1]>>4],d+=h[(15&c[b+1])<<2|c[b+2]>>6],d+=h[63&c[b+2]];return c.length%3===2?d=d.substring(0,d.length-1)+"=":c.length%3===1&&(d=d.substring(0,d.length-2)+"=="),d}var h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i="~~local_forage_type~",j=/^~~local_forage_type~([^~]+)~/,k="__lfsc__:",l=k.length,m="arbf",n="blob",o="si08",p="ui08",q="uic8",r="si16",s="si32",t="ur16",u="ui32",v="fl32",w="fl64",x=l+m.length,y=this,z={serialize:d,deserialize:e,stringToBuffer:f,bufferToString:g};"undefined"!=typeof b&&b.exports&&"undefined"!=typeof a?b.exports=z:"function"==typeof define&&define.amd?define("localforageSerializer",function(){return z}):this.localforageSerializer=z}).call(window)},{}],77:[function(a,b,c){"use strict";var d=a("./lib/utils/common").assign,e=a("./lib/deflate"),f=a("./lib/inflate"),g=a("./lib/zlib/constants"),h={};d(h,e,f,g),b.exports=h},{"./lib/deflate":78,"./lib/inflate":79,"./lib/utils/common":80,"./lib/zlib/constants":83}],78:[function(a,b,c){"use strict";function d(a){if(!(this instanceof d))return new d(a);this.options=i.assign({level:s,method:u,chunkSize:16384,windowBits:15,memLevel:8,strategy:t,to:""},a||{});var b=this.options;b.raw&&b.windowBits>0?b.windowBits=-b.windowBits:b.gzip&&b.windowBits>0&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var c=h.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(c!==p)throw new Error(k[c]);if(b.header&&h.deflateSetHeader(this.strm,b.header),b.dictionary){var e;if(e="string"==typeof b.dictionary?j.string2buf(b.dictionary):"[object ArrayBuffer]"===m.call(b.dictionary)?new Uint8Array(b.dictionary):b.dictionary,c=h.deflateSetDictionary(this.strm,e),c!==p)throw new Error(k[c]);this._dict_set=!0}}function e(a,b){var c=new d(b);if(c.push(a,!0),c.err)throw c.msg;return c.result}function f(a,b){return b=b||{},b.raw=!0,e(a,b)}function g(a,b){return b=b||{},b.gzip=!0,e(a,b)}var h=a("./zlib/deflate"),i=a("./utils/common"),j=a("./utils/strings"),k=a("./zlib/messages"),l=a("./zlib/zstream"),m=Object.prototype.toString,n=0,o=4,p=0,q=1,r=2,s=-1,t=0,u=8;d.prototype.push=function(a,b){var c,d,e=this.strm,f=this.options.chunkSize;if(this.ended)return!1;d=b===~~b?b:b===!0?o:n,"string"==typeof a?e.input=j.string2buf(a):"[object ArrayBuffer]"===m.call(a)?e.input=new Uint8Array(a):e.input=a,e.next_in=0,e.avail_in=e.input.length;do{if(0===e.avail_out&&(e.output=new i.Buf8(f),e.next_out=0,e.avail_out=f),c=h.deflate(e,d),c!==q&&c!==p)return this.onEnd(c),this.ended=!0,!1;0!==e.avail_out&&(0!==e.avail_in||d!==o&&d!==r)||("string"===this.options.to?this.onData(j.buf2binstring(i.shrinkBuf(e.output,e.next_out))):this.onData(i.shrinkBuf(e.output,e.next_out)))}while((e.avail_in>0||0===e.avail_out)&&c!==q);return d===o?(c=h.deflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===p):d!==r||(this.onEnd(p),e.avail_out=0,!0)},d.prototype.onData=function(a){this.chunks.push(a)},d.prototype.onEnd=function(a){a===p&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Deflate=d,c.deflate=e,c.deflateRaw=f,c.gzip=g},{"./utils/common":80,"./utils/strings":81,"./zlib/deflate":85,"./zlib/messages":90,"./zlib/zstream":92}],79:[function(a,b,c){"use strict";function d(a){if(!(this instanceof d))return new d(a);this.options=h.assign({chunkSize:16384,windowBits:0,to:""},a||{});var b=this.options;b.raw&&b.windowBits>=0&&b.windowBits<16&&(b.windowBits=-b.windowBits,0===b.windowBits&&(b.windowBits=-15)),!(b.windowBits>=0&&b.windowBits<16)||a&&a.windowBits||(b.windowBits+=32),b.windowBits>15&&b.windowBits<48&&0===(15&b.windowBits)&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var c=g.inflateInit2(this.strm,b.windowBits);if(c!==j.Z_OK)throw new Error(k[c]);this.header=new m,g.inflateGetHeader(this.strm,this.header)}function e(a,b){var c=new d(b);if(c.push(a,!0),c.err)throw c.msg;return c.result}function f(a,b){return b=b||{},b.raw=!0,e(a,b)}var g=a("./zlib/inflate"),h=a("./utils/common"),i=a("./utils/strings"),j=a("./zlib/constants"),k=a("./zlib/messages"),l=a("./zlib/zstream"),m=a("./zlib/gzheader"),n=Object.prototype.toString;d.prototype.push=function(a,b){var c,d,e,f,k,l,m=this.strm,o=this.options.chunkSize,p=this.options.dictionary,q=!1;if(this.ended)return!1;d=b===~~b?b:b===!0?j.Z_FINISH:j.Z_NO_FLUSH,"string"==typeof a?m.input=i.binstring2buf(a):"[object ArrayBuffer]"===n.call(a)?m.input=new Uint8Array(a):m.input=a,m.next_in=0,m.avail_in=m.input.length;do{if(0===m.avail_out&&(m.output=new h.Buf8(o),m.next_out=0,m.avail_out=o),c=g.inflate(m,j.Z_NO_FLUSH),c===j.Z_NEED_DICT&&p&&(l="string"==typeof p?i.string2buf(p):"[object ArrayBuffer]"===n.call(p)?new Uint8Array(p):p,c=g.inflateSetDictionary(this.strm,l)),c===j.Z_BUF_ERROR&&q===!0&&(c=j.Z_OK,q=!1),c!==j.Z_STREAM_END&&c!==j.Z_OK)return this.onEnd(c),this.ended=!0,!1;m.next_out&&(0!==m.avail_out&&c!==j.Z_STREAM_END&&(0!==m.avail_in||d!==j.Z_FINISH&&d!==j.Z_SYNC_FLUSH)||("string"===this.options.to?(e=i.utf8border(m.output,m.next_out),f=m.next_out-e,k=i.buf2string(m.output,e),m.next_out=f,m.avail_out=o-f,f&&h.arraySet(m.output,m.output,e,f,0),this.onData(k)):this.onData(h.shrinkBuf(m.output,m.next_out)))),0===m.avail_in&&0===m.avail_out&&(q=!0)}while((m.avail_in>0||0===m.avail_out)&&c!==j.Z_STREAM_END);return c===j.Z_STREAM_END&&(d=j.Z_FINISH),d===j.Z_FINISH?(c=g.inflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===j.Z_OK):d!==j.Z_SYNC_FLUSH||(this.onEnd(j.Z_OK),m.avail_out=0,!0)},d.prototype.onData=function(a){this.chunks.push(a)},d.prototype.onEnd=function(a){a===j.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Inflate=d,c.inflate=e,c.inflateRaw=f,c.ungzip=e},{"./utils/common":80,"./utils/strings":81,"./zlib/constants":83,"./zlib/gzheader":86,"./zlib/inflate":88,"./zlib/messages":90,"./zlib/zstream":92}],80:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;c.assign=function(a){for(var b=Array.prototype.slice.call(arguments,1);b.length;){var c=b.shift();if(c){if("object"!=typeof c)throw new TypeError(c+"must be non-object");for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}}return a},c.shrinkBuf=function(a,b){return a.length===b?a:a.subarray?a.subarray(0,b):(a.length=b,a)};var e={arraySet:function(a,b,c,d,e){if(b.subarray&&a.subarray)return void a.set(b.subarray(c,c+d),e);for(var f=0;f<d;f++)a[e+f]=b[c+f]},flattenChunks:function(a){var b,c,d,e,f,g;for(d=0,b=0,c=a.length;b<c;b++)d+=a[b].length;for(g=new Uint8Array(d),e=0,b=0,c=a.length;b<c;b++)f=a[b],g.set(f,e),e+=f.length;return g}},f={arraySet:function(a,b,c,d,e){for(var f=0;f<d;f++)a[e+f]=b[c+f]},flattenChunks:function(a){return[].concat.apply([],a)}};c.setTyped=function(a){a?(c.Buf8=Uint8Array,c.Buf16=Uint16Array,c.Buf32=Int32Array,c.assign(c,e)):(c.Buf8=Array,c.Buf16=Array,c.Buf32=Array,c.assign(c,f))},c.setTyped(d)},{}],81:[function(a,b,c){"use strict";function d(a,b){if(b<65537&&(a.subarray&&g||!a.subarray&&f))return String.fromCharCode.apply(null,e.shrinkBuf(a,b));for(var c="",d=0;d<b;d++)c+=String.fromCharCode(a[d]);return c}var e=a("./common"),f=!0,g=!0;try{String.fromCharCode.apply(null,[0])}catch(a){f=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(a){g=!1}for(var h=new e.Buf8(256),i=0;i<256;i++)h[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;h[254]=h[254]=1,c.string2buf=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;f<h;f++)c=a.charCodeAt(f),55296===(64512&c)&&f+1<h&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),i+=c<128?1:c<2048?2:c<65536?3:4;for(b=new e.Buf8(i),g=0,f=0;g<i;f++)c=a.charCodeAt(f),55296===(64512&c)&&f+1<h&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),c<128?b[g++]=c:c<2048?(b[g++]=192|c>>>6,b[g++]=128|63&c):c<65536?(b[g++]=224|c>>>12,b[g++]=128|c>>>6&63,b[g++]=128|63&c):(b[g++]=240|c>>>18,b[g++]=128|c>>>12&63,b[g++]=128|c>>>6&63,b[g++]=128|63&c);return b},c.buf2binstring=function(a){return d(a,a.length)},c.binstring2buf=function(a){for(var b=new e.Buf8(a.length),c=0,d=b.length;c<d;c++)b[c]=a.charCodeAt(c);return b},c.buf2string=function(a,b){var c,e,f,g,i=b||a.length,j=new Array(2*i);for(e=0,c=0;c<i;)if(f=a[c++],f<128)j[e++]=f;else if(g=h[f],g>4)j[e++]=65533,c+=g-1;else{for(f&=2===g?31:3===g?15:7;g>1&&c<i;)f=f<<6|63&a[c++],g--;g>1?j[e++]=65533:f<65536?j[e++]=f:(f-=65536,j[e++]=55296|f>>10&1023,j[e++]=56320|1023&f)}return d(j,e)},c.utf8border=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128===(192&a[c]);)c--;return c<0?b:0===c?b:c+h[a[c]]>b?c:b}},{"./common":80}],82:[function(a,b,c){"use strict";function d(a,b,c,d){for(var e=65535&a|0,f=a>>>16&65535|0,g=0;0!==c;){g=c>2e3?2e3:c,c-=g;do e=e+b[d++]|0,f=f+e|0;while(--g);e%=65521,f%=65521}return e|f<<16|0}b.exports=d},{}],83:[function(a,b,c){"use strict";b.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],84:[function(a,b,c){"use strict";function d(){for(var a,b=[],c=0;c<256;c++){a=c;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function e(a,b,c,d){var e=f,g=d+c;a^=-1;for(var h=d;h<g;h++)a=a>>>8^e[255&(a^b[h])];return a^-1}var f=d();b.exports=e},{}],85:[function(a,b,c){"use strict";function d(a,b){return a.msg=I[b],b}function e(a){return(a<<1)-(a>4?9:0)}function f(a){for(var b=a.length;--b>=0;)a[b]=0}function g(a){var b=a.state,c=b.pending;c>a.avail_out&&(c=a.avail_out),0!==c&&(E.arraySet(a.output,b.pending_buf,b.pending_out,c,a.next_out),a.next_out+=c,b.pending_out+=c,a.total_out+=c,a.avail_out-=c,b.pending-=c,0===b.pending&&(b.pending_out=0))}function h(a,b){F._tr_flush_block(a,a.block_start>=0?a.block_start:-1,a.strstart-a.block_start,b),a.block_start=a.strstart,g(a.strm)}function i(a,b){a.pending_buf[a.pending++]=b}function j(a,b){a.pending_buf[a.pending++]=b>>>8&255,a.pending_buf[a.pending++]=255&b}function k(a,b,c,d){var e=a.avail_in;return e>d&&(e=d),0===e?0:(a.avail_in-=e,E.arraySet(b,a.input,a.next_in,e,c),1===a.state.wrap?a.adler=G(a.adler,b,e,c):2===a.state.wrap&&(a.adler=H(a.adler,b,e,c)),a.next_in+=e,a.total_in+=e,e)}function l(a,b){var c,d,e=a.max_chain_length,f=a.strstart,g=a.prev_length,h=a.nice_match,i=a.strstart>a.w_size-la?a.strstart-(a.w_size-la):0,j=a.window,k=a.w_mask,l=a.prev,m=a.strstart+ka,n=j[f+g-1],o=j[f+g];a.prev_length>=a.good_match&&(e>>=2),h>a.lookahead&&(h=a.lookahead);do if(c=b,j[c+g]===o&&j[c+g-1]===n&&j[c]===j[f]&&j[++c]===j[f+1]){f+=2,c++;do;while(j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&f<m);if(d=ka-(m-f),f=m-ka,d>g){if(a.match_start=b,g=d,d>=h)break;n=j[f+g-1],o=j[f+g]}}while((b=l[b&k])>i&&0!==--e);return g<=a.lookahead?g:a.lookahead}function m(a){var b,c,d,e,f,g=a.w_size;do{if(e=a.window_size-a.lookahead-a.strstart,a.strstart>=g+(g-la)){E.arraySet(a.window,a.window,g,g,0),a.match_start-=g,a.strstart-=g,a.block_start-=g,c=a.hash_size,b=c;do d=a.head[--b],a.head[b]=d>=g?d-g:0;while(--c);c=g,b=c;do d=a.prev[--b],a.prev[b]=d>=g?d-g:0;while(--c);e+=g}if(0===a.strm.avail_in)break;if(c=k(a.strm,a.window,a.strstart+a.lookahead,e),a.lookahead+=c,a.lookahead+a.insert>=ja)for(f=a.strstart-a.insert,a.ins_h=a.window[f],a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+1])&a.hash_mask;a.insert&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+ja-1])&a.hash_mask,a.prev[f&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=f,f++,a.insert--,!(a.lookahead+a.insert<ja)););}while(a.lookahead<la&&0!==a.strm.avail_in)}function n(a,b){var c=65535;for(c>a.pending_buf_size-5&&(c=a.pending_buf_size-5);;){if(a.lookahead<=1){if(m(a),0===a.lookahead&&b===J)return ua;if(0===a.lookahead)break}a.strstart+=a.lookahead,a.lookahead=0;var d=a.block_start+c;if((0===a.strstart||a.strstart>=d)&&(a.lookahead=a.strstart-d,a.strstart=d,h(a,!1),0===a.strm.avail_out))return ua;if(a.strstart-a.block_start>=a.w_size-la&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=0,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.strstart>a.block_start&&(h(a,!1),0===a.strm.avail_out)?ua:ua}function o(a,b){for(var c,d;;){if(a.lookahead<la){if(m(a),a.lookahead<la&&b===J)return ua;if(0===a.lookahead)break}if(c=0,a.lookahead>=ja&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),0!==c&&a.strstart-c<=a.w_size-la&&(a.match_length=l(a,c)),a.match_length>=ja)if(d=F._tr_tally(a,a.strstart-a.match_start,a.match_length-ja),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=ja){
a.match_length--;do a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart;while(0!==--a.match_length);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else d=F._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(d&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=a.strstart<ja-1?a.strstart:ja-1,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function p(a,b){for(var c,d,e;;){if(a.lookahead<la){if(m(a),a.lookahead<la&&b===J)return ua;if(0===a.lookahead)break}if(c=0,a.lookahead>=ja&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),a.prev_length=a.match_length,a.prev_match=a.match_start,a.match_length=ja-1,0!==c&&a.prev_length<a.max_lazy_match&&a.strstart-c<=a.w_size-la&&(a.match_length=l(a,c),a.match_length<=5&&(a.strategy===U||a.match_length===ja&&a.strstart-a.match_start>4096)&&(a.match_length=ja-1)),a.prev_length>=ja&&a.match_length<=a.prev_length){e=a.strstart+a.lookahead-ja,d=F._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-ja),a.lookahead-=a.prev_length-1,a.prev_length-=2;do++a.strstart<=e&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ja-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);while(0!==--a.prev_length);if(a.match_available=0,a.match_length=ja-1,a.strstart++,d&&(h(a,!1),0===a.strm.avail_out))return ua}else if(a.match_available){if(d=F._tr_tally(a,0,a.window[a.strstart-1]),d&&h(a,!1),a.strstart++,a.lookahead--,0===a.strm.avail_out)return ua}else a.match_available=1,a.strstart++,a.lookahead--}return a.match_available&&(d=F._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0),a.insert=a.strstart<ja-1?a.strstart:ja-1,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function q(a,b){for(var c,d,e,f,g=a.window;;){if(a.lookahead<=ka){if(m(a),a.lookahead<=ka&&b===J)return ua;if(0===a.lookahead)break}if(a.match_length=0,a.lookahead>=ja&&a.strstart>0&&(e=a.strstart-1,d=g[e],d===g[++e]&&d===g[++e]&&d===g[++e])){f=a.strstart+ka;do;while(d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&e<f);a.match_length=ka-(f-e),a.match_length>a.lookahead&&(a.match_length=a.lookahead)}if(a.match_length>=ja?(c=F._tr_tally(a,1,a.match_length-ja),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(c=F._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++),c&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=0,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function r(a,b){for(var c;;){if(0===a.lookahead&&(m(a),0===a.lookahead)){if(b===J)return ua;break}if(a.match_length=0,c=F._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++,c&&(h(a,!1),0===a.strm.avail_out))return ua}return a.insert=0,b===M?(h(a,!0),0===a.strm.avail_out?wa:xa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ua:va}function s(a,b,c,d,e){this.good_length=a,this.max_lazy=b,this.nice_length=c,this.max_chain=d,this.func=e}function t(a){a.window_size=2*a.w_size,f(a.head),a.max_lazy_match=D[a.level].max_lazy,a.good_match=D[a.level].good_length,a.nice_match=D[a.level].nice_length,a.max_chain_length=D[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=ja-1,a.match_available=0,a.ins_h=0}function u(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=$,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new E.Buf16(2*ha),this.dyn_dtree=new E.Buf16(2*(2*fa+1)),this.bl_tree=new E.Buf16(2*(2*ga+1)),f(this.dyn_ltree),f(this.dyn_dtree),f(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new E.Buf16(ia+1),this.heap=new E.Buf16(2*ea+1),f(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new E.Buf16(2*ea+1),f(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function v(a){var b;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=Z,b=a.state,b.pending=0,b.pending_out=0,b.wrap<0&&(b.wrap=-b.wrap),b.status=b.wrap?na:sa,a.adler=2===b.wrap?0:1,b.last_flush=J,F._tr_init(b),O):d(a,Q)}function w(a){var b=v(a);return b===O&&t(a.state),b}function x(a,b){return a&&a.state?2!==a.state.wrap?Q:(a.state.gzhead=b,O):Q}function y(a,b,c,e,f,g){if(!a)return Q;var h=1;if(b===T&&(b=6),e<0?(h=0,e=-e):e>15&&(h=2,e-=16),f<1||f>_||c!==$||e<8||e>15||b<0||b>9||g<0||g>X)return d(a,Q);8===e&&(e=9);var i=new u;return a.state=i,i.strm=a,i.wrap=h,i.gzhead=null,i.w_bits=e,i.w_size=1<<i.w_bits,i.w_mask=i.w_size-1,i.hash_bits=f+7,i.hash_size=1<<i.hash_bits,i.hash_mask=i.hash_size-1,i.hash_shift=~~((i.hash_bits+ja-1)/ja),i.window=new E.Buf8(2*i.w_size),i.head=new E.Buf16(i.hash_size),i.prev=new E.Buf16(i.w_size),i.lit_bufsize=1<<f+6,i.pending_buf_size=4*i.lit_bufsize,i.pending_buf=new E.Buf8(i.pending_buf_size),i.d_buf=1*i.lit_bufsize,i.l_buf=3*i.lit_bufsize,i.level=b,i.strategy=g,i.method=c,w(a)}function z(a,b){return y(a,b,$,aa,ba,Y)}function A(a,b){var c,h,k,l;if(!a||!a.state||b>N||b<0)return a?d(a,Q):Q;if(h=a.state,!a.output||!a.input&&0!==a.avail_in||h.status===ta&&b!==M)return d(a,0===a.avail_out?S:Q);if(h.strm=a,c=h.last_flush,h.last_flush=b,h.status===na)if(2===h.wrap)a.adler=0,i(h,31),i(h,139),i(h,8),h.gzhead?(i(h,(h.gzhead.text?1:0)+(h.gzhead.hcrc?2:0)+(h.gzhead.extra?4:0)+(h.gzhead.name?8:0)+(h.gzhead.comment?16:0)),i(h,255&h.gzhead.time),i(h,h.gzhead.time>>8&255),i(h,h.gzhead.time>>16&255),i(h,h.gzhead.time>>24&255),i(h,9===h.level?2:h.strategy>=V||h.level<2?4:0),i(h,255&h.gzhead.os),h.gzhead.extra&&h.gzhead.extra.length&&(i(h,255&h.gzhead.extra.length),i(h,h.gzhead.extra.length>>8&255)),h.gzhead.hcrc&&(a.adler=H(a.adler,h.pending_buf,h.pending,0)),h.gzindex=0,h.status=oa):(i(h,0),i(h,0),i(h,0),i(h,0),i(h,0),i(h,9===h.level?2:h.strategy>=V||h.level<2?4:0),i(h,ya),h.status=sa);else{var m=$+(h.w_bits-8<<4)<<8,n=-1;n=h.strategy>=V||h.level<2?0:h.level<6?1:6===h.level?2:3,m|=n<<6,0!==h.strstart&&(m|=ma),m+=31-m%31,h.status=sa,j(h,m),0!==h.strstart&&(j(h,a.adler>>>16),j(h,65535&a.adler)),a.adler=1}if(h.status===oa)if(h.gzhead.extra){for(k=h.pending;h.gzindex<(65535&h.gzhead.extra.length)&&(h.pending!==h.pending_buf_size||(h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending!==h.pending_buf_size));)i(h,255&h.gzhead.extra[h.gzindex]),h.gzindex++;h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),h.gzindex===h.gzhead.extra.length&&(h.gzindex=0,h.status=pa)}else h.status=pa;if(h.status===pa)if(h.gzhead.name){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.name.length?255&h.gzhead.name.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.gzindex=0,h.status=qa)}else h.status=qa;if(h.status===qa)if(h.gzhead.comment){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.comment.length?255&h.gzhead.comment.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=H(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.status=ra)}else h.status=ra;if(h.status===ra&&(h.gzhead.hcrc?(h.pending+2>h.pending_buf_size&&g(a),h.pending+2<=h.pending_buf_size&&(i(h,255&a.adler),i(h,a.adler>>8&255),a.adler=0,h.status=sa)):h.status=sa),0!==h.pending){if(g(a),0===a.avail_out)return h.last_flush=-1,O}else if(0===a.avail_in&&e(b)<=e(c)&&b!==M)return d(a,S);if(h.status===ta&&0!==a.avail_in)return d(a,S);if(0!==a.avail_in||0!==h.lookahead||b!==J&&h.status!==ta){var o=h.strategy===V?r(h,b):h.strategy===W?q(h,b):D[h.level].func(h,b);if(o!==wa&&o!==xa||(h.status=ta),o===ua||o===wa)return 0===a.avail_out&&(h.last_flush=-1),O;if(o===va&&(b===K?F._tr_align(h):b!==N&&(F._tr_stored_block(h,0,0,!1),b===L&&(f(h.head),0===h.lookahead&&(h.strstart=0,h.block_start=0,h.insert=0))),g(a),0===a.avail_out))return h.last_flush=-1,O}return b!==M?O:h.wrap<=0?P:(2===h.wrap?(i(h,255&a.adler),i(h,a.adler>>8&255),i(h,a.adler>>16&255),i(h,a.adler>>24&255),i(h,255&a.total_in),i(h,a.total_in>>8&255),i(h,a.total_in>>16&255),i(h,a.total_in>>24&255)):(j(h,a.adler>>>16),j(h,65535&a.adler)),g(a),h.wrap>0&&(h.wrap=-h.wrap),0!==h.pending?O:P)}function B(a){var b;return a&&a.state?(b=a.state.status,b!==na&&b!==oa&&b!==pa&&b!==qa&&b!==ra&&b!==sa&&b!==ta?d(a,Q):(a.state=null,b===sa?d(a,R):O)):Q}function C(a,b){var c,d,e,g,h,i,j,k,l=b.length;if(!a||!a.state)return Q;if(c=a.state,g=c.wrap,2===g||1===g&&c.status!==na||c.lookahead)return Q;for(1===g&&(a.adler=G(a.adler,b,l,0)),c.wrap=0,l>=c.w_size&&(0===g&&(f(c.head),c.strstart=0,c.block_start=0,c.insert=0),k=new E.Buf8(c.w_size),E.arraySet(k,b,l-c.w_size,c.w_size,0),b=k,l=c.w_size),h=a.avail_in,i=a.next_in,j=a.input,a.avail_in=l,a.next_in=0,a.input=b,m(c);c.lookahead>=ja;){d=c.strstart,e=c.lookahead-(ja-1);do c.ins_h=(c.ins_h<<c.hash_shift^c.window[d+ja-1])&c.hash_mask,c.prev[d&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=d,d++;while(--e);c.strstart=d,c.lookahead=ja-1,m(c)}return c.strstart+=c.lookahead,c.block_start=c.strstart,c.insert=c.lookahead,c.lookahead=0,c.match_length=c.prev_length=ja-1,c.match_available=0,a.next_in=i,a.input=j,a.avail_in=h,c.wrap=g,O}var D,E=a("../utils/common"),F=a("./trees"),G=a("./adler32"),H=a("./crc32"),I=a("./messages"),J=0,K=1,L=3,M=4,N=5,O=0,P=1,Q=-2,R=-3,S=-5,T=-1,U=1,V=2,W=3,X=4,Y=0,Z=2,$=8,_=9,aa=15,ba=8,ca=29,da=256,ea=da+1+ca,fa=30,ga=19,ha=2*ea+1,ia=15,ja=3,ka=258,la=ka+ja+1,ma=32,na=42,oa=69,pa=73,qa=91,ra=103,sa=113,ta=666,ua=1,va=2,wa=3,xa=4,ya=3;D=[new s(0,0,0,0,n),new s(4,4,8,4,o),new s(4,5,16,8,o),new s(4,6,32,32,o),new s(4,4,16,16,p),new s(8,16,32,32,p),new s(8,16,128,128,p),new s(8,32,128,256,p),new s(32,128,258,1024,p),new s(32,258,258,4096,p)],c.deflateInit=z,c.deflateInit2=y,c.deflateReset=w,c.deflateResetKeep=v,c.deflateSetHeader=x,c.deflate=A,c.deflateEnd=B,c.deflateSetDictionary=C,c.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":80,"./adler32":82,"./crc32":84,"./messages":90,"./trees":91}],86:[function(a,b,c){"use strict";function d(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}b.exports=d},{}],87:[function(a,b,c){"use strict";var d=30,e=12;b.exports=function(a,b){var c,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C;c=a.state,f=a.next_in,B=a.input,g=f+(a.avail_in-5),h=a.next_out,C=a.output,i=h-(b-a.avail_out),j=h+(a.avail_out-257),k=c.dmax,l=c.wsize,m=c.whave,n=c.wnext,o=c.window,p=c.hold,q=c.bits,r=c.lencode,s=c.distcode,t=(1<<c.lenbits)-1,u=(1<<c.distbits)-1;a:do{q<15&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=r[p&t];b:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,0===w)C[h++]=65535&v;else{if(!(16&w)){if(0===(64&w)){v=r[(65535&v)+(p&(1<<w)-1)];continue b}if(32&w){c.mode=e;break a}a.msg="invalid literal/length code",c.mode=d;break a}x=65535&v,w&=15,w&&(q<w&&(p+=B[f++]<<q,q+=8),x+=p&(1<<w)-1,p>>>=w,q-=w),q<15&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=s[p&u];c:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,!(16&w)){if(0===(64&w)){v=s[(65535&v)+(p&(1<<w)-1)];continue c}a.msg="invalid distance code",c.mode=d;break a}if(y=65535&v,w&=15,q<w&&(p+=B[f++]<<q,q+=8,q<w&&(p+=B[f++]<<q,q+=8)),y+=p&(1<<w)-1,y>k){a.msg="invalid distance too far back",c.mode=d;break a}if(p>>>=w,q-=w,w=h-i,y>w){if(w=y-w,w>m&&c.sane){a.msg="invalid distance too far back",c.mode=d;break a}if(z=0,A=o,0===n){if(z+=l-w,w<x){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}else if(n<w){if(z+=l+n-w,w-=n,w<x){x-=w;do C[h++]=o[z++];while(--w);if(z=0,n<x){w=n,x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}}else if(z+=n-w,w<x){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}for(;x>2;)C[h++]=A[z++],C[h++]=A[z++],C[h++]=A[z++],x-=3;x&&(C[h++]=A[z++],x>1&&(C[h++]=A[z++]))}else{z=h-y;do C[h++]=C[z++],C[h++]=C[z++],C[h++]=C[z++],x-=3;while(x>2);x&&(C[h++]=C[z++],x>1&&(C[h++]=C[z++]))}break}}break}}while(f<g&&h<j);x=q>>3,f-=x,q-=x<<3,p&=(1<<q)-1,a.next_in=f,a.next_out=h,a.avail_in=f<g?5+(g-f):5-(f-g),a.avail_out=h<j?257+(j-h):257-(h-j),c.hold=p,c.bits=q}},{}],88:[function(a,b,c){"use strict";function d(a){return(a>>>24&255)+(a>>>8&65280)+((65280&a)<<8)+((255&a)<<24)}function e(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(a){var b;return a&&a.state?(b=a.state,a.total_in=a.total_out=b.total=0,a.msg="",b.wrap&&(a.adler=1&b.wrap),b.mode=L,b.last=0,b.havedict=0,b.dmax=32768,b.head=null,b.hold=0,b.bits=0,b.lencode=b.lendyn=new s.Buf32(pa),b.distcode=b.distdyn=new s.Buf32(qa),b.sane=1,b.back=-1,D):G}function g(a){var b;return a&&a.state?(b=a.state,b.wsize=0,b.whave=0,b.wnext=0,f(a)):G}function h(a,b){var c,d;return a&&a.state?(d=a.state,b<0?(c=0,b=-b):(c=(b>>4)+1,b<48&&(b&=15)),b&&(b<8||b>15)?G:(null!==d.window&&d.wbits!==b&&(d.window=null),d.wrap=c,d.wbits=b,g(a))):G}function i(a,b){var c,d;return a?(d=new e,a.state=d,d.window=null,c=h(a,b),c!==D&&(a.state=null),c):G}function j(a){return i(a,sa)}function k(a){if(ta){var b;for(q=new s.Buf32(512),r=new s.Buf32(32),b=0;b<144;)a.lens[b++]=8;for(;b<256;)a.lens[b++]=9;for(;b<280;)a.lens[b++]=7;for(;b<288;)a.lens[b++]=8;for(w(y,a.lens,0,288,q,0,a.work,{bits:9}),b=0;b<32;)a.lens[b++]=5;w(z,a.lens,0,32,r,0,a.work,{bits:5}),ta=!1}a.lencode=q,a.lenbits=9,a.distcode=r,a.distbits=5}function l(a,b,c,d){var e,f=a.state;return null===f.window&&(f.wsize=1<<f.wbits,f.wnext=0,f.whave=0,f.window=new s.Buf8(f.wsize)),d>=f.wsize?(s.arraySet(f.window,b,c-f.wsize,f.wsize,0),f.wnext=0,f.whave=f.wsize):(e=f.wsize-f.wnext,e>d&&(e=d),s.arraySet(f.window,b,c-d,e,f.wnext),d-=e,d?(s.arraySet(f.window,b,c-d,d,0),f.wnext=d,f.whave=f.wsize):(f.wnext+=e,f.wnext===f.wsize&&(f.wnext=0),f.whave<f.wsize&&(f.whave+=e))),0}function m(a,b){var c,e,f,g,h,i,j,m,n,o,p,q,r,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa=0,Ba=new s.Buf8(4),Ca=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return G;c=a.state,c.mode===W&&(c.mode=X),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,o=i,p=j,xa=D;a:for(;;)switch(c.mode){case L:if(0===c.wrap){c.mode=X;break}for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(2&c.wrap&&35615===m){c.check=0,Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0),m=0,n=0,c.mode=M;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&m)<<8)+(m>>8))%31){a.msg="incorrect header check",c.mode=ma;break}if((15&m)!==K){a.msg="unknown compression method",c.mode=ma;break}if(m>>>=4,n-=4,wa=(15&m)+8,0===c.wbits)c.wbits=wa;else if(wa>c.wbits){a.msg="invalid window size",c.mode=ma;break}c.dmax=1<<wa,a.adler=c.check=1,c.mode=512&m?U:W,m=0,n=0;break;case M:for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.flags=m,(255&c.flags)!==K){a.msg="unknown compression method",c.mode=ma;break}if(57344&c.flags){a.msg="unknown header flags set",c.mode=ma;break}c.head&&(c.head.text=m>>8&1),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0,c.mode=N;case N:for(;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.time=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,Ba[2]=m>>>16&255,Ba[3]=m>>>24&255,c.check=u(c.check,Ba,4,0)),m=0,n=0,c.mode=O;case O:for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.xflags=255&m,c.head.os=m>>8),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0,c.mode=P;case P:if(1024&c.flags){for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length=m,c.head&&(c.head.extra_len=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0}else c.head&&(c.head.extra=null);c.mode=Q;case Q:if(1024&c.flags&&(q=c.length,q>i&&(q=i),q&&(c.head&&(wa=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),s.arraySet(c.head.extra,e,g,q,wa)),512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,c.length-=q),c.length))break a;c.length=0,c.mode=R;case R:if(2048&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.name+=String.fromCharCode(wa));while(wa&&q<i);if(512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.name=null);c.length=0,c.mode=S;case S:if(4096&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.comment+=String.fromCharCode(wa));while(wa&&q<i);if(512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.comment=null);c.mode=T;case T:if(512&c.flags){for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(65535&c.check)){a.msg="header crc mismatch",c.mode=ma;break}m=0,n=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),a.adler=c.check=0,c.mode=W;break;case U:for(;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}a.adler=c.check=d(m),m=0,n=0,c.mode=V;case V:if(0===c.havedict)return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,F;a.adler=c.check=1,c.mode=W;case W:if(b===B||b===C)break a;case X:if(c.last){m>>>=7&n,n-=7&n,c.mode=ja;break}for(;n<3;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}switch(c.last=1&m,m>>>=1,n-=1,3&m){case 0:c.mode=Y;break;case 1:if(k(c),c.mode=ca,b===C){m>>>=2,n-=2;break a}break;case 2:c.mode=_;break;case 3:a.msg="invalid block type",c.mode=ma}m>>>=2,n-=2;break;case Y:for(m>>>=7&n,n-=7&n;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if((65535&m)!==(m>>>16^65535)){a.msg="invalid stored block lengths",c.mode=ma;break}if(c.length=65535&m,m=0,n=0,c.mode=Z,b===C)break a;case Z:c.mode=$;case $:if(q=c.length){if(q>i&&(q=i),q>j&&(q=j),0===q)break a;s.arraySet(f,e,g,q,h),i-=q,g+=q,j-=q,h+=q,c.length-=q;break}c.mode=W;break;case _:for(;n<14;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.nlen=(31&m)+257,m>>>=5,n-=5,c.ndist=(31&m)+1,m>>>=5,n-=5,c.ncode=(15&m)+4,m>>>=4,n-=4,c.nlen>286||c.ndist>30){a.msg="too many length or distance symbols",c.mode=ma;break}c.have=0,c.mode=aa;case aa:for(;c.have<c.ncode;){for(;n<3;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.lens[Ca[c.have++]]=7&m,m>>>=3,n-=3}for(;c.have<19;)c.lens[Ca[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,ya={bits:c.lenbits},xa=w(x,c.lens,0,19,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid code lengths set",c.mode=ma;break}c.have=0,c.mode=ba;case ba:for(;c.have<c.nlen+c.ndist;){for(;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(sa<16)m>>>=qa,n-=qa,c.lens[c.have++]=sa;else{if(16===sa){for(za=qa+2;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m>>>=qa,n-=qa,0===c.have){a.msg="invalid bit length repeat",c.mode=ma;break}wa=c.lens[c.have-1],q=3+(3&m),m>>>=2,n-=2}else if(17===sa){for(za=qa+3;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=3+(7&m),m>>>=3,n-=3}else{for(za=qa+7;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=11+(127&m),m>>>=7,n-=7}if(c.have+q>c.nlen+c.ndist){a.msg="invalid bit length repeat",c.mode=ma;break}for(;q--;)c.lens[c.have++]=wa}}if(c.mode===ma)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block",c.mode=ma;break}if(c.lenbits=9,ya={bits:c.lenbits},xa=w(y,c.lens,0,c.nlen,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid literal/lengths set",c.mode=ma;break}if(c.distbits=6,c.distcode=c.distdyn,ya={bits:c.distbits},xa=w(z,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,ya),c.distbits=ya.bits,xa){a.msg="invalid distances set",c.mode=ma;break}if(c.mode=ca,b===C)break a;case ca:c.mode=da;case da:if(i>=6&&j>=258){a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,v(a,p),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,c.mode===W&&(c.back=-1);break}for(c.back=0;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(ra&&0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.lencode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(ta+qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,c.length=sa,0===ra){c.mode=ia;break}if(32&ra){c.back=-1,c.mode=W;break}if(64&ra){a.msg="invalid literal/length code",c.mode=ma;break}c.extra=15&ra,c.mode=ea;case ea:if(c.extra){for(za=c.extra;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=fa;case fa:for(;Aa=c.distcode[m&(1<<c.distbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.distcode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(ta+qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,64&ra){a.msg="invalid distance code",c.mode=ma;break}c.offset=sa,c.extra=15&ra,c.mode=ga;case ga:if(c.extra){for(za=c.extra;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.offset+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back",c.mode=ma;break}c.mode=ha;case ha:if(0===j)break a;if(q=p-j,c.offset>q){if(q=c.offset-q,q>c.whave&&c.sane){a.msg="invalid distance too far back",c.mode=ma;break}q>c.wnext?(q-=c.wnext,r=c.wsize-q):r=c.wnext-q,q>c.length&&(q=c.length),pa=c.window}else pa=f,r=h-c.offset,q=c.length;q>j&&(q=j),j-=q,c.length-=q;do f[h++]=pa[r++];while(--q);0===c.length&&(c.mode=da);break;case ia:if(0===j)break a;f[h++]=c.length,j--,c.mode=da;break;case ja:if(c.wrap){for(;n<32;){if(0===i)break a;i--,m|=e[g++]<<n,n+=8}if(p-=j,a.total_out+=p,c.total+=p,p&&(a.adler=c.check=c.flags?u(c.check,f,p,h-p):t(c.check,f,p,h-p)),p=j,(c.flags?m:d(m))!==c.check){a.msg="incorrect data check",c.mode=ma;break}m=0,n=0}c.mode=ka;case ka:if(c.wrap&&c.flags){for(;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(4294967295&c.total)){a.msg="incorrect length check",c.mode=ma;break}m=0,n=0}c.mode=la;case la:xa=E;break a;case ma:xa=H;break a;case na:return I;case oa:default:return G}return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,(c.wsize||p!==a.avail_out&&c.mode<ma&&(c.mode<ja||b!==A))&&l(a,a.output,a.next_out,p-a.avail_out)?(c.mode=na,I):(o-=a.avail_in,p-=a.avail_out,a.total_in+=o,a.total_out+=p,c.total+=p,c.wrap&&p&&(a.adler=c.check=c.flags?u(c.check,f,p,a.next_out-p):t(c.check,f,p,a.next_out-p)),a.data_type=c.bits+(c.last?64:0)+(c.mode===W?128:0)+(c.mode===ca||c.mode===Z?256:0),(0===o&&0===p||b===A)&&xa===D&&(xa=J),xa)}function n(a){if(!a||!a.state)return G;var b=a.state;return b.window&&(b.window=null),a.state=null,D}function o(a,b){var c;return a&&a.state?(c=a.state,0===(2&c.wrap)?G:(c.head=b,b.done=!1,D)):G}function p(a,b){var c,d,e,f=b.length;return a&&a.state?(c=a.state,0!==c.wrap&&c.mode!==V?G:c.mode===V&&(d=1,d=t(d,b,f,0),d!==c.check)?H:(e=l(a,b,f,f))?(c.mode=na,I):(c.havedict=1,D)):G}var q,r,s=a("../utils/common"),t=a("./adler32"),u=a("./crc32"),v=a("./inffast"),w=a("./inftrees"),x=0,y=1,z=2,A=4,B=5,C=6,D=0,E=1,F=2,G=-2,H=-3,I=-4,J=-5,K=8,L=1,M=2,N=3,O=4,P=5,Q=6,R=7,S=8,T=9,U=10,V=11,W=12,X=13,Y=14,Z=15,$=16,_=17,aa=18,ba=19,ca=20,da=21,ea=22,fa=23,ga=24,ha=25,ia=26,ja=27,ka=28,la=29,ma=30,na=31,oa=32,pa=852,qa=592,ra=15,sa=ra,ta=!0;c.inflateReset=g,c.inflateReset2=h,c.inflateResetKeep=f,c.inflateInit=j,c.inflateInit2=i,c.inflate=m,c.inflateEnd=n,c.inflateGetHeader=o,c.inflateSetDictionary=p,c.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":80,"./adler32":82,"./crc32":84,"./inffast":87,"./inftrees":89}],89:[function(a,b,c){"use strict";var d=a("../utils/common"),e=15,f=852,g=592,h=0,i=1,j=2,k=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],m=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],n=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];b.exports=function(a,b,c,o,p,q,r,s){var t,u,v,w,x,y,z,A,B,C=s.bits,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=null,O=0,P=new d.Buf16(e+1),Q=new d.Buf16(e+1),R=null,S=0;for(D=0;D<=e;D++)P[D]=0;for(E=0;E<o;E++)P[b[c+E]]++;for(H=C,G=e;G>=1&&0===P[G];G--);if(H>G&&(H=G),0===G)return p[q++]=20971520,p[q++]=20971520,s.bits=1,0;for(F=1;F<G&&0===P[F];F++);for(H<F&&(H=F),K=1,D=1;D<=e;D++)if(K<<=1,K-=P[D],K<0)return-1;if(K>0&&(a===h||1!==G))return-1;for(Q[1]=0,D=1;D<e;D++)Q[D+1]=Q[D]+P[D];for(E=0;E<o;E++)0!==b[c+E]&&(r[Q[b[c+E]]++]=E);if(a===h?(N=R=r,y=19):a===i?(N=k,O-=257,R=l,S-=257,y=256):(N=m,R=n,y=-1),M=0,E=0,D=F,x=q,I=H,J=0,v=-1,L=1<<H,w=L-1,a===i&&L>f||a===j&&L>g)return 1;for(var T=0;;){T++,z=D-J,r[E]<y?(A=0,B=r[E]):r[E]>y?(A=R[S+r[E]],B=N[O+r[E]]):(A=96,B=0),t=1<<D-J,u=1<<I,F=u;do u-=t,p[x+(M>>J)+u]=z<<24|A<<16|B|0;while(0!==u);for(t=1<<D-1;M&t;)t>>=1;if(0!==t?(M&=t-1,M+=t):M=0,E++,0===--P[D]){if(D===G)break;D=b[c+r[E]]}if(D>H&&(M&w)!==v){for(0===J&&(J=H),x+=F,I=D-J,K=1<<I;I+J<G&&(K-=P[I+J],!(K<=0));)I++,K<<=1;if(L+=1<<I,a===i&&L>f||a===j&&L>g)return 1;v=M&w,p[v]=H<<24|I<<16|x-q|0}}return 0!==M&&(p[x+M]=D-J<<24|64<<16|0),s.bits=H,0}},{"../utils/common":80}],90:[function(a,b,c){"use strict";b.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],91:[function(a,b,c){"use strict";function d(a){for(var b=a.length;--b>=0;)a[b]=0}function e(a,b,c,d,e){this.static_tree=a,this.extra_bits=b,this.extra_base=c,this.elems=d,this.max_length=e,this.has_stree=a&&a.length}function f(a,b){this.dyn_tree=a,this.max_code=0,this.stat_desc=b}function g(a){return a<256?ia[a]:ia[256+(a>>>7)]}function h(a,b){a.pending_buf[a.pending++]=255&b,a.pending_buf[a.pending++]=b>>>8&255}function i(a,b,c){a.bi_valid>X-c?(a.bi_buf|=b<<a.bi_valid&65535,h(a,a.bi_buf),a.bi_buf=b>>X-a.bi_valid,a.bi_valid+=c-X):(a.bi_buf|=b<<a.bi_valid&65535,a.bi_valid+=c)}function j(a,b,c){i(a,c[2*b],c[2*b+1])}function k(a,b){var c=0;do c|=1&a,a>>>=1,c<<=1;while(--b>0);return c>>>1}function l(a){16===a.bi_valid?(h(a,a.bi_buf),a.bi_buf=0,a.bi_valid=0):a.bi_valid>=8&&(a.pending_buf[a.pending++]=255&a.bi_buf,a.bi_buf>>=8,a.bi_valid-=8)}function m(a,b){var c,d,e,f,g,h,i=b.dyn_tree,j=b.max_code,k=b.stat_desc.static_tree,l=b.stat_desc.has_stree,m=b.stat_desc.extra_bits,n=b.stat_desc.extra_base,o=b.stat_desc.max_length,p=0;for(f=0;f<=W;f++)a.bl_count[f]=0;for(i[2*a.heap[a.heap_max]+1]=0,c=a.heap_max+1;c<V;c++)d=a.heap[c],f=i[2*i[2*d+1]+1]+1,f>o&&(f=o,p++),i[2*d+1]=f,d>j||(a.bl_count[f]++,g=0,d>=n&&(g=m[d-n]),h=i[2*d],a.opt_len+=h*(f+g),l&&(a.static_len+=h*(k[2*d+1]+g)));if(0!==p){do{for(f=o-1;0===a.bl_count[f];)f--;a.bl_count[f]--,a.bl_count[f+1]+=2,a.bl_count[o]--,p-=2}while(p>0);for(f=o;0!==f;f--)for(d=a.bl_count[f];0!==d;)e=a.heap[--c],e>j||(i[2*e+1]!==f&&(a.opt_len+=(f-i[2*e+1])*i[2*e],i[2*e+1]=f),d--)}}function n(a,b,c){var d,e,f=new Array(W+1),g=0;for(d=1;d<=W;d++)f[d]=g=g+c[d-1]<<1;for(e=0;e<=b;e++){var h=a[2*e+1];0!==h&&(a[2*e]=k(f[h]++,h))}}function o(){var a,b,c,d,f,g=new Array(W+1);for(c=0,d=0;d<Q-1;d++)for(ka[d]=c,a=0;a<1<<ba[d];a++)ja[c++]=d;for(ja[c-1]=d,f=0,d=0;d<16;d++)for(la[d]=f,a=0;a<1<<ca[d];a++)ia[f++]=d;for(f>>=7;d<T;d++)for(la[d]=f<<7,a=0;a<1<<ca[d]-7;a++)ia[256+f++]=d;for(b=0;b<=W;b++)g[b]=0;for(a=0;a<=143;)ga[2*a+1]=8,a++,g[8]++;for(;a<=255;)ga[2*a+1]=9,a++,g[9]++;for(;a<=279;)ga[2*a+1]=7,a++,g[7]++;for(;a<=287;)ga[2*a+1]=8,a++,g[8]++;for(n(ga,S+1,g),a=0;a<T;a++)ha[2*a+1]=5,ha[2*a]=k(a,5);ma=new e(ga,ba,R+1,S,W),na=new e(ha,ca,0,T,W),oa=new e(new Array(0),da,0,U,Y)}function p(a){var b;for(b=0;b<S;b++)a.dyn_ltree[2*b]=0;for(b=0;b<T;b++)a.dyn_dtree[2*b]=0;for(b=0;b<U;b++)a.bl_tree[2*b]=0;a.dyn_ltree[2*Z]=1,a.opt_len=a.static_len=0,a.last_lit=a.matches=0}function q(a){a.bi_valid>8?h(a,a.bi_buf):a.bi_valid>0&&(a.pending_buf[a.pending++]=a.bi_buf),a.bi_buf=0,a.bi_valid=0}function r(a,b,c,d){q(a),d&&(h(a,c),h(a,~c)),G.arraySet(a.pending_buf,a.window,b,c,a.pending),a.pending+=c}function s(a,b,c,d){var e=2*b,f=2*c;return a[e]<a[f]||a[e]===a[f]&&d[b]<=d[c]}function t(a,b,c){for(var d=a.heap[c],e=c<<1;e<=a.heap_len&&(e<a.heap_len&&s(b,a.heap[e+1],a.heap[e],a.depth)&&e++,!s(b,d,a.heap[e],a.depth));)a.heap[c]=a.heap[e],c=e,e<<=1;a.heap[c]=d}function u(a,b,c){var d,e,f,h,k=0;if(0!==a.last_lit)do d=a.pending_buf[a.d_buf+2*k]<<8|a.pending_buf[a.d_buf+2*k+1],e=a.pending_buf[a.l_buf+k],k++,0===d?j(a,e,b):(f=ja[e],j(a,f+R+1,b),h=ba[f],0!==h&&(e-=ka[f],i(a,e,h)),d--,f=g(d),j(a,f,c),h=ca[f],0!==h&&(d-=la[f],i(a,d,h)));while(k<a.last_lit);j(a,Z,b)}function v(a,b){var c,d,e,f=b.dyn_tree,g=b.stat_desc.static_tree,h=b.stat_desc.has_stree,i=b.stat_desc.elems,j=-1;for(a.heap_len=0,a.heap_max=V,c=0;c<i;c++)0!==f[2*c]?(a.heap[++a.heap_len]=j=c,a.depth[c]=0):f[2*c+1]=0;for(;a.heap_len<2;)e=a.heap[++a.heap_len]=j<2?++j:0,f[2*e]=1,a.depth[e]=0,a.opt_len--,h&&(a.static_len-=g[2*e+1]);for(b.max_code=j,c=a.heap_len>>1;c>=1;c--)t(a,f,c);e=i;do c=a.heap[1],a.heap[1]=a.heap[a.heap_len--],t(a,f,1),d=a.heap[1],a.heap[--a.heap_max]=c,a.heap[--a.heap_max]=d,f[2*e]=f[2*c]+f[2*d],a.depth[e]=(a.depth[c]>=a.depth[d]?a.depth[c]:a.depth[d])+1,f[2*c+1]=f[2*d+1]=e,a.heap[1]=e++,t(a,f,1);while(a.heap_len>=2);a.heap[--a.heap_max]=a.heap[1],m(a,b),n(f,j,a.bl_count)}function w(a,b,c){var d,e,f=-1,g=b[1],h=0,i=7,j=4;for(0===g&&(i=138,j=3),b[2*(c+1)+1]=65535,d=0;d<=c;d++)e=g,g=b[2*(d+1)+1],++h<i&&e===g||(h<j?a.bl_tree[2*e]+=h:0!==e?(e!==f&&a.bl_tree[2*e]++,a.bl_tree[2*$]++):h<=10?a.bl_tree[2*_]++:a.bl_tree[2*aa]++,h=0,f=e,0===g?(i=138,j=3):e===g?(i=6,j=3):(i=7,j=4))}function x(a,b,c){var d,e,f=-1,g=b[1],h=0,k=7,l=4;for(0===g&&(k=138,l=3),d=0;d<=c;d++)if(e=g,g=b[2*(d+1)+1],!(++h<k&&e===g)){if(h<l){do j(a,e,a.bl_tree);while(0!==--h)}else 0!==e?(e!==f&&(j(a,e,a.bl_tree),h--),j(a,$,a.bl_tree),i(a,h-3,2)):h<=10?(j(a,_,a.bl_tree),i(a,h-3,3)):(j(a,aa,a.bl_tree),i(a,h-11,7));h=0,f=e,0===g?(k=138,l=3):e===g?(k=6,l=3):(k=7,l=4)}}function y(a){var b;for(w(a,a.dyn_ltree,a.l_desc.max_code),w(a,a.dyn_dtree,a.d_desc.max_code),v(a,a.bl_desc),b=U-1;b>=3&&0===a.bl_tree[2*ea[b]+1];b--);return a.opt_len+=3*(b+1)+5+5+4,b}function z(a,b,c,d){var e;for(i(a,b-257,5),i(a,c-1,5),i(a,d-4,4),e=0;e<d;e++)i(a,a.bl_tree[2*ea[e]+1],3);x(a,a.dyn_ltree,b-1),x(a,a.dyn_dtree,c-1)}function A(a){var b,c=4093624447;for(b=0;b<=31;b++,c>>>=1)if(1&c&&0!==a.dyn_ltree[2*b])return I;if(0!==a.dyn_ltree[18]||0!==a.dyn_ltree[20]||0!==a.dyn_ltree[26])return J;for(b=32;b<R;b++)if(0!==a.dyn_ltree[2*b])return J;return I}function B(a){
pa||(o(),pa=!0),a.l_desc=new f(a.dyn_ltree,ma),a.d_desc=new f(a.dyn_dtree,na),a.bl_desc=new f(a.bl_tree,oa),a.bi_buf=0,a.bi_valid=0,p(a)}function C(a,b,c,d){i(a,(L<<1)+(d?1:0),3),r(a,b,c,!0)}function D(a){i(a,M<<1,3),j(a,Z,ga),l(a)}function E(a,b,c,d){var e,f,g=0;a.level>0?(a.strm.data_type===K&&(a.strm.data_type=A(a)),v(a,a.l_desc),v(a,a.d_desc),g=y(a),e=a.opt_len+3+7>>>3,f=a.static_len+3+7>>>3,f<=e&&(e=f)):e=f=c+5,c+4<=e&&b!==-1?C(a,b,c,d):a.strategy===H||f===e?(i(a,(M<<1)+(d?1:0),3),u(a,ga,ha)):(i(a,(N<<1)+(d?1:0),3),z(a,a.l_desc.max_code+1,a.d_desc.max_code+1,g+1),u(a,a.dyn_ltree,a.dyn_dtree)),p(a),d&&q(a)}function F(a,b,c){return a.pending_buf[a.d_buf+2*a.last_lit]=b>>>8&255,a.pending_buf[a.d_buf+2*a.last_lit+1]=255&b,a.pending_buf[a.l_buf+a.last_lit]=255&c,a.last_lit++,0===b?a.dyn_ltree[2*c]++:(a.matches++,b--,a.dyn_ltree[2*(ja[c]+R+1)]++,a.dyn_dtree[2*g(b)]++),a.last_lit===a.lit_bufsize-1}var G=a("../utils/common"),H=4,I=0,J=1,K=2,L=0,M=1,N=2,O=3,P=258,Q=29,R=256,S=R+1+Q,T=30,U=19,V=2*S+1,W=15,X=16,Y=7,Z=256,$=16,_=17,aa=18,ba=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ca=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],da=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ea=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],fa=512,ga=new Array(2*(S+2));d(ga);var ha=new Array(2*T);d(ha);var ia=new Array(fa);d(ia);var ja=new Array(P-O+1);d(ja);var ka=new Array(Q);d(ka);var la=new Array(T);d(la);var ma,na,oa,pa=!1;c._tr_init=B,c._tr_stored_block=C,c._tr_flush_block=E,c._tr_tally=F,c._tr_align=D},{"../utils/common":80}],92:[function(a,b,c){"use strict";function d(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}b.exports=d},{}],93:[function(a,b,c){function d(){k=!1,h.length?j=h.concat(j):l=-1,j.length&&e()}function e(){if(!k){var a=setTimeout(d);k=!0;for(var b=j.length;b;){for(h=j,j=[];++l<b;)h&&h[l].run();l=-1,b=j.length}h=null,k=!1,clearTimeout(a)}}function f(a,b){this.fun=a,this.array=b}function g(){}var h,i=b.exports={},j=[],k=!1,l=-1;i.nextTick=function(a){var b=new Array(arguments.length-1);if(arguments.length>1)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];j.push(new f(a,b)),1!==j.length||k||setTimeout(e,0)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.binding=function(a){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(a){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],94:[function(a,b,c){"use strict";function d(a){function b(a){return null===j?void l.push(a):void g(function(){var b=j?a.onFulfilled:a.onRejected;if(null===b)return void(j?a.resolve:a.reject)(k);var c;try{c=b(k)}catch(b){return void a.reject(b)}a.resolve(c)})}function c(a){try{if(a===m)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"==typeof a||"function"==typeof a)){var b=a.then;if("function"==typeof b)return void f(b.bind(a),c,h)}j=!0,k=a,i()}catch(a){h(a)}}function h(a){j=!1,k=a,i()}function i(){for(var a=0,c=l.length;a<c;a++)b(l[a]);l=null}if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");var j=null,k=null,l=[],m=this;this.then=function(a,c){return new d(function(d,f){b(new e(a,c,d,f))})},f(a,c,h)}function e(a,b,c,d){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.resolve=c,this.reject=d}function f(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(a){if(d)return;d=!0,c(a)}}var g=a("asap");b.exports=d},{asap:36}],95:[function(a,b,c){"use strict";function d(a){this.then=function(b){return"function"!=typeof b?this:new e(function(c,d){f(function(){try{c(b(a))}catch(a){d(a)}})})}}var e=a("./core.js"),f=a("asap");b.exports=e,d.prototype=Object.create(e.prototype);var g=new d(!0),h=new d(!1),i=new d(null),j=new d(void 0),k=new d(0),l=new d("");e.resolve=function(a){if(a instanceof e)return a;if(null===a)return i;if(void 0===a)return j;if(a===!0)return g;if(a===!1)return h;if(0===a)return k;if(""===a)return l;if("object"==typeof a||"function"==typeof a)try{var b=a.then;if("function"==typeof b)return new e(b.bind(a))}catch(a){return new e(function(b,c){c(a)})}return new d(a)},e.from=e.cast=function(a){var b=new Error("Promise.from and Promise.cast are deprecated, use Promise.resolve instead");return b.name="Warning",console.warn(b.stack),e.resolve(a)},e.denodeify=function(a,b){return b=b||1/0,function(){var c=this,d=Array.prototype.slice.call(arguments);return new e(function(e,f){for(;d.length&&d.length>b;)d.pop();d.push(function(a,b){a?f(a):e(b)}),a.apply(c,d)})}},e.nodeify=function(a){return function(){var b=Array.prototype.slice.call(arguments),c="function"==typeof b[b.length-1]?b.pop():null;try{return a.apply(this,arguments).nodeify(c)}catch(a){if(null===c||"undefined"==typeof c)return new e(function(b,c){c(a)});f(function(){c(a)})}}},e.all=function(){var a=1===arguments.length&&Array.isArray(arguments[0]),b=Array.prototype.slice.call(a?arguments[0]:arguments);if(!a){var c=new Error("Promise.all should be called with a single array, calling it with multiple arguments is deprecated");c.name="Warning",console.warn(c.stack)}return new e(function(a,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(f,a)},c)}b[f]=g,0===--e&&a(b)}catch(a){c(a)}}if(0===b.length)return a([]);for(var e=b.length,f=0;f<b.length;f++)d(f,b[f])})},e.reject=function(a){return new e(function(b,c){c(a)})},e.race=function(a){return new e(function(b,c){a.forEach(function(a){e.resolve(a).then(b,c)})})},e.prototype.done=function(a,b){var c=arguments.length?this.then.apply(this,arguments):this;c.then(null,function(a){f(function(){throw a})})},e.prototype.nodeify=function(a){return"function"!=typeof a?this:void this.then(function(b){f(function(){a(null,b)})},function(b){f(function(){a(b)})})},e.prototype.catch=function(a){return this.then(null,a)}},{"./core.js":94,asap:36}]},{},[1]);
|
example/login-react/src/index.js
|
bripkens/formalistic
|
import ReactDOM from 'react-dom';
import React from 'react';
import App from './App';
ReactDOM.render(
<App />,
document.getElementById('root')
);
|
doc-components/GitHub.js
|
miduga/react-slidy
|
import React from 'react'
import PropTypes from 'prop-types'
export default function GitHubBadge({
slug,
width = 36,
height = 36,
fill = 'black'
}) {
return (
<>
<a
href="https://github.com/midudev/react-slidy"
rel="noopener noreferrer"
target="_blank"
>
<svg viewBox="0 0 64 64" width={height} height={width}>
<path
strokeWidth="0"
fill={fill}
d="M32 0 C14 0 0 14 0 32 0 53 19 62 22 62 24 62 24 61 24 60 L24 55 C17 57 14 53 13 50 13 50 13 49 11 47 10 46 6 44 10 44 13 44 15 48 15 48 18 52 22 51 24 50 24 48 26 46 26 46 18 45 12 42 12 31 12 27 13 24 15 22 15 22 13 18 15 13 15 13 20 13 24 17 27 15 37 15 40 17 44 13 49 13 49 13 51 20 49 22 49 22 51 24 52 27 52 31 52 42 45 45 38 46 39 47 40 49 40 52 L40 60 C40 61 40 62 42 62 45 62 64 53 64 32 64 14 50 0 32 0 Z"
/>
</svg>
</a>
<style jsx>{`
a {
position: fixed;
top: 1rem;
right: 1rem;
zindex: 9999;
}
`}</style>
</>
)
}
GitHubBadge.propTypes = {
slug: PropTypes.string.isRequired,
width: PropTypes.number,
height: PropTypes.number,
fill: PropTypes.string
}
|
files/clappr/0.0.88/clappr.js
|
MenZil/jsdelivr
|
require=(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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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(require,module,exports){
(function (global){
"use strict";
var Player = require('./components/player');
var IframePlayer = require('./components/iframe_player');
var Mediator = require('mediator');
var version = require('../package.json').version;
global.DEBUG = false;
window.Clappr = {
Player: Player,
Mediator: Mediator,
IframePlayer: IframePlayer
};
window.Clappr.version = version;
module.exports = window.Clappr;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../package.json":6,"./components/iframe_player":17,"./components/player":21,"mediator":"mediator"}],2:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
process.nextTick = (function () {
var canSetImmediate = typeof window !== 'undefined'
&& window.setImmediate;
var canMutationObserver = typeof window !== 'undefined'
&& window.MutationObserver;
var canPost = typeof window !== 'undefined'
&& window.postMessage && window.addEventListener
;
if (canSetImmediate) {
return function (f) { return window.setImmediate(f) };
}
var queue = [];
if (canMutationObserver) {
var hiddenDiv = document.createElement("div");
var observer = new MutationObserver(function () {
var queueList = queue.slice();
queue.length = 0;
queueList.forEach(function (fn) {
fn();
});
});
observer.observe(hiddenDiv, { attributes: true });
return function nextTick(fn) {
if (!queue.length) {
hiddenDiv.setAttribute('yes', 'no');
}
queue.push(fn);
};
}
if (canPost) {
window.addEventListener('message', function (ev) {
var source = ev.source;
if ((source === window || source === null) && ev.data === 'process-tick') {
ev.stopPropagation();
if (queue.length > 0) {
var fn = queue.shift();
fn();
}
}
}, true);
return function nextTick(fn) {
queue.push(fn);
window.postMessage('process-tick', '*');
};
}
return function nextTick(fn) {
setTimeout(fn, 0);
};
})();
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
// TODO(shtylman)
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
},{}],3:[function(require,module,exports){
(function (process,global){
(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 types = {
void: function voidType() {},
any: function any() {},
string: function string() {},
number: function number() {},
boolean: function boolean() {}
};
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 createPrivateName() {
var s = newUniqueString();
privateNames[s] = true;
return s;
}
function isSymbol(symbol) {
return typeof symbol === 'object' && symbol instanceof SymbolValue;
}
function typeOf(v) {
if (isSymbol(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);
}
Symbol.iterator = Symbol();
freeze(SymbolValue.prototype);
function toProperty(name) {
if (isSymbol(name))
return name[symbolInternalProperty];
return name;
}
function getOwnPropertyNames(object) {
var rv = [];
var names = $getOwnPropertyNames(object);
for (var i = 0; i < names.length; i++) {
var name = names[i];
if (!symbolValues[name] && !privateNames[name])
rv.push(name);
}
return rv;
}
function getOwnPropertyDescriptor(object, name) {
return $getOwnPropertyDescriptor(object, toProperty(name));
}
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 hasOwnProperty(name) {
return $hasOwnProperty.call(this, toProperty(name));
}
function getOption(name) {
return global.traceur && global.traceur.options[name];
}
function setProperty(object, name, value) {
var sym,
desc;
if (isSymbol(name)) {
sym = name;
name = name[symbolInternalProperty];
}
object[name] = value;
if (sym && (desc = $getOwnPropertyDescriptor(object, name)))
$defineProperty(object, name, {enumerable: false});
return value;
}
function defineProperty(object, name, descriptor) {
if (isSymbol(name)) {
if (descriptor.enumerable) {
descriptor = $create(descriptor, {enumerable: {value: false}});
}
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});
Object.getOwnPropertySymbols = getOwnPropertySymbols;
}
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 (privateNames[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 setupGlobals(global) {
global.Symbol = Symbol;
global.Reflect = global.Reflect || {};
global.Reflect.global = global.Reflect.global || global;
polyfillObject(global.Object);
}
setupGlobals(global);
global.$traceurRuntime = {
createPrivateName: createPrivateName,
exportStar: exportStar,
getOwnHashObject: getOwnHashObject,
privateNames: privateNames,
setProperty: setProperty,
setupGlobals: setupGlobals,
toObject: toObject,
isObject: isObject,
toProperty: toProperty,
type: types,
typeof: typeOf,
checkObjectCoercible: checkObjectCoercible,
hasOwnProperty: function(o, p) {
return hasOwnProperty.call(o, p);
},
defineProperties: $defineProperties,
defineProperty: $defineProperty,
getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
getOwnPropertyNames: $getOwnPropertyNames,
keys: $keys
};
})(typeof global !== 'undefined' ? global : this);
(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;
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 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 = {},
name,
names = $getOwnPropertyNames(object);
for (var i = 0; i < names.length; i++) {
var name = names[i];
descriptors[name] = $getOwnPropertyDescriptor(object, name);
}
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.superGet = superGet;
$traceurRuntime.superSet = superSet;
})();
(function() {
'use strict';
var createPrivateName = $traceurRuntime.createPrivateName;
var $defineProperties = $traceurRuntime.defineProperties;
var $defineProperty = $traceurRuntime.defineProperty;
var $create = Object.create;
var $TypeError = TypeError;
function nonEnum(value) {
return {
configurable: true,
enumerable: false,
value: value,
writable: true
};
}
var ST_NEWBORN = 0;
var ST_EXECUTING = 1;
var ST_SUSPENDED = 2;
var ST_CLOSED = 3;
var END_STATE = -2;
var RETHROW_STATE = -3;
function getInternalError(state) {
return new Error('Traceur compiler bug: invalid state in state machine: ' + state);
}
function GeneratorContext() {
this.state = 0;
this.GState = ST_NEWBORN;
this.storedException = undefined;
this.finallyFallThrough = undefined;
this.sent_ = undefined;
this.returnValue = undefined;
this.tryStack_ = [];
}
GeneratorContext.prototype = {
pushTry: function(catchState, finallyState) {
if (finallyState !== null) {
var finallyFallThrough = null;
for (var i = this.tryStack_.length - 1; i >= 0; i--) {
if (this.tryStack_[i].catch !== undefined) {
finallyFallThrough = this.tryStack_[i].catch;
break;
}
}
if (finallyFallThrough === null)
finallyFallThrough = RETHROW_STATE;
this.tryStack_.push({
finally: finallyState,
finallyFallThrough: finallyFallThrough
});
}
if (catchState !== null) {
this.tryStack_.push({catch: catchState});
}
},
popTry: function() {
this.tryStack_.pop();
},
get sent() {
this.maybeThrow();
return this.sent_;
},
set sent(v) {
this.sent_ = v;
},
get sentIgnoreThrow() {
return this.sent_;
},
maybeThrow: function() {
if (this.action === 'throw') {
this.action = 'next';
throw this.sent_;
}
},
end: function() {
switch (this.state) {
case END_STATE:
return this;
case RETHROW_STATE:
throw this.storedException;
default:
throw getInternalError(this.state);
}
},
handleException: function(ex) {
this.GState = ST_CLOSED;
this.state = END_STATE;
throw ex;
}
};
function nextOrThrow(ctx, moveNext, action, x) {
switch (ctx.GState) {
case ST_EXECUTING:
throw new Error(("\"" + action + "\" on executing generator"));
case ST_CLOSED:
if (action == 'next') {
return {
value: undefined,
done: true
};
}
throw x;
case ST_NEWBORN:
if (action === 'throw') {
ctx.GState = ST_CLOSED;
throw x;
}
if (x !== undefined)
throw $TypeError('Sent value to newborn generator');
case ST_SUSPENDED:
ctx.GState = ST_EXECUTING;
ctx.action = action;
ctx.sent = x;
var value = moveNext(ctx);
var done = value === ctx;
if (done)
value = ctx.returnValue;
ctx.GState = done ? ST_CLOSED : ST_SUSPENDED;
return {
value: value,
done: done
};
}
}
var ctxName = createPrivateName();
var moveNextName = createPrivateName();
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
GeneratorFunction.prototype = GeneratorFunctionPrototype;
$defineProperty(GeneratorFunctionPrototype, 'constructor', nonEnum(GeneratorFunction));
GeneratorFunctionPrototype.prototype = {
constructor: GeneratorFunctionPrototype,
next: function(v) {
return nextOrThrow(this[ctxName], this[moveNextName], 'next', v);
},
throw: function(v) {
return nextOrThrow(this[ctxName], this[moveNextName], 'throw', v);
}
};
$defineProperties(GeneratorFunctionPrototype.prototype, {
constructor: {enumerable: false},
next: {enumerable: false},
throw: {enumerable: false}
});
Object.defineProperty(GeneratorFunctionPrototype.prototype, Symbol.iterator, nonEnum(function() {
return this;
}));
function createGeneratorInstance(innerFunction, functionObject, self) {
var moveNext = getMoveNext(innerFunction, self);
var ctx = new GeneratorContext();
var object = $create(functionObject.prototype);
object[ctxName] = ctx;
object[moveNextName] = moveNext;
return object;
}
function initGeneratorFunction(functionObject) {
functionObject.prototype = $create(GeneratorFunctionPrototype.prototype);
functionObject.__proto__ = GeneratorFunctionPrototype;
return functionObject;
}
function AsyncFunctionContext() {
GeneratorContext.call(this);
this.err = undefined;
var ctx = this;
ctx.result = new Promise(function(resolve, reject) {
ctx.resolve = resolve;
ctx.reject = reject;
});
}
AsyncFunctionContext.prototype = $create(GeneratorContext.prototype);
AsyncFunctionContext.prototype.end = function() {
switch (this.state) {
case END_STATE:
this.resolve(this.returnValue);
break;
case RETHROW_STATE:
this.reject(this.storedException);
break;
default:
this.reject(getInternalError(this.state));
}
};
AsyncFunctionContext.prototype.handleException = function() {
this.state = RETHROW_STATE;
};
function asyncWrap(innerFunction, self) {
var moveNext = getMoveNext(innerFunction, self);
var ctx = new AsyncFunctionContext();
ctx.createCallback = function(newState) {
return function(value) {
ctx.state = newState;
ctx.value = value;
moveNext(ctx);
};
};
ctx.errback = function(err) {
handleCatch(ctx, err);
moveNext(ctx);
};
moveNext(ctx);
return ctx.result;
}
function getMoveNext(innerFunction, self) {
return function(ctx) {
while (true) {
try {
return innerFunction.call(self, ctx);
} catch (ex) {
handleCatch(ctx, ex);
}
}
};
}
function handleCatch(ctx, ex) {
ctx.storedException = ex;
var last = ctx.tryStack_[ctx.tryStack_.length - 1];
if (!last) {
ctx.handleException(ex);
return;
}
ctx.state = last.catch !== undefined ? last.catch : last.finally;
if (last.finallyFallThrough !== undefined)
ctx.finallyFallThrough = last.finallyFallThrough;
}
$traceurRuntime.asyncWrap = asyncWrap;
$traceurRuntime.initGeneratorFunction = initGeneratorFunction;
$traceurRuntime.createGeneratorInstance = createGeneratorInstance;
})();
(function() {
function buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) {
var out = [];
if (opt_scheme) {
out.push(opt_scheme, ':');
}
if (opt_domain) {
out.push('//');
if (opt_userInfo) {
out.push(opt_userInfo, '@');
}
out.push(opt_domain);
if (opt_port) {
out.push(':', opt_port);
}
}
if (opt_path) {
out.push(opt_path);
}
if (opt_queryData) {
out.push('?', opt_queryData);
}
if (opt_fragment) {
out.push('#', opt_fragment);
}
return out.join('');
}
;
var splitRe = new RegExp('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$');
var ComponentIndex = {
SCHEME: 1,
USER_INFO: 2,
DOMAIN: 3,
PORT: 4,
PATH: 5,
QUERY_DATA: 6,
FRAGMENT: 7
};
function split(uri) {
return (uri.match(splitRe));
}
function removeDotSegments(path) {
if (path === '/')
return '/';
var leadingSlash = path[0] === '/' ? '/' : '';
var trailingSlash = path.slice(-1) === '/' ? '/' : '';
var segments = path.split('/');
var out = [];
var up = 0;
for (var pos = 0; pos < segments.length; pos++) {
var segment = segments[pos];
switch (segment) {
case '':
case '.':
break;
case '..':
if (out.length)
out.pop();
else
up++;
break;
default:
out.push(segment);
}
}
if (!leadingSlash) {
while (up-- > 0) {
out.unshift('..');
}
if (out.length === 0)
out.push('.');
}
return leadingSlash + out.join('/') + trailingSlash;
}
function joinAndCanonicalizePath(parts) {
var path = parts[ComponentIndex.PATH] || '';
path = removeDotSegments(path);
parts[ComponentIndex.PATH] = path;
return buildFromEncodedParts(parts[ComponentIndex.SCHEME], parts[ComponentIndex.USER_INFO], parts[ComponentIndex.DOMAIN], parts[ComponentIndex.PORT], parts[ComponentIndex.PATH], parts[ComponentIndex.QUERY_DATA], parts[ComponentIndex.FRAGMENT]);
}
function canonicalizeUrl(url) {
var parts = split(url);
return joinAndCanonicalizePath(parts);
}
function resolveUrl(base, url) {
var parts = split(url);
var baseParts = split(base);
if (parts[ComponentIndex.SCHEME]) {
return joinAndCanonicalizePath(parts);
} else {
parts[ComponentIndex.SCHEME] = baseParts[ComponentIndex.SCHEME];
}
for (var i = ComponentIndex.SCHEME; i <= ComponentIndex.PORT; i++) {
if (!parts[i]) {
parts[i] = baseParts[i];
}
}
if (parts[ComponentIndex.PATH][0] == '/') {
return joinAndCanonicalizePath(parts);
}
var path = baseParts[ComponentIndex.PATH];
var index = path.lastIndexOf('/');
path = path.slice(0, index + 1) + parts[ComponentIndex.PATH];
parts[ComponentIndex.PATH] = path;
return joinAndCanonicalizePath(parts);
}
function isAbsolute(name) {
if (!name)
return false;
if (name[0] === '/')
return true;
var parts = split(name);
if (parts[ComponentIndex.SCHEME])
return true;
return false;
}
$traceurRuntime.canonicalizeUrl = canonicalizeUrl;
$traceurRuntime.isAbsolute = isAbsolute;
$traceurRuntime.removeDotSegments = removeDotSegments;
$traceurRuntime.resolveUrl = resolveUrl;
})();
(function(global) {
'use strict';
var $__2 = $traceurRuntime,
canonicalizeUrl = $__2.canonicalizeUrl,
resolveUrl = $__2.resolveUrl,
isAbsolute = $__2.isAbsolute;
var moduleInstantiators = Object.create(null);
var baseURL;
if (global.location && global.location.href)
baseURL = resolveUrl(global.location.href, './');
else
baseURL = '';
var UncoatedModuleEntry = function UncoatedModuleEntry(url, uncoatedModule) {
this.url = url;
this.value_ = uncoatedModule;
};
($traceurRuntime.createClass)(UncoatedModuleEntry, {}, {});
var ModuleEvaluationError = function ModuleEvaluationError(erroneousModuleName, cause) {
this.message = this.constructor.name + ': ' + this.stripCause(cause) + ' in ' + erroneousModuleName;
if (!(cause instanceof $ModuleEvaluationError) && cause.stack)
this.stack = this.stripStack(cause.stack);
else
this.stack = '';
};
var $ModuleEvaluationError = ModuleEvaluationError;
($traceurRuntime.createClass)(ModuleEvaluationError, {
stripError: function(message) {
return message.replace(/.*Error:/, this.constructor.name + ':');
},
stripCause: function(cause) {
if (!cause)
return '';
if (!cause.message)
return cause + '';
return this.stripError(cause.message);
},
loadedBy: function(moduleName) {
this.stack += '\n loaded by ' + moduleName;
},
stripStack: function(causeStack) {
var stack = [];
causeStack.split('\n').some((function(frame) {
if (/UncoatedModuleInstantiator/.test(frame))
return true;
stack.push(frame);
}));
stack[0] = this.stripError(stack[0]);
return stack.join('\n');
}
}, {}, Error);
var UncoatedModuleInstantiator = function UncoatedModuleInstantiator(url, func) {
$traceurRuntime.superCall(this, $UncoatedModuleInstantiator.prototype, "constructor", [url, null]);
this.func = func;
};
var $UncoatedModuleInstantiator = UncoatedModuleInstantiator;
($traceurRuntime.createClass)(UncoatedModuleInstantiator, {getUncoatedModule: function() {
if (this.value_)
return this.value_;
try {
return this.value_ = this.func.call(global);
} catch (ex) {
if (ex instanceof ModuleEvaluationError) {
ex.loadedBy(this.url);
throw ex;
}
throw new ModuleEvaluationError(this.url, ex);
}
}}, {}, UncoatedModuleEntry);
function getUncoatedModuleInstantiator(name) {
if (!name)
return;
var url = ModuleStore.normalize(name);
return moduleInstantiators[url];
}
;
var moduleInstances = Object.create(null);
var liveModuleSentinel = {};
function Module(uncoatedModule) {
var isLive = arguments[1];
var coatedModule = Object.create(null);
Object.getOwnPropertyNames(uncoatedModule).forEach((function(name) {
var getter,
value;
if (isLive === liveModuleSentinel) {
var descr = Object.getOwnPropertyDescriptor(uncoatedModule, name);
if (descr.get)
getter = descr.get;
}
if (!getter) {
value = uncoatedModule[name];
getter = function() {
return value;
};
}
Object.defineProperty(coatedModule, name, {
get: getter,
enumerable: true
});
}));
Object.preventExtensions(coatedModule);
return coatedModule;
}
var ModuleStore = {
normalize: function(name, refererName, refererAddress) {
if (typeof name !== "string")
throw new TypeError("module name must be a string, not " + typeof name);
if (isAbsolute(name))
return canonicalizeUrl(name);
if (/[^\.]\/\.\.\//.test(name)) {
throw new Error('module name embeds /../: ' + name);
}
if (name[0] === '.' && refererName)
return resolveUrl(refererName, name);
return canonicalizeUrl(name);
},
get: function(normalizedName) {
var m = getUncoatedModuleInstantiator(normalizedName);
if (!m)
return undefined;
var moduleInstance = moduleInstances[m.url];
if (moduleInstance)
return moduleInstance;
moduleInstance = Module(m.getUncoatedModule(), liveModuleSentinel);
return moduleInstances[m.url] = moduleInstance;
},
set: function(normalizedName, module) {
normalizedName = String(normalizedName);
moduleInstantiators[normalizedName] = new UncoatedModuleInstantiator(normalizedName, (function() {
return module;
}));
moduleInstances[normalizedName] = module;
},
get baseURL() {
return baseURL;
},
set baseURL(v) {
baseURL = String(v);
},
registerModule: function(name, func) {
var normalizedName = ModuleStore.normalize(name);
if (moduleInstantiators[normalizedName])
throw new Error('duplicate module named ' + normalizedName);
moduleInstantiators[normalizedName] = new UncoatedModuleInstantiator(normalizedName, func);
},
bundleStore: Object.create(null),
register: function(name, deps, func) {
if (!deps || !deps.length && !func.length) {
this.registerModule(name, func);
} else {
this.bundleStore[name] = {
deps: deps,
execute: function() {
var $__0 = arguments;
var depMap = {};
deps.forEach((function(dep, index) {
return depMap[dep] = $__0[index];
}));
var registryEntry = func.call(this, depMap);
registryEntry.execute.call(this);
return registryEntry.exports;
}
};
}
},
getAnonymousModule: function(func) {
return new Module(func.call(global), liveModuleSentinel);
},
getForTesting: function(name) {
var $__0 = this;
if (!this.testingPrefix_) {
Object.keys(moduleInstances).some((function(key) {
var m = /(traceur@[^\/]*\/)/.exec(key);
if (m) {
$__0.testingPrefix_ = m[1];
return true;
}
}));
}
return this.get(this.testingPrefix_ + name);
}
};
ModuleStore.set('@traceur/src/runtime/ModuleStore', new Module({ModuleStore: ModuleStore}));
var setupGlobals = $traceurRuntime.setupGlobals;
$traceurRuntime.setupGlobals = function(global) {
setupGlobals(global);
};
$traceurRuntime.ModuleStore = ModuleStore;
global.System = {
register: ModuleStore.register.bind(ModuleStore),
get: ModuleStore.get,
set: ModuleStore.set,
normalize: ModuleStore.normalize
};
$traceurRuntime.getModuleImpl = function(name) {
var instantiator = getUncoatedModuleInstantiator(name);
return instantiator && instantiator.getUncoatedModule();
};
})(typeof global !== 'undefined' ? global : this);
System.register("traceur-runtime@0.0.62/src/runtime/polyfills/utils", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.62/src/runtime/polyfills/utils";
var $ceil = Math.ceil;
var $floor = Math.floor;
var $isFinite = isFinite;
var $isNaN = isNaN;
var $pow = Math.pow;
var $min = Math.min;
var toObject = $traceurRuntime.toObject;
function toUint32(x) {
return x >>> 0;
}
function isObject(x) {
return x && (typeof x === 'object' || typeof x === 'function');
}
function isCallable(x) {
return typeof x === 'function';
}
function isNumber(x) {
return typeof x === 'number';
}
function toInteger(x) {
x = +x;
if ($isNaN(x))
return 0;
if (x === 0 || !$isFinite(x))
return x;
return x > 0 ? $floor(x) : $ceil(x);
}
var MAX_SAFE_LENGTH = $pow(2, 53) - 1;
function toLength(x) {
var len = toInteger(x);
return len < 0 ? 0 : $min(len, MAX_SAFE_LENGTH);
}
function checkIterable(x) {
return !isObject(x) ? undefined : x[Symbol.iterator];
}
function isConstructor(x) {
return isCallable(x);
}
function createIteratorResultObject(value, done) {
return {
value: value,
done: done
};
}
function maybeDefine(object, name, descr) {
if (!(name in object)) {
Object.defineProperty(object, name, descr);
}
}
function maybeDefineMethod(object, name, value) {
maybeDefine(object, name, {
value: value,
configurable: true,
enumerable: false,
writable: true
});
}
function maybeDefineConst(object, name, value) {
maybeDefine(object, name, {
value: value,
configurable: false,
enumerable: false,
writable: false
});
}
function maybeAddFunctions(object, functions) {
for (var i = 0; i < functions.length; i += 2) {
var name = functions[i];
var value = functions[i + 1];
maybeDefineMethod(object, name, value);
}
}
function maybeAddConsts(object, consts) {
for (var i = 0; i < consts.length; i += 2) {
var name = consts[i];
var value = consts[i + 1];
maybeDefineConst(object, name, value);
}
}
function maybeAddIterator(object, func, Symbol) {
if (!Symbol || !Symbol.iterator || object[Symbol.iterator])
return;
if (object['@@iterator'])
func = object['@@iterator'];
Object.defineProperty(object, Symbol.iterator, {
value: func,
configurable: true,
enumerable: false,
writable: true
});
}
var polyfills = [];
function registerPolyfill(func) {
polyfills.push(func);
}
function polyfillAll(global) {
polyfills.forEach((function(f) {
return f(global);
}));
}
return {
get toObject() {
return toObject;
},
get toUint32() {
return toUint32;
},
get isObject() {
return isObject;
},
get isCallable() {
return isCallable;
},
get isNumber() {
return isNumber;
},
get toInteger() {
return toInteger;
},
get toLength() {
return toLength;
},
get checkIterable() {
return checkIterable;
},
get isConstructor() {
return isConstructor;
},
get createIteratorResultObject() {
return createIteratorResultObject;
},
get maybeDefine() {
return maybeDefine;
},
get maybeDefineMethod() {
return maybeDefineMethod;
},
get maybeDefineConst() {
return maybeDefineConst;
},
get maybeAddFunctions() {
return maybeAddFunctions;
},
get maybeAddConsts() {
return maybeAddConsts;
},
get maybeAddIterator() {
return maybeAddIterator;
},
get registerPolyfill() {
return registerPolyfill;
},
get polyfillAll() {
return polyfillAll;
}
};
});
System.register("traceur-runtime@0.0.62/src/runtime/polyfills/Map", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.62/src/runtime/polyfills/Map";
var $__3 = System.get("traceur-runtime@0.0.62/src/runtime/polyfills/utils"),
isObject = $__3.isObject,
maybeAddIterator = $__3.maybeAddIterator,
registerPolyfill = $__3.registerPolyfill;
var getOwnHashObject = $traceurRuntime.getOwnHashObject;
var $hasOwnProperty = Object.prototype.hasOwnProperty;
var deletedSentinel = {};
function lookupIndex(map, key) {
if (isObject(key)) {
var hashObject = getOwnHashObject(key);
return hashObject && map.objectIndex_[hashObject.hash];
}
if (typeof key === 'string')
return map.stringIndex_[key];
return map.primitiveIndex_[key];
}
function initMap(map) {
map.entries_ = [];
map.objectIndex_ = Object.create(null);
map.stringIndex_ = Object.create(null);
map.primitiveIndex_ = Object.create(null);
map.deletedCount_ = 0;
}
var Map = function Map() {
var iterable = arguments[0];
if (!isObject(this))
throw new TypeError('Map called on incompatible type');
if ($hasOwnProperty.call(this, 'entries_')) {
throw new TypeError('Map can not be reentrantly initialised');
}
initMap(this);
if (iterable !== null && iterable !== undefined) {
for (var $__5 = iterable[Symbol.iterator](),
$__6; !($__6 = $__5.next()).done; ) {
var $__7 = $__6.value,
key = $__7[0],
value = $__7[1];
{
this.set(key, value);
}
}
}
};
($traceurRuntime.createClass)(Map, {
get size() {
return this.entries_.length / 2 - this.deletedCount_;
},
get: function(key) {
var index = lookupIndex(this, key);
if (index !== undefined)
return this.entries_[index + 1];
},
set: function(key, value) {
var objectMode = isObject(key);
var stringMode = typeof key === 'string';
var index = lookupIndex(this, key);
if (index !== undefined) {
this.entries_[index + 1] = value;
} else {
index = this.entries_.length;
this.entries_[index] = key;
this.entries_[index + 1] = value;
if (objectMode) {
var hashObject = getOwnHashObject(key);
var hash = hashObject.hash;
this.objectIndex_[hash] = index;
} else if (stringMode) {
this.stringIndex_[key] = index;
} else {
this.primitiveIndex_[key] = index;
}
}
return this;
},
has: function(key) {
return lookupIndex(this, key) !== undefined;
},
delete: function(key) {
var objectMode = isObject(key);
var stringMode = typeof key === 'string';
var index;
var hash;
if (objectMode) {
var hashObject = getOwnHashObject(key);
if (hashObject) {
index = this.objectIndex_[hash = hashObject.hash];
delete this.objectIndex_[hash];
}
} else if (stringMode) {
index = this.stringIndex_[key];
delete this.stringIndex_[key];
} else {
index = this.primitiveIndex_[key];
delete this.primitiveIndex_[key];
}
if (index !== undefined) {
this.entries_[index] = deletedSentinel;
this.entries_[index + 1] = undefined;
this.deletedCount_++;
return true;
}
return false;
},
clear: function() {
initMap(this);
},
forEach: function(callbackFn) {
var thisArg = arguments[1];
for (var i = 0; i < this.entries_.length; i += 2) {
var key = this.entries_[i];
var value = this.entries_[i + 1];
if (key === deletedSentinel)
continue;
callbackFn.call(thisArg, value, key, this);
}
},
entries: $traceurRuntime.initGeneratorFunction(function $__8() {
var i,
key,
value;
return $traceurRuntime.createGeneratorInstance(function($ctx) {
while (true)
switch ($ctx.state) {
case 0:
i = 0;
$ctx.state = 12;
break;
case 12:
$ctx.state = (i < this.entries_.length) ? 8 : -2;
break;
case 4:
i += 2;
$ctx.state = 12;
break;
case 8:
key = this.entries_[i];
value = this.entries_[i + 1];
$ctx.state = 9;
break;
case 9:
$ctx.state = (key === deletedSentinel) ? 4 : 6;
break;
case 6:
$ctx.state = 2;
return [key, value];
case 2:
$ctx.maybeThrow();
$ctx.state = 4;
break;
default:
return $ctx.end();
}
}, $__8, this);
}),
keys: $traceurRuntime.initGeneratorFunction(function $__9() {
var i,
key,
value;
return $traceurRuntime.createGeneratorInstance(function($ctx) {
while (true)
switch ($ctx.state) {
case 0:
i = 0;
$ctx.state = 12;
break;
case 12:
$ctx.state = (i < this.entries_.length) ? 8 : -2;
break;
case 4:
i += 2;
$ctx.state = 12;
break;
case 8:
key = this.entries_[i];
value = this.entries_[i + 1];
$ctx.state = 9;
break;
case 9:
$ctx.state = (key === deletedSentinel) ? 4 : 6;
break;
case 6:
$ctx.state = 2;
return key;
case 2:
$ctx.maybeThrow();
$ctx.state = 4;
break;
default:
return $ctx.end();
}
}, $__9, this);
}),
values: $traceurRuntime.initGeneratorFunction(function $__10() {
var i,
key,
value;
return $traceurRuntime.createGeneratorInstance(function($ctx) {
while (true)
switch ($ctx.state) {
case 0:
i = 0;
$ctx.state = 12;
break;
case 12:
$ctx.state = (i < this.entries_.length) ? 8 : -2;
break;
case 4:
i += 2;
$ctx.state = 12;
break;
case 8:
key = this.entries_[i];
value = this.entries_[i + 1];
$ctx.state = 9;
break;
case 9:
$ctx.state = (key === deletedSentinel) ? 4 : 6;
break;
case 6:
$ctx.state = 2;
return value;
case 2:
$ctx.maybeThrow();
$ctx.state = 4;
break;
default:
return $ctx.end();
}
}, $__10, this);
})
}, {});
Object.defineProperty(Map.prototype, Symbol.iterator, {
configurable: true,
writable: true,
value: Map.prototype.entries
});
function polyfillMap(global) {
var $__7 = global,
Object = $__7.Object,
Symbol = $__7.Symbol;
if (!global.Map)
global.Map = Map;
var mapPrototype = global.Map.prototype;
if (mapPrototype.entries) {
maybeAddIterator(mapPrototype, mapPrototype.entries, Symbol);
maybeAddIterator(Object.getPrototypeOf(new global.Map().entries()), function() {
return this;
}, Symbol);
}
}
registerPolyfill(polyfillMap);
return {
get Map() {
return Map;
},
get polyfillMap() {
return polyfillMap;
}
};
});
System.get("traceur-runtime@0.0.62/src/runtime/polyfills/Map" + '');
System.register("traceur-runtime@0.0.62/src/runtime/polyfills/Set", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.62/src/runtime/polyfills/Set";
var $__11 = System.get("traceur-runtime@0.0.62/src/runtime/polyfills/utils"),
isObject = $__11.isObject,
maybeAddIterator = $__11.maybeAddIterator,
registerPolyfill = $__11.registerPolyfill;
var Map = System.get("traceur-runtime@0.0.62/src/runtime/polyfills/Map").Map;
var getOwnHashObject = $traceurRuntime.getOwnHashObject;
var $hasOwnProperty = Object.prototype.hasOwnProperty;
function initSet(set) {
set.map_ = new Map();
}
var Set = function Set() {
var iterable = arguments[0];
if (!isObject(this))
throw new TypeError('Set called on incompatible type');
if ($hasOwnProperty.call(this, 'map_')) {
throw new TypeError('Set can not be reentrantly initialised');
}
initSet(this);
if (iterable !== null && iterable !== undefined) {
for (var $__15 = iterable[Symbol.iterator](),
$__16; !($__16 = $__15.next()).done; ) {
var item = $__16.value;
{
this.add(item);
}
}
}
};
($traceurRuntime.createClass)(Set, {
get size() {
return this.map_.size;
},
has: function(key) {
return this.map_.has(key);
},
add: function(key) {
this.map_.set(key, key);
return this;
},
delete: function(key) {
return this.map_.delete(key);
},
clear: function() {
return this.map_.clear();
},
forEach: function(callbackFn) {
var thisArg = arguments[1];
var $__13 = this;
return this.map_.forEach((function(value, key) {
callbackFn.call(thisArg, key, key, $__13);
}));
},
values: $traceurRuntime.initGeneratorFunction(function $__18() {
var $__19,
$__20;
return $traceurRuntime.createGeneratorInstance(function($ctx) {
while (true)
switch ($ctx.state) {
case 0:
$__19 = this.map_.keys()[Symbol.iterator]();
$ctx.sent = void 0;
$ctx.action = 'next';
$ctx.state = 12;
break;
case 12:
$__20 = $__19[$ctx.action]($ctx.sentIgnoreThrow);
$ctx.state = 9;
break;
case 9:
$ctx.state = ($__20.done) ? 3 : 2;
break;
case 3:
$ctx.sent = $__20.value;
$ctx.state = -2;
break;
case 2:
$ctx.state = 12;
return $__20.value;
default:
return $ctx.end();
}
}, $__18, this);
}),
entries: $traceurRuntime.initGeneratorFunction(function $__21() {
var $__22,
$__23;
return $traceurRuntime.createGeneratorInstance(function($ctx) {
while (true)
switch ($ctx.state) {
case 0:
$__22 = this.map_.entries()[Symbol.iterator]();
$ctx.sent = void 0;
$ctx.action = 'next';
$ctx.state = 12;
break;
case 12:
$__23 = $__22[$ctx.action]($ctx.sentIgnoreThrow);
$ctx.state = 9;
break;
case 9:
$ctx.state = ($__23.done) ? 3 : 2;
break;
case 3:
$ctx.sent = $__23.value;
$ctx.state = -2;
break;
case 2:
$ctx.state = 12;
return $__23.value;
default:
return $ctx.end();
}
}, $__21, this);
})
}, {});
Object.defineProperty(Set.prototype, Symbol.iterator, {
configurable: true,
writable: true,
value: Set.prototype.values
});
Object.defineProperty(Set.prototype, 'keys', {
configurable: true,
writable: true,
value: Set.prototype.values
});
function polyfillSet(global) {
var $__17 = global,
Object = $__17.Object,
Symbol = $__17.Symbol;
if (!global.Set)
global.Set = Set;
var setPrototype = global.Set.prototype;
if (setPrototype.values) {
maybeAddIterator(setPrototype, setPrototype.values, Symbol);
maybeAddIterator(Object.getPrototypeOf(new global.Set().values()), function() {
return this;
}, Symbol);
}
}
registerPolyfill(polyfillSet);
return {
get Set() {
return Set;
},
get polyfillSet() {
return polyfillSet;
}
};
});
System.get("traceur-runtime@0.0.62/src/runtime/polyfills/Set" + '');
System.register("traceur-runtime@0.0.62/node_modules/rsvp/lib/rsvp/asap", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.62/node_modules/rsvp/lib/rsvp/asap";
var len = 0;
function asap(callback, arg) {
queue[len] = callback;
queue[len + 1] = arg;
len += 2;
if (len === 2) {
scheduleFlush();
}
}
var $__default = asap;
var browserGlobal = (typeof window !== 'undefined') ? window : {};
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
function useNextTick() {
return function() {
process.nextTick(flush);
};
}
function useMutationObserver() {
var iterations = 0;
var observer = new BrowserMutationObserver(flush);
var node = document.createTextNode('');
observer.observe(node, {characterData: true});
return function() {
node.data = (iterations = ++iterations % 2);
};
}
function useMessageChannel() {
var channel = new MessageChannel();
channel.port1.onmessage = flush;
return function() {
channel.port2.postMessage(0);
};
}
function useSetTimeout() {
return function() {
setTimeout(flush, 1);
};
}
var queue = new Array(1000);
function flush() {
for (var i = 0; i < len; i += 2) {
var callback = queue[i];
var arg = queue[i + 1];
callback(arg);
queue[i] = undefined;
queue[i + 1] = undefined;
}
len = 0;
}
var scheduleFlush;
if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleFlush = useNextTick();
} else if (BrowserMutationObserver) {
scheduleFlush = useMutationObserver();
} else if (isWorker) {
scheduleFlush = useMessageChannel();
} else {
scheduleFlush = useSetTimeout();
}
return {get default() {
return $__default;
}};
});
System.register("traceur-runtime@0.0.62/src/runtime/polyfills/Promise", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.62/src/runtime/polyfills/Promise";
var async = System.get("traceur-runtime@0.0.62/node_modules/rsvp/lib/rsvp/asap").default;
var registerPolyfill = System.get("traceur-runtime@0.0.62/src/runtime/polyfills/utils").registerPolyfill;
var promiseRaw = {};
function isPromise(x) {
return x && typeof x === 'object' && x.status_ !== undefined;
}
function idResolveHandler(x) {
return x;
}
function idRejectHandler(x) {
throw x;
}
function chain(promise) {
var onResolve = arguments[1] !== (void 0) ? arguments[1] : idResolveHandler;
var onReject = arguments[2] !== (void 0) ? arguments[2] : idRejectHandler;
var deferred = getDeferred(promise.constructor);
switch (promise.status_) {
case undefined:
throw TypeError;
case 0:
promise.onResolve_.push(onResolve, deferred);
promise.onReject_.push(onReject, deferred);
break;
case +1:
promiseEnqueue(promise.value_, [onResolve, deferred]);
break;
case -1:
promiseEnqueue(promise.value_, [onReject, deferred]);
break;
}
return deferred.promise;
}
function getDeferred(C) {
if (this === $Promise) {
var promise = promiseInit(new $Promise(promiseRaw));
return {
promise: promise,
resolve: (function(x) {
promiseResolve(promise, x);
}),
reject: (function(r) {
promiseReject(promise, r);
})
};
} else {
var result = {};
result.promise = new C((function(resolve, reject) {
result.resolve = resolve;
result.reject = reject;
}));
return result;
}
}
function promiseSet(promise, status, value, onResolve, onReject) {
promise.status_ = status;
promise.value_ = value;
promise.onResolve_ = onResolve;
promise.onReject_ = onReject;
return promise;
}
function promiseInit(promise) {
return promiseSet(promise, 0, undefined, [], []);
}
var Promise = function Promise(resolver) {
if (resolver === promiseRaw)
return;
if (typeof resolver !== 'function')
throw new TypeError;
var promise = promiseInit(this);
try {
resolver((function(x) {
promiseResolve(promise, x);
}), (function(r) {
promiseReject(promise, r);
}));
} catch (e) {
promiseReject(promise, e);
}
};
($traceurRuntime.createClass)(Promise, {
catch: function(onReject) {
return this.then(undefined, onReject);
},
then: function(onResolve, onReject) {
if (typeof onResolve !== 'function')
onResolve = idResolveHandler;
if (typeof onReject !== 'function')
onReject = idRejectHandler;
var that = this;
var constructor = this.constructor;
return chain(this, function(x) {
x = promiseCoerce(constructor, x);
return x === that ? onReject(new TypeError) : isPromise(x) ? x.then(onResolve, onReject) : onResolve(x);
}, onReject);
}
}, {
resolve: function(x) {
if (this === $Promise) {
if (isPromise(x)) {
return x;
}
return promiseSet(new $Promise(promiseRaw), +1, x);
} else {
return new this(function(resolve, reject) {
resolve(x);
});
}
},
reject: function(r) {
if (this === $Promise) {
return promiseSet(new $Promise(promiseRaw), -1, r);
} else {
return new this((function(resolve, reject) {
reject(r);
}));
}
},
all: function(values) {
var deferred = getDeferred(this);
var resolutions = [];
try {
var count = values.length;
if (count === 0) {
deferred.resolve(resolutions);
} else {
for (var i = 0; i < values.length; i++) {
this.resolve(values[i]).then(function(i, x) {
resolutions[i] = x;
if (--count === 0)
deferred.resolve(resolutions);
}.bind(undefined, i), (function(r) {
deferred.reject(r);
}));
}
}
} catch (e) {
deferred.reject(e);
}
return deferred.promise;
},
race: function(values) {
var deferred = getDeferred(this);
try {
for (var i = 0; i < values.length; i++) {
this.resolve(values[i]).then((function(x) {
deferred.resolve(x);
}), (function(r) {
deferred.reject(r);
}));
}
} catch (e) {
deferred.reject(e);
}
return deferred.promise;
}
});
var $Promise = Promise;
var $PromiseReject = $Promise.reject;
function promiseResolve(promise, x) {
promiseDone(promise, +1, x, promise.onResolve_);
}
function promiseReject(promise, r) {
promiseDone(promise, -1, r, promise.onReject_);
}
function promiseDone(promise, status, value, reactions) {
if (promise.status_ !== 0)
return;
promiseEnqueue(value, reactions);
promiseSet(promise, status, value);
}
function promiseEnqueue(value, tasks) {
async((function() {
for (var i = 0; i < tasks.length; i += 2) {
promiseHandle(value, tasks[i], tasks[i + 1]);
}
}));
}
function promiseHandle(value, handler, deferred) {
try {
var result = handler(value);
if (result === deferred.promise)
throw new TypeError;
else if (isPromise(result))
chain(result, deferred.resolve, deferred.reject);
else
deferred.resolve(result);
} catch (e) {
try {
deferred.reject(e);
} catch (e) {}
}
}
var thenableSymbol = '@@thenable';
function isObject(x) {
return x && (typeof x === 'object' || typeof x === 'function');
}
function promiseCoerce(constructor, x) {
if (!isPromise(x) && isObject(x)) {
var then;
try {
then = x.then;
} catch (r) {
var promise = $PromiseReject.call(constructor, r);
x[thenableSymbol] = promise;
return promise;
}
if (typeof then === 'function') {
var p = x[thenableSymbol];
if (p) {
return p;
} else {
var deferred = getDeferred(constructor);
x[thenableSymbol] = deferred.promise;
try {
then.call(x, deferred.resolve, deferred.reject);
} catch (r) {
deferred.reject(r);
}
return deferred.promise;
}
}
}
return x;
}
function polyfillPromise(global) {
if (!global.Promise)
global.Promise = Promise;
}
registerPolyfill(polyfillPromise);
return {
get Promise() {
return Promise;
},
get polyfillPromise() {
return polyfillPromise;
}
};
});
System.get("traceur-runtime@0.0.62/src/runtime/polyfills/Promise" + '');
System.register("traceur-runtime@0.0.62/src/runtime/polyfills/StringIterator", [], function() {
"use strict";
var $__29;
var __moduleName = "traceur-runtime@0.0.62/src/runtime/polyfills/StringIterator";
var $__27 = System.get("traceur-runtime@0.0.62/src/runtime/polyfills/utils"),
createIteratorResultObject = $__27.createIteratorResultObject,
isObject = $__27.isObject;
var $__30 = $traceurRuntime,
hasOwnProperty = $__30.hasOwnProperty,
toProperty = $__30.toProperty;
var iteratedString = Symbol('iteratedString');
var stringIteratorNextIndex = Symbol('stringIteratorNextIndex');
var StringIterator = function StringIterator() {};
($traceurRuntime.createClass)(StringIterator, ($__29 = {}, Object.defineProperty($__29, "next", {
value: function() {
var o = this;
if (!isObject(o) || !hasOwnProperty(o, iteratedString)) {
throw new TypeError('this must be a StringIterator object');
}
var s = o[toProperty(iteratedString)];
if (s === undefined) {
return createIteratorResultObject(undefined, true);
}
var position = o[toProperty(stringIteratorNextIndex)];
var len = s.length;
if (position >= len) {
o[toProperty(iteratedString)] = undefined;
return createIteratorResultObject(undefined, true);
}
var first = s.charCodeAt(position);
var resultString;
if (first < 0xD800 || first > 0xDBFF || position + 1 === len) {
resultString = String.fromCharCode(first);
} else {
var second = s.charCodeAt(position + 1);
if (second < 0xDC00 || second > 0xDFFF) {
resultString = String.fromCharCode(first);
} else {
resultString = String.fromCharCode(first) + String.fromCharCode(second);
}
}
o[toProperty(stringIteratorNextIndex)] = position + resultString.length;
return createIteratorResultObject(resultString, false);
},
configurable: true,
enumerable: true,
writable: true
}), Object.defineProperty($__29, Symbol.iterator, {
value: function() {
return this;
},
configurable: true,
enumerable: true,
writable: true
}), $__29), {});
function createStringIterator(string) {
var s = String(string);
var iterator = Object.create(StringIterator.prototype);
iterator[toProperty(iteratedString)] = s;
iterator[toProperty(stringIteratorNextIndex)] = 0;
return iterator;
}
return {get createStringIterator() {
return createStringIterator;
}};
});
System.register("traceur-runtime@0.0.62/src/runtime/polyfills/String", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.62/src/runtime/polyfills/String";
var createStringIterator = System.get("traceur-runtime@0.0.62/src/runtime/polyfills/StringIterator").createStringIterator;
var $__32 = System.get("traceur-runtime@0.0.62/src/runtime/polyfills/utils"),
maybeAddFunctions = $__32.maybeAddFunctions,
maybeAddIterator = $__32.maybeAddIterator,
registerPolyfill = $__32.registerPolyfill;
var $toString = Object.prototype.toString;
var $indexOf = String.prototype.indexOf;
var $lastIndexOf = String.prototype.lastIndexOf;
function startsWith(search) {
var string = String(this);
if (this == null || $toString.call(search) == '[object RegExp]') {
throw TypeError();
}
var stringLength = string.length;
var searchString = String(search);
var searchLength = searchString.length;
var position = arguments.length > 1 ? arguments[1] : undefined;
var pos = position ? Number(position) : 0;
if (isNaN(pos)) {
pos = 0;
}
var start = Math.min(Math.max(pos, 0), stringLength);
return $indexOf.call(string, searchString, pos) == start;
}
function endsWith(search) {
var string = String(this);
if (this == null || $toString.call(search) == '[object RegExp]') {
throw TypeError();
}
var stringLength = string.length;
var searchString = String(search);
var searchLength = searchString.length;
var pos = stringLength;
if (arguments.length > 1) {
var position = arguments[1];
if (position !== undefined) {
pos = position ? Number(position) : 0;
if (isNaN(pos)) {
pos = 0;
}
}
}
var end = Math.min(Math.max(pos, 0), stringLength);
var start = end - searchLength;
if (start < 0) {
return false;
}
return $lastIndexOf.call(string, searchString, start) == start;
}
function contains(search) {
if (this == null) {
throw TypeError();
}
var string = String(this);
var stringLength = string.length;
var searchString = String(search);
var searchLength = searchString.length;
var position = arguments.length > 1 ? arguments[1] : undefined;
var pos = position ? Number(position) : 0;
if (isNaN(pos)) {
pos = 0;
}
var start = Math.min(Math.max(pos, 0), stringLength);
return $indexOf.call(string, searchString, pos) != -1;
}
function repeat(count) {
if (this == null) {
throw TypeError();
}
var string = String(this);
var n = count ? Number(count) : 0;
if (isNaN(n)) {
n = 0;
}
if (n < 0 || n == Infinity) {
throw RangeError();
}
if (n == 0) {
return '';
}
var result = '';
while (n--) {
result += string;
}
return result;
}
function codePointAt(position) {
if (this == null) {
throw TypeError();
}
var string = String(this);
var size = string.length;
var index = position ? Number(position) : 0;
if (isNaN(index)) {
index = 0;
}
if (index < 0 || index >= size) {
return undefined;
}
var first = string.charCodeAt(index);
var second;
if (first >= 0xD800 && first <= 0xDBFF && size > index + 1) {
second = string.charCodeAt(index + 1);
if (second >= 0xDC00 && second <= 0xDFFF) {
return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
}
}
return first;
}
function raw(callsite) {
var raw = callsite.raw;
var len = raw.length >>> 0;
if (len === 0)
return '';
var s = '';
var i = 0;
while (true) {
s += raw[i];
if (i + 1 === len)
return s;
s += arguments[++i];
}
}
function fromCodePoint() {
var codeUnits = [];
var floor = Math.floor;
var highSurrogate;
var lowSurrogate;
var index = -1;
var length = arguments.length;
if (!length) {
return '';
}
while (++index < length) {
var codePoint = Number(arguments[index]);
if (!isFinite(codePoint) || codePoint < 0 || codePoint > 0x10FFFF || floor(codePoint) != codePoint) {
throw RangeError('Invalid code point: ' + codePoint);
}
if (codePoint <= 0xFFFF) {
codeUnits.push(codePoint);
} else {
codePoint -= 0x10000;
highSurrogate = (codePoint >> 10) + 0xD800;
lowSurrogate = (codePoint % 0x400) + 0xDC00;
codeUnits.push(highSurrogate, lowSurrogate);
}
}
return String.fromCharCode.apply(null, codeUnits);
}
function stringPrototypeIterator() {
var o = $traceurRuntime.checkObjectCoercible(this);
var s = String(o);
return createStringIterator(s);
}
function polyfillString(global) {
var String = global.String;
maybeAddFunctions(String.prototype, ['codePointAt', codePointAt, 'contains', contains, 'endsWith', endsWith, 'startsWith', startsWith, 'repeat', repeat]);
maybeAddFunctions(String, ['fromCodePoint', fromCodePoint, 'raw', raw]);
maybeAddIterator(String.prototype, stringPrototypeIterator, Symbol);
}
registerPolyfill(polyfillString);
return {
get startsWith() {
return startsWith;
},
get endsWith() {
return endsWith;
},
get contains() {
return contains;
},
get repeat() {
return repeat;
},
get codePointAt() {
return codePointAt;
},
get raw() {
return raw;
},
get fromCodePoint() {
return fromCodePoint;
},
get stringPrototypeIterator() {
return stringPrototypeIterator;
},
get polyfillString() {
return polyfillString;
}
};
});
System.get("traceur-runtime@0.0.62/src/runtime/polyfills/String" + '');
System.register("traceur-runtime@0.0.62/src/runtime/polyfills/ArrayIterator", [], function() {
"use strict";
var $__36;
var __moduleName = "traceur-runtime@0.0.62/src/runtime/polyfills/ArrayIterator";
var $__34 = System.get("traceur-runtime@0.0.62/src/runtime/polyfills/utils"),
toObject = $__34.toObject,
toUint32 = $__34.toUint32,
createIteratorResultObject = $__34.createIteratorResultObject;
var ARRAY_ITERATOR_KIND_KEYS = 1;
var ARRAY_ITERATOR_KIND_VALUES = 2;
var ARRAY_ITERATOR_KIND_ENTRIES = 3;
var ArrayIterator = function ArrayIterator() {};
($traceurRuntime.createClass)(ArrayIterator, ($__36 = {}, Object.defineProperty($__36, "next", {
value: function() {
var iterator = toObject(this);
var array = iterator.iteratorObject_;
if (!array) {
throw new TypeError('Object is not an ArrayIterator');
}
var index = iterator.arrayIteratorNextIndex_;
var itemKind = iterator.arrayIterationKind_;
var length = toUint32(array.length);
if (index >= length) {
iterator.arrayIteratorNextIndex_ = Infinity;
return createIteratorResultObject(undefined, true);
}
iterator.arrayIteratorNextIndex_ = index + 1;
if (itemKind == ARRAY_ITERATOR_KIND_VALUES)
return createIteratorResultObject(array[index], false);
if (itemKind == ARRAY_ITERATOR_KIND_ENTRIES)
return createIteratorResultObject([index, array[index]], false);
return createIteratorResultObject(index, false);
},
configurable: true,
enumerable: true,
writable: true
}), Object.defineProperty($__36, Symbol.iterator, {
value: function() {
return this;
},
configurable: true,
enumerable: true,
writable: true
}), $__36), {});
function createArrayIterator(array, kind) {
var object = toObject(array);
var iterator = new ArrayIterator;
iterator.iteratorObject_ = object;
iterator.arrayIteratorNextIndex_ = 0;
iterator.arrayIterationKind_ = kind;
return iterator;
}
function entries() {
return createArrayIterator(this, ARRAY_ITERATOR_KIND_ENTRIES);
}
function keys() {
return createArrayIterator(this, ARRAY_ITERATOR_KIND_KEYS);
}
function values() {
return createArrayIterator(this, ARRAY_ITERATOR_KIND_VALUES);
}
return {
get entries() {
return entries;
},
get keys() {
return keys;
},
get values() {
return values;
}
};
});
System.register("traceur-runtime@0.0.62/src/runtime/polyfills/Array", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.62/src/runtime/polyfills/Array";
var $__37 = System.get("traceur-runtime@0.0.62/src/runtime/polyfills/ArrayIterator"),
entries = $__37.entries,
keys = $__37.keys,
values = $__37.values;
var $__38 = System.get("traceur-runtime@0.0.62/src/runtime/polyfills/utils"),
checkIterable = $__38.checkIterable,
isCallable = $__38.isCallable,
isConstructor = $__38.isConstructor,
maybeAddFunctions = $__38.maybeAddFunctions,
maybeAddIterator = $__38.maybeAddIterator,
registerPolyfill = $__38.registerPolyfill,
toInteger = $__38.toInteger,
toLength = $__38.toLength,
toObject = $__38.toObject;
function from(arrLike) {
var mapFn = arguments[1];
var thisArg = arguments[2];
var C = this;
var items = toObject(arrLike);
var mapping = mapFn !== undefined;
var k = 0;
var arr,
len;
if (mapping && !isCallable(mapFn)) {
throw TypeError();
}
if (checkIterable(items)) {
arr = isConstructor(C) ? new C() : [];
for (var $__39 = items[Symbol.iterator](),
$__40; !($__40 = $__39.next()).done; ) {
var item = $__40.value;
{
if (mapping) {
arr[k] = mapFn.call(thisArg, item, k);
} else {
arr[k] = item;
}
k++;
}
}
arr.length = k;
return arr;
}
len = toLength(items.length);
arr = isConstructor(C) ? new C(len) : new Array(len);
for (; k < len; k++) {
if (mapping) {
arr[k] = typeof thisArg === 'undefined' ? mapFn(items[k], k) : mapFn.call(thisArg, items[k], k);
} else {
arr[k] = items[k];
}
}
arr.length = len;
return arr;
}
function of() {
for (var items = [],
$__41 = 0; $__41 < arguments.length; $__41++)
items[$__41] = arguments[$__41];
var C = this;
var len = items.length;
var arr = isConstructor(C) ? new C(len) : new Array(len);
for (var k = 0; k < len; k++) {
arr[k] = items[k];
}
arr.length = len;
return arr;
}
function fill(value) {
var start = arguments[1] !== (void 0) ? arguments[1] : 0;
var end = arguments[2];
var object = toObject(this);
var len = toLength(object.length);
var fillStart = toInteger(start);
var fillEnd = end !== undefined ? toInteger(end) : len;
fillStart = fillStart < 0 ? Math.max(len + fillStart, 0) : Math.min(fillStart, len);
fillEnd = fillEnd < 0 ? Math.max(len + fillEnd, 0) : Math.min(fillEnd, len);
while (fillStart < fillEnd) {
object[fillStart] = value;
fillStart++;
}
return object;
}
function find(predicate) {
var thisArg = arguments[1];
return findHelper(this, predicate, thisArg);
}
function findIndex(predicate) {
var thisArg = arguments[1];
return findHelper(this, predicate, thisArg, true);
}
function findHelper(self, predicate) {
var thisArg = arguments[2];
var returnIndex = arguments[3] !== (void 0) ? arguments[3] : false;
var object = toObject(self);
var len = toLength(object.length);
if (!isCallable(predicate)) {
throw TypeError();
}
for (var i = 0; i < len; i++) {
if (i in object) {
var value = object[i];
if (predicate.call(thisArg, value, i, object)) {
return returnIndex ? i : value;
}
}
}
return returnIndex ? -1 : undefined;
}
function polyfillArray(global) {
var $__42 = global,
Array = $__42.Array,
Object = $__42.Object,
Symbol = $__42.Symbol;
maybeAddFunctions(Array.prototype, ['entries', entries, 'keys', keys, 'values', values, 'fill', fill, 'find', find, 'findIndex', findIndex]);
maybeAddFunctions(Array, ['from', from, 'of', of]);
maybeAddIterator(Array.prototype, values, Symbol);
maybeAddIterator(Object.getPrototypeOf([].values()), function() {
return this;
}, Symbol);
}
registerPolyfill(polyfillArray);
return {
get from() {
return from;
},
get of() {
return of;
},
get fill() {
return fill;
},
get find() {
return find;
},
get findIndex() {
return findIndex;
},
get polyfillArray() {
return polyfillArray;
}
};
});
System.get("traceur-runtime@0.0.62/src/runtime/polyfills/Array" + '');
System.register("traceur-runtime@0.0.62/src/runtime/polyfills/Object", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.62/src/runtime/polyfills/Object";
var $__43 = System.get("traceur-runtime@0.0.62/src/runtime/polyfills/utils"),
maybeAddFunctions = $__43.maybeAddFunctions,
registerPolyfill = $__43.registerPolyfill;
var $__44 = $traceurRuntime,
defineProperty = $__44.defineProperty,
getOwnPropertyDescriptor = $__44.getOwnPropertyDescriptor,
getOwnPropertyNames = $__44.getOwnPropertyNames,
keys = $__44.keys,
privateNames = $__44.privateNames;
function is(left, right) {
if (left === right)
return left !== 0 || 1 / left === 1 / right;
return left !== left && right !== right;
}
function assign(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
var props = keys(source);
var p,
length = props.length;
for (p = 0; p < length; p++) {
var name = props[p];
if (privateNames[name])
continue;
target[name] = source[name];
}
}
return target;
}
function mixin(target, source) {
var props = getOwnPropertyNames(source);
var p,
descriptor,
length = props.length;
for (p = 0; p < length; p++) {
var name = props[p];
if (privateNames[name])
continue;
descriptor = getOwnPropertyDescriptor(source, props[p]);
defineProperty(target, props[p], descriptor);
}
return target;
}
function polyfillObject(global) {
var Object = global.Object;
maybeAddFunctions(Object, ['assign', assign, 'is', is, 'mixin', mixin]);
}
registerPolyfill(polyfillObject);
return {
get is() {
return is;
},
get assign() {
return assign;
},
get mixin() {
return mixin;
},
get polyfillObject() {
return polyfillObject;
}
};
});
System.get("traceur-runtime@0.0.62/src/runtime/polyfills/Object" + '');
System.register("traceur-runtime@0.0.62/src/runtime/polyfills/Number", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.62/src/runtime/polyfills/Number";
var $__46 = System.get("traceur-runtime@0.0.62/src/runtime/polyfills/utils"),
isNumber = $__46.isNumber,
maybeAddConsts = $__46.maybeAddConsts,
maybeAddFunctions = $__46.maybeAddFunctions,
registerPolyfill = $__46.registerPolyfill,
toInteger = $__46.toInteger;
var $abs = Math.abs;
var $isFinite = isFinite;
var $isNaN = isNaN;
var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;
var MIN_SAFE_INTEGER = -Math.pow(2, 53) + 1;
var EPSILON = Math.pow(2, -52);
function NumberIsFinite(number) {
return isNumber(number) && $isFinite(number);
}
;
function isInteger(number) {
return NumberIsFinite(number) && toInteger(number) === number;
}
function NumberIsNaN(number) {
return isNumber(number) && $isNaN(number);
}
;
function isSafeInteger(number) {
if (NumberIsFinite(number)) {
var integral = toInteger(number);
if (integral === number)
return $abs(integral) <= MAX_SAFE_INTEGER;
}
return false;
}
function polyfillNumber(global) {
var Number = global.Number;
maybeAddConsts(Number, ['MAX_SAFE_INTEGER', MAX_SAFE_INTEGER, 'MIN_SAFE_INTEGER', MIN_SAFE_INTEGER, 'EPSILON', EPSILON]);
maybeAddFunctions(Number, ['isFinite', NumberIsFinite, 'isInteger', isInteger, 'isNaN', NumberIsNaN, 'isSafeInteger', isSafeInteger]);
}
registerPolyfill(polyfillNumber);
return {
get MAX_SAFE_INTEGER() {
return MAX_SAFE_INTEGER;
},
get MIN_SAFE_INTEGER() {
return MIN_SAFE_INTEGER;
},
get EPSILON() {
return EPSILON;
},
get isFinite() {
return NumberIsFinite;
},
get isInteger() {
return isInteger;
},
get isNaN() {
return NumberIsNaN;
},
get isSafeInteger() {
return isSafeInteger;
},
get polyfillNumber() {
return polyfillNumber;
}
};
});
System.get("traceur-runtime@0.0.62/src/runtime/polyfills/Number" + '');
System.register("traceur-runtime@0.0.62/src/runtime/polyfills/polyfills", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.62/src/runtime/polyfills/polyfills";
var polyfillAll = System.get("traceur-runtime@0.0.62/src/runtime/polyfills/utils").polyfillAll;
polyfillAll(this);
var setupGlobals = $traceurRuntime.setupGlobals;
$traceurRuntime.setupGlobals = function(global) {
setupGlobals(global);
polyfillAll(global);
};
return {};
});
System.get("traceur-runtime@0.0.62/src/runtime/polyfills/polyfills" + '');
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"_process":2}],4:[function(require,module,exports){
/*global define:false */
/**
* Copyright 2013 Craig Campbell
*
* 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.
*
* Mousetrap is a simple keyboard shortcut library for Javascript with
* no external dependencies
*
* @version 1.4.6
* @url craig.is/killing/mice
*/
(function(window, document, undefined) {
/**
* mapping of special keycodes to their corresponding keys
*
* everything in this dictionary cannot use keypress events
* so it has to be here to map to the correct keycodes for
* keyup/keydown events
*
* @type {Object}
*/
var _MAP = {
8: 'backspace',
9: 'tab',
13: 'enter',
16: 'shift',
17: 'ctrl',
18: 'alt',
20: 'capslock',
27: 'esc',
32: 'space',
33: 'pageup',
34: 'pagedown',
35: 'end',
36: 'home',
37: 'left',
38: 'up',
39: 'right',
40: 'down',
45: 'ins',
46: 'del',
91: 'meta',
93: 'meta',
224: 'meta'
},
/**
* mapping for special characters so they can support
*
* this dictionary is only used incase you want to bind a
* keyup or keydown event to one of these keys
*
* @type {Object}
*/
_KEYCODE_MAP = {
106: '*',
107: '+',
109: '-',
110: '.',
111 : '/',
186: ';',
187: '=',
188: ',',
189: '-',
190: '.',
191: '/',
192: '`',
219: '[',
220: '\\',
221: ']',
222: '\''
},
/**
* this is a mapping of keys that require shift on a US keypad
* back to the non shift equivelents
*
* this is so you can use keyup events with these keys
*
* note that this will only work reliably on US keyboards
*
* @type {Object}
*/
_SHIFT_MAP = {
'~': '`',
'!': '1',
'@': '2',
'#': '3',
'$': '4',
'%': '5',
'^': '6',
'&': '7',
'*': '8',
'(': '9',
')': '0',
'_': '-',
'+': '=',
':': ';',
'\"': '\'',
'<': ',',
'>': '.',
'?': '/',
'|': '\\'
},
/**
* this is a list of special strings you can use to map
* to modifier keys when you specify your keyboard shortcuts
*
* @type {Object}
*/
_SPECIAL_ALIASES = {
'option': 'alt',
'command': 'meta',
'return': 'enter',
'escape': 'esc',
'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl'
},
/**
* variable to store the flipped version of _MAP from above
* needed to check if we should use keypress or not when no action
* is specified
*
* @type {Object|undefined}
*/
_REVERSE_MAP,
/**
* a list of all the callbacks setup via Mousetrap.bind()
*
* @type {Object}
*/
_callbacks = {},
/**
* direct map of string combinations to callbacks used for trigger()
*
* @type {Object}
*/
_directMap = {},
/**
* keeps track of what level each sequence is at since multiple
* sequences can start out with the same sequence
*
* @type {Object}
*/
_sequenceLevels = {},
/**
* variable to store the setTimeout call
*
* @type {null|number}
*/
_resetTimer,
/**
* temporary state where we will ignore the next keyup
*
* @type {boolean|string}
*/
_ignoreNextKeyup = false,
/**
* temporary state where we will ignore the next keypress
*
* @type {boolean}
*/
_ignoreNextKeypress = false,
/**
* are we currently inside of a sequence?
* type of action ("keyup" or "keydown" or "keypress") or false
*
* @type {boolean|string}
*/
_nextExpectedAction = false;
/**
* loop through the f keys, f1 to f19 and add them to the map
* programatically
*/
for (var i = 1; i < 20; ++i) {
_MAP[111 + i] = 'f' + i;
}
/**
* loop through to map numbers on the numeric keypad
*/
for (i = 0; i <= 9; ++i) {
_MAP[i + 96] = i;
}
/**
* cross browser add event method
*
* @param {Element|HTMLDocument} object
* @param {string} type
* @param {Function} callback
* @returns void
*/
function _addEvent(object, type, callback) {
if (object.addEventListener) {
object.addEventListener(type, callback, false);
return;
}
object.attachEvent('on' + type, callback);
}
/**
* takes the event and returns the key character
*
* @param {Event} e
* @return {string}
*/
function _characterFromEvent(e) {
// for keypress events we should return the character as is
if (e.type == 'keypress') {
var character = String.fromCharCode(e.which);
// if the shift key is not pressed then it is safe to assume
// that we want the character to be lowercase. this means if
// you accidentally have caps lock on then your key bindings
// will continue to work
//
// the only side effect that might not be desired is if you
// bind something like 'A' cause you want to trigger an
// event when capital A is pressed caps lock will no longer
// trigger the event. shift+a will though.
if (!e.shiftKey) {
character = character.toLowerCase();
}
return character;
}
// for non keypress events the special maps are needed
if (_MAP[e.which]) {
return _MAP[e.which];
}
if (_KEYCODE_MAP[e.which]) {
return _KEYCODE_MAP[e.which];
}
// if it is not in the special map
// with keydown and keyup events the character seems to always
// come in as an uppercase character whether you are pressing shift
// or not. we should make sure it is always lowercase for comparisons
return String.fromCharCode(e.which).toLowerCase();
}
/**
* checks if two arrays are equal
*
* @param {Array} modifiers1
* @param {Array} modifiers2
* @returns {boolean}
*/
function _modifiersMatch(modifiers1, modifiers2) {
return modifiers1.sort().join(',') === modifiers2.sort().join(',');
}
/**
* resets all sequence counters except for the ones passed in
*
* @param {Object} doNotReset
* @returns void
*/
function _resetSequences(doNotReset) {
doNotReset = doNotReset || {};
var activeSequences = false,
key;
for (key in _sequenceLevels) {
if (doNotReset[key]) {
activeSequences = true;
continue;
}
_sequenceLevels[key] = 0;
}
if (!activeSequences) {
_nextExpectedAction = false;
}
}
/**
* finds all callbacks that match based on the keycode, modifiers,
* and action
*
* @param {string} character
* @param {Array} modifiers
* @param {Event|Object} e
* @param {string=} sequenceName - name of the sequence we are looking for
* @param {string=} combination
* @param {number=} level
* @returns {Array}
*/
function _getMatches(character, modifiers, e, sequenceName, combination, level) {
var i,
callback,
matches = [],
action = e.type;
// if there are no events related to this keycode
if (!_callbacks[character]) {
return [];
}
// if a modifier key is coming up on its own we should allow it
if (action == 'keyup' && _isModifier(character)) {
modifiers = [character];
}
// loop through all callbacks for the key that was pressed
// and see if any of them match
for (i = 0; i < _callbacks[character].length; ++i) {
callback = _callbacks[character][i];
// if a sequence name is not specified, but this is a sequence at
// the wrong level then move onto the next match
if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) {
continue;
}
// if the action we are looking for doesn't match the action we got
// then we should keep going
if (action != callback.action) {
continue;
}
// if this is a keypress event and the meta key and control key
// are not pressed that means that we need to only look at the
// character, otherwise check the modifiers as well
//
// chrome will not fire a keypress if meta or control is down
// safari will fire a keypress if meta or meta+shift is down
// firefox will fire a keypress if meta or control is down
if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) {
// when you bind a combination or sequence a second time it
// should overwrite the first one. if a sequenceName or
// combination is specified in this call it does just that
//
// @todo make deleting its own method?
var deleteCombo = !sequenceName && callback.combo == combination;
var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level;
if (deleteCombo || deleteSequence) {
_callbacks[character].splice(i, 1);
}
matches.push(callback);
}
}
return matches;
}
/**
* takes a key event and figures out what the modifiers are
*
* @param {Event} e
* @returns {Array}
*/
function _eventModifiers(e) {
var modifiers = [];
if (e.shiftKey) {
modifiers.push('shift');
}
if (e.altKey) {
modifiers.push('alt');
}
if (e.ctrlKey) {
modifiers.push('ctrl');
}
if (e.metaKey) {
modifiers.push('meta');
}
return modifiers;
}
/**
* prevents default for this event
*
* @param {Event} e
* @returns void
*/
function _preventDefault(e) {
if (e.preventDefault) {
e.preventDefault();
return;
}
e.returnValue = false;
}
/**
* stops propogation for this event
*
* @param {Event} e
* @returns void
*/
function _stopPropagation(e) {
if (e.stopPropagation) {
e.stopPropagation();
return;
}
e.cancelBubble = true;
}
/**
* actually calls the callback function
*
* if your callback function returns false this will use the jquery
* convention - prevent default and stop propogation on the event
*
* @param {Function} callback
* @param {Event} e
* @returns void
*/
function _fireCallback(callback, e, combo, sequence) {
// if this event should not happen stop here
if (Mousetrap.stopCallback(e, e.target || e.srcElement, combo, sequence)) {
return;
}
if (callback(e, combo) === false) {
_preventDefault(e);
_stopPropagation(e);
}
}
/**
* handles a character key event
*
* @param {string} character
* @param {Array} modifiers
* @param {Event} e
* @returns void
*/
function _handleKey(character, modifiers, e) {
var callbacks = _getMatches(character, modifiers, e),
i,
doNotReset = {},
maxLevel = 0,
processedSequenceCallback = false;
// Calculate the maxLevel for sequences so we can only execute the longest callback sequence
for (i = 0; i < callbacks.length; ++i) {
if (callbacks[i].seq) {
maxLevel = Math.max(maxLevel, callbacks[i].level);
}
}
// loop through matching callbacks for this key event
for (i = 0; i < callbacks.length; ++i) {
// fire for all sequence callbacks
// this is because if for example you have multiple sequences
// bound such as "g i" and "g t" they both need to fire the
// callback for matching g cause otherwise you can only ever
// match the first one
if (callbacks[i].seq) {
// only fire callbacks for the maxLevel to prevent
// subsequences from also firing
//
// for example 'a option b' should not cause 'option b' to fire
// even though 'option b' is part of the other sequence
//
// any sequences that do not match here will be discarded
// below by the _resetSequences call
if (callbacks[i].level != maxLevel) {
continue;
}
processedSequenceCallback = true;
// keep a list of which sequences were matches for later
doNotReset[callbacks[i].seq] = 1;
_fireCallback(callbacks[i].callback, e, callbacks[i].combo, callbacks[i].seq);
continue;
}
// if there were no sequence matches but we are still here
// that means this is a regular match so we should fire that
if (!processedSequenceCallback) {
_fireCallback(callbacks[i].callback, e, callbacks[i].combo);
}
}
// if the key you pressed matches the type of sequence without
// being a modifier (ie "keyup" or "keypress") then we should
// reset all sequences that were not matched by this event
//
// this is so, for example, if you have the sequence "h a t" and you
// type "h e a r t" it does not match. in this case the "e" will
// cause the sequence to reset
//
// modifier keys are ignored because you can have a sequence
// that contains modifiers such as "enter ctrl+space" and in most
// cases the modifier key will be pressed before the next key
//
// also if you have a sequence such as "ctrl+b a" then pressing the
// "b" key will trigger a "keypress" and a "keydown"
//
// the "keydown" is expected when there is a modifier, but the
// "keypress" ends up matching the _nextExpectedAction since it occurs
// after and that causes the sequence to reset
//
// we ignore keypresses in a sequence that directly follow a keydown
// for the same character
var ignoreThisKeypress = e.type == 'keypress' && _ignoreNextKeypress;
if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) {
_resetSequences(doNotReset);
}
_ignoreNextKeypress = processedSequenceCallback && e.type == 'keydown';
}
/**
* handles a keydown event
*
* @param {Event} e
* @returns void
*/
function _handleKeyEvent(e) {
// normalize e.which for key events
// @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion
if (typeof e.which !== 'number') {
e.which = e.keyCode;
}
var character = _characterFromEvent(e);
// no character found then stop
if (!character) {
return;
}
// need to use === for the character check because the character can be 0
if (e.type == 'keyup' && _ignoreNextKeyup === character) {
_ignoreNextKeyup = false;
return;
}
Mousetrap.handleKey(character, _eventModifiers(e), e);
}
/**
* determines if the keycode specified is a modifier key or not
*
* @param {string} key
* @returns {boolean}
*/
function _isModifier(key) {
return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta';
}
/**
* called to set a 1 second timeout on the specified sequence
*
* this is so after each key press in the sequence you have 1 second
* to press the next key before you have to start over
*
* @returns void
*/
function _resetSequenceTimer() {
clearTimeout(_resetTimer);
_resetTimer = setTimeout(_resetSequences, 1000);
}
/**
* reverses the map lookup so that we can look for specific keys
* to see what can and can't use keypress
*
* @return {Object}
*/
function _getReverseMap() {
if (!_REVERSE_MAP) {
_REVERSE_MAP = {};
for (var key in _MAP) {
// pull out the numeric keypad from here cause keypress should
// be able to detect the keys from the character
if (key > 95 && key < 112) {
continue;
}
if (_MAP.hasOwnProperty(key)) {
_REVERSE_MAP[_MAP[key]] = key;
}
}
}
return _REVERSE_MAP;
}
/**
* picks the best action based on the key combination
*
* @param {string} key - character for key
* @param {Array} modifiers
* @param {string=} action passed in
*/
function _pickBestAction(key, modifiers, action) {
// if no action was picked in we should try to pick the one
// that we think would work best for this key
if (!action) {
action = _getReverseMap()[key] ? 'keydown' : 'keypress';
}
// modifier keys don't work as expected with keypress,
// switch to keydown
if (action == 'keypress' && modifiers.length) {
action = 'keydown';
}
return action;
}
/**
* binds a key sequence to an event
*
* @param {string} combo - combo specified in bind call
* @param {Array} keys
* @param {Function} callback
* @param {string=} action
* @returns void
*/
function _bindSequence(combo, keys, callback, action) {
// start off by adding a sequence level record for this combination
// and setting the level to 0
_sequenceLevels[combo] = 0;
/**
* callback to increase the sequence level for this sequence and reset
* all other sequences that were active
*
* @param {string} nextAction
* @returns {Function}
*/
function _increaseSequence(nextAction) {
return function() {
_nextExpectedAction = nextAction;
++_sequenceLevels[combo];
_resetSequenceTimer();
};
}
/**
* wraps the specified callback inside of another function in order
* to reset all sequence counters as soon as this sequence is done
*
* @param {Event} e
* @returns void
*/
function _callbackAndReset(e) {
_fireCallback(callback, e, combo);
// we should ignore the next key up if the action is key down
// or keypress. this is so if you finish a sequence and
// release the key the final key will not trigger a keyup
if (action !== 'keyup') {
_ignoreNextKeyup = _characterFromEvent(e);
}
// weird race condition if a sequence ends with the key
// another sequence begins with
setTimeout(_resetSequences, 10);
}
// loop through keys one at a time and bind the appropriate callback
// function. for any key leading up to the final one it should
// increase the sequence. after the final, it should reset all sequences
//
// if an action is specified in the original bind call then that will
// be used throughout. otherwise we will pass the action that the
// next key in the sequence should match. this allows a sequence
// to mix and match keypress and keydown events depending on which
// ones are better suited to the key provided
for (var i = 0; i < keys.length; ++i) {
var isFinal = i + 1 === keys.length;
var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i + 1]).action);
_bindSingle(keys[i], wrappedCallback, action, combo, i);
}
}
/**
* Converts from a string key combination to an array
*
* @param {string} combination like "command+shift+l"
* @return {Array}
*/
function _keysFromString(combination) {
if (combination === '+') {
return ['+'];
}
return combination.split('+');
}
/**
* Gets info for a specific key combination
*
* @param {string} combination key combination ("command+s" or "a" or "*")
* @param {string=} action
* @returns {Object}
*/
function _getKeyInfo(combination, action) {
var keys,
key,
i,
modifiers = [];
// take the keys from this pattern and figure out what the actual
// pattern is all about
keys = _keysFromString(combination);
for (i = 0; i < keys.length; ++i) {
key = keys[i];
// normalize key names
if (_SPECIAL_ALIASES[key]) {
key = _SPECIAL_ALIASES[key];
}
// if this is not a keypress event then we should
// be smart about using shift keys
// this will only work for US keyboards however
if (action && action != 'keypress' && _SHIFT_MAP[key]) {
key = _SHIFT_MAP[key];
modifiers.push('shift');
}
// if this key is a modifier then add it to the list of modifiers
if (_isModifier(key)) {
modifiers.push(key);
}
}
// depending on what the key combination is
// we will try to pick the best event for it
action = _pickBestAction(key, modifiers, action);
return {
key: key,
modifiers: modifiers,
action: action
};
}
/**
* binds a single keyboard combination
*
* @param {string} combination
* @param {Function} callback
* @param {string=} action
* @param {string=} sequenceName - name of sequence if part of sequence
* @param {number=} level - what part of the sequence the command is
* @returns void
*/
function _bindSingle(combination, callback, action, sequenceName, level) {
// store a direct mapped reference for use with Mousetrap.trigger
_directMap[combination + ':' + action] = callback;
// make sure multiple spaces in a row become a single space
combination = combination.replace(/\s+/g, ' ');
var sequence = combination.split(' '),
info;
// if this pattern is a sequence of keys then run through this method
// to reprocess each pattern one key at a time
if (sequence.length > 1) {
_bindSequence(combination, sequence, callback, action);
return;
}
info = _getKeyInfo(combination, action);
// make sure to initialize array if this is the first time
// a callback is added for this key
_callbacks[info.key] = _callbacks[info.key] || [];
// remove an existing match if there is one
_getMatches(info.key, info.modifiers, {type: info.action}, sequenceName, combination, level);
// add this call back to the array
// if it is a sequence put it at the beginning
// if not put it at the end
//
// this is important because the way these are processed expects
// the sequence ones to come first
_callbacks[info.key][sequenceName ? 'unshift' : 'push']({
callback: callback,
modifiers: info.modifiers,
action: info.action,
seq: sequenceName,
level: level,
combo: combination
});
}
/**
* binds multiple combinations to the same callback
*
* @param {Array} combinations
* @param {Function} callback
* @param {string|undefined} action
* @returns void
*/
function _bindMultiple(combinations, callback, action) {
for (var i = 0; i < combinations.length; ++i) {
_bindSingle(combinations[i], callback, action);
}
}
// start!
_addEvent(document, 'keypress', _handleKeyEvent);
_addEvent(document, 'keydown', _handleKeyEvent);
_addEvent(document, 'keyup', _handleKeyEvent);
var Mousetrap = {
/**
* binds an event to mousetrap
*
* can be a single key, a combination of keys separated with +,
* an array of keys, or a sequence of keys separated by spaces
*
* be sure to list the modifier keys first to make sure that the
* correct key ends up getting bound (the last key in the pattern)
*
* @param {string|Array} keys
* @param {Function} callback
* @param {string=} action - 'keypress', 'keydown', or 'keyup'
* @returns void
*/
bind: function(keys, callback, action) {
keys = keys instanceof Array ? keys : [keys];
_bindMultiple(keys, callback, action);
return this;
},
/**
* unbinds an event to mousetrap
*
* the unbinding sets the callback function of the specified key combo
* to an empty function and deletes the corresponding key in the
* _directMap dict.
*
* TODO: actually remove this from the _callbacks dictionary instead
* of binding an empty function
*
* the keycombo+action has to be exactly the same as
* it was defined in the bind method
*
* @param {string|Array} keys
* @param {string} action
* @returns void
*/
unbind: function(keys, action) {
return Mousetrap.bind(keys, function() {}, action);
},
/**
* triggers an event that has already been bound
*
* @param {string} keys
* @param {string=} action
* @returns void
*/
trigger: function(keys, action) {
if (_directMap[keys + ':' + action]) {
_directMap[keys + ':' + action]({}, keys);
}
return this;
},
/**
* resets the library back to its initial state. this is useful
* if you want to clear out the current keyboard shortcuts and bind
* new ones - for example if you switch to another page
*
* @returns void
*/
reset: function() {
_callbacks = {};
_directMap = {};
return this;
},
/**
* should we stop this event before firing off callbacks
*
* @param {Event} e
* @param {Element} element
* @return {boolean}
*/
stopCallback: function(e, element) {
// if the element has the class "mousetrap" then no need to stop
if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
return false;
}
// stop for input, select, and textarea
return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable;
},
/**
* exposes _handleKey publicly so it can be overwritten by extensions
*/
handleKey: _handleKey
};
// expose mousetrap to the global object
window.Mousetrap = Mousetrap;
// expose mousetrap as an AMD module
if (typeof define === 'function' && define.amd) {
define(Mousetrap);
}
}) (window, document);
},{}],5:[function(require,module,exports){
(function( factory ) {
if (typeof define !== 'undefined' && define.amd) {
define([], factory);
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = factory();
} else {
window.scrollMonitor = factory();
}
})(function() {
var scrollTop = function() {
return window.pageYOffset ||
(document.documentElement && document.documentElement.scrollTop) ||
document.body.scrollTop;
};
var exports = {};
var watchers = [];
var VISIBILITYCHANGE = 'visibilityChange';
var ENTERVIEWPORT = 'enterViewport';
var FULLYENTERVIEWPORT = 'fullyEnterViewport';
var EXITVIEWPORT = 'exitViewport';
var PARTIALLYEXITVIEWPORT = 'partiallyExitViewport';
var LOCATIONCHANGE = 'locationChange';
var STATECHANGE = 'stateChange';
var eventTypes = [
VISIBILITYCHANGE,
ENTERVIEWPORT,
FULLYENTERVIEWPORT,
EXITVIEWPORT,
PARTIALLYEXITVIEWPORT,
LOCATIONCHANGE,
STATECHANGE
];
var defaultOffsets = {top: 0, bottom: 0};
var getViewportHeight = function() {
return window.innerHeight || document.documentElement.clientHeight;
};
var getDocumentHeight = function() {
// jQuery approach
// whichever is greatest
return Math.max(
document.body.scrollHeight, document.documentElement.scrollHeight,
document.body.offsetHeight, document.documentElement.offsetHeight,
document.documentElement.clientHeight
);
};
exports.viewportTop = null;
exports.viewportBottom = null;
exports.documentHeight = null;
exports.viewportHeight = getViewportHeight();
var previousDocumentHeight;
var latestEvent;
var calculateViewportI;
function calculateViewport() {
exports.viewportTop = scrollTop();
exports.viewportBottom = exports.viewportTop + exports.viewportHeight;
exports.documentHeight = getDocumentHeight();
if (exports.documentHeight !== previousDocumentHeight) {
calculateViewportI = watchers.length;
while( calculateViewportI-- ) {
watchers[calculateViewportI].recalculateLocation();
}
previousDocumentHeight = exports.documentHeight;
}
}
function recalculateWatchLocationsAndTrigger() {
exports.viewportHeight = getViewportHeight();
calculateViewport();
updateAndTriggerWatchers();
}
var recalculateAndTriggerTimer;
function debouncedRecalcuateAndTrigger() {
clearTimeout(recalculateAndTriggerTimer);
recalculateAndTriggerTimer = setTimeout( recalculateWatchLocationsAndTrigger, 100 );
}
var updateAndTriggerWatchersI;
function updateAndTriggerWatchers() {
// update all watchers then trigger the events so one can rely on another being up to date.
updateAndTriggerWatchersI = watchers.length;
while( updateAndTriggerWatchersI-- ) {
watchers[updateAndTriggerWatchersI].update();
}
updateAndTriggerWatchersI = watchers.length;
while( updateAndTriggerWatchersI-- ) {
watchers[updateAndTriggerWatchersI].triggerCallbacks();
}
}
function ElementWatcher( watchItem, offsets ) {
var self = this;
this.watchItem = watchItem;
if (!offsets) {
this.offsets = defaultOffsets;
} else if (offsets === +offsets) {
this.offsets = {top: offsets, bottom: offsets};
} else {
this.offsets = {
top: offsets.top || defaultOffsets.top,
bottom: offsets.bottom || defaultOffsets.bottom
};
}
this.callbacks = {}; // {callback: function, isOne: true }
for (var i = 0, j = eventTypes.length; i < j; i++) {
self.callbacks[eventTypes[i]] = [];
}
this.locked = false;
var wasInViewport;
var wasFullyInViewport;
var wasAboveViewport;
var wasBelowViewport;
var listenerToTriggerListI;
var listener;
function triggerCallbackArray( listeners ) {
if (listeners.length === 0) {
return;
}
listenerToTriggerListI = listeners.length;
while( listenerToTriggerListI-- ) {
listener = listeners[listenerToTriggerListI];
listener.callback.call( self, latestEvent );
if (listener.isOne) {
listeners.splice(listenerToTriggerListI, 1);
}
}
}
this.triggerCallbacks = function triggerCallbacks() {
if (this.isInViewport && !wasInViewport) {
triggerCallbackArray( this.callbacks[ENTERVIEWPORT] );
}
if (this.isFullyInViewport && !wasFullyInViewport) {
triggerCallbackArray( this.callbacks[FULLYENTERVIEWPORT] );
}
if (this.isAboveViewport !== wasAboveViewport &&
this.isBelowViewport !== wasBelowViewport) {
triggerCallbackArray( this.callbacks[VISIBILITYCHANGE] );
// if you skip completely past this element
if (!wasFullyInViewport && !this.isFullyInViewport) {
triggerCallbackArray( this.callbacks[FULLYENTERVIEWPORT] );
triggerCallbackArray( this.callbacks[PARTIALLYEXITVIEWPORT] );
}
if (!wasInViewport && !this.isInViewport) {
triggerCallbackArray( this.callbacks[ENTERVIEWPORT] );
triggerCallbackArray( this.callbacks[EXITVIEWPORT] );
}
}
if (!this.isFullyInViewport && wasFullyInViewport) {
triggerCallbackArray( this.callbacks[PARTIALLYEXITVIEWPORT] );
}
if (!this.isInViewport && wasInViewport) {
triggerCallbackArray( this.callbacks[EXITVIEWPORT] );
}
if (this.isInViewport !== wasInViewport) {
triggerCallbackArray( this.callbacks[VISIBILITYCHANGE] );
}
switch( true ) {
case wasInViewport !== this.isInViewport:
case wasFullyInViewport !== this.isFullyInViewport:
case wasAboveViewport !== this.isAboveViewport:
case wasBelowViewport !== this.isBelowViewport:
triggerCallbackArray( this.callbacks[STATECHANGE] );
}
wasInViewport = this.isInViewport;
wasFullyInViewport = this.isFullyInViewport;
wasAboveViewport = this.isAboveViewport;
wasBelowViewport = this.isBelowViewport;
};
this.recalculateLocation = function() {
if (this.locked) {
return;
}
var previousTop = this.top;
var previousBottom = this.bottom;
if (this.watchItem.nodeName) { // a dom element
var cachedDisplay = this.watchItem.style.display;
if (cachedDisplay === 'none') {
this.watchItem.style.display = '';
}
var boundingRect = this.watchItem.getBoundingClientRect();
this.top = boundingRect.top + exports.viewportTop;
this.bottom = boundingRect.bottom + exports.viewportTop;
if (cachedDisplay === 'none') {
this.watchItem.style.display = cachedDisplay;
}
} else if (this.watchItem === +this.watchItem) { // number
if (this.watchItem > 0) {
this.top = this.bottom = this.watchItem;
} else {
this.top = this.bottom = exports.documentHeight - this.watchItem;
}
} else { // an object with a top and bottom property
this.top = this.watchItem.top;
this.bottom = this.watchItem.bottom;
}
this.top -= this.offsets.top;
this.bottom += this.offsets.bottom;
this.height = this.bottom - this.top;
if ( (previousTop !== undefined || previousBottom !== undefined) && (this.top !== previousTop || this.bottom !== previousBottom) ) {
triggerCallbackArray( this.callbacks[LOCATIONCHANGE] );
}
};
this.recalculateLocation();
this.update();
wasInViewport = this.isInViewport;
wasFullyInViewport = this.isFullyInViewport;
wasAboveViewport = this.isAboveViewport;
wasBelowViewport = this.isBelowViewport;
}
ElementWatcher.prototype = {
on: function( event, callback, isOne ) {
// trigger the event if it applies to the element right now.
switch( true ) {
case event === VISIBILITYCHANGE && !this.isInViewport && this.isAboveViewport:
case event === ENTERVIEWPORT && this.isInViewport:
case event === FULLYENTERVIEWPORT && this.isFullyInViewport:
case event === EXITVIEWPORT && this.isAboveViewport && !this.isInViewport:
case event === PARTIALLYEXITVIEWPORT && this.isAboveViewport:
callback.call( this, latestEvent );
if (isOne) {
return;
}
}
if (this.callbacks[event]) {
this.callbacks[event].push({callback: callback, isOne: isOne||false});
} else {
throw new Error('Tried to add a scroll monitor listener of type '+event+'. Your options are: '+eventTypes.join(', '));
}
},
off: function( event, callback ) {
if (this.callbacks[event]) {
for (var i = 0, item; item = this.callbacks[event][i]; i++) {
if (item.callback === callback) {
this.callbacks[event].splice(i, 1);
break;
}
}
} else {
throw new Error('Tried to remove a scroll monitor listener of type '+event+'. Your options are: '+eventTypes.join(', '));
}
},
one: function( event, callback ) {
this.on( event, callback, true);
},
recalculateSize: function() {
this.height = this.watchItem.offsetHeight + this.offsets.top + this.offsets.bottom;
this.bottom = this.top + this.height;
},
update: function() {
this.isAboveViewport = this.top < exports.viewportTop;
this.isBelowViewport = this.bottom > exports.viewportBottom;
this.isInViewport = (this.top <= exports.viewportBottom && this.bottom >= exports.viewportTop);
this.isFullyInViewport = (this.top >= exports.viewportTop && this.bottom <= exports.viewportBottom) ||
(this.isAboveViewport && this.isBelowViewport);
},
destroy: function() {
var index = watchers.indexOf(this),
self = this;
watchers.splice(index, 1);
for (var i = 0, j = eventTypes.length; i < j; i++) {
self.callbacks[eventTypes[i]].length = 0;
}
},
// prevent recalculating the element location
lock: function() {
this.locked = true;
},
unlock: function() {
this.locked = false;
}
};
var eventHandlerFactory = function (type) {
return function( callback, isOne ) {
this.on.call(this, type, callback, isOne);
};
};
for (var i = 0, j = eventTypes.length; i < j; i++) {
var type = eventTypes[i];
ElementWatcher.prototype[type] = eventHandlerFactory(type);
}
try {
calculateViewport();
} catch (e) {
try {
window.$(calculateViewport);
} catch (e) {
throw new Error('If you must put scrollMonitor in the <head>, you must use jQuery.');
}
}
function scrollMonitorListener(event) {
latestEvent = event;
calculateViewport();
updateAndTriggerWatchers();
}
if (window.addEventListener) {
window.addEventListener('scroll', scrollMonitorListener);
window.addEventListener('resize', debouncedRecalcuateAndTrigger);
} else {
// Old IE support
window.attachEvent('onscroll', scrollMonitorListener);
window.attachEvent('onresize', debouncedRecalcuateAndTrigger);
}
exports.beget = exports.create = function( element, offsets ) {
if (typeof element === 'string') {
element = document.querySelector(element);
} else if (element && element.length > 0) {
element = element[0];
}
var watcher = new ElementWatcher( element, offsets );
watchers.push(watcher);
watcher.update();
return watcher;
};
exports.update = function() {
latestEvent = null;
calculateViewport();
updateAndTriggerWatchers();
};
exports.recalculateLocations = function() {
exports.documentHeight = 0;
exports.update();
};
return exports;
});
},{}],6:[function(require,module,exports){
module.exports={
"name": "clappr",
"version": "0.0.88",
"description": "An extensible media player for the web",
"main": "dist/clappr.min.js",
"scripts": {
"test": "./node_modules/.bin/gulp release && ./node_modules/.bin/karma start --single-run --browsers Firefox"
},
"repository": {
"type": "git",
"url": "git@github.com:globocom/clappr.git"
},
"author": "Globo.com",
"license": "BSD",
"bugs": {
"url": "https://github.com/globocom/clappr/issues"
},
"browser": {
"zepto": "clappr-zepto"
},
"homepage": "https://github.com/globocom/clappr",
"devDependencies": {
"browserify": "^8.0.3",
"chai": "1.10.0",
"compass-mixins": "0.12.3",
"dotenv": "^0.4.0",
"es6ify": "~1.4.0",
"exorcist": "^0.1.6",
"express": "^4.6.1",
"express-alias": "0.4.0",
"glob": "^4.0.2",
"gulp": "^3.8.1",
"clappr-zepto": "0.0.3",
"gulp-compressor": "^0.1.0",
"gulp-jshint": "1.9.0",
"gulp-livereload": "^2.1.0",
"gulp-minify-css": "0.3.11",
"gulp-rename": "^1.2.0",
"gulp-sass": "1.0.0",
"gulp-streamify": "0.0.5",
"gulp-uglify": "^1.0.1",
"gulp-util": "3.0.1",
"karma": "^0.12.17",
"karma-browserify": "^1.0.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^0.1.4",
"karma-cli": "0.0.4",
"karma-firefox-launcher": "^0.1.3",
"karma-jasmine": "^0.2.2",
"karma-jquery": "^0.1.0",
"karma-mocha": "^0.1.4",
"karma-safari-launcher": "^0.1.1",
"karma-sinon": "^1.0.3",
"karma-sinon-chai": "^0.2.0",
"mkdirp": "^0.5.0",
"s3": "^4.1.1",
"scp": "0.0.3",
"sinon": "^1.10.2",
"traceur": "0.0.72",
"vinyl-source-stream": "^1.0.0",
"vinyl-transform": "0.0.1",
"watchify": "^2.0.0",
"yargs": "1.3.3"
},
"dependencies": {
"underscore": "1.7.0",
"mousetrap": "^1.4.6",
"scrollmonitor": "^1.0.8"
}
}
},{}],7:[function(require,module,exports){
"use strict";
var _ = require('underscore');
module.exports = {
'media_control': _.template('<div class="media-control-background" data-background></div><div class="media-control-layer" data-controls><% var renderBar=function(name) { %><div class="bar-container" data-<%= name %>><div class="bar-background" data-<%= name %>><div class="bar-fill-1" data-<%= name %>></div><div class="bar-fill-2" data-<%= name %>></div><div class="bar-hover" data-<%= name %>></div></div><div class="bar-scrubber" data-<%= name %>><div class="bar-scrubber-icon" data-<%= name %>></div></div></div><% }; %><% var renderSegmentedBar=function(name, segments) { segments=segments || 10; %><div class="bar-container" data-<%= name %>><% for (var i = 0; i < segments; i++) { %><div class="segmented-bar-element" data-<%= name %>></div><% } %></div><% }; %><% var renderDrawer=function(name, renderContent) { %><div class="drawer-container" data-<%= name %>><div class="drawer-icon-container" data-<%= name %>><div class="drawer-icon media-control-icon" data-<%= name %>></div><span class="drawer-text" data-<%= name %>></span></div><% renderContent(name); %></div><% }; %><% var renderIndicator=function(name) { %><div class="media-control-indicator" data-<%= name %>></div><% }; %><% var renderButton=function(name) { %><button class="media-control-button media-control-icon" data-<%= name %>></button><% }; %><% var templates={ bar: renderBar, segmentedBar: renderSegmentedBar, }; var render=function(settingsList) { _.each(settingsList, function(setting) { if(setting === "seekbar") { renderBar(setting); } else if (setting === "volume") { renderDrawer(setting, settings.volumeBarTemplate ? templates[settings.volumeBarTemplate] : function(name) { return renderSegmentedBar(name); }); } else if (setting === "duration" || setting=== "position") { renderIndicator(setting); } else { renderButton(setting); } }); }; %><% if (settings.default && settings.default.length) { %><div class="media-control-center-panel" data-media-control><% render(settings.default); %></div><% } %><% if (settings.left && settings.left.length) { %><div class="media-control-left-panel" data-media-control><% render(settings.left); %></div><% } %><% if (settings.right && settings.right.length) { %><div class="media-control-right-panel" data-media-control><% render(settings.right); %></div><% } %></div>'),
'seek_time': _.template('<span data-seek-time></span>'),
'flash': _.template('<param name="movie" value="<%= swfPath %>"><param name="quality" value="autohigh"><param name="swliveconnect" value="true"><param name="allowScriptAccess" value="always"><param name="bgcolor" value="#001122"><param name="allowFullScreen" value="false"><param name="wmode" value="transparent"><param name="tabindex" value="1"><param name=FlashVars value="playbackId=<%= playbackId %>" /><embed type="application/x-shockwave-flash" disabled tabindex="-1" enablecontextmenu="false" allowScriptAccess="always" quality="autohight" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" swliveconnect="true" type="application/x-shockwave-flash" allowfullscreen="false" bgcolor="#000000" FlashVars="playbackId=<%= playbackId %>" src="<%= swfPath %>"></embed>'),
'hls': _.template('<param name="movie" value="<%= swfPath %>?inline=1"><param name="quality" value="autohigh"><param name="swliveconnect" value="true"><param name="allowScriptAccess" value="always"><param name="bgcolor" value="#001122"><param name="allowFullScreen" value="false"><param name="wmode" value="transparent"><param name="tabindex" value="1"><param name=FlashVars value="playbackId=<%= playbackId %>" /><embed type="application/x-shockwave-flash" tabindex="1" enablecontextmenu="false" allowScriptAccess="always" quality="autohigh" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" swliveconnect="true" type="application/x-shockwave-flash" allowfullscreen="false" bgcolor="#000000" FlashVars="playbackId=<%= playbackId %>" src="<%= swfPath %>" width="100%" height="100%"></embed>'),
'html5_video': _.template('<source src="<%=src%>" type="<%=type%>">'),
'no_op': _.template('<p data-no-op-msg>Something went wrong :(</p>'),
'background_button': _.template('<div class="background-button-wrapper" data-background-button><button class="background-button-icon" data-background-button></button></div>'),
'dvr_controls': _.template('<div class="live-info">LIVE</div><button class="live-button">BACK TO LIVE</button>'),
'poster': _.template('<div class="play-wrapper" data-poster><span class="poster-icon play" data-poster/></div>'),
'spinner_three_bounce': _.template('<div data-bounce1></div><div data-bounce2></div><div data-bounce3></div>'),
'watermark': _.template('<div data-watermark data-watermark-<%=position %>><img src="<%= imageUrl %>"></div>'),
CSS: {
'container': '.container[data-container]{position:absolute;background-color:#000;height:100%;width:100%}.container[data-container].pointer-enabled{cursor:pointer}',
'core': '[data-player]{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0);position:relative;margin:0;padding:0;border:0;font-style:normal;font-weight:400;text-align:center;overflow:hidden;font-size:100%;font-family:"lucida grande",tahoma,verdana,arial,sans-serif;text-shadow:0 0 0;box-sizing:border-box}[data-player] a,[data-player] abbr,[data-player] acronym,[data-player] address,[data-player] applet,[data-player] article,[data-player] aside,[data-player] audio,[data-player] b,[data-player] big,[data-player] blockquote,[data-player] canvas,[data-player] caption,[data-player] center,[data-player] cite,[data-player] code,[data-player] dd,[data-player] del,[data-player] details,[data-player] dfn,[data-player] div,[data-player] dl,[data-player] dt,[data-player] em,[data-player] embed,[data-player] fieldset,[data-player] figcaption,[data-player] figure,[data-player] footer,[data-player] form,[data-player] h1,[data-player] h2,[data-player] h3,[data-player] h4,[data-player] h5,[data-player] h6,[data-player] header,[data-player] hgroup,[data-player] i,[data-player] iframe,[data-player] img,[data-player] ins,[data-player] kbd,[data-player] label,[data-player] legend,[data-player] li,[data-player] mark,[data-player] menu,[data-player] nav,[data-player] object,[data-player] ol,[data-player] output,[data-player] p,[data-player] pre,[data-player] q,[data-player] ruby,[data-player] s,[data-player] samp,[data-player] section,[data-player] small,[data-player] span,[data-player] strike,[data-player] strong,[data-player] sub,[data-player] summary,[data-player] sup,[data-player] table,[data-player] tbody,[data-player] td,[data-player] tfoot,[data-player] th,[data-player] thead,[data-player] time,[data-player] tr,[data-player] tt,[data-player] u,[data-player] ul,[data-player] var,[data-player] video{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}[data-player] table{border-collapse:collapse;border-spacing:0}[data-player] caption,[data-player] td,[data-player] th{text-align:left;font-weight:400;vertical-align:middle}[data-player] blockquote,[data-player] q{quotes:none}[data-player] blockquote:after,[data-player] blockquote:before,[data-player] q:after,[data-player] q:before{content:"";content:none}[data-player] a img{border:none}[data-player] *{max-width:initial;box-sizing:inherit;float:initial}[data-player].fullscreen{width:100%;height:100%}[data-player].nocursor{cursor:none}[data-player] .clappr-style{display:none!important}@media screen{[data-player]{opacity:.99}}',
'media_control': '@font-face{font-family:Player;src:url(http://cdn.clappr.io/latest/assets/Player-Regular.eot);src:url(http://cdn.clappr.io/latest/assets/Player-Regular.eot?#iefix) format("embedded-opentype"),url(http://cdn.clappr.io/latest/assets/Player-Regular.ttf) format("truetype"),url(http://cdn.clappr.io/latest/assets/Player-Regular.svg#player) format("svg")}.media-control-notransition{-webkit-transition:none!important;-webkit-transition-delay:0s;-moz-transition:none!important;-o-transition:none!important;transition:none!important}.media-control[data-media-control]{position:absolute;width:100%;height:100%;z-index:9999;pointer-events:none}.media-control[data-media-control].dragging{pointer-events:auto;cursor:-webkit-grabbing!important;cursor:grabbing!important}.media-control[data-media-control].dragging *{cursor:-webkit-grabbing!important;cursor:grabbing!important}.media-control[data-media-control] .media-control-background[data-background]{position:absolute;height:40%;width:100%;bottom:0;background-image:-owg(linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.9)));background-image:-webkit(linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.9)));background-image:-moz(linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.9)));background-image:-o(linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.9)));background-image:linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.9));-webkit-transition:opacity .6s;-webkit-transition-delay:ease-out;-moz-transition:opacity .6s ease-out;-o-transition:opacity .6s ease-out;transition:opacity .6s ease-out}.media-control[data-media-control] .media-control-icon{font-family:Player;font-weight:400;font-style:normal;font-size:26px;line-height:32px;letter-spacing:0;speak:none;color:#fff;opacity:.5;vertical-align:middle;text-align:left;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-transition:all .1s;-webkit-transition-delay:ease;-moz-transition:all .1s ease;-o-transition:all .1s ease;transition:all .1s ease}.media-control[data-media-control] .media-control-icon:hover{color:#fff;opacity:.75;text-shadow:rgba(255,255,255,.8) 0 0 5px}.media-control[data-media-control].media-control-hide .media-control-background[data-background]{opacity:0}.media-control[data-media-control].media-control-hide .media-control-layer[data-controls]{bottom:-50px}.media-control[data-media-control].media-control-hide .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar]{opacity:0}.media-control[data-media-control] .media-control-layer[data-controls]{position:absolute;bottom:7px;width:100%;height:32px;vertical-align:middle;pointer-events:auto;-webkit-transition:bottom .4s;-webkit-transition-delay:ease-out;-moz-transition:bottom .4s ease-out;-o-transition:bottom .4s ease-out;transition:bottom .4s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-left-panel[data-media-control]{position:absolute;top:0;left:4px;height:100%}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-center-panel[data-media-control]{height:100%;text-align:center;line-height:32px}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-right-panel[data-media-control]{position:absolute;top:0;right:4px;height:100%}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button{background-color:transparent;border:0;margin:0 6px;padding:0;cursor:pointer;display:inline-block}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button:focus{outline:0}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-play]{float:left;height:100%;font-size:20px}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-play]:before{content:"\\e001"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-pause]{float:left;height:100%;font-size:20px}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-pause]:before{content:"\\e002"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-stop]{float:left;height:100%;font-size:20px}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-stop]:before{content:"\\e003"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-fullscreen]{float:right;background-color:transparent;border:0;height:100%}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-fullscreen]:before{content:"\\e006"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-fullscreen].shrink:before{content:"\\e007"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator]{cursor:default;float:right;background-color:transparent;border:0;height:100%;opacity:0}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator]:before{content:"\\e008"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator].enabled{opacity:1}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator].enabled:hover{opacity:1;text-shadow:none}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playpause]{float:left;height:100%;font-size:20px}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playpause]:before{content:"\\e001"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playpause].playing:before{content:"\\e002"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playpause].paused:before{content:"\\e001"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playstop]{float:left;height:100%;font-size:20px}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playstop]:before{content:"\\e001"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playstop].playing:before{content:"\\e003"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playstop].stopped:before{content:"\\e001"}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration],.media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-position]{display:inline-block;font-size:10px;color:#fff;cursor:default;line-height:32px;position:relative}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-position]{margin-left:6px}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration]{color:rgba(255,255,255,.5);margin-right:6px}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration]:before{content:"|";margin:0 3px}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar]{position:absolute;top:-20px;left:0;display:inline-block;vertical-align:middle;width:100%;height:25px;cursor:pointer}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar]{width:100%;height:1px;position:relative;top:12px;background-color:#666}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-1[data-seekbar]{position:absolute;top:0;left:0;width:0;height:100%;background-color:#c2c2c2;-webkit-transition:all .1s;-webkit-transition-delay:ease-out;-moz-transition:all .1s ease-out;-o-transition:all .1s ease-out;transition:all .1s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar]{position:absolute;top:0;left:0;width:0;height:100%;background-color:#005aff;-webkit-transition:all .1s;-webkit-transition-delay:ease-out;-moz-transition:all .1s ease-out;-o-transition:all .1s ease-out;transition:all .1s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-hover[data-seekbar]{opacity:0;position:absolute;top:-3px;width:5px;height:7px;background-color:rgba(255,255,255,.5);-webkit-transition:opacity .1s;-webkit-transition-delay:ease;-moz-transition:opacity .1s ease;-o-transition:opacity .1s ease;transition:opacity .1s ease}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar]:hover .bar-background[data-seekbar] .bar-hover[data-seekbar]{opacity:1}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar].seek-disabled{cursor:default}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar].seek-disabled:hover .bar-background[data-seekbar] .bar-hover[data-seekbar]{opacity:0}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar]{position:absolute;top:2px;left:0;width:20px;height:20px;opacity:1;-webkit-transition:all .1s;-webkit-transition-delay:ease-out;-moz-transition:all .1s ease-out;-o-transition:all .1s ease-out;transition:all .1s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar] .bar-scrubber-icon[data-seekbar]{position:absolute;left:6px;top:6px;width:8px;height:8px;border-radius:10px;box-shadow:0 0 0 6px rgba(255,255,255,.2);background-color:#fff}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume]{float:right;display:inline-block;height:32px;cursor:pointer;margin:0 6px;box-sizing:border-box}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume]{float:left;bottom:0}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume]{background-color:transparent;border:0;box-sizing:content-box;width:16px;height:32px;margin-right:6px;opacity:1}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume]:hover{opacity:1}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume]:before{content:"\\e004"}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume].muted{opacity:.5}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume].muted:hover{opacity:.7}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume].muted:before{content:"\\e005"}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume]{float:left;position:relative;top:6px;width:42px;height:18px;padding:3px 0;overflow:hidden;-webkit-transition:width .2s;-webkit-transition-delay:ease-out;-moz-transition:width .2s ease-out;-o-transition:width .2s ease-out;transition:width .2s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume]{float:left;width:4px;padding-left:2px;height:12px;opacity:.5;-webkit-box-shadow:inset 2px 0 0 #fff;-moz-box-shadow:inset 2px 0 0 #fff;-ms-box-shadow:inset 2px 0 0 #fff;-o-box-shadow:inset 2px 0 0 #fff;box-shadow:inset 2px 0 0 #fff;-webkit-transition:-webkit-transform .2s;-webkit-transition-delay:ease-out;-moz-transition:-moz-transform .2s ease-out;-o-transition:-o-transform .2s ease-out;transition:transform .2s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume].fill{-webkit-box-shadow:inset 2px 0 0 #fff;-moz-box-shadow:inset 2px 0 0 #fff;-ms-box-shadow:inset 2px 0 0 #fff;-o-box-shadow:inset 2px 0 0 #fff;box-shadow:inset 2px 0 0 #fff;opacity:1}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume]:nth-of-type(1){padding-left:0}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume]:hover{-webkit-transform:scaleY(1.5);-moz-transform:scaleY(1.5);-ms-transform:scaleY(1.5);-o-transform:scaleY(1.5);transform:scaleY(1.5)}.media-control[data-media-control].w320 .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume].volume-bar-hide{height:12px;top:9px;padding:0;width:0}',
'seek_time': '.seek-time[data-seek-time]{position:absolute;width:auto;height:20px;line-height:20px;bottom:55px;background-color:rgba(2,2,2,.5);z-index:9999;-webkit-transition:opacity .1s;-webkit-transition-delay:ease;-moz-transition:opacity .1s ease;-o-transition:opacity .1s ease;transition:opacity .1s ease}.seek-time[data-seek-time].hidden[data-seek-time]{opacity:0}.seek-time[data-seek-time] span[data-seek-time]{position:relative;color:#fff;font-size:10px;padding-left:7px;padding-right:7px}',
'flash': '[data-flash]{position:absolute;height:100%;width:100%;background-color:#000;display:block;pointer-events:none}',
'hls': '[data-hls]{position:absolute;display:block;pointer-events:none;top:0}',
'html5_video': '[data-html5-video]{position:absolute;height:100%;width:100%;display:block}',
'html_img': '[data-html-img]{max-width:100%;max-height:100%}',
'no_op': '[data-no-op]{z-index:1000;position:absolute;background-color:#222;height:100%;width:100%}[data-no-op] p[data-no-op-msg]{position:relative;font-size:25px;top:50%;color:#fff}',
'background_button': '.background-button[data-background-button]{font-family:Player;position:absolute;height:100%;width:100%;background-color:rgba(0,0,0,.2);pointer-events:none;-webkit-transition:all .4s;-webkit-transition-delay:ease-out;-moz-transition:all .4s ease-out;-o-transition:all .4s ease-out;transition:all .4s ease-out}.background-button[data-background-button].hide{background-color:transparent}.background-button[data-background-button].hide .background-button-wrapper[data-background-button]{opacity:0}.background-button[data-background-button] .background-button-wrapper[data-background-button]{position:absolute;overflow:hidden;width:100%;height:25%;line-height:100%;font-size:25%;top:50%;text-align:center}.background-button[data-background-button] .background-button-wrapper[data-background-button] .background-button-icon[data-background-button]{cursor:pointer;pointer-events:auto;font-family:Player;font-weight:400;font-style:normal;line-height:1;letter-spacing:0;speak:none;color:#fff;opacity:.75;border:0;outline:0;background-color:transparent;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-transition:all .1s;-webkit-transition-delay:ease;-moz-transition:all .1s ease;-o-transition:all .1s ease;transition:all .1s ease}.background-button[data-background-button] .background-button-wrapper[data-background-button] .background-button-icon[data-background-button]:hover{opacity:1;text-shadow:rgba(255,255,255,.8) 0 0 15px}.background-button[data-background-button] .background-button-wrapper[data-background-button] .background-button-icon[data-background-button].playing:before{content:"\\e002"}.background-button[data-background-button] .background-button-wrapper[data-background-button] .background-button-icon[data-background-button].notplaying:before{content:"\\e001"}.background-button[data-background-button] .background-button-wrapper[data-background-button] .background-button-icon[data-background-button].playstop.playing:before{content:"\\e003"}.background-button[data-background-button] .background-button-wrapper[data-background-button] .background-button-icon[data-background-button].playstop.notplaying:before{content:"\\e001"}.media-control.media-control-hide[data-media-control] .background-button[data-background-button]{opacity:0}',
'dvr_controls': '@import url(http://fonts.googleapis.com/css?family=Roboto);.dvr-controls[data-dvr-controls]{display:inline-block;float:left;color:#fff;line-height:32px;font-size:10px;font-weight:700;margin-left:6px}.dvr-controls[data-dvr-controls] .live-info{cursor:default;font-family:Roboto,"Open Sans",Arial,sans-serif}.dvr-controls[data-dvr-controls] .live-info:before{content:"";display:inline-block;position:relative;width:7px;height:7px;border-radius:3.5px;margin-right:3.5px;background-color:#ff0101}.dvr-controls[data-dvr-controls] .live-info.disabled{opacity:.3}.dvr-controls[data-dvr-controls] .live-info.disabled:before{background-color:#fff}.dvr-controls[data-dvr-controls] .live-button{cursor:pointer;outline:0;display:none;border:0;color:#fff;background-color:transparent;height:32px;padding:0;opacity:.7;font-family:Roboto,"Open Sans",Arial,sans-serif;-webkit-transition:all .1s;-webkit-transition-delay:ease;-moz-transition:all .1s ease;-o-transition:all .1s ease;transition:all .1s ease}.dvr-controls[data-dvr-controls] .live-button:before{content:"";display:inline-block;position:relative;width:7px;height:7px;border-radius:3.5px;margin-right:3.5px;background-color:#fff}.dvr-controls[data-dvr-controls] .live-button:hover{opacity:1;text-shadow:rgba(255,255,255,.75) 0 0 5px}.dvr .dvr-controls[data-dvr-controls] .live-info{display:none}.dvr .dvr-controls[data-dvr-controls] .live-button{display:block}.dvr.media-control.live[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar]{background-color:#005aff}.media-control.live[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar]{background-color:#ff0101}.seek-time[data-seek-time] span[data-duration]{position:relative;color:rgba(255,255,255,.5);font-size:10px;padding-right:7px}.seek-time[data-seek-time] span[data-duration]:before{content:"|";margin-right:7px}',
'poster': '@font-face{font-family:Player;src:url(http://cdn.clappr.io/latest/assets/Player-Regular.eot);src:url(http://cdn.clappr.io/latest/assets/Player-Regular.eot?#iefix) format("embedded-opentype"),url(http://cdn.clappr.io/latest/assets/Player-Regular.ttf) format("truetype"),url(http://cdn.clappr.io/latest/assets/Player-Regular.svg#player) format("svg")}.player-poster[data-poster]{cursor:pointer;position:absolute;height:100%;width:100%;z-index:998;top:0}.player-poster[data-poster] .poster-background[data-poster]{width:100%;height:100%}.player-poster[data-poster] .play-wrapper[data-poster]{position:absolute;width:100%;height:25%;line-height:100%;font-size:25%;top:50%;text-align:center}.player-poster[data-poster] .play-wrapper[data-poster] .poster-icon[data-poster]{font-family:Player;font-weight:400;font-style:normal;line-height:1;letter-spacing:0;speak:none;color:#fff;opacity:.75;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-transition:opacity text-shadow;-webkit-transition-delay:.1s;-moz-transition:opacity text-shadow .1s;-o-transition:opacity text-shadow .1s;transition:opacity text-shadow .1s ease}.player-poster[data-poster] .play-wrapper[data-poster] .poster-icon[data-poster].play[data-poster]:before{content:"\\e001"}.player-poster[data-poster] .play-wrapper[data-poster] .poster-icon[data-poster]:hover{opacity:1;text-shadow:rgba(255,255,255,.8) 0 0 15px}',
'spinner_three_bounce': '.spinner-three-bounce[data-spinner]{position:absolute;margin:0 auto;width:70px;text-align:center;z-index:999;top:47%;left:0;right:0}.spinner-three-bounce[data-spinner]>div{width:18px;height:18px;background-color:#FFF;border-radius:100%;display:inline-block;-webkit-animation:bouncedelay 1.4s infinite ease-in-out;-moz-animation:bouncedelay 1.4s infinite ease-in-out;-ms-animation:bouncedelay 1.4s infinite ease-in-out;-o-animation:bouncedelay 1.4s infinite ease-in-out;animation:bouncedelay 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;-moz-animation-fill-mode:both;-ms-animation-fill-mode:both;-o-animation-fill-mode:both;animation-fill-mode:both}.spinner-three-bounce[data-spinner] [data-bounce1],.spinner-three-bounce[data-spinner] [data-bounce2]{-webkit-animation-delay:-.32s;-moz-animation-delay:-.32s;-ms-animation-delay:-.32s;-o-animation-delay:-.32s;animation-delay:-.32s}@-moz-keyframes bouncedelay{0%,100%,80%{-moz-transform:scale(0);transform:scale(0)}40%{-moz-transform:scale(1);transform:scale(1)}}@-webkit-keyframes bouncedelay{0%,100%,80%{-webkit-transform:scale(0);transform:scale(0)}40%{-webkit-transform:scale(1);transform:scale(1)}}@-o-keyframes bouncedelay{0%,100%,80%{-o-transform:scale(0);transform:scale(0)}40%{-o-transform:scale(1);transform:scale(1)}}@-ms-keyframes bouncedelay{0%,100%,80%{-ms-transform:scale(0);transform:scale(0)}40%{-ms-transform:scale(1);transform:scale(1)}}@keyframes bouncedelay{0%,100%,80%{transform:scale(0)}40%{transform:scale(1)}}',
'watermark': '[data-watermark]{position:absolute;margin:100px auto 0;width:70px;text-align:center;z-index:10}[data-watermark-bottom-left]{bottom:10px;left:10px}[data-watermark-bottom-right]{bottom:10px;right:42px}[data-watermark-top-left]{top:-95px;left:10px}[data-watermark-top-right]{top:-95px;right:37px}'
}
};
},{"underscore":"underscore"}],8:[function(require,module,exports){
"use strict";
var $ = require('zepto');
var _ = require('underscore');
var JST = require('./jst');
var Styler = {getStyleFor: function(name, options) {
options = options || {};
return $('<style class="clappr-style"></style>').html(_.template(JST.CSS[name])(options))[0];
}};
module.exports = Styler;
},{"./jst":7,"underscore":"underscore","zepto":"zepto"}],9:[function(require,module,exports){
"use strict";
var _ = require('underscore');
var Browser = require('browser');
var extend = function(protoProps, staticProps) {
var parent = this;
var child;
if (protoProps && _.has(protoProps, 'constructor')) {
child = protoProps.constructor;
} else {
child = function() {
return parent.apply(this, arguments);
};
}
_.extend(child, parent, staticProps);
var Surrogate = function() {
this.constructor = child;
};
Surrogate.prototype = parent.prototype;
child.prototype = new Surrogate();
if (protoProps)
_.extend(child.prototype, protoProps);
child.__super__ = parent.prototype;
child.super = function(name) {
return parent.prototype[name];
};
child.prototype.getClass = function() {
return child;
};
return child;
};
var formatTime = function(time) {
time = time * 1000;
time = parseInt(time / 1000);
var seconds = time % 60;
time = parseInt(time / 60);
var minutes = time % 60;
time = parseInt(time / 60);
var hours = time % 24;
var out = "";
if (hours && hours > 0)
out += ("0" + hours).slice(-2) + ":";
out += ("0" + minutes).slice(-2) + ":";
out += ("0" + seconds).slice(-2);
return out.trim();
};
var Fullscreen = {
isFullscreen: function() {
return document.webkitIsFullScreen || document.mozFullScreen || !!document.msFullscreenElement || window.iframeFullScreen;
},
requestFullscreen: function(el) {
if (el.requestFullscreen) {
el.requestFullscreen();
} else if (el.webkitRequestFullscreen) {
el.webkitRequestFullscreen();
} else if (el.mozRequestFullScreen) {
el.mozRequestFullScreen();
} else if (el.msRequestFullscreen) {
el.msRequestFullscreen();
}
},
cancelFullscreen: function() {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
}
};
var Config = function Config() {};
($traceurRuntime.createClass)(Config, {}, {
_defaultConfig: function() {
return {volume: {
value: 100,
parse: parseInt
}};
},
_defaultValueFor: function(key) {
try {
return this._defaultConfig()[key]['parse'](this._defaultConfig()[key]['value']);
} catch (e) {
return undefined;
}
},
_create_keyspace: function(key) {
return 'clappr.' + document.domain + '.' + key;
},
restore: function(key) {
if (Browser.hasLocalstorage && localStorage[this._create_keyspace(key)]) {
return this._defaultConfig()[key]['parse'](localStorage[this._create_keyspace(key)]);
}
return this._defaultValueFor(key);
},
persist: function(key, value) {
if (Browser.hasLocalstorage) {
try {
localStorage[this._create_keyspace(key)] = value;
return true;
} catch (e) {
return false;
}
}
}
});
var seekStringToSeconds = function(url) {
var elements = _.rest(_.compact(url.match(/t=([0-9]*)h?([0-9]*)m?([0-9]*)s/))).reverse();
var seconds = 0;
var factor = 1;
_.each(elements, function(el) {
seconds += (parseInt(el) * factor);
factor = factor * 60;
}, this);
return seconds;
};
module.exports = {
extend: extend,
formatTime: formatTime,
Fullscreen: Fullscreen,
Config: Config,
seekStringToSeconds: seekStringToSeconds
};
},{"browser":"browser","underscore":"underscore"}],10:[function(require,module,exports){
"use strict";
var UIObject = require('ui_object');
var Styler = require('../../base/styler');
var _ = require('underscore');
var Events = require('events');
var Container = function Container(options) {
$traceurRuntime.superCall(this, $Container.prototype, "constructor", [options]);
this.playback = options.playback;
this.settings = this.playback.settings;
this.isReady = false;
this.mediaControlDisabled = false;
this.plugins = [this.playback];
this.bindEvents();
};
var $Container = Container;
($traceurRuntime.createClass)(Container, {
get name() {
return 'Container';
},
get attributes() {
return {
class: 'container',
'data-container': ''
};
},
get events() {
return {'click': 'clicked'};
},
bindEvents: function() {
this.listenTo(this.playback, Events.PLAYBACK_PROGRESS, this.progress);
this.listenTo(this.playback, Events.PLAYBACK_TIMEUPDATE, this.timeUpdated);
this.listenTo(this.playback, Events.PLAYBACK_READY, this.ready);
this.listenTo(this.playback, Events.PLAYBACK_BUFFERING, this.buffering);
this.listenTo(this.playback, Events.PLAYBACK_BUFFERFULL, this.bufferfull);
this.listenTo(this.playback, Events.PLAYBACK_SETTINGSUPDATE, this.settingsUpdate);
this.listenTo(this.playback, Events.PLAYBACK_LOADEDMETADATA, this.loadedMetadata);
this.listenTo(this.playback, Events.PLAYBACK_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate);
this.listenTo(this.playback, Events.PLAYBACK_BITRATE, this.updateBitrate);
this.listenTo(this.playback, Events.PLAYBACK_PLAYBACKSTATE, this.playbackStateChanged);
this.listenTo(this.playback, Events.PLAYBACK_DVR, this.playbackDvrStateChanged);
this.listenTo(this.playback, Events.PLAYBACK_MEDIACONTROL_DISABLE, this.disableMediaControl);
this.listenTo(this.playback, Events.PLAYBACK_MEDIACONTROL_ENABLE, this.enableMediaControl);
this.listenTo(this.playback, Events.PLAYBACK_ENDED, this.ended);
this.listenTo(this.playback, Events.PLAYBACK_PLAY, this.playing);
this.listenTo(this.playback, Events.PLAYBACK_ERROR, this.error);
},
with: function(klass) {
_.extend(this, klass);
return this;
},
playbackStateChanged: function() {
this.trigger(Events.CONTAINER_PLAYBACKSTATE);
},
playbackDvrStateChanged: function(dvrInUse) {
this.settings = this.playback.settings;
this.dvrInUse = dvrInUse;
this.trigger(Events.CONTAINER_PLAYBACKDVRSTATECHANGED, dvrInUse);
},
updateBitrate: function(newBitrate) {
this.trigger(Events.CONTAINER_BITRATE, newBitrate);
},
statsReport: function(metrics) {
this.trigger(Events.CONTAINER_STATS_REPORT, metrics);
},
getPlaybackType: function() {
return this.playback.getPlaybackType();
},
isDvrEnabled: function() {
return !!this.playback.dvrEnabled;
},
isDvrInUse: function() {
return !!this.dvrInUse;
},
destroy: function() {
this.trigger(Events.CONTAINER_DESTROYED, this, this.name);
this.playback.destroy();
_(this.plugins).each((function(plugin) {
return plugin.destroy();
}));
this.$el.remove();
},
setStyle: function(style) {
this.$el.css(style);
},
animate: function(style, duration) {
return this.$el.animate(style, duration).promise();
},
ready: function() {
this.isReady = true;
this.trigger(Events.CONTAINER_READY, this.name);
},
isPlaying: function() {
return this.playback.isPlaying();
},
getDuration: function() {
return this.playback.getDuration();
},
error: function(errorObj) {
this.$el.append(errorObj.render().el);
this.trigger(Events.CONTAINER_ERROR, {
error: errorObj,
container: this
}, this.name);
},
loadedMetadata: function(duration) {
this.trigger(Events.CONTAINER_LOADEDMETADATA, duration);
},
timeUpdated: function(position, duration) {
this.trigger(Events.CONTAINER_TIMEUPDATE, position, duration, this.name);
},
progress: function(startPosition, endPosition, duration) {
this.trigger(Events.CONTAINER_PROGRESS, startPosition, endPosition, duration, this.name);
},
playing: function() {
this.trigger(Events.CONTAINER_PLAY, this.name);
},
play: function() {
this.playback.play();
},
stop: function() {
this.trigger(Events.CONTAINER_STOP, this.name);
this.playback.stop();
},
pause: function() {
this.trigger(Events.CONTAINER_PAUSE, this.name);
this.playback.pause();
},
ended: function() {
this.trigger(Events.CONTAINER_ENDED, this, this.name);
},
clicked: function() {
this.trigger(Events.CONTAINER_CLICK, this, this.name);
},
setCurrentTime: function(time) {
this.trigger(Events.CONTAINER_SEEK, time, this.name);
this.playback.seek(time);
},
setVolume: function(value) {
this.trigger(Events.CONTAINER_VOLUME, value, this.name);
this.playback.volume(value);
},
fullscreen: function() {
this.trigger(Events.CONTAINER_FULLSCREEN, this.name);
},
buffering: function() {
this.trigger(Events.CONTAINER_STATE_BUFFERING, this.name);
},
bufferfull: function() {
this.trigger(Events.CONTAINER_STATE_BUFFERFULL, this.name);
},
addPlugin: function(plugin) {
this.plugins.push(plugin);
},
hasPlugin: function(name) {
return !!this.getPlugin(name);
},
getPlugin: function(name) {
return _(this.plugins).find(function(plugin) {
return plugin.name === name;
});
},
settingsUpdate: function() {
this.settings = this.playback.settings;
this.trigger(Events.CONTAINER_SETTINGSUPDATE);
},
highDefinitionUpdate: function() {
this.trigger(Events.CONTAINER_HIGHDEFINITIONUPDATE);
},
isHighDefinitionInUse: function() {
return this.playback.isHighDefinitionInUse();
},
disableMediaControl: function() {
this.mediaControlDisabled = true;
this.trigger(Events.CONTAINER_MEDIACONTROL_DISABLE);
},
enableMediaControl: function() {
this.mediaControlDisabled = false;
this.trigger(Events.CONTAINER_MEDIACONTROL_ENABLE);
},
render: function() {
var style = Styler.getStyleFor('container');
this.$el.append(style);
this.$el.append(this.playback.render().el);
return this;
}
}, {}, UIObject);
module.exports = Container;
},{"../../base/styler":8,"events":"events","ui_object":"ui_object","underscore":"underscore"}],11:[function(require,module,exports){
"use strict";
var _ = require('underscore');
var BaseObject = require('base_object');
var Container = require('container');
var $ = require('zepto');
var Events = require('events');
var ContainerFactory = function ContainerFactory(options, loader) {
$traceurRuntime.superCall(this, $ContainerFactory.prototype, "constructor", [options]);
this.options = options;
this.loader = loader;
};
var $ContainerFactory = ContainerFactory;
($traceurRuntime.createClass)(ContainerFactory, {
createContainers: function() {
var $__0 = this;
return $.Deferred((function(promise) {
promise.resolve(_.map($__0.options.sources, (function(source) {
return $__0.createContainer(source);
}), $__0));
}));
},
findPlaybackPlugin: function(source) {
return _.find(this.loader.playbackPlugins, (function(p) {
return p.canPlay(source.toString());
}), this);
},
createContainer: function(source) {
var playbackPlugin = this.findPlaybackPlugin(source);
var options = _.extend({}, this.options, {
src: source,
autoPlay: !!this.options.autoPlay
});
var playback = new playbackPlugin(options);
var container = new Container({playback: playback});
var defer = $.Deferred();
defer.promise(container);
this.addContainerPlugins(container, source);
this.listenToOnce(container, Events.CONTAINER_READY, (function() {
return defer.resolve(container);
}));
return container;
},
addContainerPlugins: function(container, source) {
_.each(this.loader.containerPlugins, function(Plugin) {
var options = _.extend(this.options, {
container: container,
src: source
});
container.addPlugin(new Plugin(options));
}, this);
}
}, {}, BaseObject);
module.exports = ContainerFactory;
},{"base_object":"base_object","container":"container","events":"events","underscore":"underscore","zepto":"zepto"}],12:[function(require,module,exports){
"use strict";
module.exports = require('./container_factory');
},{"./container_factory":11}],13:[function(require,module,exports){
"use strict";
var _ = require('underscore');
var $ = require('zepto');
var UIObject = require('ui_object');
var ContainerFactory = require('../container_factory');
var Fullscreen = require('../../base/utils').Fullscreen;
var Styler = require('../../base/styler');
var MediaControl = require('media_control');
var PlayerInfo = require('player_info');
var Mediator = require('mediator');
var Events = require('events');
var Core = function Core(options) {
var $__0 = this;
$traceurRuntime.superCall(this, $Core.prototype, "constructor", [options]);
PlayerInfo.options = options;
this.options = options;
this.plugins = [];
this.containers = [];
this.createContainers(options);
$(document).bind('fullscreenchange', (function() {
return $__0.exit();
}));
$(document).bind('MSFullscreenChange', (function() {
return $__0.exit();
}));
$(document).bind('mozfullscreenchange', (function() {
return $__0.exit();
}));
};
var $Core = Core;
($traceurRuntime.createClass)(Core, {
get events() {
return {
'webkitfullscreenchange': 'exit',
'mousemove': 'showMediaControl',
'mouseleave': 'hideMediaControl'
};
},
get attributes() {
return {'data-player': ''};
},
createContainers: function(options) {
var $__0 = this;
this.defer = $.Deferred();
this.defer.promise(this);
this.containerFactory = new ContainerFactory(options, options.loader);
this.containerFactory.createContainers().then((function(containers) {
return $__0.setupContainers(containers);
})).then((function(containers) {
return $__0.resolveOnContainersReady(containers);
}));
},
updateSize: function() {
if (Fullscreen.isFullscreen()) {
this.setFullscreen();
} else {
this.setPlayerSize();
}
Mediator.trigger(Events.PLAYER_RESIZE);
},
setFullscreen: function() {
this.$el.addClass('fullscreen');
this.$el.removeAttr('style');
PlayerInfo.previousSize = PlayerInfo.currentSize;
PlayerInfo.currentSize = {
width: $(window).width(),
height: $(window).height()
};
},
setPlayerSize: function() {
this.$el.removeClass('fullscreen');
PlayerInfo.currentSize = PlayerInfo.previousSize;
PlayerInfo.previousSize = {
width: $(window).width(),
height: $(window).height()
};
this.resize(PlayerInfo.currentSize);
},
resize: function(options) {
var size = _.pick(options, 'width', 'height');
this.el.style.height = (size.height + "px");
this.el.style.width = (size.width + "px");
PlayerInfo.previousSize = PlayerInfo.currentSize;
PlayerInfo.currentSize = size;
Mediator.trigger(Events.PLAYER_RESIZE);
},
resolveOnContainersReady: function(containers) {
var $__0 = this;
$.when.apply($, containers).done((function() {
return $__0.defer.resolve($__0);
}));
},
addPlugin: function(plugin) {
this.plugins.push(plugin);
},
hasPlugin: function(name) {
return !!this.getPlugin(name);
},
getPlugin: function(name) {
return _(this.plugins).find((function(plugin) {
return plugin.name === name;
}));
},
load: function(sources) {
var $__0 = this;
sources = _.isArray(sources) ? sources : [sources.toString()];
_(this.containers).each((function(container) {
return container.destroy();
}));
this.containerFactory.options = _(this.options).extend({sources: sources});
this.containerFactory.createContainers().then((function(containers) {
$__0.setupContainers(containers);
}));
},
destroy: function() {
_(this.containers).each((function(container) {
return container.destroy();
}));
_(this.plugins).each((function(plugin) {
return plugin.destroy();
}));
this.$el.remove();
this.mediaControl.destroy();
$(document).unbind('fullscreenchange');
$(document).unbind('MSFullscreenChange');
$(document).unbind('mozfullscreenchange');
},
exit: function() {
this.updateSize();
this.mediaControl.show();
},
setMediaControlContainer: function(container) {
this.mediaControl.setContainer(container);
this.mediaControl.render();
},
disableMediaControl: function() {
this.mediaControl.disable();
this.$el.removeClass('nocursor');
},
enableMediaControl: function() {
this.mediaControl.enable();
},
removeContainer: function(container) {
this.stopListening(container);
this.containers = _.without(this.containers, container);
},
appendContainer: function(container) {
this.listenTo(container, Events.CONTAINER_DESTROYED, this.removeContainer);
this.el.appendChild(container.render().el);
this.containers.push(container);
},
setupContainers: function(containers) {
_.map(containers, this.appendContainer, this);
this.setupMediaControl(this.getCurrentContainer());
this.render();
this.$el.appendTo(this.options.parentElement);
return containers;
},
createContainer: function(source) {
var container = this.containerFactory.createContainer(source);
this.appendContainer(container);
return container;
},
setupMediaControl: function(container) {
if (this.mediaControl) {
this.mediaControl.setContainer(container);
} else {
this.mediaControl = this.createMediaControl(_.extend({container: container}, this.options));
this.listenTo(this.mediaControl, Events.MEDIACONTROL_FULLSCREEN, this.toggleFullscreen);
this.listenTo(this.mediaControl, Events.MEDIACONTROL_SHOW, this.onMediaControlShow.bind(this, true));
this.listenTo(this.mediaControl, Events.MEDIACONTROL_HIDE, this.onMediaControlShow.bind(this, false));
}
},
createMediaControl: function(options) {
if (options.mediacontrol && options.mediacontrol.external) {
return new options.mediacontrol.external(options);
} else {
return new MediaControl(options);
}
},
getCurrentContainer: function() {
return this.containers[0];
},
toggleFullscreen: function() {
if (!Fullscreen.isFullscreen()) {
Fullscreen.requestFullscreen(this.el);
this.$el.addClass('fullscreen');
} else {
Fullscreen.cancelFullscreen();
this.$el.removeClass('fullscreen nocursor');
}
this.mediaControl.show();
},
showMediaControl: function(event) {
this.mediaControl.show(event);
},
hideMediaControl: function(event) {
this.mediaControl.hide(event);
},
onMediaControlShow: function(showing) {
if (showing)
this.$el.removeClass('nocursor');
else if (Fullscreen.isFullscreen())
this.$el.addClass('nocursor');
},
render: function() {
var style = Styler.getStyleFor('core');
this.$el.append(style);
this.$el.append(this.mediaControl.render().el);
this.options.width = this.options.width || this.$el.width();
this.options.height = this.options.height || this.$el.height();
PlayerInfo.previousSize = PlayerInfo.currentSize = _.pick(this.options, 'width', 'height');
this.updateSize();
return this;
}
}, {}, UIObject);
module.exports = Core;
},{"../../base/styler":8,"../../base/utils":9,"../container_factory":12,"events":"events","media_control":"media_control","mediator":"mediator","player_info":"player_info","ui_object":"ui_object","underscore":"underscore","zepto":"zepto"}],14:[function(require,module,exports){
"use strict";
var _ = require('underscore');
var BaseObject = require('base_object');
var Core = require('core');
var CoreFactory = function CoreFactory(player, loader) {
this.player = player;
this.options = player.options;
this.loader = loader;
this.options.loader = this.loader;
};
($traceurRuntime.createClass)(CoreFactory, {
create: function() {
this.core = new Core(this.options);
this.core.then(this.addCorePlugins.bind(this));
return this.core;
},
addCorePlugins: function() {
_.each(this.loader.corePlugins, function(Plugin) {
var plugin = new Plugin(this.core);
this.core.addPlugin(plugin);
this.setupExternalInterface(plugin);
}, this);
return this.core;
},
setupExternalInterface: function(plugin) {
_.each(plugin.getExternalInterface(), function(value, key) {
this.player[key] = value.bind(plugin);
}, this);
}
}, {}, BaseObject);
module.exports = CoreFactory;
},{"base_object":"base_object","core":"core","underscore":"underscore"}],15:[function(require,module,exports){
"use strict";
module.exports = require('./core_factory');
},{"./core_factory":14}],16:[function(require,module,exports){
"use strict";
var BaseObject = require('base_object');
var $ = require('zepto');
var Player = require('../player');
var IframePlayer = function IframePlayer(options) {
$traceurRuntime.superCall(this, $IframePlayer.prototype, "constructor", [options]);
this.options = options;
this.createIframe();
};
var $IframePlayer = IframePlayer;
($traceurRuntime.createClass)(IframePlayer, {
createIframe: function() {
this.iframe = document.createElement("iframe");
this.iframe.setAttribute("frameborder", 0);
this.iframe.setAttribute("id", this.uniqueId);
this.iframe.setAttribute("allowfullscreen", true);
this.iframe.setAttribute("scrolling", "no");
this.iframe.setAttribute("src", "http://cdn.clappr.io/latest/assets/iframe.htm" + this.buildQueryString());
this.iframe.setAttribute('width', this.options.width);
this.iframe.setAttribute('height', this.options.height);
},
attachTo: function(element) {
element.appendChild(this.iframe);
},
addEventListeners: function() {
var $__0 = this;
this.iframe.contentWindow.addEventListener("fullscreenchange", (function() {
return $__0.updateSize();
}));
this.iframe.contentWindow.addEventListener("webkitfullscreenchange", (function() {
return $__0.updateSize();
}));
this.iframe.contentWindow.addEventListener("mozfullscreenchange", (function() {
return $__0.updateSize();
}));
},
buildQueryString: function() {
var result = "";
for (var param in this.options) {
result += !!result ? "&" : "?";
result += encodeURIComponent(param) + "=" + encodeURIComponent(this.options[param]);
}
return result;
}
}, {}, BaseObject);
module.exports = IframePlayer;
},{"../player":21,"base_object":"base_object","zepto":"zepto"}],17:[function(require,module,exports){
"use strict";
module.exports = require('./iframe_player');
},{"./iframe_player":16}],18:[function(require,module,exports){
"use strict";
module.exports = require('./loader');
},{"./loader":19}],19:[function(require,module,exports){
"use strict";
var BaseObject = require('base_object');
var _ = require('underscore');
var PlayerInfo = require('player_info');
var HTML5VideoPlayback = require('html5_video');
var FlashVideoPlayback = require('flash');
var HTML5AudioPlayback = require('html5_audio');
var HLSVideoPlayback = require('hls');
var HTMLImgPlayback = require('html_img');
var NoOp = require('../../playbacks/no_op');
var SpinnerThreeBouncePlugin = require('../../plugins/spinner_three_bounce');
var StatsPlugin = require('../../plugins/stats');
var WaterMarkPlugin = require('../../plugins/watermark');
var PosterPlugin = require('poster');
var GoogleAnalyticsPlugin = require('../../plugins/google_analytics');
var ClickToPausePlugin = require('../../plugins/click_to_pause');
var BackgroundButton = require('../../plugins/background_button');
var DVRControls = require('../../plugins/dvr_controls');
var Loader = function Loader(externalPlugins) {
$traceurRuntime.superCall(this, $Loader.prototype, "constructor", []);
this.playbackPlugins = [HTML5VideoPlayback, FlashVideoPlayback, HTML5AudioPlayback, HLSVideoPlayback, HTMLImgPlayback, NoOp];
this.containerPlugins = [SpinnerThreeBouncePlugin, WaterMarkPlugin, PosterPlugin, StatsPlugin, GoogleAnalyticsPlugin, ClickToPausePlugin];
this.corePlugins = [BackgroundButton, DVRControls];
if (externalPlugins) {
this.addExternalPlugins(externalPlugins);
}
};
var $Loader = Loader;
($traceurRuntime.createClass)(Loader, {
addExternalPlugins: function(plugins) {
var pluginName = function(plugin) {
return plugin.prototype.name;
};
if (plugins.playback) {
this.playbackPlugins = _.uniq(plugins.playback.concat(this.playbackPlugins), pluginName);
}
if (plugins.container) {
this.containerPlugins = _.uniq(plugins.container.concat(this.containerPlugins), pluginName);
}
if (plugins.core) {
this.corePlugins = _.uniq(plugins.core.concat(this.corePlugins), pluginName);
}
PlayerInfo.playbackPlugins = this.playbackPlugins;
},
getPlugin: function(name) {
var allPlugins = _.union(this.containerPlugins, this.playbackPlugins, this.corePlugins);
return _.find(allPlugins, function(plugin) {
return plugin.prototype.name === name;
});
}
}, {}, BaseObject);
module.exports = Loader;
},{"../../playbacks/no_op":29,"../../plugins/background_button":32,"../../plugins/click_to_pause":34,"../../plugins/dvr_controls":36,"../../plugins/google_analytics":38,"../../plugins/spinner_three_bounce":42,"../../plugins/stats":44,"../../plugins/watermark":46,"base_object":"base_object","flash":"flash","hls":"hls","html5_audio":"html5_audio","html5_video":"html5_video","html_img":"html_img","player_info":"player_info","poster":"poster","underscore":"underscore"}],20:[function(require,module,exports){
"use strict";
var _ = require('underscore');
var $ = require('zepto');
var JST = require('../../base/jst');
var Styler = require('../../base/styler');
var UIObject = require('ui_object');
var Utils = require('../../base/utils');
var SeekTime = require('../seek_time');
var Mediator = require('mediator');
var PlayerInfo = require('player_info');
var Events = require('events');
require('mousetrap');
var MediaControl = function MediaControl(options) {
var $__0 = this;
$traceurRuntime.superCall(this, $MediaControl.prototype, "constructor", [options]);
this.seekTime = new SeekTime(this);
this.options = options;
this.mute = this.options.mute;
this.persistConfig = this.options.persistConfig;
this.container = options.container;
var initialVolume = (this.persistConfig) ? Utils.Config.restore("volume") : 100;
this.setVolume(this.mute ? 0 : initialVolume);
this.keepVisible = false;
this.addEventListeners();
this.settings = {
left: ['play', 'stop', 'pause'],
right: ['volume'],
default: ['position', 'seekbar', 'duration']
};
this.settings = _.isEmpty(this.container.settings) ? this.settings : this.container.settings;
this.disabled = false;
if (this.container.mediaControlDisabled || this.options.chromeless) {
this.disable();
}
$(document).bind('mouseup', (function(event) {
return $__0.stopDrag(event);
}));
$(document).bind('mousemove', (function(event) {
return $__0.updateDrag(event);
}));
Mediator.on(Events.PLAYER_RESIZE, (function() {
return $__0.playerResize();
}));
};
var $MediaControl = MediaControl;
($traceurRuntime.createClass)(MediaControl, {
get name() {
return 'MediaControl';
},
get attributes() {
return {
class: 'media-control',
'data-media-control': ''
};
},
get events() {
return {
'click [data-play]': 'play',
'click [data-pause]': 'pause',
'click [data-playpause]': 'togglePlayPause',
'click [data-stop]': 'stop',
'click [data-playstop]': 'togglePlayStop',
'click [data-fullscreen]': 'toggleFullscreen',
'click .bar-container[data-seekbar]': 'seek',
'click .bar-container[data-volume]': 'volume',
'click .drawer-icon[data-volume]': 'toggleMute',
'mouseenter .drawer-container[data-volume]': 'showVolumeBar',
'mouseleave .drawer-container[data-volume]': 'hideVolumeBar',
'mousedown .bar-scrubber[data-volume]': 'startVolumeDrag',
'mousedown .bar-scrubber[data-seekbar]': 'startSeekDrag',
'mousemove .bar-container[data-seekbar]': 'mousemoveOnSeekBar',
'mouseleave .bar-container[data-seekbar]': 'mouseleaveOnSeekBar',
'mouseenter .media-control-layer[data-controls]': 'setKeepVisible',
'mouseleave .media-control-layer[data-controls]': 'resetKeepVisible'
};
},
get template() {
return JST.media_control;
},
addEventListeners: function() {
this.listenTo(this.container, Events.CONTAINER_PLAY, this.changeTogglePlay);
this.listenTo(this.container, Events.CONTAINER_TIMEUPDATE, this.updateSeekBar);
this.listenTo(this.container, Events.CONTAINER_PROGRESS, this.updateProgressBar);
this.listenTo(this.container, Events.CONTAINER_SETTINGSUPDATE, this.settingsUpdate);
this.listenTo(this.container, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.settingsUpdate);
this.listenTo(this.container, Events.CONTAINER_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate);
this.listenTo(this.container, Events.CONTAINER_MEDIACONTROL_DISABLE, this.disable);
this.listenTo(this.container, Events.CONTAINER_MEDIACONTROL_ENABLE, this.enable);
this.listenTo(this.container, Events.CONTAINER_ENDED, this.ended);
},
disable: function() {
this.disabled = true;
this.hide();
this.$el.hide();
},
enable: function() {
if (this.options.chromeless)
return;
this.disabled = false;
this.show();
},
play: function() {
this.container.play();
},
pause: function() {
this.container.pause();
},
stop: function() {
this.container.stop();
},
changeTogglePlay: function() {
if (this.container.isPlaying()) {
this.$playPauseToggle.removeClass('paused').addClass('playing');
this.$playStopToggle.removeClass('stopped').addClass('playing');
this.trigger(Events.MEDIACONTROL_PLAYING);
} else {
this.$playPauseToggle.removeClass('playing').addClass('paused');
this.$playStopToggle.removeClass('playing').addClass('stopped');
this.trigger(Events.MEDIACONTROL_NOTPLAYING);
}
},
mousemoveOnSeekBar: function(event) {
if (this.container.settings.seekEnabled) {
var offsetX = event.pageX - this.$seekBarContainer.offset().left - (this.$seekBarHover.width() / 2);
this.$seekBarHover.css({left: offsetX});
}
this.trigger(Events.MEDIACONTROL_MOUSEMOVE_SEEKBAR, event);
},
mouseleaveOnSeekBar: function(event) {
this.trigger(Events.MEDIACONTROL_MOUSELEAVE_SEEKBAR, event);
},
playerResize: function() {
if (Utils.Fullscreen.isFullscreen()) {
this.$fullscreenToggle.addClass('shrink');
} else {
this.$fullscreenToggle.removeClass('shrink');
}
this.$el.removeClass('w320');
if (PlayerInfo.currentSize.width <= 320) {
this.$el.addClass('w320');
}
},
togglePlayPause: function() {
if (this.container.isPlaying()) {
this.container.pause();
} else {
this.container.play();
}
this.changeTogglePlay();
},
togglePlayStop: function() {
if (this.container.isPlaying()) {
this.container.stop();
} else {
this.container.play();
}
this.changeTogglePlay();
},
startSeekDrag: function(event) {
if (!this.container.settings.seekEnabled)
return;
this.draggingSeekBar = true;
this.$el.addClass('dragging');
this.$seekBarLoaded.addClass('media-control-notransition');
this.$seekBarPosition.addClass('media-control-notransition');
this.$seekBarScrubber.addClass('media-control-notransition');
if (event) {
event.preventDefault();
}
},
startVolumeDrag: function(event) {
this.draggingVolumeBar = true;
this.$el.addClass('dragging');
if (event) {
event.preventDefault();
}
},
stopDrag: function(event) {
if (this.draggingSeekBar) {
this.seek(event);
}
this.$el.removeClass('dragging');
this.$seekBarLoaded.removeClass('media-control-notransition');
this.$seekBarPosition.removeClass('media-control-notransition');
this.$seekBarScrubber.removeClass('media-control-notransition dragging');
this.draggingSeekBar = false;
this.draggingVolumeBar = false;
},
updateDrag: function(event) {
if (event) {
event.preventDefault();
}
if (this.draggingSeekBar) {
var offsetX = event.pageX - this.$seekBarContainer.offset().left;
var pos = offsetX / this.$seekBarContainer.width() * 100;
pos = Math.min(100, Math.max(pos, 0));
this.setSeekPercentage(pos);
} else if (this.draggingVolumeBar) {
this.volume(event);
}
},
volume: function(event) {
var offsetY = event.pageX - this.$volumeBarContainer.offset().left;
var volumeFromUI = (offsetY / this.$volumeBarContainer.width()) * 100;
this.setVolume(volumeFromUI);
},
toggleMute: function() {
if (this.mute) {
if (this.currentVolume <= 0) {
this.currentVolume = 100;
}
this.setVolume(this.currentVolume);
} else {
this.setVolume(0);
}
},
setVolume: function(value) {
this.currentVolume = Math.min(100, Math.max(value, 0));
this.container.setVolume(this.currentVolume);
this.setVolumeLevel(this.currentVolume);
this.mute = this.currentVolume === 0;
this.persistConfig && Utils.Config.persist("volume", this.currentVolume);
},
toggleFullscreen: function() {
this.trigger(Events.MEDIACONTROL_FULLSCREEN, this.name);
this.container.fullscreen();
this.resetKeepVisible();
},
setContainer: function(container) {
this.stopListening(this.container);
this.container = container;
this.changeTogglePlay();
this.addEventListeners();
this.settingsUpdate();
this.container.trigger(Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.container.isDvrInUse());
this.setVolume(this.currentVolume);
if (this.container.mediaControlDisabled) {
this.disable();
}
this.trigger(Events.MEDIACONTROL_CONTAINERCHANGED);
},
showVolumeBar: function() {
if (this.hideVolumeId) {
clearTimeout(this.hideVolumeId);
}
this.$volumeBarContainer.removeClass('volume-bar-hide');
},
hideVolumeBar: function() {
var $__0 = this;
var timeout = 400;
if (!this.$volumeBarContainer)
return;
if (this.draggingVolumeBar) {
this.hideVolumeId = setTimeout((function() {
return $__0.hideVolumeBar();
}), timeout);
} else {
if (this.hideVolumeId) {
clearTimeout(this.hideVolumeId);
}
this.hideVolumeId = setTimeout((function() {
return $__0.$volumeBarContainer.addClass('volume-bar-hide');
}), timeout);
}
},
ended: function() {
this.changeTogglePlay();
},
updateProgressBar: function(startPosition, endPosition, duration) {
var loadedStart = startPosition / duration * 100;
var loadedEnd = endPosition / duration * 100;
this.$seekBarLoaded.css({
left: loadedStart + '%',
width: (loadedEnd - loadedStart) + '%'
});
},
updateSeekBar: function(position, duration) {
if (this.draggingSeekBar)
return;
if (position < 0)
position = duration;
this.$seekBarPosition.removeClass('media-control-notransition');
this.$seekBarScrubber.removeClass('media-control-notransition');
var seekbarValue = (100 / duration) * position;
this.setSeekPercentage(seekbarValue);
this.$('[data-position]').html(Utils.formatTime(position));
this.$('[data-duration]').html(Utils.formatTime(duration));
},
seek: function(event) {
if (!this.container.settings.seekEnabled)
return;
var offsetX = event.pageX - this.$seekBarContainer.offset().left;
var pos = offsetX / this.$seekBarContainer.width() * 100;
pos = Math.min(100, Math.max(pos, 0));
this.container.setCurrentTime(pos);
this.setSeekPercentage(pos);
return false;
},
setKeepVisible: function() {
this.keepVisible = true;
},
resetKeepVisible: function() {
this.keepVisible = false;
},
isVisible: function() {
return !this.$el.hasClass('media-control-hide');
},
show: function(event) {
var $__0 = this;
if (this.disabled || this.container.getPlaybackType() === null)
return;
var timeout = 2000;
if (!event || (event.clientX !== this.lastMouseX && event.clientY !== this.lastMouseY) || navigator.userAgent.match(/firefox/i)) {
clearTimeout(this.hideId);
this.$el.show();
this.trigger(Events.MEDIACONTROL_SHOW, this.name);
this.$el.removeClass('media-control-hide');
this.hideId = setTimeout((function() {
return $__0.hide();
}), timeout);
if (event) {
this.lastMouseX = event.clientX;
this.lastMouseY = event.clientY;
}
}
},
hide: function() {
var $__0 = this;
var timeout = 2000;
clearTimeout(this.hideId);
if (!this.isVisible() || this.options.hideMediaControl === false)
return;
if (this.keepVisible || this.draggingSeekBar || this.draggingVolumeBar) {
this.hideId = setTimeout((function() {
return $__0.hide();
}), timeout);
} else {
this.trigger(Events.MEDIACONTROL_HIDE, this.name);
this.$el.addClass('media-control-hide');
this.hideVolumeBar();
}
},
settingsUpdate: function() {
if (this.container.getPlaybackType() !== null && !_.isEmpty(this.container.settings)) {
this.settings = this.container.settings;
this.render();
this.enable();
} else {
this.disable();
}
},
highDefinitionUpdate: function() {
if (this.container.isHighDefinitionInUse()) {
this.$el.find('button[data-hd-indicator]').addClass("enabled");
} else {
this.$el.find('button[data-hd-indicator]').removeClass("enabled");
}
},
createCachedElements: function() {
this.$playPauseToggle = this.$el.find('button.media-control-button[data-playpause]');
this.$playStopToggle = this.$el.find('button.media-control-button[data-playstop]');
this.$fullscreenToggle = this.$el.find('button.media-control-button[data-fullscreen]');
this.$seekBarContainer = this.$el.find('.bar-container[data-seekbar]');
this.$seekBarLoaded = this.$el.find('.bar-fill-1[data-seekbar]');
this.$seekBarPosition = this.$el.find('.bar-fill-2[data-seekbar]');
this.$seekBarScrubber = this.$el.find('.bar-scrubber[data-seekbar]');
this.$seekBarHover = this.$el.find('.bar-hover[data-seekbar]');
this.$volumeBarContainer = this.$el.find('.bar-container[data-volume]');
this.$volumeIcon = this.$el.find('.drawer-icon[data-volume]');
},
setVolumeLevel: function(value) {
var $__0 = this;
if (!this.container.isReady || !this.$volumeBarContainer) {
this.listenToOnce(this.container, Events.CONTAINER_READY, (function() {
return $__0.setVolumeLevel(value);
}));
} else {
this.$volumeBarContainer.find('.segmented-bar-element').removeClass('fill');
var item = Math.ceil(value / 10.0);
this.$volumeBarContainer.find('.segmented-bar-element').slice(0, item).addClass('fill');
if (value > 0) {
this.$volumeIcon.removeClass('muted');
} else {
this.$volumeIcon.addClass('muted');
}
}
},
setSeekPercentage: function(value) {
if (value > 100)
return;
var pos = this.$seekBarContainer.width() * value / 100.0 - (this.$seekBarScrubber.width() / 2.0);
this.currentSeekPercentage = value;
this.$seekBarPosition.css({width: value + '%'});
this.$seekBarScrubber.css({left: pos});
},
bindKeyEvents: function() {
var $__0 = this;
Mousetrap.bind(['space'], (function() {
return $__0.togglePlayPause();
}));
},
unbindKeyEvents: function() {
Mousetrap.unbind('space');
},
parseColors: function() {
if (this.options.mediacontrol) {
var buttonsColor = this.options.mediacontrol.buttons;
var seekbarColor = this.options.mediacontrol.seekbar;
this.$el.find('.bar-fill-2[data-seekbar]').css('background-color', seekbarColor);
this.$el.find('[data-media-control] > .media-control-icon, .drawer-icon').css('color', buttonsColor);
this.$el.find('.segmented-bar-element[data-volume]').css('boxShadow', "inset 2px 0 0 " + buttonsColor);
}
},
render: function() {
var $__0 = this;
var timeout = 1000;
var style = Styler.getStyleFor('media_control');
this.$el.html(this.template({settings: this.settings}));
this.$el.append(style);
this.createCachedElements();
this.$playPauseToggle.addClass('paused');
this.$playStopToggle.addClass('stopped');
this.changeTogglePlay();
this.hideId = setTimeout((function() {
return $__0.hide();
}), timeout);
if (this.disabled) {
this.hide();
}
this.$seekBarPosition.addClass('media-control-notransition');
this.$seekBarScrubber.addClass('media-control-notransition');
if (!this.currentSeekPercentage) {
this.currentSeekPercentage = 0;
}
this.setSeekPercentage(this.currentSeekPercentage);
this.$el.ready((function() {
if (!$__0.container.settings.seekEnabled) {
$__0.$seekBarContainer.addClass('seek-disabled');
}
$__0.setVolume($__0.currentVolume);
$__0.bindKeyEvents();
$__0.hideVolumeBar();
}));
this.parseColors();
this.seekTime.render();
this.trigger(Events.MEDIACONTROL_RENDERED);
return this;
},
destroy: function() {
$(document).unbind('mouseup');
$(document).unbind('mousemove');
this.unbindKeyEvents();
}
}, {}, UIObject);
module.exports = MediaControl;
},{"../../base/jst":7,"../../base/styler":8,"../../base/utils":9,"../seek_time":22,"events":"events","mediator":"mediator","mousetrap":4,"player_info":"player_info","ui_object":"ui_object","underscore":"underscore","zepto":"zepto"}],21:[function(require,module,exports){
"use strict";
var BaseObject = require('base_object');
var CoreFactory = require('./core_factory');
var Loader = require('./loader');
var _ = require('underscore');
var ScrollMonitor = require('scrollmonitor');
var PlayerInfo = require('player_info');
var Player = function Player(options) {
$traceurRuntime.superCall(this, $Player.prototype, "constructor", [options]);
window.p = this;
var defaultOptions = {
persistConfig: true,
width: 640,
height: 360
};
this.options = _.extend(defaultOptions, options);
this.options.sources = this.normalizeSources(options);
this.loader = new Loader(this.options.plugins || {});
this.coreFactory = new CoreFactory(this, this.loader);
PlayerInfo.currentSize = {
width: options.width,
height: options.height
};
if (this.options.parentId) {
this.setParentId(this.options.parentId);
}
};
var $Player = Player;
($traceurRuntime.createClass)(Player, {
setParentId: function(parentId) {
var el = document.querySelector(parentId);
if (el) {
this.attachTo(el);
}
},
attachTo: function(element) {
this.options.parentElement = element;
this.core = this.coreFactory.create();
if (this.options.autoPlayVisible) {
this.bindAutoPlayVisible(this.options.autoPlayVisible);
}
},
bindAutoPlayVisible: function(option) {
var $__0 = this;
this.elementWatcher = ScrollMonitor.create(this.core.$el);
if (option === 'full') {
this.elementWatcher.fullyEnterViewport((function() {
return $__0.enterViewport();
}));
} else if (option === 'partial') {
this.elementWatcher.enterViewport((function() {
return $__0.enterViewport();
}));
}
},
enterViewport: function() {
if (this.elementWatcher.top !== 0 && !this.isPlaying()) {
this.play();
}
},
normalizeSources: function(options) {
var sources = _.compact(_.flatten([options.source, options.sources]));
return _.isEmpty(sources) ? ['no.op'] : sources;
},
resize: function(size) {
this.core.resize(size);
},
load: function(sources) {
this.core.load(sources);
},
destroy: function() {
this.core.destroy();
},
play: function() {
this.core.mediaControl.container.play();
},
pause: function() {
this.core.mediaControl.container.pause();
},
stop: function() {
this.core.mediaControl.container.stop();
},
seek: function(time) {
this.core.mediaControl.container.setCurrentTime(time);
},
setVolume: function(volume) {
this.core.mediaControl.container.setVolume(volume);
},
mute: function() {
this.core.mediaControl.container.setVolume(0);
},
unmute: function() {
this.core.mediaControl.container.setVolume(100);
},
isPlaying: function() {
return this.core.mediaControl.container.isPlaying();
}
}, {}, BaseObject);
module.exports = Player;
},{"./core_factory":15,"./loader":18,"base_object":"base_object","player_info":"player_info","scrollmonitor":5,"underscore":"underscore"}],22:[function(require,module,exports){
"use strict";
module.exports = require('./seek_time');
},{"./seek_time":23}],23:[function(require,module,exports){
"use strict";
var UIObject = require('ui_object');
var Styler = require('../../base/styler');
var JST = require('../../base/jst');
var formatTime = require('../../base/utils').formatTime;
var Events = require('events');
var SeekTime = function SeekTime(mediaControl) {
$traceurRuntime.superCall(this, $SeekTime.prototype, "constructor", []);
this.mediaControl = mediaControl;
this.addEventListeners();
};
var $SeekTime = SeekTime;
($traceurRuntime.createClass)(SeekTime, {
get name() {
return 'seek_time';
},
get template() {
return JST.seek_time;
},
get attributes() {
return {
'class': 'seek-time hidden',
'data-seek-time': ''
};
},
addEventListeners: function() {
this.listenTo(this.mediaControl, Events.MEDIACONTROL_MOUSEMOVE_SEEKBAR, this.showTime);
this.listenTo(this.mediaControl, Events.MEDIACONTROL_MOUSELEAVE_SEEKBAR, this.hideTime);
},
showTime: function(event) {
var offset = event.pageX - this.mediaControl.$seekBarContainer.offset().left;
var timePosition = Math.min(100, Math.max((offset) / this.mediaControl.$seekBarContainer.width() * 100, 0));
var pointerPosition = event.pageX - this.mediaControl.$el.offset().left - (this.$el.width() / 2);
pointerPosition = Math.min(Math.max(0, pointerPosition), this.mediaControl.$el.width() - this.$el.width());
var currentTime = timePosition * this.mediaControl.container.getDuration() / 100;
var options = {
timestamp: currentTime,
formattedTime: formatTime(currentTime),
pointerPosition: pointerPosition
};
this.update(options);
},
hideTime: function() {
this.$el.addClass('hidden');
this.$el.css('left', '-100%');
},
update: function(options) {
if (this.mediaControl.container.getPlaybackType() === 'vod' || this.mediaControl.container.isDvrInUse()) {
this.$el.find('[data-seek-time]').text(options.formattedTime);
this.$el.css('left', options.pointerPosition);
this.$el.removeClass('hidden');
}
},
render: function() {
var style = Styler.getStyleFor(this.name);
this.$el.html(this.template());
this.$el.append(style);
this.mediaControl.$el.append(this.el);
}
}, {}, UIObject);
module.exports = SeekTime;
},{"../../base/jst":7,"../../base/styler":8,"../../base/utils":9,"events":"events","ui_object":"ui_object"}],24:[function(require,module,exports){
"use strict";
var Playback = require('playback');
var Styler = require('../../base/styler');
var JST = require('../../base/jst');
var Mediator = require('mediator');
var _ = require('underscore');
var $ = require('zepto');
var Browser = require('browser');
var seekStringToSeconds = require('../../base/utils').seekStringToSeconds;
var Events = require('events');
require('mousetrap');
var objectIE = '<object type="application/x-shockwave-flash" id="<%= cid %>" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" data-flash-vod=""><param name="movie" value="<%= swfPath %>"> <param name="quality" value="autohigh"> <param name="swliveconnect" value="true"> <param name="allowScriptAccess" value="always"> <param name="bgcolor" value="#001122"> <param name="allowFullScreen" value="false"> <param name="wmode" value="gpu"> <param name="tabindex" value="1"> <param name=FlashVars value="playbackId=<%= playbackId %>" /> </object>';
var Flash = function Flash(options) {
$traceurRuntime.superCall(this, $Flash.prototype, "constructor", [options]);
this.src = options.src;
this.defaultBaseSwfPath = "http://cdn.clappr.io/" + Clappr.version + "/assets/";
this.swfPath = (options.swfBasePath || this.defaultBaseSwfPath) + "Player.swf";
this.autoPlay = options.autoPlay;
this.settings = {default: ['seekbar']};
this.settings.left = ["playpause", "position", "duration"];
this.settings.right = ["fullscreen", "volume"];
this.settings.seekEnabled = true;
this.isReady = false;
this.addListeners();
};
var $Flash = Flash;
($traceurRuntime.createClass)(Flash, {
get name() {
return 'flash';
},
get tagName() {
return 'object';
},
get template() {
return JST.flash;
},
bootstrap: function() {
this.el.width = "100%";
this.el.height = "100%";
this.isReady = true;
if (this.currentState === 'PLAYING') {
this.firstPlay();
} else {
this.currentState = "IDLE";
this.autoPlay && this.play();
}
$('<div style="position: absolute; top: 0; left: 0; width: 100%; height: 100%" />').insertAfter(this.$el);
this.trigger(Events.PLAYBACK_READY, this.name);
},
getPlaybackType: function() {
return 'vod';
},
setupFirefox: function() {
var $el = this.$('embed');
$el.attr('data-flash', '');
this.setElement($el[0]);
},
isHighDefinitionInUse: function() {
return false;
},
updateTime: function() {
this.trigger(Events.PLAYBACK_TIMEUPDATE, this.el.getPosition(), this.el.getDuration(), this.name);
},
addListeners: function() {
Mediator.on(this.uniqueId + ':progress', this.progress, this);
Mediator.on(this.uniqueId + ':timeupdate', this.updateTime, this);
Mediator.on(this.uniqueId + ':statechanged', this.checkState, this);
Mediator.on(this.uniqueId + ':flashready', this.bootstrap, this);
_.each(_.range(1, 10), function(i) {
var $__0 = this;
Mousetrap.bind([i.toString()], (function() {
return $__0.seek(i * 10);
}));
}.bind(this));
},
stopListening: function() {
$traceurRuntime.superCall(this, $Flash.prototype, "stopListening", []);
Mediator.off(this.uniqueId + ':progress');
Mediator.off(this.uniqueId + ':timeupdate');
Mediator.off(this.uniqueId + ':statechanged');
Mediator.off(this.uniqueId + ':flashready');
_.each(_.range(1, 10), function(i) {
var $__0 = this;
Mousetrap.unbind([i.toString()], (function() {
return $__0.seek(i * 10);
}));
}.bind(this));
},
checkState: function() {
if (this.currentState === "PAUSED") {
return;
} else if (this.currentState !== "PLAYING_BUFFERING" && this.el.getState() === "PLAYING_BUFFERING") {
this.trigger(Events.PLAYBACK_BUFFERING, this.name);
this.currentState = "PLAYING_BUFFERING";
} else if (this.el.getState() === "PLAYING") {
this.trigger(Events.PLAYBACK_BUFFERFULL, this.name);
this.currentState = "PLAYING";
} else if (this.el.getState() === "IDLE") {
this.currentState = "IDLE";
} else if (this.el.getState() === "ENDED") {
this.trigger(Events.PLAYBACK_ENDED, this.name);
this.trigger(Events.PLAYBACK_TIMEUPDATE, 0, this.el.getDuration(), this.name);
this.currentState = "ENDED";
}
},
progress: function() {
if (this.currentState !== "IDLE" && this.currentState !== "ENDED") {
this.trigger(Events.PLAYBACK_PROGRESS, 0, this.el.getBytesLoaded(), this.el.getBytesTotal(), this.name);
}
},
firstPlay: function() {
var $__0 = this;
if (this.el.playerPlay) {
this.el.playerPlay(this.src);
this.listenToOnce(this, Events.PLAYBACK_BUFFERFULL, (function() {
return $__0.checkInitialSeek();
}));
this.currentState = "PLAYING";
} else {
this.listenToOnce(this, Events.PLAYBACK_READY, this.firstPlay);
}
},
checkInitialSeek: function() {
var seekTime = seekStringToSeconds(window.location.href);
if (seekTime !== 0) {
this.seekSeconds(seekTime);
}
},
play: function() {
if (this.el.getState() === 'PAUSED' || this.el.getState() === 'PLAYING_BUFFERING') {
this.currentState = "PLAYING";
this.el.playerResume();
} else if (this.el.getState() !== 'PLAYING') {
this.firstPlay();
}
this.trigger(Events.PLAYBACK_PLAY, this.name);
},
volume: function(value) {
var $__0 = this;
if (this.isReady) {
this.el.playerVolume(value);
} else {
this.listenToOnce(this, Events.PLAYBACK_BUFFERFULL, (function() {
return $__0.volume(value);
}));
}
},
pause: function() {
this.currentState = "PAUSED";
this.el.playerPause();
},
stop: function() {
this.el.playerStop();
this.trigger(Events.PLAYBACK_TIMEUPDATE, 0, this.name);
},
isPlaying: function() {
return !!(this.isReady && this.currentState.indexOf("PLAYING") > -1);
},
getDuration: function() {
return this.el.getDuration();
},
seek: function(seekBarValue) {
var seekTo = this.el.getDuration() * (seekBarValue / 100);
this.seekSeconds(seekTo);
},
seekSeconds: function(seekTo) {
this.el.playerSeek(seekTo);
this.trigger(Events.PLAYBACK_TIMEUPDATE, seekTo, this.el.getDuration(), this.name);
if (this.currentState === "PAUSED") {
this.el.playerPause();
}
},
destroy: function() {
clearInterval(this.bootstrapId);
this.stopListening();
this.$el.remove();
},
setupIE: function() {
this.setElement($(_.template(objectIE)({
cid: this.cid,
swfPath: this.swfPath,
playbackId: this.uniqueId
})));
},
render: function() {
var style = Styler.getStyleFor(this.name);
this.$el.html(this.template({
cid: this.cid,
swfPath: this.swfPath,
playbackId: this.uniqueId
}));
if (Browser.isFirefox) {
this.setupFirefox();
} else if (Browser.isLegacyIE) {
this.setupIE();
}
this.$el.append(style);
return this;
}
}, {}, Playback);
Flash.canPlay = function(resource) {
if ((!Browser.isMobile && Browser.isFirefox) || Browser.isLegacyIE) {
return _.isString(resource) && !!resource.match(/(.*)\.(mp4|mov|f4v|3gpp|3gp)/);
} else {
return _.isString(resource) && !!resource.match(/(.*)\.(mov|f4v|3gpp|3gp)/);
}
};
module.exports = Flash;
},{"../../base/jst":7,"../../base/styler":8,"../../base/utils":9,"browser":"browser","events":"events","mediator":"mediator","mousetrap":4,"playback":"playback","underscore":"underscore","zepto":"zepto"}],25:[function(require,module,exports){
"use strict";
var Playback = require('playback');
var JST = require('../../base/jst');
var _ = require("underscore");
var Mediator = require('mediator');
var Browser = require('browser');
var Events = require('events');
var Styler = require('../../base/styler');
var objectIE = '<object type="application/x-shockwave-flash" id="<%= cid %>" class="hls-playback" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" data-hls="" width="100%" height="100%"><param name="movie" value="<%= swfPath %>"> <param name="quality" value="autohigh"> <param name="swliveconnect" value="true"> <param name="allowScriptAccess" value="always"> <param name="bgcolor" value="#001122"> <param name="allowFullScreen" value="false"> <param name="wmode" value="transparent"> <param name="tabindex" value="1"> <param name=FlashVars value="playbackId=<%= playbackId %>" /> </object>';
var HLS = function HLS(options) {
$traceurRuntime.superCall(this, $HLS.prototype, "constructor", [options]);
this.src = options.src;
this.defaultBaseSwfPath = "http://cdn.clappr.io/" + Clappr.version + "/assets/";
this.swfPath = (options.swfBasePath || this.defaultBaseSwfPath) + "HLSPlayer.swf";
this.flushLiveURLCache = (options.flushLiveURLCache === undefined) ? true : options.flushLiveURLCache;
this.capLevelToStage = (options.capLevelToStage === undefined) ? false : options.capLevelToStage;
this.highDefinition = false;
this.autoPlay = options.autoPlay;
this.defaultSettings = {
left: ["playstop"],
default: ['seekbar'],
right: ["fullscreen", "volume", "hd-indicator"],
seekEnabled: false
};
this.settings = _.extend({}, this.defaultSettings);
this.playbackType = 'live';
this.addListeners();
};
var $HLS = HLS;
($traceurRuntime.createClass)(HLS, {
get name() {
return 'hls';
},
get tagName() {
return 'object';
},
get template() {
return JST.hls;
},
get attributes() {
return {
'class': 'hls-playback',
'data-hls': '',
'type': 'application/x-shockwave-flash',
'width': '100%',
'height': '100%'
};
},
addListeners: function() {
var $__0 = this;
Mediator.on(this.uniqueId + ':flashready', (function() {
return $__0.bootstrap();
}));
Mediator.on(this.uniqueId + ':timeupdate', (function() {
return $__0.updateTime();
}));
Mediator.on(this.uniqueId + ':playbackstate', (function(state) {
return $__0.setPlaybackState(state);
}));
Mediator.on(this.uniqueId + ':highdefinition', (function(isHD) {
return $__0.updateHighDefinition(isHD);
}));
Mediator.on(this.uniqueId + ':playbackerror', (function() {
return $__0.flashPlaybackError();
}));
},
stopListening: function() {
$traceurRuntime.superCall(this, $HLS.prototype, "stopListening", []);
Mediator.off(this.uniqueId + ':flashready');
Mediator.off(this.uniqueId + ':timeupdate');
Mediator.off(this.uniqueId + ':playbackstate');
Mediator.off(this.uniqueId + ':highdefinition');
Mediator.off(this.uniqueId + ':playbackerror');
},
bootstrap: function() {
this.el.width = "100%";
this.el.height = "100%";
this.isReady = true;
this.trigger(Events.PLAYBACK_READY, this.name);
this.currentState = "IDLE";
this.setFlashSettings();
this.autoPlay && this.play();
},
setFlashSettings: function() {
this.el.globoPlayerSetflushLiveURLCache(this.flushLiveURLCache);
this.el.globoPlayerCapLeveltoStage(this.capLevelToStage);
this.el.globoPlayerSetmaxBufferLength(0);
},
updateHighDefinition: function(isHD) {
this.highDefinition = (isHD === "true");
this.trigger(Events.PLAYBACK_HIGHDEFINITIONUPDATE);
this.trigger(Events.PLAYBACK_BITRATE, {'bitrate': this.getCurrentBitrate()});
},
updateTime: function() {
var duration = this.getDuration();
var position = Math.min(Math.max(this.el.globoGetPosition(), 0), duration);
var previousDVRStatus = this.dvrEnabled;
var livePlayback = (this.playbackType === 'live');
this.dvrEnabled = (livePlayback && duration > 240);
if (duration === 100 || livePlayback === undefined) {
return;
}
if (this.dvrEnabled !== previousDVRStatus) {
this.updateSettings();
this.trigger(Events.PLAYBACK_SETTINGSUPDATE, this.name);
}
if (livePlayback && (!this.dvrEnabled || !this.dvrInUse)) {
position = duration;
}
this.trigger(Events.PLAYBACK_TIMEUPDATE, position, duration, this.name);
},
play: function() {
if (this.currentState === 'PAUSED') {
this.el.globoPlayerResume();
} else if (this.currentState !== "PLAYING") {
this.firstPlay();
}
this.trigger(Events.PLAYBACK_PLAY, this.name);
},
getPlaybackType: function() {
return this.playbackType ? this.playbackType : null;
},
getCurrentBitrate: function() {
var currentLevel = this.getLevels()[this.el.globoGetLevel()];
return currentLevel.bitrate;
},
getLastProgramDate: function() {
var programDate = this.el.globoGetLastProgramDate();
return programDate - 1.08e+7;
},
isHighDefinitionInUse: function() {
return this.highDefinition;
},
getLevels: function() {
if (!this.levels || this.levels.length === 0) {
this.levels = this.el.globoGetLevels();
}
return this.levels;
},
setPlaybackState: function(state) {
var bufferLength = this.el.globoGetbufferLength();
if (state === "PLAYING_BUFFERING" && bufferLength < 1) {
this.trigger(Events.PLAYBACK_BUFFERING, this.name);
this.updateCurrentState(state);
} else if (state === "PLAYING") {
if (_.contains(["PLAYING_BUFFERING", "PAUSED", "IDLE"], this.currentState)) {
this.trigger(Events.PLAYBACK_BUFFERFULL, this.name);
this.updateCurrentState(state);
}
} else if (state === "PAUSED") {
this.updateCurrentState(state);
} else if (state === "IDLE") {
this.trigger(Events.PLAYBACK_ENDED, this.name);
this.trigger(Events.PLAYBACK_TIMEUPDATE, 0, this.el.globoGetDuration(), this.name);
this.updateCurrentState(state);
}
this.lastBufferLength = bufferLength;
},
updateCurrentState: function(state) {
this.currentState = state;
this.updatePlaybackType();
},
updatePlaybackType: function() {
this.playbackType = this.el.globoGetType();
if (this.playbackType) {
this.playbackType = this.playbackType.toLowerCase();
if (this.playbackType === 'vod') {
this.startReportingProgress();
} else {
this.stopReportingProgress();
}
}
this.trigger(Events.PLAYBACK_PLAYBACKSTATE);
},
startReportingProgress: function() {
if (!this.reportingProgress) {
this.reportingProgress = true;
Mediator.on(this.uniqueId + ':fragmentloaded', this.onFragmentLoaded);
}
},
stopReportingProgress: function() {
Mediator.off(this.uniqueId + ':fragmentloaded', this.onFragmentLoaded, this);
},
onFragmentLoaded: function() {
var buffered = this.el.globoGetPosition() + this.el.globoGetbufferLength();
this.trigger(Events.PLAYBACK_PROGRESS, this.el.globoGetPosition(), buffered, this.getDuration(), this.name);
},
firstPlay: function() {
this.setFlashSettings();
this.el.globoPlayerLoad(this.src);
this.el.globoPlayerPlay();
},
volume: function(value) {
var $__0 = this;
if (this.isReady) {
this.el.globoPlayerVolume(value);
} else {
this.listenToOnce(this, Events.PLAYBACK_BUFFERFULL, (function() {
return $__0.volume(value);
}));
}
},
pause: function() {
if (this.playbackType !== 'live' || this.dvrEnabled) {
this.el.globoPlayerPause();
if (this.playbackType === 'live' && this.dvrEnabled) {
this.updateDvr(true);
}
}
},
stop: function() {
this.el.globoPlayerStop();
this.trigger(Events.PLAYBACK_TIMEUPDATE, 0, this.name);
},
isPlaying: function() {
if (this.currentState) {
return !!(this.currentState.match(/playing/i));
}
return false;
},
getDuration: function() {
var duration = this.el.globoGetDuration();
if (this.playbackType === 'live') {
duration = duration - 10;
}
return duration;
},
seek: function(time) {
var duration = this.getDuration();
if (time > 0) {
time = duration * time / 100;
}
if (this.playbackType === 'live') {
var dvrInUse = (time >= 0 && duration - time > 5);
if (!dvrInUse) {
time = -1;
}
this.updateDvr(dvrInUse);
}
this.el.globoPlayerSeek(time);
this.trigger(Events.PLAYBACK_TIMEUPDATE, time, duration, this.name);
},
updateDvr: function(dvrInUse) {
var previousDvrInUse = !!this.dvrInUse;
this.dvrInUse = dvrInUse;
if (this.dvrInUse !== previousDvrInUse) {
this.updateSettings();
this.trigger(Events.PLAYBACK_DVR, this.dvrInUse);
this.trigger(Events.PLAYBACK_STATS_ADD, {'dvr': this.dvrInUse});
}
},
flashPlaybackError: function() {
this.trigger(Events.PLAYBACK_STOP);
},
timeUpdate: function(time, duration) {
this.trigger(Events.PLAYBACK_TIMEUPDATE, time, duration, this.name);
},
destroy: function() {
this.stopListening();
this.$el.remove();
},
setupFirefox: function() {
var $el = this.$('embed');
$el.attr('data-hls', '');
this.setElement($el);
},
setupIE: function() {
this.setElement($(_.template(objectIE)({
cid: this.cid,
swfPath: this.swfPath,
playbackId: this.uniqueId
})));
},
updateSettings: function() {
this.settings = _.extend({}, this.defaultSettings);
if (this.playbackType === "vod" || this.dvrInUse) {
this.settings.left = ["playpause", "position", "duration"];
this.settings.seekEnabled = true;
} else if (this.dvrEnabled) {
this.settings.left = ["playpause"];
this.settings.seekEnabled = true;
} else {
this.settings.seekEnabled = false;
}
},
setElement: function(element) {
this.$el = element;
this.el = element[0];
},
render: function() {
var style = Styler.getStyleFor(this.name);
if (Browser.isLegacyIE) {
this.setupIE();
} else {
this.$el.html(this.template({
cid: this.cid,
swfPath: this.swfPath,
playbackId: this.uniqueId
}));
if (Browser.isFirefox) {
this.setupFirefox();
} else if (Browser.isIE) {
this.$('embed').remove();
}
}
this.el.id = this.cid;
this.$el.append(style);
return this;
}
}, {}, Playback);
HLS.canPlay = function(resource) {
return !!resource.match(/^http(.*).m3u8?/);
};
module.exports = HLS;
},{"../../base/jst":7,"../../base/styler":8,"browser":"browser","events":"events","mediator":"mediator","playback":"playback","underscore":"underscore"}],26:[function(require,module,exports){
"use strict";
var Playback = require('playback');
var Events = require('events');
var HTML5Audio = function HTML5Audio(params) {
$traceurRuntime.superCall(this, $HTML5Audio.prototype, "constructor", [params]);
this.el.src = params.src;
this.settings = {
left: ['playpause', 'position', 'duration'],
right: ['fullscreen', 'volume'],
default: ['seekbar']
};
this.render();
params.autoPlay && this.play();
};
var $HTML5Audio = HTML5Audio;
($traceurRuntime.createClass)(HTML5Audio, {
get name() {
return 'html5_audio';
},
get tagName() {
return 'audio';
},
get events() {
return {
'timeupdate': 'timeUpdated',
'ended': 'ended',
'canplaythrough': 'bufferFull'
};
},
bindEvents: function() {
this.listenTo(this.container, Events.CONTAINER_PLAY, this.play);
this.listenTo(this.container, Events.CONTAINER_PAUSE, this.pause);
this.listenTo(this.container, Events.CONTAINER_SEEK, this.seek);
this.listenTo(this.container, Events.CONTAINER_VOLUME, this.volume);
this.listenTo(this.container, Events.CONTAINER_STOP, this.stop);
},
getPlaybackType: function() {
return "aod";
},
play: function() {
this.el.play();
this.trigger(Events.PLAYBACK_PLAY);
},
pause: function() {
this.el.pause();
},
stop: function() {
this.pause();
this.el.currentTime = 0;
},
volume: function(value) {
this.el.volume = value / 100;
},
mute: function() {
this.el.volume = 0;
},
unmute: function() {
this.el.volume = 1;
},
isMuted: function() {
return !!this.el.volume;
},
ended: function() {
this.trigger(Events.CONTAINER_TIMEUPDATE, 0);
},
seek: function(seekBarValue) {
var time = this.el.duration * (seekBarValue / 100);
this.el.currentTime = time;
},
getCurrentTime: function() {
return this.el.currentTime;
},
getDuration: function() {
return this.el.duration;
},
isPlaying: function() {
return !this.el.paused && !this.el.ended;
},
timeUpdated: function() {
this.trigger(Events.PLAYBACK_TIMEUPDATE, this.el.currentTime, this.el.duration, this.name);
},
bufferFull: function() {
this.trigger(Events.PLAYBACK_TIMEUPDATE, this.el.currentTime, this.el.duration, this.name);
this.trigger(Events.PLAYBACK_BUFFERFULL);
},
render: function() {
this.trigger(Events.PLAYBACK_READY, this.name);
return this;
}
}, {}, Playback);
HTML5Audio.canPlay = function(resource) {
return !!resource.match(/(.*).mp3/);
};
module.exports = HTML5Audio;
},{"events":"events","playback":"playback"}],27:[function(require,module,exports){
(function (process){
"use strict";
var Playback = require('playback');
var JST = require('../../base/jst');
var Styler = require('../../base/styler');
var Browser = require('browser');
var seekStringToSeconds = require('../../base/utils').seekStringToSeconds;
var Events = require('events');
var _ = require('underscore');
require('mousetrap');
var HTML5Video = function HTML5Video(options) {
$traceurRuntime.superCall(this, $HTML5Video.prototype, "constructor", [options]);
this.options = options;
this.src = options.src;
this.el.src = options.src;
this.el.loop = options.loop;
this.firstBuffer = true;
this.isHLS = (this.src.indexOf('m3u8') > -1);
this.settings = {default: ['seekbar']};
if (Browser.isSafari) {
this.el.preload = 'auto';
} else {
this.el.preload = options.preload ? options.preload : 'metadata';
this.settings.seekEnabled = true;
}
this.settings.left = this.isHLS ? ["playstop"] : ["playpause", "position", "duration"];
this.settings.right = ["fullscreen", "volume"];
this.bindEvents();
};
var $HTML5Video = HTML5Video;
($traceurRuntime.createClass)(HTML5Video, {
get name() {
return 'html5_video';
},
get tagName() {
return 'video';
},
get template() {
return JST.html5_video;
},
get attributes() {
return {'data-html5-video': ''};
},
get events() {
return {
'timeupdate': 'timeUpdated',
'progress': 'progress',
'ended': 'ended',
'stalled': 'stalled',
'waiting': 'waiting',
'canplaythrough': 'bufferFull',
'loadedmetadata': 'loadedMetadata'
};
},
bindEvents: function() {
_.each(_.range(1, 10), function(i) {
var $__0 = this;
Mousetrap.bind([i.toString()], (function() {
return $__0.seek(i * 10);
}));
}.bind(this));
},
loadedMetadata: function(e) {
this.trigger(Events.PLAYBACK_LOADEDMETADATA, e.target.duration);
this.trigger(Events.PLAYBACK_SETTINGSUPDATE);
this.checkInitialSeek();
},
getPlaybackType: function() {
return this.isHLS && _.contains([0, undefined, Infinity], this.el.duration) ? 'live' : 'vod';
},
isHighDefinitionInUse: function() {
return false;
},
play: function() {
this.el.play();
this.trigger(Events.PLAYBACK_PLAY);
if (this.isHLS) {
this.trigger(Events.PLAYBACK_TIMEUPDATE, 1, 1, this.name);
}
},
pause: function() {
this.el.pause();
},
stop: function() {
this.pause();
if (this.el.readyState !== 0) {
this.el.currentTime = 0;
}
},
volume: function(value) {
this.el.volume = value / 100;
},
mute: function() {
this.el.volume = 0;
},
unmute: function() {
this.el.volume = 1;
},
isMuted: function() {
return !!this.el.volume;
},
isPlaying: function() {
return !this.el.paused && !this.el.ended;
},
ended: function() {
this.trigger(Events.PLAYBACK_ENDED, this.name);
this.trigger(Events.PLAYBACK_TIMEUPDATE, 0, this.el.duration, this.name);
},
stalled: function() {
if (this.getPlaybackType() === 'vod' && this.el.readyState < this.el.HAVE_FUTURE_DATA) {
this.trigger(Events.PLAYBACK_BUFFERING, this.name);
}
},
waiting: function() {
if (this.el.readyState < this.el.HAVE_FUTURE_DATA) {
this.trigger(Events.PLAYBACK_BUFFERING, this.name);
}
},
bufferFull: function() {
if (this.options.poster && this.firstBuffer) {
this.firstBuffer = false;
if (!this.isPlaying()) {
this.el.poster = this.options.poster;
}
} else {
this.el.poster = '';
}
this.trigger(Events.PLAYBACK_BUFFERFULL, this.name);
},
destroy: function() {
this.stop();
this.el.src = '';
this.$el.remove();
},
seek: function(seekBarValue) {
var time = this.el.duration * (seekBarValue / 100);
this.seekSeconds(time);
},
seekSeconds: function(time) {
this.el.currentTime = time;
},
checkInitialSeek: function() {
var seekTime = seekStringToSeconds(window.location.href);
this.seekSeconds(seekTime);
},
getCurrentTime: function() {
return this.el.currentTime;
},
getDuration: function() {
return this.el.duration;
},
timeUpdated: function() {
if (this.getPlaybackType() !== 'live') {
this.trigger(Events.PLAYBACK_TIMEUPDATE, this.el.currentTime, this.el.duration, this.name);
}
},
progress: function() {
if (!this.el.buffered.length)
return;
var bufferedPos = 0;
for (var i = 0; i < this.el.buffered.length; i++) {
if (this.el.currentTime >= this.el.buffered.start(i) && this.el.currentTime <= this.el.buffered.end(i)) {
bufferedPos = i;
break;
}
}
this.trigger(Events.PLAYBACK_PROGRESS, this.el.buffered.start(bufferedPos), this.el.buffered.end(bufferedPos), this.el.duration, this.name);
},
typeFor: function(src) {
return (src.indexOf('.m3u8') > 0) ? 'application/vnd.apple.mpegurl' : 'video/mp4';
},
render: function() {
var $__0 = this;
var style = Styler.getStyleFor(this.name);
this.$el.html(this.template({
src: this.src,
type: this.typeFor(this.src)
}));
this.$el.append(style);
this.trigger(Events.PLAYBACK_READY, this.name);
process.nextTick((function() {
return $__0.options.autoPlay && $__0.play();
}));
return this;
}
}, {}, Playback);
HTML5Video.canPlay = function(resource) {
var mimetypes = {
'mp4': _.map(["avc1.42E01E", "avc1.58A01E", "avc1.4D401E", "avc1.64001E", "mp4v.20.8", "mp4v.20.240", "mp4a.40.2"], function(codec) {
return 'video/mp4; codecs="' + codec + ', mp4a.40.2"';
}),
'ogg': ['video/ogg; codecs="theora, vorbis"', 'video/ogg; codecs="dirac"', 'video/ogg; codecs="theora, speex"'],
'3gpp': ['video/3gpp; codecs="mp4v.20.8, samr"'],
'webm': ['video/webm; codecs="vp8, vorbis"'],
'mkv': ['video/x-matroska; codecs="theora, vorbis"'],
'm3u8': ['application/x-mpegURL']
};
mimetypes['ogv'] = mimetypes['ogg'];
mimetypes['3gp'] = mimetypes['3gpp'];
var extension = resource.split('?')[0].match(/.*\.(.*)$/)[1];
if (_.has(mimetypes, extension)) {
var v = document.createElement('video');
return !!_.find(mimetypes[extension], function(ext) {
return !!v.canPlayType(ext).replace(/no/, '');
});
}
return false;
};
module.exports = HTML5Video;
}).call(this,require('_process'))
},{"../../base/jst":7,"../../base/styler":8,"../../base/utils":9,"_process":2,"browser":"browser","events":"events","mousetrap":4,"playback":"playback","underscore":"underscore"}],28:[function(require,module,exports){
"use strict";
var Playback = require('playback');
var Styler = require('../../base/styler');
var JST = require('../../base/jst');
var Events = require('events');
var HTMLImg = function HTMLImg(params) {
$traceurRuntime.superCall(this, $HTMLImg.prototype, "constructor", [params]);
this.el.src = params.src;
setTimeout(function() {
this.trigger(Events.PLAYBACK_BUFFERFULL, this.name);
}.bind(this), 1);
};
var $HTMLImg = HTMLImg;
($traceurRuntime.createClass)(HTMLImg, {
get name() {
return 'html_img';
},
get tagName() {
return 'img';
},
get attributes() {
return {'data-html-img': ''};
},
getPlaybackType: function() {
return null;
},
render: function() {
var style = Styler.getStyleFor(this.name);
this.$el.append(style);
return this;
}
}, {}, Playback);
HTMLImg.canPlay = function(resource) {
return !!resource.match(/(.*).(png|jpg|jpeg|gif|bmp)/);
};
module.exports = HTMLImg;
},{"../../base/jst":7,"../../base/styler":8,"events":"events","playback":"playback"}],29:[function(require,module,exports){
"use strict";
module.exports = require('./no_op');
},{"./no_op":30}],30:[function(require,module,exports){
"use strict";
var Playback = require('playback');
var JST = require('../../base/jst');
var Styler = require('../../base/styler');
var NoOp = function NoOp(options) {
$traceurRuntime.superCall(this, $NoOp.prototype, "constructor", [options]);
};
var $NoOp = NoOp;
($traceurRuntime.createClass)(NoOp, {
get name() {
return 'no_op';
},
get template() {
return JST.no_op;
},
get attributes() {
return {'data-no-op': ''};
},
render: function() {
var style = Styler.getStyleFor(this.name);
this.$el.html(this.template());
this.$el.append(style);
return this;
}
}, {}, Playback);
NoOp.canPlay = (function(source) {
return true;
});
module.exports = NoOp;
},{"../../base/jst":7,"../../base/styler":8,"playback":"playback"}],31:[function(require,module,exports){
(function (process){
"use strict";
var UICorePlugin = require('ui_core_plugin');
var JST = require('../../base/jst');
var Styler = require('../../base/styler');
var Events = require('events');
var Browser = require('browser');
var Mediator = require('mediator');
var PlayerInfo = require('player_info');
var BackgroundButton = function BackgroundButton(core) {
$traceurRuntime.superCall(this, $BackgroundButton.prototype, "constructor", [core]);
this.core = core;
this.settingsUpdate();
};
var $BackgroundButton = BackgroundButton;
($traceurRuntime.createClass)(BackgroundButton, {
get template() {
return JST.background_button;
},
get name() {
return 'background_button';
},
get attributes() {
return {
'class': 'background-button',
'data-background-button': ''
};
},
get events() {
return {'click .background-button-icon': 'click'};
},
bindEvents: function() {
this.listenTo(this.core.mediaControl.container, Events.CONTAINER_STATE_BUFFERING, this.hide);
this.listenTo(this.core.mediaControl.container, Events.CONTAINER_STATE_BUFFERFULL, this.show);
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.settingsUpdate);
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_SHOW, this.updateSize);
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_PLAYING, this.playing);
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_NOTPLAYING, this.notplaying);
Mediator.on(Events.PLAYER_RESIZE, this.updateSize, this);
},
stopListening: function() {
$traceurRuntime.superCall(this, $BackgroundButton.prototype, "stopListening", []);
Mediator.off(Events.PLAYER_RESIZE, this.updateSize, this);
},
settingsUpdate: function() {
this.stopListening();
if (this.shouldRender()) {
this.render();
this.bindEvents();
if (this.core.mediaControl.container.isPlaying()) {
this.playing();
} else {
this.notplaying();
}
} else {
this.$el.remove();
this.$playPauseButton.show();
this.$playStopButton.show();
this.listenTo(this.core.mediaControl.container, Events.CONTAINER_SETTINGSUPDATE, this.settingsUpdate);
this.listenTo(this.core.mediaControl.container, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.settingsUpdate);
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.settingsUpdate);
}
},
shouldRender: function() {
var useBackgroundButton = (this.core.options.useBackgroundButton === undefined && Browser.isMobile) || !!this.core.options.useBackgroundButton;
return useBackgroundButton && (this.core.mediaControl.$el.find('[data-playstop]').length > 0 || this.core.mediaControl.$el.find('[data-playpause]').length > 0);
},
click: function() {
this.core.mediaControl.show();
if (this.shouldStop) {
this.core.mediaControl.togglePlayStop();
} else {
this.core.mediaControl.togglePlayPause();
}
},
show: function() {
this.$el.removeClass('hide');
},
hide: function() {
this.$el.addClass('hide');
},
enable: function() {
this.stopListening();
$traceurRuntime.superCall(this, $BackgroundButton.prototype, "enable", []);
this.settingsUpdate();
},
disable: function() {
$traceurRuntime.superCall(this, $BackgroundButton.prototype, "disable", []);
this.$playPauseButton.show();
this.$playStopButton.show();
},
playing: function() {
this.$buttonIcon.removeClass('notplaying').addClass('playing');
},
notplaying: function() {
this.$buttonIcon.removeClass('playing').addClass('notplaying');
},
getExternalInterface: function() {},
updateSize: function() {
if (!this.$el)
return;
var height = PlayerInfo.currentSize ? PlayerInfo.currentSize.height : this.$el.height();
this.$el.css({fontSize: height});
this.$buttonWrapper.css({marginTop: -(this.$buttonWrapper.height() / 2)});
},
render: function() {
var $__0 = this;
var style = Styler.getStyleFor(this.name);
this.$el.html(this.template());
this.$el.append(style);
this.$playPauseButton = this.core.mediaControl.$el.find('[data-playpause]');
this.$playStopButton = this.core.mediaControl.$el.find('[data-playstop]');
this.$buttonWrapper = this.$el.find('.background-button-wrapper[data-background-button]');
this.$buttonIcon = this.$el.find('.background-button-icon[data-background-button]');
this.shouldStop = this.$playStopButton.length > 0;
this.$el.insertBefore(this.core.mediaControl.$el.find('.media-control-layer[data-controls]'));
this.$el.click((function() {
return $__0.click($__0.$el);
}));
process.nextTick((function() {
return $__0.updateSize();
}));
if (this.core.options.useBackgroundButton) {
this.$playPauseButton.hide();
this.$playStopButton.hide();
}
if (this.shouldStop) {
this.$buttonIcon.addClass('playstop');
}
if (this.core.mediaControl.isVisible()) {
this.show();
}
return this;
}
}, {}, UICorePlugin);
module.exports = BackgroundButton;
}).call(this,require('_process'))
},{"../../base/jst":7,"../../base/styler":8,"_process":2,"browser":"browser","events":"events","mediator":"mediator","player_info":"player_info","ui_core_plugin":"ui_core_plugin"}],32:[function(require,module,exports){
"use strict";
module.exports = require('./background_button');
},{"./background_button":31}],33:[function(require,module,exports){
"use strict";
var ContainerPlugin = require('container_plugin');
var Events = require('events');
var ClickToPausePlugin = function ClickToPausePlugin() {
$traceurRuntime.defaultSuperCall(this, $ClickToPausePlugin.prototype, arguments);
};
var $ClickToPausePlugin = ClickToPausePlugin;
($traceurRuntime.createClass)(ClickToPausePlugin, {
get name() {
return 'click_to_pause';
},
bindEvents: function() {
this.listenTo(this.container, Events.CONTAINER_CLICK, this.click);
this.listenTo(this.container, Events.CONTAINER_SETTINGSUPDATE, this.settingsUpdate);
},
click: function() {
if (this.container.getPlaybackType() !== 'live' || this.container.isDvrEnabled()) {
if (this.container.isPlaying()) {
this.container.pause();
} else {
this.container.play();
}
}
},
settingsUpdate: function() {
this.container.$el.removeClass('pointer-enabled');
if (this.container.getPlaybackType() !== 'live' || this.container.isDvrEnabled()) {
this.container.$el.addClass('pointer-enabled');
}
}
}, {}, ContainerPlugin);
module.exports = ClickToPausePlugin;
},{"container_plugin":"container_plugin","events":"events"}],34:[function(require,module,exports){
"use strict";
module.exports = require('./click_to_pause');
},{"./click_to_pause":33}],35:[function(require,module,exports){
"use strict";
var UICorePlugin = require('ui_core_plugin');
var JST = require('../../base/jst');
var Styler = require('../../base/styler');
var Events = require('events');
var DVRControls = function DVRControls(core) {
$traceurRuntime.superCall(this, $DVRControls.prototype, "constructor", [core]);
this.core = core;
this.settingsUpdate();
};
var $DVRControls = DVRControls;
($traceurRuntime.createClass)(DVRControls, {
get template() {
return JST.dvr_controls;
},
get name() {
return 'dvr_controls';
},
get events() {
return {'click .live-button': 'click'};
},
get attributes() {
return {
'class': 'dvr-controls',
'data-dvr-controls': ''
};
},
bindEvents: function() {
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.settingsUpdate);
this.listenTo(this.core.mediaControl.container, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.dvrChanged);
},
dvrChanged: function(dvrEnabled) {
this.settingsUpdate();
this.core.mediaControl.$el.addClass('live');
if (dvrEnabled) {
this.core.mediaControl.$el.addClass('dvr');
this.core.mediaControl.$el.find('.media-control-indicator[data-position], .media-control-indicator[data-duration]').hide();
} else {
this.core.mediaControl.$el.removeClass('dvr');
}
},
click: function() {
if (!this.core.mediaControl.container.isPlaying()) {
this.core.mediaControl.container.play();
}
if (this.core.mediaControl.$el.hasClass('dvr')) {
this.core.mediaControl.container.setCurrentTime(-1);
}
},
settingsUpdate: function() {
var $__0 = this;
this.stopListening();
if (this.shouldRender()) {
this.render();
this.$el.click((function() {
return $__0.click();
}));
}
this.bindEvents();
},
shouldRender: function() {
var useDvrControls = this.core.options.useDvrControls === undefined || !!this.core.options.useDvrControls;
return useDvrControls && this.core.mediaControl.container.getPlaybackType() === 'live';
},
render: function() {
var style = Styler.getStyleFor(this.name);
this.$el.html(this.template());
this.$el.append(style);
if (this.shouldRender()) {
this.core.mediaControl.$el.addClass('live');
this.core.mediaControl.$('.media-control-left-panel[data-media-control]').append(this.$el);
if (this.$duration) {
this.$duration.remove();
}
this.$duration = $('<span data-duration></span>');
this.core.mediaControl.seekTime.$el.append(this.$duration);
}
return this;
}
}, {}, UICorePlugin);
module.exports = DVRControls;
},{"../../base/jst":7,"../../base/styler":8,"events":"events","ui_core_plugin":"ui_core_plugin"}],36:[function(require,module,exports){
"use strict";
module.exports = require('./dvr_controls');
},{"./dvr_controls":35}],37:[function(require,module,exports){
"use strict";
var ContainerPlugin = require('container_plugin');
var Events = require('events');
var GoogleAnalytics = function GoogleAnalytics(options) {
$traceurRuntime.superCall(this, $GoogleAnalytics.prototype, "constructor", [options]);
if (options.gaAccount) {
this.embedScript();
this.account = options.gaAccount;
this.trackerName = options.gaTrackerName + "." || 'Clappr.';
this.currentHDState = undefined;
}
};
var $GoogleAnalytics = GoogleAnalytics;
($traceurRuntime.createClass)(GoogleAnalytics, {
get name() {
return 'google_analytics';
},
embedScript: function() {
var $__0 = this;
if (!window._gat) {
var script = document.createElement('script');
script.setAttribute("type", "text/javascript");
script.setAttribute("async", "async");
script.setAttribute("src", "http://www.google-analytics.com/ga.js");
script.onload = (function() {
return $__0.addEventListeners();
});
document.body.appendChild(script);
} else {
this.addEventListeners();
}
},
addEventListeners: function() {
var $__0 = this;
this.listenTo(this.container, Events.CONTAINER_PLAY, this.onPlay);
this.listenTo(this.container, Events.CONTAINER_STOP, this.onStop);
this.listenTo(this.container, Events.CONTAINER_PAUSE, this.onPause);
this.listenTo(this.container, Events.CONTAINER_ENDED, this.onEnded);
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering);
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERFULL, this.onBufferFull);
this.listenTo(this.container, Events.CONTAINER_ENDED, this.onEnded);
this.listenTo(this.container, Events.CONTAINER_ERROR, this.onError);
this.listenTo(this.container, Events.CONTAINER_PLAYBACKSTATE, this.onPlaybackChanged);
this.listenTo(this.container, Events.CONTAINER_VOLUME, (function(event) {
return $__0.onVolumeChanged(event);
}));
this.listenTo(this.container, Events.CONTAINER_SEEK, (function(event) {
return $__0.onSeek(event);
}));
this.listenTo(this.container, Events.CONTAINER_FULL_SCREEN, this.onFullscreen);
this.listenTo(this.container, Events.CONTAINER_HIGHDEFINITIONUPDATE, this.onHD);
this.listenTo(this.container.playback, Events.PLAYBACK_DVR, this.onDVR);
_gaq.push([this.trackerName + '_setAccount', this.account]);
},
onPlay: function() {
this.push(["Video", "Play", this.container.playback.src]);
},
onStop: function() {
this.push(["Video", "Stop", this.container.playback.src]);
},
onEnded: function() {
this.push(["Video", "Ended", this.container.playback.src]);
},
onBuffering: function() {
this.push(["Video", "Buffering", this.container.playback.src]);
},
onBufferFull: function() {
this.push(["Video", "Bufferfull", this.container.playback.src]);
},
onError: function() {
this.push(["Video", "Error", this.container.playback.src]);
},
onHD: function() {
var status = this.container.isHighDefinitionInUse() ? "ON" : "OFF";
if (status !== this.currentHDState) {
this.currentHDState = status;
this.push(["Video", "HD - " + status, this.container.playback.src]);
}
},
onPlaybackChanged: function() {
var type = this.container.getPlaybackType();
if (type !== null) {
this.push(["Video", "Playback Type - " + type, this.container.playback.src]);
}
},
onDVR: function() {
var status = this.container.isHighDefinitionInUse();
this.push(["Interaction", "DVR - " + status, this.container.playback.src]);
},
onPause: function() {
this.push(["Video", "Pause", this.container.playback.src]);
},
onSeek: function() {
this.push(["Video", "Seek", this.container.playback.src]);
},
onVolumeChanged: function() {
this.push(["Interaction", "Volume", this.container.playback.src]);
},
onFullscreen: function() {
this.push(["Interaction", "Fullscreen", this.container.playback.src]);
},
push: function(array) {
var res = [this.trackerName + "_trackEvent"].concat(array);
_gaq.push(res);
}
}, {}, ContainerPlugin);
module.exports = GoogleAnalytics;
},{"container_plugin":"container_plugin","events":"events"}],38:[function(require,module,exports){
"use strict";
module.exports = require('./google_analytics');
},{"./google_analytics":37}],39:[function(require,module,exports){
"use strict";
module.exports = require('./log');
},{"./log":40}],40:[function(require,module,exports){
"use strict";
var _ = require('underscore');
require('mousetrap');
var Log = function Log() {
var $__0 = this;
Mousetrap.bind(['ctrl+shift+d'], (function() {
return $__0.onOff();
}));
this.BLACKLIST = ['playback:timeupdate', 'playback:progress', 'container:hover', 'container:timeupdate', 'container:progress'];
};
($traceurRuntime.createClass)(Log, {
info: function(klass, message) {
this.log(klass, 'info', message);
},
warn: function(klass, message) {
this.log(klass, 'warn', message);
},
debug: function(klass, message) {
this.log(klass, 'debug', message);
},
onOff: function() {
window.DEBUG = !window.DEBUG;
if (window.DEBUG) {
console.log('log enabled');
} else {
console.log('log disabled');
}
},
log: function(klass, level, message) {
if (!window.DEBUG || _.contains(this.BLACKLIST, message))
return;
var color;
if (level === 'warn') {
color = '#FF8000';
} else if (level === 'info') {
color = '#006600';
} else if (level === 'error') {
color = '#FF0000';
}
console.log("%c [" + klass + "] [" + level + "] " + message, 'color: ' + color);
}
}, {});
Log.getInstance = function() {
if (this._instance === undefined) {
this._instance = new this();
}
return this._instance;
};
module.exports = Log;
},{"mousetrap":4,"underscore":"underscore"}],41:[function(require,module,exports){
(function (process){
"use strict";
var UIContainerPlugin = require('ui_container_plugin');
var Styler = require('../../base/styler');
var JST = require('../../base/jst');
var Events = require('events');
var Mediator = require('mediator');
var PlayerInfo = require('player_info');
var $ = require('zepto');
var _ = require('underscore');
var PosterPlugin = function PosterPlugin(options) {
$traceurRuntime.superCall(this, $PosterPlugin.prototype, "constructor", [options]);
this.options = options;
_.defaults(this.options, {disableControlsOnPoster: true});
if (this.options.disableControlsOnPoster) {
this.container.disableMediaControl();
}
this.render();
};
var $PosterPlugin = PosterPlugin;
($traceurRuntime.createClass)(PosterPlugin, {
get name() {
return 'poster';
},
get template() {
return JST.poster;
},
get attributes() {
return {
'class': 'player-poster',
'data-poster': ''
};
},
get events() {
return {'click': 'clicked'};
},
bindEvents: function() {
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering);
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERFULL, this.onBufferfull);
this.listenTo(this.container, Events.CONTAINER_STOP, this.onStop);
this.listenTo(this.container, Events.CONTAINER_ENDED, this.onStop);
Mediator.on(Events.PLAYER_RESIZE, this.updateSize, this);
},
stopListening: function() {
$traceurRuntime.superCall(this, $PosterPlugin.prototype, "stopListening", []);
Mediator.off(Events.PLAYER_RESIZE, this.updateSize, this);
},
onBuffering: function() {
this.hidePlayButton();
},
onBufferfull: function() {
this.$el.hide();
if (this.options.disableControlsOnPoster) {
this.container.enableMediaControl();
}
},
onStop: function() {
this.$el.show();
if (this.options.disableControlsOnPoster) {
this.container.disableMediaControl();
}
if (!this.options.hidePlayButton) {
this.showPlayButton();
}
},
hidePlayButton: function() {
this.$playButton.hide();
},
showPlayButton: function() {
this.$playButton.show();
this.updateSize();
},
clicked: function() {
this.container.play();
return false;
},
updateSize: function() {
if (!this.$el)
return;
var height = PlayerInfo.currentSize ? PlayerInfo.currentSize.height : this.$el.height();
this.$el.css({fontSize: height});
if (this.$playWrapper.is(':visible')) {
this.$playWrapper.css({marginTop: -(this.$playWrapper.height() / 2)});
if (!this.options.hidePlayButton) {
this.$playButton.show();
}
} else {
this.$playButton.hide();
}
},
render: function() {
var $__0 = this;
var style = Styler.getStyleFor(this.name);
this.$el.html(this.template());
this.$el.append(style);
this.$playButton = this.$el.find('.poster-icon');
this.$playWrapper = this.$el.find('.play-wrapper');
if (this.options.poster !== undefined) {
var imgEl = $('<img data-poster class="poster-background"></img>');
imgEl.attr('src', this.options.poster);
this.$el.prepend(imgEl);
}
this.container.$el.append(this.el);
if (!!this.options.hidePlayButton) {
this.hidePlayButton();
}
process.nextTick((function() {
return $__0.updateSize();
}));
return this;
}
}, {}, UIContainerPlugin);
module.exports = PosterPlugin;
}).call(this,require('_process'))
},{"../../base/jst":7,"../../base/styler":8,"_process":2,"events":"events","mediator":"mediator","player_info":"player_info","ui_container_plugin":"ui_container_plugin","underscore":"underscore","zepto":"zepto"}],42:[function(require,module,exports){
"use strict";
module.exports = require('./spinner_three_bounce');
},{"./spinner_three_bounce":43}],43:[function(require,module,exports){
"use strict";
var UIContainerPlugin = require('ui_container_plugin');
var Styler = require('../../base/styler');
var JST = require('../../base/jst');
var Events = require('events');
var SpinnerThreeBouncePlugin = function SpinnerThreeBouncePlugin(options) {
$traceurRuntime.superCall(this, $SpinnerThreeBouncePlugin.prototype, "constructor", [options]);
this.template = JST.spinner_three_bounce;
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering);
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERFULL, this.onBufferFull);
this.listenTo(this.container, Events.CONTAINER_STOP, this.onStop);
this.render();
};
var $SpinnerThreeBouncePlugin = SpinnerThreeBouncePlugin;
($traceurRuntime.createClass)(SpinnerThreeBouncePlugin, {
get name() {
return 'spinner';
},
get attributes() {
return {
'data-spinner': '',
'class': 'spinner-three-bounce'
};
},
onBuffering: function() {
this.$el.show();
},
onBufferFull: function() {
this.$el.hide();
},
onStop: function() {
this.$el.hide();
},
render: function() {
this.$el.html(this.template());
var style = Styler.getStyleFor('spinner_three_bounce');
this.container.$el.append(style);
this.container.$el.append(this.$el);
this.$el.hide();
return this;
}
}, {}, UIContainerPlugin);
module.exports = SpinnerThreeBouncePlugin;
},{"../../base/jst":7,"../../base/styler":8,"events":"events","ui_container_plugin":"ui_container_plugin"}],44:[function(require,module,exports){
"use strict";
module.exports = require('./stats');
},{"./stats":45}],45:[function(require,module,exports){
"use strict";
var ContainerPlugin = require('container_plugin');
var $ = require("zepto");
var Events = require('events');
var StatsPlugin = function StatsPlugin(options) {
$traceurRuntime.superCall(this, $StatsPlugin.prototype, "constructor", [options]);
this.setInitialAttrs();
this.reportInterval = options.reportInterval || 5000;
this.state = "IDLE";
};
var $StatsPlugin = StatsPlugin;
($traceurRuntime.createClass)(StatsPlugin, {
get name() {
return 'stats';
},
bindEvents: function() {
this.listenTo(this.container.playback, Events.PLAYBACK_PLAY, this.onPlay);
this.listenTo(this.container, Events.CONTAINER_STOP, this.onStop);
this.listenTo(this.container, Events.CONTAINER_DESTROYED, this.onStop);
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering);
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERFULL, this.onBufferFull);
this.listenTo(this.container, Events.CONTAINER_STATS_ADD, this.onStatsAdd);
this.listenTo(this.container, Events.CONTAINER_BITRATE, this.onStatsAdd);
this.listenTo(this.container.playback, Events.PLAYBACK_STATS_ADD, this.onStatsAdd);
},
setInitialAttrs: function() {
this.firstPlay = true;
this.startupTime = 0;
this.rebufferingTime = 0;
this.watchingTime = 0;
this.rebuffers = 0;
this.externalMetrics = {};
},
onPlay: function() {
this.state = "PLAYING";
this.watchingTimeInit = Date.now();
if (!this.intervalId) {
this.intervalId = setInterval(this.report.bind(this), this.reportInterval);
}
},
onStop: function() {
clearInterval(this.intervalId);
this.intervalId = undefined;
this.state = "STOPPED";
},
onBuffering: function() {
if (this.firstPlay) {
this.startupTimeInit = Date.now();
} else {
this.rebufferingTimeInit = Date.now();
}
this.state = "BUFFERING";
this.rebuffers++;
},
onBufferFull: function() {
if (this.firstPlay && !!this.startupTimeInit) {
this.firstPlay = false;
this.startupTime = Date.now() - this.startupTimeInit;
this.watchingTimeInit = Date.now();
} else if (!!this.rebufferingTimeInit) {
this.rebufferingTime += this.getRebufferingTime();
}
this.rebufferingTimeInit = undefined;
this.state = "PLAYING";
},
getRebufferingTime: function() {
return Date.now() - this.rebufferingTimeInit;
},
getWatchingTime: function() {
var totalTime = (Date.now() - this.watchingTimeInit);
return totalTime - this.rebufferingTime;
},
isRebuffering: function() {
return !!this.rebufferingTimeInit;
},
onStatsAdd: function(metric) {
$.extend(this.externalMetrics, metric);
},
getStats: function() {
var metrics = {
startupTime: this.startupTime,
rebuffers: this.rebuffers,
rebufferingTime: this.isRebuffering() ? this.rebufferingTime + this.getRebufferingTime() : this.rebufferingTime,
watchingTime: this.isRebuffering() ? this.getWatchingTime() - this.getRebufferingTime() : this.getWatchingTime()
};
$.extend(metrics, this.externalMetrics);
return metrics;
},
report: function() {
this.container.statsReport(this.getStats());
}
}, {}, ContainerPlugin);
module.exports = StatsPlugin;
},{"container_plugin":"container_plugin","events":"events","zepto":"zepto"}],46:[function(require,module,exports){
"use strict";
module.exports = require('./watermark');
},{"./watermark":47}],47:[function(require,module,exports){
"use strict";
var UIContainerPlugin = require('ui_container_plugin');
var Styler = require('../../base/styler');
var JST = require('../../base/jst');
var Events = require('events');
var WaterMarkPlugin = function WaterMarkPlugin(options) {
$traceurRuntime.superCall(this, $WaterMarkPlugin.prototype, "constructor", [options]);
this.template = JST[this.name];
this.position = options.position || "bottom-right";
if (options.watermark) {
this.imageUrl = options.watermark;
this.render();
} else {
this.$el.remove();
}
};
var $WaterMarkPlugin = WaterMarkPlugin;
($traceurRuntime.createClass)(WaterMarkPlugin, {
get name() {
return 'watermark';
},
bindEvents: function() {
this.listenTo(this.container, Events.CONTAINER_PLAY, this.onPlay);
this.listenTo(this.container, Events.CONTAINER_STOP, this.onStop);
},
onPlay: function() {
if (!this.hidden)
this.$el.show();
},
onStop: function() {
this.$el.hide();
},
render: function() {
this.$el.hide();
var templateOptions = {
position: this.position,
imageUrl: this.imageUrl
};
this.$el.html(this.template(templateOptions));
var style = Styler.getStyleFor(this.name);
this.container.$el.append(style);
this.container.$el.append(this.$el);
return this;
}
}, {}, UIContainerPlugin);
module.exports = WaterMarkPlugin;
},{"../../base/jst":7,"../../base/styler":8,"events":"events","ui_container_plugin":"ui_container_plugin"}],"base_object":[function(require,module,exports){
"use strict";
var _ = require('underscore');
var extend = require('./utils').extend;
var Events = require('events');
var pluginOptions = ['container'];
var BaseObject = function BaseObject(options) {
this.uniqueId = _.uniqueId('o');
options || (options = {});
_.extend(this, _.pick(options, pluginOptions));
};
($traceurRuntime.createClass)(BaseObject, {}, {}, Events);
BaseObject.extend = extend;
module.exports = BaseObject;
},{"./utils":9,"events":"events","underscore":"underscore"}],"browser":[function(require,module,exports){
"use strict";
var Browser = function Browser() {};
($traceurRuntime.createClass)(Browser, {}, {});
var hasLocalstorage = function() {
try {
localStorage.setItem('clappr', 'clappr');
localStorage.removeItem('clappr');
return true;
} catch (e) {
return false;
}
};
Browser.isSafari = (!!navigator.userAgent.match(/safari/i) && navigator.userAgent.indexOf('Chrome') === -1);
Browser.isChrome = !!(navigator.userAgent.match(/chrome/i));
Browser.isFirefox = !!(navigator.userAgent.match(/firefox/i));
Browser.isLegacyIE = !!(window.ActiveXObject);
Browser.isIE = Browser.isLegacyIE || !!(navigator.userAgent.match(/trident.*rv:1\d/i));
Browser.isIE11 = !!(navigator.userAgent.match(/trident.*rv:11/i));
Browser.isMobile = !!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone|IEMobile|Opera Mini/i.test(navigator.userAgent));
Browser.isWin8App = !!(/MSAppHost/i.test(navigator.userAgent));
Browser.isWiiU = !!(/WiiU/i.test(navigator.userAgent));
Browser.isPS4 = !!(/PlayStation 4/i.test(navigator.userAgent));
Browser.hasLocalstorage = hasLocalstorage();
module.exports = Browser;
},{}],"container_plugin":[function(require,module,exports){
"use strict";
var BaseObject = require('base_object');
var ContainerPlugin = function ContainerPlugin(options) {
$traceurRuntime.superCall(this, $ContainerPlugin.prototype, "constructor", [options]);
this.bindEvents();
};
var $ContainerPlugin = ContainerPlugin;
($traceurRuntime.createClass)(ContainerPlugin, {
enable: function() {
this.bindEvents();
},
disable: function() {
this.stopListening();
},
bindEvents: function() {},
destroy: function() {
this.stopListening();
}
}, {}, BaseObject);
module.exports = ContainerPlugin;
},{"base_object":"base_object"}],"container":[function(require,module,exports){
"use strict";
module.exports = require('./container');
},{"./container":10}],"core_plugin":[function(require,module,exports){
"use strict";
var BaseObject = require('base_object');
var CorePlugin = function CorePlugin(core) {
$traceurRuntime.superCall(this, $CorePlugin.prototype, "constructor", [core]);
this.core = core;
};
var $CorePlugin = CorePlugin;
($traceurRuntime.createClass)(CorePlugin, {
getExternalInterface: function() {
return {};
},
destroy: function() {}
}, {}, BaseObject);
module.exports = CorePlugin;
},{"base_object":"base_object"}],"core":[function(require,module,exports){
"use strict";
module.exports = require('./core');
},{"./core":13}],"events":[function(require,module,exports){
"use strict";
var _ = require('underscore');
var Log = require('../plugins/log').getInstance();
var slice = Array.prototype.slice;
var Events = function Events() {};
($traceurRuntime.createClass)(Events, {
on: function(name, callback, context) {
if (!eventsApi(this, 'on', name, [callback, context]) || !callback)
return this;
this._events || (this._events = {});
var events = this._events[name] || (this._events[name] = []);
events.push({
callback: callback,
context: context,
ctx: context || this
});
return this;
},
once: function(name, callback, context) {
if (!eventsApi(this, 'once', name, [callback, context]) || !callback)
return this;
var self = this;
var once = _.once(function() {
self.off(name, once);
callback.apply(this, arguments);
});
once._callback = callback;
return this.on(name, once, context);
},
off: function(name, callback, context) {
var retain,
ev,
events,
names,
i,
l,
j,
k;
if (!this._events || !eventsApi(this, 'off', name, [callback, context]))
return this;
if (!name && !callback && !context) {
this._events = void 0;
return this;
}
names = name ? [name] : _.keys(this._events);
for (i = 0, l = names.length; i < l; i++) {
name = names[i];
events = this._events[name];
if (events) {
this._events[name] = retain = [];
if (callback || context) {
for (j = 0, k = events.length; j < k; j++) {
ev = events[j];
if ((callback && callback !== ev.callback && callback !== ev.callback._callback) || (context && context !== ev.context)) {
retain.push(ev);
}
}
}
if (!retain.length)
delete this._events[name];
}
}
return this;
},
trigger: function(name) {
var klass = arguments[arguments.length - 1];
Log.info(klass, name);
if (!this._events)
return this;
var args = slice.call(arguments, 1);
if (!eventsApi(this, 'trigger', name, args))
return this;
var events = this._events[name];
var allEvents = this._events.all;
if (events)
triggerEvents(events, args);
if (allEvents)
triggerEvents(allEvents, arguments);
return this;
},
stopListening: function(obj, name, callback) {
var listeningTo = this._listeningTo;
if (!listeningTo)
return this;
var remove = !name && !callback;
if (!callback && typeof name === 'object')
callback = this;
if (obj)
(listeningTo = {})[obj._listenId] = obj;
for (var id in listeningTo) {
obj = listeningTo[id];
obj.off(name, callback, this);
if (remove || _.isEmpty(obj._events))
delete this._listeningTo[id];
}
return this;
}
}, {});
var eventSplitter = /\s+/;
var eventsApi = function(obj, action, name, rest) {
if (!name)
return true;
if (typeof name === 'object') {
for (var key in name) {
obj[action].apply(obj, [key, name[key]].concat(rest));
}
return false;
}
if (eventSplitter.test(name)) {
var names = name.split(eventSplitter);
for (var i = 0,
l = names.length; i < l; i++) {
obj[action].apply(obj, [names[i]].concat(rest));
}
return false;
}
return true;
};
var triggerEvents = function(events, args) {
var ev,
i = -1,
l = events.length,
a1 = args[0],
a2 = args[1],
a3 = args[2];
switch (args.length) {
case 0:
while (++i < l)
(ev = events[i]).callback.call(ev.ctx);
return;
case 1:
while (++i < l)
(ev = events[i]).callback.call(ev.ctx, a1);
return;
case 2:
while (++i < l)
(ev = events[i]).callback.call(ev.ctx, a1, a2);
return;
case 3:
while (++i < l)
(ev = events[i]).callback.call(ev.ctx, a1, a2, a3);
return;
default:
while (++i < l)
(ev = events[i]).callback.apply(ev.ctx, args);
return;
}
};
var listenMethods = {
listenTo: 'on',
listenToOnce: 'once'
};
_.each(listenMethods, function(implementation, method) {
Events.prototype[method] = function(obj, name, callback) {
var listeningTo = this._listeningTo || (this._listeningTo = {});
var id = obj._listenId || (obj._listenId = _.uniqueId('l'));
listeningTo[id] = obj;
if (!callback && typeof name === 'object')
callback = this;
obj[implementation](name, callback, this);
return this;
};
});
Events.PLAYER_RESIZE = 'player:resize';
Events.PLAYBACK_PROGRESS = 'playback:progress';
Events.PLAYBACK_TIMEUPDATE = 'playback:timeupdate';
Events.PLAYBACK_READY = 'playback:ready';
Events.PLAYBACK_BUFFERING = 'playback:buffering';
Events.PLAYBACK_BUFFERFULL = 'playback:bufferfull';
Events.PLAYBACK_SETTINGSUPDATE = 'playback:settingsupdate';
Events.PLAYBACK_LOADEDMETADATA = 'playback:loadedmetadata';
Events.PLAYBACK_HIGHDEFINITIONUPDATE = 'playback:highdefinitionupdate';
Events.PLAYBACK_BITRATE = 'playback:bitrate';
Events.PLAYBACK_PLAYBACKSTATE = 'playback:playbackstate';
Events.PLAYBACK_DVR = 'playback:dvr';
Events.PLAYBACK_MEDIACONTROL_DISABLE = 'playback:mediacontrol:disable';
Events.PLAYBACK_MEDIACONTROL_ENABLE = 'playback:mediacontrol:enable';
Events.PLAYBACK_ENDED = 'playback:ended';
Events.PLAYBACK_PLAY = 'playback:play';
Events.PLAYBACK_ERROR = 'playback:error';
Events.PLAYBACK_STATS_ADD = 'playback:stats:add';
Events.CONTAINER_PLAYBACKSTATE = 'container:playbackstate';
Events.CONTAINER_PLAYBACKDVRSTATECHANGED = 'container:dvr';
Events.CONTAINER_BITRATE = 'container:bitrate';
Events.CONTAINER_STATS_REPORT = 'container:stats:report';
Events.CONTAINER_DESTROYED = 'container:destroyed';
Events.CONTAINER_READY = 'container:ready';
Events.CONTAINER_ERROR = 'container:error';
Events.CONTAINER_LOADEDMETADATA = 'container:loadedmetadata';
Events.CONTAINER_TIMEUPDATE = 'container:timeupdate';
Events.CONTAINER_PROGRESS = 'container:progress';
Events.CONTAINER_PLAY = 'container:play';
Events.CONTAINER_STOP = 'container:stop';
Events.CONTAINER_PAUSE = 'container:pause';
Events.CONTAINER_ENDED = 'container:ended';
Events.CONTAINER_CLICK = 'container:click';
Events.CONTAINER_SEEK = 'container:seek';
Events.CONTAINER_VOLUME = 'container:volume';
Events.CONTAINER_FULLSCREEN = 'container:fullscreen';
Events.CONTAINER_STATE_BUFFERING = 'container:state:buffering';
Events.CONTAINER_STATE_BUFFERFULL = 'container:state:bufferfull';
Events.CONTAINER_SETTINGSUPDATE = 'container:settingsupdate';
Events.CONTAINER_HIGHDEFINITIONUPDATE = 'container:highdefinitionupdate';
Events.CONTAINER_MEDIACONTROL_DISABLE = 'container:mediacontrol:disable';
Events.CONTAINER_MEDIACONTROL_ENABLE = 'container:mediacontrol:enable';
Events.CONTAINER_STATS_ADD = 'container:stats:add';
Events.MEDIACONTROL_RENDERED = 'mediacontrol:rendered';
Events.MEDIACONTROL_FULLSCREEN = 'mediacontrol:fullscreen';
Events.MEDIACONTROL_SHOW = 'mediacontrol:show';
Events.MEDIACONTROL_HIDE = 'mediacontrol:hide';
Events.MEDIACONTROL_MOUSEMOVE_SEEKBAR = 'mediacontrol:mousemove:seekbar';
Events.MEDIACONTROL_MOUSELEAVE_SEEKBAR = 'mediacontrol:mouseleave:seekbar';
Events.MEDIACONTROL_PLAYING = 'mediacontrol:playing';
Events.MEDIACONTROL_NOTPLAYING = 'mediacontrol:notplaying';
Events.MEDIACONTROL_CONTAINERCHANGED = 'mediacontrol:containerchanged';
module.exports = Events;
},{"../plugins/log":39,"underscore":"underscore"}],"flash":[function(require,module,exports){
"use strict";
module.exports = require('./flash');
},{"./flash":24}],"hls":[function(require,module,exports){
"use strict";
module.exports = require('./hls');
},{"./hls":25}],"html5_audio":[function(require,module,exports){
"use strict";
module.exports = require('./html5_audio');
},{"./html5_audio":26}],"html5_video":[function(require,module,exports){
"use strict";
module.exports = require('./html5_video');
},{"./html5_video":27}],"html_img":[function(require,module,exports){
"use strict";
module.exports = require('./html_img');
},{"./html_img":28}],"media_control":[function(require,module,exports){
"use strict";
module.exports = require('./media_control');
},{"./media_control":20}],"mediator":[function(require,module,exports){
"use strict";
var Events = require('events');
var events = new Events();
var Mediator = function Mediator() {};
($traceurRuntime.createClass)(Mediator, {}, {});
Mediator.on = function(name, callback, context) {
events.on(name, callback, context);
return;
};
Mediator.once = function(name, callback, context) {
events.once(name, callback, context);
return;
};
Mediator.off = function(name, callback, context) {
events.off(name, callback, context);
return;
};
Mediator.trigger = function(name, opts) {
events.trigger(name, opts);
return;
};
Mediator.stopListening = function(obj, name, callback) {
events.stopListening(obj, name, callback);
return;
};
module.exports = Mediator;
},{"events":"events"}],"playback":[function(require,module,exports){
"use strict";
var UIObject = require('ui_object');
var Playback = function Playback(options) {
$traceurRuntime.superCall(this, $Playback.prototype, "constructor", [options]);
this.settings = {};
};
var $Playback = Playback;
($traceurRuntime.createClass)(Playback, {
play: function() {},
pause: function() {},
stop: function() {},
seek: function(time) {},
getDuration: function() {
return 0;
},
isPlaying: function() {
return false;
},
getPlaybackType: function() {
return 'no_op';
},
isHighDefinitionInUse: function() {
return false;
},
volume: function(value) {},
destroy: function() {
this.$el.remove();
}
}, {}, UIObject);
Playback.canPlay = (function(source) {
return false;
});
module.exports = Playback;
},{"ui_object":"ui_object"}],"player_info":[function(require,module,exports){
"use strict";
var PlayerInfo = {
options: {},
playbackPlugins: [],
currentSize: {
width: 0,
height: 0
}
};
module.exports = PlayerInfo;
},{}],"poster":[function(require,module,exports){
"use strict";
module.exports = require('./poster');
},{"./poster":41}],"ui_container_plugin":[function(require,module,exports){
"use strict";
var UIObject = require('ui_object');
var UIContainerPlugin = function UIContainerPlugin(options) {
$traceurRuntime.superCall(this, $UIContainerPlugin.prototype, "constructor", [options]);
this.enabled = true;
this.bindEvents();
};
var $UIContainerPlugin = UIContainerPlugin;
($traceurRuntime.createClass)(UIContainerPlugin, {
enable: function() {
this.bindEvents();
this.$el.show();
this.enabled = true;
},
disable: function() {
this.stopListening();
this.$el.hide();
this.enabled = false;
},
bindEvents: function() {},
destroy: function() {
this.remove();
}
}, {}, UIObject);
module.exports = UIContainerPlugin;
},{"ui_object":"ui_object"}],"ui_core_plugin":[function(require,module,exports){
"use strict";
var UIObject = require('ui_object');
var UICorePlugin = function UICorePlugin(core) {
$traceurRuntime.superCall(this, $UICorePlugin.prototype, "constructor", [core]);
this.core = core;
this.enabled = true;
this.bindEvents();
this.render();
};
var $UICorePlugin = UICorePlugin;
($traceurRuntime.createClass)(UICorePlugin, {
bindEvents: function() {},
getExternalInterface: function() {
return {};
},
enable: function() {
this.bindEvents();
this.$el.show();
this.enabled = true;
},
disable: function() {
this.stopListening();
this.$el.hide();
this.enabled = false;
},
destroy: function() {
this.remove();
},
render: function() {
this.$el.html(this.template());
this.$el.append(this.styler.getStyleFor(this.name));
this.core.$el.append(this.el);
return this;
}
}, {}, UIObject);
module.exports = UICorePlugin;
},{"ui_object":"ui_object"}],"ui_object":[function(require,module,exports){
"use strict";
var $ = require('zepto');
var _ = require('underscore');
var extend = require('./utils').extend;
var BaseObject = require('base_object');
var delegateEventSplitter = /^(\S+)\s*(.*)$/;
var UIObject = function UIObject(options) {
$traceurRuntime.superCall(this, $UIObject.prototype, "constructor", [options]);
this.cid = _.uniqueId('c');
this._ensureElement();
this.delegateEvents();
};
var $UIObject = UIObject;
($traceurRuntime.createClass)(UIObject, {
get tagName() {
return 'div';
},
$: function(selector) {
return this.$el.find(selector);
},
render: function() {
return this;
},
remove: function() {
this.$el.remove();
this.stopListening();
return this;
},
setElement: function(element, delegate) {
if (this.$el)
this.undelegateEvents();
this.$el = element instanceof $ ? element : $(element);
this.el = this.$el[0];
if (delegate !== false)
this.delegateEvents();
return this;
},
delegateEvents: function(events) {
if (!(events || (events = _.result(this, 'events'))))
return this;
this.undelegateEvents();
for (var key in events) {
var method = events[key];
if (!_.isFunction(method))
method = this[events[key]];
if (!method)
continue;
var match = key.match(delegateEventSplitter);
var eventName = match[1],
selector = match[2];
method = _.bind(method, this);
eventName += '.delegateEvents' + this.cid;
if (selector === '') {
this.$el.on(eventName, method);
} else {
this.$el.on(eventName, selector, method);
}
}
return this;
},
undelegateEvents: function() {
this.$el.off('.delegateEvents' + this.cid);
return this;
},
_ensureElement: function() {
if (!this.el) {
var attrs = _.extend({}, _.result(this, 'attributes'));
if (this.id)
attrs.id = _.result(this, 'id');
if (this.className)
attrs['class'] = _.result(this, 'className');
var $el = $('<' + _.result(this, 'tagName') + '>').attr(attrs);
this.setElement($el, false);
} else {
this.setElement(_.result(this, 'el'), false);
}
}
}, {}, BaseObject);
UIObject.extend = extend;
module.exports = UIObject;
},{"./utils":9,"base_object":"base_object","underscore":"underscore","zepto":"zepto"}],"underscore":[function(require,module,exports){
// Underscore.js 1.7.0
// http://underscorejs.org
// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
(function() {
// Baseline setup
// --------------
// Establish the root object, `window` in the browser, or `exports` on the server.
var root = this;
// Save the previous value of the `_` variable.
var previousUnderscore = root._;
// Save bytes in the minified (but not gzipped) version:
var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
// Create quick reference variables for speed access to core prototypes.
var
push = ArrayProto.push,
slice = ArrayProto.slice,
concat = ArrayProto.concat,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty;
// All **ECMAScript 5** native function implementations that we hope to use
// are declared here.
var
nativeIsArray = Array.isArray,
nativeKeys = Object.keys,
nativeBind = FuncProto.bind;
// Create a safe reference to the Underscore object for use below.
var _ = function(obj) {
if (obj instanceof _) return obj;
if (!(this instanceof _)) return new _(obj);
this._wrapped = obj;
};
// Export the Underscore object for **Node.js**, with
// backwards-compatibility for the old `require()` API. If we're in
// the browser, add `_` as a global object.
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = _;
}
exports._ = _;
} else {
root._ = _;
}
// Current version.
_.VERSION = '1.7.0';
// Internal function that returns an efficient (for current engines) version
// of the passed-in callback, to be repeatedly applied in other Underscore
// functions.
var createCallback = function(func, context, argCount) {
if (context === void 0) return func;
switch (argCount == null ? 3 : argCount) {
case 1: return function(value) {
return func.call(context, value);
};
case 2: return function(value, other) {
return func.call(context, value, other);
};
case 3: return function(value, index, collection) {
return func.call(context, value, index, collection);
};
case 4: return function(accumulator, value, index, collection) {
return func.call(context, accumulator, value, index, collection);
};
}
return function() {
return func.apply(context, arguments);
};
};
// A mostly-internal function to generate callbacks that can be applied
// to each element in a collection, returning the desired result — either
// identity, an arbitrary callback, a property matcher, or a property accessor.
_.iteratee = function(value, context, argCount) {
if (value == null) return _.identity;
if (_.isFunction(value)) return createCallback(value, context, argCount);
if (_.isObject(value)) return _.matches(value);
return _.property(value);
};
// Collection Functions
// --------------------
// The cornerstone, an `each` implementation, aka `forEach`.
// Handles raw objects in addition to array-likes. Treats all
// sparse array-likes as if they were dense.
_.each = _.forEach = function(obj, iteratee, context) {
if (obj == null) return obj;
iteratee = createCallback(iteratee, context);
var i, length = obj.length;
if (length === +length) {
for (i = 0; i < length; i++) {
iteratee(obj[i], i, obj);
}
} else {
var keys = _.keys(obj);
for (i = 0, length = keys.length; i < length; i++) {
iteratee(obj[keys[i]], keys[i], obj);
}
}
return obj;
};
// Return the results of applying the iteratee to each element.
_.map = _.collect = function(obj, iteratee, context) {
if (obj == null) return [];
iteratee = _.iteratee(iteratee, context);
var keys = obj.length !== +obj.length && _.keys(obj),
length = (keys || obj).length,
results = Array(length),
currentKey;
for (var index = 0; index < length; index++) {
currentKey = keys ? keys[index] : index;
results[index] = iteratee(obj[currentKey], currentKey, obj);
}
return results;
};
var reduceError = 'Reduce of empty array with no initial value';
// **Reduce** builds up a single result from a list of values, aka `inject`,
// or `foldl`.
_.reduce = _.foldl = _.inject = function(obj, iteratee, memo, context) {
if (obj == null) obj = [];
iteratee = createCallback(iteratee, context, 4);
var keys = obj.length !== +obj.length && _.keys(obj),
length = (keys || obj).length,
index = 0, currentKey;
if (arguments.length < 3) {
if (!length) throw new TypeError(reduceError);
memo = obj[keys ? keys[index++] : index++];
}
for (; index < length; index++) {
currentKey = keys ? keys[index] : index;
memo = iteratee(memo, obj[currentKey], currentKey, obj);
}
return memo;
};
// The right-associative version of reduce, also known as `foldr`.
_.reduceRight = _.foldr = function(obj, iteratee, memo, context) {
if (obj == null) obj = [];
iteratee = createCallback(iteratee, context, 4);
var keys = obj.length !== + obj.length && _.keys(obj),
index = (keys || obj).length,
currentKey;
if (arguments.length < 3) {
if (!index) throw new TypeError(reduceError);
memo = obj[keys ? keys[--index] : --index];
}
while (index--) {
currentKey = keys ? keys[index] : index;
memo = iteratee(memo, obj[currentKey], currentKey, obj);
}
return memo;
};
// Return the first value which passes a truth test. Aliased as `detect`.
_.find = _.detect = function(obj, predicate, context) {
var result;
predicate = _.iteratee(predicate, context);
_.some(obj, function(value, index, list) {
if (predicate(value, index, list)) {
result = value;
return true;
}
});
return result;
};
// Return all the elements that pass a truth test.
// Aliased as `select`.
_.filter = _.select = function(obj, predicate, context) {
var results = [];
if (obj == null) return results;
predicate = _.iteratee(predicate, context);
_.each(obj, function(value, index, list) {
if (predicate(value, index, list)) results.push(value);
});
return results;
};
// Return all the elements for which a truth test fails.
_.reject = function(obj, predicate, context) {
return _.filter(obj, _.negate(_.iteratee(predicate)), context);
};
// Determine whether all of the elements match a truth test.
// Aliased as `all`.
_.every = _.all = function(obj, predicate, context) {
if (obj == null) return true;
predicate = _.iteratee(predicate, context);
var keys = obj.length !== +obj.length && _.keys(obj),
length = (keys || obj).length,
index, currentKey;
for (index = 0; index < length; index++) {
currentKey = keys ? keys[index] : index;
if (!predicate(obj[currentKey], currentKey, obj)) return false;
}
return true;
};
// Determine if at least one element in the object matches a truth test.
// Aliased as `any`.
_.some = _.any = function(obj, predicate, context) {
if (obj == null) return false;
predicate = _.iteratee(predicate, context);
var keys = obj.length !== +obj.length && _.keys(obj),
length = (keys || obj).length,
index, currentKey;
for (index = 0; index < length; index++) {
currentKey = keys ? keys[index] : index;
if (predicate(obj[currentKey], currentKey, obj)) return true;
}
return false;
};
// Determine if the array or object contains a given value (using `===`).
// Aliased as `include`.
_.contains = _.include = function(obj, target) {
if (obj == null) return false;
if (obj.length !== +obj.length) obj = _.values(obj);
return _.indexOf(obj, target) >= 0;
};
// Invoke a method (with arguments) on every item in a collection.
_.invoke = function(obj, method) {
var args = slice.call(arguments, 2);
var isFunc = _.isFunction(method);
return _.map(obj, function(value) {
return (isFunc ? method : value[method]).apply(value, args);
});
};
// Convenience version of a common use case of `map`: fetching a property.
_.pluck = function(obj, key) {
return _.map(obj, _.property(key));
};
// Convenience version of a common use case of `filter`: selecting only objects
// containing specific `key:value` pairs.
_.where = function(obj, attrs) {
return _.filter(obj, _.matches(attrs));
};
// Convenience version of a common use case of `find`: getting the first object
// containing specific `key:value` pairs.
_.findWhere = function(obj, attrs) {
return _.find(obj, _.matches(attrs));
};
// Return the maximum element (or element-based computation).
_.max = function(obj, iteratee, context) {
var result = -Infinity, lastComputed = -Infinity,
value, computed;
if (iteratee == null && obj != null) {
obj = obj.length === +obj.length ? obj : _.values(obj);
for (var i = 0, length = obj.length; i < length; i++) {
value = obj[i];
if (value > result) {
result = value;
}
}
} else {
iteratee = _.iteratee(iteratee, context);
_.each(obj, function(value, index, list) {
computed = iteratee(value, index, list);
if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
result = value;
lastComputed = computed;
}
});
}
return result;
};
// Return the minimum element (or element-based computation).
_.min = function(obj, iteratee, context) {
var result = Infinity, lastComputed = Infinity,
value, computed;
if (iteratee == null && obj != null) {
obj = obj.length === +obj.length ? obj : _.values(obj);
for (var i = 0, length = obj.length; i < length; i++) {
value = obj[i];
if (value < result) {
result = value;
}
}
} else {
iteratee = _.iteratee(iteratee, context);
_.each(obj, function(value, index, list) {
computed = iteratee(value, index, list);
if (computed < lastComputed || computed === Infinity && result === Infinity) {
result = value;
lastComputed = computed;
}
});
}
return result;
};
// Shuffle a collection, using the modern version of the
// [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
_.shuffle = function(obj) {
var set = obj && obj.length === +obj.length ? obj : _.values(obj);
var length = set.length;
var shuffled = Array(length);
for (var index = 0, rand; index < length; index++) {
rand = _.random(0, index);
if (rand !== index) shuffled[index] = shuffled[rand];
shuffled[rand] = set[index];
}
return shuffled;
};
// Sample **n** random values from a collection.
// If **n** is not specified, returns a single random element.
// The internal `guard` argument allows it to work with `map`.
_.sample = function(obj, n, guard) {
if (n == null || guard) {
if (obj.length !== +obj.length) obj = _.values(obj);
return obj[_.random(obj.length - 1)];
}
return _.shuffle(obj).slice(0, Math.max(0, n));
};
// Sort the object's values by a criterion produced by an iteratee.
_.sortBy = function(obj, iteratee, context) {
iteratee = _.iteratee(iteratee, context);
return _.pluck(_.map(obj, function(value, index, list) {
return {
value: value,
index: index,
criteria: iteratee(value, index, list)
};
}).sort(function(left, right) {
var a = left.criteria;
var b = right.criteria;
if (a !== b) {
if (a > b || a === void 0) return 1;
if (a < b || b === void 0) return -1;
}
return left.index - right.index;
}), 'value');
};
// An internal function used for aggregate "group by" operations.
var group = function(behavior) {
return function(obj, iteratee, context) {
var result = {};
iteratee = _.iteratee(iteratee, context);
_.each(obj, function(value, index) {
var key = iteratee(value, index, obj);
behavior(result, value, key);
});
return result;
};
};
// Groups the object's values by a criterion. Pass either a string attribute
// to group by, or a function that returns the criterion.
_.groupBy = group(function(result, value, key) {
if (_.has(result, key)) result[key].push(value); else result[key] = [value];
});
// Indexes the object's values by a criterion, similar to `groupBy`, but for
// when you know that your index values will be unique.
_.indexBy = group(function(result, value, key) {
result[key] = value;
});
// Counts instances of an object that group by a certain criterion. Pass
// either a string attribute to count by, or a function that returns the
// criterion.
_.countBy = group(function(result, value, key) {
if (_.has(result, key)) result[key]++; else result[key] = 1;
});
// Use a comparator function to figure out the smallest index at which
// an object should be inserted so as to maintain order. Uses binary search.
_.sortedIndex = function(array, obj, iteratee, context) {
iteratee = _.iteratee(iteratee, context, 1);
var value = iteratee(obj);
var low = 0, high = array.length;
while (low < high) {
var mid = low + high >>> 1;
if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
}
return low;
};
// Safely create a real, live array from anything iterable.
_.toArray = function(obj) {
if (!obj) return [];
if (_.isArray(obj)) return slice.call(obj);
if (obj.length === +obj.length) return _.map(obj, _.identity);
return _.values(obj);
};
// Return the number of elements in an object.
_.size = function(obj) {
if (obj == null) return 0;
return obj.length === +obj.length ? obj.length : _.keys(obj).length;
};
// Split a collection into two arrays: one whose elements all satisfy the given
// predicate, and one whose elements all do not satisfy the predicate.
_.partition = function(obj, predicate, context) {
predicate = _.iteratee(predicate, context);
var pass = [], fail = [];
_.each(obj, function(value, key, obj) {
(predicate(value, key, obj) ? pass : fail).push(value);
});
return [pass, fail];
};
// Array Functions
// ---------------
// Get the first element of an array. Passing **n** will return the first N
// values in the array. Aliased as `head` and `take`. The **guard** check
// allows it to work with `_.map`.
_.first = _.head = _.take = function(array, n, guard) {
if (array == null) return void 0;
if (n == null || guard) return array[0];
if (n < 0) return [];
return slice.call(array, 0, n);
};
// Returns everything but the last entry of the array. Especially useful on
// the arguments object. Passing **n** will return all the values in
// the array, excluding the last N. The **guard** check allows it to work with
// `_.map`.
_.initial = function(array, n, guard) {
return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
};
// Get the last element of an array. Passing **n** will return the last N
// values in the array. The **guard** check allows it to work with `_.map`.
_.last = function(array, n, guard) {
if (array == null) return void 0;
if (n == null || guard) return array[array.length - 1];
return slice.call(array, Math.max(array.length - n, 0));
};
// Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
// Especially useful on the arguments object. Passing an **n** will return
// the rest N values in the array. The **guard**
// check allows it to work with `_.map`.
_.rest = _.tail = _.drop = function(array, n, guard) {
return slice.call(array, n == null || guard ? 1 : n);
};
// Trim out all falsy values from an array.
_.compact = function(array) {
return _.filter(array, _.identity);
};
// Internal implementation of a recursive `flatten` function.
var flatten = function(input, shallow, strict, output) {
if (shallow && _.every(input, _.isArray)) {
return concat.apply(output, input);
}
for (var i = 0, length = input.length; i < length; i++) {
var value = input[i];
if (!_.isArray(value) && !_.isArguments(value)) {
if (!strict) output.push(value);
} else if (shallow) {
push.apply(output, value);
} else {
flatten(value, shallow, strict, output);
}
}
return output;
};
// Flatten out an array, either recursively (by default), or just one level.
_.flatten = function(array, shallow) {
return flatten(array, shallow, false, []);
};
// Return a version of the array that does not contain the specified value(s).
_.without = function(array) {
return _.difference(array, slice.call(arguments, 1));
};
// Produce a duplicate-free version of the array. If the array has already
// been sorted, you have the option of using a faster algorithm.
// Aliased as `unique`.
_.uniq = _.unique = function(array, isSorted, iteratee, context) {
if (array == null) return [];
if (!_.isBoolean(isSorted)) {
context = iteratee;
iteratee = isSorted;
isSorted = false;
}
if (iteratee != null) iteratee = _.iteratee(iteratee, context);
var result = [];
var seen = [];
for (var i = 0, length = array.length; i < length; i++) {
var value = array[i];
if (isSorted) {
if (!i || seen !== value) result.push(value);
seen = value;
} else if (iteratee) {
var computed = iteratee(value, i, array);
if (_.indexOf(seen, computed) < 0) {
seen.push(computed);
result.push(value);
}
} else if (_.indexOf(result, value) < 0) {
result.push(value);
}
}
return result;
};
// Produce an array that contains the union: each distinct element from all of
// the passed-in arrays.
_.union = function() {
return _.uniq(flatten(arguments, true, true, []));
};
// Produce an array that contains every item shared between all the
// passed-in arrays.
_.intersection = function(array) {
if (array == null) return [];
var result = [];
var argsLength = arguments.length;
for (var i = 0, length = array.length; i < length; i++) {
var item = array[i];
if (_.contains(result, item)) continue;
for (var j = 1; j < argsLength; j++) {
if (!_.contains(arguments[j], item)) break;
}
if (j === argsLength) result.push(item);
}
return result;
};
// Take the difference between one array and a number of other arrays.
// Only the elements present in just the first array will remain.
_.difference = function(array) {
var rest = flatten(slice.call(arguments, 1), true, true, []);
return _.filter(array, function(value){
return !_.contains(rest, value);
});
};
// Zip together multiple lists into a single array -- elements that share
// an index go together.
_.zip = function(array) {
if (array == null) return [];
var length = _.max(arguments, 'length').length;
var results = Array(length);
for (var i = 0; i < length; i++) {
results[i] = _.pluck(arguments, i);
}
return results;
};
// Converts lists into objects. Pass either a single array of `[key, value]`
// pairs, or two parallel arrays of the same length -- one of keys, and one of
// the corresponding values.
_.object = function(list, values) {
if (list == null) return {};
var result = {};
for (var i = 0, length = list.length; i < length; i++) {
if (values) {
result[list[i]] = values[i];
} else {
result[list[i][0]] = list[i][1];
}
}
return result;
};
// Return the position of the first occurrence of an item in an array,
// or -1 if the item is not included in the array.
// If the array is large and already in sort order, pass `true`
// for **isSorted** to use binary search.
_.indexOf = function(array, item, isSorted) {
if (array == null) return -1;
var i = 0, length = array.length;
if (isSorted) {
if (typeof isSorted == 'number') {
i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted;
} else {
i = _.sortedIndex(array, item);
return array[i] === item ? i : -1;
}
}
for (; i < length; i++) if (array[i] === item) return i;
return -1;
};
_.lastIndexOf = function(array, item, from) {
if (array == null) return -1;
var idx = array.length;
if (typeof from == 'number') {
idx = from < 0 ? idx + from + 1 : Math.min(idx, from + 1);
}
while (--idx >= 0) if (array[idx] === item) return idx;
return -1;
};
// Generate an integer Array containing an arithmetic progression. A port of
// the native Python `range()` function. See
// [the Python documentation](http://docs.python.org/library/functions.html#range).
_.range = function(start, stop, step) {
if (arguments.length <= 1) {
stop = start || 0;
start = 0;
}
step = step || 1;
var length = Math.max(Math.ceil((stop - start) / step), 0);
var range = Array(length);
for (var idx = 0; idx < length; idx++, start += step) {
range[idx] = start;
}
return range;
};
// Function (ahem) Functions
// ------------------
// Reusable constructor function for prototype setting.
var Ctor = function(){};
// Create a function bound to a given object (assigning `this`, and arguments,
// optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
// available.
_.bind = function(func, context) {
var args, bound;
if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');
args = slice.call(arguments, 2);
bound = function() {
if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
Ctor.prototype = func.prototype;
var self = new Ctor;
Ctor.prototype = null;
var result = func.apply(self, args.concat(slice.call(arguments)));
if (_.isObject(result)) return result;
return self;
};
return bound;
};
// Partially apply a function by creating a version that has had some of its
// arguments pre-filled, without changing its dynamic `this` context. _ acts
// as a placeholder, allowing any combination of arguments to be pre-filled.
_.partial = function(func) {
var boundArgs = slice.call(arguments, 1);
return function() {
var position = 0;
var args = boundArgs.slice();
for (var i = 0, length = args.length; i < length; i++) {
if (args[i] === _) args[i] = arguments[position++];
}
while (position < arguments.length) args.push(arguments[position++]);
return func.apply(this, args);
};
};
// Bind a number of an object's methods to that object. Remaining arguments
// are the method names to be bound. Useful for ensuring that all callbacks
// defined on an object belong to it.
_.bindAll = function(obj) {
var i, length = arguments.length, key;
if (length <= 1) throw new Error('bindAll must be passed function names');
for (i = 1; i < length; i++) {
key = arguments[i];
obj[key] = _.bind(obj[key], obj);
}
return obj;
};
// Memoize an expensive function by storing its results.
_.memoize = function(func, hasher) {
var memoize = function(key) {
var cache = memoize.cache;
var address = hasher ? hasher.apply(this, arguments) : key;
if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);
return cache[address];
};
memoize.cache = {};
return memoize;
};
// Delays a function for the given number of milliseconds, and then calls
// it with the arguments supplied.
_.delay = function(func, wait) {
var args = slice.call(arguments, 2);
return setTimeout(function(){
return func.apply(null, args);
}, wait);
};
// Defers a function, scheduling it to run after the current call stack has
// cleared.
_.defer = function(func) {
return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
};
// Returns a function, that, when invoked, will only be triggered at most once
// during a given window of time. Normally, the throttled function will run
// as much as it can, without ever going more than once per `wait` duration;
// but if you'd like to disable the execution on the leading edge, pass
// `{leading: false}`. To disable execution on the trailing edge, ditto.
_.throttle = function(func, wait, options) {
var context, args, result;
var timeout = null;
var previous = 0;
if (!options) options = {};
var later = function() {
previous = options.leading === false ? 0 : _.now();
timeout = null;
result = func.apply(context, args);
if (!timeout) context = args = null;
};
return function() {
var now = _.now();
if (!previous && options.leading === false) previous = now;
var remaining = wait - (now - previous);
context = this;
args = arguments;
if (remaining <= 0 || remaining > wait) {
clearTimeout(timeout);
timeout = null;
previous = now;
result = func.apply(context, args);
if (!timeout) context = args = null;
} else if (!timeout && options.trailing !== false) {
timeout = setTimeout(later, remaining);
}
return result;
};
};
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
_.debounce = function(func, wait, immediate) {
var timeout, args, context, timestamp, result;
var later = function() {
var last = _.now() - timestamp;
if (last < wait && last > 0) {
timeout = setTimeout(later, wait - last);
} else {
timeout = null;
if (!immediate) {
result = func.apply(context, args);
if (!timeout) context = args = null;
}
}
};
return function() {
context = this;
args = arguments;
timestamp = _.now();
var callNow = immediate && !timeout;
if (!timeout) timeout = setTimeout(later, wait);
if (callNow) {
result = func.apply(context, args);
context = args = null;
}
return result;
};
};
// Returns the first function passed as an argument to the second,
// allowing you to adjust arguments, run code before and after, and
// conditionally execute the original function.
_.wrap = function(func, wrapper) {
return _.partial(wrapper, func);
};
// Returns a negated version of the passed-in predicate.
_.negate = function(predicate) {
return function() {
return !predicate.apply(this, arguments);
};
};
// Returns a function that is the composition of a list of functions, each
// consuming the return value of the function that follows.
_.compose = function() {
var args = arguments;
var start = args.length - 1;
return function() {
var i = start;
var result = args[start].apply(this, arguments);
while (i--) result = args[i].call(this, result);
return result;
};
};
// Returns a function that will only be executed after being called N times.
_.after = function(times, func) {
return function() {
if (--times < 1) {
return func.apply(this, arguments);
}
};
};
// Returns a function that will only be executed before being called N times.
_.before = function(times, func) {
var memo;
return function() {
if (--times > 0) {
memo = func.apply(this, arguments);
} else {
func = null;
}
return memo;
};
};
// Returns a function that will be executed at most one time, no matter how
// often you call it. Useful for lazy initialization.
_.once = _.partial(_.before, 2);
// Object Functions
// ----------------
// Retrieve the names of an object's properties.
// Delegates to **ECMAScript 5**'s native `Object.keys`
_.keys = function(obj) {
if (!_.isObject(obj)) return [];
if (nativeKeys) return nativeKeys(obj);
var keys = [];
for (var key in obj) if (_.has(obj, key)) keys.push(key);
return keys;
};
// Retrieve the values of an object's properties.
_.values = function(obj) {
var keys = _.keys(obj);
var length = keys.length;
var values = Array(length);
for (var i = 0; i < length; i++) {
values[i] = obj[keys[i]];
}
return values;
};
// Convert an object into a list of `[key, value]` pairs.
_.pairs = function(obj) {
var keys = _.keys(obj);
var length = keys.length;
var pairs = Array(length);
for (var i = 0; i < length; i++) {
pairs[i] = [keys[i], obj[keys[i]]];
}
return pairs;
};
// Invert the keys and values of an object. The values must be serializable.
_.invert = function(obj) {
var result = {};
var keys = _.keys(obj);
for (var i = 0, length = keys.length; i < length; i++) {
result[obj[keys[i]]] = keys[i];
}
return result;
};
// Return a sorted list of the function names available on the object.
// Aliased as `methods`
_.functions = _.methods = function(obj) {
var names = [];
for (var key in obj) {
if (_.isFunction(obj[key])) names.push(key);
}
return names.sort();
};
// Extend a given object with all the properties in passed-in object(s).
_.extend = function(obj) {
if (!_.isObject(obj)) return obj;
var source, prop;
for (var i = 1, length = arguments.length; i < length; i++) {
source = arguments[i];
for (prop in source) {
if (hasOwnProperty.call(source, prop)) {
obj[prop] = source[prop];
}
}
}
return obj;
};
// Return a copy of the object only containing the whitelisted properties.
_.pick = function(obj, iteratee, context) {
var result = {}, key;
if (obj == null) return result;
if (_.isFunction(iteratee)) {
iteratee = createCallback(iteratee, context);
for (key in obj) {
var value = obj[key];
if (iteratee(value, key, obj)) result[key] = value;
}
} else {
var keys = concat.apply([], slice.call(arguments, 1));
obj = new Object(obj);
for (var i = 0, length = keys.length; i < length; i++) {
key = keys[i];
if (key in obj) result[key] = obj[key];
}
}
return result;
};
// Return a copy of the object without the blacklisted properties.
_.omit = function(obj, iteratee, context) {
if (_.isFunction(iteratee)) {
iteratee = _.negate(iteratee);
} else {
var keys = _.map(concat.apply([], slice.call(arguments, 1)), String);
iteratee = function(value, key) {
return !_.contains(keys, key);
};
}
return _.pick(obj, iteratee, context);
};
// Fill in a given object with default properties.
_.defaults = function(obj) {
if (!_.isObject(obj)) return obj;
for (var i = 1, length = arguments.length; i < length; i++) {
var source = arguments[i];
for (var prop in source) {
if (obj[prop] === void 0) obj[prop] = source[prop];
}
}
return obj;
};
// Create a (shallow-cloned) duplicate of an object.
_.clone = function(obj) {
if (!_.isObject(obj)) return obj;
return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
};
// Invokes interceptor with the obj, and then returns obj.
// The primary purpose of this method is to "tap into" a method chain, in
// order to perform operations on intermediate results within the chain.
_.tap = function(obj, interceptor) {
interceptor(obj);
return obj;
};
// Internal recursive comparison function for `isEqual`.
var eq = function(a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
if (a === b) return a !== 0 || 1 / a === 1 / b;
// A strict comparison is necessary because `null == undefined`.
if (a == null || b == null) return a === b;
// Unwrap any wrapped objects.
if (a instanceof _) a = a._wrapped;
if (b instanceof _) b = b._wrapped;
// Compare `[[Class]]` names.
var className = toString.call(a);
if (className !== toString.call(b)) return false;
switch (className) {
// Strings, numbers, regular expressions, dates, and booleans are compared by value.
case '[object RegExp]':
// RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
case '[object String]':
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return '' + a === '' + b;
case '[object Number]':
// `NaN`s are equivalent, but non-reflexive.
// Object(NaN) is equivalent to NaN
if (+a !== +a) return +b !== +b;
// An `egal` comparison is performed for other numeric values.
return +a === 0 ? 1 / +a === 1 / b : +a === +b;
case '[object Date]':
case '[object Boolean]':
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return +a === +b;
}
if (typeof a != 'object' || typeof b != 'object') return false;
// Assume equality for cyclic structures. The algorithm for detecting cyclic
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
var length = aStack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
if (aStack[length] === a) return bStack[length] === b;
}
// Objects with different constructors are not equivalent, but `Object`s
// from different frames are.
var aCtor = a.constructor, bCtor = b.constructor;
if (
aCtor !== bCtor &&
// Handle Object.create(x) cases
'constructor' in a && 'constructor' in b &&
!(_.isFunction(aCtor) && aCtor instanceof aCtor &&
_.isFunction(bCtor) && bCtor instanceof bCtor)
) {
return false;
}
// Add the first object to the stack of traversed objects.
aStack.push(a);
bStack.push(b);
var size, result;
// Recursively compare objects and arrays.
if (className === '[object Array]') {
// Compare array lengths to determine if a deep comparison is necessary.
size = a.length;
result = size === b.length;
if (result) {
// Deep compare the contents, ignoring non-numeric properties.
while (size--) {
if (!(result = eq(a[size], b[size], aStack, bStack))) break;
}
}
} else {
// Deep compare objects.
var keys = _.keys(a), key;
size = keys.length;
// Ensure that both objects contain the same number of properties before comparing deep equality.
result = _.keys(b).length === size;
if (result) {
while (size--) {
// Deep compare each member
key = keys[size];
if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break;
}
}
}
// Remove the first object from the stack of traversed objects.
aStack.pop();
bStack.pop();
return result;
};
// Perform a deep comparison to check if two objects are equal.
_.isEqual = function(a, b) {
return eq(a, b, [], []);
};
// Is a given array, string, or object empty?
// An "empty" object has no enumerable own-properties.
_.isEmpty = function(obj) {
if (obj == null) return true;
if (_.isArray(obj) || _.isString(obj) || _.isArguments(obj)) return obj.length === 0;
for (var key in obj) if (_.has(obj, key)) return false;
return true;
};
// Is a given value a DOM element?
_.isElement = function(obj) {
return !!(obj && obj.nodeType === 1);
};
// Is a given value an array?
// Delegates to ECMA5's native Array.isArray
_.isArray = nativeIsArray || function(obj) {
return toString.call(obj) === '[object Array]';
};
// Is a given variable an object?
_.isObject = function(obj) {
var type = typeof obj;
return type === 'function' || type === 'object' && !!obj;
};
// Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp.
_.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) {
_['is' + name] = function(obj) {
return toString.call(obj) === '[object ' + name + ']';
};
});
// Define a fallback version of the method in browsers (ahem, IE), where
// there isn't any inspectable "Arguments" type.
if (!_.isArguments(arguments)) {
_.isArguments = function(obj) {
return _.has(obj, 'callee');
};
}
// Optimize `isFunction` if appropriate. Work around an IE 11 bug.
if (typeof /./ !== 'function') {
_.isFunction = function(obj) {
return typeof obj == 'function' || false;
};
}
// Is a given object a finite number?
_.isFinite = function(obj) {
return isFinite(obj) && !isNaN(parseFloat(obj));
};
// Is the given value `NaN`? (NaN is the only number which does not equal itself).
_.isNaN = function(obj) {
return _.isNumber(obj) && obj !== +obj;
};
// Is a given value a boolean?
_.isBoolean = function(obj) {
return obj === true || obj === false || toString.call(obj) === '[object Boolean]';
};
// Is a given value equal to null?
_.isNull = function(obj) {
return obj === null;
};
// Is a given variable undefined?
_.isUndefined = function(obj) {
return obj === void 0;
};
// Shortcut function for checking if an object has a given property directly
// on itself (in other words, not on a prototype).
_.has = function(obj, key) {
return obj != null && hasOwnProperty.call(obj, key);
};
// Utility Functions
// -----------------
// Run Underscore.js in *noConflict* mode, returning the `_` variable to its
// previous owner. Returns a reference to the Underscore object.
_.noConflict = function() {
root._ = previousUnderscore;
return this;
};
// Keep the identity function around for default iteratees.
_.identity = function(value) {
return value;
};
_.constant = function(value) {
return function() {
return value;
};
};
_.noop = function(){};
_.property = function(key) {
return function(obj) {
return obj[key];
};
};
// Returns a predicate for checking whether an object has a given set of `key:value` pairs.
_.matches = function(attrs) {
var pairs = _.pairs(attrs), length = pairs.length;
return function(obj) {
if (obj == null) return !length;
obj = new Object(obj);
for (var i = 0; i < length; i++) {
var pair = pairs[i], key = pair[0];
if (pair[1] !== obj[key] || !(key in obj)) return false;
}
return true;
};
};
// Run a function **n** times.
_.times = function(n, iteratee, context) {
var accum = Array(Math.max(0, n));
iteratee = createCallback(iteratee, context, 1);
for (var i = 0; i < n; i++) accum[i] = iteratee(i);
return accum;
};
// Return a random integer between min and max (inclusive).
_.random = function(min, max) {
if (max == null) {
max = min;
min = 0;
}
return min + Math.floor(Math.random() * (max - min + 1));
};
// A (possibly faster) way to get the current timestamp as an integer.
_.now = Date.now || function() {
return new Date().getTime();
};
// List of HTML entities for escaping.
var escapeMap = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
'`': '`'
};
var unescapeMap = _.invert(escapeMap);
// Functions for escaping and unescaping strings to/from HTML interpolation.
var createEscaper = function(map) {
var escaper = function(match) {
return map[match];
};
// Regexes for identifying a key that needs to be escaped
var source = '(?:' + _.keys(map).join('|') + ')';
var testRegexp = RegExp(source);
var replaceRegexp = RegExp(source, 'g');
return function(string) {
string = string == null ? '' : '' + string;
return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
};
};
_.escape = createEscaper(escapeMap);
_.unescape = createEscaper(unescapeMap);
// If the value of the named `property` is a function then invoke it with the
// `object` as context; otherwise, return it.
_.result = function(object, property) {
if (object == null) return void 0;
var value = object[property];
return _.isFunction(value) ? object[property]() : value;
};
// Generate a unique integer id (unique within the entire client session).
// Useful for temporary DOM ids.
var idCounter = 0;
_.uniqueId = function(prefix) {
var id = ++idCounter + '';
return prefix ? prefix + id : id;
};
// By default, Underscore uses ERB-style template delimiters, change the
// following template settings to use alternative delimiters.
_.templateSettings = {
evaluate : /<%([\s\S]+?)%>/g,
interpolate : /<%=([\s\S]+?)%>/g,
escape : /<%-([\s\S]+?)%>/g
};
// When customizing `templateSettings`, if you don't want to define an
// interpolation, evaluation or escaping regex, we need one that is
// guaranteed not to match.
var noMatch = /(.)^/;
// Certain characters need to be escaped so that they can be put into a
// string literal.
var escapes = {
"'": "'",
'\\': '\\',
'\r': 'r',
'\n': 'n',
'\u2028': 'u2028',
'\u2029': 'u2029'
};
var escaper = /\\|'|\r|\n|\u2028|\u2029/g;
var escapeChar = function(match) {
return '\\' + escapes[match];
};
// JavaScript micro-templating, similar to John Resig's implementation.
// Underscore templating handles arbitrary delimiters, preserves whitespace,
// and correctly escapes quotes within interpolated code.
// NB: `oldSettings` only exists for backwards compatibility.
_.template = function(text, settings, oldSettings) {
if (!settings && oldSettings) settings = oldSettings;
settings = _.defaults({}, settings, _.templateSettings);
// Combine delimiters into one regular expression via alternation.
var matcher = RegExp([
(settings.escape || noMatch).source,
(settings.interpolate || noMatch).source,
(settings.evaluate || noMatch).source
].join('|') + '|$', 'g');
// Compile the template source, escaping string literals appropriately.
var index = 0;
var source = "__p+='";
text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
source += text.slice(index, offset).replace(escaper, escapeChar);
index = offset + match.length;
if (escape) {
source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
} else if (interpolate) {
source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
} else if (evaluate) {
source += "';\n" + evaluate + "\n__p+='";
}
// Adobe VMs need the match returned to produce the correct offest.
return match;
});
source += "';\n";
// If a variable is not specified, place data values in local scope.
if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
source = "var __t,__p='',__j=Array.prototype.join," +
"print=function(){__p+=__j.call(arguments,'');};\n" +
source + 'return __p;\n';
try {
var render = new Function(settings.variable || 'obj', '_', source);
} catch (e) {
e.source = source;
throw e;
}
var template = function(data) {
return render.call(this, data, _);
};
// Provide the compiled source as a convenience for precompilation.
var argument = settings.variable || 'obj';
template.source = 'function(' + argument + '){\n' + source + '}';
return template;
};
// Add a "chain" function. Start chaining a wrapped Underscore object.
_.chain = function(obj) {
var instance = _(obj);
instance._chain = true;
return instance;
};
// OOP
// ---------------
// If Underscore is called as a function, it returns a wrapped object that
// can be used OO-style. This wrapper holds altered versions of all the
// underscore functions. Wrapped objects may be chained.
// Helper function to continue chaining intermediate results.
var result = function(obj) {
return this._chain ? _(obj).chain() : obj;
};
// Add your own custom functions to the Underscore object.
_.mixin = function(obj) {
_.each(_.functions(obj), function(name) {
var func = _[name] = obj[name];
_.prototype[name] = function() {
var args = [this._wrapped];
push.apply(args, arguments);
return result.call(this, func.apply(_, args));
};
});
};
// Add all of the Underscore functions to the wrapper object.
_.mixin(_);
// Add all mutator Array functions to the wrapper.
_.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
var method = ArrayProto[name];
_.prototype[name] = function() {
var obj = this._wrapped;
method.apply(obj, arguments);
if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0];
return result.call(this, obj);
};
});
// Add all accessor Array functions to the wrapper.
_.each(['concat', 'join', 'slice'], function(name) {
var method = ArrayProto[name];
_.prototype[name] = function() {
return result.call(this, method.apply(this._wrapped, arguments));
};
});
// Extracts the result from a wrapped and chained object.
_.prototype.value = function() {
return this._wrapped;
};
// AMD registration happens at the end for compatibility with AMD loaders
// that may not enforce next-turn semantics on modules. Even though general
// practice for AMD registration is to be anonymous, underscore registers
// as a named module because, like jQuery, it is a base library that is
// popular enough to be bundled in a third party lib, but not be part of
// an AMD load request. Those cases could generate an error when an
// anonymous define() is called outside of a loader request.
if (typeof define === 'function' && define.amd) {
define('underscore', [], function() {
return _;
});
}
}.call(this));
},{}],"zepto":[function(require,module,exports){
/* Zepto v1.1.4-76-g2bd5d7a - zepto event ajax callbacks deferred touch selector - zeptojs.com/license */
var Zepto=function(){function D(t){return null==t?String(t):j[S.call(t)]||"object"}function L(t){return"function"==D(t)}function k(t){return null!=t&&t==t.window}function Z(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function $(t){return"object"==D(t)}function F(t){return $(t)&&!k(t)&&Object.getPrototypeOf(t)==Object.prototype}function R(t){return"number"==typeof t.length}function q(t){return s.call(t,function(t){return null!=t})}function W(t){return t.length>0?n.fn.concat.apply([],t):t}function z(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function H(t){return t in c?c[t]:c[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function _(t,e){return"number"!=typeof e||l[z(t)]?e:e+"px"}function I(t){var e,n;return f[t]||(e=u.createElement(t),u.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),f[t]=n),f[t]}function U(t){return"children"in t?a.call(t.children):n.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function X(t,e){var n,i=t?t.length:0;for(n=0;i>n;n++)this[n]=t[n];this.length=i,this.selector=e||""}function B(n,i,r){for(e in i)r&&(F(i[e])||A(i[e]))?(F(i[e])&&!F(n[e])&&(n[e]={}),A(i[e])&&!A(n[e])&&(n[e]=[]),B(n[e],i[e],r)):i[e]!==t&&(n[e]=i[e])}function V(t,e){return null==e?n(t):n(t).filter(e)}function Y(t,e,n,i){return L(e)?e.call(t,n,i):e}function J(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function G(e,n){var i=e.className||"",r=i&&i.baseVal!==t;return n===t?r?i.baseVal:i:void(r?i.baseVal=n:e.className=n)}function K(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?n.parseJSON(t):t):t}catch(e){return t}}function Q(t,e){e(t);for(var n=0,i=t.childNodes.length;i>n;n++)Q(t.childNodes[n],e)}var t,e,n,i,N,P,r=[],o=r.concat,s=r.filter,a=r.slice,u=window.document,f={},c={},l={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},h=/^\s*<(\w+|!)[^>]*>/,p=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,d=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,m=/^(?:body|html)$/i,g=/([A-Z])/g,v=["val","css","html","text","data","width","height","offset"],y=["after","prepend","before","append"],w=u.createElement("table"),x=u.createElement("tr"),b={tr:u.createElement("tbody"),tbody:w,thead:w,tfoot:w,td:x,th:x,"*":u.createElement("div")},E=/complete|loaded|interactive/,T=/^[\w-]*$/,j={},S=j.toString,C={},O=u.createElement("div"),M={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},A=Array.isArray||function(t){return t instanceof Array};return C.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var i,r=t.parentNode,o=!r;return o&&(r=O).appendChild(t),i=~C.qsa(r,e).indexOf(t),o&&O.removeChild(t),i},N=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},P=function(t){return s.call(t,function(e,n){return t.indexOf(e)==n})},C.fragment=function(e,i,r){var o,s,f;return p.test(e)&&(o=n(u.createElement(RegExp.$1))),o||(e.replace&&(e=e.replace(d,"<$1></$2>")),i===t&&(i=h.test(e)&&RegExp.$1),i in b||(i="*"),f=b[i],f.innerHTML=""+e,o=n.each(a.call(f.childNodes),function(){f.removeChild(this)})),F(r)&&(s=n(o),n.each(r,function(t,e){v.indexOf(t)>-1?s[t](e):s.attr(t,e)})),o},C.Z=function(t,e){return new X(t,e)},C.isZ=function(t){return t instanceof C.Z},C.init=function(e,i){var r;if(!e)return C.Z();if("string"==typeof e)if(e=e.trim(),"<"==e[0]&&h.test(e))r=C.fragment(e,RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=C.qsa(u,e)}else{if(L(e))return n(u).ready(e);if(C.isZ(e))return e;if(A(e))r=q(e);else if($(e))r=[e],e=null;else if(h.test(e))r=C.fragment(e.trim(),RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=C.qsa(u,e)}}return C.Z(r,e)},n=function(t,e){return C.init(t,e)},n.extend=function(t){var e,n=a.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){B(t,n,e)}),t},C.qsa=function(t,e){var n,i="#"==e[0],r=!i&&"."==e[0],o=i||r?e.slice(1):e,s=T.test(o);return t.getElementById&&s&&i?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:a.call(s&&!i&&t.getElementsByClassName?r?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},n.contains=u.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},n.type=D,n.isFunction=L,n.isWindow=k,n.isArray=A,n.isPlainObject=F,n.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},n.inArray=function(t,e,n){return r.indexOf.call(e,t,n)},n.camelCase=N,n.trim=function(t){return null==t?"":String.prototype.trim.call(t)},n.uuid=0,n.support={},n.expr={},n.noop=function(){},n.map=function(t,e){var n,r,o,i=[];if(R(t))for(r=0;r<t.length;r++)n=e(t[r],r),null!=n&&i.push(n);else for(o in t)n=e(t[o],o),null!=n&&i.push(n);return W(i)},n.each=function(t,e){var n,i;if(R(t)){for(n=0;n<t.length;n++)if(e.call(t[n],n,t[n])===!1)return t}else for(i in t)if(e.call(t[i],i,t[i])===!1)return t;return t},n.grep=function(t,e){return s.call(t,e)},window.JSON&&(n.parseJSON=JSON.parse),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){j["[object "+e+"]"]=e.toLowerCase()}),n.fn={constructor:C.Z,length:0,forEach:r.forEach,reduce:r.reduce,push:r.push,sort:r.sort,splice:r.splice,indexOf:r.indexOf,concat:function(){var t,e,n=[];for(t=0;t<arguments.length;t++)e=arguments[t],n[t]=C.isZ(e)?e.toArray():e;return o.apply(C.isZ(this)?this.toArray():this,n)},map:function(t){return n(n.map(this,function(e,n){return t.call(e,n,e)}))},slice:function(){return n(a.apply(this,arguments))},ready:function(t){return E.test(u.readyState)&&u.body?t(n):u.addEventListener("DOMContentLoaded",function(){t(n)},!1),this},get:function(e){return e===t?a.call(this):this[e>=0?e:e+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return r.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return L(t)?this.not(this.not(t)):n(s.call(this,function(e){return C.matches(e,t)}))},add:function(t,e){return n(P(this.concat(n(t,e))))},is:function(t){return this.length>0&&C.matches(this[0],t)},not:function(e){var i=[];if(L(e)&&e.call!==t)this.each(function(t){e.call(this,t)||i.push(this)});else{var r="string"==typeof e?this.filter(e):R(e)&&L(e.item)?a.call(e):n(e);this.forEach(function(t){r.indexOf(t)<0&&i.push(t)})}return n(i)},has:function(t){return this.filter(function(){return $(t)?n.contains(this,t):n(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!$(t)?t:n(t)},last:function(){var t=this[this.length-1];return t&&!$(t)?t:n(t)},find:function(t){var e,i=this;return e=t?"object"==typeof t?n(t).filter(function(){var t=this;return r.some.call(i,function(e){return n.contains(e,t)})}):1==this.length?n(C.qsa(this[0],t)):this.map(function(){return C.qsa(this,t)}):n()},closest:function(t,e){var i=this[0],r=!1;for("object"==typeof t&&(r=n(t));i&&!(r?r.indexOf(i)>=0:C.matches(i,t));)i=i!==e&&!Z(i)&&i.parentNode;return n(i)},parents:function(t){for(var e=[],i=this;i.length>0;)i=n.map(i,function(t){return(t=t.parentNode)&&!Z(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return V(e,t)},parent:function(t){return V(P(this.pluck("parentNode")),t)},children:function(t){return V(this.map(function(){return U(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||a.call(this.childNodes)})},siblings:function(t){return V(this.map(function(t,e){return s.call(U(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return n.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=I(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=L(t);if(this[0]&&!e)var i=n(t).get(0),r=i.parentNode||this.length>1;return this.each(function(o){n(this).wrapAll(e?t.call(this,o):r?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){n(this[0]).before(t=n(t));for(var e;(e=t.children()).length;)t=e.first();n(t).append(this)}return this},wrapInner:function(t){var e=L(t);return this.each(function(i){var r=n(this),o=r.contents(),s=e?t.call(this,i):t;o.length?o.wrapAll(s):r.append(s)})},unwrap:function(){return this.parent().each(function(){n(this).replaceWith(n(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(e){return this.each(function(){var i=n(this);(e===t?"none"==i.css("display"):e)?i.show():i.hide()})},prev:function(t){return n(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return n(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var i=this.innerHTML;n(this).empty().append(Y(this,t,e,i))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=Y(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this[0].textContent:null},attr:function(n,i){var r;return"string"!=typeof n||1 in arguments?this.each(function(t){if(1===this.nodeType)if($(n))for(e in n)J(this,e,n[e]);else J(this,n,Y(this,i,t,this.getAttribute(n)))}):this.length&&1===this[0].nodeType?!(r=this[0].getAttribute(n))&&n in this[0]?this[0][n]:r:t},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){J(this,t)},this)})},prop:function(t,e){return t=M[t]||t,1 in arguments?this.each(function(n){this[t]=Y(this,e,n,this[t])}):this[0]&&this[0][t]},data:function(e,n){var i="data-"+e.replace(g,"-$1").toLowerCase(),r=1 in arguments?this.attr(i,n):this.attr(i);return null!==r?K(r):t},val:function(t){return 0 in arguments?this.each(function(e){this.value=Y(this,t,e,this.value)}):this[0]&&(this[0].multiple?n(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var i=n(this),r=Y(this,t,e,i.offset()),o=i.offsetParent().offset(),s={top:r.top-o.top,left:r.left-o.left};"static"==i.css("position")&&(s.position="relative"),i.css(s)});if(!this.length)return null;var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(t,i){if(arguments.length<2){var r,o=this[0];if(!o)return;if(r=getComputedStyle(o,""),"string"==typeof t)return o.style[N(t)]||r.getPropertyValue(t);if(A(t)){var s={};return n.each(t,function(t,e){s[e]=o.style[N(e)]||r.getPropertyValue(e)}),s}}var a="";if("string"==D(t))i||0===i?a=z(t)+":"+_(t,i):this.each(function(){this.style.removeProperty(z(t))});else for(e in t)t[e]||0===t[e]?a+=z(e)+":"+_(e,t[e])+";":this.each(function(){this.style.removeProperty(z(e))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(n(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?r.some.call(this,function(t){return this.test(G(t))},H(t)):!1},addClass:function(t){return t?this.each(function(e){if("className"in this){i=[];var r=G(this),o=Y(this,t,e,r);o.split(/\s+/g).forEach(function(t){n(this).hasClass(t)||i.push(t)},this),i.length&&G(this,r+(r?" ":"")+i.join(" "))}}):this},removeClass:function(e){return this.each(function(n){if("className"in this){if(e===t)return G(this,"");i=G(this),Y(this,e,n,i).split(/\s+/g).forEach(function(t){i=i.replace(H(t)," ")}),G(this,i.trim())}})},toggleClass:function(e,i){return e?this.each(function(r){var o=n(this),s=Y(this,e,r,G(this));s.split(/\s+/g).forEach(function(e){(i===t?!o.hasClass(e):i)?o.addClass(e):o.removeClass(e)})}):this},scrollTop:function(e){if(this.length){var n="scrollTop"in this[0];return e===t?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=e}:function(){this.scrollTo(this.scrollX,e)})}},scrollLeft:function(e){if(this.length){var n="scrollLeft"in this[0];return e===t?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=e}:function(){this.scrollTo(e,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),i=this.offset(),r=m.test(e[0].nodeName)?{top:0,left:0}:e.offset();return i.top-=parseFloat(n(t).css("margin-top"))||0,i.left-=parseFloat(n(t).css("margin-left"))||0,r.top+=parseFloat(n(e[0]).css("border-top-width"))||0,r.left+=parseFloat(n(e[0]).css("border-left-width"))||0,{top:i.top-r.top,left:i.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||u.body;t&&!m.test(t.nodeName)&&"static"==n(t).css("position");)t=t.offsetParent;return t})}},n.fn.detach=n.fn.remove,["width","height"].forEach(function(e){var i=e.replace(/./,function(t){return t[0].toUpperCase()});n.fn[e]=function(r){var o,s=this[0];return r===t?k(s)?s["inner"+i]:Z(s)?s.documentElement["scroll"+i]:(o=this.offset())&&o[e]:this.each(function(t){s=n(this),s.css(e,Y(this,r,t,s[e]()))})}}),y.forEach(function(t,e){var i=e%2;n.fn[t]=function(){var t,o,r=n.map(arguments,function(e){return t=D(e),"object"==t||"array"==t||null==e?e:C.fragment(e)}),s=this.length>1;return r.length<1?this:this.each(function(t,a){o=i?a:a.parentNode,a=0==e?a.nextSibling:1==e?a.firstChild:2==e?a:null;var f=n.contains(u.documentElement,o);r.forEach(function(t){if(s)t=t.cloneNode(!0);else if(!o)return n(t).remove();o.insertBefore(t,a),f&&Q(t,function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},n.fn[i?t+"To":"insert"+(e?"Before":"After")]=function(e){return n(e)[t](this),this}}),C.Z.prototype=X.prototype=n.fn,C.uniq=P,C.deserializeValue=K,n.zepto=C,n}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(t){function l(t){return t._zid||(t._zid=e++)}function h(t,e,n,i){if(e=p(e),e.ns)var r=d(e.ns);return(s[l(t)]||[]).filter(function(t){return!(!t||e.e&&t.e!=e.e||e.ns&&!r.test(t.ns)||n&&l(t.fn)!==l(n)||i&&t.sel!=i)})}function p(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function d(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function m(t,e){return t.del&&!u&&t.e in f||!!e}function g(t){return c[t]||u&&f[t]||t}function v(e,i,r,o,a,u,f){var h=l(e),d=s[h]||(s[h]=[]);i.split(/\s/).forEach(function(i){if("ready"==i)return t(document).ready(r);var s=p(i);s.fn=r,s.sel=a,s.e in c&&(r=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?s.fn.apply(this,arguments):void 0}),s.del=u;var l=u||r;s.proxy=function(t){if(t=T(t),!t.isImmediatePropagationStopped()){t.data=o;var i=l.apply(e,t._args==n?[t]:[t].concat(t._args));return i===!1&&(t.preventDefault(),t.stopPropagation()),i}},s.i=d.length,d.push(s),"addEventListener"in e&&e.addEventListener(g(s.e),s.proxy,m(s,f))})}function y(t,e,n,i,r){var o=l(t);(e||"").split(/\s/).forEach(function(e){h(t,e,n,i).forEach(function(e){delete s[o][e.i],"removeEventListener"in t&&t.removeEventListener(g(e.e),e.proxy,m(e,r))})})}function T(e,i){return(i||!e.isDefaultPrevented)&&(i||(i=e),t.each(E,function(t,n){var r=i[t];e[t]=function(){return this[n]=w,r&&r.apply(i,arguments)},e[n]=x}),(i.defaultPrevented!==n?i.defaultPrevented:"returnValue"in i?i.returnValue===!1:i.getPreventDefault&&i.getPreventDefault())&&(e.isDefaultPrevented=w)),e}function j(t){var e,i={originalEvent:t};for(e in t)b.test(e)||t[e]===n||(i[e]=t[e]);return T(i,t)}var n,e=1,i=Array.prototype.slice,r=t.isFunction,o=function(t){return"string"==typeof t},s={},a={},u="onfocusin"in window,f={focus:"focusin",blur:"focusout"},c={mouseenter:"mouseover",mouseleave:"mouseout"};a.click=a.mousedown=a.mouseup=a.mousemove="MouseEvents",t.event={add:v,remove:y},t.proxy=function(e,n){var s=2 in arguments&&i.call(arguments,2);if(r(e)){var a=function(){return e.apply(n,s?s.concat(i.call(arguments)):arguments)};return a._zid=l(e),a}if(o(n))return s?(s.unshift(e[n],e),t.proxy.apply(null,s)):t.proxy(e[n],e);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,i){return this.on(t,e,n,i,1)};var w=function(){return!0},x=function(){return!1},b=/^([A-Z]|returnValue$|layer[XY]$)/,E={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,s,a,u,f){var c,l,h=this;return e&&!o(e)?(t.each(e,function(t,e){h.on(t,s,a,e,f)}),h):(o(s)||r(u)||u===!1||(u=a,a=s,s=n),(u===n||a===!1)&&(u=a,a=n),u===!1&&(u=x),h.each(function(n,r){f&&(c=function(t){return y(r,t.type,u),u.apply(this,arguments)}),s&&(l=function(e){var n,o=t(e.target).closest(s,r).get(0);return o&&o!==r?(n=t.extend(j(e),{currentTarget:o,liveFired:r}),(c||u).apply(o,[n].concat(i.call(arguments,1)))):void 0}),v(r,e,u,a,s,l||c)}))},t.fn.off=function(e,i,s){var a=this;return e&&!o(e)?(t.each(e,function(t,e){a.off(t,i,e)}),a):(o(i)||r(s)||s===!1||(s=i,i=n),s===!1&&(s=x),a.each(function(){y(this,e,s,i)}))},t.fn.trigger=function(e,n){return e=o(e)||t.isPlainObject(e)?t.Event(e):T(e),e._args=n,this.each(function(){e.type in f&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,n){var i,r;return this.each(function(s,a){i=j(o(e)?t.Event(e):e),i._args=n,i.target=a,t.each(h(a,e.type||e),function(t,e){return r=e.proxy(i),i.isImmediatePropagationStopped()?!1:void 0})}),r},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}}),t.Event=function(t,e){o(t)||(e=t,t=e.type);var n=document.createEvent(a[t]||"Events"),i=!0;if(e)for(var r in e)"bubbles"==r?i=!!e[r]:n[r]=e[r];return n.initEvent(t,i,!0),T(n)}}(Zepto),function(t){function h(e,n,i){var r=t.Event(n);return t(e).trigger(r,i),!r.isDefaultPrevented()}function p(t,e,i,r){return t.global?h(e||n,i,r):void 0}function d(e){e.global&&0===t.active++&&p(e,null,"ajaxStart")}function m(e){e.global&&!--t.active&&p(e,null,"ajaxStop")}function g(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||p(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void p(e,n,"ajaxSend",[t,e])}function v(t,e,n,i){var r=n.context,o="success";n.success.call(r,t,o,e),i&&i.resolveWith(r,[t,o,e]),p(n,r,"ajaxSuccess",[e,n,t]),w(o,e,n)}function y(t,e,n,i,r){var o=i.context;i.error.call(o,n,e,t),r&&r.rejectWith(o,[n,e,t]),p(i,o,"ajaxError",[n,i,t||e]),w(e,n,i)}function w(t,e,n){var i=n.context;n.complete.call(i,e,t),p(n,i,"ajaxComplete",[e,n]),m(n)}function x(){}function b(t){return t&&(t=t.split(";",2)[0]),t&&(t==f?"html":t==u?"json":s.test(t)?"script":a.test(t)&&"xml")||"text"}function E(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function T(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=E(e.url,e.data),e.data=void 0)}function j(e,n,i,r){return t.isFunction(n)&&(r=i,i=n,n=void 0),t.isFunction(i)||(r=i,i=void 0),{url:e,data:n,success:i,dataType:r}}function C(e,n,i,r){var o,s=t.isArray(n),a=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),r&&(n=i?r:r+"["+(a||"object"==o||"array"==o?n:"")+"]"),!r&&s?e.add(u.name,u.value):"array"==o||!i&&"object"==o?C(e,u,i,n):e.add(n,u)})}var i,r,e=0,n=window.document,o=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,s=/^(?:text|application)\/javascript/i,a=/^(?:text|application)\/xml/i,u="application/json",f="text/html",c=/^\s*$/,l=n.createElement("a");l.href=window.location.href,t.active=0,t.ajaxJSONP=function(i,r){if(!("type"in i))return t.ajax(i);var f,h,o=i.jsonpCallback,s=(t.isFunction(o)?o():o)||"jsonp"+ ++e,a=n.createElement("script"),u=window[s],c=function(e){t(a).triggerHandler("error",e||"abort")},l={abort:c};return r&&r.promise(l),t(a).on("load error",function(e,n){clearTimeout(h),t(a).off().remove(),"error"!=e.type&&f?v(f[0],l,i,r):y(null,n||"error",l,i,r),window[s]=u,f&&t.isFunction(u)&&u(f[0]),u=f=void 0}),g(l,i)===!1?(c("abort"),l):(window[s]=function(){f=arguments},a.src=i.url.replace(/\?(.+)=\?/,"?$1="+s),n.head.appendChild(a),i.timeout>0&&(h=setTimeout(function(){c("timeout")},i.timeout)),l)},t.ajaxSettings={type:"GET",beforeSend:x,success:x,error:x,complete:x,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:u,xml:"application/xml, text/xml",html:f,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var a,u,o=t.extend({},e||{}),s=t.Deferred&&t.Deferred();for(i in t.ajaxSettings)void 0===o[i]&&(o[i]=t.ajaxSettings[i]);d(o),o.crossDomain||(a=n.createElement("a"),a.href=o.url,a.href=a.href,o.crossDomain=l.protocol+"//"+l.host!=a.protocol+"//"+a.host),o.url||(o.url=window.location.toString()),(u=o.url.indexOf("#"))>-1&&(o.url=o.url.slice(0,u)),T(o);var f=o.dataType,h=/\?.+=\?/.test(o.url);if(h&&(f="jsonp"),o.cache!==!1&&(e&&e.cache===!0||"script"!=f&&"jsonp"!=f)||(o.url=E(o.url,"_="+Date.now())),"jsonp"==f)return h||(o.url=E(o.url,o.jsonp?o.jsonp+"=?":o.jsonp===!1?"":"callback=?")),t.ajaxJSONP(o,s);var N,p=o.accepts[f],m={},w=function(t,e){m[t.toLowerCase()]=[t,e]},j=/^([\w-]+:)\/\//.test(o.url)?RegExp.$1:window.location.protocol,S=o.xhr(),C=S.setRequestHeader;if(s&&s.promise(S),o.crossDomain||w("X-Requested-With","XMLHttpRequest"),w("Accept",p||"*/*"),(p=o.mimeType||p)&&(p.indexOf(",")>-1&&(p=p.split(",",2)[0]),S.overrideMimeType&&S.overrideMimeType(p)),(o.contentType||o.contentType!==!1&&o.data&&"GET"!=o.type.toUpperCase())&&w("Content-Type",o.contentType||"application/x-www-form-urlencoded"),o.headers)for(r in o.headers)w(r,o.headers[r]);if(S.setRequestHeader=w,S.onreadystatechange=function(){if(4==S.readyState){S.onreadystatechange=x,clearTimeout(N);var e,n=!1;if(S.status>=200&&S.status<300||304==S.status||0==S.status&&"file:"==j){f=f||b(o.mimeType||S.getResponseHeader("content-type")),e=S.responseText;try{"script"==f?(1,eval)(e):"xml"==f?e=S.responseXML:"json"==f&&(e=c.test(e)?null:t.parseJSON(e))}catch(i){n=i}n?y(n,"parsererror",S,o,s):v(e,S,o,s)}else y(S.statusText||null,S.status?"error":"abort",S,o,s)}},g(S,o)===!1)return S.abort(),y(null,"abort",S,o,s),S;if(o.xhrFields)for(r in o.xhrFields)S[r]=o.xhrFields[r];var P="async"in o?o.async:!0;S.open(o.type,o.url,P,o.username,o.password);for(r in m)C.apply(S,m[r]);return o.timeout>0&&(N=setTimeout(function(){S.onreadystatechange=x,S.abort(),y(null,"timeout",S,o,s)},o.timeout)),S.send(o.data?o.data:null),S},t.get=function(){return t.ajax(j.apply(null,arguments))},t.post=function(){var e=j.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=j.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,i){if(!this.length)return this;var a,r=this,s=e.split(/\s/),u=j(e,n,i),f=u.success;return s.length>1&&(u.url=s[0],a=s[1]),u.success=function(e){r.html(a?t("<div>").html(e.replace(o,"")).find(a):e),f&&f.apply(r,arguments)},t.ajax(u),this};var S=encodeURIComponent;t.param=function(e,n){var i=[];return i.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(S(e)+"="+S(n))},C(i,e,n),i.join("&").replace(/%20/g,"+")}}(Zepto),function(t){t.Callbacks=function(e){e=t.extend({},e);var n,i,r,o,s,a,u=[],f=!e.once&&[],c=function(t){for(n=e.memory&&t,i=!0,a=o||0,o=0,s=u.length,r=!0;u&&s>a;++a)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}r=!1,u&&(f?f.length&&c(f.shift()):n?u.length=0:l.disable())},l={add:function(){if(u){var i=u.length,a=function(n){t.each(n,function(t,n){"function"==typeof n?e.unique&&l.has(n)||u.push(n):n&&n.length&&"string"!=typeof n&&a(n)})};a(arguments),r?s=u.length:n&&(o=i,c(n))}return this},remove:function(){return u&&t.each(arguments,function(e,n){for(var i;(i=t.inArray(n,u,i))>-1;)u.splice(i,1),r&&(s>=i&&--s,a>=i&&--a)}),this},has:function(e){return!(!u||!(e?t.inArray(e,u)>-1:u.length))},empty:function(){return s=u.length=0,this},disable:function(){return u=f=n=void 0,this},disabled:function(){return!u},lock:function(){return f=void 0,n||l.disable(),this},locked:function(){return!f},fireWith:function(t,e){return!u||i&&!f||(e=e||[],e=[t,e.slice?e.slice():e],r?f.push(e):c(e)),this},fire:function(){return l.fireWith(this,arguments)},fired:function(){return!!i}};return l}}(Zepto),function(t){function n(e){var i=[["resolve","done",t.Callbacks({once:1,memory:1}),"resolved"],["reject","fail",t.Callbacks({once:1,memory:1}),"rejected"],["notify","progress",t.Callbacks({memory:1})]],r="pending",o={state:function(){return r},always:function(){return s.done(arguments).fail(arguments),this},then:function(){var e=arguments;return n(function(n){t.each(i,function(i,r){var a=t.isFunction(e[i])&&e[i];s[r[1]](function(){var e=a&&a.apply(this,arguments);if(e&&t.isFunction(e.promise))e.promise().done(n.resolve).fail(n.reject).progress(n.notify);else{var i=this===o?n.promise():this,s=a?[e]:arguments;n[r[0]+"With"](i,s)}})}),e=null}).promise()},promise:function(e){return null!=e?t.extend(e,o):o}},s={};return t.each(i,function(t,e){var n=e[2],a=e[3];o[e[1]]=n.add,a&&n.add(function(){r=a},i[1^t][2].disable,i[2][2].lock),s[e[0]]=function(){return s[e[0]+"With"](this===s?o:this,arguments),this},s[e[0]+"With"]=n.fireWith}),o.promise(s),e&&e.call(s,s),s}var e=Array.prototype.slice;t.when=function(i){var f,c,l,r=e.call(arguments),o=r.length,s=0,a=1!==o||i&&t.isFunction(i.promise)?o:0,u=1===a?i:n(),h=function(t,n,i){return function(r){n[t]=this,i[t]=arguments.length>1?e.call(arguments):r,i===f?u.notifyWith(n,i):--a||u.resolveWith(n,i)}};if(o>1)for(f=new Array(o),c=new Array(o),l=new Array(o);o>s;++s)r[s]&&t.isFunction(r[s].promise)?r[s].promise().done(h(s,l,r)).fail(u.reject).progress(h(s,c,f)):--a;return a||u.resolveWith(l,r),u.promise()},t.Deferred=n}(Zepto),function(t){function u(t,e,n,i){return Math.abs(t-e)>=Math.abs(n-i)?t-e>0?"Left":"Right":n-i>0?"Up":"Down"}function f(){o=null,e.last&&(e.el.trigger("longTap"),e={})}function c(){o&&clearTimeout(o),o=null}function l(){n&&clearTimeout(n),i&&clearTimeout(i),r&&clearTimeout(r),o&&clearTimeout(o),n=i=r=o=null,e={}}function h(t){return("touch"==t.pointerType||t.pointerType==t.MSPOINTER_TYPE_TOUCH)&&t.isPrimary}function p(t,e){return t.type=="pointer"+e||t.type.toLowerCase()=="mspointer"+e}var n,i,r,o,a,e={},s=750;t(document).ready(function(){var d,m,y,w,g=0,v=0;"MSGesture"in window&&(a=new MSGesture,a.target=document.body),t(document).bind("MSGestureEnd",function(t){var n=t.velocityX>1?"Right":t.velocityX<-1?"Left":t.velocityY>1?"Down":t.velocityY<-1?"Up":null;n&&(e.el.trigger("swipe"),e.el.trigger("swipe"+n))}).on("touchstart MSPointerDown pointerdown",function(i){(!(w=p(i,"down"))||h(i))&&(y=w?i:i.touches[0],i.touches&&1===i.touches.length&&e.x2&&(e.x2=void 0,e.y2=void 0),d=Date.now(),m=d-(e.last||d),e.el=t("tagName"in y.target?y.target:y.target.parentNode),n&&clearTimeout(n),e.x1=y.pageX,e.y1=y.pageY,m>0&&250>=m&&(e.isDoubleTap=!0),e.last=d,o=setTimeout(f,s),a&&w&&a.addPointer(i.pointerId))}).on("touchmove MSPointerMove pointermove",function(t){(!(w=p(t,"move"))||h(t))&&(y=w?t:t.touches[0],c(),e.x2=y.pageX,e.y2=y.pageY,g+=Math.abs(e.x1-e.x2),v+=Math.abs(e.y1-e.y2))}).on("touchend MSPointerUp pointerup",function(o){(!(w=p(o,"up"))||h(o))&&(c(),e.x2&&Math.abs(e.x1-e.x2)>30||e.y2&&Math.abs(e.y1-e.y2)>30?r=setTimeout(function(){e.el.trigger("swipe"),e.el.trigger("swipe"+u(e.x1,e.x2,e.y1,e.y2)),e={}},0):"last"in e&&(30>g&&30>v?i=setTimeout(function(){var i=t.Event("tap");i.cancelTouch=l,e.el.trigger(i),e.isDoubleTap?(e.el&&e.el.trigger("doubleTap"),e={}):n=setTimeout(function(){n=null,e.el&&e.el.trigger("singleTap"),e={}},250)},0):e={}),g=v=0)}).on("touchcancel MSPointerCancel pointercancel",l),t(window).on("scroll",l)}),["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(e){t.fn[e]=function(t){return this.on(e,t)}})}(Zepto),function(t){function r(e){return e=t(e),!(!e.width()&&!e.height())&&"none"!==e.css("display")}function f(t,e){t=t.replace(/=#\]/g,'="#"]');var n,i,r=s.exec(t);if(r&&r[2]in o&&(n=o[r[2]],i=r[3],t=r[1],i)){var a=Number(i);i=isNaN(a)?i.replace(/^["']|["']$/g,""):a}return e(t,n,i)}var e=t.zepto,n=e.qsa,i=e.matches,o=t.expr[":"]={visible:function(){return r(this)?this:void 0},hidden:function(){return r(this)?void 0:this},selected:function(){return this.selected?this:void 0},checked:function(){return this.checked?this:void 0},parent:function(){return this.parentNode},first:function(t){return 0===t?this:void 0},last:function(t,e){return t===e.length-1?this:void 0},eq:function(t,e,n){return t===n?this:void 0},contains:function(e,n,i){return t(this).text().indexOf(i)>-1?this:void 0},has:function(t,n,i){return e.qsa(this,i).length?this:void 0}},s=new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"),a=/^\s*>/,u="Zepto"+ +new Date;e.qsa=function(i,r){return f(r,function(o,s,f){try{var c;!o&&s?o="*":a.test(o)&&(c=t(i).addClass(u),o="."+u+" "+o);var l=n(i,o)}catch(h){throw console.error("error performing selector: %o",r),h}finally{c&&c.removeClass(u)}return s?e.uniq(t.map(l,function(t,e){return s.call(t,e,l,f)})):l})},e.matches=function(t,e){return f(e,function(e,n,r){return!(e&&!i(t,e)||n&&n.call(t,null,r)!==t)})}}(Zepto);
module.exports = Zepto;
},{}]},{},[3,1]);
|
ajax/libs/mediaelement/2.9.1/jquery.js
|
jonobr1/cdnjs
|
/*!
* jQuery JavaScript Library v1.7
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Thu Nov 3 16:18:21 2011 -0400
*/
(function( window, undefined ) {
// Use the correct document accordingly with window argument (sandbox)
var document = window.document,
navigator = window.navigator,
location = window.location;
var jQuery = (function() {
// Define a local copy of jQuery
var jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// A central reference to the root jQuery(document)
rootjQuery,
// A simple way to check for HTML strings or ID strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
// Check if a string has a non-whitespace character in it
rnotwhite = /\S/,
// Used for trimming whitespace
trimLeft = /^\s+/,
trimRight = /\s+$/,
// Check for digits
rdigit = /\d/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
// Useragent RegExp
rwebkit = /(webkit)[ \/]([\w.]+)/,
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
rmsie = /(msie) ([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
// Matches dashed string for camelizing
rdashAlpha = /-([a-z]|[0-9])/ig,
rmsPrefix = /^-ms-/,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return ( letter + "" ).toUpperCase();
},
// Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent,
// For matching the engine and version of the browser
browserMatch,
// The deferred used on DOM ready
readyList,
// The ready event handler
DOMContentLoaded,
// Save a reference to some core methods
toString = Object.prototype.toString,
hasOwn = Object.prototype.hasOwnProperty,
push = Array.prototype.push,
slice = Array.prototype.slice,
trim = String.prototype.trim,
indexOf = Array.prototype.indexOf,
// [[Class]] -> type pairs
class2type = {};
jQuery.fn = jQuery.prototype = {
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc;
// Handle $(""), $(null), or $(undefined)
if ( !selector ) {
return this;
}
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
}
// The body element only exists once, optimize finding it
if ( selector === "body" && !context && document.body ) {
this.context = document;
this[0] = document.body;
this.selector = selector;
this.length = 1;
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID?
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 = quickExpr.exec( selector );
}
// Verify a match, and that no context was specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
doc = ( context ? context.ownerDocument || context : document );
// If a single string is passed in and it's a single tag
// just do a createElement and skip the rest
ret = rsingleTag.exec( selector );
if ( ret ) {
if ( jQuery.isPlainObject( context ) ) {
selector = [ document.createElement( ret[1] ) ];
jQuery.fn.attr.call( selector, context, true );
} else {
selector = [ doc.createElement( ret[1] ) ];
}
} else {
ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
}
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.7",
// 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 slice.call( this, 0 );
},
// 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 = this.constructor();
if ( jQuery.isArray( elems ) ) {
push.apply( ret, elems );
} else {
jQuery.merge( ret, 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 ) {
// Attach the listeners
jQuery.bindReady();
// Add the callback
readyList.add( fn );
return this;
},
eq: function( 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( slice.apply( this, arguments ),
"slice", 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: 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 ) {
// Either a released hold or an DOMready/load event and not yet ready
if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
// 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.fireWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger( "ready" ).unbind( "ready" );
}
}
},
bindReady: function() {
if ( readyList ) {
return;
}
readyList = jQuery.Callbacks( "once memory" );
// Catch cases where $(document).ready() is called after the
// browser event has already occurred.
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
return setTimeout( jQuery.ready, 1 );
}
// Mozilla, Opera and webkit nightlies currently support this event
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 if ( document.attachEvent ) {
// 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 toplevel = false;
try {
toplevel = window.frameElement == null;
} catch(e) {}
if ( document.documentElement.doScroll && toplevel ) {
doScrollCheck();
}
}
},
// 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";
},
// A crude way of determining if an object is a window
isWindow: function( obj ) {
return obj && typeof obj === "object" && "setInterval" in obj;
},
isNumeric: function( obj ) {
return obj != null && rdigit.test( obj ) && !isNaN( obj );
},
type: function( obj ) {
return obj == null ?
String( obj ) :
class2type[ 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 &&
!hasOwn.call(obj, "constructor") &&
!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 || hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
for ( var name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw msg;
},
parseJSON: function( data ) {
if ( typeof data !== "string" || !data ) {
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;
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 && 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.toUpperCase() === name.toUpperCase();
},
// args is for internal usage only
each: function( object, callback, args ) {
var name, i = 0,
length = object.length,
isObj = length === undefined || jQuery.isFunction( object );
if ( args ) {
if ( isObj ) {
for ( name in object ) {
if ( callback.apply( object[ name ], args ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.apply( object[ i++ ], args ) === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isObj ) {
for ( name in object ) {
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
break;
}
}
}
}
return object;
},
// Use native String.trim function wherever possible
trim: trim ?
function( text ) {
return text == null ?
"" :
trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
},
// results is for internal usage only
makeArray: function( array, results ) {
var ret = results || [];
if ( array != null ) {
// The window, strings (and functions) also have 'length'
// The extra typeof function check is to prevent crashes
// in Safari 2 (See: #3039)
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
var type = jQuery.type( array );
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
push.call( ret, array );
} else {
jQuery.merge( ret, array );
}
}
return ret;
},
inArray: function( elem, array, i ) {
var len;
if ( array ) {
if ( indexOf ) {
return indexOf.call( array, elem, i );
}
len = array.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in array && array[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var i = first.length,
j = 0;
if ( typeof second.length === "number" ) {
for ( var l = second.length; 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 ret = [], retVal;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( var i = 0, length = elems.length; 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 ) {
if ( typeof context === "string" ) {
var 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
var args = slice.call( arguments, 2 ),
proxy = function() {
return fn.apply( context, args.concat( 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 || proxy.guid || jQuery.guid++;
return proxy;
},
// Mutifunctional method to get and set values to a collection
// The value/s can optionally be executed if it's a function
access: function( elems, key, value, exec, fn, pass ) {
var length = elems.length;
// Setting many attributes
if ( typeof key === "object" ) {
for ( var k in key ) {
jQuery.access( elems, k, key[k], exec, fn, value );
}
return elems;
}
// Setting one attribute
if ( value !== undefined ) {
// Optionally, function values get executed if exec is true
exec = !pass && exec && jQuery.isFunction(value);
for ( var i = 0; i < length; i++ ) {
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
}
return elems;
}
// Getting an attribute
return length ? fn( elems[0], key ) : undefined;
},
now: function() {
return ( new Date() ).getTime();
},
// Use of jQuery.browser is frowned upon.
// More details: http://docs.jquery.com/Utilities/jQuery.browser
uaMatch: function( ua ) {
ua = ua.toLowerCase();
var match = rwebkit.exec( ua ) ||
ropera.exec( ua ) ||
rmsie.exec( ua ) ||
ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
[];
return { browser: match[1] || "", version: match[2] || "0" };
},
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;
},
browser: {}
});
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
browserMatch = jQuery.uaMatch( userAgent );
if ( browserMatch.browser ) {
jQuery.browser[ browserMatch.browser ] = true;
jQuery.browser.version = browserMatch.version;
}
// Deprecated, use jQuery.browser.webkit instead
if ( jQuery.browser.webkit ) {
jQuery.browser.safari = true;
}
// IE doesn't match non-breaking spaces with \s
if ( rnotwhite.test( "\xA0" ) ) {
trimLeft = /^[\s\xA0]+/;
trimRight = /[\s\xA0]+$/;
}
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
// Cleanup functions for the document ready method
if ( document.addEventListener ) {
DOMContentLoaded = function() {
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
jQuery.ready();
};
} else if ( document.attachEvent ) {
DOMContentLoaded = function() {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( document.readyState === "complete" ) {
document.detachEvent( "onreadystatechange", DOMContentLoaded );
jQuery.ready();
}
};
}
// The DOM ready check for Internet Explorer
function doScrollCheck() {
if ( jQuery.isReady ) {
return;
}
try {
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
} catch(e) {
setTimeout( doScrollCheck, 1 );
return;
}
// and execute any waiting functions
jQuery.ready();
}
// 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.
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
define( "jquery", [], function () { return jQuery; } );
}
return jQuery;
})();
// String to Object flags format cache
var flagsCache = {};
// Convert String-formatted flags into Object-formatted ones and store in cache
function createFlags( flags ) {
var object = flagsCache[ flags ] = {},
i, length;
flags = flags.split( /\s+/ );
for ( i = 0, length = flags.length; i < length; i++ ) {
object[ flags[i] ] = true;
}
return object;
}
/*
* Create a callback list using the following parameters:
*
* flags: an optional list of space-separated flags that will change how
* the callback list behaves
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible flags:
*
* 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( flags ) {
// Convert flags from String-formatted to Object-formatted
// (we check in cache first)
flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
var // Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = [],
// Last fire value (for non-forgettable lists)
memory,
// 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,
// Add one or several callbacks to the list
add = function( args ) {
var i,
length,
elem,
type,
actual;
for ( i = 0, length = args.length; i < length; i++ ) {
elem = args[ i ];
type = jQuery.type( elem );
if ( type === "array" ) {
// Inspect recursively
add( elem );
} else if ( type === "function" ) {
// Add if not in unique mode and callback is not in
if ( !flags.unique || !self.has( elem ) ) {
list.push( elem );
}
}
}
},
// Fire callbacks
fire = function( context, args ) {
args = args || [];
memory = !flags.memory || [ context, args ];
firing = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
memory = true; // Mark as halted
break;
}
}
firing = false;
if ( list ) {
if ( !flags.once ) {
if ( stack && stack.length ) {
memory = stack.shift();
self.fireWith( memory[ 0 ], memory[ 1 ] );
}
} else if ( memory === true ) {
self.disable();
} else {
list = [];
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
var length = list.length;
add( 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, unless previous
// firing was halted (stopOnFalse)
} else if ( memory && memory !== true ) {
firingStart = length;
fire( memory[ 0 ], memory[ 1 ] );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
var args = arguments,
argIndex = 0,
argLength = args.length;
for ( ; argIndex < argLength ; argIndex++ ) {
for ( var i = 0; i < list.length; i++ ) {
if ( args[ argIndex ] === list[ i ] ) {
// Handle firingIndex and firingLength
if ( firing ) {
if ( i <= firingLength ) {
firingLength--;
if ( i <= firingIndex ) {
firingIndex--;
}
}
}
// Remove the element
list.splice( i--, 1 );
// If we have some unicity property then
// we only need to do this once
if ( flags.unique ) {
break;
}
}
}
}
}
return this;
},
// Control if a given callback is in the list
has: function( fn ) {
if ( list ) {
var i = 0,
length = list.length;
for ( ; i < length; i++ ) {
if ( fn === list[ i ] ) {
return true;
}
}
}
return false;
},
// 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 || memory === true ) {
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 ( stack ) {
if ( firing ) {
if ( !flags.once ) {
stack.push( [ context, args ] );
}
} else if ( !( flags.once && memory ) ) {
fire( context, 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 !!memory;
}
};
return self;
};
var // Static reference to slice
sliceDeferred = [].slice;
jQuery.extend({
Deferred: function( func ) {
var doneList = jQuery.Callbacks( "once memory" ),
failList = jQuery.Callbacks( "once memory" ),
progressList = jQuery.Callbacks( "memory" ),
state = "pending",
lists = {
resolve: doneList,
reject: failList,
notify: progressList
},
promise = {
done: doneList.add,
fail: failList.add,
progress: progressList.add,
state: function() {
return state;
},
// Deprecated
isResolved: doneList.fired,
isRejected: failList.fired,
then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
return this;
},
always: function() {
return deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
},
pipe: function( fnDone, fnFail, fnProgress ) {
return jQuery.Deferred(function( newDefer ) {
jQuery.each( {
done: [ fnDone, "resolve" ],
fail: [ fnFail, "reject" ],
progress: [ fnProgress, "notify" ]
}, function( handler, data ) {
var fn = data[ 0 ],
action = data[ 1 ],
returned;
if ( jQuery.isFunction( fn ) ) {
deferred[ handler ](function() {
returned = fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
} else {
newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
}
});
} else {
deferred[ handler ]( newDefer[ action ] );
}
});
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
if ( obj == null ) {
obj = promise;
} else {
for ( var key in promise ) {
obj[ key ] = promise[ key ];
}
}
return obj;
}
},
deferred = promise.promise({}),
key;
for ( key in lists ) {
deferred[ key ] = lists[ key ].fire;
deferred[ key + "With" ] = lists[ key ].fireWith;
}
// Handle state
deferred.done( function() {
state = "resolved";
}, failList.disable, progressList.lock ).fail( function() {
state = "rejected";
}, doneList.disable, progressList.lock );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( firstParam ) {
var args = sliceDeferred.call( arguments, 0 ),
i = 0,
length = args.length,
pValues = new Array( length ),
count = length,
pCount = length,
deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
firstParam :
jQuery.Deferred(),
promise = deferred.promise();
function resolveFunc( i ) {
return function( value ) {
args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
if ( !( --count ) ) {
deferred.resolveWith( deferred, args );
}
};
}
function progressFunc( i ) {
return function( value ) {
pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
deferred.notifyWith( promise, pValues );
};
}
if ( length > 1 ) {
for ( ; i < length; i++ ) {
if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
} else {
--count;
}
}
if ( !count ) {
deferred.resolveWith( deferred, args );
}
} else if ( deferred !== firstParam ) {
deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
}
return promise;
}
});
jQuery.support = (function() {
var div = document.createElement( "div" ),
documentElement = document.documentElement,
all,
a,
select,
opt,
input,
marginDiv,
support,
fragment,
body,
testElementParent,
testElement,
testElementStyle,
tds,
events,
eventName,
i,
isSupported;
// Preliminary tests
div.setAttribute("className", "t");
div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/><nav></nav>";
all = div.getElementsByTagName( "*" );
a = div.getElementsByTagName( "a" )[ 0 ];
// Can't get basic test support
if ( !all || !all.length || !a ) {
return {};
}
// First batch of supports tests
select = document.createElement( "select" );
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName( "input" )[ 0 ];
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.55/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Make sure unknown elements (like HTML5 elems) are handled appropriately
unknownElems: !!div.getElementsByTagName( "nav" ).length,
// 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,
// Will be defined later
submitBubbles: true,
changeBubbles: true,
focusinBubbles: false,
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: 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;
// 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", function() {
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
support.noCloneEvent = false;
});
div.cloneNode( true ).fireEvent( "onclick" );
}
// 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");
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;
div.innerHTML = "";
// Figure out if the W3C box model works as expected
div.style.width = div.style.paddingLeft = "1px";
// We don't want to do body-related feature tests on frameset
// documents, which lack a body. So we use
// document.getElementsByTagName("body")[0], which is undefined in
// frameset documents, while document.body isn’t. (7398)
body = document.getElementsByTagName("body")[ 0 ];
// We use our own, invisible, body unless the body is already present
// in which case we use a div (#9239)
testElement = document.createElement( body ? "div" : "body" );
testElementStyle = {
visibility: "hidden",
width: 0,
height: 0,
border: 0,
margin: 0,
background: "none"
};
if ( body ) {
jQuery.extend( testElementStyle, {
position: "absolute",
left: "-999px",
top: "-999px"
});
}
for ( i in testElementStyle ) {
testElement.style[ i ] = testElementStyle[ i ];
}
testElement.appendChild( div );
testElementParent = body || documentElement;
testElementParent.insertBefore( testElement, testElementParent.firstChild );
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
support.boxModel = div.offsetWidth === 2;
if ( "zoom" in div.style ) {
// 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.style.display = "inline";
div.style.zoom = 1;
support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display = "";
div.innerHTML = "<div style='width:4px;'></div>";
support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
}
div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
tds = div.getElementsByTagName( "td" );
// 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)
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 );
div.innerHTML = "";
// 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
if ( document.defaultView && document.defaultView.getComputedStyle ) {
marginDiv = document.createElement( "div" );
marginDiv.style.width = "0";
marginDiv.style.marginRight = "0";
div.appendChild( marginDiv );
support.reliableMarginRight =
( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
}
// 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: 1,
change: 1,
focusin: 1
} ) {
eventName = "on" + i;
isSupported = ( eventName in div );
if ( !isSupported ) {
div.setAttribute( eventName, "return;" );
isSupported = ( typeof div[ eventName ] === "function" );
}
support[ i + "Bubbles" ] = isSupported;
}
}
// Run fixed position tests at doc ready to avoid a crash
// related to the invisible body in IE8
jQuery(function() {
var container, outer, inner, table, td, offsetSupport,
conMarginTop = 1,
ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",
vb = "visibility:hidden;border:0;",
style = "style='" + ptlm + "border:5px solid #000;padding:0;'",
html = "<div " + style + "><div></div></div>" +
"<table " + style + " cellpadding='0' cellspacing='0'>" +
"<tr><td></td></tr></table>";
// Reconstruct a container
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
// These tests cannot be done
return;
}
container = document.createElement("div");
container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
body.insertBefore( container, body.firstChild );
// Construct a test element
testElement = document.createElement("div");
testElement.style.cssText = ptlm + vb;
testElement.innerHTML = html;
container.appendChild( testElement );
outer = testElement.firstChild;
inner = outer.firstChild;
td = outer.nextSibling.firstChild.firstChild;
offsetSupport = {
doesNotAddBorder: ( inner.offsetTop !== 5 ),
doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
};
inner.style.position = "fixed";
inner.style.top = "20px";
// safari subtracts parent border width here which is 5px
offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
inner.style.position = inner.style.top = "";
outer.style.overflow = "hidden";
outer.style.position = "relative";
offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
body.removeChild( container );
testElement = container = null;
jQuery.extend( support, offsetSupport );
});
testElement.innerHTML = "";
testElementParent.removeChild( testElement );
// Null connected elements to avoid leaks in IE
testElement = fragment = select = opt = body = marginDiv = div = input = null;
return support;
})();
// Keep track of boxModel
jQuery.boxModel = jQuery.support.boxModel;
var rbrace = /^(?:\{.*\}|\[.*\])$/,
rmultiDash = /([A-Z])/g;
jQuery.extend({
cache: {},
// Please use with caution
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 privateCache, 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[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando,
isEvents = name === "events";
// 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] || (!isEvents && !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[ jQuery.expando ] = id = ++jQuery.uuid;
} else {
id = jQuery.expando;
}
}
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 );
}
}
privateCache = 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;
}
// Users should not attempt to inspect the internal events object using jQuery.data,
// it is undocumented and subject to change. But does anyone listen? No.
if ( isEvents && !thisCache[ name ] ) {
return privateCache.events;
}
// 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,
// Reference to internal data cache key
internalKey = jQuery.expando,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
// See jQuery.data for more information
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 space separated names
if ( jQuery.isArray( name ) ) {
name = name;
} else if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces
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;
}
}
// Browsers that fail expando deletion also refuse to delete expandos on
// the window, but it will allow it on all other JS objects; other browsers
// don't care
// Ensure that `cache` is not a window object #10080
if ( jQuery.support.deleteExpando || !cache.setInterval ) {
delete cache[ id ];
} else {
cache[ id ] = null;
}
// We destroyed the cache and need to eliminate the expando on the node to avoid
// false lookups in the cache for entries that no longer exist
if ( isNode ) {
// 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 ( jQuery.support.deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
} else {
elem[ jQuery.expando ] = 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 ) {
if ( elem.nodeName ) {
var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
if ( match ) {
return !(match === true || elem.getAttribute("classid") !== match);
}
}
return true;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var parts, attr, name,
data = null;
if ( typeof key === "undefined" ) {
if ( this.length ) {
data = jQuery.data( this[0] );
if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) {
attr = this[0].attributes;
for ( var i = 0, l = attr.length; i < l; i++ ) {
name = attr[i].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = jQuery.camelCase( name.substring(5) );
dataAttr( this[0], name, data[ name ] );
}
}
jQuery._data( this[0], "parsedAttrs", true );
}
}
return data;
} else if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
parts = key.split(".");
parts[1] = parts[1] ? "." + parts[1] : "";
if ( value === undefined ) {
data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
// Try to fetch any internally stored data first
if ( data === undefined && this.length ) {
data = jQuery.data( this[0], key );
data = dataAttr( this[0], key, data );
}
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
} else {
return this.each(function() {
var $this = jQuery( this ),
args = [ parts[0], value ];
$this.triggerHandler( "setData" + parts[1] + "!", args );
jQuery.data( this, key, value );
$this.triggerHandler( "changeData" + parts[1] + "!", args );
});
}
},
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 :
jQuery.isNumeric( data ) ? parseFloat( 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 ) {
for ( var 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;
}
function handleQueueMarkDefer( elem, type, src ) {
var deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
defer = jQuery._data( elem, deferDataKey );
if ( defer &&
( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
// Give room for hard-coded callbacks to fire first
// and eventually mark/queue something else on the element
setTimeout( function() {
if ( !jQuery._data( elem, queueDataKey ) &&
!jQuery._data( elem, markDataKey ) ) {
jQuery.removeData( elem, deferDataKey, true );
defer.fire();
}
}, 0 );
}
}
jQuery.extend({
_mark: function( elem, type ) {
if ( elem ) {
type = ( type || "fx" ) + "mark";
jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );
}
},
_unmark: function( force, elem, type ) {
if ( force !== true ) {
type = elem;
elem = force;
force = false;
}
if ( elem ) {
type = type || "fx";
var key = type + "mark",
count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );
if ( count ) {
jQuery._data( elem, key, count );
} else {
jQuery.removeData( elem, key, true );
handleQueueMarkDefer( elem, type, "mark" );
}
}
},
queue: function( elem, type, data ) {
var q;
if ( elem ) {
type = ( type || "fx" ) + "queue";
q = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !q || jQuery.isArray(data) ) {
q = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
q.push( data );
}
}
return q || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
fn = queue.shift(),
hooks = {};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
jQuery._data( elem, type + ".run", hooks );
fn.call( elem, function() {
jQuery.dequeue( elem, type );
}, hooks );
}
if ( !queue.length ) {
jQuery.removeData( elem, type + "queue " + type + ".run", true );
handleQueueMarkDefer( elem, type, "queue" );
}
}
});
jQuery.fn.extend({
queue: function( type, data ) {
if ( typeof type !== "string" ) {
data = type;
type = "fx";
}
if ( data === undefined ) {
return jQuery.queue( this[0], type );
}
return this.each(function() {
var queue = jQuery.queue( this, type, data );
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, object ) {
if ( typeof type !== "string" ) {
object = type;
type = undefined;
}
type = type || "fx";
var defer = jQuery.Deferred(),
elements = this,
i = elements.length,
count = 1,
deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
tmp;
function resolve() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
}
while( i-- ) {
if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
count++;
tmp.add( resolve );
}
}
resolve();
return defer.promise();
}
});
var rclass = /[\n\t\r]/g,
rspace = /\s+/,
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,
nodeHook, boolHook, fixSpecified;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.attr );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.prop );
},
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( 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 ] + " " ) ) {
setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim( setClass );
}
}
}
}
return this;
},
removeClass: function( value ) {
var classNames, i, l, elem, className, c, cl;
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 ) {
classNames = ( value || "" ).split( rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 && elem.className ) {
if ( value ) {
className = (" " + elem.className + " ").replace( rclass, " " );
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
className = className.replace(" " + classNames[ c ] + " ", " ");
}
elem.className = jQuery.trim( className );
} else {
elem.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( rspace );
while ( (className = classNames[ i++ ]) ) {
// check each className given, space seperated 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 ) > -1 ) {
return true;
}
}
return false;
},
val: function( value ) {
var hooks, ret, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
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 undefined;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var self = jQuery(this), val;
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.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
// 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, i, max, option,
index = elem.selectedIndex,
values = [],
options = elem.options,
one = elem.type === "select-one";
// Nothing was selected
if ( index < 0 ) {
return null;
}
// Loop through all the selected options
i = one ? index : 0;
max = one ? index + 1 : options.length;
for ( ; i < max; i++ ) {
option = options[ i ];
// Don't return options that are disabled or in a disabled optgroup
if ( option.selected && (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 );
}
}
// Fixes Bug #2551 -- select.val() broken in IE after form.reset()
if ( one && !values.length && options.length ) {
return jQuery( options[ index ] ).val();
}
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;
}
}
},
attrFn: {
val: true,
css: true,
html: true,
text: true,
data: true,
width: true,
height: true,
offset: true
},
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 undefined;
}
if ( pass && name in jQuery.attrFn ) {
return jQuery( elem )[ name ]( value );
}
// Fallback to prop when attributes are not supported
if ( !("getAttribute" in elem) ) {
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 undefined;
} 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, l,
i = 0;
if ( elem.nodeType === 1 ) {
attrNames = ( value || "" ).split( rspace );
l = attrNames.length;
for ( ; i < l; i++ ) {
name = attrNames[ i ].toLowerCase();
propName = jQuery.propFix[ name ] || name;
// See #9699 for explanation of this approach (setting first, then removal)
jQuery.attr( elem, name, "" );
elem.removeAttribute( getSetAttribute ? name : propName );
// Set corresponding property to false for boolean attributes
if ( rboolean.test( name ) && 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 undefined;
}
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;
}
}
}
});
// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)
jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;
// 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
};
// 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.nodeValue !== "" : ret.specified ) ?
ret.nodeValue :
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.nodeValue = value + "" );
}
};
// Apply the nodeHook to tabindex
jQuery.attrHooks.tabindex.set = nodeHook.set;
// 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 rnamespaces = /\.(.*)$/,
rformElems = /^(?:textarea|input|select)$/i,
rperiod = /\./g,
rspaces = / /g,
rescape = /[^\w\s.|`]/g,
rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
rhoverHack = /\bhover(\.\S+)?/,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
quickParse = function( selector ) {
var quick = rquickIs.exec( selector );
if ( quick ) {
// 0 1 2 3
// [ _, tag, id, class ]
quick[1] = ( quick[1] || "" ).toLowerCase();
quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );
}
return quick;
},
quickIs = function( elem, m ) {
return (
(!m[1] || elem.nodeName.toLowerCase() === m[1]) &&
(!m[2] || elem.id === m[2]) &&
(!m[3] || m[3].test( elem.className ))
);
},
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, quick, 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;
}
// 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 = 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,
namespace: namespaces.join(".")
}, handleObjIn );
// Delegated event; pre-analyze selector so it's processed quickly on event dispatch
if ( selector ) {
handleObj.quick = quickParse( selector );
if ( !handleObj.quick && jQuery.expr.match.POS.test( selector ) ) {
handleObj.isPositional = true;
}
}
// 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 ) {
var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
t, tns, type, namespaces, origCount,
j, events, special, handle, eventType, handleObj;
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = hoverHack( types || "" ).split(" ");
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = tns[1];
namespaces = tns[2];
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
namespaces = namespaces? "." + namespaces : "";
for ( j in events ) {
jQuery.event.remove( elem, j + namespaces, handler, selector );
}
return;
}
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;
// Only need to loop for special events or selective removal
if ( handler || namespaces || selector || special.remove ) {
for ( j = 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( !handler || handler.guid === handleObj.guid ) {
if ( !namespaces || namespaces.test( handleObj.namespace ) ) {
if ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) {
eventType.splice( j--, 1 );
if ( handleObj.selector ) {
eventType.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
}
}
} else {
// Removing all events
eventType.length = 0;
}
// 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 ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
handle = elemData.handle;
if ( handle ) {
handle.elem = null;
}
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery.removeData( elem, [ "events", "handle" ], 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 type = event.type || event,
namespaces = [],
cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;
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 : "";
// triggerHandler() and global events don't bubble or run the default action
if ( onlyHandlers || !elem ) {
event.preventDefault();
}
// 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;
old = null;
for ( cur = elem.parentNode; 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 && old === elem.ownerDocument ) {
eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
}
}
// Fire handlers on the event path
for ( i = 0; i < eventPath.length; 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 );
}
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) ) {
handle.apply( cur, data );
}
if ( event.isPropagationStopped() ) {
break;
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !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 handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
delegateCount = handlers.delegateCount,
args = [].slice.call( arguments, 0 ),
run_all = !event.exclusive && !event.namespace,
specialHandle = ( jQuery.event.special[ event.type ] || {} ).handle,
handlerQueue = [],
i, j, cur, ret, selMatch, matched, matches, handleObj, sel, hit, related;
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Determine handlers that should run if there are delegated events
// Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861)
if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) {
for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
selMatch = {};
matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
sel = handleObj.selector;
hit = selMatch[ sel ];
if ( handleObj.isPositional ) {
// Since .is() does not work for positionals; see http://jsfiddle.net/eJ4yd/3/
hit = ( hit || (selMatch[ sel ] = jQuery( sel )) ).index( cur ) >= 0;
} else if ( hit === undefined ) {
hit = selMatch[ sel ] = ( handleObj.quick ? quickIs( cur, handleObj.quick ) : jQuery( cur ).is( sel ) );
}
if ( hit ) {
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 = ( specialHandle || handleObj.handler ).apply( matched.elem, args );
if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
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 wheelDelta".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; add metaKey if it's not there (#3368, IE6/7/8)
if ( event.metaKey === undefined ) {
event.metaKey = event.ctrlKey;
}
return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
},
special: {
ready: {
// Make sure the ready event is setup
setup: jQuery.bindReady
},
focus: {
delegateType: "focusin",
noBubble: true
},
blur: {
delegateType: "focusout",
noBubble: true
},
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 ) {
if ( elem.detachEvent ) {
elem.detachEvent( "on" + type, 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 ] = jQuery.event.special[ fix ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var target = this,
related = event.relatedTarget,
handleObj = event.handleObj,
selector = handleObj.selector,
oldType, ret;
// For a real mouseover/out, always call the handler; 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 || handleObj.origType === event.type || (related !== target && !jQuery.contains( target, related )) ) {
oldType = event.type;
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = oldType;
}
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 && !form._submit_attached ) {
jQuery.event.add( form, "submit._submit", function( event ) {
// Form was submitted, bubble the event up the tree
if ( this.parentNode ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
});
form._submit_attached = true;
}
});
// return undefined since we don't need an event listener
},
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 ) {
this._just_changed = false;
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 ) && !elem._change_attached ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
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" ) {
// ( types-Object, 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.call( this, types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
var handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( var 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.bind( name, data, fn ) :
this.trigger( name );
};
if ( jQuery.attrFn ) {
jQuery.attrFn[ name ] = true;
}
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 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
expando = "sizcache" + (Math.random() + '').replace('.', ''),
done = 0,
toString = Object.prototype.toString,
hasDuplicate = false,
baseHasDuplicate = true,
rBackslash = /\\/g,
rReturn = /\r\n/g,
rNonWord = /\W/;
// Here we check if the JavaScript engine is using some sort of
// optimization where it does not always call our comparision
// function. If that is the case, discard the hasDuplicate value.
// Thus far that includes Google Chrome.
[0, 0].sort(function() {
baseHasDuplicate = false;
return 0;
});
var Sizzle = function( selector, context, results, seed ) {
results = results || [];
context = context || document;
var origContext = context;
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return [];
}
if ( !selector || typeof selector !== "string" ) {
return results;
}
var m, set, checkSet, extra, ret, cur, pop, i,
prune = true,
contextXML = Sizzle.isXML( context ),
parts = [],
soFar = selector;
// Reset the position of the chunker regexp (start from head)
do {
chunker.exec( "" );
m = chunker.exec( soFar );
if ( m ) {
soFar = m[3];
parts.push( m[1] );
if ( m[2] ) {
extra = m[3];
break;
}
}
} while ( m );
if ( parts.length > 1 && origPOS.exec( selector ) ) {
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
set = posProcess( parts[0] + parts[1], context, seed );
} else {
set = Expr.relative[ parts[0] ] ?
[ context ] :
Sizzle( parts.shift(), context );
while ( parts.length ) {
selector = parts.shift();
if ( Expr.relative[ selector ] ) {
selector += parts.shift();
}
set = posProcess( selector, set, seed );
}
}
} else {
// Take a shortcut and set the context if the root selector is an ID
// (but not if it'll be faster if the inner selector is an ID)
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
ret = Sizzle.find( parts.shift(), context, contextXML );
context = ret.expr ?
Sizzle.filter( ret.expr, ret.set )[0] :
ret.set[0];
}
if ( context ) {
ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
set = ret.expr ?
Sizzle.filter( ret.expr, ret.set ) :
ret.set;
if ( parts.length > 0 ) {
checkSet = makeArray( set );
} else {
prune = false;
}
while ( parts.length ) {
cur = parts.pop();
pop = cur;
if ( !Expr.relative[ cur ] ) {
cur = "";
} else {
pop = parts.pop();
}
if ( pop == null ) {
pop = context;
}
Expr.relative[ cur ]( checkSet, pop, contextXML );
}
} else {
checkSet = parts = [];
}
}
if ( !checkSet ) {
checkSet = set;
}
if ( !checkSet ) {
Sizzle.error( cur || selector );
}
if ( toString.call(checkSet) === "[object Array]" ) {
if ( !prune ) {
results.push.apply( results, checkSet );
} else if ( context && context.nodeType === 1 ) {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
results.push( set[i] );
}
}
} else {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
results.push( set[i] );
}
}
}
} else {
makeArray( checkSet, results );
}
if ( extra ) {
Sizzle( extra, origContext, results, seed );
Sizzle.uniqueSort( results );
}
return results;
};
Sizzle.uniqueSort = function( results ) {
if ( sortOrder ) {
hasDuplicate = baseHasDuplicate;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[ i - 1 ] ) {
results.splice( i--, 1 );
}
}
}
}
return results;
};
Sizzle.matches = function( expr, set ) {
return Sizzle( expr, null, null, set );
};
Sizzle.matchesSelector = function( node, expr ) {
return Sizzle( expr, null, null, [node] ).length > 0;
};
Sizzle.find = function( expr, context, isXML ) {
var set, i, len, match, type, left;
if ( !expr ) {
return [];
}
for ( i = 0, len = Expr.order.length; i < len; i++ ) {
type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
left = match[1];
match.splice( 1, 1 );
if ( left.substr( left.length - 1 ) !== "\\" ) {
match[1] = (match[1] || "").replace( rBackslash, "" );
set = Expr.find[ type ]( match, context, isXML );
if ( set != null ) {
expr = expr.replace( Expr.match[ type ], "" );
break;
}
}
}
}
if ( !set ) {
set = typeof context.getElementsByTagName !== "undefined" ?
context.getElementsByTagName( "*" ) :
[];
}
return { set: set, expr: expr };
};
Sizzle.filter = function( expr, set, inplace, not ) {
var match, anyFound,
type, found, item, filter, left,
i, pass,
old = expr,
result = [],
curLoop = set,
isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
while ( expr && set.length ) {
for ( type in Expr.filter ) {
if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
filter = Expr.filter[ type ];
left = match[1];
anyFound = false;
match.splice(1,1);
if ( left.substr( left.length - 1 ) === "\\" ) {
continue;
}
if ( curLoop === result ) {
result = [];
}
if ( Expr.preFilter[ type ] ) {
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
if ( !match ) {
anyFound = found = true;
} else if ( match === true ) {
continue;
}
}
if ( match ) {
for ( i = 0; (item = curLoop[i]) != null; i++ ) {
if ( item ) {
found = filter( item, match, i, curLoop );
pass = not ^ found;
if ( inplace && found != null ) {
if ( pass ) {
anyFound = true;
} else {
curLoop[i] = false;
}
} else if ( pass ) {
result.push( item );
anyFound = true;
}
}
}
}
if ( found !== undefined ) {
if ( !inplace ) {
curLoop = result;
}
expr = expr.replace( Expr.match[ type ], "" );
if ( !anyFound ) {
return [];
}
break;
}
}
}
// Improper expression
if ( expr === old ) {
if ( anyFound == null ) {
Sizzle.error( expr );
} else {
break;
}
}
old = expr;
}
return curLoop;
};
Sizzle.error = function( msg ) {
throw "Syntax error, unrecognized expression: " + msg;
};
/**
* Utility function for retreiving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
var getText = Sizzle.getText = function( elem ) {
var i, node,
nodeType = elem.nodeType,
ret = "";
if ( nodeType ) {
if ( nodeType === 1 ) {
// Use textContent || innerText for elements
if ( typeof elem.textContent === 'string' ) {
return elem.textContent;
} else if ( typeof elem.innerText === 'string' ) {
// Replace IE's carriage returns
return elem.innerText.replace( rReturn, '' );
} else {
// Traverse it's children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
} else {
// If no nodeType, this is expected to be an array
for ( i = 0; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
if ( node.nodeType !== 8 ) {
ret += getText( node );
}
}
}
return ret;
};
var Expr = Sizzle.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|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
},
leftMatch: {},
attrMap: {
"class": "className",
"for": "htmlFor"
},
attrHandle: {
href: function( elem ) {
return elem.getAttribute( "href" );
},
type: function( elem ) {
return elem.getAttribute( "type" );
}
},
relative: {
"+": function(checkSet, part){
var isPartStr = typeof part === "string",
isTag = isPartStr && !rNonWord.test( part ),
isPartStrNotTag = isPartStr && !isTag;
if ( isTag ) {
part = part.toLowerCase();
}
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
if ( (elem = checkSet[i]) ) {
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
elem || false :
elem === part;
}
}
if ( isPartStrNotTag ) {
Sizzle.filter( part, checkSet, true );
}
},
">": function( checkSet, part ) {
var elem,
isPartStr = typeof part === "string",
i = 0,
l = checkSet.length;
if ( isPartStr && !rNonWord.test( part ) ) {
part = part.toLowerCase();
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
var parent = elem.parentNode;
checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
}
}
} else {
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
checkSet[i] = isPartStr ?
elem.parentNode :
elem.parentNode === part;
}
}
if ( isPartStr ) {
Sizzle.filter( part, checkSet, true );
}
}
},
"": function(checkSet, part, isXML){
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
},
"~": function( checkSet, part, isXML ) {
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
}
},
find: {
ID: function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
},
NAME: function( match, context ) {
if ( typeof context.getElementsByName !== "undefined" ) {
var ret = [],
results = context.getElementsByName( match[1] );
for ( var i = 0, l = results.length; i < l; i++ ) {
if ( results[i].getAttribute("name") === match[1] ) {
ret.push( results[i] );
}
}
return ret.length === 0 ? null : ret;
}
},
TAG: function( match, context ) {
if ( typeof context.getElementsByTagName !== "undefined" ) {
return context.getElementsByTagName( match[1] );
}
}
},
preFilter: {
CLASS: function( match, curLoop, inplace, result, not, isXML ) {
match = " " + match[1].replace( rBackslash, "" ) + " ";
if ( isXML ) {
return match;
}
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
if ( elem ) {
if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
if ( !inplace ) {
result.push( elem );
}
} else if ( inplace ) {
curLoop[i] = false;
}
}
}
return false;
},
ID: function( match ) {
return match[1].replace( rBackslash, "" );
},
TAG: function( match, curLoop ) {
return match[1].replace( rBackslash, "" ).toLowerCase();
},
CHILD: function( match ) {
if ( match[1] === "nth" ) {
if ( !match[2] ) {
Sizzle.error( match[0] );
}
match[2] = match[2].replace(/^\+|\s*/g, '');
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
// calculate the numbers (first)n+(last) including if they are negative
match[2] = (test[1] + (test[2] || 1)) - 0;
match[3] = test[3] - 0;
}
else if ( match[2] ) {
Sizzle.error( match[0] );
}
// TODO: Move to normal caching system
match[0] = done++;
return match;
},
ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1] = match[1].replace( rBackslash, "" );
if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name];
}
// Handle if an un-quoted value was used
match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
if ( match[2] === "~=" ) {
match[4] = " " + match[4] + " ";
}
return match;
},
PSEUDO: function( match, curLoop, inplace, result, not ) {
if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple one
if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop);
} else {
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
if ( !inplace ) {
result.push.apply( result, ret );
}
return false;
}
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true;
}
return match;
},
POS: function( match ) {
match.unshift( true );
return match;
}
},
filters: {
enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden";
},
disabled: function( elem ) {
return elem.disabled === true;
},
checked: function( elem ) {
return elem.checked === true;
},
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 !!elem.firstChild;
},
empty: function( elem ) {
return !elem.firstChild;
},
has: function( elem, i, match ) {
return !!Sizzle( match[3], elem ).length;
},
header: function( elem ) {
return (/h\d/i).test( elem.nodeName );
},
text: function( elem ) {
var attr = elem.getAttribute( "type" ), type = elem.type;
// 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" && "text" === type && ( attr === type || attr === null );
},
radio: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
},
checkbox: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
},
file: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
},
password: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
},
submit: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "submit" === elem.type;
},
image: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
},
reset: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "reset" === elem.type;
},
button: function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && "button" === elem.type || name === "button";
},
input: function( elem ) {
return (/input|select|textarea|button/i).test( elem.nodeName );
},
focus: function( elem ) {
return elem === elem.ownerDocument.activeElement;
}
},
setFilters: {
first: function( elem, i ) {
return i === 0;
},
last: function( elem, i, match, array ) {
return i === array.length - 1;
},
even: function( elem, i ) {
return i % 2 === 0;
},
odd: function( elem, i ) {
return i % 2 === 1;
},
lt: function( elem, i, match ) {
return i < match[3] - 0;
},
gt: function( elem, i, match ) {
return i > match[3] - 0;
},
nth: function( elem, i, match ) {
return match[3] - 0 === i;
},
eq: function( elem, i, match ) {
return match[3] - 0 === i;
}
},
filter: {
PSEUDO: function( elem, match, i, array ) {
var name = match[1],
filter = Expr.filters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
} else if ( name === "contains" ) {
return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
} else if ( name === "not" ) {
var not = match[3];
for ( var j = 0, l = not.length; j < l; j++ ) {
if ( not[j] === elem ) {
return false;
}
}
return true;
} else {
Sizzle.error( name );
}
},
CHILD: function( elem, match ) {
var first, last,
doneName, parent, cache,
count, diff,
type = match[1],
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;
case "last":
while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
return true;
case "nth":
first = match[2];
last = match[3];
if ( first === 1 && last === 0 ) {
return true;
}
doneName = match[0];
parent = elem.parentNode;
if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
node.nodeIndex = ++count;
}
}
parent[ expando ] = doneName;
}
diff = elem.nodeIndex - last;
if ( first === 0 ) {
return diff === 0;
} else {
return ( diff % first === 0 && diff / first >= 0 );
}
}
},
ID: function( elem, match ) {
return elem.nodeType === 1 && elem.getAttribute("id") === match;
},
TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
},
CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1;
},
ATTR: function( elem, match ) {
var name = match[1],
result = Sizzle.attr ?
Sizzle.attr( elem, name ) :
Expr.attrHandle[ name ] ?
Expr.attrHandle[ name ]( elem ) :
elem[ name ] != null ?
elem[ name ] :
elem.getAttribute( name ),
value = result + "",
type = match[2],
check = match[4];
return result == null ?
type === "!=" :
!type && Sizzle.attr ?
result != null :
type === "=" ?
value === check :
type === "*=" ?
value.indexOf(check) >= 0 :
type === "~=" ?
(" " + value + " ").indexOf(check) >= 0 :
!check ?
value && result !== false :
type === "!=" ?
value !== check :
type === "^=" ?
value.indexOf(check) === 0 :
type === "$=" ?
value.substr(value.length - check.length) === check :
type === "|=" ?
value === check || value.substr(0, check.length + 1) === check + "-" :
false;
},
POS: function( elem, match, i, array ) {
var name = match[2],
filter = Expr.setFilters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
}
}
}
};
var origPOS = Expr.match.POS,
fescape = function(all, num){
return "\\" + (num - 0 + 1);
};
for ( var type in Expr.match ) {
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
}
var makeArray = function( array, results ) {
array = Array.prototype.slice.call( array, 0 );
if ( results ) {
results.push.apply( results, array );
return results;
}
return array;
};
// Perform a simple check to determine if the browser is capable of
// converting a NodeList to an array using builtin methods.
// Also verifies that the returned array holds DOM nodes
// (which is not the case in the Blackberry browser)
try {
Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
// Provide a fallback method if it does not work
} catch( e ) {
makeArray = function( array, results ) {
var i = 0,
ret = results || [];
if ( toString.call(array) === "[object Array]" ) {
Array.prototype.push.apply( ret, array );
} else {
if ( typeof array.length === "number" ) {
for ( var l = array.length; i < l; i++ ) {
ret.push( array[i] );
}
} else {
for ( ; array[i]; i++ ) {
ret.push( array[i] );
}
}
}
return ret;
};
}
var sortOrder, siblingCheck;
if ( document.documentElement.compareDocumentPosition ) {
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
return a.compareDocumentPosition ? -1 : 1;
}
return a.compareDocumentPosition(b) & 4 ? -1 : 1;
};
} else {
sortOrder = 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 );
};
siblingCheck = function( a, b, ret ) {
if ( a === b ) {
return ret;
}
var cur = a.nextSibling;
while ( cur ) {
if ( cur === b ) {
return -1;
}
cur = cur.nextSibling;
}
return 1;
};
}
// Check to see if the browser returns elements by name when
// querying by getElementById (and provide a workaround)
(function(){
// We're going to inject a fake input element with a specified name
var form = document.createElement("div"),
id = "script" + (new Date()).getTime(),
root = document.documentElement;
form.innerHTML = "<a name='" + id + "'/>";
// Inject it into the root element, check its status, and remove it quickly
root.insertBefore( form, root.firstChild );
// The workaround has to do additional checks after a getElementById
// Which slows things down for other browsers (hence the branching)
if ( document.getElementById( id ) ) {
Expr.find.ID = function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
return m ?
m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
[m] :
undefined :
[];
}
};
Expr.filter.ID = function( elem, match ) {
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
return elem.nodeType === 1 && node && node.nodeValue === match;
};
}
root.removeChild( form );
// release memory in IE
root = form = null;
})();
(function(){
// Check to see if the browser returns only elements
// when doing getElementsByTagName("*")
// Create a fake element
var div = document.createElement("div");
div.appendChild( document.createComment("") );
// Make sure no comments are found
if ( div.getElementsByTagName("*").length > 0 ) {
Expr.find.TAG = function( match, context ) {
var results = context.getElementsByTagName( match[1] );
// Filter out possible comments
if ( match[1] === "*" ) {
var tmp = [];
for ( var i = 0; results[i]; i++ ) {
if ( results[i].nodeType === 1 ) {
tmp.push( results[i] );
}
}
results = tmp;
}
return results;
};
}
// Check to see if an attribute returns normalized href attributes
div.innerHTML = "<a href='#'></a>";
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
div.firstChild.getAttribute("href") !== "#" ) {
Expr.attrHandle.href = function( elem ) {
return elem.getAttribute( "href", 2 );
};
}
// release memory in IE
div = null;
})();
if ( document.querySelectorAll ) {
(function(){
var oldSizzle = Sizzle,
div = document.createElement("div"),
id = "__sizzle__";
div.innerHTML = "<p class='TEST'></p>";
// Safari can't handle uppercase or unicode characters when
// in quirks mode.
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return;
}
Sizzle = function( query, context, extra, seed ) {
context = context || document;
// Only use querySelectorAll on non-XML documents
// (ID selectors don't work in non-HTML documents)
if ( !seed && !Sizzle.isXML(context) ) {
// See if we find a selector to speed up
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
// Speed-up: Sizzle("TAG")
if ( match[1] ) {
return makeArray( context.getElementsByTagName( query ), extra );
// Speed-up: Sizzle(".CLASS")
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
return makeArray( context.getElementsByClassName( match[2] ), extra );
}
}
if ( context.nodeType === 9 ) {
// Speed-up: Sizzle("body")
// The body element only exists once, optimize finding it
if ( query === "body" && context.body ) {
return makeArray( [ context.body ], extra );
// Speed-up: Sizzle("#ID")
} else if ( match && match[3] ) {
var elem = context.getElementById( match[3] );
// 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[3] ) {
return makeArray( [ elem ], extra );
}
} else {
return makeArray( [], extra );
}
}
try {
return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {}
// 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
} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
var oldContext = context,
old = context.getAttribute( "id" ),
nid = old || id,
hasParent = context.parentNode,
relativeHierarchySelector = /^\s*[+~]/.test( query );
if ( !old ) {
context.setAttribute( "id", nid );
} else {
nid = nid.replace( /'/g, "\\$&" );
}
if ( relativeHierarchySelector && hasParent ) {
context = context.parentNode;
}
try {
if ( !relativeHierarchySelector || hasParent ) {
return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
}
} catch(pseudoError) {
} finally {
if ( !old ) {
oldContext.removeAttribute( "id" );
}
}
}
}
return oldSizzle(query, context, extra, seed);
};
for ( var prop in oldSizzle ) {
Sizzle[ prop ] = oldSizzle[ prop ];
}
// release memory in IE
div = null;
})();
}
(function(){
var html = document.documentElement,
matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
if ( matches ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9 fails this)
var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
pseudoWorks = false;
try {
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) {
pseudoWorks = true;
}
Sizzle.matchesSelector = function( node, expr ) {
// Make sure that attribute selectors are quoted
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) {
try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
var ret = matches.call( node, 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, so check for that
node.document && node.document.nodeType !== 11 ) {
return ret;
}
}
} catch(e) {}
}
return Sizzle(expr, null, null, [node]).length > 0;
};
}
})();
(function(){
var div = document.createElement("div");
div.innerHTML = "<div class='test e'></div><div class='test'></div>";
// Opera can't find a second classname (in 9.6)
// Also, make sure that getElementsByClassName actually exists
if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
return;
}
// Safari caches class attributes, doesn't catch changes (in 3.2)
div.lastChild.className = "e";
if ( div.getElementsByClassName("e").length === 1 ) {
return;
}
Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
return context.getElementsByClassName(match[1]);
}
};
// release memory in IE
div = null;
})();
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem[ expando ] === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 && !isXML ){
elem[ expando ] = doneName;
elem.sizset = i;
}
if ( elem.nodeName.toLowerCase() === cur ) {
match = elem;
break;
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem[ expando ] === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 ) {
if ( !isXML ) {
elem[ expando ] = doneName;
elem.sizset = i;
}
if ( typeof cur !== "string" ) {
if ( elem === cur ) {
match = true;
break;
}
} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
match = elem;
break;
}
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
if ( document.documentElement.contains ) {
Sizzle.contains = function( a, b ) {
return a !== b && (a.contains ? a.contains(b) : true);
};
} else if ( document.documentElement.compareDocumentPosition ) {
Sizzle.contains = function( a, b ) {
return !!(a.compareDocumentPosition(b) & 16);
};
} else {
Sizzle.contains = function() {
return false;
};
}
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 : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
var posProcess = function( selector, context, seed ) {
var match,
tmpSet = [],
later = "",
root = context.nodeType ? [context] : context;
// Position selectors must be done after the filter
// And so must :not(positional) so we move all PSEUDOs to the end
while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
later += match[0];
selector = selector.replace( Expr.match.PSEUDO, "" );
}
selector = Expr.relative[selector] ? selector + "*" : selector;
for ( var i = 0, l = root.length; i < l; i++ ) {
Sizzle( selector, root[i], tmpSet, seed );
}
return Sizzle.filter( later, tmpSet );
};
// EXPOSE
// Override sizzle attribute retrieval
Sizzle.attr = jQuery.attr;
Sizzle.selectors.attrMap = {};
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})();
var runtil = /Until$/,
rparentsprev = /^(?:parents|prevUntil|prevAll)/,
// Note: This RegExp should be improved, or likely pulled from Sizzle
rmultiselector = /,/,
isSimple = /^.[^:#\[\.,]*$/,
slice = Array.prototype.slice,
POS = jQuery.expr.match.POS,
// 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 self = this,
i, l;
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;
}
}
});
}
var ret = this.pushStack( "", "find", selector ),
length, n, r;
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 targets = jQuery( target );
return this.filter(function() {
for ( var i = 0, l = targets.length; i < l; 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 selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
POS.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 ret = [], i, l, cur = this[0];
// Array (deprecated as of jQuery 1.7)
if ( jQuery.isArray( selectors ) ) {
var level = 1;
while ( cur && cur.ownerDocument && cur !== context ) {
for ( i = 0; i < selectors.length; i++ ) {
if ( jQuery( cur ).is( selectors[ i ] ) ) {
ret.push({ selector: selectors[ i ], elem: cur, level: level });
}
}
cur = cur.parentNode;
level++;
}
return ret;
}
// String
var pos = POS.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( i = 0, l = this.length; i < l; i++ ) {
cur = this[i];
while ( cur ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
} else {
cur = cur.parentNode;
if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
break;
}
}
}
}
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 ) );
},
andSelf: function() {
return this.add( this.prevObject );
}
});
// 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;
}
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 jQuery.nth( elem, 2, "nextSibling" );
},
prev: function( elem ) {
return jQuery.nth( elem, 2, "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.makeArray( elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until ),
// The variable 'args' was introduced in
// https://github.com/jquery/jquery/commit/52a0238
// to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
// http://code.google.com/p/v8/issues/detail?id=1050
args = slice.call(arguments);
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 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret, name, args.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;
},
nth: function( cur, result, dir, elem ) {
result = result || 1;
var num = 0;
for ( ; cur; cur = cur[dir] ) {
if ( cur.nodeType === 1 && ++num === result ) {
break;
}
}
return cur;
},
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 canvas datalist details figcaption figure footer " +
"header hgroup mark meter nav output progress section summary time video",
rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style)/i,
rnocache = /<(?:script|object|embed|option|style)/i,
rnoshimcache = new RegExp("<(?:" + nodeNames.replace(" ", "|") + ")", "i"),
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /\/(java|ecma)script/i,
rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
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 );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
// IE can't serialize <link> and <script> tags normally
if ( !jQuery.support.htmlSerialize ) {
wrapMap._default = [ 1, "div<div>", "</div>" ];
}
jQuery.fn.extend({
text: function( text ) {
if ( jQuery.isFunction(text) ) {
return this.each(function(i) {
var self = jQuery( this );
self.text( text.call(this, i, self.text()) );
});
}
if ( typeof text !== "object" && text !== undefined ) {
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
}
return jQuery.text( this );
},
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 ) {
return this.each(function() {
jQuery( this ).wrapAll( 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.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this );
});
} else if ( arguments.length ) {
var set = jQuery(arguments[0]);
set.push.apply( set, this.toArray() );
return this.pushStack( set, "before", arguments );
}
},
after: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this.nextSibling );
});
} else if ( arguments.length ) {
var set = this.pushStack( this, "after", arguments );
set.push.apply( set, jQuery(arguments[0]).toArray() );
return set;
}
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
for ( var i = 0, elem; (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() {
for ( var i = 0, elem; (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 ) {
if ( value === undefined ) {
return this[0] && this[0].nodeType === 1 ?
this[0].innerHTML.replace(rinlinejQuery, "") :
null;
// See if we can take a shortcut and just use innerHTML
} else if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
value = value.replace(rxhtmlTag, "<$1></$2>");
try {
for ( var i = 0, l = this.length; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
if ( this[i].nodeType === 1 ) {
jQuery.cleanData( this[i].getElementsByTagName("*") );
this[i].innerHTML = value;
}
}
// If using innerHTML throws an exception, use the fallback method
} catch(e) {
this.empty().append( value );
}
} else if ( jQuery.isFunction( value ) ) {
this.each(function(i){
var self = jQuery( this );
self.html( value.call(this, i, self.html()) );
});
} else {
this.empty().append( value );
}
return this;
},
replaceWith: function( value ) {
if ( this[0] && this[0].parentNode ) {
// 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 );
}
});
} else {
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 ) {
var results, first, fragment, parent,
value = args[0],
scripts = [];
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
return this.each(function() {
jQuery(this).domManip( args, table, callback, true );
});
}
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] ) {
parent = value && value.parentNode;
// If we're in a fragment, just use that instead of building a new one
if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
results = { fragment: parent };
} else {
results = jQuery.buildFragment( args, this, scripts );
}
fragment = results.fragment;
if ( fragment.childNodes.length === 1 ) {
first = fragment = fragment.firstChild;
} else {
first = fragment.firstChild;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
callback.call(
table ?
root(this[i], first) :
this[i],
// Make sure that we do not leak memory by inadvertently discarding
// the original fragment (which might have attached data) instead of
// using it; in addition, use the original fragment object for the last
// item instead of first because it can end up being emptied incorrectly
// in certain situations (Bug #8070).
// Fragments from the fragment cache must always be cloned and never used
// in place.
results.cacheable || ( l > 1 && i < lastIndex ) ?
jQuery.clone( fragment, true, true ) :
fragment
);
}
}
if ( scripts.length ) {
jQuery.each( scripts, evalScript );
}
}
return this;
}
});
function root( elem, cur ) {
return jQuery.nodeName(elem, "table") ?
(elem.getElementsByTagName("tbody")[0] ||
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
elem;
}
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 ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
}
}
}
// 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();
// IE6-8 fail to clone children inside object elements that use
// the proprietary classid attribute value (rather than the type
// attribute) to identify the type of content to display
if ( nodeName === "object" ) {
dest.outerHTML = src.outerHTML;
} else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
// 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
if ( src.checked ) {
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;
}
// Event data gets referenced instead of copied if the expando
// gets copied too
dest.removeAttribute( jQuery.expando );
}
jQuery.buildFragment = function( args, nodes, scripts ) {
var fragment, cacheable, cacheresults, doc,
first = args[ 0 ];
// nodes may contain either an explicit document object,
// a jQuery collection or context object.
// If nodes[0] contains a valid object to assign to doc
if ( nodes && nodes[0] ) {
doc = nodes[0].ownerDocument || nodes[0];
}
// Ensure that an attr object doesn't incorrectly stand in as a document object
// Chrome and Firefox seem to allow this to occur and will throw exception
// Fixes #8950
if ( !doc.createDocumentFragment ) {
doc = document;
}
// 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 && doc === document &&
first.charAt(0) === "<" && !rnocache.test( first ) &&
(jQuery.support.checkClone || !rchecked.test( first )) &&
(!jQuery.support.unknownElems && rnoshimcache.test( first )) ) {
cacheable = true;
cacheresults = jQuery.fragments[ first ];
if ( cacheresults && cacheresults !== 1 ) {
fragment = cacheresults;
}
}
if ( !fragment ) {
fragment = doc.createDocumentFragment();
jQuery.clean( args, doc, fragment, scripts );
}
if ( cacheable ) {
jQuery.fragments[ first ] = cacheresults ? fragment : 1;
}
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 ret = [],
insert = jQuery( selector ),
parent = this.length === 1 && this[0].parentNode;
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
insert[ original ]( this[0] );
return this;
} else {
for ( var i = 0, l = insert.length; i < l; i++ ) {
var 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 ( elem.type === "checkbox" || elem.type === "radio" ) {
elem.defaultChecked = elem.checked;
}
}
// Finds all inputs and passes them to fixDefaultChecked
function findInputs( elem ) {
var nodeName = ( elem.nodeName || "" ).toLowerCase();
if ( nodeName === "input" ) {
fixDefaultChecked( elem );
// Skip scripts, get other children
} else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) {
jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
}
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var clone = elem.cloneNode(true),
srcElements,
destElements,
i;
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 checkScriptType;
context = context || document;
// !context.createElement fails in IE with an error but returns typeof 'object'
if ( typeof context.createElement === "undefined" ) {
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
}
var ret = [], j;
for ( var i = 0, elem; (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 {
// Fix "XHTML"-style tags in all browsers
elem = elem.replace(rxhtmlTag, "<$1></$2>");
// Trim whitespace, otherwise indexOf won't work as expected
var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
wrap = wrapMap[ tag ] || wrapMap._default,
depth = wrap[0],
div = context.createElement("div");
// Append wrapper element to unknown element safe doc fragment
if ( context === document ) {
// Use the fragment we've already created for this document
safeFragment.appendChild( div );
} else {
// Use a fragment created with the owner document
createSafeFragment( context ).appendChild( div );
}
// Go to html and back, then peel off extra wrappers
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>
var 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;
}
}
// Resets defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
var len;
if ( !jQuery.support.appendChecked ) {
if ( elem[0] && typeof (len = elem.length) === "number" ) {
for ( j = 0; j < len; j++ ) {
findInputs( elem[j] );
}
} else {
findInputs( elem );
}
}
if ( elem.nodeType ) {
ret.push( elem );
} else {
ret = jQuery.merge( ret, elem );
}
}
if ( fragment ) {
checkScriptType = function( elem ) {
return !elem.type || rscriptType.test( elem.type );
};
for ( i = 0; ret[i]; i++ ) {
if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
} else {
if ( ret[i].nodeType === 1 ) {
var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
}
fragment.appendChild( ret[i] );
}
}
}
return ret;
},
cleanData: function( elems ) {
var data, id,
cache = jQuery.cache,
special = jQuery.event.special,
deleteExpando = jQuery.support.deleteExpando;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
continue;
}
id = elem[ jQuery.expando ];
if ( id ) {
data = cache[ id ];
if ( data && data.events ) {
for ( var 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 );
}
}
// Null the DOM reference to avoid IE6/7/8 leak (#7054)
if ( data.handle ) {
data.handle.elem = null;
}
}
if ( deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
}
delete cache[ id ];
}
}
}
});
function evalScript( i, elem ) {
if ( elem.src ) {
jQuery.ajax({
url: elem.src,
async: false,
dataType: "script"
});
} else {
jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
var ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
// fixed for IE9, see #8346
rupper = /([A-Z]|^ms)/g,
rnumpx = /^-?\d+(?:px)?$/i,
rnum = /^-?\d/,
rrelNum = /^([\-+])=([\-+.\de]+)/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssWidth = [ "Left", "Right" ],
cssHeight = [ "Top", "Bottom" ],
curCSS,
getComputedStyle,
currentStyle;
jQuery.fn.css = function( name, value ) {
// Setting 'undefined' is a no-op
if ( arguments.length === 2 && value === undefined ) {
return this;
}
return jQuery.access( this, name, value, true, function( elem, name, value ) {
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
});
};
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", "opacity" );
return ret === "" ? "1" : ret;
} else {
return elem.style.opacity;
}
}
}
},
// 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, origName = jQuery.camelCase( name ),
style = elem.style, hooks = jQuery.cssHooks[ origName ];
name = jQuery.cssProps[ origName ] || 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 )) !== 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 ) {
var ret, hooks;
// Make sure that we're working with the right name
name = jQuery.camelCase( name );
hooks = jQuery.cssHooks[ name ];
name = jQuery.cssProps[ name ] || name;
// cssFloat needs a special treatment
if ( name === "cssFloat" ) {
name = "float";
}
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
return ret;
// Otherwise, if a way to get the computed value exists, use that
} else if ( curCSS ) {
return curCSS( elem, name );
}
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback ) {
var old = {};
// Remember the old values, and insert the new ones
for ( var name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
callback.call( elem );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
}
});
// DEPRECATED, Use jQuery.css() instead
jQuery.curCSS = jQuery.css;
jQuery.each(["height", "width"], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
var val;
if ( computed ) {
if ( elem.offsetWidth !== 0 ) {
return getWH( elem, name, extra );
} else {
jQuery.swap( elem, cssShow, function() {
val = getWH( elem, name, extra );
});
}
return val;
}
},
set: function( elem, value ) {
if ( rnumpx.test( value ) ) {
// ignore negative width and height values #1599
value = parseFloat( value );
if ( value >= 0 ) {
return value + "px";
}
} else {
return value;
}
}
};
});
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) || "" ) ?
( parseFloat( RegExp.$1 ) / 100 ) + "" :
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, "" ) ) === "" ) {
// 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;
}
};
}
jQuery(function() {
// This hook cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
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
var ret;
jQuery.swap( elem, { "display": "inline-block" }, function() {
if ( computed ) {
ret = curCSS( elem, "margin-right", "marginRight" );
} else {
ret = elem.style.marginRight;
}
});
return ret;
}
};
}
});
if ( document.defaultView && document.defaultView.getComputedStyle ) {
getComputedStyle = function( elem, name ) {
var ret, defaultView, computedStyle;
name = name.replace( rupper, "-$1" ).toLowerCase();
if ( !(defaultView = elem.ownerDocument.defaultView) ) {
return undefined;
}
if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
ret = computedStyle.getPropertyValue( name );
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
ret = jQuery.style( elem, name );
}
}
return ret;
};
}
if ( document.documentElement.currentStyle ) {
currentStyle = function( elem, name ) {
var left, rsLeft, uncomputed,
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 && (uncomputed = style[ name ]) ) {
ret = uncomputed;
}
// 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
if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
// 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 || 0 );
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
elem.runtimeStyle.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
curCSS = getComputedStyle || currentStyle;
function getWH( elem, name, extra ) {
// Start with offset property
var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
which = name === "width" ? cssWidth : cssHeight;
if ( val > 0 ) {
if ( extra !== "border" ) {
jQuery.each( which, function() {
if ( !extra ) {
val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
} else {
val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
}
});
}
return val + "px";
}
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, name );
if ( val < 0 || val == null ) {
val = elem.style[ name ] || 0;
}
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
// Add padding, border, margin
if ( extra ) {
jQuery.each( which, function() {
val += parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
if ( extra !== "padding" ) {
val += parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
}
});
}
return val + "px";
}
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
var width = elem.offsetWidth,
height = elem.offsetHeight;
return ( width === 0 && height === 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 );
};
}
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rhash = /#.*$/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
// #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,
rselectTextarea = /^(?:select|textarea)/i,
rspacesAjax = /\s+/,
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 = {},
// Document location
ajaxLocation,
// Document location segments
ajaxLocParts,
// 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 = "*";
}
if ( jQuery.isFunction( func ) ) {
var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
i = 0,
length = dataTypes.length,
dataType,
list,
placeBefore;
// 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 list = structure[ dataType ],
i = 0,
length = list ? list.length : 0,
executeOnly = ( structure === prefilters ),
selection;
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.extend({
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
} else if ( !this.length ) {
return this;
}
var off = url.indexOf( " " );
if ( off >= 0 ) {
var selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// Default to a GET request
var type = "GET";
// If the second parameter was provided
if ( params ) {
// 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 ( typeof params === "object" ) {
params = jQuery.param( params, jQuery.ajaxSettings.traditional );
type = "POST";
}
}
var self = this;
// Request the remote document
jQuery.ajax({
url: url,
type: type,
dataType: "html",
data: params,
// Complete callback (responseText is used internally)
complete: function( jqXHR, status, responseText ) {
// Store the response as specified by the jqXHR object
responseText = jqXHR.responseText;
// If successful, inject the HTML into all the matched elements
if ( jqXHR.isResolved() ) {
// #4825: Get the actual response in case
// a dataFilter is present in ajaxSettings
jqXHR.done(function( r ) {
responseText = r;
});
// 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 );
}
if ( callback ) {
self.each( callback, [ responseText, status, jqXHR ] );
}
}
});
return this;
},
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();
}
});
// 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.bind( 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",
processData: true,
async: true,
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
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 // 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 || {},
// ifModified key
ifModifiedKey,
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// Response headers
responseHeadersString,
responseHeaders,
// transport
transport,
// timeout handle
timeoutTimer,
// Cross-domain detection vars
parts,
// The jqXHR state
state = 0,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// 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 || "abort";
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 ) {
// 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;
var isSuccess,
success,
error,
statusText = nativeStatusText,
response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
lastModified,
etag;
// 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 ) {
if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
jQuery.lastModified[ ifModifiedKey ] = lastModified;
}
if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
jQuery.etag[ ifModifiedKey ] = etag;
}
}
// If not modified
if ( status === 304 ) {
statusText = "notmodified";
isSuccess = true;
// If we have data
} else {
try {
success = ajaxConvert( s, response );
statusText = "success";
isSuccess = true;
} catch(e) {
// We have a parsererror
statusText = "parsererror";
error = e;
}
}
} 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.then( tmp, 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( rspacesAjax );
// Determine if a cross-domain request is in order
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 prefiler, stop there
if ( state === 2 ) {
return false;
}
// 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
jqXHR.abort();
return false;
}
// 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 {
jQuery.error( e );
}
}
}
return jqXHR;
},
// Serialize an array of form elements or a set of
// key/values into a query string
param: function( a, traditional ) {
var s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : value;
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = 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 ( var prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
}
});
function buildParams( prefix, obj, traditional, add ) {
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" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && obj != null && typeof obj === "object" ) {
// Serialize object item.
for ( var name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
// This is still on the jQuery object... for now
// Want to move this to jQuery.ajax some day
jQuery.extend({
// 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 contents = s.contents,
dataTypes = s.dataTypes,
responseFields = s.responseFields,
ct,
type,
finalDataType,
firstDataType;
// 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 ) {
// Apply the dataFilter if provided
if ( s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
var dataTypes = s.dataTypes,
converters = {},
i,
key,
length = dataTypes.length,
tmp,
// Current and previous dataTypes
current = dataTypes[ 0 ],
prev,
// Conversion expression
conversion,
// Conversion function
conv,
// Conversion functions (transitive conversion)
conv1,
conv2;
// For each dataType in the chain
for ( i = 1; i < length; i++ ) {
// Create converters map
// with lowercased keys
if ( i === 1 ) {
for ( key in s.converters ) {
if ( typeof key === "string" ) {
converters[ key.toLowerCase() ] = s.converters[ key ];
}
}
}
// Get the dataTypes
prev = current;
current = dataTypes[ i ];
// If current is auto dataType, update it to prev
if ( current === "*" ) {
current = prev;
// If no auto and dataTypes are actually different
} else if ( prev !== "*" && prev !== current ) {
// Get the converter
conversion = prev + " " + current;
conv = converters[ conversion ] || converters[ "* " + current ];
// If there is no direct converter, search transitively
if ( !conv ) {
conv2 = undefined;
for ( conv1 in converters ) {
tmp = conv1.split( " " );
if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
conv2 = converters[ tmp[1] + " " + current ];
if ( conv2 ) {
conv1 = converters[ conv1 ];
if ( conv1 === true ) {
conv = conv2;
} else if ( conv2 === true ) {
conv = conv1;
}
break;
}
}
}
}
// If we found no converter, dispatch an error
if ( !( conv || conv2 ) ) {
jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
}
// If found converter is not an equivalence
if ( conv !== true ) {
// Convert with 1 or 2 converters accordingly
response = conv ? conv( response ) : conv2( conv1(response) );
}
}
}
return response;
}
var jsc = jQuery.now(),
jsre = /(\=)\?(&|$)|\?\?/i;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
return jQuery.expando + "_" + ( jsc++ );
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
( typeof s.data === "string" );
if ( s.dataTypes[ 0 ] === "jsonp" ||
s.jsonp !== false && ( jsre.test( s.url ) ||
inspectData && jsre.test( s.data ) ) ) {
var responseContainer,
jsonpCallback = s.jsonpCallback =
jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
previous = window[ jsonpCallback ],
url = s.url,
data = s.data,
replace = "$1" + jsonpCallback + "$2";
if ( s.jsonp !== false ) {
url = url.replace( jsre, replace );
if ( s.url === url ) {
if ( inspectData ) {
data = data.replace( jsre, replace );
}
if ( s.data === data ) {
// Add callback manually
url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
}
}
}
s.url = url;
s.data = data;
// Install callback
window[ jsonpCallback ] = function( response ) {
responseContainer = [ response ];
};
// Clean-up function
jqXHR.always(function() {
// Set callback back to previous value
window[ jsonpCallback ] = previous;
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( previous ) ) {
window[ jsonpCallback ]( responseContainer[ 0 ] );
}
});
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( jsonpCallback + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// 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 // #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,
xhrCallbacks;
// 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 xhr = s.xhr(),
handle,
i;
// 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 occured
// 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;
}
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 we're in sync mode or it's in cache
// and has been retrieved directly (IE6 & IE7)
// we need to manually fire the callback
if ( !s.async || xhr.readyState === 4 ) {
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(0,1);
}
}
};
}
});
}
var elemdisplay = {},
iframe, iframeDoc,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
timerId,
fxAttrs = [
// height animations
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
// width animations
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
// opacity animations
[ "opacity" ]
],
fxNow;
jQuery.fn.extend({
show: function( speed, easing, callback ) {
var elem, display;
if ( speed || speed === 0 ) {
return this.animate( genFx("show", 3), speed, easing, callback );
} else {
for ( var i = 0, j = this.length; i < j; i++ ) {
elem = this[ i ];
if ( elem.style ) {
display = elem.style.display;
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
display = 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 ( display === "" && jQuery.css(elem, "display") === "none" ) {
jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
elem = this[ i ];
if ( elem.style ) {
display = elem.style.display;
if ( display === "" || display === "none" ) {
elem.style.display = jQuery._data( elem, "olddisplay" ) || "";
}
}
}
return this;
}
},
hide: function( speed, easing, callback ) {
if ( speed || speed === 0 ) {
return this.animate( genFx("hide", 3), speed, easing, callback);
} else {
var elem, display,
i = 0,
j = this.length;
for ( ; i < j; i++ ) {
elem = this[i];
if ( elem.style ) {
display = jQuery.css( elem, "display" );
if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) {
jQuery._data( elem, "olddisplay", display );
}
}
}
// Set the display of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
if ( this[i].style ) {
this[i].style.display = "none";
}
}
return this;
}
},
// Save the old toggle function
_toggle: jQuery.fn.toggle,
toggle: function( fn, fn2, callback ) {
var bool = typeof fn === "boolean";
if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
this._toggle.apply( this, arguments );
} else if ( fn == null || bool ) {
this.each(function() {
var state = bool ? fn : jQuery(this).is(":hidden");
jQuery(this)[ state ? "show" : "hide" ]();
});
} else {
this.animate(genFx("toggle", 3), fn, fn2, callback);
}
return this;
},
fadeTo: function( speed, to, easing, callback ) {
return this.filter(":hidden").css("opacity", 0).show().end()
.animate({opacity: to}, speed, easing, callback);
},
animate: function( prop, speed, easing, callback ) {
var optall = jQuery.speed( speed, easing, callback );
if ( jQuery.isEmptyObject( prop ) ) {
return this.each( optall.complete, [ false ] );
}
// Do not change referenced properties as per-property easing will be lost
prop = jQuery.extend( {}, prop );
function doAnimation() {
// XXX 'this' does not always have a nodeName when running the
// test suite
if ( optall.queue === false ) {
jQuery._mark( this );
}
var opt = jQuery.extend( {}, optall ),
isElement = this.nodeType === 1,
hidden = isElement && jQuery(this).is(":hidden"),
name, val, p, e,
parts, start, end, unit,
method;
// will store per property easing and be used to determine when an animation is complete
opt.animatedProperties = {};
for ( p in prop ) {
// property name normalization
name = jQuery.camelCase( p );
if ( p !== name ) {
prop[ name ] = prop[ p ];
delete prop[ p ];
}
val = prop[ name ];
// easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
if ( jQuery.isArray( val ) ) {
opt.animatedProperties[ name ] = val[ 1 ];
val = prop[ name ] = val[ 0 ];
} else {
opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
}
if ( val === "hide" && hidden || val === "show" && !hidden ) {
return opt.complete.call( this );
}
if ( isElement && ( name === "height" || name === "width" ) ) {
// 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
opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if ( jQuery.css( this, "display" ) === "inline" &&
jQuery.css( this, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) {
this.style.display = "inline-block";
} else {
this.style.zoom = 1;
}
}
}
}
if ( opt.overflow != null ) {
this.style.overflow = "hidden";
}
for ( p in prop ) {
e = new jQuery.fx( this, opt, p );
val = prop[ p ];
if ( rfxtypes.test( val ) ) {
// Tracks whether to show or hide based on private
// data attached to the element
method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 );
if ( method ) {
jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" );
e[ method ]();
} else {
e[ val ]();
}
} else {
parts = rfxnum.exec( val );
start = e.cur();
if ( parts ) {
end = parseFloat( parts[2] );
unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" ) {
jQuery.style( this, p, (end || 1) + unit);
start = ( (end || 1) / e.cur() ) * start;
jQuery.style( this, p, start + unit);
}
// If a +=/-= token was provided, we're doing a relative animation
if ( parts[1] ) {
end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
}
e.custom( start, end, unit );
} else {
e.custom( start, val, "" );
}
}
}
// For JS strict compliance
return true;
}
return optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each(function() {
var i,
hadTimers = false,
timers = jQuery.timers,
data = jQuery._data( this );
// clear marker counters if we know they won't be
if ( !gotoEnd ) {
jQuery._unmark( true, this );
}
function stopQueue( elem, data, i ) {
var hooks = data[ i ];
jQuery.removeData( elem, i, true );
hooks.stop( gotoEnd );
}
if ( type == null ) {
for ( i in data ) {
if ( data[ i ].stop && i.indexOf(".run") === i.length - 4 ) {
stopQueue( this, data, i );
}
}
} else if ( data[ i = type + ".run" ] && data[ i ].stop ){
stopQueue( this, data, i );
}
for ( i = timers.length; i--; ) {
if ( timers[ i ].elem === this && (type == null || timers[ i ].queue === type) ) {
if ( gotoEnd ) {
// force the next step to be the last
timers[ i ]( true );
} else {
timers[ i ].saveState();
}
hadTimers = true;
timers.splice( i, 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 ( !( gotoEnd && hadTimers ) ) {
jQuery.dequeue( this, type );
}
});
}
});
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout( clearFxNow, 0 );
return ( fxNow = jQuery.now() );
}
function clearFxNow() {
fxNow = undefined;
}
// Generate parameters to create a standard animation
function genFx( type, num ) {
var obj = {};
jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() {
obj[ this ] = type;
});
return obj;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx( "show", 1 ),
slideUp: genFx( "hide", 1 ),
slideToggle: genFx( "toggle", 1 ),
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.extend({
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( noUnmark ) {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
} else if ( noUnmark !== false ) {
jQuery._unmark( this );
}
};
return opt;
},
easing: {
linear: function( p, n, firstNum, diff ) {
return firstNum + diff * p;
},
swing: function( p, n, firstNum, diff ) {
return ( ( -Math.cos( p*Math.PI ) / 2 ) + 0.5 ) * diff + firstNum;
}
},
timers: [],
fx: function( elem, options, prop ) {
this.options = options;
this.elem = elem;
this.prop = prop;
options.orig = options.orig || {};
}
});
jQuery.fx.prototype = {
// Simple function for setting a style value
update: function() {
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this );
},
// Get the current size
cur: function() {
if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) {
return this.elem[ this.prop ];
}
var parsed,
r = jQuery.css( this.elem, this.prop );
// Empty strings, null, undefined and "auto" are converted to 0,
// complex values such as "rotate(1rad)" are returned as is,
// simple values such as "10px" are parsed to Float.
return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
},
// Start an animation from one number to another
custom: function( from, to, unit ) {
var self = this,
fx = jQuery.fx;
this.startTime = fxNow || createFxNow();
this.end = to;
this.now = this.start = from;
this.pos = this.state = 0;
this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
function t( gotoEnd ) {
return self.step( gotoEnd );
}
t.queue = this.options.queue;
t.elem = this.elem;
t.saveState = function() {
if ( self.options.hide && jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
jQuery._data( self.elem, "fxshow" + self.prop, self.start );
}
};
if ( t() && jQuery.timers.push(t) && !timerId ) {
timerId = setInterval( fx.tick, fx.interval );
}
},
// Simple 'show' function
show: function() {
var dataShow = jQuery._data( this.elem, "fxshow" + this.prop );
// Remember where we started, so that we can go back to it later
this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop );
this.options.show = true;
// Begin the animation
// Make sure that we start at a small width/height to avoid any flash of content
if ( dataShow !== undefined ) {
// This show is picking up where a previous hide or show left off
this.custom( this.cur(), dataShow );
} else {
this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() );
}
// Start by showing the element
jQuery( this.elem ).show();
},
// Simple 'hide' function
hide: function() {
// Remember where we started, so that we can go back to it later
this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop );
this.options.hide = true;
// Begin the animation
this.custom( this.cur(), 0 );
},
// Each step of an animation
step: function( gotoEnd ) {
var p, n, complete,
t = fxNow || createFxNow(),
done = true,
elem = this.elem,
options = this.options;
if ( gotoEnd || t >= options.duration + this.startTime ) {
this.now = this.end;
this.pos = this.state = 1;
this.update();
options.animatedProperties[ this.prop ] = true;
for ( p in options.animatedProperties ) {
if ( options.animatedProperties[ p ] !== true ) {
done = false;
}
}
if ( done ) {
// Reset the overflow
if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
jQuery.each( [ "", "X", "Y" ], function( index, value ) {
elem.style[ "overflow" + value ] = options.overflow[ index ];
});
}
// Hide the element if the "hide" operation was done
if ( options.hide ) {
jQuery( elem ).hide();
}
// Reset the properties, if the item has been hidden or shown
if ( options.hide || options.show ) {
for ( p in options.animatedProperties ) {
jQuery.style( elem, p, options.orig[ p ] );
jQuery.removeData( elem, "fxshow" + p, true );
// Toggle data is no longer needed
jQuery.removeData( elem, "toggle" + p, true );
}
}
// Execute the complete function
// in the event that the complete function throws an exception
// we must ensure it won't be called twice. #5684
complete = options.complete;
if ( complete ) {
options.complete = false;
complete.call( elem );
}
}
return false;
} else {
// classical easing cannot be used with an Infinity duration
if ( options.duration == Infinity ) {
this.now = t;
} else {
n = t - this.startTime;
this.state = n / options.duration;
// Perform the easing function, defaults to swing
this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration );
this.now = this.start + ( (this.end - this.start) * this.pos );
}
// Perform the next step of the animation
this.update();
}
return true;
}
};
jQuery.extend( jQuery.fx, {
tick: function() {
var timer,
timers = jQuery.timers,
i = 0;
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();
}
},
interval: 13,
stop: function() {
clearInterval( timerId );
timerId = null;
},
speeds: {
slow: 600,
fast: 200,
// Default speed
_default: 400
},
step: {
opacity: function( fx ) {
jQuery.style( fx.elem, "opacity", fx.now );
},
_default: function( fx ) {
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
fx.elem.style[ fx.prop ] = fx.now + fx.unit;
} else {
fx.elem[ fx.prop ] = fx.now;
}
}
}
});
// Adds width/height step functions
// Do not set anything below 0
jQuery.each([ "width", "height" ], function( i, prop ) {
jQuery.fx.step[ prop ] = function( fx ) {
jQuery.style( fx.elem, prop, Math.max(0, fx.now) );
};
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
// Try to restore the default display value of an element
function defaultDisplay( nodeName ) {
if ( !elemdisplay[ nodeName ] ) {
var body = document.body,
elem = jQuery( "<" + nodeName + ">" ).appendTo( 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 === "" ) {
// No iframe to use yet, so create it
if ( !iframe ) {
iframe = document.createElement( "iframe" );
iframe.frameBorder = iframe.width = iframe.height = 0;
}
body.appendChild( iframe );
// 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( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
iframeDoc.close();
}
elem = iframeDoc.createElement( nodeName );
iframeDoc.body.appendChild( elem );
display = jQuery.css( elem, "display" );
body.removeChild( iframe );
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return elemdisplay[ nodeName ];
}
var rtable = /^t(?:able|d|h)$/i,
rroot = /^(?:body|html)$/i;
if ( "getBoundingClientRect" in document.documentElement ) {
jQuery.fn.offset = function( options ) {
var elem = this[0], box;
if ( options ) {
return this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
if ( !elem || !elem.ownerDocument ) {
return null;
}
if ( elem === elem.ownerDocument.body ) {
return jQuery.offset.bodyOffset( elem );
}
try {
box = elem.getBoundingClientRect();
} catch(e) {}
var doc = elem.ownerDocument,
docElem = doc.documentElement;
// Make sure we're not dealing with a disconnected DOM node
if ( !box || !jQuery.contains( docElem, elem ) ) {
return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
}
var body = doc.body,
win = getWindow(doc),
clientTop = docElem.clientTop || body.clientTop || 0,
clientLeft = docElem.clientLeft || body.clientLeft || 0,
scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
top = box.top + scrollTop - clientTop,
left = box.left + scrollLeft - clientLeft;
return { top: top, left: left };
};
} else {
jQuery.fn.offset = function( options ) {
var elem = this[0];
if ( options ) {
return this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
if ( !elem || !elem.ownerDocument ) {
return null;
}
if ( elem === elem.ownerDocument.body ) {
return jQuery.offset.bodyOffset( elem );
}
var computedStyle,
offsetParent = elem.offsetParent,
prevOffsetParent = elem,
doc = elem.ownerDocument,
docElem = doc.documentElement,
body = doc.body,
defaultView = doc.defaultView,
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
top = elem.offsetTop,
left = elem.offsetLeft;
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
break;
}
computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
top -= elem.scrollTop;
left -= elem.scrollLeft;
if ( elem === offsetParent ) {
top += elem.offsetTop;
left += elem.offsetLeft;
if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevOffsetParent = offsetParent;
offsetParent = elem.offsetParent;
}
if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevComputedStyle = computedStyle;
}
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
top += body.offsetTop;
left += body.offsetLeft;
}
if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
top += Math.max( docElem.scrollTop, body.scrollTop );
left += Math.max( docElem.scrollLeft, body.scrollLeft );
}
return { top: top, left: left };
};
}
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 null;
}
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;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( ["Left", "Top"], function( i, name ) {
var method = "scroll" + name;
jQuery.fn[ method ] = function( val ) {
var elem, win;
if ( val === undefined ) {
elem = this[ 0 ];
if ( !elem ) {
return null;
}
win = getWindow( elem );
// Return the scroll offset
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
jQuery.support.boxModel && win.document.documentElement[ method ] ||
win.document.body[ method ] :
elem[ method ];
}
// Set the scroll offset
return this.each(function() {
win = getWindow( this );
if ( win ) {
win.scrollTo(
!i ? val : jQuery( win ).scrollLeft(),
i ? val : jQuery( win ).scrollTop()
);
} else {
this[ method ] = val;
}
});
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function( i, name ) {
var type = name.toLowerCase();
// innerHeight and innerWidth
jQuery.fn[ "inner" + name ] = function() {
var elem = this[0];
return elem ?
elem.style ?
parseFloat( jQuery.css( elem, type, "padding" ) ) :
this[ type ]() :
null;
};
// outerHeight and outerWidth
jQuery.fn[ "outer" + name ] = function( margin ) {
var elem = this[0];
return elem ?
elem.style ?
parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
this[ type ]() :
null;
};
jQuery.fn[ type ] = function( size ) {
// Get window width or height
var elem = this[0];
if ( !elem ) {
return size == null ? null : this;
}
if ( jQuery.isFunction( size ) ) {
return this.each(function( i ) {
var self = jQuery( this );
self[ type ]( size.call( this, i, self[ type ]() ) );
});
}
if ( jQuery.isWindow( elem ) ) {
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
var docElemProp = elem.document.documentElement[ "client" + name ],
body = elem.document.body;
return elem.document.compatMode === "CSS1Compat" && docElemProp ||
body && body[ "client" + name ] || docElemProp;
// Get document width or height
} else if ( elem.nodeType === 9 ) {
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
return Math.max(
elem.documentElement["client" + name],
elem.body["scroll" + name], elem.documentElement["scroll" + name],
elem.body["offset" + name], elem.documentElement["offset" + name]
);
// Get or set width or height on the element
} else if ( size === undefined ) {
var orig = jQuery.css( elem, type ),
ret = parseFloat( orig );
return jQuery.isNumeric( ret ) ? ret : orig;
// Set the width or height on the element (default to pixels if value is unitless)
} else {
return this.css( type, typeof size === "string" ? size : size + "px" );
}
};
});
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
})( window );
|
src/actions/currentUser.js
|
deguchi/mastobone
|
import { AsyncStorage } from 'react-native';
const getCurrentUser = (onComplete: ?() => void) => {
return async (dispatch, getState) => {
// AsyncStorage.clear();
return AsyncStorage.getItem('current_user').then((value)=>{
dispatch(Success(value));
if (onComplete) onComplete();
}).catch((error)=>{
console.log('AsyncStorage error: ' + error.message);
dispatch(Error(error));
});
}
};
const setCurrentUser = (username, domain) => {
return (dispatch, getState) => {
const value = `${username}@${domain}`;
return AsyncStorage.setItem('current_user', value).then(()=>{
dispatch(Success(value));
}).catch((error)=>{
console.log('AsyncStorage error: ' + error.message);
dispatch(Error(error));
});
}
};
const Success = (value) =>{
return {
type: 'CURRENT_USER_SUCCESS',
value: value
}
};
const Error = (error) => {
return {
type: 'CURRENT_USER_ERROR',
code: error.code,
message: error.message,
}
};
module.exports = {
getCurrentUser,
setCurrentUser,
};
|
ajax/libs/ember-data.js/2.5.1/ember-data.prod.js
|
jonobr1/cdnjs
|
(function(){
"use strict";
/*!
* @overview Ember Data
* @copyright Copyright 2011-2016 Tilde Inc. and contributors.
* Portions Copyright 2011 LivingSocial Inc.
* @license Licensed under MIT license (see license.js)
* @version 2.5.1
*/
var define, requireModule, require, requirejs;
(function() {
var _isArray;
if (!Array.isArray) {
_isArray = function (x) {
return Object.prototype.toString.call(x) === "[object Array]";
};
} else {
_isArray = Array.isArray;
}
var registry = {};
var seen = {};
var FAILED = false;
var uuid = 0;
function tryFinally(tryable, finalizer) {
try {
return tryable();
} finally {
finalizer();
}
}
function unsupportedModule(length) {
throw new Error("an unsupported module was defined, expected `define(name, deps, module)` instead got: `" + length + "` arguments to define`");
}
var defaultDeps = ['require', 'exports', 'module'];
function Module(name, deps, callback, exports) {
this.id = uuid++;
this.name = name;
this.deps = !deps.length && callback.length ? defaultDeps : deps;
this.exports = exports || { };
this.callback = callback;
this.state = undefined;
this._require = undefined;
}
Module.prototype.makeRequire = function() {
var name = this.name;
return this._require || (this._require = function(dep) {
return require(resolve(dep, name));
});
}
define = function(name, deps, callback) {
if (arguments.length < 2) {
unsupportedModule(arguments.length);
}
if (!_isArray(deps)) {
callback = deps;
deps = [];
}
registry[name] = new Module(name, deps, callback);
};
// we don't support all of AMD
// define.amd = {};
// we will support petals...
define.petal = { };
function Alias(path) {
this.name = path;
}
define.alias = function(path) {
return new Alias(path);
};
function reify(mod, name, seen) {
var deps = mod.deps;
var length = deps.length;
var reified = new Array(length);
var dep;
// TODO: new Module
// TODO: seen refactor
var module = { };
for (var i = 0, l = length; i < l; i++) {
dep = deps[i];
if (dep === 'exports') {
module.exports = reified[i] = seen;
} else if (dep === 'require') {
reified[i] = mod.makeRequire();
} else if (dep === 'module') {
mod.exports = seen;
module = reified[i] = mod;
} else {
reified[i] = requireFrom(resolve(dep, name), name);
}
}
return {
deps: reified,
module: module
};
}
function requireFrom(name, origin) {
var mod = registry[name];
if (!mod) {
throw new Error('Could not find module `' + name + '` imported from `' + origin + '`');
}
return require(name);
}
function missingModule(name) {
throw new Error('Could not find module ' + name);
}
requirejs = require = requireModule = function(name) {
var mod = registry[name];
if (mod && mod.callback instanceof Alias) {
mod = registry[mod.callback.name];
}
if (!mod) { missingModule(name); }
if (mod.state !== FAILED &&
seen.hasOwnProperty(name)) {
return seen[name];
}
var reified;
var module;
var loaded = false;
seen[name] = { }; // placeholder for run-time cycles
tryFinally(function() {
reified = reify(mod, name, seen[name]);
module = mod.callback.apply(this, reified.deps);
loaded = true;
}, function() {
if (!loaded) {
mod.state = FAILED;
}
});
var obj;
if (module === undefined && reified.module.exports) {
obj = reified.module.exports;
} else {
obj = seen[name] = module;
}
if (obj !== null &&
(typeof obj === 'object' || typeof obj === 'function') &&
obj['default'] === undefined) {
obj['default'] = obj;
}
return (seen[name] = obj);
};
function resolve(child, name) {
if (child.charAt(0) !== '.') { return child; }
var parts = child.split('/');
var nameParts = name.split('/');
var parentBase = nameParts.slice(0, -1);
for (var i = 0, l = parts.length; i < l; i++) {
var part = parts[i];
if (part === '..') {
if (parentBase.length === 0) {
throw new Error('Cannot access parent module of root');
}
parentBase.pop();
} else if (part === '.') {
continue;
} else { parentBase.push(part); }
}
return parentBase.join('/');
}
requirejs.entries = requirejs._eak_seen = registry;
requirejs.unsee = function(moduleName) {
delete seen[moduleName];
};
requirejs.clear = function() {
requirejs.entries = requirejs._eak_seen = registry = {};
seen = state = {};
};
})();
define("ember-data/-private/adapters", ["exports", "ember-data/adapters/json-api", "ember-data/adapters/rest"], function (exports, _emberDataAdaptersJsonApi, _emberDataAdaptersRest) {
exports.JSONAPIAdapter = _emberDataAdaptersJsonApi.default;
exports.RESTAdapter = _emberDataAdaptersRest.default;
});
/**
@module ember-data
*/
define('ember-data/-private/adapters/build-url-mixin', ['exports', 'ember'], function (exports, _ember) {
var get = _ember.default.get;
/**
WARNING: This interface is likely to change in order to accomodate https://github.com/emberjs/rfcs/pull/4
## Using BuildURLMixin
To use url building, include the mixin when extending an adapter, and call `buildURL` where needed.
The default behaviour is designed for RESTAdapter.
### Example
```javascript
export default DS.Adapter.extend(BuildURLMixin, {
findRecord: function(store, type, id, snapshot) {
var url = this.buildURL(type.modelName, id, snapshot, 'findRecord');
return this.ajax(url, 'GET');
}
});
```
### Attributes
The `host` and `namespace` attributes will be used if defined, and are optional.
@class BuildURLMixin
@namespace DS
*/
exports.default = _ember.default.Mixin.create({
/**
Builds a URL for a given type and optional ID.
By default, it pluralizes the type's name (for example, 'post'
becomes 'posts' and 'person' becomes 'people'). To override the
pluralization see [pathForType](#method_pathForType).
If an ID is specified, it adds the ID to the path generated
for the type, separated by a `/`.
When called by RESTAdapter.findMany() the `id` and `snapshot` parameters
will be arrays of ids and snapshots.
@method buildURL
@param {String} modelName
@param {(String|Array|Object)} id single id or array of ids or query
@param {(DS.Snapshot|Array)} snapshot single snapshot or array of snapshots
@param {String} requestType
@param {Object} query object of query parameters to send for query requests.
@return {String} url
*/
buildURL: function (modelName, id, snapshot, requestType, query) {
switch (requestType) {
case 'findRecord':
return this.urlForFindRecord(id, modelName, snapshot);
case 'findAll':
return this.urlForFindAll(modelName, snapshot);
case 'query':
return this.urlForQuery(query, modelName);
case 'queryRecord':
return this.urlForQueryRecord(query, modelName);
case 'findMany':
return this.urlForFindMany(id, modelName, snapshot);
case 'findHasMany':
return this.urlForFindHasMany(id, modelName, snapshot);
case 'findBelongsTo':
return this.urlForFindBelongsTo(id, modelName, snapshot);
case 'createRecord':
return this.urlForCreateRecord(modelName, snapshot);
case 'updateRecord':
return this.urlForUpdateRecord(id, modelName, snapshot);
case 'deleteRecord':
return this.urlForDeleteRecord(id, modelName, snapshot);
default:
return this._buildURL(modelName, id);
}
},
/**
@method _buildURL
@private
@param {String} modelName
@param {String} id
@return {String} url
*/
_buildURL: function (modelName, id) {
var url = [];
var host = get(this, 'host');
var prefix = this.urlPrefix();
var path;
if (modelName) {
path = this.pathForType(modelName);
if (path) {
url.push(path);
}
}
if (id) {
url.push(encodeURIComponent(id));
}
if (prefix) {
url.unshift(prefix);
}
url = url.join('/');
if (!host && url && url.charAt(0) !== '/') {
url = '/' + url;
}
return url;
},
/**
* @method urlForFindRecord
* @param {String} id
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
*/
urlForFindRecord: function (id, modelName, snapshot) {
return this._buildURL(modelName, id);
},
/**
* @method urlForFindAll
* @param {String} modelName
* @param {DS.SnapshotRecordArray} snapshot
* @return {String} url
*/
urlForFindAll: function (modelName, snapshot) {
return this._buildURL(modelName);
},
/**
* @method urlForQuery
* @param {Object} query
* @param {String} modelName
* @return {String} url
*/
urlForQuery: function (query, modelName) {
return this._buildURL(modelName);
},
/**
* @method urlForQueryRecord
* @param {Object} query
* @param {String} modelName
* @return {String} url
*/
urlForQueryRecord: function (query, modelName) {
return this._buildURL(modelName);
},
/**
* @method urlForFindMany
* @param {Array} ids
* @param {String} modelName
* @param {Array} snapshots
* @return {String} url
*/
urlForFindMany: function (ids, modelName, snapshots) {
return this._buildURL(modelName);
},
/**
* @method urlForFindHasMany
* @param {String} id
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
*/
urlForFindHasMany: function (id, modelName, snapshot) {
return this._buildURL(modelName, id);
},
/**
* @method urlForFindBelongTo
* @param {String} id
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
*/
urlForFindBelongsTo: function (id, modelName, snapshot) {
return this._buildURL(modelName, id);
},
/**
* @method urlForCreateRecord
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
*/
urlForCreateRecord: function (modelName, snapshot) {
return this._buildURL(modelName);
},
/**
* @method urlForUpdateRecord
* @param {String} id
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
*/
urlForUpdateRecord: function (id, modelName, snapshot) {
return this._buildURL(modelName, id);
},
/**
* @method urlForDeleteRecord
* @param {String} id
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
*/
urlForDeleteRecord: function (id, modelName, snapshot) {
return this._buildURL(modelName, id);
},
/**
@method urlPrefix
@private
@param {String} path
@param {String} parentURL
@return {String} urlPrefix
*/
urlPrefix: function (path, parentURL) {
var host = get(this, 'host');
var namespace = get(this, 'namespace');
if (!host || host === '/') {
host = '';
}
if (path) {
// Protocol relative url
if (/^\/\//.test(path) || /http(s)?:\/\//.test(path)) {
// Do nothing, the full host is already included.
return path;
// Absolute path
} else if (path.charAt(0) === '/') {
return '' + host + path;
// Relative path
} else {
return parentURL + '/' + path;
}
}
// No path provided
var url = [];
if (host) {
url.push(host);
}
if (namespace) {
url.push(namespace);
}
return url.join('/');
},
/**
Determines the pathname for a given type.
By default, it pluralizes the type's name (for example,
'post' becomes 'posts' and 'person' becomes 'people').
### Pathname customization
For example if you have an object LineItem with an
endpoint of "/line_items/".
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
pathForType: function(modelName) {
var decamelized = Ember.String.decamelize(modelName);
return Ember.String.pluralize(decamelized);
}
});
```
@method pathForType
@param {String} modelName
@return {String} path
**/
pathForType: function (modelName) {
var camelized = _ember.default.String.camelize(modelName);
return _ember.default.String.pluralize(camelized);
}
});
});
define('ember-data/-private/adapters/errors', ['exports', 'ember', 'ember-data/-private/debug'], function (exports, _ember, _emberDataPrivateDebug) {
exports.AdapterError = AdapterError;
exports.InvalidError = InvalidError;
exports.TimeoutError = TimeoutError;
exports.AbortError = AbortError;
exports.errorsHashToArray = errorsHashToArray;
exports.errorsArrayToHash = errorsArrayToHash;
var EmberError = _ember.default.Error;
var SOURCE_POINTER_REGEXP = /^\/?data\/(attributes|relationships)\/(.*)/;
var SOURCE_POINTER_PRIMARY_REGEXP = /^\/?data/;
var PRIMARY_ATTRIBUTE_KEY = 'base';
/**
@class AdapterError
@namespace DS
*/
function AdapterError(errors) {
var message = arguments.length <= 1 || arguments[1] === undefined ? 'Adapter operation failed' : arguments[1];
this.isAdapterError = true;
EmberError.call(this, message);
this.errors = errors || [{
title: 'Adapter Error',
detail: message
}];
}
AdapterError.prototype = Object.create(EmberError.prototype);
/**
A `DS.InvalidError` is used by an adapter to signal the external API
was unable to process a request because the content was not
semantically correct or meaningful per the API. Usually this means a
record failed some form of server side validation. When a promise
from an adapter is rejected with a `DS.InvalidError` the record will
transition to the `invalid` state and the errors will be set to the
`errors` property on the record.
For Ember Data to correctly map errors to their corresponding
properties on the model, Ember Data expects each error to be
a valid json-api error object with a `source/pointer` that matches
the property name. For example if you had a Post model that
looked like this.
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr('string'),
content: DS.attr('string')
});
```
To show an error from the server related to the `title` and
`content` properties your adapter could return a promise that
rejects with a `DS.InvalidError` object that looks like this:
```app/adapters/post.js
import Ember from 'ember';
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
updateRecord: function() {
// Fictional adapter that always rejects
return Ember.RSVP.reject(new DS.InvalidError([
{
detail: 'Must be unique',
source: { pointer: '/data/attributes/title' }
},
{
detail: 'Must not be blank',
source: { pointer: '/data/attributes/content'}
}
]));
}
});
```
Your backend may use different property names for your records the
store will attempt extract and normalize the errors using the
serializer's `extractErrors` method before the errors get added to
the the model. As a result, it is safe for the `InvalidError` to
wrap the error payload unaltered.
@class InvalidError
@namespace DS
*/
function InvalidError(errors) {
AdapterError.call(this, errors, 'The adapter rejected the commit because it was invalid');
}
InvalidError.prototype = Object.create(AdapterError.prototype);
/**
@class TimeoutError
@namespace DS
*/
function TimeoutError() {
AdapterError.call(this, null, 'The adapter operation timed out');
}
TimeoutError.prototype = Object.create(AdapterError.prototype);
/**
@class AbortError
@namespace DS
*/
function AbortError() {
AdapterError.call(this, null, 'The adapter operation was aborted');
}
AbortError.prototype = Object.create(AdapterError.prototype);
/**
@method errorsHashToArray
@private
*/
function errorsHashToArray(errors) {
var out = [];
if (_ember.default.isPresent(errors)) {
Object.keys(errors).forEach(function (key) {
var messages = _ember.default.makeArray(errors[key]);
for (var i = 0; i < messages.length; i++) {
var title = 'Invalid Attribute';
var pointer = '/data/attributes/' + key;
if (key === PRIMARY_ATTRIBUTE_KEY) {
title = 'Invalid Document';
pointer = '/data';
}
out.push({
title: title,
detail: messages[i],
source: {
pointer: pointer
}
});
}
});
}
return out;
}
/**
@method errorsArrayToHash
@private
*/
function errorsArrayToHash(errors) {
var out = {};
if (_ember.default.isPresent(errors)) {
errors.forEach(function (error) {
if (error.source && error.source.pointer) {
var key = error.source.pointer.match(SOURCE_POINTER_REGEXP);
if (key) {
key = key[2];
} else if (error.source.pointer.search(SOURCE_POINTER_PRIMARY_REGEXP) !== -1) {
key = PRIMARY_ATTRIBUTE_KEY;
}
if (key) {
out[key] = out[key] || [];
out[key].push(error.detail || error.title);
}
}
});
}
return out;
}
});
define('ember-data/-private/core', ['exports', 'ember', 'ember-data/version'], function (exports, _ember, _emberDataVersion) {
/**
@module ember-data
*/
/**
All Ember Data methods and functions are defined inside of this namespace.
@class DS
@static
*/
/**
@property VERSION
@type String
@static
*/
var DS = _ember.default.Namespace.create({
VERSION: _emberDataVersion.default
});
if (_ember.default.libraries) {
_ember.default.libraries.registerCoreLibrary('Ember Data', DS.VERSION);
}
exports.default = DS;
});
define('ember-data/-private/debug', ['exports', 'ember'], function (exports, _ember) {
exports.assert = assert;
exports.debug = debug;
exports.deprecate = deprecate;
exports.info = info;
exports.runInDebug = runInDebug;
exports.warn = warn;
exports.debugSeal = debugSeal;
exports.assertPolymorphicType = assertPolymorphicType;
function assert() {
return _ember.default.assert.apply(_ember.default, arguments);
}
function debug() {
return _ember.default.debug.apply(_ember.default, arguments);
}
function deprecate() {
return _ember.default.deprecate.apply(_ember.default, arguments);
}
function info() {
return _ember.default.info.apply(_ember.default, arguments);
}
function runInDebug() {
return _ember.default.runInDebug.apply(_ember.default, arguments);
}
function warn() {
return _ember.default.warn.apply(_ember.default, arguments);
}
function debugSeal() {
return _ember.default.debugSeal.apply(_ember.default, arguments);
}
function checkPolymorphic(typeClass, addedRecord) {
if (typeClass.__isMixin) {
//TODO Need to do this in order to support mixins, should convert to public api
//once it exists in Ember
return typeClass.__mixin.detect(addedRecord.type.PrototypeMixin);
}
if (_ember.default.MODEL_FACTORY_INJECTIONS) {
typeClass = typeClass.superclass;
}
return typeClass.detect(addedRecord.type);
}
/**
Assert that `addedRecord` has a valid type so it can be added to the
relationship of the `record`.
The assert basically checks if the `addedRecord` can be added to the
relationship (specified via `relationshipMeta`) of the `record`.
This utility should only be used internally, as both record parameters must
be an InternalModel and the `relationshipMeta` needs to be the meta
information about the relationship, retrieved via
`record.relationshipFor(key)`.
@method assertPolymorphicType
@param {InternalModel} record
@param {RelationshipMeta} relationshipMeta retrieved via
`record.relationshipFor(key)`
@param {InternalModel} addedRecord record which
should be added/set for the relationship
*/
function assertPolymorphicType(record, relationshipMeta, addedRecord) {
var addedType = addedRecord.type.modelName;
var recordType = record.type.modelName;
var key = relationshipMeta.key;
var typeClass = record.store.modelFor(relationshipMeta.type);
var assertionMessage = 'You cannot add a record of type \'' + addedType + '\' to the \'' + recordType + '.' + key + '\' relationship (only \'' + typeClass.modelName + '\' allowed)';
assert(assertionMessage, checkPolymorphic(typeClass, addedRecord));
}
});
define('ember-data/-private/ext/date', ['exports', 'ember'], function (exports, _ember) {
/**
Date.parse with progressive enhancement for ISO 8601 <https://github.com/csnover/js-iso8601>
© 2011 Colin Snover <http://zetafleet.com>
Released under MIT license.
@class Date
@namespace Ember
@static
*/
_ember.default.Date = _ember.default.Date || {};
var origParse = Date.parse;
var numericKeys = [1, 4, 5, 6, 7, 10, 11];
/**
@method parse
@param {Date} date
@return {Number} timestamp
*/
_ember.default.Date.parse = function (date) {
var timestamp, struct;
var minutesOffset = 0;
// ES5 §15.9.4.2 states that the string should attempt to be parsed as a Date Time String Format string
// before falling back to any implementation-specific date parsing, so that’s what we do, even if native
// implementations could be faster
// 1 YYYY 2 MM 3 DD 4 HH 5 mm 6 ss 7 msec 8 Z 9 ± 10 tzHH 11 tzmm
if (struct = /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(date)) {
// avoid NaN timestamps caused by “undefined” values being passed to Date.UTC
for (var i = 0, k; k = numericKeys[i]; ++i) {
struct[k] = +struct[k] || 0;
}
// allow undefined days and months
struct[2] = (+struct[2] || 1) - 1;
struct[3] = +struct[3] || 1;
if (struct[8] !== 'Z' && struct[9] !== undefined) {
minutesOffset = struct[10] * 60 + struct[11];
if (struct[9] === '+') {
minutesOffset = 0 - minutesOffset;
}
}
timestamp = Date.UTC(struct[1], struct[2], struct[3], struct[4], struct[5] + minutesOffset, struct[6], struct[7]);
} else {
timestamp = origParse ? origParse(date) : NaN;
}
return timestamp;
};
if (_ember.default.EXTEND_PROTOTYPES === true || _ember.default.EXTEND_PROTOTYPES.Date) {
Date.parse = _ember.default.Date.parse;
}
});
/**
@module ember-data
*/
define('ember-data/-private/features', ['exports', 'ember'], function (exports, _ember) {
exports.default = isEnabled;
function isEnabled() {
var _Ember$FEATURES;
return (_Ember$FEATURES = _ember.default.FEATURES).isEnabled.apply(_Ember$FEATURES, arguments);
}
});
define("ember-data/-private/initializers/data-adapter", ["exports", "ember-data/-private/system/debug/debug-adapter"], function (exports, _emberDataPrivateSystemDebugDebugAdapter) {
exports.default = initializeDebugAdapter;
/**
Configures a registry with injections on Ember applications
for the Ember-Data store. Accepts an optional namespace argument.
@method initializeStoreInjections
@param {Ember.Registry} registry
*/
function initializeDebugAdapter(registry) {
registry.register('data-adapter:main', _emberDataPrivateSystemDebugDebugAdapter.default);
}
});
define('ember-data/-private/initializers/store-injections', ['exports'], function (exports) {
exports.default = initializeStoreInjections;
/**
Configures a registry with injections on Ember applications
for the Ember-Data store. Accepts an optional namespace argument.
@method initializeStoreInjections
@param {Ember.Registry} registry
*/
function initializeStoreInjections(registry) {
// registry.injection for Ember < 2.1.0
// application.inject for Ember 2.1.0+
var inject = registry.inject || registry.injection;
inject.call(registry, 'controller', 'store', 'service:store');
inject.call(registry, 'route', 'store', 'service:store');
inject.call(registry, 'data-adapter', 'store', 'service:store');
}
});
define("ember-data/-private/initializers/store", ["exports", "ember-data/-private/system/store", "ember-data/-private/serializers", "ember-data/-private/adapters"], function (exports, _emberDataPrivateSystemStore, _emberDataPrivateSerializers, _emberDataPrivateAdapters) {
exports.default = initializeStore;
function has(applicationOrRegistry, fullName) {
if (applicationOrRegistry.has) {
// < 2.1.0
return applicationOrRegistry.has(fullName);
} else {
// 2.1.0+
return applicationOrRegistry.hasRegistration(fullName);
}
}
/**
Configures a registry for use with an Ember-Data
store. Accepts an optional namespace argument.
@method initializeStore
@param {Ember.Registry} registry
*/
function initializeStore(registry) {
// registry.optionsForType for Ember < 2.1.0
// application.registerOptionsForType for Ember 2.1.0+
var registerOptionsForType = registry.registerOptionsForType || registry.optionsForType;
registerOptionsForType.call(registry, 'serializer', { singleton: false });
registerOptionsForType.call(registry, 'adapter', { singleton: false });
registry.register('serializer:-default', _emberDataPrivateSerializers.JSONSerializer);
registry.register('serializer:-rest', _emberDataPrivateSerializers.RESTSerializer);
registry.register('adapter:-rest', _emberDataPrivateAdapters.RESTAdapter);
registry.register('adapter:-json-api', _emberDataPrivateAdapters.JSONAPIAdapter);
registry.register('serializer:-json-api', _emberDataPrivateSerializers.JSONAPISerializer);
if (!has(registry, 'service:store')) {
registry.register('service:store', _emberDataPrivateSystemStore.default);
}
}
});
define('ember-data/-private/initializers/transforms', ['exports', 'ember-data/-private/transforms'], function (exports, _emberDataPrivateTransforms) {
exports.default = initializeTransforms;
/**
Configures a registry for use with Ember-Data
transforms.
@method initializeTransforms
@param {Ember.Registry} registry
*/
function initializeTransforms(registry) {
registry.register('transform:boolean', _emberDataPrivateTransforms.BooleanTransform);
registry.register('transform:date', _emberDataPrivateTransforms.DateTransform);
registry.register('transform:number', _emberDataPrivateTransforms.NumberTransform);
registry.register('transform:string', _emberDataPrivateTransforms.StringTransform);
}
});
define('ember-data/-private/instance-initializers/initialize-store-service', ['exports'], function (exports) {
exports.default = initializeStoreService;
/**
Configures a registry for use with an Ember-Data
store.
@method initializeStore
@param {Ember.ApplicationInstance} applicationOrRegistry
*/
function initializeStoreService(application) {
var container = application.lookup ? application : application.container;
// Eagerly generate the store so defaultStore is populated.
container.lookup('service:store');
}
});
define("ember-data/-private/serializers", ["exports", "ember-data/serializers/json-api", "ember-data/serializers/json", "ember-data/serializers/rest"], function (exports, _emberDataSerializersJsonApi, _emberDataSerializersJson, _emberDataSerializersRest) {
exports.JSONAPISerializer = _emberDataSerializersJsonApi.default;
exports.JSONSerializer = _emberDataSerializersJson.default;
exports.RESTSerializer = _emberDataSerializersRest.default;
});
/**
@module ember-data
*/
define("ember-data/-private/system/clone-null", ["exports", "ember-data/-private/system/empty-object"], function (exports, _emberDataPrivateSystemEmptyObject) {
exports.default = cloneNull;
function cloneNull(source) {
var clone = new _emberDataPrivateSystemEmptyObject.default();
for (var key in source) {
clone[key] = source[key];
}
return clone;
}
});
define('ember-data/-private/system/coerce-id', ['exports'], function (exports) {
exports.default = coerceId;
// Used by the store to normalize IDs entering the store. Despite the fact
// that developers may provide IDs as numbers (e.g., `store.findRecord('person', 1)`),
// it is important that internally we use strings, since IDs may be serialized
// and lose type information. For example, Ember's router may put a record's
// ID into the URL, and if we later try to deserialize that URL and find the
// corresponding record, we will not know if it is a string or a number.
function coerceId(id) {
return id == null || id === '' ? null : id + '';
}
});
define('ember-data/-private/system/container-proxy', ['exports', 'ember-data/-private/debug'], function (exports, _emberDataPrivateDebug) {
exports.default = ContainerProxy;
/*
This is used internally to enable deprecation of container paths and provide
a decent message to the user indicating how to fix the issue.
@class ContainerProxy
@namespace DS
@private
*/
function ContainerProxy(container) {
this.container = container;
}
ContainerProxy.prototype.aliasedFactory = function (path, preLookup) {
var _this = this;
return {
create: function () {
if (preLookup) {
preLookup();
}
return _this.container.lookup(path);
}
};
};
ContainerProxy.prototype.registerAlias = function (source, dest, preLookup) {
var factory = this.aliasedFactory(dest, preLookup);
return this.container.register(source, factory);
};
ContainerProxy.prototype.registerDeprecation = function (deprecated, valid) {
var preLookupCallback = function () {};
return this.registerAlias(deprecated, valid, preLookupCallback);
};
ContainerProxy.prototype.registerDeprecations = function (proxyPairs) {
var i, proxyPair, deprecated, valid;
for (i = proxyPairs.length; i > 0; i--) {
proxyPair = proxyPairs[i - 1];
deprecated = proxyPair['deprecated'];
valid = proxyPair['valid'];
this.registerDeprecation(deprecated, valid);
}
};
});
define("ember-data/-private/system/debug", ["exports", "ember-data/-private/system/debug/debug-adapter"], function (exports, _emberDataPrivateSystemDebugDebugAdapter) {
exports.default = _emberDataPrivateSystemDebugDebugAdapter.default;
});
/**
@module ember-data
*/
define('ember-data/-private/system/debug/debug-adapter', ['exports', 'ember', 'ember-data/model'], function (exports, _ember, _emberDataModel) {
var get = _ember.default.get;
var capitalize = _ember.default.String.capitalize;
var underscore = _ember.default.String.underscore;
var assert = _ember.default.assert;
/*
Extend `Ember.DataAdapter` with ED specific code.
@class DebugAdapter
@namespace DS
@extends Ember.DataAdapter
@private
*/
exports.default = _ember.default.DataAdapter.extend({
getFilters: function () {
return [{ name: 'isNew', desc: 'New' }, { name: 'isModified', desc: 'Modified' }, { name: 'isClean', desc: 'Clean' }];
},
detect: function (typeClass) {
return typeClass !== _emberDataModel.default && _emberDataModel.default.detect(typeClass);
},
columnsForType: function (typeClass) {
var columns = [{
name: 'id',
desc: 'Id'
}];
var count = 0;
var self = this;
get(typeClass, 'attributes').forEach(function (meta, name) {
if (count++ > self.attributeLimit) {
return false;
}
var desc = capitalize(underscore(name).replace('_', ' '));
columns.push({ name: name, desc: desc });
});
return columns;
},
getRecords: function (modelClass, modelName) {
if (arguments.length < 2) {
// Legacy Ember.js < 1.13 support
var containerKey = modelClass._debugContainerKey;
if (containerKey) {
var match = containerKey.match(/model:(.*)/);
if (match) {
modelName = match[1];
}
}
}
assert("Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support", !!modelName);
return this.get('store').peekAll(modelName);
},
getRecordColumnValues: function (record) {
var _this = this;
var count = 0;
var columnValues = { id: get(record, 'id') };
record.eachAttribute(function (key) {
if (count++ > _this.attributeLimit) {
return false;
}
var value = get(record, key);
columnValues[key] = value;
});
return columnValues;
},
getRecordKeywords: function (record) {
var keywords = [];
var keys = _ember.default.A(['id']);
record.eachAttribute(function (key) {
return keys.push(key);
});
keys.forEach(function (key) {
return keywords.push(get(record, key));
});
return keywords;
},
getRecordFilterValues: function (record) {
return {
isNew: record.get('isNew'),
isModified: record.get('hasDirtyAttributes') && !record.get('isNew'),
isClean: !record.get('hasDirtyAttributes')
};
},
getRecordColor: function (record) {
var color = 'black';
if (record.get('isNew')) {
color = 'green';
} else if (record.get('hasDirtyAttributes')) {
color = 'blue';
}
return color;
},
observeRecord: function (record, recordUpdated) {
var releaseMethods = _ember.default.A();
var keysToObserve = _ember.default.A(['id', 'isNew', 'hasDirtyAttributes']);
record.eachAttribute(function (key) {
return keysToObserve.push(key);
});
var adapter = this;
keysToObserve.forEach(function (key) {
var handler = function () {
recordUpdated(adapter.wrapRecord(record));
};
_ember.default.addObserver(record, key, handler);
releaseMethods.push(function () {
_ember.default.removeObserver(record, key, handler);
});
});
var release = function () {
releaseMethods.forEach(function (fn) {
return fn();
});
};
return release;
}
});
});
/**
@module ember-data
*/
define('ember-data/-private/system/debug/debug-info', ['exports', 'ember'], function (exports, _ember) {
exports.default = _ember.default.Mixin.create({
/**
Provides info about the model for debugging purposes
by grouping the properties into more semantic groups.
Meant to be used by debugging tools such as the Chrome Ember Extension.
- Groups all attributes in "Attributes" group.
- Groups all belongsTo relationships in "Belongs To" group.
- Groups all hasMany relationships in "Has Many" group.
- Groups all flags in "Flags" group.
- Flags relationship CPs as expensive properties.
@method _debugInfo
@for DS.Model
@private
*/
_debugInfo: function () {
var attributes = ['id'];
var relationships = { belongsTo: [], hasMany: [] };
var expensiveProperties = [];
this.eachAttribute(function (name, meta) {
return attributes.push(name);
});
this.eachRelationship(function (name, relationship) {
relationships[relationship.kind].push(name);
expensiveProperties.push(name);
});
var groups = [{
name: 'Attributes',
properties: attributes,
expand: true
}, {
name: 'Belongs To',
properties: relationships.belongsTo,
expand: true
}, {
name: 'Has Many',
properties: relationships.hasMany,
expand: true
}, {
name: 'Flags',
properties: ['isLoaded', 'hasDirtyAttributes', 'isSaving', 'isDeleted', 'isError', 'isNew', 'isValid']
}];
return {
propertyInfo: {
// include all other mixins / properties (not just the grouped ones)
includeOtherProperties: true,
groups: groups,
// don't pre-calculate unless cached
expensiveProperties: expensiveProperties
}
};
}
});
});
define("ember-data/-private/system/empty-object", ["exports"], function (exports) {
exports.default = EmptyObject;
// This exists because `Object.create(null)` is absurdly slow compared
// to `new EmptyObject()`. In either case, you want a null prototype
// when you're treating the object instances as arbitrary dictionaries
// and don't want your keys colliding with build-in methods on the
// default object prototype.
var proto = Object.create(null, {
// without this, we will always still end up with (new
// EmptyObject()).constructor === Object
constructor: {
value: undefined,
enumerable: false,
writable: true
}
});
function EmptyObject() {}
EmptyObject.prototype = proto;
});
define('ember-data/-private/system/is-array-like', ['exports', 'ember'], function (exports, _ember) {
exports.default = isArrayLike;
/*
We're using this to detect arrays and "array-like" objects.
This is a copy of the `isArray` method found in `ember-runtime/utils` as we're
currently unable to import non-exposed modules.
This method was previously exposed as `Ember.isArray` but since
https://github.com/emberjs/ember.js/pull/11463 `Ember.isArray` is an alias of
`Array.isArray` hence removing the "array-like" part.
*/
function isArrayLike(obj) {
if (!obj || obj.setInterval) {
return false;
}
if (Array.isArray(obj)) {
return true;
}
if (_ember.default.Array.detect(obj)) {
return true;
}
var type = _ember.default.typeOf(obj);
if ('array' === type) {
return true;
}
if (obj.length !== undefined && 'object' === type) {
return true;
}
return false;
}
});
define("ember-data/-private/system/many-array", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/system/promise-proxies", "ember-data/-private/system/store/common"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateSystemPromiseProxies, _emberDataPrivateSystemStoreCommon) {
var get = _ember.default.get;
var set = _ember.default.set;
/**
A `ManyArray` is a `MutableArray` that represents the contents of a has-many
relationship.
The `ManyArray` is instantiated lazily the first time the relationship is
requested.
### Inverses
Often, the relationships in Ember Data applications will have
an inverse. For example, imagine the following models are
defined:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('comment')
});
```
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
post: DS.belongsTo('post')
});
```
If you created a new instance of `App.Post` and added
a `App.Comment` record to its `comments` has-many
relationship, you would expect the comment's `post`
property to be set to the post that contained
the has-many.
We call the record to which a relationship belongs the
relationship's _owner_.
@class ManyArray
@namespace DS
@extends Ember.Object
@uses Ember.MutableArray, Ember.Evented
*/
exports.default = _ember.default.Object.extend(_ember.default.MutableArray, _ember.default.Evented, {
init: function () {
this._super.apply(this, arguments);
this.currentState = _ember.default.A([]);
},
record: null,
canonicalState: null,
currentState: null,
length: 0,
objectAt: function (index) {
//Ember observers such as 'firstObject', 'lastObject' might do out of bounds accesses
if (!this.currentState[index]) {
return undefined;
}
return this.currentState[index].getRecord();
},
flushCanonical: function () {
//TODO make this smarter, currently its plenty stupid
var toSet = this.canonicalState.filter(function (internalModel) {
return !internalModel.isDeleted();
});
//a hack for not removing new records
//TODO remove once we have proper diffing
var newRecords = this.currentState.filter(function (internalModel) {
return internalModel.isNew() && toSet.indexOf(internalModel) === -1;
});
toSet = toSet.concat(newRecords);
var oldLength = this.length;
this.arrayContentWillChange(0, this.length, toSet.length);
// It’s possible the parent side of the relationship may have been unloaded by this point
if ((0, _emberDataPrivateSystemStoreCommon._objectIsAlive)(this)) {
this.set('length', toSet.length);
}
this.currentState = toSet;
this.arrayContentDidChange(0, oldLength, this.length);
//TODO Figure out to notify only on additions and maybe only if unloaded
this.relationship.notifyHasManyChanged();
this.record.updateRecordArrays();
},
/**
`true` if the relationship is polymorphic, `false` otherwise.
@property {Boolean} isPolymorphic
@private
*/
isPolymorphic: false,
/**
The loading state of this array
@property {Boolean} isLoaded
*/
isLoaded: false,
/**
The relationship which manages this array.
@property {ManyRelationship} relationship
@private
*/
relationship: null,
/**
Metadata associated with the request for async hasMany relationships.
Example
Given that the server returns the following JSON payload when fetching a
hasMany relationship:
```js
{
"comments": [{
"id": 1,
"comment": "This is the first comment",
}, {
// ...
}],
"meta": {
"page": 1,
"total": 5
}
}
```
You can then access the metadata via the `meta` property:
```js
post.get('comments').then(function(comments) {
var meta = comments.get('meta');
// meta.page => 1
// meta.total => 5
});
```
@property {Object} meta
@public
*/
meta: null,
internalReplace: function (idx, amt, objects) {
if (!objects) {
objects = [];
}
this.arrayContentWillChange(idx, amt, objects.length);
this.currentState.splice.apply(this.currentState, [idx, amt].concat(objects));
this.set('length', this.currentState.length);
this.arrayContentDidChange(idx, amt, objects.length);
if (objects) {
//TODO(Igor) probably needed only for unloaded records
this.relationship.notifyHasManyChanged();
}
this.record.updateRecordArrays();
},
//TODO(Igor) optimize
internalRemoveRecords: function (records) {
var index;
for (var i = 0; i < records.length; i++) {
index = this.currentState.indexOf(records[i]);
this.internalReplace(index, 1);
}
},
//TODO(Igor) optimize
internalAddRecords: function (records, idx) {
if (idx === undefined) {
idx = this.currentState.length;
}
this.internalReplace(idx, 0, records);
},
replace: function (idx, amt, objects) {
var records;
if (amt > 0) {
records = this.currentState.slice(idx, idx + amt);
this.get('relationship').removeRecords(records);
}
if (objects) {
this.get('relationship').addRecords(objects.map(function (obj) {
return obj._internalModel;
}), idx);
}
},
/**
Used for async `hasMany` arrays
to keep track of when they will resolve.
@property {Ember.RSVP.Promise} promise
@private
*/
promise: null,
/**
@method loadingRecordsCount
@param {Number} count
@private
*/
loadingRecordsCount: function (count) {
this.loadingRecordsCount = count;
},
/**
@method loadedRecord
@private
*/
loadedRecord: function () {
this.loadingRecordsCount--;
if (this.loadingRecordsCount === 0) {
set(this, 'isLoaded', true);
this.trigger('didLoad');
}
},
/**
@method reload
@public
*/
reload: function () {
return this.relationship.reload();
},
/**
Saves all of the records in the `ManyArray`.
Example
```javascript
store.findRecord('inbox', 1).then(function(inbox) {
inbox.get('messages').then(function(messages) {
messages.forEach(function(message) {
message.set('isRead', true);
});
messages.save()
});
});
```
@method save
@return {DS.PromiseArray} promise
*/
save: function () {
var manyArray = this;
var promiseLabel = "DS: ManyArray#save " + get(this, 'type');
var promise = _ember.default.RSVP.all(this.invoke("save"), promiseLabel).then(function (array) {
return manyArray;
}, null, "DS: ManyArray#save return ManyArray");
return _emberDataPrivateSystemPromiseProxies.PromiseArray.create({ promise: promise });
},
/**
Create a child record within the owner
@method createRecord
@private
@param {Object} hash
@return {DS.Model} record
*/
createRecord: function (hash) {
var store = get(this, 'store');
var type = get(this, 'type');
var record;
record = store.createRecord(type.modelName, hash);
this.pushObject(record);
return record;
}
});
});
/**
@module ember-data
*/
define("ember-data/-private/system/model", ["exports", "ember-data/-private/system/model/model", "ember-data/attr", "ember-data/-private/system/model/states", "ember-data/-private/system/model/errors"], function (exports, _emberDataPrivateSystemModelModel, _emberDataAttr, _emberDataPrivateSystemModelStates, _emberDataPrivateSystemModelErrors) {
exports.RootState = _emberDataPrivateSystemModelStates.default;
exports.attr = _emberDataAttr.default;
exports.Errors = _emberDataPrivateSystemModelErrors.default;
exports.default = _emberDataPrivateSystemModelModel.default;
});
/**
@module ember-data
*/
define("ember-data/-private/system/model/attr", ["exports", "ember", "ember-data/-private/debug"], function (exports, _ember, _emberDataPrivateDebug) {
var get = _ember.default.get;
var Map = _ember.default.Map;
/**
@module ember-data
*/
/**
@class Model
@namespace DS
*/
var AttrClassMethodsMixin = _ember.default.Mixin.create({
/**
A map whose keys are the attributes of the model (properties
described by DS.attr) and whose values are the meta object for the
property.
Example
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: attr('string'),
lastName: attr('string'),
birthday: attr('date')
});
```
```javascript
import Ember from 'ember';
import Person from 'app/models/person';
var attributes = Ember.get(Person, 'attributes')
attributes.forEach(function(meta, name) {
console.log(name, meta);
});
// prints:
// firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}
// lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}
// birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
```
@property attributes
@static
@type {Ember.Map}
@readOnly
*/
attributes: _ember.default.computed(function () {
var map = Map.create();
this.eachComputedProperty(function (name, meta) {
if (meta.isAttribute) {
meta.name = name;
map.set(name, meta);
}
});
return map;
}).readOnly(),
/**
A map whose keys are the attributes of the model (properties
described by DS.attr) and whose values are type of transformation
applied to each attribute. This map does not include any
attributes that do not have an transformation type.
Example
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: attr(),
lastName: attr('string'),
birthday: attr('date')
});
```
```javascript
import Ember from 'ember';
import Person from 'app/models/person';
var transformedAttributes = Ember.get(Person, 'transformedAttributes')
transformedAttributes.forEach(function(field, type) {
console.log(field, type);
});
// prints:
// lastName string
// birthday date
```
@property transformedAttributes
@static
@type {Ember.Map}
@readOnly
*/
transformedAttributes: _ember.default.computed(function () {
var map = Map.create();
this.eachAttribute(function (key, meta) {
if (meta.type) {
map.set(key, meta.type);
}
});
return map;
}).readOnly(),
/**
Iterates through the attributes of the model, calling the passed function on each
attribute.
The callback method you provide should have the following signature (all
parameters are optional):
```javascript
function(name, meta);
```
- `name` the name of the current property in the iteration
- `meta` the meta object for the attribute property in the iteration
Note that in addition to a callback, you can also pass an optional target
object that will be set as `this` on the context.
Example
```javascript
import DS from 'ember-data';
var Person = DS.Model.extend({
firstName: attr('string'),
lastName: attr('string'),
birthday: attr('date')
});
Person.eachAttribute(function(name, meta) {
console.log(name, meta);
});
// prints:
// firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}
// lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}
// birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
```
@method eachAttribute
@param {Function} callback The callback to execute
@param {Object} [binding] the value to which the callback's `this` should be bound
@static
*/
eachAttribute: function (callback, binding) {
get(this, 'attributes').forEach(function (meta, name) {
callback.call(binding, name, meta);
});
},
/**
Iterates through the transformedAttributes of the model, calling
the passed function on each attribute. Note the callback will not be
called for any attributes that do not have an transformation type.
The callback method you provide should have the following signature (all
parameters are optional):
```javascript
function(name, type);
```
- `name` the name of the current property in the iteration
- `type` a string containing the name of the type of transformed
applied to the attribute
Note that in addition to a callback, you can also pass an optional target
object that will be set as `this` on the context.
Example
```javascript
import DS from 'ember-data';
var Person = DS.Model.extend({
firstName: attr(),
lastName: attr('string'),
birthday: attr('date')
});
Person.eachTransformedAttribute(function(name, type) {
console.log(name, type);
});
// prints:
// lastName string
// birthday date
```
@method eachTransformedAttribute
@param {Function} callback The callback to execute
@param {Object} [binding] the value to which the callback's `this` should be bound
@static
*/
eachTransformedAttribute: function (callback, binding) {
get(this, 'transformedAttributes').forEach(function (type, name) {
callback.call(binding, name, type);
});
}
});
exports.AttrClassMethodsMixin = AttrClassMethodsMixin;
var AttrInstanceMethodsMixin = _ember.default.Mixin.create({
eachAttribute: function (callback, binding) {
this.constructor.eachAttribute(callback, binding);
}
});
exports.AttrInstanceMethodsMixin = AttrInstanceMethodsMixin;
});
define('ember-data/-private/system/model/errors', ['exports', 'ember', 'ember-data/-private/debug'], function (exports, _ember, _emberDataPrivateDebug) {
var get = _ember.default.get;
var set = _ember.default.set;
var isEmpty = _ember.default.isEmpty;
var makeArray = _ember.default.makeArray;
var MapWithDefault = _ember.default.MapWithDefault;
/**
@module ember-data
*/
/**
Holds validation errors for a given record, organized by attribute names.
Every `DS.Model` has an `errors` property that is an instance of
`DS.Errors`. This can be used to display validation error
messages returned from the server when a `record.save()` rejects.
For Example, if you had a `User` model that looked like this:
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
username: attr('string'),
email: attr('string')
});
```
And you attempted to save a record that did not validate on the backend:
```javascript
var user = store.createRecord('user', {
username: 'tomster',
email: 'invalidEmail'
});
user.save();
```
Your backend would be expected to return an error response that described
the problem, so that error messages can be generated on the app.
API responses will be translated into instances of `DS.Errors` differently,
depending on the specific combination of adapter and serializer used. You
may want to check the documentation or the source code of the libraries
that you are using, to know how they expect errors to be communicated.
Errors can be displayed to the user by accessing their property name
to get an array of all the error objects for that property. Each
error object is a JavaScript object with two keys:
- `message` A string containing the error message from the backend
- `attribute` The name of the property associated with this error message
```handlebars
<label>Username: {{input value=username}} </label>
{{#each model.errors.username as |error|}}
<div class="error">
{{error.message}}
</div>
{{/each}}
<label>Email: {{input value=email}} </label>
{{#each model.errors.email as |error|}}
<div class="error">
{{error.message}}
</div>
{{/each}}
```
You can also access the special `messages` property on the error
object to get an array of all the error strings.
```handlebars
{{#each model.errors.messages as |message|}}
<div class="error">
{{message}}
</div>
{{/each}}
```
@class Errors
@namespace DS
@extends Ember.Object
@uses Ember.Enumerable
@uses Ember.Evented
*/
exports.default = _ember.default.ArrayProxy.extend(_ember.default.Evented, {
/**
Register with target handler
@method registerHandlers
@param {Object} target
@param {Function} becameInvalid
@param {Function} becameValid
@deprecated
*/
registerHandlers: function (target, becameInvalid, becameValid) {
this._registerHandlers(target, becameInvalid, becameValid);
},
/**
Register with target handler
@method _registerHandlers
@private
*/
_registerHandlers: function (target, becameInvalid, becameValid) {
this.on('becameInvalid', target, becameInvalid);
this.on('becameValid', target, becameValid);
},
/**
@property errorsByAttributeName
@type {Ember.MapWithDefault}
@private
*/
errorsByAttributeName: _ember.default.computed(function () {
return MapWithDefault.create({
defaultValue: function () {
return _ember.default.A();
}
});
}),
/**
Returns errors for a given attribute
```javascript
var user = store.createRecord('user', {
username: 'tomster',
email: 'invalidEmail'
});
user.save().catch(function(){
user.get('errors').errorsFor('email'); // returns:
// [{attribute: "email", message: "Doesn't look like a valid email."}]
});
```
@method errorsFor
@param {String} attribute
@return {Array}
*/
errorsFor: function (attribute) {
return get(this, 'errorsByAttributeName').get(attribute);
},
/**
An array containing all of the error messages for this
record. This is useful for displaying all errors to the user.
```handlebars
{{#each model.errors.messages as |message|}}
<div class="error">
{{message}}
</div>
{{/each}}
```
@property messages
@type {Array}
*/
messages: _ember.default.computed.mapBy('content', 'message'),
/**
@property content
@type {Array}
@private
*/
content: _ember.default.computed(function () {
return _ember.default.A();
}),
/**
@method unknownProperty
@private
*/
unknownProperty: function (attribute) {
var errors = this.errorsFor(attribute);
if (isEmpty(errors)) {
return null;
}
return errors;
},
/**
Total number of errors.
@property length
@type {Number}
@readOnly
*/
/**
@property isEmpty
@type {Boolean}
@readOnly
*/
isEmpty: _ember.default.computed.not('length').readOnly(),
/**
Adds error messages to a given attribute and sends
`becameInvalid` event to the record.
Example:
```javascript
if (!user.get('username') {
user.get('errors').add('username', 'This field is required');
}
```
@method add
@param {String} attribute
@param {(Array|String)} messages
@deprecated
*/
add: function (attribute, messages) {
var wasEmpty = get(this, 'isEmpty');
this._add(attribute, messages);
if (wasEmpty && !get(this, 'isEmpty')) {
this.trigger('becameInvalid');
}
},
/**
Adds error messages to a given attribute without sending event.
@method _add
@private
*/
_add: function (attribute, messages) {
messages = this._findOrCreateMessages(attribute, messages);
this.addObjects(messages);
get(this, 'errorsByAttributeName').get(attribute).addObjects(messages);
this.notifyPropertyChange(attribute);
},
/**
@method _findOrCreateMessages
@private
*/
_findOrCreateMessages: function (attribute, messages) {
var errors = this.errorsFor(attribute);
var messagesArray = makeArray(messages);
var _messages = new Array(messagesArray.length);
for (var i = 0; i < messagesArray.length; i++) {
var message = messagesArray[i];
var err = errors.findBy('message', message);
if (err) {
_messages[i] = err;
} else {
_messages[i] = {
attribute: attribute,
message: message
};
}
}
return _messages;
},
/**
Removes all error messages from the given attribute and sends
`becameValid` event to the record if there no more errors left.
Example:
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
email: DS.attr('string'),
twoFactorAuth: DS.attr('boolean'),
phone: DS.attr('string')
});
```
```app/routes/user/edit.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
save: function(user) {
if (!user.get('twoFactorAuth')) {
user.get('errors').remove('phone');
}
user.save();
}
}
});
```
@method remove
@param {String} attribute
@deprecated
*/
remove: function (attribute) {
if (get(this, 'isEmpty')) {
return;
}
this._remove(attribute);
if (get(this, 'isEmpty')) {
this.trigger('becameValid');
}
},
/**
Removes all error messages from the given attribute without sending event.
@method _remove
@private
*/
_remove: function (attribute) {
if (get(this, 'isEmpty')) {
return;
}
var content = this.rejectBy('attribute', attribute);
set(this, 'content', content);
get(this, 'errorsByAttributeName').delete(attribute);
this.notifyPropertyChange(attribute);
},
/**
Removes all error messages and sends `becameValid` event
to the record.
Example:
```app/routes/user/edit.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
retrySave: function(user) {
user.get('errors').clear();
user.save();
}
}
});
```
@method clear
@deprecated
*/
clear: function () {
if (get(this, 'isEmpty')) {
return;
}
this._clear();
this.trigger('becameValid');
},
/**
Removes all error messages.
to the record.
@method _clear
@private
*/
_clear: function () {
if (get(this, 'isEmpty')) {
return;
}
var errorsByAttributeName = get(this, 'errorsByAttributeName');
var attributes = _ember.default.A();
errorsByAttributeName.forEach(function (_, attribute) {
attributes.push(attribute);
});
errorsByAttributeName.clear();
attributes.forEach(function (attribute) {
this.notifyPropertyChange(attribute);
}, this);
_ember.default.ArrayProxy.prototype.clear.call(this);
},
/**
Checks if there is error messages for the given attribute.
```app/routes/user/edit.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
save: function(user) {
if (user.get('errors').has('email')) {
return alert('Please update your email before attempting to save.');
}
user.save();
}
}
});
```
@method has
@param {String} attribute
@return {Boolean} true if there some errors on given attribute
*/
has: function (attribute) {
return !isEmpty(this.errorsFor(attribute));
}
});
});
define("ember-data/-private/system/model/internal-model", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/system/model/states", "ember-data/-private/system/relationships/state/create", "ember-data/-private/system/snapshot", "ember-data/-private/system/empty-object", "ember-data/-private/features", "ember-data/-private/utils", "ember-data/-private/system/references"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateSystemModelStates, _emberDataPrivateSystemRelationshipsStateCreate, _emberDataPrivateSystemSnapshot, _emberDataPrivateSystemEmptyObject, _emberDataPrivateFeatures, _emberDataPrivateUtils, _emberDataPrivateSystemReferences) {
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; })();
exports.default = InternalModel;
var Promise = _ember.default.RSVP.Promise;
var get = _ember.default.get;
var set = _ember.default.set;
var copy = _ember.default.copy;
var assign = _ember.default.assign || _ember.default.merge;
var _extractPivotNameCache = new _emberDataPrivateSystemEmptyObject.default();
var _splitOnDotCache = new _emberDataPrivateSystemEmptyObject.default();
function splitOnDot(name) {
return _splitOnDotCache[name] || (_splitOnDotCache[name] = name.split('.'));
}
function extractPivotName(name) {
return _extractPivotNameCache[name] || (_extractPivotNameCache[name] = splitOnDot(name)[0]);
}
function retrieveFromCurrentState(key) {
return function () {
return get(this.currentState, key);
};
}
var guid = 0;
/*
`InternalModel` is the Model class that we use internally inside Ember Data to represent models.
Internal ED methods should only deal with `InternalModel` objects. It is a fast, plain Javascript class.
We expose `DS.Model` to application code, by materializing a `DS.Model` from `InternalModel` lazily, as
a performance optimization.
`InternalModel` should never be exposed to application code. At the boundaries of the system, in places
like `find`, `push`, etc. we convert between Models and InternalModels.
We need to make sure that the properties from `InternalModel` are correctly exposed/proxied on `Model`
if they are needed.
@private
@class InternalModel
*/
function InternalModel(type, id, store, _, data) {
this.type = type;
this.id = id;
this.store = store;
this._data = data || new _emberDataPrivateSystemEmptyObject.default();
this.modelName = type.modelName;
this.dataHasInitialized = false;
//Look into making this lazy
this._deferredTriggers = [];
this._attributes = new _emberDataPrivateSystemEmptyObject.default();
this._inFlightAttributes = new _emberDataPrivateSystemEmptyObject.default();
this._relationships = new _emberDataPrivateSystemRelationshipsStateCreate.default(this);
this._recordArrays = undefined;
this.currentState = _emberDataPrivateSystemModelStates.default.empty;
this.recordReference = new _emberDataPrivateSystemReferences.RecordReference(store, this);
this.references = {};
this.isReloading = false;
this.isError = false;
this.error = null;
this.__ember_meta__ = null;
this[_ember.default.GUID_KEY] = guid++ + 'internal-model';
/*
implicit relationships are relationship which have not been declared but the inverse side exists on
another record somewhere
For example if there was
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr()
})
```
but there is also
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr(),
comments: DS.hasMany('comment')
})
```
would have a implicit post relationship in order to be do things like remove ourselves from the post
when we are deleted
*/
this._implicitRelationships = new _emberDataPrivateSystemEmptyObject.default();
}
InternalModel.prototype = {
isEmpty: retrieveFromCurrentState('isEmpty'),
isLoading: retrieveFromCurrentState('isLoading'),
isLoaded: retrieveFromCurrentState('isLoaded'),
hasDirtyAttributes: retrieveFromCurrentState('hasDirtyAttributes'),
isSaving: retrieveFromCurrentState('isSaving'),
isDeleted: retrieveFromCurrentState('isDeleted'),
isNew: retrieveFromCurrentState('isNew'),
isValid: retrieveFromCurrentState('isValid'),
dirtyType: retrieveFromCurrentState('dirtyType'),
constructor: InternalModel,
materializeRecord: function () {
// lookupFactory should really return an object that creates
// instances with the injections applied
var createOptions = {
store: this.store,
_internalModel: this,
id: this.id,
currentState: get(this, 'currentState'),
isError: this.isError,
adapterError: this.error
};
if (_ember.default.setOwner) {
// ensure that `Ember.getOwner(this)` works inside a model instance
_ember.default.setOwner(createOptions, (0, _emberDataPrivateUtils.getOwner)(this.store));
} else {
createOptions.container = this.store.container;
}
this.record = this.type._create(createOptions);
this._triggerDeferredTriggers();
},
recordObjectWillDestroy: function () {
this.record = null;
},
deleteRecord: function () {
this.send('deleteRecord');
},
save: function (options) {
var promiseLabel = "DS: Model#save " + this;
var resolver = _ember.default.RSVP.defer(promiseLabel);
this.store.scheduleSave(this, resolver, options);
return resolver.promise;
},
startedReloading: function () {
this.isReloading = true;
if (this.record) {
set(this.record, 'isReloading', true);
}
},
finishedReloading: function () {
this.isReloading = false;
if (this.record) {
set(this.record, 'isReloading', false);
}
},
reload: function () {
this.startedReloading();
var record = this;
var promiseLabel = "DS: Model#reload of " + this;
return new Promise(function (resolve) {
record.send('reloadRecord', resolve);
}, promiseLabel).then(function () {
record.didCleanError();
return record;
}, function (error) {
record.didError(error);
throw error;
}, "DS: Model#reload complete, update flags").finally(function () {
record.finishedReloading();
record.updateRecordArrays();
});
},
getRecord: function () {
if (!this.record) {
this.materializeRecord();
}
return this.record;
},
unloadRecord: function () {
this.send('unloadRecord');
},
eachRelationship: function (callback, binding) {
return this.type.eachRelationship(callback, binding);
},
eachAttribute: function (callback, binding) {
return this.type.eachAttribute(callback, binding);
},
inverseFor: function (key) {
return this.type.inverseFor(key);
},
setupData: function (data) {
var changedKeys = this._changedKeys(data.attributes);
assign(this._data, data.attributes);
this.pushedData();
if (this.record) {
this.record._notifyProperties(changedKeys);
}
this.didInitalizeData();
},
becameReady: function () {
_ember.default.run.schedule('actions', this.store.recordArrayManager, this.store.recordArrayManager.recordWasLoaded, this);
},
didInitalizeData: function () {
if (!this.dataHasInitialized) {
this.becameReady();
this.dataHasInitialized = true;
}
},
destroy: function () {
if (this.record) {
return this.record.destroy();
}
},
/*
@method createSnapshot
@private
*/
createSnapshot: function (options) {
return new _emberDataPrivateSystemSnapshot.default(this, options);
},
/*
@method loadingData
@private
@param {Promise} promise
*/
loadingData: function (promise) {
this.send('loadingData', promise);
},
/*
@method loadedData
@private
*/
loadedData: function () {
this.send('loadedData');
this.didInitalizeData();
},
/*
@method notFound
@private
*/
notFound: function () {
this.send('notFound');
},
/*
@method pushedData
@private
*/
pushedData: function () {
this.send('pushedData');
},
flushChangedAttributes: function () {
this._inFlightAttributes = this._attributes;
this._attributes = new _emberDataPrivateSystemEmptyObject.default();
},
hasChangedAttributes: function () {
return Object.keys(this._attributes).length > 0;
},
/*
Checks if the attributes which are considered as changed are still
different to the state which is acknowledged by the server.
This method is needed when data for the internal model is pushed and the
pushed data might acknowledge dirty attributes as confirmed.
@method updateChangedAttributes
@private
*/
updateChangedAttributes: function () {
var changedAttributes = this.changedAttributes();
var changedAttributeNames = Object.keys(changedAttributes);
for (var i = 0, _length = changedAttributeNames.length; i < _length; i++) {
var attribute = changedAttributeNames[i];
var _changedAttributes$attribute = _slicedToArray(changedAttributes[attribute], 2);
var oldData = _changedAttributes$attribute[0];
var newData = _changedAttributes$attribute[1];
if (oldData === newData) {
delete this._attributes[attribute];
}
}
},
/*
Returns an object, whose keys are changed properties, and value is an
[oldProp, newProp] array.
@method changedAttributes
@private
*/
changedAttributes: function () {
var oldData = this._data;
var currentData = this._attributes;
var inFlightData = this._inFlightAttributes;
var newData = assign(copy(inFlightData), currentData);
var diffData = new _emberDataPrivateSystemEmptyObject.default();
var newDataKeys = Object.keys(newData);
for (var i = 0, _length2 = newDataKeys.length; i < _length2; i++) {
var key = newDataKeys[i];
diffData[key] = [oldData[key], newData[key]];
}
return diffData;
},
/*
@method adapterWillCommit
@private
*/
adapterWillCommit: function () {
this.send('willCommit');
},
/*
@method adapterDidDirty
@private
*/
adapterDidDirty: function () {
this.send('becomeDirty');
this.updateRecordArraysLater();
},
/*
@method send
@private
@param {String} name
@param {Object} context
*/
send: function (name, context) {
var currentState = get(this, 'currentState');
if (!currentState[name]) {
this._unhandledEvent(currentState, name, context);
}
return currentState[name](this, context);
},
notifyHasManyAdded: function (key, record, idx) {
if (this.record) {
this.record.notifyHasManyAdded(key, record, idx);
}
},
notifyHasManyRemoved: function (key, record, idx) {
if (this.record) {
this.record.notifyHasManyRemoved(key, record, idx);
}
},
notifyBelongsToChanged: function (key, record) {
if (this.record) {
this.record.notifyBelongsToChanged(key, record);
}
},
notifyPropertyChange: function (key) {
if (this.record) {
this.record.notifyPropertyChange(key);
}
},
rollbackAttributes: function () {
var dirtyKeys = Object.keys(this._attributes);
this._attributes = new _emberDataPrivateSystemEmptyObject.default();
if (get(this, 'isError')) {
this._inFlightAttributes = new _emberDataPrivateSystemEmptyObject.default();
this.didCleanError();
}
//Eventually rollback will always work for relationships
//For now we support it only out of deleted state, because we
//have an explicit way of knowing when the server acked the relationship change
if (this.isDeleted()) {
//TODO: Should probably move this to the state machine somehow
this.becameReady();
}
if (this.isNew()) {
this.clearRelationships();
}
if (this.isValid()) {
this._inFlightAttributes = new _emberDataPrivateSystemEmptyObject.default();
}
this.send('rolledBack');
this.record._notifyProperties(dirtyKeys);
},
/*
@method transitionTo
@private
@param {String} name
*/
transitionTo: function (name) {
// POSSIBLE TODO: Remove this code and replace with
// always having direct reference to state objects
var pivotName = extractPivotName(name);
var currentState = get(this, 'currentState');
var state = currentState;
do {
if (state.exit) {
state.exit(this);
}
state = state.parentState;
} while (!state.hasOwnProperty(pivotName));
var path = splitOnDot(name);
var setups = [];
var enters = [];
var i, l;
for (i = 0, l = path.length; i < l; i++) {
state = state[path[i]];
if (state.enter) {
enters.push(state);
}
if (state.setup) {
setups.push(state);
}
}
for (i = 0, l = enters.length; i < l; i++) {
enters[i].enter(this);
}
set(this, 'currentState', state);
//TODO Consider whether this is the best approach for keeping these two in sync
if (this.record) {
set(this.record, 'currentState', state);
}
for (i = 0, l = setups.length; i < l; i++) {
setups[i].setup(this);
}
this.updateRecordArraysLater();
},
_unhandledEvent: function (state, name, context) {
var errorMessage = "Attempted to handle event `" + name + "` ";
errorMessage += "on " + String(this) + " while in state ";
errorMessage += state.stateName + ". ";
if (context !== undefined) {
errorMessage += "Called with " + _ember.default.inspect(context) + ".";
}
throw new _ember.default.Error(errorMessage);
},
triggerLater: function () {
var length = arguments.length;
var args = new Array(length);
for (var i = 0; i < length; i++) {
args[i] = arguments[i];
}
if (this._deferredTriggers.push(args) !== 1) {
return;
}
_ember.default.run.scheduleOnce('actions', this, '_triggerDeferredTriggers');
},
_triggerDeferredTriggers: function () {
//TODO: Before 1.0 we want to remove all the events that happen on the pre materialized record,
//but for now, we queue up all the events triggered before the record was materialized, and flush
//them once we have the record
if (!this.record) {
return;
}
for (var i = 0, l = this._deferredTriggers.length; i < l; i++) {
this.record.trigger.apply(this.record, this._deferredTriggers[i]);
}
this._deferredTriggers.length = 0;
},
/*
@method clearRelationships
@private
*/
clearRelationships: function () {
var _this = this;
this.eachRelationship(function (name, relationship) {
if (_this._relationships.has(name)) {
var rel = _this._relationships.get(name);
rel.clear();
rel.destroy();
}
});
Object.keys(this._implicitRelationships).forEach(function (key) {
_this._implicitRelationships[key].clear();
_this._implicitRelationships[key].destroy();
});
},
/*
When a find request is triggered on the store, the user can optionally pass in
attributes and relationships to be preloaded. These are meant to behave as if they
came back from the server, except the user obtained them out of band and is informing
the store of their existence. The most common use case is for supporting client side
nested URLs, such as `/posts/1/comments/2` so the user can do
`store.findRecord('comment', 2, { preload: { post: 1 } })` without having to fetch the post.
Preloaded data can be attributes and relationships passed in either as IDs or as actual
models.
@method _preloadData
@private
@param {Object} preload
*/
_preloadData: function (preload) {
var _this2 = this;
//TODO(Igor) consider the polymorphic case
Object.keys(preload).forEach(function (key) {
var preloadValue = get(preload, key);
var relationshipMeta = _this2.type.metaForProperty(key);
if (relationshipMeta.isRelationship) {
_this2._preloadRelationship(key, preloadValue);
} else {
_this2._data[key] = preloadValue;
}
});
},
_preloadRelationship: function (key, preloadValue) {
var relationshipMeta = this.type.metaForProperty(key);
var type = relationshipMeta.type;
if (relationshipMeta.kind === 'hasMany') {
this._preloadHasMany(key, preloadValue, type);
} else {
this._preloadBelongsTo(key, preloadValue, type);
}
},
_preloadHasMany: function (key, preloadValue, type) {
var recordsToSet = new Array(preloadValue.length);
for (var i = 0; i < preloadValue.length; i++) {
var recordToPush = preloadValue[i];
recordsToSet[i] = this._convertStringOrNumberIntoInternalModel(recordToPush, type);
}
//We use the pathway of setting the hasMany as if it came from the adapter
//because the user told us that they know this relationships exists already
this._relationships.get(key).updateRecordsFromAdapter(recordsToSet);
},
_preloadBelongsTo: function (key, preloadValue, type) {
var recordToSet = this._convertStringOrNumberIntoInternalModel(preloadValue, type);
//We use the pathway of setting the hasMany as if it came from the adapter
//because the user told us that they know this relationships exists already
this._relationships.get(key).setRecord(recordToSet);
},
_convertStringOrNumberIntoInternalModel: function (value, type) {
if (typeof value === 'string' || typeof value === 'number') {
return this.store._internalModelForId(type, value);
}
if (value._internalModel) {
return value._internalModel;
}
return value;
},
/*
@method updateRecordArrays
@private
*/
updateRecordArrays: function () {
this._updatingRecordArraysLater = false;
this.store.dataWasUpdated(this.type, this);
},
setId: function (id) {
this.id = id;
if (this.record.get('id') !== id) {
this.record.set('id', id);
}
},
didError: function (error) {
this.error = error;
this.isError = true;
if (this.record) {
this.record.setProperties({
isError: true,
adapterError: error
});
}
},
didCleanError: function () {
this.error = null;
this.isError = false;
if (this.record) {
this.record.setProperties({
isError: false,
adapterError: null
});
}
},
/*
If the adapter did not return a hash in response to a commit,
merge the changed attributes and relationships into the existing
saved data.
@method adapterDidCommit
*/
adapterDidCommit: function (data) {
if (data) {
data = data.attributes;
}
this.didCleanError();
var changedKeys = this._changedKeys(data);
assign(this._data, this._inFlightAttributes);
if (data) {
assign(this._data, data);
}
this._inFlightAttributes = new _emberDataPrivateSystemEmptyObject.default();
this.send('didCommit');
this.updateRecordArraysLater();
if (!data) {
return;
}
this.record._notifyProperties(changedKeys);
},
/*
@method updateRecordArraysLater
@private
*/
updateRecordArraysLater: function () {
// quick hack (something like this could be pushed into run.once
if (this._updatingRecordArraysLater) {
return;
}
this._updatingRecordArraysLater = true;
_ember.default.run.schedule('actions', this, this.updateRecordArrays);
},
addErrorMessageToAttribute: function (attribute, message) {
var record = this.getRecord();
get(record, 'errors')._add(attribute, message);
},
removeErrorMessageFromAttribute: function (attribute) {
var record = this.getRecord();
get(record, 'errors')._remove(attribute);
},
clearErrorMessages: function () {
var record = this.getRecord();
get(record, 'errors')._clear();
},
hasErrors: function () {
var record = this.getRecord();
var errors = get(record, 'errors');
return !_ember.default.isEmpty(errors);
},
// FOR USE DURING COMMIT PROCESS
/*
@method adapterDidInvalidate
@private
*/
adapterDidInvalidate: function (errors) {
var attribute;
for (attribute in errors) {
if (errors.hasOwnProperty(attribute)) {
this.addErrorMessageToAttribute(attribute, errors[attribute]);
}
}
this.send('becameInvalid');
this._saveWasRejected();
},
/*
@method adapterDidError
@private
*/
adapterDidError: function (error) {
this.send('becameError');
this.didError(error);
this._saveWasRejected();
},
_saveWasRejected: function () {
var keys = Object.keys(this._inFlightAttributes);
for (var i = 0; i < keys.length; i++) {
if (this._attributes[keys[i]] === undefined) {
this._attributes[keys[i]] = this._inFlightAttributes[keys[i]];
}
}
this._inFlightAttributes = new _emberDataPrivateSystemEmptyObject.default();
},
/*
Ember Data has 3 buckets for storing the value of an attribute on an internalModel.
`_data` holds all of the attributes that have been acknowledged by
a backend via the adapter. When rollbackAttributes is called on a model all
attributes will revert to the record's state in `_data`.
`_attributes` holds any change the user has made to an attribute
that has not been acknowledged by the adapter. Any values in
`_attributes` are have priority over values in `_data`.
`_inFlightAttributes`. When a record is being synced with the
backend the values in `_attributes` are copied to
`_inFlightAttributes`. This way if the backend acknowledges the
save but does not return the new state Ember Data can copy the
values from `_inFlightAttributes` to `_data`. Without having to
worry about changes made to `_attributes` while the save was
happenign.
Changed keys builds a list of all of the values that may have been
changed by the backend after a successful save.
It does this by iterating over each key, value pair in the payload
returned from the server after a save. If the `key` is found in
`_attributes` then the user has a local changed to the attribute
that has not been synced with the server and the key is not
included in the list of changed keys.
If the value, for a key differs from the value in what Ember Data
believes to be the truth about the backend state (A merger of the
`_data` and `_inFlightAttributes` objects where
`_inFlightAttributes` has priority) then that means the backend
has updated the value and the key is added to the list of changed
keys.
@method _changedKeys
@private
*/
_changedKeys: function (updates) {
var changedKeys = [];
if (updates) {
var original, i, value, key;
var keys = Object.keys(updates);
var length = keys.length;
original = assign(new _emberDataPrivateSystemEmptyObject.default(), this._data);
original = assign(original, this._inFlightAttributes);
for (i = 0; i < length; i++) {
key = keys[i];
value = updates[key];
// A value in _attributes means the user has a local change to
// this attributes. We never override this value when merging
// updates from the backend so we should not sent a change
// notification if the server value differs from the original.
if (this._attributes[key] !== undefined) {
continue;
}
if (!_ember.default.isEqual(original[key], value)) {
changedKeys.push(key);
}
}
}
return changedKeys;
},
toString: function () {
if (this.record) {
return this.record.toString();
} else {
return "<" + this.modelName + ":" + this.id + ">";
}
}
};
InternalModel.prototype.referenceFor = function (type, name) {
var reference = this.references[name];
if (!reference) {
var relationship = this._relationships.get(name);
if (type === "belongsTo") {
reference = new _emberDataPrivateSystemReferences.BelongsToReference(this.store, this, relationship);
} else if (type === "hasMany") {
reference = new _emberDataPrivateSystemReferences.HasManyReference(this.store, this, relationship);
}
this.references[name] = reference;
}
return reference;
};
});
define("ember-data/-private/system/model/model", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/system/promise-proxies", "ember-data/-private/system/model/errors", "ember-data/-private/features", "ember-data/-private/system/debug/debug-info", "ember-data/-private/system/relationships/belongs-to", "ember-data/-private/system/relationships/has-many", "ember-data/-private/system/relationships/ext", "ember-data/-private/system/model/attr"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateSystemPromiseProxies, _emberDataPrivateSystemModelErrors, _emberDataPrivateFeatures, _emberDataPrivateSystemDebugDebugInfo, _emberDataPrivateSystemRelationshipsBelongsTo, _emberDataPrivateSystemRelationshipsHasMany, _emberDataPrivateSystemRelationshipsExt, _emberDataPrivateSystemModelAttr) {
/**
@module ember-data
*/
var get = _ember.default.get;
function intersection(array1, array2) {
var result = [];
array1.forEach(function (element) {
if (array2.indexOf(element) >= 0) {
result.push(element);
}
});
return result;
}
var RESERVED_MODEL_PROPS = ['currentState', 'data', 'store'];
var retrieveFromCurrentState = _ember.default.computed('currentState', function (key) {
return get(this._internalModel.currentState, key);
}).readOnly();
/**
The model class that all Ember Data records descend from.
This is the public API of Ember Data models. If you are using Ember Data
in your application, this is the class you should use.
If you are working on Ember Data internals, you most likely want to be dealing
with `InternalModel`
@class Model
@namespace DS
@extends Ember.Object
@uses Ember.Evented
*/
var Model = _ember.default.Object.extend(_ember.default.Evented, {
_internalModel: null,
store: null,
/**
If this property is `true` the record is in the `empty`
state. Empty is the first state all records enter after they have
been created. Most records created by the store will quickly
transition to the `loading` state if data needs to be fetched from
the server or the `created` state if the record is created on the
client. A record can also enter the empty state if the adapter is
unable to locate the record.
@property isEmpty
@type {Boolean}
@readOnly
*/
isEmpty: retrieveFromCurrentState,
/**
If this property is `true` the record is in the `loading` state. A
record enters this state when the store asks the adapter for its
data. It remains in this state until the adapter provides the
requested data.
@property isLoading
@type {Boolean}
@readOnly
*/
isLoading: retrieveFromCurrentState,
/**
If this property is `true` the record is in the `loaded` state. A
record enters this state when its data is populated. Most of a
record's lifecycle is spent inside substates of the `loaded`
state.
Example
```javascript
var record = store.createRecord('model');
record.get('isLoaded'); // true
store.findRecord('model', 1).then(function(model) {
model.get('isLoaded'); // true
});
```
@property isLoaded
@type {Boolean}
@readOnly
*/
isLoaded: retrieveFromCurrentState,
/**
If this property is `true` the record is in the `dirty` state. The
record has local changes that have not yet been saved by the
adapter. This includes records that have been created (but not yet
saved) or deleted.
Example
```javascript
var record = store.createRecord('model');
record.get('hasDirtyAttributes'); // true
store.findRecord('model', 1).then(function(model) {
model.get('hasDirtyAttributes'); // false
model.set('foo', 'some value');
model.get('hasDirtyAttributes'); // true
});
```
@property hasDirtyAttributes
@type {Boolean}
@readOnly
*/
hasDirtyAttributes: _ember.default.computed('currentState.isDirty', function () {
return this.get('currentState.isDirty');
}),
/**
If this property is `true` the record is in the `saving` state. A
record enters the saving state when `save` is called, but the
adapter has not yet acknowledged that the changes have been
persisted to the backend.
Example
```javascript
var record = store.createRecord('model');
record.get('isSaving'); // false
var promise = record.save();
record.get('isSaving'); // true
promise.then(function() {
record.get('isSaving'); // false
});
```
@property isSaving
@type {Boolean}
@readOnly
*/
isSaving: retrieveFromCurrentState,
/**
If this property is `true` the record is in the `deleted` state
and has been marked for deletion. When `isDeleted` is true and
`hasDirtyAttributes` is true, the record is deleted locally but the deletion
was not yet persisted. When `isSaving` is true, the change is
in-flight. When both `hasDirtyAttributes` and `isSaving` are false, the
change has persisted.
Example
```javascript
var record = store.createRecord('model');
record.get('isDeleted'); // false
record.deleteRecord();
// Locally deleted
record.get('isDeleted'); // true
record.get('hasDirtyAttributes'); // true
record.get('isSaving'); // false
// Persisting the deletion
var promise = record.save();
record.get('isDeleted'); // true
record.get('isSaving'); // true
// Deletion Persisted
promise.then(function() {
record.get('isDeleted'); // true
record.get('isSaving'); // false
record.get('hasDirtyAttributes'); // false
});
```
@property isDeleted
@type {Boolean}
@readOnly
*/
isDeleted: retrieveFromCurrentState,
/**
If this property is `true` the record is in the `new` state. A
record will be in the `new` state when it has been created on the
client and the adapter has not yet report that it was successfully
saved.
Example
```javascript
var record = store.createRecord('model');
record.get('isNew'); // true
record.save().then(function(model) {
model.get('isNew'); // false
});
```
@property isNew
@type {Boolean}
@readOnly
*/
isNew: retrieveFromCurrentState,
/**
If this property is `true` the record is in the `valid` state.
A record will be in the `valid` state when the adapter did not report any
server-side validation failures.
@property isValid
@type {Boolean}
@readOnly
*/
isValid: retrieveFromCurrentState,
/**
If the record is in the dirty state this property will report what
kind of change has caused it to move into the dirty
state. Possible values are:
- `created` The record has been created by the client and not yet saved to the adapter.
- `updated` The record has been updated by the client and not yet saved to the adapter.
- `deleted` The record has been deleted by the client and not yet saved to the adapter.
Example
```javascript
var record = store.createRecord('model');
record.get('dirtyType'); // 'created'
```
@property dirtyType
@type {String}
@readOnly
*/
dirtyType: retrieveFromCurrentState,
/**
If `true` the adapter reported that it was unable to save local
changes to the backend for any reason other than a server-side
validation error.
Example
```javascript
record.get('isError'); // false
record.set('foo', 'valid value');
record.save().then(null, function() {
record.get('isError'); // true
});
```
@property isError
@type {Boolean}
@readOnly
*/
isError: false,
/**
If `true` the store is attempting to reload the record form the adapter.
Example
```javascript
record.get('isReloading'); // false
record.reload();
record.get('isReloading'); // true
```
@property isReloading
@type {Boolean}
@readOnly
*/
isReloading: false,
/**
All ember models have an id property. This is an identifier
managed by an external source. These are always coerced to be
strings before being used internally. Note when declaring the
attributes for a model it is an error to declare an id
attribute.
```javascript
var record = store.createRecord('model');
record.get('id'); // null
store.findRecord('model', 1).then(function(model) {
model.get('id'); // '1'
});
```
@property id
@type {String}
*/
id: null,
/**
@property currentState
@private
@type {Object}
*/
/**
When the record is in the `invalid` state this object will contain
any errors returned by the adapter. When present the errors hash
contains keys corresponding to the invalid property names
and values which are arrays of Javascript objects with two keys:
- `message` A string containing the error message from the backend
- `attribute` The name of the property associated with this error message
```javascript
record.get('errors.length'); // 0
record.set('foo', 'invalid value');
record.save().catch(function() {
record.get('errors').get('foo');
// [{message: 'foo should be a number.', attribute: 'foo'}]
});
```
The `errors` property us useful for displaying error messages to
the user.
```handlebars
<label>Username: {{input value=username}} </label>
{{#each model.errors.username as |error|}}
<div class="error">
{{error.message}}
</div>
{{/each}}
<label>Email: {{input value=email}} </label>
{{#each model.errors.email as |error|}}
<div class="error">
{{error.message}}
</div>
{{/each}}
```
You can also access the special `messages` property on the error
object to get an array of all the error strings.
```handlebars
{{#each model.errors.messages as |message|}}
<div class="error">
{{message}}
</div>
{{/each}}
```
@property errors
@type {DS.Errors}
*/
errors: _ember.default.computed(function () {
var errors = _emberDataPrivateSystemModelErrors.default.create();
errors._registerHandlers(this._internalModel, function () {
this.send('becameInvalid');
}, function () {
this.send('becameValid');
});
return errors;
}).readOnly(),
/**
This property holds the `DS.AdapterError` object with which
last adapter operation was rejected.
@property adapterError
@type {DS.AdapterError}
*/
adapterError: null,
/**
Create a JSON representation of the record, using the serialization
strategy of the store's adapter.
`serialize` takes an optional hash as a parameter, currently
supported options are:
- `includeId`: `true` if the record's ID should be included in the
JSON representation.
@method serialize
@param {Object} options
@return {Object} an object whose values are primitive JSON values only
*/
serialize: function (options) {
return this.store.serialize(this, options);
},
/**
Use [DS.JSONSerializer](DS.JSONSerializer.html) to
get the JSON representation of a record.
`toJSON` takes an optional hash as a parameter, currently
supported options are:
- `includeId`: `true` if the record's ID should be included in the
JSON representation.
@method toJSON
@param {Object} options
@return {Object} A JSON representation of the object.
*/
toJSON: function (options) {
// container is for lazy transform lookups
var serializer = this.store.serializerFor('-default');
var snapshot = this._internalModel.createSnapshot();
return serializer.serialize(snapshot, options);
},
/**
Fired when the record is ready to be interacted with,
that is either loaded from the server or created locally.
@event ready
*/
ready: _ember.default.K,
/**
Fired when the record is loaded from the server.
@event didLoad
*/
didLoad: _ember.default.K,
/**
Fired when the record is updated.
@event didUpdate
*/
didUpdate: _ember.default.K,
/**
Fired when a new record is commited to the server.
@event didCreate
*/
didCreate: _ember.default.K,
/**
Fired when the record is deleted.
@event didDelete
*/
didDelete: _ember.default.K,
/**
Fired when the record becomes invalid.
@event becameInvalid
*/
becameInvalid: _ember.default.K,
/**
Fired when the record enters the error state.
@event becameError
*/
becameError: _ember.default.K,
/**
Fired when the record is rolled back.
@event rolledBack
*/
rolledBack: _ember.default.K,
/**
@property data
@private
@type {Object}
*/
data: _ember.default.computed.readOnly('_internalModel._data'),
//TODO Do we want to deprecate these?
/**
@method send
@private
@param {String} name
@param {Object} context
*/
send: function (name, context) {
return this._internalModel.send(name, context);
},
/**
@method transitionTo
@private
@param {String} name
*/
transitionTo: function (name) {
return this._internalModel.transitionTo(name);
},
/**
Marks the record as deleted but does not save it. You must call
`save` afterwards if you want to persist it. You might use this
method if you want to allow the user to still `rollbackAttributes()`
after a delete it was made.
Example
```app/routes/model/delete.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
softDelete: function() {
this.controller.get('model').deleteRecord();
},
confirm: function() {
this.controller.get('model').save();
},
undo: function() {
this.controller.get('model').rollbackAttributes();
}
}
});
```
@method deleteRecord
*/
deleteRecord: function () {
this._internalModel.deleteRecord();
},
/**
Same as `deleteRecord`, but saves the record immediately.
Example
```app/routes/model/delete.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
delete: function() {
var controller = this.controller;
controller.get('model').destroyRecord().then(function() {
controller.transitionToRoute('model.index');
});
}
}
});
```
@method destroyRecord
@param {Object} options
@return {Promise} a promise that will be resolved when the adapter returns
successfully or rejected if the adapter returns with an error.
*/
destroyRecord: function (options) {
this.deleteRecord();
return this.save(options);
},
/**
@method unloadRecord
@private
*/
unloadRecord: function () {
if (this.isDestroyed) {
return;
}
this._internalModel.unloadRecord();
},
/**
@method _notifyProperties
@private
*/
_notifyProperties: function (keys) {
_ember.default.beginPropertyChanges();
var key;
for (var i = 0, length = keys.length; i < length; i++) {
key = keys[i];
this.notifyPropertyChange(key);
}
_ember.default.endPropertyChanges();
},
/**
Returns an object, whose keys are changed properties, and value is
an [oldProp, newProp] array.
Example
```app/models/mascot.js
import DS from 'ember-data';
export default DS.Model.extend({
name: attr('string')
});
```
```javascript
var mascot = store.createRecord('mascot');
mascot.changedAttributes(); // {}
mascot.set('name', 'Tomster');
mascot.changedAttributes(); // {name: [undefined, 'Tomster']}
```
@method changedAttributes
@return {Object} an object, whose keys are changed properties,
and value is an [oldProp, newProp] array.
*/
changedAttributes: function () {
return this._internalModel.changedAttributes();
},
//TODO discuss with tomhuda about events/hooks
//Bring back as hooks?
/**
@method adapterWillCommit
@private
adapterWillCommit: function() {
this.send('willCommit');
},
/**
@method adapterDidDirty
@private
adapterDidDirty: function() {
this.send('becomeDirty');
this.updateRecordArraysLater();
},
*/
/**
If the model `hasDirtyAttributes` this function will discard any unsaved
changes. If the model `isNew` it will be removed from the store.
Example
```javascript
record.get('name'); // 'Untitled Document'
record.set('name', 'Doc 1');
record.get('name'); // 'Doc 1'
record.rollbackAttributes();
record.get('name'); // 'Untitled Document'
```
@method rollbackAttributes
*/
rollbackAttributes: function () {
this._internalModel.rollbackAttributes();
},
/*
@method _createSnapshot
@private
*/
_createSnapshot: function () {
return this._internalModel.createSnapshot();
},
toStringExtension: function () {
return get(this, 'id');
},
/**
Save the record and persist any changes to the record to an
external source via the adapter.
Example
```javascript
record.set('name', 'Tomster');
record.save().then(function() {
// Success callback
}, function() {
// Error callback
});
```
@method save
@param {Object} options
@return {Promise} a promise that will be resolved when the adapter returns
successfully or rejected if the adapter returns with an error.
*/
save: function (options) {
var _this = this;
return _emberDataPrivateSystemPromiseProxies.PromiseObject.create({
promise: this._internalModel.save(options).then(function () {
return _this;
})
});
},
/**
Reload the record from the adapter.
This will only work if the record has already finished loading.
Example
```app/routes/model/view.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
reload: function() {
this.controller.get('model').reload().then(function(model) {
// do something with the reloaded model
});
}
}
});
```
@method reload
@return {Promise} a promise that will be resolved with the record when the
adapter returns successfully or rejected if the adapter returns
with an error.
*/
reload: function () {
var _this2 = this;
return _emberDataPrivateSystemPromiseProxies.PromiseObject.create({
promise: this._internalModel.reload().then(function () {
return _this2;
})
});
},
/**
Override the default event firing from Ember.Evented to
also call methods with the given name.
@method trigger
@private
@param {String} name
*/
trigger: function (name) {
var length = arguments.length;
var args = new Array(length - 1);
for (var i = 1; i < length; i++) {
args[i - 1] = arguments[i];
}
_ember.default.tryInvoke(this, name, args);
this._super.apply(this, arguments);
},
willDestroy: function () {
//TODO Move!
this._super.apply(this, arguments);
this._internalModel.clearRelationships();
this._internalModel.recordObjectWillDestroy();
//TODO should we set internalModel to null here?
},
// This is a temporary solution until we refactor DS.Model to not
// rely on the data property.
willMergeMixin: function (props) {
var constructor = this.constructor;
},
attr: function () {},
belongsTo: function () {},
hasMany: function () {},
setId: _ember.default.observer('id', function () {
this._internalModel.setId(this.get('id'));
})
});
Model.reopenClass({
/**
Alias DS.Model's `create` method to `_create`. This allows us to create DS.Model
instances from within the store, but if end users accidentally call `create()`
(instead of `createRecord()`), we can raise an error.
@method _create
@private
@static
*/
_create: Model.create,
/**
Override the class' `create()` method to raise an error. This
prevents end users from inadvertently calling `create()` instead
of `createRecord()`. The store is still able to create instances
by calling the `_create()` method. To create an instance of a
`DS.Model` use [store.createRecord](DS.Store.html#method_createRecord).
@method create
@private
@static
*/
create: function () {
throw new _ember.default.Error("You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.");
},
/**
Represents the model's class name as a string. This can be used to look up the model through
DS.Store's modelFor method.
`modelName` is generated for you by Ember Data. It will be a lowercased, dasherized string.
For example:
```javascript
store.modelFor('post').modelName; // 'post'
store.modelFor('blog-post').modelName; // 'blog-post'
```
The most common place you'll want to access `modelName` is in your serializer's `payloadKeyFromModelName` method. For example, to change payload
keys to underscore (instead of dasherized), you might use the following code:
```javascript
export default var PostSerializer = DS.RESTSerializer.extend({
payloadKeyFromModelName: function(modelName) {
return Ember.String.underscore(modelName);
}
});
```
@property modelName
@type String
@readonly
*/
modelName: null
});
// if `Ember.setOwner` is defined, accessing `this.container` is
// deprecated (but functional). In "standard" Ember usage, this
// deprecation is actually created via an `.extend` of the factory
// inside the container itself, but that only happens on models
// with MODEL_FACTORY_INJECTIONS enabled :(
if (_ember.default.setOwner) {
Object.defineProperty(Model.prototype, 'container', {
configurable: true,
enumerable: false,
get: function () {
return this.store.container;
}
});
}
Model.reopen({
/**
Get the reference for the specified belongsTo relationship.
Example
```javascript
// models/blog.js
export default DS.Model.extend({
user: DS.belongsTo({ async: true })
});
store.push({
type: 'blog',
id: 1,
relationships: {
user: { type: 'user', id: 1 }
}
});
var userRef = blog.belongsTo('user');
// check if the user relationship is loaded
var isLoaded = userRef.value() !== null;
// get the record of the reference (null if not yet available)
var user = userRef.value();
// get the identifier of the reference
if (userRef.remoteType() === "id") {
var id = userRef.id();
} else if (userRef.remoteType() === "link") {
var link = userRef.link();
}
// load user (via store.findRecord or store.findBelongsTo)
userRef.load().then(...)
// or trigger a reload
userRef.reload().then(...)
// provide data for reference
userRef.push({
type: 'user',
id: 1,
attributes: {
username: "@user"
}
}).then(function(user) {
userRef.value() === user;
});
```
@method belongsTo
@param {String} name of the relationship
@return {BelongsToReference} reference for this relationship
*/
belongsTo: function (name) {
return this._internalModel.referenceFor('belongsTo', name);
},
/**
Get the reference for the specified hasMany relationship.
Example
```javascript
// models/blog.js
export default DS.Model.extend({
comments: DS.hasMany({ async: true })
});
store.push({
type: 'blog',
id: 1,
relationships: {
comments: {
data: [
{ type: 'comment', id: 1 },
{ type: 'comment', id: 2 }
]
}
}
});
var commentsRef = blog.hasMany('comments');
// check if the comments are loaded already
var isLoaded = commentsRef.value() !== null;
// get the records of the reference (null if not yet available)
var comments = commentsRef.value();
// get the identifier of the reference
if (commentsRef.remoteType() === "ids") {
var ids = commentsRef.ids();
} else if (commentsRef.remoteType() === "link") {
var link = commentsRef.link();
}
// load comments (via store.findMany or store.findHasMany)
commentsRef.load().then(...)
// or trigger a reload
commentsRef.reload().then(...)
// provide data for reference
commentsRef.push([{ type: 'comment', id: 1 }, { type: 'comment', id: 2 }]).then(function(comments) {
commentsRef.value() === comments;
});
```
@method hasMany
@param {String} name of the relationship
@return {HasManyReference} reference for this relationship
*/
hasMany: function (name) {
return this._internalModel.referenceFor('hasMany', name);
}
});
Model.reopenClass(_emberDataPrivateSystemRelationshipsExt.RelationshipsClassMethodsMixin);
Model.reopenClass(_emberDataPrivateSystemModelAttr.AttrClassMethodsMixin);
exports.default = Model.extend(_emberDataPrivateSystemDebugDebugInfo.default, _emberDataPrivateSystemRelationshipsBelongsTo.BelongsToMixin, _emberDataPrivateSystemRelationshipsExt.DidDefinePropertyMixin, _emberDataPrivateSystemRelationshipsExt.RelationshipsInstanceMethodsMixin, _emberDataPrivateSystemRelationshipsHasMany.HasManyMixin, _emberDataPrivateSystemModelAttr.AttrInstanceMethodsMixin);
});
define('ember-data/-private/system/model/states', ['exports', 'ember', 'ember-data/-private/debug'], function (exports, _ember, _emberDataPrivateDebug) {
var get = _ember.default.get;
/*
This file encapsulates the various states that a record can transition
through during its lifecycle.
*/
/**
### State
Each record has a `currentState` property that explicitly tracks what
state a record is in at any given time. For instance, if a record is
newly created and has not yet been sent to the adapter to be saved,
it would be in the `root.loaded.created.uncommitted` state. If a
record has had local modifications made to it that are in the
process of being saved, the record would be in the
`root.loaded.updated.inFlight` state. (This state paths will be
explained in more detail below.)
Events are sent by the record or its store to the record's
`currentState` property. How the state reacts to these events is
dependent on which state it is in. In some states, certain events
will be invalid and will cause an exception to be raised.
States are hierarchical and every state is a substate of the
`RootState`. For example, a record can be in the
`root.deleted.uncommitted` state, then transition into the
`root.deleted.inFlight` state. If a child state does not implement
an event handler, the state manager will attempt to invoke the event
on all parent states until the root state is reached. The state
hierarchy of a record is described in terms of a path string. You
can determine a record's current state by getting the state's
`stateName` property:
```javascript
record.get('currentState.stateName');
//=> "root.created.uncommitted"
```
The hierarchy of valid states that ship with ember data looks like
this:
```text
* root
* deleted
* saved
* uncommitted
* inFlight
* empty
* loaded
* created
* uncommitted
* inFlight
* saved
* updated
* uncommitted
* inFlight
* loading
```
The `DS.Model` states are themselves stateless. What that means is
that, the hierarchical states that each of *those* points to is a
shared data structure. For performance reasons, instead of each
record getting its own copy of the hierarchy of states, each record
points to this global, immutable shared instance. How does a state
know which record it should be acting on? We pass the record
instance into the state's event handlers as the first argument.
The record passed as the first parameter is where you should stash
state about the record if needed; you should never store data on the state
object itself.
### Events and Flags
A state may implement zero or more events and flags.
#### Events
Events are named functions that are invoked when sent to a record. The
record will first look for a method with the given name on the
current state. If no method is found, it will search the current
state's parent, and then its grandparent, and so on until reaching
the top of the hierarchy. If the root is reached without an event
handler being found, an exception will be raised. This can be very
helpful when debugging new features.
Here's an example implementation of a state with a `myEvent` event handler:
```javascript
aState: DS.State.create({
myEvent: function(manager, param) {
console.log("Received myEvent with", param);
}
})
```
To trigger this event:
```javascript
record.send('myEvent', 'foo');
//=> "Received myEvent with foo"
```
Note that an optional parameter can be sent to a record's `send()` method,
which will be passed as the second parameter to the event handler.
Events should transition to a different state if appropriate. This can be
done by calling the record's `transitionTo()` method with a path to the
desired state. The state manager will attempt to resolve the state path
relative to the current state. If no state is found at that path, it will
attempt to resolve it relative to the current state's parent, and then its
parent, and so on until the root is reached. For example, imagine a hierarchy
like this:
* created
* uncommitted <-- currentState
* inFlight
* updated
* inFlight
If we are currently in the `uncommitted` state, calling
`transitionTo('inFlight')` would transition to the `created.inFlight` state,
while calling `transitionTo('updated.inFlight')` would transition to
the `updated.inFlight` state.
Remember that *only events* should ever cause a state transition. You should
never call `transitionTo()` from outside a state's event handler. If you are
tempted to do so, create a new event and send that to the state manager.
#### Flags
Flags are Boolean values that can be used to introspect a record's current
state in a more user-friendly way than examining its state path. For example,
instead of doing this:
```javascript
var statePath = record.get('stateManager.currentPath');
if (statePath === 'created.inFlight') {
doSomething();
}
```
You can say:
```javascript
if (record.get('isNew') && record.get('isSaving')) {
doSomething();
}
```
If your state does not set a value for a given flag, the value will
be inherited from its parent (or the first place in the state hierarchy
where it is defined).
The current set of flags are defined below. If you want to add a new flag,
in addition to the area below, you will also need to declare it in the
`DS.Model` class.
* [isEmpty](DS.Model.html#property_isEmpty)
* [isLoading](DS.Model.html#property_isLoading)
* [isLoaded](DS.Model.html#property_isLoaded)
* [isDirty](DS.Model.html#property_isDirty)
* [isSaving](DS.Model.html#property_isSaving)
* [isDeleted](DS.Model.html#property_isDeleted)
* [isNew](DS.Model.html#property_isNew)
* [isValid](DS.Model.html#property_isValid)
@namespace DS
@class RootState
*/
function didSetProperty(internalModel, context) {
if (context.value === context.originalValue) {
delete internalModel._attributes[context.name];
internalModel.send('propertyWasReset', context.name);
} else if (context.value !== context.oldValue) {
internalModel.send('becomeDirty');
}
internalModel.updateRecordArraysLater();
}
// Implementation notes:
//
// Each state has a boolean value for all of the following flags:
//
// * isLoaded: The record has a populated `data` property. When a
// record is loaded via `store.find`, `isLoaded` is false
// until the adapter sets it. When a record is created locally,
// its `isLoaded` property is always true.
// * isDirty: The record has local changes that have not yet been
// saved by the adapter. This includes records that have been
// created (but not yet saved) or deleted.
// * isSaving: The record has been committed, but
// the adapter has not yet acknowledged that the changes have
// been persisted to the backend.
// * isDeleted: The record was marked for deletion. When `isDeleted`
// is true and `isDirty` is true, the record is deleted locally
// but the deletion was not yet persisted. When `isSaving` is
// true, the change is in-flight. When both `isDirty` and
// `isSaving` are false, the change has persisted.
// * isNew: The record was created on the client and the adapter
// did not yet report that it was successfully saved.
// * isValid: The adapter did not report any server-side validation
// failures.
// The dirty state is a abstract state whose functionality is
// shared between the `created` and `updated` states.
//
// The deleted state shares the `isDirty` flag with the
// subclasses of `DirtyState`, but with a very different
// implementation.
//
// Dirty states have three child states:
//
// `uncommitted`: the store has not yet handed off the record
// to be saved.
// `inFlight`: the store has handed off the record to be saved,
// but the adapter has not yet acknowledged success.
// `invalid`: the record has invalid information and cannot be
// send to the adapter yet.
var DirtyState = {
initialState: 'uncommitted',
// FLAGS
isDirty: true,
// SUBSTATES
// When a record first becomes dirty, it is `uncommitted`.
// This means that there are local pending changes, but they
// have not yet begun to be saved, and are not invalid.
uncommitted: {
// EVENTS
didSetProperty: didSetProperty,
//TODO(Igor) reloading now triggers a
//loadingData event, though it seems fine?
loadingData: _ember.default.K,
propertyWasReset: function (internalModel, name) {
if (!internalModel.hasChangedAttributes()) {
internalModel.send('rolledBack');
}
},
pushedData: function (internalModel) {
internalModel.updateChangedAttributes();
if (!internalModel.hasChangedAttributes()) {
internalModel.transitionTo('loaded.saved');
}
},
becomeDirty: _ember.default.K,
willCommit: function (internalModel) {
internalModel.transitionTo('inFlight');
},
reloadRecord: function (internalModel, resolve) {
resolve(internalModel.store.reloadRecord(internalModel));
},
rolledBack: function (internalModel) {
internalModel.transitionTo('loaded.saved');
},
becameInvalid: function (internalModel) {
internalModel.transitionTo('invalid');
},
rollback: function (internalModel) {
internalModel.rollbackAttributes();
internalModel.triggerLater('ready');
}
},
// Once a record has been handed off to the adapter to be
// saved, it is in the 'in flight' state. Changes to the
// record cannot be made during this window.
inFlight: {
// FLAGS
isSaving: true,
// EVENTS
didSetProperty: didSetProperty,
becomeDirty: _ember.default.K,
pushedData: _ember.default.K,
unloadRecord: assertAgainstUnloadRecord,
// TODO: More robust semantics around save-while-in-flight
willCommit: _ember.default.K,
didCommit: function (internalModel) {
var dirtyType = get(this, 'dirtyType');
internalModel.transitionTo('saved');
internalModel.send('invokeLifecycleCallbacks', dirtyType);
},
becameInvalid: function (internalModel) {
internalModel.transitionTo('invalid');
internalModel.send('invokeLifecycleCallbacks');
},
becameError: function (internalModel) {
internalModel.transitionTo('uncommitted');
internalModel.triggerLater('becameError', internalModel);
}
},
// A record is in the `invalid` if the adapter has indicated
// the the record failed server-side invalidations.
invalid: {
// FLAGS
isValid: false,
// EVENTS
deleteRecord: function (internalModel) {
internalModel.transitionTo('deleted.uncommitted');
},
didSetProperty: function (internalModel, context) {
internalModel.removeErrorMessageFromAttribute(context.name);
didSetProperty(internalModel, context);
if (!internalModel.hasErrors()) {
this.becameValid(internalModel);
}
},
becameInvalid: _ember.default.K,
becomeDirty: _ember.default.K,
pushedData: _ember.default.K,
willCommit: function (internalModel) {
internalModel.clearErrorMessages();
internalModel.transitionTo('inFlight');
},
rolledBack: function (internalModel) {
internalModel.clearErrorMessages();
internalModel.transitionTo('loaded.saved');
internalModel.triggerLater('ready');
},
becameValid: function (internalModel) {
internalModel.transitionTo('uncommitted');
},
invokeLifecycleCallbacks: function (internalModel) {
internalModel.triggerLater('becameInvalid', internalModel);
}
}
};
// The created and updated states are created outside the state
// chart so we can reopen their substates and add mixins as
// necessary.
function deepClone(object) {
var clone = {};
var value;
for (var prop in object) {
value = object[prop];
if (value && typeof value === 'object') {
clone[prop] = deepClone(value);
} else {
clone[prop] = value;
}
}
return clone;
}
function mixin(original, hash) {
for (var prop in hash) {
original[prop] = hash[prop];
}
return original;
}
function dirtyState(options) {
var newState = deepClone(DirtyState);
return mixin(newState, options);
}
var createdState = dirtyState({
dirtyType: 'created',
// FLAGS
isNew: true
});
createdState.invalid.rolledBack = function (internalModel) {
internalModel.transitionTo('deleted.saved');
};
createdState.uncommitted.rolledBack = function (internalModel) {
internalModel.transitionTo('deleted.saved');
};
var updatedState = dirtyState({
dirtyType: 'updated'
});
function createdStateDeleteRecord(internalModel) {
internalModel.transitionTo('deleted.saved');
internalModel.send('invokeLifecycleCallbacks');
}
createdState.uncommitted.deleteRecord = createdStateDeleteRecord;
createdState.invalid.deleteRecord = createdStateDeleteRecord;
createdState.uncommitted.rollback = function (internalModel) {
DirtyState.uncommitted.rollback.apply(this, arguments);
internalModel.transitionTo('deleted.saved');
};
createdState.uncommitted.pushedData = function (internalModel) {
internalModel.transitionTo('loaded.updated.uncommitted');
internalModel.triggerLater('didLoad');
};
createdState.uncommitted.propertyWasReset = _ember.default.K;
function assertAgainstUnloadRecord(internalModel) {}
updatedState.inFlight.unloadRecord = assertAgainstUnloadRecord;
updatedState.uncommitted.deleteRecord = function (internalModel) {
internalModel.transitionTo('deleted.uncommitted');
};
var RootState = {
// FLAGS
isEmpty: false,
isLoading: false,
isLoaded: false,
isDirty: false,
isSaving: false,
isDeleted: false,
isNew: false,
isValid: true,
// DEFAULT EVENTS
// Trying to roll back if you're not in the dirty state
// doesn't change your state. For example, if you're in the
// in-flight state, rolling back the record doesn't move
// you out of the in-flight state.
rolledBack: _ember.default.K,
unloadRecord: function (internalModel) {
// clear relationships before moving to deleted state
// otherwise it fails
internalModel.clearRelationships();
internalModel.transitionTo('deleted.saved');
},
propertyWasReset: _ember.default.K,
// SUBSTATES
// A record begins its lifecycle in the `empty` state.
// If its data will come from the adapter, it will
// transition into the `loading` state. Otherwise, if
// the record is being created on the client, it will
// transition into the `created` state.
empty: {
isEmpty: true,
// EVENTS
loadingData: function (internalModel, promise) {
internalModel._loadingPromise = promise;
internalModel.transitionTo('loading');
},
loadedData: function (internalModel) {
internalModel.transitionTo('loaded.created.uncommitted');
internalModel.triggerLater('ready');
},
pushedData: function (internalModel) {
internalModel.transitionTo('loaded.saved');
internalModel.triggerLater('didLoad');
internalModel.triggerLater('ready');
}
},
// A record enters this state when the store asks
// the adapter for its data. It remains in this state
// until the adapter provides the requested data.
//
// Usually, this process is asynchronous, using an
// XHR to retrieve the data.
loading: {
// FLAGS
isLoading: true,
exit: function (internalModel) {
internalModel._loadingPromise = null;
},
// EVENTS
pushedData: function (internalModel) {
internalModel.transitionTo('loaded.saved');
internalModel.triggerLater('didLoad');
internalModel.triggerLater('ready');
//TODO this seems out of place here
internalModel.didCleanError();
},
becameError: function (internalModel) {
internalModel.triggerLater('becameError', internalModel);
},
notFound: function (internalModel) {
internalModel.transitionTo('empty');
}
},
// A record enters this state when its data is populated.
// Most of a record's lifecycle is spent inside substates
// of the `loaded` state.
loaded: {
initialState: 'saved',
// FLAGS
isLoaded: true,
//TODO(Igor) Reloading now triggers a loadingData event,
//but it should be ok?
loadingData: _ember.default.K,
// SUBSTATES
// If there are no local changes to a record, it remains
// in the `saved` state.
saved: {
setup: function (internalModel) {
if (internalModel.hasChangedAttributes()) {
internalModel.adapterDidDirty();
}
},
// EVENTS
didSetProperty: didSetProperty,
pushedData: _ember.default.K,
becomeDirty: function (internalModel) {
internalModel.transitionTo('updated.uncommitted');
},
willCommit: function (internalModel) {
internalModel.transitionTo('updated.inFlight');
},
reloadRecord: function (internalModel, resolve) {
resolve(internalModel.store.reloadRecord(internalModel));
},
deleteRecord: function (internalModel) {
internalModel.transitionTo('deleted.uncommitted');
},
unloadRecord: function (internalModel) {
// clear relationships before moving to deleted state
// otherwise it fails
internalModel.clearRelationships();
internalModel.transitionTo('deleted.saved');
},
didCommit: function (internalModel) {
internalModel.send('invokeLifecycleCallbacks', get(internalModel, 'lastDirtyType'));
},
// loaded.saved.notFound would be triggered by a failed
// `reload()` on an unchanged record
notFound: _ember.default.K
},
// A record is in this state after it has been locally
// created but before the adapter has indicated that
// it has been saved.
created: createdState,
// A record is in this state if it has already been
// saved to the server, but there are new local changes
// that have not yet been saved.
updated: updatedState
},
// A record is in this state if it was deleted from the store.
deleted: {
initialState: 'uncommitted',
dirtyType: 'deleted',
// FLAGS
isDeleted: true,
isLoaded: true,
isDirty: true,
// TRANSITIONS
setup: function (internalModel) {
internalModel.updateRecordArrays();
},
// SUBSTATES
// When a record is deleted, it enters the `start`
// state. It will exit this state when the record
// starts to commit.
uncommitted: {
// EVENTS
willCommit: function (internalModel) {
internalModel.transitionTo('inFlight');
},
rollback: function (internalModel) {
internalModel.rollbackAttributes();
internalModel.triggerLater('ready');
},
pushedData: _ember.default.K,
becomeDirty: _ember.default.K,
deleteRecord: _ember.default.K,
rolledBack: function (internalModel) {
internalModel.transitionTo('loaded.saved');
internalModel.triggerLater('ready');
}
},
// After a record starts committing, but
// before the adapter indicates that the deletion
// has saved to the server, a record is in the
// `inFlight` substate of `deleted`.
inFlight: {
// FLAGS
isSaving: true,
// EVENTS
unloadRecord: assertAgainstUnloadRecord,
// TODO: More robust semantics around save-while-in-flight
willCommit: _ember.default.K,
didCommit: function (internalModel) {
internalModel.transitionTo('saved');
internalModel.send('invokeLifecycleCallbacks');
},
becameError: function (internalModel) {
internalModel.transitionTo('uncommitted');
internalModel.triggerLater('becameError', internalModel);
},
becameInvalid: function (internalModel) {
internalModel.transitionTo('invalid');
internalModel.triggerLater('becameInvalid', internalModel);
}
},
// Once the adapter indicates that the deletion has
// been saved, the record enters the `saved` substate
// of `deleted`.
saved: {
// FLAGS
isDirty: false,
setup: function (internalModel) {
internalModel.clearRelationships();
var store = internalModel.store;
store._dematerializeRecord(internalModel);
},
invokeLifecycleCallbacks: function (internalModel) {
internalModel.triggerLater('didDelete', internalModel);
internalModel.triggerLater('didCommit', internalModel);
},
willCommit: _ember.default.K,
didCommit: _ember.default.K
},
invalid: {
isValid: false,
didSetProperty: function (internalModel, context) {
internalModel.removeErrorMessageFromAttribute(context.name);
didSetProperty(internalModel, context);
if (!internalModel.hasErrors()) {
this.becameValid(internalModel);
}
},
becameInvalid: _ember.default.K,
becomeDirty: _ember.default.K,
deleteRecord: _ember.default.K,
willCommit: _ember.default.K,
rolledBack: function (internalModel) {
internalModel.clearErrorMessages();
internalModel.transitionTo('loaded.saved');
internalModel.triggerLater('ready');
},
becameValid: function (internalModel) {
internalModel.transitionTo('uncommitted');
}
}
},
invokeLifecycleCallbacks: function (internalModel, dirtyType) {
if (dirtyType === 'created') {
internalModel.triggerLater('didCreate', internalModel);
} else {
internalModel.triggerLater('didUpdate', internalModel);
}
internalModel.triggerLater('didCommit', internalModel);
}
};
function wireState(object, parent, name) {
/*jshint proto:true*/
// TODO: Use Object.create and copy instead
object = mixin(parent ? Object.create(parent) : {}, object);
object.parentState = parent;
object.stateName = name;
for (var prop in object) {
if (!object.hasOwnProperty(prop) || prop === 'parentState' || prop === 'stateName') {
continue;
}
if (typeof object[prop] === 'object') {
object[prop] = wireState(object[prop], object, name + "." + prop);
}
}
return object;
}
RootState = wireState(RootState, null, "root");
exports.default = RootState;
});
/**
@module ember-data
*/
define('ember-data/-private/system/normalize-link', ['exports'], function (exports) {
exports.default = _normalizeLink;
/**
This method normalizes a link to an "links object". If the passed link is
already an object it's returned without any modifications.
See http://jsonapi.org/format/#document-links for more information.
@method _normalizeLink
@private
@param {String} link
@return {Object|null}
@for DS
*/
function _normalizeLink(link) {
switch (typeof link) {
case 'object':
return link;
case 'string':
return { href: link };
}
return null;
}
});
define('ember-data/-private/system/normalize-model-name', ['exports', 'ember'], function (exports, _ember) {
exports.default = normalizeModelName;
/**
All modelNames are dasherized internally. Changing this function may
require changes to other normalization hooks (such as typeForRoot).
@method normalizeModelName
@public
@param {String} modelName
@return {String} if the adapter can generate one, an ID
@for DS
*/
function normalizeModelName(modelName) {
return _ember.default.String.dasherize(modelName);
}
});
define('ember-data/-private/system/ordered-set', ['exports', 'ember'], function (exports, _ember) {
exports.default = OrderedSet;
var EmberOrderedSet = _ember.default.OrderedSet;
var guidFor = _ember.default.guidFor;
function OrderedSet() {
this._super$constructor();
}
OrderedSet.create = function () {
var Constructor = this;
return new Constructor();
};
OrderedSet.prototype = Object.create(EmberOrderedSet.prototype);
OrderedSet.prototype.constructor = OrderedSet;
OrderedSet.prototype._super$constructor = EmberOrderedSet;
OrderedSet.prototype.addWithIndex = function (obj, idx) {
var guid = guidFor(obj);
var presenceSet = this.presenceSet;
var list = this.list;
if (presenceSet[guid] === true) {
return;
}
presenceSet[guid] = true;
if (idx === undefined || idx == null) {
list.push(obj);
} else {
list.splice(idx, 0, obj);
}
this.size += 1;
return this;
};
});
define('ember-data/-private/system/promise-proxies', ['exports', 'ember', 'ember-data/-private/debug'], function (exports, _ember, _emberDataPrivateDebug) {
var Promise = _ember.default.RSVP.Promise;
var get = _ember.default.get;
/**
A `PromiseArray` is an object that acts like both an `Ember.Array`
and a promise. When the promise is resolved the resulting value
will be set to the `PromiseArray`'s `content` property. This makes
it easy to create data bindings with the `PromiseArray` that will be
updated when the promise resolves.
For more information see the [Ember.PromiseProxyMixin
documentation](/api/classes/Ember.PromiseProxyMixin.html).
Example
```javascript
var promiseArray = DS.PromiseArray.create({
promise: $.getJSON('/some/remote/data.json')
});
promiseArray.get('length'); // 0
promiseArray.then(function() {
promiseArray.get('length'); // 100
});
```
@class PromiseArray
@namespace DS
@extends Ember.ArrayProxy
@uses Ember.PromiseProxyMixin
*/
var PromiseArray = _ember.default.ArrayProxy.extend(_ember.default.PromiseProxyMixin);
/**
A `PromiseObject` is an object that acts like both an `Ember.Object`
and a promise. When the promise is resolved, then the resulting value
will be set to the `PromiseObject`'s `content` property. This makes
it easy to create data bindings with the `PromiseObject` that will
be updated when the promise resolves.
For more information see the [Ember.PromiseProxyMixin
documentation](/api/classes/Ember.PromiseProxyMixin.html).
Example
```javascript
var promiseObject = DS.PromiseObject.create({
promise: $.getJSON('/some/remote/data.json')
});
promiseObject.get('name'); // null
promiseObject.then(function() {
promiseObject.get('name'); // 'Tomster'
});
```
@class PromiseObject
@namespace DS
@extends Ember.ObjectProxy
@uses Ember.PromiseProxyMixin
*/
var PromiseObject = _ember.default.ObjectProxy.extend(_ember.default.PromiseProxyMixin);
var promiseObject = function (promise, label) {
return PromiseObject.create({
promise: Promise.resolve(promise, label)
});
};
var promiseArray = function (promise, label) {
return PromiseArray.create({
promise: Promise.resolve(promise, label)
});
};
/**
A PromiseManyArray is a PromiseArray that also proxies certain method calls
to the underlying manyArray.
Right now we proxy:
* `reload()`
* `createRecord()`
* `on()`
* `one()`
* `trigger()`
* `off()`
* `has()`
@class PromiseManyArray
@namespace DS
@extends Ember.ArrayProxy
*/
function proxyToContent(method) {
return function () {
var content = get(this, 'content');
return content[method].apply(content, arguments);
};
}
var PromiseManyArray = PromiseArray.extend({
reload: function () {
return PromiseManyArray.create({
promise: get(this, 'content').reload()
});
//I don't think this should ever happen right now, but worth guarding if we refactor the async relationships
},
createRecord: proxyToContent('createRecord'),
on: proxyToContent('on'),
one: proxyToContent('one'),
trigger: proxyToContent('trigger'),
off: proxyToContent('off'),
has: proxyToContent('has')
});
var promiseManyArray = function (promise, label) {
return PromiseManyArray.create({
promise: Promise.resolve(promise, label)
});
};
exports.PromiseArray = PromiseArray;
exports.PromiseObject = PromiseObject;
exports.PromiseManyArray = PromiseManyArray;
exports.promiseArray = promiseArray;
exports.promiseObject = promiseObject;
exports.promiseManyArray = promiseManyArray;
});
define("ember-data/-private/system/record-array-manager", ["exports", "ember", "ember-data/-private/system/record-arrays", "ember-data/-private/system/ordered-set"], function (exports, _ember, _emberDataPrivateSystemRecordArrays, _emberDataPrivateSystemOrderedSet) {
var MapWithDefault = _ember.default.MapWithDefault;
var get = _ember.default.get;
/**
@class RecordArrayManager
@namespace DS
@private
@extends Ember.Object
*/
exports.default = _ember.default.Object.extend({
init: function () {
var _this = this;
this.filteredRecordArrays = MapWithDefault.create({
defaultValue: function () {
return [];
}
});
this.liveRecordArrays = MapWithDefault.create({
defaultValue: function (typeClass) {
return _this.createRecordArray(typeClass);
}
});
this.changedRecords = [];
this._adapterPopulatedRecordArrays = [];
},
recordDidChange: function (record) {
if (this.changedRecords.push(record) !== 1) {
return;
}
_ember.default.run.schedule('actions', this, this.updateRecordArrays);
},
recordArraysForRecord: function (record) {
record._recordArrays = record._recordArrays || _emberDataPrivateSystemOrderedSet.default.create();
return record._recordArrays;
},
/**
This method is invoked whenever data is loaded into the store by the
adapter or updated by the adapter, or when a record has changed.
It updates all record arrays that a record belongs to.
To avoid thrashing, it only runs at most once per run loop.
@method updateRecordArrays
*/
updateRecordArrays: function () {
var _this2 = this;
this.changedRecords.forEach(function (internalModel) {
if (get(internalModel, 'record.isDestroyed') || get(internalModel, 'record.isDestroying') || get(internalModel, 'currentState.stateName') === 'root.deleted.saved') {
_this2._recordWasDeleted(internalModel);
} else {
_this2._recordWasChanged(internalModel);
}
});
this.changedRecords.length = 0;
},
_recordWasDeleted: function (record) {
var recordArrays = record._recordArrays;
if (!recordArrays) {
return;
}
recordArrays.forEach(function (array) {
return array.removeInternalModel(record);
});
record._recordArrays = null;
},
_recordWasChanged: function (record) {
var _this3 = this;
var typeClass = record.type;
var recordArrays = this.filteredRecordArrays.get(typeClass);
var filter;
recordArrays.forEach(function (array) {
filter = get(array, 'filterFunction');
_this3.updateFilterRecordArray(array, filter, typeClass, record);
});
},
//Need to update live arrays on loading
recordWasLoaded: function (record) {
var _this4 = this;
var typeClass = record.type;
var recordArrays = this.filteredRecordArrays.get(typeClass);
var filter;
recordArrays.forEach(function (array) {
filter = get(array, 'filterFunction');
_this4.updateFilterRecordArray(array, filter, typeClass, record);
});
if (this.liveRecordArrays.has(typeClass)) {
var liveRecordArray = this.liveRecordArrays.get(typeClass);
this._addRecordToRecordArray(liveRecordArray, record);
}
},
/**
Update an individual filter.
@method updateFilterRecordArray
@param {DS.FilteredRecordArray} array
@param {Function} filter
@param {DS.Model} typeClass
@param {InternalModel} record
*/
updateFilterRecordArray: function (array, filter, typeClass, record) {
var shouldBeInArray = filter(record.getRecord());
var recordArrays = this.recordArraysForRecord(record);
if (shouldBeInArray) {
this._addRecordToRecordArray(array, record);
} else {
recordArrays.delete(array);
array.removeInternalModel(record);
}
},
_addRecordToRecordArray: function (array, record) {
var recordArrays = this.recordArraysForRecord(record);
if (!recordArrays.has(array)) {
array.addInternalModel(record);
recordArrays.add(array);
}
},
populateLiveRecordArray: function (array, modelName) {
var typeMap = this.store.typeMapFor(modelName);
var records = typeMap.records;
var record;
for (var i = 0; i < records.length; i++) {
record = records[i];
if (!record.isDeleted() && !record.isEmpty()) {
this._addRecordToRecordArray(array, record);
}
}
},
/**
This method is invoked if the `filterFunction` property is
changed on a `DS.FilteredRecordArray`.
It essentially re-runs the filter from scratch. This same
method is invoked when the filter is created in th first place.
@method updateFilter
@param {Array} array
@param {String} modelName
@param {Function} filter
*/
updateFilter: function (array, modelName, filter) {
var typeMap = this.store.typeMapFor(modelName);
var records = typeMap.records;
var record;
for (var i = 0; i < records.length; i++) {
record = records[i];
if (!record.isDeleted() && !record.isEmpty()) {
this.updateFilterRecordArray(array, filter, modelName, record);
}
}
},
/**
Get the `DS.RecordArray` for a type, which contains all loaded records of
given type.
@method liveRecordArrayFor
@param {Class} typeClass
@return {DS.RecordArray}
*/
liveRecordArrayFor: function (typeClass) {
return this.liveRecordArrays.get(typeClass);
},
/**
Create a `DS.RecordArray` for a type.
@method createRecordArray
@param {Class} typeClass
@return {DS.RecordArray}
*/
createRecordArray: function (typeClass) {
var array = _emberDataPrivateSystemRecordArrays.RecordArray.create({
type: typeClass,
content: _ember.default.A(),
store: this.store,
isLoaded: true,
manager: this
});
return array;
},
/**
Create a `DS.FilteredRecordArray` for a type and register it for updates.
@method createFilteredRecordArray
@param {DS.Model} typeClass
@param {Function} filter
@param {Object} query (optional
@return {DS.FilteredRecordArray}
*/
createFilteredRecordArray: function (typeClass, filter, query) {
var array = _emberDataPrivateSystemRecordArrays.FilteredRecordArray.create({
query: query,
type: typeClass,
content: _ember.default.A(),
store: this.store,
manager: this,
filterFunction: filter
});
this.registerFilteredRecordArray(array, typeClass, filter);
return array;
},
/**
Create a `DS.AdapterPopulatedRecordArray` for a type with given query.
@method createAdapterPopulatedRecordArray
@param {DS.Model} typeClass
@param {Object} query
@return {DS.AdapterPopulatedRecordArray}
*/
createAdapterPopulatedRecordArray: function (typeClass, query) {
var array = _emberDataPrivateSystemRecordArrays.AdapterPopulatedRecordArray.create({
type: typeClass,
query: query,
content: _ember.default.A(),
store: this.store,
manager: this
});
this._adapterPopulatedRecordArrays.push(array);
return array;
},
/**
Register a RecordArray for a given type to be backed by
a filter function. This will cause the array to update
automatically when records of that type change attribute
values or states.
@method registerFilteredRecordArray
@param {DS.RecordArray} array
@param {DS.Model} typeClass
@param {Function} filter
*/
registerFilteredRecordArray: function (array, typeClass, filter) {
var recordArrays = this.filteredRecordArrays.get(typeClass);
recordArrays.push(array);
this.updateFilter(array, typeClass, filter);
},
/**
Unregister a RecordArray.
So manager will not update this array.
@method unregisterRecordArray
@param {DS.RecordArray} array
*/
unregisterRecordArray: function (array) {
var typeClass = array.type;
// unregister filtered record array
var recordArrays = this.filteredRecordArrays.get(typeClass);
var removedFromFiltered = remove(recordArrays, array);
// remove from adapter populated record array
var removedFromAdapterPopulated = remove(this._adapterPopulatedRecordArrays, array);
if (!removedFromFiltered && !removedFromAdapterPopulated) {
// unregister live record array
if (this.liveRecordArrays.has(typeClass)) {
var liveRecordArrayForType = this.liveRecordArrayFor(typeClass);
if (array === liveRecordArrayForType) {
this.liveRecordArrays.delete(typeClass);
}
}
}
},
willDestroy: function () {
this._super.apply(this, arguments);
this.filteredRecordArrays.forEach(function (value) {
return flatten(value).forEach(destroy);
});
this.liveRecordArrays.forEach(destroy);
this._adapterPopulatedRecordArrays.forEach(destroy);
}
});
function destroy(entry) {
entry.destroy();
}
function flatten(list) {
var length = list.length;
var result = _ember.default.A();
for (var i = 0; i < length; i++) {
result = result.concat(list[i]);
}
return result;
}
function remove(array, item) {
var index = array.indexOf(item);
if (index !== -1) {
array.splice(index, 1);
return true;
}
return false;
}
});
/**
@module ember-data
*/
define("ember-data/-private/system/record-arrays", ["exports", "ember-data/-private/system/record-arrays/record-array", "ember-data/-private/system/record-arrays/filtered-record-array", "ember-data/-private/system/record-arrays/adapter-populated-record-array"], function (exports, _emberDataPrivateSystemRecordArraysRecordArray, _emberDataPrivateSystemRecordArraysFilteredRecordArray, _emberDataPrivateSystemRecordArraysAdapterPopulatedRecordArray) {
exports.RecordArray = _emberDataPrivateSystemRecordArraysRecordArray.default;
exports.FilteredRecordArray = _emberDataPrivateSystemRecordArraysFilteredRecordArray.default;
exports.AdapterPopulatedRecordArray = _emberDataPrivateSystemRecordArraysAdapterPopulatedRecordArray.default;
});
/**
@module ember-data
*/
define("ember-data/-private/system/record-arrays/adapter-populated-record-array", ["exports", "ember", "ember-data/-private/system/record-arrays/record-array", "ember-data/-private/system/clone-null"], function (exports, _ember, _emberDataPrivateSystemRecordArraysRecordArray, _emberDataPrivateSystemCloneNull) {
/**
@module ember-data
*/
var get = _ember.default.get;
/**
Represents an ordered list of records whose order and membership is
determined by the adapter. For example, a query sent to the adapter
may trigger a search on the server, whose results would be loaded
into an instance of the `AdapterPopulatedRecordArray`.
@class AdapterPopulatedRecordArray
@namespace DS
@extends DS.RecordArray
*/
exports.default = _emberDataPrivateSystemRecordArraysRecordArray.default.extend({
query: null,
replace: function () {
var type = get(this, 'type').toString();
throw new Error("The result of a server query (on " + type + ") is immutable.");
},
_update: function () {
var store = get(this, 'store');
var modelName = get(this, 'type.modelName');
var query = get(this, 'query');
return store._query(modelName, query, this);
},
/**
@method loadRecords
@param {Array} records
@param {Object} payload normalized payload
@private
*/
loadRecords: function (records, payload) {
var _this = this;
//TODO Optimize
var internalModels = _ember.default.A(records).mapBy('_internalModel');
this.setProperties({
content: _ember.default.A(internalModels),
isLoaded: true,
isUpdating: false,
meta: (0, _emberDataPrivateSystemCloneNull.default)(payload.meta)
});
internalModels.forEach(function (record) {
_this.manager.recordArraysForRecord(record).add(_this);
});
// TODO: should triggering didLoad event be the last action of the runLoop?
_ember.default.run.once(this, 'trigger', 'didLoad');
}
});
});
define('ember-data/-private/system/record-arrays/filtered-record-array', ['exports', 'ember', 'ember-data/-private/system/record-arrays/record-array'], function (exports, _ember, _emberDataPrivateSystemRecordArraysRecordArray) {
/**
@module ember-data
*/
var get = _ember.default.get;
/**
Represents a list of records whose membership is determined by the
store. As records are created, loaded, or modified, the store
evaluates them to determine if they should be part of the record
array.
@class FilteredRecordArray
@namespace DS
@extends DS.RecordArray
*/
exports.default = _emberDataPrivateSystemRecordArraysRecordArray.default.extend({
/**
The filterFunction is a function used to test records from the store to
determine if they should be part of the record array.
Example
```javascript
var allPeople = store.peekAll('person');
allPeople.mapBy('name'); // ["Tom Dale", "Yehuda Katz", "Trek Glowacki"]
var people = store.filter('person', function(person) {
if (person.get('name').match(/Katz$/)) { return true; }
});
people.mapBy('name'); // ["Yehuda Katz"]
var notKatzFilter = function(person) {
return !person.get('name').match(/Katz$/);
};
people.set('filterFunction', notKatzFilter);
people.mapBy('name'); // ["Tom Dale", "Trek Glowacki"]
```
@method filterFunction
@param {DS.Model} record
@return {Boolean} `true` if the record should be in the array
*/
filterFunction: null,
isLoaded: true,
replace: function () {
var type = get(this, 'type').toString();
throw new Error("The result of a client-side filter (on " + type + ") is immutable.");
},
/**
@method updateFilter
@private
*/
_updateFilter: function () {
var manager = get(this, 'manager');
manager.updateFilter(this, get(this, 'type'), get(this, 'filterFunction'));
},
updateFilter: _ember.default.observer('filterFunction', function () {
_ember.default.run.once(this, this._updateFilter);
})
});
});
define("ember-data/-private/system/record-arrays/record-array", ["exports", "ember", "ember-data/-private/system/promise-proxies", "ember-data/-private/system/snapshot-record-array"], function (exports, _ember, _emberDataPrivateSystemPromiseProxies, _emberDataPrivateSystemSnapshotRecordArray) {
var get = _ember.default.get;
var set = _ember.default.set;
/**
A record array is an array that contains records of a certain type. The record
array materializes records as needed when they are retrieved for the first
time. You should not create record arrays yourself. Instead, an instance of
`DS.RecordArray` or its subclasses will be returned by your application's store
in response to queries.
@class RecordArray
@namespace DS
@extends Ember.ArrayProxy
@uses Ember.Evented
*/
exports.default = _ember.default.ArrayProxy.extend(_ember.default.Evented, {
/**
The model type contained by this record array.
@property type
@type DS.Model
*/
type: null,
/**
The array of client ids backing the record array. When a
record is requested from the record array, the record
for the client id at the same index is materialized, if
necessary, by the store.
@property content
@private
@type Ember.Array
*/
content: null,
/**
The flag to signal a `RecordArray` is finished loading data.
Example
```javascript
var people = store.peekAll('person');
people.get('isLoaded'); // true
```
@property isLoaded
@type Boolean
*/
isLoaded: false,
/**
The flag to signal a `RecordArray` is currently loading data.
Example
```javascript
var people = store.peekAll('person');
people.get('isUpdating'); // false
people.update();
people.get('isUpdating'); // true
```
@property isUpdating
@type Boolean
*/
isUpdating: false,
/**
The store that created this record array.
@property store
@private
@type DS.Store
*/
store: null,
/**
Retrieves an object from the content by index.
@method objectAtContent
@private
@param {Number} index
@return {DS.Model} record
*/
objectAtContent: function (index) {
var content = get(this, 'content');
var internalModel = content.objectAt(index);
return internalModel && internalModel.getRecord();
},
/**
Used to get the latest version of all of the records in this array
from the adapter.
Example
```javascript
var people = store.peekAll('person');
people.get('isUpdating'); // false
people.update().then(function() {
people.get('isUpdating'); // false
});
people.get('isUpdating'); // true
```
@method update
*/
update: function () {
if (get(this, 'isUpdating')) {
return;
}
this.set('isUpdating', true);
return this._update();
},
/*
Update this RecordArray and return a promise which resolves once the update
is finished.
*/
_update: function () {
var store = get(this, 'store');
var modelName = get(this, 'type.modelName');
return store.findAll(modelName, { reload: true });
},
/**
Adds an internal model to the `RecordArray` without duplicates
@method addInternalModel
@private
@param {InternalModel} internalModel
@param {number} an optional index to insert at
*/
addInternalModel: function (internalModel, idx) {
var content = get(this, 'content');
if (idx === undefined) {
content.addObject(internalModel);
} else if (!content.contains(internalModel)) {
content.insertAt(idx, internalModel);
}
},
/**
Removes an internalModel to the `RecordArray`.
@method removeInternalModel
@private
@param {InternalModel} internalModel
*/
removeInternalModel: function (internalModel) {
get(this, 'content').removeObject(internalModel);
},
/**
Saves all of the records in the `RecordArray`.
Example
```javascript
var messages = store.peekAll('message');
messages.forEach(function(message) {
message.set('hasBeenSeen', true);
});
messages.save();
```
@method save
@return {DS.PromiseArray} promise
*/
save: function () {
var recordArray = this;
var promiseLabel = "DS: RecordArray#save " + get(this, 'type');
var promise = _ember.default.RSVP.all(this.invoke("save"), promiseLabel).then(function (array) {
return recordArray;
}, null, "DS: RecordArray#save return RecordArray");
return _emberDataPrivateSystemPromiseProxies.PromiseArray.create({ promise: promise });
},
_dissociateFromOwnRecords: function () {
var _this = this;
this.get('content').forEach(function (record) {
var recordArrays = record._recordArrays;
if (recordArrays) {
recordArrays.delete(_this);
}
});
},
/**
@method _unregisterFromManager
@private
*/
_unregisterFromManager: function () {
var manager = get(this, 'manager');
manager.unregisterRecordArray(this);
},
willDestroy: function () {
this._unregisterFromManager();
this._dissociateFromOwnRecords();
set(this, 'content', undefined);
this._super.apply(this, arguments);
},
createSnapshot: function (options) {
var meta = this.get('meta');
return new _emberDataPrivateSystemSnapshotRecordArray.default(this, meta, options);
}
});
});
/**
@module ember-data
*/
define('ember-data/-private/system/references', ['exports', 'ember-data/-private/system/references/record', 'ember-data/-private/system/references/belongs-to', 'ember-data/-private/system/references/has-many'], function (exports, _emberDataPrivateSystemReferencesRecord, _emberDataPrivateSystemReferencesBelongsTo, _emberDataPrivateSystemReferencesHasMany) {
exports.RecordReference = _emberDataPrivateSystemReferencesRecord.default;
exports.BelongsToReference = _emberDataPrivateSystemReferencesBelongsTo.default;
exports.HasManyReference = _emberDataPrivateSystemReferencesHasMany.default;
});
define('ember-data/-private/system/references/belongs-to', ['exports', 'ember-data/model', 'ember', 'ember-data/-private/system/references/reference', 'ember-data/-private/debug'], function (exports, _emberDataModel, _ember, _emberDataPrivateSystemReferencesReference, _emberDataPrivateDebug) {
var BelongsToReference = function (store, parentInternalModel, belongsToRelationship) {
this._super$constructor(store, parentInternalModel);
this.belongsToRelationship = belongsToRelationship;
this.type = belongsToRelationship.relationshipMeta.type;
this.parent = parentInternalModel.recordReference;
// TODO inverse
};
BelongsToReference.prototype = Object.create(_emberDataPrivateSystemReferencesReference.default.prototype);
BelongsToReference.prototype.constructor = BelongsToReference;
BelongsToReference.prototype._super$constructor = _emberDataPrivateSystemReferencesReference.default;
BelongsToReference.prototype.remoteType = function () {
if (this.belongsToRelationship.link) {
return "link";
}
return "id";
};
BelongsToReference.prototype.id = function () {
var inverseRecord = this.belongsToRelationship.inverseRecord;
return inverseRecord && inverseRecord.id;
};
BelongsToReference.prototype.link = function () {
return this.belongsToRelationship.link;
};
BelongsToReference.prototype.meta = function () {
return this.belongsToRelationship.meta;
};
BelongsToReference.prototype.push = function (objectOrPromise) {
var _this = this;
return _ember.default.RSVP.resolve(objectOrPromise).then(function (data) {
var record;
if (data instanceof _emberDataModel.default) {
record = data;
} else {
record = _this.store.push(data);
}
_this.belongsToRelationship.setCanonicalRecord(record._internalModel);
return record;
});
};
BelongsToReference.prototype.value = function () {
var inverseRecord = this.belongsToRelationship.inverseRecord;
if (inverseRecord && inverseRecord.record) {
return inverseRecord.record;
}
return null;
};
BelongsToReference.prototype.load = function () {
var _this2 = this;
if (this.remoteType() === "id") {
return this.belongsToRelationship.getRecord();
}
if (this.remoteType() === "link") {
return this.belongsToRelationship.findLink().then(function (internalModel) {
return _this2.value();
});
}
};
BelongsToReference.prototype.reload = function () {
var _this3 = this;
return this.belongsToRelationship.reload().then(function (internalModel) {
return _this3.value();
});
};
exports.default = BelongsToReference;
});
define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'ember-data/-private/system/references/reference', 'ember-data/-private/debug'], function (exports, _ember, _emberDataPrivateSystemReferencesReference, _emberDataPrivateDebug) {
var get = _ember.default.get;
var HasManyReference = function (store, parentInternalModel, hasManyRelationship) {
this._super$constructor(store, parentInternalModel);
this.hasManyRelationship = hasManyRelationship;
this.type = hasManyRelationship.relationshipMeta.type;
this.parent = parentInternalModel.recordReference;
// TODO inverse
};
HasManyReference.prototype = Object.create(_emberDataPrivateSystemReferencesReference.default.prototype);
HasManyReference.prototype.constructor = HasManyReference;
HasManyReference.prototype._super$constructor = _emberDataPrivateSystemReferencesReference.default;
HasManyReference.prototype.remoteType = function () {
if (this.hasManyRelationship.link) {
return "link";
}
return "ids";
};
HasManyReference.prototype.link = function () {
return this.hasManyRelationship.link;
};
HasManyReference.prototype.ids = function () {
var members = this.hasManyRelationship.members;
var ids = members.toArray().map(function (internalModel) {
return internalModel.id;
});
return ids;
};
HasManyReference.prototype.meta = function () {
return this.hasManyRelationship.manyArray.meta;
};
HasManyReference.prototype.push = function (objectOrPromise) {
var _this = this;
return _ember.default.RSVP.resolve(objectOrPromise).then(function (payload) {
var array = payload;
if (typeof payload === "object" && payload.data) {
array = payload.data;
}
var internalModels = array.map(function (obj) {
var record = _this.store.push(obj);
return record._internalModel;
});
_this.hasManyRelationship.computeChanges(internalModels);
return _this.hasManyRelationship.manyArray;
});
};
HasManyReference.prototype._isLoaded = function () {
var hasData = get(this.hasManyRelationship, 'hasData');
if (!hasData) {
return false;
}
var members = this.hasManyRelationship.members.toArray();
var isEveryLoaded = members.every(function (internalModel) {
return internalModel.isLoaded() === true;
});
return isEveryLoaded;
};
HasManyReference.prototype.value = function () {
if (this._isLoaded()) {
return this.hasManyRelationship.manyArray;
}
return null;
};
HasManyReference.prototype.load = function () {
if (!this._isLoaded()) {
return this.hasManyRelationship.getRecords();
}
var manyArray = this.hasManyRelationship.manyArray;
return _ember.default.RSVP.resolve(manyArray);
};
HasManyReference.prototype.reload = function () {
return this.hasManyRelationship.reload();
};
exports.default = HasManyReference;
});
define('ember-data/-private/system/references/record', ['exports', 'ember', 'ember-data/-private/system/references/reference'], function (exports, _ember, _emberDataPrivateSystemReferencesReference) {
var RecordReference = function (store, internalModel) {
this._super$constructor(store, internalModel);
this.type = internalModel.modelName;
this._id = internalModel.id;
};
RecordReference.prototype = Object.create(_emberDataPrivateSystemReferencesReference.default.prototype);
RecordReference.prototype.constructor = RecordReference;
RecordReference.prototype._super$constructor = _emberDataPrivateSystemReferencesReference.default;
RecordReference.prototype.id = function () {
return this._id;
};
RecordReference.prototype.remoteType = function () {
return 'identity';
};
RecordReference.prototype.push = function (objectOrPromise) {
var _this = this;
return _ember.default.RSVP.resolve(objectOrPromise).then(function (data) {
var record = _this.store.push(data);
return record;
});
};
RecordReference.prototype.value = function () {
return this.internalModel.record;
};
RecordReference.prototype.load = function () {
return this.store.findRecord(this.type, this._id);
};
RecordReference.prototype.reload = function () {
var record = this.value();
if (record) {
return record.reload();
}
return this.load();
};
exports.default = RecordReference;
});
define("ember-data/-private/system/references/reference", ["exports"], function (exports) {
var Reference = function (store, internalModel) {
this.store = store;
this.internalModel = internalModel;
};
Reference.prototype = {
constructor: Reference
};
exports.default = Reference;
});
define('ember-data/-private/system/relationship-meta', ['exports', 'ember-inflector', 'ember-data/-private/system/normalize-model-name'], function (exports, _emberInflector, _emberDataPrivateSystemNormalizeModelName) {
exports.typeForRelationshipMeta = typeForRelationshipMeta;
exports.relationshipFromMeta = relationshipFromMeta;
function typeForRelationshipMeta(meta) {
var modelName;
modelName = meta.type || meta.key;
if (meta.kind === 'hasMany') {
modelName = (0, _emberInflector.singularize)((0, _emberDataPrivateSystemNormalizeModelName.default)(modelName));
}
return modelName;
}
function relationshipFromMeta(meta) {
return {
key: meta.key,
kind: meta.kind,
type: typeForRelationshipMeta(meta),
options: meta.options,
parentType: meta.parentType,
isRelationship: true
};
}
});
define("ember-data/-private/system/relationships/belongs-to", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/system/normalize-model-name"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateSystemNormalizeModelName) {
exports.default = belongsTo;
/**
`DS.belongsTo` is used to define One-To-One and One-To-Many
relationships on a [DS.Model](/api/data/classes/DS.Model.html).
`DS.belongsTo` takes an optional hash as a second parameter, currently
supported options are:
- `async`: A boolean value used to explicitly declare this to be an async relationship.
- `inverse`: A string used to identify the inverse property on a
related model in a One-To-Many relationship. See [Explicit Inverses](#toc_explicit-inverses)
#### One-To-One
To declare a one-to-one relationship between two models, use
`DS.belongsTo`:
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
profile: DS.belongsTo('profile')
});
```
```app/models/profile.js
import DS from 'ember-data';
export default DS.Model.extend({
user: DS.belongsTo('user')
});
```
#### One-To-Many
To declare a one-to-many relationship between two models, use
`DS.belongsTo` in combination with `DS.hasMany`, like this:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('comment')
});
```
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
post: DS.belongsTo('post')
});
```
You can avoid passing a string as the first parameter. In that case Ember Data
will infer the type from the key name.
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
post: DS.belongsTo()
});
```
will lookup for a Post type.
@namespace
@method belongsTo
@for DS
@param {String} modelName (optional) type of the relationship
@param {Object} options (optional) a hash of options
@return {Ember.computed} relationship
*/
function belongsTo(modelName, options) {
var opts, userEnteredModelName;
if (typeof modelName === 'object') {
opts = modelName;
userEnteredModelName = undefined;
} else {
opts = options;
userEnteredModelName = modelName;
}
if (typeof userEnteredModelName === 'string') {
userEnteredModelName = (0, _emberDataPrivateSystemNormalizeModelName.default)(userEnteredModelName);
}
opts = opts || {};
var meta = {
type: userEnteredModelName,
isRelationship: true,
options: opts,
kind: 'belongsTo',
key: null
};
return _ember.default.computed({
get: function (key) {
if (opts.hasOwnProperty('serialize')) {}
if (opts.hasOwnProperty('embedded')) {}
return this._internalModel._relationships.get(key).getRecord();
},
set: function (key, value) {
if (value === undefined) {
value = null;
}
if (value && value.then) {
this._internalModel._relationships.get(key).setRecordPromise(value);
} else if (value) {
this._internalModel._relationships.get(key).setRecord(value._internalModel);
} else {
this._internalModel._relationships.get(key).setRecord(value);
}
return this._internalModel._relationships.get(key).getRecord();
}
}).meta(meta);
}
/*
These observers observe all `belongsTo` relationships on the record. See
`relationships/ext` to see how these observers get their dependencies.
*/
var BelongsToMixin = _ember.default.Mixin.create({
notifyBelongsToChanged: function (key) {
this.notifyPropertyChange(key);
}
});
exports.BelongsToMixin = BelongsToMixin;
});
define("ember-data/-private/system/relationships/ext", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/system/relationship-meta", "ember-data/-private/system/empty-object"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateSystemRelationshipMeta, _emberDataPrivateSystemEmptyObject) {
var get = _ember.default.get;
var Map = _ember.default.Map;
var MapWithDefault = _ember.default.MapWithDefault;
var relationshipsDescriptor = _ember.default.computed(function () {
if (_ember.default.testing === true && relationshipsDescriptor._cacheable === true) {
relationshipsDescriptor._cacheable = false;
}
var map = new MapWithDefault({
defaultValue: function () {
return [];
}
});
// Loop through each computed property on the class
this.eachComputedProperty(function (name, meta) {
// If the computed property is a relationship, add
// it to the map.
if (meta.isRelationship) {
meta.key = name;
var relationshipsForType = map.get((0, _emberDataPrivateSystemRelationshipMeta.typeForRelationshipMeta)(meta));
relationshipsForType.push({
name: name,
kind: meta.kind
});
}
});
return map;
}).readOnly();
var relatedTypesDescriptor = _ember.default.computed(function () {
if (_ember.default.testing === true && relatedTypesDescriptor._cacheable === true) {
relatedTypesDescriptor._cacheable = false;
}
var modelName;
var types = _ember.default.A();
// Loop through each computed property on the class,
// and create an array of the unique types involved
// in relationships
this.eachComputedProperty(function (name, meta) {
if (meta.isRelationship) {
meta.key = name;
modelName = (0, _emberDataPrivateSystemRelationshipMeta.typeForRelationshipMeta)(meta);
if (!types.contains(modelName)) {
types.push(modelName);
}
}
});
return types;
}).readOnly();
var relationshipsByNameDescriptor = _ember.default.computed(function () {
if (_ember.default.testing === true && relationshipsByNameDescriptor._cacheable === true) {
relationshipsByNameDescriptor._cacheable = false;
}
var map = Map.create();
this.eachComputedProperty(function (name, meta) {
if (meta.isRelationship) {
meta.key = name;
var relationship = (0, _emberDataPrivateSystemRelationshipMeta.relationshipFromMeta)(meta);
relationship.type = (0, _emberDataPrivateSystemRelationshipMeta.typeForRelationshipMeta)(meta);
map.set(name, relationship);
}
});
return map;
}).readOnly();
/**
@module ember-data
*/
/*
This file defines several extensions to the base `DS.Model` class that
add support for one-to-many relationships.
*/
/**
@class Model
@namespace DS
*/
var DidDefinePropertyMixin = _ember.default.Mixin.create({
/**
This Ember.js hook allows an object to be notified when a property
is defined.
In this case, we use it to be notified when an Ember Data user defines a
belongs-to relationship. In that case, we need to set up observers for
each one, allowing us to track relationship changes and automatically
reflect changes in the inverse has-many array.
This hook passes the class being set up, as well as the key and value
being defined. So, for example, when the user does this:
```javascript
DS.Model.extend({
parent: DS.belongsTo('user')
});
```
This hook would be called with "parent" as the key and the computed
property returned by `DS.belongsTo` as the value.
@method didDefineProperty
@param {Object} proto
@param {String} key
@param {Ember.ComputedProperty} value
*/
didDefineProperty: function (proto, key, value) {
// Check if the value being set is a computed property.
if (value instanceof _ember.default.ComputedProperty) {
// If it is, get the metadata for the relationship. This is
// populated by the `DS.belongsTo` helper when it is creating
// the computed property.
var meta = value.meta();
meta.parentType = proto.constructor;
}
}
});
exports.DidDefinePropertyMixin = DidDefinePropertyMixin;
/*
These DS.Model extensions add class methods that provide relationship
introspection abilities about relationships.
A note about the computed properties contained here:
**These properties are effectively sealed once called for the first time.**
To avoid repeatedly doing expensive iteration over a model's fields, these
values are computed once and then cached for the remainder of the runtime of
your application.
If your application needs to modify a class after its initial definition
(for example, using `reopen()` to add additional attributes), make sure you
do it before using your model with the store, which uses these properties
extensively.
*/
var RelationshipsClassMethodsMixin = _ember.default.Mixin.create({
/**
For a given relationship name, returns the model type of the relationship.
For example, if you define a model like this:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('comment')
});
```
Calling `App.Post.typeForRelationship('comments')` will return `App.Comment`.
@method typeForRelationship
@static
@param {String} name the name of the relationship
@param {store} store an instance of DS.Store
@return {DS.Model} the type of the relationship, or undefined
*/
typeForRelationship: function (name, store) {
var relationship = get(this, 'relationshipsByName').get(name);
return relationship && store.modelFor(relationship.type);
},
inverseMap: _ember.default.computed(function () {
return new _emberDataPrivateSystemEmptyObject.default();
}),
/**
Find the relationship which is the inverse of the one asked for.
For example, if you define models like this:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('message')
});
```
```app/models/message.js
import DS from 'ember-data';
export default DS.Model.extend({
owner: DS.belongsTo('post')
});
```
App.Post.inverseFor('comments') -> { type: App.Message, name: 'owner', kind: 'belongsTo' }
App.Message.inverseFor('owner') -> { type: App.Post, name: 'comments', kind: 'hasMany' }
@method inverseFor
@static
@param {String} name the name of the relationship
@return {Object} the inverse relationship, or null
*/
inverseFor: function (name, store) {
var inverseMap = get(this, 'inverseMap');
if (inverseMap[name]) {
return inverseMap[name];
} else {
var inverse = this._findInverseFor(name, store);
inverseMap[name] = inverse;
return inverse;
}
},
//Calculate the inverse, ignoring the cache
_findInverseFor: function (name, store) {
var inverseType = this.typeForRelationship(name, store);
if (!inverseType) {
return null;
}
var propertyMeta = this.metaForProperty(name);
//If inverse is manually specified to be null, like `comments: DS.hasMany('message', { inverse: null })`
var options = propertyMeta.options;
if (options.inverse === null) {
return null;
}
var inverseName, inverseKind, inverse;
//If inverse is specified manually, return the inverse
if (options.inverse) {
inverseName = options.inverse;
inverse = _ember.default.get(inverseType, 'relationshipsByName').get(inverseName);
inverseKind = inverse.kind;
} else {
//No inverse was specified manually, we need to use a heuristic to guess one
if (propertyMeta.type === propertyMeta.parentType.modelName) {}
var possibleRelationships = findPossibleInverses(this, inverseType);
if (possibleRelationships.length === 0) {
return null;
}
var filteredRelationships = possibleRelationships.filter(function (possibleRelationship) {
var optionsForRelationship = inverseType.metaForProperty(possibleRelationship.name).options;
return name === optionsForRelationship.inverse;
});
if (filteredRelationships.length === 1) {
possibleRelationships = filteredRelationships;
}
inverseName = possibleRelationships[0].name;
inverseKind = possibleRelationships[0].kind;
}
function findPossibleInverses(type, inverseType, relationshipsSoFar) {
var possibleRelationships = relationshipsSoFar || [];
var relationshipMap = get(inverseType, 'relationships');
if (!relationshipMap) {
return possibleRelationships;
}
var relationships = relationshipMap.get(type.modelName);
relationships = relationships.filter(function (relationship) {
var optionsForRelationship = inverseType.metaForProperty(relationship.name).options;
if (!optionsForRelationship.inverse) {
return true;
}
return name === optionsForRelationship.inverse;
});
if (relationships) {
possibleRelationships.push.apply(possibleRelationships, relationships);
}
//Recurse to support polymorphism
if (type.superclass) {
findPossibleInverses(type.superclass, inverseType, possibleRelationships);
}
return possibleRelationships;
}
return {
type: inverseType,
name: inverseName,
kind: inverseKind
};
},
/**
The model's relationships as a map, keyed on the type of the
relationship. The value of each entry is an array containing a descriptor
for each relationship with that type, describing the name of the relationship
as well as the type.
For example, given the following model definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This computed property would return a map describing these
relationships, like this:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
var relationships = Ember.get(Blog, 'relationships');
relationships.get(App.User);
//=> [ { name: 'users', kind: 'hasMany' },
// { name: 'owner', kind: 'belongsTo' } ]
relationships.get(App.Post);
//=> [ { name: 'posts', kind: 'hasMany' } ]
```
@property relationships
@static
@type Ember.Map
@readOnly
*/
relationships: relationshipsDescriptor,
/**
A hash containing lists of the model's relationships, grouped
by the relationship kind. For example, given a model with this
definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This property would contain the following:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
var relationshipNames = Ember.get(Blog, 'relationshipNames');
relationshipNames.hasMany;
//=> ['users', 'posts']
relationshipNames.belongsTo;
//=> ['owner']
```
@property relationshipNames
@static
@type Object
@readOnly
*/
relationshipNames: _ember.default.computed(function () {
var names = {
hasMany: [],
belongsTo: []
};
this.eachComputedProperty(function (name, meta) {
if (meta.isRelationship) {
names[meta.kind].push(name);
}
});
return names;
}),
/**
An array of types directly related to a model. Each type will be
included once, regardless of the number of relationships it has with
the model.
For example, given a model with this definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This property would contain the following:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
var relatedTypes = Ember.get(Blog, 'relatedTypes');
//=> [ App.User, App.Post ]
```
@property relatedTypes
@static
@type Ember.Array
@readOnly
*/
relatedTypes: relatedTypesDescriptor,
/**
A map whose keys are the relationships of a model and whose values are
relationship descriptors.
For example, given a model with this
definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This property would contain the following:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
var relationshipsByName = Ember.get(Blog, 'relationshipsByName');
relationshipsByName.get('users');
//=> { key: 'users', kind: 'hasMany', type: App.User }
relationshipsByName.get('owner');
//=> { key: 'owner', kind: 'belongsTo', type: App.User }
```
@property relationshipsByName
@static
@type Ember.Map
@readOnly
*/
relationshipsByName: relationshipsByNameDescriptor,
/**
A map whose keys are the fields of the model and whose values are strings
describing the kind of the field. A model's fields are the union of all of its
attributes and relationships.
For example:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post'),
title: DS.attr('string')
});
```
```js
import Ember from 'ember';
import Blog from 'app/models/blog';
var fields = Ember.get(Blog, 'fields');
fields.forEach(function(kind, field) {
console.log(field, kind);
});
// prints:
// users, hasMany
// owner, belongsTo
// posts, hasMany
// title, attribute
```
@property fields
@static
@type Ember.Map
@readOnly
*/
fields: _ember.default.computed(function () {
var map = Map.create();
this.eachComputedProperty(function (name, meta) {
if (meta.isRelationship) {
map.set(name, meta.kind);
} else if (meta.isAttribute) {
map.set(name, 'attribute');
}
});
return map;
}).readOnly(),
/**
Given a callback, iterates over each of the relationships in the model,
invoking the callback with the name of each relationship and its relationship
descriptor.
@method eachRelationship
@static
@param {Function} callback the callback to invoke
@param {any} binding the value to which the callback's `this` should be bound
*/
eachRelationship: function (callback, binding) {
get(this, 'relationshipsByName').forEach(function (relationship, name) {
callback.call(binding, name, relationship);
});
},
/**
Given a callback, iterates over each of the types related to a model,
invoking the callback with the related type's class. Each type will be
returned just once, regardless of how many different relationships it has
with a model.
@method eachRelatedType
@static
@param {Function} callback the callback to invoke
@param {any} binding the value to which the callback's `this` should be bound
*/
eachRelatedType: function (callback, binding) {
var relationshipTypes = get(this, 'relatedTypes');
for (var i = 0; i < relationshipTypes.length; i++) {
var type = relationshipTypes[i];
callback.call(binding, type);
}
},
determineRelationshipType: function (knownSide, store) {
var knownKey = knownSide.key;
var knownKind = knownSide.kind;
var inverse = this.inverseFor(knownKey, store);
var key = undefined,
otherKind = undefined;
if (!inverse) {
return knownKind === 'belongsTo' ? 'oneToNone' : 'manyToNone';
}
key = inverse.name;
otherKind = inverse.kind;
if (otherKind === 'belongsTo') {
return knownKind === 'belongsTo' ? 'oneToOne' : 'manyToOne';
} else {
return knownKind === 'belongsTo' ? 'oneToMany' : 'manyToMany';
}
}
});
exports.RelationshipsClassMethodsMixin = RelationshipsClassMethodsMixin;
var RelationshipsInstanceMethodsMixin = _ember.default.Mixin.create({
/**
Given a callback, iterates over each of the relationships in the model,
invoking the callback with the name of each relationship and its relationship
descriptor.
The callback method you provide should have the following signature (all
parameters are optional):
```javascript
function(name, descriptor);
```
- `name` the name of the current property in the iteration
- `descriptor` the meta object that describes this relationship
The relationship descriptor argument is an object with the following properties.
- **key** <span class="type">String</span> the name of this relationship on the Model
- **kind** <span class="type">String</span> "hasMany" or "belongsTo"
- **options** <span class="type">Object</span> the original options hash passed when the relationship was declared
- **parentType** <span class="type">DS.Model</span> the type of the Model that owns this relationship
- **type** <span class="type">DS.Model</span> the type of the related Model
Note that in addition to a callback, you can also pass an optional target
object that will be set as `this` on the context.
Example
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serialize: function(record, options) {
var json = {};
record.eachRelationship(function(name, descriptor) {
if (descriptor.kind === 'hasMany') {
var serializedHasManyName = name.toUpperCase() + '_IDS';
json[serializedHasManyName] = record.get(name).mapBy('id');
}
});
return json;
}
});
```
@method eachRelationship
@param {Function} callback the callback to invoke
@param {any} binding the value to which the callback's `this` should be bound
*/
eachRelationship: function (callback, binding) {
this.constructor.eachRelationship(callback, binding);
},
relationshipFor: function (name) {
return get(this.constructor, 'relationshipsByName').get(name);
},
inverseFor: function (key) {
return this.constructor.inverseFor(key, this.store);
}
});
exports.RelationshipsInstanceMethodsMixin = RelationshipsInstanceMethodsMixin;
});
define("ember-data/-private/system/relationships/has-many", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/system/normalize-model-name", "ember-data/-private/system/is-array-like"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateSystemNormalizeModelName, _emberDataPrivateSystemIsArrayLike) {
exports.default = hasMany;
/**
`DS.hasMany` is used to define One-To-Many and Many-To-Many
relationships on a [DS.Model](/api/data/classes/DS.Model.html).
`DS.hasMany` takes an optional hash as a second parameter, currently
supported options are:
- `async`: A boolean value used to explicitly declare this to be an async relationship.
- `inverse`: A string used to identify the inverse property on a related model.
#### One-To-Many
To declare a one-to-many relationship between two models, use
`DS.belongsTo` in combination with `DS.hasMany`, like this:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('comment')
});
```
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
post: DS.belongsTo('post')
});
```
#### Many-To-Many
To declare a many-to-many relationship between two models, use
`DS.hasMany`:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
tags: DS.hasMany('tag')
});
```
```app/models/tag.js
import DS from 'ember-data';
export default DS.Model.extend({
posts: DS.hasMany('post')
});
```
You can avoid passing a string as the first parameter. In that case Ember Data
will infer the type from the singularized key name.
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
tags: DS.hasMany()
});
```
will lookup for a Tag type.
#### Explicit Inverses
Ember Data will do its best to discover which relationships map to
one another. In the one-to-many code above, for example, Ember Data
can figure out that changing the `comments` relationship should update
the `post` relationship on the inverse because post is the only
relationship to that model.
However, sometimes you may have multiple `belongsTo`/`hasManys` for the
same type. You can specify which property on the related model is
the inverse using `DS.hasMany`'s `inverse` option:
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
onePost: DS.belongsTo('post'),
twoPost: DS.belongsTo('post'),
redPost: DS.belongsTo('post'),
bluePost: DS.belongsTo('post')
});
```
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('comment', {
inverse: 'redPost'
})
});
```
You can also specify an inverse on a `belongsTo`, which works how
you'd expect.
@namespace
@method hasMany
@for DS
@param {String} type (optional) type of the relationship
@param {Object} options (optional) a hash of options
@return {Ember.computed} relationship
*/
function hasMany(type, options) {
if (typeof type === 'object') {
options = type;
type = undefined;
}
options = options || {};
if (typeof type === 'string') {
type = (0, _emberDataPrivateSystemNormalizeModelName.default)(type);
}
// Metadata about relationships is stored on the meta of
// the relationship. This is used for introspection and
// serialization. Note that `key` is populated lazily
// the first time the CP is called.
var meta = {
type: type,
isRelationship: true,
options: options,
kind: 'hasMany',
key: null
};
return _ember.default.computed({
get: function (key) {
var relationship = this._internalModel._relationships.get(key);
return relationship.getRecords();
},
set: function (key, records) {
var relationship = this._internalModel._relationships.get(key);
relationship.clear();
relationship.addRecords(_ember.default.A(records).mapBy('_internalModel'));
return relationship.getRecords();
}
}).meta(meta);
}
var HasManyMixin = _ember.default.Mixin.create({
notifyHasManyAdded: function (key) {
//We need to notifyPropertyChange in the adding case because we need to make sure
//we fetch the newly added record in case it is unloaded
//TODO(Igor): Consider whether we could do this only if the record state is unloaded
//Goes away once hasMany is double promisified
this.notifyPropertyChange(key);
}
});
exports.HasManyMixin = HasManyMixin;
});
/**
@module ember-data
*/
define("ember-data/-private/system/relationships/state/belongs-to", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/system/promise-proxies", "ember-data/-private/system/relationships/state/relationship"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateSystemPromiseProxies, _emberDataPrivateSystemRelationshipsStateRelationship) {
exports.default = BelongsToRelationship;
function BelongsToRelationship(store, record, inverseKey, relationshipMeta) {
this._super$constructor(store, record, inverseKey, relationshipMeta);
this.record = record;
this.key = relationshipMeta.key;
this.inverseRecord = null;
this.canonicalState = null;
}
BelongsToRelationship.prototype = Object.create(_emberDataPrivateSystemRelationshipsStateRelationship.default.prototype);
BelongsToRelationship.prototype.constructor = BelongsToRelationship;
BelongsToRelationship.prototype._super$constructor = _emberDataPrivateSystemRelationshipsStateRelationship.default;
BelongsToRelationship.prototype.setRecord = function (newRecord) {
if (newRecord) {
this.addRecord(newRecord);
} else if (this.inverseRecord) {
this.removeRecord(this.inverseRecord);
}
this.setHasData(true);
this.setHasLoaded(true);
};
BelongsToRelationship.prototype.setCanonicalRecord = function (newRecord) {
if (newRecord) {
this.addCanonicalRecord(newRecord);
} else if (this.canonicalState) {
this.removeCanonicalRecord(this.canonicalState);
}
this.setHasData(true);
this.setHasLoaded(true);
};
BelongsToRelationship.prototype._super$addCanonicalRecord = _emberDataPrivateSystemRelationshipsStateRelationship.default.prototype.addCanonicalRecord;
BelongsToRelationship.prototype.addCanonicalRecord = function (newRecord) {
if (this.canonicalMembers.has(newRecord)) {
return;
}
if (this.canonicalState) {
this.removeCanonicalRecord(this.canonicalState);
}
this.canonicalState = newRecord;
this._super$addCanonicalRecord(newRecord);
};
BelongsToRelationship.prototype._super$flushCanonical = _emberDataPrivateSystemRelationshipsStateRelationship.default.prototype.flushCanonical;
BelongsToRelationship.prototype.flushCanonical = function () {
//temporary fix to not remove newly created records if server returned null.
//TODO remove once we have proper diffing
if (this.inverseRecord && this.inverseRecord.isNew() && !this.canonicalState) {
return;
}
this.inverseRecord = this.canonicalState;
this.record.notifyBelongsToChanged(this.key);
this._super$flushCanonical();
};
BelongsToRelationship.prototype._super$addRecord = _emberDataPrivateSystemRelationshipsStateRelationship.default.prototype.addRecord;
BelongsToRelationship.prototype.addRecord = function (newRecord) {
if (this.members.has(newRecord)) {
return;
}
if (this.inverseRecord) {
this.removeRecord(this.inverseRecord);
}
this.inverseRecord = newRecord;
this._super$addRecord(newRecord);
this.record.notifyBelongsToChanged(this.key);
};
BelongsToRelationship.prototype.setRecordPromise = function (newPromise) {
var content = newPromise.get && newPromise.get('content');
this.setRecord(content ? content._internalModel : content);
};
BelongsToRelationship.prototype._super$removeRecordFromOwn = _emberDataPrivateSystemRelationshipsStateRelationship.default.prototype.removeRecordFromOwn;
BelongsToRelationship.prototype.removeRecordFromOwn = function (record) {
if (!this.members.has(record)) {
return;
}
this.inverseRecord = null;
this._super$removeRecordFromOwn(record);
this.record.notifyBelongsToChanged(this.key);
};
BelongsToRelationship.prototype._super$removeCanonicalRecordFromOwn = _emberDataPrivateSystemRelationshipsStateRelationship.default.prototype.removeCanonicalRecordFromOwn;
BelongsToRelationship.prototype.removeCanonicalRecordFromOwn = function (record) {
if (!this.canonicalMembers.has(record)) {
return;
}
this.canonicalState = null;
this._super$removeCanonicalRecordFromOwn(record);
};
BelongsToRelationship.prototype.findRecord = function () {
if (this.inverseRecord) {
return this.store._findByInternalModel(this.inverseRecord);
} else {
return _ember.default.RSVP.Promise.resolve(null);
}
};
BelongsToRelationship.prototype.fetchLink = function () {
var _this = this;
return this.store.findBelongsTo(this.record, this.link, this.relationshipMeta).then(function (record) {
if (record) {
_this.addRecord(record);
}
return record;
});
};
BelongsToRelationship.prototype.getRecord = function () {
var _this2 = this;
//TODO(Igor) flushCanonical here once our syncing is not stupid
if (this.isAsync) {
var promise;
if (this.link) {
if (this.hasLoaded) {
promise = this.findRecord();
} else {
promise = this.findLink().then(function () {
return _this2.findRecord();
});
}
} else {
promise = this.findRecord();
}
return _emberDataPrivateSystemPromiseProxies.PromiseObject.create({
promise: promise,
content: this.inverseRecord ? this.inverseRecord.getRecord() : null
});
} else {
if (this.inverseRecord === null) {
return null;
}
var toReturn = this.inverseRecord.getRecord();
return toReturn;
}
};
BelongsToRelationship.prototype.reload = function () {
// TODO handle case when reload() is triggered multiple times
if (this.link) {
return this.fetchLink();
}
// reload record, if it is already loaded
if (this.inverseRecord && this.inverseRecord.record) {
return this.inverseRecord.record.reload();
}
return this.findRecord();
};
});
define("ember-data/-private/system/relationships/state/create", ["exports", "ember", "ember-data/-private/system/relationships/state/has-many", "ember-data/-private/system/relationships/state/belongs-to", "ember-data/-private/system/empty-object"], function (exports, _ember, _emberDataPrivateSystemRelationshipsStateHasMany, _emberDataPrivateSystemRelationshipsStateBelongsTo, _emberDataPrivateSystemEmptyObject) {
exports.default = Relationships;
var get = _ember.default.get;
function createRelationshipFor(record, relationshipMeta, store) {
var inverseKey;
var inverse = record.type.inverseFor(relationshipMeta.key, store);
if (inverse) {
inverseKey = inverse.name;
}
if (relationshipMeta.kind === 'hasMany') {
return new _emberDataPrivateSystemRelationshipsStateHasMany.default(store, record, inverseKey, relationshipMeta);
} else {
return new _emberDataPrivateSystemRelationshipsStateBelongsTo.default(store, record, inverseKey, relationshipMeta);
}
}
function Relationships(record) {
this.record = record;
this.initializedRelationships = new _emberDataPrivateSystemEmptyObject.default();
}
Relationships.prototype.has = function (key) {
return !!this.initializedRelationships[key];
};
Relationships.prototype.get = function (key) {
var relationships = this.initializedRelationships;
var relationshipsByName = get(this.record.type, 'relationshipsByName');
if (!relationships[key] && relationshipsByName.get(key)) {
relationships[key] = createRelationshipFor(this.record, relationshipsByName.get(key), this.record.store);
}
return relationships[key];
};
});
define("ember-data/-private/system/relationships/state/has-many", ["exports", "ember-data/-private/debug", "ember-data/-private/system/promise-proxies", "ember-data/-private/system/relationships/state/relationship", "ember-data/-private/system/ordered-set", "ember-data/-private/system/many-array"], function (exports, _emberDataPrivateDebug, _emberDataPrivateSystemPromiseProxies, _emberDataPrivateSystemRelationshipsStateRelationship, _emberDataPrivateSystemOrderedSet, _emberDataPrivateSystemManyArray) {
exports.default = ManyRelationship;
function ManyRelationship(store, record, inverseKey, relationshipMeta) {
this._super$constructor(store, record, inverseKey, relationshipMeta);
this.belongsToType = relationshipMeta.type;
this.canonicalState = [];
this.manyArray = _emberDataPrivateSystemManyArray.default.create({
canonicalState: this.canonicalState,
store: this.store,
relationship: this,
type: this.store.modelFor(this.belongsToType),
record: record
});
this.isPolymorphic = relationshipMeta.options.polymorphic;
this.manyArray.isPolymorphic = this.isPolymorphic;
}
ManyRelationship.prototype = Object.create(_emberDataPrivateSystemRelationshipsStateRelationship.default.prototype);
ManyRelationship.prototype.constructor = ManyRelationship;
ManyRelationship.prototype._super$constructor = _emberDataPrivateSystemRelationshipsStateRelationship.default;
ManyRelationship.prototype.destroy = function () {
this.manyArray.destroy();
};
ManyRelationship.prototype._super$updateMeta = _emberDataPrivateSystemRelationshipsStateRelationship.default.prototype.updateMeta;
ManyRelationship.prototype.updateMeta = function (meta) {
this._super$updateMeta(meta);
this.manyArray.set('meta', meta);
};
ManyRelationship.prototype._super$addCanonicalRecord = _emberDataPrivateSystemRelationshipsStateRelationship.default.prototype.addCanonicalRecord;
ManyRelationship.prototype.addCanonicalRecord = function (record, idx) {
if (this.canonicalMembers.has(record)) {
return;
}
if (idx !== undefined) {
this.canonicalState.splice(idx, 0, record);
} else {
this.canonicalState.push(record);
}
this._super$addCanonicalRecord(record, idx);
};
ManyRelationship.prototype._super$addRecord = _emberDataPrivateSystemRelationshipsStateRelationship.default.prototype.addRecord;
ManyRelationship.prototype.addRecord = function (record, idx) {
if (this.members.has(record)) {
return;
}
this._super$addRecord(record, idx);
this.manyArray.internalAddRecords([record], idx);
};
ManyRelationship.prototype._super$removeCanonicalRecordFromOwn = _emberDataPrivateSystemRelationshipsStateRelationship.default.prototype.removeCanonicalRecordFromOwn;
ManyRelationship.prototype.removeCanonicalRecordFromOwn = function (record, idx) {
var i = idx;
if (!this.canonicalMembers.has(record)) {
return;
}
if (i === undefined) {
i = this.canonicalState.indexOf(record);
}
if (i > -1) {
this.canonicalState.splice(i, 1);
}
this._super$removeCanonicalRecordFromOwn(record, idx);
};
ManyRelationship.prototype._super$flushCanonical = _emberDataPrivateSystemRelationshipsStateRelationship.default.prototype.flushCanonical;
ManyRelationship.prototype.flushCanonical = function () {
this.manyArray.flushCanonical();
this._super$flushCanonical();
};
ManyRelationship.prototype._super$removeRecordFromOwn = _emberDataPrivateSystemRelationshipsStateRelationship.default.prototype.removeRecordFromOwn;
ManyRelationship.prototype.removeRecordFromOwn = function (record, idx) {
if (!this.members.has(record)) {
return;
}
this._super$removeRecordFromOwn(record, idx);
if (idx !== undefined) {
//TODO(Igor) not used currently, fix
this.manyArray.currentState.removeAt(idx);
} else {
this.manyArray.internalRemoveRecords([record]);
}
};
ManyRelationship.prototype.notifyRecordRelationshipAdded = function (record, idx) {
this.record.notifyHasManyAdded(this.key, record, idx);
};
ManyRelationship.prototype.reload = function () {
var _this = this;
var manyArrayLoadedState = this.manyArray.get('isLoaded');
if (this._loadingPromise) {
if (this._loadingPromise.get('isPending')) {
return this._loadingPromise;
}
if (this._loadingPromise.get('isRejected')) {
this.manyArray.set('isLoaded', manyArrayLoadedState);
}
}
if (this.link) {
this._loadingPromise = (0, _emberDataPrivateSystemPromiseProxies.promiseManyArray)(this.fetchLink(), 'Reload with link');
return this._loadingPromise;
} else {
this._loadingPromise = (0, _emberDataPrivateSystemPromiseProxies.promiseManyArray)(this.store.scheduleFetchMany(this.manyArray.toArray()).then(function () {
return _this.manyArray;
}), 'Reload with ids');
return this._loadingPromise;
}
};
ManyRelationship.prototype.computeChanges = function (records) {
var members = this.canonicalMembers;
var recordsToRemove = [];
var length;
var record;
var i;
records = setForArray(records);
members.forEach(function (member) {
if (records.has(member)) {
return;
}
recordsToRemove.push(member);
});
this.removeCanonicalRecords(recordsToRemove);
// Using records.toArray() since currently using
// removeRecord can modify length, messing stuff up
// forEach since it directly looks at "length" each
// iteration
records = records.toArray();
length = records.length;
for (i = 0; i < length; i++) {
record = records[i];
this.removeCanonicalRecord(record);
this.addCanonicalRecord(record, i);
}
};
ManyRelationship.prototype.fetchLink = function () {
var _this2 = this;
return this.store.findHasMany(this.record, this.link, this.relationshipMeta).then(function (records) {
if (records.hasOwnProperty('meta')) {
_this2.updateMeta(records.meta);
}
_this2.store._backburner.join(function () {
_this2.updateRecordsFromAdapter(records);
_this2.manyArray.set('isLoaded', true);
});
return _this2.manyArray;
});
};
ManyRelationship.prototype.findRecords = function () {
var _this3 = this;
var manyArray = this.manyArray.toArray();
var internalModels = new Array(manyArray.length);
for (var i = 0; i < manyArray.length; i++) {
internalModels[i] = manyArray[i]._internalModel;
}
//TODO CLEANUP
return this.store.findMany(internalModels).then(function () {
if (!_this3.manyArray.get('isDestroyed')) {
//Goes away after the manyArray refactor
_this3.manyArray.set('isLoaded', true);
}
return _this3.manyArray;
});
};
ManyRelationship.prototype.notifyHasManyChanged = function () {
this.record.notifyHasManyAdded(this.key);
};
ManyRelationship.prototype.getRecords = function () {
var _this4 = this;
//TODO(Igor) sync server here, once our syncing is not stupid
if (this.isAsync) {
var promise;
if (this.link) {
if (this.hasLoaded) {
promise = this.findRecords();
} else {
promise = this.findLink().then(function () {
return _this4.findRecords();
});
}
} else {
promise = this.findRecords();
}
this._loadingPromise = _emberDataPrivateSystemPromiseProxies.PromiseManyArray.create({
content: this.manyArray,
promise: promise
});
return this._loadingPromise;
} else {
//TODO(Igor) WTF DO I DO HERE?
if (!this.manyArray.get('isDestroyed')) {
this.manyArray.set('isLoaded', true);
}
return this.manyArray;
}
};
function setForArray(array) {
var set = new _emberDataPrivateSystemOrderedSet.default();
if (array) {
for (var i = 0, l = array.length; i < l; i++) {
set.add(array[i]);
}
}
return set;
}
});
define("ember-data/-private/system/relationships/state/relationship", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/system/ordered-set"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateSystemOrderedSet) {
exports.default = Relationship;
function Relationship(store, record, inverseKey, relationshipMeta) {
var async = relationshipMeta.options.async;
this.members = new _emberDataPrivateSystemOrderedSet.default();
this.canonicalMembers = new _emberDataPrivateSystemOrderedSet.default();
this.store = store;
this.key = relationshipMeta.key;
this.inverseKey = inverseKey;
this.record = record;
this.isAsync = typeof async === 'undefined' ? true : async;
this.relationshipMeta = relationshipMeta;
//This probably breaks for polymorphic relationship in complex scenarios, due to
//multiple possible modelNames
this.inverseKeyForImplicit = this.record.constructor.modelName + this.key;
this.linkPromise = null;
this.meta = null;
this.hasData = false;
this.hasLoaded = false;
}
Relationship.prototype = {
constructor: Relationship,
destroy: _ember.default.K,
updateMeta: function (meta) {
this.meta = meta;
},
clear: function () {
var members = this.members.list;
var member;
while (members.length > 0) {
member = members[0];
this.removeRecord(member);
}
},
removeRecords: function (records) {
var _this = this;
records.forEach(function (record) {
return _this.removeRecord(record);
});
},
addRecords: function (records, idx) {
var _this2 = this;
records.forEach(function (record) {
_this2.addRecord(record, idx);
if (idx !== undefined) {
idx++;
}
});
},
addCanonicalRecords: function (records, idx) {
for (var i = 0; i < records.length; i++) {
if (idx !== undefined) {
this.addCanonicalRecord(records[i], i + idx);
} else {
this.addCanonicalRecord(records[i]);
}
}
},
addCanonicalRecord: function (record, idx) {
if (!this.canonicalMembers.has(record)) {
this.canonicalMembers.add(record);
if (this.inverseKey) {
record._relationships.get(this.inverseKey).addCanonicalRecord(this.record);
} else {
if (!record._implicitRelationships[this.inverseKeyForImplicit]) {
record._implicitRelationships[this.inverseKeyForImplicit] = new Relationship(this.store, record, this.key, { options: {} });
}
record._implicitRelationships[this.inverseKeyForImplicit].addCanonicalRecord(this.record);
}
}
this.flushCanonicalLater();
this.setHasData(true);
},
removeCanonicalRecords: function (records, idx) {
for (var i = 0; i < records.length; i++) {
if (idx !== undefined) {
this.removeCanonicalRecord(records[i], i + idx);
} else {
this.removeCanonicalRecord(records[i]);
}
}
},
removeCanonicalRecord: function (record, idx) {
if (this.canonicalMembers.has(record)) {
this.removeCanonicalRecordFromOwn(record);
if (this.inverseKey) {
this.removeCanonicalRecordFromInverse(record);
} else {
if (record._implicitRelationships[this.inverseKeyForImplicit]) {
record._implicitRelationships[this.inverseKeyForImplicit].removeCanonicalRecord(this.record);
}
}
}
this.flushCanonicalLater();
},
addRecord: function (record, idx) {
if (!this.members.has(record)) {
this.members.addWithIndex(record, idx);
this.notifyRecordRelationshipAdded(record, idx);
if (this.inverseKey) {
record._relationships.get(this.inverseKey).addRecord(this.record);
} else {
if (!record._implicitRelationships[this.inverseKeyForImplicit]) {
record._implicitRelationships[this.inverseKeyForImplicit] = new Relationship(this.store, record, this.key, { options: {} });
}
record._implicitRelationships[this.inverseKeyForImplicit].addRecord(this.record);
}
this.record.updateRecordArraysLater();
}
this.setHasData(true);
},
removeRecord: function (record) {
if (this.members.has(record)) {
this.removeRecordFromOwn(record);
if (this.inverseKey) {
this.removeRecordFromInverse(record);
} else {
if (record._implicitRelationships[this.inverseKeyForImplicit]) {
record._implicitRelationships[this.inverseKeyForImplicit].removeRecord(this.record);
}
}
}
},
removeRecordFromInverse: function (record) {
var inverseRelationship = record._relationships.get(this.inverseKey);
//Need to check for existence, as the record might unloading at the moment
if (inverseRelationship) {
inverseRelationship.removeRecordFromOwn(this.record);
}
},
removeRecordFromOwn: function (record) {
this.members.delete(record);
this.notifyRecordRelationshipRemoved(record);
this.record.updateRecordArrays();
},
removeCanonicalRecordFromInverse: function (record) {
var inverseRelationship = record._relationships.get(this.inverseKey);
//Need to check for existence, as the record might unloading at the moment
if (inverseRelationship) {
inverseRelationship.removeCanonicalRecordFromOwn(this.record);
}
},
removeCanonicalRecordFromOwn: function (record) {
this.canonicalMembers.delete(record);
this.flushCanonicalLater();
},
flushCanonical: function () {
this.willSync = false;
//a hack for not removing new records
//TODO remove once we have proper diffing
var newRecords = [];
for (var i = 0; i < this.members.list.length; i++) {
if (this.members.list[i].isNew()) {
newRecords.push(this.members.list[i]);
}
}
//TODO(Igor) make this less abysmally slow
this.members = this.canonicalMembers.copy();
for (i = 0; i < newRecords.length; i++) {
this.members.add(newRecords[i]);
}
},
flushCanonicalLater: function () {
var _this3 = this;
if (this.willSync) {
return;
}
this.willSync = true;
this.store._backburner.join(function () {
return _this3.store._backburner.schedule('syncRelationships', _this3, _this3.flushCanonical);
});
},
updateLink: function (link) {
if (link !== this.link) {
this.link = link;
this.linkPromise = null;
this.setHasLoaded(false);
this.record.notifyPropertyChange(this.key);
}
},
findLink: function () {
if (this.linkPromise) {
return this.linkPromise;
} else {
var promise = this.fetchLink();
this.linkPromise = promise;
return promise.then(function (result) {
return result;
});
}
},
updateRecordsFromAdapter: function (records) {
//TODO(Igor) move this to a proper place
//TODO Once we have adapter support, we need to handle updated and canonical changes
this.computeChanges(records);
this.setHasData(true);
this.setHasLoaded(true);
},
notifyRecordRelationshipAdded: _ember.default.K,
notifyRecordRelationshipRemoved: _ember.default.K,
/*
`hasData` for a relationship is a flag to indicate if we consider the
content of this relationship "known". Snapshots uses this to tell the
difference between unknown (`undefined`) or empty (`null`). The reason for
this is that we wouldn't want to serialize unknown relationships as `null`
as that might overwrite remote state.
All relationships for a newly created (`store.createRecord()`) are
considered known (`hasData === true`).
*/
setHasData: function (value) {
this.hasData = value;
},
/*
`hasLoaded` is a flag to indicate if we have gotten data from the adapter or
not when the relationship has a link.
This is used to be able to tell when to fetch the link and when to return
the local data in scenarios where the local state is considered known
(`hasData === true`).
Updating the link will automatically set `hasLoaded` to `false`.
*/
setHasLoaded: function (value) {
this.hasLoaded = value;
}
};
});
define('ember-data/-private/system/snapshot-record-array', ['exports', 'ember-data/-private/features'], function (exports, _emberDataPrivateFeatures) {
exports.default = SnapshotRecordArray;
/**
@class SnapshotRecordArray
@namespace DS
@private
@constructor
@param {Array} snapshots An array of snapshots
@param {Object} meta
*/
function SnapshotRecordArray(recordArray, meta) {
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
/**
An array of snapshots
@private
@property _snapshots
@type {Array}
*/
this._snapshots = null;
/**
An array of records
@private
@property _recordArray
@type {Array}
*/
this._recordArray = recordArray;
/**
Number of records in the array
@property length
@type {Number}
*/
this.length = recordArray.get('length');
/**
The type of the underlying records for the snapshots in the array, as a DS.Model
@property type
@type {DS.Model}
*/
this.type = recordArray.get('type');
/**
Meta object
@property meta
@type {Object}
*/
this.meta = meta;
/**
A hash of adapter options
@property adapterOptions
@type {Object}
*/
this.adapterOptions = options.adapterOptions;
this.include = options.include;
}
/**
Get snapshots of the underlying record array
@method snapshots
@return {Array} Array of snapshots
*/
SnapshotRecordArray.prototype.snapshots = function () {
if (this._snapshots) {
return this._snapshots;
}
var recordArray = this._recordArray;
this._snapshots = recordArray.invoke('createSnapshot');
return this._snapshots;
};
});
/**
@module ember-data
*/
define('ember-data/-private/system/snapshot', ['exports', 'ember', 'ember-data/-private/system/empty-object', 'ember-data/-private/features'], function (exports, _ember, _emberDataPrivateSystemEmptyObject, _emberDataPrivateFeatures) {
exports.default = Snapshot;
var get = _ember.default.get;
/**
@class Snapshot
@namespace DS
@private
@constructor
@param {DS.Model} internalModel The model to create a snapshot from
*/
function Snapshot(internalModel) {
var _this = this;
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
this._attributes = new _emberDataPrivateSystemEmptyObject.default();
this._belongsToRelationships = new _emberDataPrivateSystemEmptyObject.default();
this._belongsToIds = new _emberDataPrivateSystemEmptyObject.default();
this._hasManyRelationships = new _emberDataPrivateSystemEmptyObject.default();
this._hasManyIds = new _emberDataPrivateSystemEmptyObject.default();
var record = internalModel.getRecord();
this.record = record;
record.eachAttribute(function (keyName) {
return _this._attributes[keyName] = get(record, keyName);
});
this.id = internalModel.id;
this._internalModel = internalModel;
this.type = internalModel.type;
this.modelName = internalModel.type.modelName;
/**
A hash of adapter options
@property adapterOptions
@type {Object}
*/
this.adapterOptions = options.adapterOptions;
this.include = options.include;
this._changedAttributes = record.changedAttributes();
}
Snapshot.prototype = {
constructor: Snapshot,
/**
The id of the snapshot's underlying record
Example
```javascript
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
postSnapshot.id; // => '1'
```
@property id
@type {String}
*/
id: null,
/**
The underlying record for this snapshot. Can be used to access methods and
properties defined on the record.
Example
```javascript
var json = snapshot.record.toJSON();
```
@property record
@type {DS.Model}
*/
record: null,
/**
The type of the underlying record for this snapshot, as a DS.Model.
@property type
@type {DS.Model}
*/
type: null,
/**
The name of the type of the underlying record for this snapshot, as a string.
@property modelName
@type {String}
*/
modelName: null,
/**
Returns the value of an attribute.
Example
```javascript
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
postSnapshot.attr('author'); // => 'Tomster'
postSnapshot.attr('title'); // => 'Ember.js rocks'
```
Note: Values are loaded eagerly and cached when the snapshot is created.
@method attr
@param {String} keyName
@return {Object} The attribute value or undefined
*/
attr: function (keyName) {
if (keyName in this._attributes) {
return this._attributes[keyName];
}
throw new _ember.default.Error("Model '" + _ember.default.inspect(this.record) + "' has no attribute named '" + keyName + "' defined.");
},
/**
Returns all attributes and their corresponding values.
Example
```javascript
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
postSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }
```
@method attributes
@return {Object} All attributes of the current snapshot
*/
attributes: function () {
return _ember.default.copy(this._attributes);
},
/**
Returns all changed attributes and their old and new values.
Example
```javascript
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
postModel.set('title', 'Ember.js rocks!');
postSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] }
```
@method changedAttributes
@return {Object} All changed attributes of the current snapshot
*/
changedAttributes: function () {
var changedAttributes = new _emberDataPrivateSystemEmptyObject.default();
var changedAttributeKeys = Object.keys(this._changedAttributes);
for (var i = 0, _length = changedAttributeKeys.length; i < _length; i++) {
var key = changedAttributeKeys[i];
changedAttributes[key] = _ember.default.copy(this._changedAttributes[key]);
}
return changedAttributes;
},
/**
Returns the current value of a belongsTo relationship.
`belongsTo` takes an optional hash of options as a second parameter,
currently supported options are:
- `id`: set to `true` if you only want the ID of the related record to be
returned.
Example
```javascript
// store.push('post', { id: 1, title: 'Hello World' });
// store.createRecord('comment', { body: 'Lorem ipsum', post: post });
commentSnapshot.belongsTo('post'); // => DS.Snapshot
commentSnapshot.belongsTo('post', { id: true }); // => '1'
// store.push('comment', { id: 1, body: 'Lorem ipsum' });
commentSnapshot.belongsTo('post'); // => undefined
```
Calling `belongsTo` will return a new Snapshot as long as there's any known
data for the relationship available, such as an ID. If the relationship is
known but unset, `belongsTo` will return `null`. If the contents of the
relationship is unknown `belongsTo` will return `undefined`.
Note: Relationships are loaded lazily and cached upon first access.
@method belongsTo
@param {String} keyName
@param {Object} [options]
@return {(DS.Snapshot|String|null|undefined)} A snapshot or ID of a known
relationship or null if the relationship is known but unset. undefined
will be returned if the contents of the relationship is unknown.
*/
belongsTo: function (keyName, options) {
var id = options && options.id;
var relationship, inverseRecord, hasData;
var result;
if (id && keyName in this._belongsToIds) {
return this._belongsToIds[keyName];
}
if (!id && keyName in this._belongsToRelationships) {
return this._belongsToRelationships[keyName];
}
relationship = this._internalModel._relationships.get(keyName);
if (!(relationship && relationship.relationshipMeta.kind === 'belongsTo')) {
throw new _ember.default.Error("Model '" + _ember.default.inspect(this.record) + "' has no belongsTo relationship named '" + keyName + "' defined.");
}
hasData = get(relationship, 'hasData');
inverseRecord = get(relationship, 'inverseRecord');
if (hasData) {
if (inverseRecord && !inverseRecord.isDeleted()) {
if (id) {
result = get(inverseRecord, 'id');
} else {
result = inverseRecord.createSnapshot();
}
} else {
result = null;
}
}
if (id) {
this._belongsToIds[keyName] = result;
} else {
this._belongsToRelationships[keyName] = result;
}
return result;
},
/**
Returns the current value of a hasMany relationship.
`hasMany` takes an optional hash of options as a second parameter,
currently supported options are:
- `ids`: set to `true` if you only want the IDs of the related records to be
returned.
Example
```javascript
// store.push('post', { id: 1, title: 'Hello World', comments: [2, 3] });
postSnapshot.hasMany('comments'); // => [DS.Snapshot, DS.Snapshot]
postSnapshot.hasMany('comments', { ids: true }); // => ['2', '3']
// store.push('post', { id: 1, title: 'Hello World' });
postSnapshot.hasMany('comments'); // => undefined
```
Note: Relationships are loaded lazily and cached upon first access.
@method hasMany
@param {String} keyName
@param {Object} [options]
@return {(Array|undefined)} An array of snapshots or IDs of a known
relationship or an empty array if the relationship is known but unset.
undefined will be returned if the contents of the relationship is unknown.
*/
hasMany: function (keyName, options) {
var ids = options && options.ids;
var relationship, members, hasData;
var results;
if (ids && keyName in this._hasManyIds) {
return this._hasManyIds[keyName];
}
if (!ids && keyName in this._hasManyRelationships) {
return this._hasManyRelationships[keyName];
}
relationship = this._internalModel._relationships.get(keyName);
if (!(relationship && relationship.relationshipMeta.kind === 'hasMany')) {
throw new _ember.default.Error("Model '" + _ember.default.inspect(this.record) + "' has no hasMany relationship named '" + keyName + "' defined.");
}
hasData = get(relationship, 'hasData');
members = get(relationship, 'members');
if (hasData) {
results = [];
members.forEach(function (member) {
if (!member.isDeleted()) {
if (ids) {
results.push(member.id);
} else {
results.push(member.createSnapshot());
}
}
});
}
if (ids) {
this._hasManyIds[keyName] = results;
} else {
this._hasManyRelationships[keyName] = results;
}
return results;
},
/**
Iterates through all the attributes of the model, calling the passed
function on each attribute.
Example
```javascript
snapshot.eachAttribute(function(name, meta) {
// ...
});
```
@method eachAttribute
@param {Function} callback the callback to execute
@param {Object} [binding] the value to which the callback's `this` should be bound
*/
eachAttribute: function (callback, binding) {
this.record.eachAttribute(callback, binding);
},
/**
Iterates through all the relationships of the model, calling the passed
function on each relationship.
Example
```javascript
snapshot.eachRelationship(function(name, relationship) {
// ...
});
```
@method eachRelationship
@param {Function} callback the callback to execute
@param {Object} [binding] the value to which the callback's `this` should be bound
*/
eachRelationship: function (callback, binding) {
this.record.eachRelationship(callback, binding);
},
/**
@method serialize
@param {Object} options
@return {Object} an object whose values are primitive JSON values only
*/
serialize: function (options) {
return this.record.store.serializerFor(this.modelName).serialize(this, options);
}
};
});
/**
@module ember-data
*/
define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/model', 'ember-data/-private/debug', 'ember-data/-private/system/normalize-link', 'ember-data/-private/system/normalize-model-name', 'ember-data/-private/adapters/errors', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/store/common', 'ember-data/-private/system/store/serializer-response', 'ember-data/-private/system/store/serializers', 'ember-data/-private/system/store/finders', 'ember-data/-private/utils', 'ember-data/-private/system/coerce-id', 'ember-data/-private/system/record-array-manager', 'ember-data/-private/system/store/container-instance-cache', 'ember-data/-private/system/model/internal-model', 'ember-data/-private/system/empty-object', 'ember-data/-private/features'], function (exports, _ember, _emberDataModel, _emberDataPrivateDebug, _emberDataPrivateSystemNormalizeLink, _emberDataPrivateSystemNormalizeModelName, _emberDataPrivateAdaptersErrors, _emberDataPrivateSystemPromiseProxies, _emberDataPrivateSystemStoreCommon, _emberDataPrivateSystemStoreSerializerResponse, _emberDataPrivateSystemStoreSerializers, _emberDataPrivateSystemStoreFinders, _emberDataPrivateUtils, _emberDataPrivateSystemCoerceId, _emberDataPrivateSystemRecordArrayManager, _emberDataPrivateSystemStoreContainerInstanceCache, _emberDataPrivateSystemModelInternalModel, _emberDataPrivateSystemEmptyObject, _emberDataPrivateFeatures) {
var badIdFormatAssertion = '`id` has to be non-empty string or number';
exports.badIdFormatAssertion = badIdFormatAssertion;
var Backburner = _ember.default._Backburner;
var Map = _ember.default.Map;
var isArray = Array.isArray || _ember.default.isArray;
//Get the materialized model from the internalModel/promise that returns
//an internal model and return it in a promiseObject. Useful for returning
//from find methods
function promiseRecord(internalModel, label) {
var toReturn = internalModel.then(function (model) {
return model.getRecord();
});
return (0, _emberDataPrivateSystemPromiseProxies.promiseObject)(toReturn, label);
}
var get = _ember.default.get;
var set = _ember.default.set;
var once = _ember.default.run.once;
var isNone = _ember.default.isNone;
var isPresent = _ember.default.isPresent;
var Promise = _ember.default.RSVP.Promise;
var copy = _ember.default.copy;
var Store;
var Service = _ember.default.Service;
// Implementors Note:
//
// The variables in this file are consistently named according to the following
// scheme:
//
// * +id+ means an identifier managed by an external source, provided inside
// the data provided by that source. These are always coerced to be strings
// before being used internally.
// * +clientId+ means a transient numerical identifier generated at runtime by
// the data store. It is important primarily because newly created objects may
// not yet have an externally generated id.
// * +internalModel+ means a record internalModel object, which holds metadata about a
// record, even if it has not yet been fully materialized.
// * +type+ means a DS.Model.
/**
The store contains all of the data for records loaded from the server.
It is also responsible for creating instances of `DS.Model` that wrap
the individual data for a record, so that they can be bound to in your
Handlebars templates.
Define your application's store like this:
```app/services/store.js
import DS from 'ember-data';
export default DS.Store.extend({
});
```
Most Ember.js applications will only have a single `DS.Store` that is
automatically created by their `Ember.Application`.
You can retrieve models from the store in several ways. To retrieve a record
for a specific id, use `DS.Store`'s `findRecord()` method:
```javascript
store.findRecord('person', 123).then(function (person) {
});
```
By default, the store will talk to your backend using a standard
REST mechanism. You can customize how the store talks to your
backend by specifying a custom adapter:
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
});
```
You can learn more about writing a custom adapter by reading the `DS.Adapter`
documentation.
### Store createRecord() vs. push() vs. pushPayload()
The store provides multiple ways to create new record objects. They have
some subtle differences in their use which are detailed below:
[createRecord](#method_createRecord) is used for creating new
records on the client side. This will return a new record in the
`created.uncommitted` state. In order to persist this record to the
backend you will need to call `record.save()`.
[push](#method_push) is used to notify Ember Data's store of new or
updated records that exist in the backend. This will return a record
in the `loaded.saved` state. The primary use-case for `store#push` is
to notify Ember Data about record updates (full or partial) that happen
outside of the normal adapter methods (for example
[SSE](http://dev.w3.org/html5/eventsource/) or [Web
Sockets](http://www.w3.org/TR/2009/WD-websockets-20091222/)).
[pushPayload](#method_pushPayload) is a convenience wrapper for
`store#push` that will deserialize payloads if the
Serializer implements a `pushPayload` method.
Note: When creating a new record using any of the above methods
Ember Data will update `DS.RecordArray`s such as those returned by
`store#peekAll()`, `store#findAll()` or `store#filter()`. This means any
data bindings or computed properties that depend on the RecordArray
will automatically be synced to include the new or updated record
values.
@class Store
@namespace DS
@extends Ember.Service
*/
exports.Store = Store = Service.extend({
/**
@method init
@private
*/
init: function () {
this._super.apply(this, arguments);
this._backburner = new Backburner(['normalizeRelationships', 'syncRelationships', 'finished']);
// internal bookkeeping; not observable
this.typeMaps = {};
this.recordArrayManager = _emberDataPrivateSystemRecordArrayManager.default.create({
store: this
});
this._pendingSave = [];
this._instanceCache = new _emberDataPrivateSystemStoreContainerInstanceCache.default((0, _emberDataPrivateUtils.getOwner)(this));
//Used to keep track of all the find requests that need to be coalesced
this._pendingFetch = Map.create();
},
/**
The adapter to use to communicate to a backend server or other persistence layer.
This can be specified as an instance, class, or string.
If you want to specify `app/adapters/custom.js` as a string, do:
```js
adapter: 'custom'
```
@property adapter
@default DS.JSONAPIAdapter
@type {(DS.Adapter|String)}
*/
adapter: '-json-api',
/**
Returns a JSON representation of the record using a custom
type-specific serializer, if one exists.
The available options are:
* `includeId`: `true` if the record's ID should be included in
the JSON representation
@method serialize
@private
@param {DS.Model} record the record to serialize
@param {Object} options an options hash
*/
serialize: function (record, options) {
var snapshot = record._internalModel.createSnapshot();
return snapshot.serialize(options);
},
/**
This property returns the adapter, after resolving a possible
string key.
If the supplied `adapter` was a class, or a String property
path resolved to a class, this property will instantiate the
class.
This property is cacheable, so the same instance of a specified
adapter class should be used for the lifetime of the store.
@property defaultAdapter
@private
@return DS.Adapter
*/
defaultAdapter: _ember.default.computed('adapter', function () {
var adapter = get(this, 'adapter');
adapter = this.retrieveManagedInstance('adapter', adapter);
return adapter;
}),
// .....................
// . CREATE NEW RECORD .
// .....................
/**
Create a new record in the current store. The properties passed
to this method are set on the newly created record.
To create a new instance of a `Post`:
```js
store.createRecord('post', {
title: "Rails is omakase"
});
```
To create a new instance of a `Post` that has a relationship with a `User` record:
```js
var user = this.store.peekRecord('user', 1);
store.createRecord('post', {
title: "Rails is omakase",
user: user
});
```
@method createRecord
@param {String} modelName
@param {Object} inputProperties a hash of properties to set on the
newly created record.
@return {DS.Model} record
*/
createRecord: function (modelName, inputProperties) {
var typeClass = this.modelFor(modelName);
var properties = copy(inputProperties) || new _emberDataPrivateSystemEmptyObject.default();
// If the passed properties do not include a primary key,
// give the adapter an opportunity to generate one. Typically,
// client-side ID generators will use something like uuid.js
// to avoid conflicts.
if (isNone(properties.id)) {
properties.id = this._generateId(modelName, properties);
}
// Coerce ID to a string
properties.id = (0, _emberDataPrivateSystemCoerceId.default)(properties.id);
var internalModel = this.buildInternalModel(typeClass, properties.id);
var record = internalModel.getRecord();
// Move the record out of its initial `empty` state into
// the `loaded` state.
internalModel.loadedData();
// Set the properties specified on the record.
record.setProperties(properties);
internalModel.eachRelationship(function (key, descriptor) {
internalModel._relationships.get(key).setHasData(true);
});
return record;
},
/**
If possible, this method asks the adapter to generate an ID for
a newly created record.
@method _generateId
@private
@param {String} modelName
@param {Object} properties from the new record
@return {String} if the adapter can generate one, an ID
*/
_generateId: function (modelName, properties) {
var adapter = this.adapterFor(modelName);
if (adapter && adapter.generateIdForRecord) {
return adapter.generateIdForRecord(this, modelName, properties);
}
return null;
},
// .................
// . DELETE RECORD .
// .................
/**
For symmetry, a record can be deleted via the store.
Example
```javascript
var post = store.createRecord('post', {
title: "Rails is omakase"
});
store.deleteRecord(post);
```
@method deleteRecord
@param {DS.Model} record
*/
deleteRecord: function (record) {
record.deleteRecord();
},
/**
For symmetry, a record can be unloaded via the store. Only
non-dirty records can be unloaded.
Example
```javascript
store.findRecord('post', 1).then(function(post) {
store.unloadRecord(post);
});
```
@method unloadRecord
@param {DS.Model} record
*/
unloadRecord: function (record) {
record.unloadRecord();
},
// ................
// . FIND RECORDS .
// ................
/**
@method find
@param {String} modelName
@param {String|Integer} id
@param {Object} options
@return {Promise} promise
@private
*/
find: function (modelName, id, options) {
// The default `model` hook in Ember.Route calls `find(modelName, id)`,
// that's why we have to keep this method around even though `findRecord` is
// the public way to get a record by modelName and id.
if (arguments.length === 1) {}
if (_ember.default.typeOf(id) === 'object') {}
if (options) {}
return this.findRecord(modelName, id);
},
/**
This method returns a record for a given type and id combination.
The `findRecord` method will always return a **promise** that will be
resolved with the record. If the record was already in the store,
the promise will be resolved immediately. Otherwise, the store
will ask the adapter's `find` method to find the necessary data.
The `findRecord` method will always resolve its promise with the same
object for a given type and `id`.
Example
```app/routes/post.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return this.store.findRecord('post', params.post_id);
}
});
```
If you would like to force the record to reload, instead of
loading it from the cache when present you can set `reload: true`
in the options object for `findRecord`.
```app/routes/post/edit.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return this.store.findRecord('post', params.post_id, { reload: true });
}
});
```
@method findRecord
@param {String} modelName
@param {(String|Integer)} id
@param {Object} options
@return {Promise} promise
*/
findRecord: function (modelName, id, options) {
var internalModel = this._internalModelForId(modelName, id);
options = options || {};
if (!this.hasRecordForId(modelName, id)) {
return this._findByInternalModel(internalModel, options);
}
var fetchedInternalModel = this._findRecord(internalModel, options);
return promiseRecord(fetchedInternalModel, "DS: Store#findRecord " + internalModel.typeKey + " with id: " + get(internalModel, 'id'));
},
_findRecord: function (internalModel, options) {
// Refetch if the reload option is passed
if (options.reload) {
return this.scheduleFetch(internalModel, options);
}
// Refetch the record if the adapter thinks the record is stale
var snapshot = internalModel.createSnapshot(options);
var typeClass = internalModel.type;
var adapter = this.adapterFor(typeClass.modelName);
if (adapter.shouldReloadRecord(this, snapshot)) {
return this.scheduleFetch(internalModel, options);
}
// Trigger the background refetch if all the previous checks fail
if (adapter.shouldBackgroundReloadRecord(this, snapshot)) {
this.scheduleFetch(internalModel, options);
}
// Return the cached record
return Promise.resolve(internalModel);
},
_findByInternalModel: function (internalModel, options) {
options = options || {};
if (options.preload) {
internalModel._preloadData(options.preload);
}
var fetchedInternalModel = this._findEmptyInternalModel(internalModel, options);
return promiseRecord(fetchedInternalModel, "DS: Store#findRecord " + internalModel.typeKey + " with id: " + get(internalModel, 'id'));
},
_findEmptyInternalModel: function (internalModel, options) {
if (internalModel.isEmpty()) {
return this.scheduleFetch(internalModel, options);
}
//TODO double check about reloading
if (internalModel.isLoading()) {
return internalModel._loadingPromise;
}
return Promise.resolve(internalModel);
},
/**
This method makes a series of requests to the adapter's `find` method
and returns a promise that resolves once they are all loaded.
@private
@method findByIds
@param {String} modelName
@param {Array} ids
@return {Promise} promise
*/
findByIds: function (modelName, ids) {
var promises = new Array(ids.length);
for (var i = 0; i < ids.length; i++) {
promises[i] = this.findRecord(modelName, ids[i]);
}
return (0, _emberDataPrivateSystemPromiseProxies.promiseArray)(_ember.default.RSVP.all(promises).then(_ember.default.A, null, "DS: Store#findByIds of " + modelName + " complete"));
},
/**
This method is called by `findRecord` if it discovers that a particular
type/id pair hasn't been loaded yet to kick off a request to the
adapter.
@method fetchRecord
@private
@param {InternalModel} internalModel model
@return {Promise} promise
*/
// TODO rename this to have an underscore
fetchRecord: function (internalModel, options) {
var typeClass = internalModel.type;
var id = internalModel.id;
var adapter = this.adapterFor(typeClass.modelName);
var promise = (0, _emberDataPrivateSystemStoreFinders._find)(adapter, this, typeClass, id, internalModel, options);
return promise;
},
scheduleFetchMany: function (records) {
var internalModels = new Array(records.length);
var fetches = new Array(records.length);
for (var i = 0; i < records.length; i++) {
internalModels[i] = records[i]._internalModel;
}
for (var i = 0; i < internalModels.length; i++) {
fetches[i] = this.scheduleFetch(internalModels[i]);
}
return _ember.default.RSVP.Promise.all(fetches);
},
scheduleFetch: function (internalModel, options) {
var typeClass = internalModel.type;
if (internalModel._loadingPromise) {
return internalModel._loadingPromise;
}
var resolver = _ember.default.RSVP.defer('Fetching ' + typeClass + 'with id: ' + internalModel.id);
var pendingFetchItem = {
record: internalModel,
resolver: resolver,
options: options
};
var promise = resolver.promise;
internalModel.loadingData(promise);
if (!this._pendingFetch.get(typeClass)) {
this._pendingFetch.set(typeClass, [pendingFetchItem]);
} else {
this._pendingFetch.get(typeClass).push(pendingFetchItem);
}
_ember.default.run.scheduleOnce('afterRender', this, this.flushAllPendingFetches);
return promise;
},
flushAllPendingFetches: function () {
if (this.isDestroyed || this.isDestroying) {
return;
}
this._pendingFetch.forEach(this._flushPendingFetchForType, this);
this._pendingFetch = Map.create();
},
_flushPendingFetchForType: function (pendingFetchItems, typeClass) {
var store = this;
var adapter = store.adapterFor(typeClass.modelName);
var shouldCoalesce = !!adapter.findMany && adapter.coalesceFindRequests;
var records = _ember.default.A(pendingFetchItems).mapBy('record');
function _fetchRecord(recordResolverPair) {
recordResolverPair.resolver.resolve(store.fetchRecord(recordResolverPair.record, recordResolverPair.options)); // TODO adapter options
}
function resolveFoundRecords(records) {
records.forEach(function (record) {
var pair = _ember.default.A(pendingFetchItems).findBy('record', record);
if (pair) {
var resolver = pair.resolver;
resolver.resolve(record);
}
});
return records;
}
function makeMissingRecordsRejector(requestedRecords) {
return function rejectMissingRecords(resolvedRecords) {
resolvedRecords = _ember.default.A(resolvedRecords);
var missingRecords = requestedRecords.reject(function (record) {
return resolvedRecords.contains(record);
});
if (missingRecords.length) {}
rejectRecords(missingRecords);
};
}
function makeRecordsRejector(records) {
return function (error) {
rejectRecords(records, error);
};
}
function rejectRecords(records, error) {
records.forEach(function (record) {
var pair = _ember.default.A(pendingFetchItems).findBy('record', record);
if (pair) {
var resolver = pair.resolver;
resolver.reject(error);
}
});
}
if (pendingFetchItems.length === 1) {
_fetchRecord(pendingFetchItems[0]);
} else if (shouldCoalesce) {
// TODO: Improve records => snapshots => records => snapshots
//
// We want to provide records to all store methods and snapshots to all
// adapter methods. To make sure we're doing that we're providing an array
// of snapshots to adapter.groupRecordsForFindMany(), which in turn will
// return grouped snapshots instead of grouped records.
//
// But since the _findMany() finder is a store method we need to get the
// records from the grouped snapshots even though the _findMany() finder
// will once again convert the records to snapshots for adapter.findMany()
var snapshots = _ember.default.A(records).invoke('createSnapshot');
var groups = adapter.groupRecordsForFindMany(this, snapshots);
groups.forEach(function (groupOfSnapshots) {
var groupOfRecords = _ember.default.A(groupOfSnapshots).mapBy('_internalModel');
var requestedRecords = _ember.default.A(groupOfRecords);
var ids = requestedRecords.mapBy('id');
if (ids.length > 1) {
(0, _emberDataPrivateSystemStoreFinders._findMany)(adapter, store, typeClass, ids, requestedRecords).then(resolveFoundRecords).then(makeMissingRecordsRejector(requestedRecords)).then(null, makeRecordsRejector(requestedRecords));
} else if (ids.length === 1) {
var pair = _ember.default.A(pendingFetchItems).findBy('record', groupOfRecords[0]);
_fetchRecord(pair);
} else {}
});
} else {
pendingFetchItems.forEach(_fetchRecord);
}
},
/**
Get a record by a given type and ID without triggering a fetch.
This method will synchronously return the record if it is available in the store,
otherwise it will return `null`. A record is available if it has been fetched earlier, or
pushed manually into the store.
_Note: This is an synchronous method and does not return a promise._
```js
var post = store.peekRecord('post', 1);
post.get('id'); // 1
```
@method peekRecord
@param {String} modelName
@param {String|Integer} id
@return {DS.Model|null} record
*/
peekRecord: function (modelName, id) {
if (this.hasRecordForId(modelName, id)) {
return this._internalModelForId(modelName, id).getRecord();
} else {
return null;
}
},
/**
This method is called by the record's `reload` method.
This method calls the adapter's `find` method, which returns a promise. When
**that** promise resolves, `reloadRecord` will resolve the promise returned
by the record's `reload`.
@method reloadRecord
@private
@param {DS.Model} internalModel
@return {Promise} promise
*/
reloadRecord: function (internalModel) {
var modelName = internalModel.type.modelName;
var adapter = this.adapterFor(modelName);
var id = internalModel.id;
return this.scheduleFetch(internalModel);
},
/**
Returns true if a record for a given type and ID is already loaded.
@method hasRecordForId
@param {(String|DS.Model)} modelName
@param {(String|Integer)} inputId
@return {Boolean}
*/
hasRecordForId: function (modelName, inputId) {
var typeClass = this.modelFor(modelName);
var id = (0, _emberDataPrivateSystemCoerceId.default)(inputId);
var internalModel = this.typeMapFor(typeClass).idToRecord[id];
return !!internalModel && internalModel.isLoaded();
},
/**
Returns id record for a given type and ID. If one isn't already loaded,
it builds a new record and leaves it in the `empty` state.
@method recordForId
@private
@param {String} modelName
@param {(String|Integer)} id
@return {DS.Model} record
*/
recordForId: function (modelName, id) {
return this._internalModelForId(modelName, id).getRecord();
},
_internalModelForId: function (typeName, inputId) {
var typeClass = this.modelFor(typeName);
var id = (0, _emberDataPrivateSystemCoerceId.default)(inputId);
var idToRecord = this.typeMapFor(typeClass).idToRecord;
var record = idToRecord[id];
if (!record || !idToRecord[id]) {
record = this.buildInternalModel(typeClass, id);
}
return record;
},
/**
@method findMany
@private
@param {Array} internalModels
@return {Promise} promise
*/
findMany: function (internalModels) {
var finds = new Array(internalModels.length);
for (var i = 0; i < internalModels.length; i++) {
finds[i] = this._findByInternalModel(internalModels[i]);
}
return Promise.all(finds);
},
/**
If a relationship was originally populated by the adapter as a link
(as opposed to a list of IDs), this method is called when the
relationship is fetched.
The link (which is usually a URL) is passed through unchanged, so the
adapter can make whatever request it wants.
The usual use-case is for the server to register a URL as a link, and
then use that URL in the future to make a request for the relationship.
@method findHasMany
@private
@param {DS.Model} owner
@param {any} link
@param {(Relationship)} relationship
@return {Promise} promise
*/
findHasMany: function (owner, link, relationship) {
var adapter = this.adapterFor(owner.type.modelName);
return (0, _emberDataPrivateSystemStoreFinders._findHasMany)(adapter, this, owner, link, relationship);
},
/**
@method findBelongsTo
@private
@param {DS.Model} owner
@param {any} link
@param {Relationship} relationship
@return {Promise} promise
*/
findBelongsTo: function (owner, link, relationship) {
var adapter = this.adapterFor(owner.type.modelName);
return (0, _emberDataPrivateSystemStoreFinders._findBelongsTo)(adapter, this, owner, link, relationship);
},
/**
This method delegates a query to the adapter. This is the one place where
adapter-level semantics are exposed to the application.
Exposing queries this way seems preferable to creating an abstract query
language for all server-side queries, and then require all adapters to
implement them.
---
If you do something like this:
```javascript
store.query('person', { page: 1 });
```
The call made to the server, using a Rails backend, will look something like this:
```
Started GET "/api/v1/person?page=1"
Processing by Api::V1::PersonsController#index as HTML
Parameters: { "page"=>"1" }
```
---
If you do something like this:
```javascript
store.query('person', { ids: [1, 2, 3] });
```
The call to the server, using a Rails backend, will look something like this:
```
Started GET "/api/v1/person?ids%5B%5D=1&ids%5B%5D=2&ids%5B%5D=3"
Processing by Api::V1::PersonsController#index as HTML
Parameters: { "ids" => ["1", "2", "3"] }
```
This method returns a promise, which is resolved with a `RecordArray`
once the server returns.
@method query
@param {String} modelName
@param {any} query an opaque query to be used by the adapter
@return {Promise} promise
*/
query: function (modelName, query) {
return this._query(modelName, query);
},
_query: function (modelName, query, array) {
var typeClass = this.modelFor(modelName);
array = array || this.recordArrayManager.createAdapterPopulatedRecordArray(typeClass, query);
var adapter = this.adapterFor(modelName);
return (0, _emberDataPrivateSystemPromiseProxies.promiseArray)((0, _emberDataPrivateSystemStoreFinders._query)(adapter, this, typeClass, query, array));
},
/**
This method delegates a query to the adapter. This is the one place where
adapter-level semantics are exposed to the application.
Exposing queries this way seems preferable to creating an abstract query
language for all server-side queries, and then require all adapters to
implement them.
This method returns a promise, which is resolved with a `RecordObject`
once the server returns.
@method queryRecord
@param {String} modelName
@param {any} query an opaque query to be used by the adapter
@return {Promise} promise
*/
queryRecord: function (modelName, query) {
var typeClass = this.modelFor(modelName);
var adapter = this.adapterFor(modelName);
return (0, _emberDataPrivateSystemPromiseProxies.promiseObject)((0, _emberDataPrivateSystemStoreFinders._queryRecord)(adapter, this, typeClass, query));
},
/**
`findAll` ask the adapter's `findAll` method to find the records
for the given type, and return a promise that will be resolved
once the server returns the values. The promise will resolve into
all records of this type present in the store, even if the server
only returns a subset of them.
```app/routes/authors.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return this.store.findAll('author');
}
});
```
@method findAll
@param {String} modelName
@param {Object} options
@return {Promise} promise
*/
findAll: function (modelName, options) {
var typeClass = this.modelFor(modelName);
return this._fetchAll(typeClass, this.peekAll(modelName), options);
},
/**
@method _fetchAll
@private
@param {DS.Model} typeClass
@param {DS.RecordArray} array
@return {Promise} promise
*/
_fetchAll: function (typeClass, array, options) {
options = options || {};
var adapter = this.adapterFor(typeClass.modelName);
var sinceToken = this.typeMapFor(typeClass).metadata.since;
if (options.reload) {
return (0, _emberDataPrivateSystemPromiseProxies.promiseArray)((0, _emberDataPrivateSystemStoreFinders._findAll)(adapter, this, typeClass, sinceToken, options));
}
var snapshotArray = array.createSnapshot(options);
if (adapter.shouldReloadAll(this, snapshotArray)) {
return (0, _emberDataPrivateSystemPromiseProxies.promiseArray)((0, _emberDataPrivateSystemStoreFinders._findAll)(adapter, this, typeClass, sinceToken, options));
}
if (adapter.shouldBackgroundReloadAll(this, snapshotArray)) {
(0, _emberDataPrivateSystemStoreFinders._findAll)(adapter, this, typeClass, sinceToken, options);
}
return (0, _emberDataPrivateSystemPromiseProxies.promiseArray)(Promise.resolve(array));
},
/**
@method didUpdateAll
@param {DS.Model} typeClass
@private
*/
didUpdateAll: function (typeClass) {
var liveRecordArray = this.recordArrayManager.liveRecordArrayFor(typeClass);
set(liveRecordArray, 'isUpdating', false);
},
/**
This method returns a filtered array that contains all of the
known records for a given type in the store.
Note that because it's just a filter, the result will contain any
locally created records of the type, however, it will not make a
request to the backend to retrieve additional records. If you
would like to request all the records from the backend please use
[store.findAll](#method_findAll).
Also note that multiple calls to `peekAll` for a given type will always
return the same `RecordArray`.
Example
```javascript
var localPosts = store.peekAll('post');
```
@method peekAll
@param {String} modelName
@return {DS.RecordArray}
*/
peekAll: function (modelName) {
var typeClass = this.modelFor(modelName);
var liveRecordArray = this.recordArrayManager.liveRecordArrayFor(typeClass);
this.recordArrayManager.populateLiveRecordArray(liveRecordArray, typeClass);
return liveRecordArray;
},
/**
This method unloads all records in the store.
Optionally you can pass a type which unload all records for a given type.
```javascript
store.unloadAll();
store.unloadAll('post');
```
@method unloadAll
@param {String=} modelName
*/
unloadAll: function (modelName) {
if (arguments.length === 0) {
var typeMaps = this.typeMaps;
var keys = Object.keys(typeMaps);
var types = new Array(keys.length);
for (var i = 0; i < keys.length; i++) {
types[i] = typeMaps[keys[i]]['type'].modelName;
}
types.forEach(this.unloadAll, this);
} else {
var typeClass = this.modelFor(modelName);
var typeMap = this.typeMapFor(typeClass);
var records = typeMap.records.slice();
var record = undefined;
for (var i = 0; i < records.length; i++) {
record = records[i];
record.unloadRecord();
record.destroy(); // maybe within unloadRecord
}
typeMap.metadata = new _emberDataPrivateSystemEmptyObject.default();
}
},
/**
Takes a type and filter function, and returns a live RecordArray that
remains up to date as new records are loaded into the store or created
locally.
The filter function takes a materialized record, and returns true
if the record should be included in the filter and false if it should
not.
Example
```javascript
store.filter('post', function(post) {
return post.get('unread');
});
```
The filter function is called once on all records for the type when
it is created, and then once on each newly loaded or created record.
If any of a record's properties change, or if it changes state, the
filter function will be invoked again to determine whether it should
still be in the array.
Optionally you can pass a query, which is the equivalent of calling
[query](#method_query) with that same query, to fetch additional records
from the server. The results returned by the server could then appear
in the filter if they match the filter function.
The query itself is not used to filter records, it's only sent to your
server for you to be able to do server-side filtering. The filter
function will be applied on the returned results regardless.
Example
```javascript
store.filter('post', { unread: true }, function(post) {
return post.get('unread');
}).then(function(unreadPosts) {
unreadPosts.get('length'); // 5
var unreadPost = unreadPosts.objectAt(0);
unreadPost.set('unread', false);
unreadPosts.get('length'); // 4
});
```
@method filter
@private
@param {String} modelName
@param {Object} query optional query
@param {Function} filter
@return {DS.PromiseArray}
@deprecated
*/
filter: function (modelName, query, filter) {
if (!_ember.default.ENV.ENABLE_DS_FILTER) {}
var promise;
var length = arguments.length;
var array;
var hasQuery = length === 3;
// allow an optional server query
if (hasQuery) {
promise = this.query(modelName, query);
} else if (arguments.length === 2) {
filter = query;
}
modelName = this.modelFor(modelName);
if (hasQuery) {
array = this.recordArrayManager.createFilteredRecordArray(modelName, filter, query);
} else {
array = this.recordArrayManager.createFilteredRecordArray(modelName, filter);
}
promise = promise || Promise.resolve(array);
return (0, _emberDataPrivateSystemPromiseProxies.promiseArray)(promise.then(function () {
return array;
}, null, 'DS: Store#filter of ' + modelName));
},
/**
This method returns if a certain record is already loaded
in the store. Use this function to know beforehand if a findRecord()
will result in a request or that it will be a cache hit.
Example
```javascript
store.recordIsLoaded('post', 1); // false
store.findRecord('post', 1).then(function() {
store.recordIsLoaded('post', 1); // true
});
```
@method recordIsLoaded
@param {String} modelName
@param {string} id
@return {boolean}
*/
recordIsLoaded: function (modelName, id) {
return this.hasRecordForId(modelName, id);
},
// ............
// . UPDATING .
// ............
/**
If the adapter updates attributes the record will notify
the store to update its membership in any filters.
To avoid thrashing, this method is invoked only once per
run loop per record.
@method dataWasUpdated
@private
@param {Class} type
@param {InternalModel} internalModel
*/
dataWasUpdated: function (type, internalModel) {
this.recordArrayManager.recordDidChange(internalModel);
},
// ..............
// . PERSISTING .
// ..............
/**
This method is called by `record.save`, and gets passed a
resolver for the promise that `record.save` returns.
It schedules saving to happen at the end of the run loop.
@method scheduleSave
@private
@param {InternalModel} internalModel
@param {Resolver} resolver
@param {Object} options
*/
scheduleSave: function (internalModel, resolver, options) {
var snapshot = internalModel.createSnapshot(options);
internalModel.flushChangedAttributes();
internalModel.adapterWillCommit();
this._pendingSave.push({
snapshot: snapshot,
resolver: resolver
});
once(this, 'flushPendingSave');
},
/**
This method is called at the end of the run loop, and
flushes any records passed into `scheduleSave`
@method flushPendingSave
@private
*/
flushPendingSave: function () {
var _this = this;
var pending = this._pendingSave.slice();
this._pendingSave = [];
pending.forEach(function (pendingItem) {
var snapshot = pendingItem.snapshot;
var resolver = pendingItem.resolver;
var record = snapshot._internalModel;
var adapter = _this.adapterFor(record.type.modelName);
var operation;
if (get(record, 'currentState.stateName') === 'root.deleted.saved') {
return resolver.resolve();
} else if (record.isNew()) {
operation = 'createRecord';
} else if (record.isDeleted()) {
operation = 'deleteRecord';
} else {
operation = 'updateRecord';
}
resolver.resolve(_commit(adapter, _this, operation, snapshot));
});
},
/**
This method is called once the promise returned by an
adapter's `createRecord`, `updateRecord` or `deleteRecord`
is resolved.
If the data provides a server-generated ID, it will
update the record and the store's indexes.
@method didSaveRecord
@private
@param {InternalModel} internalModel the in-flight internal model
@param {Object} data optional data (see above)
*/
didSaveRecord: function (internalModel, dataArg) {
var data;
if (dataArg) {
data = dataArg.data;
}
if (data) {
// normalize relationship IDs into records
this._backburner.schedule('normalizeRelationships', this, '_setupRelationships', internalModel, data);
this.updateId(internalModel, data);
}
//We first make sure the primary data has been updated
//TODO try to move notification to the user to the end of the runloop
internalModel.adapterDidCommit(data);
},
/**
This method is called once the promise returned by an
adapter's `createRecord`, `updateRecord` or `deleteRecord`
is rejected with a `DS.InvalidError`.
@method recordWasInvalid
@private
@param {InternalModel} internalModel
@param {Object} errors
*/
recordWasInvalid: function (internalModel, errors) {
internalModel.adapterDidInvalidate(errors);
},
/**
This method is called once the promise returned by an
adapter's `createRecord`, `updateRecord` or `deleteRecord`
is rejected (with anything other than a `DS.InvalidError`).
@method recordWasError
@private
@param {InternalModel} internalModel
@param {Error} error
*/
recordWasError: function (internalModel, error) {
internalModel.adapterDidError(error);
},
/**
When an adapter's `createRecord`, `updateRecord` or `deleteRecord`
resolves with data, this method extracts the ID from the supplied
data.
@method updateId
@private
@param {InternalModel} internalModel
@param {Object} data
*/
updateId: function (internalModel, data) {
var oldId = internalModel.id;
var id = (0, _emberDataPrivateSystemCoerceId.default)(data.id);
this.typeMapFor(internalModel.type).idToRecord[id] = internalModel;
internalModel.setId(id);
},
/**
Returns a map of IDs to client IDs for a given type.
@method typeMapFor
@private
@param {DS.Model} typeClass
@return {Object} typeMap
*/
typeMapFor: function (typeClass) {
var typeMaps = get(this, 'typeMaps');
var guid = _ember.default.guidFor(typeClass);
var typeMap = typeMaps[guid];
if (typeMap) {
return typeMap;
}
typeMap = {
idToRecord: new _emberDataPrivateSystemEmptyObject.default(),
records: [],
metadata: new _emberDataPrivateSystemEmptyObject.default(),
type: typeClass
};
typeMaps[guid] = typeMap;
return typeMap;
},
// ................
// . LOADING DATA .
// ................
/**
This internal method is used by `push`.
@method _load
@private
@param {(String|DS.Model)} type
@param {Object} data
*/
_load: function (data) {
var internalModel = this._internalModelForId(data.type, data.id);
internalModel.setupData(data);
this.recordArrayManager.recordDidChange(internalModel);
return internalModel;
},
/*
In case someone defined a relationship to a mixin, for example:
```
var Comment = DS.Model.extend({
owner: belongsTo('commentable'. { polymorphic: true})
});
var Commentable = Ember.Mixin.create({
comments: hasMany('comment')
});
```
we want to look up a Commentable class which has all the necessary
relationship metadata. Thus, we look up the mixin and create a mock
DS.Model, so we can access the relationship CPs of the mixin (`comments`)
in this case
*/
_modelForMixin: function (modelName) {
var normalizedModelName = (0, _emberDataPrivateSystemNormalizeModelName.default)(modelName);
// container.registry = 2.1
// container._registry = 1.11 - 2.0
// container = < 1.11
var owner = (0, _emberDataPrivateUtils.getOwner)(this);
var mixin = owner._lookupFactory('mixin:' + normalizedModelName);
if (mixin) {
//Cache the class as a model
owner.register('model:' + normalizedModelName, _emberDataModel.default.extend(mixin));
}
var factory = this.modelFactoryFor(normalizedModelName);
if (factory) {
factory.__isMixin = true;
factory.__mixin = mixin;
}
return factory;
},
/**
Returns a model class for a particular key. Used by
methods that take a type key (like `find`, `createRecord`,
etc.)
@method modelFor
@param {String} modelName
@return {DS.Model}
*/
modelFor: function (modelName) {
var factory = this.modelFactoryFor(modelName);
if (!factory) {
//Support looking up mixins as base types for polymorphic relationships
factory = this._modelForMixin(modelName);
}
if (!factory) {
throw new _ember.default.Error("No model was found for '" + modelName + "'");
}
factory.modelName = factory.modelName || (0, _emberDataPrivateSystemNormalizeModelName.default)(modelName);
return factory;
},
modelFactoryFor: function (modelName) {
var normalizedKey = (0, _emberDataPrivateSystemNormalizeModelName.default)(modelName);
var owner = (0, _emberDataPrivateUtils.getOwner)(this);
return owner._lookupFactory('model:' + normalizedKey);
},
/**
Push some data for a given type into the store.
This method expects normalized [JSON API](http://jsonapi.org/) document. This means you have to follow [JSON API specification](http://jsonapi.org/format/) with few minor adjustments:
- record's `type` should always be in singular, dasherized form
- members (properties) should be camelCased
[Your primary data should be wrapped inside `data` property](http://jsonapi.org/format/#document-top-level):
```js
store.push({
data: {
// primary data for single record of type `Person`
id: '1',
type: 'person',
attributes: {
firstName: 'Daniel',
lastName: 'Kmak'
}
}
});
```
[Demo.](http://ember-twiddle.com/fb99f18cd3b4d3e2a4c7)
`data` property can also hold an array (of records):
```js
store.push({
data: [
// an array of records
{
id: '1',
type: 'person',
attributes: {
firstName: 'Daniel',
lastName: 'Kmak'
}
},
{
id: '2',
type: 'person',
attributes: {
firstName: 'Tom',
lastName: 'Dale'
}
}
]
});
```
[Demo.](http://ember-twiddle.com/69cdbeaa3702159dc355)
There are some typical properties for `JSONAPI` payload:
* `id` - mandatory, unique record's key
* `type` - mandatory string which matches `model`'s dasherized name in singular form
* `attributes` - object which holds data for record attributes - `DS.attr`'s declared in model
* `relationships` - object which must contain any of the following properties under each relationships' respective key (example path is `relationships.achievements.data`):
- [`links`](http://jsonapi.org/format/#document-links)
- [`data`](http://jsonapi.org/format/#document-resource-object-linkage) - place for primary data
- [`meta`](http://jsonapi.org/format/#document-meta) - object which contains meta-information about relationship
For this model:
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
children: DS.hasMany('person')
});
```
To represent the children as IDs:
```js
{
data: {
id: '1',
type: 'person',
attributes: {
firstName: 'Tom',
lastName: 'Dale'
},
relationships: {
children: {
data: [
{
id: '2',
type: 'person'
},
{
id: '3',
type: 'person'
},
{
id: '4',
type: 'person'
}
]
}
}
}
}
```
[Demo.](http://ember-twiddle.com/343e1735e034091f5bde)
To represent the children relationship as a URL:
```js
{
data: {
id: '1',
type: 'person',
attributes: {
firstName: 'Tom',
lastName: 'Dale'
},
relationships: {
children: {
links: {
related: '/people/1/children'
}
}
}
}
}
```
If you're streaming data or implementing an adapter, make sure
that you have converted the incoming data into this form. The
store's [normalize](#method_normalize) method is a convenience
helper for converting a json payload into the form Ember Data
expects.
```js
store.push(store.normalize('person', data));
```
This method can be used both to push in brand new
records, as well as to update existing records.
@method push
@param {Object} data
@return {DS.Model|Array} the record(s) that was created or
updated.
*/
push: function (data) {
var included = data.included;
var i, length;
if (included) {
for (i = 0, length = included.length; i < length; i++) {
this._pushInternalModel(included[i]);
}
}
if (isArray(data.data)) {
length = data.data.length;
var internalModels = new Array(length);
for (i = 0; i < length; i++) {
internalModels[i] = this._pushInternalModel(data.data[i]).getRecord();
}
return internalModels;
}
if (data.data === null) {
return null;
}
var internalModel = this._pushInternalModel(data.data);
return internalModel.getRecord();
},
_hasModelFor: function (type) {
return !!(0, _emberDataPrivateUtils.getOwner)(this)._lookupFactory('model:' + type);
},
_pushInternalModel: function (data) {
var _this2 = this;
var modelName = data.type;
var type = this.modelFor(modelName);
// If Ember.ENV.DS_WARN_ON_UNKNOWN_KEYS is set to true and the payload
// contains unknown keys, log a warning.
if (_ember.default.ENV.DS_WARN_ON_UNKNOWN_KEYS) {}
// Actually load the record into the store.
var internalModel = this._load(data);
this._backburner.join(function () {
_this2._backburner.schedule('normalizeRelationships', _this2, '_setupRelationships', internalModel, data);
});
return internalModel;
},
_setupRelationships: function (record, data) {
// This will convert relationships specified as IDs into DS.Model instances
// (possibly unloaded) and also create the data structures used to track
// relationships.
setupRelationships(this, record, data);
},
/**
Push some raw data into the store.
This method can be used both to push in brand new
records, as well as to update existing records. You
can push in more than one type of object at once.
All objects should be in the format expected by the
serializer.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.ActiveModelSerializer;
```
```js
var pushData = {
posts: [
{ id: 1, post_title: "Great post", comment_ids: [2] }
],
comments: [
{ id: 2, comment_body: "Insightful comment" }
]
}
store.pushPayload(pushData);
```
By default, the data will be deserialized using a default
serializer (the application serializer if it exists).
Alternatively, `pushPayload` will accept a model type which
will determine which serializer will process the payload.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.ActiveModelSerializer;
```
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer;
```
```js
store.pushPayload('comment', pushData); // Will use the application serializer
store.pushPayload('post', pushData); // Will use the post serializer
```
@method pushPayload
@param {String} modelName Optionally, a model type used to determine which serializer will be used
@param {Object} inputPayload
*/
pushPayload: function (modelName, inputPayload) {
var _this3 = this;
var serializer;
var payload;
if (!inputPayload) {
payload = modelName;
serializer = defaultSerializer(this);
} else {
payload = inputPayload;
serializer = this.serializerFor(modelName);
}
this._adapterRun(function () {
return serializer.pushPayload(_this3, payload);
});
},
/**
`normalize` converts a json payload into the normalized form that
[push](#method_push) expects.
Example
```js
socket.on('message', function(message) {
var modelName = message.model;
var data = message.data;
store.push(modelName, store.normalize(modelName, data));
});
```
@method normalize
@param {String} modelName The name of the model type for this payload
@param {Object} payload
@return {Object} The normalized payload
*/
normalize: function (modelName, payload) {
var serializer = this.serializerFor(modelName);
var model = this.modelFor(modelName);
return serializer.normalize(model, payload);
},
/**
Build a brand new record for a given type, ID, and
initial data.
@method buildRecord
@private
@param {DS.Model} type
@param {String} id
@param {Object} data
@return {InternalModel} internal model
*/
buildInternalModel: function (type, id, data) {
var typeMap = this.typeMapFor(type);
var idToRecord = typeMap.idToRecord;
// lookupFactory should really return an object that creates
// instances with the injections applied
var internalModel = new _emberDataPrivateSystemModelInternalModel.default(type, id, this, null, data);
// if we're creating an item, this process will be done
// later, once the object has been persisted.
if (id) {
idToRecord[id] = internalModel;
}
typeMap.records.push(internalModel);
return internalModel;
},
//Called by the state machine to notify the store that the record is ready to be interacted with
recordWasLoaded: function (record) {
this.recordArrayManager.recordWasLoaded(record);
},
// ...............
// . DESTRUCTION .
// ...............
/**
When a record is destroyed, this un-indexes it and
removes it from any record arrays so it can be GCed.
@method _dematerializeRecord
@private
@param {InternalModel} internalModel
*/
_dematerializeRecord: function (internalModel) {
var type = internalModel.type;
var typeMap = this.typeMapFor(type);
var id = internalModel.id;
internalModel.updateRecordArrays();
if (id) {
delete typeMap.idToRecord[id];
}
var loc = typeMap.records.indexOf(internalModel);
typeMap.records.splice(loc, 1);
},
// ......................
// . PER-TYPE ADAPTERS
// ......................
/**
Returns an instance of the adapter for a given type. For
example, `adapterFor('person')` will return an instance of
`App.PersonAdapter`.
If no `App.PersonAdapter` is found, this method will look
for an `App.ApplicationAdapter` (the default adapter for
your entire application).
If no `App.ApplicationAdapter` is found, it will return
the value of the `defaultAdapter`.
@method adapterFor
@public
@param {String} modelName
@return DS.Adapter
*/
adapterFor: function (modelName) {
return this.lookupAdapter(modelName);
},
_adapterRun: function (fn) {
return this._backburner.run(fn);
},
// ..............................
// . RECORD CHANGE NOTIFICATION .
// ..............................
/**
Returns an instance of the serializer for a given type. For
example, `serializerFor('person')` will return an instance of
`App.PersonSerializer`.
If no `App.PersonSerializer` is found, this method will look
for an `App.ApplicationSerializer` (the default serializer for
your entire application).
if no `App.ApplicationSerializer` is found, it will attempt
to get the `defaultSerializer` from the `PersonAdapter`
(`adapterFor('person')`).
If a serializer cannot be found on the adapter, it will fall back
to an instance of `DS.JSONSerializer`.
@method serializerFor
@public
@param {String} modelName the record to serialize
@return {DS.Serializer}
*/
serializerFor: function (modelName) {
var fallbacks = ['application', this.adapterFor(modelName).get('defaultSerializer'), '-default'];
var serializer = this.lookupSerializer(modelName, fallbacks);
return serializer;
},
/**
Retrieve a particular instance from the
container cache. If not found, creates it and
placing it in the cache.
Enabled a store to manage local instances of
adapters and serializers.
@method retrieveManagedInstance
@private
@param {String} modelName the object modelName
@param {String} name the object name
@param {Array} fallbacks the fallback objects to lookup if the lookup for modelName or 'application' fails
@return {Ember.Object}
*/
retrieveManagedInstance: function (type, modelName, fallbacks) {
var normalizedModelName = (0, _emberDataPrivateSystemNormalizeModelName.default)(modelName);
var instance = this._instanceCache.get(type, normalizedModelName, fallbacks);
set(instance, 'store', this);
return instance;
},
lookupAdapter: function (name) {
return this.retrieveManagedInstance('adapter', name, this.get('_adapterFallbacks'));
},
_adapterFallbacks: _ember.default.computed('adapter', function () {
var adapter = this.get('adapter');
return ['application', adapter, '-json-api'];
}),
lookupSerializer: function (name, fallbacks) {
return this.retrieveManagedInstance('serializer', name, fallbacks);
},
willDestroy: function () {
this._super.apply(this, arguments);
this.recordArrayManager.destroy();
this.unloadAll();
}
});
Store.reopen({
/**
Get the reference for the specified record.
Example
```javascript
var userRef = store.getReference('user', 1);
// check if the user is loaded
var isLoaded = userRef.value() !== null;
// get the record of the reference (null if not yet available)
var user = userRef.value();
// get the identifier of the reference
if (userRef.remoteType() === "id") {
var id = userRef.id();
}
// load user (via store.find)
userRef.load().then(...)
// or trigger a reload
userRef.reload().then(...)
// provide data for reference
userRef.push({ id: 1, username: "@user" }).then(function(user) {
userRef.value() === user;
});
```
@method getReference
@param {String} type
@param {String|Integer} id
@return {RecordReference}
*/
getReference: function (type, id) {
return this._internalModelForId(type, id).recordReference;
}
});
function deserializeRecordId(store, key, relationship, id) {
if (isNone(id)) {
return;
}
//TODO:Better asserts
return store._internalModelForId(id.type, id.id);
}
function deserializeRecordIds(store, key, relationship, ids) {
if (isNone(ids)) {
return;
}
var _ids = new Array(ids.length);
for (var i = 0; i < ids.length; i++) {
_ids[i] = deserializeRecordId(store, key, relationship, ids[i]);
}
return _ids;
}
// Delegation to the adapter and promise management
function defaultSerializer(store) {
return store.serializerFor('application');
}
function _commit(adapter, store, operation, snapshot) {
var internalModel = snapshot._internalModel;
var modelName = snapshot.modelName;
var typeClass = store.modelFor(modelName);
var promise = adapter[operation](store, typeClass, snapshot);
var serializer = (0, _emberDataPrivateSystemStoreSerializers.serializerForAdapter)(store, adapter, modelName);
var label = 'DS: Extract and notify about ' + operation + ' completion of ' + internalModel;
promise = Promise.resolve(promise, label);
promise = (0, _emberDataPrivateSystemStoreCommon._guard)(promise, (0, _emberDataPrivateSystemStoreCommon._bind)(_emberDataPrivateSystemStoreCommon._objectIsAlive, store));
promise = (0, _emberDataPrivateSystemStoreCommon._guard)(promise, (0, _emberDataPrivateSystemStoreCommon._bind)(_emberDataPrivateSystemStoreCommon._objectIsAlive, internalModel));
return promise.then(function (adapterPayload) {
store._adapterRun(function () {
var payload, data;
if (adapterPayload) {
payload = (0, _emberDataPrivateSystemStoreSerializerResponse.normalizeResponseHelper)(serializer, store, typeClass, adapterPayload, snapshot.id, operation);
if (payload.included) {
store.push({ data: payload.included });
}
data = payload.data;
}
store.didSaveRecord(internalModel, { data: data });
});
return internalModel;
}, function (error) {
if (error instanceof _emberDataPrivateAdaptersErrors.InvalidError) {
var errors = serializer.extractErrors(store, typeClass, error, snapshot.id);
store.recordWasInvalid(internalModel, errors);
} else {
store.recordWasError(internalModel, error);
}
throw error;
}, label);
}
function setupRelationships(store, record, data) {
if (!data.relationships) {
return;
}
record.type.eachRelationship(function (key, descriptor) {
var kind = descriptor.kind;
if (!data.relationships[key]) {
return;
}
var relationship;
if (data.relationships[key].links && data.relationships[key].links.related) {
var relatedLink = (0, _emberDataPrivateSystemNormalizeLink.default)(data.relationships[key].links.related);
if (relatedLink && relatedLink.href) {
relationship = record._relationships.get(key);
relationship.updateLink(relatedLink.href);
}
}
if (data.relationships[key].meta) {
relationship = record._relationships.get(key);
relationship.updateMeta(data.relationships[key].meta);
}
// If the data contains a relationship that is specified as an ID (or IDs),
// normalizeRelationship will convert them into DS.Model instances
// (possibly unloaded) before we push the payload into the store.
normalizeRelationship(store, key, descriptor, data.relationships[key]);
var value = data.relationships[key].data;
if (value !== undefined) {
if (kind === 'belongsTo') {
relationship = record._relationships.get(key);
relationship.setCanonicalRecord(value);
} else if (kind === 'hasMany') {
relationship = record._relationships.get(key);
relationship.updateRecordsFromAdapter(value);
}
}
});
}
function normalizeRelationship(store, key, relationship, jsonPayload) {
var data = jsonPayload.data;
if (data) {
var kind = relationship.kind;
if (kind === 'belongsTo') {
jsonPayload.data = deserializeRecordId(store, key, relationship, data);
} else if (kind === 'hasMany') {
jsonPayload.data = deserializeRecordIds(store, key, relationship, data);
}
}
}
exports.Store = Store;
exports.default = Store;
});
/**
@module ember-data
*/
define('ember-data/-private/system/store/common', ['exports', 'ember'], function (exports, _ember) {
exports._bind = _bind;
exports._guard = _guard;
exports._objectIsAlive = _objectIsAlive;
var get = _ember.default.get;
function _bind(fn) {
var args = Array.prototype.slice.call(arguments, 1);
return function () {
return fn.apply(undefined, args);
};
}
function _guard(promise, test) {
var guarded = promise['finally'](function () {
if (!test()) {
guarded._subscribers.length = 0;
}
});
return guarded;
}
function _objectIsAlive(object) {
return !(get(object, "isDestroyed") || get(object, "isDestroying"));
}
});
define('ember-data/-private/system/store/container-instance-cache', ['exports', 'ember', 'ember-data/-private/system/empty-object'], function (exports, _ember, _emberDataPrivateSystemEmptyObject) {
exports.default = ContainerInstanceCache;
var assign = _ember.default.assign || _ember.default.merge;
/**
* The `ContainerInstanceCache` serves as a lazy cache for looking up
* instances of serializers and adapters. It has some additional logic for
* finding the 'fallback' adapter or serializer.
*
* The 'fallback' adapter or serializer is an adapter or serializer that is looked up
* when the preferred lookup fails. For example, say you try to look up `adapter:post`,
* but there is no entry (app/adapters/post.js in EmberCLI) for `adapter:post` in the registry.
*
* The `fallbacks` array passed will then be used; the first entry in the fallbacks array
* that exists in the container will then be cached for `adapter:post`. So, the next time you
* look up `adapter:post`, you'll get the `adapter:application` instance (or whatever the fallback
* was if `adapter:application` doesn't exist).
*
* @private
* @class ContainerInstanceCache
*
*/
function ContainerInstanceCache(owner) {
this._owner = owner;
this._cache = new _emberDataPrivateSystemEmptyObject.default();
}
ContainerInstanceCache.prototype = new _emberDataPrivateSystemEmptyObject.default();
assign(ContainerInstanceCache.prototype, {
get: function (type, preferredKey, fallbacks) {
var cache = this._cache;
var preferredLookupKey = type + ':' + preferredKey;
if (!(preferredLookupKey in cache)) {
var instance = this.instanceFor(preferredLookupKey) || this._findInstance(type, fallbacks);
if (instance) {
cache[preferredLookupKey] = instance;
}
}
return cache[preferredLookupKey];
},
_findInstance: function (type, fallbacks) {
for (var i = 0, _length = fallbacks.length; i < _length; i++) {
var fallback = fallbacks[i];
var lookupKey = type + ':' + fallback;
var instance = this.instanceFor(lookupKey);
if (instance) {
return instance;
}
}
},
instanceFor: function (key) {
var cache = this._cache;
if (!cache[key]) {
var instance = this._owner.lookup(key);
if (instance) {
cache[key] = instance;
}
}
return cache[key];
},
destroy: function () {
var cache = this._cache;
var cacheEntries = Object.keys(cache);
for (var i = 0, _length2 = cacheEntries.length; i < _length2; i++) {
var cacheKey = cacheEntries[i];
var cacheEntry = cache[cacheKey];
if (cacheEntry) {
cacheEntry.destroy();
}
}
this._owner = null;
},
constructor: ContainerInstanceCache,
toString: function () {
return 'ContainerInstanceCache';
}
});
});
define("ember-data/-private/system/store/finders", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/system/store/common", "ember-data/-private/system/store/serializer-response", "ember-data/-private/system/store/serializers"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateSystemStoreCommon, _emberDataPrivateSystemStoreSerializerResponse, _emberDataPrivateSystemStoreSerializers) {
exports._find = _find;
exports._findMany = _findMany;
exports._findHasMany = _findHasMany;
exports._findBelongsTo = _findBelongsTo;
exports._findAll = _findAll;
exports._query = _query;
exports._queryRecord = _queryRecord;
var Promise = _ember.default.RSVP.Promise;
function payloadIsNotBlank(adapterPayload) {
if (_ember.default.isArray(adapterPayload)) {
return true;
} else {
return Object.keys(adapterPayload || {}).length;
}
}
function _find(adapter, store, typeClass, id, internalModel, options) {
var snapshot = internalModel.createSnapshot(options);
var promise = adapter.findRecord(store, typeClass, id, snapshot);
var serializer = (0, _emberDataPrivateSystemStoreSerializers.serializerForAdapter)(store, adapter, internalModel.type.modelName);
var label = "DS: Handle Adapter#findRecord of " + typeClass + " with id: " + id;
promise = Promise.resolve(promise, label);
promise = (0, _emberDataPrivateSystemStoreCommon._guard)(promise, (0, _emberDataPrivateSystemStoreCommon._bind)(_emberDataPrivateSystemStoreCommon._objectIsAlive, store));
return promise.then(function (adapterPayload) {
return store._adapterRun(function () {
var payload = (0, _emberDataPrivateSystemStoreSerializerResponse.normalizeResponseHelper)(serializer, store, typeClass, adapterPayload, id, 'findRecord');
//TODO Optimize
var record = store.push(payload);
return record._internalModel;
});
}, function (error) {
internalModel.notFound();
if (internalModel.isEmpty()) {
internalModel.unloadRecord();
}
throw error;
}, "DS: Extract payload of '" + typeClass + "'");
}
function _findMany(adapter, store, typeClass, ids, internalModels) {
var snapshots = _ember.default.A(internalModels).invoke('createSnapshot');
var promise = adapter.findMany(store, typeClass, ids, snapshots);
var serializer = (0, _emberDataPrivateSystemStoreSerializers.serializerForAdapter)(store, adapter, typeClass.modelName);
var label = "DS: Handle Adapter#findMany of " + typeClass;
if (promise === undefined) {
throw new Error('adapter.findMany returned undefined, this was very likely a mistake');
}
promise = Promise.resolve(promise, label);
promise = (0, _emberDataPrivateSystemStoreCommon._guard)(promise, (0, _emberDataPrivateSystemStoreCommon._bind)(_emberDataPrivateSystemStoreCommon._objectIsAlive, store));
return promise.then(function (adapterPayload) {
return store._adapterRun(function () {
var payload = (0, _emberDataPrivateSystemStoreSerializerResponse.normalizeResponseHelper)(serializer, store, typeClass, adapterPayload, null, 'findMany');
//TODO Optimize, no need to materialize here
var records = store.push(payload);
var internalModels = new Array(records.length);
for (var i = 0; i < records.length; i++) {
internalModels[i] = records[i]._internalModel;
}
return internalModels;
});
}, null, "DS: Extract payload of " + typeClass);
}
function _findHasMany(adapter, store, internalModel, link, relationship) {
var snapshot = internalModel.createSnapshot();
var typeClass = store.modelFor(relationship.type);
var promise = adapter.findHasMany(store, snapshot, link, relationship);
var serializer = (0, _emberDataPrivateSystemStoreSerializers.serializerForAdapter)(store, adapter, relationship.type);
var label = "DS: Handle Adapter#findHasMany of " + internalModel + " : " + relationship.type;
promise = Promise.resolve(promise, label);
promise = (0, _emberDataPrivateSystemStoreCommon._guard)(promise, (0, _emberDataPrivateSystemStoreCommon._bind)(_emberDataPrivateSystemStoreCommon._objectIsAlive, store));
promise = (0, _emberDataPrivateSystemStoreCommon._guard)(promise, (0, _emberDataPrivateSystemStoreCommon._bind)(_emberDataPrivateSystemStoreCommon._objectIsAlive, internalModel));
return promise.then(function (adapterPayload) {
return store._adapterRun(function () {
var payload = (0, _emberDataPrivateSystemStoreSerializerResponse.normalizeResponseHelper)(serializer, store, typeClass, adapterPayload, null, 'findHasMany');
//TODO Use a non record creating push
var records = store.push(payload);
var recordArray = records.map(function (record) {
return record._internalModel;
});
recordArray.meta = payload.meta;
return recordArray;
});
}, null, "DS: Extract payload of " + internalModel + " : hasMany " + relationship.type);
}
function _findBelongsTo(adapter, store, internalModel, link, relationship) {
var snapshot = internalModel.createSnapshot();
var typeClass = store.modelFor(relationship.type);
var promise = adapter.findBelongsTo(store, snapshot, link, relationship);
var serializer = (0, _emberDataPrivateSystemStoreSerializers.serializerForAdapter)(store, adapter, relationship.type);
var label = "DS: Handle Adapter#findBelongsTo of " + internalModel + " : " + relationship.type;
promise = Promise.resolve(promise, label);
promise = (0, _emberDataPrivateSystemStoreCommon._guard)(promise, (0, _emberDataPrivateSystemStoreCommon._bind)(_emberDataPrivateSystemStoreCommon._objectIsAlive, store));
promise = (0, _emberDataPrivateSystemStoreCommon._guard)(promise, (0, _emberDataPrivateSystemStoreCommon._bind)(_emberDataPrivateSystemStoreCommon._objectIsAlive, internalModel));
return promise.then(function (adapterPayload) {
return store._adapterRun(function () {
var payload = (0, _emberDataPrivateSystemStoreSerializerResponse.normalizeResponseHelper)(serializer, store, typeClass, adapterPayload, null, 'findBelongsTo');
if (!payload.data) {
return null;
}
//TODO Optimize
var record = store.push(payload);
return record._internalModel;
});
}, null, "DS: Extract payload of " + internalModel + " : " + relationship.type);
}
function _findAll(adapter, store, typeClass, sinceToken, options) {
var modelName = typeClass.modelName;
var recordArray = store.peekAll(modelName);
var snapshotArray = recordArray.createSnapshot(options);
var promise = adapter.findAll(store, typeClass, sinceToken, snapshotArray);
var serializer = (0, _emberDataPrivateSystemStoreSerializers.serializerForAdapter)(store, adapter, modelName);
var label = "DS: Handle Adapter#findAll of " + typeClass;
promise = Promise.resolve(promise, label);
promise = (0, _emberDataPrivateSystemStoreCommon._guard)(promise, (0, _emberDataPrivateSystemStoreCommon._bind)(_emberDataPrivateSystemStoreCommon._objectIsAlive, store));
return promise.then(function (adapterPayload) {
store._adapterRun(function () {
var payload = (0, _emberDataPrivateSystemStoreSerializerResponse.normalizeResponseHelper)(serializer, store, typeClass, adapterPayload, null, 'findAll');
//TODO Optimize
store.push(payload);
});
store.didUpdateAll(typeClass);
return store.peekAll(modelName);
}, null, "DS: Extract payload of findAll " + typeClass);
}
function _query(adapter, store, typeClass, query, recordArray) {
var modelName = typeClass.modelName;
var promise = adapter.query(store, typeClass, query, recordArray);
var serializer = (0, _emberDataPrivateSystemStoreSerializers.serializerForAdapter)(store, adapter, modelName);
var label = "DS: Handle Adapter#query of " + typeClass;
promise = Promise.resolve(promise, label);
promise = (0, _emberDataPrivateSystemStoreCommon._guard)(promise, (0, _emberDataPrivateSystemStoreCommon._bind)(_emberDataPrivateSystemStoreCommon._objectIsAlive, store));
return promise.then(function (adapterPayload) {
var records, payload;
store._adapterRun(function () {
payload = (0, _emberDataPrivateSystemStoreSerializerResponse.normalizeResponseHelper)(serializer, store, typeClass, adapterPayload, null, 'query');
//TODO Optimize
records = store.push(payload);
});
recordArray.loadRecords(records, payload);
return recordArray;
}, null, "DS: Extract payload of query " + typeClass);
}
function _queryRecord(adapter, store, typeClass, query) {
var modelName = typeClass.modelName;
var promise = adapter.queryRecord(store, typeClass, query);
var serializer = (0, _emberDataPrivateSystemStoreSerializers.serializerForAdapter)(store, adapter, modelName);
var label = "DS: Handle Adapter#queryRecord of " + typeClass;
promise = Promise.resolve(promise, label);
promise = (0, _emberDataPrivateSystemStoreCommon._guard)(promise, (0, _emberDataPrivateSystemStoreCommon._bind)(_emberDataPrivateSystemStoreCommon._objectIsAlive, store));
return promise.then(function (adapterPayload) {
var record;
store._adapterRun(function () {
var payload = (0, _emberDataPrivateSystemStoreSerializerResponse.normalizeResponseHelper)(serializer, store, typeClass, adapterPayload, null, 'queryRecord');
//TODO Optimize
record = store.push(payload);
});
return record;
}, null, "DS: Extract payload of queryRecord " + typeClass);
}
});
define('ember-data/-private/system/store/serializer-response', ['exports', 'ember', 'ember-data/-private/debug'], function (exports, _ember, _emberDataPrivateDebug) {
exports.validateDocumentStructure = validateDocumentStructure;
exports.normalizeResponseHelper = normalizeResponseHelper;
/*
This is a helper method that validates a JSON API top-level document
The format of a document is described here:
http://jsonapi.org/format/#document-top-level
@method validateDocumentStructure
@param {Object} doc JSON API document
@return {array} An array of errors found in the document structure
*/
function validateDocumentStructure(doc) {
var errors = [];
if (!doc || typeof doc !== 'object') {
errors.push('Top level of a JSON API document must be an object');
} else {
if (!('data' in doc) && !('errors' in doc) && !('meta' in doc)) {
errors.push('One or more of the following keys must be present: "data", "errors", "meta".');
} else {
if ('data' in doc && 'errors' in doc) {
errors.push('Top level keys "errors" and "data" cannot both be present in a JSON API document');
}
}
if ('data' in doc) {
if (!(doc.data === null || _ember.default.isArray(doc.data) || typeof doc.data === 'object')) {
errors.push('data must be null, an object, or an array');
}
}
if ('meta' in doc) {
if (typeof doc.meta !== 'object') {
errors.push('meta must be an object');
}
}
if ('errors' in doc) {
if (!_ember.default.isArray(doc.errors)) {
errors.push('errors must be an array');
}
}
if ('links' in doc) {
if (typeof doc.links !== 'object') {
errors.push('links must be an object');
}
}
if ('jsonapi' in doc) {
if (typeof doc.jsonapi !== 'object') {
errors.push('jsonapi must be an object');
}
}
if ('included' in doc) {
if (typeof doc.included !== 'object') {
errors.push('included must be an array');
}
}
}
return errors;
}
/*
This is a helper method that always returns a JSON-API Document.
@method normalizeResponseHelper
@param {DS.Serializer} serializer
@param {DS.Store} store
@param {subclass of DS.Model} modelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
function normalizeResponseHelper(serializer, store, modelClass, payload, id, requestType) {
var normalizedResponse = serializer.normalizeResponse(store, modelClass, payload, id, requestType);
var validationErrors = [];
return normalizedResponse;
}
});
define("ember-data/-private/system/store/serializers", ["exports"], function (exports) {
exports.serializerForAdapter = serializerForAdapter;
function serializerForAdapter(store, adapter, type) {
var serializer = adapter.serializer;
if (serializer === undefined) {
serializer = store.serializerFor(type);
}
if (serializer === null || serializer === undefined) {
serializer = {
extract: function (store, type, payload) {
return payload;
}
};
}
return serializer;
}
});
define("ember-data/-private/transforms", ["exports", "ember-data/transform", "ember-data/-private/transforms/number", "ember-data/-private/transforms/date", "ember-data/-private/transforms/string", "ember-data/-private/transforms/boolean"], function (exports, _emberDataTransform, _emberDataPrivateTransformsNumber, _emberDataPrivateTransformsDate, _emberDataPrivateTransformsString, _emberDataPrivateTransformsBoolean) {
exports.Transform = _emberDataTransform.default;
exports.NumberTransform = _emberDataPrivateTransformsNumber.default;
exports.DateTransform = _emberDataPrivateTransformsDate.default;
exports.StringTransform = _emberDataPrivateTransformsString.default;
exports.BooleanTransform = _emberDataPrivateTransformsBoolean.default;
});
define("ember-data/-private/transforms/boolean", ["exports", "ember-data/transform"], function (exports, _emberDataTransform) {
/**
The `DS.BooleanTransform` class is used to serialize and deserialize
boolean attributes on Ember Data record objects. This transform is
used when `boolean` is passed as the type parameter to the
[DS.attr](../../data#method_attr) function.
Usage
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
isAdmin: DS.attr('boolean'),
name: DS.attr('string'),
email: DS.attr('string')
});
```
@class BooleanTransform
@extends DS.Transform
@namespace DS
*/
exports.default = _emberDataTransform.default.extend({
deserialize: function (serialized) {
var type = typeof serialized;
if (type === "boolean") {
return serialized;
} else if (type === "string") {
return serialized.match(/^true$|^t$|^1$/i) !== null;
} else if (type === "number") {
return serialized === 1;
} else {
return false;
}
},
serialize: function (deserialized) {
return Boolean(deserialized);
}
});
});
define("ember-data/-private/transforms/date", ["exports", "ember", "ember-data/-private/ext/date", "ember-data/transform"], function (exports, _ember, _emberDataPrivateExtDate, _emberDataTransform) {
exports.default = _emberDataTransform.default.extend({
deserialize: function (serialized) {
var type = typeof serialized;
if (type === "string") {
return new Date(_ember.default.Date.parse(serialized));
} else if (type === "number") {
return new Date(serialized);
} else if (serialized === null || serialized === undefined) {
// if the value is null return null
// if the value is not present in the data return undefined
return serialized;
} else {
return null;
}
},
serialize: function (date) {
if (date instanceof Date) {
return date.toISOString();
} else {
return null;
}
}
});
});
/**
The `DS.DateTransform` class is used to serialize and deserialize
date attributes on Ember Data record objects. This transform is used
when `date` is passed as the type parameter to the
[DS.attr](../../data#method_attr) function.
```app/models/score.js
import DS from 'ember-data';
export default DS.Model.extend({
value: DS.attr('number'),
player: DS.belongsTo('player'),
date: DS.attr('date')
});
```
@class DateTransform
@extends DS.Transform
@namespace DS
*/
define("ember-data/-private/transforms/number", ["exports", "ember", "ember-data/transform"], function (exports, _ember, _emberDataTransform) {
var empty = _ember.default.isEmpty;
function isNumber(value) {
return value === value && value !== Infinity && value !== -Infinity;
}
/**
The `DS.NumberTransform` class is used to serialize and deserialize
numeric attributes on Ember Data record objects. This transform is
used when `number` is passed as the type parameter to the
[DS.attr](../../data#method_attr) function.
Usage
```app/models/score.js
import DS from 'ember-data';
export default DS.Model.extend({
value: DS.attr('number'),
player: DS.belongsTo('player'),
date: DS.attr('date')
});
```
@class NumberTransform
@extends DS.Transform
@namespace DS
*/
exports.default = _emberDataTransform.default.extend({
deserialize: function (serialized) {
var transformed;
if (empty(serialized)) {
return null;
} else {
transformed = Number(serialized);
return isNumber(transformed) ? transformed : null;
}
},
serialize: function (deserialized) {
var transformed;
if (empty(deserialized)) {
return null;
} else {
transformed = Number(deserialized);
return isNumber(transformed) ? transformed : null;
}
}
});
});
define("ember-data/-private/transforms/string", ["exports", "ember", "ember-data/transform"], function (exports, _ember, _emberDataTransform) {
var none = _ember.default.isNone;
/**
The `DS.StringTransform` class is used to serialize and deserialize
string attributes on Ember Data record objects. This transform is
used when `string` is passed as the type parameter to the
[DS.attr](../../data#method_attr) function.
Usage
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
isAdmin: DS.attr('boolean'),
name: DS.attr('string'),
email: DS.attr('string')
});
```
@class StringTransform
@extends DS.Transform
@namespace DS
*/
exports.default = _emberDataTransform.default.extend({
deserialize: function (serialized) {
return none(serialized) ? null : String(serialized);
},
serialize: function (deserialized) {
return none(deserialized) ? null : String(deserialized);
}
});
});
define('ember-data/-private/utils', ['exports', 'ember'], function (exports, _ember) {
var get = _ember.default.get;
/**
Check if the passed model has a `type` attribute or a relationship named `type`.
@method modelHasAttributeOrRelationshipNamedType
@param modelClass
*/
function modelHasAttributeOrRelationshipNamedType(modelClass) {
return get(modelClass, 'attributes').has('type') || get(modelClass, 'relationshipsByName').has('type');
}
/*
ember-container-inject-owner is a new feature in Ember 2.3 that finally provides a public
API for looking items up. This function serves as a super simple polyfill to avoid
triggering deprecations.
*/
function getOwner(context) {
var owner;
if (_ember.default.getOwner) {
owner = _ember.default.getOwner(context);
}
if (!owner && context.container) {
owner = context.container;
}
if (owner && owner.lookupFactory && !owner._lookupFactory) {
// `owner` is a container, we are just making this work
owner._lookupFactory = owner.lookupFactory;
owner.register = function () {
var registry = owner.registry || owner._registry || owner;
return registry.register.apply(registry, arguments);
};
}
return owner;
}
exports.modelHasAttributeOrRelationshipNamedType = modelHasAttributeOrRelationshipNamedType;
exports.getOwner = getOwner;
});
define('ember-data/-private/utils/parse-response-headers', ['exports', 'ember-data/-private/system/empty-object'], function (exports, _emberDataPrivateSystemEmptyObject) {
exports.default = parseResponseHeaders;
function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); }
var CLRF = '\u000d\u000a';
function parseResponseHeaders(headersString) {
var headers = new _emberDataPrivateSystemEmptyObject.default();
if (!headersString) {
return headers;
}
var headerPairs = headersString.split(CLRF);
headerPairs.forEach(function (header) {
var _header$split = header.split(':');
var _header$split2 = _toArray(_header$split);
var field = _header$split2[0];
var value = _header$split2.slice(1);
field = field.trim();
value = value.join(':').trim();
if (value) {
headers[field] = value;
}
});
return headers;
}
});
define('ember-data/adapter', ['exports', 'ember'], function (exports, _ember) {
var get = _ember.default.get;
/**
An adapter is an object that receives requests from a store and
translates them into the appropriate action to take against your
persistence layer. The persistence layer is usually an HTTP API, but
may be anything, such as the browser's local storage. Typically the
adapter is not invoked directly instead its functionality is accessed
through the `store`.
### Creating an Adapter
Create a new subclass of `DS.Adapter` in the `app/adapters` folder:
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
// ...your code here
});
```
Model-specific adapters can be created by putting your adapter
class in an `app/adapters/` + `model-name` + `.js` file of the application.
```app/adapters/post.js
import DS from 'ember-data';
export default DS.Adapter.extend({
// ...Post-specific adapter code goes here
});
```
`DS.Adapter` is an abstract base class that you should override in your
application to customize it for your backend. The minimum set of methods
that you should implement is:
* `findRecord()`
* `createRecord()`
* `updateRecord()`
* `deleteRecord()`
* `findAll()`
* `query()`
To improve the network performance of your application, you can optimize
your adapter by overriding these lower-level methods:
* `findMany()`
For an example implementation, see `DS.RESTAdapter`, the
included REST adapter.
@class Adapter
@namespace DS
@extends Ember.Object
*/
exports.default = _ember.default.Object.extend({
/**
If you would like your adapter to use a custom serializer you can
set the `defaultSerializer` property to be the name of the custom
serializer.
Note the `defaultSerializer` serializer has a lower priority than
a model specific serializer (i.e. `PostSerializer`) or the
`application` serializer.
```app/adapters/django.js
import DS from 'ember-data';
export default DS.Adapter.extend({
defaultSerializer: 'django'
});
```
@property defaultSerializer
@type {String}
*/
defaultSerializer: '-default',
/**
The `findRecord()` method is invoked when the store is asked for a record that
has not previously been loaded. In response to `findRecord()` being called, you
should query your persistence layer for a record with the given ID. Once
found, you can asynchronously call the store's `push()` method to push
the record into the store.
Here is an example `findRecord` implementation:
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
findRecord: function(store, type, id, snapshot) {
var url = [type.modelName, id].join('/');
return new Ember.RSVP.Promise(function(resolve, reject) {
Ember.$.getJSON(url).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method findRecord
@param {DS.Store} store
@param {DS.Model} type
@param {String} id
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
findRecord: null,
/**
The `findAll()` method is used to retrieve all records for a given type.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
findAll: function(store, type, sinceToken) {
var url = type;
var query = { since: sinceToken };
return new Ember.RSVP.Promise(function(resolve, reject) {
Ember.$.getJSON(url, query).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method findAll
@param {DS.Store} store
@param {DS.Model} type
@param {String} sinceToken
@param {DS.SnapshotRecordArray} snapshotRecordArray
@return {Promise} promise
*/
findAll: null,
/**
This method is called when you call `query` on the store.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
query: function(store, type, query) {
var url = type;
return new Ember.RSVP.Promise(function(resolve, reject) {
Ember.$.getJSON(url, query).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method query
@param {DS.Store} store
@param {DS.Model} type
@param {Object} query
@param {DS.AdapterPopulatedRecordArray} recordArray
@return {Promise} promise
*/
query: null,
/**
The `queryRecord()` method is invoked when the store is asked for a single
record through a query object.
In response to `queryRecord()` being called, you should always fetch fresh
data. Once found, you can asynchronously call the store's `push()` method
to push the record into the store.
Here is an example `queryRecord` implementation:
Example
```app/adapters/application.js
import DS from 'ember-data';
import Ember from 'ember';
export default DS.Adapter.extend(DS.BuildURLMixin, {
queryRecord: function(store, type, query) {
var urlForQueryRecord = this.buildURL(type.modelName, null, null, 'queryRecord', query);
return new Ember.RSVP.Promise(function(resolve, reject) {
Ember.$.getJSON(urlForQueryRecord, query).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method queryRecord
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {Object} query
@return {Promise} promise
*/
queryRecord: null,
/**
If the globally unique IDs for your records should be generated on the client,
implement the `generateIdForRecord()` method. This method will be invoked
each time you create a new record, and the value returned from it will be
assigned to the record's `primaryKey`.
Most traditional REST-like HTTP APIs will not use this method. Instead, the ID
of the record will be set by the server, and your adapter will update the store
with the new ID when it calls `didCreateRecord()`. Only implement this method if
you intend to generate record IDs on the client-side.
The `generateIdForRecord()` method will be invoked with the requesting store as
the first parameter and the newly created record as the second parameter:
```javascript
generateIdForRecord: function(store, inputProperties) {
var uuid = App.generateUUIDWithStatisticallyLowOddsOfCollision();
return uuid;
}
```
@method generateIdForRecord
@param {DS.Store} store
@param {DS.Model} type the DS.Model class of the record
@param {Object} inputProperties a hash of properties to set on the
newly created record.
@return {(String|Number)} id
*/
generateIdForRecord: null,
/**
Proxies to the serializer's `serialize` method.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
createRecord: function(store, type, snapshot) {
var data = this.serialize(snapshot, { includeId: true });
var url = type;
// ...
}
});
```
@method serialize
@param {DS.Snapshot} snapshot
@param {Object} options
@return {Object} serialized snapshot
*/
serialize: function (snapshot, options) {
return get(snapshot.record, 'store').serializerFor(snapshot.modelName).serialize(snapshot, options);
},
/**
Implement this method in a subclass to handle the creation of
new records.
Serializes the record and sends it to the server.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
createRecord: function(store, type, snapshot) {
var data = this.serialize(snapshot, { includeId: true });
var url = type;
return new Ember.RSVP.Promise(function(resolve, reject) {
Ember.$.ajax({
type: 'POST',
url: url,
dataType: 'json',
data: data
}).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method createRecord
@param {DS.Store} store
@param {DS.Model} type the DS.Model class of the record
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
createRecord: null,
/**
Implement this method in a subclass to handle the updating of
a record.
Serializes the record update and sends it to the server.
The updateRecord method is expected to return a promise that will
resolve with the serialized record. This allows the backend to
inform the Ember Data store the current state of this record after
the update. If it is not possible to return a serialized record
the updateRecord promise can also resolve with `undefined` and the
Ember Data store will assume all of the updates were successfully
applied on the backend.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
updateRecord: function(store, type, snapshot) {
var data = this.serialize(snapshot, { includeId: true });
var id = snapshot.id;
var url = [type, id].join('/');
return new Ember.RSVP.Promise(function(resolve, reject) {
Ember.$.ajax({
type: 'PUT',
url: url,
dataType: 'json',
data: data
}).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method updateRecord
@param {DS.Store} store
@param {DS.Model} type the DS.Model class of the record
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
updateRecord: null,
/**
Implement this method in a subclass to handle the deletion of
a record.
Sends a delete request for the record to the server.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
deleteRecord: function(store, type, snapshot) {
var data = this.serialize(snapshot, { includeId: true });
var id = snapshot.id;
var url = [type, id].join('/');
return new Ember.RSVP.Promise(function(resolve, reject) {
Ember.$.ajax({
type: 'DELETE',
url: url,
dataType: 'json',
data: data
}).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method deleteRecord
@param {DS.Store} store
@param {DS.Model} type the DS.Model class of the record
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
deleteRecord: null,
/**
By default the store will try to coalesce all `fetchRecord` calls within the same runloop
into as few requests as possible by calling groupRecordsForFindMany and passing it into a findMany call.
You can opt out of this behaviour by either not implementing the findMany hook or by setting
coalesceFindRequests to false.
@property coalesceFindRequests
@type {boolean}
*/
coalesceFindRequests: true,
/**
Find multiple records at once if coalesceFindRequests is true.
@method findMany
@param {DS.Store} store
@param {DS.Model} type the DS.Model class of the records
@param {Array} ids
@param {Array} snapshots
@return {Promise} promise
*/
findMany: null,
/**
Organize records into groups, each of which is to be passed to separate
calls to `findMany`.
For example, if your api has nested URLs that depend on the parent, you will
want to group records by their parent.
The default implementation returns the records as a single group.
@method groupRecordsForFindMany
@param {DS.Store} store
@param {Array} snapshots
@return {Array} an array of arrays of records, each of which is to be
loaded separately by `findMany`.
*/
groupRecordsForFindMany: function (store, snapshots) {
return [snapshots];
},
/**
This method is used by the store to determine if the store should
reload a record from the adapter when a record is requested by
`store.findRecord`.
If this method returns true, the store will re-fetch a record from
the adapter. If this method returns false, the store will resolve
immediately using the cached record.
@method shouldReloadRecord
@param {DS.Store} store
@param {DS.Snapshot} snapshot
@return {Boolean}
*/
shouldReloadRecord: function (store, snapshot) {
return false;
},
/**
This method is used by the store to determine if the store should
reload all records from the adapter when records are requested by
`store.findAll`.
If this method returns true, the store will re-fetch all records from
the adapter. If this method returns false, the store will resolve
immediately using the cached record.
@method shouldReloadAll
@param {DS.Store} store
@param {DS.SnapshotRecordArray} snapshotRecordArray
@return {Boolean}
*/
shouldReloadAll: function (store, snapshotRecordArray) {
return !snapshotRecordArray.length;
},
/**
This method is used by the store to determine if the store should
reload a record after the `store.findRecord` method resolves a
cached record.
This method is *only* checked by the store when the store is
returning a cached record.
If this method returns true the store will re-fetch a record from
the adapter.
@method shouldBackgroundReloadRecord
@param {DS.Store} store
@param {DS.Snapshot} snapshot
@return {Boolean}
*/
shouldBackgroundReloadRecord: function (store, snapshot) {
return true;
},
/**
This method is used by the store to determine if the store should
reload a record array after the `store.findAll` method resolves
with a cached record array.
This method is *only* checked by the store when the store is
returning a cached record array.
If this method returns true the store will re-fetch all records
from the adapter.
@method shouldBackgroundReloadAll
@param {DS.Store} store
@param {DS.SnapshotRecordArray} snapshotRecordArray
@return {Boolean}
*/
shouldBackgroundReloadAll: function (store, snapshotRecordArray) {
return true;
}
});
});
/**
@module ember-data
*/
define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-data/adapters/rest'], function (exports, _ember, _emberDataAdaptersRest) {
/**
@class JSONAPIAdapter
@constructor
@namespace DS
@extends DS.RESTAdapter
*/
exports.default = _emberDataAdaptersRest.default.extend({
defaultSerializer: '-json-api',
/**
@method ajaxOptions
@private
@param {String} url
@param {String} type The request type GET, POST, PUT, DELETE etc.
@param {Object} options
@return {Object}
*/
ajaxOptions: function (url, type, options) {
var hash = this._super.apply(this, arguments);
if (hash.contentType) {
hash.contentType = 'application/vnd.api+json';
}
var beforeSend = hash.beforeSend;
hash.beforeSend = function (xhr) {
xhr.setRequestHeader('Accept', 'application/vnd.api+json');
if (beforeSend) {
beforeSend(xhr);
}
};
return hash;
},
/**
By default the JSONAPIAdapter will send each find request coming from a `store.find`
or from accessing a relationship separately to the server. If your server supports passing
ids as a query string, you can set coalesceFindRequests to true to coalesce all find requests
within a single runloop.
For example, if you have an initial payload of:
```javascript
{
post: {
id: 1,
comments: [1, 2]
}
}
```
By default calling `post.get('comments')` will trigger the following requests(assuming the
comments haven't been loaded before):
```
GET /comments/1
GET /comments/2
```
If you set coalesceFindRequests to `true` it will instead trigger the following request:
```
GET /comments?filter[id]=1,2
```
Setting coalesceFindRequests to `true` also works for `store.find` requests and `belongsTo`
relationships accessed within the same runloop. If you set `coalesceFindRequests: true`
```javascript
store.findRecord('comment', 1);
store.findRecord('comment', 2);
```
will also send a request to: `GET /comments?filter[id]=1,2`
Note: Requests coalescing rely on URL building strategy. So if you override `buildURL` in your app
`groupRecordsForFindMany` more likely should be overridden as well in order for coalescing to work.
@property coalesceFindRequests
@type {boolean}
*/
coalesceFindRequests: false,
/**
@method findMany
@param {DS.Store} store
@param {DS.Model} type
@param {Array} ids
@param {Array} snapshots
@return {Promise} promise
*/
findMany: function (store, type, ids, snapshots) {
var url = this.buildURL(type.modelName, ids, snapshots, 'findMany');
return this.ajax(url, 'GET', { data: { filter: { id: ids.join(',') } } });
},
/**
@method pathForType
@param {String} modelName
@return {String} path
**/
pathForType: function (modelName) {
var dasherized = _ember.default.String.dasherize(modelName);
return _ember.default.String.pluralize(dasherized);
},
// TODO: Remove this once we have a better way to override HTTP verbs.
/**
@method updateRecord
@param {DS.Store} store
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
updateRecord: function (store, type, snapshot) {
var data = {};
var serializer = store.serializerFor(type.modelName);
serializer.serializeIntoHash(data, type, snapshot, { includeId: true });
var id = snapshot.id;
var url = this.buildURL(type.modelName, id, snapshot, 'updateRecord');
return this.ajax(url, 'PATCH', { data: data });
}
});
});
/**
@module ember-data
*/
define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'ember-data/-private/adapters/errors', 'ember-data/-private/adapters/build-url-mixin', 'ember-data/-private/features', 'ember-data/-private/utils/parse-response-headers'], function (exports, _ember, _emberDataAdapter, _emberDataPrivateAdaptersErrors, _emberDataPrivateAdaptersBuildUrlMixin, _emberDataPrivateFeatures, _emberDataPrivateUtilsParseResponseHeaders) {
var MapWithDefault = _ember.default.MapWithDefault;
var get = _ember.default.get;
/**
The REST adapter allows your store to communicate with an HTTP server by
transmitting JSON via XHR. Most Ember.js apps that consume a JSON API
should use the REST adapter.
This adapter is designed around the idea that the JSON exchanged with
the server should be conventional.
## Success and failure
The REST adapter will consider a success any response with a status code
of the 2xx family ("Success"), as well as 304 ("Not Modified"). Any other
status code will be considered a failure.
On success, the request promise will be resolved with the full response
payload.
Failed responses with status code 422 ("Unprocessable Entity") will be
considered "invalid". The response will be discarded, except for the
`errors` key. The request promise will be rejected with a `DS.InvalidError`.
This error object will encapsulate the saved `errors` value.
Any other status codes will be treated as an "adapter error". The request
promise will be rejected, similarly to the "invalid" case, but with
an instance of `DS.AdapterError` instead.
## JSON Structure
The REST adapter expects the JSON returned from your server to follow
these conventions.
### Object Root
The JSON payload should be an object that contains the record inside a
root property. For example, in response to a `GET` request for
`/posts/1`, the JSON should look like this:
```js
{
"post": {
"id": 1,
"title": "I'm Running to Reform the W3C's Tag",
"author": "Yehuda Katz"
}
}
```
Similarly, in response to a `GET` request for `/posts`, the JSON should
look like this:
```js
{
"posts": [
{
"id": 1,
"title": "I'm Running to Reform the W3C's Tag",
"author": "Yehuda Katz"
},
{
"id": 2,
"title": "Rails is omakase",
"author": "D2H"
}
]
}
```
Note that the object root can be pluralized for both a single-object response
and an array response: the REST adapter is not strict on this. Further, if the
HTTP server responds to a `GET` request to `/posts/1` (e.g. the response to a
`findRecord` query) with more than one object in the array, Ember Data will
only display the object with the matching ID.
### Conventional Names
Attribute names in your JSON payload should be the camelCased versions of
the attributes in your Ember.js models.
For example, if you have a `Person` model:
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
occupation: DS.attr('string')
});
```
The JSON returned should look like this:
```js
{
"person": {
"id": 5,
"firstName": "Barack",
"lastName": "Obama",
"occupation": "President"
}
}
```
### Errors
If a response is considered a failure, the JSON payload is expected to include
a top-level key `errors`, detailing any specific issues. For example:
```js
{
"errors": {
"msg": "Something went wrong"
}
}
```
This adapter does not make any assumptions as to the format of the `errors`
object. It will simply be passed along as is, wrapped in an instance
of `DS.InvalidError` or `DS.AdapterError`. The serializer can interpret it
afterwards.
## Customization
### Endpoint path customization
Endpoint paths can be prefixed with a `namespace` by setting the namespace
property on the adapter:
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
namespace: 'api/1'
});
```
Requests for the `Person` model would now target `/api/1/people/1`.
### Host customization
An adapter can target other hosts by setting the `host` property.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
host: 'https://api.example.com'
});
```
### Headers customization
Some APIs require HTTP headers, e.g. to provide an API key. Arbitrary
headers can be set as key/value pairs on the `RESTAdapter`'s `headers`
object and Ember Data will send them along with each ajax request.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
headers: {
"API_KEY": "secret key",
"ANOTHER_HEADER": "Some header value"
}
});
```
`headers` can also be used as a computed property to support dynamic
headers. In the example below, the `session` object has been
injected into an adapter by Ember's container.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
headers: Ember.computed('session.authToken', function() {
return {
"API_KEY": this.get("session.authToken"),
"ANOTHER_HEADER": "Some header value"
};
})
});
```
In some cases, your dynamic headers may require data from some
object outside of Ember's observer system (for example
`document.cookie`). You can use the
[volatile](/api/classes/Ember.ComputedProperty.html#method_volatile)
function to set the property into a non-cached mode causing the headers to
be recomputed with every request.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
headers: Ember.computed(function() {
return {
"API_KEY": Ember.get(document.cookie.match(/apiKey\=([^;]*)/), "1"),
"ANOTHER_HEADER": "Some header value"
};
}).volatile()
});
```
@class RESTAdapter
@constructor
@namespace DS
@extends DS.Adapter
@uses DS.BuildURLMixin
*/
exports.default = _emberDataAdapter.default.extend(_emberDataPrivateAdaptersBuildUrlMixin.default, {
defaultSerializer: '-rest',
/**
By default, the RESTAdapter will send the query params sorted alphabetically to the
server.
For example:
```js
store.query('posts', { sort: 'price', category: 'pets' });
```
will generate a requests like this `/posts?category=pets&sort=price`, even if the
parameters were specified in a different order.
That way the generated URL will be deterministic and that simplifies caching mechanisms
in the backend.
Setting `sortQueryParams` to a falsey value will respect the original order.
In case you want to sort the query parameters with a different criteria, set
`sortQueryParams` to your custom sort function.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
sortQueryParams: function(params) {
var sortedKeys = Object.keys(params).sort().reverse();
var len = sortedKeys.length, newParams = {};
for (var i = 0; i < len; i++) {
newParams[sortedKeys[i]] = params[sortedKeys[i]];
}
return newParams;
}
});
```
@method sortQueryParams
@param {Object} obj
@return {Object}
*/
sortQueryParams: function (obj) {
var keys = Object.keys(obj);
var len = keys.length;
if (len < 2) {
return obj;
}
var newQueryParams = {};
var sortedKeys = keys.sort();
for (var i = 0; i < len; i++) {
newQueryParams[sortedKeys[i]] = obj[sortedKeys[i]];
}
return newQueryParams;
},
/**
By default the RESTAdapter will send each find request coming from a `store.find`
or from accessing a relationship separately to the server. If your server supports passing
ids as a query string, you can set coalesceFindRequests to true to coalesce all find requests
within a single runloop.
For example, if you have an initial payload of:
```javascript
{
post: {
id: 1,
comments: [1, 2]
}
}
```
By default calling `post.get('comments')` will trigger the following requests(assuming the
comments haven't been loaded before):
```
GET /comments/1
GET /comments/2
```
If you set coalesceFindRequests to `true` it will instead trigger the following request:
```
GET /comments?ids[]=1&ids[]=2
```
Setting coalesceFindRequests to `true` also works for `store.find` requests and `belongsTo`
relationships accessed within the same runloop. If you set `coalesceFindRequests: true`
```javascript
store.findRecord('comment', 1);
store.findRecord('comment', 2);
```
will also send a request to: `GET /comments?ids[]=1&ids[]=2`
Note: Requests coalescing rely on URL building strategy. So if you override `buildURL` in your app
`groupRecordsForFindMany` more likely should be overridden as well in order for coalescing to work.
@property coalesceFindRequests
@type {boolean}
*/
coalesceFindRequests: false,
/**
Endpoint paths can be prefixed with a `namespace` by setting the namespace
property on the adapter:
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
namespace: 'api/1'
});
```
Requests for the `Post` model would now target `/api/1/post/`.
@property namespace
@type {String}
*/
/**
An adapter can target other hosts by setting the `host` property.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
host: 'https://api.example.com'
});
```
Requests for the `Post` model would now target `https://api.example.com/post/`.
@property host
@type {String}
*/
/**
Some APIs require HTTP headers, e.g. to provide an API
key. Arbitrary headers can be set as key/value pairs on the
`RESTAdapter`'s `headers` object and Ember Data will send them
along with each ajax request. For dynamic headers see [headers
customization](/api/data/classes/DS.RESTAdapter.html#toc_headers-customization).
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
headers: {
"API_KEY": "secret key",
"ANOTHER_HEADER": "Some header value"
}
});
```
@property headers
@type {Object}
*/
/**
Called by the store in order to fetch the JSON for a given
type and ID.
The `findRecord` method makes an Ajax request to a URL computed by
`buildURL`, and returns a promise for the resulting payload.
This method performs an HTTP `GET` request with the id provided as part of the query string.
@method findRecord
@param {DS.Store} store
@param {DS.Model} type
@param {String} id
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
findRecord: function (store, type, id, snapshot) {
var url = this.buildURL(type.modelName, id, snapshot, 'findRecord');
var query = this.buildQuery(snapshot);
return this.ajax(url, 'GET', { data: query });
},
/**
Called by the store in order to fetch a JSON array for all
of the records for a given type.
The `findAll` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a
promise for the resulting payload.
@method findAll
@param {DS.Store} store
@param {DS.Model} type
@param {String} sinceToken
@param {DS.SnapshotRecordArray} snapshotRecordArray
@return {Promise} promise
*/
findAll: function (store, type, sinceToken, snapshotRecordArray) {
var url = this.buildURL(type.modelName, null, snapshotRecordArray, 'findAll');
var query = this.buildQuery(snapshotRecordArray);
return this.ajax(url, 'GET', { data: query });
},
/**
Called by the store in order to fetch a JSON array for
the records that match a particular query.
The `query` method makes an Ajax (HTTP GET) request to a URL
computed by `buildURL`, and returns a promise for the resulting
payload.
The `query` argument is a simple JavaScript object that will be passed directly
to the server as parameters.
@method query
@param {DS.Store} store
@param {DS.Model} type
@param {Object} query
@return {Promise} promise
*/
query: function (store, type, query) {
var url = this.buildURL(type.modelName, null, null, 'query', query);
if (this.sortQueryParams) {
query = this.sortQueryParams(query);
}
return this.ajax(url, 'GET', { data: query });
},
/**
Called by the store in order to fetch a JSON object for
the record that matches a particular query.
The `queryRecord` method makes an Ajax (HTTP GET) request to a URL
computed by `buildURL`, and returns a promise for the resulting
payload.
The `query` argument is a simple JavaScript object that will be passed directly
to the server as parameters.
@method queryRecord
@param {DS.Store} store
@param {DS.Model} type
@param {Object} query
@return {Promise} promise
*/
queryRecord: function (store, type, query) {
var url = this.buildURL(type.modelName, null, null, 'queryRecord', query);
if (this.sortQueryParams) {
query = this.sortQueryParams(query);
}
return this.ajax(url, 'GET', { data: query });
},
/**
Called by the store in order to fetch several records together if `coalesceFindRequests` is true
For example, if the original payload looks like:
```js
{
"id": 1,
"title": "Rails is omakase",
"comments": [ 1, 2, 3 ]
}
```
The IDs will be passed as a URL-encoded Array of IDs, in this form:
```
ids[]=1&ids[]=2&ids[]=3
```
Many servers, such as Rails and PHP, will automatically convert this URL-encoded array
into an Array for you on the server-side. If you want to encode the
IDs, differently, just override this (one-line) method.
The `findMany` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a
promise for the resulting payload.
@method findMany
@param {DS.Store} store
@param {DS.Model} type
@param {Array} ids
@param {Array} snapshots
@return {Promise} promise
*/
findMany: function (store, type, ids, snapshots) {
var url = this.buildURL(type.modelName, ids, snapshots, 'findMany');
return this.ajax(url, 'GET', { data: { ids: ids } });
},
/**
Called by the store in order to fetch a JSON array for
the unloaded records in a has-many relationship that were originally
specified as a URL (inside of `links`).
For example, if your original payload looks like this:
```js
{
"post": {
"id": 1,
"title": "Rails is omakase",
"links": { "comments": "/posts/1/comments" }
}
}
```
This method will be called with the parent record and `/posts/1/comments`.
The `findHasMany` method will make an Ajax (HTTP GET) request to the originally specified URL.
The format of your `links` value will influence the final request URL via the `urlPrefix` method:
* Links beginning with `//`, `http://`, `https://`, will be used as is, with no further manipulation.
* Links beginning with a single `/` will have the current adapter's `host` value prepended to it.
* Links with no beginning `/` will have a parentURL prepended to it, via the current adapter's `buildURL`.
@method findHasMany
@param {DS.Store} store
@param {DS.Snapshot} snapshot
@param {String} url
@return {Promise} promise
*/
findHasMany: function (store, snapshot, url, relationship) {
var id = snapshot.id;
var type = snapshot.modelName;
url = this.urlPrefix(url, this.buildURL(type, id, snapshot, 'findHasMany'));
return this.ajax(url, 'GET');
},
/**
Called by the store in order to fetch the JSON for the unloaded record in a
belongs-to relationship that was originally specified as a URL (inside of
`links`).
For example, if your original payload looks like this:
```js
{
"person": {
"id": 1,
"name": "Tom Dale",
"links": { "group": "/people/1/group" }
}
}
```
This method will be called with the parent record and `/people/1/group`.
The `findBelongsTo` method will make an Ajax (HTTP GET) request to the originally specified URL.
The format of your `links` value will influence the final request URL via the `urlPrefix` method:
* Links beginning with `//`, `http://`, `https://`, will be used as is, with no further manipulation.
* Links beginning with a single `/` will have the current adapter's `host` value prepended to it.
* Links with no beginning `/` will have a parentURL prepended to it, via the current adapter's `buildURL`.
@method findBelongsTo
@param {DS.Store} store
@param {DS.Snapshot} snapshot
@param {String} url
@return {Promise} promise
*/
findBelongsTo: function (store, snapshot, url, relationship) {
var id = snapshot.id;
var type = snapshot.modelName;
url = this.urlPrefix(url, this.buildURL(type, id, snapshot, 'findBelongsTo'));
return this.ajax(url, 'GET');
},
/**
Called by the store when a newly created record is
saved via the `save` method on a model record instance.
The `createRecord` method serializes the record and makes an Ajax (HTTP POST) request
to a URL computed by `buildURL`.
See `serialize` for information on how to customize the serialized form
of a record.
@method createRecord
@param {DS.Store} store
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
createRecord: function (store, type, snapshot) {
var data = {};
var serializer = store.serializerFor(type.modelName);
var url = this.buildURL(type.modelName, null, snapshot, 'createRecord');
serializer.serializeIntoHash(data, type, snapshot, { includeId: true });
return this.ajax(url, "POST", { data: data });
},
/**
Called by the store when an existing record is saved
via the `save` method on a model record instance.
The `updateRecord` method serializes the record and makes an Ajax (HTTP PUT) request
to a URL computed by `buildURL`.
See `serialize` for information on how to customize the serialized form
of a record.
@method updateRecord
@param {DS.Store} store
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
updateRecord: function (store, type, snapshot) {
var data = {};
var serializer = store.serializerFor(type.modelName);
serializer.serializeIntoHash(data, type, snapshot);
var id = snapshot.id;
var url = this.buildURL(type.modelName, id, snapshot, 'updateRecord');
return this.ajax(url, "PUT", { data: data });
},
/**
Called by the store when a record is deleted.
The `deleteRecord` method makes an Ajax (HTTP DELETE) request to a URL computed by `buildURL`.
@method deleteRecord
@param {DS.Store} store
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
deleteRecord: function (store, type, snapshot) {
var id = snapshot.id;
return this.ajax(this.buildURL(type.modelName, id, snapshot, 'deleteRecord'), "DELETE");
},
_stripIDFromURL: function (store, snapshot) {
var url = this.buildURL(snapshot.modelName, snapshot.id, snapshot);
var expandedURL = url.split('/');
//Case when the url is of the format ...something/:id
var lastSegment = expandedURL[expandedURL.length - 1];
var id = snapshot.id;
if (lastSegment === id) {
expandedURL[expandedURL.length - 1] = "";
} else if (endsWith(lastSegment, '?id=' + id)) {
//Case when the url is of the format ...something?id=:id
expandedURL[expandedURL.length - 1] = lastSegment.substring(0, lastSegment.length - id.length - 1);
}
return expandedURL.join('/');
},
// http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
maxURLLength: 2048,
/**
Organize records into groups, each of which is to be passed to separate
calls to `findMany`.
This implementation groups together records that have the same base URL but
differing ids. For example `/comments/1` and `/comments/2` will be grouped together
because we know findMany can coalesce them together as `/comments?ids[]=1&ids[]=2`
It also supports urls where ids are passed as a query param, such as `/comments?id=1`
but not those where there is more than 1 query param such as `/comments?id=2&name=David`
Currently only the query param of `id` is supported. If you need to support others, please
override this or the `_stripIDFromURL` method.
It does not group records that have differing base urls, such as for example: `/posts/1/comments/2`
and `/posts/2/comments/3`
@method groupRecordsForFindMany
@param {DS.Store} store
@param {Array} snapshots
@return {Array} an array of arrays of records, each of which is to be
loaded separately by `findMany`.
*/
groupRecordsForFindMany: function (store, snapshots) {
var groups = MapWithDefault.create({ defaultValue: function () {
return [];
} });
var adapter = this;
var maxURLLength = this.maxURLLength;
snapshots.forEach(function (snapshot) {
var baseUrl = adapter._stripIDFromURL(store, snapshot);
groups.get(baseUrl).push(snapshot);
});
function splitGroupToFitInUrl(group, maxURLLength, paramNameLength) {
var baseUrl = adapter._stripIDFromURL(store, group[0]);
var idsSize = 0;
var splitGroups = [[]];
group.forEach(function (snapshot) {
var additionalLength = encodeURIComponent(snapshot.id).length + paramNameLength;
if (baseUrl.length + idsSize + additionalLength >= maxURLLength) {
idsSize = 0;
splitGroups.push([]);
}
idsSize += additionalLength;
var lastGroupIndex = splitGroups.length - 1;
splitGroups[lastGroupIndex].push(snapshot);
});
return splitGroups;
}
var groupsArray = [];
groups.forEach(function (group, key) {
var paramNameLength = '&ids%5B%5D='.length;
var splitGroups = splitGroupToFitInUrl(group, maxURLLength, paramNameLength);
splitGroups.forEach(function (splitGroup) {
return groupsArray.push(splitGroup);
});
});
return groupsArray;
},
/**
Takes an ajax response, and returns the json payload or an error.
By default this hook just returns the json payload passed to it.
You might want to override it in two cases:
1. Your API might return useful results in the response headers.
Response headers are passed in as the second argument.
2. Your API might return errors as successful responses with status code
200 and an Errors text or object. You can return a `DS.InvalidError` or a
`DS.AdapterError` (or a sub class) from this hook and it will automatically
reject the promise and put your record into the invalid or error state.
Returning a `DS.InvalidError` from this method will cause the
record to transition into the `invalid` state and make the
`errors` object available on the record. When returning an
`DS.InvalidError` the store will attempt to normalize the error data
returned from the server using the serializer's `extractErrors`
method.
@method handleResponse
@param {Number} status
@param {Object} headers
@param {Object} payload
@param {Object} requestData - the original request information
@return {Object | DS.AdapterError} response
*/
handleResponse: function (status, headers, payload, requestData) {
if (this.isSuccess(status, headers, payload)) {
return payload;
} else if (this.isInvalid(status, headers, payload)) {
return new _emberDataPrivateAdaptersErrors.InvalidError(payload.errors);
}
var errors = this.normalizeErrorResponse(status, headers, payload);
var detailedMessage = this.generatedDetailedMessage(status, headers, payload, requestData);
return new _emberDataPrivateAdaptersErrors.AdapterError(errors, detailedMessage);
},
/**
Default `handleResponse` implementation uses this hook to decide if the
response is a success.
@method isSuccess
@param {Number} status
@param {Object} headers
@param {Object} payload
@return {Boolean}
*/
isSuccess: function (status, headers, payload) {
return status >= 200 && status < 300 || status === 304;
},
/**
Default `handleResponse` implementation uses this hook to decide if the
response is a an invalid error.
@method isInvalid
@param {Number} status
@param {Object} headers
@param {Object} payload
@return {Boolean}
*/
isInvalid: function (status, headers, payload) {
return status === 422;
},
/**
Takes a URL, an HTTP method and a hash of data, and makes an
HTTP request.
When the server responds with a payload, Ember Data will call into `extractSingle`
or `extractArray` (depending on whether the original query was for one record or
many records).
By default, `ajax` method has the following behavior:
* It sets the response `dataType` to `"json"`
* If the HTTP method is not `"GET"`, it sets the `Content-Type` to be
`application/json; charset=utf-8`
* If the HTTP method is not `"GET"`, it stringifies the data passed in. The
data is the serialized record in the case of a save.
* Registers success and failure handlers.
@method ajax
@private
@param {String} url
@param {String} type The request type GET, POST, PUT, DELETE etc.
@param {Object} options
@return {Promise} promise
*/
ajax: function (url, type, options) {
var adapter = this;
var requestData = {
url: url,
method: type
};
return new _ember.default.RSVP.Promise(function (resolve, reject) {
var hash = adapter.ajaxOptions(url, type, options);
hash.success = function (payload, textStatus, jqXHR) {
var response = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), payload, requestData);
if (response && response.isAdapterError) {
_ember.default.run.join(null, reject, response);
} else {
_ember.default.run.join(null, resolve, response);
}
};
hash.error = function (jqXHR, textStatus, errorThrown) {
var error = undefined;
if (errorThrown instanceof Error) {
error = errorThrown;
} else if (textStatus === 'timeout') {
error = new _emberDataPrivateAdaptersErrors.TimeoutError();
} else if (textStatus === 'abort') {
error = new _emberDataPrivateAdaptersErrors.AbortError();
} else {
error = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), adapter.parseErrorResponse(jqXHR.responseText) || errorThrown, requestData);
}
_ember.default.run.join(null, reject, error);
};
adapter._ajaxRequest(hash);
}, 'DS: RESTAdapter#ajax ' + type + ' to ' + url);
},
/**
@method _ajaxRequest
@private
@param {Object} options jQuery ajax options to be used for the ajax request
*/
_ajaxRequest: function (options) {
_ember.default.$.ajax(options);
},
/**
@method ajaxOptions
@private
@param {String} url
@param {String} type The request type GET, POST, PUT, DELETE etc.
@param {Object} options
@return {Object}
*/
ajaxOptions: function (url, type, options) {
var hash = options || {};
hash.url = url;
hash.type = type;
hash.dataType = 'json';
hash.context = this;
if (hash.data && type !== 'GET') {
hash.contentType = 'application/json; charset=utf-8';
hash.data = JSON.stringify(hash.data);
}
var headers = get(this, 'headers');
if (headers !== undefined) {
hash.beforeSend = function (xhr) {
Object.keys(headers).forEach(function (key) {
return xhr.setRequestHeader(key, headers[key]);
});
};
}
return hash;
},
/**
@method parseErrorResponse
@private
@param {String} responseText
@return {Object}
*/
parseErrorResponse: function (responseText) {
var json = responseText;
try {
json = _ember.default.$.parseJSON(responseText);
} catch (e) {}
return json;
},
/**
@method normalizeErrorResponse
@private
@param {Number} status
@param {Object} headers
@param {Object} payload
@return {Array} errors payload
*/
normalizeErrorResponse: function (status, headers, payload) {
if (payload && typeof payload === 'object' && payload.errors) {
return payload.errors;
} else {
return [{
status: '' + status,
title: "The backend responded with an error",
detail: '' + payload
}];
}
},
/**
Generates a detailed ("friendly") error message, with plenty
of information for debugging (good luck!)
@method generatedDetailedMessage
@private
@param {Number} status
@param {Object} headers
@param {Object} payload
@param {Object} requestData
@return {String} detailed error message
*/
generatedDetailedMessage: function (status, headers, payload, requestData) {
var shortenedPayload;
var payloadContentType = headers["Content-Type"] || "Empty Content-Type";
if (payloadContentType === "text/html" && payload.length > 250) {
shortenedPayload = "[Omitted Lengthy HTML]";
} else {
shortenedPayload = payload;
}
var requestDescription = requestData.method + ' ' + requestData.url;
var payloadDescription = 'Payload (' + payloadContentType + ')';
return ['Ember Data Request ' + requestDescription + ' returned a ' + status, payloadDescription, shortenedPayload].join('\n');
},
buildQuery: function (snapshot) {
var query = {};
if (snapshot) {
var include = snapshot.include;
if (include) {
query.include = include;
}
}
return query;
}
});
//From http://stackoverflow.com/questions/280634/endswith-in-javascript
function endsWith(string, suffix) {
if (typeof String.prototype.endsWith !== 'function') {
return string.indexOf(suffix, string.length - suffix.length) !== -1;
} else {
return string.endsWith(suffix);
}
}
});
/**
@module ember-data
*/
define("ember-data/attr", ["exports", "ember", "ember-data/-private/debug"], function (exports, _ember, _emberDataPrivateDebug) {
exports.default = attr;
/**
@module ember-data
*/
function getDefaultValue(record, options, key) {
if (typeof options.defaultValue === "function") {
return options.defaultValue.apply(null, arguments);
} else {
var defaultValue = options.defaultValue;
return defaultValue;
}
}
function hasValue(record, key) {
return key in record._attributes || key in record._inFlightAttributes || key in record._data;
}
function getValue(record, key) {
if (key in record._attributes) {
return record._attributes[key];
} else if (key in record._inFlightAttributes) {
return record._inFlightAttributes[key];
} else {
return record._data[key];
}
}
/**
`DS.attr` defines an attribute on a [DS.Model](/api/data/classes/DS.Model.html).
By default, attributes are passed through as-is, however you can specify an
optional type to have the value automatically transformed.
Ember Data ships with four basic transform types: `string`, `number`,
`boolean` and `date`. You can define your own transforms by subclassing
[DS.Transform](/api/data/classes/DS.Transform.html).
Note that you cannot use `attr` to define an attribute of `id`.
`DS.attr` takes an optional hash as a second parameter, currently
supported options are:
- `defaultValue`: Pass a string or a function to be called to set the attribute
to a default value if none is supplied.
Example
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
username: DS.attr('string'),
email: DS.attr('string'),
verified: DS.attr('boolean', { defaultValue: false })
});
```
Default value can also be a function. This is useful it you want to return
a new object for each attribute.
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
username: attr('string'),
email: attr('string'),
settings: attr({defaultValue: function() {
return {};
}})
});
```
@namespace
@method attr
@for DS
@param {String} type the attribute type
@param {Object} options a hash of options
@return {Attribute}
*/
function attr(type, options) {
if (typeof type === 'object') {
options = type;
type = undefined;
} else {
options = options || {};
}
var meta = {
type: type,
isAttribute: true,
options: options
};
return _ember.default.computed({
get: function (key) {
var internalModel = this._internalModel;
if (hasValue(internalModel, key)) {
return getValue(internalModel, key);
} else {
return getDefaultValue(this, options, key);
}
},
set: function (key, value) {
var internalModel = this._internalModel;
var oldValue = getValue(internalModel, key);
if (value !== oldValue) {
// Add the new value to the changed attributes hash; it will get deleted by
// the 'didSetProperty' handler if it is no different from the original value
internalModel._attributes[key] = value;
this._internalModel.send('didSetProperty', {
name: key,
oldValue: oldValue,
originalValue: internalModel._data[key],
value: value
});
}
return value;
}
}).meta(meta);
}
// TODO add to documentation of `attr` function above, once this feature is added
// /**
// * The `options` hash is passed as second argument to a transforms'
// * `serialize` and `deserialize` method. This allows to configure a
// * transformation and adapt the corresponding value, based on the config:
// *
// * ```app/models/post.js
// * export default DS.Model.extend({
// * text: DS.attr('text', {
// * uppercase: true
// * })
// * });
// * ```
// *
// * ```app/transforms/text.js
// * export default DS.Transform.extend({
// * serialize: function(value, options) {
// * if (options.uppercase) {
// * return value.toUpperCase();
// * }
// *
// * return value;
// * },
// *
// * deserialize: function(value) {
// * return value;
// * }
// * })
// * ```
// *
// */
});
define("ember-data", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/core", "ember-data/-private/system/normalize-model-name", "ember-data/-private/system/model/internal-model", "ember-data/-private/system/promise-proxies", "ember-data/-private/system/store", "ember-data/-private/system/model", "ember-data/model", "ember-data/-private/system/snapshot", "ember-data/adapter", "ember-data/serializer", "ember-data/-private/system/debug", "ember-data/-private/adapters/errors", "ember-data/-private/system/record-arrays", "ember-data/-private/system/many-array", "ember-data/-private/system/record-array-manager", "ember-data/-private/adapters", "ember-data/-private/adapters/build-url-mixin", "ember-data/-private/serializers", "ember-inflector", "ember-data/serializers/embedded-records-mixin", "ember-data/-private/transforms", "ember-data/relationships", "ember-data/setup-container", "ember-data/-private/instance-initializers/initialize-store-service", "ember-data/-private/system/container-proxy", "ember-data/-private/system/relationships/state/relationship"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateCore, _emberDataPrivateSystemNormalizeModelName, _emberDataPrivateSystemModelInternalModel, _emberDataPrivateSystemPromiseProxies, _emberDataPrivateSystemStore, _emberDataPrivateSystemModel, _emberDataModel, _emberDataPrivateSystemSnapshot, _emberDataAdapter, _emberDataSerializer, _emberDataPrivateSystemDebug, _emberDataPrivateAdaptersErrors, _emberDataPrivateSystemRecordArrays, _emberDataPrivateSystemManyArray, _emberDataPrivateSystemRecordArrayManager, _emberDataPrivateAdapters, _emberDataPrivateAdaptersBuildUrlMixin, _emberDataPrivateSerializers, _emberInflector, _emberDataSerializersEmbeddedRecordsMixin, _emberDataPrivateTransforms, _emberDataRelationships, _emberDataSetupContainer, _emberDataPrivateInstanceInitializersInitializeStoreService, _emberDataPrivateSystemContainerProxy, _emberDataPrivateSystemRelationshipsStateRelationship) {
/**
Ember Data
@module ember-data
@main ember-data
*/
if (_ember.default.VERSION.match(/^1\.([0-9]|1[0-2])\./)) {
throw new _ember.default.Error("Ember Data requires at least Ember 1.13.0, but you have " + _ember.default.VERSION + ". Please upgrade your version of Ember, then upgrade Ember Data.");
}
if (_ember.default.VERSION.match(/^1\.13\./)) {}
_emberDataPrivateCore.default.Store = _emberDataPrivateSystemStore.Store;
_emberDataPrivateCore.default.PromiseArray = _emberDataPrivateSystemPromiseProxies.PromiseArray;
_emberDataPrivateCore.default.PromiseObject = _emberDataPrivateSystemPromiseProxies.PromiseObject;
_emberDataPrivateCore.default.PromiseManyArray = _emberDataPrivateSystemPromiseProxies.PromiseManyArray;
_emberDataPrivateCore.default.Model = _emberDataModel.default;
_emberDataPrivateCore.default.RootState = _emberDataPrivateSystemModel.RootState;
_emberDataPrivateCore.default.attr = _emberDataPrivateSystemModel.attr;
_emberDataPrivateCore.default.Errors = _emberDataPrivateSystemModel.Errors;
_emberDataPrivateCore.default.InternalModel = _emberDataPrivateSystemModelInternalModel.default;
_emberDataPrivateCore.default.Snapshot = _emberDataPrivateSystemSnapshot.default;
_emberDataPrivateCore.default.Adapter = _emberDataAdapter.default;
_emberDataPrivateCore.default.AdapterError = _emberDataPrivateAdaptersErrors.AdapterError;
_emberDataPrivateCore.default.InvalidError = _emberDataPrivateAdaptersErrors.InvalidError;
_emberDataPrivateCore.default.TimeoutError = _emberDataPrivateAdaptersErrors.TimeoutError;
_emberDataPrivateCore.default.AbortError = _emberDataPrivateAdaptersErrors.AbortError;
_emberDataPrivateCore.default.errorsHashToArray = _emberDataPrivateAdaptersErrors.errorsHashToArray;
_emberDataPrivateCore.default.errorsArrayToHash = _emberDataPrivateAdaptersErrors.errorsArrayToHash;
_emberDataPrivateCore.default.Serializer = _emberDataSerializer.default;
_emberDataPrivateCore.default.DebugAdapter = _emberDataPrivateSystemDebug.default;
_emberDataPrivateCore.default.RecordArray = _emberDataPrivateSystemRecordArrays.RecordArray;
_emberDataPrivateCore.default.FilteredRecordArray = _emberDataPrivateSystemRecordArrays.FilteredRecordArray;
_emberDataPrivateCore.default.AdapterPopulatedRecordArray = _emberDataPrivateSystemRecordArrays.AdapterPopulatedRecordArray;
_emberDataPrivateCore.default.ManyArray = _emberDataPrivateSystemManyArray.default;
_emberDataPrivateCore.default.RecordArrayManager = _emberDataPrivateSystemRecordArrayManager.default;
_emberDataPrivateCore.default.RESTAdapter = _emberDataPrivateAdapters.RESTAdapter;
_emberDataPrivateCore.default.BuildURLMixin = _emberDataPrivateAdaptersBuildUrlMixin.default;
_emberDataPrivateCore.default.RESTSerializer = _emberDataPrivateSerializers.RESTSerializer;
_emberDataPrivateCore.default.JSONSerializer = _emberDataPrivateSerializers.JSONSerializer;
_emberDataPrivateCore.default.JSONAPIAdapter = _emberDataPrivateAdapters.JSONAPIAdapter;
_emberDataPrivateCore.default.JSONAPISerializer = _emberDataPrivateSerializers.JSONAPISerializer;
_emberDataPrivateCore.default.Transform = _emberDataPrivateTransforms.Transform;
_emberDataPrivateCore.default.DateTransform = _emberDataPrivateTransforms.DateTransform;
_emberDataPrivateCore.default.StringTransform = _emberDataPrivateTransforms.StringTransform;
_emberDataPrivateCore.default.NumberTransform = _emberDataPrivateTransforms.NumberTransform;
_emberDataPrivateCore.default.BooleanTransform = _emberDataPrivateTransforms.BooleanTransform;
_emberDataPrivateCore.default.EmbeddedRecordsMixin = _emberDataSerializersEmbeddedRecordsMixin.default;
_emberDataPrivateCore.default.belongsTo = _emberDataRelationships.belongsTo;
_emberDataPrivateCore.default.hasMany = _emberDataRelationships.hasMany;
_emberDataPrivateCore.default.Relationship = _emberDataPrivateSystemRelationshipsStateRelationship.default;
_emberDataPrivateCore.default.ContainerProxy = _emberDataPrivateSystemContainerProxy.default;
_emberDataPrivateCore.default._setupContainer = _emberDataSetupContainer.default;
_emberDataPrivateCore.default._initializeStoreService = _emberDataPrivateInstanceInitializersInitializeStoreService.default;
Object.defineProperty(_emberDataPrivateCore.default, 'normalizeModelName', {
enumerable: true,
writable: false,
configurable: false,
value: _emberDataPrivateSystemNormalizeModelName.default
});
_ember.default.lookup.DS = _emberDataPrivateCore.default;
exports.default = _emberDataPrivateCore.default;
});
define("ember-data/model", ["exports", "ember-data/-private/system/model"], function (exports, _emberDataPrivateSystemModel) {
exports.default = _emberDataPrivateSystemModel.default;
});
define("ember-data/relationships", ["exports", "ember-data/-private/system/relationships/belongs-to", "ember-data/-private/system/relationships/has-many"], function (exports, _emberDataPrivateSystemRelationshipsBelongsTo, _emberDataPrivateSystemRelationshipsHasMany) {
exports.belongsTo = _emberDataPrivateSystemRelationshipsBelongsTo.default;
exports.hasMany = _emberDataPrivateSystemRelationshipsHasMany.default;
});
/**
@module ember-data
*/
define('ember-data/serializer', ['exports', 'ember'], function (exports, _ember) {
/**
`DS.Serializer` is an abstract base class that you should override in your
application to customize it for your backend. The minimum set of methods
that you should implement is:
* `normalizeResponse()`
* `serialize()`
And you can optionally override the following methods:
* `normalize()`
For an example implementation, see
[DS.JSONSerializer](DS.JSONSerializer.html), the included JSON serializer.
@class Serializer
@namespace DS
@extends Ember.Object
*/
exports.default = _ember.default.Object.extend({
/**
The `store` property is the application's `store` that contains all records.
It's injected as a service.
It can be used to push records from a non flat data structure server
response.
@property store
@type {DS.Store}
@public
*/
/**
The `normalizeResponse` method is used to normalize a payload from the
server to a JSON-API Document.
http://jsonapi.org/format/#document-structure
@method normalizeResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeResponse: null,
/**
The `serialize` method is used when a record is saved in order to convert
the record into the form that your external data source expects.
`serialize` takes an optional `options` hash with a single option:
- `includeId`: If this is `true`, `serialize` should include the ID
in the serialized object it builds.
@method serialize
@param {DS.Model} record
@param {Object} [options]
@return {Object}
*/
serialize: null,
/**
The `normalize` method is used to convert a payload received from your
external data source into the normalized form `store.push()` expects. You
should override this method, munge the hash and return the normalized
payload.
@method normalize
@param {DS.Model} typeClass
@param {Object} hash
@return {Object}
*/
normalize: function (typeClass, hash) {
return hash;
}
});
});
/**
@module ember-data
*/
define('ember-data/serializers/embedded-records-mixin', ['exports', 'ember', 'ember-data/-private/debug'], function (exports, _ember, _emberDataPrivateDebug) {
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
var get = _ember.default.get;
var set = _ember.default.set;
var camelize = _ember.default.String.camelize;
/**
## Using Embedded Records
`DS.EmbeddedRecordsMixin` supports serializing embedded records.
To set up embedded records, include the mixin when extending a serializer,
then define and configure embedded (model) relationships.
Below is an example of a per-type serializer (`post` type).
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
author: { embedded: 'always' },
comments: { serialize: 'ids' }
}
});
```
Note that this use of `{ embedded: 'always' }` is unrelated to
the `{ embedded: 'always' }` that is defined as an option on `DS.attr` as part of
defining a model while working with the `ActiveModelSerializer`. Nevertheless,
using `{ embedded: 'always' }` as an option to `DS.attr` is not a valid way to setup
embedded records.
The `attrs` option for a resource `{ embedded: 'always' }` is shorthand for:
```js
{
serialize: 'records',
deserialize: 'records'
}
```
### Configuring Attrs
A resource's `attrs` option may be set to use `ids`, `records` or false for the
`serialize` and `deserialize` settings.
The `attrs` property can be set on the `ApplicationSerializer` or a per-type
serializer.
In the case where embedded JSON is expected while extracting a payload (reading)
the setting is `deserialize: 'records'`, there is no need to use `ids` when
extracting as that is the default behavior without this mixin if you are using
the vanilla `EmbeddedRecordsMixin`. Likewise, to embed JSON in the payload while
serializing `serialize: 'records'` is the setting to use. There is an option of
not embedding JSON in the serialized payload by using `serialize: 'ids'`. If you
do not want the relationship sent at all, you can use `serialize: false`.
### EmbeddedRecordsMixin defaults
If you do not overwrite `attrs` for a specific relationship, the `EmbeddedRecordsMixin`
will behave in the following way:
BelongsTo: `{ serialize: 'id', deserialize: 'id' }`
HasMany: `{ serialize: false, deserialize: 'ids' }`
### Model Relationships
Embedded records must have a model defined to be extracted and serialized. Note that
when defining any relationships on your model such as `belongsTo` and `hasMany`, you
should not both specify `async: true` and also indicate through the serializer's
`attrs` attribute that the related model should be embedded for deserialization.
If a model is declared embedded for deserialization (`embedded: 'always'` or `deserialize: 'records'`),
then do not use `async: true`.
To successfully extract and serialize embedded records the model relationships
must be setup correcty. See the
[defining relationships](/guides/models/defining-models/#toc_defining-relationships)
section of the **Defining Models** guide page.
Records without an `id` property are not considered embedded records, model
instances must have an `id` property to be used with Ember Data.
### Example JSON payloads, Models and Serializers
**When customizing a serializer it is important to grok what the customizations
are. Please read the docs for the methods this mixin provides, in case you need
to modify it to fit your specific needs.**
For example review the docs for each method of this mixin:
* [normalize](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_normalize)
* [serializeBelongsTo](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeBelongsTo)
* [serializeHasMany](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeHasMany)
@class EmbeddedRecordsMixin
@namespace DS
*/
exports.default = _ember.default.Mixin.create({
/**
Normalize the record and recursively normalize/extract all the embedded records
while pushing them into the store as they are encountered
A payload with an attr configured for embedded records needs to be extracted:
```js
{
"post": {
"id": "1"
"title": "Rails is omakase",
"comments": [{
"id": "1",
"body": "Rails is unagi"
}, {
"id": "2",
"body": "Omakase O_o"
}]
}
}
```
@method normalize
@param {DS.Model} typeClass
@param {Object} hash to be normalized
@param {String} prop the hash has been referenced by
@return {Object} the normalized hash
**/
normalize: function (typeClass, hash, prop) {
var normalizedHash = this._super(typeClass, hash, prop);
return this._extractEmbeddedRecords(this, this.store, typeClass, normalizedHash);
},
keyForRelationship: function (key, typeClass, method) {
if (method === 'serialize' && this.hasSerializeRecordsOption(key) || method === 'deserialize' && this.hasDeserializeRecordsOption(key)) {
return this.keyForAttribute(key, method);
} else {
return this._super(key, typeClass, method) || key;
}
},
/**
Serialize `belongsTo` relationship when it is configured as an embedded object.
This example of an author model belongs to a post model:
```js
Post = DS.Model.extend({
title: DS.attr('string'),
body: DS.attr('string'),
author: DS.belongsTo('author')
});
Author = DS.Model.extend({
name: DS.attr('string'),
post: DS.belongsTo('post')
});
```
Use a custom (type) serializer for the post model to configure embedded author
```app/serializers/post.js
import DS from 'ember-data;
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
author: { embedded: 'always' }
}
})
```
A payload with an attribute configured for embedded records can serialize
the records together under the root attribute's payload:
```js
{
"post": {
"id": "1"
"title": "Rails is omakase",
"author": {
"id": "2"
"name": "dhh"
}
}
}
```
@method serializeBelongsTo
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeBelongsTo: function (snapshot, json, relationship) {
var attr = relationship.key;
if (this.noSerializeOptionSpecified(attr)) {
this._super(snapshot, json, relationship);
return;
}
var includeIds = this.hasSerializeIdsOption(attr);
var includeRecords = this.hasSerializeRecordsOption(attr);
var embeddedSnapshot = snapshot.belongsTo(attr);
var key;
if (includeIds) {
key = this.keyForRelationship(attr, relationship.kind, 'serialize');
if (!embeddedSnapshot) {
json[key] = null;
} else {
json[key] = embeddedSnapshot.id;
if (relationship.options.polymorphic) {
this.serializePolymorphicType(snapshot, json, relationship);
}
}
} else if (includeRecords) {
this._serializeEmbeddedBelongsTo(snapshot, json, relationship);
}
},
_serializeEmbeddedBelongsTo: function (snapshot, json, relationship) {
var embeddedSnapshot = snapshot.belongsTo(relationship.key);
var serializedKey = this._getMappedKey(relationship.key, snapshot.type);
if (serializedKey === relationship.key && this.keyForRelationship) {
serializedKey = this.keyForRelationship(relationship.key, relationship.kind, "serialize");
}
if (!embeddedSnapshot) {
json[serializedKey] = null;
} else {
json[serializedKey] = embeddedSnapshot.record.serialize({ includeId: true });
this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, json[serializedKey]);
if (relationship.options.polymorphic) {
this.serializePolymorphicType(snapshot, json, relationship);
}
}
},
/**
Serialize `hasMany` relationship when it is configured as embedded objects.
This example of a post model has many comments:
```js
Post = DS.Model.extend({
title: DS.attr('string'),
body: DS.attr('string'),
comments: DS.hasMany('comment')
});
Comment = DS.Model.extend({
body: DS.attr('string'),
post: DS.belongsTo('post')
});
```
Use a custom (type) serializer for the post model to configure embedded comments
```app/serializers/post.js
import DS from 'ember-data;
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
comments: { embedded: 'always' }
}
})
```
A payload with an attribute configured for embedded records can serialize
the records together under the root attribute's payload:
```js
{
"post": {
"id": "1"
"title": "Rails is omakase",
"body": "I want this for my ORM, I want that for my template language..."
"comments": [{
"id": "1",
"body": "Rails is unagi"
}, {
"id": "2",
"body": "Omakase O_o"
}]
}
}
```
The attrs options object can use more specific instruction for extracting and
serializing. When serializing, an option to embed `ids` or `records` can be set.
When extracting the only option is `records`.
So `{ embedded: 'always' }` is shorthand for:
`{ serialize: 'records', deserialize: 'records' }`
To embed the `ids` for a related object (using a hasMany relationship):
```app/serializers/post.js
import DS from 'ember-data;
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
comments: { serialize: 'ids', deserialize: 'records' }
}
})
```
```js
{
"post": {
"id": "1"
"title": "Rails is omakase",
"body": "I want this for my ORM, I want that for my template language..."
"comments": ["1", "2"]
}
}
```
@method serializeHasMany
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeHasMany: function (snapshot, json, relationship) {
var attr = relationship.key;
if (this.noSerializeOptionSpecified(attr)) {
this._super(snapshot, json, relationship);
return;
}
var includeIds = this.hasSerializeIdsOption(attr);
var includeRecords = this.hasSerializeRecordsOption(attr);
if (includeIds) {
var serializedKey = this.keyForRelationship(attr, relationship.kind, 'serialize');
json[serializedKey] = snapshot.hasMany(attr, { ids: true });
} else if (includeRecords) {
this._serializeEmbeddedHasMany(snapshot, json, relationship);
}
},
_serializeEmbeddedHasMany: function (snapshot, json, relationship) {
var serializedKey = this._getMappedKey(relationship.key, snapshot.type);
if (serializedKey === relationship.key && this.keyForRelationship) {
serializedKey = this.keyForRelationship(relationship.key, relationship.kind, "serialize");
}
json[serializedKey] = this._generateSerializedHasMany(snapshot, relationship);
},
/*
Returns an array of embedded records serialized to JSON
*/
_generateSerializedHasMany: function (snapshot, relationship) {
var hasMany = snapshot.hasMany(relationship.key);
var manyArray = _ember.default.A(hasMany);
var ret = new Array(manyArray.length);
for (var i = 0; i < manyArray.length; i++) {
var embeddedSnapshot = manyArray[i];
var embeddedJson = embeddedSnapshot.record.serialize({ includeId: true });
this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, embeddedJson);
ret[i] = embeddedJson;
}
return ret;
},
/**
When serializing an embedded record, modify the property (in the json payload)
that refers to the parent record (foreign key for relationship).
Serializing a `belongsTo` relationship removes the property that refers to the
parent record
Serializing a `hasMany` relationship does not remove the property that refers to
the parent record.
@method removeEmbeddedForeignKey
@param {DS.Snapshot} snapshot
@param {DS.Snapshot} embeddedSnapshot
@param {Object} relationship
@param {Object} json
*/
removeEmbeddedForeignKey: function (snapshot, embeddedSnapshot, relationship, json) {
if (relationship.kind === 'hasMany') {
return;
} else if (relationship.kind === 'belongsTo') {
var parentRecord = snapshot.type.inverseFor(relationship.key, this.store);
if (parentRecord) {
var name = parentRecord.name;
var embeddedSerializer = this.store.serializerFor(embeddedSnapshot.modelName);
var parentKey = embeddedSerializer.keyForRelationship(name, parentRecord.kind, 'deserialize');
if (parentKey) {
delete json[parentKey];
}
}
}
},
// checks config for attrs option to embedded (always) - serialize and deserialize
hasEmbeddedAlwaysOption: function (attr) {
var option = this.attrsOption(attr);
return option && option.embedded === 'always';
},
// checks config for attrs option to serialize ids
hasSerializeRecordsOption: function (attr) {
var alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);
var option = this.attrsOption(attr);
return alwaysEmbed || option && option.serialize === 'records';
},
// checks config for attrs option to serialize records
hasSerializeIdsOption: function (attr) {
var option = this.attrsOption(attr);
return option && (option.serialize === 'ids' || option.serialize === 'id');
},
// checks config for attrs option to serialize records
noSerializeOptionSpecified: function (attr) {
var option = this.attrsOption(attr);
return !(option && (option.serialize || option.embedded));
},
// checks config for attrs option to deserialize records
// a defined option object for a resource is treated the same as
// `deserialize: 'records'`
hasDeserializeRecordsOption: function (attr) {
var alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);
var option = this.attrsOption(attr);
return alwaysEmbed || option && option.deserialize === 'records';
},
attrsOption: function (attr) {
var attrs = this.get('attrs');
return attrs && (attrs[camelize(attr)] || attrs[attr]);
},
/**
@method _extractEmbeddedRecords
@private
*/
_extractEmbeddedRecords: function (serializer, store, typeClass, partial) {
var _this = this;
typeClass.eachRelationship(function (key, relationship) {
if (serializer.hasDeserializeRecordsOption(key)) {
if (relationship.kind === "hasMany") {
_this._extractEmbeddedHasMany(store, key, partial, relationship);
}
if (relationship.kind === "belongsTo") {
_this._extractEmbeddedBelongsTo(store, key, partial, relationship);
}
}
});
return partial;
},
/**
@method _extractEmbeddedHasMany
@private
*/
_extractEmbeddedHasMany: function (store, key, hash, relationshipMeta) {
var relationshipHash = get(hash, 'data.relationships.' + key + '.data');
if (!relationshipHash) {
return;
}
var hasMany = new Array(relationshipHash.length);
for (var i = 0; i < relationshipHash.length; i++) {
var item = relationshipHash[i];
var _normalizeEmbeddedRelationship = this._normalizeEmbeddedRelationship(store, relationshipMeta, item);
var data = _normalizeEmbeddedRelationship.data;
var included = _normalizeEmbeddedRelationship.included;
hash.included = hash.included || [];
hash.included.push(data);
if (included) {
var _hash$included;
(_hash$included = hash.included).push.apply(_hash$included, _toConsumableArray(included));
}
hasMany[i] = { id: data.id, type: data.type };
}
var relationship = { data: hasMany };
set(hash, 'data.relationships.' + key, relationship);
},
/**
@method _extractEmbeddedBelongsTo
@private
*/
_extractEmbeddedBelongsTo: function (store, key, hash, relationshipMeta) {
var relationshipHash = get(hash, 'data.relationships.' + key + '.data');
if (!relationshipHash) {
return;
}
var _normalizeEmbeddedRelationship2 = this._normalizeEmbeddedRelationship(store, relationshipMeta, relationshipHash);
var data = _normalizeEmbeddedRelationship2.data;
var included = _normalizeEmbeddedRelationship2.included;
hash.included = hash.included || [];
hash.included.push(data);
if (included) {
var _hash$included2;
(_hash$included2 = hash.included).push.apply(_hash$included2, _toConsumableArray(included));
}
var belongsTo = { id: data.id, type: data.type };
var relationship = { data: belongsTo };
set(hash, 'data.relationships.' + key, relationship);
},
/**
@method _normalizeEmbeddedRelationship
@private
*/
_normalizeEmbeddedRelationship: function (store, relationshipMeta, relationshipHash) {
var modelName = relationshipMeta.type;
if (relationshipMeta.options.polymorphic) {
modelName = relationshipHash.type;
}
var modelClass = store.modelFor(modelName);
var serializer = store.serializerFor(modelName);
return serializer.normalize(modelClass, relationshipHash, null);
}
});
});
define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-private/debug', 'ember-data/serializers/json', 'ember-data/-private/system/normalize-model-name', 'ember-inflector', 'ember-data/-private/features'], function (exports, _ember, _emberDataPrivateDebug, _emberDataSerializersJson, _emberDataPrivateSystemNormalizeModelName, _emberInflector, _emberDataPrivateFeatures) {
var dasherize = _ember.default.String.dasherize;
/**
Ember Data 2.0 Serializer:
In Ember Data a Serializer is used to serialize and deserialize
records when they are transferred in and out of an external source.
This process involves normalizing property names, transforming
attribute values and serializing relationships.
`JSONAPISerializer` supports the http://jsonapi.org/ spec and is the
serializer recommended by Ember Data.
This serializer normalizes a JSON API payload that looks like:
```js
// models/player.js
import DS from "ember-data";
export default DS.Model.extend({
name: DS.attr(),
skill: DS.attr(),
gamesPlayed: DS.attr(),
club: DS.belongsTo('club')
});
// models/club.js
import DS from "ember-data";
export default DS.Model.extend({
name: DS.attr(),
location: DS.attr(),
players: DS.hasMany('player')
});
```
```js
{
"data": [
{
"attributes": {
"name": "Benfica",
"location": "Portugal"
},
"id": "1",
"relationships": {
"players": {
"data": [
{
"id": "3",
"type": "players"
}
]
}
},
"type": "clubs"
}
],
"included": [
{
"attributes": {
"name": "Eusebio Silva Ferreira",
"skill": "Rocket shot",
"games-played": 431
},
"id": "3",
"relationships": {
"club": {
"data": {
"id": "1",
"type": "clubs"
}
}
},
"type": "players"
}
]
}
```
to the format that the Ember Data store expects.
@class JSONAPISerializer
@namespace DS
@extends DS.JSONSerializer
*/
var JSONAPISerializer = _emberDataSerializersJson.default.extend({
/**
@method _normalizeDocumentHelper
@param {Object} documentHash
@return {Object}
@private
*/
_normalizeDocumentHelper: function (documentHash) {
if (_ember.default.typeOf(documentHash.data) === 'object') {
documentHash.data = this._normalizeResourceHelper(documentHash.data);
} else if (Array.isArray(documentHash.data)) {
var ret = new Array(documentHash.data.length);
for (var i = 0; i < documentHash.data.length; i++) {
var data = documentHash.data[i];
ret[i] = this._normalizeResourceHelper(data);
}
documentHash.data = ret;
}
if (Array.isArray(documentHash.included)) {
var ret = new Array(documentHash.included.length);
for (var i = 0; i < documentHash.included.length; i++) {
var included = documentHash.included[i];
ret[i] = this._normalizeResourceHelper(included);
}
documentHash.included = ret;
}
return documentHash;
},
/**
@method _normalizeRelationshipDataHelper
@param {Object} relationshipDataHash
@return {Object}
@private
*/
_normalizeRelationshipDataHelper: function (relationshipDataHash) {
var type = this.modelNameFromPayloadKey(relationshipDataHash.type);
relationshipDataHash.type = type;
return relationshipDataHash;
},
/**
@method _normalizeResourceHelper
@param {Object} resourceHash
@return {Object}
@private
*/
_normalizeResourceHelper: function (resourceHash) {
var modelName = this.modelNameFromPayloadKey(resourceHash.type);
if (!this.store._hasModelFor(modelName)) {
return null;
}
var modelClass = this.store.modelFor(modelName);
var serializer = this.store.serializerFor(modelName);
var _serializer$normalize = serializer.normalize(modelClass, resourceHash);
var data = _serializer$normalize.data;
return data;
},
/**
@method pushPayload
@param {DS.Store} store
@param {Object} payload
*/
pushPayload: function (store, payload) {
var normalizedPayload = this._normalizeDocumentHelper(payload);
store.push(normalizedPayload);
},
/**
@method _normalizeResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@param {Boolean} isSingle
@return {Object} JSON-API Document
@private
*/
_normalizeResponse: function (store, primaryModelClass, payload, id, requestType, isSingle) {
var normalizedPayload = this._normalizeDocumentHelper(payload);
return normalizedPayload;
},
/**
@method extractAttributes
@param {DS.Model} modelClass
@param {Object} resourceHash
@return {Object}
*/
extractAttributes: function (modelClass, resourceHash) {
var _this = this;
var attributes = {};
if (resourceHash.attributes) {
modelClass.eachAttribute(function (key) {
var attributeKey = _this.keyForAttribute(key, 'deserialize');
if (resourceHash.attributes.hasOwnProperty(attributeKey)) {
attributes[key] = resourceHash.attributes[attributeKey];
}
});
}
return attributes;
},
/**
@method extractRelationship
@param {Object} relationshipHash
@return {Object}
*/
extractRelationship: function (relationshipHash) {
if (_ember.default.typeOf(relationshipHash.data) === 'object') {
relationshipHash.data = this._normalizeRelationshipDataHelper(relationshipHash.data);
}
if (Array.isArray(relationshipHash.data)) {
var ret = new Array(relationshipHash.data.length);
for (var i = 0; i < relationshipHash.data.length; i++) {
var data = relationshipHash.data[i];
ret[i] = this._normalizeRelationshipDataHelper(data);
}
relationshipHash.data = ret;
}
return relationshipHash;
},
/**
@method extractRelationships
@param {Object} modelClass
@param {Object} resourceHash
@return {Object}
*/
extractRelationships: function (modelClass, resourceHash) {
var _this2 = this;
var relationships = {};
if (resourceHash.relationships) {
modelClass.eachRelationship(function (key, relationshipMeta) {
var relationshipKey = _this2.keyForRelationship(key, relationshipMeta.kind, 'deserialize');
if (resourceHash.relationships.hasOwnProperty(relationshipKey)) {
var relationshipHash = resourceHash.relationships[relationshipKey];
relationships[key] = _this2.extractRelationship(relationshipHash);
}
});
}
return relationships;
},
/**
@method _extractType
@param {DS.Model} modelClass
@param {Object} resourceHash
@return {String}
@private
*/
_extractType: function (modelClass, resourceHash) {
return this.modelNameFromPayloadKey(resourceHash.type);
},
/**
@method modelNameFromPayloadKey
@param {String} key
@return {String} the model's modelName
*/
modelNameFromPayloadKey: function (key) {
return (0, _emberInflector.singularize)((0, _emberDataPrivateSystemNormalizeModelName.default)(key));
},
/**
@method payloadKeyFromModelName
@param {String} modelName
@return {String}
*/
payloadKeyFromModelName: function (modelName) {
return (0, _emberInflector.pluralize)(modelName);
},
/**
@method normalize
@param {DS.Model} modelClass
@param {Object} resourceHash the resource hash from the adapter
@return {Object} the normalized resource hash
*/
normalize: function (modelClass, resourceHash) {
if (resourceHash.attributes) {
this.normalizeUsingDeclaredMapping(modelClass, resourceHash.attributes);
}
if (resourceHash.relationships) {
this.normalizeUsingDeclaredMapping(modelClass, resourceHash.relationships);
}
var data = {
id: this.extractId(modelClass, resourceHash),
type: this._extractType(modelClass, resourceHash),
attributes: this.extractAttributes(modelClass, resourceHash),
relationships: this.extractRelationships(modelClass, resourceHash)
};
this.applyTransforms(modelClass, data.attributes);
return { data: data };
},
/**
`keyForAttribute` can be used to define rules for how to convert an
attribute name in your model to a key in your JSON.
By default `JSONAPISerializer` follows the format used on the examples of
http://jsonapi.org/format and uses dashes as the word separator in the JSON
attribute keys.
This behaviour can be easily customized by extending this method.
Example
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONAPISerializer.extend({
keyForAttribute: function(attr, method) {
return Ember.String.dasherize(attr).toUpperCase();
}
});
```
@method keyForAttribute
@param {String} key
@param {String} method
@return {String} normalized key
*/
keyForAttribute: function (key, method) {
return dasherize(key);
},
/**
`keyForRelationship` can be used to define a custom key when
serializing and deserializing relationship properties.
By default `JSONAPISerializer` follows the format used on the examples of
http://jsonapi.org/format and uses dashes as word separators in
relationship properties.
This behaviour can be easily customized by extending this method.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONAPISerializer.extend({
keyForRelationship: function(key, relationship, method) {
return Ember.String.underscore(key);
}
});
```
@method keyForRelationship
@param {String} key
@param {String} typeClass
@param {String} method
@return {String} normalized key
*/
keyForRelationship: function (key, typeClass, method) {
return dasherize(key);
},
/**
@method serialize
@param {DS.Snapshot} snapshot
@param {Object} options
@return {Object} json
*/
serialize: function (snapshot, options) {
var data = this._super.apply(this, arguments);
data.type = this.payloadKeyFromModelName(snapshot.modelName);
return { data: data };
},
/**
@method serializeAttribute
@param {DS.Snapshot} snapshot
@param {Object} json
@param {String} key
@param {Object} attribute
*/
serializeAttribute: function (snapshot, json, key, attribute) {
var type = attribute.type;
if (this._canSerialize(key)) {
json.attributes = json.attributes || {};
var value = snapshot.attr(key);
if (type) {
var transform = this.transformFor(type);
value = transform.serialize(value);
}
var payloadKey = this._getMappedKey(key, snapshot.type);
if (payloadKey === key) {
payloadKey = this.keyForAttribute(key, 'serialize');
}
json.attributes[payloadKey] = value;
}
},
/**
@method serializeBelongsTo
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeBelongsTo: function (snapshot, json, relationship) {
var key = relationship.key;
if (this._canSerialize(key)) {
var belongsTo = snapshot.belongsTo(key);
if (belongsTo !== undefined) {
json.relationships = json.relationships || {};
var payloadKey = this._getMappedKey(key, snapshot.type);
if (payloadKey === key) {
payloadKey = this.keyForRelationship(key, 'belongsTo', 'serialize');
}
var data = null;
if (belongsTo) {
data = {
type: this.payloadKeyFromModelName(belongsTo.modelName),
id: belongsTo.id
};
}
json.relationships[payloadKey] = { data: data };
}
}
},
/**
@method serializeHasMany
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeHasMany: function (snapshot, json, relationship) {
var key = relationship.key;
if (this._shouldSerializeHasMany(snapshot, key, relationship)) {
var hasMany = snapshot.hasMany(key);
if (hasMany !== undefined) {
json.relationships = json.relationships || {};
var payloadKey = this._getMappedKey(key, snapshot.type);
if (payloadKey === key && this.keyForRelationship) {
payloadKey = this.keyForRelationship(key, 'hasMany', 'serialize');
}
var data = new Array(hasMany.length);
for (var i = 0; i < hasMany.length; i++) {
var item = hasMany[i];
data[i] = {
type: this.payloadKeyFromModelName(item.modelName),
id: item.id
};
}
json.relationships[payloadKey] = { data: data };
}
}
}
});
exports.default = JSONAPISerializer;
});
/**
@module ember-data
*/
define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-private/debug', 'ember-data/serializer', 'ember-data/-private/system/coerce-id', 'ember-data/-private/system/normalize-model-name', 'ember-data/-private/utils', 'ember-data/-private/adapters/errors', 'ember-data/-private/features'], function (exports, _ember, _emberDataPrivateDebug, _emberDataSerializer, _emberDataPrivateSystemCoerceId, _emberDataPrivateSystemNormalizeModelName, _emberDataPrivateUtils, _emberDataPrivateAdaptersErrors, _emberDataPrivateFeatures) {
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
var get = _ember.default.get;
var isNone = _ember.default.isNone;
var assign = _ember.default.assign || _ember.default.merge;
/**
Ember Data 2.0 Serializer:
In Ember Data a Serializer is used to serialize and deserialize
records when they are transferred in and out of an external source.
This process involves normalizing property names, transforming
attribute values and serializing relationships.
By default, Ember Data uses and recommends the `JSONAPISerializer`.
`JSONSerializer` is useful for simpler or legacy backends that may
not support the http://jsonapi.org/ spec.
For example, given the following `User` model and JSON payload:
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
friends: DS.hasMany('user'),
house: DS.belongsTo('location'),
name: DS.attr('string')
});
```
```js
{
id: 1,
name: 'Sebastian',
friends: [3, 4],
links: {
house: '/houses/lefkada'
}
}
```
`JSONSerializer` will normalize the JSON payload to the JSON API format that the
Ember Data store expects.
You can customize how JSONSerializer processes its payload by passing options in
the `attrs` hash or by subclassing the `JSONSerializer` and overriding hooks:
- To customize how a single record is normalized, use the `normalize` hook.
- To customize how `JSONSerializer` normalizes the whole server response, use the
`normalizeResponse` hook.
- To customize how `JSONSerializer` normalizes a specific response from the server,
use one of the many specific `normalizeResponse` hooks.
- To customize how `JSONSerializer` normalizes your id, attributes or relationships,
use the `extractId`, `extractAttributes` and `extractRelationships` hooks.
The `JSONSerializer` normalization process follows these steps:
- `normalizeResponse` - entry method to the serializer.
- `normalizeCreateRecordResponse` - a `normalizeResponse` for a specific operation is called.
- `normalizeSingleResponse`|`normalizeArrayResponse` - for methods like `createRecord` we expect
a single record back, while for methods like `findAll` we expect multiple methods back.
- `normalize` - `normalizeArray` iterates and calls `normalize` for each of its records while `normalizeSingle`
calls it once. This is the method you most likely want to subclass.
- `extractId` | `extractAttributes` | `extractRelationships` - `normalize` delegates to these methods to
turn the record payload into the JSON API format.
@class JSONSerializer
@namespace DS
@extends DS.Serializer
*/
exports.default = _emberDataSerializer.default.extend({
/**
The `primaryKey` is used when serializing and deserializing
data. Ember Data always uses the `id` property to store the id of
the record. The external source may not always follow this
convention. In these cases it is useful to override the
`primaryKey` property to match the `primaryKey` of your external
store.
Example
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
primaryKey: '_id'
});
```
@property primaryKey
@type {String}
@default 'id'
*/
primaryKey: 'id',
/**
The `attrs` object can be used to declare a simple mapping between
property names on `DS.Model` records and payload keys in the
serialized JSON object representing the record. An object with the
property `key` can also be used to designate the attribute's key on
the response payload.
Example
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
occupation: DS.attr('string'),
admin: DS.attr('boolean')
});
```
```app/serializers/person.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
attrs: {
admin: 'is_admin',
occupation: { key: 'career' }
}
});
```
You can also remove attributes by setting the `serialize` key to
`false` in your mapping object.
Example
```app/serializers/person.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
attrs: {
admin: { serialize: false },
occupation: { key: 'career' }
}
});
```
When serialized:
```javascript
{
"firstName": "Harry",
"lastName": "Houdini",
"career": "magician"
}
```
Note that the `admin` is now not included in the payload.
@property attrs
@type {Object}
*/
mergedProperties: ['attrs'],
/**
Given a subclass of `DS.Model` and a JSON object this method will
iterate through each attribute of the `DS.Model` and invoke the
`DS.Transform#deserialize` method on the matching property of the
JSON object. This method is typically called after the
serializer's `normalize` method.
@method applyTransforms
@private
@param {DS.Model} typeClass
@param {Object} data The data to transform
@return {Object} data The transformed data object
*/
applyTransforms: function (typeClass, data) {
var _this = this;
var attributes = undefined;
attributes = get(typeClass, 'attributes');
typeClass.eachTransformedAttribute(function (key, typeClass) {
if (!data.hasOwnProperty(key)) {
return;
}
var transform = _this.transformFor(typeClass);
var transformMeta = attributes.get(key);
data[key] = transform.deserialize(data[key], transformMeta.options);
});
return data;
},
/**
The `normalizeResponse` method is used to normalize a payload from the
server to a JSON-API Document.
http://jsonapi.org/format/#document-structure
This method delegates to a more specific normalize method based on
the `requestType`.
To override this method with a custom one, make sure to call
`return this._super(store, primaryModelClass, payload, id, requestType)` with your
pre-processed data.
Here's an example of using `normalizeResponse` manually:
```javascript
socket.on('message', function(message) {
var data = message.data;
var modelClass = store.modelFor(data.modelName);
var serializer = store.serializerFor(data.modelName);
var normalized = serializer.normalizeSingleResponse(store, modelClass, data, data.id);
store.push(normalized);
});
```
@method normalizeResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeResponse: function (store, primaryModelClass, payload, id, requestType) {
switch (requestType) {
case 'findRecord':
return this.normalizeFindRecordResponse.apply(this, arguments);
case 'queryRecord':
return this.normalizeQueryRecordResponse.apply(this, arguments);
case 'findAll':
return this.normalizeFindAllResponse.apply(this, arguments);
case 'findBelongsTo':
return this.normalizeFindBelongsToResponse.apply(this, arguments);
case 'findHasMany':
return this.normalizeFindHasManyResponse.apply(this, arguments);
case 'findMany':
return this.normalizeFindManyResponse.apply(this, arguments);
case 'query':
return this.normalizeQueryResponse.apply(this, arguments);
case 'createRecord':
return this.normalizeCreateRecordResponse.apply(this, arguments);
case 'deleteRecord':
return this.normalizeDeleteRecordResponse.apply(this, arguments);
case 'updateRecord':
return this.normalizeUpdateRecordResponse.apply(this, arguments);
}
},
/**
@method normalizeFindRecordResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeFindRecordResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSingleResponse.apply(this, arguments);
},
/**
@method normalizeQueryRecordResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeQueryRecordResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSingleResponse.apply(this, arguments);
},
/**
@method normalizeFindAllResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeFindAllResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeArrayResponse.apply(this, arguments);
},
/**
@method normalizeFindBelongsToResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeFindBelongsToResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSingleResponse.apply(this, arguments);
},
/**
@method normalizeFindHasManyResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeFindHasManyResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeArrayResponse.apply(this, arguments);
},
/**
@method normalizeFindManyResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeFindManyResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeArrayResponse.apply(this, arguments);
},
/**
@method normalizeQueryResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeQueryResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeArrayResponse.apply(this, arguments);
},
/**
@method normalizeCreateRecordResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeCreateRecordResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSaveResponse.apply(this, arguments);
},
/**
@method normalizeDeleteRecordResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeDeleteRecordResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSaveResponse.apply(this, arguments);
},
/**
@method normalizeUpdateRecordResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeUpdateRecordResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSaveResponse.apply(this, arguments);
},
/**
@method normalizeSaveResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeSaveResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSingleResponse.apply(this, arguments);
},
/**
@method normalizeSingleResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeSingleResponse: function (store, primaryModelClass, payload, id, requestType) {
return this._normalizeResponse(store, primaryModelClass, payload, id, requestType, true);
},
/**
@method normalizeArrayResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeArrayResponse: function (store, primaryModelClass, payload, id, requestType) {
return this._normalizeResponse(store, primaryModelClass, payload, id, requestType, false);
},
/**
@method _normalizeResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@param {Boolean} isSingle
@return {Object} JSON-API Document
@private
*/
_normalizeResponse: function (store, primaryModelClass, payload, id, requestType, isSingle) {
var documentHash = {
data: null,
included: []
};
var meta = this.extractMeta(store, primaryModelClass, payload);
if (meta) {
documentHash.meta = meta;
}
if (isSingle) {
var _normalize = this.normalize(primaryModelClass, payload);
var data = _normalize.data;
var included = _normalize.included;
documentHash.data = data;
if (included) {
documentHash.included = included;
}
} else {
var ret = new Array(payload.length);
for (var i = 0, l = payload.length; i < l; i++) {
var item = payload[i];
var _normalize2 = this.normalize(primaryModelClass, item);
var data = _normalize2.data;
var included = _normalize2.included;
if (included) {
var _documentHash$included;
(_documentHash$included = documentHash.included).push.apply(_documentHash$included, _toConsumableArray(included));
}
ret[i] = data;
}
documentHash.data = ret;
}
return documentHash;
},
/**
Normalizes a part of the JSON payload returned by
the server. You should override this method, munge the hash
and call super if you have generic normalization to do.
It takes the type of the record that is being normalized
(as a DS.Model class), the property where the hash was
originally found, and the hash to normalize.
You can use this method, for example, to normalize underscored keys to camelized
or other general-purpose normalizations.
Example
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
normalize: function(typeClass, hash) {
var fields = Ember.get(typeClass, 'fields');
fields.forEach(function(field) {
var payloadField = Ember.String.underscore(field);
if (field === payloadField) { return; }
hash[field] = hash[payloadField];
delete hash[payloadField];
});
return this._super.apply(this, arguments);
}
});
```
@method normalize
@param {DS.Model} typeClass
@param {Object} hash
@return {Object}
*/
normalize: function (modelClass, resourceHash) {
var data = null;
if (resourceHash) {
this.normalizeUsingDeclaredMapping(modelClass, resourceHash);
if (_ember.default.typeOf(resourceHash.links) === 'object') {
this.normalizeUsingDeclaredMapping(modelClass, resourceHash.links);
}
data = {
id: this.extractId(modelClass, resourceHash),
type: modelClass.modelName,
attributes: this.extractAttributes(modelClass, resourceHash),
relationships: this.extractRelationships(modelClass, resourceHash)
};
this.applyTransforms(modelClass, data.attributes);
}
return { data: data };
},
/**
Returns the resource's ID.
@method extractId
@param {Object} modelClass
@param {Object} resourceHash
@return {String}
*/
extractId: function (modelClass, resourceHash) {
var primaryKey = get(this, 'primaryKey');
var id = resourceHash[primaryKey];
return (0, _emberDataPrivateSystemCoerceId.default)(id);
},
/**
Returns the resource's attributes formatted as a JSON-API "attributes object".
http://jsonapi.org/format/#document-resource-object-attributes
@method extractAttributes
@param {Object} modelClass
@param {Object} resourceHash
@return {Object}
*/
extractAttributes: function (modelClass, resourceHash) {
var _this2 = this;
var attributeKey;
var attributes = {};
modelClass.eachAttribute(function (key) {
attributeKey = _this2.keyForAttribute(key, 'deserialize');
if (resourceHash.hasOwnProperty(attributeKey)) {
attributes[key] = resourceHash[attributeKey];
}
});
return attributes;
},
/**
Returns a relationship formatted as a JSON-API "relationship object".
http://jsonapi.org/format/#document-resource-object-relationships
@method extractRelationship
@param {Object} relationshipModelName
@param {Object} relationshipHash
@return {Object}
*/
extractRelationship: function (relationshipModelName, relationshipHash) {
if (_ember.default.isNone(relationshipHash)) {
return null;
}
/*
When `relationshipHash` is an object it usually means that the relationship
is polymorphic. It could however also be embedded resources that the
EmbeddedRecordsMixin has be able to process.
*/
if (_ember.default.typeOf(relationshipHash) === 'object') {
if (relationshipHash.id) {
relationshipHash.id = (0, _emberDataPrivateSystemCoerceId.default)(relationshipHash.id);
}
var modelClass = this.store.modelFor(relationshipModelName);
if (relationshipHash.type && !(0, _emberDataPrivateUtils.modelHasAttributeOrRelationshipNamedType)(modelClass)) {
relationshipHash.type = this.modelNameFromPayloadKey(relationshipHash.type);
}
return relationshipHash;
}
return { id: (0, _emberDataPrivateSystemCoerceId.default)(relationshipHash), type: relationshipModelName };
},
/**
Returns a polymorphic relationship formatted as a JSON-API "relationship object".
http://jsonapi.org/format/#document-resource-object-relationships
`relationshipOptions` is a hash which contains more information about the
polymorphic relationship which should be extracted:
- `resourceHash` complete hash of the resource the relationship should be
extracted from
- `relationshipKey` key under which the value for the relationship is
extracted from the resourceHash
- `relationshipMeta` meta information about the relationship
@method extractPolymorphicRelationship
@param {Object} relationshipModelName
@param {Object} relationshipHash
@param {Object} relationshipOptions
@return {Object}
*/
extractPolymorphicRelationship: function (relationshipModelName, relationshipHash, relationshipOptions) {
return this.extractRelationship(relationshipModelName, relationshipHash);
},
/**
Returns the resource's relationships formatted as a JSON-API "relationships object".
http://jsonapi.org/format/#document-resource-object-relationships
@method extractRelationships
@param {Object} modelClass
@param {Object} resourceHash
@return {Object}
*/
extractRelationships: function (modelClass, resourceHash) {
var _this3 = this;
var relationships = {};
modelClass.eachRelationship(function (key, relationshipMeta) {
var relationship = null;
var relationshipKey = _this3.keyForRelationship(key, relationshipMeta.kind, 'deserialize');
if (resourceHash.hasOwnProperty(relationshipKey)) {
var data = null;
var relationshipHash = resourceHash[relationshipKey];
if (relationshipMeta.kind === 'belongsTo') {
if (relationshipMeta.options.polymorphic) {
// extracting a polymorphic belongsTo may need more information
// than the type and the hash (which might only be an id) for the
// relationship, hence we pass the key, resource and
// relationshipMeta too
data = _this3.extractPolymorphicRelationship(relationshipMeta.type, relationshipHash, { key: key, resourceHash: resourceHash, relationshipMeta: relationshipMeta });
} else {
data = _this3.extractRelationship(relationshipMeta.type, relationshipHash);
}
} else if (relationshipMeta.kind === 'hasMany') {
if (!_ember.default.isNone(relationshipHash)) {
data = new Array(relationshipHash.length);
for (var i = 0, l = relationshipHash.length; i < l; i++) {
var item = relationshipHash[i];
data[i] = _this3.extractRelationship(relationshipMeta.type, item);
}
}
}
relationship = { data: data };
}
var linkKey = _this3.keyForLink(key, relationshipMeta.kind);
if (resourceHash.links && resourceHash.links.hasOwnProperty(linkKey)) {
var related = resourceHash.links[linkKey];
relationship = relationship || {};
relationship.links = { related: related };
}
if (relationship) {
relationships[key] = relationship;
}
});
return relationships;
},
/**
@method modelNameFromPayloadKey
@param {String} key
@return {String} the model's modelName
*/
modelNameFromPayloadKey: function (key) {
return (0, _emberDataPrivateSystemNormalizeModelName.default)(key);
},
/**
@method normalizeAttributes
@private
*/
normalizeAttributes: function (typeClass, hash) {
var _this4 = this;
var payloadKey;
if (this.keyForAttribute) {
typeClass.eachAttribute(function (key) {
payloadKey = _this4.keyForAttribute(key, 'deserialize');
if (key === payloadKey) {
return;
}
if (!hash.hasOwnProperty(payloadKey)) {
return;
}
hash[key] = hash[payloadKey];
delete hash[payloadKey];
});
}
},
/**
@method normalizeRelationships
@private
*/
normalizeRelationships: function (typeClass, hash) {
var _this5 = this;
var payloadKey;
if (this.keyForRelationship) {
typeClass.eachRelationship(function (key, relationship) {
payloadKey = _this5.keyForRelationship(key, relationship.kind, 'deserialize');
if (key === payloadKey) {
return;
}
if (!hash.hasOwnProperty(payloadKey)) {
return;
}
hash[key] = hash[payloadKey];
delete hash[payloadKey];
});
}
},
/**
@method normalizeUsingDeclaredMapping
@private
*/
normalizeUsingDeclaredMapping: function (modelClass, hash) {
var attrs = get(this, 'attrs');
var normalizedKey, payloadKey, key;
if (attrs) {
for (key in attrs) {
normalizedKey = payloadKey = this._getMappedKey(key, modelClass);
if (!hash.hasOwnProperty(payloadKey)) {
continue;
}
if (get(modelClass, 'attributes').has(key)) {
normalizedKey = this.keyForAttribute(key);
}
if (get(modelClass, 'relationshipsByName').has(key)) {
normalizedKey = this.keyForRelationship(key);
}
if (payloadKey !== normalizedKey) {
hash[normalizedKey] = hash[payloadKey];
delete hash[payloadKey];
}
}
}
},
/**
Looks up the property key that was set by the custom `attr` mapping
passed to the serializer.
@method _getMappedKey
@private
@param {String} key
@return {String} key
*/
_getMappedKey: function (key, modelClass) {
var attrs = get(this, 'attrs');
var mappedKey;
if (attrs && attrs[key]) {
mappedKey = attrs[key];
//We need to account for both the { title: 'post_title' } and
//{ title: { key: 'post_title' }} forms
if (mappedKey.key) {
mappedKey = mappedKey.key;
}
if (typeof mappedKey === 'string') {
key = mappedKey;
}
}
return key;
},
/**
Check attrs.key.serialize property to inform if the `key`
can be serialized
@method _canSerialize
@private
@param {String} key
@return {boolean} true if the key can be serialized
*/
_canSerialize: function (key) {
var attrs = get(this, 'attrs');
return !attrs || !attrs[key] || attrs[key].serialize !== false;
},
/**
When attrs.key.serialize is set to true then
it takes priority over the other checks and the related
attribute/relationship will be serialized
@method _mustSerialize
@private
@param {String} key
@return {boolean} true if the key must be serialized
*/
_mustSerialize: function (key) {
var attrs = get(this, 'attrs');
return attrs && attrs[key] && attrs[key].serialize === true;
},
/**
Check if the given hasMany relationship should be serialized
@method _shouldSerializeHasMany
@private
@param {DS.Snapshot} snapshot
@param {String} key
@param {String} relationshipType
@return {boolean} true if the hasMany relationship should be serialized
*/
_shouldSerializeHasMany: function (snapshot, key, relationship) {
var relationshipType = snapshot.type.determineRelationshipType(relationship, this.store);
if (this._mustSerialize(key)) {
return true;
}
return this._canSerialize(key) && (relationshipType === 'manyToNone' || relationshipType === 'manyToMany');
},
// SERIALIZE
/**
Called when a record is saved in order to convert the
record into JSON.
By default, it creates a JSON object with a key for
each attribute and belongsTo relationship.
For example, consider this model:
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr(),
body: DS.attr(),
author: DS.belongsTo('user')
});
```
The default serialization would create a JSON object like:
```javascript
{
"title": "Rails is unagi",
"body": "Rails? Omakase? O_O",
"author": 12
}
```
By default, attributes are passed through as-is, unless
you specified an attribute type (`DS.attr('date')`). If
you specify a transform, the JavaScript value will be
serialized when inserted into the JSON hash.
By default, belongs-to relationships are converted into
IDs when inserted into the JSON hash.
## IDs
`serialize` takes an options hash with a single option:
`includeId`. If this option is `true`, `serialize` will,
by default include the ID in the JSON object it builds.
The adapter passes in `includeId: true` when serializing
a record for `createRecord`, but not for `updateRecord`.
## Customization
Your server may expect a different JSON format than the
built-in serialization format.
In that case, you can implement `serialize` yourself and
return a JSON hash of your choosing.
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serialize: function(snapshot, options) {
var json = {
POST_TTL: snapshot.attr('title'),
POST_BDY: snapshot.attr('body'),
POST_CMS: snapshot.hasMany('comments', { ids: true })
}
if (options.includeId) {
json.POST_ID_ = snapshot.id;
}
return json;
}
});
```
## Customizing an App-Wide Serializer
If you want to define a serializer for your entire
application, you'll probably want to use `eachAttribute`
and `eachRelationship` on the record.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serialize: function(snapshot, options) {
var json = {};
snapshot.eachAttribute(function(name) {
json[serverAttributeName(name)] = snapshot.attr(name);
})
snapshot.eachRelationship(function(name, relationship) {
if (relationship.kind === 'hasMany') {
json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });
}
});
if (options.includeId) {
json.ID_ = snapshot.id;
}
return json;
}
});
function serverAttributeName(attribute) {
return attribute.underscore().toUpperCase();
}
function serverHasManyName(name) {
return serverAttributeName(name.singularize()) + "_IDS";
}
```
This serializer will generate JSON that looks like this:
```javascript
{
"TITLE": "Rails is omakase",
"BODY": "Yep. Omakase.",
"COMMENT_IDS": [ 1, 2, 3 ]
}
```
## Tweaking the Default JSON
If you just want to do some small tweaks on the default JSON,
you can call super first and make the tweaks on the returned
JSON.
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serialize: function(snapshot, options) {
var json = this._super.apply(this, arguments);
json.subject = json.title;
delete json.title;
return json;
}
});
```
@method serialize
@param {DS.Snapshot} snapshot
@param {Object} options
@return {Object} json
*/
serialize: function (snapshot, options) {
var _this6 = this;
var json = {};
if (options && options.includeId) {
var id = snapshot.id;
if (id) {
json[get(this, 'primaryKey')] = id;
}
}
snapshot.eachAttribute(function (key, attribute) {
_this6.serializeAttribute(snapshot, json, key, attribute);
});
snapshot.eachRelationship(function (key, relationship) {
if (relationship.kind === 'belongsTo') {
_this6.serializeBelongsTo(snapshot, json, relationship);
} else if (relationship.kind === 'hasMany') {
_this6.serializeHasMany(snapshot, json, relationship);
}
});
return json;
},
/**
You can use this method to customize how a serialized record is added to the complete
JSON hash to be sent to the server. By default the JSON Serializer does not namespace
the payload and just sends the raw serialized JSON object.
If your server expects namespaced keys, you should consider using the RESTSerializer.
Otherwise you can override this method to customize how the record is added to the hash.
The hash property should be modified by reference.
For example, your server may expect underscored root objects.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
serializeIntoHash: function(data, type, snapshot, options) {
var root = Ember.String.decamelize(type.modelName);
data[root] = this.serialize(snapshot, options);
}
});
```
@method serializeIntoHash
@param {Object} hash
@param {DS.Model} typeClass
@param {DS.Snapshot} snapshot
@param {Object} options
*/
serializeIntoHash: function (hash, typeClass, snapshot, options) {
assign(hash, this.serialize(snapshot, options));
},
/**
`serializeAttribute` can be used to customize how `DS.attr`
properties are serialized
For example if you wanted to ensure all your attributes were always
serialized as properties on an `attributes` object you could
write:
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serializeAttribute: function(snapshot, json, key, attributes) {
json.attributes = json.attributes || {};
this._super(snapshot, json.attributes, key, attributes);
}
});
```
@method serializeAttribute
@param {DS.Snapshot} snapshot
@param {Object} json
@param {String} key
@param {Object} attribute
*/
serializeAttribute: function (snapshot, json, key, attribute) {
var type = attribute.type;
if (this._canSerialize(key)) {
var value = snapshot.attr(key);
if (type) {
var transform = this.transformFor(type);
value = transform.serialize(value, attribute.options);
}
// if provided, use the mapping provided by `attrs` in
// the serializer
var payloadKey = this._getMappedKey(key, snapshot.type);
if (payloadKey === key && this.keyForAttribute) {
payloadKey = this.keyForAttribute(key, 'serialize');
}
json[payloadKey] = value;
}
},
/**
`serializeBelongsTo` can be used to customize how `DS.belongsTo`
properties are serialized.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serializeBelongsTo: function(snapshot, json, relationship) {
var key = relationship.key;
var belongsTo = snapshot.belongsTo(key);
key = this.keyForRelationship ? this.keyForRelationship(key, "belongsTo", "serialize") : key;
json[key] = Ember.isNone(belongsTo) ? belongsTo : belongsTo.record.toJSON();
}
});
```
@method serializeBelongsTo
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeBelongsTo: function (snapshot, json, relationship) {
var key = relationship.key;
if (this._canSerialize(key)) {
var belongsToId = snapshot.belongsTo(key, { id: true });
// if provided, use the mapping provided by `attrs` in
// the serializer
var payloadKey = this._getMappedKey(key, snapshot.type);
if (payloadKey === key && this.keyForRelationship) {
payloadKey = this.keyForRelationship(key, "belongsTo", "serialize");
}
//Need to check whether the id is there for new&async records
if (isNone(belongsToId)) {
json[payloadKey] = null;
} else {
json[payloadKey] = belongsToId;
}
if (relationship.options.polymorphic) {
this.serializePolymorphicType(snapshot, json, relationship);
}
}
},
/**
`serializeHasMany` can be used to customize how `DS.hasMany`
properties are serialized.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serializeHasMany: function(snapshot, json, relationship) {
var key = relationship.key;
if (key === 'comments') {
return;
} else {
this._super.apply(this, arguments);
}
}
});
```
@method serializeHasMany
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeHasMany: function (snapshot, json, relationship) {
var key = relationship.key;
if (this._shouldSerializeHasMany(snapshot, key, relationship)) {
var hasMany = snapshot.hasMany(key, { ids: true });
if (hasMany !== undefined) {
// if provided, use the mapping provided by `attrs` in
// the serializer
var payloadKey = this._getMappedKey(key, snapshot.type);
if (payloadKey === key && this.keyForRelationship) {
payloadKey = this.keyForRelationship(key, "hasMany", "serialize");
}
json[payloadKey] = hasMany;
// TODO support for polymorphic manyToNone and manyToMany relationships
}
}
},
/**
You can use this method to customize how polymorphic objects are
serialized. Objects are considered to be polymorphic if
`{ polymorphic: true }` is pass as the second argument to the
`DS.belongsTo` function.
Example
```app/serializers/comment.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serializePolymorphicType: function(snapshot, json, relationship) {
var key = relationship.key,
belongsTo = snapshot.belongsTo(key);
key = this.keyForAttribute ? this.keyForAttribute(key, "serialize") : key;
if (Ember.isNone(belongsTo)) {
json[key + "_type"] = null;
} else {
json[key + "_type"] = belongsTo.modelName;
}
}
});
```
@method serializePolymorphicType
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializePolymorphicType: _ember.default.K,
/**
`extractMeta` is used to deserialize any meta information in the
adapter payload. By default Ember Data expects meta information to
be located on the `meta` property of the payload object.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
extractMeta: function(store, typeClass, payload) {
if (payload && payload.hasOwnProperty('_pagination')) {
let meta = payload._pagination;
delete payload._pagination;
return meta;
}
}
});
```
@method extractMeta
@param {DS.Store} store
@param {DS.Model} modelClass
@param {Object} payload
*/
extractMeta: function (store, modelClass, payload) {
if (payload && payload.hasOwnProperty('meta')) {
var meta = payload.meta;
delete payload.meta;
return meta;
}
},
/**
`extractErrors` is used to extract model errors when a call
to `DS.Model#save` fails with an `InvalidError`. By default
Ember Data expects error information to be located on the `errors`
property of the payload object.
This serializer expects this `errors` object to be an Array similar
to the following, compliant with the JSON-API specification:
```js
{
"errors": [
{
"detail": "This username is already taken!",
"source": {
"pointer": "data/attributes/username"
}
}, {
"detail": "Doesn't look like a valid email.",
"source": {
"pointer": "data/attributes/email"
}
}
]
}
```
The key `detail` provides a textual description of the problem.
Alternatively, the key `title` can be used for the same purpose.
The nested keys `source.pointer` detail which specific element
of the request data was invalid.
Note that JSON-API also allows for object-level errors to be placed
in an object with pointer `data`, signifying that the problem
cannot be traced to a specific attribute:
```javascript
{
"errors": [
{
"detail": "Some generic non property error message",
"source": {
"pointer": "data"
}
}
]
}
```
When turn into a `DS.Errors` object, you can read these errors
through the property `base`:
```handlebars
{{#each model.errors.base as |error|}}
<div class="error">
{{error.message}}
</div>
{{/each}}
```
Example of alternative implementation, overriding the default
behavior to deal with a different format of errors:
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
extractErrors: function(store, typeClass, payload, id) {
if (payload && typeof payload === 'object' && payload._problems) {
payload = payload._problems;
this.normalizeErrors(typeClass, payload);
}
return payload;
}
});
```
@method extractErrors
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@return {Object} json The deserialized errors
*/
extractErrors: function (store, typeClass, payload, id) {
var _this7 = this;
if (payload && typeof payload === 'object' && payload.errors) {
payload = (0, _emberDataPrivateAdaptersErrors.errorsArrayToHash)(payload.errors);
this.normalizeUsingDeclaredMapping(typeClass, payload);
typeClass.eachAttribute(function (name) {
var key = _this7.keyForAttribute(name, 'deserialize');
if (key !== name && payload.hasOwnProperty(key)) {
payload[name] = payload[key];
delete payload[key];
}
});
typeClass.eachRelationship(function (name) {
var key = _this7.keyForRelationship(name, 'deserialize');
if (key !== name && payload.hasOwnProperty(key)) {
payload[name] = payload[key];
delete payload[key];
}
});
}
return payload;
},
/**
`keyForAttribute` can be used to define rules for how to convert an
attribute name in your model to a key in your JSON.
Example
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
keyForAttribute: function(attr, method) {
return Ember.String.underscore(attr).toUpperCase();
}
});
```
@method keyForAttribute
@param {String} key
@param {String} method
@return {String} normalized key
*/
keyForAttribute: function (key, method) {
return key;
},
/**
`keyForRelationship` can be used to define a custom key when
serializing and deserializing relationship properties. By default
`JSONSerializer` does not provide an implementation of this method.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
keyForRelationship: function(key, relationship, method) {
return 'rel_' + Ember.String.underscore(key);
}
});
```
@method keyForRelationship
@param {String} key
@param {String} typeClass
@param {String} method
@return {String} normalized key
*/
keyForRelationship: function (key, typeClass, method) {
return key;
},
/**
`keyForLink` can be used to define a custom key when deserializing link
properties.
@method keyForLink
@param {String} key
@param {String} kind `belongsTo` or `hasMany`
@return {String} normalized key
*/
keyForLink: function (key, kind) {
return key;
},
// HELPERS
/**
@method transformFor
@private
@param {String} attributeType
@param {Boolean} skipAssertion
@return {DS.Transform} transform
*/
transformFor: function (attributeType, skipAssertion) {
var transform = (0, _emberDataPrivateUtils.getOwner)(this).lookup('transform:' + attributeType);
return transform;
}
});
});
define("ember-data/serializers/rest", ["exports", "ember", "ember-data/-private/debug", "ember-data/serializers/json", "ember-data/-private/system/normalize-model-name", "ember-inflector", "ember-data/-private/system/coerce-id", "ember-data/-private/utils", "ember-data/-private/features"], function (exports, _ember, _emberDataPrivateDebug, _emberDataSerializersJson, _emberDataPrivateSystemNormalizeModelName, _emberInflector, _emberDataPrivateSystemCoerceId, _emberDataPrivateUtils, _emberDataPrivateFeatures) {
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
var camelize = _ember.default.String.camelize;
/**
Normally, applications will use the `RESTSerializer` by implementing
the `normalize` method and individual normalizations under
`normalizeHash`.
This allows you to do whatever kind of munging you need, and is
especially useful if your server is inconsistent and you need to
do munging differently for many different kinds of responses.
See the `normalize` documentation for more information.
## Across the Board Normalization
There are also a number of hooks that you might find useful to define
across-the-board rules for your payload. These rules will be useful
if your server is consistent, or if you're building an adapter for
an infrastructure service, like Parse, and want to encode service
conventions.
For example, if all of your keys are underscored and all-caps, but
otherwise consistent with the names you use in your models, you
can implement across-the-board rules for how to convert an attribute
name in your model to a key in your JSON.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
keyForAttribute: function(attr, method) {
return Ember.String.underscore(attr).toUpperCase();
}
});
```
You can also implement `keyForRelationship`, which takes the name
of the relationship as the first parameter, the kind of
relationship (`hasMany` or `belongsTo`) as the second parameter, and
the method (`serialize` or `deserialize`) as the third parameter.
@class RESTSerializer
@namespace DS
@extends DS.JSONSerializer
*/
var RESTSerializer = _emberDataSerializersJson.default.extend({
/**
`keyForPolymorphicType` can be used to define a custom key when
serializing and deserializing a polymorphic type. By default, the
returned key is `${key}Type`.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
keyForPolymorphicType: function(key, relationship) {
var relationshipKey = this.keyForRelationship(key);
return 'type-' + relationshipKey;
}
});
```
@method keyForPolymorphicType
@param {String} key
@param {String} typeClass
@param {String} method
@return {String} normalized key
*/
keyForPolymorphicType: function (key, typeClass, method) {
var relationshipKey = this.keyForRelationship(key);
return relationshipKey + "Type";
},
/**
Normalizes a part of the JSON payload returned by
the server. You should override this method, munge the hash
and call super if you have generic normalization to do.
It takes the type of the record that is being normalized
(as a DS.Model class), the property where the hash was
originally found, and the hash to normalize.
For example, if you have a payload that looks like this:
```js
{
"post": {
"id": 1,
"title": "Rails is omakase",
"comments": [ 1, 2 ]
},
"comments": [{
"id": 1,
"body": "FIRST"
}, {
"id": 2,
"body": "Rails is unagi"
}]
}
```
The `normalize` method will be called three times:
* With `App.Post`, `"posts"` and `{ id: 1, title: "Rails is omakase", ... }`
* With `App.Comment`, `"comments"` and `{ id: 1, body: "FIRST" }`
* With `App.Comment`, `"comments"` and `{ id: 2, body: "Rails is unagi" }`
You can use this method, for example, to normalize underscored keys to camelized
or other general-purpose normalizations.
If you want to do normalizations specific to some part of the payload, you
can specify those under `normalizeHash`.
For example, if the `IDs` under `"comments"` are provided as `_id` instead of
`id`, you can specify how to normalize just the comments:
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
normalizeHash: {
comments: function(hash) {
hash.id = hash._id;
delete hash._id;
return hash;
}
}
});
```
The key under `normalizeHash` is just the original key that was in the original
payload.
@method normalize
@param {DS.Model} modelClass
@param {Object} resourceHash
@param {String} prop
@return {Object}
*/
normalize: function (modelClass, resourceHash, prop) {
if (this.normalizeHash && this.normalizeHash[prop]) {
this.normalizeHash[prop](resourceHash);
}
return this._super(modelClass, resourceHash, prop);
},
/**
Normalizes an array of resource payloads and returns a JSON-API Document
with primary data and, if any, included data as `{ data, included }`.
@method _normalizeArray
@param {DS.Store} store
@param {String} modelName
@param {Object} arrayHash
@param {String} prop
@return {Object}
@private
*/
_normalizeArray: function (store, modelName, arrayHash, prop) {
var _this = this;
var documentHash = {
data: [],
included: []
};
var modelClass = store.modelFor(modelName);
var serializer = store.serializerFor(modelName);
/*jshint loopfunc:true*/
_ember.default.makeArray(arrayHash).forEach(function (hash) {
var _normalizePolymorphicRecord = _this._normalizePolymorphicRecord(store, hash, prop, modelClass, serializer);
var data = _normalizePolymorphicRecord.data;
var included = _normalizePolymorphicRecord.included;
documentHash.data.push(data);
if (included) {
var _documentHash$included;
(_documentHash$included = documentHash.included).push.apply(_documentHash$included, _toConsumableArray(included));
}
});
return documentHash;
},
_normalizePolymorphicRecord: function (store, hash, prop, primaryModelClass, primarySerializer) {
var serializer = undefined,
modelClass = undefined;
var primaryHasTypeAttribute = (0, _emberDataPrivateUtils.modelHasAttributeOrRelationshipNamedType)(primaryModelClass);
// Support polymorphic records in async relationships
if (!primaryHasTypeAttribute && hash.type && store._hasModelFor(this.modelNameFromPayloadKey(hash.type))) {
serializer = store.serializerFor(this.modelNameFromPayloadKey(hash.type));
modelClass = store.modelFor(this.modelNameFromPayloadKey(hash.type));
} else {
serializer = primarySerializer;
modelClass = primaryModelClass;
}
return serializer.normalize(modelClass, hash, prop);
},
/*
@method _normalizeResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@param {Boolean} isSingle
@return {Object} JSON-API Document
@private
*/
_normalizeResponse: function (store, primaryModelClass, payload, id, requestType, isSingle) {
var documentHash = {
data: null,
included: []
};
var meta = this.extractMeta(store, primaryModelClass, payload);
if (meta) {
documentHash.meta = meta;
}
var keys = Object.keys(payload);
for (var i = 0, _length = keys.length; i < _length; i++) {
var prop = keys[i];
var modelName = prop;
var forcedSecondary = false;
/*
If you want to provide sideloaded records of the same type that the
primary data you can do that by prefixing the key with `_`.
Example
```
{
users: [
{ id: 1, title: 'Tom', manager: 3 },
{ id: 2, title: 'Yehuda', manager: 3 }
],
_users: [
{ id: 3, title: 'Tomster' }
]
}
```
This forces `_users` to be added to `included` instead of `data`.
*/
if (prop.charAt(0) === '_') {
forcedSecondary = true;
modelName = prop.substr(1);
}
var typeName = this.modelNameFromPayloadKey(modelName);
if (!store.modelFactoryFor(typeName)) {
continue;
}
var isPrimary = !forcedSecondary && this.isPrimaryType(store, typeName, primaryModelClass);
var value = payload[prop];
if (value === null) {
continue;
}
/*
Support primary data as an object instead of an array.
Example
```
{
user: { id: 1, title: 'Tom', manager: 3 }
}
```
*/
if (isPrimary && _ember.default.typeOf(value) !== 'array') {
var _normalizePolymorphicRecord2 = this._normalizePolymorphicRecord(store, value, prop, primaryModelClass, this);
var _data = _normalizePolymorphicRecord2.data;
var _included = _normalizePolymorphicRecord2.included;
documentHash.data = _data;
if (_included) {
var _documentHash$included2;
(_documentHash$included2 = documentHash.included).push.apply(_documentHash$included2, _toConsumableArray(_included));
}
continue;
}
var _normalizeArray = this._normalizeArray(store, typeName, value, prop);
var data = _normalizeArray.data;
var included = _normalizeArray.included;
if (included) {
var _documentHash$included3;
(_documentHash$included3 = documentHash.included).push.apply(_documentHash$included3, _toConsumableArray(included));
}
if (isSingle) {
/*jshint loopfunc:true*/
data.forEach(function (resource) {
/*
Figures out if this is the primary record or not.
It's either:
1. The record with the same ID as the original request
2. If it's a newly created record without an ID, the first record
in the array
*/
var isUpdatedRecord = isPrimary && (0, _emberDataPrivateSystemCoerceId.default)(resource.id) === id;
var isFirstCreatedRecord = isPrimary && !id && !documentHash.data;
if (isFirstCreatedRecord || isUpdatedRecord) {
documentHash.data = resource;
} else {
documentHash.included.push(resource);
}
});
} else {
if (isPrimary) {
documentHash.data = data;
} else {
if (data) {
var _documentHash$included4;
(_documentHash$included4 = documentHash.included).push.apply(_documentHash$included4, _toConsumableArray(data));
}
}
}
}
return documentHash;
},
isPrimaryType: function (store, typeName, primaryTypeClass) {
var typeClass = store.modelFor(typeName);
return typeClass.modelName === primaryTypeClass.modelName;
},
/**
This method allows you to push a payload containing top-level
collections of records organized per type.
```js
{
"posts": [{
"id": "1",
"title": "Rails is omakase",
"author", "1",
"comments": [ "1" ]
}],
"comments": [{
"id": "1",
"body": "FIRST"
}],
"users": [{
"id": "1",
"name": "@d2h"
}]
}
```
It will first normalize the payload, so you can use this to push
in data streaming in from your server structured the same way
that fetches and saves are structured.
@method pushPayload
@param {DS.Store} store
@param {Object} payload
*/
pushPayload: function (store, payload) {
var documentHash = {
data: [],
included: []
};
for (var prop in payload) {
var modelName = this.modelNameFromPayloadKey(prop);
if (!store.modelFactoryFor(modelName)) {
continue;
}
var type = store.modelFor(modelName);
var typeSerializer = store.serializerFor(type.modelName);
/*jshint loopfunc:true*/
_ember.default.makeArray(payload[prop]).forEach(function (hash) {
var _typeSerializer$normalize = typeSerializer.normalize(type, hash, prop);
var data = _typeSerializer$normalize.data;
var included = _typeSerializer$normalize.included;
documentHash.data.push(data);
if (included) {
var _documentHash$included5;
(_documentHash$included5 = documentHash.included).push.apply(_documentHash$included5, _toConsumableArray(included));
}
});
}
store.push(documentHash);
},
/**
This method is used to convert each JSON root key in the payload
into a modelName that it can use to look up the appropriate model for
that part of the payload.
For example, your server may send a model name that does not correspond with
the name of the model in your app. Let's take a look at an example model,
and an example payload:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
});
```
```javascript
{
"blog/post": {
"id": "1
}
}
```
Ember Data is going to normalize the payload's root key for the modelName. As a result,
it will try to look up the "blog/post" model. Since we don't have a model called "blog/post"
(or a file called app/models/blog/post.js in ember-cli), Ember Data will throw an error
because it cannot find the "blog/post" model.
Since we want to remove this namespace, we can define a serializer for the application that will
remove "blog/" from the payload key whenver it's encountered by Ember Data:
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
modelNameFromPayloadKey: function(payloadKey) {
if (payloadKey === 'blog/post') {
return this._super(payloadKey.replace('blog/', ''));
} else {
return this._super(payloadKey);
}
}
});
```
After refreshing, Ember Data will appropriately look up the "post" model.
By default the modelName for a model is its
name in dasherized form. This means that a payload key like "blogPost" would be
normalized to "blog-post" when Ember Data looks up the model. Usually, Ember Data
can use the correct inflection to do this for you. Most of the time, you won't
need to override `modelNameFromPayloadKey` for this purpose.
@method modelNameFromPayloadKey
@param {String} key
@return {String} the model's modelName
*/
modelNameFromPayloadKey: function (key) {
return (0, _emberInflector.singularize)((0, _emberDataPrivateSystemNormalizeModelName.default)(key));
},
// SERIALIZE
/**
Called when a record is saved in order to convert the
record into JSON.
By default, it creates a JSON object with a key for
each attribute and belongsTo relationship.
For example, consider this model:
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr(),
body: DS.attr(),
author: DS.belongsTo('user')
});
```
The default serialization would create a JSON object like:
```js
{
"title": "Rails is unagi",
"body": "Rails? Omakase? O_O",
"author": 12
}
```
By default, attributes are passed through as-is, unless
you specified an attribute type (`DS.attr('date')`). If
you specify a transform, the JavaScript value will be
serialized when inserted into the JSON hash.
By default, belongs-to relationships are converted into
IDs when inserted into the JSON hash.
## IDs
`serialize` takes an options hash with a single option:
`includeId`. If this option is `true`, `serialize` will,
by default include the ID in the JSON object it builds.
The adapter passes in `includeId: true` when serializing
a record for `createRecord`, but not for `updateRecord`.
## Customization
Your server may expect a different JSON format than the
built-in serialization format.
In that case, you can implement `serialize` yourself and
return a JSON hash of your choosing.
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
serialize: function(snapshot, options) {
var json = {
POST_TTL: snapshot.attr('title'),
POST_BDY: snapshot.attr('body'),
POST_CMS: snapshot.hasMany('comments', { ids: true })
}
if (options.includeId) {
json.POST_ID_ = snapshot.id;
}
return json;
}
});
```
## Customizing an App-Wide Serializer
If you want to define a serializer for your entire
application, you'll probably want to use `eachAttribute`
and `eachRelationship` on the record.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
serialize: function(snapshot, options) {
var json = {};
snapshot.eachAttribute(function(name) {
json[serverAttributeName(name)] = snapshot.attr(name);
})
snapshot.eachRelationship(function(name, relationship) {
if (relationship.kind === 'hasMany') {
json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });
}
});
if (options.includeId) {
json.ID_ = snapshot.id;
}
return json;
}
});
function serverAttributeName(attribute) {
return attribute.underscore().toUpperCase();
}
function serverHasManyName(name) {
return serverAttributeName(name.singularize()) + "_IDS";
}
```
This serializer will generate JSON that looks like this:
```js
{
"TITLE": "Rails is omakase",
"BODY": "Yep. Omakase.",
"COMMENT_IDS": [ 1, 2, 3 ]
}
```
## Tweaking the Default JSON
If you just want to do some small tweaks on the default JSON,
you can call super first and make the tweaks on the returned
JSON.
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
serialize: function(snapshot, options) {
var json = this._super(snapshot, options);
json.subject = json.title;
delete json.title;
return json;
}
});
```
@method serialize
@param {DS.Snapshot} snapshot
@param {Object} options
@return {Object} json
*/
serialize: function (snapshot, options) {
return this._super.apply(this, arguments);
},
/**
You can use this method to customize the root keys serialized into the JSON.
The hash property should be modified by reference (possibly using something like _.extend)
By default the REST Serializer sends the modelName of a model, which is a camelized
version of the name.
For example, your server may expect underscored root objects.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
serializeIntoHash: function(data, type, record, options) {
var root = Ember.String.decamelize(type.modelName);
data[root] = this.serialize(record, options);
}
});
```
@method serializeIntoHash
@param {Object} hash
@param {DS.Model} typeClass
@param {DS.Snapshot} snapshot
@param {Object} options
*/
serializeIntoHash: function (hash, typeClass, snapshot, options) {
var normalizedRootKey = this.payloadKeyFromModelName(typeClass.modelName);
hash[normalizedRootKey] = this.serialize(snapshot, options);
},
/**
You can use `payloadKeyFromModelName` to override the root key for an outgoing
request. By default, the RESTSerializer returns a camelized version of the
model's name.
For a model called TacoParty, its `modelName` would be the string `taco-party`. The RESTSerializer
will send it to the server with `tacoParty` as the root key in the JSON payload:
```js
{
"tacoParty": {
"id": "1",
"location": "Matthew Beale's House"
}
}
```
For example, your server may expect dasherized root objects:
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
payloadKeyFromModelName: function(modelName) {
return Ember.String.dasherize(modelName);
}
});
```
Given a `TacoParty` model, calling `save` on it would produce an outgoing
request like:
```js
{
"taco-party": {
"id": "1",
"location": "Matthew Beale's House"
}
}
```
@method payloadKeyFromModelName
@param {String} modelName
@return {String}
*/
payloadKeyFromModelName: function (modelName) {
return camelize(modelName);
},
/**
You can use this method to customize how polymorphic objects are serialized.
By default the REST Serializer creates the key by appending `Type` to
the attribute and value from the model's camelcased model name.
@method serializePolymorphicType
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializePolymorphicType: function (snapshot, json, relationship) {
var key = relationship.key;
var belongsTo = snapshot.belongsTo(key);
var typeKey = this.keyForPolymorphicType(key, relationship.type, 'serialize');
// old way of getting the key for the polymorphic type
key = this.keyForAttribute ? this.keyForAttribute(key, "serialize") : key;
key = key + "Type";
// The old way of serializing the type of a polymorphic record used
// `keyForAttribute`, which is not correct. The next code checks if the old
// way is used and if it differs from the new way of using
// `keyForPolymorphicType`. If this is the case, a deprecation warning is
// logged and the old way is restored (so nothing breaks).
if (key !== typeKey && this.keyForPolymorphicType === RESTSerializer.prototype.keyForPolymorphicType) {
typeKey = key;
}
if (_ember.default.isNone(belongsTo)) {
json[typeKey] = null;
} else {
json[typeKey] = camelize(belongsTo.modelName);
}
},
/**
You can use this method to customize how a polymorphic relationship should
be extracted.
@method extractPolymorphicRelationship
@param {Object} relationshipType
@param {Object} relationshipHash
@param {Object} relationshipOptions
@return {Object}
*/
extractPolymorphicRelationship: function (relationshipType, relationshipHash, relationshipOptions) {
var key = relationshipOptions.key;
var resourceHash = relationshipOptions.resourceHash;
var relationshipMeta = relationshipOptions.relationshipMeta;
// A polymorphic belongsTo relationship can be present in the payload
// either in the form where the `id` and the `type` are given:
//
// {
// message: { id: 1, type: 'post' }
// }
//
// or by the `id` and a `<relationship>Type` attribute:
//
// {
// message: 1,
// messageType: 'post'
// }
//
// The next code checks if the latter case is present and returns the
// corresponding JSON-API representation. The former case is handled within
// the base class JSONSerializer.
var isPolymorphic = relationshipMeta.options.polymorphic;
var typeProperty = this.keyForPolymorphicType(key, relationshipType, 'deserialize');
if (isPolymorphic && resourceHash.hasOwnProperty(typeProperty) && typeof relationshipHash !== 'object') {
var type = this.modelNameFromPayloadKey(resourceHash[typeProperty]);
return {
id: relationshipHash,
type: type
};
}
return this._super.apply(this, arguments);
}
});
exports.default = RESTSerializer;
});
/**
@module ember-data
*/
define('ember-data/setup-container', ['exports', 'ember-data/-private/initializers/store', 'ember-data/-private/initializers/transforms', 'ember-data/-private/initializers/store-injections', 'ember-data/-private/initializers/data-adapter'], function (exports, _emberDataPrivateInitializersStore, _emberDataPrivateInitializersTransforms, _emberDataPrivateInitializersStoreInjections, _emberDataPrivateInitializersDataAdapter) {
exports.default = setupContainer;
function setupContainer(application) {
(0, _emberDataPrivateInitializersDataAdapter.default)(application);
(0, _emberDataPrivateInitializersTransforms.default)(application);
(0, _emberDataPrivateInitializersStoreInjections.default)(application);
(0, _emberDataPrivateInitializersStore.default)(application);
}
});
define("ember-data/store", ["exports", "ember-data/-private/system/store"], function (exports, _emberDataPrivateSystemStore) {
exports.default = _emberDataPrivateSystemStore.default;
});
define('ember-data/transform', ['exports', 'ember'], function (exports, _ember) {
/**
The `DS.Transform` class is used to serialize and deserialize model
attributes when they are saved or loaded from an
adapter. Subclassing `DS.Transform` is useful for creating custom
attributes. All subclasses of `DS.Transform` must implement a
`serialize` and a `deserialize` method.
Example
```app/transforms/temperature.js
import DS from 'ember-data';
// Converts centigrade in the JSON to fahrenheit in the app
export default DS.Transform.extend({
deserialize: function(serialized) {
return (serialized * 1.8) + 32;
},
serialize: function(deserialized) {
return (deserialized - 32) / 1.8;
}
});
```
Usage
```app/models/requirement.js
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr('string'),
temperature: DS.attr('temperature')
});
```
@class Transform
@namespace DS
*/
exports.default = _ember.default.Object.extend({
/**
When given a deserialized value from a record attribute this
method must return the serialized value.
Example
```javascript
serialize: function(deserialized) {
return Ember.isEmpty(deserialized) ? null : Number(deserialized);
}
```
@method serialize
@param deserialized The deserialized value
@return The serialized value
*/
serialize: null,
/**
When given a serialize value from a JSON object this method must
return the deserialized value for the record attribute.
Example
```javascript
deserialize: function(serialized) {
return empty(serialized) ? null : Number(serialized);
}
```
@method deserialize
@param serialized The serialized value
@return The deserialized value
*/
deserialize: null
});
});
define("ember-data/version", ["exports"], function (exports) {
exports.default = "2.5.1";
});
define("ember-inflector", ["exports", "ember", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (exports, _ember, _emberInflectorLibSystem, _emberInflectorLibExtString) {
_emberInflectorLibSystem.Inflector.defaultRules = _emberInflectorLibSystem.defaultRules;
_ember.default.Inflector = _emberInflectorLibSystem.Inflector;
_ember.default.String.pluralize = _emberInflectorLibSystem.pluralize;
_ember.default.String.singularize = _emberInflectorLibSystem.singularize;
exports.default = _emberInflectorLibSystem.Inflector;
exports.pluralize = _emberInflectorLibSystem.pluralize;
exports.singularize = _emberInflectorLibSystem.singularize;
exports.defaultRules = _emberInflectorLibSystem.defaultRules;
if (typeof define !== 'undefined' && define.amd) {
define('ember-inflector', ['exports'], function (__exports__) {
__exports__['default'] = _emberInflectorLibSystem.Inflector;
return _emberInflectorLibSystem.Inflector;
});
} else if (typeof module !== 'undefined' && module['exports']) {
module['exports'] = _emberInflectorLibSystem.Inflector;
}
});
/* global define, module */
define('ember-inflector/lib/ext/string', ['exports', 'ember', 'ember-inflector/lib/system/string'], function (exports, _ember, _emberInflectorLibSystemString) {
if (_ember.default.EXTEND_PROTOTYPES === true || _ember.default.EXTEND_PROTOTYPES.String) {
/**
See {{#crossLink "Ember.String/pluralize"}}{{/crossLink}}
@method pluralize
@for String
*/
String.prototype.pluralize = function () {
return (0, _emberInflectorLibSystemString.pluralize)(this);
};
/**
See {{#crossLink "Ember.String/singularize"}}{{/crossLink}}
@method singularize
@for String
*/
String.prototype.singularize = function () {
return (0, _emberInflectorLibSystemString.singularize)(this);
};
}
});
define('ember-inflector/lib/helpers/pluralize', ['exports', 'ember-inflector', 'ember-inflector/lib/utils/make-helper'], function (exports, _emberInflector, _emberInflectorLibUtilsMakeHelper) {
/**
*
* If you have Ember Inflector (such as if Ember Data is present),
* pluralize a word. For example, turn "ox" into "oxen".
*
* Example:
*
* {{pluralize count myProperty}}
* {{pluralize 1 "oxen"}}
* {{pluralize myProperty}}
* {{pluralize "ox"}}
*
* @for Ember.HTMLBars.helpers
* @method pluralize
* @param {Number|Property} [count] count of objects
* @param {String|Property} word word to pluralize
*/
exports.default = (0, _emberInflectorLibUtilsMakeHelper.default)(function (params) {
var count = undefined,
word = undefined;
if (params.length === 1) {
word = params[0];
return (0, _emberInflector.pluralize)(word);
} else {
count = params[0];
word = params[1];
if (parseFloat(count) !== 1) {
word = (0, _emberInflector.pluralize)(word);
}
return count + " " + word;
}
});
});
define('ember-inflector/lib/helpers/singularize', ['exports', 'ember-inflector', 'ember-inflector/lib/utils/make-helper'], function (exports, _emberInflector, _emberInflectorLibUtilsMakeHelper) {
/**
*
* If you have Ember Inflector (such as if Ember Data is present),
* singularize a word. For example, turn "oxen" into "ox".
*
* Example:
*
* {{singularize myProperty}}
* {{singularize "oxen"}}
*
* @for Ember.HTMLBars.helpers
* @method singularize
* @param {String|Property} word word to singularize
*/
exports.default = (0, _emberInflectorLibUtilsMakeHelper.default)(function (params) {
return (0, _emberInflector.singularize)(params[0]);
});
});
define("ember-inflector/lib/system", ["exports", "ember-inflector/lib/system/inflector", "ember-inflector/lib/system/string", "ember-inflector/lib/system/inflections"], function (exports, _emberInflectorLibSystemInflector, _emberInflectorLibSystemString, _emberInflectorLibSystemInflections) {
_emberInflectorLibSystemInflector.default.inflector = new _emberInflectorLibSystemInflector.default(_emberInflectorLibSystemInflections.default);
exports.Inflector = _emberInflectorLibSystemInflector.default;
exports.singularize = _emberInflectorLibSystemString.singularize;
exports.pluralize = _emberInflectorLibSystemString.pluralize;
exports.defaultRules = _emberInflectorLibSystemInflections.default;
});
define('ember-inflector/lib/system/inflections', ['exports'], function (exports) {
exports.default = {
plurals: [[/$/, 's'], [/s$/i, 's'], [/^(ax|test)is$/i, '$1es'], [/(octop|vir)us$/i, '$1i'], [/(octop|vir)i$/i, '$1i'], [/(alias|status)$/i, '$1es'], [/(bu)s$/i, '$1ses'], [/(buffal|tomat)o$/i, '$1oes'], [/([ti])um$/i, '$1a'], [/([ti])a$/i, '$1a'], [/sis$/i, 'ses'], [/(?:([^f])fe|([lr])f)$/i, '$1$2ves'], [/(hive)$/i, '$1s'], [/([^aeiouy]|qu)y$/i, '$1ies'], [/(x|ch|ss|sh)$/i, '$1es'], [/(matr|vert|ind)(?:ix|ex)$/i, '$1ices'], [/^(m|l)ouse$/i, '$1ice'], [/^(m|l)ice$/i, '$1ice'], [/^(ox)$/i, '$1en'], [/^(oxen)$/i, '$1'], [/(quiz)$/i, '$1zes']],
singular: [[/s$/i, ''], [/(ss)$/i, '$1'], [/(n)ews$/i, '$1ews'], [/([ti])a$/i, '$1um'], [/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, '$1sis'], [/(^analy)(sis|ses)$/i, '$1sis'], [/([^f])ves$/i, '$1fe'], [/(hive)s$/i, '$1'], [/(tive)s$/i, '$1'], [/([lr])ves$/i, '$1f'], [/([^aeiouy]|qu)ies$/i, '$1y'], [/(s)eries$/i, '$1eries'], [/(m)ovies$/i, '$1ovie'], [/(x|ch|ss|sh)es$/i, '$1'], [/^(m|l)ice$/i, '$1ouse'], [/(bus)(es)?$/i, '$1'], [/(o)es$/i, '$1'], [/(shoe)s$/i, '$1'], [/(cris|test)(is|es)$/i, '$1is'], [/^(a)x[ie]s$/i, '$1xis'], [/(octop|vir)(us|i)$/i, '$1us'], [/(alias|status)(es)?$/i, '$1'], [/^(ox)en/i, '$1'], [/(vert|ind)ices$/i, '$1ex'], [/(matr)ices$/i, '$1ix'], [/(quiz)zes$/i, '$1'], [/(database)s$/i, '$1']],
irregularPairs: [['person', 'people'], ['man', 'men'], ['child', 'children'], ['sex', 'sexes'], ['move', 'moves'], ['cow', 'kine'], ['zombie', 'zombies']],
uncountable: ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'jeans', 'police']
};
});
define('ember-inflector/lib/system/inflector', ['exports', 'ember'], function (exports, _ember) {
var capitalize = _ember.default.String.capitalize;
var BLANK_REGEX = /^\s*$/;
var LAST_WORD_DASHED_REGEX = /([\w/-]+[_/\s-])([a-z\d]+$)/;
var LAST_WORD_CAMELIZED_REGEX = /([\w/\s-]+)([A-Z][a-z\d]*$)/;
var CAMELIZED_REGEX = /[A-Z][a-z\d]*$/;
function loadUncountable(rules, uncountable) {
for (var i = 0, length = uncountable.length; i < length; i++) {
rules.uncountable[uncountable[i].toLowerCase()] = true;
}
}
function loadIrregular(rules, irregularPairs) {
var pair;
for (var i = 0, length = irregularPairs.length; i < length; i++) {
pair = irregularPairs[i];
//pluralizing
rules.irregular[pair[0].toLowerCase()] = pair[1];
rules.irregular[pair[1].toLowerCase()] = pair[1];
//singularizing
rules.irregularInverse[pair[1].toLowerCase()] = pair[0];
rules.irregularInverse[pair[0].toLowerCase()] = pair[0];
}
}
/**
Inflector.Ember provides a mechanism for supplying inflection rules for your
application. Ember includes a default set of inflection rules, and provides an
API for providing additional rules.
Examples:
Creating an inflector with no rules.
```js
var inflector = new Ember.Inflector();
```
Creating an inflector with the default ember ruleset.
```js
var inflector = new Ember.Inflector(Ember.Inflector.defaultRules);
inflector.pluralize('cow'); //=> 'kine'
inflector.singularize('kine'); //=> 'cow'
```
Creating an inflector and adding rules later.
```javascript
var inflector = Ember.Inflector.inflector;
inflector.pluralize('advice'); // => 'advices'
inflector.uncountable('advice');
inflector.pluralize('advice'); // => 'advice'
inflector.pluralize('formula'); // => 'formulas'
inflector.irregular('formula', 'formulae');
inflector.pluralize('formula'); // => 'formulae'
// you would not need to add these as they are the default rules
inflector.plural(/$/, 's');
inflector.singular(/s$/i, '');
```
Creating an inflector with a nondefault ruleset.
```javascript
var rules = {
plurals: [ /$/, 's' ],
singular: [ /\s$/, '' ],
irregularPairs: [
[ 'cow', 'kine' ]
],
uncountable: [ 'fish' ]
};
var inflector = new Ember.Inflector(rules);
```
@class Inflector
@namespace Ember
*/
function Inflector(ruleSet) {
ruleSet = ruleSet || {};
ruleSet.uncountable = ruleSet.uncountable || makeDictionary();
ruleSet.irregularPairs = ruleSet.irregularPairs || makeDictionary();
var rules = this.rules = {
plurals: ruleSet.plurals || [],
singular: ruleSet.singular || [],
irregular: makeDictionary(),
irregularInverse: makeDictionary(),
uncountable: makeDictionary()
};
loadUncountable(rules, ruleSet.uncountable);
loadIrregular(rules, ruleSet.irregularPairs);
this.enableCache();
}
if (!Object.create && !Object.create(null).hasOwnProperty) {
throw new Error("This browser does not support Object.create(null), please polyfil with es5-sham: http://git.io/yBU2rg");
}
function makeDictionary() {
var cache = Object.create(null);
cache['_dict'] = null;
delete cache['_dict'];
return cache;
}
Inflector.prototype = {
/**
@public
As inflections can be costly, and commonly the same subset of words are repeatedly
inflected an optional cache is provided.
@method enableCache
*/
enableCache: function () {
this.purgeCache();
this.singularize = function (word) {
this._cacheUsed = true;
return this._sCache[word] || (this._sCache[word] = this._singularize(word));
};
this.pluralize = function (word) {
this._cacheUsed = true;
return this._pCache[word] || (this._pCache[word] = this._pluralize(word));
};
},
/**
@public
@method purgedCache
*/
purgeCache: function () {
this._cacheUsed = false;
this._sCache = makeDictionary();
this._pCache = makeDictionary();
},
/**
@public
disable caching
@method disableCache;
*/
disableCache: function () {
this._sCache = null;
this._pCache = null;
this.singularize = function (word) {
return this._singularize(word);
};
this.pluralize = function (word) {
return this._pluralize(word);
};
},
/**
@method plural
@param {RegExp} regex
@param {String} string
*/
plural: function (regex, string) {
if (this._cacheUsed) {
this.purgeCache();
}
this.rules.plurals.push([regex, string.toLowerCase()]);
},
/**
@method singular
@param {RegExp} regex
@param {String} string
*/
singular: function (regex, string) {
if (this._cacheUsed) {
this.purgeCache();
}
this.rules.singular.push([regex, string.toLowerCase()]);
},
/**
@method uncountable
@param {String} regex
*/
uncountable: function (string) {
if (this._cacheUsed) {
this.purgeCache();
}
loadUncountable(this.rules, [string.toLowerCase()]);
},
/**
@method irregular
@param {String} singular
@param {String} plural
*/
irregular: function (singular, plural) {
if (this._cacheUsed) {
this.purgeCache();
}
loadIrregular(this.rules, [[singular, plural]]);
},
/**
@method pluralize
@param {String} word
*/
pluralize: function (word) {
return this._pluralize(word);
},
_pluralize: function (word) {
return this.inflect(word, this.rules.plurals, this.rules.irregular);
},
/**
@method singularize
@param {String} word
*/
singularize: function (word) {
return this._singularize(word);
},
_singularize: function (word) {
return this.inflect(word, this.rules.singular, this.rules.irregularInverse);
},
/**
@protected
@method inflect
@param {String} word
@param {Object} typeRules
@param {Object} irregular
*/
inflect: function (word, typeRules, irregular) {
var inflection, substitution, result, lowercase, wordSplit, firstPhrase, lastWord, isBlank, isCamelized, rule, isUncountable;
isBlank = !word || BLANK_REGEX.test(word);
isCamelized = CAMELIZED_REGEX.test(word);
firstPhrase = "";
if (isBlank) {
return word;
}
lowercase = word.toLowerCase();
wordSplit = LAST_WORD_DASHED_REGEX.exec(word) || LAST_WORD_CAMELIZED_REGEX.exec(word);
if (wordSplit) {
firstPhrase = wordSplit[1];
lastWord = wordSplit[2].toLowerCase();
}
isUncountable = this.rules.uncountable[lowercase] || this.rules.uncountable[lastWord];
if (isUncountable) {
return word;
}
for (rule in this.rules.irregular) {
if (lowercase.match(rule + "$")) {
substitution = irregular[rule];
if (isCamelized && irregular[lastWord]) {
substitution = capitalize(substitution);
rule = capitalize(rule);
}
return word.replace(rule, substitution);
}
}
for (var i = typeRules.length, min = 0; i > min; i--) {
inflection = typeRules[i - 1];
rule = inflection[0];
if (rule.test(word)) {
break;
}
}
inflection = inflection || [];
rule = inflection[0];
substitution = inflection[1];
result = word.replace(rule, substitution);
return result;
}
};
exports.default = Inflector;
});
define('ember-inflector/lib/system/string', ['exports', 'ember-inflector/lib/system/inflector'], function (exports, _emberInflectorLibSystemInflector) {
function pluralize(word) {
return _emberInflectorLibSystemInflector.default.inflector.pluralize(word);
}
function singularize(word) {
return _emberInflectorLibSystemInflector.default.inflector.singularize(word);
}
exports.pluralize = pluralize;
exports.singularize = singularize;
});
define('ember-inflector/lib/utils/make-helper', ['exports', 'ember'], function (exports, _ember) {
exports.default = makeHelper;
function makeHelper(helperFunction) {
if (_ember.default.Helper) {
return _ember.default.Helper.helper(helperFunction);
}
if (_ember.default.HTMLBars) {
return _ember.default.HTMLBars.makeBoundHelper(helperFunction);
}
return _ember.default.Handlebars.makeBoundHelper(helperFunction);
}
});
define('ember', [], function() {
return {
default: Ember
};
});
require("ember-data");
})();
;(function() {
function processEmberDataShims() {
var shims = {
'ember-data': { default: DS },
'ember-data/model': { default: DS.Model },
'ember-data/mixins/embedded-records': { default: DS.EmbeddedRecordsMixin },
'ember-data/serializers/rest': { default: DS.RESTSerializer },
'ember-data/serializers/active-model': { default: DS.ActiveModelSerializer },
'ember-data/serializers/json': { default: DS.JSONSerializer },
'ember-data/serializers/json-api': { default: DS.JSONAPISerializer },
'ember-data/serializer': { default: DS.Serializer },
'ember-data/adapters/json-api': { default: DS.JSONAPIAdapter },
'ember-data/adapters/rest': { default: DS.RESTAdapter },
'ember-data/adapter': { default: DS.Adapter },
'ember-data/adapters/active-model': { default: DS.ActiveModelAdapter },
'ember-data/store': { default: DS.Store },
'ember-data/transform': { default: DS.Transform },
'ember-data/attr': { default: DS.attr },
'ember-data/relationships': { hasMany: DS.hasMany, belongsTo: DS.belongsTo }
};
for (var moduleName in shims) {
generateModule(moduleName, shims[moduleName]);
}
}
function generateModule(name, values) {
define(name, [], function() {
'use strict';
return values;
});
}
if (typeof define !== 'undefined' && define && define.petal) {
processEmberDataShims();
}
})();
;(function() {
/* globals Ember */
/* globals DS */
var K = Ember.K;
Ember.onLoad('Ember.Application', function(Application) {
Application.initializer({
name: "ember-data",
initialize: DS._setupContainer
});
Application.instanceInitializer({
name: "ember-data",
initialize: DS._initializeStoreService
});
// Deprecated initializers to satisfy old code that depended on them
Application.initializer({
name: "store",
after: "ember-data",
initialize: K
});
Application.initializer({
name: "transforms",
before: "store",
initialize: K
});
Application.initializer({
name: "data-adapter",
before: "store",
initialize: K
});
Application.initializer({
name: "injectStore",
before: "store",
initialize: K
});
});
})();
|
src/utils/domUtils.js
|
xiaoking/react-bootstrap
|
import React from 'react';
import canUseDom from 'dom-helpers/util/inDOM';
import getOwnerDocument from 'dom-helpers/ownerDocument';
import getOwnerWindow from 'dom-helpers/ownerWindow';
import contains from 'dom-helpers/query/contains';
import activeElement from 'dom-helpers/activeElement';
import getOffset from 'dom-helpers/query/offset';
import offsetParent from 'dom-helpers/query/offsetParent';
import getPosition from 'dom-helpers/query/position';
import css from 'dom-helpers/style';
function ownerDocument(componentOrElement) {
let elem = React.findDOMNode(componentOrElement);
return getOwnerDocument((elem && elem.ownerDocument) || document);
}
function ownerWindow(componentOrElement) {
let doc = ownerDocument(componentOrElement);
return getOwnerWindow(doc);
}
// TODO remove in 0.26
function getComputedStyles(elem) {
return ownerDocument(elem).defaultView.getComputedStyle(elem, null);
}
/**
* Get the height of the document
*
* @returns {documentHeight: number}
*/
function getDocumentHeight() {
return Math.max(document.documentElement.offsetHeight, document.height, document.body.scrollHeight, document.body.offsetHeight);
}
/**
* Get an element's size
*
* @param {HTMLElement} elem
* @returns {{width: number, height: number}}
*/
function getSize(elem) {
let rect = {
width: elem.offsetWidth || 0,
height: elem.offsetHeight || 0
};
if (typeof elem.getBoundingClientRect !== 'undefined') {
let {width, height} = elem.getBoundingClientRect();
rect.width = width || rect.width;
rect.height = height || rect.height;
}
return rect;
}
export default {
canUseDom,
css,
getComputedStyles,
contains,
ownerWindow,
ownerDocument,
getOffset,
getDocumentHeight,
getPosition,
getSize,
activeElement,
offsetParent
};
|
src/parser/warlock/destruction/modules/talents/ChannelDemonfire.js
|
ronaldpereira/WoWAnalyzer
|
import React from 'react';
import Analyzer, { SELECTED_PLAYER } from 'parser/core/Analyzer';
import Events from 'parser/core/Events';
import Enemies from 'parser/shared/modules/Enemies';
import SPELLS from 'common/SPELLS';
import { formatThousands, formatNumber, formatPercentage } from 'common/format';
import Statistic from 'interface/statistics/Statistic';
import BoringSpellValueText from 'interface/statistics/components/BoringSpellValueText';
import STATISTIC_ORDER from 'interface/others/STATISTIC_ORDER';
class ChannelDemonfire extends Analyzer {
static dependencies = {
enemies: Enemies,
};
damage = 0;
constructor(...args) {
super(...args);
this.active = this.selectedCombatant.hasTalent(SPELLS.CHANNEL_DEMONFIRE_TALENT.id);
this.addEventListener(Events.damage.by(SELECTED_PLAYER).spell(SPELLS.CHANNEL_DEMONFIRE_DAMAGE), this.onCDFdamage);
}
onCDFdamage(event) {
this.damage += event.amount + (event.absorbed || 0);
}
get dps() {
return this.damage / this.owner.fightDuration * 1000;
}
statistic() {
return (
<Statistic
position={STATISTIC_ORDER.OPTIONAL(5)}
size="small"
tooltip={`${formatThousands(this.damage)} damage`}
>
<BoringSpellValueText spell={SPELLS.CHANNEL_DEMONFIRE_TALENT}>
{formatNumber(this.dps)} DPS <small>{formatPercentage(this.owner.getPercentageOfTotalDamageDone(this.damage))} % of total</small>
</BoringSpellValueText>
</Statistic>
);
}
}
export default ChannelDemonfire;
|
static/src/components/islands/IslandShrooms.js
|
andribja/airhornbot
|
// @flow
// jscs:disable maximumLineLength
import React from 'react';
type Props = {
number: number,
paused: boolean
};
export default ({number, paused}: Props): React.Element => {
let className = 'island shrooms';
if (number) {
className += `-${number}`;
}
if (paused) {
className += ' paused';
}
return (
<svg className={className} xmlns="http://www.w3.org/2000/svg" width="259" height="252">
<g fill="none" fill-rule="evenodd">
<path fill="#FFE6A7" d="M1.5012 124.2279v57.903l118.413 68.367 136.734-78.942v-57.903l-255.147 10.575z"/>
<path fill="#EDD194" d="M118.8135 119.3652v130.5l1.101.633 136.734-78.942v-57.903l-137.835 5.712z"/>
<path stroke="#5E4634" strokeWidth="3" d="M256.6494 113.6514v57.906l-136.734 78.942-118.416-68.367v-57.906" strokeLinecap="round" strokeLinejoin="round"/>
<path fill="#C7E082" d="M1.5012 124.2279v20.403l118.413 68.37 136.734-78.945v-20.403l-255.147 10.575z"/>
<path fill="#B0CC64" d="M119.8134 119.3235v93.618l.102.06 136.734-78.945v-20.406l-136.836 5.673z"/>
<path stroke="#5E4634" strokeWidth="3" d="M256.6494 116.6514v17.406l-136.734 78.942-118.416-68.367v-20.406" strokeLinecap="round" strokeLinejoin="round"/>
<path fill="#B7D86F" d="M1.5012 124.2279l118.413 68.367 136.734-78.942-118.413-68.367-136.734 78.942z"/>
<path stroke="#5E4634" strokeWidth="3" d="M119.9151 192.5949l-118.416-68.367 136.734-78.945 118.416 68.37-136.734 78.942zm0 0v57.906M65.7984 115.0263v3.249m49.9914-40.9422v3.249M74.7984 95.4783v3.249m49.4964-38.2491v3.249m9.5682 87.876v3.249" strokeLinecap="round" strokeLinejoin="round"/>
<path fill="#EBEBEB" d="M48.2067 121.5012h-6.684c-.735 0-1.335-.6-1.335-1.338v-.555c0-1.776 1.452-3.231 3.231-3.231h2.895c1.776 0 3.231 1.455 3.231 3.231v.555c0 .738-.603 1.338-1.338 1.338"/>
<path stroke="#5E4634" strokeWidth="3" d="M48.2067 121.5012h-6.684c-.735 0-1.335-.6-1.335-1.338v-.555c0-1.776 1.452-3.231 3.231-3.231h2.895c1.776 0 3.231 1.455 3.231 3.231v.555c0 .738-.603 1.338-1.338 1.338z" strokeLinecap="round" strokeLinejoin="round"/>
<path fill="#FFE6A7" d="M158.5977 111.0552v26.625c0 2.691 5.289 4.875 11.814 4.875 6.522 0 11.811-2.184 11.811-4.875v-26.625h-23.625z"/>
<path fill="#EDD194" d="M170.4735 111.0552v31.497c6.495-.015 11.751-2.19 11.751-4.872v-26.625h-11.751z"/>
<path stroke="#5E4634" strokeWidth="3" d="M158.5977 111.0552v26.625c0 2.691 5.289 4.875 11.814 4.875 6.522 0 11.811-2.184 11.811-4.875v-26.625h-23.625z" strokeLinecap="round" strokeLinejoin="round"/>
<g className="stretch">
<path fill="#C3F270" d="M176.0448 5.5341l36.129 98.73c1.719 4.695.099 10.05-4.092 12.777-6.051 3.939-17.328 8.265-37.671 8.265s-31.62-4.326-37.671-8.265c-4.191-2.727-5.814-8.082-4.095-12.777l36.132-98.73c1.92-5.25 9.345-5.25 11.268 0"/>
<path fill="#B7D86F" d="M212.175 104.2638l-36.129-98.73c-1.923-5.25-9.348-5.25-11.271 0l-2.88 7.875 31.239 85.365c1.719 4.695.099 10.05-4.095 12.777-6.051 3.939-17.328 8.265-37.671 8.265-5.913 0-11.043-.375-15.519-.99 6.552 3.354 17.274 6.48 34.56 6.48 20.343 0 31.62-4.326 37.671-8.265 4.194-2.727 5.814-8.082 4.095-12.777"/>
<path stroke="#5E4634" strokeWidth="3" d="M176.0448 5.5341l36.129 98.73c1.719 4.695.099 10.05-4.092 12.777-6.051 3.939-17.328 8.265-37.671 8.265s-31.62-4.326-37.671-8.265c-4.191-2.727-5.814-8.082-4.095-12.777l36.132-98.73c1.92-5.25 9.345-5.25 11.268 0z" strokeLinecap="round" strokeLinejoin="round"/>
</g>
<path fill="#FFF" d="M111.0498 151.7964h-.021c-2.616 0-4.74-2.121-4.74-4.74v-9.261h9.501v9.261c0 2.619-2.121 4.74-4.74 4.74"/>
<path stroke="#5E4634" strokeWidth="3" d="M111.0498 151.7964h-.021c-2.616 0-4.74-2.121-4.74-4.74v-9.261h9.501v9.261c0 2.619-2.121 4.74-4.74 4.74z" strokeLinecap="round" strokeLinejoin="round"/>
<path fill="#FF7555" d="M119.7672 142.4328h-17.454c-1.809 0-3.273-1.464-3.273-3.273 0-6.627 5.373-12 12-12s12 5.373 12 12c0 1.809-1.467 3.273-3.273 3.273"/>
<path stroke="#5E4634" strokeWidth="3" d="M119.7672 142.4328h-17.454c-1.809 0-3.273-1.464-3.273-3.273 0-6.627 5.373-12 12-12s12 5.373 12 12c0 1.809-1.467 3.273-3.273 3.273z" strokeLinecap="round" strokeLinejoin="round"/>
<path fill="#FFF" d="M96.0528 119.7891h-.012c-1.65 0-2.988-1.338-2.988-2.988v-5.835h5.988v5.835c0 1.65-1.338 2.988-2.988 2.988"/>
<path stroke="#5E4634" strokeWidth="3" d="M96.0528 119.7891h-.012c-1.65 0-2.988-1.338-2.988-2.988v-5.835h5.988v5.835c0 1.65-1.338 2.988-2.988 2.988z" strokeLinecap="round" strokeLinejoin="round"/>
<path fill="#FF7555" d="M101.5464 113.8881h-11.001c-1.137 0-2.061-.924-2.061-2.061 0-4.179 3.387-7.563 7.563-7.563s7.56 3.384 7.56 7.563c0 1.137-.921 2.061-2.061 2.061"/>
<path stroke="#5E4634" strokeWidth="3" d="M101.5464 113.8881h-11.001c-1.137 0-2.061-.924-2.061-2.061 0-4.179 3.387-7.563 7.563-7.563s7.56 3.384 7.56 7.563c0 1.137-.921 2.061-2.061 2.061z" strokeLinecap="round" strokeLinejoin="round"/>
</g>
</svg>
);
};
|
src/js/components/comments.js
|
lantuhui/NewsApp-react
|
/**
* Created by lantu on 2017/10/24.
*/
import React from 'react';
import { Row,Col } from 'antd';
import {
Menu,
Icon,
Tabs,
message,
Form,
Input,
Button,
CheckBox,
Modal,
Card,
notification
} from 'antd';
const FormItem = Form.Item;
import { Link } from 'react-router-dom';
import axios from 'axios';
class Comments extends React.Component {
constructor(){
super();
this.state = {
comments: ''
}
}
componentDidMount(){
axios.get("http://newsapi.gugujiankong.com/Handler.ashx?action=getcomments&uniquekey=" + this.props.uniquekey)
.then((response) => {
this.setState({ comments: response.data });
})
}
handleSubmit(e){
e.preventDefault();
var formdata = this.props.form.getFieldsValue();
axios.get("http://newsapi.gugujiankong.com/Handler.ashx?action=comment&userid=" + localStorage.userid + "&uniquekey=" + this.props.uniquekey + "&commnet=" + formdata.remark)
.then((response) => {
this.componentDidMount();
})
}
addUserCollection(){
notification.success({message: 'ReactNews提醒',description: '收藏此文章成功'});
}
render(){
let { getFieldDecorator } = this.props.form;
const { comments } = this.state;
const commentList = comments.length
?comments.map((comment,index) => (
<Card key={index} title={comment.UserName} extra={<a href="#">发布于 {comment.datetime}</a>}>
<p>{comment.Comments}</p>
</Card>
)):'没有加载到任何评论';
return (
<div className="comment">
<Row>
<Col span={24}>
{ commentList }
<Form onSubmit={this.handleSubmit.bind(this)}>
<FormItem label="您的评论">
{getFieldDecorator('remark',{})(
<Input placeholder="随便写"/>
)}
</FormItem>
<Button type="primary" htmlType="submit">提交评论</Button>
<Button type="primary" htmlType="button" onClick={this.addUserCollection.bind(this)}>收藏文章</Button>
</Form>
</Col>
</Row>
</div>
)
}
}
export default Form.create({})(Comments);
|
packages/material-ui-icons/src/Transform.js
|
allanalexandre/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0z" /><path d="M22 18v-2H8V4h2L7 1 4 4h2v2H2v2h4v8c0 1.1.9 2 2 2h8v2h-2l3 3 3-3h-2v-2h4zM10 8h6v6h2V8c0-1.1-.9-2-2-2h-6v2z" /></React.Fragment>
, 'Transform');
|
sites/all/modules/jquery_update/replace/jquery/1.8/jquery.min.js
|
mymail748/drupal734
|
/*! jQuery v1.8.2 jquery.com | jquery.org/license */
(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c==="input"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bY(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bW.length;while(e--){b=bW[e]+c;if(b in a)return b}return d}function bZ(a,b){return a=b||a,p.css(a,"display")==="none"||!p.contains(a.ownerDocument,a)}function b$(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,"olddisplay"),b?(!e[f]&&c.style.display==="none"&&(c.style.display=""),c.style.display===""&&bZ(c)&&(e[f]=p._data(c,"olddisplay",cc(c.nodeName)))):(d=bH(c,"display"),!e[f]&&d!=="none"&&p._data(c,"olddisplay",d))}for(f=0;f<g;f++){c=a[f];if(!c.style)continue;if(!b||c.style.display==="none"||c.style.display==="")c.style.display=b?e[f]||"":"none"}return a}function b_(a,b,c){var d=bP.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function ca(a,b,c,d){var e=c===(d?"border":"content")?4:b==="width"?1:0,f=0;for(;e<4;e+=2)c==="margin"&&(f+=p.css(a,c+bV[e],!0)),d?(c==="content"&&(f-=parseFloat(bH(a,"padding"+bV[e]))||0),c!=="margin"&&(f-=parseFloat(bH(a,"border"+bV[e]+"Width"))||0)):(f+=parseFloat(bH(a,"padding"+bV[e]))||0,c!=="padding"&&(f+=parseFloat(bH(a,"border"+bV[e]+"Width"))||0));return f}function cb(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=!0,f=p.support.boxSizing&&p.css(a,"boxSizing")==="border-box";if(d<=0||d==null){d=bH(a,b);if(d<0||d==null)d=a.style[b];if(bQ.test(d))return d;e=f&&(p.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+ca(a,b,c||(f?"border":"content"),e)+"px"}function cc(a){if(bS[a])return bS[a];var b=p("<"+a+">").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write("<!doctype html><html><body>"),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bS[a]=c,c}function ci(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||ce.test(a)?d(a,e):ci(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ci(a+"["+e+"]",b[e],c,d);else d(a,b)}function cz(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h<i;h++)d=g[h],f=/^\+/.test(d),f&&(d=d.substr(1)||"*"),e=a[d]=a[d]||[],e[f?"unshift":"push"](c)}}function cA(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h,i=a[f],j=0,k=i?i.length:0,l=a===cv;for(;j<k&&(l||!h);j++)h=i[j](c,d,e),typeof h=="string"&&(!l||g[h]?h=b:(c.dataTypes.unshift(h),h=cA(a,c,d,e,h,g)));return(l||!h)&&!g["*"]&&(h=cA(a,c,d,e,"*",g)),h}function cB(a,c){var d,e,f=p.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&p.extend(!0,a,e)}function cC(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(f in k)f in d&&(c[k[f]]=d[f]);while(j[0]==="*")j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("content-type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}if(g)return g!==j[0]&&j.unshift(g),d[g]}function cD(a,b){var c,d,e,f,g=a.dataTypes.slice(),h=g[0],i={},j=0;a.dataFilter&&(b=a.dataFilter(b,a.dataType));if(g[1])for(c in a.converters)i[c.toLowerCase()]=a.converters[c];for(;e=g[++j];)if(e!=="*"){if(h!=="*"&&h!==e){c=i[h+" "+e]||i["* "+e];if(!c)for(d in i){f=d.split(" ");if(f[1]===e){c=i[h+" "+f[0]]||i["* "+f[0]];if(c){c===!0?c=i[d]:i[d]!==!0&&(e=f[0],g.splice(j--,0,e));break}}}if(c!==!0)if(c&&a["throws"])b=c(b);else try{b=c(b)}catch(k){return{state:"parsererror",error:c?k:"No conversion from "+h+" to "+e}}}h=e}return{state:"success",data:b}}function cL(){try{return new a.XMLHttpRequest}catch(b){}}function cM(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cU(){return setTimeout(function(){cN=b},0),cN=p.now()}function cV(a,b){p.each(b,function(b,c){var d=(cT[b]||[]).concat(cT["*"]),e=0,f=d.length;for(;e<f;e++)if(d[e].call(a,b,c))return})}function cW(a,b,c){var d,e=0,f=0,g=cS.length,h=p.Deferred().always(function(){delete i.elem}),i=function(){var b=cN||cU(),c=Math.max(0,j.startTime+j.duration-b),d=1-(c/j.duration||0),e=0,f=j.tweens.length;for(;e<f;e++)j.tweens[e].run(d);return h.notifyWith(a,[j,d,c]),d<1&&f?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:p.extend({},b),opts:p.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:cN||cU(),duration:c.duration,tweens:[],createTween:function(b,c,d){var e=p.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(e),e},stop:function(b){var c=0,d=b?j.tweens.length:0;for(;c<d;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;cX(k,j.opts.specialEasing);for(;e<g;e++){d=cS[e].call(j,a,k,j.opts);if(d)return d}return cV(j,k),p.isFunction(j.opts.start)&&j.opts.start.call(a,j),p.fx.timer(p.extend(i,{anim:j,queue:j.opts.queue,elem:a})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function cX(a,b){var c,d,e,f,g;for(c in a){d=p.camelCase(c),e=b[d],f=a[c],p.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=p.cssHooks[d];if(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 cY(a,b,c){var d,e,f,g,h,i,j,k,l=this,m=a.style,n={},o=[],q=a.nodeType&&bZ(a);c.queue||(j=p._queueHooks(a,"fx"),j.unqueued==null&&(j.unqueued=0,k=j.empty.fire,j.empty.fire=function(){j.unqueued||k()}),j.unqueued++,l.always(function(){l.always(function(){j.unqueued--,p.queue(a,"fx").length||j.empty.fire()})})),a.nodeType===1&&("height"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],p.css(a,"display")==="inline"&&p.css(a,"float")==="none"&&(!p.support.inlineBlockNeedsLayout||cc(a.nodeName)==="inline"?m.display="inline-block":m.zoom=1)),c.overflow&&(m.overflow="hidden",p.support.shrinkWrapBlocks||l.done(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b){f=b[d];if(cP.exec(f)){delete b[d];if(f===(q?"hide":"show"))continue;o.push(d)}}g=o.length;if(g){h=p._data(a,"fxshow")||p._data(a,"fxshow",{}),q?p(a).show():l.done(function(){p(a).hide()}),l.done(function(){var b;p.removeData(a,"fxshow",!0);for(b in n)p.style(a,b,n[b])});for(d=0;d<g;d++)e=o[d],i=l.createTween(e,q?h[e]:0),n[e]=h[e]||p.style(a,e),e in h||(h[e]=i.start,q&&(i.end=i.start,i.start=e==="width"||e==="height"?1:0))}}function cZ(a,b,c,d,e){return new cZ.prototype.init(a,b,c,d,e)}function c$(a,b){var c,d={height:a},e=0;b=b?1:0;for(;e<4;e+=2-b)c=bV[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function da(a){return p.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var c,d,e=a.document,f=a.location,g=a.navigator,h=a.jQuery,i=a.$,j=Array.prototype.push,k=Array.prototype.slice,l=Array.prototype.indexOf,m=Object.prototype.toString,n=Object.prototype.hasOwnProperty,o=String.prototype.trim,p=function(a,b){return new p.fn.init(a,b,c)},q=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,r=/\S/,s=/\s+/,t=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.2",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i<j;i++)if((a=arguments[i])!=null)for(c in a){d=h[c],e=a[c];if(h===e)continue;k&&e&&(p.isPlainObject(e)||(f=p.isArray(e)))?(f?(f=!1,g=d&&p.isArray(d)?d:[]):g=d&&p.isPlainObject(d)?d:{},h[c]=p.extend(k,g,e)):e!==b&&(h[c]=e)}return h},p.extend({noConflict:function(b){return a.$===p&&(a.$=i),b&&a.jQuery===p&&(a.jQuery=h),p},isReady:!1,readyWait:1,holdReady:function(a){a?p.readyWait++:p.ready(!0)},ready:function(a){if(a===!0?--p.readyWait:p.isReady)return;if(!e.body)return setTimeout(p.ready,1);p.isReady=!0;if(a!==!0&&--p.readyWait>0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f<g;)if(c.apply(a[f++],d)===!1)break}else if(h){for(e in a)if(c.call(a[e],e,a[e])===!1)break}else for(;f<g;)if(c.call(a[f],f,a[f++])===!1)break;return a},trim:o&&!o.call(" ")?function(a){return a==null?"":o.call(a)}:function(a){return a==null?"":(a+"").replace(t,"")},makeArray:function(a,b){var c,d=b||[];return a!=null&&(c=p.type(a),a.length==null||c==="string"||c==="function"||c==="regexp"||p.isWindow(a)?j.call(d,a):p.merge(d,a)),d},inArray:function(a,b,c){var d;if(b){if(l)return l.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=c.length,e=a.length,f=0;if(typeof d=="number")for(;f<d;f++)a[e++]=c[f];else while(c[f]!==b)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;c=!!c;for(;f<g;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,c,d){var e,f,g=[],h=0,i=a.length,j=a instanceof p||i!==b&&typeof i=="number"&&(i>0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h<i;h++)e=c(a[h],h,d),e!=null&&(g[g.length]=e);else for(f in a)e=c(a[f],f,d),e!=null&&(g[g.length]=e);return g.concat.apply([],g)},guid:1,proxy:function(a,c){var d,e,f;return typeof c=="string"&&(d=a[c],c=a,a=d),p.isFunction(a)?(e=k.call(arguments,2),f=function(){return a.apply(c,e.concat(k.call(arguments)))},f.guid=a.guid=a.guid||p.guid++,f):b},access:function(a,c,d,e,f,g,h){var i,j=d==null,k=0,l=a.length;if(d&&typeof d=="object"){for(k in d)p.access(a,c,k,d[k],1,g,e);f=1}else if(e!==b){i=h===b&&p.isFunction(e),j&&(i?(i=c,c=function(a,b,c){return i.call(p(a),c)}):(c.call(a,e),c=null));if(c)for(;k<l;k++)c(a[k],d,i?e.call(a[k],k,c(a[k],d)):e,h);f=1}return f?a:j?c.call(a):l?c(a[0],d):g},now:function(){return(new Date).getTime()}}),p.ready.promise=function(b){if(!d){d=p.Deferred();if(e.readyState==="complete")setTimeout(p.ready,1);else if(e.addEventListener)e.addEventListener("DOMContentLoaded",D,!1),a.addEventListener("load",p.ready,!1);else{e.attachEvent("onreadystatechange",D),a.attachEvent("onload",p.ready);var c=!1;try{c=a.frameElement==null&&e.documentElement}catch(f){}c&&c.doScroll&&function g(){if(!p.isReady){try{c.doScroll("left")}catch(a){return setTimeout(g,50)}p.ready()}}()}}return d.promise(b)},p.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){E["[object "+b+"]"]=b.toLowerCase()}),c=p(e);var F={};p.Callbacks=function(a){a=typeof a=="string"?F[a]||G(a):p.extend({},a);var c,d,e,f,g,h,i=[],j=!a.once&&[],k=function(b){c=a.memory&&b,d=!0,h=f||0,f=0,g=i.length,e=!0;for(;i&&h<g;h++)if(i[h].apply(b[0],b[1])===!1&&a.stopOnFalse){c=!1;break}e=!1,i&&(j?j.length&&k(j.shift()):c?i=[]:l.disable())},l={add:function(){if(i){var b=i.length;(function d(b){p.each(b,function(b,c){var e=p.type(c);e==="function"&&(!a.unique||!l.has(c))?i.push(c):c&&c.length&&e!=="string"&&d(c)})})(arguments),e?g=i.length:c&&(f=b,k(c))}return this},remove:function(){return i&&p.each(arguments,function(a,b){var c;while((c=p.inArray(b,i,c))>-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return a!=null?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b<d;b++)c[b]&&p.isFunction(c[b].promise)?c[b].promise().done(g(b,j,c)).fail(f.reject).progress(g(b,i,h)):--e}return e||f.resolveWith(j,c),f.promise()}}),p.support=function(){var b,c,d,f,g,h,i,j,k,l,m,n=e.createElement("div");n.setAttribute("className","t"),n.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,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%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="<div></div>",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||p.guid++:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e<f;e++)delete d[b[e]];if(!(c?K:p.isEmptyObject)(d))return}}if(!c){delete h[i].data;if(!K(h[i]))return}g?p.cleanData([a],!0):p.support.deleteExpando||h!=h.window?delete h[i]:h[i]=null},_data:function(a,b,c){return p.data(a,b,c,!0)},acceptData:function(a){var b=a.nodeName&&p.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),p.fn.extend({data:function(a,c){var d,e,f,g,h,i=this[0],j=0,k=null;if(a===b){if(this.length){k=p.data(i);if(i.nodeType===1&&!p._data(i,"parsedAttrs")){f=i.attributes;for(h=f.length;j<h;j++)g=f[j].name,g.indexOf("data-")||(g=p.camelCase(g.substring(5)),J(i,g,k[g]));p._data(i,"parsedAttrs",!0)}}return k}return typeof a=="object"?this.each(function(){p.data(this,a)}):(d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!",p.access(this,function(c){if(c===b)return k=this.triggerHandler("getData"+e,[d[0]]),k===b&&i&&(k=p.data(i,a),k=J(i,a,k)),k===b&&d[1]?this.data(d[0]):k;d[1]=c,this.each(function(){var b=p(this);b.triggerHandler("setData"+e,d),p.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.length,e=c.shift(),f=p._queueHooks(a,b),g=function(){p.dequeue(a,b)};e==="inprogress"&&(e=c.shift(),d--),e&&(b==="fx"&&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 p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length<d?p.queue(this[0],a):c===b?this:this.each(function(){var b=p.queue(this,a,c);p._queueHooks(this,a),a==="fx"&&b[0]!=="inprogress"&&p.dequeue(this,a)})},dequeue:function(a){return this.each(function(){p.dequeue(this,a)})},delay:function(a,b){return a=p.fx?p.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=p.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};typeof a!="string"&&(c=a,a=b),a=a||"fx";while(h--)d=p._data(g[h],a+"queueHooks"),d&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var L,M,N,O=/[\t\r\n]/g,P=/\r/g,Q=/^(?:button|input)$/i,R=/^(?:button|input|object|select|textarea)$/i,S=/^a(?:rea|)$/i,T=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,U=p.support.getSetAttribute;p.fn.extend({attr:function(a,b){return p.access(this,p.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{f=" "+e.className+" ";for(g=0,h=b.length;g<h;g++)f.indexOf(" "+b[g]+" ")<0&&(f+=b[g]+" ");e.className=p.trim(f)}}}return this},removeClass:function(a){var c,d,e,f,g,h,i;if(p.isFunction(a))return this.each(function(b){p(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(s);for(h=0,i=this.length;h<i;h++){e=this[h];if(e.nodeType===1&&e.className){d=(" "+e.className+" ").replace(O," ");for(f=0,g=c.length;f<g;f++)while(d.indexOf(" "+c[f]+" ")>=0)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(O," ").indexOf(b)>=0)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c<d;c++){e=h[c];if(e.selected&&(p.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!p.nodeName(e.parentNode,"optgroup"))){b=p(e).val();if(i)return b;g.push(b)}}return i&&!g.length&&h.length?p(h[f]).val():g},set:function(a,b){var c=p.makeArray(b);return p(a).find("option").each(function(){this.selected=p.inArray(p(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,d+""),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g<d.length;g++)e=d[g],e&&(c=p.propFix[e]||e,f=T.test(e),f||p.attr(a,e,""),a.removeAttribute(U?e:c),f&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(Q.test(a.nodeName)&&a.parentNode)p.error("type property can't be changed");else if(!p.support.radioValue&&b==="radio"&&p.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}},value:{get:function(a,b){return L&&p.nodeName(a,"button")?L.get(a,b):b in a?a.value:null},set:function(a,b,c){if(L&&p.nodeName(a,"button"))return L.set(a,b,c);a.value=b}}},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(a,c,d){var e,f,g,h=a.nodeType;if(!a||h===3||h===8||h===2)return;return g=h!==1||!p.isXMLDoc(a),g&&(c=p.propFix[c]||c,f=p.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&(e=f.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):R.test(a.nodeName)||S.test(a.nodeName)&&a.href?0:b}}}}),M={get:function(a,c){var d,e=p.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;return b===!1?p.removeAttr(a,c):(d=p.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase())),c}},U||(N={name:!0,id:!0,coords:!0},L=p.valHooks.button={get:function(a,c){var d;return d=a.getAttributeNode(c),d&&(N[c]?d.value!=="":d.specified)?d.value:b},set:function(a,b,c){var d=a.getAttributeNode(c);return d||(d=e.createAttribute(c),a.setAttributeNode(d)),d.value=b+""}},p.each(["width","height"],function(a,b){p.attrHooks[b]=p.extend(p.attrHooks[b],{set:function(a,c){if(c==="")return a.setAttribute(b,"auto"),c}})}),p.attrHooks.contenteditable={get:L.get,set:function(a,b,c){b===""&&(b="false"),L.set(a,b,c)}}),p.support.hrefNormalized||p.each(["href","src","width","height"],function(a,c){p.attrHooks[c]=p.extend(p.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),p.support.style||(p.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=b+""}}),p.support.optSelected||(p.propHooks.selected=p.extend(p.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),p.support.enctype||(p.propFix.enctype="encoding"),p.support.checkOn||p.each(["radio","checkbox"],function(){p.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),p.each(["radio","checkbox"],function(){p.valHooks[this]=p.extend(p.valHooks[this],{set:function(a,b){if(p.isArray(b))return a.checked=p.inArray(p(a).val(),b)>=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j<c.length;j++){k=W.exec(c[j])||[],l=k[1],m=(k[2]||"").split(".").sort(),r=p.event.special[l]||{},l=(f?r.delegateType:r.bindType)||l,r=p.event.special[l]||{},n=p.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,needsContext:f&&p.expr.match.needsContext.test(f),namespace:m.join(".")},o),q=i[l];if(!q){q=i[l]=[],q.delegateCount=0;if(!r.setup||r.setup.call(a,e,m,h)===!1)a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h)}r.add&&(r.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,n):q.push(n),p.event.global[l]=!0}a=null},global:{},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,q,r=p.hasData(a)&&p._data(a);if(!r||!(m=r.events))return;b=p.trim(_(b||"")).split(" ");for(f=0;f<b.length;f++){g=W.exec(b[f])||[],h=i=g[1],j=g[2];if(!h){for(h in m)p.event.remove(a,h+b[f],c,d,!0);continue}n=p.event.special[h]||{},h=(d?n.delegateType:n.bindType)||h,o=m[h]||[],k=o.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(l=0;l<o.length;l++)q=o[l],(e||i===q.origType)&&(!c||c.guid===q.guid)&&(!j||j.test(q.namespace))&&(!d||d===q.selector||d==="**"&&q.selector)&&(o.splice(l--,1),q.selector&&o.delegateCount--,n.remove&&n.remove.call(a,q));o.length===0&&k!==o.length&&((!n.teardown||n.teardown.call(a,j,r.handle)===!1)&&p.removeEvent(a,h,r.handle),delete m[h])}p.isEmptyObject(m)&&(delete r.handle,p.removeData(a,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,f,g){if(!f||f.nodeType!==3&&f.nodeType!==8){var h,i,j,k,l,m,n,o,q,r,s=c.type||c,t=[];if($.test(s+p.event.triggered))return;s.indexOf("!")>=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j<q.length&&!c.isPropagationStopped();j++)k=q[j][0],c.type=q[j][1],o=(p._data(k,"events")||{})[c.type]&&p._data(k,"handle"),o&&o.apply(k,d),o=m&&k[m],o&&p.acceptData(k)&&o.apply&&o.apply(k,d)===!1&&c.preventDefault();return c.type=s,!g&&!c.isDefaultPrevented()&&(!n._default||n._default.apply(f.ownerDocument,d)===!1)&&(s!=="click"||!p.nodeName(f,"a"))&&p.acceptData(f)&&m&&f[s]&&(s!=="focus"&&s!=="blur"||c.target.offsetWidth!==0)&&!p.isWindow(f)&&(l=f[m],l&&(f[m]=null),p.event.triggered=s,f[s](),p.event.triggered=b,l&&(f[m]=l)),c.result}return},dispatch:function(c){c=p.event.fix(c||a.event);var d,e,f,g,h,i,j,l,m,n,o=(p._data(this,"events")||{})[c.type]||[],q=o.delegateCount,r=k.call(arguments),s=!c.exclusive&&!c.namespace,t=p.event.special[c.type]||{},u=[];r[0]=c,c.delegateTarget=this;if(t.preDispatch&&t.preDispatch.call(this,c)===!1)return;if(q&&(!c.button||c.type!=="click"))for(f=c.target;f!=this;f=f.parentNode||this)if(f.disabled!==!0||c.type!=="click"){h={},j=[];for(d=0;d<q;d++)l=o[d],m=l.selector,h[m]===b&&(h[m]=l.needsContext?p(m,this).index(f)>=0:p.find(m,this,null,[f]).length),h[m]&&j.push(l);j.length&&u.push({elem:f,matches:j})}o.length>q&&u.push({elem:this,matches:o.slice(q)});for(d=0;d<u.length&&!c.isPropagationStopped();d++){i=u[d],c.currentTarget=i.elem;for(e=0;e<i.matches.length&&!c.isImmediatePropagationStopped();e++){l=i.matches[e];if(s||!c.namespace&&!l.namespace||c.namespace_re&&c.namespace_re.test(l.namespace))c.data=l.data,c.handleObj=l,g=((p.event.special[l.origType]||{}).handle||l.handler).apply(i.elem,r),g!==b&&(c.result=g,g===!1&&(c.preventDefault(),c.stopPropagation()))}}return t.postDispatch&&t.postDispatch.call(this,c),c.result},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(a,b){return a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,f,g,h=c.button,i=c.fromElement;return a.pageX==null&&c.clientX!=null&&(d=a.target.ownerDocument||e,f=d.documentElement,g=d.body,a.pageX=c.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=c.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?c.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0),a}},fix:function(a){if(a[p.expando])return a;var b,c,d=a,f=p.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=p.Event(d);for(b=g.length;b;)c=g[--b],a[c]=d[c];return a.target||(a.target=d.srcElement||e),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,f.filter?f.filter(a,d):a},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){p.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=p.extend(new p.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?p.event.trigger(e,null,b):p.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},p.event.handle=p.event.dispatch,p.removeEvent=e.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]=="undefined"&&(a[d]=null),a.detachEvent(d,c))},p.Event=function(a,b){if(this instanceof p.Event)a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?bb:ba):this.type=a,b&&p.extend(this,b),this.timeStamp=a&&a.timeStamp||p.now(),this[p.expando]=!0;else return new p.Event(a,b)},p.Event.prototype={preventDefault:function(){this.isDefaultPrevented=bb;var a=this.originalEvent;if(!a)return;a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=bb;var a=this.originalEvent;if(!a)return;a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()},isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba},p.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){p.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj,g=f.selector;if(!e||e!==d&&!p.contains(d,e))a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b;return c}}}),p.support.submitBubbles||(p.event.special.submit={setup:function(){if(p.nodeName(this,"form"))return!1;p.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=p.nodeName(c,"input")||p.nodeName(c,"button")?c.form:b;d&&!p._data(d,"_submit_attached")&&(p.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),p._data(d,"_submit_attached",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&p.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(p.nodeName(this,"form"))return!1;p.event.remove(this,"._submit")}}),p.support.changeBubbles||(p.event.special.change={setup:function(){if(V.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")p.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),p.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),p.event.simulate("change",this,a,!0)});return!1}p.event.add(this,"beforeactivate._change",function(a){var b=a.target;V.test(b.nodeName)&&!p._data(b,"_change_attached")&&(p.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&p.event.simulate("change",this.parentNode,a,!0)}),p._data(b,"_change_attached",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){return p.event.remove(this,"._change"),!V.test(this.nodeName)}}),p.support.focusinBubbles||p.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){p.event.simulate(b,a.target,p.event.fix(a),!0)};p.event.special[b]={setup:function(){c++===0&&e.addEventListener(a,d,!0)},teardown:function(){--c===0&&e.removeEventListener(a,d,!0)}}}),p.fn.extend({on:function(a,c,d,e,f){var g,h;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(h in a)this.on(h,c,d,a[h],f);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=ba;else if(!e)return this;return f===1&&(g=e,e=function(a){return p().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=p.guid++)),this.each(function(){p.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,p(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if(typeof a=="object"){for(f in a)this.off(f,c,a[f]);return this}if(c===!1||typeof c=="function")d=c,c=b;return d===!1&&(d=ba),this.each(function(){p.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){return p(this.context).on(a,this.selector,b,c),this},die:function(a,b){return p(this.context).off(a,this.selector||"**",b),this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length===1?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){p.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return p.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||p.guid++,d=0,e=function(c){var e=(p._data(this,"lastToggle"+a.guid)||0)%d;return p._data(this,"lastToggle"+a.guid,e+1),c.preventDefault(),b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),p.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){p.fn[b]=function(a,c){return c==null&&(c=a,a=null),arguments.length>0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bc(a,b,c,d){c=c||[],b=b||r;var e,f,i,j,k=b.nodeType;if(!a||typeof a!="string")return c;if(k!==1&&k!==9)return[];i=g(b);if(!i&&!d)if(e=P.exec(a))if(j=e[1]){if(k===9){f=b.getElementById(j);if(!f||!f.parentNode)return c;if(f.id===j)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(j))&&h(b,f)&&f.id===j)return c.push(f),c}else{if(e[2])return w.apply(c,x.call(b.getElementsByTagName(a),0)),c;if((j=e[3])&&_&&b.getElementsByClassName)return w.apply(c,x.call(b.getElementsByClassName(j),0)),c}return bp(a.replace(L,"$1"),b,c,d,i)}function bd(a){return function(b){var c=b.nodeName.toLowerCase();return c==="input"&&b.type===a}}function be(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}}function bf(a){return z(function(b){return b=+b,z(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 bg(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}function bh(a,b){var c,d,f,g,h,i,j,k=C[o][a];if(k)return b?0:k.slice(0);h=a,i=[],j=e.preFilter;while(h){if(!c||(d=M.exec(h)))d&&(h=h.slice(d[0].length)),i.push(f=[]);c=!1;if(d=N.exec(h))f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=d[0].replace(L," ");for(g in e.filter)(d=W[g].exec(h))&&(!j[g]||(d=j[g](d,r,!0)))&&(f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=g,c.matches=d);if(!c)break}return b?h.length:h?bc.error(a):C(a,i).slice(0)}function bi(a,b,d){var e=b.dir,f=d&&b.dir==="parentNode",g=u++;return b.first?function(b,c,d){while(b=b[e])if(f||b.nodeType===1)return a(b,c,d)}:function(b,d,h){if(!h){var i,j=t+" "+g+" ",k=j+c;while(b=b[e])if(f||b.nodeType===1){if((i=b[o])===k)return b.sizset;if(typeof i=="string"&&i.indexOf(j)===0){if(b.sizset)return b}else{b[o]=k;if(a(b,d,h))return b.sizset=!0,b;b.sizset=!1}}}else while(b=b[e])if(f||b.nodeType===1)if(a(b,d,h))return b}}function bj(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 bk(a,b,c,d,e){var f,g=[],h=0,i=a.length,j=b!=null;for(;h<i;h++)if(f=a[h])if(!c||c(f,d,e))g.push(f),j&&b.push(h);return g}function bl(a,b,c,d,e,f){return d&&!d[o]&&(d=bl(d)),e&&!e[o]&&(e=bl(e,f)),z(function(f,g,h,i){if(f&&e)return;var j,k,l,m=[],n=[],o=g.length,p=f||bo(b||"*",h.nodeType?[h]:h,[],f),q=a&&(f||!b)?bk(p,m,a,h,i):p,r=c?e||(f?a:o||d)?[]:g:q;c&&c(q,r,h,i);if(d){l=bk(r,n),d(l,[],h,i),j=l.length;while(j--)if(k=l[j])r[n[j]]=!(q[n[j]]=k)}if(f){j=a&&r.length;while(j--)if(k=r[j])f[m[j]]=!(g[m[j]]=k)}else r=bk(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):w.apply(g,r)})}function bm(a){var b,c,d,f=a.length,g=e.relative[a[0].type],h=g||e.relative[" "],i=g?1:0,j=bi(function(a){return a===b},h,!0),k=bi(function(a){return y.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==l)||((b=c).nodeType?j(a,c,d):k(a,c,d))}];for(;i<f;i++)if(c=e.relative[a[i].type])m=[bi(bj(m),c)];else{c=e.filter[a[i].type].apply(null,a[i].matches);if(c[o]){d=++i;for(;d<f;d++)if(e.relative[a[d].type])break;return bl(i>1&&bj(m),i>1&&a.slice(0,i-1).join("").replace(L,"$1"),c,i<d&&bm(a.slice(i,d)),d<f&&bm(a=a.slice(d)),d<f&&a.join(""))}m.push(c)}return bj(m)}function bn(a,b){var d=b.length>0,f=a.length>0,g=function(h,i,j,k,m){var n,o,p,q=[],s=0,u="0",x=h&&[],y=m!=null,z=l,A=h||f&&e.find.TAG("*",m&&i.parentNode||i),B=t+=z==null?1:Math.E;y&&(l=i!==r&&i,c=g.el);for(;(n=A[u])!=null;u++){if(f&&n){for(o=0;p=a[o];o++)if(p(n,i,j)){k.push(n);break}y&&(t=B,c=++g.el)}d&&((n=!p&&n)&&s--,h&&x.push(n))}s+=u;if(d&&u!==s){for(o=0;p=b[o];o++)p(x,q,i,j);if(h){if(s>0)while(u--)!x[u]&&!q[u]&&(q[u]=v.call(k));q=bk(q)}w.apply(k,q),y&&!h&&q.length>0&&s+b.length>1&&bc.uniqueSort(k)}return y&&(t=B,l=z),x};return g.el=0,d?z(g):g}function bo(a,b,c,d){var e=0,f=b.length;for(;e<f;e++)bc(a,b[e],c,d);return c}function bp(a,b,c,d,f){var g,h,j,k,l,m=bh(a),n=m.length;if(!d&&m.length===1){h=m[0]=m[0].slice(0);if(h.length>2&&(j=h[0]).type==="ID"&&b.nodeType===9&&!f&&e.relative[h[1].type]){b=e.find.ID(j.matches[0].replace(V,""),b,f)[0];if(!b)return c;a=a.slice(h.shift().length)}for(g=W.POS.test(a)?-1:h.length-1;g>=0;g--){j=h[g];if(e.relative[k=j.type])break;if(l=e.find[k])if(d=l(j.matches[0].replace(V,""),R.test(h[0].type)&&b.parentNode||b,f)){h.splice(g,1),a=d.length&&h.join("");if(!a)return w.apply(c,x.call(d,0)),c;break}}}return i(a,m)(d,b,f,c,R.test(a)),c}function bq(){}var c,d,e,f,g,h,i,j,k,l,m=!0,n="undefined",o=("sizcache"+Math.random()).replace(".",""),q=String,r=a.document,s=r.documentElement,t=0,u=0,v=[].pop,w=[].push,x=[].slice,y=[].indexOf||function(a){var b=0,c=this.length;for(;b<c;b++)if(this[b]===a)return b;return-1},z=function(a,b){return a[o]=b==null||b,a},A=function(){var a={},b=[];return z(function(c,d){return b.push(c)>e.cacheLength&&delete a[b.shift()],a[c]=d},a)},B=A(),C=A(),D=A(),E="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",G=F.replace("w","w#"),H="([*^$|!~]?=)",I="\\["+E+"*("+F+")"+E+"*(?:"+H+E+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+G+")|)|)"+E+"*\\]",J=":("+F+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+I+")|[^:]|\\\\.)*|.*))\\)|)",K=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+E+"*((?:-\\d)?\\d*)"+E+"*\\)|)(?=[^-]|$)",L=new RegExp("^"+E+"+|((?:^|[^\\\\])(?:\\\\.)*)"+E+"+$","g"),M=new RegExp("^"+E+"*,"+E+"*"),N=new RegExp("^"+E+"*([\\x20\\t\\r\\n\\f>+~])"+E+"*"),O=new RegExp(J),P=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,Q=/^:not/,R=/[\x20\t\r\n\f]*[+~]/,S=/:not\($/,T=/h\d/i,U=/input|select|textarea|button/i,V=/\\(?!\\)/g,W={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),NAME:new RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:new RegExp("^("+F.replace("w","w*")+")"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+J),POS:new RegExp(K,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+E+"*(even|odd|(([+-]|)(\\d*)n|)"+E+"*(?:([+-]|)"+E+"*(\\d+)|))"+E+"*\\)|)","i"),needsContext:new RegExp("^"+E+"*[>+~]|"+K,"i")},X=function(a){var b=r.createElement("div");try{return a(b)}catch(c){return!1}finally{b=null}},Y=X(function(a){return a.appendChild(r.createComment("")),!a.getElementsByTagName("*").length}),Z=X(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==n&&a.firstChild.getAttribute("href")==="#"}),$=X(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),_=X(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!a.getElementsByClassName||!a.getElementsByClassName("e").length?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length===2)}),ba=X(function(a){a.id=o+0,a.innerHTML="<a name='"+o+"'></a><div name='"+o+"'></div>",s.insertBefore(a,s.firstChild);var b=r.getElementsByName&&r.getElementsByName(o).length===2+r.getElementsByName(o+0).length;return d=!r.getElementById(o),s.removeChild(a),b});try{x.call(s.childNodes,0)[0].nodeType}catch(bb){x=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}bc.matches=function(a,b){return bc(a,null,null,b)},bc.matchesSelector=function(a,b){return bc(b,null,null,[a]).length>0},f=bc.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=f(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=f(b);return c},g=bc.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},h=bc.contains=s.contains?function(a,b){var c=a.nodeType===9?a.documentElement:a,d=b&&b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:s.compareDocumentPosition?function(a,b){return b&&!!(a.compareDocumentPosition(b)&16)}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},bc.attr=function(a,b){var c,d=g(a);return d||(b=b.toLowerCase()),(c=e.attrHandle[b])?c(a):d||$?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},e=bc.selectors={cacheLength:50,createPseudo:z,match:W,attrHandle:Z?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},find:{ID:d?function(a,b,c){if(typeof b.getElementById!==n&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==n&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==n&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:Y?function(a,b){if(typeof b.getElementsByTagName!==n)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c},NAME:ba&&function(a,b){if(typeof b.getElementsByName!==n)return b.getElementsByName(name)},CLASS:_&&function(a,b,c){if(typeof b.getElementsByClassName!==n&&!c)return b.getElementsByClassName(a)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(V,""),a[3]=(a[4]||a[5]||"").replace(V,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||bc.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&bc.error(a[0]),a},PSEUDO:function(a){var b,c;if(W.CHILD.test(a[0]))return null;if(a[3])a[2]=a[3];else if(b=a[4])O.test(b)&&(c=bh(b,!0))&&(c=b.indexOf(")",b.length-c)-b.length)&&(b=b.slice(0,c),a[0]=a[0].slice(0,c)),a[2]=b;return a.slice(0,3)}},filter:{ID:d?function(a){return a=a.replace(V,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(V,""),function(b){var c=typeof b.getAttributeNode!==n&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(V,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=B[o][a];return b||(b=B(a,new RegExp("(^|"+E+")"+a+"("+E+"|$)"))),function(a){return b.test(a.className||typeof a.getAttribute!==n&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return function(d,e){var f=bc.attr(d,a);return f==null?b==="!=":b?(f+="",b==="="?f===c:b==="!="?f!==c:b==="^="?c&&f.indexOf(c)===0:b==="*="?c&&f.indexOf(c)>-1:b==="$="?c&&f.substr(f.length-c.length)===c:b==="~="?(" "+f+" ").indexOf(c)>-1:b==="|="?f===c||f.substr(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d){return a==="nth"?function(a){var b,e,f=a.parentNode;if(c===1&&d===0)return!0;if(f){e=0;for(b=f.firstChild;b;b=b.nextSibling)if(b.nodeType===1){e++;if(a===b)break}}return e-=d,e===c||e%c===0&&e/c>=0}:function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b){var c,d=e.pseudos[a]||e.setFilters[a.toLowerCase()]||bc.error("unsupported pseudo: "+a);return d[o]?d(b):d.length>1?(c=[a,a,"",b],e.setFilters.hasOwnProperty(a.toLowerCase())?z(function(a,c){var e,f=d(a,b),g=f.length;while(g--)e=y.call(a,f[g]),a[e]=!(c[e]=f[g])}):function(a){return d(a,0,c)}):d}},pseudos:{not:z(function(a){var b=[],c=[],d=i(a.replace(L,"$1"));return d[o]?z(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)if(f=g[h])a[h]=!(b[h]=f)}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:z(function(a){return function(b){return bc(a,b).length>0}}),contains:z(function(a){return function(b){return(b.textContent||b.innerText||f(b)).indexOf(a)>-1}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!e.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},header:function(a){return T.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:bd("radio"),checkbox:bd("checkbox"),file:bd("file"),password:bd("password"),image:bd("image"),submit:be("submit"),reset:be("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return U.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement},first:bf(function(a,b,c){return[0]}),last:bf(function(a,b,c){return[b-1]}),eq:bf(function(a,b,c){return[c<0?c+b:c]}),even:bf(function(a,b,c){for(var d=0;d<b;d+=2)a.push(d);return a}),odd:bf(function(a,b,c){for(var d=1;d<b;d+=2)a.push(d);return a}),lt:bf(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:bf(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},j=s.compareDocumentPosition?function(a,b){return a===b?(k=!0,0):(!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition:a.compareDocumentPosition(b)&4)?-1:1}:function(a,b){if(a===b)return k=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,h=b.parentNode,i=g;if(g===h)return bg(a,b);if(!g)return-1;if(!h)return 1;while(i)e.unshift(i),i=i.parentNode;i=h;while(i)f.unshift(i),i=i.parentNode;c=e.length,d=f.length;for(var j=0;j<c&&j<d;j++)if(e[j]!==f[j])return bg(e[j],f[j]);return j===c?bg(a,f[j],-1):bg(e[j],b,1)},[0,0].sort(j),m=!k,bc.uniqueSort=function(a){var b,c=1;k=m,a.sort(j);if(k)for(;b=a[c];c++)b===a[c-1]&&a.splice(c--,1);return a},bc.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},i=bc.compile=function(a,b){var c,d=[],e=[],f=D[o][a];if(!f){b||(b=bh(a)),c=b.length;while(c--)f=bm(b[c]),f[o]?d.push(f):e.push(f);f=D(a,bn(e,d))}return f},r.querySelectorAll&&function(){var a,b=bp,c=/'|\\/g,d=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,e=[":focus"],f=[":active",":focus"],h=s.matchesSelector||s.mozMatchesSelector||s.webkitMatchesSelector||s.oMatchesSelector||s.msMatchesSelector;X(function(a){a.innerHTML="<select><option selected=''></option></select>",a.querySelectorAll("[selected]").length||e.push("\\["+E+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),X(function(a){a.innerHTML="<p test=''></p>",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+E+"*(?:\"\"|'')"),a.innerHTML="<input type='hidden'/>",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=new RegExp(e.join("|")),bp=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a))){var i,j,k=!0,l=o,m=d,n=d.nodeType===9&&a;if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){i=bh(a),(k=d.getAttribute("id"))?l=k.replace(c,"\\$&"):d.setAttribute("id",l),l="[id='"+l+"'] ",j=i.length;while(j--)i[j]=l+i[j].join("");m=R.test(a)&&d.parentNode||d,n=i.join(",")}if(n)try{return w.apply(f,x.call(m.querySelectorAll(n),0)),f}catch(p){}finally{k||d.removeAttribute("id")}}return b(a,d,f,g,h)},h&&(X(function(b){a=h.call(b,"div");try{h.call(b,"[test!='']:sizzle"),f.push("!=",J)}catch(c){}}),f=new RegExp(f.join("|")),bc.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!g(b)&&!f.test(c)&&(!e||!e.test(c)))try{var i=h.call(b,c);if(i||a||b.document&&b.document.nodeType!==11)return i}catch(j){}return bc(c,null,null,[b]).length>0})}(),e.pseudos.nth=e.pseudos.eq,e.filters=bq.prototype=e.pseudos,e.setFilters=new bq,bc.attr=p.attr,p.find=bc,p.expr=bc.selectors,p.expr[":"]=p.expr.pseudos,p.unique=bc.uniqueSort,p.text=bc.getText,p.isXMLDoc=bc.isXML,p.contains=bc.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b<c;b++)if(p.contains(h[b],this))return!0});g=this.pushStack("","find",a);for(b=0,c=this.length;b<c;b++){d=g.length,p.find(a,this[b],g);if(b>0)for(e=d;e<g.length;e++)for(f=0;f<d;f++)if(g[f]===g[e]){g.splice(e--,1);break}}return g},has:function(a){var b,c=p(a,this),d=c.length;return this.filter(function(){for(b=0;b<d;b++)if(p.contains(this,c[b]))return!0})},not:function(a){return this.pushStack(bj(this,a,!1),"not",a)},filter:function(a){return this.pushStack(bj(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?bf.test(a)?p(a,this.context).index(this[0])>=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d<e;d++){c=this[d];while(c&&c.ownerDocument&&c!==b&&c.nodeType!==11){if(g?g.index(c)>-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/<tbody/i,br=/<|&#?\w+;/,bs=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,bu=new RegExp("<(?:"+bl+")[\\s/>]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,bz={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,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X<div>","</div>"]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return bh(this[0])?this.length?this.pushStack(p(p.isFunction(a)?a():a),"replaceWith",a):this:p.isFunction(a)?this.each(function(b){var c=p(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=p(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;p(this).remove(),b?p(b).before(a):p(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],l=this.length;if(!p.support.checkClone&&l>1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i<l;i++)d.call(c&&p.nodeName(this[i],"table")?bC(this[i],"tbody"):this[i],i===h?g:p.clone(g,!0,!0))}g=f=null,k.length&&p.each(k,function(a,b){b.src?p.ajax?p.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):p.error("no ajax"):p.globalEval((b.text||b.textContent||b.innerHTML||"").replace(by,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),p.buildFragment=function(a,c,d){var f,g,h,i=a[0];return c=c||e,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,a.length===1&&typeof i=="string"&&i.length<512&&c===e&&i.charAt(0)==="<"&&!bt.test(i)&&(p.support.checkClone||!bw.test(i))&&(p.support.html5Clone||!bu.test(i))&&(g=!0,f=p.fragments[i],h=f!==b),f||(f=c.createDocumentFragment(),p.clean(a,c,f,d),g&&(p.fragments[i]=h&&f)),{fragment:f,cacheable:g}},p.fragments={},p.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){p.fn[a]=function(c){var d,e=0,f=[],g=p(c),h=g.length,i=this.length===1&&this[0].parentNode;if((i==null||i&&i.nodeType===11&&i.childNodes.length===1)&&h===1)return g[b](this[0]),this;for(;e<h;e++)d=(e>0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=b===e&&bA,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(f=0;(h=a[f])!=null;f++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{s=s||bk(b),l=b.createElement("div"),s.appendChild(l),h=h.replace(bo,"<$1></$2>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]==="<table>"&&!m?l.childNodes:[];for(g=n.length-1;g>=0;--g)p.nodeName(n[g],"tbody")&&!n[g].childNodes.length&&n[g].parentNode.removeChild(n[g])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l.parentNode.removeChild(l)}h.nodeType?t.push(h):p.merge(t,h)}l&&(h=l=s=null);if(!p.support.appendChecked)for(f=0;(h=t[f])!=null;f++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(f=0;(h=t[f])!=null;f++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[f+1,0].concat(r)),f+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.chrome?b.webkit=!0:b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^(none|table(?!-c[ea]).+)/,bO=/^margin/,bP=new RegExp("^("+q+")(.*)$","i"),bQ=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bR=new RegExp("^([-+])=("+q+")","i"),bS={},bT={position:"absolute",visibility:"hidden",display:"block"},bU={letterSpacing:0,fontWeight:400},bV=["Top","Right","Bottom","Left"],bW=["Webkit","O","Moz","ms"],bX=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return b$(this,!0)},hide:function(){return b$(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bX.apply(this,arguments):this.each(function(){(c?a:bZ(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bY(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bR.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bY(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bU&&(f=bU[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(b,c){var d,e,f,g,h=a.getComputedStyle(b,null),i=b.style;return h&&(d=h[c],d===""&&!p.contains(b.ownerDocument,b)&&(d=p.style(b,c)),bQ.test(d)&&bO.test(c)&&(e=i.width,f=i.minWidth,g=i.maxWidth,i.minWidth=i.maxWidth=i.width=d,d=h.width,i.width=e,i.minWidth=f,i.maxWidth=g)),d}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bQ.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth===0&&bN.test(bH(a,"display"))?p.swap(a,bT,function(){return cb(a,b,d)}):cb(a,b,d)},set:function(a,c,d){return b_(a,c,d?ca(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.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=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bQ.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bV[d]+b]=e[d]||e[d-2]||e[0];return f}},bO.test(a)||(p.cssHooks[a+b].set=b_)});var cd=/%20/g,ce=/\[\]$/,cf=/\r?\n/g,cg=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ch=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ch.test(this.nodeName)||cg.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(cf,"\r\n")}}):{name:b.name,value:c.replace(cf,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ci(d,a[d],c,f);return e.join("&").replace(cd,"+")};var cj,ck,cl=/#.*$/,cm=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,co=/^(?:GET|HEAD)$/,cp=/^\/\//,cq=/\?/,cr=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,cs=/([?&])_=[^&]*/,ct=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,cu=p.fn.load,cv={},cw={},cx=["*/"]+["*"];try{ck=f.href}catch(cy){ck=e.createElement("a"),ck.href="",ck=ck.href}cj=ct.exec(ck.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&cu)return cu.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):c&&typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("<div>").append(a.replace(cr,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cB(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cB(a,b),a},ajaxSettings:{url:ck,isLocal:cn.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cx},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cz(cv),ajaxTransport:cz(cw),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cC(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cD(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=(c||y)+"",k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cm.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(cl,"").replace(cp,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=ct.exec(l.url.toLowerCase())||!1,l.crossDomain=i&&i.join(":")+(i[3]?"":i[1]==="http:"?80:443)!==cj.join(":")+(cj[3]?"":cj[1]==="http:"?80:443)),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cA(cv,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!co.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cq.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cs,"$1_="+z);l.url=A+(A===l.url?(cq.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cx+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cA(cw,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cE=[],cF=/\?/,cG=/(=)\?(?=&|$)|\?\?/,cH=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cE.pop()||p.expando+"_"+cH++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cG.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cG.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cG,"$1"+f):m?c.data=i.replace(cG,"$1"+f):k&&(c.url+=(cF.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cE.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cI,cJ=a.ActiveXObject?function(){for(var a in cI)cI[a](0,1)}:!1,cK=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cL()||cM()}:cL,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cJ&&delete cI[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cK,cJ&&(cI||(cI={},p(a).unload(cJ)),cI[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cN,cO,cP=/^(?:toggle|show|hide)$/,cQ=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cR=/queueHooks$/,cS=[cY],cT={"*":[function(a,b){var c,d,e=this.createTween(a,b),f=cQ.exec(b),g=e.cur(),h=+g||0,i=1,j=20;if(f){c=+f[2],d=f[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&h){h=p.css(e.elem,a,!0)||c||1;do i=i||".5",h=h/i,p.style(e.elem,a,h+d);while(i!==(i=e.cur()/g)&&i!==1&&--j)}e.unit=d,e.start=h,e.end=f[1]?h+(f[1]+1)*c:c}return e}]};p.Animation=p.extend(cW,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d<e;d++)c=a[d],cT[c]=cT[c]||[],cT[c].unshift(b)},prefilter:function(a,b){b?cS.unshift(a):cS.push(a)}}),p.Tween=cZ,cZ.prototype={constructor:cZ,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||(p.cssNumber[c]?"":"px")},cur:function(){var a=cZ.propHooks[this.prop];return a&&a.get?a.get(this):cZ.propHooks._default.get(this)},run:function(a){var b,c=cZ.propHooks[this.prop];return this.options.duration?this.pos=b=p.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):cZ.propHooks._default.set(this),this}},cZ.prototype.init.prototype=cZ.prototype,cZ.propHooks={_default:{get:function(a){var b;return a.elem[a.prop]==null||!!a.elem.style&&a.elem.style[a.prop]!=null?(b=p.css(a.elem,a.prop,!1,""),!b||b==="auto"?0:b):a.elem[a.prop]},set:function(a){p.fx.step[a.prop]?p.fx.step[a.prop](a):a.elem.style&&(a.elem.style[p.cssProps[a.prop]]!=null||p.cssHooks[a.prop])?p.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},cZ.propHooks.scrollTop=cZ.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},p.each(["toggle","show","hide"],function(a,b){var c=p.fn[b];p.fn[b]=function(d,e,f){return d==null||typeof d=="boolean"||!a&&p.isFunction(d)&&p.isFunction(e)?c.apply(this,arguments):this.animate(c$(b,!0),d,e,f)}}),p.fn.extend({fadeTo:function(a,b,c,d){return this.filter(bZ).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=p.isEmptyObject(a),f=p.speed(b,c,d),g=function(){var b=cW(this,p.extend({},a),f);e&&b.stop(!0)};return e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,c,d){var e=function(a){var b=a.stop;delete a.stop,b(d)};return typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,c=a!=null&&a+"queueHooks",f=p.timers,g=p._data(this);if(c)g[c]&&g[c].stop&&e(g[c]);else for(c in g)g[c]&&g[c].stop&&cR.test(c)&&e(g[c]);for(c=f.length;c--;)f[c].elem===this&&(a==null||f[c].queue===a)&&(f[c].anim.stop(d),b=!1,f.splice(c,1));(b||!d)&&p.dequeue(this,a)})}}),p.each({slideDown:c$("show"),slideUp:c$("hide"),slideToggle:c$("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){p.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),p.speed=function(a,b,c){var d=a&&typeof a=="object"?p.extend({},a):{complete:c||!c&&b||p.isFunction(a)&&a,duration:a,easing:c&&b||b&&!p.isFunction(b)&&b};d.duration=p.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in p.fx.speeds?p.fx.speeds[d.duration]:p.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";return d.old=d.complete,d.complete=function(){p.isFunction(d.old)&&d.old.call(this),d.queue&&p.dequeue(this,d.queue)},d},p.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},p.timers=[],p.fx=cZ.prototype.init,p.fx.tick=function(){var a,b=p.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||p.fx.stop()},p.fx.timer=function(a){a()&&p.timers.push(a)&&!cO&&(cO=setInterval(p.fx.tick,p.fx.interval))},p.fx.interval=13,p.fx.stop=function(){clearInterval(cO),cO=null},p.fx.speeds={slow:600,fast:200,_default:400},p.fx.step={},p.expr&&p.expr.filters&&(p.expr.filters.animated=function(a){return p.grep(p.timers,function(b){return a===b.elem}).length});var c_=/^(?:body|html)$/i;p.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){p.offset.setOffset(this,a,b)});var c,d,e,f,g,h,i,j={top:0,left:0},k=this[0],l=k&&k.ownerDocument;if(!l)return;return(d=l.body)===k?p.offset.bodyOffset(k):(c=l.documentElement,p.contains(c,k)?(typeof k.getBoundingClientRect!="undefined"&&(j=k.getBoundingClientRect()),e=da(l),f=c.clientTop||d.clientTop||0,g=c.clientLeft||d.clientLeft||0,h=e.pageYOffset||c.scrollTop,i=e.pageXOffset||c.scrollLeft,{top:j.top+h-f,left:j.left+i-g}):j)},p.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;return p.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(p.css(a,"marginTop"))||0,c+=parseFloat(p.css(a,"marginLeft"))||0),{top:b,left:c}},setOffset:function(a,b,c){var d=p.css(a,"position");d==="static"&&(a.style.position="relative");var e=p(a),f=e.offset(),g=p.css(a,"top"),h=p.css(a,"left"),i=(d==="absolute"||d==="fixed")&&p.inArray("auto",[g,h])>-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c_.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c_.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=da(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g,null)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window);
|
imports/api/interests/interests.js
|
howlround/worldtheatremap
|
// Meteor
import { TAPi18n } from 'meteor/tap:i18n';
// Utilities
import React from 'react';
import ReactSelect from 'react-select';
import { FormattedMessage } from 'react-intl';
import t from 'tcomb-form';
import Checkboxes from '../../ui/components/Checkboxes.jsx';
class InterestsCollection extends TAPi18n.Collection {
// insert(profile, callback) {
// }
// remove(selector, callback) {
// }
}
export const Interests = new InterestsCollection('Interests');
// Deny all client-side updates since we will be using methods to manage this collection
Interests.deny({
insert() { return true; },
update() { return true; },
remove() { return true; },
});
Interests.publicFields = {
value: 1,
label: 1,
};
export const interestsSelectFactory = (locale, multiValue = false) => {
// interestsSelectFactory options
const sortKey = (!locale || locale === 'en') ? 'label' : `i18n.${locale}.label`;
const sort = {};
sort[sortKey] = 1;
const allInterests = Interests.find({}, { sort }).fetch();
// interestsSelectFactory template
const allInterestsTags = t.form.Form.templates.select.clone({
renderSelect: (locals) => {
function onChange(options) {
if (multiValue === true) {
const values = (options || []).map(({ value }) => value);
locals.onChange(values);
} else {
if (options) {
locals.onChange(options.value);
} else {
locals.onChange(null);
}
}
}
const placeholder = (<FormattedMessage
id="forms.selectPlaceholder"
description="Select widget placeholder"
defaultMessage="Select..."
/>);
return (
<ReactSelect
multi
autoBlur
options={allInterests}
value={locals.value}
onChange={onChange}
className="interests-edit"
placeholder={placeholder}
/>
);
},
});
// interestsSelectFactory factory function
class ReactSelectInterestsFactory extends t.form.Component {
getTemplate() {
return allInterestsTags;
}
}
ReactSelectInterestsFactory.transformer = t.form.List.transformer;
return ReactSelectInterestsFactory;
};
export const interestsCheckboxFactory = (locale) => {
// interestsCheckboxFactory options
const sortKey = (!locale || locale === 'en') ? 'label' : `i18n.${locale}.label`;
const sort = {};
sort[sortKey] = 1;
const allInterests = Interests.find({}, { sort }).fetch();
// interestsCheckboxFactory template
const interestsCheckboxes = t.form.Form.templates.select.clone({
renderSelect: (locals) => (
<Checkboxes
options={allInterests}
values={locals.value}
name="interests"
onChange={locals.onChange}
/>
),
});
// interestsCheckboxFactory factory function
class CheckboxesInterestsFactory extends t.form.Component {
getTemplate() {
return interestsCheckboxes;
}
}
CheckboxesInterestsFactory.transformer = t.form.List.transformer;
return CheckboxesInterestsFactory;
};
|
client/src/components/SignUpForm.js
|
didju/didju
|
import React, { Component } from 'react';
import { Redirect } from 'react-router-dom';
import PropTypes from 'prop-types';
// import fetch from '../fetch';
export default class SignUpForm extends Component {
constructor(props) {
super(props);
this.state = {
firstName: '',
lastName: '',
email: '',
password: '',
errorMessage: '',
redirect: false,
};
this.handleChange = this.handleChange.bind(this);
this.handleSignUp = this.handleSignUp.bind(this);
}
handleChange(e) {
this.setState({ [e.target.name]: e.target.value });
}
handleSignUp(e) {
e.preventDefault();
const payload = {
firstName: this.state.firstName,
lastName: this.state.lastName,
email: this.state.email,
password: this.state.password,
};
fetch('/api/users', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-type': 'application/json',
},
body: JSON.stringify(payload),
})
.then(res => res.json())
.then((res) => {
if (res.token) {
this.setState({
firstName: '',
lastName: '',
email: '',
password: '',
errorMessage: '',
}, () => {
this.props.updateState({
name: res.name,
signedIn: true,
token: res.token,
}, () => this.setState({ redirect: true }));
});
} else {
this.setState({
errorMessage: res.message,
});
}
});
}
render() {
if (this.state.redirect) {
return <Redirect to="/setup" />;
}
return (
<div>
<h3>Sign up:</h3>
{this.state.errorMessage && (
<p>{this.state.errorMessage}</p>
)}
<form onSubmit={this.handleSignUp} autoComplete="off" >
<input
name="firstName"
type="text"
placeholder="first name"
value={this.state.firstName}
onChange={this.handleChange}
required
/> <br />
<input
name="lastName"
type="text"
placeholder="last name"
value={this.state.lastName}
onChange={this.handleChange}
required
/> <br />
<input
name="email"
type="email"
placeholder="email"
value={this.state.email}
onChange={this.handleChange}
required
/> <br />
<input
name="password"
type="password"
placeholder="password"
value={this.state.password}
onChange={this.handleChange}
required
/> <br />
<button type="submit" >submit</button>
</form>
</div>
);
}
}
SignUpForm.propTypes = {
updateState: PropTypes.func.isRequired,
};
|
fields/components/ItemsTableCell.js
|
dvdcastro/keystone
|
import React from 'react';
import classnames from 'classnames';
function ItemsTableCell ({ className, ...props }) {
props.className = classnames('ItemList__col', className);
return <td {...props} />;
};
module.exports = ItemsTableCell;
|
docs/src/app/components/pages/components/IconButton/Page.js
|
rscnt/material-ui
|
import React from 'react';
import Title from 'react-title-component';
import CodeExample from '../../../CodeExample';
import PropTypeDescription from '../../../PropTypeDescription';
import MarkdownElement from '../../../MarkdownElement';
import iconButtonCode from '!raw!material-ui/lib/IconButton/IconButton';
import iconButtonReadmeText from './README';
import iconButtonExampleSimpleCode from '!raw!./ExampleSimple';
import IconButtonExampleSimple from './ExampleSimple';
import iconButtonExampleComplexCode from '!raw!./ExampleComplex';
import IconButtonExampleComplex from './ExampleComplex';
import iconButtonExampleSizeCode from '!raw!./ExampleSize';
import IconButtonExampleSize from './ExampleSize';
import iconButtonExampleTooltipCode from '!raw!./ExampleTooltip';
import IconButtonExampleTooltip from './ExampleTooltip';
import iconButtonExampleTouchCode from '!raw!./ExampleTouch';
import IconButtonExampleTouch from './ExampleTouch';
const descriptions = {
simple: 'An Icon Button using an icon specified with the `iconClassName` property, and a `disabled` example.',
tooltip: 'Icon Buttons showing the available `tooltip` positions.',
touch: 'The `touch` property adjusts the tooltip size for better visibility on mobile devices.',
size: 'Examples of Icon Button in different sizes.',
other: 'An Icon Button using a nested [Font Icon](/#/components/font-icon), ' +
'a nested [SVG Icon](/#/components/svg-icon) and an icon font ligature.',
};
const IconButtonPage = () => (
<div>
<Title render={(previousTitle) => `Icon Button - ${previousTitle}`} />
<MarkdownElement text={iconButtonReadmeText} />
<CodeExample
title="Simple example"
description={descriptions.simple}
code={iconButtonExampleSimpleCode}
>
<IconButtonExampleSimple />
</CodeExample>
<CodeExample
title="Further examples"
description={descriptions.other}
code={iconButtonExampleComplexCode}
>
<IconButtonExampleComplex />
</CodeExample>
<CodeExample
title="Size examples"
description={descriptions.size}
code={iconButtonExampleSizeCode}
>
<IconButtonExampleSize />
</CodeExample>
<CodeExample
title="Tooltip examples"
description={descriptions.tooltip}
code={iconButtonExampleTooltipCode}
>
<IconButtonExampleTooltip />
</CodeExample>
<CodeExample
title="Touch example"
description={descriptions.touch}
code={iconButtonExampleTouchCode}
>
<IconButtonExampleTouch />
</CodeExample>
<PropTypeDescription code={iconButtonCode} />
</div>
);
export default IconButtonPage;
|
ajax/libs/ember-data.js/0.0.12/ember-data.prod.js
|
mirthy/cdnjs
|
(function() {
window.DS = Ember.Namespace.create({
// this one goes past 11
CURRENT_API_REVISION: 12
});
})();
(function() {
/**
* Date.parse with progressive enhancement for ISO 8601 <https://github.com/csnover/js-iso8601>
* © 2011 Colin Snover <http://zetafleet.com>
* Released under MIT license.
*/
Ember.Date = Ember.Date || {};
var origParse = Date.parse, numericKeys = [ 1, 4, 5, 6, 7, 10, 11 ];
Ember.Date.parse = function (date) {
var timestamp, struct, minutesOffset = 0;
// ES5 §15.9.4.2 states that the string should attempt to be parsed as a Date Time String Format string
// before falling back to any implementation-specific date parsing, so that’s what we do, even if native
// implementations could be faster
// 1 YYYY 2 MM 3 DD 4 HH 5 mm 6 ss 7 msec 8 Z 9 ± 10 tzHH 11 tzmm
if ((struct = /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(date))) {
// avoid NaN timestamps caused by “undefined” values being passed to Date.UTC
for (var i = 0, k; (k = numericKeys[i]); ++i) {
struct[k] = +struct[k] || 0;
}
// allow undefined days and months
struct[2] = (+struct[2] || 1) - 1;
struct[3] = +struct[3] || 1;
if (struct[8] !== 'Z' && struct[9] !== undefined) {
minutesOffset = struct[10] * 60 + struct[11];
if (struct[9] === '+') {
minutesOffset = 0 - minutesOffset;
}
}
timestamp = Date.UTC(struct[1], struct[2], struct[3], struct[4], struct[5] + minutesOffset, struct[6], struct[7]);
}
else {
timestamp = origParse ? origParse(date) : NaN;
}
return timestamp;
};
if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.Date) {
Date.parse = Ember.Date.parse;
}
})();
(function() {
})();
(function() {
var DeferredMixin = Ember.DeferredMixin, // ember-runtime/mixins/deferred
Evented = Ember.Evented, // ember-runtime/mixins/evented
run = Ember.run, // ember-metal/run-loop
get = Ember.get; // ember-metal/accessors
var LoadPromise = Ember.Mixin.create(Evented, DeferredMixin, {
init: function() {
this._super.apply(this, arguments);
this.one('didLoad', function() {
run(this, 'resolve', this);
});
if (get(this, 'isLoaded')) {
this.trigger('didLoad');
}
}
});
DS.LoadPromise = LoadPromise;
})();
(function() {
var get = Ember.get, set = Ember.set;
var LoadPromise = DS.LoadPromise; // system/mixins/load_promise
/**
A record array is an array that contains records of a certain type. The record
array materializes records as needed when they are retrieved for the first
time. You should not create record arrays yourself. Instead, an instance of
DS.RecordArray or its subclasses will be returned by your application's store
in response to queries.
*/
DS.RecordArray = Ember.ArrayProxy.extend(Ember.Evented, LoadPromise, {
/**
The model type contained by this record array.
@type DS.Model
*/
type: null,
// The array of client ids backing the record array. When a
// record is requested from the record array, the record
// for the client id at the same index is materialized, if
// necessary, by the store.
content: null,
isLoaded: false,
isUpdating: false,
// The store that created this record array.
store: null,
objectAtContent: function(index) {
var content = get(this, 'content'),
reference = content.objectAt(index),
store = get(this, 'store');
if (reference) {
return store.recordForReference(reference);
}
},
materializedObjectAt: function(index) {
var reference = get(this, 'content').objectAt(index);
if (!reference) { return; }
if (get(this, 'store').recordIsMaterialized(reference)) {
return this.objectAt(index);
}
},
update: function() {
if (get(this, 'isUpdating')) { return; }
var store = get(this, 'store'),
type = get(this, 'type');
store.fetchAll(type, this);
},
addReference: function(reference) {
get(this, 'content').addObject(reference);
},
removeReference: function(reference) {
get(this, 'content').removeObject(reference);
}
});
})();
(function() {
var get = Ember.get;
DS.FilteredRecordArray = DS.RecordArray.extend({
filterFunction: null,
isLoaded: true,
replace: function() {
var type = get(this, 'type').toString();
throw new Error("The result of a client-side filter (on " + type + ") is immutable.");
},
updateFilter: Ember.observer(function() {
var store = get(this, 'store');
store.updateRecordArrayFilter(this, get(this, 'type'), get(this, 'filterFunction'));
}, 'filterFunction')
});
})();
(function() {
var get = Ember.get, set = Ember.set;
DS.AdapterPopulatedRecordArray = DS.RecordArray.extend({
query: null,
replace: function() {
var type = get(this, 'type').toString();
throw new Error("The result of a server query (on " + type + ") is immutable.");
},
load: function(references) {
var store = get(this, 'store'), type = get(this, 'type');
this.beginPropertyChanges();
set(this, 'content', Ember.A(references));
set(this, 'isLoaded', true);
this.endPropertyChanges();
var self = this;
// TODO: does triggering didLoad event should be the last action of the runLoop?
Ember.run.once(function() {
self.trigger('didLoad');
});
}
});
})();
(function() {
var get = Ember.get, set = Ember.set;
/**
A ManyArray is a RecordArray that represents the contents of a has-many
relationship.
The ManyArray is instantiated lazily the first time the relationship is
requested.
### Inverses
Often, the relationships in Ember Data applications will have
an inverse. For example, imagine the following models are
defined:
App.Post = DS.Model.extend({
comments: DS.hasMany('App.Comment')
});
App.Comment = DS.Model.extend({
post: DS.belongsTo('App.Post')
});
If you created a new instance of `App.Post` and added
a `App.Comment` record to its `comments` has-many
relationship, you would expect the comment's `post`
property to be set to the post that contained
the has-many.
We call the record to which a relationship belongs the
relationship's _owner_.
*/
DS.ManyArray = DS.RecordArray.extend({
init: function() {
this._super.apply(this, arguments);
this._changesToSync = Ember.OrderedSet.create();
},
/**
@private
The record to which this relationship belongs.
@property {DS.Model}
*/
owner: null,
/**
@private
`true` if the relationship is polymorphic, `false` otherwise.
@property {Boolean}
*/
isPolymorphic: false,
// LOADING STATE
isLoaded: false,
loadingRecordsCount: function(count) {
this.loadingRecordsCount = count;
},
loadedRecord: function() {
this.loadingRecordsCount--;
if (this.loadingRecordsCount === 0) {
set(this, 'isLoaded', true);
this.trigger('didLoad');
}
},
fetch: function() {
var references = get(this, 'content'),
store = get(this, 'store'),
owner = get(this, 'owner');
store.fetchUnloadedReferences(references, owner);
},
// Overrides Ember.Array's replace method to implement
replaceContent: function(index, removed, added) {
// Map the array of record objects into an array of client ids.
added = added.map(function(record) {
return get(record, '_reference');
}, this);
this._super(index, removed, added);
},
arrangedContentDidChange: function() {
this.fetch();
},
arrayContentWillChange: function(index, removed, added) {
var owner = get(this, 'owner'),
name = get(this, 'name');
if (!owner._suspendedRelationships) {
// This code is the first half of code that continues inside
// of arrayContentDidChange. It gets or creates a change from
// the child object, adds the current owner as the old
// parent if this is the first time the object was removed
// from a ManyArray, and sets `newParent` to null.
//
// Later, if the object is added to another ManyArray,
// the `arrayContentDidChange` will set `newParent` on
// the change.
for (var i=index; i<index+removed; i++) {
var reference = get(this, 'content').objectAt(i);
var change = DS.RelationshipChange.createChange(owner.get('_reference'), reference, get(this, 'store'), {
parentType: owner.constructor,
changeType: "remove",
kind: "hasMany",
key: name
});
this._changesToSync.add(change);
}
}
return this._super.apply(this, arguments);
},
arrayContentDidChange: function(index, removed, added) {
this._super.apply(this, arguments);
var owner = get(this, 'owner'),
name = get(this, 'name'),
store = get(this, 'store');
if (!owner._suspendedRelationships) {
// This code is the second half of code that started in
// `arrayContentWillChange`. It gets or creates a change
// from the child object, and adds the current owner as
// the new parent.
for (var i=index; i<index+added; i++) {
var reference = get(this, 'content').objectAt(i);
var change = DS.RelationshipChange.createChange(owner.get('_reference'), reference, store, {
parentType: owner.constructor,
changeType: "add",
kind:"hasMany",
key: name
});
change.hasManyName = name;
this._changesToSync.add(change);
}
// We wait until the array has finished being
// mutated before syncing the OneToManyChanges created
// in arrayContentWillChange, so that the array
// membership test in the sync() logic operates
// on the final results.
this._changesToSync.forEach(function(change) {
change.sync();
});
DS.OneToManyChange.ensureSameTransaction(this._changesToSync, store);
this._changesToSync.clear();
}
},
// Create a child record within the owner
createRecord: function(hash, transaction) {
var owner = get(this, 'owner'),
store = get(owner, 'store'),
type = get(this, 'type'),
record;
transaction = transaction || get(owner, 'transaction');
record = store.createRecord.call(store, type, hash, transaction);
this.pushObject(record);
return record;
}
});
})();
(function() {
})();
(function() {
var get = Ember.get, set = Ember.set, fmt = Ember.String.fmt,
removeObject = Ember.EnumerableUtils.removeObject, forEach = Ember.EnumerableUtils.forEach;
/**
A transaction allows you to collect multiple records into a unit of work
that can be committed or rolled back as a group.
For example, if a record has local modifications that have not yet
been saved, calling `commit()` on its transaction will cause those
modifications to be sent to the adapter to be saved. Calling
`rollback()` on its transaction would cause all of the modifications to
be discarded and the record to return to the last known state before
changes were made.
If a newly created record's transaction is rolled back, it will
immediately transition to the deleted state.
If you do not explicitly create a transaction, a record is assigned to
an implicit transaction called the default transaction. In these cases,
you can treat your application's instance of `DS.Store` as a transaction
and call the `commit()` and `rollback()` methods on the store itself.
Once a record has been successfully committed or rolled back, it will
be moved back to the implicit transaction. Because it will now be in
a clean state, it can be moved to a new transaction if you wish.
### Creating a Transaction
To create a new transaction, call the `transaction()` method of your
application's `DS.Store` instance:
var transaction = App.store.transaction();
This will return a new instance of `DS.Transaction` with no records
yet assigned to it.
### Adding Existing Records
Add records to a transaction using the `add()` method:
record = App.store.find(App.Person, 1);
transaction.add(record);
Note that only records whose `isDirty` flag is `false` may be added
to a transaction. Once modifications to a record have been made
(its `isDirty` flag is `true`), it is not longer able to be added to
a transaction.
### Creating New Records
Because newly created records are dirty from the time they are created,
and because dirty records can not be added to a transaction, you must
use the `createRecord()` method to assign new records to a transaction.
For example, instead of this:
var transaction = store.transaction();
var person = App.Person.createRecord({ name: "Steve" });
// won't work because person is dirty
transaction.add(person);
Call `createRecord()` on the transaction directly:
var transaction = store.transaction();
transaction.createRecord(App.Person, { name: "Steve" });
### Asynchronous Commits
Typically, all of the records in a transaction will be committed
together. However, new records that have a dependency on other new
records need to wait for their parent record to be saved and assigned an
ID. In that case, the child record will continue to live in the
transaction until its parent is saved, at which time the transaction will
attempt to commit again.
For this reason, you should not re-use transactions once you have committed
them. Always make a new transaction and move the desired records to it before
calling commit.
*/
var arrayDefault = function() { return []; };
DS.Transaction = Ember.Object.extend({
/**
@private
Creates the bucket data structure used to segregate records by
type.
*/
init: function() {
set(this, 'buckets', {
clean: Ember.OrderedSet.create(),
created: Ember.OrderedSet.create(),
updated: Ember.OrderedSet.create(),
deleted: Ember.OrderedSet.create(),
inflight: Ember.OrderedSet.create()
});
set(this, 'relationships', Ember.OrderedSet.create());
},
/**
Creates a new record of the given type and assigns it to the transaction
on which the method was called.
This is useful as only clean records can be added to a transaction and
new records created using other methods immediately become dirty.
@param {DS.Model} type the model type to create
@param {Object} hash the data hash to assign the new record
*/
createRecord: function(type, hash) {
var store = get(this, 'store');
return store.createRecord(type, hash, this);
},
isEqualOrDefault: function(other) {
if (this === other || other === get(this, 'store.defaultTransaction')) {
return true;
}
},
isDefault: Ember.computed(function() {
return this === get(this, 'store.defaultTransaction');
}),
/**
Adds an existing record to this transaction. Only records without
modficiations (i.e., records whose `isDirty` property is `false`)
can be added to a transaction.
@param {DS.Model} record the record to add to the transaction
*/
add: function(record) {
var recordTransaction = get(record, 'transaction'),
defaultTransaction = get(this, 'store.defaultTransaction');
// Make `add` idempotent
if (recordTransaction === this) { return; }
// XXX it should be possible to move a dirty transaction from the default transaction
// we could probably make this work if someone has a valid use case. Do you?
this.adoptRecord(record);
},
relationshipBecameDirty: function(relationship) {
get(this, 'relationships').add(relationship);
},
relationshipBecameClean: function(relationship) {
get(this, 'relationships').remove(relationship);
},
/**
Commits the transaction, which causes all of the modified records that
belong to the transaction to be sent to the adapter to be saved.
Once you call `commit()` on a transaction, you should not re-use it.
When a record is saved, it will be removed from this transaction and
moved back to the store's default transaction.
*/
commit: function() {
var store = get(this, 'store');
var adapter = get(store, '_adapter');
var defaultTransaction = get(store, 'defaultTransaction');
var iterate = function(records) {
var set = records.copy();
set.forEach(function (record) {
record.send('willCommit');
});
return set;
};
var relationships = get(this, 'relationships');
var commitDetails = {
created: iterate(this.bucketForType('created')),
updated: iterate(this.bucketForType('updated')),
deleted: iterate(this.bucketForType('deleted')),
relationships: relationships
};
if (this === defaultTransaction) {
set(store, 'defaultTransaction', store.transaction());
}
this.removeCleanRecords();
if (!commitDetails.created.isEmpty() || !commitDetails.updated.isEmpty() || !commitDetails.deleted.isEmpty() || !relationships.isEmpty()) {
adapter.commit(store, commitDetails);
}
// Once we've committed the transaction, there is no need to
// keep the OneToManyChanges around. Destroy them so they
// can be garbage collected.
relationships.forEach(function(relationship) {
relationship.destroy();
});
},
/**
Rolling back a transaction resets the records that belong to
that transaction.
Updated records have their properties reset to the last known
value from the persistence layer. Deleted records are reverted
to a clean, non-deleted state. Newly created records immediately
become deleted, and are not sent to the adapter to be persisted.
After the transaction is rolled back, any records that belong
to it will return to the store's default transaction, and the
current transaction should not be used again.
*/
rollback: function() {
// Loop through all of the records in each of the dirty states
// and initiate a rollback on them. As a side effect of telling
// the record to roll back, it should also move itself out of
// the dirty bucket and into the clean bucket.
['created', 'updated', 'deleted', 'inflight'].forEach(function(bucketType) {
var records = this.bucketForType(bucketType);
forEach(records, function(record) {
record.send('rollback');
});
records.clear();
}, this);
// Now that all records in the transaction are guaranteed to be
// clean, migrate them all to the store's default transaction.
this.removeCleanRecords();
},
/**
@private
Removes a record from this transaction and back to the store's
default transaction.
Note: This method is private for now, but should probably be exposed
in the future once we have stricter error checking (for example, in the
case of the record being dirty).
@param {DS.Model} record
*/
remove: function(record) {
var defaultTransaction = get(this, 'store.defaultTransaction');
defaultTransaction.adoptRecord(record);
},
/**
@private
Removes all of the records in the transaction's clean bucket.
*/
removeCleanRecords: function() {
var clean = this.bucketForType('clean');
clean.forEach(function(record) {
this.remove(record);
}, this);
clean.clear();
},
/**
@private
Returns the bucket for the given bucket type. For example, you might call
`this.bucketForType('updated')` to get the `Ember.Map` that contains all
of the records that have changes pending.
@param {String} bucketType the type of bucket
@returns Ember.Map
*/
bucketForType: function(bucketType) {
var buckets = get(this, 'buckets');
return get(buckets, bucketType);
},
/**
@private
This method moves a record into a different transaction without the normal
checks that ensure that the user is not doing something weird, like moving
a dirty record into a new transaction.
It is designed for internal use, such as when we are moving a clean record
into a new transaction when the transaction is committed.
This method must not be called unless the record is clean.
@param {DS.Model} record
*/
adoptRecord: function(record) {
var oldTransaction = get(record, 'transaction');
if (oldTransaction) {
oldTransaction.removeFromBucket('clean', record);
}
this.addToBucket('clean', record);
set(record, 'transaction', this);
},
/**
@private
Adds a record to the named bucket.
@param {String} bucketType one of `clean`, `created`, `updated`, or `deleted`
*/
addToBucket: function(bucketType, record) {
this.bucketForType(bucketType).add(record);
},
/**
@private
Removes a record from the named bucket.
@param {String} bucketType one of `clean`, `created`, `updated`, or `deleted`
*/
removeFromBucket: function(bucketType, record) {
this.bucketForType(bucketType).remove(record);
},
/**
@private
Called by a record's state manager to indicate that the record has entered
a dirty state. The record will be moved from the `clean` bucket and into
the appropriate dirty bucket.
@param {String} bucketType one of `created`, `updated`, or `deleted`
*/
recordBecameDirty: function(bucketType, record) {
this.removeFromBucket('clean', record);
this.addToBucket(bucketType, record);
},
/**
@private
Called by a record's state manager to indicate that the record has entered
inflight state. The record will be moved from its current dirty bucket and into
the `inflight` bucket.
@param {String} bucketType one of `created`, `updated`, or `deleted`
*/
recordBecameInFlight: function(kind, record) {
this.removeFromBucket(kind, record);
this.addToBucket('inflight', record);
},
recordIsMoving: function(kind, record) {
this.removeFromBucket(kind, record);
this.addToBucket('clean', record);
},
/**
@private
Called by a record's state manager to indicate that the record has entered
a clean state. The record will be moved from its current dirty or inflight bucket and into
the `clean` bucket.
@param {String} bucketType one of `created`, `updated`, or `deleted`
*/
recordBecameClean: function(kind, record) {
this.removeFromBucket(kind, record);
this.remove(record);
}
});
})();
(function() {
var classify = Ember.String.classify, get = Ember.get;
/**
@private
The Mappable mixin is designed for classes that would like to
behave as a map for configuration purposes.
For example, the DS.Adapter class can behave like a map, with
more semantic API, via the `map` API:
DS.Adapter.map('App.Person', { firstName: { key: 'FIRST' } });
Class configuration via a map-like API has a few common requirements
that differentiate it from the standard Ember.Map implementation.
First, values often are provided as strings that should be normalized
into classes the first time the configuration options are used.
Second, the values configured on parent classes should also be taken
into account.
Finally, setting the value of a key sometimes should merge with the
previous value, rather than replacing it.
This mixin provides a instance method, `createInstanceMapFor`, that
will reify all of the configuration options set on an instance's
constructor and provide it for the instance to use.
Classes can implement certain hooks that allow them to customize
the requirements listed above:
* `resolveMapConflict` - called when a value is set for an existing
value
* `transformMapKey` - allows a key name (for example, a global path
to a class) to be normalized
* `transformMapValue` - allows a value (for example, a class that
should be instantiated) to be normalized
Classes that implement this mixin should also implement a class
method built using the `generateMapFunctionFor` method:
DS.Adapter.reopenClass({
map: DS.Mappable.generateMapFunctionFor('attributes', function(key, newValue, map) {
var existingValue = map.get(key);
for (var prop in newValue) {
if (!newValue.hasOwnProperty(prop)) { continue; }
existingValue[prop] = newValue[prop];
}
})
});
The function passed to `generateMapFunctionFor` is invoked every time a
new value is added to the map.
**/
var resolveMapConflict = function(oldValue, newValue, mappingsKey) {
return oldValue;
};
var transformMapKey = function(key, value) {
return key;
};
var transformMapValue = function(key, value) {
return value;
};
DS._Mappable = Ember.Mixin.create({
createInstanceMapFor: function(mapName) {
var instanceMeta = Ember.metaPath(this, ['DS.Mappable'], true);
instanceMeta.values = instanceMeta.values || {};
if (instanceMeta.values[mapName]) { return instanceMeta.values[mapName]; }
var instanceMap = instanceMeta.values[mapName] = new Ember.Map();
var klass = this.constructor;
while (klass && klass !== DS.Store) {
this._copyMap(mapName, klass, instanceMap);
klass = klass.superclass;
}
instanceMeta.values[mapName] = instanceMap;
return instanceMap;
},
_copyMap: function(mapName, klass, instanceMap) {
var classMeta = Ember.metaPath(klass, ['DS.Mappable'], true);
var classMap = classMeta[mapName];
if (classMap) {
classMap.forEach(eachMap, this);
}
function eachMap(key, value) {
var transformedKey = (klass.transformMapKey || transformMapKey)(key, value);
var transformedValue = (klass.transformMapValue || transformMapValue)(key, value);
var oldValue = instanceMap.get(transformedKey);
var newValue = transformedValue;
if (oldValue) {
newValue = (this.constructor.resolveMapConflict || resolveMapConflict)(oldValue, newValue, mapName);
}
instanceMap.set(transformedKey, newValue);
}
}
});
DS._Mappable.generateMapFunctionFor = function(mapName, transform) {
return function(key, value) {
var meta = Ember.metaPath(this, ['DS.Mappable'], true);
var map = meta[mapName] || Ember.MapWithDefault.create({
defaultValue: function() { return {}; }
});
transform.call(this, key, value, map);
meta[mapName] = map;
};
};
})();
(function() {
/*globals Ember*/
/*jshint eqnull:true*/
var get = Ember.get, set = Ember.set, fmt = Ember.String.fmt, once = Ember.run.once;
var forEach = Ember.EnumerableUtils.forEach;
// These values are used in the data cache when clientIds are
// needed but the underlying data has not yet been loaded by
// the server.
var UNLOADED = 'unloaded';
var LOADING = 'loading';
var MATERIALIZED = { materialized: true };
var CREATED = { created: true };
// Implementors Note:
//
// The variables in this file are consistently named according to the following
// scheme:
//
// * +id+ means an identifier managed by an external source, provided inside
// the data provided by that source.
// * +clientId+ means a transient numerical identifier generated at runtime by
// the data store. It is important primarily because newly created objects may
// not yet have an externally generated id.
// * +type+ means a subclass of DS.Model.
// Used by the store to normalize IDs entering the store. Despite the fact
// that developers may provide IDs as numbers (e.g., `store.find(Person, 1)`),
// it is important that internally we use strings, since IDs may be serialized
// and lose type information. For example, Ember's router may put a record's
// ID into the URL, and if we later try to deserialize that URL and find the
// corresponding record, we will not know if it is a string or a number.
var coerceId = function(id) {
return id == null ? null : id+'';
};
var map = Ember.EnumerableUtils.map;
/**
The store contains all of the data for records loaded from the server.
It is also responsible for creating instances of DS.Model that wraps
the individual data for a record, so that they can be bound to in your
Handlebars templates.
Create a new store like this:
MyApp.store = DS.Store.create();
You can retrieve DS.Model instances from the store in several ways. To retrieve
a record for a specific id, use the `find()` method:
var record = MyApp.store.find(MyApp.Contact, 123);
By default, the store will talk to your backend using a standard REST mechanism.
You can customize how the store talks to your backend by specifying a custom adapter:
MyApp.store = DS.Store.create({
adapter: 'MyApp.CustomAdapter'
});
You can learn more about writing a custom adapter by reading the `DS.Adapter`
documentation.
*/
DS.Store = Ember.Object.extend(DS._Mappable, {
/**
Many methods can be invoked without specifying which store should be used.
In those cases, the first store created will be used as the default. If
an application has multiple stores, it should specify which store to use
when performing actions, such as finding records by id.
The init method registers this store as the default if none is specified.
*/
init: function() {
// Enforce API revisioning. See BREAKING_CHANGES.md for more.
var revision = get(this, 'revision');
if (revision !== DS.CURRENT_API_REVISION && !Ember.ENV.TESTING) {
throw new Error("Error: The Ember Data library has had breaking API changes since the last time you updated the library. Please review the list of breaking changes at https://github.com/emberjs/data/blob/master/BREAKING_CHANGES.md, then update your store's `revision` property to " + DS.CURRENT_API_REVISION);
}
if (!get(DS, 'defaultStore') || get(this, 'isDefaultStore')) {
set(DS, 'defaultStore', this);
}
// internal bookkeeping; not observable
this.typeMaps = {};
this.recordCache = [];
this.clientIdToId = {};
this.clientIdToType = {};
this.clientIdToData = {};
this.clientIdToPrematerializedData = {};
this.recordArraysByClientId = {};
this.relationshipChanges = {};
this.recordReferences = {};
// Internally, we maintain a map of all unloaded IDs requested by
// a ManyArray. As the adapter loads data into the store, the
// store notifies any interested ManyArrays. When the ManyArray's
// total number of loading records drops to zero, it becomes
// `isLoaded` and fires a `didLoad` event.
this.loadingRecordArrays = {};
this._recordsToSave = Ember.OrderedSet.create();
set(this, 'defaultTransaction', this.transaction());
},
/**
Returns a new transaction scoped to this store. This delegates
responsibility for invoking the adapter's commit mechanism to
a transaction.
Transaction are responsible for tracking changes to records
added to them, and supporting `commit` and `rollback`
functionality. Committing a transaction invokes the store's
adapter, while rolling back a transaction reverses all
changes made to records added to the transaction.
A store has an implicit (default) transaction, which tracks changes
made to records not explicitly added to a transaction.
@see {DS.Transaction}
@returns DS.Transaction
*/
transaction: function() {
return DS.Transaction.create({ store: this });
},
ensureSameTransaction: function(records){
var transactions = Ember.A();
forEach( records, function(record){
if (record){ transactions.pushObject(get(record, 'transaction')); }
});
var transaction = transactions.reduce(function(prev, t) {
if (!get(t, 'isDefault')) {
if (prev === null) { return t; }
}
return prev;
}, null);
if (transaction) {
forEach( records, function(record){
if (record){ transaction.add(record); }
});
} else {
transaction = transactions.objectAt(0);
}
return transaction;
},
/**
@private
Instructs the store to materialize the data for a given record.
To materialize a record, the store first retrieves the opaque data that was
passed to either `load()` or `loadMany()`. Then, the data and the record
are passed to the adapter's `materialize()` method, which allows the adapter
to translate arbitrary data structures from the adapter into the normalized
form the record expects.
The adapter's `materialize()` method will invoke `materializeAttribute()`,
`materializeHasMany()` and `materializeBelongsTo()` on the record to
populate it with normalized values.
@param {DS.Model} record
*/
materializeData: function(record) {
var clientId = get(record, 'clientId'),
cidToData = this.clientIdToData,
adapter = this.adapterForType(record.constructor),
data = cidToData[clientId];
cidToData[clientId] = MATERIALIZED;
var prematerialized = this.clientIdToPrematerializedData[clientId];
// Ensures the record's data structures are setup
// before being populated by the adapter.
record.setupData();
if (data !== CREATED) {
// Instructs the adapter to extract information from the
// opaque data and materialize the record's attributes and
// relationships.
adapter.materialize(record, data, prematerialized);
}
},
/**
@private
Returns true if there is already a record for this clientId.
This is used to determine whether cleanup is required, so that
"changes" to unmaterialized records do not trigger mass
materialization.
For example, if a parent record in a relationship with a large
number of children is deleted, we want to avoid materializing
those children.
@param {Object} reference
@return {Boolean}
*/
recordIsMaterialized: function(reference) {
return !!this.recordCache[reference.clientId];
},
/**
The adapter to use to communicate to a backend server or other persistence layer.
This can be specified as an instance, a class, or a property path that specifies
where the adapter can be located.
@property {DS.Adapter|String}
*/
adapter: 'DS.RESTAdapter',
/**
@private
Returns a JSON representation of the record using the adapter's
serialization strategy. This method exists primarily to enable
a record, which has access to its store (but not the store's
adapter) to provide a `serialize()` convenience.
The available options are:
* `includeId`: `true` if the record's ID should be included in
the JSON representation
@param {DS.Model} record the record to serialize
@param {Object} options an options hash
*/
serialize: function(record, options) {
return this.adapterForType(record.constructor).serialize(record, options);
},
/**
@private
This property returns the adapter, after resolving a possible
property path.
If the supplied `adapter` was a class, or a String property
path resolved to a class, this property will instantiate the
class.
This property is cacheable, so the same instance of a specified
adapter class should be used for the lifetime of the store.
@returns DS.Adapter
*/
_adapter: Ember.computed(function() {
var adapter = get(this, 'adapter');
if (typeof adapter === 'string') {
adapter = get(this, adapter, false) || get(Ember.lookup, adapter);
}
if (DS.Adapter.detect(adapter)) {
adapter = adapter.create();
}
return adapter;
}).property('adapter'),
/**
@private
A monotonically increasing number to be used to uniquely identify
data and records.
It starts at 1 so other parts of the code can test for truthiness
when provided a `clientId` instead of having to explicitly test
for undefined.
*/
clientIdCounter: 1,
// .....................
// . CREATE NEW RECORD .
// .....................
/**
Create a new record in the current store. The properties passed
to this method are set on the newly created record.
Note: The third `transaction` property is for internal use only.
If you want to create a record inside of a given transaction,
use `transaction.createRecord()` instead of `store.createRecord()`.
@param {subclass of DS.Model} type
@param {Object} properties a hash of properties to set on the
newly created record.
@returns DS.Model
*/
createRecord: function(type, properties, transaction) {
properties = properties || {};
// Create a new instance of the model `type` and put it
// into the specified `transaction`. If no transaction is
// specified, the default transaction will be used.
var record = type._create({
store: this
});
transaction = transaction || get(this, 'defaultTransaction');
// adoptRecord is an internal API that allows records to move
// into a transaction without assertions designed for app
// code. It is used here to ensure that regardless of new
// restrictions on the use of the public `transaction.add()`
// API, we will always be able to insert new records into
// their transaction.
transaction.adoptRecord(record);
// `id` is a special property that may not be a `DS.attr`
var id = properties.id;
// If the passed properties do not include a primary key,
// give the adapter an opportunity to generate one. Typically,
// client-side ID generators will use something like uuid.js
// to avoid conflicts.
var adapter;
if (Ember.isNone(id)) {
adapter = this.adapterForType(type);
if (adapter && adapter.generateIdForRecord) {
id = coerceId(adapter.generateIdForRecord(this, record));
properties.id = id;
}
}
id = coerceId(id);
// Create a new `clientId` and associate it with the
// specified (or generated) `id`. Since we don't have
// any data for the server yet (by definition), store
// the sentinel value CREATED as the data for this
// clientId. If we see this value later, we will skip
// materialization.
var clientId = this.pushData(CREATED, id, type);
// Now that we have a clientId, attach it to the record we
// just created.
set(record, 'clientId', clientId);
// Move the record out of its initial `empty` state into
// the `loaded` state.
record.loadedData();
// Make sure the data is set up so the record doesn't
// try to materialize its nonexistent data.
record.setupData();
// Store the record we just created in the record cache for
// this clientId.
this.recordCache[clientId] = record;
// Set the properties specified on the record.
record.setProperties(properties);
// Resolve record promise
Ember.run(record, 'resolve', record);
return record;
},
// .................
// . DELETE RECORD .
// .................
/**
For symmetry, a record can be deleted via the store.
@param {DS.Model} record
*/
deleteRecord: function(record) {
record.deleteRecord();
},
/**
For symmetry, a record can be unloaded via the store.
@param {DS.Model} record
*/
unloadRecord: function(record) {
record.unloadRecord();
},
// ................
// . FIND RECORDS .
// ................
/**
This is the main entry point into finding records. The first parameter to
this method is always a subclass of `DS.Model`.
You can use the `find` method on a subclass of `DS.Model` directly if your
application only has one store. For example, instead of
`store.find(App.Person, 1)`, you could say `App.Person.find(1)`.
---
To find a record by ID, pass the `id` as the second parameter:
store.find(App.Person, 1);
App.Person.find(1);
If the record with that `id` had not previously been loaded, the store will
return an empty record immediately and ask the adapter to find the data by
calling the adapter's `find` method.
The `find` method will always return the same object for a given type and
`id`. To check whether the adapter has populated a record, you can check
its `isLoaded` property.
---
To find all records for a type, call `find` with no additional parameters:
store.find(App.Person);
App.Person.find();
This will return a `RecordArray` representing all known records for the
given type and kick off a request to the adapter's `findAll` method to load
any additional records for the type.
The `RecordArray` returned by `find()` is live. If any more records for the
type are added at a later time through any mechanism, it will automatically
update to reflect the change.
---
To find a record by a query, call `find` with a hash as the second
parameter:
store.find(App.Person, { page: 1 });
App.Person.find({ page: 1 });
This will return a `RecordArray` immediately, but it will always be an
empty `RecordArray` at first. It will call the adapter's `findQuery`
method, which will populate the `RecordArray` once the server has returned
results.
You can check whether a query results `RecordArray` has loaded by checking
its `isLoaded` property.
*/
find: function(type, id) {
if (id === undefined) {
return this.findAll(type);
}
// We are passed a query instead of an id.
if (Ember.typeOf(id) === 'object') {
return this.findQuery(type, id);
}
return this.findById(type, coerceId(id));
},
/**
@private
This method returns a record for a given type and id combination.
If the store has never seen this combination of type and id before, it
creates a new `clientId` with the LOADING sentinel and asks the adapter to
load the data.
If the store has seen the combination, this method delegates to
`getByReference`.
*/
findById: function(type, id) {
var clientId = this.typeMapFor(type).idToCid[id];
if (clientId) {
return this.findByClientId(type, clientId);
}
clientId = this.pushData(LOADING, id, type);
// create a new instance of the model type in the
// 'isLoading' state
var record = this.materializeRecord(type, clientId, id);
// let the adapter set the data, possibly async
var adapter = this.adapterForType(type);
adapter.find(this, type, id);
return record;
},
reloadRecord: function(record) {
var type = record.constructor,
adapter = this.adapterForType(type),
id = get(record, 'id');
adapter.find(this, type, id);
},
/**
@private
This method returns a record for a given clientId.
If there is no record object yet for the clientId, this method materializes
a new record object. This allows adapters to eagerly load large amounts of
data into the store, and avoid incurring the cost to create the objects
until they are requested.
Several parts of Ember Data call this method:
* findById, if a clientId already exists for a given type and
id combination
* OneToManyChange, which is backed by clientIds, when getChild,
getOldParent or getNewParent are called
* RecordArray, which is backed by clientIds, when an object at
a particular index is looked up
In short, it's a convenient way to get a record for a known
clientId, materializing it if necessary.
@param {Class} type
@param {Number|String} clientId
*/
findByClientId: function(type, clientId) {
var cidToData, record, id;
record = this.recordCache[clientId];
if (!record) {
// create a new instance of the model type in the
// 'isLoading' state
id = this.clientIdToId[clientId];
record = this.materializeRecord(type, clientId, id);
cidToData = this.clientIdToData;
if (typeof cidToData[clientId] === 'object') {
record.loadedData();
}
}
return record;
},
/**
@private
Given an array of `reference`s, determines which of those
`clientId`s has not yet been loaded.
In preparation for loading, this method also marks any unloaded
`clientId`s as loading.
*/
neededReferences: function(references) {
var neededReferences = [],
cidToData = this.clientIdToData,
reference;
for (var i=0, l=references.length; i<l; i++) {
reference = references[i];
if (cidToData[reference.clientId] === UNLOADED) {
neededReferences.push(reference);
cidToData[reference.clientId] = LOADING;
}
}
return neededReferences;
},
/**
@private
This method is the entry point that relationships use to update
themselves when their underlying data changes.
First, it determines which of its `reference`s are still unloaded,
then invokes `findMany` on the adapter.
*/
fetchUnloadedReferences: function(references, owner) {
var neededReferences = this.neededReferences(references);
this.fetchMany(neededReferences, owner);
},
/**
@private
This method takes a list of `reference`s, group the `reference`s by type,
converts the `reference`s into IDs, and then invokes the adapter's `findMany`
method.
The `reference`s are grouped by type to invoke `findMany` on adapters
for each unique type in `reference`s.
It is used both by a brand new relationship (via the `findMany`
method) or when the data underlying an existing relationship
changes (via the `fetchUnloadedReferences` method).
*/
fetchMany: function(references, owner) {
if (!references.length) { return; }
// Group By Type
var referencesByTypeMap = Ember.MapWithDefault.create({
defaultValue: function() { return Ember.A(); }
});
forEach(references, function(reference) {
referencesByTypeMap.get(reference.type).push(reference);
});
forEach(referencesByTypeMap, function(type) {
var references = referencesByTypeMap.get(type),
ids = map(references, function(reference) { return reference.id; });
var adapter = this.adapterForType(type);
adapter.findMany(this, type, ids, owner);
}, this);
},
referenceForId: function(type, id) {
var clientId = this.clientIdForId(type, id);
return this.referenceForClientId(clientId);
},
referenceForClientId: function(clientId) {
var references = this.recordReferences;
if (references[clientId]) {
return references[clientId];
}
var type = this.clientIdToType[clientId];
return references[clientId] = {
id: this.idForClientId(clientId),
clientId: clientId,
type: type
};
},
isReferenceMaterialized: function(reference) {
return !!this.recordCache[reference.clientId];
},
recordForReference: function(reference) {
return this.findByClientId(reference.type, reference.clientId);
},
/**
@private
`findMany` is the entry point that relationships use to generate a
new `ManyArray` for the list of IDs specified by the server for
the relationship.
Its responsibilities are:
* convert the IDs into clientIds
* determine which of the clientIds still need to be loaded
* create a new ManyArray whose content is *all* of the clientIds
* notify the ManyArray of the number of its elements that are
already loaded
* insert the unloaded clientIds into the `loadingRecordArrays`
bookkeeping structure, which will allow the `ManyArray` to know
when all of its loading elements are loaded from the server.
* ask the adapter to load the unloaded elements, by invoking
findMany with the still-unloaded IDs.
*/
findMany: function(type, idsOrReferencesOrOpaque, record, relationship) {
// 1. Determine which of the client ids need to be loaded
// 2. Create a new ManyArray whose content is ALL of the clientIds
// 3. Decrement the ManyArray's counter by the number of loaded clientIds
// 4. Put the ManyArray into our bookkeeping data structure, keyed on
// the needed clientIds
// 5. Ask the adapter to load the records for the unloaded clientIds (but
// convert them back to ids)
if (!Ember.isArray(idsOrReferencesOrOpaque)) {
var adapter = this.adapterForType(type);
if (adapter && adapter.findHasMany) {
adapter.findHasMany(this, record, relationship, idsOrReferencesOrOpaque);
} else if (idsOrReferencesOrOpaque !== undefined) {
}
return this.createManyArray(type, Ember.A());
}
// Coerce server IDs into Record Reference
var references = map(idsOrReferencesOrOpaque, function(reference) {
if (typeof reference !== 'object' && reference !== null) {
return this.referenceForId(type, reference);
}
return reference;
}, this);
var neededReferences = this.neededReferences(references),
manyArray = this.createManyArray(type, Ember.A(references)),
loadingRecordArrays = this.loadingRecordArrays,
reference, clientId, i, l;
// Start the decrementing counter on the ManyArray at the number of
// records we need to load from the adapter
manyArray.loadingRecordsCount(neededReferences.length);
if (neededReferences.length) {
for (i=0, l=neededReferences.length; i<l; i++) {
reference = neededReferences[i];
clientId = reference.clientId;
// keep track of the record arrays that a given loading record
// is part of. This way, if the same record is in multiple
// ManyArrays, all of their loading records counters will be
// decremented when the adapter provides the data.
if (loadingRecordArrays[clientId]) {
loadingRecordArrays[clientId].push(manyArray);
} else {
this.loadingRecordArrays[clientId] = [ manyArray ];
}
}
this.fetchMany(neededReferences, record);
} else {
// all requested records are available
manyArray.set('isLoaded', true);
Ember.run.once(function() {
manyArray.trigger('didLoad');
});
}
return manyArray;
},
/**
@private
This method delegates a query to the adapter. This is the one place where
adapter-level semantics are exposed to the application.
Exposing queries this way seems preferable to creating an abstract query
language for all server-side queries, and then require all adapters to
implement them.
@param {Class} type
@param {Object} query an opaque query to be used by the adapter
@return {DS.AdapterPopulatedRecordArray}
*/
findQuery: function(type, query) {
var array = DS.AdapterPopulatedRecordArray.create({ type: type, query: query, content: Ember.A([]), store: this });
var adapter = this.adapterForType(type);
adapter.findQuery(this, type, query, array);
return array;
},
/**
@private
This method returns an array of all records adapter can find.
It triggers the adapter's `findAll` method to give it an opportunity to populate
the array with records of that type.
@param {Class} type
@return {DS.AdapterPopulatedRecordArray}
*/
findAll: function(type) {
return this.fetchAll(type, this.all(type));
},
/**
@private
*/
fetchAll: function(type, array) {
var adapter = this.adapterForType(type),
sinceToken = this.typeMapFor(type).metadata.since;
set(array, 'isUpdating', true);
adapter.findAll(this, type, sinceToken);
return array;
},
/**
*/
metaForType: function(type, property, data) {
var target = this.typeMapFor(type).metadata;
set(target, property, data);
},
/**
*/
didUpdateAll: function(type) {
var findAllCache = this.typeMapFor(type).findAllCache;
set(findAllCache, 'isUpdating', false);
},
/**
This method returns a filtered array that contains all of the known records
for a given type.
Note that because it's just a filter, it will have any locally
created records of the type.
Also note that multiple calls to `all` for a given type will always
return the same RecordArray.
@param {Class} type
@return {DS.RecordArray}
*/
all: function(type) {
var typeMap = this.typeMapFor(type),
findAllCache = typeMap.findAllCache;
if (findAllCache) { return findAllCache; }
var array = DS.RecordArray.create({ type: type, content: Ember.A([]), store: this, isLoaded: true });
this.registerRecordArray(array, type);
typeMap.findAllCache = array;
return array;
},
/**
Takes a type and filter function, and returns a live RecordArray that
remains up to date as new records are loaded into the store or created
locally.
The callback function takes a materialized record, and returns true
if the record should be included in the filter and false if it should
not.
The filter function is called once on all records for the type when
it is created, and then once on each newly loaded or created record.
If any of a record's properties change, or if it changes state, the
filter function will be invoked again to determine whether it should
still be in the array.
Note that the existence of a filter on a type will trigger immediate
materialization of all loaded data for a given type, so you might
not want to use filters for a type if you are loading many records
into the store, many of which are not active at any given time.
In this scenario, you might want to consider filtering the raw
data before loading it into the store.
@param {Class} type
@param {Function} filter
@return {DS.FilteredRecordArray}
*/
filter: function(type, query, filter) {
// allow an optional server query
if (arguments.length === 3) {
this.findQuery(type, query);
} else if (arguments.length === 2) {
filter = query;
}
var array = DS.FilteredRecordArray.create({ type: type, content: Ember.A([]), store: this, filterFunction: filter });
this.registerRecordArray(array, type, filter);
return array;
},
/**
This method returns if a certain record is already loaded
in the store. Use this function to know beforehand if a find()
will result in a request or that it will be a cache hit.
@param {Class} type
@param {string} id
@return {boolean}
*/
recordIsLoaded: function(type, id) {
return !Ember.isNone(this.typeMapFor(type).idToCid[id]);
},
// ............
// . UPDATING .
// ............
/**
@private
If the adapter updates attributes or acknowledges creation
or deletion, the record will notify the store to update its
membership in any filters.
To avoid thrashing, this method is invoked only once per
run loop per record.
@param {Class} type
@param {Number|String} clientId
@param {DS.Model} record
*/
dataWasUpdated: function(type, reference, record) {
// Because data updates are invoked at the end of the run loop,
// it is possible that a record might be deleted after its data
// has been modified and this method was scheduled to be called.
//
// If that's the case, the record would have already been removed
// from all record arrays; calling updateRecordArrays would just
// add it back. If the record is deleted, just bail. It shouldn't
// give us any more trouble after this.
if (get(record, 'isDeleted')) { return; }
var cidToData = this.clientIdToData,
clientId = reference.clientId,
data = cidToData[clientId];
if (typeof data === "object") {
this.updateRecordArrays(type, clientId);
}
},
// .................
// . BASIC ADAPTER .
// .................
scheduleSave: function(record) {
this._recordsToSave.add(record);
Ember.run.once(this, 'flushSavedRecords');
},
flushSavedRecords: function() {
var created = Ember.OrderedSet.create();
var updated = Ember.OrderedSet.create();
var deleted = Ember.OrderedSet.create();
this._recordsToSave.forEach(function(record) {
if (get(record, 'isNew')) {
created.add(record);
} else if (get(record, 'isDeleted')) {
deleted.add(record);
} else {
updated.add(record);
}
});
this._recordsToSave.clear();
get(this, '_adapter').commit(this, {
created: created,
updated: updated,
deleted: deleted
});
},
// ..............
// . PERSISTING .
// ..............
/**
This method delegates committing to the store's implicit
transaction.
Calling this method is essentially a request to persist
any changes to records that were not explicitly added to
a transaction.
*/
commit: function() {
get(this, 'defaultTransaction').commit();
},
/**
Adapters should call this method if they would like to acknowledge
that all changes related to a record (other than relationship
changes) have persisted.
Because relationship changes affect multiple records, the adapter
is responsible for acknowledging the change to the relationship
directly (using `store.didUpdateRelationship`) when all aspects
of the relationship change have persisted.
It can be called for created, deleted or updated records.
If the adapter supplies new data, that data will become the new
canonical data for the record. That will result in blowing away
all local changes and rematerializing the record with the new
data (the "sledgehammer" approach).
Alternatively, if the adapter does not supply new data, the record
will collapse all local changes into its saved data. Subsequent
rollbacks of the record will roll back to this point.
If an adapter is acknowledging receipt of a newly created record
that did not generate an id in the client, it *must* either
provide data or explicitly invoke `store.didReceiveId` with
the server-provided id.
Note that an adapter may not supply new data when acknowledging
a deleted record.
@see DS.Store#didUpdateRelationship
@param {DS.Model} record the in-flight record
@param {Object} data optional data (see above)
*/
didSaveRecord: function(record, data) {
record.adapterDidCommit();
if (data) {
this.updateId(record, data);
this.updateRecordData(record, data);
} else {
this.didUpdateAttributes(record);
}
},
/**
For convenience, if an adapter is performing a bulk commit, it can also
acknowledge all of the records at once.
If the adapter supplies an array of data, they must be in the same order as
the array of records passed in as the first parameter.
@param {#forEach} list a list of records whose changes the
adapter is acknowledging. You can pass any object that
has an ES5-like `forEach` method, including the
`OrderedSet` objects passed into the adapter at commit
time.
@param {Array[Object]} dataList an Array of data. This
parameter must be an integer-indexed Array-like.
*/
didSaveRecords: function(list, dataList) {
var i = 0;
list.forEach(function(record) {
this.didSaveRecord(record, dataList && dataList[i++]);
}, this);
},
/**
This method allows the adapter to specify that a record
could not be saved because it had backend-supplied validation
errors.
The errors object must have keys that correspond to the
attribute names. Once each of the specified attributes have
changed, the record will automatically move out of the
invalid state and be ready to commit again.
TODO: We should probably automate the process of converting
server names to attribute names using the existing serializer
infrastructure.
@param {DS.Model} record
@param {Object} errors
*/
recordWasInvalid: function(record, errors) {
record.adapterDidInvalidate(errors);
},
/**
This method allows the adapter to specify that a record
could not be saved because the server returned an unhandled
error.
@param {DS.Model} record
*/
recordWasError: function(record) {
record.adapterDidError();
},
/**
This is a lower-level API than `didSaveRecord` that allows an
adapter to acknowledge the persistence of a single attribute.
This is useful if an adapter needs to make multiple asynchronous
calls to fully persist a record. The record will keep track of
which attributes and relationships are still outstanding and
automatically move into the `saved` state once the adapter has
acknowledged everything.
If a value is provided, it clobbers the locally specified value.
Otherwise, the local value becomes the record's last known
saved value (which is used when rolling back a record).
Note that the specified attributeName is the normalized name
specified in the definition of the `DS.Model`, not a key in
the server-provided data.
Also note that the adapter is responsible for performing any
transformations on the value using the serializer API.
@param {DS.Model} record
@param {String} attributeName
@param {Object} value
*/
didUpdateAttribute: function(record, attributeName, value) {
record.adapterDidUpdateAttribute(attributeName, value);
},
/**
This method allows an adapter to acknowledge persistence
of all attributes of a record but not relationships or
other factors.
It loops through the record's defined attributes and
notifies the record that they are all acknowledged.
This method does not take optional values, because
the adapter is unlikely to have a hash of normalized
keys and transformed values, and instead of building
one up, it should just call `didUpdateAttribute` as
needed.
This method is intended as a middle-ground between
`didSaveRecord`, which acknowledges all changes to
a record, and `didUpdateAttribute`, which allows an
adapter fine-grained control over updates.
@param {DS.Model} record
*/
didUpdateAttributes: function(record) {
record.eachAttribute(function(attributeName) {
this.didUpdateAttribute(record, attributeName);
}, this);
},
/**
This allows an adapter to acknowledge that it has saved all
necessary aspects of a relationship change.
This is separated from acknowledging the record itself
(via `didSaveRecord`) because a relationship change can
involve as many as three separate records. Records should
only move out of the in-flight state once the server has
acknowledged all of their relationships, and this differs
based upon the adapter's semantics.
There are three basic scenarios by which an adapter can
save a relationship.
### Foreign Key
An adapter can save all relationship changes by updating
a foreign key on the child record. If it does this, it
should acknowledge the changes when the child record is
saved.
record.eachRelationship(function(name, meta) {
if (meta.kind === 'belongsTo') {
store.didUpdateRelationship(record, name);
}
});
store.didSaveRecord(record, data);
### Embedded in Parent
An adapter can save one-to-many relationships by embedding
IDs (or records) in the parent object. In this case, the
relationship is not considered acknowledged until both the
old parent and new parent have acknowledged the change.
In this case, the adapter should keep track of the old
parent and new parent, and acknowledge the relationship
change once both have acknowledged. If one of the two
sides does not exist (e.g. the new parent does not exist
because of nulling out the belongs-to relationship),
the adapter should acknowledge the relationship once
the other side has acknowledged.
### Separate Entity
An adapter can save relationships as separate entities
on the server. In this case, they should acknowledge
the relationship as saved once the server has
acknowledged the entity.
@see DS.Store#didSaveRecord
@param {DS.Model} record
@param {DS.Model} relationshipName
*/
didUpdateRelationship: function(record, relationshipName) {
var relationship = this.relationshipChangeFor(get(record, 'clientId'), relationshipName);
//TODO(Igor)
if (relationship) { relationship.adapterDidUpdate(); }
},
/**
This allows an adapter to acknowledge all relationship changes
for a given record.
Like `didUpdateAttributes`, this is intended as a middle ground
between `didSaveRecord` and fine-grained control via the
`didUpdateRelationship` API.
*/
didUpdateRelationships: function(record) {
var changes = this.relationshipChangesFor(get(record, '_reference'));
for (var name in changes) {
if (!changes.hasOwnProperty(name)) { continue; }
changes[name].adapterDidUpdate();
}
},
/**
When acknowledging the creation of a locally created record,
adapters must supply an id (if they did not implement
`generateIdForRecord` to generate an id locally).
If an adapter does not use `didSaveRecord` and supply a hash
(for example, if it needs to make multiple HTTP requests to
create and then update the record), it will need to invoke
`didReceiveId` with the backend-supplied id.
When not using `didSaveRecord`, an adapter will need to
invoke:
* didReceiveId (unless the id was generated locally)
* didCreateRecord
* didUpdateAttribute(s)
* didUpdateRelationship(s)
@param {DS.Model} record
@param {Number|String} id
*/
didReceiveId: function(record, id) {
var typeMap = this.typeMapFor(record.constructor),
clientId = get(record, 'clientId'),
oldId = get(record, 'id');
typeMap.idToCid[id] = clientId;
this.clientIdToId[clientId] = id;
},
/**
@private
This method re-indexes the data by its clientId in the store
and then notifies the record that it should rematerialize
itself.
@param {DS.Model} record
@param {Object} data
*/
updateRecordData: function(record, data) {
var clientId = get(record, 'clientId'),
cidToData = this.clientIdToData;
cidToData[clientId] = data;
record.didChangeData();
},
/**
@private
If an adapter invokes `didSaveRecord` with data, this method
extracts the id from the supplied data (using the adapter's
`extractId()` method) and indexes the clientId with that id.
@param {DS.Model} record
@param {Object} data
*/
updateId: function(record, data) {
var typeMap = this.typeMapFor(record.constructor),
clientId = get(record, 'clientId'),
oldId = get(record, 'id'),
type = record.constructor,
id = this.preprocessData(type, data);
typeMap.idToCid[id] = clientId;
this.clientIdToId[clientId] = id;
this.referenceForClientId(clientId).id = id;
},
/**
@private
This method receives opaque data provided by the adapter and
preprocesses it, returning an ID.
The actual preprocessing takes place in the adapter. If you would
like to change the default behavior, you should override the
appropriate hooks in `DS.Serializer`.
@see {DS.Serializer}
@return {String} id the id represented by the data
*/
preprocessData: function(type, data) {
return this.adapterForType(type).extractId(type, data);
},
// .................
// . RECORD ARRAYS .
// .................
/**
@private
Register a RecordArray for a given type to be backed by
a filter function. This will cause the array to update
automatically when records of that type change attribute
values or states.
@param {DS.RecordArray} array
@param {Class} type
@param {Function} filter
*/
registerRecordArray: function(array, type, filter) {
var recordArrays = this.typeMapFor(type).recordArrays;
recordArrays.push(array);
this.updateRecordArrayFilter(array, type, filter);
},
/**
@private
Create a `DS.ManyArray` for a type and list of clientIds
and index the `ManyArray` under each clientId. This allows
us to efficiently remove records from `ManyArray`s when
they are deleted.
@param {Class} type
@param {Array} clientIds
@return {DS.ManyArray}
*/
createManyArray: function(type, clientIds) {
var array = DS.ManyArray.create({ type: type, content: clientIds, store: this });
clientIds.forEach(function(clientId) {
var recordArrays = this.recordArraysForClientId(clientId);
recordArrays.add(array);
}, this);
return array;
},
/**
@private
This method is invoked if the `filterFunction` property is
changed on a `DS.FilteredRecordArray`.
It essentially re-runs the filter from scratch. This same
method is invoked when the filter is created in th first place.
*/
updateRecordArrayFilter: function(array, type, filter) {
var typeMap = this.typeMapFor(type),
cidToData = this.clientIdToData,
clientIds = typeMap.clientIds,
clientId, data, shouldFilter, record;
for (var i=0, l=clientIds.length; i<l; i++) {
clientId = clientIds[i];
shouldFilter = false;
data = cidToData[clientId];
if (typeof data === 'object') {
if (record = this.recordCache[clientId]) {
if (!get(record, 'isDeleted')) { shouldFilter = true; }
} else {
shouldFilter = true;
}
if (shouldFilter) {
this.updateRecordArray(array, filter, type, clientId);
}
}
}
},
updateRecordArraysLater: function(type, clientId) {
Ember.run.once(this, function() {
this.updateRecordArrays(type, clientId);
});
},
/**
@private
This method is invoked whenever data is loaded into the store
by the adapter or updated by the adapter, or when an attribute
changes on a record.
It updates all filters that a record belongs to.
To avoid thrashing, it only runs once per run loop per record.
@param {Class} type
@param {Number|String} clientId
*/
updateRecordArrays: function(type, clientId) {
var recordArrays = this.typeMapFor(type).recordArrays,
filter;
recordArrays.forEach(function(array) {
filter = get(array, 'filterFunction');
this.updateRecordArray(array, filter, type, clientId);
}, this);
// loop through all manyArrays containing an unloaded copy of this
// clientId and notify them that the record was loaded.
var manyArrays = this.loadingRecordArrays[clientId];
if (manyArrays) {
for (var i=0, l=manyArrays.length; i<l; i++) {
manyArrays[i].loadedRecord();
}
this.loadingRecordArrays[clientId] = null;
}
},
/**
@private
Update an individual filter.
@param {DS.FilteredRecordArray} array
@param {Function} filter
@param {Class} type
@param {Number|String} clientId
*/
updateRecordArray: function(array, filter, type, clientId) {
var shouldBeInArray, record;
if (!filter) {
shouldBeInArray = true;
} else {
record = this.findByClientId(type, clientId);
shouldBeInArray = filter(record);
}
var content = get(array, 'content');
var recordArrays = this.recordArraysForClientId(clientId);
var reference = this.referenceForClientId(clientId);
if (shouldBeInArray) {
recordArrays.add(array);
array.addReference(reference);
} else if (!shouldBeInArray) {
recordArrays.remove(array);
array.removeReference(reference);
}
},
/**
@private
When a record is deleted, it is removed from all its
record arrays.
@param {DS.Model} record
*/
removeFromRecordArrays: function(record) {
var reference = get(record, '_reference');
var recordArrays = this.recordArraysForClientId(reference.clientId);
recordArrays.forEach(function(array) {
array.removeReference(reference);
});
},
// ............
// . INDEXING .
// ............
/**
@private
Return a list of all `DS.RecordArray`s a clientId is
part of.
@return {Object(clientId: Ember.OrderedSet)}
*/
recordArraysForClientId: function(clientId) {
var recordArrays = get(this, 'recordArraysByClientId');
var ret = recordArrays[clientId];
if (!ret) {
ret = recordArrays[clientId] = Ember.OrderedSet.create();
}
return ret;
},
typeMapFor: function(type) {
var typeMaps = get(this, 'typeMaps');
var guidForType = Ember.guidFor(type);
var typeMap = typeMaps[guidForType];
if (typeMap) {
return typeMap;
} else {
return (typeMaps[guidForType] =
{
idToCid: {},
clientIds: [],
recordArrays: [],
metadata: {}
});
}
},
/** @private
For a given type and id combination, returns the client id used by the store.
If no client id has been assigned yet, one will be created and returned.
@param {DS.Model} type
@param {String|Number} id
*/
clientIdForId: function(type, id) {
id = coerceId(id);
var clientId = this.typeMapFor(type).idToCid[id];
if (clientId !== undefined) { return clientId; }
return this.pushData(UNLOADED, id, type);
},
/**
@private
This method works exactly like `clientIdForId`, but does not
require looking up the `typeMap` for every `clientId` and
invoking a method per `clientId`.
*/
clientIdsForIds: function(type, ids) {
var typeMap = this.typeMapFor(type),
idToClientIdMap = typeMap.idToCid;
return map(ids, function(id) {
id = coerceId(id);
var clientId = idToClientIdMap[id];
if (clientId) { return clientId; }
return this.pushData(UNLOADED, id, type);
}, this);
},
typeForClientId: function(clientId) {
return this.clientIdToType[clientId];
},
idForClientId: function(clientId) {
return this.clientIdToId[clientId];
},
// ................
// . LOADING DATA .
// ................
/**
Load new data into the store for a given id and type combination.
If data for that record had been loaded previously, the new information
overwrites the old.
If the record you are loading data for has outstanding changes that have not
yet been saved, an exception will be thrown.
@param {DS.Model} type
@param {String|Number} id
@param {Object} data the data to load
*/
load: function(type, data, prematerialized) {
var id;
if (typeof data === 'number' || typeof data === 'string') {
id = data;
data = prematerialized;
prematerialized = null;
}
if (prematerialized && prematerialized.id) {
id = prematerialized.id;
} else if (id === undefined) {
id = this.preprocessData(type, data);
}
id = coerceId(id);
var typeMap = this.typeMapFor(type),
clientId = typeMap.idToCid[id],
cidToPrematerialized = this.clientIdToPrematerializedData;
if (clientId !== undefined) {
this.loadData(data, clientId, type);
cidToPrematerialized[clientId] = prematerialized;
var record = this.recordCache[clientId];
if (record) {
once(record, 'loadedData');
}
} else {
clientId = this.pushData(data, id, type);
cidToPrematerialized[clientId] = prematerialized;
}
this.updateRecordArraysLater(type, clientId);
return this.referenceForClientId(clientId);
},
prematerialize: function(reference, prematerialized) {
this.clientIdToPrematerializedData[reference.clientId] = prematerialized;
},
loadMany: function(type, ids, dataList) {
if (dataList === undefined) {
dataList = ids;
ids = map(dataList, function(data) {
return this.preprocessData(type, data);
}, this);
}
return map(ids, function(id, i) {
return this.load(type, id, dataList[i]);
}, this);
},
loadHasMany: function(record, key, ids) {
//It looks sad to have to do the conversion in the store
var type = record.get(key + '.type'),
tuples = map(ids, function(id) {
return {id: id, type: type};
});
record.materializeHasMany(key, tuples);
// Update any existing many arrays that use the previous IDs,
// if necessary.
record.hasManyDidChange(key);
var relationship = record.cacheFor(key);
// TODO (tomdale) this assumes that loadHasMany *always* means
// that the records for the provided IDs are loaded.
if (relationship) {
set(relationship, 'isLoaded', true);
relationship.trigger('didLoad');
}
},
loadData: function(data, clientId, type){
var cidToData = this.clientIdToData;
cidToData[clientId] = data;
},
/** @private
Stores data for the specified type and id combination and returns
the client id.
@param {Object} data
@param {String|Number} id
@param {DS.Model} type
@returns {Number}
*/
pushData: function(data, id, type) {
var typeMap = this.typeMapFor(type);
var idToClientIdMap = typeMap.idToCid,
clientIdToIdMap = this.clientIdToId,
clientIdToTypeMap = this.clientIdToType,
clientIds = typeMap.clientIds,
cidToData = this.clientIdToData;
var clientId = ++this.clientIdCounter;
this.loadData(data, clientId, type);
clientIdToTypeMap[clientId] = type;
// if we're creating an item, this process will be done
// later, once the object has been persisted.
if (id) {
idToClientIdMap[id] = clientId;
clientIdToIdMap[clientId] = id;
}
clientIds.push(clientId);
return clientId;
},
// ..........................
// . RECORD MATERIALIZATION .
// ..........................
materializeRecord: function(type, clientId, id) {
var record;
this.recordCache[clientId] = record = type._create({
store: this,
clientId: clientId
});
set(record, 'id', id);
get(this, 'defaultTransaction').adoptRecord(record);
record.loadingData();
return record;
},
dematerializeRecord: function(record) {
var id = get(record, 'id'),
clientId = get(record, 'clientId'),
type = this.typeForClientId(clientId),
typeMap = this.typeMapFor(type);
record.updateRecordArrays();
delete this.recordCache[clientId];
delete this.clientIdToId[clientId];
delete this.clientIdToType[clientId];
delete this.clientIdToData[clientId];
delete this.recordArraysByClientId[clientId];
if (id) { delete typeMap.idToCid[id]; }
},
willDestroy: function() {
if (get(DS, 'defaultStore') === this) {
set(DS, 'defaultStore', null);
}
},
// ........................
// . RELATIONSHIP CHANGES .
// ........................
addRelationshipChangeFor: function(clientReference, childKey, parentReference, parentKey, change) {
var clientId = clientReference.clientId,
parentClientId = parentReference ? parentReference.clientId : parentReference;
var key = childKey + parentKey;
var changes = this.relationshipChanges;
if (!(clientId in changes)) {
changes[clientId] = {};
}
if (!(parentClientId in changes[clientId])) {
changes[clientId][parentClientId] = {};
}
if (!(key in changes[clientId][parentClientId])) {
changes[clientId][parentClientId][key] = {};
}
changes[clientId][parentClientId][key][change.changeType] = change;
},
removeRelationshipChangeFor: function(clientReference, childKey, parentReference, parentKey, type) {
var clientId = clientReference.clientId,
parentClientId = parentReference ? parentReference.clientId : parentReference;
var changes = this.relationshipChanges;
var key = childKey + parentKey;
if (!(clientId in changes) || !(parentClientId in changes[clientId]) || !(key in changes[clientId][parentClientId])){
return;
}
delete changes[clientId][parentClientId][key][type];
},
relationshipChangeFor: function(clientId, childKey, parentClientId, parentKey, type) {
var changes = this.relationshipChanges;
var key = childKey + parentKey;
if (!(clientId in changes) || !(parentClientId in changes[clientId])){
return;
}
if(type){
return changes[clientId][parentClientId][key][type];
}
else{
//TODO(Igor) what if both present
return changes[clientId][parentClientId][key]["add"] || changes[clientId][parentClientId][key]["remove"];
}
},
relationshipChangePairsFor: function(reference){
var toReturn = [];
if( !reference ) { return toReturn; }
//TODO(Igor) What about the other side
var changesObject = this.relationshipChanges[reference.clientId];
for (var objKey in changesObject){
if(changesObject.hasOwnProperty(objKey)){
for (var changeKey in changesObject[objKey]){
if(changesObject[objKey].hasOwnProperty(changeKey)){
toReturn.push(changesObject[objKey][changeKey]);
}
}
}
}
return toReturn;
},
relationshipChangesFor: function(reference) {
var toReturn = [];
if( !reference ) { return toReturn; }
var relationshipPairs = this.relationshipChangePairsFor(reference);
forEach(relationshipPairs, function(pair){
var addedChange = pair["add"];
var removedChange = pair["remove"];
if(addedChange){
toReturn.push(addedChange);
}
if(removedChange){
toReturn.push(removedChange);
}
});
return toReturn;
},
// ......................
// . PER-TYPE ADAPTERS
// ......................
adapterForType: function(type) {
this._adaptersMap = this.createInstanceMapFor('adapters');
var adapter = this._adaptersMap.get(type);
if (adapter) { return adapter; }
return this.get('_adapter');
},
// ..............................
// . RECORD CHANGE NOTIFICATION .
// ..............................
recordAttributeDidChange: function(reference, attributeName, newValue, oldValue) {
var record = this.recordForReference(reference),
dirtySet = new Ember.OrderedSet(),
adapter = this.adapterForType(record.constructor);
if (adapter.dirtyRecordsForAttributeChange) {
adapter.dirtyRecordsForAttributeChange(dirtySet, record, attributeName, newValue, oldValue);
}
dirtySet.forEach(function(record) {
record.adapterDidDirty();
});
},
recordBelongsToDidChange: function(dirtySet, child, relationship) {
var adapter = this.adapterForType(child.constructor);
if (adapter.dirtyRecordsForBelongsToChange) {
adapter.dirtyRecordsForBelongsToChange(dirtySet, child, relationship);
}
// adapterDidDirty is called by the RelationshipChange that created
// the dirtySet.
},
recordHasManyDidChange: function(dirtySet, parent, relationship) {
var adapter = this.adapterForType(parent.constructor);
if (adapter.dirtyRecordsForHasManyChange) {
adapter.dirtyRecordsForHasManyChange(dirtySet, parent, relationship);
}
// adapterDidDirty is called by the RelationshipChange that created
// the dirtySet.
}
});
DS.Store.reopenClass({
registerAdapter: DS._Mappable.generateMapFunctionFor('adapters', function(type, adapter, map) {
map.set(type, adapter);
}),
transformMapKey: function(key) {
if (typeof key === 'string') {
var transformedKey;
transformedKey = get(Ember.lookup, key);
return transformedKey;
} else {
return key;
}
},
transformMapValue: function(key, value) {
if (Ember.Object.detect(value)) {
return value.create();
}
return value;
}
});
})();
(function() {
var get = Ember.get, set = Ember.set,
once = Ember.run.once, arrayMap = Ember.ArrayPolyfills.map;
/**
This file encapsulates the various states that a record can transition
through during its lifecycle.
### State Manager
A record's state manager explicitly tracks what state a record is in
at any given time. For instance, if a record is newly created and has
not yet been sent to the adapter to be saved, it would be in the
`created.uncommitted` state. If a record has had local modifications
made to it that are in the process of being saved, the record would be
in the `updated.inFlight` state. (These state paths will be explained
in more detail below.)
Events are sent by the record or its store to the record's state manager.
How the state manager reacts to these events is dependent on which state
it is in. In some states, certain events will be invalid and will cause
an exception to be raised.
States are hierarchical. For example, a record can be in the
`deleted.start` state, then transition into the `deleted.inFlight` state.
If a child state does not implement an event handler, the state manager
will attempt to invoke the event on all parent states until the root state is
reached. The state hierarchy of a record is described in terms of a path
string. You can determine a record's current state by getting its manager's
current state path:
record.get('stateManager.currentPath');
//=> "created.uncommitted"
The `DS.Model` states are themselves stateless. What we mean is that,
though each instance of a record also has a unique instance of a
`DS.StateManager`, the hierarchical states that each of *those* points
to is a shared data structure. For performance reasons, instead of each
record getting its own copy of the hierarchy of states, each state
manager points to this global, immutable shared instance. How does a
state know which record it should be acting on? We pass a reference to
the current state manager as the first parameter to every method invoked
on a state.
The state manager passed as the first parameter is where you should stash
state about the record if needed; you should never store data on the state
object itself. If you need access to the record being acted on, you can
retrieve the state manager's `record` property. For example, if you had
an event handler `myEvent`:
myEvent: function(manager) {
var record = manager.get('record');
record.doSomething();
}
For more information about state managers in general, see the Ember.js
documentation on `Ember.StateManager`.
### Events, Flags, and Transitions
A state may implement zero or more events, flags, or transitions.
#### Events
Events are named functions that are invoked when sent to a record. The
state manager will first look for a method with the given name on the
current state. If no method is found, it will search the current state's
parent, and then its grandparent, and so on until reaching the top of
the hierarchy. If the root is reached without an event handler being found,
an exception will be raised. This can be very helpful when debugging new
features.
Here's an example implementation of a state with a `myEvent` event handler:
aState: DS.State.create({
myEvent: function(manager, param) {
console.log("Received myEvent with "+param);
}
})
To trigger this event:
record.send('myEvent', 'foo');
//=> "Received myEvent with foo"
Note that an optional parameter can be sent to a record's `send()` method,
which will be passed as the second parameter to the event handler.
Events should transition to a different state if appropriate. This can be
done by calling the state manager's `transitionTo()` method with a path to the
desired state. The state manager will attempt to resolve the state path
relative to the current state. If no state is found at that path, it will
attempt to resolve it relative to the current state's parent, and then its
parent, and so on until the root is reached. For example, imagine a hierarchy
like this:
* created
* start <-- currentState
* inFlight
* updated
* inFlight
If we are currently in the `start` state, calling
`transitionTo('inFlight')` would transition to the `created.inFlight` state,
while calling `transitionTo('updated.inFlight')` would transition to
the `updated.inFlight` state.
Remember that *only events* should ever cause a state transition. You should
never call `transitionTo()` from outside a state's event handler. If you are
tempted to do so, create a new event and send that to the state manager.
#### Flags
Flags are Boolean values that can be used to introspect a record's current
state in a more user-friendly way than examining its state path. For example,
instead of doing this:
var statePath = record.get('stateManager.currentPath');
if (statePath === 'created.inFlight') {
doSomething();
}
You can say:
if (record.get('isNew') && record.get('isSaving')) {
doSomething();
}
If your state does not set a value for a given flag, the value will
be inherited from its parent (or the first place in the state hierarchy
where it is defined).
The current set of flags are defined below. If you want to add a new flag,
in addition to the area below, you will also need to declare it in the
`DS.Model` class.
#### Transitions
Transitions are like event handlers but are called automatically upon
entering or exiting a state. To implement a transition, just call a method
either `enter` or `exit`:
myState: DS.State.create({
// Gets called automatically when entering
// this state.
enter: function(manager) {
console.log("Entered myState");
}
})
Note that enter and exit events are called once per transition. If the
current state changes, but changes to another child state of the parent,
the transition event on the parent will not be triggered.
*/
var stateProperty = Ember.computed(function(key) {
var parent = get(this, 'parentState');
if (parent) {
return get(parent, key);
}
}).property();
var hasDefinedProperties = function(object) {
for (var name in object) {
if (object.hasOwnProperty(name) && object[name]) { return true; }
}
return false;
};
var didChangeData = function(manager) {
var record = get(manager, 'record');
record.materializeData();
};
var willSetProperty = function(manager, context) {
context.oldValue = get(get(manager, 'record'), context.name);
var change = DS.AttributeChange.createChange(context);
get(manager, 'record')._changesToSync[context.name] = change;
};
var didSetProperty = function(manager, context) {
var change = get(manager, 'record')._changesToSync[context.name];
change.value = get(get(manager, 'record'), context.name);
change.sync();
};
DS.State = Ember.State.extend({
isLoaded: stateProperty,
isReloading: stateProperty,
isDirty: stateProperty,
isSaving: stateProperty,
isDeleted: stateProperty,
isError: stateProperty,
isNew: stateProperty,
isValid: stateProperty,
// For states that are substates of a
// DirtyState (updated or created), it is
// useful to be able to determine which
// type of dirty state it is.
dirtyType: stateProperty
});
// Implementation notes:
//
// Each state has a boolean value for all of the following flags:
//
// * isLoaded: The record has a populated `data` property. When a
// record is loaded via `store.find`, `isLoaded` is false
// until the adapter sets it. When a record is created locally,
// its `isLoaded` property is always true.
// * isDirty: The record has local changes that have not yet been
// saved by the adapter. This includes records that have been
// created (but not yet saved) or deleted.
// * isSaving: The record's transaction has been committed, but
// the adapter has not yet acknowledged that the changes have
// been persisted to the backend.
// * isDeleted: The record was marked for deletion. When `isDeleted`
// is true and `isDirty` is true, the record is deleted locally
// but the deletion was not yet persisted. When `isSaving` is
// true, the change is in-flight. When both `isDirty` and
// `isSaving` are false, the change has persisted.
// * isError: The adapter reported that it was unable to save
// local changes to the backend. This may also result in the
// record having its `isValid` property become false if the
// adapter reported that server-side validations failed.
// * isNew: The record was created on the client and the adapter
// did not yet report that it was successfully saved.
// * isValid: No client-side validations have failed and the
// adapter did not report any server-side validation failures.
// The dirty state is a abstract state whose functionality is
// shared between the `created` and `updated` states.
//
// The deleted state shares the `isDirty` flag with the
// subclasses of `DirtyState`, but with a very different
// implementation.
//
// Dirty states have three child states:
//
// `uncommitted`: the store has not yet handed off the record
// to be saved.
// `inFlight`: the store has handed off the record to be saved,
// but the adapter has not yet acknowledged success.
// `invalid`: the record has invalid information and cannot be
// send to the adapter yet.
var DirtyState = DS.State.extend({
initialState: 'uncommitted',
// FLAGS
isDirty: true,
// SUBSTATES
// When a record first becomes dirty, it is `uncommitted`.
// This means that there are local pending changes, but they
// have not yet begun to be saved, and are not invalid.
uncommitted: DS.State.extend({
// TRANSITIONS
enter: function(manager) {
var dirtyType = get(this, 'dirtyType'),
record = get(manager, 'record');
record.withTransaction(function (t) {
t.recordBecameDirty(dirtyType, record);
});
},
// EVENTS
willSetProperty: willSetProperty,
didSetProperty: didSetProperty,
becomeDirty: Ember.K,
willCommit: function(manager) {
manager.transitionTo('inFlight');
},
becameClean: function(manager) {
var record = get(manager, 'record'),
dirtyType = get(this, 'dirtyType');
record.withTransaction(function(t) {
t.recordBecameClean(dirtyType, record);
});
manager.transitionTo('loaded.materializing');
},
becameInvalid: function(manager) {
var dirtyType = get(this, 'dirtyType'),
record = get(manager, 'record');
record.withTransaction(function (t) {
t.recordBecameInFlight(dirtyType, record);
});
manager.transitionTo('invalid');
},
rollback: function(manager) {
get(manager, 'record').rollback();
}
}),
// Once a record has been handed off to the adapter to be
// saved, it is in the 'in flight' state. Changes to the
// record cannot be made during this window.
inFlight: DS.State.extend({
// FLAGS
isSaving: true,
// TRANSITIONS
enter: function(manager) {
var dirtyType = get(this, 'dirtyType'),
record = get(manager, 'record');
record.becameInFlight();
record.withTransaction(function (t) {
t.recordBecameInFlight(dirtyType, record);
});
},
// EVENTS
didCommit: function(manager) {
var dirtyType = get(this, 'dirtyType'),
record = get(manager, 'record');
record.withTransaction(function(t) {
t.recordBecameClean('inflight', record);
});
manager.transitionTo('saved');
manager.send('invokeLifecycleCallbacks', dirtyType);
},
becameInvalid: function(manager, errors) {
var record = get(manager, 'record');
set(record, 'errors', errors);
manager.transitionTo('invalid');
manager.send('invokeLifecycleCallbacks');
},
becameError: function(manager) {
manager.transitionTo('error');
manager.send('invokeLifecycleCallbacks');
}
}),
// A record is in the `invalid` state when its client-side
// invalidations have failed, or if the adapter has indicated
// the the record failed server-side invalidations.
invalid: DS.State.extend({
// FLAGS
isValid: false,
exit: function(manager) {
var record = get(manager, 'record');
record.withTransaction(function (t) {
t.recordBecameClean('inflight', record);
});
},
// EVENTS
deleteRecord: function(manager) {
manager.transitionTo('deleted');
get(manager, 'record').clearRelationships();
},
willSetProperty: willSetProperty,
didSetProperty: function(manager, context) {
var record = get(manager, 'record'),
errors = get(record, 'errors'),
key = context.name;
set(errors, key, null);
if (!hasDefinedProperties(errors)) {
manager.send('becameValid');
}
didSetProperty(manager, context);
},
becomeDirty: Ember.K,
rollback: function(manager) {
manager.send('becameValid');
manager.send('rollback');
},
becameValid: function(manager) {
manager.transitionTo('uncommitted');
},
invokeLifecycleCallbacks: function(manager) {
var record = get(manager, 'record');
record.trigger('becameInvalid', record);
}
})
});
// The created and updated states are created outside the state
// chart so we can reopen their substates and add mixins as
// necessary.
var createdState = DirtyState.create({
dirtyType: 'created',
// FLAGS
isNew: true
});
var updatedState = DirtyState.create({
dirtyType: 'updated'
});
createdState.states.uncommitted.reopen({
deleteRecord: function(manager) {
var record = get(manager, 'record');
record.withTransaction(function(t) {
t.recordIsMoving('created', record);
});
record.clearRelationships();
manager.transitionTo('deleted.saved');
}
});
createdState.states.uncommitted.reopen({
rollback: function(manager) {
this._super(manager);
manager.transitionTo('deleted.saved');
}
});
updatedState.states.uncommitted.reopen({
deleteRecord: function(manager) {
var record = get(manager, 'record');
record.withTransaction(function(t) {
t.recordIsMoving('updated', record);
});
manager.transitionTo('deleted');
get(manager, 'record').clearRelationships();
}
});
var states = {
rootState: Ember.State.create({
// FLAGS
isLoaded: false,
isReloading: false,
isDirty: false,
isSaving: false,
isDeleted: false,
isError: false,
isNew: false,
isValid: true,
// SUBSTATES
// A record begins its lifecycle in the `empty` state.
// If its data will come from the adapter, it will
// transition into the `loading` state. Otherwise, if
// the record is being created on the client, it will
// transition into the `created` state.
empty: DS.State.create({
// EVENTS
loadingData: function(manager) {
manager.transitionTo('loading');
},
loadedData: function(manager) {
manager.transitionTo('loaded.created');
}
}),
// A record enters this state when the store askes
// the adapter for its data. It remains in this state
// until the adapter provides the requested data.
//
// Usually, this process is asynchronous, using an
// XHR to retrieve the data.
loading: DS.State.create({
// EVENTS
loadedData: didChangeData,
materializingData: function(manager) {
manager.transitionTo('loaded.materializing.firstTime');
}
}),
// A record enters this state when its data is populated.
// Most of a record's lifecycle is spent inside substates
// of the `loaded` state.
loaded: DS.State.create({
initialState: 'saved',
// FLAGS
isLoaded: true,
// SUBSTATES
materializing: DS.State.create({
// EVENTS
willSetProperty: Ember.K,
didSetProperty: Ember.K,
didChangeData: didChangeData,
finishedMaterializing: function(manager) {
manager.transitionTo('loaded.saved');
},
// SUBSTATES
firstTime: DS.State.create({
// FLAGS
isLoaded: false,
exit: function(manager) {
var record = get(manager, 'record');
once(function() {
record.trigger('didLoad');
});
}
})
}),
reloading: DS.State.create({
// FLAGS
isReloading: true,
// TRANSITIONS
enter: function(manager) {
var record = get(manager, 'record'),
store = get(record, 'store');
store.reloadRecord(record);
},
exit: function(manager) {
var record = get(manager, 'record');
once(record, 'trigger', 'didReload');
},
// EVENTS
loadedData: didChangeData,
materializingData: function(manager) {
manager.transitionTo('loaded.materializing');
}
}),
// If there are no local changes to a record, it remains
// in the `saved` state.
saved: DS.State.create({
// EVENTS
willSetProperty: willSetProperty,
didSetProperty: didSetProperty,
didChangeData: didChangeData,
loadedData: didChangeData,
reloadRecord: function(manager) {
manager.transitionTo('loaded.reloading');
},
materializingData: function(manager) {
manager.transitionTo('loaded.materializing');
},
becomeDirty: function(manager) {
manager.transitionTo('updated');
},
deleteRecord: function(manager) {
manager.transitionTo('deleted');
get(manager, 'record').clearRelationships();
},
unloadRecord: function(manager) {
var record = get(manager, 'record');
// clear relationships before moving to deleted state
// otherwise it fails
record.clearRelationships();
record.withTransaction(function(t) {
t.recordIsMoving('updated', record);
});
manager.transitionTo('deleted.saved');
},
invokeLifecycleCallbacks: function(manager, dirtyType) {
var record = get(manager, 'record');
if (dirtyType === 'created') {
record.trigger('didCreate', record);
} else {
record.trigger('didUpdate', record);
}
}
}),
// A record is in this state after it has been locally
// created but before the adapter has indicated that
// it has been saved.
created: createdState,
// A record is in this state if it has already been
// saved to the server, but there are new local changes
// that have not yet been saved.
updated: updatedState
}),
// A record is in this state if it was deleted from the store.
deleted: DS.State.create({
initialState: 'uncommitted',
dirtyType: 'deleted',
// FLAGS
isDeleted: true,
isLoaded: true,
isDirty: true,
// TRANSITIONS
setup: function(manager) {
var record = get(manager, 'record'),
store = get(record, 'store');
store.removeFromRecordArrays(record);
},
// SUBSTATES
// When a record is deleted, it enters the `start`
// state. It will exit this state when the record's
// transaction starts to commit.
uncommitted: DS.State.create({
// TRANSITIONS
enter: function(manager) {
var record = get(manager, 'record');
record.withTransaction(function(t) {
t.recordBecameDirty('deleted', record);
});
},
// EVENTS
willCommit: function(manager) {
manager.transitionTo('inFlight');
},
rollback: function(manager) {
get(manager, 'record').rollback();
},
becomeDirty: Ember.K,
becameClean: function(manager) {
var record = get(manager, 'record');
record.withTransaction(function(t) {
t.recordBecameClean('deleted', record);
});
manager.transitionTo('loaded.materializing');
}
}),
// After a record's transaction is committing, but
// before the adapter indicates that the deletion
// has saved to the server, a record is in the
// `inFlight` substate of `deleted`.
inFlight: DS.State.create({
// FLAGS
isSaving: true,
// TRANSITIONS
enter: function(manager) {
var record = get(manager, 'record');
record.becameInFlight();
record.withTransaction(function (t) {
t.recordBecameInFlight('deleted', record);
});
},
// EVENTS
didCommit: function(manager) {
var record = get(manager, 'record');
record.withTransaction(function(t) {
t.recordBecameClean('inflight', record);
});
manager.transitionTo('saved');
manager.send('invokeLifecycleCallbacks');
}
}),
// Once the adapter indicates that the deletion has
// been saved, the record enters the `saved` substate
// of `deleted`.
saved: DS.State.create({
// FLAGS
isDirty: false,
setup: function(manager) {
var record = get(manager, 'record'),
store = get(record, 'store');
store.dematerializeRecord(record);
},
invokeLifecycleCallbacks: function(manager) {
var record = get(manager, 'record');
record.trigger('didDelete', record);
}
})
}),
// If the adapter indicates that there was an unknown
// error saving a record, the record enters the `error`
// state.
error: DS.State.create({
isError: true,
// EVENTS
invokeLifecycleCallbacks: function(manager) {
var record = get(manager, 'record');
record.trigger('becameError', record);
}
})
})
};
DS.StateManager = Ember.StateManager.extend({
record: null,
initialState: 'rootState',
states: states,
unhandledEvent: function(manager, originalEvent) {
var record = manager.get('record'),
contexts = [].slice.call(arguments, 2),
errorMessage;
errorMessage = "Attempted to handle event `" + originalEvent + "` ";
errorMessage += "on " + record.toString() + " while in state ";
errorMessage += get(manager, 'currentState.path') + ". Called with ";
errorMessage += arrayMap.call(contexts, function(context){
return Ember.inspect(context);
}).join(', ');
throw new Ember.Error(errorMessage);
}
});
})();
(function() {
var LoadPromise = DS.LoadPromise; // system/mixins/load_promise
var get = Ember.get, set = Ember.set, map = Ember.EnumerableUtils.map;
var retrieveFromCurrentState = Ember.computed(function(key, value) {
return get(get(this, 'stateManager.currentState'), key);
}).property('stateManager.currentState').readOnly();
DS.Model = Ember.Object.extend(Ember.Evented, LoadPromise, {
isLoaded: retrieveFromCurrentState,
isReloading: retrieveFromCurrentState,
isDirty: retrieveFromCurrentState,
isSaving: retrieveFromCurrentState,
isDeleted: retrieveFromCurrentState,
isError: retrieveFromCurrentState,
isNew: retrieveFromCurrentState,
isValid: retrieveFromCurrentState,
clientId: null,
id: null,
transaction: null,
stateManager: null,
errors: null,
/**
Create a JSON representation of the record, using the serialization
strategy of the store's adapter.
Available options:
* `includeId`: `true` if the record's ID should be included in the
JSON representation.
@param {Object} options
@returns {Object} an object whose values are primitive JSON values only
*/
serialize: function(options) {
var store = get(this, 'store');
return store.serialize(this, options);
},
toJSON: function(options) {
var serializer = DS.JSONSerializer.create();
return serializer.serialize(this, options);
},
didLoad: Ember.K,
didReload: Ember.K,
didUpdate: Ember.K,
didCreate: Ember.K,
didDelete: Ember.K,
becameInvalid: Ember.K,
becameError: Ember.K,
data: Ember.computed(function() {
if (!this._data) {
this.materializeData();
}
return this._data;
}).property(),
materializeData: function() {
this.send('materializingData');
get(this, 'store').materializeData(this);
this.suspendRelationshipObservers(function() {
this.notifyPropertyChange('data');
});
},
_data: null,
init: function() {
this._super();
var stateManager = DS.StateManager.create({ record: this });
set(this, 'stateManager', stateManager);
this._setup();
stateManager.goToState('empty');
},
_setup: function() {
this._relationshipChanges = {};
this._changesToSync = {};
},
send: function(name, context) {
return get(this, 'stateManager').send(name, context);
},
withTransaction: function(fn) {
var transaction = get(this, 'transaction');
if (transaction) { fn(transaction); }
},
loadingData: function() {
this.send('loadingData');
},
loadedData: function() {
this.send('loadedData');
},
didChangeData: function() {
this.send('didChangeData');
},
/**
Reload the record from the adapter.
This will only work if the record has already finished loading
and has not yet been modified (`isLoaded` but not `isDirty`,
or `isSaving`).
*/
reload: function() {
this.send('reloadRecord');
},
deleteRecord: function() {
this.send('deleteRecord');
},
unloadRecord: function() {
this.send('unloadRecord');
},
clearRelationships: function() {
this.eachRelationship(function(name, relationship) {
if (relationship.kind === 'belongsTo') {
set(this, name, null);
} else if (relationship.kind === 'hasMany') {
this.clearHasMany(relationship);
}
}, this);
},
updateRecordArrays: function() {
var store = get(this, 'store');
if (store) {
store.dataWasUpdated(this.constructor, get(this, '_reference'), this);
}
},
/**
If the adapter did not return a hash in response to a commit,
merge the changed attributes and relationships into the existing
saved data.
*/
adapterDidCommit: function() {
var attributes = get(this, 'data').attributes;
get(this.constructor, 'attributes').forEach(function(name, meta) {
attributes[name] = get(this, name);
}, this);
this.send('didCommit');
this.updateRecordArraysLater();
},
adapterDidDirty: function() {
this.send('becomeDirty');
this.updateRecordArraysLater();
},
dataDidChange: Ember.observer(function() {
var relationships = get(this.constructor, 'relationshipsByName');
this.updateRecordArraysLater();
relationships.forEach(function(name, relationship) {
if (relationship.kind === 'hasMany') {
this.hasManyDidChange(relationship.key);
}
}, this);
this.send('finishedMaterializing');
}, 'data'),
hasManyDidChange: function(key) {
var cachedValue = this.cacheFor(key);
if (cachedValue) {
var type = get(this.constructor, 'relationshipsByName').get(key).type;
var store = get(this, 'store');
var ids = this._data.hasMany[key] || [];
var references = map(ids, function(id) {
if (typeof id === 'object') {
if( id.clientId ) {
// if it was already a reference, return the reference
return id;
} else {
// <id, type> tuple for a polymorphic association.
return store.referenceForId(id.type, id.id);
}
}
return store.referenceForId(type, id);
});
set(cachedValue, 'content', Ember.A(references));
}
},
updateRecordArraysLater: function() {
Ember.run.once(this, this.updateRecordArrays);
},
setupData: function(prematerialized) {
this._data = {
attributes: {},
belongsTo: {},
hasMany: {},
id: null
};
},
materializeId: function(id) {
set(this, 'id', id);
},
materializeAttributes: function(attributes) {
this._data.attributes = attributes;
},
materializeAttribute: function(name, value) {
this._data.attributes[name] = value;
},
materializeHasMany: function(name, tuplesOrReferencesOrOpaque) {
var tuplesOrReferencesOrOpaqueType = typeof tuplesOrReferencesOrOpaque;
if (tuplesOrReferencesOrOpaque && tuplesOrReferencesOrOpaqueType !== 'string' && tuplesOrReferencesOrOpaque.length > 1) { Ember.assert('materializeHasMany expects tuples, references or opaque token, not ' + tuplesOrReferencesOrOpaque[0], tuplesOrReferencesOrOpaque[0].hasOwnProperty('id') && tuplesOrReferencesOrOpaque[0].type); }
if( tuplesOrReferencesOrOpaqueType === "string" ) {
this._data.hasMany[name] = tuplesOrReferencesOrOpaque;
} else {
var references = tuplesOrReferencesOrOpaque;
if (tuplesOrReferencesOrOpaque && Ember.isArray(tuplesOrReferencesOrOpaque)) {
references = this._convertTuplesToReferences(tuplesOrReferencesOrOpaque);
}
this._data.hasMany[name] = references;
}
},
materializeBelongsTo: function(name, tupleOrReference) {
if (tupleOrReference) { Ember.assert('materializeBelongsTo expects a tuple or a reference, not a ' + tupleOrReference, !tupleOrReference || (tupleOrReference.hasOwnProperty('id') && tupleOrReference.hasOwnProperty('type'))); }
this._data.belongsTo[name] = tupleOrReference;
},
_convertTuplesToReferences: function(tuplesOrReferences) {
return map(tuplesOrReferences, function(tupleOrReference) {
return this._convertTupleToReference(tupleOrReference);
}, this);
},
_convertTupleToReference: function(tupleOrReference) {
var store = get(this, 'store');
if(tupleOrReference.clientId) {
return tupleOrReference;
} else {
return store.referenceForId(tupleOrReference.type, tupleOrReference.id);
}
},
rollback: function() {
this._setup();
this.send('becameClean');
this.suspendRelationshipObservers(function() {
this.notifyPropertyChange('data');
});
},
toStringExtension: function() {
return get(this, 'id');
},
/**
@private
The goal of this method is to temporarily disable specific observers
that take action in response to application changes.
This allows the system to make changes (such as materialization and
rollback) that should not trigger secondary behavior (such as setting an
inverse relationship or marking records as dirty).
The specific implementation will likely change as Ember proper provides
better infrastructure for suspending groups of observers, and if Array
observation becomes more unified with regular observers.
*/
suspendRelationshipObservers: function(callback, binding) {
var observers = get(this.constructor, 'relationshipNames').belongsTo;
var self = this;
try {
this._suspendedRelationships = true;
Ember._suspendObservers(self, observers, null, 'belongsToDidChange', function() {
Ember._suspendBeforeObservers(self, observers, null, 'belongsToWillChange', function() {
callback.call(binding || self);
});
});
} finally {
this._suspendedRelationships = false;
}
},
becameInFlight: function() {
},
// FOR USE BY THE BASIC ADAPTER
save: function() {
this.get('store').scheduleSave(this);
},
// FOR USE DURING COMMIT PROCESS
adapterDidUpdateAttribute: function(attributeName, value) {
// If a value is passed in, update the internal attributes and clear
// the attribute cache so it picks up the new value. Otherwise,
// collapse the current value into the internal attributes because
// the adapter has acknowledged it.
if (value !== undefined) {
get(this, 'data.attributes')[attributeName] = value;
this.notifyPropertyChange(attributeName);
} else {
value = get(this, attributeName);
get(this, 'data.attributes')[attributeName] = value;
}
this.updateRecordArraysLater();
},
_reference: Ember.computed(function() {
return get(this, 'store').referenceForClientId(get(this, 'clientId'));
}),
adapterDidInvalidate: function(errors) {
this.send('becameInvalid', errors);
},
adapterDidError: function() {
this.send('becameError');
},
/**
@private
Override the default event firing from Ember.Evented to
also call methods with the given name.
*/
trigger: function(name) {
Ember.tryInvoke(this, name, [].slice.call(arguments, 1));
this._super.apply(this, arguments);
}
});
// Helper function to generate store aliases.
// This returns a function that invokes the named alias
// on the default store, but injects the class as the
// first parameter.
var storeAlias = function(methodName) {
return function() {
var store = get(DS, 'defaultStore'),
args = [].slice.call(arguments);
args.unshift(this);
return store[methodName].apply(store, args);
};
};
DS.Model.reopenClass({
isLoaded: storeAlias('recordIsLoaded'),
find: storeAlias('find'),
all: storeAlias('all'),
query: storeAlias('findQuery'),
filter: storeAlias('filter'),
_create: DS.Model.create,
create: function() {
throw new Ember.Error("You should not call `create` on a model. Instead, call `createRecord` with the attributes you would like to set.");
},
createRecord: storeAlias('createRecord')
});
})();
(function() {
var get = Ember.get;
DS.Model.reopenClass({
attributes: Ember.computed(function() {
var map = Ember.Map.create();
this.eachComputedProperty(function(name, meta) {
if (meta.isAttribute) {
meta.name = name;
map.set(name, meta);
}
});
return map;
})
});
var AttributeChange = DS.AttributeChange = function(options) {
this.reference = options.reference;
this.store = options.store;
this.name = options.name;
this.oldValue = options.oldValue;
};
AttributeChange.createChange = function(options) {
return new AttributeChange(options);
};
AttributeChange.prototype = {
sync: function() {
this.store.recordAttributeDidChange(this.reference, this.name, this.value, this.oldValue);
// TODO: Use this object in the commit process
this.destroy();
},
destroy: function() {
delete this.store.recordForReference(this.reference)._changesToSync[this.name];
}
};
DS.Model.reopen({
eachAttribute: function(callback, binding) {
get(this.constructor, 'attributes').forEach(function(name, meta) {
callback.call(binding, name, meta);
}, binding);
},
attributeWillChange: Ember.beforeObserver(function(record, key) {
var reference = get(record, '_reference'),
store = get(record, 'store');
record.send('willSetProperty', { reference: reference, store: store, name: key });
}),
attributeDidChange: Ember.observer(function(record, key) {
record.send('didSetProperty', { name: key });
})
});
function getAttr(record, options, key) {
var attributes = get(record, 'data').attributes;
var value = attributes[key];
if (value === undefined) {
value = options.defaultValue;
}
return value;
}
DS.attr = function(type, options) {
options = options || {};
var meta = {
type: type,
isAttribute: true,
options: options
};
return Ember.computed(function(key, value, oldValue) {
if (arguments.length > 1) {
} else {
value = getAttr(this, options, key);
}
return value;
// `data` is never set directly. However, it may be
// invalidated from the state manager's setData
// event.
}).property('data').meta(meta);
};
})();
(function() {
})();
(function() {
var get = Ember.get, set = Ember.set,
isNone = Ember.isNone;
DS.belongsTo = function(type, options) {
options = options || {};
var meta = { type: type, isRelationship: true, options: options, kind: 'belongsTo' };
return Ember.computed(function(key, value) {
if (typeof type === 'string') {
type = get(this, type, false) || get(Ember.lookup, type);
}
if (arguments.length === 2) {
return value === undefined ? null : value;
}
var data = get(this, 'data').belongsTo,
store = get(this, 'store'), id;
id = data[key];
if(isNone(id)) {
return null;
} else if (id.clientId) {
return store.recordForReference(id);
} else {
return store.findById(id.type, id.id);
}
}).property('data').meta(meta);
};
/**
These observers observe all `belongsTo` relationships on the record. See
`relationships/ext` to see how these observers get their dependencies.
*/
DS.Model.reopen({
/** @private */
belongsToWillChange: Ember.beforeObserver(function(record, key) {
if (get(record, 'isLoaded')) {
var oldParent = get(record, key);
var childReference = get(record, '_reference'),
store = get(record, 'store');
if (oldParent){
var change = DS.RelationshipChange.createChange(childReference, get(oldParent, '_reference'), store, { key: key, kind:"belongsTo", changeType: "remove" });
change.sync();
this._changesToSync[key] = change;
}
}
}),
/** @private */
belongsToDidChange: Ember.immediateObserver(function(record, key) {
if (get(record, 'isLoaded')) {
var newParent = get(record, key);
if(newParent){
var childReference = get(record, '_reference'),
store = get(record, 'store');
var change = DS.RelationshipChange.createChange(childReference, get(newParent, '_reference'), store, { key: key, kind:"belongsTo", changeType: "add" });
change.sync();
if(this._changesToSync[key]){
DS.OneToManyChange.ensureSameTransaction([change, this._changesToSync[key]], store);
}
}
}
delete this._changesToSync[key];
})
});
})();
(function() {
var get = Ember.get, set = Ember.set, forEach = Ember.ArrayPolyfills.forEach;
var hasRelationship = function(type, options) {
options = options || {};
var meta = { type: type, isRelationship: true, options: options, kind: 'hasMany' };
return Ember.computed(function(key, value) {
var data = get(this, 'data').hasMany,
store = get(this, 'store'),
ids, relationship;
if (typeof type === 'string') {
type = get(this, type, false) || get(Ember.lookup, type);
}
//ids can be references or opaque token
//(e.g. `{url: '/relationship'}`) that will be passed to the adapter
ids = data[key];
relationship = store.findMany(type, ids, this, meta);
set(relationship, 'owner', this);
set(relationship, 'name', key);
set(relationship, 'isPolymorphic', options.polymorphic);
return relationship;
}).property().meta(meta);
};
DS.hasMany = function(type, options) {
return hasRelationship(type, options);
};
function clearUnmaterializedHasMany(record, relationship) {
var store = get(record, 'store'),
data = get(record, 'data').hasMany,
type = relationship.type;
var references = data[relationship.key];
if (!references) { return; }
var inverseName = record.constructor.inverseFor(relationship.key).name;
forEach.call(references, function(reference) {
var childRecord;
if (store.isReferenceMaterialized(reference)) {
childRecord = store.recordForReference(reference);
record.suspendRelationshipObservers(function() {
set(childRecord, inverseName, null);
});
}
});
}
DS.Model.reopen({
clearHasMany: function(relationship) {
var hasMany = this.cacheFor(relationship.name);
if (hasMany) {
hasMany.clear();
} else {
clearUnmaterializedHasMany(this, relationship);
}
}
});
})();
(function() {
var get = Ember.get, set = Ember.set;
/**
@private
This file defines several extensions to the base `DS.Model` class that
add support for one-to-many relationships.
*/
DS.Model.reopen({
// This Ember.js hook allows an object to be notified when a property
// is defined.
//
// In this case, we use it to be notified when an Ember Data user defines a
// belongs-to relationship. In that case, we need to set up observers for
// each one, allowing us to track relationship changes and automatically
// reflect changes in the inverse has-many array.
//
// This hook passes the class being set up, as well as the key and value
// being defined. So, for example, when the user does this:
//
// DS.Model.extend({
// parent: DS.belongsTo(App.User)
// });
//
// This hook would be called with "parent" as the key and the computed
// property returned by `DS.belongsTo` as the value.
didDefineProperty: function(proto, key, value) {
// Check if the value being set is a computed property.
if (value instanceof Ember.Descriptor) {
// If it is, get the metadata for the relationship. This is
// populated by the `DS.belongsTo` helper when it is creating
// the computed property.
var meta = value.meta();
if (meta.isRelationship && meta.kind === 'belongsTo') {
Ember.addObserver(proto, key, null, 'belongsToDidChange');
Ember.addBeforeObserver(proto, key, null, 'belongsToWillChange');
}
if (meta.isAttribute) {
Ember.addObserver(proto, key, null, 'attributeDidChange');
Ember.addBeforeObserver(proto, key, null, 'attributeWillChange');
}
meta.parentType = proto.constructor;
}
}
});
/**
These DS.Model extensions add class methods that provide relationship
introspection abilities about relationships.
A note about the computed properties contained here:
**These properties are effectively sealed once called for the first time.**
To avoid repeatedly doing expensive iteration over a model's fields, these
values are computed once and then cached for the remainder of the runtime of
your application.
If your application needs to modify a class after its initial definition
(for example, using `reopen()` to add additional attributes), make sure you
do it before using your model with the store, which uses these properties
extensively.
*/
DS.Model.reopenClass({
/**
For a given relationship name, returns the model type of the relationship.
For example, if you define a model like this:
App.Post = DS.Model.extend({
comments: DS.hasMany(App.Comment)
});
Calling `App.Post.typeForRelationship('comments')` will return `App.Comment`.
@param {String} name the name of the relationship
@return {subclass of DS.Model} the type of the relationship, or undefined
*/
typeForRelationship: function(name) {
var relationship = get(this, 'relationshipsByName').get(name);
return relationship && relationship.type;
},
inverseFor: function(name) {
var inverseType = this.typeForRelationship(name);
if (!inverseType) { return null; }
var options = this.metaForProperty(name).options;
var inverseName, inverseKind;
if (options.inverse) {
inverseName = options.inverse;
inverseKind = Ember.get(inverseType, 'relationshipsByName').get(inverseName).kind;
} else {
var possibleRelationships = findPossibleInverses(this, inverseType);
if (possibleRelationships.length === 0) { return null; }
inverseName = possibleRelationships[0].name;
inverseKind = possibleRelationships[0].kind;
}
function findPossibleInverses(type, inverseType, possibleRelationships) {
possibleRelationships = possibleRelationships || [];
var relationshipMap = get(inverseType, 'relationships');
if (!relationshipMap) { return; }
var relationships = relationshipMap.get(type);
if (relationships) {
possibleRelationships.push.apply(possibleRelationships, relationshipMap.get(type));
}
if (type.superclass) {
findPossibleInverses(type.superclass, inverseType, possibleRelationships);
}
return possibleRelationships;
}
return {
type: inverseType,
name: inverseName,
kind: inverseKind
};
},
/**
The model's relationships as a map, keyed on the type of the
relationship. The value of each entry is an array containing a descriptor
for each relationship with that type, describing the name of the relationship
as well as the type.
For example, given the following model definition:
App.Blog = DS.Model.extend({
users: DS.hasMany(App.User),
owner: DS.belongsTo(App.User),
posts: DS.hasMany(App.Post)
});
This computed property would return a map describing these
relationships, like this:
var relationships = Ember.get(App.Blog, 'relationships');
relationships.get(App.User);
//=> [ { name: 'users', kind: 'hasMany' },
// { name: 'owner', kind: 'belongsTo' } ]
relationships.get(App.Post);
//=> [ { name: 'posts', kind: 'hasMany' } ]
@type Ember.Map
@readOnly
*/
relationships: Ember.computed(function() {
var map = new Ember.MapWithDefault({
defaultValue: function() { return []; }
});
// Loop through each computed property on the class
this.eachComputedProperty(function(name, meta) {
// If the computed property is a relationship, add
// it to the map.
if (meta.isRelationship) {
if (typeof meta.type === 'string') {
meta.type = Ember.get(Ember.lookup, meta.type);
}
var relationshipsForType = map.get(meta.type);
relationshipsForType.push({ name: name, kind: meta.kind });
}
});
return map;
}),
/**
A hash containing lists of the model's relationships, grouped
by the relationship kind. For example, given a model with this
definition:
App.Blog = DS.Model.extend({
users: DS.hasMany(App.User),
owner: DS.belongsTo(App.User),
posts: DS.hasMany(App.Post)
});
This property would contain the following:
var relationshipNames = Ember.get(App.Blog, 'relationshipNames');
relationshipNames.hasMany;
//=> ['users', 'posts']
relationshipNames.belongsTo;
//=> ['owner']
@type Object
@readOnly
*/
relationshipNames: Ember.computed(function() {
var names = { hasMany: [], belongsTo: [] };
this.eachComputedProperty(function(name, meta) {
if (meta.isRelationship) {
names[meta.kind].push(name);
}
});
return names;
}),
/**
An array of types directly related to a model. Each type will be
included once, regardless of the number of relationships it has with
the model.
For example, given a model with this definition:
App.Blog = DS.Model.extend({
users: DS.hasMany(App.User),
owner: DS.belongsTo(App.User),
posts: DS.hasMany(App.Post)
});
This property would contain the following:
var relatedTypes = Ember.get(App.Blog, 'relatedTypes');
//=> [ App.User, App.Post ]
@type Ember.Array
@readOnly
*/
relatedTypes: Ember.computed(function() {
var type,
types = Ember.A([]);
// Loop through each computed property on the class,
// and create an array of the unique types involved
// in relationships
this.eachComputedProperty(function(name, meta) {
if (meta.isRelationship) {
type = meta.type;
if (typeof type === 'string') {
type = get(this, type, false) || get(Ember.lookup, type);
}
if (!types.contains(type)) {
types.push(type);
}
}
});
return types;
}),
/**
A map whose keys are the relationships of a model and whose values are
relationship descriptors.
For example, given a model with this
definition:
App.Blog = DS.Model.extend({
users: DS.hasMany(App.User),
owner: DS.belongsTo(App.User),
posts: DS.hasMany(App.Post)
});
This property would contain the following:
var relationshipsByName = Ember.get(App.Blog, 'relationshipsByName');
relationshipsByName.get('users');
//=> { key: 'users', kind: 'hasMany', type: App.User }
relationshipsByName.get('owner');
//=> { key: 'owner', kind: 'belongsTo', type: App.User }
@type Ember.Map
@readOnly
*/
relationshipsByName: Ember.computed(function() {
var map = Ember.Map.create(), type;
this.eachComputedProperty(function(name, meta) {
if (meta.isRelationship) {
meta.key = name;
type = meta.type;
if (typeof type === 'string') {
type = get(this, type, false) || get(Ember.lookup, type);
meta.type = type;
}
map.set(name, meta);
}
});
return map;
}),
/**
A map whose keys are the fields of the model and whose values are strings
describing the kind of the field. A model's fields are the union of all of its
attributes and relationships.
For example:
App.Blog = DS.Model.extend({
users: DS.hasMany(App.User),
owner: DS.belongsTo(App.User),
posts: DS.hasMany(App.Post),
title: DS.attr('string')
});
var fields = Ember.get(App.Blog, 'fields');
fields.forEach(function(field, kind) {
console.log(field, kind);
});
// prints:
// users, hasMany
// owner, belongsTo
// posts, hasMany
// title, attribute
@type Ember.Map
@readOnly
*/
fields: Ember.computed(function() {
var map = Ember.Map.create(), type;
this.eachComputedProperty(function(name, meta) {
if (meta.isRelationship) {
map.set(name, meta.kind);
} else if (meta.isAttribute) {
map.set(name, 'attribute');
}
});
return map;
}),
/**
Given a callback, iterates over each of the relationships in the model,
invoking the callback with the name of each relationship and its relationship
descriptor.
@param {Function} callback the callback to invoke
@param {any} binding the value to which the callback's `this` should be bound
*/
eachRelationship: function(callback, binding) {
get(this, 'relationshipsByName').forEach(function(name, relationship) {
callback.call(binding, name, relationship);
});
},
/**
Given a callback, iterates over each of the types related to a model,
invoking the callback with the related type's class. Each type will be
returned just once, regardless of how many different relationships it has
with a model.
@param {Function} callback the callback to invoke
@param {any} binding the value to which the callback's `this` should be bound
*/
eachRelatedType: function(callback, binding) {
get(this, 'relatedTypes').forEach(function(type) {
callback.call(binding, type);
});
}
});
DS.Model.reopen({
/**
Given a callback, iterates over each of the relationships in the model,
invoking the callback with the name of each relationship and its relationship
descriptor.
@param {Function} callback the callback to invoke
@param {any} binding the value to which the callback's `this` should be bound
*/
eachRelationship: function(callback, binding) {
this.constructor.eachRelationship(callback, binding);
}
});
})();
(function() {
var get = Ember.get, set = Ember.set;
var forEach = Ember.EnumerableUtils.forEach;
DS.RelationshipChange = function(options) {
this.parentReference = options.parentReference;
this.childReference = options.childReference;
this.firstRecordReference = options.firstRecordReference;
this.firstRecordKind = options.firstRecordKind;
this.firstRecordName = options.firstRecordName;
this.secondRecordReference = options.secondRecordReference;
this.secondRecordKind = options.secondRecordKind;
this.secondRecordName = options.secondRecordName;
this.store = options.store;
this.committed = {};
this.changeType = options.changeType;
};
DS.RelationshipChangeAdd = function(options){
DS.RelationshipChange.call(this, options);
};
DS.RelationshipChangeRemove = function(options){
DS.RelationshipChange.call(this, options);
};
/** @private */
DS.RelationshipChange.create = function(options) {
return new DS.RelationshipChange(options);
};
/** @private */
DS.RelationshipChangeAdd.create = function(options) {
return new DS.RelationshipChangeAdd(options);
};
/** @private */
DS.RelationshipChangeRemove.create = function(options) {
return new DS.RelationshipChangeRemove(options);
};
DS.OneToManyChange = {};
DS.OneToNoneChange = {};
DS.ManyToNoneChange = {};
DS.OneToOneChange = {};
DS.ManyToManyChange = {};
DS.RelationshipChange._createChange = function(options){
if(options.changeType === "add"){
return DS.RelationshipChangeAdd.create(options);
}
if(options.changeType === "remove"){
return DS.RelationshipChangeRemove.create(options);
}
};
DS.RelationshipChange.determineRelationshipType = function(recordType, knownSide){
var knownKey = knownSide.key, key, type, otherKind;
var knownKind = knownSide.kind;
var inverse = recordType.inverseFor(knownKey);
if (inverse){
key = inverse.name;
otherKind = inverse.kind;
}
if (!inverse){
return knownKind === "belongsTo" ? "oneToNone" : "manyToNone";
}
else{
if(otherKind === "belongsTo"){
return knownKind === "belongsTo" ? "oneToOne" : "manyToOne";
}
else{
return knownKind === "belongsTo" ? "oneToMany" : "manyToMany";
}
}
};
DS.RelationshipChange.createChange = function(firstRecordReference, secondRecordReference, store, options){
// Get the type of the child based on the child's client ID
var firstRecordType = firstRecordReference.type, key, changeType;
changeType = DS.RelationshipChange.determineRelationshipType(firstRecordType, options);
if (changeType === "oneToMany"){
return DS.OneToManyChange.createChange(firstRecordReference, secondRecordReference, store, options);
}
else if (changeType === "manyToOne"){
return DS.OneToManyChange.createChange(secondRecordReference, firstRecordReference, store, options);
}
else if (changeType === "oneToNone"){
return DS.OneToNoneChange.createChange(firstRecordReference, secondRecordReference, store, options);
}
else if (changeType === "manyToNone"){
return DS.ManyToNoneChange.createChange(firstRecordReference, secondRecordReference, store, options);
}
else if (changeType === "oneToOne"){
return DS.OneToOneChange.createChange(firstRecordReference, secondRecordReference, store, options);
}
else if (changeType === "manyToMany"){
return DS.ManyToManyChange.createChange(firstRecordReference, secondRecordReference, store, options);
}
};
/** @private */
DS.OneToNoneChange.createChange = function(childReference, parentReference, store, options) {
var key = options.key;
var change = DS.RelationshipChange._createChange({
parentReference: parentReference,
childReference: childReference,
firstRecordReference: childReference,
store: store,
changeType: options.changeType,
firstRecordName: key,
firstRecordKind: "belongsTo"
});
store.addRelationshipChangeFor(childReference, key, parentReference, null, change);
return change;
};
/** @private */
DS.ManyToNoneChange.createChange = function(childReference, parentReference, store, options) {
var key = options.key;
var change = DS.RelationshipChange._createChange({
parentReference: childReference,
childReference: parentReference,
secondRecordReference: childReference,
store: store,
changeType: options.changeType,
secondRecordName: options.key,
secondRecordKind: "hasMany"
});
store.addRelationshipChangeFor(childReference, key, parentReference, null, change);
return change;
};
/** @private */
DS.ManyToManyChange.createChange = function(childReference, parentReference, store, options) {
// Get the type of the child based on the child's client ID
var childType = childReference.type, key;
// If the name of the belongsTo side of the relationship is specified,
// use that
// If the type of the parent is specified, look it up on the child's type
// definition.
key = options.key;
var change = DS.RelationshipChange._createChange({
parentReference: parentReference,
childReference: childReference,
firstRecordReference: childReference,
secondRecordReference: parentReference,
firstRecordKind: "hasMany",
secondRecordKind: "hasMany",
store: store,
changeType: options.changeType,
firstRecordName: key
});
store.addRelationshipChangeFor(childReference, key, parentReference, null, change);
return change;
};
/** @private */
DS.OneToOneChange.createChange = function(childReference, parentReference, store, options) {
// Get the type of the child based on the child's client ID
var childType = childReference.type, key;
// If the name of the belongsTo side of the relationship is specified,
// use that
// If the type of the parent is specified, look it up on the child's type
// definition.
if (options.parentType) {
key = options.parentType.inverseFor(options.key).name;
} else if (options.key) {
key = options.key;
} else {
}
var change = DS.RelationshipChange._createChange({
parentReference: parentReference,
childReference: childReference,
firstRecordReference: childReference,
secondRecordReference: parentReference,
firstRecordKind: "belongsTo",
secondRecordKind: "belongsTo",
store: store,
changeType: options.changeType,
firstRecordName: key
});
store.addRelationshipChangeFor(childReference, key, parentReference, null, change);
return change;
};
DS.OneToOneChange.maintainInvariant = function(options, store, childReference, key){
if (options.changeType === "add" && store.recordIsMaterialized(childReference)) {
var child = store.recordForReference(childReference);
var oldParent = get(child, key);
if (oldParent){
var correspondingChange = DS.OneToOneChange.createChange(childReference, oldParent.get('_reference'), store, {
parentType: options.parentType,
hasManyName: options.hasManyName,
changeType: "remove",
key: options.key
});
store.addRelationshipChangeFor(childReference, key, options.parentReference , null, correspondingChange);
correspondingChange.sync();
}
}
};
/** @private */
DS.OneToManyChange.createChange = function(childReference, parentReference, store, options) {
// Get the type of the child based on the child's client ID
var childType = childReference.type, key;
// If the name of the belongsTo side of the relationship is specified,
// use that
// If the type of the parent is specified, look it up on the child's type
// definition.
if (options.parentType) {
key = options.parentType.inverseFor(options.key).name;
DS.OneToManyChange.maintainInvariant( options, store, childReference, key );
} else if (options.key) {
key = options.key;
} else {
}
var change = DS.RelationshipChange._createChange({
parentReference: parentReference,
childReference: childReference,
firstRecordReference: childReference,
secondRecordReference: parentReference,
firstRecordKind: "belongsTo",
secondRecordKind: "hasMany",
store: store,
changeType: options.changeType,
firstRecordName: key
});
store.addRelationshipChangeFor(childReference, key, parentReference, null, change);
return change;
};
DS.OneToManyChange.maintainInvariant = function(options, store, childReference, key){
if (options.changeType === "add" && store.recordIsMaterialized(childReference)) {
var child = store.recordForReference(childReference);
var oldParent = get(child, key);
if (oldParent){
var correspondingChange = DS.OneToManyChange.createChange(childReference, oldParent.get('_reference'), store, {
parentType: options.parentType,
hasManyName: options.hasManyName,
changeType: "remove",
key: options.key
});
store.addRelationshipChangeFor(childReference, key, options.parentReference , null, correspondingChange);
correspondingChange.sync();
}
}
};
DS.OneToManyChange.ensureSameTransaction = function(changes, store){
var records = Ember.A();
forEach(changes, function(change){
records.addObject(change.getSecondRecord());
records.addObject(change.getFirstRecord());
});
var transaction = store.ensureSameTransaction(records);
forEach(changes, function(change){
change.transaction = transaction;
});
};
DS.RelationshipChange.prototype = {
getSecondRecordName: function() {
var name = this.secondRecordName, store = this.store, parent;
if (!name) {
parent = this.secondRecordReference;
if (!parent) { return; }
var childType = this.firstRecordReference.type;
var inverse = childType.inverseFor(this.firstRecordName);
this.secondRecordName = inverse.name;
}
return this.secondRecordName;
},
/**
Get the name of the relationship on the belongsTo side.
@returns {String}
*/
getFirstRecordName: function() {
var name = this.firstRecordName;
return name;
},
/** @private */
destroy: function() {
var childReference = this.childReference,
belongsToName = this.getFirstRecordName(),
hasManyName = this.getSecondRecordName(),
store = this.store,
child, oldParent, newParent, lastParent, transaction;
store.removeRelationshipChangeFor(childReference, belongsToName, this.parentReference, hasManyName, this.changeType);
if (transaction = this.transaction) {
transaction.relationshipBecameClean(this);
}
},
/** @private */
getByReference: function(reference) {
var store = this.store;
// return null or undefined if the original reference was null or undefined
if (!reference) { return reference; }
if (store.recordIsMaterialized(reference)) {
return store.recordForReference(reference);
}
},
getSecondRecord: function(){
return this.getByReference(this.secondRecordReference);
},
/** @private */
getFirstRecord: function() {
return this.getByReference(this.firstRecordReference);
},
/**
@private
Make sure that all three parts of the relationship change are part of
the same transaction. If any of the three records is clean and in the
default transaction, and the rest are in a different transaction, move
them all into that transaction.
*/
ensureSameTransaction: function() {
var child = this.getFirstRecord(),
parentRecord = this.getSecondRecord();
var transaction = this.store.ensureSameTransaction([child, parentRecord]);
this.transaction = transaction;
return transaction;
},
callChangeEvents: function(){
var hasManyName = this.getSecondRecordName(),
belongsToName = this.getFirstRecordName(),
child = this.getFirstRecord(),
parentRecord = this.getSecondRecord();
var dirtySet = new Ember.OrderedSet();
// TODO: This implementation causes a race condition in key-value
// stores. The fix involves buffering changes that happen while
// a record is loading. A similar fix is required for other parts
// of ember-data, and should be done as new infrastructure, not
// a one-off hack. [tomhuda]
if (parentRecord && get(parentRecord, 'isLoaded')) {
this.store.recordHasManyDidChange(dirtySet, parentRecord, this);
}
if (child) {
this.store.recordBelongsToDidChange(dirtySet, child, this);
}
dirtySet.forEach(function(record) {
record.adapterDidDirty();
});
},
coalesce: function(){
var relationshipPairs = this.store.relationshipChangePairsFor(this.firstRecordReference);
forEach(relationshipPairs, function(pair){
var addedChange = pair["add"];
var removedChange = pair["remove"];
if(addedChange && removedChange) {
addedChange.destroy();
removedChange.destroy();
}
});
}
};
DS.RelationshipChangeAdd.prototype = Ember.create(DS.RelationshipChange.create({}));
DS.RelationshipChangeRemove.prototype = Ember.create(DS.RelationshipChange.create({}));
DS.RelationshipChangeAdd.prototype.changeType = "add";
DS.RelationshipChangeAdd.prototype.sync = function() {
var secondRecordName = this.getSecondRecordName(),
firstRecordName = this.getFirstRecordName(),
firstRecord = this.getFirstRecord(),
secondRecord = this.getSecondRecord();
//Ember.assert("You specified a hasMany (" + hasManyName + ") on " + (!belongsToName && (newParent || oldParent || this.lastParent).constructor) + " but did not specify an inverse belongsTo on " + child.constructor, belongsToName);
//Ember.assert("You specified a belongsTo (" + belongsToName + ") on " + child.constructor + " but did not specify an inverse hasMany on " + (!hasManyName && (newParent || oldParent || this.lastParentRecord).constructor), hasManyName);
var transaction = this.ensureSameTransaction();
transaction.relationshipBecameDirty(this);
this.callChangeEvents();
if (secondRecord && firstRecord) {
if(this.secondRecordKind === "belongsTo"){
secondRecord.suspendRelationshipObservers(function(){
set(secondRecord, secondRecordName, firstRecord);
});
}
else if(this.secondRecordKind === "hasMany"){
secondRecord.suspendRelationshipObservers(function(){
get(secondRecord, secondRecordName).addObject(firstRecord);
});
}
}
if (firstRecord && secondRecord && get(firstRecord, firstRecordName) !== secondRecord) {
if(this.firstRecordKind === "belongsTo"){
firstRecord.suspendRelationshipObservers(function(){
set(firstRecord, firstRecordName, secondRecord);
});
}
else if(this.firstdRecordKind === "hasMany"){
firstRecord.suspendRelationshipObservers(function(){
get(firstRecord, firstRecordName).addObject(secondRecord);
});
}
}
this.coalesce();
};
DS.RelationshipChangeRemove.prototype.changeType = "remove";
DS.RelationshipChangeRemove.prototype.sync = function() {
var secondRecordName = this.getSecondRecordName(),
firstRecordName = this.getFirstRecordName(),
firstRecord = this.getFirstRecord(),
secondRecord = this.getSecondRecord();
//Ember.assert("You specified a hasMany (" + hasManyName + ") on " + (!belongsToName && (newParent || oldParent || this.lastParent).constructor) + " but did not specify an inverse belongsTo on " + child.constructor, belongsToName);
//Ember.assert("You specified a belongsTo (" + belongsToName + ") on " + child.constructor + " but did not specify an inverse hasMany on " + (!hasManyName && (newParent || oldParent || this.lastParentRecord).constructor), hasManyName);
var transaction = this.ensureSameTransaction(firstRecord, secondRecord, secondRecordName, firstRecordName);
transaction.relationshipBecameDirty(this);
this.callChangeEvents();
if (secondRecord && firstRecord) {
if(this.secondRecordKind === "belongsTo"){
secondRecord.suspendRelationshipObservers(function(){
set(secondRecord, secondRecordName, null);
});
}
else if(this.secondRecordKind === "hasMany"){
secondRecord.suspendRelationshipObservers(function(){
get(secondRecord, secondRecordName).removeObject(firstRecord);
});
}
}
if (firstRecord && get(firstRecord, firstRecordName)) {
if(this.firstRecordKind === "belongsTo"){
firstRecord.suspendRelationshipObservers(function(){
set(firstRecord, firstRecordName, null);
});
}
else if(this.firstdRecordKind === "hasMany"){
firstRecord.suspendRelationshipObservers(function(){
get(firstRecord, firstRecordName).removeObject(secondRecord);
});
}
}
this.coalesce();
};
})();
(function() {
})();
(function() {
var set = Ember.set;
/**
This code registers an injection for Ember.Application.
If an Ember.js developer defines a subclass of DS.Store on their application,
this code will automatically instantiate it and make it available on the
router.
Additionally, after an application's controllers have been injected, they will
each have the store made available to them.
For example, imagine an Ember.js application with the following classes:
App.Store = DS.Store.extend({
adapter: 'App.MyCustomAdapter'
});
App.PostsController = Ember.ArrayController.extend({
// ...
});
When the application is initialized, `App.Store` will automatically be
instantiated, and the instance of `App.PostsController` will have its `store`
property set to that instance.
Note that this code will only be run if the `ember-application` package is
loaded. If Ember Data is being used in an environment other than a
typical application (e.g., node.js where only `ember-runtime` is available),
this code will be ignored.
*/
Ember.onLoad('Ember.Application', function(Application) {
if (Application.registerInjection) {
Application.registerInjection({
name: "store",
before: "controllers",
// If a store subclass is defined, like App.Store,
// instantiate it and inject it into the router.
injection: function(app, stateManager, property) {
if (!stateManager) { return; }
if (property === 'Store') {
set(stateManager, 'store', app[property].create());
}
}
});
Application.registerInjection({
name: "giveStoreToControllers",
after: ['store','controllers'],
// For each controller, set its `store` property
// to the DS.Store instance we created above.
injection: function(app, stateManager, property) {
if (!stateManager) { return; }
if (/^[A-Z].*Controller$/.test(property)) {
var controllerName = property.charAt(0).toLowerCase() + property.substr(1);
var store = stateManager.get('store');
var controller = stateManager.get(controllerName);
if(!controller) { return; }
controller.set('store', store);
}
}
});
} else if (Application.initializer) {
Application.initializer({
name: "store",
initialize: function(container, application) {
application.register('store:main', application.Store);
// Eagerly generate the store so defaultStore is populated.
// TODO: Do this in a finisher hook
container.lookup('store:main');
}
});
Application.initializer({
name: "injectStore",
initialize: function(container, application) {
application.inject('controller', 'store', 'store:main');
application.inject('route', 'store', 'store:main');
}
});
}
});
})();
(function() {
var get = Ember.get, set = Ember.set, map = Ember.ArrayPolyfills.map, isNone = Ember.isNone;
function mustImplement(name) {
return function() {
throw new Ember.Error("Your serializer " + this.toString() + " does not implement the required method " + name);
};
}
/**
A serializer is responsible for serializing and deserializing a group of
records.
`DS.Serializer` is an abstract base class designed to help you build a
serializer that can read to and write from any serialized form. While most
applications will use `DS.JSONSerializer`, which reads and writes JSON, the
serializer architecture allows your adapter to transmit things like XML,
strings, or custom binary data.
Typically, your application's `DS.Adapter` is responsible for both creating a
serializer as well as calling the appropriate methods when it needs to
materialize data or serialize a record.
The serializer API is designed as a series of layered hooks that you can
override to customize any of the individual steps of serialization and
deserialization.
The hooks are organized by the three responsibilities of the serializer:
1. Determining naming conventions
2. Serializing records into a serialized form
3. Deserializing records from a serialized form
Because Ember Data lazily materializes records, the deserialization
step, and therefore the hooks you implement, are split into two phases:
1. Extraction, where the serialized forms for multiple records are
extracted from a single payload. The IDs of each record are also
extracted for indexing.
2. Materialization, where a newly-created record has its attributes
and relationships initialized based on the serialized form loaded
by the adapter.
Additionally, a serializer can convert values from their JavaScript
versions into their serialized versions via a declarative API.
## Naming Conventions
One of the most common uses of the serializer is to map attribute names
from the serialized form to your `DS.Model`. For example, in your model,
you may have an attribute called `firstName`:
```javascript
App.Person = DS.Model.extend({
firstName: DS.attr('string')
});
```
However, because the web API your adapter is communicating with is
legacy, it calls this attribute `FIRST_NAME`.
You can determine the attribute name used in the serialized form
by implementing `keyForAttributeName`:
```javascript
keyForAttributeName: function(type, name) {
return name.underscore.toUpperCase();
}
```
If your attribute names are not predictable, you can re-map them
one-by-one using the adapter's `map` API:
```javascript
App.Adapter.map('App.Person', {
firstName: { key: '*API_USER_FIRST_NAME*' }
});
```
This API will also work for relationships and primary keys. For
example:
```javascript
App.Adapter.map('App.Person', {
primaryKey: '_id'
});
```
## Serialization
During the serialization process, a record or records are converted
from Ember.js objects into their serialized form.
These methods are designed in layers, like a delicious 7-layer
cake (but with fewer layers).
The main entry point for serialization is the `serialize`
method, which takes the record and options.
The `serialize` method is responsible for:
* turning the record's attributes (`DS.attr`) into
attributes on the JSON object.
* optionally adding the record's ID onto the hash
* adding relationships (`DS.hasMany` and `DS.belongsTo`)
to the JSON object.
Depending on the backend, the serializer can choose
whether to include the `hasMany` or `belongsTo`
relationships on the JSON hash.
For very custom serialization, you can implement your
own `serialize` method. In general, however, you will want
to override the hooks described below.
### Adding the ID
The default `serialize` will optionally call your serializer's
`addId` method with the JSON hash it is creating, the
record's type, and the record's ID. The `serialize` method
will not call `addId` if the record's ID is undefined.
Your adapter must specifically request ID inclusion by
passing `{ includeId: true }` as an option to `serialize`.
NOTE: You may not want to include the ID when updating an
existing record, because your server will likely disallow
changing an ID after it is created, and the PUT request
itself will include the record's identification.
By default, `addId` will:
1. Get the primary key name for the record by calling
the serializer's `primaryKey` with the record's type.
Unless you override the `primaryKey` method, this
will be `'id'`.
2. Assign the record's ID to the primary key in the
JSON hash being built.
If your backend expects a JSON object with the primary
key at the root, you can just override the `primaryKey`
method on your serializer subclass.
Otherwise, you can override the `addId` method for
more specialized handling.
### Adding Attributes
By default, the serializer's `serialize` method will call
`addAttributes` with the JSON object it is creating
and the record to serialize.
The `addAttributes` method will then call `addAttribute`
in turn, with the JSON object, the record to serialize,
the attribute's name and its type.
Finally, the `addAttribute` method will serialize the
attribute:
1. It will call `keyForAttributeName` to determine
the key to use in the JSON hash.
2. It will get the value from the record.
3. It will call `serializeValue` with the attribute's
value and attribute type to convert it into a
JSON-compatible value. For example, it will convert a
Date into a String.
If your backend expects a JSON object with attributes as
keys at the root, you can just override the `serializeValue`
and `keyForAttributeName` methods in your serializer
subclass and let the base class do the heavy lifting.
If you need something more specialized, you can probably
override `addAttribute` and let the default `addAttributes`
handle the nitty gritty.
### Adding Relationships
By default, `serialize` will call your serializer's
`addRelationships` method with the JSON object that is
being built and the record being serialized. The default
implementation of this method is to loop over all of the
relationships defined on your record type and:
* If the relationship is a `DS.hasMany` relationship,
call `addHasMany` with the JSON object, the record
and a description of the relationship.
* If the relationship is a `DS.belongsTo` relationship,
call `addBelongsTo` with the JSON object, the record
and a description of the relationship.
The relationship description has the following keys:
* `type`: the class of the associated information (the
first parameter to `DS.hasMany` or `DS.belongsTo`)
* `kind`: either `hasMany` or `belongsTo`
The relationship description may get additional
information in the future if more capabilities or
relationship types are added. However, it will
remain backwards-compatible, so the mere existence
of new features should not break existing adapters.
*/
DS.Serializer = Ember.Object.extend({
init: function() {
this.mappings = Ember.Map.create();
this.aliases = Ember.Map.create();
this.configurations = Ember.Map.create();
this.globalConfigurations = {};
},
extract: mustImplement('extract'),
extractMany: mustImplement('extractMany'),
extractId: mustImplement('extractId'),
extractAttribute: mustImplement('extractAttribute'),
extractHasMany: mustImplement('extractHasMany'),
extractBelongsTo: mustImplement('extractBelongsTo'),
createSerializedForm: mustImplement('createSerializedForm'),
extractRecordRepresentation: function(loader, type, json, shouldSideload) {
var prematerialized = {}, reference;
if (shouldSideload) {
reference = loader.sideload(type, json);
} else {
reference = loader.load(type, json);
}
this.eachEmbeddedHasMany(type, function(name, relationship) {
var embeddedData = json[this.keyFor(relationship)];
if (!isNone(embeddedData)) {
this.extractEmbeddedHasMany(loader, relationship, embeddedData, reference, prematerialized);
}
}, this);
this.eachEmbeddedBelongsTo(type, function(name, relationship) {
var embeddedData = json[this.keyFor(relationship)];
if (!isNone(embeddedData)) {
this.extractEmbeddedBelongsTo(loader, relationship, embeddedData, reference, prematerialized);
}
}, this);
loader.prematerialize(reference, prematerialized);
return reference;
},
extractEmbeddedHasMany: function(loader, relationship, array, parent, prematerialized) {
var references = map.call(array, function(item) {
if (!item) { return; }
var foundType = this.extractEmbeddedType(relationship, item),
reference = this.extractRecordRepresentation(loader, foundType, item, true);
// If the embedded record should also be saved back when serializing the parent,
// make sure we set its parent since it will not have an ID.
var embeddedType = this.embeddedType(parent.type, relationship.key);
if (embeddedType === 'always') {
reference.parent = parent;
}
return reference;
}, this);
prematerialized[relationship.key] = references;
},
extractEmbeddedBelongsTo: function(loader, relationship, data, parent, prematerialized) {
var foundType = this.extractEmbeddedType(relationship, data),
reference = this.extractRecordRepresentation(loader, foundType, data, true);
prematerialized[relationship.key] = reference;
// If the embedded record should also be saved back when serializing the parent,
// make sure we set its parent since it will not have an ID.
var embeddedType = this.embeddedType(parent.type, relationship.key);
if (embeddedType === 'always') {
reference.parent = parent;
}
},
/**
A hook you can use to customize how the record's type is extracted from
the serialized data.
The `extractEmbeddedType` hook is called with:
* the serialized representation being built
* the serialized id (after calling the `serializeId` hook)
By default, it returns the type of the relationship.
@param {Object} relationship an object representing the relationship
@param {any} data the serialized representation that is being built
*/
extractEmbeddedType: function(relationship, data) {
return relationship.type;
},
//.......................
//. SERIALIZATION HOOKS
//.......................
/**
The main entry point for serializing a record. While you can consider this
a hook that can be overridden in your serializer, you will have to manually
handle serialization. For most cases, there are more granular hooks that you
can override.
If overriding this method, these are the responsibilities that you will need
to implement yourself:
* If the option hash contains `includeId`, add the record's ID to the serialized form.
By default, `serialize` calls `addId` if appropriate.
* If the option hash contains `includeType`, add the record's type to the serialized form.
* Add the record's attributes to the serialized form. By default, `serialize` calls
`addAttributes`.
* Add the record's relationships to the serialized form. By default, `serialize` calls
`addRelationships`.
@param {DS.Model} record the record to serialize
@param {Object} [options] a hash of options
@returns {any} the serialized form of the record
*/
serialize: function(record, options) {
options = options || {};
var serialized = this.createSerializedForm(), id;
if (options.includeId) {
if (id = get(record, 'id')) {
this._addId(serialized, record.constructor, id);
}
}
if (options.includeType) {
this.addType(serialized, record.constructor);
}
this.addAttributes(serialized, record);
this.addRelationships(serialized, record);
return serialized;
},
/**
@private
Given an attribute type and value, convert the value into the
serialized form using the transform registered for that type.
@param {any} value the value to convert to the serialized form
@param {String} attributeType the registered type (e.g. `string`
or `boolean`)
@returns {any} the serialized form of the value
*/
serializeValue: function(value, attributeType) {
var transform = this.transforms ? this.transforms[attributeType] : null;
return transform.serialize(value);
},
/**
A hook you can use to normalize IDs before adding them to the
serialized representation.
Because the store coerces all IDs to strings for consistency,
this is the opportunity for the serializer to, for example,
convert numerical IDs back into number form.
@param {String} id the id from the record
@returns {any} the serialized representation of the id
*/
serializeId: function(id) {
if (isNaN(id)) { return id; }
return +id;
},
/**
A hook you can use to change how attributes are added to the serialized
representation of a record.
By default, `addAttributes` simply loops over all of the attributes of the
passed record, maps the attribute name to the key for the serialized form,
and invokes any registered transforms on the value. It then invokes the
more granular `addAttribute` with the key and transformed value.
Since you can override `keyForAttributeName`, `addAttribute`, and register
custom transforms, you should rarely need to override this hook.
@param {any} data the serialized representation that is being built
@param {DS.Model} record the record to serialize
*/
addAttributes: function(data, record) {
record.eachAttribute(function(name, attribute) {
this._addAttribute(data, record, name, attribute.type);
}, this);
},
/**
A hook you can use to customize how the key/value pair is added to
the serialized data.
@param {any} serialized the serialized form being built
@param {String} key the key to add to the serialized data
@param {any} value the value to add to the serialized data
*/
addAttribute: mustImplement('addAttribute'),
/**
A hook you can use to customize how the record's id is added to
the serialized data.
The `addId` hook is called with:
* the serialized representation being built
* the resolved primary key (taking configurations and the
`primaryKey` hook into consideration)
* the serialized id (after calling the `serializeId` hook)
@param {any} data the serialized representation that is being built
@param {String} key the resolved primary key
@param {id} id the serialized id
*/
addId: mustImplement('addId'),
/**
A hook you can use to customize how the record's type is added to
the serialized data.
The `addType` hook is called with:
* the serialized representation being built
* the serialized id (after calling the `serializeId` hook)
@param {any} data the serialized representation that is being built
@param {DS.Model subclass} type the type of the record
*/
addType: Ember.K,
/**
Creates an empty hash that will be filled in by the hooks called from the
`serialize()` method.
@return {Object}
*/
createSerializedForm: function() {
return {};
},
/**
A hook you can use to change how relationships are added to the serialized
representation of a record.
By default, `addRelationships` loops over all of the relationships of the
passed record, maps the relationship names to the key for the serialized form,
and then invokes the public `addBelongsTo` and `addHasMany` hooks.
Since you can override `keyForBelongsTo`, `keyForHasMany`, `addBelongsTo`,
`addHasMany`, and register mappings, you should rarely need to override this
hook.
@param {any} data the serialized representation that is being built
@param {DS.Model} record the record to serialize
*/
addRelationships: function(data, record) {
record.eachRelationship(function(name, relationship) {
if (relationship.kind === 'belongsTo') {
this._addBelongsTo(data, record, name, relationship);
} else if (relationship.kind === 'hasMany') {
this._addHasMany(data, record, name, relationship);
}
}, this);
},
/**
A hook you can use to add a `belongsTo` relationship to the
serialized representation.
The specifics of this hook are very adapter-specific, so there
is no default implementation. You can see `DS.JSONSerializer`
for an example of an implementation of the `addBelongsTo` hook.
The `belongsTo` relationship object has the following properties:
* **type** a subclass of DS.Model that is the type of the
relationship. This is the first parameter to DS.belongsTo
* **options** the options passed to the call to DS.belongsTo
* **kind** always `belongsTo`
Additional properties may be added in the future.
@param {any} data the serialized representation that is being built
@param {DS.Model} record the record to serialize
@param {String} key the key for the serialized object
@param {Object} relationship an object representing the relationship
*/
addBelongsTo: mustImplement('addBelongsTo'),
/**
A hook you can use to add a `hasMany` relationship to the
serialized representation.
The specifics of this hook are very adapter-specific, so there
is no default implementation. You may not need to implement this,
for example, if your backend only expects relationships on the
child of a one to many relationship.
The `hasMany` relationship object has the following properties:
* **type** a subclass of DS.Model that is the type of the
relationship. This is the first parameter to DS.hasMany
* **options** the options passed to the call to DS.hasMany
* **kind** always `hasMany`
Additional properties may be added in the future.
@param {any} data the serialized representation that is being built
@param {DS.Model} record the record to serialize
@param {String} key the key for the serialized object
@param {Object} relationship an object representing the relationship
*/
addHasMany: mustImplement('addHasMany'),
/**
NAMING CONVENTIONS
The most commonly overridden APIs of the serializer are
the naming convention methods:
* `keyForAttributeName`: converts a camelized attribute name
into a key in the adapter-provided data hash. For example,
if the model's attribute name was `firstName`, and the
server used underscored names, you would return `first_name`.
* `primaryKey`: returns the key that should be used to
extract the id from the adapter-provided data hash. It is
also used when serializing a record.
*/
/**
A hook you can use in your serializer subclass to customize
how an unmapped attribute name is converted into a key.
By default, this method returns the `name` parameter.
For example, if the attribute names in your JSON are underscored,
you will want to convert them into JavaScript conventional
camelcase:
```javascript
App.MySerializer = DS.Serializer.extend({
// ...
keyForAttributeName: function(type, name) {
return name.camelize();
}
});
```
@param {DS.Model subclass} type the type of the record with
the attribute name `name`
@param {String} name the attribute name to convert into a key
@returns {String} the key
*/
keyForAttributeName: function(type, name) {
return name;
},
/**
A hook you can use in your serializer to specify a conventional
primary key.
By default, this method will return the string `id`.
In general, you should not override this hook to specify a special
primary key for an individual type; use `configure` instead.
For example, if your primary key is always `__id__`:
```javascript
App.MySerializer = DS.Serializer.extend({
// ...
primaryKey: function(type) {
return '__id__';
}
});
```
In another example, if the primary key always includes the
underscored version of the type before the string `id`:
```javascript
App.MySerializer = DS.Serializer.extend({
// ...
primaryKey: function(type) {
// If the type is `BlogPost`, this will return
// `blog_post_id`.
var typeString = type.toString().split(".")[1].underscore();
return typeString + "_id";
}
});
```
@param {DS.Model subclass} type
@returns {String} the primary key for the type
*/
primaryKey: function(type) {
return "id";
},
/**
A hook you can use in your serializer subclass to customize
how an unmapped `belongsTo` relationship is converted into
a key.
By default, this method calls `keyForAttributeName`, so if
your naming convention is uniform across attributes and
relationships, you can use the default here and override
just `keyForAttributeName` as needed.
For example, if the `belongsTo` names in your JSON always
begin with `BT_` (e.g. `BT_posts`), you can strip out the
`BT_` prefix:"
```javascript
App.MySerializer = DS.Serializer.extend({
// ...
keyForBelongsTo: function(type, name) {
return name.match(/^BT_(.*)$/)[1].camelize();
}
});
```
@param {DS.Model subclass} type the type of the record with
the `belongsTo` relationship.
@param {String} name the relationship name to convert into a key
@returns {String} the key
*/
keyForBelongsTo: function(type, name) {
return this.keyForAttributeName(type, name);
},
/**
A hook you can use in your serializer subclass to customize
how an unmapped `hasMany` relationship is converted into
a key.
By default, this method calls `keyForAttributeName`, so if
your naming convention is uniform across attributes and
relationships, you can use the default here and override
just `keyForAttributeName` as needed.
For example, if the `hasMany` names in your JSON always
begin with the "table name" for the current type (e.g.
`post_comments`), you can strip out the prefix:"
```javascript
App.MySerializer = DS.Serializer.extend({
// ...
keyForHasMany: function(type, name) {
// if your App.BlogPost has many App.BlogComment, the key from
// the server would look like: `blog_post_blog_comments`
//
// 1. Convert the type into a string and underscore the
// second part (App.BlogPost -> blog_post)
// 2. Extract the part after `blog_post_` (`blog_comments`)
// 3. Underscore it, to become `blogComments`
var typeString = type.toString().split(".")[1].underscore();
return name.match(new RegExp("^" + typeString + "_(.*)$"))[1].camelize();
}
});
```
@param {DS.Model subclass} type the type of the record with
the `belongsTo` relationship.
@param {String} name the relationship name to convert into a key
@returns {String} the key
*/
keyForHasMany: function(type, name) {
return this.keyForAttributeName(type, name);
},
//.........................
//. MATERIALIZATION HOOKS
//.........................
materialize: function(record, serialized, prematerialized) {
var id;
if (Ember.isNone(get(record, 'id'))) {
if (prematerialized && prematerialized.hasOwnProperty('id')) {
id = prematerialized.id;
} else {
id = this.extractId(record.constructor, serialized);
}
record.materializeId(id);
}
this.materializeAttributes(record, serialized, prematerialized);
this.materializeRelationships(record, serialized, prematerialized);
},
deserializeValue: function(value, attributeType) {
var transform = this.transforms ? this.transforms[attributeType] : null;
return transform.deserialize(value);
},
materializeAttributes: function(record, serialized, prematerialized) {
record.eachAttribute(function(name, attribute) {
if (prematerialized && prematerialized.hasOwnProperty(name)) {
record.materializeAttribute(name, prematerialized[name]);
} else {
this.materializeAttribute(record, serialized, name, attribute.type);
}
}, this);
},
materializeAttribute: function(record, serialized, attributeName, attributeType) {
var value = this.extractAttribute(record.constructor, serialized, attributeName);
value = this.deserializeValue(value, attributeType);
record.materializeAttribute(attributeName, value);
},
materializeRelationships: function(record, hash, prematerialized) {
record.eachRelationship(function(name, relationship) {
if (relationship.kind === 'hasMany') {
if (prematerialized && prematerialized.hasOwnProperty(name)) {
var tuplesOrReferencesOrOpaque = this._convertPrematerializedHasMany(relationship.type, prematerialized[name]);
record.materializeHasMany(name, tuplesOrReferencesOrOpaque);
} else {
this.materializeHasMany(name, record, hash, relationship, prematerialized);
}
} else if (relationship.kind === 'belongsTo') {
if (prematerialized && prematerialized.hasOwnProperty(name)) {
var tupleOrReference = this._convertTuple(relationship.type, prematerialized[name]);
record.materializeBelongsTo(name, tupleOrReference);
} else {
this.materializeBelongsTo(name, record, hash, relationship, prematerialized);
}
}
}, this);
},
materializeHasMany: function(name, record, hash, relationship) {
var type = record.constructor,
key = this._keyForHasMany(type, relationship.key),
idsOrTuples = this.extractHasMany(type, hash, key),
tuples = idsOrTuples;
if(idsOrTuples && Ember.isArray(idsOrTuples)) {
tuples = this._convertTuples(relationship.type, idsOrTuples);
}
record.materializeHasMany(name, tuples);
},
materializeBelongsTo: function(name, record, hash, relationship) {
var type = record.constructor,
key = this._keyForBelongsTo(type, relationship.key),
idOrTuple,
tuple = null;
if(relationship.options && relationship.options.polymorphic) {
idOrTuple = this.extractBelongsToPolymorphic(type, hash, key);
} else {
idOrTuple = this.extractBelongsTo(type, hash, key);
}
if(!isNone(idOrTuple)) {
tuple = this._convertTuple(relationship.type, idOrTuple);
}
record.materializeBelongsTo(name, tuple);
},
_extractEmbeddedRelationship: function(type, hash, name, relationshipType) {
var key = this['_keyFor' + relationshipType](type, name);
if (this.embeddedType(type, name)) {
return this['extractEmbedded' + relationshipType](type, hash, key);
}
},
_extractEmbeddedBelongsTo: function(type, hash, name) {
return this._extractEmbeddedRelationship(type, hash, name, 'BelongsTo');
},
_extractEmbeddedHasMany: function(type, hash, name) {
return this._extractEmbeddedRelationship(type, hash, name, 'HasMany');
},
_convertPrematerializedHasMany: function(type, prematerializedHasMany) {
var tuplesOrReferencesOrOpaque;
if( typeof prematerializedHasMany === 'string' ) {
tuplesOrReferencesOrOpaque = prematerializedHasMany;
} else {
tuplesOrReferencesOrOpaque = this._convertTuples(type, prematerializedHasMany);
}
return tuplesOrReferencesOrOpaque;
},
_convertTuples: function(type, idsOrTuples) {
return map.call(idsOrTuples, function(idOrTuple) {
return this._convertTuple(type, idOrTuple);
}, this);
},
_convertTuple: function(type, idOrTuple) {
var foundType;
if (typeof idOrTuple === 'object') {
if (DS.Model.detect(idOrTuple.type)) {
return idOrTuple;
} else {
foundType = this.typeFromAlias(idOrTuple.type);
return {id: idOrTuple.id, type: foundType};
}
}
return {id: idOrTuple, type: type};
},
/**
@private
This method is called to get the primary key for a given
type.
If a primary key configuration exists for this type, this
method will return the configured value. Otherwise, it will
call the public `primaryKey` hook.
@param {DS.Model subclass} type
@returns {String} the primary key for the type
*/
_primaryKey: function(type) {
var config = this.configurationForType(type),
primaryKey = config && config.primaryKey;
if (primaryKey) {
return primaryKey;
} else {
return this.primaryKey(type);
}
},
/**
@private
This method looks up the key for the attribute name and transforms the
attribute's value using registered transforms.
Specifically:
1. Look up the key for the attribute name. If available, this will use
any registered mappings. Otherwise, it will invoke the public
`keyForAttributeName` hook.
2. Get the value from the record using the `attributeName`.
3. Transform the value using registered transforms for the `attributeType`.
4. Invoke the public `addAttribute` hook with the hash, key, and
transformed value.
@param {any} data the serialized representation being built
@param {DS.Model} record the record to serialize
@param {String} attributeName the name of the attribute on the record
@param {String} attributeType the type of the attribute (e.g. `string`
or `boolean`)
*/
_addAttribute: function(data, record, attributeName, attributeType) {
var key = this._keyForAttributeName(record.constructor, attributeName);
var value = get(record, attributeName);
this.addAttribute(data, key, this.serializeValue(value, attributeType));
},
/**
@private
This method looks up the primary key for the `type` and invokes
`serializeId` on the `id`.
It then invokes the public `addId` hook with the primary key and
the serialized id.
@param {any} data the serialized representation that is being built
@param {Ember.Model subclass} type
@param {any} id the materialized id from the record
*/
_addId: function(hash, type, id) {
var primaryKey = this._primaryKey(type);
this.addId(hash, primaryKey, this.serializeId(id));
},
/**
@private
This method is called to get a key used in the data from
an attribute name. It first checks for any mappings before
calling the public hook `keyForAttributeName`.
@param {DS.Model subclass} type the type of the record with
the attribute name `name`
@param {String} name the attribute name to convert into a key
@returns {String} the key
*/
_keyForAttributeName: function(type, name) {
return this._keyFromMappingOrHook('keyForAttributeName', type, name);
},
/**
@private
This method is called to get a key used in the data from
a belongsTo relationship. It first checks for any mappings before
calling the public hook `keyForBelongsTo`.
@param {DS.Model subclass} type the type of the record with
the `belongsTo` relationship.
@param {String} name the relationship name to convert into a key
@returns {String} the key
*/
_keyForBelongsTo: function(type, name) {
return this._keyFromMappingOrHook('keyForBelongsTo', type, name);
},
keyFor: function(description) {
var type = description.parentType,
name = description.key;
switch (description.kind) {
case 'belongsTo':
return this._keyForBelongsTo(type, name);
case 'hasMany':
return this._keyForHasMany(type, name);
}
},
/**
@private
This method is called to get a key used in the data from
a hasMany relationship. It first checks for any mappings before
calling the public hook `keyForHasMany`.
@param {DS.Model subclass} type the type of the record with
the `hasMany` relationship.
@param {String} name the relationship name to convert into a key
@returns {String} the key
*/
_keyForHasMany: function(type, name) {
return this._keyFromMappingOrHook('keyForHasMany', type, name);
},
/**
@private
This method converts the relationship name to a key for serialization,
and then invokes the public `addBelongsTo` hook.
@param {any} data the serialized representation that is being built
@param {DS.Model} record the record to serialize
@param {String} name the relationship name
@param {Object} relationship an object representing the relationship
*/
_addBelongsTo: function(data, record, name, relationship) {
var key = this._keyForBelongsTo(record.constructor, name);
this.addBelongsTo(data, record, key, relationship);
},
/**
@private
This method converts the relationship name to a key for serialization,
and then invokes the public `addHasMany` hook.
@param {any} data the serialized representation that is being built
@param {DS.Model} record the record to serialize
@param {String} name the relationship name
@param {Object} relationship an object representing the relationship
*/
_addHasMany: function(data, record, name, relationship) {
var key = this._keyForHasMany(record.constructor, name);
this.addHasMany(data, record, key, relationship);
},
/**
@private
An internal method that handles checking whether a mapping
exists for a particular attribute or relationship name before
calling the public hooks.
If a mapping is found, and the mapping has a key defined,
use that instead of invoking the hook.
@param {String} publicMethod the public hook to invoke if
a mapping is not found (e.g. `keyForAttributeName`)
@param {DS.Model subclass} type the type of the record with
the attribute or relationship name.
@param {String} name the attribute or relationship name to
convert into a key
*/
_keyFromMappingOrHook: function(publicMethod, type, name) {
var key = this.mappingOption(type, name, 'key');
if (key) {
return key;
} else {
return this[publicMethod](type, name);
}
},
/**
TRANSFORMS
*/
registerTransform: function(type, transform) {
this.transforms[type] = transform;
},
registerEnumTransform: function(type, objects) {
var transform = {
deserialize: function(serialized) {
return Ember.A(objects).objectAt(serialized);
},
serialize: function(deserialized) {
return Ember.EnumerableUtils.indexOf(objects, deserialized);
},
values: objects
};
this.registerTransform(type, transform);
},
/**
MAPPING CONVENIENCE
*/
map: function(type, mappings) {
this.mappings.set(type, mappings);
},
configure: function(type, configuration) {
if (type && !configuration) {
Ember.merge(this.globalConfigurations, type);
return;
}
var config, alias;
if (configuration.alias) {
alias = configuration.alias;
this.aliases.set(alias, type);
delete configuration.alias;
}
config = Ember.create(this.globalConfigurations);
Ember.merge(config, configuration);
this.configurations.set(type, config);
},
typeFromAlias: function(alias) {
this._completeAliases();
return this.aliases.get(alias);
},
mappingForType: function(type) {
this._reifyMappings();
return this.mappings.get(type) || {};
},
configurationForType: function(type) {
this._reifyConfigurations();
return this.configurations.get(type) || this.globalConfigurations;
},
_completeAliases: function() {
this._pluralizeAliases();
this._reifyAliases();
},
_pluralizeAliases: function() {
if (this._didPluralizeAliases) { return; }
var aliases = this.aliases,
sideloadMapping = this.aliases.sideloadMapping,
plural,
self = this;
aliases.forEach(function(key, type) {
plural = self.pluralize(key);
aliases.set(plural, type);
});
// This map is only for backward compatibility with the `sideloadAs` option.
if (sideloadMapping) {
sideloadMapping.forEach(function(key, type) {
aliases.set(key, type);
});
delete this.aliases.sideloadMapping;
}
this._didPluralizeAliases = true;
},
_reifyAliases: function() {
if (this._didReifyAliases) { return; }
var aliases = this.aliases,
reifiedAliases = Ember.Map.create(),
foundType;
aliases.forEach(function(key, type) {
if (typeof type === 'string') {
foundType = Ember.get(Ember.lookup, type);
reifiedAliases.set(key, foundType);
} else {
reifiedAliases.set(key, type);
}
});
this.aliases = reifiedAliases;
this._didReifyAliases = true;
},
_reifyMappings: function() {
if (this._didReifyMappings) { return; }
var mappings = this.mappings,
reifiedMappings = Ember.Map.create();
mappings.forEach(function(key, mapping) {
if (typeof key === 'string') {
var type = Ember.get(Ember.lookup, key);
reifiedMappings.set(type, mapping);
} else {
reifiedMappings.set(key, mapping);
}
});
this.mappings = reifiedMappings;
this._didReifyMappings = true;
},
_reifyConfigurations: function() {
if (this._didReifyConfigurations) { return; }
var configurations = this.configurations,
reifiedConfigurations = Ember.Map.create();
configurations.forEach(function(key, mapping) {
if (typeof key === 'string' && key !== 'plurals') {
var type = Ember.get(Ember.lookup, key);
reifiedConfigurations.set(type, mapping);
} else {
reifiedConfigurations.set(key, mapping);
}
});
this.configurations = reifiedConfigurations;
this._didReifyConfigurations = true;
},
mappingOption: function(type, name, option) {
var mapping = this.mappingForType(type)[name];
return mapping && mapping[option];
},
configOption: function(type, option) {
var config = this.configurationForType(type);
return config[option];
},
// EMBEDDED HELPERS
embeddedType: function(type, name) {
return this.mappingOption(type, name, 'embedded');
},
eachEmbeddedRecord: function(record, callback, binding) {
this.eachEmbeddedBelongsToRecord(record, callback, binding);
this.eachEmbeddedHasManyRecord(record, callback, binding);
},
eachEmbeddedBelongsToRecord: function(record, callback, binding) {
var type = record.constructor;
this.eachEmbeddedBelongsTo(record.constructor, function(name, relationship, embeddedType) {
var embeddedRecord = get(record, name);
if (embeddedRecord) { callback.call(binding, embeddedRecord, embeddedType); }
});
},
eachEmbeddedHasManyRecord: function(record, callback, binding) {
var type = record.constructor;
this.eachEmbeddedHasMany(record.constructor, function(name, relationship, embeddedType) {
var array = get(record, name);
for (var i=0, l=get(array, 'length'); i<l; i++) {
callback.call(binding, array.objectAt(i), embeddedType);
}
});
},
eachEmbeddedHasMany: function(type, callback, binding) {
this.eachEmbeddedRelationship(type, 'hasMany', callback, binding);
},
eachEmbeddedBelongsTo: function(type, callback, binding) {
this.eachEmbeddedRelationship(type, 'belongsTo', callback, binding);
},
eachEmbeddedRelationship: function(type, kind, callback, binding) {
type.eachRelationship(function(name, relationship) {
var embeddedType = this.embeddedType(type, name);
if (embeddedType) {
if (relationship.kind === kind) {
callback.call(binding, name, relationship, embeddedType);
}
}
}, this);
},
// HELPERS
// define a plurals hash in your subclass to define
// special-case pluralization
pluralize: function(name) {
var plurals = this.configurations.get('plurals');
return (plurals && plurals[name]) || name + "s";
},
// use the same plurals hash to determine
// special-case singularization
singularize: function(name) {
var plurals = this.configurations.get('plurals');
if (plurals) {
for (var i in plurals) {
if (plurals[i] === name) {
return i;
}
}
}
if (name.lastIndexOf('s') === name.length - 1) {
return name.substring(0, name.length - 1);
} else {
return name;
}
},
});
})();
(function() {
var none = Ember.isNone, empty = Ember.isEmpty;
/**
DS.Transforms is a hash of transforms used by DS.Serializer.
*/
DS.JSONTransforms = {
string: {
deserialize: function(serialized) {
return none(serialized) ? null : String(serialized);
},
serialize: function(deserialized) {
return none(deserialized) ? null : String(deserialized);
}
},
number: {
deserialize: function(serialized) {
return empty(serialized) ? null : Number(serialized);
},
serialize: function(deserialized) {
return empty(deserialized) ? null : Number(deserialized);
}
},
// Handles the following boolean inputs:
// "TrUe", "t", "f", "FALSE", 0, (non-zero), or boolean true/false
'boolean': {
deserialize: function(serialized) {
var type = typeof serialized;
if (type === "boolean") {
return serialized;
} else if (type === "string") {
return serialized.match(/^true$|^t$|^1$/i) !== null;
} else if (type === "number") {
return serialized === 1;
} else {
return false;
}
},
serialize: function(deserialized) {
return Boolean(deserialized);
}
},
date: {
deserialize: function(serialized) {
var type = typeof serialized;
var date = null;
if (type === "string") {
return new Date(Ember.Date.parse(serialized));
} else if (type === "number") {
return new Date(serialized);
} else if (serialized === null || serialized === undefined) {
// if the value is not present in the data,
// return undefined, not null.
return serialized;
} else {
return null;
}
},
serialize: function(date) {
if (date instanceof Date) {
var days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
var pad = function(num) {
return num < 10 ? "0"+num : ""+num;
};
var utcYear = date.getUTCFullYear(),
utcMonth = date.getUTCMonth(),
utcDayOfMonth = date.getUTCDate(),
utcDay = date.getUTCDay(),
utcHours = date.getUTCHours(),
utcMinutes = date.getUTCMinutes(),
utcSeconds = date.getUTCSeconds();
var dayOfWeek = days[utcDay];
var dayOfMonth = pad(utcDayOfMonth);
var month = months[utcMonth];
return dayOfWeek + ", " + dayOfMonth + " " + month + " " + utcYear + " " +
pad(utcHours) + ":" + pad(utcMinutes) + ":" + pad(utcSeconds) + " GMT";
} else {
return null;
}
}
}
};
})();
(function() {
var get = Ember.get, set = Ember.set;
var generatedId = 0;
DS.JSONSerializer = DS.Serializer.extend({
init: function() {
this._super();
if (!get(this, 'transforms')) {
this.set('transforms', DS.JSONTransforms);
}
this.sideloadMapping = Ember.Map.create();
this.metadataMapping = Ember.Map.create();
this.configure({
meta: 'meta',
since: 'since'
});
},
configure: function(type, configuration) {
var key;
if (type && !configuration) {
for(key in type){
this.metadataMapping.set(get(type, key), key);
}
return this._super(type);
}
var sideloadAs = configuration.sideloadAs,
sideloadMapping;
if (sideloadAs) {
sideloadMapping = this.aliases.sideloadMapping || Ember.Map.create();
sideloadMapping.set(sideloadAs, type);
this.aliases.sideloadMapping = sideloadMapping;
delete configuration.sideloadAs;
}
this._super.apply(this, arguments);
},
addId: function(data, key, id) {
data[key] = id;
},
/**
A hook you can use to customize how the key/value pair is added to
the serialized data.
@param {any} hash the JSON hash being built
@param {String} key the key to add to the serialized data
@param {any} value the value to add to the serialized data
*/
addAttribute: function(hash, key, value) {
hash[key] = value;
},
extractAttribute: function(type, hash, attributeName) {
var key = this._keyForAttributeName(type, attributeName);
return hash[key];
},
extractId: function(type, hash) {
var primaryKey = this._primaryKey(type);
if (hash.hasOwnProperty(primaryKey)) {
// Ensure that we coerce IDs to strings so that record
// IDs remain consistent between application runs; especially
// if the ID is serialized and later deserialized from the URL,
// when type information will have been lost.
return hash[primaryKey]+'';
} else {
return null;
}
},
extractHasMany: function(type, hash, key) {
return hash[key];
},
extractBelongsTo: function(type, hash, key) {
return hash[key];
},
extractBelongsToPolymorphic: function(type, hash, key) {
var keyForId = this.keyForPolymorphicId(key),
keyForType,
id = hash[keyForId];
if (id) {
keyForType = this.keyForPolymorphicType(key);
return {id: id, type: hash[keyForType]};
}
return null;
},
addBelongsTo: function(hash, record, key, relationship) {
var type = record.constructor,
name = relationship.key,
value = null,
includeType = (relationship.options && relationship.options.polymorphic),
embeddedChild,
child,
id;
if (this.embeddedType(type, name)) {
if (embeddedChild = get(record, name)) {
value = this.serialize(embeddedChild, { includeId: true, includeType: includeType });
}
hash[key] = value;
} else {
child = get(record, relationship.key);
id = get(child, 'id');
if (relationship.options && relationship.options.polymorphic && !Ember.isNone(id)) {
this.addBelongsToPolymorphic(hash, key, id, child.constructor);
} else {
hash[key] = id === undefined ? null : this.serializeId(id);
}
}
},
addBelongsToPolymorphic: function(hash, key, id, type) {
var keyForId = this.keyForPolymorphicId(key),
keyForType = this.keyForPolymorphicType(key);
hash[keyForId] = id;
hash[keyForType] = this.rootForType(type);
},
/**
Adds a has-many relationship to the JSON hash being built.
The default REST semantics are to only add a has-many relationship if it
is embedded. If the relationship was initially loaded by ID, we assume that
that was done as a performance optimization, and that changes to the
has-many should be saved as foreign key changes on the child's belongs-to
relationship.
@param {Object} hash the JSON being built
@param {DS.Model} record the record being serialized
@param {String} key the JSON key into which the serialized relationship
should be saved
@param {Object} relationship metadata about the relationship being serialized
*/
addHasMany: function(hash, record, key, relationship) {
var type = record.constructor,
name = relationship.key,
serializedHasMany = [],
includeType = (relationship.options && relationship.options.polymorphic),
manyArray, embeddedType;
// If the has-many is not embedded, there is nothing to do.
embeddedType = this.embeddedType(type, name);
if (embeddedType !== 'always') { return; }
// Get the DS.ManyArray for the relationship off the record
manyArray = get(record, name);
// Build up the array of serialized records
manyArray.forEach(function (record) {
serializedHasMany.push(this.serialize(record, { includeId: true, includeType: includeType }));
}, this);
// Set the appropriate property of the serialized JSON to the
// array of serialized embedded records
hash[key] = serializedHasMany;
},
addType: function(hash, type) {
var keyForType = this.keyForEmbeddedType();
hash[keyForType] = this.rootForType(type);
},
// EXTRACTION
extract: function(loader, json, type, record) {
var root = this.rootForType(type);
this.sideload(loader, type, json, root);
this.extractMeta(loader, type, json);
if (json[root]) {
if (record) { loader.updateId(record, json[root]); }
this.extractRecordRepresentation(loader, type, json[root]);
}
},
extractMany: function(loader, json, type, records) {
var root = this.rootForType(type);
root = this.pluralize(root);
this.sideload(loader, type, json, root);
this.extractMeta(loader, type, json);
if (json[root]) {
var objects = json[root], references = [];
if (records) { records = records.toArray(); }
for (var i = 0; i < objects.length; i++) {
if (records) { loader.updateId(records[i], objects[i]); }
var reference = this.extractRecordRepresentation(loader, type, objects[i]);
references.push(reference);
}
loader.populateArray(references);
}
},
extractMeta: function(loader, type, json) {
var meta = this.configOption(type, 'meta'),
data = json, key, property, value;
if(meta && json[meta]){
data = json[meta];
}
this.metadataMapping.forEach(function(property, key){
if(value = data[property]){
loader.metaForType(type, key, value);
}
});
},
extractEmbeddedType: function(relationship, data) {
var foundType = relationship.type;
if(relationship.options && relationship.options.polymorphic) {
var key = this.keyFor(relationship),
keyForEmbeddedType = this.keyForEmbeddedType(key);
foundType = this.typeFromAlias(data[keyForEmbeddedType]);
delete data[keyForEmbeddedType];
}
return foundType;
},
/**
@private
Iterates over the `json` payload and attempts to load any data
included alongside `root`.
The keys expected for sideloaded data are based upon the types related
to the root model. Recursion is used to ensure that types related to
related types can be loaded as well. Any custom keys specified by
`sideloadAs` mappings will also be respected.
@param {DS.Store subclass} loader
@param {DS.Model subclass} type
@param {Object} json
@param {String} root
*/
sideload: function(loader, type, json, root) {
var sideloadedType;
this.configureSideloadMappingForType(type);
for (var prop in json) {
if (!json.hasOwnProperty(prop) ||
prop === root ||
!!this.metadataMapping.get(prop)) {
continue;
}
sideloadedType = this.typeFromAlias(prop);
this.loadValue(loader, sideloadedType, json[prop]);
}
},
/**
@private
Configures possible sideload mappings for the types related to a
particular model. This recursive method ensures that sideloading
works for related models as well.
@param {DS.Model subclass} type
@param {Ember.A} configured an array of types that have already been configured
*/
configureSideloadMappingForType: function(type, configured) {
if (!configured) {configured = Ember.A([]);}
configured.pushObject(type);
type.eachRelatedType(function(relatedType) {
if (!configured.contains(relatedType)) {
var root = this.defaultSideloadRootForType(relatedType);
this.aliases.set(root, relatedType);
this.configureSideloadMappingForType(relatedType, configured);
}
}, this);
},
loadValue: function(loader, type, value) {
if (value instanceof Array) {
for (var i=0; i < value.length; i++) {
loader.sideload(type, value[i]);
}
} else {
loader.sideload(type, value);
}
},
/**
A hook you can use in your serializer subclass to customize
how a polymorphic association's name is converted into a key for the id.
@param {String} name the association name to convert into a key
@returns {String} the key
*/
keyForPolymorphicId: Ember.K,
/**
A hook you can use in your serializer subclass to customize
how a polymorphic association's name is converted into a key for the type.
@param {String} name the association name to convert into a key
@returns {String} the key
*/
keyForPolymorphicType: Ember.K,
/**
A hook you can use in your serializer subclass to customize
the key used to store the type of a record of an embedded polymorphic association.
By default, this method returns 'type'.
@returns {String} the key
*/
keyForEmbeddedType: function() {
return 'type';
},
// HELPERS
/**
@private
Determines the singular root name for a particular type.
This is an underscored, lowercase version of the model name.
For example, the type `App.UserGroup` will have the root
`user_group`.
@param {DS.Model subclass} type
@returns {String} name of the root element
*/
rootForType: function(type) {
var typeString = type.toString();
// use the last part of the name as the URL
var parts = typeString.split(".");
var name = parts[parts.length - 1];
return name.replace(/([A-Z])/g, '_$1').toLowerCase().slice(1);
},
/**
@private
The default root name for a particular sideloaded type.
@param {DS.Model subclass} type
@returns {String} name of the root element
*/
defaultSideloadRootForType: function(type) {
return this.pluralize(this.rootForType(type));
}
});
})();
(function() {
function loaderFor(store) {
return {
load: function(type, data, prematerialized) {
return store.load(type, data, prematerialized);
},
loadMany: function(type, array) {
return store.loadMany(type, array);
},
updateId: function(record, data) {
return store.updateId(record, data);
},
populateArray: Ember.K,
sideload: function(type, data) {
return store.load(type, data);
},
sideloadMany: function(type, array) {
return store.loadMany(type, array);
},
prematerialize: function(reference, prematerialized) {
store.prematerialize(reference, prematerialized);
},
metaForType: function(type, property, data) {
store.metaForType(type, property, data);
}
};
}
DS.loaderFor = loaderFor;
/**
An adapter is an object that receives requests from a store and
translates them into the appropriate action to take against your
persistence layer. The persistence layer is usually an HTTP API, but may
be anything, such as the browser's local storage.
### Creating an Adapter
First, create a new subclass of `DS.Adapter`:
App.MyAdapter = DS.Adapter.extend({
// ...your code here
});
To tell your store which adapter to use, set its `adapter` property:
App.store = DS.Store.create({
revision: 3,
adapter: App.MyAdapter.create()
});
`DS.Adapter` is an abstract base class that you should override in your
application to customize it for your backend. The minimum set of methods
that you should implement is:
* `find()`
* `createRecord()`
* `updateRecord()`
* `deleteRecord()`
To improve the network performance of your application, you can optimize
your adapter by overriding these lower-level methods:
* `findMany()`
* `createRecords()`
* `updateRecords()`
* `deleteRecords()`
* `commit()`
*/
var get = Ember.get, set = Ember.set, merge = Ember.merge;
DS.Adapter = Ember.Object.extend(DS._Mappable, {
init: function() {
var serializer = get(this, 'serializer');
if (Ember.Object.detect(serializer)) {
serializer = serializer.create();
set(this, 'serializer', serializer);
}
this._attributesMap = this.createInstanceMapFor('attributes');
this._configurationsMap = this.createInstanceMapFor('configurations');
this._outstandingOperations = new Ember.MapWithDefault({
defaultValue: function() { return 0; }
});
this._dependencies = new Ember.MapWithDefault({
defaultValue: function() { return new Ember.OrderedSet(); }
});
this.registerSerializerTransforms(this.constructor, serializer, {});
this.registerSerializerMappings(serializer);
},
/**
Loads a payload for a record into the store.
This method asks the serializer to break the payload into
constituent parts, and then loads them into the store. For example,
if you have a payload that contains embedded records, they will be
extracted by the serializer and loaded into the store.
For example:
```javascript
adapter.load(store, App.Person, {
id: 123,
firstName: "Yehuda",
lastName: "Katz",
occupations: [{
id: 345,
title: "Tricycle Mechanic"
}]
});
```
This will load the payload for the `App.Person` with ID `123` and
the embedded `App.Occupation` with ID `345`.
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {any} payload
*/
load: function(store, type, payload) {
var loader = loaderFor(store);
get(this, 'serializer').extractRecordRepresentation(loader, type, payload);
},
/**
Acknowledges that the adapter has finished creating a record.
Your adapter should call this method from `createRecord` when
it has saved a new record to its persistent storage and received
an acknowledgement.
If the persistent storage returns a new payload in response to the
creation, and you want to update the existing record with the
new information, pass the payload as the fourth parameter.
For example, the `RESTAdapter` saves newly created records by
making an Ajax request. When the server returns, the adapter
calls didCreateRecord. If the server returns a response body,
it is passed as the payload.
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {DS.Model} record
@param {any} payload
*/
didCreateRecord: function(store, type, record, payload) {
store.didSaveRecord(record);
if (payload) {
var loader = DS.loaderFor(store);
loader.load = function(type, data, prematerialized) {
store.updateId(record, data);
return store.load(type, data, prematerialized);
};
get(this, 'serializer').extract(loader, payload, type);
}
},
/**
Acknowledges that the adapter has finished creating several records.
Your adapter should call this method from `createRecords` when it
has saved multiple created records to its persistent storage
received an acknowledgement.
If the persistent storage returns a new payload in response to the
creation, and you want to update the existing record with the
new information, pass the payload as the fourth parameter.
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {DS.Model} record
@param {any} payload
*/
didCreateRecords: function(store, type, records, payload) {
records.forEach(function(record) {
store.didSaveRecord(record);
}, this);
if (payload) {
var loader = DS.loaderFor(store);
get(this, 'serializer').extractMany(loader, payload, type, records);
}
},
/**
@private
Acknowledges that the adapter has finished updating or deleting a record.
Your adapter should call this method from `updateRecord` or `deleteRecord`
when it has updated or deleted a record to its persistent storage and
received an acknowledgement.
If the persistent storage returns a new payload in response to the
update or delete, and you want to update the existing record with the
new information, pass the payload as the fourth parameter.
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {DS.Model} record
@param {any} payload
*/
didSaveRecord: function(store, type, record, payload) {
store.didSaveRecord(record);
var serializer = get(this, 'serializer'),
mappings = serializer.mappingForType(type);
serializer.eachEmbeddedRecord(record, function(embeddedRecord, embeddedType) {
if (embeddedType === 'load') { return; }
this.didSaveRecord(store, embeddedRecord.constructor, embeddedRecord);
}, this);
if (payload) {
var loader = DS.loaderFor(store);
serializer.extract(loader, payload, type);
}
},
/**
Acknowledges that the adapter has finished updating a record.
Your adapter should call this method from `updateRecord` when it
has updated a record to its persistent storage and received an
acknowledgement.
If the persistent storage returns a new payload in response to the
update, pass the payload as the fourth parameter.
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {DS.Model} record
@param {any} payload
*/
didUpdateRecord: function() {
this.didSaveRecord.apply(this, arguments);
},
/**
Acknowledges that the adapter has finished deleting a record.
Your adapter should call this method from `deleteRecord` when it
has deleted a record from its persistent storage and received an
acknowledgement.
If the persistent storage returns a new payload in response to the
deletion, pass the payload as the fourth parameter.
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {DS.Model} record
@param {any} payload
*/
didDeleteRecord: function() {
this.didSaveRecord.apply(this, arguments);
},
/**
Acknowledges that the adapter has finished updating or deleting
multiple records.
Your adapter should call this method from its `updateRecords` or
`deleteRecords` when it has updated or deleted multiple records
to its persistent storage and received an acknowledgement.
If the persistent storage returns a new payload in response to the
creation, pass the payload as the fourth parameter.
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {DS.Model} records
@param {any} payload
*/
didSaveRecords: function(store, type, records, payload) {
records.forEach(function(record) {
store.didSaveRecord(record);
}, this);
if (payload) {
var loader = DS.loaderFor(store);
get(this, 'serializer').extractMany(loader, payload, type);
}
},
/**
Acknowledges that the adapter has finished updating multiple records.
Your adapter should call this method from its `updateRecords` when
it has updated multiple records to its persistent storage and
received an acknowledgement.
If the persistent storage returns a new payload in response to the
update, pass the payload as the fourth parameter.
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {DS.Model} records
@param {any} payload
*/
didUpdateRecords: function() {
this.didSaveRecords.apply(this, arguments);
},
/**
Acknowledges that the adapter has finished updating multiple records.
Your adapter should call this method from its `deleteRecords` when
it has deleted multiple records to its persistent storage and
received an acknowledgement.
If the persistent storage returns a new payload in response to the
deletion, pass the payload as the fourth parameter.
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {DS.Model} records
@param {any} payload
*/
didDeleteRecords: function() {
this.didSaveRecords.apply(this, arguments);
},
/**
Loads the response to a request for a record by ID.
Your adapter should call this method from its `find` method
with the response from the backend.
You should pass the same ID to this method that was given
to your find method so that the store knows which record
to associate the new data with.
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {any} payload
@param {String} id
*/
didFindRecord: function(store, type, payload, id) {
var loader = DS.loaderFor(store);
loader.load = function(type, data, prematerialized) {
prematerialized = prematerialized || {};
prematerialized.id = id;
return store.load(type, data, prematerialized);
};
get(this, 'serializer').extract(loader, payload, type);
},
/**
Loads the response to a request for all records by type.
You adapter should call this method from its `findAll`
method with the response from the backend.
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {any} payload
*/
didFindAll: function(store, type, payload) {
var loader = DS.loaderFor(store),
serializer = get(this, 'serializer');
store.didUpdateAll(type);
serializer.extractMany(loader, payload, type);
},
/**
Loads the response to a request for records by query.
Your adapter should call this method from its `findQuery`
method with the response from the backend.
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {any} payload
@param {DS.AdapterPopulatedRecordArray} recordArray
*/
didFindQuery: function(store, type, payload, recordArray) {
var loader = DS.loaderFor(store);
loader.populateArray = function(data) {
recordArray.load(data);
};
get(this, 'serializer').extractMany(loader, payload, type);
},
/**
Loads the response to a request for many records by ID.
You adapter should call this method from its `findMany`
method with the response from the backend.
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {any} payload
*/
didFindMany: function(store, type, payload) {
var loader = DS.loaderFor(store);
get(this, 'serializer').extractMany(loader, payload, type);
},
/**
Notifies the store that a request to the backend returned
an error.
Your adapter should call this method to indicate that the
backend returned an error for a request.
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {DS.Model} record
*/
didError: function(store, type, record) {
store.recordWasError(record);
},
dirtyRecordsForAttributeChange: function(dirtySet, record, attributeName, newValue, oldValue) {
if (newValue !== oldValue) {
// If this record is embedded, add its parent
// to the dirty set.
this.dirtyRecordsForRecordChange(dirtySet, record);
}
},
dirtyRecordsForRecordChange: function(dirtySet, record) {
dirtySet.add(record);
},
dirtyRecordsForBelongsToChange: function(dirtySet, child) {
this.dirtyRecordsForRecordChange(dirtySet, child);
},
dirtyRecordsForHasManyChange: function(dirtySet, parent) {
this.dirtyRecordsForRecordChange(dirtySet, parent);
},
/**
@private
This method recursively climbs the superclass hierarchy and
registers any class-registered transforms on the adapter's
serializer.
Once it registers a transform for a given type, it ignores
subsequent transforms for the same attribute type.
@param {Class} klass the DS.Adapter subclass to extract the
transforms from
@param {DS.Serializer} serializer the serializer to register
the transforms onto
@param {Object} seen a hash of attributes already seen
*/
registerSerializerTransforms: function(klass, serializer, seen) {
var transforms = klass._registeredTransforms, superclass, prop;
for (prop in transforms) {
if (!transforms.hasOwnProperty(prop) || prop in seen) { continue; }
seen[prop] = true;
serializer.registerTransform(prop, transforms[prop]);
}
if (superclass = klass.superclass) {
this.registerSerializerTransforms(superclass, serializer, seen);
}
},
/**
@private
This method recursively climbs the superclass hierarchy and
registers any class-registered mappings on the adapter's
serializer.
@param {Class} klass the DS.Adapter subclass to extract the
transforms from
@param {DS.Serializer} serializer the serializer to register the
mappings onto
*/
registerSerializerMappings: function(serializer) {
var mappings = this._attributesMap,
configurations = this._configurationsMap;
mappings.forEach(serializer.map, serializer);
configurations.forEach(serializer.configure, serializer);
},
/**
The `find()` method is invoked when the store is asked for a record that
has not previously been loaded. In response to `find()` being called, you
should query your persistence layer for a record with the given ID. Once
found, you can asynchronously call the store's `load()` method to load
the record.
Here is an example `find` implementation:
find: function(store, type, id) {
var url = type.url;
url = url.fmt(id);
jQuery.getJSON(url, function(data) {
// data is a hash of key/value pairs. If your server returns a
// root, simply do something like:
// store.load(type, id, data.person)
store.load(type, id, data);
});
}
*/
find: null,
serializer: DS.JSONSerializer,
registerTransform: function(attributeType, transform) {
get(this, 'serializer').registerTransform(attributeType, transform);
},
/**
A public method that allows you to register an enumerated
type on your adapter. This is useful if you want to utilize
a text representation of an integer value.
Eg: Say you want to utilize "low","medium","high" text strings
in your app, but you want to persist those as 0,1,2 in your backend.
You would first register the transform on your adapter instance:
adapter.registerEnumTransform('priority', ['low', 'medium', 'high']);
You would then refer to the 'priority' DS.attr in your model:
App.Task = DS.Model.extend({
priority: DS.attr('priority')
});
And lastly, you would set/get the text representation on your model instance,
but the transformed result will be the index number of the type.
App: myTask.get('priority') => 'low'
Server Response / Load: { myTask: {priority: 0} }
@param {String} type of the transform
@param {Array} array of String objects to use for the enumerated values.
This is an ordered list and the index values will be used for the transform.
*/
registerEnumTransform: function(attributeType, objects) {
get(this, 'serializer').registerEnumTransform(attributeType, objects);
},
/**
If the globally unique IDs for your records should be generated on the client,
implement the `generateIdForRecord()` method. This method will be invoked
each time you create a new record, and the value returned from it will be
assigned to the record's `primaryKey`.
Most traditional REST-like HTTP APIs will not use this method. Instead, the ID
of the record will be set by the server, and your adapter will update the store
with the new ID when it calls `didCreateRecord()`. Only implement this method if
you intend to generate record IDs on the client-side.
The `generateIdForRecord()` method will be invoked with the requesting store as
the first parameter and the newly created record as the second parameter:
generateIdForRecord: function(store, record) {
var uuid = App.generateUUIDWithStatisticallyLowOddsOfCollision();
return uuid;
}
*/
generateIdForRecord: null,
materialize: function(record, data, prematerialized) {
get(this, 'serializer').materialize(record, data, prematerialized);
},
serialize: function(record, options) {
return get(this, 'serializer').serialize(record, options);
},
extractId: function(type, data) {
return get(this, 'serializer').extractId(type, data);
},
groupByType: function(enumerable) {
var map = Ember.MapWithDefault.create({
defaultValue: function() { return Ember.OrderedSet.create(); }
});
enumerable.forEach(function(item) {
map.get(item.constructor).add(item);
});
return map;
},
commit: function(store, commitDetails) {
this.save(store, commitDetails);
},
save: function(store, commitDetails) {
var adapter = this;
function filter(records) {
var filteredSet = Ember.OrderedSet.create();
records.forEach(function(record) {
if (adapter.shouldSave(record)) {
filteredSet.add(record);
}
});
return filteredSet;
}
this.groupByType(commitDetails.created).forEach(function(type, set) {
this.createRecords(store, type, filter(set));
}, this);
this.groupByType(commitDetails.updated).forEach(function(type, set) {
this.updateRecords(store, type, filter(set));
}, this);
this.groupByType(commitDetails.deleted).forEach(function(type, set) {
this.deleteRecords(store, type, filter(set));
}, this);
},
shouldSave: Ember.K,
createRecords: function(store, type, records) {
records.forEach(function(record) {
this.createRecord(store, type, record);
}, this);
},
updateRecords: function(store, type, records) {
records.forEach(function(record) {
this.updateRecord(store, type, record);
}, this);
},
deleteRecords: function(store, type, records) {
records.forEach(function(record) {
this.deleteRecord(store, type, record);
}, this);
},
findMany: function(store, type, ids) {
ids.forEach(function(id) {
this.find(store, type, id);
}, this);
}
});
DS.Adapter.reopenClass({
registerTransform: function(attributeType, transform) {
var registeredTransforms = this._registeredTransforms || {};
registeredTransforms[attributeType] = transform;
this._registeredTransforms = registeredTransforms;
},
map: DS._Mappable.generateMapFunctionFor('attributes', function(key, newValue, map) {
var existingValue = map.get(key);
merge(existingValue, newValue);
}),
configure: DS._Mappable.generateMapFunctionFor('configurations', function(key, newValue, map) {
var existingValue = map.get(key);
// If a mapping configuration is provided, peel it off and apply it
// using the DS.Adapter.map API.
var mappings = newValue && newValue.mappings;
if (mappings) {
this.map(key, mappings);
delete newValue.mappings;
}
merge(existingValue, newValue);
}),
resolveMapConflict: function(oldValue, newValue, mappingsKey) {
merge(newValue, oldValue);
return newValue;
}
});
})();
(function() {
var get = Ember.get, set = Ember.set;
DS.FixtureSerializer = DS.Serializer.extend({
deserializeValue: function(value, attributeType) {
return value;
},
serializeValue: function(value, attributeType) {
return value;
},
addId: function(data, key, id) {
data[key] = id;
},
addAttribute: function(hash, key, value) {
hash[key] = value;
},
addBelongsTo: function(hash, record, key, relationship) {
var id = get(record, relationship.key+'.id');
if (!Ember.isNone(id)) { hash[key] = id; }
},
addHasMany: function(hash, record, key, relationship) {
var ids = get(record, relationship.key).map(function(item) {
return item.get('id');
});
hash[relationship.key] = ids;
},
extract: function(loader, fixture, type, record) {
if (record) { loader.updateId(record, fixture); }
this.extractRecordRepresentation(loader, type, fixture);
},
extractMany: function(loader, fixtures, type, records) {
var objects = fixtures, references = [];
if (records) { records = records.toArray(); }
for (var i = 0; i < objects.length; i++) {
if (records) { loader.updateId(records[i], objects[i]); }
var reference = this.extractRecordRepresentation(loader, type, objects[i]);
references.push(reference);
}
loader.populateArray(references);
},
extractId: function(type, hash) {
var primaryKey = this._primaryKey(type);
if (hash.hasOwnProperty(primaryKey)) {
// Ensure that we coerce IDs to strings so that record
// IDs remain consistent between application runs; especially
// if the ID is serialized and later deserialized from the URL,
// when type information will have been lost.
return hash[primaryKey]+'';
} else {
return null;
}
},
extractAttribute: function(type, hash, attributeName) {
var key = this._keyForAttributeName(type, attributeName);
return hash[key];
},
extractHasMany: function(type, hash, key) {
return hash[key];
},
extractBelongsTo: function(type, hash, key) {
return hash[key];
},
extractBelongsToPolymorphic: function(type, hash, key) {
var keyForId = this.keyForPolymorphicId(key),
keyForType,
id = hash[keyForId];
if (id) {
keyForType = this.keyForPolymorphicType(key);
return {id: id, type: hash[keyForType]};
}
return null;
},
keyForPolymorphicId: function(key) {
return key;
},
keyForPolymorphicType: function(key) {
return key + '_type';
}
});
})();
(function() {
var get = Ember.get, fmt = Ember.String.fmt,
dump = Ember.get(window, 'JSON.stringify') || function(object) { return object.toString(); };
/**
`DS.FixtureAdapter` is an adapter that loads records from memory.
Its primarily used for development and testing. You can also use
`DS.FixtureAdapter` while working on the API but are not ready to
integrate yet. It is a fully functioning adapter. All CRUD methods
are implemented. You can also implement query logic that a remote
system would do. Its possible to do develop your entire application
with `DS.FixtureAdapter`.
*/
DS.FixtureAdapter = DS.Adapter.extend({
simulateRemoteResponse: true,
latency: 50,
serializer: DS.FixtureSerializer,
/*
Implement this method in order to provide data associated with a type
*/
fixturesForType: function(type) {
if (type.FIXTURES) {
var fixtures = Ember.A(type.FIXTURES);
return fixtures.map(function(fixture){
if(!fixture.id){
throw new Error(fmt('the id property must be defined for fixture %@', [dump(fixture)]));
}
fixture.id = fixture.id + '';
return fixture;
});
}
return null;
},
/*
Implement this method in order to query fixtures data
*/
queryFixtures: function(fixtures, query, type) {
},
updateFixtures: function(type, fixture) {
if(!type.FIXTURES) {
type.FIXTURES = [];
}
var fixtures = type.FIXTURES;
this.deleteLoadedFixture(type, fixture);
fixtures.push(fixture);
},
/*
Implement this method in order to provide provide json for CRUD methods
*/
mockJSON: function(type, record) {
return this.serialize(record, { includeId: true });
},
/*
Adapter methods
*/
generateIdForRecord: function(store, record) {
return Ember.guidFor(record);
},
find: function(store, type, id) {
var fixtures = this.fixturesForType(type),
fixture;
if (fixtures) {
fixture = Ember.A(fixtures).findProperty('id', id);
}
if (fixture) {
this.simulateRemoteCall(function() {
this.didFindRecord(store, type, fixture, id);
}, this);
}
},
findMany: function(store, type, ids) {
var fixtures = this.fixturesForType(type);
if (fixtures) {
fixtures = fixtures.filter(function(item) {
return ids.indexOf(item.id) !== -1;
});
}
if (fixtures) {
this.simulateRemoteCall(function() {
this.didFindMany(store, type, fixtures);
}, this);
}
},
findAll: function(store, type) {
var fixtures = this.fixturesForType(type);
this.simulateRemoteCall(function() {
this.didFindAll(store, type, fixtures);
}, this);
},
findQuery: function(store, type, query, array) {
var fixtures = this.fixturesForType(type);
fixtures = this.queryFixtures(fixtures, query, type);
if (fixtures) {
this.simulateRemoteCall(function() {
this.didFindQuery(store, type, fixtures, array);
}, this);
}
},
createRecord: function(store, type, record) {
var fixture = this.mockJSON(type, record);
this.updateFixtures(type, fixture);
this.simulateRemoteCall(function() {
this.didCreateRecord(store, type, record, fixture);
}, this);
},
updateRecord: function(store, type, record) {
var fixture = this.mockJSON(type, record);
this.updateFixtures(type, fixture);
this.simulateRemoteCall(function() {
this.didUpdateRecord(store, type, record, fixture);
}, this);
},
deleteRecord: function(store, type, record) {
var fixture = this.mockJSON(type, record);
this.deleteLoadedFixture(type, fixture);
this.simulateRemoteCall(function() {
this.didDeleteRecord(store, type, record);
}, this);
},
/*
@private
*/
deleteLoadedFixture: function(type, record) {
var id = this.extractId(type, record);
var existingFixture = this.findExistingFixture(type, record);
if(existingFixture) {
var index = type.FIXTURES.indexOf(existingFixture);
type.FIXTURES.splice(index, 1);
return true;
}
},
findExistingFixture: function(type, record) {
var fixtures = this.fixturesForType(type);
var id = this.extractId(type, record);
return this.findFixtureById(fixtures, id);
},
findFixtureById: function(fixtures, id) {
var adapter = this;
return Ember.A(fixtures).find(function(r) {
if(''+get(r, 'id') === ''+id) {
return true;
} else {
return false;
}
});
},
simulateRemoteCall: function(callback, context) {
if (get(this, 'simulateRemoteResponse')) {
// Schedule with setTimeout
Ember.run.later(context, callback, get(this, 'latency'));
} else {
// Asynchronous, but at the of the runloop with zero latency
Ember.run.once(context, callback);
}
}
});
})();
(function() {
var get = Ember.get;
DS.RESTSerializer = DS.JSONSerializer.extend({
keyForAttributeName: function(type, name) {
return Ember.String.decamelize(name);
},
keyForBelongsTo: function(type, name) {
var key = this.keyForAttributeName(type, name);
if (this.embeddedType(type, name)) {
return key;
}
return key + "_id";
},
keyForHasMany: function(type, name) {
var key = this.keyForAttributeName(type, name);
if (this.embeddedType(type, name)) {
return key;
}
return this.singularize(key) + "_ids";
},
keyForPolymorphicId: function(key) {
return key;
},
keyForPolymorphicType: function(key) {
return key.replace(/_id$/, '_type');
},
extractValidationErrors: function(type, json) {
var errors = {};
get(type, 'attributes').forEach(function(name) {
var key = this._keyForAttributeName(type, name);
if (json['errors'].hasOwnProperty(key)) {
errors[name] = json['errors'][key];
}
}, this);
return errors;
}
});
})();
(function() {
/*global jQuery*/
var get = Ember.get, set = Ember.set, merge = Ember.merge;
/**
The REST adapter allows your store to communicate with an HTTP server by
transmitting JSON via XHR. Most Ember.js apps that consume a JSON API
should use the REST adapter.
This adapter is designed around the idea that the JSON exchanged with
the server should be conventional.
## JSON Structure
The REST adapter expects the JSON returned from your server to follow
these conventions.
### Object Root
The JSON payload should be an object that contains the record inside a
root property. For example, in response to a `GET` request for
`/posts/1`, the JSON should look like this:
```js
{
"post": {
title: "I'm Running to Reform the W3C's Tag",
author: "Yehuda Katz"
}
}
```
### Conventional Names
Attribute names in your JSON payload should be the underscored versions of
the attributes in your Ember.js models.
For example, if you have a `Person` model:
```js
App.Person = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
occupation: DS.attr('string')
});
```
The JSON returned should look like this:
```js
{
"person": {
"first_name": "Barack",
"last_name": "Obama",
"occupation": "President"
}
}
```
*/
DS.RESTAdapter = DS.Adapter.extend({
bulkCommit: false,
since: 'since',
serializer: DS.RESTSerializer,
init: function() {
this._super.apply(this, arguments);
},
shouldSave: function(record) {
var reference = get(record, '_reference');
return !reference.parent;
},
dirtyRecordsForRecordChange: function(dirtySet, record) {
this._dirtyTree(dirtySet, record);
},
dirtyRecordsForHasManyChange: function(dirtySet, record, relationship) {
var embeddedType = get(this, 'serializer').embeddedType(record.constructor, relationship.secondRecordName);
if (embeddedType === 'always') {
relationship.childReference.parent = relationship.parentReference;
this._dirtyTree(dirtySet, record);
}
},
_dirtyTree: function(dirtySet, record) {
dirtySet.add(record);
get(this, 'serializer').eachEmbeddedRecord(record, function(embeddedRecord, embeddedType) {
if (embeddedType !== 'always') { return; }
if (dirtySet.has(embeddedRecord)) { return; }
this._dirtyTree(dirtySet, embeddedRecord);
}, this);
var reference = record.get('_reference');
if (reference.parent) {
var store = get(record, 'store');
var parent = store.recordForReference(reference.parent);
this._dirtyTree(dirtySet, parent);
}
},
createRecord: function(store, type, record) {
var root = this.rootForType(type);
var data = {};
data[root] = this.serialize(record, { includeId: true });
this.ajax(this.buildURL(root), "POST", {
data: data,
success: function(json) {
Ember.run(this, function(){
this.didCreateRecord(store, type, record, json);
});
},
error: function(xhr) {
this.didError(store, type, record, xhr);
}
});
},
createRecords: function(store, type, records) {
if (get(this, 'bulkCommit') === false) {
return this._super(store, type, records);
}
var root = this.rootForType(type),
plural = this.pluralize(root);
var data = {};
data[plural] = [];
records.forEach(function(record) {
data[plural].push(this.serialize(record, { includeId: true }));
}, this);
this.ajax(this.buildURL(root), "POST", {
data: data,
success: function(json) {
Ember.run(this, function(){
this.didCreateRecords(store, type, records, json);
});
}
});
},
updateRecord: function(store, type, record) {
var id = get(record, 'id');
var root = this.rootForType(type);
var data = {};
data[root] = this.serialize(record);
this.ajax(this.buildURL(root, id), "PUT", {
data: data,
success: function(json) {
Ember.run(this, function(){
this.didUpdateRecord(store, type, record, json);
});
},
error: function(xhr) {
this.didError(store, type, record, xhr);
}
});
},
updateRecords: function(store, type, records) {
if (get(this, 'bulkCommit') === false) {
return this._super(store, type, records);
}
var root = this.rootForType(type),
plural = this.pluralize(root);
var data = {};
data[plural] = [];
records.forEach(function(record) {
data[plural].push(this.serialize(record, { includeId: true }));
}, this);
this.ajax(this.buildURL(root, "bulk"), "PUT", {
data: data,
success: function(json) {
Ember.run(this, function(){
this.didUpdateRecords(store, type, records, json);
});
}
});
},
deleteRecord: function(store, type, record) {
var id = get(record, 'id');
var root = this.rootForType(type);
this.ajax(this.buildURL(root, id), "DELETE", {
success: function(json) {
Ember.run(this, function(){
this.didDeleteRecord(store, type, record, json);
});
},
error: function(xhr) {
this.didError(store, type, record, xhr);
}
});
},
deleteRecords: function(store, type, records) {
if (get(this, 'bulkCommit') === false) {
return this._super(store, type, records);
}
var root = this.rootForType(type),
plural = this.pluralize(root),
serializer = get(this, 'serializer');
var data = {};
data[plural] = [];
records.forEach(function(record) {
data[plural].push(serializer.serializeId( get(record, 'id') ));
});
this.ajax(this.buildURL(root, 'bulk'), "DELETE", {
data: data,
success: function(json) {
Ember.run(this, function(){
this.didDeleteRecords(store, type, records, json);
});
}
});
},
find: function(store, type, id) {
var root = this.rootForType(type);
this.ajax(this.buildURL(root, id), "GET", {
success: function(json) {
Ember.run(this, function(){
this.didFindRecord(store, type, json, id);
});
}
});
},
findAll: function(store, type, since) {
var root = this.rootForType(type);
this.ajax(this.buildURL(root), "GET", {
data: this.sinceQuery(since),
success: function(json) {
Ember.run(this, function(){
this.didFindAll(store, type, json);
});
}
});
},
findQuery: function(store, type, query, recordArray) {
var root = this.rootForType(type);
this.ajax(this.buildURL(root), "GET", {
data: query,
success: function(json) {
Ember.run(this, function(){
this.didFindQuery(store, type, json, recordArray);
});
}
});
},
findMany: function(store, type, ids, owner) {
var root = this.rootForType(type);
ids = this.serializeIds(ids);
this.ajax(this.buildURL(root), "GET", {
data: {ids: ids},
success: function(json) {
Ember.run(this, function(){
this.didFindMany(store, type, json);
});
}
});
},
/**
@private
This method serializes a list of IDs using `serializeId`
@returns {Array} an array of serialized IDs
*/
serializeIds: function(ids) {
var serializer = get(this, 'serializer');
return Ember.EnumerableUtils.map(ids, function(id) {
return serializer.serializeId(id);
});
},
didError: function(store, type, record, xhr) {
if (xhr.status === 422) {
var json = JSON.parse(xhr.responseText),
serializer = get(this, 'serializer'),
errors = serializer.extractValidationErrors(type, json);
store.recordWasInvalid(record, errors);
} else {
this._super.apply(this, arguments);
}
},
ajax: function(url, type, hash) {
hash.url = url;
hash.type = type;
hash.dataType = 'json';
hash.contentType = 'application/json; charset=utf-8';
hash.context = this;
if (hash.data && type !== 'GET') {
hash.data = JSON.stringify(hash.data);
}
jQuery.ajax(hash);
},
url: "",
rootForType: function(type) {
var serializer = get(this, 'serializer');
return serializer.rootForType(type);
},
pluralize: function(string) {
var serializer = get(this, 'serializer');
return serializer.pluralize(string);
},
buildURL: function(record, suffix) {
var url = [this.url];
if (this.namespace !== undefined) {
url.push(this.namespace);
}
url.push(this.pluralize(record));
if (suffix !== undefined) {
url.push(suffix);
}
return url.join("/");
},
sinceQuery: function(since) {
var query = {};
query[get(this, 'since')] = since;
return since ? query : null;
}
});
})();
(function() {
var camelize = Ember.String.camelize,
capitalize = Ember.String.capitalize,
get = Ember.get,
map = Ember.ArrayPolyfills.map,
registeredTransforms;
var passthruTransform = {
serialize: function(value) { return value; },
deserialize: function(value) { return value; }
};
var defaultTransforms = {
string: passthruTransform,
boolean: passthruTransform,
number: passthruTransform
};
function camelizeKeys(json) {
var value;
for (var prop in json) {
value = json[prop];
delete json[prop];
json[camelize(prop)] = value;
}
}
function munge(json, callback) {
callback(json);
}
function applyTransforms(json, type, transformType) {
var transforms = registeredTransforms[transformType];
get(type, 'attributes').forEach(function(name, attribute) {
var attributeType = attribute.type,
value = json[name];
var transform = transforms[attributeType] || defaultTransforms[attributeType];
json[name] = transform.deserialize(value);
});
}
function ObjectProcessor(json, type, store) {
this.json = json;
this.type = type;
this.store = store;
}
ObjectProcessor.prototype = {
camelizeKeys: function() {
camelizeKeys(this.json);
return this;
},
munge: function(callback) {
munge(this.json, callback);
return this;
},
applyTransforms: function(transformType) {
applyTransforms(this.json, this.type, transformType);
return this;
}
};
function LoadObjectProcessor() {
ObjectProcessor.apply(this, arguments);
}
LoadObjectProcessor.prototype = Ember.create(ObjectProcessor.prototype);
LoadObjectProcessor.prototype.load = function() {
this.store.load(this.type, {}, this.json);
};
function loadObjectProcessorFactory(store, type) {
return function(json) {
return new LoadObjectProcessor(json, type, store);
};
}
function ArrayProcessor(json, type, array, store) {
this.json = json;
this.type = type;
this.array = array;
this.store = store;
}
ArrayProcessor.prototype = {
load: function() {
var store = this.store,
type = this.type;
var references = this.json.map(function(object) {
return store.load(type, {}, object);
});
this.array.load(references);
},
camelizeKeys: function() {
this.json.forEach(camelizeKeys);
return this;
},
munge: function(callback) {
this.json.forEach(function(object) {
munge(object, callback);
});
return this;
},
applyTransforms: function(transformType) {
var type = this.type;
this.json.forEach(function(object) {
applyTransforms(object, type, transformType);
});
return this;
}
};
function arrayProcessorFactory(store, type, array) {
return function(json) {
return new ArrayProcessor(json, type, array, store);
};
}
var HasManyProcessor = function(json, store, record, relationship) {
this.json = json;
this.store = store;
this.record = record;
this.type = record.constructor;
this.relationship = relationship;
};
HasManyProcessor.prototype = Ember.create(ArrayProcessor.prototype);
HasManyProcessor.prototype.load = function() {
var store = this.store;
var ids = map.call(this.json, function(obj) { return obj.id; });
store.loadMany(this.relationship.type, this.json);
store.loadHasMany(this.record, this.relationship.key, ids);
};
function hasManyProcessorFactory(store, record, relationship) {
return function(json) {
return new HasManyProcessor(json, store, record, relationship);
};
}
function SaveProcessor(record, store, type, includeId) {
this.record = record;
ObjectProcessor.call(this, record.toJSON({ includeId: includeId }), type, store);
}
SaveProcessor.prototype = Ember.create(ObjectProcessor.prototype);
SaveProcessor.prototype.save = function(callback) {
callback(this.json);
};
function saveProcessorFactory(store, type, includeId) {
return function(record) {
return new SaveProcessor(record, store, type, includeId);
};
}
DS.BasicAdapter = DS.Adapter.extend({
find: function(store, type, id) {
var sync = type.sync;
sync.find(id, loadObjectProcessorFactory(store, type));
},
findQuery: function(store, type, query, recordArray) {
var sync = type.sync;
sync.query(query, arrayProcessorFactory(store, type, recordArray));
},
findHasMany: function(store, record, relationship, data) {
var name = capitalize(relationship.key),
sync = record.constructor.sync,
processor = hasManyProcessorFactory(store, record, relationship);
var options = {
relationship: relationship.key,
data: data
};
if (sync['find'+name]) {
sync['find' + name](record, options, processor);
} else if (sync.findHasMany) {
sync.findHasMany(record, options, processor);
} else {
}
},
createRecord: function(store, type, record) {
var sync = type.sync;
sync.createRecord(record, saveProcessorFactory(store, type));
},
updateRecord: function(store, type, record) {
var sync = type.sync;
sync.updateRecord(record, saveProcessorFactory(store, type, true));
},
deleteRecord: function(store, type, record) {
var sync = type.sync;
sync.deleteRecord(record, saveProcessorFactory(store, type, true));
}
});
DS.registerTransforms = function(kind, object) {
registeredTransforms[kind] = object;
};
DS.clearTransforms = function() {
registeredTransforms = {};
};
DS.clearTransforms();
})();
(function() {
})();
(function() {
//Copyright (C) 2011 by Living Social, Inc.
//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.
})();
if (typeof location !== 'undefined' && (location.hostname === 'localhost' || location.hostname === '127.0.0.1')) {
console.warn("You are running a production build of Ember on localhost and won't receive detailed error messages. "+
"If you want full error messages please use the non-minified build provided on the Ember website.");
}
|
examples/huge-apps/routes/Course/routes/Assignments/components/Assignments.js
|
RobertKielty/react-router
|
import React from 'react';
class Assignments extends React.Component {
render () {
return (
<div>
<h3>Assignments</h3>
{this.props.children || <p>Choose an assignment from the sidebar.</p>}
</div>
);
}
}
export default Assignments;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.