diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..c88a062 Binary files /dev/null and b/.DS_Store differ diff --git a/dist/main.js b/dist/main.js index 4687d8d..2af7927 100644 --- a/dist/main.js +++ b/dist/main.js @@ -1,89504 +1,43 @@ -(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 -1 && jqueryAjax.type === 'POST' && jqueryAjax.url.indexOf('custom') === -1 && jqueryAjax.url.indexOf('logout') === -1) { - // console.log('basic auth'); - xhrAjax.setRequestHeader('Authorization', 'Basic ' + _store2.default.settings.basicAuth); - } else { - // console.log('kinvey auth'); - xhrAjax.setRequestHeader('Authorization', 'Kinvey ' + _store2.default.session.get('authtoken')); - } - } else { - // xhrAjax.setRequestHeader('Authorization', `Basic ${store.settings.basicAuth}`) - } - } -}); - -},{"./store":78,"jquery":299}],3:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _underscore = require('underscore'); - -var _underscore2 = _interopRequireDefault(_underscore); - -var _store = require('./store'); - -var _store2 = _interopRequireDefault(_store); - -var _countries = require('./data/countries'); - -var _countries2 = _interopRequireDefault(_countries); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var cc = { - commafy: function commafy(num) { - var parts = ('' + (num < 0 ? -num : num)).split("."), - s = parts[0], - L, - i = L = s.length, - o = ''; - while (i--) { - o = (i === 0 ? '' : (L - i) % 3 ? '' : ',') + s.charAt(i) + o; - } - return (num < 0 ? '-' : '') + o + (parts[1] ? '.' + parts[1] : ''); - }, - validateLocation: function validateLocation(location) { - return new Promise(function (resolve, reject) { - if (!location.country_code || !location.country_name) { - reject('Missing country'); - } else if (!location.addressLine1) { - reject('Missing address'); - } else { - resolve(); - } - }); - }, - calculateTax: function calculateTax(countryCode) { - console.log(countryCode); - return new Promise(function (resolve, reject) { - var country = _underscore2.default.where(_countries2.default, { value: countryCode }); - if (country[0].taxPercent) { - resolve(country[0].taxPercent); - } else { - resolve(0); - } - }); - }, - - ccFormat: function ccFormat(input) { - var v = input.replace(/\s+/g, '').replace(/[^0-9]/gi, ''); - var matches = v.match(/\d{4,16}/g); - var match = matches && matches[0] || ''; - var parts = []; - for (var i = 0, len = match.length; i < len; i += 4) { - parts.push(match.substring(i, i + 4)); - } - if (parts.length) { - return parts.join(' '); - } else { - return v; - } - }, - dateFormat: function dateFormat(e, input) { - var v = input; - if (e.which !== 8) { - v = input.replace(/\s+/g, '').replace(/[^0-9]/gi, ''); - if (v.length === 1 && v > 1) { - v = '0' + v; - } - if (v.length === 2) { - if (v > 12) { - var parts = v.split(''); - parts.splice(1, 1); - v = parts.join(''); - } else { - v = v + ' / '; - } - } else if (v.length > 2) { - var _parts = v.split(''); - _parts.splice(2, 0, ' / '); - v = _parts.join(''); - } - if (v.length > 7) { - var _parts2 = v.split(''); - _parts2.splice(6, 1); - v = _parts2.join(''); - } - } else { - if (v.length === 4) { - var _parts3 = v.split(''); - _parts3 = _underscore2.default.without(_parts3, '/'); - _parts3 = _underscore2.default.without(_parts3, ' '); - _parts3.splice(1, 1); - v = _parts3.join(''); - } - - if (v.length > 2) { - var _parts4 = v.split(''); - _parts4 = _underscore2.default.without(_parts4, '/'); - _parts4 = _underscore2.default.without(_parts4, ' '); - _parts4.splice(2, 0, ' / '); - v = _parts4.join(''); - } - } - return v; - }, - cvcFormat: function cvcFormat(input) { - var v = input.replace(/\s+/g, '').replace(/[^0-9]/gi, ''); - if (v.length > 3) { - var parts = v.split(''); - parts.splice(2, 1); - v = parts.join(''); - } - return v; - }, - checkPayment: function checkPayment(card) { - return new Promise(function (resolve, reject) { - console.log(String(card.number).split('').length); - if (String(card.number).split('').length < 16) { - console.log('less than 16'); - reject('Card number invalid'); - } else { - Stripe.setPublishableKey('pk_test_hh5vsZ7wNnMi80XJgzHVanEm'); - Stripe.card.createToken({ - number: card.number, - cvc: card.cvc, - exp_month: card.month, - exp_year: card.year - }, function (status, response) { - if (status === 200) { - resolve(response.id); - console.log(response); - } else if (response.error.message.indexOf('required param: exp_year') !== -1) { - reject('Missing expiry year'); - } else { - console.log(response.error.message); - reject(response.error.message); - } - }); - } - }); - }, - createCustomer: function createCustomer(token, planName, cycle, taxPercent) { - return new Promise(function (resolve, reject) { - _jquery2.default.ajax({ - type: 'POST', - url: 'https://baas.kinvey.com/rpc/' + _store2.default.settings.appKey + '/custom/charge', - data: { - plan: planName + '-' + cycle.trim(), - source: token, - email: _store2.default.session.get('email'), - tax_percent: taxPercent - }, - success: function success(customer) { - console.log(customer); - _store2.default.session.set('stripe', customer); - - var type = 0; - if (planName === 'basic') { - type = 1; - } else if (planName === 'premium') { - type = 2; - } else if (planName === 'business') { - type = 3; - } else if (planName === 'fund') { - type = 4; - } - _store2.default.session.set('type', type); - - _store2.default.session.signup(_store2.default.session.get('email'), _store2.default.session.get('password')); - resolve(); - }, - error: function error(response) { - console.error(response); - reject(JSON.parse(response.responseText).error); - } - }); - }); - }, - cancelSubscription: function cancelSubscription() { - console.log(_store2.default.session.get('stripe').subscriptions.data[0].id); - _jquery2.default.ajax({ - type: 'POST', - url: 'https://baas.kinvey.com/rpc/' + _store2.default.settings.appKey + '/custom/cancelsub', - data: { - subId: _store2.default.session.get('stripe').subscriptions.data[0].id - }, - success: function success(subscription) { - - var customer = _store2.default.session.get('stripe'); - customer.subscriptions = { data: [subscription] }; - _store2.default.session.set('stripe', customer); - - _store2.default.session.updateUser(); - }, - fail: function fail(e) { - console.error('failed cancelation: ', e); - } - }); - }, - updateSubscription: function updateSubscription(planName, cycle) { - // console.log(planName, cycle); - // console.log(store.session.get('stripe').subscriptions.data[0].plan.metadata.plan_name); - return new Promise(function (resolve, reject) { - if (planName !== _store2.default.session.get('stripe').subscriptions.data[0].plan.metadata.plan_name) { - _jquery2.default.ajax({ - type: 'POST', - url: 'https://baas.kinvey.com/rpc/' + _store2.default.settings.appKey + '/custom/updatesub', - data: { - plan: planName + '-' + cycle, - subId: _store2.default.session.get('stripe').subscriptions.data[0].id - }, - success: function success(subscription) { - console.log('successfully changed subscription: ', subscription); - - var customer = _store2.default.session.get('stripe'); - customer.subscriptions = { data: [subscription] }; - _store2.default.session.set('stripe', customer); - - var type = 0; - if (planName === 'basic') { - type = 1; - } else if (planName === 'premium') { - type = 2; - } else if (planName === 'business') { - type = 3; - } else if (planName === 'fund') { - type = 4; - } - _store2.default.session.set('type', type); - - _store2.default.session.updateUser(); - resolve(); - }, - fail: function fail(e) { - console.error('failed changing subscription: ', e); - reject(e); - } - }); - } - }); - }, - newSubscription: function newSubscription(planName, cycle) { - // console.log(store.session.get('stripe').customer); - // console.log(planName+'-'+cycle), - console.log('creating a new subscription'); - return new Promise(function (resolve, reject) { - _jquery2.default.ajax({ - type: 'POST', - url: 'https://baas.kinvey.com/rpc/' + _store2.default.settings.appKey + '/custom/newsub', - data: { - plan: planName + '-' + cycle, - customer: _store2.default.session.get('stripe').sources.data[0].customer - }, - success: function success(subscription) { - console.log('successfully created new subscription: ', subscription); - - var customer = _store2.default.session.get('stripe'); - customer.subscriptions = { data: [subscription] }; - _store2.default.session.set('stripe', customer); - - var type = 0; - if (planName === 'basic') { - type = 1; - } else if (planName === 'premium') { - type = 2; - } else if (planName === 'business') { - type = 3; - } else if (planName === 'fund') { - type = 4; - } - _store2.default.session.set('type', type); - - _store2.default.session.updateUser(); - resolve(); - }, - fail: function fail(e) { - console.error('failed creating subscription: ', e); - reject(); - } - }); - }); - } -}; - -exports.default = cc; - -},{"./data/countries":68,"./store":78,"jquery":299,"underscore":553}],4:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _backbone = require('backbone'); - -var _backbone2 = _interopRequireDefault(_backbone); - -var _Article = require('../models/Article'); - -var _Article2 = _interopRequireDefault(_Article); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Articles = _backbone2.default.Collection.extend({ - url: 'https://baas.kinvey.com/appdata/kid_rJRC6m9F/articles', - model: _Article2.default -}); - -exports.default = Articles; - -},{"../models/Article":71,"backbone":80}],5:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _backbone = require('backbone'); - -var _backbone2 = _interopRequireDefault(_backbone); - -var _Newsletter = require('../models/Newsletter'); - -var _Newsletter2 = _interopRequireDefault(_Newsletter); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var NewsletterSubs = _backbone2.default.Collection.extend({ - url: 'https://baas.kinvey.com/appdata/kid_rJRC6m9F/newsletter', - model: _Newsletter2.default -}); - -exports.default = NewsletterSubs; - -},{"../models/Newsletter":73,"backbone":80}],6:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _backbone = require('backbone'); - -var _backbone2 = _interopRequireDefault(_backbone); - -var _Plan = require('../models/Plan'); - -var _Plan2 = _interopRequireDefault(_Plan); - -var _store = require('../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Plans = _backbone2.default.Collection.extend({ - url: 'https://baas.kinvey.com/appdata/kid_rJRC6m9F/api', - model: _Plan2.default -}); - -exports.default = Plans; - -},{"../models/Plan":74,"../store":78,"backbone":80}],7:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _backbone = require('backbone'); - -var _backbone2 = _interopRequireDefault(_backbone); - -var _Visit = require('../models/Visit'); - -var _Visit2 = _interopRequireDefault(_Visit); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Visits = _backbone2.default.Collection.extend({ - url: 'https://baas.kinvey.com/appdata/kid_rJRC6m9F/visits', - model: _Visit2.default -}); - -exports.default = Visits; - -},{"../models/Visit":76,"backbone":80}],8:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _reactRouter = require('react-router'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var NotFoundPage = _react2.default.createClass({ - displayName: 'NotFoundPage', - render: function render() { - return _react2.default.createElement( - 'div', - { className: 'page-not-found' }, - _react2.default.createElement('img', { src: '/assets/images/logo_vertical.svg' }), - _react2.default.createElement( - 'h1', - null, - 'WHOOPS' - ), - _react2.default.createElement( - 'p', - null, - 'We couldn\'t find the page you were looking for.' - ), - _react2.default.createElement( - _reactRouter.Link, - { className: 'filled-btn', to: '/' }, - 'Back to safety' - ) - ); - } -}); - -exports.default = NotFoundPage; - -},{"react":538,"react-router":361}],9:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _underscore = require('underscore'); - -var _underscore2 = _interopRequireDefault(_underscore); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Modal = _react2.default.createClass({ - displayName: 'Modal', - - closeModal: function closeModal(e) { - if (_underscore2.default.toArray(e.target.classList).indexOf('modal-container') !== -1) { - this.props.closeModal(e); - } - }, - render: function render() { - return _react2.default.createElement( - 'div', - { onClick: this.closeModal, className: 'modal-container', style: this.props.containerStyles }, - _react2.default.createElement( - 'div', - { onScroll: this.scroll, className: 'modal', style: this.props.modalStyles, ref: 'modal' }, - this.props.children - ) - ); - } -}); - -exports.default = Modal; - -},{"jquery":299,"react":538,"underscore":553}],10:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _reactDropzone = require('react-dropzone'); - -var _reactDropzone2 = _interopRequireDefault(_reactDropzone); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var AdminAPI = _react2.default.createClass({ - displayName: 'AdminAPI', - onDrop: function onDrop(files) { - /* ACCEPTABLE FILENAMES */ - var filenames = ["annual_basic.json", "annual_premium.json", "annual_business.json", "annual_fund.json", "monthly_basic.json", "monthly_premium.json", "monthly_business.json", "monthly_fund.json", "weekly_basic.json", "weekly_premium.json", "weekly_business.json", "weekly_fund.json"]; - - var badFiles = files.filter(function (file, i) { - console.log(i); - if (filenames.indexOf(file.name) === -1) { - return true; - } - }); - - if (badFiles.length > 0) { - // console.error('Bad file name! ', badFiles) - _store2.default.session.set('notification', { - text: 'Bad file name: ' + badFiles[0].name, - type: 'error' - }); - return null; - } else { - var basicFiles = files.filter(function (file) { - if (file.name.indexOf('basic') > -1) { - return true; - } - }); - var premiumFiles = files.filter(function (file) { - if (file.name.indexOf('premium') > -1) { - return true; - } - }); - var businessFiles = files.filter(function (file) { - if (file.name.indexOf('business') > -1) { - return true; - } - }); - var fundFiles = files.filter(function (file) { - if (file.name.indexOf('fund') > -1) { - return true; - } - }); - - if (basicFiles.length > 0) { - _store2.default.plans.get('basic').updateData(basicFiles); - } - if (premiumFiles.length > 0) { - _store2.default.plans.get('premium').updateData(premiumFiles); - } - if (businessFiles.length > 0) { - _store2.default.plans.get('business').updateData(businessFiles); - } - if (fundFiles.length > 0) { - _store2.default.plans.get('fund').updateData(fundFiles); - } - } - }, - render: function render() { - return _react2.default.createElement( - 'div', - { className: 'admin-api' }, - _react2.default.createElement( - 'div', - { className: 'wrapper white' }, - _react2.default.createElement( - 'h2', - null, - 'Upload JSON files' - ), - _react2.default.createElement( - _reactDropzone2.default, - { className: 'dropzone', onDrop: this.onDrop }, - _react2.default.createElement( - 'div', - null, - _react2.default.createElement( - 'h3', - null, - 'Drag and drop JSON files here' - ), - _react2.default.createElement('img', { src: '/assets/icons/json_icon.svg' }) - ) - ) - ) - ); - } -}); - -exports.default = AdminAPI; - -},{"../../store":78,"react":538,"react-dropzone":307}],11:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _underscore = require('underscore'); - -var _underscore2 = _interopRequireDefault(_underscore); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _admin = require('../../admin'); - -var _admin2 = _interopRequireDefault(_admin); - -var _AdminPanelHeader = require('./AdminPanelHeader'); - -var _AdminPanelHeader2 = _interopRequireDefault(_AdminPanelHeader); - -var _BrowserPieChart = require('./BrowserPieChart'); - -var _BrowserPieChart2 = _interopRequireDefault(_BrowserPieChart); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var AdminPanel = _react2.default.createClass({ - displayName: 'AdminPanel', - getInitialState: function getInitialState() { - return { visitors: _admin2.default.visits.toJSON() }; - }, - componentDidMount: function componentDidMount() { - _admin2.default.visits.on('change update', this.updateState); - _admin2.default.visits.fetch(); - }, - componentWillUnmount: function componentWillUnmount() { - _admin2.default.visits.off('change update', this.updateState); - }, - updateState: function updateState() { - this.setState({ visitors: _admin2.default.visits.toJSON() }); - }, - render: function render() { - // console.log(this.state.visitors); - // let fixedVisitors = this.state.visitors.reduce((returnSoFar, visitor) => { - // visitor.amount = 1 - // let index = 0 - // let duplicates = returnSoFar.filter((vtor, i) => { - // if (vtor.location.city === visitor.location.city) { - // index = i - // return true - // } - // }) - // - // if (duplicates.length === 0) { - // returnSoFar.push(visitor) - // } else { - // console.log('else running'); - // let newVisitor = returnSoFar[index] - // newVisitor.amount += 1 - // returnSoFar = returnSoFar.splice(0,index).concat(newVisitor, returnSoFar.splice(index + 1)) - // } - // return returnSoFar - // }, []) - // console.log('fixed: ', fixedVisitors); - - // let max = 1; - // let min = 15; - - - var images = this.state.visitors.map(function (visitor) { - - // if (visitor.amount > max) { - // max = visitor.amount - // } - // let size = visitor.amount / max * 20 - // if (size <= 5) { - // size = 5 - // } - - // console.log(visitor); - var color = visitor.type > 0 && visitor.type < 5 ? '#27A5F9' : visitor.type === 5 ? '#da1354' : '#12D99E'; - - return { - "type": "circle", - "theme": "light", - - "width": 10, - "height": 10, - "color": color, - "longitude": visitor.location.longitude, - "latitude": visitor.location.latitude, - "title": visitor.location.country_name + '
' + visitor.location.city + '
' - }; - }); - - var map = _react2.default.createElement(AmCharts.React, { - "class": "map", - "type": "map", - "theme": "light", - "projection": "eckert6", - "dataProvider": { - "map": "worldLow", - "getAreasFromMap": true, - "images": images - }, - "areasSettings": { - "autoZoom": true, - "rollOverColor": "#ccc", - "selectedColor": "#ccc", - "color": "#26262C" - }, - "export": { - "enabled": true - } - }); - var ChromeUsers = this.state.visitors.filter(function (visitor) { - return visitor.browser === 'Chrome' ? true : false; - }).length; - var FirefoxUsers = this.state.visitors.filter(function (visitor) { - return visitor.browser === 'Firefox' ? true : false; - }).length; - var IEUsers = this.state.visitors.filter(function (visitor) { - return visitor.browser === 'IE' ? true : false; - }).length; - var EdgeUsers = this.state.visitors.filter(function (visitor) { - return visitor.browser === 'Edge' ? true : false; - }).length; - var SafariUSers = this.state.visitors.filter(function (visitor) { - return visitor.browser === 'Safari' ? true : false; - }).length; - var OtherUsers = this.state.visitors.length - ChromeUsers - FirefoxUsers - IEUsers - EdgeUsers - SafariUSers; - - //

Unique visitors

- return _react2.default.createElement( - 'div', - { className: 'admin-panel' }, - _react2.default.createElement(_AdminPanelHeader2.default, null), - _react2.default.createElement( - 'div', - { className: 'unqiue-visiotrs' }, - _react2.default.createElement( - 'div', - { className: 'visitor-map' }, - map - ) - ), - _react2.default.createElement( - 'div', - { className: 'browsers-container' }, - _react2.default.createElement( - 'h2', - null, - 'Browsers' - ), - _react2.default.createElement( - 'div', - { className: 'browsers' }, - _react2.default.createElement(_BrowserPieChart2.default, { title: 'Chrome', max: this.state.visitors.length, value: ChromeUsers }), - _react2.default.createElement(_BrowserPieChart2.default, { title: 'Safari', max: this.state.visitors.length, value: SafariUSers }), - _react2.default.createElement(_BrowserPieChart2.default, { title: 'Firefox', max: this.state.visitors.length, value: FirefoxUsers }), - _react2.default.createElement(_BrowserPieChart2.default, { title: 'IE', max: this.state.visitors.length, value: IEUsers }), - _react2.default.createElement(_BrowserPieChart2.default, { title: 'Edge', max: this.state.visitors.length, value: EdgeUsers }), - _react2.default.createElement(_BrowserPieChart2.default, { title: 'Other', max: this.state.visitors.length, value: OtherUsers }) - ) - ) - ); - } -}); - -exports.default = AdminPanel; - -},{"../../admin":1,"./AdminPanelHeader":12,"./BrowserPieChart":16,"react":538,"underscore":553}],12:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -var _admin = require('../../admin'); - -var _admin2 = _interopRequireDefault(_admin); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var AdminPanelHeader = _react2.default.createClass({ - displayName: 'AdminPanelHeader', - getInitialState: function getInitialState() { - return { - fetched: false, - visitors: _admin2.default.visits.toJSON(), - newsletterSubs: _admin2.default.newsletterSubs.toJSON() - }; - }, - componentDidMount: function componentDidMount() { - _admin2.default.visits.on('update', this.updateState); - _admin2.default.newsletterSubs.on('update', this.updateState); - _admin2.default.visits.fetch(); - _admin2.default.newsletterSubs.fetch(); - }, - componentWillUnmount: function componentWillUnmount() { - _admin2.default.visits.off('change update', this.updateState); - }, - updateState: function updateState() { - // console.log(admin.visits.toJSON()); - this.setState({ visitors: _admin2.default.visits.toJSON() }); - this.setState({ newsletterSubs: _admin2.default.newsletterSubs.toJSON() }); - }, - render: function render() { - var subscribers = this.state.visitors.filter(function (visitor) { - if (visitor.type > 0 && visitor.type < 5) { - return true; - } else { - return false; - } - }); - var trials = this.state.visitors.filter(function (visitor) { - if (visitor.type === 0) { - return true; - } else { - return false; - } - }); - - var conversionRate = 0.00; - if (subscribers.length !== 0) { - conversionRate = 100 - this.state.visitors.length / subscribers.length * 100; - } - return _react2.default.createElement( - 'section', - { className: 'suggestion-header' }, - _react2.default.createElement( - 'ul', - null, - _react2.default.createElement( - 'li', - { className: 'panel cagr blue' }, - _react2.default.createElement( - 'div', - { className: 'symbol' }, - _react2.default.createElement('i', { className: 'fa fa-users white-color' }) - ), - _react2.default.createElement( - 'div', - { className: 'value' }, - _react2.default.createElement( - 'h3', - { className: 'white-color' }, - this.state.visitors.length - ), - _react2.default.createElement( - 'p', - { className: 'white-color' }, - 'Unique Visitors' - ) - ) - ), - _react2.default.createElement( - 'li', - { className: 'panel profitable-stocks white gray-border' }, - _react2.default.createElement( - 'div', - { className: 'symbol' }, - _react2.default.createElement('i', { className: 'fa fa-flask blue-color' }) - ), - _react2.default.createElement( - 'div', - { className: 'value' }, - _react2.default.createElement( - 'h3', - { className: 'blue-color' }, - subscribers.length - ), - _react2.default.createElement( - 'p', - { className: 'blue-color' }, - 'Subscribers' - ) - ) - ), - _react2.default.createElement( - 'li', - { className: 'panel green' }, - _react2.default.createElement( - 'div', - { className: 'symbol' }, - _react2.default.createElement('i', { className: 'fa fa-list white-color' }) - ), - _react2.default.createElement( - 'div', - { className: 'value' }, - _react2.default.createElement( - 'h3', - { className: 'white-color' }, - trials.length - ), - _react2.default.createElement( - 'p', - { className: 'white-color' }, - 'Trials' - ) - ) - ), - _react2.default.createElement( - 'li', - { className: 'panel white gray-border' }, - _react2.default.createElement( - 'div', - { className: 'symbol' }, - _react2.default.createElement('i', { className: 'fa fa-paper-plane green-color' }) - ), - _react2.default.createElement( - 'div', - { className: 'value white' }, - _react2.default.createElement( - 'h3', - { className: 'green-color' }, - this.state.newsletterSubs.length - ), - _react2.default.createElement( - 'p', - { className: 'green-color' }, - 'Newsletter subs.' - ) - ) - ) - ) - ); - } -}); - -exports.default = AdminPanelHeader; - -},{"../../admin":1,"../../store":78,"react":538}],13:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _draftJsExportHtml = require('draft-js-export-html'); - -var _draftJs = require('draft-js'); - -var _reactHtmlParser = require('react-html-parser'); - -var _reactHtmlParser2 = _interopRequireDefault(_reactHtmlParser); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Article = _react2.default.createClass({ - displayName: 'Article', - getInitialState: function getInitialState() { - return { article: _store2.default.articles.data.get(this.props.id).toJSON() }; - }, - updateState: function updateState() { - this.setState({ article: _store2.default.articles.data.get(this.props.id).toJSON() }); - }, - componentDidMount: function componentDidMount() { - _store2.default.articles.data.fetch({ success: this.updateState }); - _store2.default.articles.data.on('change update', this.updateState); - }, - componentWillUnmount: function componentWillUnmount() { - _store2.default.articles.data.off('update', this.updateState); - }, - render: function render() { - var article = void 0; - if (this.state.article) { - var rawData = this.state.article.content; - var contentState = (0, _draftJs.convertFromRaw)(rawData); - var articleHtml = (0, _draftJsExportHtml.stateToHTML)(contentState); - console.log(this.state.article); - var imageCounter = 0; - while (imageCounter < this.state.article.images.length) { - var startPoint = articleHtml.indexOf('
'); - var endPoint = articleHtml.indexOf('
'); - articleHtml = articleHtml.slice(0, startPoint).concat('').concat(articleHtml.slice(endPoint + 9)); - imageCounter++; - } - while (articleHtml.indexOf(' ') > -1) { - articleHtml = articleHtml.replace(' ', '

'); - } - - console.log(articleHtml); - - article = (0, _reactHtmlParser2.default)(articleHtml); - } - - return _react2.default.createElement( - 'div', - { className: 'article' }, - _react2.default.createElement( - 'h2', - { className: 'title' }, - this.state.article.title - ), - _react2.default.createElement( - 'div', - { className: 'article-content' }, - article - ) - ); - } -}); - -exports.default = Article; - -},{"../../store":78,"draft-js":125,"draft-js-export-html":107,"react":538,"react-html-parser":317}],14:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _underscore = require('underscore'); - -var _underscore2 = _interopRequireDefault(_underscore); - -var _draftJsExportHtml = require('draft-js-export-html'); - -var _draftJs = require('draft-js'); - -var _reactHtmlParser = require('react-html-parser'); - -var _reactHtmlParser2 = _interopRequireDefault(_reactHtmlParser); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -var _Modal = require('../Modal'); - -var _Modal2 = _interopRequireDefault(_Modal); - -var _Article = require('./Article'); - -var _Article2 = _interopRequireDefault(_Article); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Articles = _react2.default.createClass({ - displayName: 'Articles', - getInitialState: function getInitialState() { - return { articles: _store2.default.articles.data.toJSON(), modal: false }; - }, - updateState: function updateState() { - var modal = false; - if (this.props.params.article) { - modal = this.props.params.article; - } - this.setState({ articles: _store2.default.articles.data.toJSON(), modal: modal }); - }, - componentDidMount: function componentDidMount() { - _store2.default.articles.data.fetch({ success: this.updateState }); - }, - gotoArticle: function gotoArticle(id) { - this.setState({ modal: id }); - _store2.default.settings.history.push('/dashboard/articles/' + id); - }, - closeModal: function closeModal(e) { - if (_underscore2.default.toArray(e.target.classList).indexOf('article-modal-container') > -1 || _underscore2.default.toArray(e.target.classList).indexOf('close-btn') > -1 || _underscore2.default.toArray(e.target.classList).indexOf('fa-times') > -1) { - this.setState({ modal: false }); - _store2.default.settings.history.push('/dashboard/articles'); - } - }, - render: function render() { - var _this = this; - - var modal = void 0; - if (this.state.modal) { - modal = _react2.default.createElement( - 'div', - { className: 'article-modal-container', onClick: this.closeModal }, - _react2.default.createElement( - 'div', - { className: 'article-modal' }, - _react2.default.createElement( - 'button', - { onClick: this.closeModal, className: 'close-btn' }, - _react2.default.createElement('i', { className: 'fa fa-times', 'aria-hidden': 'true' }) - ), - _react2.default.createElement(_Article2.default, { id: this.props.params.article }) - ) - ); - } - - var articles = this.state.articles.map(function (article, i) { - - var rawData = article.content; - var contentState = (0, _draftJs.convertFromRaw)(rawData); - var previewText = (0, _draftJsExportHtml.stateToHTML)(contentState); - - var endIndex = previewText.indexOf('/p'); - previewText = previewText.slice(3, endIndex - 1); - previewText = previewText.slice(0, 150); - while (previewText.indexOf(' ') > -1) { - previewText = previewText.replace(' ', '

'); - } - previewText = (0, _reactHtmlParser2.default)(previewText); - - return _react2.default.createElement( - 'li', - { key: i, className: 'article-preview', onClick: _this.gotoArticle.bind(null, article._id) }, - _react2.default.createElement( - 'h3', - null, - article.title - ), - previewText - ); - }); - return _react2.default.createElement( - 'div', - { className: 'articles' }, - _react2.default.createElement( - 'ul', - null, - articles - ), - modal - ); - } -}); - -exports.default = Articles; - -},{"../../store":78,"../Modal":9,"./Article":13,"draft-js":125,"draft-js-export-html":107,"react":538,"react-html-parser":317,"underscore":553}],15:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _moment = require('moment'); - -var _moment2 = _interopRequireDefault(_moment); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Breadcrumbs = _react2.default.createClass({ - displayName: 'Breadcrumbs', - getInitialState: function getInitialState() { - return { fetched: false }; - }, - componentDidMount: function componentDidMount() { - _store2.default.plans.on('update', this.updateState); - }, - updateState: function updateState() { - this.setState({ fetched: true }); - }, - render: function render() { - var _this = this; - - var plans = ['basic', 'premium', 'business', 'fund']; - var planName = ''; - - plans.forEach(function (plan) { - if (_this.props.location.indexOf(plan) > -1) { - planName = plan; - } - }); - - var page = void 0; - if (this.props.location.indexOf('portfolio') > -1) { - page = 'Portfolio'; - } else if (this.props.location.indexOf('suggestions') > -1) { - page = 'Suggestions'; - } else { - return null; - } - - var lastUpdated = void 0; - if (page === 'Suggestions' && _store2.default.plans.get(planName).get('suggestions')[0]) { - var date = _store2.default.plans.get(planName).get('suggestions')[0].date; - lastUpdated = (0, _moment2.default)(date.year + date.month + date.date, 'YYYYMMDD').format('MMMM D, YYYY'); - } else if (page === 'Portfolio' && _store2.default.plans.get(planName).get('portfolio')[0]) { - var _date = _store2.default.plans.get(planName).get('portfolio')[0].date; - lastUpdated = (0, _moment2.default)(_date.year + _date.month + _date.date, 'YYYYMMDD').format('MMMM D, YYYY'); - } - - return _react2.default.createElement( - 'div', - { className: 'breadcrumbs' }, - _react2.default.createElement( - 'p', - null, - page, - ' ', - _react2.default.createElement('i', { className: 'fa fa-chevron-right', 'aria-hidden': 'true' }), - ' ', - _react2.default.createElement( - 'span', - { className: 'blue-color capitalize' }, - planName - ) - ), - _react2.default.createElement( - 'p', - null, - 'Last updated: ', - _react2.default.createElement( - 'span', - null, - lastUpdated - ) - ) - ); - } -}); - -exports.default = Breadcrumbs; - -},{"../../store":78,"moment":300,"react":538}],16:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require("react"); - -var _react2 = _interopRequireDefault(_react); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var BrowserPieChart = _react2.default.createClass({ - displayName: "BrowserPieChart", - render: function render() { - var config = { - "type": "pie", - "dataProvider": [{ - "title": this.props.title, - "value": this.props.value - }, { - "title": "", - "value": this.props.max - this.props.value - }], - "titleField": "title", - "valueField": "value", - "balloonText": "[[value]]", - "radius": "40%", - "innerRadius": "70%", - labelsEnabled: false, - colors: ['#27A5F9', '#F3F3F3'] - }; - - return _react2.default.createElement( - "div", - { className: "browserChart" }, - _react2.default.createElement(AmCharts.React, config), - _react2.default.createElement( - "h3", - null, - this.props.title - ) - ); - } -}); - -exports.default = BrowserPieChart; - -},{"react":538}],17:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -var _Nav = require('./Nav'); - -var _Nav2 = _interopRequireDefault(_Nav); - -var _SideBar = require('./SideBar'); - -var _SideBar2 = _interopRequireDefault(_SideBar); - -var _Breadcrumbs = require('./Breadcrumbs'); - -var _Breadcrumbs2 = _interopRequireDefault(_Breadcrumbs); - -var _Notification = require('./Notification'); - -var _Notification2 = _interopRequireDefault(_Notification); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Dashboard = _react2.default.createClass({ - displayName: 'Dashboard', - getInitialState: function getInitialState() { - return { fetched: false }; - }, - componentWillMount: function componentWillMount() { - if (!localStorage.authtoken) { - _store2.default.settings.history.push('/'); - } - }, - componentDidMount: function componentDidMount() { - _store2.default.session.on('change', this.updateState); - }, - componentWillUnmount: function componentWillUnmount() { - _store2.default.session.off('change', this.updateState); - }, - updateState: function updateState() { - this.setState({ fetched: true }); - }, - render: function render() { - if (!_store2.default.session.get('stripe').subscriptions) { - return null; - } - - var plan = this.props.params.plan; - if (!plan && !_store2.default.session.get('stripe').canceled_at && _store2.default.session.get('stripe').canceled_at !== null) { - plan = _store2.default.session.get('stripe').subscriptions.data[0].plan.id; - plan = plan.slice(0, plan.indexOf('-')); - } - - if (!plan && _store2.default.session.get('stripe').canceled_at) { - plan = 'basic'; - } - - var notification = void 0; - if (_store2.default.session.get('notification')) { - notification = _react2.default.createElement(_Notification2.default, { text: _store2.default.session.get('notification').text, type: _store2.default.session.get('notification').type }); - } - - return _react2.default.createElement( - 'div', - { className: 'dashboard' }, - _react2.default.createElement(_Nav2.default, null), - _react2.default.createElement( - 'div', - { className: 'container' }, - _react2.default.createElement(_SideBar2.default, { plan: plan, location: this.props.location.pathname }), - _react2.default.createElement( - 'div', - { className: 'db-content' }, - notification, - _react2.default.createElement(_Breadcrumbs2.default, { location: this.props.location.pathname, plan: plan }), - _react2.default.cloneElement(this.props.children, { plan: plan, location: this.props.location.pathname }) - ) - ) - ); - } -}); - -exports.default = Dashboard; - -},{"../../store":78,"./Breadcrumbs":15,"./Nav":19,"./Notification":21,"./SideBar":32,"react":538}],18:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _moment = require('moment'); - -var _moment2 = _interopRequireDefault(_moment); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -var _cc = require('../../cc'); - -var _cc2 = _interopRequireDefault(_cc); - -var _Modal = require('../Modal'); - -var _Modal2 = _interopRequireDefault(_Modal); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var MyAccount = _react2.default.createClass({ - displayName: 'MyAccount', - getInitialState: function getInitialState() { - var currPlan = 'premium'; - if (_store2.default.session.get('stripe').subscriptions && !_store2.default.session.get('stripe').subscriptions.data[0].canceled_at !== null) { - currPlan = _store2.default.session.get('stripe').subscriptions.data[0].plan.id; - currPlan = currPlan.slice(0, currPlan.indexOf('-')); - } else { - currPlan = 'unsubscribed'; - } - return { selectedPlan: false, showModal: false, charging: false, currPlan: currPlan }; - }, - cancelSubscription: function cancelSubscription() { - _cc2.default.cancelSubscription(); - }, - selectPlan: function selectPlan(plan) { - this.setState({ selectedPlan: plan }); - }, - changePlan: function changePlan() { - var _this = this; - - this.setState({ charging: true }); - var cycle = 'monthly'; - if (this.state.selectedPlan === 'business' || this.state.selectedPlan === 'fund') { - cycle = 'annually'; - } - if (this.state.currPlan !== 'unsubscribed') { - _cc2.default.updateSubscription(this.state.selectedPlan, cycle).then(function () { - _store2.default.session.set('notification', { - text: 'You are now subscribed to the ' + _this.state.selectedPlan + ' formula', - type: 'notification' - }); - _this.setState({ charging: false, showModal: false }); - }).catch(function () { - _store2.default.session.set('notification', { - text: 'Failed to change plan', - type: 'error' - }); - _this.setState({ charging: false, showModal: false }); - }); - } else { - _cc2.default.newSubscription(this.state.selectedPlan, cycle).then(function () { - _store2.default.session.set('notification', { - text: 'You are now subscribed to the ' + _this.state.selectedPlan + ' formula', - type: 'notification' - }); - _this.setState({ charging: false, showModal: false }); - }).catch(function () { - _store2.default.session.set('notification', { - text: 'Failed to subscribe to the ' + _this.state.selectedPlan + ' formula', - type: 'error' - }); - _this.setState({ charging: false, showModal: false }); - }); - } - }, - showConfirmationModal: function showConfirmationModal() { - if (this.state.selectedPlan) { - this.setState({ showModal: 'confirmation' }); - } - }, - closeModal: function closeModal() { - this.setState({ showModal: false }); - }, - newSubscription: function newSubscription() { - var cycle = 'monthly'; - if (this.state.selectedPlan === 'business' || this.state.selectedPlan === 'fund') { - cycle = 'annually'; - } - _cc2.default.newSubscription(this.state.selectedPlan, cycle); - }, - render: function render() { - - var basicClass = 'white'; - var premiumClass = 'white'; - var businessClass = 'white'; - var fundClass = 'white'; - - if (this.state.selectedPlan === 'basic') { - basicClass = 'blue selected'; - } else if (this.state.selectedPlan === 'premium') { - premiumClass = 'blue selected'; - } else if (this.state.selectedPlan === 'business') { - businessClass = 'blue selected'; - } else if (this.state.selectedPlan === 'fund') { - fundClass = 'blue selected'; - } - - var currPlan = void 0; - if (_store2.default.session.get('stripe').subscriptions && !_store2.default.session.get('stripe').subscriptions.data[0].canceled_at !== null) { - currPlan = _store2.default.session.get('stripe').subscriptions.data[0].plan.id; - currPlan = currPlan.slice(0, currPlan.indexOf('-')); - currPlan = currPlan + ' formula'; - } - - if (_store2.default.session.get('stripe').subscriptions.data[0].canceled_at !== null) { - currPlan = 'Unsubscribed'; - } - - var changePlanBtn = _react2.default.createElement( - 'button', - { onClick: this.showConfirmationModal, className: 'change-plan filled-btn' }, - 'Next' - ); - - var bottomBtn = _react2.default.createElement( - 'button', - { onClick: this.cancelSubscription, className: 'filled-btn cancel-btn red' }, - 'Cancel subscription' - ); - var changeTitle = 'Change your subscription'; - if (_store2.default.session.get('stripe').subscriptions.data[0].canceled_at !== null) { - changePlanBtn = _react2.default.createElement( - 'button', - { onClick: this.showConfirmationModal, className: 'change-plan filled-btn' }, - 'Subscribe to: ', - _react2.default.createElement( - 'span', - { className: 'capitalize' }, - ' ', - this.state.selectedPlan - ) - ); - bottomBtn = undefined; - changeTitle = 'Select a plan'; - } - var basicDisabled = void 0, - premiumDisabled = void 0, - businessDisabled = void 0, - fundDisabled = false; - - if (currPlan === 'basic formula') { - basicClass = 'blue current';basicDisabled = true; - } else if (currPlan === 'premium formula') { - premiumClass = 'blue current';premiumDisabled = true; - } else if (currPlan === 'business formula') { - businessClass = 'blue current';businessDisabled = true; - } else if (currPlan === 'fund formula') { - fundClass = 'blue current';fundDisabled = true; - } - - console.log(_store2.default.session.get('stripe')); - var modal = void 0; - if (this.state.showModal) { - - var cycle = 'monthly'; - var price = void 0; - if (this.state.selectedPlan === 'basic') { - price = 50; - } else if (this.state.selectedPlan === 'premium') { - price = 100; - } else if (this.state.selectedPlan === 'business') { - price = 20000;cycle = "annually"; - } else if (this.state.selectedPlan === 'fund') { - price = 120000;cycle = "annually"; - } - - var modalStyles = { - maxWidth: '400px' - }; - - var chargeText = _react2.default.createElement( - 'p', - null, - 'We will charge ', - _react2.default.createElement( - 'span', - { className: 'bold' }, - '$', - _cc2.default.commafy(price) - ), - ' to the card on file.' - ); - if (_store2.default.plans.get(this.state.selectedPlan).get('type') < _store2.default.session.get('type')) { - chargeText = _react2.default.createElement( - 'p', - null, - 'on your next billing date we will charge ', - _react2.default.createElement( - 'span', - { className: 'bold' }, - '$', - _cc2.default.commafy(price) - ), - ' to the card on file.' - ); - } - - var chargeBtn = _react2.default.createElement( - 'button', - { className: 'filled-btn', onClick: this.changePlan }, - 'Subscribe for $', - _cc2.default.commafy(price), - ' ', - cycle - ); - if (this.state.charging) { - chargeBtn = _react2.default.createElement( - 'button', - { className: 'filled-btn' }, - _react2.default.createElement('i', { className: 'fa fa-spinner fa-pulse fa-2x fa-fw white-color' }) - ); - } - - modal = _react2.default.createElement( - _Modal2.default, - { closeModal: this.closeModal, modalStyles: modalStyles }, - _react2.default.createElement( - 'div', - { className: 'change-plan-confirmation' }, - _react2.default.createElement( - 'h2', - null, - 'Confirm plan change' - ), - chargeText, - _react2.default.createElement( - 'p', - { className: 'card-on-file' }, - _react2.default.createElement('i', { className: 'fa fa-credit-card-alt', 'aria-hidden': 'true' }), - _store2.default.session.get('stripe').sources.data[0].last4 - ), - chargeBtn - ) - ); - } - - // console.log(store.session.get('stripe').subscriptions.data[0].current_period_end); - // console.log(moment.unix(store.session.get('stripe').subscriptions.data[0].current_period_end).format('DD MMMM YYYY')); - return _react2.default.createElement( - 'div', - { className: 'my-account-page' }, - _react2.default.createElement( - 'section', - { className: 'top' }, - _react2.default.createElement( - 'div', - { className: 'profile-info blue' }, - _react2.default.createElement( - 'h2', - { className: 'name white-color' }, - _store2.default.session.get('name') - ), - _react2.default.createElement( - 'h3', - { className: 'white-color capitalize' }, - _react2.default.createElement('i', { className: 'fa fa-flask white-color', 'aria-hidden': 'true' }), - ' ', - currPlan - ), - _react2.default.createElement( - 'h3', - { className: 'email white-color' }, - _react2.default.createElement('i', { className: 'fa fa-envelope white-color', 'aria-hidden': 'true' }), - _store2.default.session.get('email') - ), - _react2.default.createElement( - 'h3', - { className: 'billing-date white-color' }, - _react2.default.createElement('i', { className: 'fa fa-calendar white-color', 'aria-hidden': 'true' }), - 'Next billing date: ', - _moment2.default.unix(_store2.default.session.get('stripe').subscriptions.data[0].current_period_end).format('MMMM Do YYYY') - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'change-plan-container' }, - _react2.default.createElement( - 'h2', - null, - changeTitle - ), - _react2.default.createElement( - 'button', - { className: basicClass, disabled: basicDisabled, onClick: this.selectPlan.bind(null, 'basic') }, - _react2.default.createElement( - 'h3', - { className: 'plan-name' }, - 'Basic' - ), - _react2.default.createElement( - 'h3', - { className: 'price' }, - '$50', - _react2.default.createElement('br', null), - _react2.default.createElement( - 'span', - { className: 'disclaimer' }, - 'monthly' - ) - ) - ), - _react2.default.createElement( - 'button', - { className: premiumClass, disabled: premiumDisabled, onClick: this.selectPlan.bind(null, 'premium') }, - _react2.default.createElement( - 'h3', - { className: 'plan-name' }, - 'Premium' - ), - _react2.default.createElement( - 'h3', - { className: 'price' }, - '$100', - _react2.default.createElement('br', null), - _react2.default.createElement( - 'span', - { className: 'disclaimer' }, - 'monthly' - ) - ) - ), - _react2.default.createElement( - 'button', - { className: businessClass, disabled: businessDisabled, onClick: this.selectPlan.bind(null, 'business') }, - _react2.default.createElement( - 'h3', - { className: 'plan-name' }, - 'Business' - ), - _react2.default.createElement( - 'h3', - { className: 'price' }, - '$20,000', - _react2.default.createElement('br', null), - _react2.default.createElement( - 'span', - { className: 'disclaimer' }, - 'yearly' - ) - ) - ), - _react2.default.createElement( - 'button', - { className: fundClass, disabled: fundDisabled, onClick: this.selectPlan.bind(null, 'fund') }, - _react2.default.createElement( - 'h3', - { className: 'plan-name' }, - 'Fund' - ), - _react2.default.createElement( - 'h3', - { className: 'price' }, - '$120,000', - _react2.default.createElement('br', null), - _react2.default.createElement( - 'span', - { className: 'disclaimer' }, - 'yearly' - ) - ) - ), - changePlanBtn - ), - bottomBtn, - modal - ); - } -}); - -exports.default = MyAccount; - -},{"../../cc":3,"../../store":78,"../Modal":9,"moment":300,"react":538}],19:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _reactRouter = require('react-router'); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Nav = _react2.default.createClass({ - displayName: 'Nav', - getInitialState: function getInitialState() { - return { fetched: false }; - }, - componentDidMount: function componentDidMount() { - _store2.default.session.on('change', this.updateState); - }, - updateState: function updateState() { - this.setState({ fetched: true }); - }, - componentWillUnmount: function componentWillUnmount() { - _store2.default.session.off('change', this.updateState); - }, - - - //
- // {store.session.get('name')} - // - //
- render: function render() { - return _react2.default.createElement( - 'nav', - { className: 'dashboard-nav' }, - _react2.default.createElement( - _reactRouter.Link, - { to: '/' }, - _react2.default.createElement('img', { id: 'logo', src: '/assets/images/logo_horizontal.svg' }) - ) - ); - } -}); - -exports.default = Nav; - -},{"../../store":78,"react":538,"react-router":361}],20:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _RichEditor = require('./RichTextEditor/containers/RichEditor'); - -var _RichEditor2 = _interopRequireDefault(_RichEditor); - -var _reactDropzone = require('react-dropzone'); - -var _reactDropzone2 = _interopRequireDefault(_reactDropzone); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var NewArticle = _react2.default.createClass({ - displayName: 'NewArticle', - getInitialState: function getInitialState() { - return { image: '', submitArticle: false, title: '' }; - }, - onDrop: function onDrop(files) { - this.setState({ uploadedFile: files[0] }); - this.handleImageUpload(files[0]); - }, - receivedImage: function receivedImage(file) { - console.log('received image: ', file); - this.setState({ image: file.srcElement.result }); - }, - handleImageUpload: function handleImageUpload(file) { - var reader = new FileReader(); - reader.onload = this.receivedImage; - reader.readAsDataURL(file); - }, - submitArticle: function submitArticle() { - this.setState({ submitArticle: true, title: this.refs.title.value }); - }, - render: function render() { - var imgContainerStyles = void 0; - - if (this.state.image) { - imgContainerStyles = { - height: '400px', - backgroundImage: 'url("' + this.state.image + '")' - }; - } - - // - //
- //

Drag and drop an image here

- // - //
- //
- - var submitBtn = _react2.default.createElement( - 'button', - { className: 'filled-btn submit-article', onClick: this.submitArticle }, - 'Submit' - ); - if (this.state.submitArticle) { - submitBtn = _react2.default.createElement( - 'button', - { className: 'filled-btn submit-article' }, - _react2.default.createElement('i', { className: 'fa fa-spinner fa-pulse fa-fw' }) - ); - } - return _react2.default.createElement( - 'div', - { className: 'new-article' }, - _react2.default.createElement('div', { className: 'image-preview', style: imgContainerStyles }), - _react2.default.createElement( - 'div', - { className: 'editor' }, - _react2.default.createElement('input', { type: 'text', className: 'article-title', placeholder: 'Title', ref: 'title' }), - _react2.default.createElement(_RichEditor2.default, { uploadedFile: this.state.uploadedFile, submitArticle: this.state.submitArticle, title: this.state.title }), - submitBtn - ) - ); - } -}); - -exports.default = NewArticle; - -},{"./RichTextEditor/containers/RichEditor":29,"jquery":299,"react":538,"react-dropzone":307}],21:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Notification = _react2.default.createClass({ - displayName: 'Notification', - dismiss: function dismiss() { - _store2.default.session.set('notification', false); - }, - render: function render() { - return _react2.default.createElement( - 'div', - { className: 'notification ' + this.props.type }, - _react2.default.createElement( - 'p', - null, - this.props.text - ), - _react2.default.createElement( - 'button', - { className: 'dismiss', onClick: this.dismiss }, - _react2.default.createElement('i', { className: 'fa fa-times', 'aria-hidden': 'true' }) - ) - ); - } -}); - -exports.default = Notification; - -},{"../../store":78,"react":538}],22:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _underscore = require('underscore'); - -var _underscore2 = _interopRequireDefault(_underscore); - -var _reactRouter = require('react-router'); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -var _cc = require('../../cc'); - -var _cc2 = _interopRequireDefault(_cc); - -var _amcharts3React = require('../../libraries/amcharts3-react'); - -var _amcharts3React2 = _interopRequireDefault(_amcharts3React); - -var _PortfolioGraph = require('./PortfolioGraph'); - -var _PortfolioGraph2 = _interopRequireDefault(_PortfolioGraph); - -var _PortfolioItem = require('./PortfolioItem'); - -var _PortfolioItem2 = _interopRequireDefault(_PortfolioItem); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Portfolio = _react2.default.createClass({ - displayName: 'Portfolio', - getInitialState: function getInitialState() { - return { fetching: true, selectedStock: '' }; - }, - componentDidMount: function componentDidMount() { - _store2.default.plans.get(this.props.plan).on('change', this.updateState); - _store2.default.market.data.on('change', this.updateState); - _store2.default.market.data.getPortfolioData(); - }, - updateState: function updateState() { - this.setState({ fetching: false }); - }, - componentWillReceiveProps: function componentWillReceiveProps(newPlan) { - _store2.default.plans.get(newPlan.plan).on('change', this.updateState); - }, - componentWillUnmount: function componentWillUnmount() { - _store2.default.market.data.off('change', this.updateState); - _store2.default.plans.get('basic').off('change', this.updateState); - _store2.default.plans.get('premium').off('change', this.updateState); - _store2.default.plans.get('business').off('change', this.updateState); - _store2.default.plans.get('fund').off('change', this.updateState); - }, - expandStock: function expandStock(stock, e) { - if (_underscore2.default.toArray(e.target.classList)[0]) { - if (this.state.selectedStock !== stock.ticker) { - this.setState({ selectedStock: stock.ticker }); - } else { - this.setState({ selectedStock: '' }); - } - } else { - console.log('clicked: ', e.target.classList); - } - }, - render: function render() { - var _this = this; - - var holdings = void 0; - if (_store2.default.session.isAllowedToView(this.props.plan)) { - var portfolio = void 0; - portfolio = _store2.default.plans.get(this.props.plan).get('portfolio').map(function (stock, i) { - if (stock.name === 'CASH') { - - return _react2.default.createElement( - 'tbody', - { key: i, className: 'cash' }, - _react2.default.createElement( - 'tr', - null, - _react2.default.createElement( - 'td', - { className: 'stock-name' }, - _react2.default.createElement('i', { className: 'fa fa-usd', 'aria-hidden': 'true' }), - stock.name - ), - _react2.default.createElement( - 'td', - null, - stock.percentage_weight.toFixed(2), - '%' - ) - ) - ); - } - - if (_this.state.selectedStock !== stock.ticker) { - return _react2.default.createElement(_PortfolioItem2.default, { stock: stock, plan: _this.props.plan, key: stock.ticker, expandStock: _this.expandStock, number: i }); - } else { - return _react2.default.createElement(_PortfolioItem2.default, { stock: stock, plan: _this.props.plan, graph: true, key: stock.ticker, expandStock: _this.expandStock, number: i }); - } - }); - - holdings = _react2.default.createElement( - 'section', - { className: 'holdings' }, - _react2.default.createElement( - 'div', - { className: 'top' }, - _react2.default.createElement( - 'h2', - null, - 'Holdings' - ), - _react2.default.createElement( - 'h2', - { className: 'blue-color' }, - _store2.default.plans.get(this.props.plan).get('portfolio').length - 1, - ' stocks' - ) - ), - _react2.default.createElement( - 'table', - { className: 'portfolio-table' }, - _react2.default.createElement( - 'thead', - { className: 'labels' }, - _react2.default.createElement( - 'tr', - null, - _react2.default.createElement( - 'th', - null, - 'Name' - ), - _react2.default.createElement( - 'th', - null, - 'Allocation' - ), - _react2.default.createElement( - 'th', - null, - 'Change' - ), - _react2.default.createElement( - 'th', - null, - 'Bought at avg.' - ), - _react2.default.createElement( - 'th', - null, - 'Last price' - ), - _react2.default.createElement( - 'th', - null, - 'Days owned' - ) - ) - ), - portfolio - ) - ); - } else { - holdings = _react2.default.createElement( - 'section', - { className: 'no-permissions' }, - _react2.default.createElement( - 'h3', - null, - 'Upgrade to the ', - _react2.default.createElement( - 'span', - { className: 'capitalize blue-color ' }, - this.props.plan, - ' formula' - ), - ' to see this portfolio' - ), - _react2.default.createElement( - _reactRouter.Link, - { to: '/dashboard/account', className: 'filled-btn upgrade-your-plan' }, - 'Upgrade your plan' - ) - ); - } - - var startValue = void 0; - var marketStartValue = void 0; - if (_store2.default.plans.get(this.props.plan).get('portfolioYields')[0]) { - startValue = _store2.default.plans.get(this.props.plan).get('portfolioYields')[0].balance; - } - if (_store2.default.market.data.get('portfolioData')[0]) { - marketStartValue = _store2.default.market.data.get('portfolioData')[0]; - } - - var portfolioYieldsLength = _store2.default.plans.get(this.props.plan).get('portfolioYields').length; - var lastValue = 0; - var lastMarketValue = 0; - if (_store2.default.plans.get(this.props.plan).get('portfolioYields')[0]) { - lastValue = _store2.default.plans.get(this.props.plan).get('portfolioYields')[portfolioYieldsLength - 1].balance; - } - if (_store2.default.market.data.get('portfolioData')[0]) { - lastMarketValue = _store2.default.market.data.get('portfolioData')[portfolioYieldsLength - 1]; - } - - var FSPercent = _react2.default.createElement('i', { className: 'fa fa-circle-o-notch fa-spin fa-3x fa-fw Spinner' }); - if (lastValue && startValue) { - FSPercent = ((lastValue - startValue) / startValue * 100).toFixed(2); - } - - var SP500Percent = _react2.default.createElement('i', { className: 'fa fa-circle-o-notch fa-spin fa-3x fa-fw Spinner' }); - if (lastMarketValue && marketStartValue) { - SP500Percent = (lastMarketValue / marketStartValue * 100 - 100).toFixed(2); - } - - return _react2.default.createElement( - 'div', - { className: 'portfolio' }, - _react2.default.createElement( - 'section', - { className: 'portfolio-yields' }, - _react2.default.createElement( - 'div', - { className: 'left' }, - _react2.default.createElement( - 'h2', - null, - 'Portfolio yields' - ), - _react2.default.createElement(_PortfolioGraph2.default, { plan: this.props.plan }) - ), - _react2.default.createElement( - 'div', - { className: 'right' }, - _react2.default.createElement( - 'div', - { className: 'fs stats' }, - _react2.default.createElement( - 'h3', - { className: 'fs-plan blue-color' }, - _react2.default.createElement( - 'span', - { className: 'capitalize' }, - this.props.plan - ), - ' formula' - ), - _react2.default.createElement( - 'div', - { className: 'wrapper' }, - _react2.default.createElement('i', { className: 'fa fa-caret-up', 'aria-hidden': 'true' }), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'blue-color' }, - FSPercent, - '%' - ), - ' since 2009' - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'stats' }, - _react2.default.createElement( - 'h3', - null, - 'S&P 500' - ), - _react2.default.createElement( - 'div', - { className: 'wrapper' }, - _react2.default.createElement('i', { className: 'fa fa-caret-up', 'aria-hidden': 'true' }), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'green-color' }, - SP500Percent, - '%' - ), - ' since 2009' - ) - ) - ) - ) - ), - holdings - ); - } -}); - -exports.default = Portfolio; - -},{"../../cc":3,"../../libraries/amcharts3-react":70,"../../store":78,"./PortfolioGraph":23,"./PortfolioItem":24,"react":538,"react-router":361,"underscore":553}],23:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var PortfolioGraph = _react2.default.createClass({ - displayName: 'PortfolioGraph', - render: function render() { - - var startValue = void 0; - var marketStartValue = void 0; - if (_store2.default.plans.get(this.props.plan).get('portfolioYields')[0]) { - startValue = _store2.default.plans.get(this.props.plan).get('portfolioYields')[0].balance; - } - if (_store2.default.market.data.get('portfolioData')[0]) { - marketStartValue = _store2.default.market.data.get('portfolioData')[0]; - } - - var fixedData = _store2.default.plans.get(this.props.plan).get('portfolioYields').map(function (point, i) { - return { - fs: ((point.balance - startValue) / startValue * 100).toFixed(2), - market: ((_store2.default.market.data.get('portfolioData')[i] - marketStartValue) / marketStartValue * 100).toFixed(2), - date: point.date.year + '-' + point.date.month + '-' + point.date.day - }; - }); - - var config = { - "type": "serial", - "dataProvider": fixedData, - "theme": "light", - "marginRight": 0, - "marginLeft": 60, - "valueAxes": [{ - "id": "v1", - unit: '%', - "axisAlpha": 0, - "position": "left", - "ignoreAxisWidth": true, - minimum: 0 - }], - balloon: { - color: '#49494A', - fillAlpha: 1, - borderColor: '#27A5F9', - borderThickness: 1 - }, - "graphs": [{ - "id": "portfolio", - "bullet": "round", - "bulletBorderAlpha": 1, - "bulletColor": "#FFFFFF", - lineColor: "#27A5F9", - "fillAlphas": 0.75, - "bulletSize": 5, - "hideBulletsCount": 50, - "lineThickness": 2, - "title": "red line", - "useLineColorForBulletBorder": true, - "valueField": "fs", - "balloonText": '' + this.props.plan + '
+[[value]]%
' - }, { - "id": "market", - "bullet": "round", - "bulletBorderAlpha": 1, - "bulletColor": "#FFFFFF", - lineColor: "#49494A", - "fillAlphas": 0.75, - "bulletSize": 5, - "hideBulletsCount": 50, - "lineThickness": 2, - "title": "red line", - "useLineColorForBulletBorder": true, - "valueField": "market", - "balloonText": "S&P 500
+[[value]]%
" - }], - chartCursor: { - valueLineEnabled: true, - valueLineAlpha: 0.5, - cursorAlpha: 0.5 - }, - categoryField: "date", - categoryAxis: { - parseDates: true, - equalSpacing: true, - tickLength: 0 - } - }; - - if (_store2.default.session.browserType() === 'Safari') { - config.dataDateFormat = "YYYY-M-D", config.categoryAxis = { - equalSpacing: true, - tickLength: 0 - }; - } - - var chart = _react2.default.createElement( - 'div', - { id: 'portfolio-chart' }, - _react2.default.createElement(AmCharts.React, config) - ); - - return chart; - } -}); - -exports.default = PortfolioGraph; - -},{"../../store":78,"react":538}],24:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _PortfolioItemGraph = require('./PortfolioItemGraph'); - -var _PortfolioItemGraph2 = _interopRequireDefault(_PortfolioItemGraph); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -var _cc = require('../../cc'); - -var _cc2 = _interopRequireDefault(_cc); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var PortfolioItem = _react2.default.createClass({ - displayName: 'PortfolioItem', - getInitialState: function getInitialState() { - - var promise = {}; - var data = []; - - if (!_store2.default.plans.get(this.props.plan).get('portfolio')[this.props.number].data) { - promise = _store2.default.plans.get(this.props.plan).getStockInfo(this.props.stock.ticker, this.props.number, true); - } else { - data = _store2.default.plans.get(this.props.plan).get('portfolio')[this.props.number].data; - } - - return { - data: data, - lastPrice: this.props.stock.latest_price, - promise: promise, - chartSpan: 6 - }; - }, - componentDidMount: function componentDidMount() { - var _this = this; - - (0, _jquery2.default)(window).on('resize', this.checkScreenSize); - if (!_store2.default.plans.get(this.props.plan).get('portfolio')[this.props.number].data) { - this.state.promise.promise.then(function (r) { - _this.setState({ data: r.data, lastPrice: r.data[0][4] }); - }).catch(function (e) { - console.error(e); - }); - } - this.checkScreenSize(); - }, - componentWillUnmount: function componentWillUnmount() { - (0, _jquery2.default)(window).off('resize', this.checkScreenSize); - if (typeof this.state.promise.cancel === 'function') { - this.state.promise.cancel(); - } - }, - checkScreenSize: function checkScreenSize() { - if ((0, _jquery2.default)(window).width() > 850 && (0, _jquery2.default)(window).width() < 950) { - this.setState({ chartSpan: 5 }); - } else if ((0, _jquery2.default)(window).width() > 650 && (0, _jquery2.default)(window).width() < 850) { - this.setState({ chartSpan: 4 }); - } else if ((0, _jquery2.default)(window).width() > 525 && (0, _jquery2.default)(window).width() < 650) { - this.setState({ chartSpan: 3 }); - } else if ((0, _jquery2.default)(window).width() > 400 && (0, _jquery2.default)(window).width() < 525) { - this.setState({ chartSpan: 2 }); - } - }, - render: function render() { - var stock = this.props.stock; - - var changeClass = 'positive'; - if ((this.state.lastPrice - stock.purchase_price).toFixed(2) < 0) { - changeClass = 'negative'; - } - - if (!this.props.graph) { - return _react2.default.createElement( - 'tbody', - { onClick: this.props.expandStock.bind(null, stock) }, - _react2.default.createElement( - 'tr', - { className: 'stock-table-row' }, - _react2.default.createElement( - 'td', - { className: 'stock-name' }, - _react2.default.createElement('i', { className: 'fa fa-flask', 'aria-hidden': 'true' }), - _react2.default.createElement( - 'div', - { className: 'wrapper' }, - _react2.default.createElement( - 'p', - { className: 'stock-name-tag' }, - stock.name - ), - _react2.default.createElement( - 'p', - { className: 'ticker' }, - stock.ticker - ) - ) - ), - _react2.default.createElement( - 'td', - { className: 'portfolio-td' }, - _react2.default.createElement( - 'p', - { className: 'blue-color' }, - stock.percentage_weight.toFixed(2), - '%' - ) - ), - _react2.default.createElement( - 'td', - { className: 'portfolio-td' }, - _react2.default.createElement( - 'p', - { className: changeClass }, - ((this.state.lastPrice - stock.purchase_price) * 100 / stock.purchase_price).toFixed(2), - '%' - ) - ), - _react2.default.createElement( - 'td', - { className: 'portfolio-td' }, - _react2.default.createElement( - 'p', - { className: 'blue-color' }, - '$', - stock.purchase_price.toFixed(2) - ) - ), - _react2.default.createElement( - 'td', - { className: 'portfolio-td' }, - _react2.default.createElement( - 'p', - { className: 'class-checker' }, - '$', - this.state.lastPrice.toFixed(2) - ) - ), - _react2.default.createElement( - 'td', - { className: 'portfolio-td' }, - _react2.default.createElement( - 'p', - { className: 'class-checker' }, - _cc2.default.commafy(stock.days_owned) - ) - ) - ) - ); - } else { - return _react2.default.createElement( - 'tbody', - { onClick: this.props.expandStock.bind(null, stock) }, - _react2.default.createElement( - 'tr', - null, - _react2.default.createElement( - 'td', - { className: 'stock-name' }, - _react2.default.createElement('i', { className: 'fa fa-flask', 'aria-hidden': 'true' }), - _react2.default.createElement( - 'div', - { className: 'wrapper' }, - _react2.default.createElement( - 'p', - { className: 'stock-name-tag' }, - stock.name - ), - _react2.default.createElement( - 'p', - { className: 'ticker' }, - stock.ticker - ) - ) - ), - _react2.default.createElement( - 'td', - { className: 'portfolio-td' }, - _react2.default.createElement( - 'p', - { className: 'blue-color' }, - stock.percentage_weight.toFixed(2), - '%' - ) - ), - _react2.default.createElement( - 'td', - { className: 'portfolio-td' }, - _react2.default.createElement( - 'p', - { className: changeClass }, - ((this.state.lastPrice - stock.purchase_price) * 100 / stock.purchase_price).toFixed(2), - '%' - ) - ), - _react2.default.createElement( - 'td', - { className: 'portfolio-td' }, - _react2.default.createElement( - 'p', - { className: 'blue-color' }, - '$', - stock.purchase_price.toFixed(2) - ) - ), - _react2.default.createElement( - 'td', - { className: 'portfolio-td' }, - _react2.default.createElement( - 'p', - { className: 'class-checker' }, - '$', - this.state.lastPrice.toFixed(2) - ) - ), - _react2.default.createElement( - 'td', - { className: 'portfolio-td' }, - _react2.default.createElement( - 'p', - { className: 'class-checker' }, - _cc2.default.commafy(stock.days_owned) - ) - ) - ), - _react2.default.createElement( - 'tr', - null, - _react2.default.createElement( - 'td', - { colSpan: this.state.chartSpan }, - _react2.default.createElement(_PortfolioItemGraph2.default, { stock: this.props.stock, plan: this.props.plan, data: this.state.data }) - ) - ) - ); - } - } -}); - -exports.default = PortfolioItem; - -},{"../../cc":3,"../../store":78,"./PortfolioItemGraph":25,"jquery":299,"react":538}],25:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var PortfolioItemGraph = _react2.default.createClass({ - displayName: 'PortfolioItemGraph', - render: function render() { - var chartData = this.props.data; - chartData = chartData.map(function (point) { - if (point[4] && point[0]) { - return { - close: Number(point[4].toFixed(2)), - date: point[0] - }; - } - }); - chartData = chartData.slice(0, this.props.stock.days_owned); - chartData = chartData.reverse(); - - var chartTheme = 'light'; - var gridOpacity = 0.05; - - var color = { - positive: '#27A5F9', - negative: '#49494A' - }; - - var config = { - "type": "serial", - "dataProvider": chartData, - "theme": chartTheme, - "marginRight": 0, - "marginLeft": 60, - "marginTop": 25, - "marginBottom": 25, - "autoMargins": false, - "valueAxes": [{ - "id": "v1", - unit: '$', - unitPosition: 'left', - "axisAlpha": 0, - "position": "left", - "ignoreAxisWidth": true, - gridAlpha: gridOpacity - }], - balloon: { - color: '#49494A', - fillAlpha: 1, - borderColor: '#27A5F9', - borderThickness: 1 - }, - "graphs": [{ - "id": "portfolioStock", - lineColor: color.negative, - "lineThickness": 2, - "negativeLineColor": color.positive, - "negativeBase": this.props.stock.purchase_price + 0.001, - "valueField": "close", - "balloonText": '

' + this.props.stock.ticker + '

$[[value]]

' - }], - chartCursor: { - valueLineEnabled: true, - valueLineAlpha: 0.5, - cursorAlpha: 0.5 - }, - categoryField: "date", - categoryAxis: { - parseDates: true, - gridAlpha: 0, - axisAlpha: 0 - }, - "guides": [{ - "value": this.props.stock.purchase_price + 0.001, - "lineColor": color.positive, - "lineAlpha": 0.4, - "lineThickness": 1, - "position": "right" - }] - }; - - var chart = _react2.default.createElement( - 'div', - { id: 'portfolio-item-chart' }, - _react2.default.createElement(AmCharts.React, config) - ); - - return chart; - } -}); - -exports.default = PortfolioItemGraph; - -},{"../../store":78,"react":538}],26:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _draftJs = require('draft-js'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = function (_ref) { - var block = _ref.block; - - var imgContent = _draftJs.Entity.get(block.getEntityAt(0)).data.src; - return _react2.default.createElement('img', { src: imgContent }); -}; - -},{"draft-js":125,"react":538}],27:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _ToolbarIcon = require('../components/ToolbarIcon'); - -var _ToolbarIcon2 = _interopRequireDefault(_ToolbarIcon); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var INLINE_STYLES = [{ icon: 'a-bold', style: 'BOLD' }, { icon: 'a-italic', style: 'ITALIC' }]; - -exports.default = function (_ref) { - var editorState = _ref.editorState; - var onToggle = _ref.onToggle; - var position = _ref.position; - - var currentStyle = editorState.getCurrentInlineStyle(); - return _react2.default.createElement( - 'div', - { - className: 'toolbar', - id: 'inlineToolbar', - style: position - }, - _react2.default.createElement( - 'ul', - { className: 'toolbar-icons' }, - INLINE_STYLES.map(function (type) { - return _react2.default.createElement(_ToolbarIcon2.default, { - key: type.label || type.icon, - active: currentStyle.has(type.style), - label: type.label, - icon: type.icon, - onToggle: onToggle, - style: type.style - }); - }) - ) - ); -}; - -},{"../components/ToolbarIcon":28,"react":538}],28:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _classnames = require('classnames'); - -var _classnames2 = _interopRequireDefault(_classnames); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = function (_ref) { - var label = _ref.label; - var icon = _ref.icon; - var active = _ref.active; - var onToggle = _ref.onToggle; - var style = _ref.style; - return _react2.default.createElement( - 'li', - { - className: "toolbar-icon " + (0, _classnames2.default)({ active: active }), - onMouseDown: function onMouseDown(e) { - e.preventDefault(); - onToggle(style); - } - }, - label ? label : _react2.default.createElement('i', { className: icon }) - ); -}; - -},{"classnames":86,"react":538}],29:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _draftJs = require('draft-js'); - -var _selection = require('../utils/selection'); - -var _SideToolbar = require('./SideToolbar'); - -var _SideToolbar2 = _interopRequireDefault(_SideToolbar); - -var _InlineToolbar = require('../components/InlineToolbar'); - -var _InlineToolbar2 = _interopRequireDefault(_InlineToolbar); - -var _ImageComponent = require('../components/ImageComponent'); - -var _ImageComponent2 = _interopRequireDefault(_ImageComponent); - -var _underscore = require('underscore'); - -var _underscore2 = _interopRequireDefault(_underscore); - -var _store = require('../../../../store'); - -var _store2 = _interopRequireDefault(_store); - -var _admin = require('../../../../admin'); - -var _admin2 = _interopRequireDefault(_admin); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(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; } - -function _inherits(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 RichEditor = function (_Component) { - _inherits(RichEditor, _Component); - - function RichEditor(props) { - _classCallCheck(this, RichEditor); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RichEditor).call(this, props)); - - _this.state = { - editorState: _draftJs.EditorState.createEmpty(), - inlineToolbar: { show: false }, - images: [] - }; - - _this.onChange = function (editorState) { - if (!editorState.getSelection().isCollapsed()) { - var selectionRange = (0, _selection.getSelectionRange)(); - var selectionCoords = (0, _selection.getSelectionCoords)(selectionRange); - _this.setState({ - inlineToolbar: { - show: true, - position: { - top: selectionCoords.offsetTop, - left: selectionCoords.offsetLeft - } - } - }); - } else { - _this.setState({ inlineToolbar: { show: false } }); - } - - _this.setState({ editorState: editorState }); - setTimeout(_this.updateSelection, 0); - }; - _this.focus = function () { - return _this.refs.editor.focus(); - }; - _this.updateSelection = function () { - return _this._updateSelection(); - }; - _this.handleKeyCommand = function (command) { - return _this._handleKeyCommand(command); - }; - _this.handleFileInput = function (e) { - return _this._handleFileInput(e); - }; - _this.handleUploadImage = function () { - return _this._handleUploadImage(); - }; - _this.toggleBlockType = function (type) { - return _this._toggleBlockType(type); - }; - _this.toggleInlineStyle = function (style) { - return _this._toggleInlineStyle(style); - }; - _this.insertImage = function (file) { - return _this._insertImage(file); - }; - _this.blockRenderer = function (block) { - if (block.getType() === 'atomic') { - return { - component: _ImageComponent2.default - }; - } - return null; - }; - _this.blockStyler = function (block) { - if (block.getType() === 'unstyled') { - return 'paragraph'; - } - return null; - }; - return _this; - } - - _createClass(RichEditor, [{ - key: '_updateSelection', - value: function _updateSelection() { - var selectionRange = (0, _selection.getSelectionRange)(); - var selectedBlock = void 0; - if (selectionRange) { - selectedBlock = (0, _selection.getSelectedBlockElement)(selectionRange); - } - this.setState({ - selectedBlock: selectedBlock, - selectionRange: selectionRange - }); - } - }, { - key: '_handleKeyCommand', - value: function _handleKeyCommand(command) { - var editorState = this.state.editorState; - - var newState = _draftJs.RichUtils.handleKeyCommand(editorState, command); - if (newState) { - this.onChange(newState); - return true; - } - return false; - } - }, { - key: '_toggleBlockType', - value: function _toggleBlockType(blockType) { - this.onChange(_draftJs.RichUtils.toggleBlockType(this.state.editorState, blockType)); - } - }, { - key: '_toggleInlineStyle', - value: function _toggleInlineStyle(inlineStyle) { - this.onChange(_draftJs.RichUtils.toggleInlineStyle(this.state.editorState, inlineStyle)); - } - }, { - key: '_insertImage', - value: function _insertImage(file) { - var entityKey = _draftJs.Entity.create('atomic', 'IMMUTABLE', { src: URL.createObjectURL(file) }); - this.onChange(_draftJs.AtomicBlockUtils.insertAtomicBlock(this.state.editorState, entityKey, ' ')); - } - }, { - key: '_handleFileInput', - value: function _handleFileInput(e) { - var fileList = e.target.files; - var file = fileList[0]; - var images = this.state.images; - images.push(file); - this.setState({ images: images }); - this.insertImage(file); - } - }, { - key: '_handleUploadImage', - value: function _handleUploadImage() { - this.refs.fileInput.click(); - } - }, { - key: 'submitArticle', - value: function submitArticle(title) { - var _this2 = this; - - var editorState = this.state.editorState; - var content = (0, _draftJs.convertToRaw)(editorState.getCurrentContent()); - - console.log('content to save: ', content); - - var imagesUploaded = 0; - - _store2.default.articles.data.create({ - content: content, - title: title, - images: [] - }, { - success: function success(response) { - _underscore2.default.each(content.entityMap, function (entity, i) { - if (entity.data) { - if (entity.data.src) { - _admin2.default.uploadImage(_this2.state.images[i], response).then(function (article) { - console.log('Uploaded Image'); - imagesUploaded++; - console.log(article); - if (function (imagesUploaded) { - return _this2.state.images.length; - }) { - _store2.default.settings.history.push('/dashboard/articles/' + article._id); - } - }); - } - } - }); - if (_this2.state.images.length === 0) { - _store2.default.settings.history.push('/dashboard/articles/' + response.get('_id')); - } - } - }); - } - }, { - key: 'componentWillReceiveProps', - value: function componentWillReceiveProps(newProps) { - console.log(newProps); - if (newProps.submitArticle) { - this.submitArticle(newProps.title); - } - } - }, { - key: 'render', - value: function render() { - var _state = this.state; - var editorState = _state.editorState; - var selectedBlock = _state.selectedBlock; - var selectionRange = _state.selectionRange; - - var sideToolbarOffsetTop = 0; - - if (selectedBlock) { - var editor = document.getElementById('richEditor'); - var editorBounds = editor.getBoundingClientRect(); - var blockBounds = selectedBlock.getBoundingClientRect(); - - sideToolbarOffsetTop = blockBounds.bottom - editorBounds.top - 31; // height of side toolbar - } - - return _react2.default.createElement( - 'div', - { className: 'editor', id: 'richEditor', onClick: this.focus }, - selectedBlock ? _react2.default.createElement(_SideToolbar2.default, { - editorState: editorState, - style: { top: sideToolbarOffsetTop + 8 }, - onToggle: this.toggleBlockType, - onUploadImage: this.handleUploadImage - }) : null, - this.state.inlineToolbar.show ? _react2.default.createElement(_InlineToolbar2.default, { - editorState: editorState, - onToggle: this.toggleInlineStyle, - position: this.state.inlineToolbar.position - }) : null, - _react2.default.createElement(_draftJs.Editor, { - blockRendererFn: this.blockRenderer, - blockStyleFn: this.blockStyler, - editorState: editorState, - handleKeyCommand: this.handleKeyCommand, - onChange: this.onChange, - placeholder: 'Write an article', - spellCheck: true, - readOnly: this.state.editingImage, - ref: 'editor' - }), - _react2.default.createElement('input', { type: 'file', ref: 'fileInput', style: { display: 'none' }, - onChange: this.handleFileInput }) - ); - } - }]); - - return RichEditor; -}(_react.Component); - -exports.default = RichEditor; - -},{"../../../../admin":1,"../../../../store":78,"../components/ImageComponent":26,"../components/InlineToolbar":27,"../utils/selection":31,"./SideToolbar":30,"draft-js":125,"react":538,"underscore":553}],30:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _ToolbarIcon = require('../components/ToolbarIcon'); - -var _ToolbarIcon2 = _interopRequireDefault(_ToolbarIcon); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(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; } - -function _inherits(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 BLOCK_TYPES = [{ label: 'H1', style: 'header-one' }, { label: 'H2', style: 'header-two' }, { icon: 'a-unordered-list', style: 'unordered-list-item' }, { icon: 'a-ordered-list', style: 'ordered-list-item' }, { icon: 'a-quote', style: 'blockquote' }]; - -var SideToolbarExtras = function SideToolbarExtras(_ref) { - var editorState = _ref.editorState; - var onToggle = _ref.onToggle; - - var selection = editorState.getSelection(); - var blockType = editorState.getCurrentContent().getBlockForKey(selection.getStartKey()).getType(); - return _react2.default.createElement( - 'div', - { className: 'toolbar side' }, - _react2.default.createElement( - 'ul', - { className: 'toolbar-icons' }, - BLOCK_TYPES.map(function (type) { - return _react2.default.createElement(_ToolbarIcon2.default, { - key: type.label || type.icon, - active: type.style === blockType, - label: type.label, - icon: type.icon, - onToggle: onToggle, - style: type.style - }); - }) - ) - ); -}; - -var SideToolbar = function (_Component) { - _inherits(SideToolbar, _Component); - - function SideToolbar(props) { - _classCallCheck(this, SideToolbar); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(SideToolbar).call(this, props)); - - _this.state = { - isExpanded: false - }; - return _this; - } - - _createClass(SideToolbar, [{ - key: 'render', - value: function render() { - var _this2 = this; - - var isExpanded = this.state.isExpanded; - var _props = this.props; - var editorState = _props.editorState; - var onUploadImage = _props.onUploadImage; - var onToggle = _props.onToggle; - - return _react2.default.createElement( - 'div', - { style: this.props.style, className: 'side-toolbar' }, - _react2.default.createElement('i', { className: 'a-photo', - onMouseDown: function onMouseDown(e) { - return e.preventDefault(); - }, - onClick: onUploadImage - }), - _react2.default.createElement( - 'i', - { className: 'a-menu', - onMouseEnter: function onMouseEnter() { - return _this2.setState({ isExpanded: true }); - }, - onMouseDown: function onMouseDown(e) { - return e.preventDefault(); - }, - onMouseLeave: function onMouseLeave() { - return _this2.setState({ isExpanded: false }); - } - }, - isExpanded ? _react2.default.createElement(SideToolbarExtras, { editorState: editorState, onToggle: onToggle }) : null - ) - ); - } - }]); - - return SideToolbar; -}(_react.Component); - -exports.default = SideToolbar; - -},{"../components/ToolbarIcon":28,"react":538}],31:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var getSelectionRange = exports.getSelectionRange = function getSelectionRange() { - var selection = window.getSelection(); - if (selection.rangeCount === 0) return null; - return selection.getRangeAt(0); -}; - -var getSelectedBlockElement = exports.getSelectedBlockElement = function getSelectedBlockElement(range) { - var node = range.startContainer; - do { - var nodeIsDataBlock = node.getAttribute ? node.getAttribute('data-block') : null; - if (nodeIsDataBlock) return node; - node = node.parentNode; - } while (node !== null); - return null; -}; - -var getSelectionCoords = exports.getSelectionCoords = function getSelectionCoords(selectionRange) { - var editorBounds = document.getElementById('richEditor').getBoundingClientRect(); - var rangeBounds = selectionRange.getBoundingClientRect(); - var rangeWidth = rangeBounds.right - rangeBounds.left; - var rangeHeight = rangeBounds.bottom - rangeBounds.top; - var offsetLeft = rangeBounds.left - editorBounds.left + rangeWidth / 2 - /* 72px is width of inline toolbar */ - - 72 / 2; - // 42px is height of inline toolbar (35px) + 5px center triangle and 2px for spacing - var offsetTop = rangeBounds.top - editorBounds.top - 42; - return { offsetLeft: offsetLeft, offsetTop: offsetTop }; -}; - -},{}],32:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _underscore = require('underscore'); - -var _underscore2 = _interopRequireDefault(_underscore); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _reactRouter = require('react-router'); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var SideBar = _react2.default.createClass({ - displayName: 'SideBar', - getInitialState: function getInitialState() { - var selected = void 0; - var dropDown = false; - if (this.props.location.indexOf('suggestions') !== -1) { - selected = 'suggestions'; - if ((0, _jquery2.default)(window).width() > 800) { - dropDown = true; - } - } else if (this.props.location.indexOf('portfolio') !== -1 || this.props.location === '/dashboard') { - selected = 'portfolio'; - if ((0, _jquery2.default)(window).width() > 800) { - dropDown = true; - } - } else if (this.props.location.indexOf('account') !== -1) { - selected = 'account'; - } else if (this.props.location.indexOf('admin') !== -1) { - selected = 'admin'; - if ((0, _jquery2.default)(window).width() > 800) { - dropDown = true; - } - } - return { plan: this.props.plan, selected: selected, dropDown: dropDown }; - }, - toggleDropdown: function toggleDropdown(dropdown, e) { - if (_underscore2.default.toArray(e.target.classList).indexOf('dropdown-link') === -1) { - if (!this.state.dropDown || dropdown !== this.state.selected) { - this.setState({ selected: dropdown, plan: this.props.plan, dropDown: true }); - } else if ((0, _jquery2.default)(window).width() < 800) { - this.setState({ dropDown: false }); - } else { - this.setState({ selected: dropdown, plan: this.props.plan, dropDown: true }); - } - } - }, - componentWillReceiveProps: function componentWillReceiveProps(props) { - this.setState({ plan: props.plan }); - }, - gotoPath: function gotoPath(path) { - if ((0, _jquery2.default)(window).width() < 800) { - this.setState({ dropDown: false }); - } - _store2.default.settings.history.push(path); - }, - gotoAccount: function gotoAccount() { - this.setState({ selected: 'account', plan: '' }); - _store2.default.settings.history.push('/dashboard/account'); - }, - gotoAdmin: function gotoAdmin() { - this.setState({ selected: 'admin', plan: '' }); - _store2.default.settings.history.push('/dashboard/admin'); - }, - gotoArticles: function gotoArticles() { - this.setState({ selected: 'articles', plan: '' }); - _store2.default.settings.history.push('/dashboard/articles'); - }, - logout: function logout() { - _store2.default.session.logout(); - }, - render: function render() { - var suggestionsClass = 'suggestions side-bar-link'; - var portfoliosClass = 'portfolios side-bar-link'; - var myAccountClass = 'myaccount side-bar-link'; - var adminClass = 'admin side-bar-link'; - var articlesClass = 'articles side-bar-link'; - var suggestionsDropdown = void 0, - portfoliosDropdown = void 0, - adminDropdown = void 0; - - var SbasicClass = void 0, - SpremiumClass = void 0, - SbusinessClass = void 0, - SfundClass = void 0; - var PbasicClass = void 0, - PpremiumClass = void 0, - PbusinessClass = void 0, - PfundClass = void 0; - - if (this.state.selected === 'suggestions') { - if (this.props.location.indexOf('suggestions') !== -1) { - if (this.state.plan === 'basic') { - SbasicClass = 'selected'; - } else if (this.state.plan === 'premium') { - SpremiumClass = 'selected'; - } else if (this.state.plan === 'business') { - SbusinessClass = 'selected'; - } else if (this.state.plan === 'fund') { - SfundClass = 'selected'; - } - } - suggestionsClass = 'suggestions side-bar-link selected'; - - if (this.state.dropDown) { - suggestionsDropdown = _react2.default.createElement( - 'div', - { className: 'dropdown plan-dd' }, - _react2.default.createElement( - 'a', - { className: 'dropdown-link ' + SbasicClass, onClick: this.gotoPath.bind(null, '/dashboard/suggestions/basic') }, - 'Basic suggestions' - ), - _react2.default.createElement( - 'a', - { className: 'dropdown-link ' + SpremiumClass, onClick: this.gotoPath.bind(null, '/dashboard/suggestions/premium') }, - 'Premium suggestions' - ), - _react2.default.createElement( - 'a', - { className: 'dropdown-link ' + SbusinessClass, onClick: this.gotoPath.bind(null, '/dashboard/suggestions/business') }, - 'Business suggestions' - ), - _react2.default.createElement( - 'a', - { className: 'dropdown-link ' + SfundClass, onClick: this.gotoPath.bind(null, '/dashboard/suggestions/fund') }, - 'Fund suggestions' - ) - ); - } - } else if (this.state.selected === 'portfolio') { - if (this.props.location.indexOf('portfolio') !== -1 || this.props.location === '/dashboard') { - if (this.state.plan === 'basic') { - PbasicClass = 'selected'; - } else if (this.state.plan === 'premium') { - PpremiumClass = 'selected'; - } else if (this.state.plan === 'business') { - PbusinessClass = 'selected'; - } else if (this.state.plan === 'fund') { - PfundClass = 'selected'; - } - } - - portfoliosClass = 'portfolios side-bar-link selected'; - if (this.state.dropDown) { - portfoliosDropdown = _react2.default.createElement( - 'div', - { className: 'dropdown plan-dd' }, - _react2.default.createElement( - 'a', - { className: 'dropdown-link ' + PbasicClass, onClick: this.gotoPath.bind(null, '/dashboard/portfolio/basic') }, - 'Basic portfolio' - ), - _react2.default.createElement( - 'a', - { className: 'dropdown-link ' + PpremiumClass, onClick: this.gotoPath.bind(null, '/dashboard/portfolio/premium') }, - 'Premium portfolio' - ), - _react2.default.createElement( - 'a', - { className: 'dropdown-link ' + PbusinessClass, onClick: this.gotoPath.bind(null, '/dashboard/portfolio/business') }, - 'Business portfolio' - ), - _react2.default.createElement( - 'a', - { className: 'dropdown-link ' + PfundClass, onClick: this.gotoPath.bind(null, '/dashboard/portfolio/fund') }, - 'Fund portfolio' - ) - ); - } - } else if (this.state.selected === 'account') { - myAccountClass = 'myaccount side-bar-link selected'; - } else if (this.state.selected === 'articles' || this.props.location.indexOf('articles') > -1) { - articlesClass = 'articles side-bar-link selected'; - } - - var admin = void 0; - if (_store2.default.session.get('type') === 5) { - var adminPanelClass = void 0, - adminAPIClass = void 0, - newArticleClass = void 0; - - if (this.state.selected === 'admin') { - adminClass = 'admin side-bar-link selected'; - - if (this.props.location.indexOf('admin') !== -1) { - if (this.props.location.indexOf('api') !== -1) { - adminAPIClass = 'selected'; - } else if (this.props.location === '/dashboard/admin') { - adminPanelClass = 'selected'; - } else if (this.props.location === '/dashboard/admin/newarticle') { - newArticleClass = 'selected'; - } - } - - if (this.state.dropDown) { - adminDropdown = _react2.default.createElement( - 'div', - { className: 'dropdown admin-dd' }, - _react2.default.createElement( - 'a', - { className: 'dropdown-link ' + adminPanelClass, onClick: this.gotoPath.bind(null, '/dashboard/admin') }, - 'Panel' - ), - _react2.default.createElement( - 'a', - { className: 'dropdown-link ' + adminAPIClass, onClick: this.gotoPath.bind(null, '/dashboard/admin/api') }, - 'JSON' - ), - _react2.default.createElement( - 'a', - { className: 'dropdown-link ' + newArticleClass, onClick: this.gotoPath.bind(null, '/dashboard/admin/newarticle') }, - 'New Article' - ) - ); - } - } - - admin = _react2.default.createElement( - 'li', - { className: adminClass, onClick: this.toggleDropdown.bind(null, 'admin') }, - _react2.default.createElement( - 'button', - { className: 'admin-btn' }, - _react2.default.createElement( - 'h3', - null, - _react2.default.createElement('i', { className: 'fa fa-tachometer', 'aria-hidden': 'true' }) - ), - _react2.default.createElement('i', { className: 'fa fa-angle-down', 'aria-hidden': 'true' }) - ), - adminDropdown - ); - } - - return _react2.default.createElement( - 'aside', - { className: 'side-bar' }, - _react2.default.createElement( - 'ul', - { className: 'side-bar-links' }, - _react2.default.createElement( - 'li', - { className: suggestionsClass, onClick: this.toggleDropdown.bind(null, 'suggestions') }, - _react2.default.createElement( - 'button', - { className: 'suggestions-btn' }, - _react2.default.createElement( - 'h3', - null, - _react2.default.createElement('i', { className: 'fa fa-flask', 'aria-hidden': 'true' }) - ), - ' ', - _react2.default.createElement('i', { className: 'fa fa-angle-down', 'aria-hidden': 'true' }) - ), - suggestionsDropdown - ), - _react2.default.createElement( - 'li', - { className: portfoliosClass, onClick: this.toggleDropdown.bind(null, 'portfolio') }, - _react2.default.createElement( - 'button', - { className: 'portfolios-btn' }, - _react2.default.createElement( - 'h3', - null, - _react2.default.createElement('i', { className: 'fa fa-line-chart', 'aria-hidden': 'true' }) - ), - ' ', - _react2.default.createElement('i', { className: 'fa fa-angle-down', 'aria-hidden': 'true' }) - ), - portfoliosDropdown - ), - _react2.default.createElement( - 'li', - { className: articlesClass }, - _react2.default.createElement( - 'button', - { className: 'articles-btn', onClick: this.gotoArticles }, - _react2.default.createElement( - 'h3', - null, - _react2.default.createElement('i', { className: 'fa fa-newspaper-o', 'aria-hidden': 'true' }) - ) - ) - ), - _react2.default.createElement( - 'li', - { className: myAccountClass }, - _react2.default.createElement( - 'button', - { className: 'my-account-btn', onClick: this.gotoAccount }, - _react2.default.createElement( - 'h3', - null, - _react2.default.createElement('i', { className: 'fa fa-user', 'aria-hidden': 'true' }) - ) - ) - ), - admin, - _react2.default.createElement( - 'li', - { className: 'my-account side-bar-link logout' }, - _react2.default.createElement( - 'button', - { className: 'logout-btn', onClick: this.logout }, - _react2.default.createElement( - 'h3', - null, - _react2.default.createElement('i', { className: 'fa fa-power-off', 'aria-hidden': 'true' }) - ) - ) - ) - ) - ); - } -}); - -exports.default = SideBar; - -},{"../../store":78,"jquery":299,"react":538,"react-router":361,"underscore":553}],33:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _underscore = require('underscore'); - -var _underscore2 = _interopRequireDefault(_underscore); - -var _SuggestionChart = require('./SuggestionChart'); - -var _SuggestionChart2 = _interopRequireDefault(_SuggestionChart); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Suggestion = _react2.default.createClass({ - displayName: 'Suggestion', - getInitialState: function getInitialState() { - return { fetched: false, fetching: false, failed: false, showModal: false }; - }, - componentDidMount: function componentDidMount() { - var _this = this; - - if (!_store2.default.plans.get(this.props.planName).get('suggestions')[this.props.i].data) { - this.setState({ fetching: true }); - _store2.default.plans.get(this.props.planName).getStockInfo(this.props.suggestion.ticker, this.props.i).promise.then(function () { - _this.setState({ fetched: true, fetching: false }); - }).catch(function () { - _this.setState({ fetched: false, fetching: false, failed: true }); - }); - } else { - this.setState({ fetched: true, fetching: false }); - } - }, - componentWillReceiveProps: function componentWillReceiveProps(newProps) { - if (newProps.planName !== this.props.planName) { - if (!_store2.default.plans.get(newProps.planName).get('suggestions')[newProps.i].data) { - _store2.default.plans.get(newProps.planName).getStockInfo(newProps.suggestion.ticker, newProps.i); - } - } - }, - moreInfo: function moreInfo() { - this.setState({ showModal: true }); - }, - closeModal: function closeModal(e) { - if (_underscore2.default.toArray(e.target.classList).indexOf('db-modal-container') !== -1) { - this.setState({ showModal: false }); - } - }, - render: function render() { - var lastPrice = void 0; - if (this.props.suggestion.data) { - lastPrice = this.props.suggestion.data[0][3].toFixed(2); - } - var allocation = void 0; - if (this.props.suggestion.percentage_weight) { - allocation = this.props.suggestion.percentage_weight.toFixed(2); - } - var listClass = 'fade-in white'; - var actionClass = ''; - var textColor = ''; - var SuggestedPriceText = 'Buy at'; - - var allocationElement = _react2.default.createElement( - 'li', - { className: actionClass }, - _react2.default.createElement( - 'h4', - { className: 'value' }, - allocation, - '%' - ), - _react2.default.createElement( - 'p', - null, - 'Cash allocation' - ) - ); - - if (this.props.suggestion.action === 'SELL') { - listClass = 'fade-in blue'; - textColor = 'white-color'; - actionClass = 'sell'; - SuggestedPriceText = 'Sell at'; - allocationElement = _react2.default.createElement('li', null); - } - - var chartArea = void 0; - var loadingColor = 'blue-color'; - if (this.props.suggestion.action === 'SELL') { - loadingColor = 'white-color'; - } - if (this.state.fetching) { - chartArea = _react2.default.createElement( - 'div', - { className: 'fetching-data' }, - _react2.default.createElement('i', { className: 'fa fa-circle-o-notch fa-spin fa-3x fa-fw ' + loadingColor }), - _react2.default.createElement( - 'p', - { className: loadingColor }, - 'Loading data' - ) - ); - } else if (this.state.failed) { - chartArea = _react2.default.createElement( - 'div', - { className: 'fetching-data' }, - _react2.default.createElement( - 'p', - { className: 'red-color' }, - 'Failed loading data' - ) - ); - } else if (this.state.fetched) { - chartArea = _react2.default.createElement(_SuggestionChart2.default, { - data: this.props.suggestion.data, - suggestedPrice: this.props.suggestion.suggested_price, - ticker: this.props.suggestion.ticker, - action: this.props.suggestion.action, - allData: this.state.showModal }); - } - - var modal = void 0; - if (this.state.showModal) { - var advancedData = this.props.suggestion.advanced_data.map(function (dataPoint, i) { - console.log(dataPoint); - var value = dataPoint.value; - if (dataPoint.unit === 'percent') { - value = value + '%'; - } - return _react2.default.createElement( - 'li', - { key: i }, - _react2.default.createElement( - 'h3', - null, - dataPoint.display_name - ), - _react2.default.createElement( - 'h3', - null, - value - ) - ); - }); - modal = _react2.default.createElement( - 'div', - { className: 'db-modal-container', onClick: this.closeModal }, - _react2.default.createElement( - 'div', - { className: 'db-modal advanced-data-modal' }, - _react2.default.createElement( - 'div', - { className: 'top' }, - _react2.default.createElement( - 'h3', - { className: textColor }, - this.props.suggestion.name - ), - _react2.default.createElement( - 'h3', - { className: 'action ' + actionClass }, - this.props.suggestion.action - ) - ), - chartArea, - _react2.default.createElement( - 'ul', - { className: 'advanced-data-list' }, - advancedData - ) - ) - ); - } - - return _react2.default.createElement( - 'li', - { className: listClass }, - _react2.default.createElement( - 'div', - { className: 'top' }, - _react2.default.createElement( - 'h3', - { className: textColor }, - this.props.suggestion.name - ), - _react2.default.createElement( - 'h3', - { className: 'action ' + actionClass }, - this.props.suggestion.action - ) - ), - chartArea, - _react2.default.createElement( - 'ul', - { className: 'bottom' }, - _react2.default.createElement( - 'li', - { className: actionClass }, - _react2.default.createElement( - 'h4', - { className: 'value' }, - this.props.suggestion.ticker - ), - _react2.default.createElement( - 'p', - null, - 'Ticker' - ) - ), - allocationElement, - _react2.default.createElement( - 'li', - { className: actionClass }, - _react2.default.createElement( - 'h4', - { className: 'value' }, - '$', - this.props.suggestion.suggested_price.toFixed(2) - ), - _react2.default.createElement( - 'p', - null, - SuggestedPriceText - ) - ), - _react2.default.createElement( - 'li', - { className: actionClass }, - _react2.default.createElement( - 'h4', - { className: 'value' }, - '$', - lastPrice - ), - _react2.default.createElement( - 'p', - null, - 'Last price' - ) - ) - ), - _react2.default.createElement( - 'button', - { className: 'more-info ' + actionClass, onClick: this.moreInfo }, - 'More info' - ), - modal - ); - } -}); - -exports.default = Suggestion; - -},{"../../store":78,"./SuggestionChart":34,"react":538,"underscore":553}],34:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _React = require('React'); - -var _React2 = _interopRequireDefault(_React); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var SuggestionChart = _React2.default.createClass({ - displayName: 'SuggestionChart', - render: function render() { - var chartData = this.props.data || []; - chartData = chartData.map(function (point) { - return { - open: Number(point[1].toFixed(2)), - high: Number(point[2].toFixed(2)), - close: Number(point[3].toFixed(2)), - date: point[0] - }; - }); - if (!this.props.allData) { - chartData = chartData.slice(0, 30); - } - chartData = chartData.reverse(); - - var chartTheme = 'light'; - var gridOpacity = 0.05; - - var color = { - positive: '#27A5F9', - negative: '#49494A' - }; - if (this.props.action === 'SELL') { - color = { - negative: '#fff', - positive: '#49494A' - }; - chartTheme = 'dark'; - gridOpacity = 0.25; - } - - var config = { - "type": "serial", - "dataProvider": chartData, - "theme": chartTheme, - "marginRight": 0, - "marginLeft": 60, - "marginTop": 25, - "marginBottom": 25, - "autoMargins": false, - "valueAxes": [{ - "id": "v1", - unit: '$', - unitPosition: 'left', - "axisAlpha": 0, - "position": "left", - "ignoreAxisWidth": true, - gridAlpha: gridOpacity - }], - balloon: { - color: '#49494A', - fillAlpha: 1, - borderColor: '#27A5F9', - borderThickness: 1 - }, - "graphs": [{ - "id": "suggestion", - lineColor: color.negative, - "lineThickness": 2, - "negativeLineColor": color.positive, - "negativeBase": this.props.suggestedPrice + 0.001, - "valueField": "close", - "balloonText": '

' + this.props.ticker + '

$[[value]]

' - }], - chartCursor: { - valueLineEnabled: true, - valueLineAlpha: 0.5, - cursorAlpha: 0.5 - }, - categoryField: "date", - categoryAxis: { - parseDates: true, - gridAlpha: 0, - axisAlpha: 0 - }, - "guides": [{ - "value": this.props.suggestedPrice + 0.001, - "lineColor": color.positive, - "lineAlpha": 0.4, - "lineThickness": 1, - "position": "right" - }] - }; - - var chart = _React2.default.createElement( - 'div', - { id: 'suggestion-chart' }, - _React2.default.createElement(AmCharts.React, config) - ); - - return chart; - } -}); - -exports.default = SuggestionChart; - -},{"React":538}],35:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var SuggestionHeader = _react2.default.createClass({ - displayName: 'SuggestionHeader', - getInitialState: function getInitialState() { - return { - stats: _store2.default.plans.get(this.props.plan).get('stats'), - // suggestionsLength: store.plans.get(this.props.plan).get('buySuggestions').length + store.plans.get(this.props.plan).get('sellSuggestions').length - suggestionsLength: _store2.default.plans.get(this.props.plan).get('suggestions').length - }; - }, - componentWillReceiveProps: function componentWillReceiveProps(newProps) { - this.setState({ - stats: _store2.default.plans.get(newProps.plan).get('stats'), - suggestionsLength: _store2.default.plans.get(newProps.plan).get('suggestions').length - }); - }, - render: function render() { - var portfolio = _store2.default.plans.get(this.props.plan).get('portfolio'); - var cashAllocation = void 0; - if (portfolio[0]) { - cashAllocation = portfolio[portfolio.length - 1].percentage_weight.toFixed(2); - } - return _react2.default.createElement( - 'section', - { className: 'suggestion-header' }, - _react2.default.createElement( - 'ul', - null, - _react2.default.createElement( - 'li', - { className: 'panel cagr blue' }, - _react2.default.createElement( - 'div', - { className: 'symbol' }, - _react2.default.createElement('i', { className: 'fa fa-line-chart white-color' }) - ), - _react2.default.createElement( - 'div', - { className: 'value' }, - _react2.default.createElement( - 'h3', - { className: 'white-color' }, - this.state.stats.CAGR.toFixed(2), - '%' - ), - _react2.default.createElement( - 'p', - { className: 'white-color' }, - 'CAGR' - ) - ) - ), - _react2.default.createElement( - 'li', - { className: 'panel profitable-stocks white gray-border' }, - _react2.default.createElement( - 'div', - { className: 'symbol' }, - _react2.default.createElement('i', { className: 'fa fa-pie-chart blue-color' }) - ), - _react2.default.createElement( - 'div', - { className: 'value' }, - _react2.default.createElement( - 'h3', - { className: 'blue-color' }, - this.state.stats.WLRatio.toFixed(2), - '%' - ), - _react2.default.createElement( - 'p', - { className: 'blue-color' }, - 'Profitable stocks' - ) - ) - ), - _react2.default.createElement( - 'li', - { className: 'panel green' }, - _react2.default.createElement( - 'div', - { className: 'symbol' }, - _react2.default.createElement('i', { className: 'fa fa-list white-color' }) - ), - _react2.default.createElement( - 'div', - { className: 'value' }, - _react2.default.createElement( - 'h3', - { className: 'white-color' }, - this.state.suggestionsLength - ), - _react2.default.createElement( - 'p', - { className: 'white-color' }, - 'Suggestions' - ) - ) - ), - _react2.default.createElement( - 'li', - { className: 'panel white gray-border' }, - _react2.default.createElement( - 'div', - { className: 'symbol' }, - _react2.default.createElement('i', { className: 'fa fa-usd green-color' }) - ), - _react2.default.createElement( - 'div', - { className: 'value white' }, - _react2.default.createElement( - 'h3', - { className: 'green-color' }, - cashAllocation, - '%' - ), - _react2.default.createElement( - 'p', - { className: 'green-color' }, - 'Percent in cash' - ) - ) - ) - ) - ); - } -}); - -exports.default = SuggestionHeader; - -},{"../../store":78,"react":538}],36:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _underscore = require('underscore'); - -var _underscore2 = _interopRequireDefault(_underscore); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _reactRouter = require('react-router'); - -var _Suggestion = require('./Suggestion'); - -var _Suggestion2 = _interopRequireDefault(_Suggestion); - -var _SuggestionHeader = require('./SuggestionHeader'); - -var _SuggestionHeader2 = _interopRequireDefault(_SuggestionHeader); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Suggestions = _react2.default.createClass({ - displayName: 'Suggestions', - getInitialState: function getInitialState() { - return { fetching: true }; - }, - componentDidMount: function componentDidMount() { - _store2.default.plans.get(this.props.plan).on('change', this.updateState); - }, - updateState: function updateState() { - this.setState({ fetching: false }); - }, - componentWillReceiveProps: function componentWillReceiveProps(newPlan) { - _store2.default.plans.get(newPlan.plan).on('change', this.updateState); - }, - componentWillUnmount: function componentWillUnmount() { - _store2.default.plans.get('basic').off('change', this.updateState); - _store2.default.plans.get('premium').off('change', this.updateState); - _store2.default.plans.get('business').off('change', this.updateState); - _store2.default.plans.get('fund').off('change', this.updateState); - }, - render: function render() { - var _this = this; - - var suggestionsList = void 0; - if (_store2.default.session.isAllowedToView(this.props.plan)) { - var suggestions = _store2.default.plans.get(this.props.plan).get('suggestions').map(function (suggestion, i) { - return _react2.default.createElement(_Suggestion2.default, { key: _this.props.plan + suggestion.ticker, suggestion: suggestion, i: i, planName: _this.props.plan }); - }); - suggestionsList = _react2.default.createElement( - 'ul', - { className: 'suggestions-list' }, - suggestions - ); - } else { - suggestionsList = _react2.default.createElement( - 'section', - { className: 'no-permissions' }, - _react2.default.createElement( - 'h3', - null, - 'Upgrade to the ', - _react2.default.createElement( - 'span', - { className: 'capitalize blue-color ' }, - this.props.plan, - ' formula' - ), - ' to see these suggestions' - ), - _react2.default.createElement( - _reactRouter.Link, - { to: '/dashboard/account', className: 'filled-btn upgrade-your-plan' }, - 'Upgrade your plan' - ) - ); - } - - return _react2.default.createElement( - 'div', - { className: 'suggestions' }, - _react2.default.createElement(_SuggestionHeader2.default, { plan: this.props.plan }), - suggestionsList - ); - } -}); - -exports.default = Suggestions; - -},{"../../store":78,"./Suggestion":33,"./SuggestionHeader":35,"react":538,"react-router":361,"underscore":553}],37:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require("react"); - -var _react2 = _interopRequireDefault(_react); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var PrivacyPolicy = _react2.default.createClass({ - displayName: "PrivacyPolicy", - render: function render() { - return _react2.default.createElement( - "div", - { className: "privacy-policy" }, - _react2.default.createElement( - "h2", - null, - "Privacy Policy" - ), - _react2.default.createElement( - "p", - null, - "When you register an account on our website or application, as part of the process, we collect the personal information you give us such as your name, country and email address.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "When you browse our website or application, we also automatically receive your computer’s internet protocol (IP) address in order to provide us with information that helps us learn about your browser and operating system.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "Email marketing (if applicable): With your permission, we may send you emails about our website or application, new products and other updates.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null) - ), - _react2.default.createElement( - "h3", - null, - "Consent" - ), - _react2.default.createElement( - "p", - null, - "When you provide us with personal information, when you register an account, complete a transaction, verify your credit card, place an order, arrange for a delivery or return a purchase or give us your information in any other way, we imply that you consent to our collecting it and using it for that specific reason only.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "If we ask for your personal information for a secondary reason, like marketing, we will either ask you directly for your expressed consent, or provide you with an opportunity to say no." - ), - _react2.default.createElement( - "h3", - null, - "Disclosure" - ), - _react2.default.createElement( - "p", - null, - "We may disclose your personal information if we are required by law to do so or if you violate our Terms of Service." - ), - _react2.default.createElement( - "h3", - null, - "Payment" - ), - _react2.default.createElement( - "p", - null, - "If you choose a direct payment gateway to complete your purchase, then FORMULA STOCKS stores your credit card data. It is encrypted through the Payment Card Industry Data Security Standard (PCI-DSS). Your purchase transaction data is stored only as long as is necessary to complete your purchase transaction. After that is complete, your purchase transaction information is deleted.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "All direct payment gateways adhere to the standards set by PCI-DSS as managed by the PCI Security Standards Council, which is a joint effort of brands like Visa, MasterCard, American Express and Discover.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "PCI-DSS requirements help ensure the secure handling of credit card information by our website and its service providers." - ), - _react2.default.createElement( - "h3", - null, - "Third-party services" - ), - _react2.default.createElement( - "p", - null, - "In general, the third-party providers used by us will only collect, use and disclose your information to the extent necessary to allow them to perform the services they provide to us.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "However, certain third-party service providers, such as payment gateways and other payment transaction processors, have their own privacy policies in respect to the information we are required to provide to them for your purchase-related transactions.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "For these providers, we recommend that you read their privacy policies so you can understand the manner in which your personal information will be handled by these providers.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "In particular, remember that certain providers may be located in or have facilities that are located a different jurisdiction than either you or us. So if you elect to proceed with a transaction that involves the services of a third-party service provider, then your information may become subject to the laws of the jurisdiction(s) in which that service provider or its facilities are located.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "As an example, if you are located in Canada and your transaction is processed by a payment gateway located in the United States, then your personal information used in completing that transaction may be subject to disclosure under United States legislation, including the Patriot Act.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "Once you leave our website or application or are redirected to a third-party website or application, you are no longer governed by this Privacy Policy or our website’s Terms of Service." - ), - _react2.default.createElement( - "h3", - null, - "Links" - ), - _react2.default.createElement( - "p", - null, - "When you click on links on our store, they may direct you away from our site. We are not responsible for the privacy practices of other sites and encourage you to read their privacy statements." - ), - _react2.default.createElement( - "h3", - null, - "Security" - ), - _react2.default.createElement( - "p", - null, - "To protect your personal information, we take reasonable precautions and follow industry best practices to make sure it is not inappropriately lost, misused, accessed, disclosed, altered or destroyed.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "If you provide us with your credit card information, the information is encrypted using secure socket layer technology (SSL) and stored with a AES-256 encryption. Although no method of transmission over the Internet or electronic storage is 100% secure, we follow all PCI-DSS requirements and implement additional generally accepted industry standards." - ), - _react2.default.createElement( - "h3", - null, - "Cookies" - ), - _react2.default.createElement( - "p", - null, - "Like most interactive web sites this Company’s website [or ISP] uses cookies to enable us to retrieve user details for each visit. Cookies are used in some areas of our site to enable the functionality of this area and ease of use for those people visiting. Some of our affiliate partners may also use cookies." - ), - _react2.default.createElement( - "h3", - null, - "Age of consent" - ), - _react2.default.createElement( - "p", - null, - "By using this site, you represent that you are at least the age of majority in your state or province of residence, or that you are the age of majority in your state or province of residence and you have given us your consent to allow any of your minor dependents to use this site." - ), - _react2.default.createElement( - "h3", - null, - "Changes to this privacy policy" - ), - _react2.default.createElement( - "p", - null, - "We reserve the right to modify this privacy policy at any time, so please review it frequently. Changes and clarifications will take effect immediately upon their posting on the website or application. If we make material changes to this policy, we will notify you here that it has been updated, so that you are aware of what information we collect, how we use it, and under what circumstances, if any, we use and/or disclose it.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "If our website, company or application is acquired or merged with another company, your information may be transferred to the new owners so that we may continue to sell products to you." - ), - _react2.default.createElement( - "h3", - null, - "Questions and contact information" - ), - _react2.default.createElement( - "p", - null, - "If you would like to: access, correct, amend or delete any personal information we have about you, register a complaint, or simply want more information contact our Privacy Compliance Officer at info@formulastocks.com" - ), - _react2.default.createElement( - "p", - null, - "© Formula Stocks ApS 2015 All Rights Reserved" - ) - ); - } -}); - -exports.default = PrivacyPolicy; - -},{"react":538}],38:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require("react"); - -var _react2 = _interopRequireDefault(_react); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var TermsAndConditions = _react2.default.createClass({ - displayName: "TermsAndConditions", - render: function render() { - var styles = {}; - return _react2.default.createElement( - "div", - { className: "terms-and-conditions" }, - _react2.default.createElement( - "h2", - null, - "Terms and Conditions" - ), - _react2.default.createElement( - "p", - { className: "disclaimer" }, - "Last updated (May 30th, 2015)" - ), - _react2.default.createElement( - "p", - null, - "Please read these Terms and Conditions carefully before using the http://www.formulastocks.com website or our application operated by FormulaStocks ApS.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "The following terminology applies to these Terms and Conditions, Privacy Statement and Disclaimer Notice and any or all Agreements: \"Client\", “You” and “Your” refers to you, the person accessing this website and accepting the Company’s terms and conditions. “FORMULA STOCKS”, “Formula Stocks ApS” \"The Company\", “Ourselves”, “We” and \"Us\", refers to our Company. “Party”, “Parties”, or “Us”, refers to both the Client and ourselves, or either the Client or ourselves. All terms refer to the offer, acceptance and consideration of payment necessary to undertake the process of our assistance to the Client in the most appropriate manner, whether by formal meetings of a fixed duration, or any other means, for the express purpose of meeting the Client’s needs in respect of provision of the Company’s stated services/products, in accordance with and subject to, prevailing English Law. Any use of the above terminology or other words in the singular, plural, capitalisation and/or he/she or they, are taken as interchangeable and therefore as referring to same.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "Your access to and use of the Service is conditioned on your acceptance of and compliance with these Terms. These Terms apply to all visitors, users and other who access or use the Service.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "By visiting our website or Application and/ or purchasing something from us, you engage in our “Service” and to be bound by the following terms and conditions (“Terms of Service”, “Terms”), including those additional terms and conditions and policies referenced herein and/or available by hyperlink. These Terms of Service apply to all users of the site, including without limitation users who are browsers, vendors, customers, merchants, and/ or contributors of content.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "Please read these Terms of Service carefully before accessing or using our website. By accessing or using any part of the site, you agree to be bound by these Terms of Service. If you do not agree to all the terms and conditions of this agreement, then you may not access the website or use any services.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "Any new features or tools which are added to the current service shall also be subject to the Terms of Service. You can review the most current version of the Terms of Service at any time on this page. We reserve the right to update, change or replace any part of these Terms of Service by posting updates and/or changes to our website. It is your responsibility to check this page periodically for changes. Your continued use of or access to the website following the posting of any changes constitutes acceptance of those changes.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "The headings used in this agreement are included for convenience only and will not limit or otherwise affect these Terms." - ), - _react2.default.createElement( - "h3", - null, - "Licensing" - ), - _react2.default.createElement( - "p", - null, - "A) BASIC or PREMIUM plans:", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "By purchasing a BASIC or PREMIUM plan you acquire the right to use the service for your personal investment account(s) held in your name. You may not resell, share, or otherwise provide the information obtained through our service to any other person, whether personally or by any other medium. Sharing of personal access codes to the website, as well as copyrighted data from the website, is expressly prohibited, and transgressions will be considered a criminal offense.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "B) BUSINESS plan:", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "The BUSINESS license is personal, and allows one person access to use FORMULA STOCKS, meaning several users within one company requires multiple licenses. BUSINESS cannot be accessed by institutional capital, advisors advising multiple clients, by funds, or any collective investment vehicles. Please refer to FUND instead. FORMULA STOCKS reserves the right to allocate only a select number of slots to BUSINESS plan subscribers, and the right to accept subscribers to this particular plan only on a clearly subjective basis. Sharing of personal access codes to the website is expressly prohibited, and transgressions will be considered a criminal offense.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "B) FUND plan:", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "The FUND license is a company-specific and company-wide license. FUND allows for multiple users within one company. The license is intended for commercial use. Usage of FORMULA STOCKS plans by an investment advisor advising multiple clients, is only possible through the FUND plan. The FUND flat fee structure has no limits as regards AUM under the provision that it is only used within one legal entity. It is possible to use FUND for a distributed commercial product, such as a fund, ETF, other investment vehicle or other forms of institutional capital. Please contact a Formula Stocks representative for further details." - ), - _react2.default.createElement( - "h3", - null, - "General" - ), - _react2.default.createElement( - "p", - null, - "FORMULA STOCKS is an information provider, not an investment advisory service, nor a registered investment advisor and does not offer individual investment advice. FORMULA STOCKS does not manage client funds, but act solely as an information and technology supplier. FORMULA STOCKS does not purport to tell or suggest which securities individual customers should buy or sell for themselves. FORMULA STOCKS purchase or sell indications, are not solicitations to buy or sell, but rather, information you can use as a starting point for doing additional independent research in order to allow you to form your own opinion regarding investments, and make your own informed decisions.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "FORMULA STOCKS assume no responsibility or liability for your investment results. You understand and acknowledge that there is a high degree of risk involved in investing in securities. This document and service does not constitute an offer, a solicitation to buy a security or to open a brokerage account. The terms and conditions of the products described herein are indicative and are subject to change.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "The supplied information is provided solely for educational and informational purposes and may not be construed as an offer to buy or sell, or a solicitation of an offer to buy or sell, any financial instrument or to engage in any specific strategy or as an official confirmation of terms.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "It should not be assumed that the systems presented in these products will be profitable or that they will not result in losses. Past results of any investment system published by Formula Stocks are not necessarily indicative of future returns. In addition, information, system output, articles and other features of our products are provided for educational and informational purposes only and should not be construed as investment advice. Accordingly, you should not rely solely on this information in making any investment. You should check with your licensed financial advisor and tax advisor to determine the suitability of any investment, and/or read relevant prospectuses, while taking into account your own financial situation and objectives.FORMULA STOCKS plans vary in terms of diversification, and may or may not be adequately diversified for any particular risk profile as the required level of diversification differs from individual to individual. Set your own individual maximum position size accordingly or consult an advisor.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "The real time test period 2009-2011 reflects actual investment results. Other period statistics are the result of backtesting the strategies. Backtested performance results have certain inherent limitations, as they could potentially be designed with some benefit of hindsight, even though best efforts has been taken to avoid such risk. Unlike an actual performance record (such as the 2009-2011 record), backtested results do not represent actual trading and may not be impacted by brokerage and other slippage fees. Also, since transactions may or may not actually have been executed, results may have under- or over-compensated for impact, if any, of certain market factors, such as lack of market liquidity or level of participation. FORMULA STOCKS business analytics depend on the accuracy of the published accounts of public corporations. Such accuracy may from time to time be less than ideal. FORMULA STOCKS strategies evolve and improve on a recurring basis, and any result and statistic is therefore subject to change without notice. FORMULA STOCKS employees may or may not own equities mentioned in the service. NO REPRESENTATION IS BEING MADE THAT YOU ARE LIKELY TO ACHIEVE PROFITS OR LOSSES SIMILAR TO THOSE SHOWN.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "For users of our “BUSINESS” plan service only (does not apply to “BASIC” or “PREMIUM” plan members): The BUSINESS service is intended for what is generally known as accredited or sophisticated investors, or corporations/businesses. The exact definition of accredited and sophisticated varies between countries, generally referring to either a certain net worth, income, or professional status, status as a corporation or financial institution or business with relation to the investment field. In the US it could imply either a net worth in excess of 1 mio. USD, excluding value of primary residence, or alternatively an annual income of at least 200,000 USD, or other factors as defined in regulations, such as status as an investment company, bank, insurance company, charitable organization with a certain amount of assets, and many other designations. Using BUSINESS does require some knowledge about investments in general, due to its focused nature, and if you sign up to the BUSINESS plan, you indicate that you can be considered either A) a sophisticated or accredited investor based upon either the rules of definition in your country of residence, or B) Represent a corporation/business which by definition enlists the services of tax or financial advisors, or C) by your own definition meet similar standards of investment knowledge where this may be applicable.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "Keep in mind that while diversification may help spread risk it does not assure a profit, or protect against loss. There is always the potential of losing money when you invest in securities, or other financial products. Investors should consider their investment objectives and risks carefully in the context of their own personal financial situation before investing.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "We reserve the right to refuse service to anyone for any reason at any time.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "Credit card information is always encrypted during transfer over networks. You understand that your content (not including credit card information), may be transferred unencrypted and involve (a) transmissions over various networks; and (b) changes to conform and adapt to technical requirements of connecting networks or devices.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "You agree not to reproduce, duplicate, copy, sell, resell or exploit any portion of the Service, use of the Service, or access to the Service or any contact on the website through which the service is provided, without express written permission by us." - ), - _react2.default.createElement( - "h3", - null, - "Licensing" - ), - _react2.default.createElement( - "p", - null, - "A) BASIC or PREMIUM plans:", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "By purchasing a BASIC or PREMIUM plan you acquire the right to use the service for your personal investment account. You may not resell, share, or otherwise provide the information obtained through our service to any other person." - ), - _react2.default.createElement( - "h3", - null, - "Age of consent" - ), - _react2.default.createElement( - "p", - null, - "By agreeing to these Terms of Service, you represent that you are at least the age of majority in your state, country or province of residence, or that you are the age of majority in your state, country or province of residence and you have given us your consent to allow any of your minor dependents to use this site." - ), - _react2.default.createElement( - "h3", - null, - "Violation of laws" - ), - _react2.default.createElement( - "p", - null, - "You may not use our products for any illegal or unauthorized purpose nor may you, in the use of the Service, violate any laws in your jurisdiction (including but not limited to copyright laws).", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "You must not transmit any worms or viruses or any code of a destructive nature." - ), - _react2.default.createElement( - "h3", - null, - "Accuracy, completeness and timeliness of information" - ), - _react2.default.createElement( - "p", - null, - "We are not responsible if information made available on this site is not accurate, complete or current. The material on this site is provided for general information only and should not be relied upon or used as the sole basis for making decisions without consulting primary, more accurate, more complete or more timely sources of information. Any reliance on the material on this site is at your own risk.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "This site may contain certain historical information. Historical information, necessarily, is not current and is provided for your reference only. We reserve the right to modify the contents of this site at any time, but we have no obligation to update any information on our site. You agree that it is your responsibility to monitor changes to our site." - ), - _react2.default.createElement( - "h3", - null, - "Modifications to the service and prices" - ), - _react2.default.createElement( - "p", - null, - "Prices for our products are subject to change without notice.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "We reserve the right at any time to modify or discontinue the Service (or any part or content thereof) without notice at any time.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "We shall not be liable to you or to any third-party for any modification, price change, suspension or discontinuance of the Service." - ), - _react2.default.createElement( - "h3", - null, - "Products and Services" - ), - _react2.default.createElement( - "p", - null, - "Certain products or services may be available exclusively online through the website or our application. These products or services may have limited quantities and are subject to return or exchange only according to our Return Policy.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "We reserve the right, but are not obligated, to limit the sales of our products or Services to any person, geographic region or jurisdiction. We may exercise this right on a case-by-case basis. We reserve the right to limit the quantities of any products or services that we offer. All descriptions of products or product pricing are subject to change at anytime without notice, at the sole discretion of us. We reserve the right to discontinue any product at any time. Any offer for any product or service made on this site is void where prohibited.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "We do not warrant that the quality of any products, services, information, or other material purchased or obtained by you will meet your expectations, or that any errors in the Service will be corrected." - ), - _react2.default.createElement( - "h3", - null, - "Accuracy of billing and account information" - ), - _react2.default.createElement( - "p", - null, - "We reserve the right to refuse any order you place with us. We may, in our sole discretion, limit or cancel quantities purchased per person, per household or per order. These restrictions may include orders placed by or under the same customer account, the same credit card, and/or orders that use the same billing and/or shipping address. In the event that we make a change to or cancel an order, we may attempt to notify you by contacting the e-mail and/or billing address/phone number provided at the time the order was made. We reserve the right to limit or prohibit orders that, in our sole judgment, appear to be placed by dealers, resellers or distributors.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "You agree to provide current, complete and accurate purchase and account information for all purchases made at our website or application. You agree to promptly update your account and other information, including your email address and credit card numbers and expiration dates, so that we can complete your transactions and contact you as needed." - ), - _react2.default.createElement( - "h3", - null, - "Optional tools" - ), - _react2.default.createElement( - "p", - null, - "We may provide you with access to third-party tools over which we neither monitor nor have any control nor input.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "You acknowledge and agree that we provide access to such tools ”as is” and “as available” without any warranties, representations or conditions of any kind and without any endorsement. We shall have no liability whatsoever arising from or relating to your use of optional third-party tools.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "Any use by you of optional tools offered through the site is entirely at your own risk and discretion and you should ensure that you are familiar with and approve of the terms on which tools are provided by the relevant third-party provider(s).", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "We may also, in the future, offer new services and/or features through the website or application (including, the release of new tools and resources). Such new features and/or services shall also be subject to these Terms of Service." - ), - _react2.default.createElement( - "h3", - null, - "Third party links" - ), - _react2.default.createElement( - "p", - null, - "Certain content, products and services available via our Service may include materials from third-parties.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "Third-party links on this site may direct you to third-party websites that are not affiliated with us. We are not responsible for examining or evaluating the content or accuracy and we do not warrant and will not have any liability or responsibility for any third-party materials or websites, or for any other materials, products, or services of third-parties.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "We do not monitor or review the content of other party’s websites which are linked to from this website or application. Opinions expressed or material appearing on such websites are not necessarily shared or endorsed by us and should not be regarded as the publisher of such opinions or material. Please be aware that we are not responsible for the privacy practices, or content, of these sites. We encourage our users to be aware when they leave our site & to read the privacy statements of these sites. You should evaluate the security and trustworthiness of any other site connected to this site or accessed through this site yourself, before disclosing any personal information to them. This Company will not accept any responsibility for any loss or damage in whatever manner, howsoever caused, resulting from your disclosure to third parties of personal information.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "We are not liable for any harm or damages related to the purchase or use of goods, services, resources, content, or any other transactions made in connection with any third-party websites. Please review carefully the third-party's policies and practices and make sure you understand them before you engage in any transaction. Complaints, claims, concerns, or questions regarding third-party products should be directed to the third-party." - ), - _react2.default.createElement( - "h3", - null, - "User comments, feedback and other submissions" - ), - _react2.default.createElement( - "p", - null, - "If, at our request, you send certain specific submissions (for example contest entries) or without a request from us you send creative ideas, suggestions, proposals, plans, or other materials, whether online, by email, by postal mail, or otherwise (collectively, 'comments'), you agree that we may, at any time, without restriction, edit, copy, publish, distribute, translate and otherwise use in any medium any comments that you forward to us. We are and shall be under no obligation (1) to maintain any comments in confidence; (2) to pay compensation for any comments; or (3) to respond to any comments.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "We may, but have no obligation to, monitor, edit or remove content that we determine in our sole discretion are unlawful, offensive, threatening, libelous, defamatory, pornographic, obscene or otherwise objectionable or violates any party’s intellectual property or these Terms of Service.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "You agree that your comments will not violate any right of any third-party, including copyright, trademark, privacy, personality or other personal or proprietary right. You further agree that your comments will not contain libelous or otherwise unlawful, abusive or obscene material, or contain any computer virus or other malware that could in any way affect the operation of the Service or any related website or application. You may not use a false e-mail address, pretend to be someone other than yourself, or otherwise mislead us or third-parties as to the origin of any comments. You are solely responsible for any comments you make and their accuracy. We take no responsibility and assume no liability for any comments posted by you or any third-party." - ), - _react2.default.createElement( - "h3", - null, - "Errors, inaccuracies and omissions" - ), - _react2.default.createElement( - "p", - null, - "Occasionally there may be information on our site or in the Service that contains typographical errors, inaccuracies or omissions that may relate to information services, product descriptions or content, pricing, promotions, offers, product shipping charges, transit times and availability. We reserve the right to correct any errors, inaccuracies or omissions, and to change or update information or cancel orders if any information in the Service or on any related website or application is inaccurate at any time without prior notice (including after you have submitted your order).", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "We undertake no obligation to update, amend or clarify information in the Service or on any related website or application, including without limitation, pricing information, except as required by law. No specified update or refresh date applied in the Service or on any related website or application, should be taken to indicate that all information in the Service or on any related website or application has been modified or updated." - ), - _react2.default.createElement( - "h3", - null, - "Prohibited uses" - ), - _react2.default.createElement( - "p", - null, - "In addition to other prohibitions as set forth in the Terms of Service, you are prohibited from using the site or its content: (a) for any unlawful purpose; (b) to solicit others to perform or participate in any unlawful acts; (c) to violate any international, federal, provincial or state regulations, rules, laws, or local ordinances; (d) to infringe upon or violate our intellectual property rights or the intellectual property rights of others; (e) to harass, abuse, insult, harm, defame, slander, disparage, intimidate, or discriminate based on gender, sexual orientation, religion, ethnicity, race, age, national origin, or disability; (f) to submit false or misleading information; (g) to upload or transmit viruses or any other type of malicious code that will or may be used in any way that will affect the functionality or operation of the Service or of any related website, other websites, other applications, or the Internet; (h) to collect or track the personal information of others; (i) to spam, phish, pharm, pretext, spider, crawl, or scrape; (j) for any obscene or immoral purpose; or (k) to interfere with or circumvent the security features of the Service or any related website, other websites, other applications, or the Internet. We reserve the right to terminate your use of the Service or any related website or application for violating any of the prohibited uses." - ), - _react2.default.createElement( - "h3", - null, - "Disclaimer of warranties; limitation of liability" - ), - _react2.default.createElement( - "p", - null, - "We do not guarantee, represent or warrant that your use of our service will be uninterrupted, timely, secure or error-free.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "We make no warranties or representations about the accuracy or completeness of the Web Site’s content or the content of any Internet site linked to or from the Web Site.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "We do not warrant that the results that may be obtained from the use of the service will be accurate or reliable.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "You agree that from time to time we may remove the service for indefinite periods of time or cancel the service at any time, without notice to you.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "You expressly agree that your use of, or inability to use, the service is at your sole risk. The service and all products and services delivered to you through the service are (except as expressly stated by us) provided 'as is' and 'as available' for your use, without any representation, warranties or conditions of any kind, either express or implied, including all implied warranties or conditions of merchantability, merchantable quality, fitness for a particular purpose, durability, title, and non-infringement.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "In no case shall FORMULA STOCKS, our directors, officers, employees, affiliates, agents, contractors, interns, suppliers, service providers, subsidiaries or licensors be liable for any injury, loss, claim, or any direct, indirect, incidental, punitive, special, or consequential damages of any kind, including, without limitation lost profits, lost revenue, lost savings, loss of data, replacement costs, or any similar damages, whether based in contract, tort (including negligence), strict liability or otherwise, arising from your use of any of the service or any products procured using the service, or for any other claim related in any way to your use of the service or any product, including, but not limited to, any errors or omissions in any content, or any loss or damage of any kind incurred as a result of the use of the service or any content (or product) posted, transmitted, or otherwise made available via the service, even if advised of their possibility. Because some states, countries or jurisdictions do not allow the exclusion or the limitation of liability for consequential or incidental damages, in such states, countries or jurisdictions, our liability shall be limited to the maximum extent permitted by law.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "YOUR USE OF THE WEB SITE IS AT YOUR OWN RISK. TO THE FULLEST EXTENT PERMITTED UNDER APPLIABLE LAW, YOU UNDERSTAND AND AGREE THAT NEITHER WE NOR ANY THIRD-PARTY CONTENT PROVIDERS SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY OR ANY OTHER DAMAGES RELATING TO OR RESULTING FROM YOUR USE OR INABILITY TO USE THE WEB SITE OR ANY OTHER SITE YOU ACCESS THROUGH A LINK FROM THE WEB SITE OR FROM ANY ACTIONS WE TAKE OR FAIL TO TAKE. THESE INCLUDE DAMAGES FOR ERRORS, OMISSIONS, INTERRUPTIONS, DEFECTS, DELAYS, COMPUTER VIRUSES, YOUR LOSS OF PROFITS, LOSS OF DATA, UNAUTHORIZED ACCESS TO AND ALTERATION OF YOUR TRANSMISSIONS AND DATA, AND OTHER TANGIBLE AND INTANGIBLE LOSSES. THIS LIMITATION APPLIES REGARDLESS WHETHER THE DAMAGES ARE CLAIMED UNDER THE TERMS OF A CONTRACT, AS A RESULT OF NEGLIGENCE OR OTHERWISE, AND EVEN IF OUR REPRESENTATIVES OR WE HAVE BEEN NEGLIGENT OR HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY." - ), - _react2.default.createElement( - "h3", - null, - "Severability" - ), - _react2.default.createElement( - "p", - null, - "In the event that any provision of these Terms of Service is determined to be unlawful, void or unenforceable, such provision shall nonetheless be enforceable to the fullest extent permitted by applicable law, and the unenforceable portion shall be deemed to be severed from these Terms of Service, such determination shall not affect the validity and enforceability of any other remaining provisions." - ), - _react2.default.createElement( - "h3", - null, - "Termination" - ), - _react2.default.createElement( - "p", - null, - "We may terminate or suspend access to our Service immediately, without prior notice or liability for any reason whatsoever, including without limitation if you breach the Terms.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "The obligations and liabilities of the parties incurred prior to the termination date shall survive the termination of this agreement for all purposes.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "All provisions of the Terms which by their nature should survive termination shall survive termination, including, without limitation, ownership provisions, warranty disclaimers, indemnity and limitations of liability.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "A breach or violation of any of the Terms will result in an immediate termination of your Services.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "If in our sole judgment you fail, or we suspect that you have failed, to comply with any term or provision of these Terms of Service, we also may terminate this agreement at any time without notice and you will remain liable for all amounts due up to and including the date of termination; and/or accordingly may deny you access to our Services (or any part thereof)." - ), - _react2.default.createElement( - "h3", - null, - "Confidentiality" - ), - _react2.default.createElement( - "p", - null, - "We are registered under the Data Protection Act 1998 and as such, any information concerning the Client and their respective Client Records may be passed to third parties. However, Client records are regarded as confidential and therefore will not be divulged to any third party, other than our suppliers or if legally required to do so to the appropriate authorities. Clients have the right to request sight of, and copies of any and all Client Records we keep, on the proviso that we are given reasonable notice of such a request. Clients are requested to retain copies of any literature issued in relation to the provision of our services. Where appropriate, we shall issue Client’s with appropriate written information, handouts or copies of records as part of an agreed contract, for the benefit of both parties.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "We will not sell, share, or rent your personal information to any third party or use your e-mail address for unsolicited mail. Any emails sent by this Company will only be in connection with the provision of agreed services and products." - ), - _react2.default.createElement( - "h3", - null, - "Exclusions and Limitations" - ), - _react2.default.createElement( - "p", - null, - "The information on this web site is provided on an \"as is\" basis. To the fullest extent permitted by law, this Company: § excludes all representations and warranties relating to this website or application and its contents or which is or may be provided by any affiliates or any other third party, including in relation to any inaccuracies or omissions in this website or application and/or the Company’s literature; and § excludes all liability for damages arising out of or in connection with your use of this website or application. This includes, without limitation, direct loss, loss of business or profits (whether or not the loss of such profits was foreseeable, arose in the normal course of things or you have advised this Company of the possibility of such potential loss), damage caused to your computer, computer software, systems and programs and the data thereon or any other direct or indirect, consequential and incidental damages. This Company does not however exclude liability for death or personal injury caused by its negligence. The above exclusions and limitations apply only to the extent permitted by law. None of your statutory rights as a consumer are affected." - ), - _react2.default.createElement( - "h3", - null, - "Personal Data" - ), - _react2.default.createElement( - "p", - null, - "By using the Service, you are consenting to have your personal data transferred to and processed by FORMULA STOCKS and its affiliates. As part of providing you the Service, we may need to provide you with certain communications, such as service announcements and administrative messages. These communications are considered part of the Service, which you may not be able to opt-out from receiving.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "If our website, company or application is acquired or merged with another company, your information may be transferred to the new owners so that we may continue to sell products to you" - ), - _react2.default.createElement( - "h3", - null, - "Termination of Agreements and Refunds Policy" - ), - _react2.default.createElement( - "p", - null, - "Both the Client and ourselves have the right to terminate any Services Agreement for any reason, including the ending of services that are already underway. No refunds shall be offered, where a Service is deemed to have begun and is, for all intents and purposes, underway. Any monies that have been paid to us which constitute payment in respect of the provision of unused Services, shall be refunded." - ), - _react2.default.createElement( - "h3", - null, - "Indemnification" - ), - _react2.default.createElement( - "p", - null, - "You agree to indemnify, defend and hold us and all of our affiliates, agents, directors, employees, information providers, licensors and licensees and officers (collectively, the “Indemnified Parties”) harmless from and against any and all liabilities and costs (including, without limitation, attorneys’ fees and costs) incurred by the Indemnified Parties in connection with any claim arising out of any breach by you of these Terms and Conditions or the representations, warranties and covenants contained herein. You will use your best efforts to cooperate with us in the defense of any claim. We reserve the right, at our own expense, to assume the exclusive defense and control of any matter otherwise subject to indemnification by you and you shall not in any event settle any matter without the written consent of us." - ), - _react2.default.createElement( - "h3", - null, - "Availability" - ), - _react2.default.createElement( - "p", - null, - "You are solely responsible for evaluating the fitness for a particular purpose of any downloads, programs, data, content, information and text available through this site. Redistribution or republication of any part of this site or its content is prohibited, including such by framing or other similar or any other means, without the express written consent of the Company. The Company does not warrant that the service from this site will be uninterrupted, timely or error free, although it is provided to the best ability. By using this service you thereby indemnify this Company, its employees, agents and affiliates against any loss or damage, in whatever manner, howsoever caused." - ), - _react2.default.createElement( - "h3", - null, - "Log Files" - ), - _react2.default.createElement( - "p", - null, - "We use IP addresses to analyse trends, administer the site, track user’s movement, and gather broad demographic information for aggregate use. IP addresses are not linked to personally identifiable information. Additionally, for systems administration, detecting usage patterns and troubleshooting purposes, our web servers automatically log standard access information including browser type, access times/open mail, URL requested, and referral URL. This information is not shared with third parties and is used only within this Company on a need-to-know basis. Any individually identifiable information related to this data will never be used in any way different to that stated above without your explicit permission." - ), - _react2.default.createElement( - "h3", - null, - "Cookies" - ), - _react2.default.createElement( - "p", - null, - "Like most interactive web sites this Company’s website [or ISP] uses cookies to enable us to retrieve user details for each visit. Cookies are used in some areas of our site to enable the functionality of this area and ease of use for those people visiting. Some of our affiliate partners may also use cookies." - ), - _react2.default.createElement( - "h3", - null, - "Copyright Notice" - ), - _react2.default.createElement( - "p", - null, - "Copyright and other relevant intellectual property rights exists on all text, images, charts and data relating to the Company’s services and the full content of this website or application." - ), - _react2.default.createElement( - "h3", - null, - "Force Majeure" - ), - _react2.default.createElement( - "p", - null, - "Neither party shall be liable to the other for any failure to perform any obligation under any Agreement which is due to an event beyond the control of such party including but not limited to any Act of God, terrorism, war, Political insurgence, insurrection, riot, civil unrest, act of civil or military authority, uprising, earthquake, flood or any other natural or man made eventuality outside of our control, which causes the termination of an agreement or contract entered into, nor which could have been reasonably foreseen. Any Party affected by such event shall forthwith inform the other Party of the same and shall use all reasonable endeavours to comply with the terms and conditions of any Agreement contained herein." - ), - _react2.default.createElement( - "h3", - null, - "Waiver" - ), - _react2.default.createElement( - "p", - null, - "Failure of either Party to insist upon strict performance of any provision of this or any Agreement or the failure of either Party to exercise any right or remedy to which it, he or they are entitled hereunder shall not constitute a waiver thereof and shall not cause a diminution of the obligations under this or any Agreement. No waiver of any of the provisions of this or any Agreement shall be effective unless it is expressly stated to be such and signed by both Parties." - ), - _react2.default.createElement( - "h3", - null, - "Jurisdictional Provisions." - ), - _react2.default.createElement( - "p", - null, - "These terms and conditions shall be governed by and construed in accordance with the laws of Denmark, without giving effect to any principles of conflicts of law. You agree that any action at law or in equity arising out of or relating to these terms and conditions shall be filed only in the courts located in Denmark, and you hereby consent and submit to the personal jurisdiction of such courts for the purposes of litigating any such action. We recognize that it is possible for you to obtain access to the Web Site from any jurisdiction in the world, but we have no practical ability to prevent such access. The Web Site has been designed to comply with the laws of Denmark. If any material on the Web Site, or your use of the Web Site, is contrary to the laws of the place where you are when you access it, the Web Site is not intended for you, and we ask you not to use the Web Site. You are responsible for informing yourself of the laws of your jurisdiction and complying with them. Some products and services may not be available in all jurisdictions. If any of these terms are deemed invalid or unenforceable for any reason (including, but not limited to the exclusions and limitations set out above), then the invalid or unenforceable provision will be severed from these terms and the remaining terms will continue to apply. Failure of the Company to enforce any of the provisions set out in these Terms and Conditions and any Agreement, or failure to exercise any option to terminate, shall not be construed as waiver of such provisions and shall not affect the validity of these Terms and Conditions or of any Agreement or any part thereof, or the right thereafter to enforce each and every provision. These Terms and Conditions shall not be amended, modified, varied or supplemented except in writing and signed by duly authorised representatives of the company." - ), - _react2.default.createElement( - "h3", - null, - "Entire Agreement" - ), - _react2.default.createElement( - "p", - null, - "These Terms, including any legal notices and disclaimers contained on this Website or application, constitute the entire agreement between FORMULA STOCKS and you in relation to your use of this Website or application, and supersede all prior agreements and understandings with respect to the same." - ), - _react2.default.createElement( - "h3", - null, - "Changes to terms of service" - ), - _react2.default.createElement( - "p", - null, - "We reserve the right, at our sole discretion, to update, add to, change or replace any part of these Terms of Service by posting updates and changes to our website. It is your responsibility to check our website periodically for changes. Your continued use of or access to our website or the Service following the posting of any changes to these Terms of Service constitutes acceptance of those changes. You are therefore advised to re-read this statement on a regular basis." - ), - _react2.default.createElement( - "h3", - null, - "Contact information" - ), - _react2.default.createElement( - "p", - null, - "Questions about the Terms of Service should be sent to us at info@formulastocks.com.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "These terms and conditions form part of the Agreement between the Client and ourselves. Your accessing of this website and/or undertaking of a booking or Agreement indicates your understanding, agreement to and acceptance, of the Disclaimer Notice and the full Terms and Conditions contained herein. Your statutory Consumer Rights are unaffected." - ), - _react2.default.createElement( - "p", - null, - "© Formula Stocks ApS 2015 All Rights Reserved" - ) - ); - } -}); - -exports.default = TermsAndConditions; - -},{"react":538}],39:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _ProfileCard = require('./ProfileCard'); - -var _ProfileCard2 = _interopRequireDefault(_ProfileCard); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var AboutUs = _react2.default.createClass({ - displayName: 'AboutUs', - getInitialState: function getInitialState() { - return { selectedEmployee: 'Thomas' }; - }, - selectEmployee: function selectEmployee(name) { - this.setState({ selectedEmployee: name }); - }, - - - //
- // - // - // - //
- render: function render() { - - var classThomas = void 0, - classMark = void 0, - classMarie = void 0, - bio = void 0; - if (this.state.selectedEmployee === 'Thomas') { - classThomas = 'selected'; - bio = 'Thomas Lyck is the founder of eight businesses since 1990.\n Some of the more well-known include the system which created the building instructions for all\n LEGO products for more than a decade, and many pioneering computer graphics solutions for the movie\n industry in the early 1990s facilitating the analog to digital industry transition. Besides being\n CEO and an accomplished investor, Thomas is a specialist in parallel supercomputing, complex data,\n and artificial intelligence, and he has recently spent a decade developing the advanced technology\n behind Formula Stocks.\n'; - } else if (this.state.selectedEmployee === 'Mark') { - classMark = 'selected'; - bio = _react2.default.createElement( - 'p', - null, - 'It is possible to beat the market. Our portfolio service is the product of a decade\'s worth of advanced equity research. We know how to gain an edge over the market, and we want to share our results with you.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'Mark Lyck is an entrepreneur who has brought his experience and edge to Formula Stocks through collaboration with Thomas. With a background in Business Administration and web-based user interface design, he makes complex technology easily accessible for everyone in, in a user-friendly manner.' - ); - } else if (this.state.selectedEmployee === 'Marie') { - classMarie = 'selected'; - bio = 'Marie works with documentation and localization and assists with research and quality control.\n A PhD., graduate of Royal Holloway, London, and Aarhus University, Aarhus,\n Marie\'s focus areas have been post-modern literature, research, as well as complexity theory.\n She is a language expert and outstanding in terms of ensuring that the highest possible\n standards are always methodically applied.'; - } - - return _react2.default.createElement( - 'section', - { className: 'about-us' }, - _react2.default.createElement( - 'h2', - null, - 'About us' - ), - _react2.default.createElement('div', { className: 'divider' }), - _react2.default.createElement( - 'div', - { className: 'content' }, - _react2.default.createElement( - 'p', - { className: 'about-fs' }, - 'Formula Stocks is a research and development company based in Denmark. We started R&D operations in 2003. The basic idea was simple: leveraging decades of supercomputer experience and investment acumen to create an informational advantage in equity investing. We have specialized in being right far more often than we are wrong, using a scientific approach and intelligent technology to analyze businesses and business models and thus accumulate knowledge which can be found nowhere else.' - ), - _react2.default.createElement( - 'div', - { className: 'employees' }, - _react2.default.createElement( - 'div', - { className: 'top-section' }, - _react2.default.createElement('div', { className: 'left', style: { backgroundImage: 'url("assets/images/profiles/' + this.state.selectedEmployee + '.jpg")' } }), - _react2.default.createElement( - 'div', - { className: 'right' }, - _react2.default.createElement( - 'p', - null, - bio - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'button-wrapper' }, - _react2.default.createElement( - 'button', - { className: classThomas, onClick: this.selectEmployee.bind(null, 'Thomas') }, - _react2.default.createElement( - 'h3', - null, - 'Thomas Lyck' - ), - _react2.default.createElement( - 'p', - null, - 'CEO' - ) - ), - _react2.default.createElement( - 'button', - { className: classMark, onClick: this.selectEmployee.bind(null, 'Mark') }, - _react2.default.createElement( - 'h3', - null, - 'Mark Lyck' - ), - _react2.default.createElement( - 'p', - null, - 'COO' - ) - ), - _react2.default.createElement( - 'button', - { className: classMarie, onClick: this.selectEmployee.bind(null, 'Marie') }, - _react2.default.createElement( - 'h3', - null, - 'Marie Lauritzen' - ), - _react2.default.createElement( - 'p', - null, - 'PhD. Research Assistant' - ) - ) - ) - ) - ) - ); - } -}); - -exports.default = AboutUs; - -},{"./ProfileCard":55,"react":538}],40:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Brochures = _react2.default.createClass({ - displayName: 'Brochures', - downloadBrochure: function downloadBrochure(name) { - window.open('/assets/downloads/' + name + '.pdf'); - }, - render: function render() { - return _react2.default.createElement( - 'section', - { className: 'brochures' }, - _react2.default.createElement( - 'h2', - { className: 'title' }, - 'Want more information? Download our brochures' - ), - _react2.default.createElement( - 'div', - { className: 'cta' }, - _react2.default.createElement( - 'button', - { onClick: this.downloadBrochure.bind(null, 'FAQ'), className: 'filled-btn' }, - _react2.default.createElement('i', { className: 'fa fa-file', 'aria-hidden': 'true' }), - 'FAQ' - ), - _react2.default.createElement( - 'button', - { onClick: this.downloadBrochure.bind(null, 'business'), className: 'filled-btn' }, - _react2.default.createElement('i', { className: 'fa fa-file', 'aria-hidden': 'true' }), - 'Business brochure' - ) - ) - ); - } -}); - -exports.default = Brochures; - -},{"../../store":78,"react":538}],41:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _reactScroll = require('react-scroll'); - -var _reactScroll2 = _interopRequireDefault(_reactScroll); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var ContactUs = _react2.default.createClass({ - displayName: 'ContactUs', - getInitialState: function getInitialState() { - return { sending: false, sent: false, error: false }; - }, - contactUs: function contactUs(e) { - var _this = this; - - e.preventDefault(); - this.setState({ sending: true }); - var email = this.refs.email.value; - if (_store2.default.session.validateEmail(email)) { - var name = this.refs.name.value; - var company = this.refs.company.value; - var body = this.refs.body.value; - _jquery2.default.ajax({ - url: 'https://baas.kinvey.com/rpc/' + _store2.default.settings.appKey + '/custom/contactus', - type: 'POST', - data: { - email: email, - name: name, - body: body, - company: company - } - }).then(function (r) { - _this.setState({ sending: false, sent: true }); - _this.refs.email.value = ''; - _this.refs.body.value = ''; - _this.refs.company.value = ''; - _this.refs.name.value = ''; - }).fail(function () { - _this.setState({ sending: false, error: true }); - }); - } else { - this.setState({ sending: false, error: 'Invalid email' }); - console.log('invalid email'); - } - }, - changingEmail: function changingEmail() { - this.setState({ sending: false, error: false }); - }, - render: function render() { - var Element = _reactScroll2.default.Element; - // - var sendBtn = _react2.default.createElement( - 'button', - { className: 'filled-btn submit' }, - _react2.default.createElement('i', { className: 'fa fa-paper-plane', 'aria-hidden': 'true' }), - 'Send' - ); - // let sendBtn = - - if (this.state.sending) { - sendBtn = _react2.default.createElement( - 'button', - { className: 'filled-btn submit' }, - _react2.default.createElement('i', { className: 'fa fa-spinner fa-pulse fa-fw blue-color' }) - ); - } else if (this.state.sent) { - sendBtn = _react2.default.createElement( - 'button', - { className: 'filled-btn submit' }, - _react2.default.createElement('i', { className: 'fa fa-check green-color' }), - _react2.default.createElement( - 'p', - { className: 'green-color' }, - 'Sent' - ) - ); - } else if (this.state.error) { - sendBtn = _react2.default.createElement( - 'button', - { className: 'filled-btn submit red-color' }, - _react2.default.createElement('i', { className: 'fa fa-times red-color' }), - this.state.error - ); - } - - return _react2.default.createElement( - 'section', - { className: 'contact-us' }, - _react2.default.createElement(Element, { name: 'contactUs' }), - _react2.default.createElement( - 'h2', - { className: 'title' }, - 'Let\'s talk!' - ), - _react2.default.createElement( - 'form', - { onSubmit: this.contactUs }, - _react2.default.createElement( - 'div', - { className: 'left' }, - _react2.default.createElement( - 'label', - null, - _react2.default.createElement( - 'p', - null, - 'Name' - ), - _react2.default.createElement('input', { id: 'contact-us-name', type: 'text', placeholder: 'Name', ref: 'name' }) - ), - _react2.default.createElement( - 'label', - null, - _react2.default.createElement( - 'p', - null, - 'Email' - ), - _react2.default.createElement('input', { id: 'contact-us-email', type: 'email', placeholder: 'Email', ref: 'email', onKeyUp: this.changingEmail }) - ), - _react2.default.createElement( - 'label', - null, - _react2.default.createElement( - 'p', - null, - 'Company' - ), - _react2.default.createElement('input', { id: 'contact-us-company', type: 'text', placeholder: 'Company', ref: 'company' }) - ) - ), - _react2.default.createElement( - 'div', - { className: 'right' }, - _react2.default.createElement('textarea', { placeholder: 'Your message', ref: 'body' }), - sendBtn - ) - ) - ); - } -}); - -exports.default = ContactUs; - -},{"../../store":78,"jquery":299,"react":538,"react-scroll":374}],42:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -var _cc = require('../../cc'); - -var _cc2 = _interopRequireDefault(_cc); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var CumulativeInterest = _react2.default.createClass({ - displayName: 'CumulativeInterest', - getInitialState: function getInitialState() { - return { cagr: 25, investment: 10000, years: 20, animate: false, startDuration: 0.75 }; - }, - - componentDidMount: function componentDidMount() { - (0, _jquery2.default)(window).on('scroll', this.animate); - this.refs.cagrSlider.value = 25; - this.refs.investmentSlider.value = 1000; - self = this; - - (0, _jquery2.default)(this.refs.cagrSlider).on("change", function () { - (0, _jquery2.default)('#cagrValue').val('CAGR: ' + this.value + "%"); - if (self.state.animate) { - self.setState({ cagr: this.value, startDuration: 0 }); - } else { - self.setState({ cagr: this.value }); - } - }).trigger("change"); - (0, _jquery2.default)(this.refs.investmentSlider).on("change", function () { - (0, _jquery2.default)('#investmentValue').val('Investment: $' + _cc2.default.commafy(this.value)); - if (self.state.animate) { - self.setState({ investment: this.value, startDuration: 0 }); - } else { - self.setState({ investment: this.value }); - } - }).trigger("change"); - - (0, _jquery2.default)('input[type=range]').on('input', function (e) { - var min = e.target.min, - max = e.target.max, - val = e.target.value; - - (0, _jquery2.default)(e.target).css({ - 'backgroundSize': (val - min) * 100 / (max - min) + '% 100%' - }); - }).trigger('input'); - }, - animate: function animate() { - var hT = (0, _jquery2.default)(this.refs.chart).offset().top; - var hH = (0, _jquery2.default)(this.refs.chart).outerHeight(); - var wH = (0, _jquery2.default)(window).height(); - - if ((0, _jquery2.default)(window).scrollTop() > hT + hH - wH) { - this.setState({ animate: true }); - (0, _jquery2.default)(window).off('scroll', this.animate); - }; - }, - calculateData: function calculateData() { - - var currentValue = this.state.investment; - var currentMarketValue = this.state.investment; - - var chartData = [{ value: currentValue, market: currentMarketValue, year: 0 }]; - - for (var i = 0; i < this.state.years; i++) { - currentValue = currentValue * (this.state.cagr / 100 + 1); - currentMarketValue = currentMarketValue * (_store2.default.market.cagr / 100 + 1); - chartData.push({ value: currentValue.toFixed(0), market: currentMarketValue.toFixed(0), year: i + 1 }); - } - if (this.state.animate) { - return chartData; - } else { - return []; - } - }, - render: function render() { - var config = { - type: "serial", - theme: "light", - addClassNames: true, - "startDuration": this.state.startDuration, - "dataProvider": this.calculateData(), - - balloon: { - color: '#49494A', - fillAlpha: 1, - borderColor: '#49494A', - borderThickness: 1 - }, - - "graphs": [{ - id: "cumulative", - "balloonText": this.state.cagr + '% cagr
Year [[category]]
$[[value]]', - "fillAlphas": 1, - lineColor: "#27A5F9", - "type": "column", - "valueField": "value" - }, { - id: "market", - "balloonText": "S&P 500
Year [[category]]
$[[value]]", - "fillAlphas": 1, - lineColor: "#555", - "type": "column", - "valueField": "market" - }], - - "valueAxes": [{ - "gridColor": "#FFFFFF", - "gridAlpha": 0.2, - "dashLength": 0, - unit: '$', - unitPosition: 'left', - "stackType": "3d" - }], - - "chartCursor": { - "categoryBalloonEnabled": false, - "cursorAlpha": 0, - "zoomable": false - }, - - "categoryField": "year", - "categoryAxis": { - "gridPosition": "start", - "gridAlpha": 0 - } - }; - - var chart = _react2.default.createElement( - 'div', - { id: 'bar-chart', ref: 'chart' }, - _react2.default.createElement(AmCharts.React, config) - ); - - return _react2.default.createElement( - 'section', - { className: 'cumulative-interest split-section' }, - _react2.default.createElement( - 'h2', - null, - 'Cumulative ', - _react2.default.createElement( - 'span', - { className: 'blue-color' }, - 'interest' - ), - ' calculator' - ), - _react2.default.createElement('div', { className: 'divider' }), - _react2.default.createElement( - 'div', - { className: 'content' }, - _react2.default.createElement( - 'div', - { className: 'left' }, - _react2.default.createElement( - 'div', - { className: 'slider' }, - _react2.default.createElement('input', { type: 'range', min: '0', max: '35', step: '1', ref: 'cagrSlider' }), - _react2.default.createElement( - 'output', - { id: 'cagrValue' }, - '50' - ) - ), - _react2.default.createElement( - 'div', - { className: 'slider' }, - _react2.default.createElement('input', { type: 'range', min: '0', max: '10000', step: '100', ref: 'investmentSlider' }), - _react2.default.createElement( - 'output', - { id: 'investmentValue' }, - '50' - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'right' }, - _react2.default.createElement( - 'div', - { className: 'chart-indicators' }, - _react2.default.createElement( - 'div', - { className: 'chart-indicator blue-color' }, - 'CAGR: ', - this.state.cagr, - '%' - ), - _react2.default.createElement( - 'div', - { className: 'chart-indicator black' }, - 'S&P 500' - ) - ), - chart - ) - ), - _react2.default.createElement( - 'p', - { className: 'disclaimer' }, - 'The above is for illustration purposes only. It does not represent, warrant, or guarantee any level of future investment performance. It is a standard compound interest calculator, which visualizes any specified level of return relative to the market return. Market CAGR is indicated at 10.71% based on S&P 500 performance from 1970 to 2015 with dividends reinvested.' - ) - ); - } -}); - -exports.default = CumulativeInterest; - -},{"../../cc":3,"../../store":78,"jquery":299,"react":538}],43:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Footer = _react2.default.createClass({ - displayName: 'Footer', - showTerms: function showTerms() { - _store2.default.session.set('showModal', 'terms'); - }, - showPrivacy: function showPrivacy() { - _store2.default.session.set('showModal', 'privacy'); - }, - render: function render() { - return _react2.default.createElement( - 'footer', - null, - _react2.default.createElement( - 'div', - { className: 'disclaimer-container' }, - _react2.default.createElement( - 'p', - { className: 'disclaimer' }, - 'Formula Stocks is an information provider, not an investment advisory service or a registered investment advisor and does not offer individual investment advice. Unless otherwise specified, all return figures shown above are for illustrative purposes only. Actual returns in the future will vary greatly and depend on personal and market circumstances. No representation is being made that you are likely to achieve profits or losses similar to those shown.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'Formula Stocks does not manage client funds, but acts solely as an information and technology supplier. Formula Stocks does not purport to tell which securities individual customers should buy or sell for themselves. Formula Stocks’ purchase and sales recommendations are not solicitations to buy or sell, but rather information you can use as a starting point for doing additional independent research in order to allow you to form your own opinion regarding investments and make your own informed decisions.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'Formula Stocks assumes no responsibility or liability for your investment results. You understand and acknowledge that there is a high degree of risk involved in investing in securities. This service does not constitute an offer, a solicitation to buy a security, or to open a brokerage account.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'Past results of any investment system are not necessarily indicative of future results. It should not be assumed that the systems presented in these products will be profitable or that they cannot result in losses. In addition, information, system output, articles, and other features of our products are provided for educational and informational purposes only and should not be construed as investment advice. Accordingly, you should not rely solely on this information in making any investment. Unless experienced as an investor, one should check with a licensed financial advisor to determine the suitability of any investment and/or read relevant stock prospectuses. Formula Stocks portfolios may or may not be adequately diversified for any particular risk profile as the required level of diversification differs from individual to individual, so set your own individual maximum position size accordingly.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'The period 2009-2016 reflects actual investment results. Other period statistics are the result of back-testing the strategies. Back-tested performance results have certain inherent limitations, as they could potentially be designed with some benefit of hindsight, even though every effort has been taken to avoid such risk. Unlike an actual live investment period (such as 2009-2016), back-tested results do not represent actual trading and may not be impacted by brokerage and other slippage fees. Also since transactions may or may not actually have been executed, results may have under- or over-compensated for impact, if any, of certain market factors, such as lack of market liquidity or level of participation.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'Formula Stocks business analytics depends on the accuracy of the published accounts of public corporations. Such accuracy may from time to time be less than ideal. Formula Stocks strategies evolve and improve on a recurring basis, and any result and statistic is therefore subject to change without notice. Formula Stocks employees may or may not own equities mentioned in the service.' - ), - _react2.default.createElement( - 'p', - { className: 'white-color disclaimer agreement' }, - 'By visiting this site, you agree to our ', - _react2.default.createElement( - 'a', - { className: 'blue-color', onClick: this.showTerms }, - 'Terms and Conditions' - ), - ' & ', - _react2.default.createElement( - 'a', - { className: 'blue-color', onClick: this.showPrivacy }, - 'Privacy Policy' - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'copyright' }, - _react2.default.createElement( - 'p', - null, - '© Formula Stocks 2016 - All rights reserved.' - ) - ) - ); - } -}); - -exports.default = Footer; - -},{"../../store":78,"react":538}],44:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var ForgotPassword = _react2.default.createClass({ - displayName: 'ForgotPassword', - getInitialState: function getInitialState() { - return { posting: false, success: false, error: false, email: '' }; - }, - resetPassword: function resetPassword(e) { - var _this = this; - - e.preventDefault(); - console.log(this.refs); - var email = this.refs.email.value; - - if (_store2.default.session.validateEmail(email)) { - console.log('valid email'); - _jquery2.default.ajax({ - url: 'https://baas.kinvey.com/rpc/kid_rJRC6m9F/' + email + '/user-password-reset-initiate', - type: 'POST' - }).then(function (r) { - _this.setState({ success: true, email: email }); - }).fail(function (e) { - console.error('error: ', e); - _this.setState({ error: e }); - }); - } else { - console.log('invalid email'); - } - }, - render: function render() { - var content = _react2.default.createElement( - 'div', - null, - _react2.default.createElement( - 'h2', - null, - 'Forgot your password?' - ), - _react2.default.createElement( - 'p', - null, - 'Enter your email below, and we\'ll send you a link to reset your password.' - ), - _react2.default.createElement( - 'form', - { onSubmit: this.resetPassword }, - _react2.default.createElement('input', { type: 'email', placeholder: 'Email', ref: 'email' }), - _react2.default.createElement('input', { type: 'submit', value: 'Reset password' }) - ) - ); - if (this.state.success) { - content = _react2.default.createElement( - 'div', - null, - _react2.default.createElement( - 'h2', - null, - 'Success!' - ), - _react2.default.createElement('i', { className: 'fa fa-check green-color', 'aria-hidden': 'true' }), - _react2.default.createElement( - 'p', - null, - 'We sent an email to ', - _react2.default.createElement( - 'span', - { className: 'blue-color' }, - this.state.email - ), - ' with, a link to reset your password.' - ), - _react2.default.createElement( - 'button', - { className: 'filled-btn close-modal', onClick: this.props.closeModal }, - 'Got it!' - ) - ); - } - return _react2.default.createElement( - 'div', - { className: 'forgot-pw-modal' }, - content - ); - } -}); - -exports.default = ForgotPassword; - -},{"../../store":78,"jquery":299,"react":538}],45:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _reactRouter = require('react-router'); - -var _reactScroll = require('react-scroll'); - -var _reactScroll2 = _interopRequireDefault(_reactScroll); - -var _Hero = require('./Hero'); - -var _Hero2 = _interopRequireDefault(_Hero); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Header = _react2.default.createClass({ - displayName: 'Header', - componentDidMount: function componentDidMount() { - (0, _jquery2.default)(window).scroll(function () { - if ((0, _jquery2.default)(window).scrollTop() === 0) { - (0, _jquery2.default)("nav").css({ - "background-color": "rgba(255,255,255,0.2)", - "border-bottom": '1px solid rgba(230,230,230, 0)' - }); - (0, _jquery2.default)(".nav-link").css({ "color": 'white' }); - } else if ((0, _jquery2.default)(window).scrollTop() < 100) { - (0, _jquery2.default)('nav').css({ - "background-color": 'rgba(255, 255, 255, ' + ((0, _jquery2.default)(window).scrollTop() / 100 + 0.2) + ')', - "border-bottom": '1px solid rgba(230,230,230, ' + ((0, _jquery2.default)(window).scrollTop() / 100 + 0.2) + ')' - }); - if ((0, _jquery2.default)(window).scrollTop() > 30) { - (0, _jquery2.default)(".nav-link").css({ "color": 'rgba(73, 73, 73, ' + (0, _jquery2.default)(window).scrollTop() / 50 + ')' }); - } else { - (0, _jquery2.default)(".nav-link").css({ "color": 'white' }); - } - } else { - (0, _jquery2.default)("nav").css({ - "background-color": "white", - "border-bottom": '1px solid rgba(230,230,230, 1)' - }); - (0, _jquery2.default)(".nav-link").css({ "color": 'rgba(73, 73, 73, 1)' }); - } - }); - }, - - render: function render() { - var ScrollLink = _reactScroll2.default.Link; - var scroll = _reactScroll2.default.animateScroll; - - var navLinks = _react2.default.createElement( - 'div', - { id: 'nav-links' }, - _react2.default.createElement( - _reactRouter.Link, - { to: '/login', id: 'login-btn', className: 'nav-link' }, - _react2.default.createElement('i', { className: 'fa fa-sign-in', 'aria-hidden': 'true' }), - ' Login' - ), - _react2.default.createElement( - _reactRouter.Link, - { to: '/signup', id: 'signup-btn', className: 'nav-link' }, - _react2.default.createElement('i', { className: 'fa fa-user-plus', 'aria-hidden': 'true' }), - ' Signup' - ) - ); - - if (localStorage.authtoken) { - navLinks = _react2.default.createElement( - 'div', - { id: 'nav-links' }, - _react2.default.createElement( - _reactRouter.Link, - { to: '/dashboard', className: 'nav-link' }, - _react2.default.createElement('i', { className: 'fa fa-tachometer', 'aria-hidden': 'true' }), - ' Dashboard' - ), - _react2.default.createElement( - 'a', - { href: '#', id: 'logout-btn', onClick: _store2.default.session.logout.bind(_store2.default.session), className: 'nav-link' }, - _react2.default.createElement('i', { className: 'fa fa-sign-out', 'aria-hidden': 'true' }), - 'Logout' - ) - ); - } - // - return _react2.default.createElement( - 'header', - null, - _react2.default.createElement( - 'nav', - null, - _react2.default.createElement( - 'div', - { className: 'content' }, - _react2.default.createElement( - 'div', - { className: 'left', onClick: function onClick() { - scroll.scrollToTop(); - } }, - _react2.default.createElement('div', { id: 'logo' }) - ), - _react2.default.createElement( - 'div', - { className: 'right' }, - _react2.default.createElement( - ScrollLink, - { className: 'nav-link products-link', to: 'ourProducts', smooth: true, offset: -100, duration: 1000 }, - 'Products' - ), - _react2.default.createElement( - ScrollLink, - { className: 'nav-link pricing-link', to: 'pricing', smooth: true, offset: -100, duration: 1000 }, - 'Pricing' - ), - _react2.default.createElement( - ScrollLink, - { className: 'nav-link contact-us-link', to: 'contactUs', smooth: true, offset: -100, duration: 1000 }, - 'Contact us' - ), - navLinks - ) - ) - ), - _react2.default.createElement(_Hero2.default, null) - ); - } -}); - -exports.default = Header; - -},{"../../store":78,"./Hero":46,"jquery":299,"react":538,"react-router":361,"react-scroll":374}],46:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _reactScroll = require('react-scroll'); - -var _reactScroll2 = _interopRequireDefault(_reactScroll); - -var _WhatIsIt = require('./WhatIsIt'); - -var _WhatIsIt2 = _interopRequireDefault(_WhatIsIt); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Hero = _react2.default.createClass({ - displayName: 'Hero', - tryIt: function tryIt() { - _store2.default.settings.history.push('/signup'); - }, - learnMore: function learnMore() {}, - render: function render() { - var Link = _reactScroll2.default.Link; - var Element = _reactScroll2.default.Element; - return _react2.default.createElement( - 'div', - { id: 'hero' }, - _react2.default.createElement( - 'div', - { className: 'content' }, - _react2.default.createElement( - 'div', - { className: 'bounce-down' }, - _react2.default.createElement( - 'h1', - { id: 'main-title' }, - 'A better ', - _react2.default.createElement( - 'span', - { className: 'font bold' }, - 'solution' - ), - ' for the ', - _react2.default.createElement( - 'span', - { className: 'font bold' }, - 'stock market investor' - ) - ), - _react2.default.createElement( - 'h2', - null, - 'What if it was possible to identify some of next year\'s winners in the markets today with a success rate of up to 84-92%?' - ) - ), - _react2.default.createElement( - 'div', - { className: 'CTA fade-in' }, - _react2.default.createElement( - 'button', - { className: 'filled-btn', onClick: this.tryIt }, - 'Try it for free!' - ), - _react2.default.createElement( - Link, - { className: 'outline-btn', to: 'whatIsIt', smooth: true, offset: 100, duration: 500 }, - 'Learn more' - ) - ) - ), - _react2.default.createElement( - 'div', - { id: 'hero-chart', className: 'slide-up' }, - _react2.default.createElement( - Element, - { name: 'whatIsIt' }, - _react2.default.createElement(_WhatIsIt2.default, null) - ) - ) - ); - } -}); - -exports.default = Hero; - -},{"../../store":78,"./WhatIsIt":62,"react":538,"react-scroll":374}],47:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _React = require('React'); - -var _React2 = _interopRequireDefault(_React); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -var _Header = require('./Header'); - -var _Header2 = _interopRequireDefault(_Header); - -var _AboveAverageReturns = require('./fiveReasons/AboveAverageReturns'); - -var _AboveAverageReturns2 = _interopRequireDefault(_AboveAverageReturns); - -var _ReachYourGoals = require('./fiveReasons/ReachYourGoals'); - -var _ReachYourGoals2 = _interopRequireDefault(_ReachYourGoals); - -var _InformationalAdvantage = require('./fiveReasons/InformationalAdvantage'); - -var _InformationalAdvantage2 = _interopRequireDefault(_InformationalAdvantage); - -var _OneDollar = require('./fiveReasons/OneDollar'); - -var _OneDollar2 = _interopRequireDefault(_OneDollar); - -var _HigherPerformance = require('./fiveReasons/HigherPerformance'); - -var _HigherPerformance2 = _interopRequireDefault(_HigherPerformance); - -var _OurProducts = require('./OurProducts'); - -var _OurProducts2 = _interopRequireDefault(_OurProducts); - -var _TheResults = require('./TheResults'); - -var _TheResults2 = _interopRequireDefault(_TheResults); - -var _PricingTable = require('./PricingTable'); - -var _PricingTable2 = _interopRequireDefault(_PricingTable); - -var _Brochures = require('./Brochures'); - -var _Brochures2 = _interopRequireDefault(_Brochures); - -var _RewardVSRisk = require('./RewardVSRisk'); - -var _RewardVSRisk2 = _interopRequireDefault(_RewardVSRisk); - -var _Quote = require('./Quote'); - -var _Quote2 = _interopRequireDefault(_Quote); - -var _CumulativeInterest = require('./CumulativeInterest'); - -var _CumulativeInterest2 = _interopRequireDefault(_CumulativeInterest); - -var _Newsletter = require('./Newsletter'); - -var _Newsletter2 = _interopRequireDefault(_Newsletter); - -var _AboutUs = require('./AboutUs'); - -var _AboutUs2 = _interopRequireDefault(_AboutUs); - -var _ContactUs = require('./ContactUs'); - -var _ContactUs2 = _interopRequireDefault(_ContactUs); - -var _Footer = require('./Footer'); - -var _Footer2 = _interopRequireDefault(_Footer); - -var _Modal = require('../Modal'); - -var _Modal2 = _interopRequireDefault(_Modal); - -var _TermsAndConditions = require('../global/TermsAndConditions'); - -var _TermsAndConditions2 = _interopRequireDefault(_TermsAndConditions); - -var _PrivacyPolicy = require('../global/PrivacyPolicy'); - -var _PrivacyPolicy2 = _interopRequireDefault(_PrivacyPolicy); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Home = _React2.default.createClass({ - displayName: 'Home', - getInitialState: function getInitialState() { - return { showModal: false }; - }, - componentDidMount: function componentDidMount() { - _store2.default.market.data.getAnnualData(); - _store2.default.session.on('change', this.updateState); - }, - componentWillUnmount: function componentWillUnmount() { - _store2.default.session.off('change', this.updateState); - }, - updateState: function updateState() { - this.setState({ showModal: _store2.default.session.get('showModal') }); - }, - closeModal: function closeModal() { - console.log('closing modal'); - _store2.default.session.set('showModal', false); - }, - render: function render() { - var modal = void 0; - - if (this.state.showModal) { - var containerStyles = { - zIndex: '20' - }; - var modalStyles = { - width: '80%', - top: '100px', - bottom: '40px', - left: '50%', - transform: 'translateX(-50%)', - padding: '40px', - position: 'absolute', - overflowY: 'scroll' - }; - if (this.state.showModal === 'terms') { - modal = _React2.default.createElement( - _Modal2.default, - { modalStyles: modalStyles, closeModal: this.closeModal, containerStyles: containerStyles }, - _React2.default.createElement(_TermsAndConditions2.default, null) - ); - } else if (this.state.showModal === 'privacy') { - modal = _React2.default.createElement( - _Modal2.default, - { modalStyles: modalStyles, closeModal: this.closeModal, containerStyles: containerStyles }, - _React2.default.createElement(_PrivacyPolicy2.default, null) - ); - } - } - - return _React2.default.createElement( - 'div', - { id: 'home' }, - modal, - _React2.default.createElement(_Header2.default, null), - _React2.default.createElement(_AboveAverageReturns2.default, null), - _React2.default.createElement(_ReachYourGoals2.default, null), - _React2.default.createElement(_InformationalAdvantage2.default, null), - _React2.default.createElement(_OneDollar2.default, null), - _React2.default.createElement(_HigherPerformance2.default, null), - _React2.default.createElement(_OurProducts2.default, null), - _React2.default.createElement(_TheResults2.default, null), - _React2.default.createElement(_PricingTable2.default, null), - _React2.default.createElement(_Brochures2.default, null), - _React2.default.createElement(_RewardVSRisk2.default, null), - _React2.default.createElement(_Quote2.default, null), - _React2.default.createElement(_CumulativeInterest2.default, null), - _React2.default.createElement(_Newsletter2.default, null), - _React2.default.createElement(_AboutUs2.default, null), - _React2.default.createElement(_ContactUs2.default, null), - _React2.default.createElement(_Footer2.default, null), - this.props.children - ); - } -}); - -exports.default = Home; - -},{"../../store":78,"../Modal":9,"../global/PrivacyPolicy":37,"../global/TermsAndConditions":38,"./AboutUs":39,"./Brochures":40,"./ContactUs":41,"./CumulativeInterest":42,"./Footer":43,"./Header":45,"./Newsletter":49,"./OurProducts":50,"./PricingTable":52,"./Quote":56,"./RewardVSRisk":57,"./TheResults":61,"./fiveReasons/AboveAverageReturns":63,"./fiveReasons/HigherPerformance":64,"./fiveReasons/InformationalAdvantage":65,"./fiveReasons/OneDollar":66,"./fiveReasons/ReachYourGoals":67,"React":538}],48:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _reactAddonsCssTransitionGroup = require('react-addons-css-transition-group'); - -var _reactAddonsCssTransitionGroup2 = _interopRequireDefault(_reactAddonsCssTransitionGroup); - -var _underscore = require('underscore'); - -var _underscore2 = _interopRequireDefault(_underscore); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -var _Modal = require('../Modal'); - -var _Modal2 = _interopRequireDefault(_Modal); - -var _ForgotPassword = require('./ForgotPassword'); - -var _ForgotPassword2 = _interopRequireDefault(_ForgotPassword); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Login = _react2.default.createClass({ - displayName: 'Login', - - getInitialState: function getInitialState() { - return { - formClasses: 'form-modal login form-bounce-down', - error: '', - showForgotPasswordModal: false - }; - }, - login: function login(e) { - var _this = this; - - e.preventDefault(); - var email = this.refs.email.value.toLowerCase(); - var password = this.refs.password.value; - _store2.default.session.login(email, password).then(function () { - _this.closeModal(); - }).catch(function (errMsg) { - console.log('ERROR: ', errMsg); - _this.setState({ formClasses: 'form-modal login login-shake', error: errMsg }); - window.setTimeout(function () { - _this.setState({ formClasses: 'form-modal login', error: errMsg }); - }, 300); - }); - }, - closeModal: function closeModal(e) { - if (e) { - if ((_underscore2.default.toArray(e.target.classList).indexOf('modal-container') !== -1 || _underscore2.default.toArray(e.target.classList).indexOf('form-modal-container') !== -1) && !this.state.showForgotPasswordModal) { - this.setState({ slideOut: true, formClasses: 'form-modal login slide-out' }); - - window.setTimeout(function () { - _store2.default.settings.history.push('/'); - }, 300); - } else if ((_underscore2.default.toArray(e.target.classList).indexOf('modal-container') !== -1 || _underscore2.default.toArray(e.target.classList).indexOf('close-modal') !== -1 || _underscore2.default.toArray(e.target.classList).indexOf('form-modal-container') !== -1) && this.state.showForgotPasswordModal) { - this.setState({ showForgotPasswordModal: false }); - } - } - }, - showForgotPasswordModal: function showForgotPasswordModal() { - this.setState({ showForgotPasswordModal: true }); - }, - - render: function render() { - var errorMsg = void 0; - var emailClasses = 'email'; - var passwordClasses = 'password'; - var verifyPasswordClasses = 'verify-password'; - - if (this.state.error) { - if (this.state.error.indexOf('Email') !== -1) { - emailClasses = 'email error'; - } else if (this.state.error.indexOf('Password') !== -1) { - passwordClasses = 'password error'; - } else if (this.state.error.indexOf('Wrong') !== -1) { - emailClasses = 'email error'; - passwordClasses = 'password error'; - } - errorMsg = _react2.default.createElement( - 'div', - { className: 'form-error' }, - _react2.default.createElement( - 'h4', - null, - _react2.default.createElement('i', { className: 'fa fa-exclamation-circle', 'aria-hidden': 'true' }), - this.state.error - ) - ); - } - - var containerStyles = { - top: "75px", - background: "rgba(0,0,0,0.5)" - }; - if (this.state.slideOut) { - containerStyles = { - top: "75px", - background: 'rgba(0,0,0,0)' - }; - } - - var modalStyles = void 0; - if (this.state.slideOut) { - containerStyles = { - top: "75px", - background: 'rgba(0,0,0,0)' - }; - modalStyles = { - animation: '300ms FormSlideOut' - }; - } - - var forgotPasswordModal = void 0; - if (this.state.showForgotPasswordModal) { - var _modalStyles = { - maxWidth: '400px' - - }; - - forgotPasswordModal = _react2.default.createElement( - _Modal2.default, - { modalStyles: _modalStyles, closeModal: function closeModal() {} }, - _react2.default.createElement(_ForgotPassword2.default, { closeModal: this.closeModal }) - ); - } - - return _react2.default.createElement( - 'div', - { onClick: this.closeModal, className: 'modal-container fade-in', style: containerStyles }, - _react2.default.createElement( - _reactAddonsCssTransitionGroup2.default, - { - transitionName: 'bounce-down', - transitionEnterTimeout: 30000, - transitionLeaveTimeout: 30000 }, - _react2.default.createElement( - 'div', - { key: 'login-modal', onScroll: this.scroll, style: modalStyles, className: this.state.formClasses, ref: 'modal' }, - _react2.default.createElement( - 'form', - { onSubmit: this.login, className: this.state.formClasses }, - _react2.default.createElement( - 'h3', - null, - 'Login' - ), - errorMsg, - _react2.default.createElement( - 'div', - { className: emailClasses }, - _react2.default.createElement('input', { type: 'text', placeholder: 'Email', ref: 'email', autoFocus: 'true' }) - ), - _react2.default.createElement( - 'div', - { className: passwordClasses }, - _react2.default.createElement('input', { type: 'password', placeholder: 'Password', ref: 'password' }) - ), - _react2.default.createElement('input', { type: 'submit', id: 'submit-btn', value: 'Login' }), - _react2.default.createElement( - 'a', - { className: 'white forgot-pw blue-color', onClick: this.showForgotPasswordModal }, - 'Forgot your password?' - ) - ) - ) - ), - forgotPasswordModal - ); - } -}); - -exports.default = Login; - -},{"../../store":78,"../Modal":9,"./ForgotPassword":44,"react":538,"react-addons-css-transition-group":305,"underscore":553}],49:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _Newsletter = require('../../models/Newsletter'); - -var _Newsletter2 = _interopRequireDefault(_Newsletter); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var NewsLetter = _react2.default.createClass({ - displayName: 'NewsLetter', - getInitialState: function getInitialState() { - return { sent: false }; - }, - signUpForNewsletter: function signUpForNewsletter(e) { - e.preventDefault(); - var email = this.refs.email.value; - if (_store2.default.session.validateEmail(email)) { - var newsletter = new _Newsletter2.default({ - email: email - }); - newsletter.save(); - this.refs.email.value = ''; - } else { - console.log('### Invalid email'); - } - }, - render: function render() { - return _react2.default.createElement( - 'section', - { className: 'newsletter' }, - _react2.default.createElement( - 'h2', - { className: 'title' }, - 'Subscribe to our newsletter and stay updated' - ), - _react2.default.createElement( - 'form', - { onSubmit: this.signUpForNewsletter }, - _react2.default.createElement('input', { type: 'email', placeholder: 'Enter your email address', ref: 'email' }), - _react2.default.createElement('input', { type: 'submit', className: 'filled-btn', value: 'Submit' }) - ) - ); - } -}); - -exports.default = NewsLetter; - -},{"../../models/Newsletter":73,"../../store":78,"react":538}],50:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _reactScroll = require('react-scroll'); - -var _reactScroll2 = _interopRequireDefault(_reactScroll); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var OurProducts = _react2.default.createClass({ - displayName: 'OurProducts', - downloadBrochure: function downloadBrochure(name) { - window.open('/assets/downloads/' + name + '.pdf'); - }, - render: function render() { - var Element = _reactScroll2.default.Element; - var ScrollLink = _reactScroll2.default.Link; - return _react2.default.createElement( - 'section', - { className: 'our-products bg-gray' }, - _react2.default.createElement( - 'div', - { className: 'content' }, - _react2.default.createElement(Element, { name: 'ourProducts' }), - _react2.default.createElement( - 'div', - { className: 'title-container' }, - _react2.default.createElement( - 'h2', - null, - 'Our ', - _react2.default.createElement( - 'span', - { className: 'blue-color' }, - 'products' - ) - ), - _react2.default.createElement('div', { className: 'divider' }) - ), - _react2.default.createElement( - 'p', - null, - 'We offer four products, each of which gives you access to a secure dashboard. You will be able to track our model portfolio, access our purchase and sales transactions in real-time as they occur, and obtain valuable information about stocks selected for purchase or sale.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'You can choose to use this information to buy stocks through your regular broker/bank, either by using our selections on an ongoing basis, or by mirroring the model portfolio and keeping abreast of changes as they regularly occur.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'Once you have made your purchases, you simply wait. Later, a sales recommendation will suggest when to sell the stock. The average holding period is 2.2 years.' - ), - _react2.default.createElement( - 'div', - { className: 'icon-container' }, - _react2.default.createElement( - 'div', - { className: 'plan-icon' }, - _react2.default.createElement('img', { src: 'assets/icons/icon-user.svg' }), - _react2.default.createElement( - 'p', - { className: 'blue-color' }, - 'Basic' - ) - ), - _react2.default.createElement( - 'div', - { className: 'plan-icon' }, - _react2.default.createElement('img', { src: 'assets/icons/icon-briefcase.svg' }), - _react2.default.createElement( - 'p', - { className: 'blue-color' }, - 'Premium' - ) - ), - _react2.default.createElement( - 'div', - { className: 'plan-icon' }, - _react2.default.createElement('img', { src: 'assets/icons/icon-chart.svg' }), - _react2.default.createElement( - 'p', - { className: 'blue-color' }, - 'Business' - ) - ), - _react2.default.createElement( - 'div', - { className: 'plan-icon' }, - _react2.default.createElement('img', { src: 'assets/icons/icon-building.svg' }), - _react2.default.createElement( - 'p', - { className: 'blue-color' }, - 'Fund' - ) - ) - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'bold' }, - 'Basic' - ), - ' and ', - _react2.default.createElement( - 'span', - { className: 'bold' }, - 'Premium' - ), - ' are both diversified retail products with excellent value propositions and targeted at the private investor.', - _react2.default.createElement( - 'span', - { className: 'bold' }, - ' Business' - ), - ' is designed for CEOs, accredited investors, and enterprising investors focusing on performance and margin of safety, at the expense of diversification. Our ', - _react2.default.createElement( - 'span', - { className: 'bold' }, - 'Fund' - ), - ' product is for institutional capital, capable of handling large diversified AUMs, which other products cannot. \u2028 Each product utilizes a different number of Intelligent Investment Technology formulas. You can explore our ', - _react2.default.createElement( - ScrollLink, - { className: 'blue-color', to: 'pricing', smooth: true, offset: -100, duration: 1000 }, - 'product matrix' - ), - ' below. Or see our ', - _react2.default.createElement( - 'a', - { className: 'blue-color', onClick: this.downloadBrochure.bind(null, 'FAQ') }, - 'FAQ' - ), - ' or ', - _react2.default.createElement( - 'a', - { className: 'blue-color', onClick: this.downloadBrochure.bind(null, 'business') }, - 'business brochure' - ), - '.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - _react2.default.createElement( - 'span', - { className: 'disclaimer' }, - 'Formula Stocks does not provide personalized investment advice. We respect your privacy and receive no financial information in the process. We do not manage money or recommend stocks with which we have any affiliation.' - ) - ) - ) - ); - } -}); - -exports.default = OurProducts; - -},{"react":538,"react-scroll":374}],51:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _reactSelect = require('react-select'); - -var _reactSelect2 = _interopRequireDefault(_reactSelect); - -var _cc = require('../../cc'); - -var _cc2 = _interopRequireDefault(_cc); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -var _countries = require('../../data/countries'); - -var _countries2 = _interopRequireDefault(_countries); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var PaymentForm = _react2.default.createClass({ - displayName: 'PaymentForm', - getInitialState: function getInitialState() { - console.log(this.props.passedProps.plan); - console.log(_store2.default.session.toJSON()); - var cycle = ' monthly'; - if (this.props.passedProps.plan === 'business' || this.props.passedProps.plan === 'fund') { - cycle = ' annually'; - } - - var priceText = 'Subscribe for $' + _cc2.default.commafy(_store2.default.plans.get(this.props.passedProps.plan).get('price')) + ' ' + cycle; - if (this.props.passedProps.plan === 'basic') { - priceText = 'Start free trial'; - } - - var countryText = 'Country of residence'; - var countryCode = void 0; - if (_store2.default.session.get('location').country_code && _store2.default.session.get('location').country_name) { - countryText = _store2.default.session.get('location').country_name; - countryCode = _store2.default.session.get('location').country_code; - } - - return { - priceText: priceText, - price: _store2.default.plans.get(this.props.passedProps.plan).get('price'), - formClass: 'payment-form ' + this.props.formAnimation, - checked: false, - validatingPayment: false, - countryName: countryText, - countryCode: countryCode, - taxPercent: 0, - cycle: cycle }; - }, - componentWillReceiveProps: function componentWillReceiveProps(newProps) { - this.setState({ formClass: 'payment-form ' + newProps.formAnimation }); - }, - ccFormat: function ccFormat() { - this.refs.cardNumber.value = _cc2.default.ccFormat(this.refs.cardNumber.value); - }, - dateFormat: function dateFormat(e) { - this.refs.cardExpiry.value = _cc2.default.dateFormat(e, this.refs.cardExpiry.value); - }, - cvcFormat: function cvcFormat() { - this.refs.cardCvc.value = _cc2.default.cvcFormat(this.refs.cardCvc.value); - }, - calculateTax: function calculateTax(countryCode) { - var _this = this; - - _cc2.default.calculateTax(countryCode).then(function (tax) { - _this.setState({ taxPercent: tax }); - }); - }, - checkPayment: function checkPayment(e) { - var _this2 = this; - - e.preventDefault(); - - if (!this.state.validatingPayment) { - this.setState({ validatingPayment: true }); - var location = { - country_name: this.state.countryName, - country_code: this.state.countryCode, - addressLine1: this.refs.address1.value, - addressLine2: this.refs.address2.value - }; - - _cc2.default.validateLocation(location).then(function () { - _this2.calculateTax(_this2.state.countryCode); - var card = { - number: _this2.refs.cardNumber.value.replace(/\s+/g, ''), - month: _this2.refs.cardExpiry.value.split(' / ')[0], - year: _this2.refs.cardExpiry.value.split(' / ')[1], - cvc: _this2.refs.cardCvc.value - }; - - _cc2.default.checkPayment(card).then(function (token) { - if (_this2.state.checked) { - _this2.createCustomer(token); - } else { - _this2.setState({ error: 'You must agree to the Terms and Conditions', formClass: 'payment-form shake', validatingPayment: false }); - window.setTimeout(function () { - _this2.setState({ formClass: 'payment-form' }); - }, 300); - } - }).catch(function (e) { - _this2.setState({ error: e, formClass: 'payment-form shake', validatingPayment: false }); - window.setTimeout(function () { - _this2.setState({ formClass: 'payment-form' }); - }, 300); - }); - }).catch(function (e) { - _this2.setState({ error: e, formClass: 'payment-form shake', validatingPayment: false }); - window.setTimeout(function () { - _this2.setState({ formClass: 'payment-form' }); - }, 300); - }); - } - }, - createCustomer: function createCustomer(token) { - var _this3 = this; - - _cc2.default.createCustomer(token, this.props.passedProps.plan, this.state.cycle, this.state.taxPercent).then(function () { - console.log('SUCCESFUL PAYMENT'); - }).catch(function (e) { - console.error('charge ERROR: ', e); - _this3.setState({ error: String(e), formClass: 'payment-form shake', validatingPayment: false }); - window.setTimeout(function () { - _this3.setState({ formClass: 'payment-form' }); - }, 300); - }); - }, - toggleCheckBox: function toggleCheckBox() { - this.setState({ checked: !this.state.checked }); - }, - selectCountry: function selectCountry(country) { - this.setState({ - countryName: country.label, - countryCode: country.value - }); - this.calculateTax(country.value); - }, - showTerms: function showTerms() { - _store2.default.session.set('showModal', 'terms'); - }, - render: function render() { - - var error = void 0; - if (this.state.error) { - error = _react2.default.createElement( - 'div', - { className: 'form-error' }, - _react2.default.createElement( - 'h4', - null, - _react2.default.createElement('i', { className: 'fa fa-exclamation-circle', 'aria-hidden': 'true' }), - this.state.error - ) - ); - } - - var checkbox = _react2.default.createElement('div', { className: 'checker', onClick: this.toggleCheckBox }); - if (this.state.checked) { - checkbox = _react2.default.createElement( - 'div', - { className: 'checker', onClick: this.toggleCheckBox }, - _react2.default.createElement('i', { className: 'fa fa-check', 'aria-hidden': 'true' }) - ); - } - - // let payButton = - var payButton = _react2.default.createElement( - 'button', - { className: 'pay-button' }, - _react2.default.createElement( - 'h3', - null, - 'Subscribe for $', - _cc2.default.commafy(this.state.price), - ' ', - this.state.cycle - ) - ); - if (this.state.taxPercent > 0) { - payButton = _react2.default.createElement( - 'button', - { className: 'pay-button' }, - _react2.default.createElement( - 'h3', - null, - 'Subscribe for $', - _cc2.default.commafy(this.state.price * (this.state.taxPercent / 100 + 1)), - ' ', - this.state.cycle - ), - _react2.default.createElement( - 'p', - { className: 'tax' }, - 'Tax: $', - _cc2.default.commafy(this.state.price * (this.state.taxPercent / 100 + 1) - this.state.price) - ) - ); - } - if (this.state.validatingPayment) { - payButton = _react2.default.createElement( - 'div', - { className: 'pay-button' }, - _react2.default.createElement('i', { className: 'fa fa-spinner fa-pulse fa-3x fa-fw' }) - ); - } - - return _react2.default.createElement( - 'form', - { onSubmit: this.checkPayment, className: this.state.formClass }, - error, - _react2.default.createElement( - 'div', - { className: 'wrapper' }, - _react2.default.createElement( - 'div', - { className: 'left' }, - _react2.default.createElement( - 'h3', - { className: 'form-title capitalize' }, - this.props.passedProps.plan, - ' Plan' - ), - _react2.default.createElement(_reactSelect2.default, { - name: 'selected-country', - ref: 'countrySelect', - options: _countries2.default, - clearable: false, - value: this.state.countryName, - placeholder: this.state.countryName, - onChange: this.selectCountry - }), - _react2.default.createElement( - 'div', - { className: 'address-line-1 field input-container' }, - _react2.default.createElement('input', { type: 'text', placeholder: 'Address line 1', ref: 'address1' }) - ), - _react2.default.createElement( - 'div', - { className: 'address-line-2 field input-container' }, - _react2.default.createElement('input', { type: 'text', placeholder: 'Address line 2', ref: 'address2' }) - ) - ), - _react2.default.createElement( - 'div', - { className: 'right' }, - _react2.default.createElement( - 'div', - { className: 'cc-number input-container' }, - _react2.default.createElement('input', { onKeyUp: this.ccFormat, type: 'text', placeholder: 'Card number', ref: 'cardNumber' }) - ), - _react2.default.createElement( - 'div', - { className: 'wrapper' }, - _react2.default.createElement( - 'div', - { className: 'card-expiry-date input-container' }, - _react2.default.createElement('input', { onKeyUp: this.dateFormat, type: 'text', placeholder: 'MM / YY', ref: 'cardExpiry' }) - ), - _react2.default.createElement( - 'div', - { className: 'card-cvc input-container' }, - _react2.default.createElement('input', { onKeyUp: this.cvcFormat, type: 'text', placeholder: 'CVC', ref: 'cardCvc' }) - ) - ), - _react2.default.createElement( - 'div', - { className: 'ToC' }, - checkbox, - _react2.default.createElement( - 'p', - null, - 'I\'ve read and agree to the ', - _react2.default.createElement( - 'a', - { onClick: this.showTerms }, - 'Terms and Conditions' - ) - ) - ), - payButton - ) - ) - ); - } -}); - -exports.default = PaymentForm; - -},{"../../cc":3,"../../data/countries":68,"../../store":78,"react":538,"react-select":386}],52:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _reactScroll = require('react-scroll'); - -var _reactScroll2 = _interopRequireDefault(_reactScroll); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -var _Product = require('./Product'); - -var _Product2 = _interopRequireDefault(_Product); - -var _Modal = require('../Modal'); - -var _Modal2 = _interopRequireDefault(_Modal); - -var _ProductModal = require('./ProductModal'); - -var _ProductModal2 = _interopRequireDefault(_ProductModal); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var PricingTable = _react2.default.createClass({ - displayName: 'PricingTable', - getInitialState: function getInitialState() { - return { - modal: false - }; - }, - componentDidMount: function componentDidMount() { - _store2.default.plans.on('update', this.updateState); - }, - componentWillUnmount: function componentWillUnmount() { - _store2.default.plans.off('update', this.updateState); - }, - updateState: function updateState() { - this.setState({ basicStats: _store2.default.plans.get('basic').get('stats') }); - }, - showModal: function showModal(planName) { - this.setState({ modal: planName }); - }, - closeModal: function closeModal() { - this.setState({ modal: false }); - }, - render: function render() { - var Element = _reactScroll2.default.Element; - var modal = void 0; - if (this.state.modal) { - modal = _react2.default.createElement( - _Modal2.default, - { closeModal: this.closeModal }, - _react2.default.createElement(_ProductModal2.default, { planName: this.state.modal }) - ); - } - - return _react2.default.createElement( - 'section', - { className: 'pricing-table' }, - _react2.default.createElement(Element, { name: 'pricing' }), - _react2.default.createElement( - 'div', - { className: 'content' }, - _react2.default.createElement( - 'h2', - { className: 'title' }, - 'Features & pricing' - ), - _react2.default.createElement('div', { className: 'divider' }), - _react2.default.createElement( - 'h3', - { className: 'subtitle' }, - 'Compare the products and find the right solution for you.' - ), - _react2.default.createElement( - 'div', - { className: 'plans' }, - _react2.default.createElement(_Product2.default, { showModal: this.showModal, name: 'Basic', price: '50', stats: _store2.default.plans.get('basic').get('stats'), billed: 'Monthly', signupText: 'Start Free Month', info: _store2.default.plans.get('basic').get('info') }), - _react2.default.createElement(_Product2.default, { showModal: this.showModal, name: 'Premium', price: '100', stats: _store2.default.plans.get('premium').get('stats'), billed: 'Monthly', signupText: 'Get Started', info: _store2.default.plans.get('premium').get('info') }), - _react2.default.createElement(_Product2.default, { showModal: this.showModal, name: 'Business', price: '20,000', stats: _store2.default.plans.get('business').get('stats'), billed: 'Yearly', signupText: 'Get Started', info: _store2.default.plans.get('business').get('info') }), - _react2.default.createElement(_Product2.default, { showModal: this.showModal, name: 'Fund', price: '120,000', stats: _store2.default.plans.get('fund').get('stats'), billed: 'Yearly', signupText: 'Get Started', info: _store2.default.plans.get('fund').get('info') }) - ), - _react2.default.createElement( - 'p', - { className: 'disclaimer' }, - 'Information in pricing tables does not represent, warrant, or guarantee any specific level of future investment performance. Historical numbers are based on backtested performance from 1975-2009, whereas data from 2009-2016 reflects actual investment results. Investing always involves varying degrees of risk.' - ) - ), - modal - ); - } -}); - -exports.default = PricingTable; - -},{"../../store":78,"../Modal":9,"./Product":53,"./ProductModal":54,"react":538,"react-scroll":374}],53:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Product = _react2.default.createClass({ - displayName: 'Product', - signup: function signup() { - _store2.default.settings.history.push('/signup'); - }, - showModal: function showModal() { - this.props.showModal(this.props.name); - }, - render: function render() { - var extraInfo = this.props.name === 'Premium' ? _react2.default.createElement( - 'p', - null, - 'Includes Basic' - ) : this.props.name === 'Business' ? _react2.default.createElement( - 'p', - null, - 'Includes Basic & Premium' - ) : this.props.name === 'Fund' ? _react2.default.createElement( - 'p', - null, - 'AUM capacity: unlimited' - ) : undefined; - return _react2.default.createElement( - 'div', - { className: 'plan' }, - _react2.default.createElement( - 'div', - { className: 'top' }, - _react2.default.createElement( - 'h3', - { className: 'bold' }, - this.props.name - ), - _react2.default.createElement( - 'p', - { className: 'bold price' }, - '$', - this.props.price - ), - _react2.default.createElement( - 'p', - { className: 'billed' }, - 'Billed ', - this.props.billed - ) - ), - _react2.default.createElement( - 'div', - { className: 'main-stats' }, - extraInfo, - _react2.default.createElement( - 'p', - null, - 'Buy & sell recommendations' - ), - _react2.default.createElement( - 'p', - null, - 'Model Portfolio Tracking' - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'Avg. round trip trades per year: ' - ), - this.props.info.roundtripTradesPerYear - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'IIT formulas applied: ' - ), - this.props.info.IITFormulas - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'Historical 45-year CAGR: ' - ), - this.props.stats.CAGR.toFixed(2), - '%' - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'Avg. winning positions: ' - ), - this.props.stats.WLRatio.toFixed(2), - '%' - ) - ), - _react2.default.createElement( - 'button', - { onClick: this.showModal, className: 'more-info filled-btn' }, - 'More info' - ), - _react2.default.createElement( - 'button', - { className: 'sign-up filled-btn', onClick: this.signup }, - this.props.signupText - ) - ); - } -}); - -exports.default = Product; - -},{"../../store":78,"react":538}],54:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var ProductModal = _react2.default.createClass({ - displayName: 'ProductModal', - getInitialState: function getInitialState() { - return { plan: _store2.default.plans.get(this.props.planName.toLowerCase()).toJSON() }; - }, - componentWillReceiveProps: function componentWillReceiveProps(newProps) { - this.setState({ plan: _store2.default.plans.get(newProps.planName.toLowerCase()).toJSON() }); - }, - render: function render() { - console.log(_store2.default.plans.get(this.props.planName.toLowerCase()).toJSON()); - console.log(this.props.planName); - return _react2.default.createElement( - 'div', - { className: 'product-modal' }, - _react2.default.createElement( - 'div', - { className: 'left' }, - _react2.default.createElement( - 'h2', - { className: 'blue-color' }, - this.props.planName, - ' Formula' - ), - _react2.default.createElement( - 'div', - { className: 'main-stats' }, - _react2.default.createElement( - 'p', - null, - 'Buy & Sell recommendations' - ), - _react2.default.createElement( - 'p', - null, - 'Model Portfolio Tracking' - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'Avg. round-trip trades per year: ' - ), - this.state.plan.info.roundtripTradesPerYear - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'IIT formulas applied: ' - ), - this.state.plan.info.IITFormulas - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'Historical 45 year CAGR: ' - ), - this.state.plan.stats.CAGR.toFixed(2), - '%' - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'Avg. winning positions: ' - ), - this.state.plan.stats.WLRatio.toFixed(2), - '%' - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'right' }, - _react2.default.createElement( - 'div', - null, - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'Avg. gain per position: ' - ), - this.state.plan.info.avgGainPerPosition, - '%' - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'Avg. loss per position: ' - ), - this.state.plan.info.avgLossPerPosition, - '%' - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'Max drawdown in 45 years: ' - ), - this.state.plan.info.maxDrawdown45y, - '%' - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'Max drawdown in 36 months: ' - ), - this.state.plan.info.maxDrawdown36m, - '%' - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'IRR Arithmetic mean: ' - ), - this.state.plan.info.IRRArithmeticMean, - '%' - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'IRR Geometric mean: ' - ), - this.state.plan.info.IRRGeometricMean, - '%' - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'Sortino ratio: ' - ), - this.state.plan.info.sortinoRatio - ), - _react2.default.createElement( - 'p', - null, - _react2.default.createElement( - 'span', - { className: 'light-text-color' }, - 'Gain-to-pain ratio: ' - ), - this.state.plan.info.gainToPainRatio - ) - ) - ) - ); - } -}); - -exports.default = ProductModal; - -},{"../../store":78,"react":538}],55:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require("react"); - -var _react2 = _interopRequireDefault(_react); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var ProfileCard = _react2.default.createClass({ - displayName: "ProfileCard", - render: function render() { - var topStyle = { - backgroundImage: "url(\"assets/images/profiles/" + this.props.imgName + ".jpg\")" - }; - return _react2.default.createElement( - "div", - { className: "profile" }, - _react2.default.createElement("div", { className: "top", style: topStyle }), - _react2.default.createElement( - "div", - { className: "bottom" }, - _react2.default.createElement( - "h3", - null, - this.props.name - ), - _react2.default.createElement( - "h4", - null, - this.props.title - ) - ) - ); - } -}); - -exports.default = ProfileCard; - -},{"react":538}],56:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require("react"); - -var _react2 = _interopRequireDefault(_react); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Quote = _react2.default.createClass({ - displayName: "Quote", - render: function render() { - return _react2.default.createElement( - "section", - { className: "quote-section" }, - _react2.default.createElement( - "div", - { className: "content" }, - _react2.default.createElement( - "h2", - { className: "quote" }, - "“Compound interest is the eighth wonder of the world.", - _react2.default.createElement("br", null), - "He who understands it - earns it. He who doesn’t - pays it.”" - ), - _react2.default.createElement( - "p", - { className: "disclaimer" }, - "- Albert Einstein" - ) - ) - ); - } -}); - -exports.default = Quote; - -},{"react":538}],57:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require("react"); - -var _react2 = _interopRequireDefault(_react); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var RewardVSRisk = _react2.default.createClass({ - displayName: "RewardVSRisk", - render: function render() { - return _react2.default.createElement( - "section", - { className: "split-section reward-vs-risk" }, - _react2.default.createElement( - "div", - { className: "content" }, - _react2.default.createElement( - "h2", - { className: "title" }, - "More ", - _react2.default.createElement( - "span", - { className: "blue-color" }, - "reward" - ), - ", less ", - _react2.default.createElement( - "span", - { className: "blue-color" }, - "risk" - ) - ), - _react2.default.createElement("div", { className: "divider" }), - _react2.default.createElement( - "div", - { className: "wrapper" }, - _react2.default.createElement( - "div", - { className: "left" }, - _react2.default.createElement("img", { src: "assets/images/omega_chart.svg" }) - ), - _react2.default.createElement( - "div", - { className: "right" }, - _react2.default.createElement( - "p", - null, - "Achieving a higher level of return is, of course, easy if it means accepting higher risk. One simply uses leverage, thus amplifying both risk and reward.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "But our methods generally do the exact opposite. They deliver above-average returns at a below-average risk and without any form of leverage - an absolute rarity." - ), - _react2.default.createElement( - "p", - { className: "disclaimer" }, - "One of the best and most modern risk/reward benchmarks is the Omega function, the output of which is depicted on the left.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "Higher levels indicate higher returns, and steeper slopes indicate lower risk. The yearly return distribution is significantly superior to DJIA at all thresholds and for all products. Depicted: yearly Omega Function." - ) - ) - ) - ) - ); - } -}); - -exports.default = RewardVSRisk; - -},{"react":538}],58:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var SelectPlanForm = _react2.default.createClass({ - displayName: 'SelectPlanForm', - getInitialState: function getInitialState() { - return { planFormClasses: 'select-plan-form ' + this.props.formAnimation, selectedPlan: 'premium' }; - }, - componentWillReceiveProps: function componentWillReceiveProps(newProps) { - this.setState({ planFormClasses: 'select-plan-form ' + newProps.formAnimation }); - }, - componentDidMount: function componentDidMount() { - if (this.props.plan) { - this.setState({ selectedPlan: this.props.plan }); - } - }, - selectPlan: function selectPlan(plan, e) { - e.preventDefault(); - this.setState({ selectedPlan: plan }); - }, - next: function next(e) { - e.preventDefault(); - this.props.goToModal('payment', { plan: this.state.selectedPlan }); - }, - render: function render() { - var basicClass = ''; - var premiumClass = ''; - var businessClass = ''; - var fundClass = ''; - - if (this.state.selectedPlan === 'basic') { - basicClass = 'selected'; - } - if (this.state.selectedPlan === 'premium') { - premiumClass = 'selected'; - } - if (this.state.selectedPlan === 'business') { - businessClass = 'selected'; - } - if (this.state.selectedPlan === 'fund') { - fundClass = 'selected'; - } - - return _react2.default.createElement( - 'form', - { className: this.state.planFormClasses }, - _react2.default.createElement( - 'h3', - { className: 'modal-title' }, - 'Select a Plan' - ), - _react2.default.createElement( - 'div', - { className: 'plans' }, - _react2.default.createElement( - 'button', - { className: basicClass, onClick: this.selectPlan.bind(null, 'basic') }, - _react2.default.createElement( - 'h3', - { className: 'plan-name' }, - 'Basic' - ), - _react2.default.createElement( - 'h3', - { className: 'price' }, - 'Free trial', - _react2.default.createElement('br', null), - _react2.default.createElement( - 'span', - { className: 'disclaimer' }, - '$50 monthly after first month' - ) - ) - ), - _react2.default.createElement( - 'button', - { className: premiumClass, onClick: this.selectPlan.bind(null, 'premium') }, - _react2.default.createElement( - 'h3', - { className: 'plan-name' }, - 'Premium' - ), - _react2.default.createElement( - 'h3', - { className: 'price' }, - '$100', - _react2.default.createElement('br', null), - _react2.default.createElement( - 'span', - { className: 'disclaimer' }, - 'monthly' - ) - ) - ), - _react2.default.createElement( - 'button', - { className: businessClass, onClick: this.selectPlan.bind(null, 'business') }, - _react2.default.createElement( - 'h3', - { className: 'plan-name' }, - 'Business' - ), - _react2.default.createElement( - 'h3', - { className: 'price' }, - '$20,000', - _react2.default.createElement('br', null), - _react2.default.createElement( - 'span', - { className: 'disclaimer' }, - 'annually' - ) - ) - ), - _react2.default.createElement( - 'button', - { className: fundClass, onClick: this.selectPlan.bind(null, 'fund') }, - _react2.default.createElement( - 'h3', - { className: 'plan-name' }, - 'Fund' - ), - _react2.default.createElement( - 'h3', - { className: 'price' }, - '$120,000', - _react2.default.createElement('br', null), - _react2.default.createElement( - 'span', - { className: 'disclaimer' }, - 'annually' - ) - ) - ) - ), - _react2.default.createElement( - 'button', - { onClick: this.next, className: 'filled-btn' }, - 'Next' - ) - ); - } -}); - -exports.default = SelectPlanForm; - -},{"../../store":78,"react":538}],59:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _underscore = require('underscore'); - -var _underscore2 = _interopRequireDefault(_underscore); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -var _Modal = require('../Modal'); - -var _Modal2 = _interopRequireDefault(_Modal); - -var _SelectPlanForm = require('./SelectPlanForm'); - -var _SelectPlanForm2 = _interopRequireDefault(_SelectPlanForm); - -var _SignupForm = require('./SignupForm'); - -var _SignupForm2 = _interopRequireDefault(_SignupForm); - -var _PaymentForm = require('./PaymentForm'); - -var _PaymentForm2 = _interopRequireDefault(_PaymentForm); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Signup = _react2.default.createClass({ - displayName: 'Signup', - - getInitialState: function getInitialState() { - return { modal: 'signup', formAnimation: 'bounce-down', passedProps: {} }; - }, - closeModal: function closeModal(e) { - if (e) { - if (_underscore2.default.toArray(e.target.classList).indexOf('modal-container') !== -1 || _underscore2.default.toArray(e.target.classList).indexOf('form-modal-container') !== -1) { - this.setState({ slideOut: true, formAnimation: 'slide-out' }); - window.setTimeout(function () { - _store2.default.settings.history.push('/'); - }, 300); - } - } - }, - goToModal: function goToModal(newModal, passedProps) { - this.setState({ modal: newModal, passedProps: passedProps, formAnimation: 'slide-in-right' }); - }, - - render: function render() { - var containerStyles = { animation: '300ms fadeIn' }; - - if (this.state.slideOut) { - containerStyles = { background: 'rgba(0,0,0,0)' }; - } - - var modalStyles = { - width: '60%', - maxWidth: '400px', - background: 'none' - }; - if (this.state.modal === 'payment') { - modalStyles = { - width: '60%', - maxWidth: '700px', - background: 'none' - }; - } - - var modalContent = void 0; - if (this.state.modal === 'signup') { - modalContent = _react2.default.createElement(_SignupForm2.default, { goToModal: this.goToModal, passedProps: this.state.passedProps, formAnimation: this.state.formAnimation }); - } else if (this.state.modal === 'selectPlan') { - modalContent = _react2.default.createElement(_SelectPlanForm2.default, { goToModal: this.goToModal, passedProps: this.state.passedProps, formAnimation: this.state.formAnimation }); - } else if (this.state.modal === 'payment') { - modalContent = _react2.default.createElement(_PaymentForm2.default, { goToModal: this.goToModal, passedProps: this.state.passedProps, formAnimation: this.state.formAnimation }); - } - - return _react2.default.createElement( - _Modal2.default, - { closeModal: this.closeModal, containerStyles: containerStyles, modalStyles: modalStyles }, - modalContent - ); - } -}); - -exports.default = Signup; - -},{"../../store":78,"../Modal":9,"./PaymentForm":51,"./SelectPlanForm":58,"./SignupForm":60,"jquery":299,"react":538,"underscore":553}],60:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var SignupForm = _react2.default.createClass({ - displayName: 'SignupForm', - - getInitialState: function getInitialState() { - return { formClasses: 'signup ' + this.props.formAnimation, error: '' }; - }, - componentWillReceiveProps: function componentWillReceiveProps(newProps) { - this.setState({ formClasses: 'signup ' + newProps.formAnimation }); - }, - - signup: function signup(e) { - var _this = this; - - e.preventDefault(); - var name = this.refs.name.value; - var email = this.refs.email.value.toLowerCase(); - var password = this.refs.password.value; - var verifyPassword = this.refs.verifyPassword.value; - - var user = { - name: name, - email: email, - password: password, - verifyPassword: verifyPassword - }; - - _store2.default.session.validateNewUser(user).then(function () { - _store2.default.session.set('name', name); - _store2.default.session.set('email', email); - _store2.default.session.set('password', password); - _this.props.goToModal('selectPlan'); - }).catch(function (errMsg) { - _this.setState({ formClasses: 'signup shake', error: errMsg }); - window.setTimeout(function () { - _this.setState({ formClasses: 'signup', error: errMsg }); - }, 300); - }); - }, - render: function render() { - console.log(this.state.formClasses); - var errorMsg = void 0; - var nameClasses = 'name input-wrapper'; - var emailClasses = 'email input-wrapper'; - var passwordClasses = 'password input-wrapper'; - var verifyPasswordClasses = 'verify-password input-wrapper'; - - if (this.state.error) { - console.log(this.state.error); - if (this.state.error.indexOf('name') !== -1) { - nameClasses = 'name error input-wrapper'; - } else if (this.state.error.indexOf('email') !== -1) { - emailClasses = 'email error input-wrapper'; - } else if (this.state.error.indexOf('match') !== -1) { - passwordClasses = 'password error input-wrapper'; - verifyPasswordClasses = 'verify-password error input-wrapper'; - } else if (this.state.error.toLowerCase().indexOf('password') !== -1) { - passwordClasses = 'password error input-wrapper'; - } - errorMsg = _react2.default.createElement( - 'div', - { className: 'form-error' }, - _react2.default.createElement( - 'h4', - null, - _react2.default.createElement('i', { className: 'fa fa-exclamation-circle', 'aria-hidden': 'true' }), - this.state.error - ) - ); - } - - return _react2.default.createElement( - 'form', - { onSubmit: this.signup, className: this.state.formClasses, ref: 'signupModal' }, - _react2.default.createElement( - 'h3', - null, - 'Signup' - ), - errorMsg, - _react2.default.createElement( - 'div', - { className: nameClasses }, - _react2.default.createElement('input', { type: 'text', placeholder: 'Name', ref: 'name', autoFocus: 'true' }) - ), - _react2.default.createElement( - 'div', - { className: emailClasses }, - _react2.default.createElement('input', { type: 'email', placeholder: 'Email', ref: 'email' }) - ), - _react2.default.createElement( - 'div', - { className: passwordClasses }, - _react2.default.createElement('input', { type: 'password', placeholder: 'Password', ref: 'password' }) - ), - _react2.default.createElement( - 'div', - { className: verifyPasswordClasses }, - _react2.default.createElement('input', { type: 'password', placeholder: 'Verify password', ref: 'verifyPassword' }) - ), - _react2.default.createElement('input', { type: 'submit', id: 'submit-btn', value: 'Next' }) - ); - } -}); - -exports.default = SignupForm; - -},{"../../store":78,"react":538}],61:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _store = require('../../store'); - -var _store2 = _interopRequireDefault(_store); - -var _amcharts3React = require('../../libraries/amcharts3-react'); - -var _amcharts3React2 = _interopRequireDefault(_amcharts3React); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var TheResults = _react2.default.createClass({ - displayName: 'TheResults', - getInitialState: function getInitialState() { - return { fetched: false, logarithmic: true, animate: false }; - }, - componentDidMount: function componentDidMount() { - (0, _jquery2.default)(window).on('scroll', this.animate); - _store2.default.plans.on('change', this.drawGraph); - _store2.default.market.data.on('change', this.drawGraph); - }, - componentWillUnmount: function componentWillUnmount() { - (0, _jquery2.default)(window).off('scroll', this.animate); - _store2.default.plans.off('change', this.drawGraph); - _store2.default.market.data.off('change', this.drawGraph); - }, - animate: function animate() { - var hT = (0, _jquery2.default)(this.refs.subtitle).offset().top; - var hH = (0, _jquery2.default)(this.refs.subtitle).outerHeight() + 250; - var wH = (0, _jquery2.default)(window).height(); - - if ((0, _jquery2.default)(window).scrollTop() > hT + hH - wH) { - this.setState({ animate: true }); - (0, _jquery2.default)(window).off('scroll', this.animate); - }; - }, - drawGraph: function drawGraph() { - this.setState({ fetched: true }); - }, - toggleLogScale: function toggleLogScale() { - this.setState({ logarithmic: !this.state.logarithmic }); - }, - render: function render() { - var basicData = _store2.default.plans.get('basic').get('annualData'); - var premiumData = _store2.default.plans.get('premium').get('annualData'); - var businessData = _store2.default.plans.get('business').get('annualData'); - // let fundData = store.plans.get('fund').get('annualData') - - var marketData = _store2.default.market.data.get('annualData'); - - var fixedData = basicData.map(function (point, i) { - - var premiumBalance = 0; - var businessBalance = 0; - // let fundBalance = 0 - var marketBalance = 0; - - if (premiumData[i]) { - premiumBalance = premiumData[i].balance; - } - if (businessData[i]) { - businessBalance = businessData[i].balance; - } - // if (fundData[i]) { fundBalance = fundData[i].balance } - if (marketData[i]) { - marketBalance = marketData[i]; - } - - return { - basic: point.balance, - premium: premiumBalance, - business: businessBalance, - // fund: fundBalance, - market: marketBalance, - - basicBalloon: formatPrice(point.balance), - premiumBalloon: formatPrice(premiumBalance), - businessBalloon: formatPrice(businessBalance), - // fundBalloon: formatPrice(fundBalance), - marketBalloon: formatPrice(marketBalance), - - date: point.date.year + '-' + point.date.month + '-' + point.date.day - }; - }); - - function formatPrice(value) { - while (/(\d+)(\d{3})/.test(value.toString())) { - value = value.toString().replace(/(\d+)(\d{3})/, '$1' + ',' + '$2'); - } - var price = '$' + value; - return price; - } - - var chartData = []; - if (this.state.animate) { - chartData = fixedData; - } - - var config = { - type: "serial", - theme: "dark", - addClassNames: true, - - dataProvider: chartData, - - balloon: { - color: '#49494A', - fillAlpha: 1, - borderColor: '#FFFFFF', - borderThickness: 0 - }, - - graphs: [{ - id: "market", - lineColor: "#49494A", - - bullet: "square", - bulletBorderAlpha: 1, - bulletColor: "#FFFFFF", - bulletSize: 5, - hideBulletsCount: 10, - lineThickness: 2, - useLineColorForBulletBorder: true, - valueField: "market", - "balloonText": "
S&P 500[[marketBalloon]]
" - }, { - id: "basic", - lineColor: "#FFFFFF", - - bullet: "square", - bulletBorderAlpha: 1, - bulletColor: "#FFFFFF", - bulletSize: 5, - hideBulletsCount: 10, - lineThickness: 2, - useLineColorForBulletBorder: true, - valueField: "basic", - balloonText: "
Basic[[basicBalloon]]
" - }, { - id: "premium", - lineColor: "#FFFFFF", - - bullet: "square", - bulletBorderAlpha: 1, - bulletColor: "#FFFFFF", - bulletSize: 5, - hideBulletsCount: 10, - lineThickness: 2, - useLineColorForBulletBorder: true, - valueField: "premium", - balloonText: "
Premium[[premiumBalloon]]
" - }, { - id: "business", - lineColor: "#FFFFFF", - - bullet: "square", - bulletBorderAlpha: 1, - bulletColor: "#FFFFFF", - bulletSize: 5, - hideBulletsCount: 10, - lineThickness: 2, - useLineColorForBulletBorder: true, - valueField: "business", - "balloonText": "
Business[[businessBalloon]]
" - }], - valueAxes: [{ - logarithmic: true, - unit: '$', - unitPosition: 'left', - gridAlpha: 0.15, - minorGridEnabled: true, - dashLength: 0, - inside: true - }], - - chartCursor: { - valueLineEnabled: true, - valueLineAlpha: 0.5, - fullWidth: true, - cursorAlpha: 0.5 - }, - - categoryField: "date", - // dataDateFormat: "YYYY-M-D", - categoryAxis: { - parseDates: true, - equalSpacing: true - } - - }; - - if (_store2.default.session.browserType() === 'Safari') { - config.dataDateFormat = "YYYY-M-D", config.categoryAxis = { - equalSpacing: true - }; - } - - var chart = _react2.default.createElement( - 'div', - { id: 'result-chart', className: this.state.chartClass }, - _react2.default.createElement(AmCharts.React, config) - ); - - return _react2.default.createElement( - 'section', - { className: 'the-results' }, - _react2.default.createElement( - 'div', - { className: 'content', ref: 'content' }, - _react2.default.createElement( - 'h2', - { className: 'title' }, - 'Performance' - ), - _react2.default.createElement('div', { className: 'divider' }), - _react2.default.createElement( - 'h3', - { className: 'subtitle', onClick: this.toggleLogScale, ref: 'subtitle' }, - 'Log graph' - ), - chart, - _react2.default.createElement( - 'h2', - { className: 'second title' }, - 'Formula Stocks vs. S&P 500' - ), - _react2.default.createElement( - 'p', - null, - 'Log scale graph of Formula Stocks products (white) versus S&P 500 (gray). The observed outperformance is the result of cumulatively 9,800 buy & sell recommendations. To date the winners of the future have been identified with an accuracy of 84%, 90%, and 92%, respectively*. Random stocks measured by the same yardstick win ~60% of the time. The difference is very significant.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'Formula Stocks’ strategies have outperformed the S&P 500 between 71% and 88% of the time. Modern risk benchmarks indicate that Formula Stocks’ strategies exhibit less risk than the general market. Results after 2009 launch are those of following the strategy in real-time. Results before 2009 are back-tested.' - ) - ) - ); - } -}); - -exports.default = TheResults; - -},{"../../libraries/amcharts3-react":70,"../../store":78,"jquery":299,"react":538}],62:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require("react"); - -var _react2 = _interopRequireDefault(_react); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var WhatIsIt = _react2.default.createClass({ - displayName: "WhatIsIt", - render: function render() { - return _react2.default.createElement( - "div", - { id: "what-is-it" }, - _react2.default.createElement( - "div", - { className: "left" }, - _react2.default.createElement( - "p", - { className: "fs-title" }, - "Formula Stocks" - ), - _react2.default.createElement( - "h3", - { className: "title" }, - "What is it?" - ), - _react2.default.createElement( - "p", - null, - "Using expert system technology we pick next year's winners in the markets today.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "Whether value or growth investor, pro or novice, you can rely on Formula Stocks for better and more informed investment decisions.", - _react2.default.createElement("br", null), - _react2.default.createElement("br", null), - "Gain a systematic edge for generating value in the marketplace." - ) - ), - _react2.default.createElement( - "div", - { className: "right" }, - _react2.default.createElement("img", { className: "screenshot", src: "assets/images/portfolio-screenshot.png" }) - ) - ); - } -}); - -exports.default = WhatIsIt; - -},{"react":538}],63:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var AboveAverageReturns = _react2.default.createClass({ - displayName: 'AboveAverageReturns', - getInitialState: function getInitialState() { - return { animate: false }; - }, - componentDidMount: function componentDidMount() { - (0, _jquery2.default)(window).on('scroll', this.animate); - }, - componentWillUnmount: function componentWillUnmount() { - (0, _jquery2.default)(window).off('scroll', this.animate); - }, - animate: function animate() { - var hT = (0, _jquery2.default)(this.refs.right).offset().top; - var hH = (0, _jquery2.default)(this.refs.right).outerHeight(); - var wH = (0, _jquery2.default)(window).height(); - - if ((0, _jquery2.default)(window).scrollTop() > hT + hH - wH) { - this.setState({ animate: true }); - (0, _jquery2.default)(window).off('scroll', this.animate); - }; - }, - render: function render() { - var p1 = void 0, - p2 = void 0, - p3 = void 0, - p4 = void 0, - p5 = void 0, - p6 = void 0, - p7 = void 0; - if (this.state.animate) { - p1 = 'fade-in p1'; - p2 = 'fade-in p2'; - p3 = 'fade-in p3'; - p4 = 'fade-in p4'; - p5 = 'fade-in p5'; - p6 = 'fade-in p6'; - p7 = 'fade-in p7'; - } - - return _react2.default.createElement( - 'section', - { className: 'split-section above-average-returns' }, - _react2.default.createElement( - 'div', - { className: 'content' }, - _react2.default.createElement( - 'div', - { className: 'left' }, - _react2.default.createElement( - 'h2', - { className: 'title' }, - 'Prefer above-average returns?' - ), - _react2.default.createElement( - 'p', - null, - 'The world is full of investment information. Because this information is offered to a large number of people, the market has already adjusted to it and priced it in, when you receive it.\u2028\u2028', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'So in order to outperform the markets, you will need an edge, an informational advantage available only to a minority.' - ) - ), - _react2.default.createElement( - 'div', - { className: 'right', ref: 'right' }, - _react2.default.createElement( - 'div', - { className: 'container' }, - _react2.default.createElement( - 'p', - { className: p1 }, - '+61%' - ), - _react2.default.createElement( - 'p', - { className: p2 }, - '+47%' - ), - _react2.default.createElement( - 'p', - { className: p3 }, - '+43%' - ), - _react2.default.createElement( - 'p', - { className: p4 }, - '+32%' - ), - _react2.default.createElement( - 'p', - { className: p5 }, - '+29%' - ), - _react2.default.createElement( - 'p', - { className: p6 }, - '+23%' - ), - _react2.default.createElement( - 'p', - { className: p7 }, - '+17%' - ) - ) - ) - ) - ); - } -}); - -exports.default = AboveAverageReturns; - -},{"jquery":299,"react":538}],64:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _reactScroll = require('react-scroll'); - -var _reactScroll2 = _interopRequireDefault(_reactScroll); - -var _store = require('../../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var HigherPerformance = _react2.default.createClass({ - displayName: 'HigherPerformance', - getInitialState: function getInitialState() { - return { animate: false }; - }, - componentDidMount: function componentDidMount() { - (0, _jquery2.default)(window).on('scroll', this.animate); - }, - componentWillUnmount: function componentWillUnmount() { - (0, _jquery2.default)(window).off('scroll', this.animate); - }, - animate: function animate() { - - var hT = (0, _jquery2.default)(this.refs.content).offset().top; - var hH = (0, _jquery2.default)(this.refs.content).outerHeight(); - var wH = (0, _jquery2.default)(window).height(); - - if ((0, _jquery2.default)(window).scrollTop() > hT + hH - wH) { - console.log('animate'); - this.setState({ animate: true }); - (0, _jquery2.default)(window).off('scroll', this.animate); - }; - }, - tryIt: function tryIt() { - _store2.default.settings.history.push('/signup'); - }, - render: function render() { - var Link = _reactScroll2.default.Link; - - var imgClass = void 0; - if (this.state.animate) { - imgClass = 'slide-up-mockup-img'; - } - - return _react2.default.createElement( - 'div', - { className: 'bg-white split-section higher-performance' }, - _react2.default.createElement( - 'div', - { className: 'content', ref: 'content' }, - _react2.default.createElement( - 'div', - { className: 'left' }, - _react2.default.createElement( - 'h2', - { className: 'title' }, - 'Higher performance at a lower cost' - ), - _react2.default.createElement( - 'p', - null, - 'Formula Stocks offers an informational advantage in the form of a capital allocation strategy and easy-to-use purchase and sales recommendations.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'It comes at a low flat fee, which will typically involve considerable savings compared to traditional methods of investing, such as funds or money management.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'Higher performance at a lower cost. What’s not to like?' - ), - _react2.default.createElement( - 'div', - { className: 'cta' }, - _react2.default.createElement( - 'button', - { className: 'filled-btn', onClick: this.tryIt }, - 'Try it for free!' - ), - _react2.default.createElement( - Link, - { className: 'outline-btn blue-color', to: 'ourProducts', smooth: true, offset: -100, duration: 500 }, - 'Learn more' - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'right' }, - _react2.default.createElement('img', { src: 'assets/images/Ipad.png', className: imgClass }) - ) - ) - ); - } -}); - -exports.default = HigherPerformance; - -},{"../../../store":78,"jquery":299,"react":538,"react-scroll":374}],65:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _store = require('../../../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var InformationalAdvantage = _react2.default.createClass({ - displayName: 'InformationalAdvantage', - getInitialState: function getInitialState() { - return { - fetched: false, - animate: false, - basic: 0, - premium: 0, - business: 0, - fund: 0, - market: 0 - }; - }, - componentDidMount: function componentDidMount() { - // store.plans.on('update', this.updateState) - (0, _jquery2.default)(window).on('scroll', this.animate); - }, - componentWillUnmount: function componentWillUnmount() { - // store.plans.off('update', this.updateState) - (0, _jquery2.default)(window).off(); - }, - updateState: function updateState() { - this.setState({ fetched: true }); - }, - animate: function animate() { - var hT = (0, _jquery2.default)(this.refs.content).offset().top; - var hH = (0, _jquery2.default)(this.refs.content).outerHeight(); - var wH = (0, _jquery2.default)(window).height(); - - if ((0, _jquery2.default)(window).scrollTop() > hT + hH - wH) { - this.updateNumbers(); - if (Math.floor(_store2.default.plans.get('business').get('stats').WLRatio) !== 0) { - (0, _jquery2.default)(window).off('scroll', this.animate); - } - }; - }, - updateNumbers: function updateNumbers() { - var bas = void 0, - pre = void 0, - bus = void 0, - fun = void 0, - mar = 0; - this.state.basic < Math.floor(_store2.default.plans.get('basic').get('stats').WLRatio) ? bas = this.state.basic + 1 : bas = Math.floor(_store2.default.plans.get('basic').get('stats').WLRatio); - this.state.premium < Math.floor(_store2.default.plans.get('premium').get('stats').WLRatio) ? pre = this.state.premium + 1 : pre = Math.floor(_store2.default.plans.get('premium').get('stats').WLRatio); - this.state.business < Math.floor(_store2.default.plans.get('business').get('stats').WLRatio) ? bus = this.state.business + 1 : bus = Math.floor(_store2.default.plans.get('business').get('stats').WLRatio); - this.state.fund < Math.floor(_store2.default.plans.get('fund').get('stats').WLRatio) ? fun = this.state.fund + 1 : fun = Math.floor(_store2.default.plans.get('fund').get('stats').WLRatio); - this.state.market < 60 ? mar = this.state.market + 1 : mar = 60; - - this.setState({ - basic: bas, - premium: pre, - business: bus, - fund: fun, - market: mar - }); - - // console.log(bus, Math.floor(store.plans.get('business').get('stats').WLRatio)); - if (bus < Math.floor(_store2.default.plans.get('business').get('stats').WLRatio)) { - window.setTimeout(this.updateNumbers, 2); - } - }, - render: function render() { - - var basStyle = { - height: 'calc(' + this.state.basic + '% + 45px)' - }; - var preStyle = { - height: 'calc(' + this.state.premium + '% + 45px)' - }; - var busStyle = { - height: 'calc(' + this.state.business + '% + 45px)' - }; - var funStyle = { - height: 'calc(' + this.state.fund + '% + 45px)' - }; - var marStyle = { - height: 'calc(' + this.state.market + '% + 45px)' - }; - - // Formula Stocks uses state-of-the-art technology to compile and - // analyze an enormous amount of information, creating a new unique - // edge for outperforming the market. And, above all, we make it - // available only to a small number of members, giving them an - // advantage available nowhere else.

- // - // This scientifically based approach on stock selection has predicted - // winners with an 84%, 87%, 90% and 97% success rate in the past.

- // - // This contrasts strongly to the ≈60% win ratio of typical - // investments in the market.

- // - // To the right you see four different Formula Stocks products and their - // win ratio performance relative to the market. - - return _react2.default.createElement( - 'div', - { className: 'bg-white split-section informational-advantage' }, - _react2.default.createElement( - 'div', - { className: 'content', ref: 'content' }, - _react2.default.createElement( - 'div', - { className: 'left' }, - _react2.default.createElement( - 'h2', - { className: 'title' }, - 'An informational advantage' - ), - _react2.default.createElement( - 'p', - null, - 'Formula Stocks develops proprietary state-of-the-art technology to compile and analyze enormous amounts of information, creating a new unique edge for outperforming the market. Above all, we make it available only to members, giving them an exclusive advantage available nowhere else.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'This scientifically based approach to stock selection has predicted winners with an', - ' ' + Math.floor(_store2.default.plans.get('basic').get('stats').WLRatio), - '%,', - ' ' + Math.floor(_store2.default.plans.get('premium').get('stats').WLRatio), - '%,', - ' ' + Math.floor(_store2.default.plans.get('fund').get('stats').WLRatio), - '% and', - ' ' + Math.floor(_store2.default.plans.get('business').get('stats').WLRatio), - '% success rate in the past.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'This contrasts strongly to the ≈60% success rates of typical investments in the market.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'To the right you see four different Formula Stocks products and their ratio of winners to losers, relative to the broader market.' - ) - ), - _react2.default.createElement( - 'div', - { className: 'right' }, - _react2.default.createElement( - 'div', - { className: 'bar-chart' }, - _react2.default.createElement( - 'div', - { className: 'bar basic-bar', style: basStyle }, - _react2.default.createElement( - 'p', - null, - this.state.basic, - '%' - ), - _react2.default.createElement( - 'p', - { className: 'plan-name' }, - 'Basic' - ) - ), - _react2.default.createElement( - 'div', - { className: 'bar premium-bar', style: preStyle }, - _react2.default.createElement( - 'p', - null, - this.state.premium, - '%' - ), - _react2.default.createElement( - 'p', - { className: 'plan-name' }, - 'Premium' - ) - ), - _react2.default.createElement( - 'div', - { className: 'bar business-bar', style: busStyle }, - _react2.default.createElement( - 'p', - null, - this.state.business, - '%' - ), - _react2.default.createElement( - 'p', - { className: 'plan-name' }, - 'Business' - ) - ), - _react2.default.createElement( - 'div', - { className: 'bar fund-bar', style: funStyle }, - _react2.default.createElement( - 'p', - null, - this.state.fund, - '%' - ), - _react2.default.createElement( - 'p', - { className: 'plan-name' }, - 'Fund' - ) - ), - _react2.default.createElement( - 'div', - { className: 'sp-bar', style: marStyle }, - _react2.default.createElement( - 'p', - null, - this.state.market, - '%' - ), - _react2.default.createElement( - 'p', - { className: 'plan-name' }, - 'Market' - ) - ) - ) - ) - ) - ); - } -}); - -exports.default = InformationalAdvantage; - -},{"../../../store":78,"jquery":299,"react":538}],66:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _store = require('../../../store'); - -var _store2 = _interopRequireDefault(_store); - -var _cc = require('../../../cc'); - -var _cc2 = _interopRequireDefault(_cc); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var OneDollar = _react2.default.createClass({ - displayName: 'OneDollar', - getInitialState: function getInitialState() { - return { fs: 1, market: 1, plan: 'premium', currYear: 0, fsPercent: 0, spPercent: 0 }; - }, - componentDidMount: function componentDidMount() { - (0, _jquery2.default)(window).on('scroll', this.animate); - _store2.default.plans.on('change', this.resetState); - }, - componentWillUnmount: function componentWillUnmount() { - (0, _jquery2.default)(window).off('scroll', this.animate); - _store2.default.plans.off('change', this.resetState); - }, - resetState: function resetState() { - this.setState({ fs: 1, market: 1, plan: 'premium', currYear: 0, fsPercent: 0, spPercent: 0 }); - }, - animate: function animate() { - var hT = (0, _jquery2.default)(this.refs.content).offset().top; - var hH = (0, _jquery2.default)(this.refs.content).outerHeight(); - var wH = (0, _jquery2.default)(window).height(); - - if ((0, _jquery2.default)(window).scrollTop() > hT + hH - wH) { - this.updateNumbers(); - (0, _jquery2.default)(window).off('scroll', this.animate); - }; - }, - updateNumbers: function updateNumbers(plan) { - var fs = this.state.fs; - var sp = this.state.market; - var year = this.state.currYear; - - if (plan) { - console.log('CHANGED TO PLAN: ', plan); - plan = plan; - fs = 1; - sp = 1; - year = 0; - } else { - plan = this.state.plan; - } - - var multiplier = _store2.default.plans.get(plan).get('stats').CAGR / 100 + 1; - - fs = fs * multiplier; - sp = sp * (_store2.default.market.cagr / 100 + 1); - - if (fs > Math.pow(1 * multiplier, 45)) { - fs = Math.pow(1 * multiplier, 45); - } - if (sp > Math.pow(1 * (_store2.default.market.cagr / 100 + 1), 45)) { - sp = Math.pow(1 * (_store2.default.market.cagr / 100 + 1), 45); - } - - if (multiplier > 1) { - this.setState({ - fs: fs.toFixed(2), - market: sp.toFixed(2), - currYear: year + 1, - plan: plan, - fsPercent: year / 45, - spPercent: sp / Math.pow(1 * multiplier, 45), - reAnimate: false - }); - } - if (year < 44) { - window.setTimeout(this.updateNumbers, 20); - } - }, - render: function render() { - var fsStyle = { - width: this.state.fsPercent * 100 + '%' - }; - - var spStyle = { - width: 'calc(' + (this.state.spPercent * 100 + '%') + ' + 1px)' - }; - - var basClass = void 0, - preClass = void 0, - busClass = void 0, - funClass = void 0; - if (this.state.plan === 'basic') { - basClass = 'selected'; - } - if (this.state.plan === 'premium') { - preClass = 'selected'; - } - if (this.state.plan === 'business') { - busClass = 'selected'; - } - if (this.state.plan === 'fund') { - funClass = 'selected'; - } - - return _react2.default.createElement( - 'div', - { className: 'bg-gray split-section one-dollar' }, - _react2.default.createElement( - 'div', - { className: 'content', ref: 'content' }, - _react2.default.createElement( - 'div', - { className: 'left' }, - _react2.default.createElement( - 'div', - { className: 'plans' }, - _react2.default.createElement( - 'button', - { onClick: this.updateNumbers.bind(null, 'basic'), className: basClass }, - 'Basic', - _react2.default.createElement('div', null) - ), - _react2.default.createElement( - 'button', - { onClick: this.updateNumbers.bind(null, 'premium'), className: preClass }, - 'Premium', - _react2.default.createElement('div', null) - ), - _react2.default.createElement( - 'button', - { onClick: this.updateNumbers.bind(null, 'business'), className: busClass }, - 'Business', - _react2.default.createElement('div', null) - ), - _react2.default.createElement( - 'button', - { onClick: this.updateNumbers.bind(null, 'fund'), className: funClass }, - 'Fund', - _react2.default.createElement('div', null) - ) - ), - _react2.default.createElement( - 'div', - { className: 'fs bar', style: fsStyle }, - _react2.default.createElement( - 'p', - null, - '$', - _cc2.default.commafy(Math.round(this.state.fs)) - ) - ), - _react2.default.createElement( - 'p', - { className: 'fs plan-name' }, - _react2.default.createElement( - 'span', - { className: 'capitalize' }, - this.state.plan - ), - ' product' - ), - _react2.default.createElement( - 'div', - { className: 'market-bar-container' }, - _react2.default.createElement('div', { className: 'market bar', style: spStyle }), - _react2.default.createElement( - 'p', - null, - '$', - Math.round(this.state.market) - ) - ), - _react2.default.createElement( - 'p', - { className: 'plan-name' }, - 'S&P 500' - ) - ), - _react2.default.createElement( - 'div', - { className: 'right' }, - _react2.default.createElement( - 'h2', - { className: 'title' }, - '$1 and 45 years' - ), - _react2.default.createElement( - 'p', - null, - 'This is how much 1 dollar could have grown over 45 years, If you had invested it either in the market (S&P 500) or a Formula Stocks strategy.*' - ), - _react2.default.createElement( - 'p', - { className: 'disclaimer' }, - '(*) in a tax-free account, excluding trading costs and slippage' - ) - ) - ) - ); - } -}); - -exports.default = OneDollar; - -},{"../../../cc":3,"../../../store":78,"jquery":299,"react":538}],67:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var ReachYourGoals = _react2.default.createClass({ - displayName: 'ReachYourGoals', - getInitialState: function getInitialState() { - return { animate: false }; - }, - componentDidMount: function componentDidMount() { - (0, _jquery2.default)(window).on('scroll', this.animate); - }, - componentWillUnmount: function componentWillUnmount() { - (0, _jquery2.default)(window).off('scroll', this.animate); - }, - animate: function animate() { - var hT = (0, _jquery2.default)(this.refs.content).offset().top; - var hH = (0, _jquery2.default)(this.refs.content).outerHeight(); - var wH = (0, _jquery2.default)(window).height(); - - if ((0, _jquery2.default)(window).scrollTop() > hT + hH - wH) { - this.setState({ animate: true }); - (0, _jquery2.default)(window).off('scroll', this.animate); - }; - }, - render: function render() { - var imgClass = void 0; - if (this.state.animate) { - imgClass = 'slide-up-reach-goal-img'; - } - return _react2.default.createElement( - 'section', - { className: 'split-section bg-gray reach-your-goals' }, - _react2.default.createElement( - 'div', - { className: 'content', ref: 'content' }, - _react2.default.createElement( - 'div', - { className: 'left' }, - _react2.default.createElement('img', { className: imgClass, src: 'assets/images/man-at-computer.png', ref: 'img' }) - ), - _react2.default.createElement( - 'div', - { className: 'right' }, - _react2.default.createElement( - 'h2', - { className: 'title' }, - 'Reach your goals!' - ), - _react2.default.createElement( - 'p', - null, - 'To reach your goals, whether it is to live a dream, retire comfortably, or simply make your savings grow - you’ll also need a strategy.', - _react2.default.createElement('br', null), - _react2.default.createElement('br', null), - 'A strategy, which will help you systematically buy low and sell high. Formula Stocks makes that easy.' - ) - ) - ) - ); - } -}); - -exports.default = ReachYourGoals; - -},{"jquery":299,"react":538}],68:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = [{ "label": "Afghanistan", "value": "AF" }, { "label": "land Islands", "value": "AX" }, { "label": "Albania", "value": "AL", taxPercent: 20 }, { "label": "Algeria", "value": "DZ" }, { "label": "American Samoa", "value": "AS" }, { "label": "AndorrA", "value": "AD" }, { "label": "Angola", "value": "AO" }, { "label": "Anguilla", "value": "AI" }, { "label": "Antarctica", "value": "AQ" }, { "label": "Antigua and Barbuda", "value": "AG" }, { "label": "Argentina", "value": "AR" }, { "label": "Armenia", "value": "AM" }, { "label": "Aruba", "value": "AW" }, { "label": "Australia", "value": "AU" }, { "label": "Austria", "value": "AT", taxPercent: 20 }, { "label": "Azerbaijan", "value": "AZ" }, { "label": "Bahamas", "value": "BS" }, { "label": "Bahrain", "value": "BH" }, { "label": "Bangladesh", "value": "BD" }, { "label": "Barbados", "value": "BB" }, { "label": "Belarus", "value": "BY", taxPercent: 20 }, { "label": "Belgium", "value": "BE", taxPercent: 21 }, { "label": "Belize", "value": "BZ" }, { "label": "Benin", "value": "BJ" }, { "label": "Bermuda", "value": "BM" }, { "label": "Bhutan", "value": "BT" }, { "label": "Bolivia", "value": "BO" }, { "label": "Bosnia and Herzegovina", "value": "BA", taxPercent: 17 }, { "label": "Botswana", "value": "BW" }, { "label": "Bouvet Island", "value": "BV" }, { "label": "Brazil", "value": "BR" }, { "label": "British Indian Ocean Territory", "value": "IO" }, { "label": "Brunei Darussalam", "value": "BN" }, { "label": "Bulgaria", "value": "BG", taxPercent: 20 }, { "label": "Burkina Faso", "value": "BF" }, { "label": "Burundi", "value": "BI" }, { "label": "Cambodia", "value": "KH" }, { "label": "Cameroon", "value": "CM" }, { "label": "Canada", "value": "CA" }, { "label": "Cape Verde", "value": "CV" }, { "label": "Cayman Islands", "value": "KY" }, { "label": "Central African Republic", "value": "CF" }, { "label": "Chad", "value": "TD" }, { "label": "Chile", "value": "CL" }, { "label": "China", "value": "CN" }, { "label": "Christmas Island", "value": "CX" }, { "label": "Cocos (Keeling) Islands", "value": "CC" }, { "label": "Colombia", "value": "CO" }, { "label": "Comoros", "value": "KM" }, { "label": "Congo", "value": "CG" }, { "label": "Congo, The Democratic Republic of the", "value": "CD" }, { "label": "Cook Islands", "value": "CK" }, { "label": "Costa Rica", "value": "CR" }, { "label": "Cote D\'Ivoire", "value": "CI" }, { "label": "Croatia", "value": "HR", taxPercent: 25 }, { "label": "Cuba", "value": "CU" }, { "label": "Cyprus", "value": "CY", taxPercent: 19 }, { "label": "Czech Republic", "value": "CZ", taxPercent: 21 }, { "label": "Denmark", "value": "DK", taxPercent: 25 }, { "label": "Djibouti", "value": "DJ" }, { "label": "Dominica", "value": "DM" }, { "label": "Dominican Republic", "value": "DO" }, { "label": "Ecuador", "value": "EC" }, { "label": "Egypt", "value": "EG" }, { "label": "El Salvador", "value": "SV" }, { "label": "Equatorial Guinea", "value": "GQ" }, { "label": "Eritrea", "value": "ER" }, { "label": "Estonia", "value": "EE", taxPercent: 20 }, { "label": "Ethiopia", "value": "ET" }, { "label": "Falkland Islands (Malvinas)", "value": "FK" }, { "label": "Faroe Islands", "value": "FO" }, { "label": "Fiji", "value": "FJ" }, { "label": "Finland", "value": "FI", taxPercent: 24 }, { "label": "France", "value": "FR", taxPercent: 20 }, { "label": "French Guiana", "value": "GF" }, { "label": "French Polynesia", "value": "PF" }, { "label": "French Southern Territories", "value": "TF" }, { "label": "Gabon", "value": "GA" }, { "label": "Gambia", "value": "GM" }, { "label": "Georgia", "value": "GE" }, { "label": "Germany", "value": "DE", taxPercent: 19 }, { "label": "Ghana", "value": "GH" }, { "label": "Gibraltar", "value": "GI" }, { "label": "Greece", "value": "GR", taxPercent: 24 }, { "label": "Greenland", "value": "GL" }, { "label": "Grenada", "value": "GD" }, { "label": "Guadeloupe", "value": "GP" }, { "label": "Guam", "value": "GU" }, { "label": "Guatemala", "value": "GT" }, { "label": "Guernsey", "value": "GG" }, { "label": "Guinea", "value": "GN" }, { "label": "Guinea-Bissau", "value": "GW" }, { "label": "Guyana", "value": "GY" }, { "label": "Haiti", "value": "HT" }, { "label": "Heard Island and Mcdonald Islands", "value": "HM" }, { "label": "Holy See (Vatican City State)", "value": "VA" }, { "label": "Honduras", "value": "HN" }, { "label": "Hong Kong", "value": "HK" }, { "label": "Hungary", "value": "HU", taxPercent: 27 }, { "label": "Iceland", "value": "IS", taxPercent: 24 }, { "label": "India", "value": "IN" }, { "label": "Indonesia", "value": "ID" }, { "label": "Iran, Islamic Republic Of", "value": "IR" }, { "label": "Iraq", "value": "IQ" }, { "label": "Ireland", "value": "IE", taxPercent: 23 }, { "label": "Isle of Man", "value": "IM" }, { "label": "Israel", "value": "IL" }, { "label": "Italy", "value": "IT", taxPercent: 22 }, { "label": "Jamaica", "value": "JM" }, { "label": "Japan", "value": "JP" }, { "label": "Jersey", "value": "JE" }, { "label": "Jordan", "value": "JO" }, { "label": "Kazakhstan", "value": "KZ" }, { "label": "Kenya", "value": "KE" }, { "label": "Kiribati", "value": "KI" }, { "label": "Korea, Democratic People\'S Republic of", "value": "KP" }, { "label": "Korea, Republic of", "value": "KR" }, { "label": "Kuwait", "value": "KW" }, { "label": "Kyrgyzstan", "value": "KG" }, { "label": "Lao People\'S Democratic Republic", "value": "LA" }, { "label": "Latvia", "value": "LV", taxPercent: 21 }, { "label": "Lebanon", "value": "LB" }, { "label": "Lesotho", "value": "LS" }, { "label": "Liberia", "value": "LR" }, { "label": "Libyan Arab Jamahiriya", "value": "LY" }, { "label": "Liechtenstein", "value": "LI", taxPercent: 8 }, { "label": "Lithuania", "value": "LT", taxPercent: 21 }, { "label": "Luxembourg", "value": "LU", taxPercent: 17 }, { "label": "Macao", "value": "MO" }, { "label": "Macedonia, Republic of", "value": "MK", taxPercent: 18 }, { "label": "Madagascar", "value": "MG" }, { "label": "Malawi", "value": "MW" }, { "label": "Malaysia", "value": "MY" }, { "label": "Maldives", "value": "MV" }, { "label": "Mali", "value": "ML" }, { "label": "Malta", "value": "MT", taxPercent: 18 }, { "label": "Marshall Islands", "value": "MH" }, { "label": "Martinique", "value": "MQ" }, { "label": "Mauritania", "value": "MR" }, { "label": "Mauritius", "value": "MU" }, { "label": "Mayotte", "value": "YT" }, { "label": "Mexico", "value": "MX" }, { "label": "Micronesia, Federated States of", "value": "FM" }, { "label": "Moldova, Republic of", "value": "MD" }, { "label": "Monaco", "value": "MC" }, { "label": "Mongolia", "value": "MN" }, { "label": "Montenegro", "value": "ME", taxPercent: 17 }, { "label": "Montserrat", "value": "MS" }, { "label": "Morocco", "value": "MA" }, { "label": "Mozambique", "value": "MZ" }, { "label": "Myanmar", "value": "MM" }, { "label": "Namibia", "value": "NA" }, { "label": "Nauru", "value": "NR" }, { "label": "Nepal", "value": "NP" }, { "label": "Netherlands", "value": "NL", taxPercent: 21 }, { "label": "Netherlands Antilles", "value": "AN" }, { "label": "New Caledonia", "value": "NC" }, { "label": "New Zealand", "value": "NZ" }, { "label": "Nicaragua", "value": "NI" }, { "label": "Niger", "value": "NE" }, { "label": "Nigeria", "value": "NG" }, { "label": "Niue", "value": "NU" }, { "label": "Norfolk Island", "value": "NF" }, { "label": "Northern Mariana Islands", "value": "MP" }, { "label": "Norway", "value": "NO", taxPercent: 25 }, { "label": "Oman", "value": "OM" }, { "label": "Pakistan", "value": "PK" }, { "label": "Palau", "value": "PW" }, { "label": "Palestinian Territory, Occupied", "value": "PS" }, { "label": "Panama", "value": "PA" }, { "label": "Papua New Guinea", "value": "PG" }, { "label": "Paraguay", "value": "PY" }, { "label": "Peru", "value": "PE" }, { "label": "Philippines", "value": "PH" }, { "label": "Pitcairn", "value": "PN" }, { "label": "Poland", "value": "PL", taxPercent: 23 }, { "label": "Portugal", "value": "PT" }, { "label": "Puerto Rico", "value": "PR" }, { "label": "Qatar", "value": "QA" }, { "label": "Reunion", "value": "RE" }, { "label": "Romania", "value": "RO", taxPercent: 20 }, { "label": "Russian Federation", "value": "RU" }, { "label": "RWANDA", "value": "RW" }, { "label": "Saint Helena", "value": "SH" }, { "label": "Saint Kitts and Nevis", "value": "KN" }, { "label": "Saint Lucia", "value": "LC" }, { "label": "Saint Pierre and Miquelon", "value": "PM" }, { "label": "Saint Vincent and the Grenadines", "value": "VC" }, { "label": "Samoa", "value": "WS" }, { "label": "San Marino", "value": "SM" }, { "label": "Sao Tome and Principe", "value": "ST" }, { "label": "Saudi Arabia", "value": "SA" }, { "label": "Senegal", "value": "SN" }, { "label": "Serbia", "value": "RS", taxPercent: 20 }, { "label": "Seychelles", "value": "SC" }, { "label": "Sierra Leone", "value": "SL" }, { "label": "Singapore", "value": "SG" }, { "label": "Slovakia", "value": "SK" }, { "label": "Slovenia", "value": "SI", taxPercent: 22 }, { "label": "Solomon Islands", "value": "SB" }, { "label": "Somalia", "value": "SO" }, { "label": "South Africa", "value": "ZA" }, { "label": "South Georgia and the South Sandwich Islands", "value": "GS" }, { "label": "Spain", "value": "ES", taxPercent: 21 }, { "label": "Sri Lanka", "value": "LK" }, { "label": "Sudan", "value": "SD" }, { "label": "Surilabel", "value": "SR" }, { "label": "Svalbard and Jan Mayen", "value": "SJ" }, { "label": "Swaziland", "value": "SZ" }, { "label": "Sweden", "value": "SE", taxPercent: 25 }, { "label": "Switzerland", "value": "CH", taxPercent: 8 }, { "label": "Syrian Arab Republic", "value": "SY" }, { "label": "Taiwan, Province of China", "value": "TW" }, { "label": "Tajikistan", "value": "TJ" }, { "label": "Tanzania, United Republic of", "value": "TZ" }, { "label": "Thailand", "value": "TH" }, { "label": "Timor-Leste", "value": "TL" }, { "label": "Togo", "value": "TG" }, { "label": "Tokelau", "value": "TK" }, { "label": "Tonga", "value": "TO" }, { "label": "Trinidad and Tobago", "value": "TT" }, { "label": "Tunisia", "value": "TN" }, { "label": "Turkey", "value": "TR" }, { "label": "Turkmenistan", "value": "TM" }, { "label": "Turks and Caicos Islands", "value": "TC" }, { "label": "Tuvalu", "value": "TV" }, { "label": "Uganda", "value": "UG" }, { "label": "Ukraine", "value": "UA", taxPercent: 20 }, { "label": "United Arab Emirates", "value": "AE" }, { "label": "United Kingdom", "value": "GB", taxPercent: 20 }, { "label": "United States", "value": "US" }, { "label": "United States Minor Outlying Islands", "value": "UM" }, { "label": "Uruguay", "value": "UY" }, { "label": "Uzbekistan", "value": "UZ" }, { "label": "Vanuatu", "value": "VU" }, { "label": "Venezuela", "value": "VE" }, { "label": "Viet Nam", "value": "VN" }, { "label": "Virgin Islands, British", "value": "VG" }, { "label": "Virgin Islands, U.S.", "value": "VI" }, { "label": "Wallis and Futuna", "value": "WF" }, { "label": "Western Sahara", "value": "EH" }, { "label": "Yemen", "value": "YE" }, { "label": "Zambia", "value": "ZM" }, { "label": "Zimbabwe", "value": "ZW" }]; - -},{}],69:[function(require,module,exports){ -'use strict'; - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _ajax = require('./ajax'); - -var _ajax2 = _interopRequireDefault(_ajax); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _reactDom = require('react-dom'); - -var _reactDom2 = _interopRequireDefault(_reactDom); - -var _router = require('./router'); - -var _router2 = _interopRequireDefault(_router); - -var _store = require('./store'); - -var _store2 = _interopRequireDefault(_store); - -var _Visit = require('./models/Visit'); - -var _Visit2 = _interopRequireDefault(_Visit); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -if (localStorage.getItem('authtoken')) { - _store2.default.session.set('authtoken', localStorage.authtoken); - _store2.default.session.retrieve(); -} else { - _store2.default.session.set('authtoken', _store2.default.settings.anomToken); - _store2.default.session.retrieve(); -} - -_store2.default.plans.fetch({ - success: function success(r) {}, - error: function error(e) { - console.error('error: ', e); - } -}); - -_reactDom2.default.render(_router2.default, document.getElementById('container')); - -// const imgMap = { -// 'gif': 'image/gif', -// 'png': 'image/png', -// 'jpg': 'image/jpeg', -// 'jpeg': 'image/jpeg' -// } -// -// let file; -// let fileId; -// function doItAll(e){ -// e.preventDefault() -// file = e.target.files[0]; -// // console.log(this.refs.fileInput); -// postToKinveyFile() -// .then(putToGoogle) -// // .then(putToKinveyUser) -// .then(putToKinveyCollection) -// // .then(getPicFromKinvey) -// // .then(putToKinveyCollection) -// .then(getFromKinveyCollection) -// .then(putItOnThePage) -// } -// -// // Need to include public and mimetype with our data. Others are optional but preffered. -// function postToKinveyFile() { -// return $.ajax({ -// url: `https://baas.kinvey.com/blob/kid_rJRC6m9F`, -// type: 'POST', -// headers: { -// Authorization: `Kinvey ${store.session.get('authtoken')}`, -// "X-Kinvey-Content-Type": file.type -// }, -// data: JSON.stringify({ -// _public: true, -// mimeType: file.type -// }), -// contentType: 'application/json', -// }) -// } -// -// function putToGoogle(kinveyFile) { -// fileId = kinveyFile._id; -// return $.ajax({ -// url: kinveyFile._uploadURL, -// type: 'PUT', -// headers: kinveyFile._requiredHeaders, -// contentLength: file.size, -// data: file, -// processData: false, -// contentType: false -// }) -// } -// -// // function putToKinveyUser() { -// // return $.ajax({ -// // url: `https://baas.kinvey.com/user/kid_rJRC6m9F/${store.session.get('userId')}`, -// // type: 'PUT', -// // data: JSON.stringify({ -// // profilePic: fileId, -// // }), -// // contentType: 'application/json' -// // }) -// // } -// -// function putToKinveyCollection() { -// return $.ajax({ -// url: `https://baas.kinvey.com/appdata/kid_rJRC6m9F/articles/${articleID}`, -// type: 'PUT', -// data: JSON.stringify({ -// image: { -// _type: 'KinveyFile', -// _id: fileId -// }, -// }), -// contentType: 'application/json' -// }) -// } -// -// function getFromKinveyCollection() { -// return $.ajax({ -// url: `https://baas.kinvey.com/appdata/kid_rJRC6m9F/articles/${articleID}`, -// }) -// } -// -// // function getPicFromKinvey() { -// // return $.ajax({ -// // url: `https://baas.kinvey.com/blob/kid_rJRC6m9F/${fileId}`, -// // }) -// // } -// -// function putItOnThePage(imgResponse) { -// console.log(imgResponse._downloadURL); -// } -// -// -// -// let Fileuploader = ( -//
-//

File uploader

-//
-// -// -//
-//
-// ) -// -// -// ReactDOM.render(Fileuploader, document.getElementById('container')) - -},{"./ajax":2,"./models/Visit":76,"./router":77,"./store":78,"jquery":299,"react":538,"react-dom":306}],70:[function(require,module,exports){ -'use strict'; - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _amcharts = require('amcharts3'); - -var _amcharts2 = _interopRequireDefault(_amcharts); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// (function () { -function getType(x) { - // TODO make this faster ? - return {}.toString.call(x); -} -// import AmCharts from './amcharts/amcharts' - - -function copyObject(x) { - var output = {}; - - // TODO use Object.keys ? - for (var key in x) { - output[key] = copy(x[key]); - } - - return output; -} - -function copyArray(x) { - var length = x.length; - - var output = new Array(length); - - for (var i = 0; i < length; ++i) { - output[i] = copy(x[i]); - } - - return output; -} - -// TODO can this be made faster ? -// TODO what about regexps, etc. ? -function copy(x) { - switch (getType(x)) { - case "[object Array]": - return copyArray(x); - - case "[object Object]": - return copyObject(x); - - // TODO is this necessary ? - case "[object Date]": - return new Date(x.getTime()); - - default: - return x; - } -} - -function isEqualArray(x, y) { - var xLength = x.length; - var yLength = y.length; - - if (xLength === yLength) { - for (var i = 0; i < xLength; ++i) { - if (!isEqual(x[i], y[i])) { - return false; - } - } - - return true; - } else { - return false; - } -} - -function isEqualObject(x, y) { - // TODO use Object.keys ? - for (var key in x) { - if (key in y) { - if (!isEqual(x[key], y[key])) { - return false; - } - } else { - return false; - } - } - - // TODO use Object.keys ? - for (var key in y) { - if (!(key in x)) { - return false; - } - } - - return true; -} - -function isEqual(x, y) { - var xType = getType(x); - var yType = getType(y); - - if (xType === yType) { - switch (xType) { - case "[object Array]": - return isEqualArray(x, y); - - case "[object Object]": - return isEqualObject(x, y); - - case "[object Date]": - return x.getTime() === y.getTime(); - - default: - return x === y; - } - } else { - return false; - } -} - -// TODO make this faster ? -// TODO does this work for listeners, etc. ? -function updateChartObject(chart, oldObj, newObj) { - var didUpdate = false; - - // TODO use Object.keys ? - for (var key in newObj) { - // TODO make this faster ? - if (!(key in oldObj) || !isEqual(oldObj[key], newObj[key])) { - // TODO make this faster ? - chart[key] = copy(newObj[key]); - didUpdate = true; - } - } - - // TODO use Object.keys ? - for (var key in oldObj) { - if (!(key in newObj)) { - delete chart[key]; - didUpdate = true; - } - } - - return didUpdate; -} - -var id = 0; - -AmCharts.React = _react2.default.createClass({ - displayName: 'React', - - // export default React.createClass({ - getInitialState: function getInitialState() { - return { - id: "__AmCharts_React_" + ++id + "__", - chart: null - }; - }, - - componentDidMount: function componentDidMount() { - // AmCharts mutates the config object, so we have to make a deep copy to prevent that - var props = copy(this.props); - - this.setState({ - chart: AmCharts.makeChart(this.state.id, props) - }); - }, - - // TODO is this correct ? should this use componentWillUpdate instead ? - componentDidUpdate: function componentDidUpdate(oldProps) { - var didUpdate = updateChartObject(this.state.chart, oldProps, this.props); - - if (didUpdate) { - // TODO is this correct ? - this.state.chart.validateNow(true, false); - } - }, - - componentWillUnmount: function componentWillUnmount() { - this.state.chart.clear(); - }, - - render: function render() { - return _react2.default.DOM.div({ - id: this.state.id, - style: { - width: "100%", - height: "100%" - } - }); - } -}); - -// })(); - -},{"amcharts3":79,"react":538}],71:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _backbone = require('backbone'); - -var _backbone2 = _interopRequireDefault(_backbone); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Article = _backbone2.default.Model.extend({ - urlRoot: 'https://baas.kinvey.com/appdata/kid_rJRC6m9F/articles', - idAttribute: '_id', - defaults: { - content: {} - } -}); - -exports.default = Article; - -},{"backbone":80}],72:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _backbone = require('backbone'); - -var _backbone2 = _interopRequireDefault(_backbone); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Market = _backbone2.default.Model.extend({ - defaults: { - annualData: [], - portfolioData: [], - cagr: 10.47 - }, - getAnnualData: function getAnnualData() { - var _this = this; - - _jquery2.default.ajax('https://www.quandl.com/api/v1/datasets/YAHOO/INDEX_GSPC.json?trim_start=1970-01-01&collapse=monthly&column=4&auth_token=6SfHcXos6YBX51kuAq8B').then(function (r) { - - var fixedData = r.data.map(function (point) { - return point[1].toFixed(0); - }); - fixedData = fixedData.reverse(); - - var percent = null; - for (var e = 0; e < fixedData.length; e++) { - if (e < 1) { - percent = 25000 * 100 / fixedData[0] / 100; - } - fixedData[e] = Math.floor(percent * fixedData[e]); - } - - _this.set('annualData', fixedData); - }).fail(function (e) { - console.error('Failed fetching QUANDL DATA', e); - }); - }, - getPortfolioData: function getPortfolioData() { - var _this2 = this; - - _jquery2.default.ajax('https://www.quandl.com/api/v1/datasets/YAHOO/INDEX_GSPC.json?trim_start=2009-01-01&collapse=monthly&column=4&auth_token=6SfHcXos6YBX51kuAq8B').then(function (r) { - var fixedData = r.data.map(function (point) { - return point[1].toFixed(0); - }); - fixedData = fixedData.reverse(); - _this2.set('portfolioData', fixedData); - }).fail(function (e) { - console.error('Failed fetching QUANDL DATA', e); - }); - } -}); - -exports.default = Market; - -},{"backbone":80,"jquery":299}],73:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _backbone = require('backbone'); - -var _backbone2 = _interopRequireDefault(_backbone); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Newsletter = _backbone2.default.Model.extend({ - urlRoot: 'https://baas.kinvey.com/appdata/kid_rJRC6m9F/newsletter', - defaults: { - email: '' - } -}); - -exports.default = Newsletter; - -},{"backbone":80}],74:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _underscore = require('underscore'); - -var _underscore2 = _interopRequireDefault(_underscore); - -var _backbone = require('backbone'); - -var _backbone2 = _interopRequireDefault(_backbone); - -var _store = require('../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Plan = _backbone2.default.Model.extend({ - urlRoot: 'https://baas.kinvey.com/appdata/kid_rJRC6m9F/api', - defaults: { - name: '', - info: { - roundtripTradesPerYear: 0, - IITFormulas: 0 - }, - stats: { - CAGR: 0, - WLRatio: 0 - }, - annualData: [], - suggestions: [], - portfolio: [], - portfolioYields: [] - }, - updateData: function updateData(fileArr) { - var _this = this; - - var receivedJSON = function receivedJSON(i, e) { - var lines = e.target.result; - var data = JSON.parse(lines); - if (fileArr[i].name.indexOf('weekly') > -1) { - var newSuggestions = _this.get('suggestions').filter(function (sug) { - if (sug.action === "SELL") { - return true; - } - }).map(function (sug) { - delete sug.data; - return sug; - }); - - newSuggestions = _underscore2.default.union(data.actionable, newSuggestions); - - newSuggestions = newSuggestions.map(function (suggestion) { - var fixedSuggestion = suggestion; - delete fixedSuggestion.data; - return fixedSuggestion; - }); - - newSuggestions.forEach(function (sug) { - if (sug.data) { - console.error('has data: ', sug); - } - }); - - _this.set('suggestions', newSuggestions); - } else if (fileArr[i].name.indexOf('monthly') > -1) { - var _newSuggestions = _this.get('suggestions').filter(function (sug) { - if (sug.action === "BUY") { - return true; - } - }).map(function (sug) { - var fixedSug = _underscore2.default.omit(sug, 'data'); - return fixedSug; - }); - - _newSuggestions = _underscore2.default.union(_newSuggestions, data.actionable); - _newSuggestions = _newSuggestions.map(function (sug) { - var fixedSug = _underscore2.default.omit(sug, 'data'); - return fixedSug; - }); - - var fixedPortfolio = data.portfolio.map(function (stock) { - var fixedStock = _underscore2.default.omit(stock, 'data'); - return fixedStock; - }); - - _newSuggestions.forEach(function (sug) { - if (sug.data) { - console.error('has data: ', sug); - _store2.default.session.set('notification', { - text: 'WARNING! uploading unnecessary data, please refresh this page and try again', - type: 'error' - }); - } - }); - fixedPortfolio.forEach(function (stock) { - if (stock.data) { - console.error('has data: ', stock); - _store2.default.session.set('notification', { - text: 'WARNING! uploading unnecessary data, please refresh this page and try again', - type: 'error' - }); - } - }); - - _this.set('suggestions', _newSuggestions); - _this.set('portfolio', fixedPortfolio); - _this.set('portfolioYields', data.logs); - } else if (fileArr[i].name.indexOf('annual') > -1) { - _this.set('annualData', data.logs); - var newStats = data.statistics; - newStats.WLRatio = 100 - data.statistics.negatives / (data.statistics.positives + data.statistics.negatives) * 100; - var oldStats = _this.get('stats'); - var stats = _underscore2.default.extend({}, oldStats, newStats); - _this.set('stats', stats); - } - console.log('saving file...'); - _this.save(null, { - success: function success(m, r) { - _store2.default.session.set('notification', { - text: 'Succesfully saved file: ' + fileArr[i].name, - type: 'success' - }); - }, - error: function error(model, _error) { - _store2.default.session.set('notification', { - text: 'Failed saved file: ' + fileArr[i].name + ' Err: ' + (_error.error || _error.responseText), - type: 'error' - }); - console.error('Failed saving file: ', _error); - } - }); - }; - - fileArr.forEach(function (file, i) { - var fr = new FileReader(); - fr.onload = receivedJSON.bind(null, i); - fr.readAsText(file); - }); - }, - parseStockData: function parseStockData(data) { - return data.filter(function (point) { - if (point[1] !== null && point[2] !== null && point[3] !== null) { - return true; - } - }); - }, - getStockInfo: function getStockInfo(ticker, i, portfolioStock) { - var _this2 = this; - - var hasCanceled_ = false; - var promise = new Promise(function (resolve, reject) { - - ticker = ticker.replace('.', '_'); - var query = 'https://www.quandl.com/api/v1/datasets/WIKI/' + ticker + '.json?api_key=' + _store2.default.settings.quandlKey; - _jquery2.default.ajax({ - url: query - }).then(function (response) { - if (!portfolioStock) { - var suggestionToUpdate = _this2.get('suggestions')[i]; - suggestionToUpdate.data = _this2.parseStockData(response.data); - - var newArr = _this2.get('suggestions').slice(0, i).concat(suggestionToUpdate, _this2.get('suggestions').slice(i + 1)); - _this2.set('suggestions', newArr); - _this2.trigger('change'); - - hasCanceled_ ? reject({ isCancelled: true }) : resolve(); - } else { - var portfolioToUpdate = _this2.get('portfolio')[i]; - portfolioToUpdate.data = _this2.parseStockData(response.data); - var _newArr = _this2.get('portfolio').slice(0, i).concat(portfolioToUpdate, _this2.get('portfolio').slice(i + 1)); - _this2.set('portfolio', _newArr); - _this2.trigger('change'); - - hasCanceled_ ? reject({ isCancelled: true }) : resolve(response); - } - }).fail(function (e) { - query = 'https://www.quandl.com/api/v1/datasets/GOOG/NASDAQ_' + ticker + '.json?api_key=' + _store2.default.settings.quandlKey; - _jquery2.default.ajax(query).then(function (response) { - if (!portfolioStock) { - var suggestionToUpdate = _this2.get('suggestions')[i]; - suggestionToUpdate.data = _this2.parseStockData(response.data); - - var newArr = _this2.get('suggestions').slice(0, i).concat(suggestionToUpdate, _this2.get('suggestions').slice(i + 1)); - _this2.set('suggestions', newArr); - _this2.trigger('change'); - - hasCanceled_ ? reject({ isCancelled: true }) : resolve(); - } else { - var portfolioToUpdate = _this2.get('portfolio')[i]; - portfolioToUpdate.data = _this2.parseStockData(response.data); - var _newArr2 = _this2.get('portfolio').slice(0, i).concat(portfolioToUpdate, _this2.get('portfolio').slice(i + 1)); - _this2.set('portfolio', _newArr2); - _this2.trigger('change'); - - hasCanceled_ ? reject({ isCancelled: true }) : resolve(response); - } - }).fail(function (error) { - query = 'https://www.quandl.com/api/v1/datasets/GOOG/NYSE_' + ticker + '.json?api_key=' + _store2.default.settings.quandlKey; - _jquery2.default.ajax(query).then(function (response) { - if (!portfolioStock) { - var suggestionToUpdate = _this2.get('suggestions')[i]; - suggestionToUpdate.data = _this2.parseStockData(response.data); - - var newArr = _this2.get('suggestions').slice(0, i).concat(suggestionToUpdate, _this2.get('suggestions').slice(i + 1)); - _this2.set('suggestions', newArr); - _this2.trigger('change'); - - hasCanceled_ ? reject({ isCancelled: true }) : resolve(response); - } else { - var portfolioToUpdate = _this2.get('portfolio')[i]; - portfolioToUpdate.data = _this2.parseStockData(response.data); - var _newArr3 = _this2.get('portfolio').slice(0, i).concat(portfolioToUpdate, _this2.get('portfolio').slice(i + 1)); - _this2.set('portfolio', _newArr3); - _this2.trigger('change'); - - hasCanceled_ ? reject({ isCancelled: true }) : resolve(response); - } - }).fail(function () { - query = 'https://www.quandl.com/api/v1/datasets/GOOG/AMEX_' + ticker + '.json?api_key=' + _store2.default.settings.quandlKey; - _jquery2.default.ajax(query).then(function (response) { - if (!portfolioStock) { - var suggestionToUpdate = _this2.get('suggestions')[i]; - suggestionToUpdate.data = _this2.parseStockData(response.data); - - var newArr = _this2.get('suggestions').slice(0, i).concat(suggestionToUpdate, _this2.get('suggestions').slice(i + 1)); - _this2.set('suggestions', newArr); - _this2.trigger('change'); - - hasCanceled_ ? reject({ isCancelled: true }) : resolve(response); - } else { - var portfolioToUpdate = _this2.get('portfolio')[i]; - portfolioToUpdate.data = _this2.parseStockData(response.data); - var _newArr4 = _this2.get('portfolio').slice(0, i).concat(portfolioToUpdate, _this2.get('portfolio').slice(i + 1)); - _this2.set('portfolio', _newArr4); - _this2.trigger('change'); - - hasCanceled_ ? reject({ isCancelled: true }) : resolve(response); - } - }).fail(function () { - query = 'https://www.quandl.com/api/v1/datasets/YAHOO/TSX_' + ticker + '.json?api_key=' + _store2.default.settings.quandlKey; - _jquery2.default.ajax(query).then(function (response) { - if (!portfolioStock) { - var suggestionToUpdate = _this2.get('suggestions')[i]; - suggestionToUpdate.data = _this2.parseStockData(response.data); - - var newArr = _this2.get('suggestions').slice(0, i).concat(suggestionToUpdate, _this2.get('suggestions').slice(i + 1)); - _this2.set('suggestions', newArr); - _this2.trigger('change'); - - hasCanceled_ ? reject({ isCancelled: true }) : resolve(response); - } else { - var portfolioToUpdate = _this2.get('portfolio')[i]; - portfolioToUpdate.data = _this2.parseStockData(response.data); - var _newArr5 = _this2.get('portfolio').slice(0, i).concat(portfolioToUpdate, _this2.get('portfolio').slice(i + 1)); - _this2.set('portfolio', _newArr5); - _this2.trigger('change'); - - hasCanceled_ ? reject({ isCancelled: true }) : resolve(response); - } - }).fail(function () { - // console.log('no data for: ', ticker); - hasCanceled_ ? reject({ isCancelled: true }) : reject('no data for: ', ticker); - }); - }); - }); - }); - }); - }); - - return { - promise: promise, - cancel: function cancel() { - hasCanceled_ = true; - } - }; - } -}); - -exports.default = Plan; - -},{"../store":78,"backbone":80,"jquery":299,"underscore":553}],75:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _backbone = require('backbone'); - -var _backbone2 = _interopRequireDefault(_backbone); - -var _reactRouter = require('react-router'); - -var _store = require('../store'); - -var _store2 = _interopRequireDefault(_store); - -var _Visit = require('./Visit'); - -var _Visit2 = _interopRequireDefault(_Visit); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Session = _backbone2.default.Model.extend({ - urlRoot: 'https://baas.kinvey.com/user/kid_rJRC6m9F/login', - idAttribute: '_id', - defaults: { - email: '', - name: '', - stripe: {}, - location: {}, - type: 0 - }, - parse: function parse(response) { - if (response) { - return { - authtoken: response._kmd.authtoken, - email: response.username, - userId: response._id, - name: response.name, - stripe: response.stripe, - type: response.type - }; - } - }, - login: function login(username, password) { - var _this = this; - - return new Promise(function (resolve, reject) { - _this.save({ username: username, password: password }, { - success: function success(model, response) { - // console.log(response._kmd.authtoken); - localStorage.authtoken = response._kmd.authtoken; - _this.unset('password'); - _this.set('showModal', false); - resolve(); - _store2.default.settings.history.push('/dashboard'); - }, - error: function error(model, response) { - console.log('ERROR: Login failed: ', response.responseText); - if (response.responseText.indexOf('IncompleteRequestBody') !== -1) { - if (username === '') { - reject('Email missing'); - } else { - reject('Password missing'); - } - } else if (response.responseText.indexOf('InvalidCredentials') !== -1) { - reject('Wrong email or password'); - } - } - }); - }); - }, - signup: function signup(email, password) { - _store2.default.session.save({ - username: email, - password: password - }, { - url: 'https://baas.kinvey.com/user/' + _store2.default.settings.appKey + '/', - success: function success(model, response) { - model.unset('password'); - localStorage.authtoken = response._kmd.authtoken; - _store2.default.settings.history.push('/dashboard'); - }, - error: function error(model, response) { - console.log('ERROR: ', arguments); - } - }); - }, - logout: function logout() { - _jquery2.default.ajax({ - type: 'POST', - url: 'https://baas.kinvey.com/user/' + _store2.default.settings.appKey + '/_logout' - }); - localStorage.removeItem('authtoken'); - this.clear(); - _store2.default.settings.history.push('/'); - this.set('authtoken', _store2.default.settings.anomToken); - this.set('location', {}); - this.set('type', 0); - this.set('email', ''); - this.set('stripe', {}); - }, - retrieve: function retrieve() { - var _this2 = this; - - this.fetch({ - url: 'https://baas.kinvey.com/user/' + _store2.default.settings.appKey + '/_me', - success: function success() { - var visit = new _Visit2.default(); - visit.getData(_this2.get('type')); - }, - error: function error(response) { - throw new Error('FETCHING USER FAILED!'); - } - }); - }, - updateUser: function updateUser() { - this.save(null, { - type: 'PUT', - url: 'https://baas.kinvey.com/user/' + _store2.default.settings.appKey + '/' + this.get('userId') - }, { silent: true }); - }, - validateNewUser: function validateNewUser(user) { - var _this3 = this; - - return new Promise(function (resolve, reject) { - if (!_this3.validateName(user.name)) { - reject('Please enter your first and last name'); - } else if (!_this3.validateEmail(user.email)) { - reject('Please enter a valid email address'); - } else if (_this3.validatePasswords(user.password, user.verifyPassword) === 'no pass') { - reject('Please enter a password'); - } else if (_this3.validatePasswords(user.password, user.verifyPassword) === 'not long enough') { - reject('Password must be at least 6 characters long'); - } else if (_this3.validatePasswords(user.password, user.verifyPassword) === 'no match') { - reject('Passwords doesn\'t match'); - } else { - _this3.checkForDuplicates(user.email).then(function (response) { - if (response.length === 0) { - resolve(); - } else { - reject('A user with this email already exists'); - } - }).fail(function () { - reject('Couldn\'t connect to server'); - }); - } - }); - }, - validateName: function validateName(name) { - if (name.length === 0 || name.indexOf(' ') === -1) { - return false; - } else { - return true; - } - }, - validateEmail: function validateEmail(email) { - var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; - return re.test(email); - }, - checkForDuplicates: function checkForDuplicates(email) { - return _jquery2.default.ajax('https://baas.kinvey.com/user/kid_rJRC6m9F/?query={"email":"' + email + '"}'); - }, - validatePasswords: function validatePasswords(pass, verifyPass) { - if (pass.length === 0) { - return 'no pass'; - } else if (pass.length <= 5) { - return 'not long enough'; - } else if (pass !== verifyPass) { - return 'no match'; - } else { - return true; - } - }, - isAllowedToView: function isAllowedToView(plan) { - var type = 5; - if (plan === 'basic') { - type = 1; - } else if (plan === 'premium') { - type = 2; - } else if (plan === 'business') { - type = 3; - } else if (plan === 'fund') { - type = 4; - } - - if (this.get('type') === 4 && type !== 4) { - return false; - } else if (this.get('type') >= type) { - return true; - } else { - return false; - } - }, - browserType: function browserType() { - if (!!window.opr && !!opr.addons || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) { - return 'Opera'; - } else if (typeof InstallTrigger !== 'undefined') { - return 'Firefox'; - } else if (Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0) { - return 'Safari'; - } else if ( /*@cc_on!@*/false || !!document.documentMode) { - return 'IE'; - } else if (!!window.StyleMedia) { - return 'Edge'; - } else if (!!window.chrome && !!window.chrome.webstore) { - return 'Chrome'; - } else if (!!window.CSS) { - return 'Blink'; - } else { - return 'Other'; - } - } -}); - -exports.default = Session; - -},{"../store":78,"./Visit":76,"backbone":80,"jquery":299,"react-router":361}],76:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _backbone = require('backbone'); - -var _backbone2 = _interopRequireDefault(_backbone); - -var _jquery = require('jquery'); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _store = require('../store'); - -var _store2 = _interopRequireDefault(_store); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var Visit = _backbone2.default.Model.extend({ - url: 'https://baas.kinvey.com/appdata/kid_rJRC6m9F/visits', - defaults: { - device: '', - location: {}, - browser: '', - type: -1 - }, - getData: function getData(type) { - var _this = this; - - _jquery2.default.ajax('https://freegeoip.net/json/').then(function (r) { - _this.set('location', r); - _this.set('browser', _store2.default.session.browserType()); - _this.set('type', type || -1); - _store2.default.session.set('location', r); - if (!localStorage.getItem('visitorID')) { - _this.save(null, { - url: 'https://baas.kinvey.com/appdata/kid_rJRC6m9F/visits', - type: 'POST', - success: function success(r) { - // console.log('response: ', r); - localStorage.visitorID = r.get('_id'); - }, - error: function error(e) { - console.error('failed posting visit: ', e); - } - }); - } else { - _this.set('_id', localStorage.visitorID); - _this.save(null, { - url: 'https://baas.kinvey.com/appdata/kid_rJRC6m9F/visits/' + localStorage.visitorID, - type: 'PUT', - success: function success(r) { - // console.log('updated visit: ', r); - }, - error: function error(e) { - console.error('failed putting visit: ', e); - } - }); - // console.log('already visited'); - } - }); - } -}); - -exports.default = Visit; - -},{"../store":78,"backbone":80,"jquery":299}],77:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _reactRouter = require('react-router'); - -var _store = require('./store'); - -var _store2 = _interopRequireDefault(_store); - -var _Home = require('./components/home/Home'); - -var _Home2 = _interopRequireDefault(_Home); - -var _Login = require('./components/home/Login'); - -var _Login2 = _interopRequireDefault(_Login); - -var _Signup = require('./components/home/Signup'); - -var _Signup2 = _interopRequireDefault(_Signup); - -var _Dashboard = require('./components/dashboard/Dashboard'); - -var _Dashboard2 = _interopRequireDefault(_Dashboard); - -var _Portfolio = require('./components/dashboard/Portfolio'); - -var _Portfolio2 = _interopRequireDefault(_Portfolio); - -var _Suggestions = require('./components/dashboard/Suggestions'); - -var _Suggestions2 = _interopRequireDefault(_Suggestions); - -var _Articles = require('./components/dashboard/Articles'); - -var _Articles2 = _interopRequireDefault(_Articles); - -var _MyAccount = require('./components/dashboard/MyAccount'); - -var _MyAccount2 = _interopRequireDefault(_MyAccount); - -var _AdminPanel = require('./components/dashboard/AdminPanel'); - -var _AdminPanel2 = _interopRequireDefault(_AdminPanel); - -var _AdminAPI = require('./components/dashboard/AdminAPI'); - -var _AdminAPI2 = _interopRequireDefault(_AdminAPI); - -var _NewArticle = require('./components/dashboard/NewArticle'); - -var _NewArticle2 = _interopRequireDefault(_NewArticle); - -var _ = require('./components/404'); - -var _2 = _interopRequireDefault(_); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var router = _react2.default.createElement( - _reactRouter.Router, - { history: _store2.default.settings.history }, - _react2.default.createElement( - _reactRouter.Route, - { path: '/', component: _Home2.default }, - _react2.default.createElement(_reactRouter.Route, { path: '/login', component: _Login2.default }), - _react2.default.createElement(_reactRouter.Route, { path: '/signup', component: _Signup2.default }) - ), - _react2.default.createElement( - _reactRouter.Route, - { path: '/dashboard', component: _Dashboard2.default }, - _react2.default.createElement(_reactRouter.IndexRoute, { component: _Portfolio2.default }), - _react2.default.createElement( - _reactRouter.Route, - { path: 'portfolio', component: _Portfolio2.default }, - _react2.default.createElement(_reactRouter.IndexRoute, { component: _Portfolio2.default }), - _react2.default.createElement(_reactRouter.Route, { path: ':plan', component: _Portfolio2.default }) - ), - _react2.default.createElement( - _reactRouter.Route, - { path: 'suggestions', component: _Suggestions2.default }, - _react2.default.createElement(_reactRouter.IndexRoute, { component: _Suggestions2.default }), - _react2.default.createElement(_reactRouter.Route, { path: ':plan', component: _Suggestions2.default }) - ), - _react2.default.createElement( - _reactRouter.Route, - { path: 'articles', component: _Articles2.default }, - _react2.default.createElement(_reactRouter.IndexRoute, { component: _Articles2.default }), - _react2.default.createElement(_reactRouter.Route, { path: ':article', component: _Articles2.default }) - ), - _react2.default.createElement(_reactRouter.Route, { path: 'account', component: _MyAccount2.default }), - _react2.default.createElement(_reactRouter.Route, { path: 'admin', component: _AdminPanel2.default }), - _react2.default.createElement(_reactRouter.Route, { path: 'admin/api', component: _AdminAPI2.default }), - _react2.default.createElement(_reactRouter.Route, { path: 'admin/newarticle', component: _NewArticle2.default }) - ), - _react2.default.createElement(_reactRouter.Route, { path: '/*', component: _2.default }) -); -// import Article from './components/dashboard/Article' -exports.default = router; - -},{"./components/404":8,"./components/dashboard/AdminAPI":10,"./components/dashboard/AdminPanel":11,"./components/dashboard/Articles":14,"./components/dashboard/Dashboard":17,"./components/dashboard/MyAccount":18,"./components/dashboard/NewArticle":20,"./components/dashboard/Portfolio":22,"./components/dashboard/Suggestions":36,"./components/home/Home":47,"./components/home/Login":48,"./components/home/Signup":59,"./store":78,"react":538,"react-router":361}],78:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _Session = require('./models/Session'); - -var _Session2 = _interopRequireDefault(_Session); - -var _reactRouter = require('react-router'); - -var _Plan = require('./models/Plan'); - -var _Plan2 = _interopRequireDefault(_Plan); - -var _Plans = require('./collections/Plans'); - -var _Plans2 = _interopRequireDefault(_Plans); - -var _Market = require('./models/Market'); - -var _Market2 = _interopRequireDefault(_Market); - -var _Articles = require('./collections/Articles'); - -var _Articles2 = _interopRequireDefault(_Articles); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var store = { - session: new _Session2.default(), - settings: { - anomToken: '8c66d956-de91-4cf8-83ab-fe8545866571.h9Ps7jZMlx+3WjjInLAfr9+MGz1aE2GN6OlUly6F6z4=', - history: _reactRouter.browserHistory, - quandlKey: 'zP2W-4snDLyygfZVpw2v', - appKey: 'kid_rJRC6m9F', - appSecret: 'e6688b599fca47e1bf150d99a786132d', - basicAuth: btoa('kid_rJRC6m9F:e6688b599fca47e1bf150d99a786132d') - }, - plans: new _Plans2.default(), - market: { - data: new _Market2.default(), - cagr: 10.71 - }, - articles: { - fetching: false, - data: new _Articles2.default() - } -}; - -store.plans.add({ - id: 'basic', - name: 'basic', - price: 50, - type: 1, - info: { - roundtripTradesPerYear: 39, - IITFormulas: 3, - avgGainPerPosition: 65.97, - avgLossPerPosition: 18.32, - maxDrawdown45y: 50.07, - maxDrawdown36m: 36.04, - IRRArithmeticMean: 52.61, - IRRGeometricMean: 27.18, - sortinoRatio: 2.4812, - gainToPainRatio: 1.1493 - } -}); -store.plans.add({ - id: 'premium', - name: 'premium', - price: 100, - type: 2, - info: { - roundtripTradesPerYear: 44, - IITFormulas: 8, - avgGainPerPosition: 77.49, - avgLossPerPosition: 17.03, - maxDrawdown45y: 52.33, - maxDrawdown36m: 21.51, - IRRArithmeticMean: 68.60, - IRRGeometricMean: 35.14, - sortinoRatio: 4.3393, - gainToPainRatio: 1.502 - } -}); -store.plans.add({ - id: 'business', - name: 'business', - price: 20000, - type: 3, - info: { - roundtripTradesPerYear: 20, - IITFormulas: 44, - avgGainPerPosition: 102.37, - avgLossPerPosition: 16.47, - maxDrawdown45y: 40.88, - maxDrawdown36m: 7.03, - IRRArithmeticMean: 108.01, - IRRGeometricMean: 48.66, - sortinoRatio: 6.728, - gainToPainRatio: 2.886 - } -}); -store.plans.add({ - id: 'fund', - name: 'fund', - price: 120000, - type: 4, - info: { - roundtripTradesPerYear: 63, - IITFormulas: 87, - avgGainPerPosition: 66.097, - avgLossPerPosition: 16.85, - maxDrawdown45y: 45.00, - maxDrawdown36m: 22.976, - IRRArithmeticMean: 67.96, - IRRGeometricMean: 33.27, - sortinoRatio: 4.4814, - gainToPainRatio: 1.9302 - } -}); - -exports.default = store; - -},{"./collections/Articles":4,"./collections/Plans":6,"./models/Market":72,"./models/Plan":74,"./models/Session":75,"react-router":361}],79:[function(require,module,exports){ -(function(){var d;window.AmCharts?d=window.AmCharts:(d={},window.AmCharts=d,d.themes={},d.maps={},d.inheriting={},d.charts=[],d.onReadyArray=[],d.useUTC=!1,d.updateRate=60,d.uid=0,d.lang={},d.translations={},d.mapTranslations={},d.windows={},d.initHandlers=[],d.amString="am",d.pmString="pm");d.Class=function(a){var b=function(){arguments[0]!==d.inheriting&&(this.events={},this.construct.apply(this,arguments))};a.inherits?(b.prototype=new a.inherits(d.inheriting),b.base=a.inherits.prototype,delete a.inherits): -(b.prototype.createEvents=function(){for(var a=0;ad.IEversion&&0b)return a;h=-1;for(a=(k=a.split(/\r\n|\n|\r/)).length;++hb;k[h]+=d.trim(g.slice(0,f))+((g=g.slice(f)).length?c:""))f=2==e||(f=g.slice(0,b+1).match(/\S*(\s)?$/))[1]?b:f.input.length-f[0].length||1==e&&b||f.input.length+(f=g.slice(b).match(/^\S*/))[0].length;g=d.trim(g)}return k.join(c)};d.trim=function(a){return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};d.wrappedText=function(a,b,c,e,h,f,g,k){var l=d.text(a,b,c,e,h,f,g);if(l){var m=l.getBBox();if(m.width>k){var n="\n";d.isModern||(n="
");k=Math.floor(k/(m.width/ -b.length));2c&&(a=c);return a};d.isDefined=function(a){return void 0===a?!1:!0};d.stripNumbers=function(a){return a.replace(/[0-9]+/g,"")};d.roundTo=function(a,b){if(0>b)return a;var c=Math.pow(10,b);return Math.round(a*c)/c};d.toFixed=function(a,b){var c=String(Math.round(a*Math.pow(10,b)));if(0=g[b].contains){var l=a-Math.floor(a/g[b].contains)*g[b].contains;"ss"==b?(l=d.formatNumber(l,f),1==l.split(k)[0].length&&(l="0"+l)):l=d.roundTo(l,f.precision);("mm"==b||"hh"==b)&&10>l&&(l="0"+l);c=l+""+e[b]+""+c;a=Math.floor(a/g[b].contains);b=g[b].nextInterval;return d.formatDuration(a,b,c,e,h,f)}"ss"==b&&(a=d.formatNumber(a, -f),1==a.split(k)[0].length&&(a="0"+a));("mm"==b||"hh"==b)&&10>a&&(a="0"+a);c=a+""+e[b]+""+c;if(g[h].count>g[b].count)for(a=g[b].count;aa?"-":"";a=Math.abs(a);var k=String(a),l=!1;-1!= -k.indexOf("e")&&(l=!0);0<=c&&!l&&(k=d.toFixed(a,c));var m="";if(l)m=k;else{var k=k.split("."),l=String(k[0]),n;for(n=l.length;0<=n;n-=3)m=n!=l.length?0!==n?l.substring(n-3,n)+b+m:l.substring(n-3,n)+m:l.substring(n-3,n);void 0!==k[1]&&(m=m+f+k[1]);void 0!==c&&0=c.x-5&&a<=c.x+c.width+5&&b>=c.y-5&&b<=c.y+c.height+5?!0:!1};d.isPercents=function(a){if(-1!=String(a).indexOf("%"))return!0};d.formatValue=function(a,b,c,e,h,f,g,k){if(b){void 0=== -h&&(h="");var l;for(l=0;la&&(g="-");a=Math.abs(a);if(1=b[k].number&&(l=a/b[k].number,m=Number(e.precision),1>m&&(m=1),c=d.roundTo(l,m),m=d.formatNumber(c,{precision:-1,decimalSeparator:e.decimalSeparator,thousandsSeparator:e.thousandsSeparator}),!h||l==c)){f=g+""+m+""+b[k].prefix;break}}else for(k=0;k"==a&&(a="easeOutSine");"<"==a&&(a="easeInSine");"elastic"==a&&(a="easeOutElastic");return a};d.getObjById=function(a,b){var c,e;for(e=0;e"));return a};d.fixBrakes=function(a){if(d.isModern){var b=RegExp("
","g");a&&(a=a.replace(b,"\n"))}else a=d.fixNewLines(a);return a};d.deleteObject=function(a,b){if(a){if(void 0===b||null===b)b=20;if(0!==b)if("[object Array]"===Object.prototype.toString.call(a))for(var c=0;cb)return e/2*b*b+c;b--;return-e/2*(b*(b-2)-1)+c};d.easeInSine=function(a,b,c,e,d){return-e*Math.cos(b/d*(Math.PI/2))+e+c};d.easeOutSine=function(a,b,c,e,d){return e*Math.sin(b/d*(Math.PI/2))+c};d.easeOutElastic= -function(a,b,c,e,d){a=1.70158;var f=0,g=e;if(0===b)return c;if(1==(b/=d))return c+e;f||(f=.3*d);gb?Math.abs(b)-1:Math.abs(b);var d;for(d=0;db?Number("0."+c+String(a)):Number(String(a)+c)};d.setCN= -function(a,b,c,e){if(a.addClassNames&&b&&(b=b.node)&&c){var d=b.getAttribute("class");a=a.classNamePrefix+"-";e&&(a="");d?b.setAttribute("class",d+" "+a+c):b.setAttribute("class",a+c)}};d.removeCN=function(a,b,c){b&&(b=b.node)&&c&&(b=b.classList)&&b.remove(a.classNamePrefix+"-"+c)};d.parseDefs=function(a,b){for(var c in a){var e=typeof a[c];if(0a&&(a=3)):a=this.width/this.minHorizontalGap,this.gridCountR=Math.max(a,1)):this.gridCountR=this.gridCount;this.axisWidth=this.axisLine.axisWidth;this.addTitle()},setOrientation:function(a){this.orientation=a?"H":"V"},addTitle:function(){var a= -this.title;this.titleLabel=null;if(a){var b=this.chart,c=this.titleColor;void 0===c&&(c=b.color);var e=this.titleFontSize;isNaN(e)&&(e=b.fontSize+1);a=d.text(b.container,a,c,b.fontFamily,e,this.titleAlign,this.titleBold);d.setCN(b,a,this.bcn+"title");this.titleLabel=a}},positionTitle:function(){var a=this.titleLabel;if(a){var b,c,e=this.labelsSet,h={};0this.autoRotateCount&&!isNaN(this.autoRotateAngle)&&(this.labelRotationR=this.autoRotateAngle),a=k;a<=B;a++){p=q+z*(a+Math.floor((D-q)/z))-C;"DD"==A&&(p+=36E5);p=d.resetDateToMin(new Date(p),A,u,t).getTime();"MM"==A&&(h=(p-l)/z,1.5<=(p-l)/z&&(p=p-(h-1)*z+d.getPeriodDuration("DD", -3),p=d.resetDateToMin(new Date(p),A,1).getTime(),C+=z));h=(p-this.startTime)*this.stepWidth;if("radar"==b.type){if(h=this.axisWidth-h,0>h||h>this.axisWidth)continue}else this.rotate?"date"==this.type&&"middle"==this.gridPosition&&(J=-z*this.stepWidth/2):"date"==this.type&&(h=this.axisWidth-h);f=!1;this.nextPeriod[g]&&(f=this.checkPeriodChange(this.nextPeriod[g],1,p,l,g));l=!1;f&&this.markPeriodChange?(f=this.dateFormatsObject[this.nextPeriod[g]],this.twoLineMode&&(f=this.dateFormatsObject[g]+"\n"+ -f,f=d.fixBrakes(f)),l=!0):f=this.dateFormatsObject[g];r||(l=!1);this.currentDateFormat=f;f=d.formatDate(new Date(p),f,b);if(a==k&&!c||a==B&&!e)f=" ";this.labelFunction&&(f=this.labelFunction(f,new Date(p),this,A,u,m).toString());this.boldLabels&&(l=!0);m=new this.axisItemRenderer(this,h,f,!1,n,J,!1,l);this.pushAxisItem(m);m=l=p;if(!isNaN(v))for(h=1;hb||b>this.height)return;if(isNaN(b)){this.hideBalloon(); -return}b=this.adjustBalloonCoordinate(b,e);e=this.coordinateToValue(b)}else{if(0>a||a>this.width)return;if(isNaN(a)){this.hideBalloon();return}a=this.adjustBalloonCoordinate(a,e);e=this.coordinateToValue(a)}var f;if(d=this.chart.chartCursor)f=d.index;if(this.balloon&&void 0!==e&&this.balloon.enabled){if(this.balloonTextFunction){if("date"==this.type||!0===this.parseDates)e=new Date(e);e=this.balloonTextFunction(e)}else this.balloonText?e=this.formatBalloonText(this.balloonText,f,c):isNaN(e)||(e=this.formatValue(e, -c));if(a!=this.prevBX||b!=this.prevBY)this.balloon.setPosition(a,b),this.prevBX=a,this.prevBY=b,e&&this.balloon.showBalloon(e)}},adjustBalloonCoordinate:function(a){return a},createBalloon:function(){var a=this.chart,b=a.chartCursor;b&&(b=b.cursorPosition,"mouse"!=b&&(this.stickBalloonToCategory=!0),"start"==b&&(this.stickBalloonToStart=!0),"ValueAxis"==this.cname&&(this.stickBalloonToCategory=!1));this.balloon&&(this.balloon.destroy&&this.balloon.destroy(),d.extend(this.balloon,a.balloon,!0))},setBalloonBounds:function(){var a= -this.balloon;if(a){var b=this.chart;a.cornerRadius=0;a.shadowAlpha=0;a.borderThickness=1;a.borderAlpha=1;a.adjustBorderColor=!1;a.showBullet=!1;this.balloon=a;a.chart=b;a.mainSet=b.plotBalloonsSet;a.pointerWidth=this.tickLength;if(this.parseDates||"date"==this.type)a.pointerWidth=0;a.className=this.id;b="V";"V"==this.orientation&&(b="H");this.stickBalloonToCategory||(a.animationDuration=0);var c,e,d,f,g=this.inside,k=this.width,l=this.height;switch(this.position){case "bottom":c=0;e=k;g?(d=0,f=l): -(d=l,f=l+1E3);break;case "top":c=0;e=k;g?(d=0,f=l):(d=-1E3,f=0);break;case "left":d=0;f=l;g?(c=0,e=k):(c=-1E3,e=0);break;case "right":d=0,f=l,g?(c=0,e=k):(c=k,e=k+1E3)}a.drop||(a.pointerOrientation=b);a.setBounds(c,d,e,f)}}})})();(function(){var d=window.AmCharts;d.ValueAxis=d.Class({inherits:d.AxisBase,construct:function(a){this.cname="ValueAxis";this.createEvents("axisChanged","logarithmicAxisFailed","axisZoomed","axisIntZoomed");d.ValueAxis.base.construct.call(this,a);this.dataChanged=!0;this.stackType="none";this.position="left";this.unitPosition="right";this.includeAllValues=this.recalculateToPercents=this.includeHidden=this.includeGuidesInMinMax=this.integersOnly=!1;this.durationUnits={DD:"d. ",hh:":",mm:":",ss:""}; -this.scrollbar=!1;this.baseValue=0;this.radarCategoriesEnabled=!0;this.axisFrequency=1;this.gridType="polygons";this.useScientificNotation=!1;this.axisTitleOffset=10;this.pointPosition="axis";this.minMaxMultiplier=1;this.logGridLimit=2;this.totalTextOffset=this.treatZeroAs=0;this.minPeriod="ss";this.relativeStart=0;this.relativeEnd=1;d.applyTheme(this,a,this.cname)},updateData:function(){0>=this.gridCountR&&(this.gridCountR=1);this.totals=[];this.data=this.chart.chartData;var a=this.chart;"xy"!=a.type&& -(this.stackGraphs("smoothedLine"),this.stackGraphs("line"),this.stackGraphs("column"),this.stackGraphs("step"));this.recalculateToPercents&&this.recalculate();this.synchronizationMultiplier&&this.synchronizeWith?(d.isString(this.synchronizeWith)&&(this.synchronizeWith=a.getValueAxisById(this.synchronizeWith)),this.synchronizeWith&&(this.synchronizeWithAxis(this.synchronizeWith),this.foundGraphs=!0)):(this.foundGraphs=!1,this.getMinMax(),0===this.start&&this.end==this.data.length-1&&isNaN(this.minZoom)&& -isNaN(this.maxZoom)&&(this.fullMin=this.min,this.fullMax=this.max,"date"!=this.type&&(isNaN(this.minimum)||(this.fullMin=this.minimum),isNaN(this.maximum)||(this.fullMax=this.maximum)),this.logarithmic&&(this.fullMin=this.logMin,0===this.fullMin&&(this.fullMin=this.treatZeroAs)),"date"==this.type&&(this.minimumDate||(this.fullMin=this.minRR),this.maximumDate||(this.fullMax=this.maxRR))))},draw:function(){d.ValueAxis.base.draw.call(this);var a=this.chart,b=this.set;this.labelRotationR=this.labelRotation; -d.setCN(a,this.set,"value-axis value-axis-"+this.id);d.setCN(a,this.labelsSet,"value-axis value-axis-"+this.id);d.setCN(a,this.axisLine.axisSet,"value-axis value-axis-"+this.id);var c=this.type;"duration"==c&&(this.duration="ss");!0===this.dataChanged&&(this.updateData(),this.dataChanged=!1);"date"==c&&(this.logarithmic=!1,this.min=this.minRR,this.max=this.maxRR,this.reversed=!1,this.getDateMinMax());if(this.logarithmic){var e=this.treatZeroAs,h=this.getExtremes(0,this.data.length-1).min;!isNaN(this.minimum)&& -this.minimum=h||0>=this.minimum){this.fire({type:"logarithmicAxisFailed",chart:a});return}}this.grid0=null;var f,g,k=a.dx,l=a.dy,e=!1,h=this.logarithmic;if(isNaN(this.min)||isNaN(this.max)||!this.foundGraphs||Infinity==this.min||-Infinity==this.max)e=!0;else{"date"==this.type&&this.min==this.max&&(this.max+=this.minDuration(),this.min-=this.minDuration());var m= -this.labelFrequency,n=this.showFirstLabel,q=this.showLastLabel,p=1,t=0;this.minCalc=this.min;this.maxCalc=this.max;if(this.strictMinMax&&(isNaN(this.minimum)||(this.min=this.minimum),isNaN(this.maximum)||(this.max=this.maximum),this.min==this.max))return;isNaN(this.minZoom)||(this.minReal=this.min=this.minZoom);isNaN(this.maxZoom)||(this.max=this.maxZoom);if(this.logarithmic){g=Math.log(this.fullMax)*Math.LOG10E-Math.log(this.fullMin)*Math.LOG10E;var r=Math.log(this.max)/Math.LN10-Math.log(this.fullMin)* -Math.LOG10E;this.relativeStart=(Math.log(this.minReal)/Math.LN10-Math.log(this.fullMin)*Math.LOG10E)/g;this.relativeEnd=r/g}else this.relativeStart=d.fitToBounds((this.min-this.fullMin)/(this.fullMax-this.fullMin),0,1),this.relativeEnd=d.fitToBounds((this.max-this.fullMin)/(this.fullMax-this.fullMin),0,1);var r=Math.round((this.maxCalc-this.minCalc)/this.step)+1,v;!0===h?(v=Math.log(this.max)*Math.LOG10E-Math.log(this.minReal)*Math.LOG10E,this.stepWidth=this.axisWidth/v,v>this.logGridLimit&&(r=Math.ceil(Math.log(this.max)* -Math.LOG10E)+1,t=Math.round(Math.log(this.minReal)*Math.LOG10E),r>this.gridCountR&&(p=Math.ceil(r/this.gridCountR)))):this.stepWidth=this.axisWidth/(this.max-this.min);var y=0;1>this.step&&-1this.maxDecCount&&(y=this.maxDecCount);var x=this.precision;isNaN(x)||(y=x);isNaN(this.maxZoom)&&(this.max=d.roundTo(this.max,this.maxDecCount),this.min=d.roundTo(this.min,this.maxDecCount));g={};g.precision=y;g.decimalSeparator=a.nf.decimalSeparator; -g.thousandsSeparator=a.nf.thousandsSeparator;this.numberFormatter=g;var u;this.exponential=!1;for(g=t;g=this.autoRotateCount&&!isNaN(this.autoRotateAngle)&&(this.labelRotationR=this.autoRotateAngle),c=this.minCalc,h&&(r++,c=this.maxCalc-r*y),this.gridCountReal=r,g=this.startCount=t;gthis.logGridLimit)t=Math.pow(10,g);else if(0>=t&&(t=c+y*g+y/2,0>=t))continue; -u=this.formatValue(t,!1,g);Math.round(g/m)!=g/m&&(u=void 0);if(0===g&&!n||g==r-1&&!q)u=" ";f=this.getCoordinate(t);var B;this.rotate&&this.autoWrap&&(B=this.stepWidth*y-10);u=new this.axisItemRenderer(this,f,u,void 0,B,void 0,void 0,this.boldLabels);this.pushAxisItem(u);if(t==this.baseValue&&"radar"!=a.type){var D,C;u=this.width;var J=this.height;"H"==this.orientation?0<=f&&f<=u+1&&(D=[f,f,f+k],C=[J,0,l]):0<=f&&f<=J+1&&(D=[0,u,u+k],C=[f,f,f+l]);D&&(u=d.fitToBounds(2*this.gridAlpha,0,1),isNaN(this.zeroGridAlpha)|| -(u=this.zeroGridAlpha),u=d.line(a.container,D,C,this.gridColor,u,1,this.dashLength),u.translate(this.x,this.y),this.grid0=u,a.axesSet.push(u),u.toBack(),d.setCN(a,u,this.bcn+"zero-grid-"+this.id),d.setCN(a,u,this.bcn+"zero-grid"))}if(!isNaN(z)&&0this.logGridLimit&&(z=Math.pow(10,g+p)),u=9,z=(z-t)/u);f=this.gridAlpha;this.gridAlpha=this.minorGridAlpha;for(J=1;Jl&&0>k||(k=new this.guideFillRenderer(this, -l,k,C),this.pushAxisItem(k,z),z=k.graphics(),C.graphics=z,C.balloonText&&this.addEventListeners(z,C));this.fillAlpha=D}g=this.baseValue;this.min>this.baseValue&&this.max>this.baseValue&&(g=this.min);this.minc&&(f.precision=Math.abs(c)),b&&1b&&c.shift();for(var e=Math.floor(Math.log(Math.abs(a))*Math.LOG10E),d=0;da){if(g=Math.pow(10,-g)*f,g==Math.round(g))return f}else if(f== -Math.round(f))return f}},stackGraphs:function(a){var b=this.stackType;"stacked"==b&&(b="regular");"line"==b&&(b="none");"100% stacked"==b&&(b="100%");this.stackType=b;var c=[],e=[],h=[],f=[],g,k=this.chart.graphs,l,m,n,q,p,t=this.baseValue,r=!1;if("line"==a||"step"==a||"smoothedLine"==a)r=!0;if(r&&("regular"==b||"100%"==b))for(q=0;qg?(m.values.close=g,isNaN(e[p])?m.values.open=t:(m.values.close+=e[p],m.values.open=e[p]),e[p]=m.values.close):(m.values.close=g,isNaN(h[p])?m.values.open=t:(m.values.close+=h[p],m.values.open=h[p]),h[p]=m.values.close)))}}for(p= -this.start;p<=this.end;p++)for(q=0;qc?(m.values.close=d.fitToBounds(c+e[p],-100,100),m.values.open=e[p],e[p]=m.values.close):(m.values.close=d.fitToBounds(c+ -h[p],-100,100),m.values.open=h[p],h[p]=m.values.close)))))},recalculate:function(){var a=this.chart,b=a.graphs,c;for(c=0;cq&&g++}if(m=a.recalculateFromDate)m=d.getDate(m,a.dataDateFormat,"fff"),g=a.getClosestIndex(a.chartData,"time",m.getTime(),!0,0,a.chartData.length),k=a.chartData.length-1;for(m=g;m<=k&&(g=this.data[m].axes[this.id].graphs[e.id],f=g.values[h],e.recalculateValue&&(f=g.dataContext[e.valueField+e.recalculateValue]),isNaN(f));m++);this.recBaseValue=f;for(h=l;h<=k;h++){g=this.data[h].axes[this.id].graphs[e.id];g.percents={};var l= -g.values,p;for(p in l)g.percents[p]="percents"!=p?l[p]/f*100-100:l[p]}}}},getMinMax:function(){var a=!1,b=this.chart,c=b.graphs,e;for(e=0;ethis.max&&(this.max=c.toValue),c.value>this.max&&(this.max=c.value);isNaN(this.minimum)||(this.min=this.minimum);isNaN(this.maximum)||(this.max=this.maximum);"date"==this.type&&this.getDateMinMax(); -this.min>this.max&&(a=this.max,this.max=this.min,this.min=a);isNaN(this.minZoom)||(this.min=this.minZoom);isNaN(this.maxZoom)||(this.max=this.maxZoom);this.minCalc=this.min;this.maxCalc=this.max;this.minReal=this.min;this.maxReal=this.max;0===this.min&&0===this.max&&(this.max=9);this.min>this.max&&(this.min=this.max-1);a=this.min;b=this.max;c=this.max-this.min;e=0===c?Math.pow(10,Math.floor(Math.log(Math.abs(this.max))*Math.LOG10E))/10:Math.pow(10,Math.floor(Math.log(Math.abs(c))*Math.LOG10E))/10; -isNaN(this.maximum)&&(this.max=Math.ceil(this.max/e)*e+e);isNaN(this.minimum)&&(this.min=Math.floor(this.min/e)*e-e);0>this.min&&0<=a&&(this.min=0);0=b&&(this.max=0);"100%"==this.stackType&&(this.min=0>this.min?-100:0,this.max=0>this.max?0:100);c=this.max-this.min;e=Math.pow(10,Math.floor(Math.log(Math.abs(c))*Math.LOG10E))/10;this.step=Math.ceil(c/this.gridCountR/e)*e;c=Math.pow(10,Math.floor(Math.log(Math.abs(this.step))*Math.LOG10E));c=d.fixStepE(c);e=Math.ceil(this.step/c);5=e&&2c?(this.maxDecCount=Math.abs(Math.log(Math.abs(c))*Math.LOG10E),this.maxDecCount=Math.round(this.maxDecCount),this.step=d.roundTo(this.step,this.maxDecCount+1)):this.maxDecCount=0;this.min=this.step*Math.floor(this.min/this.step);this.max=this.step*Math.ceil(this.max/this.step);0>this.min&&0<=a&&(this.min=0);0=b&&(this.max=0);1e&&(e=l);else for(var m in k)k.hasOwnProperty(m)&&"percents"!=m&&"total"!=m&&"error"!=m&&(l=k[m],le&&(e=l))}}}return{min:c,max:e}},zoomOut:function(a){this.maxZoom=this.minZoom=NaN;this.zoomToRelativeValues(0,1,a)},zoomToRelativeValues:function(a,b,c){if(this.reversed){var e=a;a=1-b;b=1-e}var d=this.fullMax,e=this.fullMin,f=e+(d-e)*a,g=e+(d-e)*b;this.logarithmic&&(d=Math.log(d)*Math.LOG10E-Math.log(e)*Math.LOG10E,f=Math.pow(10, -d*a+Math.log(e)*Math.LOG10E),g=Math.pow(10,d*b+Math.log(e)*Math.LOG10E));return this.zoomToValues(f,g,c)},zoomToValues:function(a,b,c){if(bn?(w=X+ia*Math.sin(T)-B-3+2,G+=-ia*Math.cos(T)-Pa*Math.sin(T)-4):w-=B+r+3+3,w-=aa):(0n?(w=X+B+3-ia/2*Math.sin(T)+2,G+=ia/2*Math.cos(T)):w+=B+u+3+3,w+=aa)):(w+=ma+r/2-ea,G+=va,I?(0Aa+2||0>r))ca.remove(),ca=null}else{0<=b&&b<=X+1&&(0X+1||wc&&"object"==typeof n&&(n=n.join(",").split(",").reverse());"V"==g?(g=d.rect(l,a.width,c,n,m),g.translate(h,b-k+f)):(g=d.rect(l, -c,a.height,n,m),g.translate(b-k+h,f));d.setCN(a.chart,g,"guide-fill");e.id&&d.setCN(a.chart,g,"guide-fill-"+e.id);this.set=l.set([g])},graphics:function(){return this.set},getLabel:function(){}})})();(function(){var d=window.AmCharts;d.AmChart=d.Class({construct:function(a){this.svgIcons=this.tapToActivate=!0;this.theme=a;this.classNamePrefix="amcharts";this.addClassNames=!1;this.version="3.20.12";d.addChart(this);this.createEvents("buildStarted","dataUpdated","init","rendered","drawn","failed","resized","animationFinished");this.height=this.width="100%";this.dataChanged=!0;this.chartCreated=!1;this.previousWidth=this.previousHeight=0;this.backgroundColor="#FFFFFF";this.borderAlpha=this.backgroundAlpha= -0;this.color=this.borderColor="#000000";this.fontFamily="Verdana";this.fontSize=11;this.usePrefixes=!1;this.autoResize=!0;this.autoDisplay=!1;this.addCodeCredits=this.accessible=!0;this.touchStartTime=this.touchClickDuration=0;this.precision=-1;this.percentPrecision=2;this.decimalSeparator=".";this.thousandsSeparator=",";this.labels=[];this.allLabels=[];this.titles=[];this.marginRight=this.marginLeft=this.autoMarginOffset=0;this.timeOuts=[];this.creditsPosition="top-left";var b=document.createElement("div"), -c=b.style;c.overflow="hidden";c.position="relative";c.textAlign="left";this.chartDiv=b;b=document.createElement("div");c=b.style;c.overflow="hidden";c.position="relative";c.textAlign="left";this.legendDiv=b;this.titleHeight=0;this.hideBalloonTime=150;this.handDrawScatter=2;this.cssScale=this.handDrawThickness=1;this.cssAngle=0;this.prefixesOfBigNumbers=[{number:1E3,prefix:"k"},{number:1E6,prefix:"M"},{number:1E9,prefix:"G"},{number:1E12,prefix:"T"},{number:1E15,prefix:"P"},{number:1E18,prefix:"E"}, -{number:1E21,prefix:"Z"},{number:1E24,prefix:"Y"}];this.prefixesOfSmallNumbers=[{number:1E-24,prefix:"y"},{number:1E-21,prefix:"z"},{number:1E-18,prefix:"a"},{number:1E-15,prefix:"f"},{number:1E-12,prefix:"p"},{number:1E-9,prefix:"n"},{number:1E-6,prefix:"\u03bc"},{number:.001,prefix:"m"}];this.panEventsEnabled=!0;this.product="amcharts";this.animations=[];this.balloon=new d.AmBalloon(this.theme);this.balloon.chart=this;this.processTimeout=0;this.processCount=1E3;this.animatable=[];d.applyTheme(this, -a,"AmChart")},drawChart:function(){0a||isNaN(a))a=0;this.chartDiv.style.height=a+"px"}}return a},updateWidth:function(){var a=this.divRealWidth,b=this.divRealHeight,c=this.legend;if(c){var e=this.legendDiv,d=e.offsetWidth; -isNaN(c.width)||(d=c.width);c.ieW&&(d=c.ieW);var f=e.offsetHeight,e=e.style,g=this.chartDiv.style,c=c.position;if("right"==c||"left"==c){a-=d;if(0>a||isNaN(a))a=0;g.width=a+"px";this.balloon.setBounds(2,2,a-2,this.realHeight);"left"==c?(g.left=d+"px",e.left="0px"):(g.left="0px",e.left=a+"px");b>f&&(e.top=(b-f)/2+"px")}}return a},getTitleHeight:function(){this.drawTitles(!0);return this.titleHeight},addTitle:function(a,b,c,e,d){isNaN(b)&&(b=this.fontSize+2);a={text:a,size:b,color:c,alpha:e,bold:d, -enabled:!0};this.titles.push(a);return a},handleWheel:function(a){var b=0;a||(a=window.event);a.wheelDelta?b=a.wheelDelta/120:a.detail&&(b=-a.detail/3);b&&this.handleWheelReal(b,a.shiftKey);a.preventDefault&&a.preventDefault()},handleWheelReal:function(){},handleDocTouchStart:function(){this.hideBalloonReal();this.handleMouseMove();this.tmx=this.mouseX;this.tmy=this.mouseY;this.touchStartTime=(new Date).getTime()},handleDocTouchEnd:function(){-.5Math.abs(this.mouseX-this.tmx)&&4>Math.abs(this.mouseY-this.tmy)?(this.tapped=!0,this.panRequired&&this.panEventsEnabled&&this.chartDiv&&(this.chartDiv.style.msTouchAction="none",this.chartDiv.style.touchAction="none")):this.mouseIsOver||this.resetTouchStyle()):(this.tapped=!1,this.resetTouchStyle())},resetTouchStyle:function(){this.panEventsEnabled&&this.chartDiv&&(this.chartDiv.style.msTouchAction="auto",this.chartDiv.style.touchAction="auto")}, -checkTouchDuration:function(a){var b=this,c=(new Date).getTime();if(a)if(a.touches)b.isTouchEvent=!0;else if(!b.isTouchEvent)return!0;if(c-b.touchStartTime>b.touchClickDuration)return!0;setTimeout(function(){b.resetTouchDuration()},300)},resetTouchDuration:function(){this.isTouchEvent=!1},checkTouchMoved:function(){if(4a.valueAxis.minMaxMultiplier&&a.positiveClip(a.set));break;case "radar":a.createRadarGraph();break;case "xy":a.createXYGraph()}a.playedTO=setTimeout(function(){a.setAnimationPlayed.call(a)},500*a.chart.startDuration)}},setAnimationPlayed:function(){this.animationPlayed= -!0},createXYGraph:function(){var a=[],b=[],c=this.xAxis,e=this.yAxis;this.pmh=e.height;this.pmw=c.width;this.pmy=this.pmx=0;var d;for(d=this.start;d<=this.end;d++){var f=this.data[d].axes[c.id].graphs[this.id],g=f.values,k=g.x,l=g.y,g=c.getCoordinate(k,this.noRounding),m=e.getCoordinate(l,this.noRounding);if(!isNaN(k)&&!isNaN(l)&&(a.push(g),b.push(m),f.x=g,f.y=m,k=this.createBullet(f,g,m,d),l=this.labelText)){var l=this.createLabel(f,l),n=0;k&&(n=k.size);this.positionLabel(f,g,m,l,n)}}this.drawLineGraph(a, -b);this.launchAnimation()},createRadarGraph:function(){var a=this.valueAxis.stackType,b=[],c=[],e=[],d=[],f,g,k,l,m;for(m=this.start;m<=this.end;m++){var n=this.data[m].axes[this.valueAxis.id].graphs[this.id],q,p;"none"==a||"3d"==a?q=n.values.value:(q=n.values.close,p=n.values.open);if(isNaN(q))this.connect||(this.drawLineGraph(b,c,e,d),b=[],c=[],e=[],d=[]);else{var t=this.valueAxis.getCoordinate(q,this.noRounding)-this.height,t=t*this.valueAxis.rMultiplier,r=-360/(this.end-this.start+1)*m;"middle"== -this.valueAxis.pointPosition&&(r-=180/(this.end-this.start+1));q=t*Math.sin(r/180*Math.PI);t*=Math.cos(r/180*Math.PI);b.push(q);c.push(t);if(!isNaN(p)){var v=this.valueAxis.getCoordinate(p,this.noRounding)-this.height,v=v*this.valueAxis.rMultiplier,y=v*Math.sin(r/180*Math.PI),r=v*Math.cos(r/180*Math.PI);e.push(y);d.push(r);isNaN(k)&&(k=y);isNaN(l)&&(l=r)}r=this.createBullet(n,q,t,m);n.x=q;n.y=t;if(y=this.labelText)y=this.createLabel(n,y),v=0,r&&(v=r.size),this.positionLabel(n,q,t,y,v);isNaN(f)&&(f= -q);isNaN(g)&&(g=t)}}b.push(f);c.push(g);isNaN(k)||(e.push(k),d.push(l));this.drawLineGraph(b,c,e,d);this.launchAnimation()},positionLabel:function(a,b,c,e,d){if(e){var f=this.chart,g=this.valueAxis,k="middle",l=!1,m=this.labelPosition,n=e.getBBox(),q=this.chart.rotate,p=a.isNegative,t=this.fontSize;void 0===t&&(t=this.chart.fontSize);c-=n.height/2-t/2-1;void 0!==a.labelIsNegative&&(p=a.labelIsNegative);switch(m){case "right":m=q?p?"left":"right":"right";break;case "top":m=q?"top":p?"bottom":"top"; -break;case "bottom":m=q?"bottom":p?"top":"bottom";break;case "left":m=q?p?"right":"left":"left"}var t=a.columnGraphics,r=0,v=0;t&&(r=t.x,v=t.y);var y=this.labelOffset;switch(m){case "right":k="start";b+=d/2+y;break;case "top":c=g.reversed?c+(d/2+n.height/2+y):c-(d/2+n.height/2+y);break;case "bottom":c=g.reversed?c-(d/2+n.height/2+y):c+(d/2+n.height/2+y);break;case "left":k="end";b-=d/2+y;break;case "inside":"column"==this.type&&(l=!0,q?p?(k="end",b=r-3-y):(k="start",b=r+3+y):c=p?v+7+y:v-10-y);break; -case "middle":"column"==this.type&&(l=!0,q?b-=(b-r)/2+y-3:c-=(c-v)/2+y-3)}"auto"!=this.labelAnchor&&(k=this.labelAnchor);e.attr({"text-anchor":k});this.labelRotation&&e.rotate(this.labelRotation);e.translate(b,c);!this.showAllValueLabels&&t&&l&&(n=e.getBBox(),n.height>a.columnHeight||n.width>a.columnWidth)&&(e.remove(),e=null);if(e&&"radar"!=f.type)if(q){if(0>c||c>this.height)e.remove(),e=null;!this.showAllValueLabels&&(0>b||b>this.width)&&(e.remove(),e=null)}else{if(0>b||b>this.width)e.remove(), -e=null;!this.showAllValueLabels&&e&&(0>c||c>this.height)&&(e.remove(),e=null)}e&&this.allBullets.push(e);return e}},getGradRotation:function(){var a=270;"horizontal"==this.gradientOrientation&&(a=0);return this.gradientRotation=a},createSerialGraph:function(){this.dashLengthSwitched=this.fillColorsSwitched=this.lineColorSwitched=void 0;var a=this.chart,b=this.id,c=this.index,e=this.data,h=this.chart.container,f=this.valueAxis,g=this.type,k=this.columnWidthReal,l=this.showBulletsAt;isNaN(this.columnWidth)|| -(k=this.columnWidth);isNaN(k)&&(k=.8);var m=this.useNegativeColorIfDown,n=this.width,q=this.height,p=this.y,t=this.rotate,r=this.columnCount,v=d.toCoordinate(this.cornerRadiusTop,k/2),y=this.connect,x=[],u=[],A,z,B,D,C=this.chart.graphs.length,J,H=this.dx/this.tcc,S=this.dy/this.tcc,O=f.stackType,Q=this.start,ga=this.end,I=this.scrollbar,aa="graph-column-";I&&(aa="scrollbar-graph-column-");var va=this.categoryAxis,ma=this.baseCoord,Oa=this.negativeBase,Z=this.columnIndex,da=this.lineThickness,X=this.lineAlpha, -Aa=this.lineColorR,ea=this.dashLength,fa=this.set,Ba,ha=this.getGradRotation(),T=this.chart.columnSpacing,Y=va.cellWidth,Da=(Y*k-r)/r;T>Da&&(T=Da);var G,w,na,ia=q,Pa=n,ca=0,tb=0,ub,vb,gb,hb,wb=this.fillColorsR,Qa=this.negativeFillColors,Ja=this.negativeLineColor,Ya=this.fillAlphas,Za=this.negativeFillAlphas;"object"==typeof Ya&&(Ya=Ya[0]);"object"==typeof Za&&(Za=Za[0]);var xb=this.noRounding;"step"==g&&(xb=!1);var ib=f.getCoordinate(f.min);f.logarithmic&&(ib=f.getCoordinate(f.minReal));this.minCoord= -ib;this.resetBullet&&(this.bullet="none");if(!(I||"line"!=g&&"smoothedLine"!=g&&"step"!=g||(1==e.length&&"step"!=g&&"none"==this.bullet&&(this.bullet="round",this.resetBullet=!0),!Qa&&void 0==Ja||m))){var Ua=Oa;Ua>f.max&&(Ua=f.max);Uak&&(k=1);var Mb=this.fixedColumnWidth;isNaN(Mb)||(k=Mb);var L;if("line"==g||"step"==g||"smoothedLine"==g){if(0W?!0:!1);if(!I)switch(this.showBalloonAt){case "close":w.y=F;break;case "open":w.y=M;break;case "high":w.y=sa;break;case "low":w.y=qa}var ja=G.x[va.id],Wa=this.periodSpan-1;"step"!=g||isNaN(G.cellWidth)|| -(Y=G.cellWidth);var ya=Math.floor(Y/2)+Math.floor(Wa*Y/2),Ha=ya,nb=0;"left"==this.stepDirection&&(nb=(2*Y+Wa*Y)/2,ja-=nb);"center"==this.stepDirection&&(nb=Y/2,ja-=nb);"start"==this.pointPosition&&(ja-=Y/2+Math.floor(Wa*Y/2),ya=0,Ha=Math.floor(Y)+Math.floor(Wa*Y));"end"==this.pointPosition&&(ja+=Y/2+Math.floor(Wa*Y/2),ya=Math.floor(Y)+Math.floor(Wa*Y),Ha=0);if(Nb){var Cb=this.columnWidth;isNaN(Cb)||(ya*=Cb,Ha*=Cb)}I||(w.x=ja);-1E5>ja&&(ja=-1E5);ja>n+1E5&&(ja=n+1E5);t?(E=F,N=M,M=F=ja,isNaN(ta)&&!this.fillToGraph&& -(N=ma),pa=qa,ra=sa):(N=E=ja,isNaN(ta)&&!this.fillToGraph&&(M=ma));if(!Bb&&WTa?(Sa&&($a=!0),Sa=!1):(Sa||($a=!0),Sa=!0):w.isNegative=W=lb||Math.abs(F-kb)>=lb)x.push(E), -u.push(F),jb=E,kb=F;wa=E;Ea=F;ka=E;la=F;!Ra||isNaN(M)||isNaN(N)||(U.push(N),V.push(M));if($a||void 0!=w.lineColor&&w.lineColor!=this.lineColorSwitched||void 0!=w.fillColors&&w.fillColors!=this.fillColorsSwitched||!isNaN(w.dashLength))this.drawLineGraph(x,u,U,V),x=[E],u=[F],U=[],V=[],!Ra||isNaN(M)||isNaN(N)||(U.push(N),V.push(M)),m?Sa?(this.lineColorSwitched=Aa,this.fillColorsSwitched=wb):(this.lineColorSwitched=Ja,this.fillColorsSwitched=Qa):(this.lineColorSwitched=w.lineColor,this.fillColorsSwitched= -w.fillColors),this.dashLengthSwitched=w.dashLength;w.gap&&(this.drawLineGraph(x,u,U,V),x=[],u=[],U=[],V=[])}break;case "smoothedLine":if(isNaN(W))y||(this.drawSmoothedGraph(x,u,U,V),x=[],u=[],U=[],V=[]);else{if(Math.abs(E-jb)>=lb||Math.abs(F-kb)>=lb)x.push(E),u.push(F),jb=E,kb=F;wa=E;Ea=F;ka=E;la=F;!Ra||isNaN(M)||isNaN(N)||(U.push(N),V.push(M));void 0==w.lineColor&&void 0==w.fillColors&&isNaN(w.dashLength)||(this.drawSmoothedGraph(x,u,U,V),x=[E],u=[F],U=[],V=[],!Ra||isNaN(M)||isNaN(N)||(U.push(N), -V.push(M)),this.lineColorSwitched=w.lineColor,this.fillColorsSwitched=w.fillColors,this.dashLengthSwitched=w.dashLength);w.gap&&(this.drawSmoothedGraph(x,u,U,V),x=[],u=[],U=[],V=[])}break;case "step":if(!isNaN(W)){t?(isNaN(A)||(x.push(A),u.push(F-ya)),u.push(F-ya),x.push(E),u.push(F+Ha),x.push(E),!Ra||isNaN(M)||isNaN(N)||(isNaN(B)||(U.push(B),V.push(M-ya)),U.push(N),V.push(M-ya),U.push(N),V.push(M+Ha))):(isNaN(z)||(u.push(z),x.push(E-ya)),x.push(E-ya),u.push(F),x.push(E+Ha),u.push(F),!Ra||isNaN(M)|| -isNaN(N)||(isNaN(D)||(U.push(N-ya),V.push(D)),U.push(N-ya),V.push(M),U.push(N+Ha),V.push(M)));A=E;z=F;B=N;D=M;wa=E;Ea=F;ka=E;la=F;if($a||void 0!=w.lineColor||void 0!=w.fillColors||!isNaN(w.dashLength)&&L=this.periodSpan||1ya+Ha)A=z=NaN;this.drawLineGraph(x,u,U,V);x=[];u=[];U=[];V=[]}break;case "column":Ca=Ga;void 0!=w.lineColor&&(Ca=w.lineColor);if(!isNaN(W)){m||(w.isNegative=WRb&&ob>Rb)){var za;if(t){"3d"==O?(P=F-(r/2-this.depthCount+1)*(k+T)+T/2+S*Z,R=N+H*Z,za=Z):(P=Math.floor(F-(r/2-Z)*(k+T)+T/2),R=N,za=0);K=k;wa=E;Ea=P+k/2;ka=E;la=P+k/2;P+K>q+za*S&&(K=q-P+za*S);Pba?!0:!1;0===ba&&1/W===1/-0&&(w.labelIsNegative=!0);isNaN(G.percentWidthValue)||(K=this.height*G.percentWidthValue/100,P=ja-K/2,Ea=P+K/2);K=d.roundTo(K,2);ba=d.roundTo(ba, -2);Pn+za*H&&(K=n-R+za*H);Rq&&(K=q-P);0>P&&(K+=P,P=0);if(Pta?(Db=[E,ra],Eb=[N,pa]): -(Db=[N,ra],Eb=[E,pa]);!isNaN(ra)&&!isNaN(pa)&&Fn&&(K=n-R);0>R&&(K+=R,R=0);ba=F-M;if(R=ta&&(Va=0);var ua=new d.Cuboid(h,K,ba,H,S,Ma,Va,da,Ca,X,ha,v,t,ea,bb,mb,aa),Fb,Gb;W>ta?(Fb=[F,sa],Gb=[M,qa]):(Fb=[M,sa],Gb=[F,qa]);!isNaN(sa)&&!isNaN(qa)&&EW?E-ac/2-2-fb-sb:E+ac/2+3+fb+ -sb):(db=wa,eb=0>W?F+bc/2+fb+sb:F-bc/2-3-fb-sb);Na.translate(db,eb);f.totals[L]=Na;t?(0>eb||eb>q)&&Na.remove():(0>db||db>n)&&Na.remove()}}}}}}}this.lastDataItem=w;if("line"==g||"step"==g||"smoothedLine"==g)"smoothedLine"==g?this.drawSmoothedGraph(x,u,U,V):this.drawLineGraph(x,u,U,V),I||this.launchAnimation();this.bulletsHidden&&this.hideBullets();this.customBulletsHidden&&this.hideCustomBullets()},animateColumns:function(a,b){var c=this,e=c.chart.startDuration;0h.height&&(z=h.height),0>z&&(z=0));q=d.line(l,a,b,t,q,p,x,!1,!0,f);q.node.setAttribute("stroke-linejoin","round");d.setCN(k,q,h.bcn+"stroke");m.push(q);m.click(function(a){h.handleGraphEvent(a,"clickGraph")}).mouseover(function(a){h.handleGraphEvent(a, -"rollOverGraph")}).mouseout(function(a){h.handleGraphEvent(a,"rollOutGraph")}).touchmove(function(a){h.chart.handleMouseMove(a)}).touchend(function(a){h.chart.handleTouchEnd(a)});void 0===y||h.useNegativeColorIfDown||(p=d.line(l,a,b,y,r,p,x,!1,!0,f),p.node.setAttribute("stroke-linejoin","round"),d.setCN(k,p,h.bcn+"stroke"),d.setCN(k,p,h.bcn+"stroke-negative"),n.push(p));if(0a&&(a=this.fillAlphas),0===a&&(a=this.bulletAlpha),0===a&&(a=1));return a},createBullet:function(a,b,c){if(!isNaN(b)&&!isNaN(c)&&("none"!=this.bullet||this.customBullet||a.bullet||a.customBullet)){var e=this.chart,h=this.container,f=this.bulletOffset,g=this.bulletSize;isNaN(a.bulletSize)|| -(g=a.bulletSize);var k=a.values.value,l=this.maxValue,m=this.minValue,n=this.maxBulletSize,q=this.minBulletSize;isNaN(l)||(isNaN(k)||(g=(k-m)/(l-m)*(n-q)+q),m==l&&(g=n));l=g;this.bulletAxis&&(g=a.values.error,isNaN(g)||(k=g),g=this.bulletAxis.stepWidth*k);gb||b>this.width||c<-g/2||c>this.height)p.remove(),p=null;p&&(this.bulletSet.push(p),p.translate(b,c),this.addListeners(p,a),this.allBullets.push(p));a.bx=b;a.by=c;d.setCN(e,p,this.bcn+"bullet");a.className&&d.setCN(e,p,a.className,!0)}if(p){p.size=g||0;if(e=this.bulletHitAreaSize)h=d.circle(h,e,"#FFFFFF",.001,0),h.translate(b,c),a.hitBullet=h,this.bulletSet.push(h),this.addListeners(h,a);a.bulletGraphics=p;void 0!==this.tabIndex&& -p.setAttr("tabindex",this.tabIndex)}else p={size:0};p.graphDataItem=a;return p}},showBullets:function(){var a=this.allBullets,b;this.bulletsHidden=!1;for(b=0;ba+k||hq+l)?(g.showBalloon(m),g.hide(0)):(g.followCursor(c),g.showBalloon(m)))):(this.hideBalloonReal(),g.hide(),this.resizeBullet(a,e,h))}else this.hideBalloonReal()}},resizeBullet:function(a,b,c){this.fixBulletSize();if(a&&d.isModern&&(1!=b||!isNaN(c))){var e=a.bulletGraphics;e&&!e.doNotScale&&(e.translate(a.bx,a.by,b),isNaN(c)||(e.setAttr("fill-opacity",c),e.setAttr("stroke-opacity", -c)),this.resizedDItem=a)}}})})();(function(){var d=window.AmCharts;d.ChartCursor=d.Class({construct:function(a){this.cname="ChartCursor";this.createEvents("changed","zoomed","onHideCursor","onShowCursor","draw","selected","moved","panning","zoomStarted");this.enabled=!0;this.cursorAlpha=1;this.selectionAlpha=.2;this.cursorColor="#CC0000";this.categoryBalloonAlpha=1;this.color="#FFFFFF";this.type="cursor";this.zoomed=!1;this.zoomable=!0;this.pan=!1;this.categoryBalloonDateFormat="MMM DD, YYYY";this.categoryBalloonText="[[category]]"; -this.categoryBalloonEnabled=this.valueBalloonsEnabled=!0;this.rolledOver=!1;this.cursorPosition="middle";this.bulletsEnabled=this.skipZoomDispatch=!1;this.bulletSize=8;this.selectWithoutZooming=this.oneBalloonOnly=!1;this.graphBulletSize=1.7;this.animationDuration=.3;this.zooming=!1;this.adjustment=0;this.avoidBalloonOverlapping=!0;this.leaveCursor=!1;this.leaveAfterTouch=!0;this.valueZoomable=!1;this.balloonPointerOrientation="horizontal";this.hLineEnabled=this.vLineEnabled=!0;this.vZoomEnabled= -this.hZoomEnabled=!1;d.applyTheme(this,a,this.cname)},draw:function(){this.destroy();var a=this.chart;a.panRequired=!0;var b=a.container;this.rotate=a.rotate;this.container=b;this.prevLineHeight=this.prevLineWidth=NaN;b=b.set();b.translate(this.x,this.y);this.set=b;a.cursorSet.push(b);this.createElements();d.isString(this.limitToGraph)&&(this.limitToGraph=d.getObjById(a.graphs,this.limitToGraph),this.fullWidth=!1,this.cursorPosition="middle");this.pointer=this.balloonPointerOrientation.substr(0,1).toUpperCase(); -this.isHidden=!1;this.hideLines();this.valueLineAxis||(this.valueLineAxis=a.valueAxes[0])},createElements:function(){var a=this,b=a.chart,c=b.dx,e=b.dy,h=a.width,f=a.height,g,k,l=a.cursorAlpha,m=a.valueLineAlpha;a.rotate?(g=m,k=l):(k=m,g=l);"xy"==b.type&&(k=l,void 0!==m&&(k=m),g=l);a.vvLine=d.line(a.container,[c,0,0],[e,0,f],a.cursorColor,g,1);d.setCN(b,a.vvLine,"cursor-line");d.setCN(b,a.vvLine,"cursor-line-vertical");a.hhLine=d.line(a.container,[0,h,h+c],[0,0,e],a.cursorColor,k,1);d.setCN(b,a.hhLine, -"cursor-line");d.setCN(b,a.hhLine,"cursor-line-horizontal");a.vLine=a.rotate?a.vvLine:a.hhLine;a.set.push(a.vvLine);a.set.push(a.hhLine);a.set.node.style.pointerEvents="none";a.fullLines=a.container.set();b=b.cursorLineSet;b.push(a.fullLines);b.translate(a.x,a.y);b.clipRect(-1,-1,h+2,f+2);void 0!==a.tabIndex&&(b.setAttr("tabindex",a.tabIndex),b.keyup(function(b){a.handleKeys(b)}).focus(function(b){a.showCursor()}).blur(function(b){a.hideCursor()}));a.set.clipRect(0,0,h,f)},handleKeys:function(a){var b= -this.prevIndex,c=this.chart;if(c){var e=c.chartData;e&&(isNaN(b)&&(b=e.length-1),37!=a.keyCode&&40!=a.keyCode||b--,39!=a.keyCode&&38!=a.keyCode||b++,b=d.fitToBounds(b,c.startIndex,c.endIndex),(a=this.chart.chartData[b])&&this.setPosition(a.x.categoryAxis),this.prevIndex=b)}},update:function(){var a=this.chart;if(a){var b=a.mouseX-this.x,c=a.mouseY-this.y;this.mouseX=b;this.mouseY=c;this.mouse2X=a.mouse2X-this.x;this.mouse2Y=a.mouse2Y-this.y;var e;if(a.chartData&&0document.documentMode&&(this.updateOnReleaseOnly=!0);this.dragIconHeight=this.dragIconWidth=35;this.dragIcon="dragIconRoundBig"; -this.dragCursorHover="cursor: cursor: grab; cursor:-moz-grab; cursor:-webkit-grab;";this.dragCursorDown="cursor: cursor: grab; cursor:-moz-grabbing; cursor:-webkit-grabbing;";this.enabled=!0;this.percentStart=this.offset=0;this.percentEnd=1;d.applyTheme(this,a,"SimpleChartScrollbar")},getPercents:function(){var a=this.getDBox(),b=a.x,c=a.y,e=a.width,a=a.height;this.rotate?(b=1-c/this.height,c=1-(c+a)/this.height):(c=b/this.width,b=(b+e)/this.width);this.percentStart=c;this.percentEnd=b},draw:function(){var a= -this;a.destroy();if(a.enabled){var b=a.chart.container,c=a.rotate,e=a.chart;e.panRequired=!0;var h=b.set();a.set=h;e.scrollbarsSet.push(h);var f,g;c?(f=a.scrollbarHeight,g=e.plotAreaHeight):(g=a.scrollbarHeight,f=e.plotAreaWidth);a.width=f;if((a.height=g)&&f){var k=d.rect(b,f,g,a.backgroundColor,a.backgroundAlpha,1,a.backgroundColor,a.backgroundAlpha);d.setCN(e,k,"scrollbar-bg");a.bg=k;h.push(k);k=d.rect(b,f,g,"#000",.005);h.push(k);a.invisibleBg=k;k.click(function(){a.handleBgClick()}).mouseover(function(){a.handleMouseOver()}).mouseout(function(){a.handleMouseOut()}).touchend(function(){a.handleBgClick()}); -k=d.rect(b,f,g,a.selectedBackgroundColor,a.selectedBackgroundAlpha);d.setCN(e,k,"scrollbar-bg-selected");a.selectedBG=k;h.push(k);f=d.rect(b,f,g,"#000",.005);a.dragger=f;h.push(f);f.mousedown(function(b){a.handleDragStart(b)}).mouseup(function(){a.handleDragStop()}).mouseover(function(){a.handleDraggerOver()}).mouseout(function(){a.handleMouseOut()}).touchstart(function(b){a.handleDragStart(b)}).touchend(function(){a.handleDragStop()});g=e.pathToImages;var l,k=a.dragIcon.replace(/\.[a-z]*$/i,""); -d.isAbsolute(k)&&(g="");c?(l=g+k+"H"+e.extension,g=a.dragIconWidth,c=a.dragIconHeight):(l=g+k+e.extension,c=a.dragIconWidth,g=a.dragIconHeight);k=b.image(l,0,0,c,g);d.setCN(e,k,"scrollbar-grip-left");l=b.image(l,0,0,c,g);d.setCN(e,l,"scrollbar-grip-right");var m=10,n=20;e.panEventsEnabled&&(m=25,n=a.scrollbarHeight);var q=d.rect(b,m,n,"#000",.005),p=d.rect(b,m,n,"#000",.005);p.translate(-(m-c)/2,-(n-g)/2);q.translate(-(m-c)/2,-(n-g)/2);c=b.set([k,p]);b=b.set([l,q]);a.iconLeft=c;h.push(a.iconLeft); -a.iconRight=b;h.push(b);e.makeAccessible(c,a.accessibleLabel);e.makeAccessible(b,a.accessibleLabel);e.makeAccessible(f,a.accessibleLabel);c.setAttr("role","menuitem");b.setAttr("role","menuitem");f.setAttr("role","menuitem");void 0!==a.tabIndex&&(c.setAttr("tabindex",a.tabIndex),c.keyup(function(b){a.handleKeys(b,1,0)}));void 0!==a.tabIndex&&(f.setAttr("tabindex",a.tabIndex),f.keyup(function(b){a.handleKeys(b,1,1)}));void 0!==a.tabIndex&&(b.setAttr("tabindex",a.tabIndex),b.keyup(function(b){a.handleKeys(b, -0,1)}));c.mousedown(function(){a.leftDragStart()}).mouseup(function(){a.leftDragStop()}).mouseover(function(){a.iconRollOver()}).mouseout(function(){a.iconRollOut()}).touchstart(function(){a.leftDragStart()}).touchend(function(){a.leftDragStop()});b.mousedown(function(){a.rightDragStart()}).mouseup(function(){a.rightDragStop()}).mouseover(function(){a.iconRollOver()}).mouseout(function(){a.iconRollOut()}).touchstart(function(){a.rightDragStart()}).touchend(function(){a.rightDragStop()});d.ifArray(e.chartData)? -h.show():h.hide();a.hideDragIcons();a.clipDragger(!1)}h.translate(a.x,a.y);h.node.style.msTouchAction="none";h.node.style.touchAction="none"}},handleKeys:function(a,b,c){this.getPercents();var e=this.percentStart,d=this.percentEnd;if(this.rotate)var f=d,d=e,e=f;if(37==a.keyCode||40==a.keyCode)e-=.02*b,d-=.02*c;if(39==a.keyCode||38==a.keyCode)e+=.02*b,d+=.02*c;this.rotate&&(a=d,d=e,e=a);isNaN(d)||isNaN(e)||this.percentZoom(e,d,!0)},updateScrollbarSize:function(a,b){if(!isNaN(a)&&!isNaN(b)){a=Math.round(a); -b=Math.round(b);var c=this.dragger,e,d,f,g,k;this.rotate?(e=0,d=a,f=this.width+1,g=b-a,c.setAttr("height",b-a),c.setAttr("y",d)):(e=a,d=0,f=b-a,g=this.height+1,k=b-a,c.setAttr("x",e),c.setAttr("width",k));this.clipAndUpdate(e,d,f,g)}},update:function(){var a,b=!1,c,e,d=this.x,f=this.y,g=this.dragger,k=this.getDBox();if(k){c=k.x+d;e=k.y+f;var l=k.width,k=k.height,m=this.rotate,n=this.chart,q=this.width,p=this.height,t=n.mouseX,r=n.mouseY;a=this.initialMouse;this.forceClip&&this.clipDragger(!0);if(n.mouseIsOver){this.dragging&& -(n=this.initialCoord,m?(a=n+(r-a),0>a&&(a=0),n=p-k,a>n&&(a=n),g.setAttr("y",a)):(a=n+(t-a),0>a&&(a=0),n=q-l,a>n&&(a=n),g.setAttr("x",a)),this.clipDragger(!0));if(this.resizingRight){if(m)if(a=r-e,!isNaN(this.maxHeight)&&a>this.maxHeight&&(a=this.maxHeight),a+e>p+f&&(a=p-e+f),0>a)this.resizingRight=!1,b=this.resizingLeft=!0;else{if(0===a||isNaN(a))a=.1;g.setAttr("height",a)}else if(a=t-c,!isNaN(this.maxWidth)&&a>this.maxWidth&&(a=this.maxWidth),a+c>q+d&&(a=q-c+d),0>a)this.resizingRight=!1,b=this.resizingLeft= -!0;else{if(0===a||isNaN(a))a=.1;g.setAttr("width",a)}this.clipDragger(!0)}if(this.resizingLeft){if(m)if(c=e,e=r,ep+f&&(e=p+f),a=!0===b?c-e:k+c-e,!isNaN(this.maxHeight)&&a>this.maxHeight&&(a=this.maxHeight,e=c),0>a)this.resizingRight=!0,this.resizingLeft=!1,g.setAttr("y",c+k-f);else{if(0===a||isNaN(a))a=.1;g.setAttr("y",e-f);g.setAttr("height",a)}else if(e=t,eq+d&&(e=q+d),a=!0===b?c-e:l+c-e,!isNaN(this.maxWidth)&&a>this.maxWidth&&(a=this.maxWidth, -e=c),0>a)this.resizingRight=!0,this.resizingLeft=!1,g.setAttr("x",c+l-d);else{if(0===a||isNaN(a))a=.1;g.setAttr("x",e-d);g.setAttr("width",a)}this.clipDragger(!0)}}}},stopForceClip:function(){this.animating=this.forceClip=!1},clipDragger:function(a){var b=this.getDBox();if(b){var c=b.x,e=b.y,d=b.width,b=b.height,f=!1;if(this.rotate){if(c=0,d=this.width+1,this.clipY!=e||this.clipH!=b)f=!0}else if(e=0,b=this.height+1,this.clipX!=c||this.clipW!=d)f=!0;f&&(this.clipAndUpdate(c,e,d,b),a&&(this.updateOnReleaseOnly|| -this.dispatchScrollbarEvent()))}},maskGraphs:function(){},clipAndUpdate:function(a,b,c,e){this.clipX=a;this.clipY=b;this.clipW=c;this.clipH=e;this.selectedBG.setAttr("width",c);this.selectedBG.setAttr("height",e);this.selectedBG.translate(a,b);this.updateDragIconPositions();this.maskGraphs(a,b,c,e)},dispatchScrollbarEvent:function(){if(this.skipEvent)this.skipEvent=!1;else{var a=this.chart;a.hideBalloon();var b=this.getDBox(),c=b.x,e=b.y,d=b.width,b=b.height;this.getPercents();this.rotate?(c=e,d= -this.height/b):d=this.width/d;this.fire({type:"zoomed",position:c,chart:a,target:this,multiplier:d,relativeStart:this.percentStart,relativeEnd:this.percentEnd})}},updateDragIconPositions:function(){var a=this.getDBox(),b=a.x,c=a.y,e=this.iconLeft,d=this.iconRight,f,g,k=this.scrollbarHeight;this.rotate?(f=this.dragIconWidth,g=this.dragIconHeight,e.translate((k-g)/2,c-f/2),d.translate((k-g)/2,c+a.height-f/2)):(f=this.dragIconHeight,g=this.dragIconWidth,e.translate(b-g/2,(k-f)/2),d.translate(b-g/2+a.width, -(k-f)/2))},showDragIcons:function(){this.resizeEnabled&&(this.iconLeft.show(),this.iconRight.show())},hideDragIcons:function(){if(!this.resizingLeft&&!this.resizingRight&&!this.dragging){if(this.hideResizeGrips||!this.resizeEnabled)this.iconLeft.hide(),this.iconRight.hide();this.removeCursors()}},removeCursors:function(){this.chart.setMouseCursor("auto")},fireZoomEvent:function(a){this.fire({type:a,chart:this.chart,target:this})},percentZoom:function(a,b,c){a=d.fitToBounds(a,0,b);b=d.fitToBounds(b, -a,1);if(this.dragger&&this.enabled){this.dragger.stop();isNaN(a)&&(a=0);isNaN(b)&&(b=1);var e,h;this.rotate?(e=this.height,b=e-e*b,h=e-e*a):(e=this.width,h=e*b,b=e*a);this.updateScrollbarSize(b,h);this.clipDragger(!1);this.getPercents();c&&this.dispatchScrollbarEvent()}},destroy:function(){this.clear();d.remove(this.set);d.remove(this.iconRight);d.remove(this.iconLeft)},clear:function(){},handleDragStart:function(){if(this.enabled){this.fireZoomEvent("zoomStarted");var a=this.chart;this.dragger.stop(); -this.removeCursors();d.isModern&&this.dragger.node.setAttribute("style",this.dragCursorDown);this.dragging=!0;var b=this.getDBox();this.rotate?(this.initialCoord=b.y,this.initialMouse=a.mouseY):(this.initialCoord=b.x,this.initialMouse=a.mouseX)}},handleDragStop:function(){this.updateOnReleaseOnly&&(this.update(),this.skipEvent=!1,this.dispatchScrollbarEvent());this.dragging=!1;this.mouseIsOver&&this.removeCursors();d.isModern&&this.dragger.node.setAttribute("style",this.dragCursorHover);this.update(); -this.fireZoomEvent("zoomEnded")},handleDraggerOver:function(){this.handleMouseOver();d.isModern&&this.dragger.node.setAttribute("style",this.dragCursorHover)},leftDragStart:function(){this.fireZoomEvent("zoomStarted");this.dragger.stop();this.resizingLeft=!0},leftDragStop:function(){this.resizingLeft&&(this.resizingLeft=!1,this.mouseIsOver||this.removeCursors(),this.updateOnRelease(),this.fireZoomEvent("zoomEnded"))},rightDragStart:function(){this.fireZoomEvent("zoomStarted");this.dragger.stop(); -this.resizingRight=!0},rightDragStop:function(){this.resizingRight&&(this.resizingRight=!1,this.mouseIsOver||this.removeCursors(),this.updateOnRelease(),this.fireZoomEvent("zoomEnded"))},iconRollOut:function(){this.removeCursors()},iconRollOver:function(){this.rotate?this.chart.setMouseCursor("ns-resize"):this.chart.setMouseCursor("ew-resize");this.handleMouseOver()},getDBox:function(){if(this.dragger)return this.dragger.getBBox()},handleBgClick:function(){var a=this;if(!a.resizingRight&&!a.resizingLeft){a.zooming= -!0;var b,c,e=a.scrollDuration,h=a.dragger;b=a.getDBox();var f=b.height,g=b.width;c=a.chart;var k=a.y,l=a.x,m=a.rotate;m?(b="y",c=c.mouseY-f/2-k,c=d.fitToBounds(c,0,a.height-f)):(b="x",c=c.mouseX-g/2-l,c=d.fitToBounds(c,0,a.width-g));a.updateOnReleaseOnly?(a.skipEvent=!1,h.setAttr(b,c),a.dispatchScrollbarEvent(),a.clipDragger()):(a.animating=!0,c=Math.round(c),m?h.animate({y:c},e,">"):h.animate({x:c},e,">"),a.forceClip=!0,clearTimeout(a.forceTO),a.forceTO=setTimeout(function(){a.stopForceClip.call(a)}, -5E3*e))}},updateOnRelease:function(){this.updateOnReleaseOnly&&(this.update(),this.skipEvent=!1,this.dispatchScrollbarEvent())},handleReleaseOutside:function(){if(this.set){if(this.resizingLeft||this.resizingRight||this.dragging)this.dragging=this.resizingRight=this.resizingLeft=!1,this.updateOnRelease(),this.removeCursors();this.animating=this.mouseIsOver=!1;this.hideDragIcons();this.update()}},handleMouseOver:function(){this.mouseIsOver=!0;this.showDragIcons()},handleMouseOut:function(){this.mouseIsOver= -!1;this.hideDragIcons();this.removeCursors()}})})();(function(){var d=window.AmCharts;d.ChartScrollbar=d.Class({inherits:d.SimpleChartScrollbar,construct:function(a){this.cname="ChartScrollbar";d.ChartScrollbar.base.construct.call(this,a);this.graphLineColor="#BBBBBB";this.graphLineAlpha=0;this.graphFillColor="#BBBBBB";this.graphFillAlpha=1;this.selectedGraphLineColor="#888888";this.selectedGraphLineAlpha=0;this.selectedGraphFillColor="#888888";this.selectedGraphFillAlpha=1;this.gridCount=0;this.gridColor="#FFFFFF";this.gridAlpha=.7;this.skipEvent= -this.autoGridCount=!1;this.color="#FFFFFF";this.scrollbarCreated=!1;this.oppositeAxis=!0;this.accessibleLabel="Zoom chart using cursor arrows";d.applyTheme(this,a,this.cname)},init:function(){var a=this.categoryAxis,b=this.chart,c=this.gridAxis;a||("CategoryAxis"==this.gridAxis.cname?(this.catScrollbar=!0,a=new d.CategoryAxis,a.id="scrollbar"):(a=new d.ValueAxis,a.data=b.chartData,a.id=c.id,a.type=c.type,a.maximumDate=c.maximumDate,a.minimumDate=c.minimumDate,a.minPeriod=c.minPeriod),this.categoryAxis= -a);a.chart=b;var e=b.categoryAxis;e&&(a.firstDayOfWeek=e.firstDayOfWeek);a.dateFormats=c.dateFormats;a.markPeriodChange=c.markPeriodChange;a.boldPeriodBeginning=c.boldPeriodBeginning;a.labelFunction=c.labelFunction;a.axisItemRenderer=d.RecItem;a.axisRenderer=d.RecAxis;a.guideFillRenderer=d.RecFill;a.inside=!0;a.fontSize=this.fontSize;a.tickLength=0;a.axisAlpha=0;d.isString(this.graph)&&(this.graph=d.getObjById(b.graphs,this.graph));(a=this.graph)&&this.catScrollbar&&(c=this.valueAxis,c||(this.valueAxis= -c=new d.ValueAxis,c.visible=!1,c.scrollbar=!0,c.axisItemRenderer=d.RecItem,c.axisRenderer=d.RecAxis,c.guideFillRenderer=d.RecFill,c.labelsEnabled=!1,c.chart=b),b=this.unselectedGraph,b||(b=new d.AmGraph,b.scrollbar=!0,this.unselectedGraph=b,b.negativeBase=a.negativeBase,b.noStepRisers=a.noStepRisers),b=this.selectedGraph,b||(b=new d.AmGraph,b.scrollbar=!0,this.selectedGraph=b,b.negativeBase=a.negativeBase,b.noStepRisers=a.noStepRisers));this.scrollbarCreated=!0},draw:function(){var a=this;d.ChartScrollbar.base.draw.call(a); -if(a.enabled){a.scrollbarCreated||a.init();var b=a.chart,c=b.chartData,e=a.categoryAxis,h=a.rotate,f=a.x,g=a.y,k=a.width,l=a.height,m=a.gridAxis,n=a.set;e.setOrientation(!h);e.parseDates=m.parseDates;"ValueAxis"==a.categoryAxis.cname&&(e.rotate=!h);e.equalSpacing=m.equalSpacing;e.minPeriod=m.minPeriod;e.startOnAxis=m.startOnAxis;e.width=k-1;e.height=l;e.gridCount=a.gridCount;e.gridColor=a.gridColor;e.gridAlpha=a.gridAlpha;e.color=a.color;e.tickLength=0;e.axisAlpha=0;e.autoGridCount=a.autoGridCount; -e.parseDates&&!e.equalSpacing&&e.timeZoom(b.firstTime,b.lastTime);e.minimum=a.gridAxis.fullMin;e.maximum=a.gridAxis.fullMax;e.strictMinMax=!0;e.zoom(0,c.length-1);if((m=a.graph)&&a.catScrollbar){var q=a.valueAxis,p=m.valueAxis;q.id=p.id;q.rotate=h;q.setOrientation(h);q.width=k;q.height=l;q.dataProvider=c;q.reversed=p.reversed;q.logarithmic=p.logarithmic;q.gridAlpha=0;q.axisAlpha=0;n.push(q.set);h?(q.y=g,q.x=0):(q.x=f,q.y=0);var f=Infinity,g=-Infinity,t;for(t=0;tg&&(g=y)}}Infinity!=f&&(q.minimum=f);-Infinity!=g&&(q.maximum=g+.1*(g-f));f==g&&(--q.minimum,q.maximum+=1);void 0!==a.minimum&&(q.minimum=a.minimum);void 0!==a.maximum&&(q.maximum=a.maximum);q.zoom(0,c.length-1);v=a.unselectedGraph;v.id=m.id;v.bcn="scrollbar-graph-";v.rotate=h;v.chart=b;v.data=c;v.valueAxis=q;v.chart=m.chart;v.categoryAxis=a.categoryAxis;v.periodSpan=m.periodSpan;v.valueField=m.valueField;v.openField= -m.openField;v.closeField=m.closeField;v.highField=m.highField;v.lowField=m.lowField;v.lineAlpha=a.graphLineAlpha;v.lineColorR=a.graphLineColor;v.fillAlphas=a.graphFillAlpha;v.fillColorsR=a.graphFillColor;v.connect=m.connect;v.hidden=m.hidden;v.width=k;v.height=l;v.pointPosition=m.pointPosition;v.stepDirection=m.stepDirection;v.periodSpan=m.periodSpan;p=a.selectedGraph;p.id=m.id;p.bcn=v.bcn+"selected-";p.rotate=h;p.chart=b;p.data=c;p.valueAxis=q;p.chart=m.chart;p.categoryAxis=e;p.periodSpan=m.periodSpan; -p.valueField=m.valueField;p.openField=m.openField;p.closeField=m.closeField;p.highField=m.highField;p.lowField=m.lowField;p.lineAlpha=a.selectedGraphLineAlpha;p.lineColorR=a.selectedGraphLineColor;p.fillAlphas=a.selectedGraphFillAlpha;p.fillColorsR=a.selectedGraphFillColor;p.connect=m.connect;p.hidden=m.hidden;p.width=k;p.height=l;p.pointPosition=m.pointPosition;p.stepDirection=m.stepDirection;p.periodSpan=m.periodSpan;b=a.graphType;b||(b=m.type);v.type=b;p.type=b;c=c.length-1;v.zoom(0,c);p.zoom(0, -c);p.set.click(function(){a.handleBackgroundClick()}).mouseover(function(){a.handleMouseOver()}).mouseout(function(){a.handleMouseOut()});v.set.click(function(){a.handleBackgroundClick()}).mouseover(function(){a.handleMouseOver()}).mouseout(function(){a.handleMouseOut()});n.push(v.set);n.push(p.set)}n.push(e.set);n.push(e.labelsSet);a.bg.toBack();a.invisibleBg.toFront();a.dragger.toFront();a.iconLeft.toFront();a.iconRight.toFront()}},timeZoom:function(a,b,c){this.startTime=a;this.endTime=b;this.timeDifference= -b-a;this.skipEvent=!d.toBoolean(c);this.zoomScrollbar();this.dispatchScrollbarEvent()},zoom:function(a,b){this.start=a;this.end=b;this.skipEvent=!0;this.zoomScrollbar()},dispatchScrollbarEvent:function(){if(this.categoryAxis&&"ValueAxis"==this.categoryAxis.cname)d.ChartScrollbar.base.dispatchScrollbarEvent.call(this);else if(this.skipEvent)this.skipEvent=!1;else{var a=this.chart.chartData,b,c,e=this.dragger.getBBox();b=e.x;var h=e.y,f=e.width,e=e.height,g=this.chart;this.rotate?(b=h,c=e):c=f;f={type:"zoomed", -target:this};f.chart=g;var k=this.categoryAxis,l=this.stepWidth,h=g.minSelectedTime,e=g.maxSelectedTime,m=!1;if(k.parseDates&&!k.equalSpacing){if(a=g.lastTime,g=g.firstTime,k=Math.round(b/l)+g,b=this.dragging?k+this.timeDifference:Math.round((b+c)/l)+g,k>b&&(k=b),0e&&(b=Math.round(k+(b-k)/2),m=Math.round(e/2),k=b-m,b+=m,m=!0),b>a&&(b=a),b-hb&&(b=k+h),k!=this.startTime||b!=this.endTime)this.startTime= -k,this.endTime=b,f.start=k,f.end=b,f.startDate=new Date(k),f.endDate=new Date(b),this.fire(f)}else{k.startOnAxis||(b+=l/2);c-=this.stepWidth/2;h=k.xToIndex(b);b=k.xToIndex(b+c);if(h!=this.start||this.end!=b)k.startOnAxis&&(this.resizingRight&&h==b&&b++,this.resizingLeft&&h==b&&(0this.timeDifference&&(this.timeDifference=0)},handleBackgroundClick:function(){d.ChartScrollbar.base.handleBackgroundClick.call(this);this.dragging||(this.difference=this.end-this.start,this.timeDifference=this.endTime-this.startTime,0>this.timeDifference&& -(this.timeDifference=0))}})})();(function(){var d=window.AmCharts;d.AmBalloon=d.Class({construct:function(a){this.cname="AmBalloon";this.enabled=!0;this.fillColor="#FFFFFF";this.fillAlpha=.8;this.borderThickness=2;this.borderColor="#FFFFFF";this.borderAlpha=1;this.cornerRadius=0;this.maxWidth=220;this.horizontalPadding=8;this.verticalPadding=4;this.pointerWidth=6;this.pointerOrientation="V";this.color="#000000";this.adjustBorderColor=!0;this.show=this.follow=this.showBullet=!1;this.bulletSize=3;this.shadowAlpha=.4;this.shadowColor= -"#000000";this.fadeOutDuration=this.animationDuration=.3;this.fixedPosition=!0;this.offsetY=6;this.offsetX=1;this.textAlign="center";this.disableMouseEvents=!0;this.deltaSignX=this.deltaSignY=1;d.isModern||(this.offsetY*=1.5);this.sdy=this.sdx=0;d.applyTheme(this,a,this.cname)},draw:function(){var a=this.pointToX,b=this.pointToY;d.isModern||(this.drop=!1);var c=this.chart;d.VML&&(this.fadeOutDuration=0);this.xAnim&&c.stopAnim(this.xAnim);this.yAnim&&c.stopAnim(this.yAnim);this.sdy=this.sdx=0;if(!isNaN(a)){var e= -this.follow,h=c.container,f=this.set;d.remove(f);this.removeDiv();f=h.set();f.node.style.pointerEvents="none";this.set=f;this.mainSet?(this.mainSet.push(this.set),this.sdx=this.mainSet.x,this.sdy=this.mainSet.y):c.balloonsSet.push(f);if(this.show){var g=this.l,k=this.t,l=this.r,m=this.b,n=this.balloonColor,q=this.fillColor,p=this.borderColor,t=q;void 0!=n&&(this.adjustBorderColor?t=p=n:q=n);var r=this.horizontalPadding,v=this.verticalPadding,y=this.pointerWidth,x=this.pointerOrientation,u=this.cornerRadius, -A=c.fontFamily,z=this.fontSize;void 0==z&&(z=c.fontSize);var n=document.createElement("div"),B=c.classNamePrefix;n.className=B+"-balloon-div";this.className&&(n.className=n.className+" "+B+"-balloon-div-"+this.className);B=n.style;this.disableMouseEvents&&(B.pointerEvents="none");B.position="absolute";var D=this.minWidth,C="";isNaN(D)||(C="min-width:"+(D-2*r)+"px; ");n.innerHTML='
'+this.text+"
";c.chartDiv.appendChild(n);this.textDiv=n;var J=n.offsetWidth,H=n.offsetHeight;n.clientHeight&&(J=n.clientWidth,H=n.clientHeight);A=H+2*v;C=J+2*r;!isNaN(D)&&CA&&(y=A/2),z=b-A/2,a=m&&(z=m-A); -zl&&(D=l-C);var k=z+v,m=D+r,O=this.shadowAlpha,Q=this.shadowColor,r=this.borderThickness,ga=this.bulletSize,I,v=this.fillAlpha,aa=this.borderAlpha;this.showBullet&&(I=d.circle(h,ga,t,v),f.push(I));this.drop?(g=C/1.6,l=0,"V"==x&&(x="down"),"H"==x&&(x="left"),"down"==x&&(D=a+1,z=b-g-g/3),"up"==x&&(l=180,D=a+1,z=b+g+g/3),"left"==x&&(l=270,D=a+g+g/3+2,z=b),"right"==x&&(l=90,D=a-g-g/3+2,z=b),k=z-H/2+1,m=D-J/2-1,q=d.drop(h,g,l,q,v,r,p,aa)):0C-y&&(g=C-y),gA-y&&(x=A-y),xa?C:a-D,C,C,0,0,C]),0this.r-e.width&&(a=this.r-e.width);dthis.processCount&&(this.processCount=1);var b=a.length/this.processCount;this.parseCount=Math.ceil(b)-1;for(var c=0;ca.length&&(c=a.length);var h=this.graphs,f={},g=this.seriesIdField;g||(g=this.categoryField);var k=!1,l,m=this.categoryAxis,n,q,p;m&&(k=m.parseDates,n=m.forceShowField,p=m.classNameField,q=m.labelColorField,l=m.categoryFunction);var t,r,v={},y;k&&(t=d.extractPeriod(m.minPeriod), -r=t.period,t=t.count,y=d.getPeriodDuration(r,t));var x={};this.lookupTable=x;var u,A=this.dataDateFormat,z={};for(u=b;u=y*Q&&(z[O].gap=!0);this.processFields(b,I,aa);I.category=B.category;I.serialDataItem=B;I.graph=b;B.axes[H].graphs[O]= -I;v[O]=B.time;z[O]=I}}}this.chartData[u]=B}if(this.parseCount==e){for(a=0;ab?this.colors[b]:a.lineColorR?a.lineColorR:d.randomColor();a.lineColorR=c}a.fillColorsR=a.fillColors?a.fillColors:a.lineColorR;a.bulletBorderColorR=a.bulletBorderColor?a.bulletBorderColor:a.useLineColorForBulletBorder?a.lineColorR:a.bulletColor;a.bulletColorR=a.bulletColor?a.bulletColor:a.lineColorR;if(c=this.patterns)a.pattern=c[b]},handleLegendEvent:function(a){var b=a.type;if(a=a.dataItem){var c=a.hidden,e=a.showBalloon;switch(b){case "clickMarker":this.textClickEnabled&& -(e?this.hideGraphsBalloon(a):this.showGraphsBalloon(a));break;case "clickLabel":e?this.hideGraphsBalloon(a):this.showGraphsBalloon(a);break;case "rollOverItem":c||this.highlightGraph(a);break;case "rollOutItem":c||this.unhighlightGraph();break;case "hideItem":this.hideGraph(a);break;case "showItem":this.showGraph(a)}}},highlightGraph:function(a){var b=this.graphs;if(b){var c,e=.2;this.legend&&(e=this.legend.rollOverGraphAlpha);if(1!=e)for(c=0;c=b&&(b=.001);if(void 0==h||0===h)h=.01;void 0===f&&(f="#000000");void 0===g&&(g=0);e={fill:c,stroke:f,"fill-opacity":e,"stroke-width":h,"stroke-opacity":g};a=isNaN(l)?a.circle(0,0,b).attr(e):a.ellipse(0,0,b,l).attr(e);k&&a.gradient("radialGradient",[c,d.adjustLuminosity(c,-.6)]);return a};d.text=function(a,b,c,e,h,f,g,k){f||(f="middle");"right"==f&&(f="end");"left"==f&&(f="start");isNaN(k)&&(k=1);void 0!==b&&(b=String(b),d.isIE&& -!d.isModern&&(b=b.replace("&","&"),b=b.replace("&","&")));c={fill:c,"font-family":e,"font-size":h+"px",opacity:k};!0===g&&(c["font-weight"]="bold");c["text-anchor"]=f;return a.text(b,c)};d.polygon=function(a,b,c,e,h,f,g,k,l,m,n){isNaN(f)&&(f=.01);isNaN(k)&&(k=h);var q=e,p=!1;"object"==typeof q&&1b&&(b=Math.abs(b),t=-b);0>c&&(c=Math.abs(c),r=-c);t+=d.dx;r+=d.dy;h={fill:q,stroke:g,"fill-opacity":h,"stroke-opacity":k};void 0!==n&&0=x&&(h=x);var u=1/180*Math.PI,x=b+Math.sin(e*u)*k,A=c-Math.cos(e*u)*v,z=b+Math.sin(e*u)*f,B=c-Math.cos(e*u)*g,D=b+Math.sin((e+h)*u)*f,C=c-Math.cos((e+h)*u)*g,J=b+Math.sin((e+h)*u)*k,u=c-Math.cos((e+h)*u)*v,H={fill:d.adjustLuminosity(m.fill,-.2),"stroke-opacity":0,"fill-opacity":m["fill-opacity"]},S=0;180Math.abs(h)&&1>=Math.abs(D-z)&&1>=Math.abs(C-B)&&(O=!0));h="";var Q;q&&(H["fill-opacity"]=0,H["stroke-opacity"]=m["stroke-opacity"]/2,H.stroke=m.stroke);if(0a.length&&(a=String(a[0])+String(a[0])+String(a[1])+String(a[1])+String(a[2])+String(a[2]));b=b||0;var c="#",e,h;for(h=0;3>h;h++)e=parseInt(a.substr(2*h,2),16),e=Math.round(Math.min(Math.max(0,e+e*b),255)).toString(16),c+=("00"+ -e).substr(e.length);return c}})();(function(){var d=window.AmCharts;d.Bezier=d.Class({construct:function(a,b,c,e,h,f,g,k,l,m,n){var q,p;"object"==typeof g&&1c&&(k=c);b.push({x:l.x-k/h,y:l.y-e/f});b.push({x:l.x,y:l.y});b.push({x:l.x+ -k/h,y:l.y+e/f})}e=a[a.length-1].y-a[a.length-2].y;c=a[a.length-1].x-a[a.length-2].x;b.push({x:a[a.length-1].x-c/h,y:a[a.length-1].y-e/f});b.push({x:a[a.length-1].x,y:a[a.length-1].y});return b},drawBeziers:function(a){var b="",c;for(c=0;c<(a.length-1)/3;c++)b+=this.drawBezierMidpoint(a[3*c],a[3*c+1],a[3*c+2],a[3*c+3]);return b},drawBezierMidpoint:function(a,b,c,d){var h=Math.round,f=this.getPointOnSegment(a,b,.75),g=this.getPointOnSegment(d,c,.75),k=(d.x-a.x)/16,l=(d.y-a.y)/16,m=this.getPointOnSegment(a, -b,.375);a=this.getPointOnSegment(f,g,.375);a.x-=k;a.y-=l;b=this.getPointOnSegment(g,f,.375);b.x+=k;b.y+=l;c=this.getPointOnSegment(d,c,.375);k=this.getMiddle(m,a);f=this.getMiddle(f,g);g=this.getMiddle(b,c);m=" Q"+h(m.x)+","+h(m.y)+","+h(k.x)+","+h(k.y);m+=" Q"+h(a.x)+","+h(a.y)+","+h(f.x)+","+h(f.y);m+=" Q"+h(b.x)+","+h(b.y)+","+h(g.x)+","+h(g.y);return m+=" Q"+h(c.x)+","+h(c.y)+","+h(d.x)+","+h(d.y)},getMiddle:function(a,b){return{x:(a.x+b.x)/2,y:(a.y+b.y)/2}},getPointOnSegment:function(a,b,c){return{x:a.x+ -(b.x-a.x)*c,y:a.y+(b.y-a.y)*c}}})})();(function(){var d=window.AmCharts;d.AmDraw=d.Class({construct:function(a,b,c,e){d.SVG_NS="http://www.w3.org/2000/svg";d.SVG_XLINK="http://www.w3.org/1999/xlink";d.hasSVG=!!document.createElementNS&&!!document.createElementNS(d.SVG_NS,"svg").createSVGRect;1>b&&(b=10);1>c&&(c=10);this.div=a;this.width=b;this.height=c;this.rBin=document.createElement("div");d.hasSVG?(d.SVG=!0,b=this.createSvgElement("svg"),a.appendChild(b),this.container=b,this.addDefs(e),this.R=new d.SVGRenderer(this)):d.isIE&&d.VMLRenderer&& -(d.VML=!0,d.vmlStyleSheet||(document.namespaces.add("amvml","urn:schemas-microsoft-com:vml"),31>document.styleSheets.length?(b=document.createStyleSheet(),b.addRule(".amvml","behavior:url(#default#VML); display:inline-block; antialias:true"),d.vmlStyleSheet=b):document.styleSheets[0].addRule(".amvml","behavior:url(#default#VML); display:inline-block; antialias:true")),this.container=a,this.R=new d.VMLRenderer(this,e),this.R.disableSelection(a))},createSvgElement:function(a){return document.createElementNS(d.SVG_NS, -a)},circle:function(a,b,c,e){var h=new d.AmDObject("circle",this);h.attr({r:c,cx:a,cy:b});this.addToContainer(h.node,e);return h},ellipse:function(a,b,c,e,h){var f=new d.AmDObject("ellipse",this);f.attr({rx:c,ry:e,cx:a,cy:b});this.addToContainer(f.node,h);return f},setSize:function(a,b){0c&&(c=1);1>e&&(e=1);k.attr({x:a,y:b,width:c,height:e,rx:h,ry:h,"stroke-width":f});this.addToContainer(k.node,g);return k},image:function(a,b,c,e,h,f){var g=new d.AmDObject("image",this);g.attr({x:b,y:c,width:e,height:h});this.R.path(g,a);this.addToContainer(g.node,f);return g},addToContainer:function(a,b){b||(b=this.container);b.appendChild(a)},text:function(a,b,c){return this.R.text(a,b,c)},path:function(a,b,c,e){var h=new d.AmDObject("path",this);e||(e="100,100"); -h.attr({cs:e});c?h.attr({dd:a}):h.attr({d:a});this.addToContainer(h.node,b);return h},set:function(a){return this.R.set(a)},remove:function(a){if(a){var b=this.rBin;b.appendChild(a);b.innerHTML=""}},renderFix:function(){var a=this.container,b=a.style;b.top="0px";b.left="0px";try{var c=a.getBoundingClientRect(),d=c.left-Math.round(c.left),h=c.top-Math.round(c.top);d&&(b.left=d+"px");h&&(b.top=h+"px")}catch(f){}},update:function(){this.R.update()},addDefs:function(a){if(d.hasSVG){var b=this.createSvgElement("desc"), -c=this.container;c.setAttribute("version","1.1");c.style.position="absolute";this.setSize(this.width,this.height);if(a.accessibleTitle){var e=this.createSvgElement("text");c.appendChild(e);e.innerHTML=a.accessibleTitle;e.style.opacity=0}d.rtl&&(c.setAttribute("direction","rtl"),c.style.left="auto",c.style.right="0px");a&&(a.addCodeCredits&&b.appendChild(document.createTextNode("JavaScript chart by amCharts "+a.version)),c.appendChild(b),a.defs&&(b=this.createSvgElement("defs"),c.appendChild(b),d.parseDefs(a.defs, -b),this.defs=b))}}})})();(function(){var d=window.AmCharts;d.AmDObject=d.Class({construct:function(a,b){this.D=b;this.R=b.R;this.node=this.R.create(this,a);this.y=this.x=0;this.scale=1},attr:function(a){this.R.attr(this,a);return this},getAttr:function(a){return this.node.getAttribute(a)},setAttr:function(a,b){this.R.setAttr(this,a,b);return this},clipRect:function(a,b,c,d){this.R.clipRect(this,a,b,c,d)},translate:function(a,b,c,d){d||(a=Math.round(a),b=Math.round(b));this.R.move(this,a,b,c);this.x=a;this.y=b;this.scale= -c;this.angle&&this.rotate(this.angle)},rotate:function(a,b){this.R.rotate(this,a,b);this.angle=a},animate:function(a,b,c){for(var e in a)if(a.hasOwnProperty(e)){var h=e,f=a[e];c=d.getEffect(c);this.R.animate(this,h,f,b,c)}},push:function(a){if(a){var b=this.node;b.appendChild(a.node);var c=a.clipPath;c&&b.appendChild(c);(a=a.grad)&&b.appendChild(a)}},text:function(a){this.R.setText(this,a)},remove:function(){this.stop();this.R.remove(this)},clear:function(){var a=this.node;if(a.hasChildNodes())for(;1<= -a.childNodes.length;)a.removeChild(a.firstChild)},hide:function(){this.setAttr("visibility","hidden")},show:function(){this.setAttr("visibility","visible")},getBBox:function(){return this.R.getBBox(this)},toFront:function(){var a=this.node;if(a){this.prevNextNode=a.nextSibling;var b=a.parentNode;b&&b.appendChild(a)}},toPrevious:function(){var a=this.node;a&&this.prevNextNode&&(a=a.parentNode)&&a.insertBefore(this.prevNextNode,null)},toBack:function(){var a=this.node;if(a){this.prevNextNode=a.nextSibling; -var b=a.parentNode;if(b){var c=b.firstChild;c&&b.insertBefore(a,c)}}},mouseover:function(a){this.R.addListener(this,"mouseover",a);return this},mouseout:function(a){this.R.addListener(this,"mouseout",a);return this},click:function(a){this.R.addListener(this,"click",a);return this},dblclick:function(a){this.R.addListener(this,"dblclick",a);return this},mousedown:function(a){this.R.addListener(this,"mousedown",a);return this},mouseup:function(a){this.R.addListener(this,"mouseup",a);return this},touchmove:function(a){this.R.addListener(this, -"touchmove",a);return this},touchstart:function(a){this.R.addListener(this,"touchstart",a);return this},touchend:function(a){this.R.addListener(this,"touchend",a);return this},keyup:function(a){this.R.addListener(this,"keyup",a);return this},focus:function(a){this.R.addListener(this,"focus",a);return this},blur:function(a){this.R.addListener(this,"blur",a);return this},contextmenu:function(a){this.node.addEventListener?this.node.addEventListener("contextmenu",a,!0):this.R.addListener(this,"contextmenu", -a);return this},stop:function(){d.removeFromArray(this.R.animations,this.an_translate);d.removeFromArray(this.R.animations,this.an_y);d.removeFromArray(this.R.animations,this.an_x)},length:function(){return this.node.childNodes.length},gradient:function(a,b,c){this.R.gradient(this,a,b,c)},pattern:function(a,b,c){a&&this.R.pattern(this,a,b,c)}})})();(function(){var d=window.AmCharts;d.VMLRenderer=d.Class({construct:function(a,b){this.chart=b;this.D=a;this.cNames={circle:"oval",ellipse:"oval",rect:"roundrect",path:"shape"};this.styleMap={x:"left",y:"top",width:"width",height:"height","font-family":"fontFamily","font-size":"fontSize",visibility:"visibility"}},create:function(a,b){var c;if("group"==b)c=document.createElement("div"),a.type="div";else if("text"==b)c=document.createElement("div"),a.type="text";else if("image"==b)c=document.createElement("img"), -a.type="image";else{a.type="shape";a.shapeType=this.cNames[b];c=document.createElement("amvml:"+this.cNames[b]);var d=document.createElement("amvml:stroke");c.appendChild(d);a.stroke=d;var h=document.createElement("amvml:fill");c.appendChild(h);a.fill=h;h.className="amvml";d.className="amvml";c.className="amvml"}c.style.position="absolute";c.style.top=0;c.style.left=0;return c},path:function(a,b){a.node.setAttribute("src",b)},setAttr:function(a,b,c){if(void 0!==c){var e;8===document.documentMode&& -(e=!0);var h=a.node,f=a.type,g=h.style;"r"==b&&(g.width=2*c,g.height=2*c);"oval"==a.shapeType&&("rx"==b&&(g.width=2*c),"ry"==b&&(g.height=2*c));"roundrect"==a.shapeType&&("width"!=b&&"height"!=b||--c);"cursor"==b&&(g.cursor=c);"cx"==b&&(g.left=c-d.removePx(g.width)/2);"cy"==b&&(g.top=c-d.removePx(g.height)/2);var k=this.styleMap[b];"width"==k&&0>c&&(c=0);void 0!==k&&(g[k]=c);"text"==f&&("text-anchor"==b&&(a.anchor=c,k=h.clientWidth,"end"==c&&(g.marginLeft=-k+"px"),"middle"==c&&(g.marginLeft=-(k/2)+ -"px",g.textAlign="center"),"start"==c&&(g.marginLeft="0px")),"fill"==b&&(g.color=c),"font-weight"==b&&(g.fontWeight=c));if(g=a.children)for(k=0;kc&&(g="dot"),3<=c&&6>=c&&(g="dash"),6g&&(b+=g);0>k&&(c+=k)}return{x:b,y:c,width:d,height:h}},setText:function(a,b){var c=a.node;c&&(c.innerHTML=b);this.setAttr(a,"text-anchor",a.anchor)},addListener:function(a,b,c){a.node["on"+b]=c},move:function(a,b,c){var e=a.node,h=e.style;"text"==a.type&&(c-=d.removePx(h.fontSize)/2-1);"oval"==a.shapeType&&(b-=d.removePx(h.width)/2,c-=d.removePx(h.height)/2);a=a.bw;isNaN(a)||(b-=a,c-=a);isNaN(b)||isNaN(c)||(e.style.left=b+"px",e.style.top= -c+"px")},svgPathToVml:function(a){var b=a.split(" ");a="";var c,d=Math.round,h;for(h=0;hthis.fontSize&&(this.ly=h/2-1);0p&&(p=z);u=u.height;u>t&&(t=u)}var z=t=0,B=f,D=0,C=0;for(A=0;AC&&(C=u.height);H+u.width>q&&0=l&&(z=0,t++,D=D+C+m,B=f,C=0);y.push(J)}u=y.getBBox();l=u.height+2*m-1;"left"==a||"right"==a?(n=u.width+2*f,k=n+b+c,g.style.width=k+"px",this.ieW=k):n=k-b-c-1;c=d.polygon(this.container,[0,n,n,0],[0,0,l,l],this.backgroundColor,this.backgroundAlpha,1,this.borderColor,this.borderAlpha);d.setCN(this.chart, -c,"legend-bg");v.push(c);v.translate(b,e);c.toBack();b=f;if("top"==a||"bottom"==a||"absolute"==a||"outside"==a)"center"==this.align?b=f+(n-u.width)/2:"right"==this.align&&(b=f+n-u.width);y.translate(b,m+1);this.titleHeight>l&&(l=this.titleHeight);a=l+e+h+1;0>a&&(a=0);a>this.chart.divRealHeight&&(g.style.top="0px");g.style.height=Math.round(a)+"px";r.setSize(this.divWidth,a)},createEntry:function(a){if(!1!==a.visibleInLegend&&!a.hideFromLegend){var b=this,c=b.chart,e=b.useGraphSettings,h=a.markerType; -h&&(e=!1);a.legendEntryWidth=b.markerSize;h||(h=b.markerType);var f=a.color,g=a.alpha;a.legendKeyColor&&(f=a.legendKeyColor());a.legendKeyAlpha&&(g=a.legendKeyAlpha());var k;!0===a.hidden&&(k=f=b.markerDisabledColor);var l=a.pattern,m=a.customMarker;m||(m=b.customMarker);var n=b.container,q=b.markerSize,p=0,t=0,r=q/2;if(e){e=a.type;b.switchType=void 0;if("line"==e||"step"==e||"smoothedLine"==e||"ohlc"==e)l=n.set(),a.hidden||(f=a.lineColorR,k=a.bulletBorderColorR),p=d.line(n,[0,2*q],[q/2,q/2],f,a.lineAlpha, -a.lineThickness,a.dashLength),d.setCN(c,p,"graph-stroke"),l.push(p),a.bullet&&(a.hidden||(f=a.bulletColorR),p=d.bullet(n,a.bullet,a.bulletSize,f,a.bulletAlpha,a.bulletBorderThickness,k,a.bulletBorderAlpha))&&(d.setCN(c,p,"graph-bullet"),p.translate(q+1,q/2),l.push(p)),r=0,p=q,t=q/3;else{var v;a.getGradRotation&&(v=a.getGradRotation(),0===v&&(v=180));p=a.fillColorsR;!0===a.hidden&&(p=f);if(l=b.createMarker("rectangle",p,a.fillAlphas,a.lineThickness,f,a.lineAlpha,v,l,a.dashLength))r=q,l.translate(r, -q/2);p=q}d.setCN(c,l,"graph-"+e);d.setCN(c,l,"graph-"+a.id)}else if(m)l=n.image(m,0,0,q,q);else{var y;isNaN(b.gradientRotation)||(y=180+b.gradientRotation);(l=b.createMarker(h,f,g,void 0,void 0,void 0,y,l))&&l.translate(q/2,q/2)}d.setCN(c,l,"legend-marker");b.addListeners(l,a);n=n.set([l]);b.switchable&&a.switchable&&n.setAttr("cursor","pointer");void 0!==a.id&&d.setCN(c,n,"legend-item-"+a.id);d.setCN(c,n,a.className,!0);k=b.switchType;var x;k&&"none"!=k&&0c&&(d="00"+c);10<=c&&100>c&&(d="0"+c);a=a.replace(/fff/g,d)}return a};d.extractPeriod=function(a){var b=d.stripNumbers(a),c=1;b!=a&&(c=Number(a.slice(0,a.indexOf(b))));return{period:b,count:c}};d.getDate=function(a,b,c){return a instanceof Date?d.newDate(a,c):b&&isNaN(a)?d.stringToDate(a,b):new Date(a)};d.daysInMonth=function(a){return(new Date(a.getYear(),a.getMonth()+ -1,0)).getDate()};d.newDate=function(a,b){return b&&-1==b.indexOf("fff")?new Date(a):new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds())};d.resetDateToMin=function(a,b,c,e){void 0===e&&(e=1);var h,f,g,k,l,m,n;d.useUTC?(h=a.getUTCFullYear(),f=a.getUTCMonth(),g=a.getUTCDate(),k=a.getUTCHours(),l=a.getUTCMinutes(),m=a.getUTCSeconds(),n=a.getUTCMilliseconds(),a=a.getUTCDay()):(h=a.getFullYear(),f=a.getMonth(),g=a.getDate(),k=a.getHours(),l= -a.getMinutes(),m=a.getSeconds(),n=a.getMilliseconds(),a=a.getDay());switch(b){case "YYYY":h=Math.floor(h/c)*c;f=0;g=1;n=m=l=k=0;break;case "MM":f=Math.floor(f/c)*c;g=1;n=m=l=k=0;break;case "WW":g=a>=e?g-a+e:g-(7+a)+e;n=m=l=k=0;break;case "DD":n=m=l=k=0;break;case "hh":k=Math.floor(k/c)*c;n=m=l=0;break;case "mm":l=Math.floor(l/c)*c;n=m=0;break;case "ss":m=Math.floor(m/c)*c;n=0;break;case "fff":n=Math.floor(n/c)*c}d.useUTC?(a=new Date,a.setUTCFullYear(h,f,g),a.setUTCHours(k,l,m,n)):a=new Date(h,f,g, -k,l,m,n);return a};d.getPeriodDuration=function(a,b){void 0===b&&(b=1);var c;switch(a){case "YYYY":c=316224E5;break;case "MM":c=26784E5;break;case "WW":c=6048E5;break;case "DD":c=864E5;break;case "hh":c=36E5;break;case "mm":c=6E4;break;case "ss":c=1E3;break;case "fff":c=1}return c*b};d.intervals={s:{nextInterval:"ss",contains:1E3},ss:{nextInterval:"mm",contains:60,count:0},mm:{nextInterval:"hh",contains:60,count:1},hh:{nextInterval:"DD",contains:24,count:2},DD:{nextInterval:"",contains:Infinity,count:3}}; -d.getMaxInterval=function(a,b){var c=d.intervals;return a>=c[b].contains?(a=Math.round(a/c[b].contains),b=c[b].nextInterval,d.getMaxInterval(a,b)):"ss"==b?c[b].nextInterval:b};d.dayNames="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" ");d.shortDayNames="Sun Mon Tue Wed Thu Fri Sat".split(" ");d.monthNames="January February March April May June July August September October November December".split(" ");d.shortMonthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "); -d.getWeekNumber=function(a){a=new Date(a);a.setHours(0,0,0);a.setDate(a.getDate()+4-(a.getDay()||7));var b=new Date(a.getFullYear(),0,1);return Math.ceil(((a-b)/864E5+1)/7)};d.stringToDate=function(a,b){var c={},e=[{pattern:"YYYY",period:"year"},{pattern:"YY",period:"year"},{pattern:"MM",period:"month"},{pattern:"M",period:"month"},{pattern:"DD",period:"date"},{pattern:"D",period:"date"},{pattern:"JJ",period:"hours"},{pattern:"J",period:"hours"},{pattern:"HH",period:"hours"},{pattern:"H",period:"hours"}, -{pattern:"KK",period:"hours"},{pattern:"K",period:"hours"},{pattern:"LL",period:"hours"},{pattern:"L",period:"hours"},{pattern:"NN",period:"minutes"},{pattern:"N",period:"minutes"},{pattern:"SS",period:"seconds"},{pattern:"S",period:"seconds"},{pattern:"QQQ",period:"milliseconds"},{pattern:"QQ",period:"milliseconds"},{pattern:"Q",period:"milliseconds"}],h=!0,f=b.indexOf("AA");-1!=f&&(a.substr(f,2),"pm"==a.toLowerCase&&(h=!1));var f=b,g,k,l;for(l=0;lr&&(r="0"+r);b=b.replace(/JJ/g,r);b=b.replace(/J/g,q);r=k;0===r&&(r=24,-1!=b.indexOf("H")&&(f--,0===f&&(e=new Date(a),e.setDate(e.getDate()-1),h=e.getMonth(),f=e.getDate(),e=e.getFullYear())));a=h+1;9>h&&(a="0"+a);q=f;10>f&&(q="0"+f);var v=r;10>v&&(v="0"+v);b=b.replace(/HH/g,v);b=b.replace(/H/g,r);r=k;11v&&(v="0"+v);b=b.replace(/KK/g,v);b=b.replace(/K/g,r);r=k;0===r&&(r=12);12v&&(v="0"+v);b=b.replace(/LL/g,v);b=b.replace(/L/g,r); -r=l;10>r&&(r="0"+r);b=b.replace(/NN/g,r);b=b.replace(/N/g,l);l=m;10>l&&(l="0"+l);b=b.replace(/SS/g,l);b=b.replace(/S/g,m);m=n;10>m?m="00"+m:100>m&&(m="0"+m);l=n;10>l&&(l="00"+l);b=b.replace(/A/g,"@A@");b=b.replace(/QQQ/g,m);b=b.replace(/QQ/g,l);b=b.replace(/Q/g,n);b=b.replace(/YYYY/g,"@IIII@");b=b.replace(/YY/g,"@II@");b=b.replace(/MMMM/g,"@XXXX@");b=b.replace(/MMM/g,"@XXX@");b=b.replace(/MM/g,"@XX@");b=b.replace(/M/g,"@X@");b=b.replace(/DD/g,"@RR@");b=b.replace(/D/g,"@R@");b=b.replace(/EEEE/g,"@PPPP@"); -b=b.replace(/EEE/g,"@PPP@");b=b.replace(/EE/g,"@PP@");b=b.replace(/E/g,"@P@");b=b.replace(/@IIII@/g,e);b=b.replace(/@II@/g,p);b=b.replace(/@XXXX@/g,c.monthNames[h]);b=b.replace(/@XXX@/g,c.shortMonthNames[h]);b=b.replace(/@XX@/g,a);b=b.replace(/@X@/g,h+1);b=b.replace(/@RR@/g,q);b=b.replace(/@R@/g,f);b=b.replace(/@PPPP@/g,c.dayNames[g]);b=b.replace(/@PPP@/g,c.shortDayNames[g]);b=b.replace(/@PP@/g,t);b=b.replace(/@P@/g,g);return b=12>k?b.replace(/@A@/g,c.amString):b.replace(/@A@/g,c.pmString)};d.changeDate= -function(a,b,c,e,h){if(d.useUTC)return d.changeUTCDate(a,b,c,e,h);var f=-1;void 0===e&&(e=!0);void 0===h&&(h=!1);!0===e&&(f=1);switch(b){case "YYYY":a.setFullYear(a.getFullYear()+c*f);e||h||a.setDate(a.getDate()+1);break;case "MM":b=a.getMonth();a.setMonth(a.getMonth()+c*f);a.getMonth()>b+c*f&&a.setDate(a.getDate()-1);e||h||a.setDate(a.getDate()+1);break;case "DD":a.setDate(a.getDate()+c*f);break;case "WW":a.setDate(a.getDate()+c*f*7);break;case "hh":a.setHours(a.getHours()+c*f);break;case "mm":a.setMinutes(a.getMinutes()+ -c*f);break;case "ss":a.setSeconds(a.getSeconds()+c*f);break;case "fff":a.setMilliseconds(a.getMilliseconds()+c*f)}return a};d.changeUTCDate=function(a,b,c,d,h){var f=-1;void 0===d&&(d=!0);void 0===h&&(h=!1);!0===d&&(f=1);switch(b){case "YYYY":a.setUTCFullYear(a.getUTCFullYear()+c*f);d||h||a.setUTCDate(a.getUTCDate()+1);break;case "MM":b=a.getUTCMonth();a.setUTCMonth(a.getUTCMonth()+c*f);a.getUTCMonth()>b+c*f&&a.setUTCDate(a.getUTCDate()-1);d||h||a.setUTCDate(a.getUTCDate()+1);break;case "DD":a.setUTCDate(a.getUTCDate()+ -c*f);break;case "WW":a.setUTCDate(a.getUTCDate()+c*f*7);break;case "hh":a.setUTCHours(a.getUTCHours()+c*f);break;case "mm":a.setUTCMinutes(a.getUTCMinutes()+c*f);break;case "ss":a.setUTCSeconds(a.getUTCSeconds()+c*f);break;case "fff":a.setUTCMilliseconds(a.getUTCMilliseconds()+c*f)}return a}})(); - -},{}],80:[function(require,module,exports){ -(function (global){ -// Backbone.js 1.3.3 - -// (c) 2010-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -// Backbone may be freely distributed under the MIT license. -// For all details and documentation: -// http://backbonejs.org - -(function(factory) { - - // Establish the root object, `window` (`self`) in the browser, or `global` on the server. - // We use `self` instead of `window` for `WebWorker` support. - var root = (typeof self == 'object' && self.self === self && self) || - (typeof global == 'object' && global.global === global && global); - - // Set up Backbone appropriately for the environment. Start with AMD. - if (typeof define === 'function' && define.amd) { - define(['underscore', 'jquery', 'exports'], function(_, $, exports) { - // Export global even in AMD case in case this script is loaded with - // others that may still expect a global Backbone. - root.Backbone = factory(root, exports, _, $); - }); - - // Next for Node.js or CommonJS. jQuery may not be needed as a module. - } else if (typeof exports !== 'undefined') { - var _ = require('underscore'), $; - try { $ = require('jquery'); } catch (e) {} - factory(root, exports, _, $); - - // Finally, as a browser global. - } else { - root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$)); - } - -})(function(root, Backbone, _, $) { - - // Initial Setup - // ------------- - - // Save the previous value of the `Backbone` variable, so that it can be - // restored later on, if `noConflict` is used. - var previousBackbone = root.Backbone; - - // Create a local reference to a common array method we'll want to use later. - var slice = Array.prototype.slice; - - // Current version of the library. Keep in sync with `package.json`. - Backbone.VERSION = '1.3.3'; - - // For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns - // the `$` variable. - Backbone.$ = $; - - // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable - // to its previous owner. Returns a reference to this Backbone object. - Backbone.noConflict = function() { - root.Backbone = previousBackbone; - return this; - }; - - // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option - // will fake `"PATCH"`, `"PUT"` and `"DELETE"` requests via the `_method` parameter and - // set a `X-Http-Method-Override` header. - Backbone.emulateHTTP = false; - - // Turn on `emulateJSON` to support legacy servers that can't deal with direct - // `application/json` requests ... this will encode the body as - // `application/x-www-form-urlencoded` instead and will send the model in a - // form param named `model`. - Backbone.emulateJSON = false; - - // Proxy Backbone class methods to Underscore functions, wrapping the model's - // `attributes` object or collection's `models` array behind the scenes. - // - // collection.filter(function(model) { return model.get('age') > 10 }); - // collection.each(this.addView); - // - // `Function#apply` can be slow so we use the method's arg count, if we know it. - var addMethod = function(length, method, attribute) { - switch (length) { - case 1: return function() { - return _[method](this[attribute]); - }; - case 2: return function(value) { - return _[method](this[attribute], value); - }; - case 3: return function(iteratee, context) { - return _[method](this[attribute], cb(iteratee, this), context); - }; - case 4: return function(iteratee, defaultVal, context) { - return _[method](this[attribute], cb(iteratee, this), defaultVal, context); - }; - default: return function() { - var args = slice.call(arguments); - args.unshift(this[attribute]); - return _[method].apply(_, args); - }; - } - }; - var addUnderscoreMethods = function(Class, methods, attribute) { - _.each(methods, function(length, method) { - if (_[method]) Class.prototype[method] = addMethod(length, method, attribute); - }); - }; - - // Support `collection.sortBy('attr')` and `collection.findWhere({id: 1})`. - var cb = function(iteratee, instance) { - if (_.isFunction(iteratee)) return iteratee; - if (_.isObject(iteratee) && !instance._isModel(iteratee)) return modelMatcher(iteratee); - if (_.isString(iteratee)) return function(model) { return model.get(iteratee); }; - return iteratee; - }; - var modelMatcher = function(attrs) { - var matcher = _.matches(attrs); - return function(model) { - return matcher(model.attributes); - }; - }; - - // Backbone.Events - // --------------- - - // A module that can be mixed in to *any object* in order to provide it with - // a custom event channel. You may bind a callback to an event with `on` or - // remove with `off`; `trigger`-ing an event fires all callbacks in - // succession. - // - // var object = {}; - // _.extend(object, Backbone.Events); - // object.on('expand', function(){ alert('expanded'); }); - // object.trigger('expand'); - // - var Events = Backbone.Events = {}; - - // Regular expression used to split event strings. - var eventSplitter = /\s+/; - - // Iterates over the standard `event, callback` (as well as the fancy multiple - // space-separated events `"change blur", callback` and jQuery-style event - // maps `{event: callback}`). - var eventsApi = function(iteratee, events, name, callback, opts) { - var i = 0, names; - if (name && typeof name === 'object') { - // Handle event maps. - if (callback !== void 0 && 'context' in opts && opts.context === void 0) opts.context = callback; - for (names = _.keys(name); i < names.length ; i++) { - events = eventsApi(iteratee, events, names[i], name[names[i]], opts); - } - } else if (name && eventSplitter.test(name)) { - // Handle space-separated event names by delegating them individually. - for (names = name.split(eventSplitter); i < names.length; i++) { - events = iteratee(events, names[i], callback, opts); - } - } else { - // Finally, standard events. - events = iteratee(events, name, callback, opts); - } - return events; - }; - - // Bind an event to a `callback` function. Passing `"all"` will bind - // the callback to all events fired. - Events.on = function(name, callback, context) { - return internalOn(this, name, callback, context); - }; - - // Guard the `listening` argument from the public API. - var internalOn = function(obj, name, callback, context, listening) { - obj._events = eventsApi(onApi, obj._events || {}, name, callback, { - context: context, - ctx: obj, - listening: listening - }); - - if (listening) { - var listeners = obj._listeners || (obj._listeners = {}); - listeners[listening.id] = listening; - } - - return obj; - }; - - // Inversion-of-control versions of `on`. Tell *this* object to listen to - // an event in another object... keeping track of what it's listening to - // for easier unbinding later. - Events.listenTo = function(obj, name, callback) { - if (!obj) return this; - var id = obj._listenId || (obj._listenId = _.uniqueId('l')); - var listeningTo = this._listeningTo || (this._listeningTo = {}); - var listening = listeningTo[id]; - - // This object is not listening to any other events on `obj` yet. - // Setup the necessary references to track the listening callbacks. - if (!listening) { - var thisId = this._listenId || (this._listenId = _.uniqueId('l')); - listening = listeningTo[id] = {obj: obj, objId: id, id: thisId, listeningTo: listeningTo, count: 0}; - } - - // Bind callbacks on obj, and keep track of them on listening. - internalOn(obj, name, callback, this, listening); - return this; - }; - - // The reducing API that adds a callback to the `events` object. - var onApi = function(events, name, callback, options) { - if (callback) { - var handlers = events[name] || (events[name] = []); - var context = options.context, ctx = options.ctx, listening = options.listening; - if (listening) listening.count++; - - handlers.push({callback: callback, context: context, ctx: context || ctx, listening: listening}); - } - return events; - }; - - // Remove one or many callbacks. If `context` is null, removes all - // callbacks with that function. If `callback` is null, removes all - // callbacks for the event. If `name` is null, removes all bound - // callbacks for all events. - Events.off = function(name, callback, context) { - if (!this._events) return this; - this._events = eventsApi(offApi, this._events, name, callback, { - context: context, - listeners: this._listeners - }); - return this; - }; - - // Tell this object to stop listening to either specific events ... or - // to every object it's currently listening to. - Events.stopListening = function(obj, name, callback) { - var listeningTo = this._listeningTo; - if (!listeningTo) return this; - - var ids = obj ? [obj._listenId] : _.keys(listeningTo); - - for (var i = 0; i < ids.length; i++) { - var listening = listeningTo[ids[i]]; - - // If listening doesn't exist, this object is not currently - // listening to obj. Break out early. - if (!listening) break; - - listening.obj.off(name, callback, this); - } - - return this; - }; - - // The reducing API that removes a callback from the `events` object. - var offApi = function(events, name, callback, options) { - if (!events) return; - - var i = 0, listening; - var context = options.context, listeners = options.listeners; - - // Delete all events listeners and "drop" events. - if (!name && !callback && !context) { - var ids = _.keys(listeners); - for (; i < ids.length; i++) { - listening = listeners[ids[i]]; - delete listeners[listening.id]; - delete listening.listeningTo[listening.objId]; - } - return; - } - - var names = name ? [name] : _.keys(events); - for (; i < names.length; i++) { - name = names[i]; - var handlers = events[name]; - - // Bail out if there are no events stored. - if (!handlers) break; - - // Replace events if there are any remaining. Otherwise, clean up. - var remaining = []; - for (var j = 0; j < handlers.length; j++) { - var handler = handlers[j]; - if ( - callback && callback !== handler.callback && - callback !== handler.callback._callback || - context && context !== handler.context - ) { - remaining.push(handler); - } else { - listening = handler.listening; - if (listening && --listening.count === 0) { - delete listeners[listening.id]; - delete listening.listeningTo[listening.objId]; - } - } - } - - // Update tail event if the list has any events. Otherwise, clean up. - if (remaining.length) { - events[name] = remaining; - } else { - delete events[name]; - } - } - return events; - }; - - // Bind an event to only be triggered a single time. After the first time - // the callback is invoked, its listener will be removed. If multiple events - // are passed in using the space-separated syntax, the handler will fire - // once for each event, not once for a combination of all events. - Events.once = function(name, callback, context) { - // Map the event into a `{event: once}` object. - var events = eventsApi(onceMap, {}, name, callback, _.bind(this.off, this)); - if (typeof name === 'string' && context == null) callback = void 0; - return this.on(events, callback, context); - }; - - // Inversion-of-control versions of `once`. - Events.listenToOnce = function(obj, name, callback) { - // Map the event into a `{event: once}` object. - var events = eventsApi(onceMap, {}, name, callback, _.bind(this.stopListening, this, obj)); - return this.listenTo(obj, events); - }; - - // Reduces the event callbacks into a map of `{event: onceWrapper}`. - // `offer` unbinds the `onceWrapper` after it has been called. - var onceMap = function(map, name, callback, offer) { - if (callback) { - var once = map[name] = _.once(function() { - offer(name, once); - callback.apply(this, arguments); - }); - once._callback = callback; - } - return map; - }; - - // Trigger one or many events, firing all bound callbacks. Callbacks are - // passed the same arguments as `trigger` is, apart from the event name - // (unless you're listening on `"all"`, which will cause your callback to - // receive the true name of the event as the first argument). - Events.trigger = function(name) { - if (!this._events) return this; - - var length = Math.max(0, arguments.length - 1); - var args = Array(length); - for (var i = 0; i < length; i++) args[i] = arguments[i + 1]; - - eventsApi(triggerApi, this._events, name, void 0, args); - return this; - }; - - // Handles triggering the appropriate event callbacks. - var triggerApi = function(objEvents, name, callback, args) { - if (objEvents) { - var events = objEvents[name]; - var allEvents = objEvents.all; - if (events && allEvents) allEvents = allEvents.slice(); - if (events) triggerEvents(events, args); - if (allEvents) triggerEvents(allEvents, [name].concat(args)); - } - return objEvents; - }; - - // A difficult-to-believe, but optimized internal dispatch function for - // triggering events. Tries to keep the usual cases speedy (most internal - // Backbone events have 3 arguments). - 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; - } - }; - - // Aliases for backwards compatibility. - Events.bind = Events.on; - Events.unbind = Events.off; - - // Allow the `Backbone` object to serve as a global event bus, for folks who - // want global "pubsub" in a convenient place. - _.extend(Backbone, Events); - - // Backbone.Model - // -------------- - - // Backbone **Models** are the basic data object in the framework -- - // frequently representing a row in a table in a database on your server. - // A discrete chunk of data and a bunch of useful, related methods for - // performing computations and transformations on that data. - - // Create a new model with the specified attributes. A client id (`cid`) - // is automatically generated and assigned for you. - var Model = Backbone.Model = function(attributes, options) { - var attrs = attributes || {}; - options || (options = {}); - this.cid = _.uniqueId(this.cidPrefix); - this.attributes = {}; - if (options.collection) this.collection = options.collection; - if (options.parse) attrs = this.parse(attrs, options) || {}; - var defaults = _.result(this, 'defaults'); - attrs = _.defaults(_.extend({}, defaults, attrs), defaults); - this.set(attrs, options); - this.changed = {}; - this.initialize.apply(this, arguments); - }; - - // Attach all inheritable methods to the Model prototype. - _.extend(Model.prototype, Events, { - - // A hash of attributes whose current and previous value differ. - changed: null, - - // The value returned during the last failed validation. - validationError: null, - - // The default name for the JSON `id` attribute is `"id"`. MongoDB and - // CouchDB users may want to set this to `"_id"`. - idAttribute: 'id', - - // The prefix is used to create the client id which is used to identify models locally. - // You may want to override this if you're experiencing name clashes with model ids. - cidPrefix: 'c', - - // Initialize is an empty function by default. Override it with your own - // initialization logic. - initialize: function(){}, - - // Return a copy of the model's `attributes` object. - toJSON: function(options) { - return _.clone(this.attributes); - }, - - // Proxy `Backbone.sync` by default -- but override this if you need - // custom syncing semantics for *this* particular model. - sync: function() { - return Backbone.sync.apply(this, arguments); - }, - - // Get the value of an attribute. - get: function(attr) { - return this.attributes[attr]; - }, - - // Get the HTML-escaped value of an attribute. - escape: function(attr) { - return _.escape(this.get(attr)); - }, - - // Returns `true` if the attribute contains a value that is not null - // or undefined. - has: function(attr) { - return this.get(attr) != null; - }, - - // Special-cased proxy to underscore's `_.matches` method. - matches: function(attrs) { - return !!_.iteratee(attrs, this)(this.attributes); - }, - - // Set a hash of model attributes on the object, firing `"change"`. This is - // the core primitive operation of a model, updating the data and notifying - // anyone who needs to know about the change in state. The heart of the beast. - set: function(key, val, options) { - if (key == null) return this; - - // Handle both `"key", value` and `{key: value}` -style arguments. - var attrs; - if (typeof key === 'object') { - attrs = key; - options = val; - } else { - (attrs = {})[key] = val; - } - - options || (options = {}); - - // Run validation. - if (!this._validate(attrs, options)) return false; - - // Extract attributes and options. - var unset = options.unset; - var silent = options.silent; - var changes = []; - var changing = this._changing; - this._changing = true; - - if (!changing) { - this._previousAttributes = _.clone(this.attributes); - this.changed = {}; - } - - var current = this.attributes; - var changed = this.changed; - var prev = this._previousAttributes; - - // For each `set` attribute, update or delete the current value. - for (var attr in attrs) { - val = attrs[attr]; - if (!_.isEqual(current[attr], val)) changes.push(attr); - if (!_.isEqual(prev[attr], val)) { - changed[attr] = val; - } else { - delete changed[attr]; - } - unset ? delete current[attr] : current[attr] = val; - } - - // Update the `id`. - if (this.idAttribute in attrs) this.id = this.get(this.idAttribute); - - // Trigger all relevant attribute changes. - if (!silent) { - if (changes.length) this._pending = options; - for (var i = 0; i < changes.length; i++) { - this.trigger('change:' + changes[i], this, current[changes[i]], options); - } - } - - // You might be wondering why there's a `while` loop here. Changes can - // be recursively nested within `"change"` events. - if (changing) return this; - if (!silent) { - while (this._pending) { - options = this._pending; - this._pending = false; - this.trigger('change', this, options); - } - } - this._pending = false; - this._changing = false; - return this; - }, - - // Remove an attribute from the model, firing `"change"`. `unset` is a noop - // if the attribute doesn't exist. - unset: function(attr, options) { - return this.set(attr, void 0, _.extend({}, options, {unset: true})); - }, - - // Clear all attributes on the model, firing `"change"`. - clear: function(options) { - var attrs = {}; - for (var key in this.attributes) attrs[key] = void 0; - return this.set(attrs, _.extend({}, options, {unset: true})); - }, - - // Determine if the model has changed since the last `"change"` event. - // If you specify an attribute name, determine if that attribute has changed. - hasChanged: function(attr) { - if (attr == null) return !_.isEmpty(this.changed); - return _.has(this.changed, attr); - }, - - // Return an object containing all the attributes that have changed, or - // false if there are no changed attributes. Useful for determining what - // parts of a view need to be updated and/or what attributes need to be - // persisted to the server. Unset attributes will be set to undefined. - // You can also pass an attributes object to diff against the model, - // determining if there *would be* a change. - changedAttributes: function(diff) { - if (!diff) return this.hasChanged() ? _.clone(this.changed) : false; - var old = this._changing ? this._previousAttributes : this.attributes; - var changed = {}; - for (var attr in diff) { - var val = diff[attr]; - if (_.isEqual(old[attr], val)) continue; - changed[attr] = val; - } - return _.size(changed) ? changed : false; - }, - - // Get the previous value of an attribute, recorded at the time the last - // `"change"` event was fired. - previous: function(attr) { - if (attr == null || !this._previousAttributes) return null; - return this._previousAttributes[attr]; - }, - - // Get all of the attributes of the model at the time of the previous - // `"change"` event. - previousAttributes: function() { - return _.clone(this._previousAttributes); - }, - - // Fetch the model from the server, merging the response with the model's - // local attributes. Any changed attributes will trigger a "change" event. - fetch: function(options) { - options = _.extend({parse: true}, options); - var model = this; - var success = options.success; - options.success = function(resp) { - var serverAttrs = options.parse ? model.parse(resp, options) : resp; - if (!model.set(serverAttrs, options)) return false; - if (success) success.call(options.context, model, resp, options); - model.trigger('sync', model, resp, options); - }; - wrapError(this, options); - return this.sync('read', this, options); - }, - - // Set a hash of model attributes, and sync the model to the server. - // If the server returns an attributes hash that differs, the model's - // state will be `set` again. - save: function(key, val, options) { - // Handle both `"key", value` and `{key: value}` -style arguments. - var attrs; - if (key == null || typeof key === 'object') { - attrs = key; - options = val; - } else { - (attrs = {})[key] = val; - } - - options = _.extend({validate: true, parse: true}, options); - var wait = options.wait; - - // If we're not waiting and attributes exist, save acts as - // `set(attr).save(null, opts)` with validation. Otherwise, check if - // the model will be valid when the attributes, if any, are set. - if (attrs && !wait) { - if (!this.set(attrs, options)) return false; - } else if (!this._validate(attrs, options)) { - return false; - } - - // After a successful server-side save, the client is (optionally) - // updated with the server-side state. - var model = this; - var success = options.success; - var attributes = this.attributes; - options.success = function(resp) { - // Ensure attributes are restored during synchronous saves. - model.attributes = attributes; - var serverAttrs = options.parse ? model.parse(resp, options) : resp; - if (wait) serverAttrs = _.extend({}, attrs, serverAttrs); - if (serverAttrs && !model.set(serverAttrs, options)) return false; - if (success) success.call(options.context, model, resp, options); - model.trigger('sync', model, resp, options); - }; - wrapError(this, options); - - // Set temporary attributes if `{wait: true}` to properly find new ids. - if (attrs && wait) this.attributes = _.extend({}, attributes, attrs); - - var method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update'); - if (method === 'patch' && !options.attrs) options.attrs = attrs; - var xhr = this.sync(method, this, options); - - // Restore attributes. - this.attributes = attributes; - - return xhr; - }, - - // Destroy this model on the server if it was already persisted. - // Optimistically removes the model from its collection, if it has one. - // If `wait: true` is passed, waits for the server to respond before removal. - destroy: function(options) { - options = options ? _.clone(options) : {}; - var model = this; - var success = options.success; - var wait = options.wait; - - var destroy = function() { - model.stopListening(); - model.trigger('destroy', model, model.collection, options); - }; - - options.success = function(resp) { - if (wait) destroy(); - if (success) success.call(options.context, model, resp, options); - if (!model.isNew()) model.trigger('sync', model, resp, options); - }; - - var xhr = false; - if (this.isNew()) { - _.defer(options.success); - } else { - wrapError(this, options); - xhr = this.sync('delete', this, options); - } - if (!wait) destroy(); - return xhr; - }, - - // Default URL for the model's representation on the server -- if you're - // using Backbone's restful methods, override this to change the endpoint - // that will be called. - url: function() { - var base = - _.result(this, 'urlRoot') || - _.result(this.collection, 'url') || - urlError(); - if (this.isNew()) return base; - var id = this.get(this.idAttribute); - return base.replace(/[^\/]$/, '$&/') + encodeURIComponent(id); - }, - - // **parse** converts a response into the hash of attributes to be `set` on - // the model. The default implementation is just to pass the response along. - parse: function(resp, options) { - return resp; - }, - - // Create a new model with identical attributes to this one. - clone: function() { - return new this.constructor(this.attributes); - }, - - // A model is new if it has never been saved to the server, and lacks an id. - isNew: function() { - return !this.has(this.idAttribute); - }, - - // Check if the model is currently in a valid state. - isValid: function(options) { - return this._validate({}, _.extend({}, options, {validate: true})); - }, - - // Run validation against the next complete set of model attributes, - // returning `true` if all is well. Otherwise, fire an `"invalid"` event. - _validate: function(attrs, options) { - if (!options.validate || !this.validate) return true; - attrs = _.extend({}, this.attributes, attrs); - var error = this.validationError = this.validate(attrs, options) || null; - if (!error) return true; - this.trigger('invalid', this, error, _.extend(options, {validationError: error})); - return false; - } - - }); - - // Underscore methods that we want to implement on the Model, mapped to the - // number of arguments they take. - var modelMethods = {keys: 1, values: 1, pairs: 1, invert: 1, pick: 0, - omit: 0, chain: 1, isEmpty: 1}; - - // Mix in each Underscore method as a proxy to `Model#attributes`. - addUnderscoreMethods(Model, modelMethods, 'attributes'); - - // Backbone.Collection - // ------------------- - - // If models tend to represent a single row of data, a Backbone Collection is - // more analogous to a table full of data ... or a small slice or page of that - // table, or a collection of rows that belong together for a particular reason - // -- all of the messages in this particular folder, all of the documents - // belonging to this particular author, and so on. Collections maintain - // indexes of their models, both in order, and for lookup by `id`. - - // Create a new **Collection**, perhaps to contain a specific type of `model`. - // If a `comparator` is specified, the Collection will maintain - // its models in sort order, as they're added and removed. - var Collection = Backbone.Collection = function(models, options) { - options || (options = {}); - if (options.model) this.model = options.model; - if (options.comparator !== void 0) this.comparator = options.comparator; - this._reset(); - this.initialize.apply(this, arguments); - if (models) this.reset(models, _.extend({silent: true}, options)); - }; - - // Default options for `Collection#set`. - var setOptions = {add: true, remove: true, merge: true}; - var addOptions = {add: true, remove: false}; - - // Splices `insert` into `array` at index `at`. - var splice = function(array, insert, at) { - at = Math.min(Math.max(at, 0), array.length); - var tail = Array(array.length - at); - var length = insert.length; - var i; - for (i = 0; i < tail.length; i++) tail[i] = array[i + at]; - for (i = 0; i < length; i++) array[i + at] = insert[i]; - for (i = 0; i < tail.length; i++) array[i + length + at] = tail[i]; - }; - - // Define the Collection's inheritable methods. - _.extend(Collection.prototype, Events, { - - // The default model for a collection is just a **Backbone.Model**. - // This should be overridden in most cases. - model: Model, - - // Initialize is an empty function by default. Override it with your own - // initialization logic. - initialize: function(){}, - - // The JSON representation of a Collection is an array of the - // models' attributes. - toJSON: function(options) { - return this.map(function(model) { return model.toJSON(options); }); - }, - - // Proxy `Backbone.sync` by default. - sync: function() { - return Backbone.sync.apply(this, arguments); - }, - - // Add a model, or list of models to the set. `models` may be Backbone - // Models or raw JavaScript objects to be converted to Models, or any - // combination of the two. - add: function(models, options) { - return this.set(models, _.extend({merge: false}, options, addOptions)); - }, - - // Remove a model, or a list of models from the set. - remove: function(models, options) { - options = _.extend({}, options); - var singular = !_.isArray(models); - models = singular ? [models] : models.slice(); - var removed = this._removeModels(models, options); - if (!options.silent && removed.length) { - options.changes = {added: [], merged: [], removed: removed}; - this.trigger('update', this, options); - } - return singular ? removed[0] : removed; - }, - - // Update a collection by `set`-ing a new list of models, adding new ones, - // removing models that are no longer present, and merging models that - // already exist in the collection, as necessary. Similar to **Model#set**, - // the core operation for updating the data contained by the collection. - set: function(models, options) { - if (models == null) return; - - options = _.extend({}, setOptions, options); - if (options.parse && !this._isModel(models)) { - models = this.parse(models, options) || []; - } - - var singular = !_.isArray(models); - models = singular ? [models] : models.slice(); - - var at = options.at; - if (at != null) at = +at; - if (at > this.length) at = this.length; - if (at < 0) at += this.length + 1; - - var set = []; - var toAdd = []; - var toMerge = []; - var toRemove = []; - var modelMap = {}; - - var add = options.add; - var merge = options.merge; - var remove = options.remove; - - var sort = false; - var sortable = this.comparator && at == null && options.sort !== false; - var sortAttr = _.isString(this.comparator) ? this.comparator : null; - - // Turn bare objects into model references, and prevent invalid models - // from being added. - var model, i; - for (i = 0; i < models.length; i++) { - model = models[i]; - - // If a duplicate is found, prevent it from being added and - // optionally merge it into the existing model. - var existing = this.get(model); - if (existing) { - if (merge && model !== existing) { - var attrs = this._isModel(model) ? model.attributes : model; - if (options.parse) attrs = existing.parse(attrs, options); - existing.set(attrs, options); - toMerge.push(existing); - if (sortable && !sort) sort = existing.hasChanged(sortAttr); - } - if (!modelMap[existing.cid]) { - modelMap[existing.cid] = true; - set.push(existing); - } - models[i] = existing; - - // If this is a new, valid model, push it to the `toAdd` list. - } else if (add) { - model = models[i] = this._prepareModel(model, options); - if (model) { - toAdd.push(model); - this._addReference(model, options); - modelMap[model.cid] = true; - set.push(model); - } - } - } - - // Remove stale models. - if (remove) { - for (i = 0; i < this.length; i++) { - model = this.models[i]; - if (!modelMap[model.cid]) toRemove.push(model); - } - if (toRemove.length) this._removeModels(toRemove, options); - } - - // See if sorting is needed, update `length` and splice in new models. - var orderChanged = false; - var replace = !sortable && add && remove; - if (set.length && replace) { - orderChanged = this.length !== set.length || _.some(this.models, function(m, index) { - return m !== set[index]; - }); - this.models.length = 0; - splice(this.models, set, 0); - this.length = this.models.length; - } else if (toAdd.length) { - if (sortable) sort = true; - splice(this.models, toAdd, at == null ? this.length : at); - this.length = this.models.length; - } - - // Silently sort the collection if appropriate. - if (sort) this.sort({silent: true}); - - // Unless silenced, it's time to fire all appropriate add/sort/update events. - if (!options.silent) { - for (i = 0; i < toAdd.length; i++) { - if (at != null) options.index = at + i; - model = toAdd[i]; - model.trigger('add', model, this, options); - } - if (sort || orderChanged) this.trigger('sort', this, options); - if (toAdd.length || toRemove.length || toMerge.length) { - options.changes = { - added: toAdd, - removed: toRemove, - merged: toMerge - }; - this.trigger('update', this, options); - } - } - - // Return the added (or merged) model (or models). - return singular ? models[0] : models; - }, - - // When you have more items than you want to add or remove individually, - // you can reset the entire set with a new list of models, without firing - // any granular `add` or `remove` events. Fires `reset` when finished. - // Useful for bulk operations and optimizations. - reset: function(models, options) { - options = options ? _.clone(options) : {}; - for (var i = 0; i < this.models.length; i++) { - this._removeReference(this.models[i], options); - } - options.previousModels = this.models; - this._reset(); - models = this.add(models, _.extend({silent: true}, options)); - if (!options.silent) this.trigger('reset', this, options); - return models; - }, - - // Add a model to the end of the collection. - push: function(model, options) { - return this.add(model, _.extend({at: this.length}, options)); - }, - - // Remove a model from the end of the collection. - pop: function(options) { - var model = this.at(this.length - 1); - return this.remove(model, options); - }, - - // Add a model to the beginning of the collection. - unshift: function(model, options) { - return this.add(model, _.extend({at: 0}, options)); - }, - - // Remove a model from the beginning of the collection. - shift: function(options) { - var model = this.at(0); - return this.remove(model, options); - }, - - // Slice out a sub-array of models from the collection. - slice: function() { - return slice.apply(this.models, arguments); - }, - - // Get a model from the set by id, cid, model object with id or cid - // properties, or an attributes object that is transformed through modelId. - get: function(obj) { - if (obj == null) return void 0; - return this._byId[obj] || - this._byId[this.modelId(obj.attributes || obj)] || - obj.cid && this._byId[obj.cid]; - }, - - // Returns `true` if the model is in the collection. - has: function(obj) { - return this.get(obj) != null; - }, - - // Get the model at the given index. - at: function(index) { - if (index < 0) index += this.length; - return this.models[index]; - }, - - // Return models with matching attributes. Useful for simple cases of - // `filter`. - where: function(attrs, first) { - return this[first ? 'find' : 'filter'](attrs); - }, - - // Return the first model with matching attributes. Useful for simple cases - // of `find`. - findWhere: function(attrs) { - return this.where(attrs, true); - }, - - // Force the collection to re-sort itself. You don't need to call this under - // normal circumstances, as the set will maintain sort order as each item - // is added. - sort: function(options) { - var comparator = this.comparator; - if (!comparator) throw new Error('Cannot sort a set without a comparator'); - options || (options = {}); - - var length = comparator.length; - if (_.isFunction(comparator)) comparator = _.bind(comparator, this); - - // Run sort based on type of `comparator`. - if (length === 1 || _.isString(comparator)) { - this.models = this.sortBy(comparator); - } else { - this.models.sort(comparator); - } - if (!options.silent) this.trigger('sort', this, options); - return this; - }, - - // Pluck an attribute from each model in the collection. - pluck: function(attr) { - return this.map(attr + ''); - }, - - // Fetch the default set of models for this collection, resetting the - // collection when they arrive. If `reset: true` is passed, the response - // data will be passed through the `reset` method instead of `set`. - fetch: function(options) { - options = _.extend({parse: true}, options); - var success = options.success; - var collection = this; - options.success = function(resp) { - var method = options.reset ? 'reset' : 'set'; - collection[method](resp, options); - if (success) success.call(options.context, collection, resp, options); - collection.trigger('sync', collection, resp, options); - }; - wrapError(this, options); - return this.sync('read', this, options); - }, - - // Create a new instance of a model in this collection. Add the model to the - // collection immediately, unless `wait: true` is passed, in which case we - // wait for the server to agree. - create: function(model, options) { - options = options ? _.clone(options) : {}; - var wait = options.wait; - model = this._prepareModel(model, options); - if (!model) return false; - if (!wait) this.add(model, options); - var collection = this; - var success = options.success; - options.success = function(m, resp, callbackOpts) { - if (wait) collection.add(m, callbackOpts); - if (success) success.call(callbackOpts.context, m, resp, callbackOpts); - }; - model.save(null, options); - return model; - }, - - // **parse** converts a response into a list of models to be added to the - // collection. The default implementation is just to pass it through. - parse: function(resp, options) { - return resp; - }, - - // Create a new collection with an identical list of models as this one. - clone: function() { - return new this.constructor(this.models, { - model: this.model, - comparator: this.comparator - }); - }, - - // Define how to uniquely identify models in the collection. - modelId: function(attrs) { - return attrs[this.model.prototype.idAttribute || 'id']; - }, - - // Private method to reset all internal state. Called when the collection - // is first initialized or reset. - _reset: function() { - this.length = 0; - this.models = []; - this._byId = {}; - }, - - // Prepare a hash of attributes (or other model) to be added to this - // collection. - _prepareModel: function(attrs, options) { - if (this._isModel(attrs)) { - if (!attrs.collection) attrs.collection = this; - return attrs; - } - options = options ? _.clone(options) : {}; - options.collection = this; - var model = new this.model(attrs, options); - if (!model.validationError) return model; - this.trigger('invalid', this, model.validationError, options); - return false; - }, - - // Internal method called by both remove and set. - _removeModels: function(models, options) { - var removed = []; - for (var i = 0; i < models.length; i++) { - var model = this.get(models[i]); - if (!model) continue; - - var index = this.indexOf(model); - this.models.splice(index, 1); - this.length--; - - // Remove references before triggering 'remove' event to prevent an - // infinite loop. #3693 - delete this._byId[model.cid]; - var id = this.modelId(model.attributes); - if (id != null) delete this._byId[id]; - - if (!options.silent) { - options.index = index; - model.trigger('remove', model, this, options); - } - - removed.push(model); - this._removeReference(model, options); - } - return removed; - }, - - // Method for checking whether an object should be considered a model for - // the purposes of adding to the collection. - _isModel: function(model) { - return model instanceof Model; - }, - - // Internal method to create a model's ties to a collection. - _addReference: function(model, options) { - this._byId[model.cid] = model; - var id = this.modelId(model.attributes); - if (id != null) this._byId[id] = model; - model.on('all', this._onModelEvent, this); - }, - - // Internal method to sever a model's ties to a collection. - _removeReference: function(model, options) { - delete this._byId[model.cid]; - var id = this.modelId(model.attributes); - if (id != null) delete this._byId[id]; - if (this === model.collection) delete model.collection; - model.off('all', this._onModelEvent, this); - }, - - // Internal method called every time a model in the set fires an event. - // Sets need to update their indexes when models change ids. All other - // events simply proxy through. "add" and "remove" events that originate - // in other collections are ignored. - _onModelEvent: function(event, model, collection, options) { - if (model) { - if ((event === 'add' || event === 'remove') && collection !== this) return; - if (event === 'destroy') this.remove(model, options); - if (event === 'change') { - var prevId = this.modelId(model.previousAttributes()); - var id = this.modelId(model.attributes); - if (prevId !== id) { - if (prevId != null) delete this._byId[prevId]; - if (id != null) this._byId[id] = model; - } - } - } - this.trigger.apply(this, arguments); - } - - }); - - // Underscore methods that we want to implement on the Collection. - // 90% of the core usefulness of Backbone Collections is actually implemented - // right here: - var collectionMethods = {forEach: 3, each: 3, map: 3, collect: 3, reduce: 0, - foldl: 0, inject: 0, reduceRight: 0, foldr: 0, find: 3, detect: 3, filter: 3, - select: 3, reject: 3, every: 3, all: 3, some: 3, any: 3, include: 3, includes: 3, - contains: 3, invoke: 0, max: 3, min: 3, toArray: 1, size: 1, first: 3, - head: 3, take: 3, initial: 3, rest: 3, tail: 3, drop: 3, last: 3, - without: 0, difference: 0, indexOf: 3, shuffle: 1, lastIndexOf: 3, - isEmpty: 1, chain: 1, sample: 3, partition: 3, groupBy: 3, countBy: 3, - sortBy: 3, indexBy: 3, findIndex: 3, findLastIndex: 3}; - - // Mix in each Underscore method as a proxy to `Collection#models`. - addUnderscoreMethods(Collection, collectionMethods, 'models'); - - // Backbone.View - // ------------- - - // Backbone Views are almost more convention than they are actual code. A View - // is simply a JavaScript object that represents a logical chunk of UI in the - // DOM. This might be a single item, an entire list, a sidebar or panel, or - // even the surrounding frame which wraps your whole app. Defining a chunk of - // UI as a **View** allows you to define your DOM events declaratively, without - // having to worry about render order ... and makes it easy for the view to - // react to specific changes in the state of your models. - - // Creating a Backbone.View creates its initial element outside of the DOM, - // if an existing element is not provided... - var View = Backbone.View = function(options) { - this.cid = _.uniqueId('view'); - _.extend(this, _.pick(options, viewOptions)); - this._ensureElement(); - this.initialize.apply(this, arguments); - }; - - // Cached regex to split keys for `delegate`. - var delegateEventSplitter = /^(\S+)\s*(.*)$/; - - // List of view options to be set as properties. - var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events']; - - // Set up all inheritable **Backbone.View** properties and methods. - _.extend(View.prototype, Events, { - - // The default `tagName` of a View's element is `"div"`. - tagName: 'div', - - // jQuery delegate for element lookup, scoped to DOM elements within the - // current view. This should be preferred to global lookups where possible. - $: function(selector) { - return this.$el.find(selector); - }, - - // Initialize is an empty function by default. Override it with your own - // initialization logic. - initialize: function(){}, - - // **render** is the core function that your view should override, in order - // to populate its element (`this.el`), with the appropriate HTML. The - // convention is for **render** to always return `this`. - render: function() { - return this; - }, - - // Remove this view by taking the element out of the DOM, and removing any - // applicable Backbone.Events listeners. - remove: function() { - this._removeElement(); - this.stopListening(); - return this; - }, - - // Remove this view's element from the document and all event listeners - // attached to it. Exposed for subclasses using an alternative DOM - // manipulation API. - _removeElement: function() { - this.$el.remove(); - }, - - // Change the view's element (`this.el` property) and re-delegate the - // view's events on the new element. - setElement: function(element) { - this.undelegateEvents(); - this._setElement(element); - this.delegateEvents(); - return this; - }, - - // Creates the `this.el` and `this.$el` references for this view using the - // given `el`. `el` can be a CSS selector or an HTML string, a jQuery - // context or an element. Subclasses can override this to utilize an - // alternative DOM manipulation API and are only required to set the - // `this.el` property. - _setElement: function(el) { - this.$el = el instanceof Backbone.$ ? el : Backbone.$(el); - this.el = this.$el[0]; - }, - - // Set callbacks, where `this.events` is a hash of - // - // *{"event selector": "callback"}* - // - // { - // 'mousedown .title': 'edit', - // 'click .button': 'save', - // 'click .open': function(e) { ... } - // } - // - // pairs. Callbacks will be bound to the view, with `this` set properly. - // Uses event delegation for efficiency. - // Omitting the selector binds the event to `this.el`. - delegateEvents: function(events) { - events || (events = _.result(this, 'events')); - if (!events) return this; - this.undelegateEvents(); - for (var key in events) { - var method = events[key]; - if (!_.isFunction(method)) method = this[method]; - if (!method) continue; - var match = key.match(delegateEventSplitter); - this.delegate(match[1], match[2], _.bind(method, this)); - } - return this; - }, - - // Add a single event listener to the view's element (or a child element - // using `selector`). This only works for delegate-able events: not `focus`, - // `blur`, and not `change`, `submit`, and `reset` in Internet Explorer. - delegate: function(eventName, selector, listener) { - this.$el.on(eventName + '.delegateEvents' + this.cid, selector, listener); - return this; - }, - - // Clears all callbacks previously bound to the view by `delegateEvents`. - // You usually don't need to use this, but may wish to if you have multiple - // Backbone views attached to the same DOM element. - undelegateEvents: function() { - if (this.$el) this.$el.off('.delegateEvents' + this.cid); - return this; - }, - - // A finer-grained `undelegateEvents` for removing a single delegated event. - // `selector` and `listener` are both optional. - undelegate: function(eventName, selector, listener) { - this.$el.off(eventName + '.delegateEvents' + this.cid, selector, listener); - return this; - }, - - // Produces a DOM element to be assigned to your view. Exposed for - // subclasses using an alternative DOM manipulation API. - _createElement: function(tagName) { - return document.createElement(tagName); - }, - - // Ensure that the View has a DOM element to render into. - // If `this.el` is a string, pass it through `$()`, take the first - // matching element, and re-assign it to `el`. Otherwise, create - // an element from the `id`, `className` and `tagName` properties. - _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'); - this.setElement(this._createElement(_.result(this, 'tagName'))); - this._setAttributes(attrs); - } else { - this.setElement(_.result(this, 'el')); - } - }, - - // Set attributes from a hash on this view's element. Exposed for - // subclasses using an alternative DOM manipulation API. - _setAttributes: function(attributes) { - this.$el.attr(attributes); - } - - }); - - // Backbone.sync - // ------------- - - // Override this function to change the manner in which Backbone persists - // models to the server. You will be passed the type of request, and the - // model in question. By default, makes a RESTful Ajax request - // to the model's `url()`. Some possible customizations could be: - // - // * Use `setTimeout` to batch rapid-fire updates into a single request. - // * Send up the models as XML instead of JSON. - // * Persist models via WebSockets instead of Ajax. - // - // Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests - // as `POST`, with a `_method` parameter containing the true HTTP method, - // as well as all requests with the body as `application/x-www-form-urlencoded` - // instead of `application/json` with the model in a param named `model`. - // Useful when interfacing with server-side languages like **PHP** that make - // it difficult to read the body of `PUT` requests. - Backbone.sync = function(method, model, options) { - var type = methodMap[method]; - - // Default options, unless specified. - _.defaults(options || (options = {}), { - emulateHTTP: Backbone.emulateHTTP, - emulateJSON: Backbone.emulateJSON - }); - - // Default JSON-request options. - var params = {type: type, dataType: 'json'}; - - // Ensure that we have a URL. - if (!options.url) { - params.url = _.result(model, 'url') || urlError(); - } - - // Ensure that we have the appropriate request data. - if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) { - params.contentType = 'application/json'; - params.data = JSON.stringify(options.attrs || model.toJSON(options)); - } - - // For older servers, emulate JSON by encoding the request into an HTML-form. - if (options.emulateJSON) { - params.contentType = 'application/x-www-form-urlencoded'; - params.data = params.data ? {model: params.data} : {}; - } - - // For older servers, emulate HTTP by mimicking the HTTP method with `_method` - // And an `X-HTTP-Method-Override` header. - if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) { - params.type = 'POST'; - if (options.emulateJSON) params.data._method = type; - var beforeSend = options.beforeSend; - options.beforeSend = function(xhr) { - xhr.setRequestHeader('X-HTTP-Method-Override', type); - if (beforeSend) return beforeSend.apply(this, arguments); - }; - } - - // Don't process data on a non-GET request. - if (params.type !== 'GET' && !options.emulateJSON) { - params.processData = false; - } - - // Pass along `textStatus` and `errorThrown` from jQuery. - var error = options.error; - options.error = function(xhr, textStatus, errorThrown) { - options.textStatus = textStatus; - options.errorThrown = errorThrown; - if (error) error.call(options.context, xhr, textStatus, errorThrown); - }; - - // Make the request, allowing the user to override any Ajax options. - var xhr = options.xhr = Backbone.ajax(_.extend(params, options)); - model.trigger('request', model, xhr, options); - return xhr; - }; - - // Map from CRUD to HTTP for our default `Backbone.sync` implementation. - var methodMap = { - 'create': 'POST', - 'update': 'PUT', - 'patch': 'PATCH', - 'delete': 'DELETE', - 'read': 'GET' - }; - - // Set the default implementation of `Backbone.ajax` to proxy through to `$`. - // Override this if you'd like to use a different library. - Backbone.ajax = function() { - return Backbone.$.ajax.apply(Backbone.$, arguments); - }; - - // Backbone.Router - // --------------- - - // Routers map faux-URLs to actions, and fire events when routes are - // matched. Creating a new one sets its `routes` hash, if not set statically. - var Router = Backbone.Router = function(options) { - options || (options = {}); - if (options.routes) this.routes = options.routes; - this._bindRoutes(); - this.initialize.apply(this, arguments); - }; - - // Cached regular expressions for matching named param parts and splatted - // parts of route strings. - var optionalParam = /\((.*?)\)/g; - var namedParam = /(\(\?)?:\w+/g; - var splatParam = /\*\w+/g; - var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g; - - // Set up all inheritable **Backbone.Router** properties and methods. - _.extend(Router.prototype, Events, { - - // Initialize is an empty function by default. Override it with your own - // initialization logic. - initialize: function(){}, - - // Manually bind a single named route to a callback. For example: - // - // this.route('search/:query/p:num', 'search', function(query, num) { - // ... - // }); - // - route: function(route, name, callback) { - if (!_.isRegExp(route)) route = this._routeToRegExp(route); - if (_.isFunction(name)) { - callback = name; - name = ''; - } - if (!callback) callback = this[name]; - var router = this; - Backbone.history.route(route, function(fragment) { - var args = router._extractParameters(route, fragment); - if (router.execute(callback, args, name) !== false) { - router.trigger.apply(router, ['route:' + name].concat(args)); - router.trigger('route', name, args); - Backbone.history.trigger('route', router, name, args); - } - }); - return this; - }, - - // Execute a route handler with the provided parameters. This is an - // excellent place to do pre-route setup or post-route cleanup. - execute: function(callback, args, name) { - if (callback) callback.apply(this, args); - }, - - // Simple proxy to `Backbone.history` to save a fragment into the history. - navigate: function(fragment, options) { - Backbone.history.navigate(fragment, options); - return this; - }, - - // Bind all defined routes to `Backbone.history`. We have to reverse the - // order of the routes here to support behavior where the most general - // routes can be defined at the bottom of the route map. - _bindRoutes: function() { - if (!this.routes) return; - this.routes = _.result(this, 'routes'); - var route, routes = _.keys(this.routes); - while ((route = routes.pop()) != null) { - this.route(route, this.routes[route]); - } - }, - - // Convert a route string into a regular expression, suitable for matching - // against the current location hash. - _routeToRegExp: function(route) { - route = route.replace(escapeRegExp, '\\$&') - .replace(optionalParam, '(?:$1)?') - .replace(namedParam, function(match, optional) { - return optional ? match : '([^/?]+)'; - }) - .replace(splatParam, '([^?]*?)'); - return new RegExp('^' + route + '(?:\\?([\\s\\S]*))?$'); - }, - - // Given a route, and a URL fragment that it matches, return the array of - // extracted decoded parameters. Empty or unmatched parameters will be - // treated as `null` to normalize cross-browser behavior. - _extractParameters: function(route, fragment) { - var params = route.exec(fragment).slice(1); - return _.map(params, function(param, i) { - // Don't decode the search params. - if (i === params.length - 1) return param || null; - return param ? decodeURIComponent(param) : null; - }); - } - - }); - - // Backbone.History - // ---------------- - - // Handles cross-browser history management, based on either - // [pushState](http://diveintohtml5.info/history.html) and real URLs, or - // [onhashchange](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange) - // and URL fragments. If the browser supports neither (old IE, natch), - // falls back to polling. - var History = Backbone.History = function() { - this.handlers = []; - this.checkUrl = _.bind(this.checkUrl, this); - - // Ensure that `History` can be used outside of the browser. - if (typeof window !== 'undefined') { - this.location = window.location; - this.history = window.history; - } - }; - - // Cached regex for stripping a leading hash/slash and trailing space. - var routeStripper = /^[#\/]|\s+$/g; - - // Cached regex for stripping leading and trailing slashes. - var rootStripper = /^\/+|\/+$/g; - - // Cached regex for stripping urls of hash. - var pathStripper = /#.*$/; - - // Has the history handling already been started? - History.started = false; - - // Set up all inheritable **Backbone.History** properties and methods. - _.extend(History.prototype, Events, { - - // The default interval to poll for hash changes, if necessary, is - // twenty times a second. - interval: 50, - - // Are we at the app root? - atRoot: function() { - var path = this.location.pathname.replace(/[^\/]$/, '$&/'); - return path === this.root && !this.getSearch(); - }, - - // Does the pathname match the root? - matchRoot: function() { - var path = this.decodeFragment(this.location.pathname); - var rootPath = path.slice(0, this.root.length - 1) + '/'; - return rootPath === this.root; - }, - - // Unicode characters in `location.pathname` are percent encoded so they're - // decoded for comparison. `%25` should not be decoded since it may be part - // of an encoded parameter. - decodeFragment: function(fragment) { - return decodeURI(fragment.replace(/%25/g, '%2525')); - }, - - // In IE6, the hash fragment and search params are incorrect if the - // fragment contains `?`. - getSearch: function() { - var match = this.location.href.replace(/#.*/, '').match(/\?.+/); - return match ? match[0] : ''; - }, - - // Gets the true hash value. Cannot use location.hash directly due to bug - // in Firefox where location.hash will always be decoded. - getHash: function(window) { - var match = (window || this).location.href.match(/#(.*)$/); - return match ? match[1] : ''; - }, - - // Get the pathname and search params, without the root. - getPath: function() { - var path = this.decodeFragment( - this.location.pathname + this.getSearch() - ).slice(this.root.length - 1); - return path.charAt(0) === '/' ? path.slice(1) : path; - }, - - // Get the cross-browser normalized URL fragment from the path or hash. - getFragment: function(fragment) { - if (fragment == null) { - if (this._usePushState || !this._wantsHashChange) { - fragment = this.getPath(); - } else { - fragment = this.getHash(); - } - } - return fragment.replace(routeStripper, ''); - }, - - // Start the hash change handling, returning `true` if the current URL matches - // an existing route, and `false` otherwise. - start: function(options) { - if (History.started) throw new Error('Backbone.history has already been started'); - History.started = true; - - // Figure out the initial configuration. Do we need an iframe? - // Is pushState desired ... is it available? - this.options = _.extend({root: '/'}, this.options, options); - this.root = this.options.root; - this._wantsHashChange = this.options.hashChange !== false; - this._hasHashChange = 'onhashchange' in window && (document.documentMode === void 0 || document.documentMode > 7); - this._useHashChange = this._wantsHashChange && this._hasHashChange; - this._wantsPushState = !!this.options.pushState; - this._hasPushState = !!(this.history && this.history.pushState); - this._usePushState = this._wantsPushState && this._hasPushState; - this.fragment = this.getFragment(); - - // Normalize root to always include a leading and trailing slash. - this.root = ('/' + this.root + '/').replace(rootStripper, '/'); - - // Transition from hashChange to pushState or vice versa if both are - // requested. - if (this._wantsHashChange && this._wantsPushState) { - - // If we've started off with a route from a `pushState`-enabled - // browser, but we're currently in a browser that doesn't support it... - if (!this._hasPushState && !this.atRoot()) { - var rootPath = this.root.slice(0, -1) || '/'; - this.location.replace(rootPath + '#' + this.getPath()); - // Return immediately as browser will do redirect to new url - return true; - - // Or if we've started out with a hash-based route, but we're currently - // in a browser where it could be `pushState`-based instead... - } else if (this._hasPushState && this.atRoot()) { - this.navigate(this.getHash(), {replace: true}); - } - - } - - // Proxy an iframe to handle location events if the browser doesn't - // support the `hashchange` event, HTML5 history, or the user wants - // `hashChange` but not `pushState`. - if (!this._hasHashChange && this._wantsHashChange && !this._usePushState) { - this.iframe = document.createElement('iframe'); - this.iframe.src = 'javascript:0'; - this.iframe.style.display = 'none'; - this.iframe.tabIndex = -1; - var body = document.body; - // Using `appendChild` will throw on IE < 9 if the document is not ready. - var iWindow = body.insertBefore(this.iframe, body.firstChild).contentWindow; - iWindow.document.open(); - iWindow.document.close(); - iWindow.location.hash = '#' + this.fragment; - } - - // Add a cross-platform `addEventListener` shim for older browsers. - var addEventListener = window.addEventListener || function(eventName, listener) { - return attachEvent('on' + eventName, listener); - }; - - // Depending on whether we're using pushState or hashes, and whether - // 'onhashchange' is supported, determine how we check the URL state. - if (this._usePushState) { - addEventListener('popstate', this.checkUrl, false); - } else if (this._useHashChange && !this.iframe) { - addEventListener('hashchange', this.checkUrl, false); - } else if (this._wantsHashChange) { - this._checkUrlInterval = setInterval(this.checkUrl, this.interval); - } - - if (!this.options.silent) return this.loadUrl(); - }, - - // Disable Backbone.history, perhaps temporarily. Not useful in a real app, - // but possibly useful for unit testing Routers. - stop: function() { - // Add a cross-platform `removeEventListener` shim for older browsers. - var removeEventListener = window.removeEventListener || function(eventName, listener) { - return detachEvent('on' + eventName, listener); - }; - - // Remove window listeners. - if (this._usePushState) { - removeEventListener('popstate', this.checkUrl, false); - } else if (this._useHashChange && !this.iframe) { - removeEventListener('hashchange', this.checkUrl, false); - } - - // Clean up the iframe if necessary. - if (this.iframe) { - document.body.removeChild(this.iframe); - this.iframe = null; - } - - // Some environments will throw when clearing an undefined interval. - if (this._checkUrlInterval) clearInterval(this._checkUrlInterval); - History.started = false; - }, - - // Add a route to be tested when the fragment changes. Routes added later - // may override previous routes. - route: function(route, callback) { - this.handlers.unshift({route: route, callback: callback}); - }, - - // Checks the current URL to see if it has changed, and if it has, - // calls `loadUrl`, normalizing across the hidden iframe. - checkUrl: function(e) { - var current = this.getFragment(); - - // If the user pressed the back button, the iframe's hash will have - // changed and we should use that for comparison. - if (current === this.fragment && this.iframe) { - current = this.getHash(this.iframe.contentWindow); - } - - if (current === this.fragment) return false; - if (this.iframe) this.navigate(current); - this.loadUrl(); - }, - - // Attempt to load the current URL fragment. If a route succeeds with a - // match, returns `true`. If no defined routes matches the fragment, - // returns `false`. - loadUrl: function(fragment) { - // If the root doesn't match, no routes can match either. - if (!this.matchRoot()) return false; - fragment = this.fragment = this.getFragment(fragment); - return _.some(this.handlers, function(handler) { - if (handler.route.test(fragment)) { - handler.callback(fragment); - return true; - } - }); - }, - - // Save a fragment into the hash history, or replace the URL state if the - // 'replace' option is passed. You are responsible for properly URL-encoding - // the fragment in advance. - // - // The options object can contain `trigger: true` if you wish to have the - // route callback be fired (not usually desirable), or `replace: true`, if - // you wish to modify the current URL without adding an entry to the history. - navigate: function(fragment, options) { - if (!History.started) return false; - if (!options || options === true) options = {trigger: !!options}; - - // Normalize the fragment. - fragment = this.getFragment(fragment || ''); - - // Don't include a trailing slash on the root. - var rootPath = this.root; - if (fragment === '' || fragment.charAt(0) === '?') { - rootPath = rootPath.slice(0, -1) || '/'; - } - var url = rootPath + fragment; - - // Strip the hash and decode for matching. - fragment = this.decodeFragment(fragment.replace(pathStripper, '')); - - if (this.fragment === fragment) return; - this.fragment = fragment; - - // If pushState is available, we use it to set the fragment as a real URL. - if (this._usePushState) { - this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url); - - // If hash changes haven't been explicitly disabled, update the hash - // fragment to store history. - } else if (this._wantsHashChange) { - this._updateHash(this.location, fragment, options.replace); - if (this.iframe && fragment !== this.getHash(this.iframe.contentWindow)) { - var iWindow = this.iframe.contentWindow; - - // Opening and closing the iframe tricks IE7 and earlier to push a - // history entry on hash-tag change. When replace is true, we don't - // want this. - if (!options.replace) { - iWindow.document.open(); - iWindow.document.close(); - } - - this._updateHash(iWindow.location, fragment, options.replace); - } - - // If you've told us that you explicitly don't want fallback hashchange- - // based history, then `navigate` becomes a page refresh. - } else { - return this.location.assign(url); - } - if (options.trigger) return this.loadUrl(fragment); - }, - - // Update the hash location, either replacing the current entry, or adding - // a new one to the browser history. - _updateHash: function(location, fragment, replace) { - if (replace) { - var href = location.href.replace(/(javascript:|#).*$/, ''); - location.replace(href + '#' + fragment); - } else { - // Some browsers require that `hash` contains a leading #. - location.hash = '#' + fragment; - } - } - - }); - - // Create the default Backbone.history. - Backbone.history = new History; - - // Helpers - // ------- - - // 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. - var extend = function(protoProps, staticProps) { - var parent = this; - 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 constructor. - if (protoProps && _.has(protoProps, 'constructor')) { - child = protoProps.constructor; - } else { - child = function(){ return parent.apply(this, arguments); }; - } - - // Add static properties to the constructor function, if supplied. - _.extend(child, parent, staticProps); - - // Set the prototype chain to inherit from `parent`, without calling - // `parent`'s constructor function and add the prototype properties. - child.prototype = _.create(parent.prototype, protoProps); - child.prototype.constructor = child; - - // Set a convenience property in case the parent's prototype is needed - // later. - child.__super__ = parent.prototype; - - return child; - }; - - // Set up inheritance for the model, collection, router, view and history. - Model.extend = Collection.extend = Router.extend = View.extend = History.extend = extend; - - // Throw an error when a URL is needed, and none is supplied. - var urlError = function() { - throw new Error('A "url" property or function must be specified'); - }; - - // Wrap an optional error callback with a fallback error event. - var wrapError = function(model, options) { - var error = options.error; - options.error = function(resp) { - if (error) error.call(options.context, model, resp, options); - model.trigger('error', model, resp, options); - }; - }; - - return Backbone; -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{"jquery":299,"underscore":553}],81:[function(require,module,exports){ -'use strict' - -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray - -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - -function init () { - var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' - for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i - } - - revLookup['-'.charCodeAt(0)] = 62 - revLookup['_'.charCodeAt(0)] = 63 -} - -init() - -function toByteArray (b64) { - var i, j, l, tmp, placeHolders, arr - var len = b64.length - - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // the number of equal signs (place holders) - // if there are two placeholders, than the two characters before it - // represent one byte - // if there is only one, then the three characters before it represent 2 bytes - // this is just a cheap hack to not do indexOf twice - placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0 - - // base64 is 4/3 + up to two characters of the original data - arr = new Arr(len * 3 / 4 - placeHolders) - - // if there are placeholders, only get up to the last complete 4 chars - l = placeHolders > 0 ? len - 4 : len - - var L = 0 - - for (i = 0, j = 0; i < l; i += 4, j += 3) { - tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] - arr[L++] = (tmp >> 16) & 0xFF - arr[L++] = (tmp >> 8) & 0xFF - arr[L++] = tmp & 0xFF - } - - if (placeHolders === 2) { - tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[L++] = tmp & 0xFF - } else if (placeHolders === 1) { - tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[L++] = (tmp >> 8) & 0xFF - arr[L++] = tmp & 0xFF - } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var output = '' - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - output += lookup[tmp >> 2] - output += lookup[(tmp << 4) & 0x3F] - output += '==' - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + (uint8[len - 1]) - output += lookup[tmp >> 10] - output += lookup[(tmp >> 4) & 0x3F] - output += lookup[(tmp << 2) & 0x3F] - output += '=' - } - - parts.push(output) - - return parts.join('') -} - -},{}],82:[function(require,module,exports){ -module.exports = function blacklist (src) { - var copy = {} - var filter = arguments[1] - - if (typeof filter === 'string') { - filter = {} - for (var i = 1; i < arguments.length; i++) { - filter[arguments[i]] = true - } - } - - for (var key in src) { - // blacklist? - if (filter[key]) continue - - copy[key] = src[key] - } - - return copy -} - -},{}],83:[function(require,module,exports){ - -},{}],84:[function(require,module,exports){ -(function (global){ -'use strict'; - -var buffer = require('buffer'); -var Buffer = buffer.Buffer; -var SlowBuffer = buffer.SlowBuffer; -var MAX_LEN = buffer.kMaxLength || 2147483647; -exports.alloc = function alloc(size, fill, encoding) { - if (typeof Buffer.alloc === 'function') { - return Buffer.alloc(size, fill, encoding); - } - if (typeof encoding === 'number') { - throw new TypeError('encoding must not be number'); - } - if (typeof size !== 'number') { - throw new TypeError('size must be a number'); - } - if (size > MAX_LEN) { - throw new RangeError('size is too large'); - } - var enc = encoding; - var _fill = fill; - if (_fill === undefined) { - enc = undefined; - _fill = 0; - } - var buf = new Buffer(size); - if (typeof _fill === 'string') { - var fillBuf = new Buffer(_fill, enc); - var flen = fillBuf.length; - var i = -1; - while (++i < size) { - buf[i] = fillBuf[i % flen]; - } - } else { - buf.fill(_fill); - } - return buf; -} -exports.allocUnsafe = function allocUnsafe(size) { - if (typeof Buffer.allocUnsafe === 'function') { - return Buffer.allocUnsafe(size); - } - if (typeof size !== 'number') { - throw new TypeError('size must be a number'); - } - if (size > MAX_LEN) { - throw new RangeError('size is too large'); - } - return new Buffer(size); -} -exports.from = function from(value, encodingOrOffset, length) { - if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) { - return Buffer.from(value, encodingOrOffset, length); - } - if (typeof value === 'number') { - throw new TypeError('"value" argument must not be a number'); - } - if (typeof value === 'string') { - return new Buffer(value, encodingOrOffset); - } - if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { - var offset = encodingOrOffset; - if (arguments.length === 1) { - return new Buffer(value); - } - if (typeof offset === 'undefined') { - offset = 0; - } - var len = length; - if (typeof len === 'undefined') { - len = value.byteLength - offset; - } - if (offset >= value.byteLength) { - throw new RangeError('\'offset\' is out of bounds'); - } - if (len > value.byteLength - offset) { - throw new RangeError('\'length\' is out of bounds'); - } - return new Buffer(value.slice(offset, offset + len)); - } - if (Buffer.isBuffer(value)) { - var out = new Buffer(value.length); - value.copy(out, 0, 0, value.length); - return out; - } - if (value) { - if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) { - return new Buffer(value); - } - if (value.type === 'Buffer' && Array.isArray(value.data)) { - return new Buffer(value.data); - } - } - - throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.'); -} -exports.allocUnsafeSlow = function allocUnsafeSlow(size) { - if (typeof Buffer.allocUnsafeSlow === 'function') { - return Buffer.allocUnsafeSlow(size); - } - if (typeof size !== 'number') { - throw new TypeError('size must be a number'); - } - if (size >= MAX_LEN) { - throw new RangeError('size is too large'); - } - return new SlowBuffer(size); -} - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{"buffer":85}],85:[function(require,module,exports){ -(function (global){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - -'use strict' - -var base64 = require('base64-js') -var ieee754 = require('ieee754') -var isArray = require('isarray') - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Use Object implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * Due to various browser bugs, sometimes the Object implementation will be used even - * when the browser supports typed arrays. - * - * Note: - * - * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, - * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. - * - * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. - * - * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of - * incorrect length in some situations. - - * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they - * get the Object implementation, which is slower but behaves correctly. - */ -Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined - ? global.TYPED_ARRAY_SUPPORT - : typedArraySupport() - -/* - * Export kMaxLength after typed array support is determined. - */ -exports.kMaxLength = kMaxLength() - -function typedArraySupport () { - try { - var arr = new Uint8Array(1) - arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} - return arr.foo() === 42 && // typed array instances can be augmented - typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` - arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` - } catch (e) { - return false - } -} - -function kMaxLength () { - return Buffer.TYPED_ARRAY_SUPPORT - ? 0x7fffffff - : 0x3fffffff -} - -function createBuffer (that, length) { - if (kMaxLength() < length) { - throw new RangeError('Invalid typed array length') - } - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = new Uint8Array(length) - that.__proto__ = Buffer.prototype - } else { - // Fallback: Return an object instance of the Buffer class - if (that === null) { - that = new Buffer(length) - } - that.length = length - } - - return that -} - -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - -function Buffer (arg, encodingOrOffset, length) { - if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { - return new Buffer(arg, encodingOrOffset, length) - } - - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new Error( - 'If encoding is specified then the first argument must be a string' - ) - } - return allocUnsafe(this, arg) - } - return from(this, arg, encodingOrOffset, length) -} - -Buffer.poolSize = 8192 // not used by this implementation - -// TODO: Legacy, not needed anymore. Remove in next major version. -Buffer._augment = function (arr) { - arr.__proto__ = Buffer.prototype - return arr -} - -function from (that, value, encodingOrOffset, length) { - if (typeof value === 'number') { - throw new TypeError('"value" argument must not be a number') - } - - if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { - return fromArrayBuffer(that, value, encodingOrOffset, length) - } - - if (typeof value === 'string') { - return fromString(that, value, encodingOrOffset) - } - - return fromObject(that, value) -} - -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(null, value, encodingOrOffset, length) -} - -if (Buffer.TYPED_ARRAY_SUPPORT) { - Buffer.prototype.__proto__ = Uint8Array.prototype - Buffer.__proto__ = Uint8Array - if (typeof Symbol !== 'undefined' && Symbol.species && - Buffer[Symbol.species] === Buffer) { - // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true - }) - } -} - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be a number') - } -} - -function alloc (that, size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(that, size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpretted as a start offset. - return typeof encoding === 'string' - ? createBuffer(that, size).fill(fill, encoding) - : createBuffer(that, size).fill(fill) - } - return createBuffer(that, size) -} - -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(null, size, fill, encoding) -} - -function allocUnsafe (that, size) { - assertSize(size) - that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) { - for (var i = 0; i < size; ++i) { - that[i] = 0 - } - } - return that -} - -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(null, size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(null, size) -} - -function fromString (that, string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('"encoding" must be a valid string encoding') - } - - var length = byteLength(string, encoding) | 0 - that = createBuffer(that, length) - - var actual = that.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - that = that.slice(0, actual) - } - - return that -} - -function fromArrayLike (that, array) { - var length = checked(array.length) | 0 - that = createBuffer(that, length) - for (var i = 0; i < length; i += 1) { - that[i] = array[i] & 255 - } - return that -} - -function fromArrayBuffer (that, array, byteOffset, length) { - array.byteLength // this throws if `array` is not a valid ArrayBuffer - - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('\'offset\' is out of bounds') - } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('\'length\' is out of bounds') - } - - if (byteOffset === undefined && length === undefined) { - array = new Uint8Array(array) - } else if (length === undefined) { - array = new Uint8Array(array, byteOffset) - } else { - array = new Uint8Array(array, byteOffset, length) - } - - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = array - that.__proto__ = Buffer.prototype - } else { - // Fallback: Return an object instance of the Buffer class - that = fromArrayLike(that, array) - } - return that -} - -function fromObject (that, obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - that = createBuffer(that, len) - - if (that.length === 0) { - return that - } - - obj.copy(that, 0, 0, len) - return that - } - - if (obj) { - if ((typeof ArrayBuffer !== 'undefined' && - obj.buffer instanceof ArrayBuffer) || 'length' in obj) { - if (typeof obj.length !== 'number' || isnan(obj.length)) { - return createBuffer(that, 0) - } - return fromArrayLike(that, obj) - } - - if (obj.type === 'Buffer' && isArray(obj.data)) { - return fromArrayLike(that, obj.data) - } - } - - throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') -} - -function checked (length) { - // Note: cannot use `length < kMaxLength` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= kMaxLength()) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + kMaxLength().toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} - -Buffer.isBuffer = function isBuffer (b) { - return !!(b != null && b._isBuffer) -} - -Buffer.compare = function compare (a, b) { - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError('Arguments must be Buffers') - } - - if (a === b) return 0 - - var x = a.length - var y = b.length - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } - - var buffer = Buffer.allocUnsafe(length) - var pos = 0 - for (i = 0; i < list.length; ++i) { - var buf = list[i] - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && - (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - string = '' + string - } - - var len = string.length - if (len === 0) return 0 - - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - case undefined: - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) return utf8ToBytes(string).length // assume utf8 - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -function slowToString (encoding, start, end) { - var loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coersion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect -// Buffer instances. -Buffer.prototype._isBuffer = true - -function swap (b, n, m) { - var i = b[n] - b[n] = b[m] - b[m] = i -} - -Buffer.prototype.swap16 = function swap16 () { - var len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} - -Buffer.prototype.swap32 = function swap32 () { - var len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this -} - -Buffer.prototype.swap64 = function swap64 () { - var len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this -} - -Buffer.prototype.toString = function toString () { - var length = this.length | 0 - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - if (this.length > 0) { - str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') - if (this.length > max) str += ' ... ' - } - return '' -} - -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (!Buffer.isBuffer(target)) { - throw new TypeError('Argument must be a Buffer') - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length - } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } - - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 - } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) - - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) - - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (isNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (Buffer.TYPED_ARRAY_SUPPORT && - typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') -} - -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 - } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } - } - - var i - if (dir) { - var foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - var found = true - for (var j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } - - return -1 -} - -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} - -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - // must be an even number of digits - var strLen = string.length - if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') - - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (isNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset | 0 - if (isFinite(length)) { - length = length | 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - // legacy write(string, encoding, offset, length) - remove in v0.13 - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - return asciiWrite(this, string, offset, length) - - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] - - var i = start - while (i < end) { - var firstByte = buf[i] - var codePoint = null - var bytesPerSequence = (firstByte > 0xEF) ? 4 - : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -var MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - var res = '' - var i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function latin1Slice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - var len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - var out = '' - for (var i = start; i < end; ++i) { - out += toHex(buf[i]) - } - return out -} - -function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - var newBuf - if (Buffer.TYPED_ARRAY_SUPPORT) { - newBuf = this.subarray(start, end) - newBuf.__proto__ = Buffer.prototype - } else { - var sliceLen = end - start - newBuf = new Buffer(sliceLen, undefined) - for (var i = 0; i < sliceLen; ++i) { - newBuf[i] = this[i + start] - } - } - - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} - -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - this[offset] = (value & 0xff) - return offset + 1 -} - -function objectWriteUInt16 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { - buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> - (littleEndian ? i : 1 - i) * 8 - } -} - -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -function objectWriteUInt32 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffffffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { - buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff - } -} - -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = 0 - var mul = 1 - var sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = byteLength - 1 - var mul = 1 - var sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - var len = end - start - var i - - if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { - // ascending copy from start - for (i = 0; i < len; ++i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, start + len), - targetStart - ) - } - - return len -} - -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if (code < 256) { - val = code - } - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - } else if (typeof val === 'number') { - val = val & 255 - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - var i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - var bytes = Buffer.isBuffer(val) - ? val - : utf8ToBytes(new Buffer(val, encoding).toString()) - var len = bytes.length - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this -} - -// HELPER FUNCTIONS -// ================ - -var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = stringtrim(str).replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function stringtrim (str) { - if (str.trim) return str.trim() - return str.replace(/^\s+|\s+$/g, '') -} - -function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) -} - -function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] - - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -function isnan (val) { - return val !== val // eslint-disable-line no-self-compare -} - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{"base64-js":81,"ieee754":293,"isarray":298}],86:[function(require,module,exports){ -/*! - Copyright (c) 2016 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames -*/ -/* global define */ - -(function () { - 'use strict'; - - var hasOwn = {}.hasOwnProperty; - - function classNames () { - var classes = []; - - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; - if (!arg) continue; - - var argType = typeof arg; - - if (argType === 'string' || argType === 'number') { - classes.push(arg); - } else if (Array.isArray(arg)) { - classes.push(classNames.apply(null, arg)); - } else if (argType === 'object') { - for (var key in arg) { - if (hasOwn.call(arg, key) && arg[key]) { - classes.push(key); - } - } - } - } - - return classes.join(' '); - } - - if (typeof module !== 'undefined' && module.exports) { - module.exports = classNames; - } else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) { - // register as 'classnames', consistent with npm package name - define('classnames', [], function () { - return classNames; - }); - } else { - window.classNames = classNames; - } -}()); - -},{}],87:[function(require,module,exports){ -(function (Buffer){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. - -function isArray(arg) { - if (Array.isArray) { - return Array.isArray(arg); - } - return objectToString(arg) === '[object Array]'; -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = Buffer.isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - -}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) - -},{"../../is-buffer/index.js":297}],88:[function(require,module,exports){ -var pSlice = Array.prototype.slice; -var objectKeys = require('./lib/keys.js'); -var isArguments = require('./lib/is_arguments.js'); - -var deepEqual = module.exports = function (actual, expected, opts) { - if (!opts) opts = {}; - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - - } else if (actual instanceof Date && expected instanceof Date) { - return actual.getTime() === expected.getTime(); - - // 7.3. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') { - return opts.strict ? actual === expected : actual == expected; - - // 7.4. For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return objEquiv(actual, expected, opts); - } -} - -function isUndefinedOrNull(value) { - return value === null || value === undefined; -} - -function isBuffer (x) { - if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false; - if (typeof x.copy !== 'function' || typeof x.slice !== 'function') { - return false; - } - if (x.length > 0 && typeof x[0] !== 'number') return false; - return true; -} - -function objEquiv(a, b, opts) { - var i, key; - if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) - return false; - // an identical 'prototype' property. - if (a.prototype !== b.prototype) return false; - //~~~I've managed to break Object.keys through screwy arguments passing. - // Converting to array solves the problem. - if (isArguments(a)) { - if (!isArguments(b)) { - return false; - } - a = pSlice.call(a); - b = pSlice.call(b); - return deepEqual(a, b, opts); - } - if (isBuffer(a)) { - if (!isBuffer(b)) { - return false; - } - if (a.length !== b.length) return false; - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) return false; - } - return true; - } - try { - var ka = objectKeys(a), - kb = objectKeys(b); - } catch (e) {//happens when one is a string literal and the other isn't - return false; - } - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length != kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!deepEqual(a[key], b[key], opts)) return false; - } - return typeof a === typeof b; -} - -},{"./lib/is_arguments.js":89,"./lib/keys.js":90}],89:[function(require,module,exports){ -var supportsArgumentsClass = (function(){ - return Object.prototype.toString.call(arguments) -})() == '[object Arguments]'; - -exports = module.exports = supportsArgumentsClass ? supported : unsupported; - -exports.supported = supported; -function supported(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -}; - -exports.unsupported = unsupported; -function unsupported(object){ - return object && - typeof object == 'object' && - typeof object.length == 'number' && - Object.prototype.hasOwnProperty.call(object, 'callee') && - !Object.prototype.propertyIsEnumerable.call(object, 'callee') || - false; -}; - -},{}],90:[function(require,module,exports){ -exports = module.exports = typeof Object.keys === 'function' - ? Object.keys : shim; - -exports.shim = shim; -function shim (obj) { - var keys = []; - for (var key in obj) keys.push(key); - return keys; -} - -},{}],91:[function(require,module,exports){ -/* - Module dependencies -*/ -var ElementType = require('domelementtype'); -var entities = require('entities'); - -/* - Boolean Attributes -*/ -var booleanAttributes = { - __proto__: null, - allowfullscreen: true, - async: true, - autofocus: true, - autoplay: true, - checked: true, - controls: true, - default: true, - defer: true, - disabled: true, - hidden: true, - ismap: true, - loop: true, - multiple: true, - muted: true, - open: true, - readonly: true, - required: true, - reversed: true, - scoped: true, - seamless: true, - selected: true, - typemustmatch: true -}; - -var unencodedElements = { - __proto__: null, - style: true, - script: true, - xmp: true, - iframe: true, - noembed: true, - noframes: true, - plaintext: true, - noscript: true -}; - -/* - Format attributes -*/ -function formatAttrs(attributes, opts) { - if (!attributes) return; - - var output = '', - value; - - // Loop through the attributes - for (var key in attributes) { - value = attributes[key]; - if (output) { - output += ' '; - } - - if (!value && booleanAttributes[key]) { - output += key; - } else { - output += key + '="' + (opts.decodeEntities ? entities.encodeXML(value) : value) + '"'; - } - } - - return output; -} - -/* - Self-enclosing tags (stolen from node-htmlparser) -*/ -var singleTag = { - __proto__: null, - area: true, - base: true, - basefont: true, - br: true, - col: true, - command: true, - embed: true, - frame: true, - hr: true, - img: true, - input: true, - isindex: true, - keygen: true, - link: true, - meta: true, - param: true, - source: true, - track: true, - wbr: true, -}; - - -var render = module.exports = function(dom, opts) { - if (!Array.isArray(dom) && !dom.cheerio) dom = [dom]; - opts = opts || {}; - - var output = ''; - - for(var i = 0; i < dom.length; i++){ - var elem = dom[i]; - - if (elem.type === 'root') - output += render(elem.children, opts); - else if (ElementType.isTag(elem)) - output += renderTag(elem, opts); - else if (elem.type === ElementType.Directive) - output += renderDirective(elem); - else if (elem.type === ElementType.Comment) - output += renderComment(elem); - else if (elem.type === ElementType.CDATA) - output += renderCdata(elem); - else - output += renderText(elem, opts); - } - - return output; -}; - -function renderTag(elem, opts) { - // Handle SVG - if (elem.name === "svg") opts = {decodeEntities: opts.decodeEntities, xmlMode: true}; - - var tag = '<' + elem.name, - attribs = formatAttrs(elem.attribs, opts); - - if (attribs) { - tag += ' ' + attribs; - } - - if ( - opts.xmlMode - && (!elem.children || elem.children.length === 0) - ) { - tag += '/>'; - } else { - tag += '>'; - if (elem.children) { - tag += render(elem.children, opts); - } - - if (!singleTag[elem.name] || opts.xmlMode) { - tag += ''; - } - } - - return tag; -} - -function renderDirective(elem) { - return '<' + elem.data + '>'; -} - -function renderText(elem, opts) { - var data = elem.data || ''; - - // if entities weren't decoded, no need to encode them back - if (opts.decodeEntities && !(elem.parent && elem.parent.name in unencodedElements)) { - data = entities.encodeXML(data); - } - - return data; -} - -function renderCdata(elem) { - return ''; -} - -function renderComment(elem) { - return ''; -} - -},{"domelementtype":92,"entities":216}],92:[function(require,module,exports){ -//Types of elements found in the DOM -module.exports = { - Text: "text", //Text - Directive: "directive", // - Comment: "comment", // - Script: "script", //