From 8d03f267ae079267c4cee66553525c5e60180357 Mon Sep 17 00:00:00 2001 From: Uri Goldshtein Date: Sun, 28 Feb 2016 20:04:51 +0200 Subject: [PATCH] chore(release): Release 1.3.7 --- CHANGELOG.md | 19 +++++++++++++++++++ bower.json | 2 +- dist/angular-meteor.bundle.js | 2 +- dist/angular-meteor.js | 2 +- dist/angular-meteor.min.js | 2 +- dist/angular-meteor.min.js.map | 2 +- package.json | 2 +- packages/angular-meteor-data/.versions | 2 +- packages/angular-meteor-data/package.js | 4 ++-- packages/angular-with-blaze/.versions | 4 ++-- packages/angular-with-blaze/package.js | 4 ++-- packages/angular/.versions | 4 ++-- packages/angular/package.js | 4 ++-- packages/urigo-angular/.versions | 8 ++++---- packages/urigo-angular/package.js | 4 ++-- 15 files changed, 42 insertions(+), 23 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..eb7cc2780 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,19 @@ + +## [1.3.7](https://github.com/Urigo/angular-meteor/compare/1.3.6...v1.3.7) (2016-02-28) + + +### Bug Fixes + +* **$angularMeteorSettings:** unknown provider ([bb1422c](https://github.com/Urigo/angular-meteor/commit/bb1422c)) +* **$angularMeteorSettings:** unknown provider ([44afc52](https://github.com/Urigo/angular-meteor/commit/44afc52)) +* **angular-meteor-data:** missing file extension ([5bf38ea](https://github.com/Urigo/angular-meteor/commit/5bf38ea)) +* Apply mixins to rootScope ([1a1c61b](https://github.com/Urigo/angular-meteor/commit/1a1c61b)) +* Legacy modules tests not passing ([504952e](https://github.com/Urigo/angular-meteor/commit/504952e)) + +### Features + +* support for new angular-templates ([5ab8fe7](https://github.com/Urigo/angular-meteor/commit/5ab8fe7)) +* **templates:** make compatible with modules ([fefa70c](https://github.com/Urigo/angular-meteor/commit/fefa70c)) + + + diff --git a/bower.json b/bower.json index a6d284a0a..55fd4c7c0 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "angular-meteor", "main": "./dist/angular-meteor.bundle.min.js", - "version": "1.3.7-beta.1", + "version": "1.3.7", "homepage": "https://github.com/Urigo/angular-meteor", "authors": [ "Uri Goldshtein " diff --git a/dist/angular-meteor.bundle.js b/dist/angular-meteor.bundle.js index 636474e3f..779c5ab55 100644 --- a/dist/angular-meteor.bundle.js +++ b/dist/angular-meteor.bundle.js @@ -9369,7 +9369,7 @@ var Promise = Package.promise.Promise; // // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // -/*! angular-meteor v1.3.7-beta.1 */ // 1 +/*! angular-meteor v1.3.7 */ // 1 /******/ (function(modules) { // webpackBootstrap // 2 /******/ // The module cache // 3 /******/ var installedModules = {}; // 4 diff --git a/dist/angular-meteor.js b/dist/angular-meteor.js index 9b2e2bdc5..8a5101429 100644 --- a/dist/angular-meteor.js +++ b/dist/angular-meteor.js @@ -1,4 +1,4 @@ -/*! angular-meteor v1.3.7-beta.1 */ +/*! angular-meteor v1.3.7 */ /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; diff --git a/dist/angular-meteor.min.js b/dist/angular-meteor.min.js index d5ba317e6..ab519694a 100644 --- a/dist/angular-meteor.min.js +++ b/dist/angular-meteor.min.js @@ -1,4 +1,4 @@ -/*! angular-meteor v1.3.7-beta.1 */ +/*! angular-meteor v1.3.7 */ !function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.name=void 0,r(1),r(2),r(3),r(4),r(5),r(6),r(7),r(8),r(9),r(10),r(11),r(12),r(13);var n=r(14),o=r(15),i=r(16),a=r(17),s=r(18),u=r(19),c=r(20),l=t.name="angular-meteor";angular.module(l,[n.name,o.name,i.name,a.name,s.name,u.name,c.name,"angular-meteor.ironrouter","angular-meteor.utils","angular-meteor.subscribe","angular-meteor.collection","angular-meteor.object","angular-meteor.user","angular-meteor.methods","angular-meteor.session","angular-meteor.camera"]).run([o.Mixer,a.Core,s.ViewModel,u.Reactive,function(e,t,r,n){e.mixin(t).mixin(r).mixin(n)}]).service("$meteor",["$meteorCollection","$meteorCollectionFS","$meteorObject","$meteorMethods","$meteorSession","$meteorSubscribe","$meteorUtils","$meteorCamera","$meteorUser",function(e,t,r,n,o,i,a,s,u){var c=this;this.collection=e,this.collectionFS=t,this.object=r,this.subscribe=i.subscribe,this.call=n.call,this.session=o,this.autorun=a.autorun,this.getCollectionByName=a.getCollectionByName,this.getPicture=s.getPicture,["loginWithPassword","requireUser","requireValidUser","waitForUser","createUser","changePassword","forgotPassword","resetPassword","verifyEmail","loginWithMeteorDeveloperAccount","loginWithFacebook","loginWithGithub","loginWithGoogle","loginWithMeetup","loginWithTwitter","loginWithWeibo","logout","logoutOtherClients"].forEach(function(e){c[e]=u[e]})}])},function(e,t){"use strict";!function(){var e=angular.module("getUpdates",[]),t=function(){var e=function s(e,t){return 1>t?{}:_.reduce(e,function(e,r,n){return r=_.isObject(r)?s(r,--t):r,e[n]=r,e},{})},t=function(e){var t=r(e),o=n(e);return _.object(t,o)},r=function u(e){var t=_.keys(e).map(function(t){var r=e[t];return!_.isObject(r)||_.isEmpty(r)||_.isArray(r)?t:u(r).map(function(e){return t+"."+e})});return _.flatten(t)},n=function c(e,t){return t=t||[],_.values(e).forEach(function(e){!_.isObject(e)||_.isEmpty(e)||_.isArray(e)?t.push(e):c(e,t)}),t},o=function(e,t,r){_.isEmpty(r)||(e[t]=r)},i=function(e,t){e||a(t)},a=function(e){throw Error("get-updates error - "+e)};return{rip:e,toPaths:t,getKeyPaths:r,getDeepValues:n,setFilled:o,assert:i,throwErr:a}}(),r=function(){var e=function(e,n,o){var i;return o>1?i=o:o&&(i=1),i&&(e=t.rip(e,i),n=t.rip(n,i)),r(e,n)},r=function(r,n){var o=_.keys(r),i=_.keys(n),a=_.chain([]).concat(o).concat(i).uniq().without("$$hashKey").value();return a.reduce(function(o,i){var a=r[i],s=n[i];if(_.isDate(a)&&_.isDate(s)&&a.getTime()!=s.getTime()&&(o[i]=s),_.isObject(a)&&_.isObject(s)){var u=e(a,s);t.setFilled(o,i,u)}else a!==s&&(o[i]=s);return o},{})};return e}(),n=function(){var e=function(e,a,s){t.assert(_.isObject(e),"first argument must be an object"),t.assert(_.isObject(a),"second argument must be an object");var u=r(e,a,s),c=t.toPaths(u),l=n(c),f=o(c),d=i(f),h={};return t.setFilled(h,"$set",l),t.setFilled(h,"$unset",f),t.setFilled(h,"$pull",d),h},n=function(e){var t=a(e);return _.omit(e,t)},o=function(e){var t=a(e),r=_.pick(e,t);return _.reduce(r,function(e,t,r){return e[r]=!0,e},{})},i=function(e){var t=_.keys(e).map(function(e){var t=e.match(/(.*)\.\d+$/);return t&&t[1]});return _.compact(t).reduce(function(e,t){return e[t]=null,e},{})},a=function(e){return _.keys(e).filter(function(t){var r=e[t];return _.isUndefined(r)})};return e}();e.value("getUpdates",n)}()},function(e,t){"use strict";var r=angular.module("diffArray",["getUpdates"]);r.factory("diffArray",["getUpdates",function(e){function t(t,r,i,a){a=!!a;var s=Package.minimongo.LocalCollection._diffQueryOrderedChanges||Package["diff-sequence"].DiffSequence.diffQueryOrderedChanges,u=[],c=[],l={},f={},d={},h=t.length;_.each(r,function(e,t){c.push({_id:e._id}),f[n(e._id)]=t}),_.each(t,function(e,t){u.push({_id:e._id}),l[n(e._id)]=t,d[n(e._id)]=t}),s(u,c,{addedBefore:function(e,t,o){var a=o?d[n(o)]:h;_.each(d,function(e,t){e>=a&&d[t]++}),h++,d[n(e)]=a,i.addedAt(e,r[f[n(e)]],a,o)},movedBefore:function(e,t){var o=d[n(e)],a=t?d[n(t)]:h-1;_.each(d,function(e,t){e>=o&&a>=e?d[t]--:o>=e&&e>=a&&d[t]++}),d[n(e)]=a,i.movedTo(e,r[f[n(e)]],o,a,t)},removed:function(e){var r=d[n(e)];_.each(d,function(e,t){e>=r&&d[t]--}),delete d[n(e)],h--,i.removedAt(e,t[l[n(e)]],r)}}),_.each(f,function(n,s){if(_.has(l,s)){var u=o(s),c=r[n]||{},f=t[l[s]],d=e(f,c,a);_.isEmpty(d)||i.changedAt(u,d,n,f)}})}var r=Package.minimongo.LocalCollection,n=r._idStringify||Package["mongo-id"].MongoID.idStringify,o=r._idParse||Package["mongo-id"].MongoID.idParse;t.shallow=function(e,r,n){return t(e,r,n,!0)},t.deepCopyChanges=function(t,r){var n=e(t,r).$set;_.each(n,function(e,r){i(t,r,e)})},t.deepCopyRemovals=function(t,r){var n=e(t,r).$unset;_.each(n,function(e,r){a(t,r)})},t.getChanges=function(e,t,r){var n={added:[],removed:[],changed:[]};return r(t,e,{addedAt:function(e,t,r){n.added.push({item:t,index:r})},removedAt:function(e,t,r){n.removed.push({item:t,index:r})},changedAt:function(e,t,r,o){n.changed.push({selector:e,modifier:t})},movedTo:function(e,t,r,n){}}),n};var i=function(e,t,r){var n=t.split("."),o=_.initial(n),i=_.last(n);o.reduce(function(e,t,r){var o=n[r+1];return c(o)?(null===e[t]&&(e[t]=[]),e[t].length==parseInt(o)&&e[t].push(null)):null!==e[t]&&u(e[t])||(e[t]={}),e[t]},e);var a=s(e,o);return a[i]=r,r},a=function(e,t){var r=t.split("."),n=_.initial(r),o=_.last(r),i=s(e,n);return _.isArray(i)&&c(o)?!!i.splice(o,1):delete i[o]},s=function(e,t){return t.reduce(function(e,t){return e[t]},e)},u=function(e){return _.isObject(e)&&Object.getPrototypeOf(e)===Object.prototype},c=function(e){return e.match(/^\d+$/)};return t}])},function(e,t){"use strict";angular.module("angular-meteor.settings",[]).constant("$angularMeteorSettings",{suppressWarnings:!1})},function(e,t){"use strict";angular.module("angular-meteor.ironrouter",[]).run(["$compile","$document","$rootScope",function(e,t,r){var n=(Package["iron:router"]||{}).Router;if(n){var o=!1;n.onAfterAction(function(n,i,a){Tracker.afterFlush(function(){o||(e(t)(r),r.$$phase||r.$apply(),o=!0)})})}}])},function(e,t){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},n=angular.module("angular-meteor.utils",["angular-meteor.settings"]);n.service("$meteorUtils",["$q","$timeout","$angularMeteorSettings",function(e,t,n){var o=this;this.autorun=function(e,r){n.suppressWarnings||console.warn("[angular-meteor.utils.autorun] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.6/autorun. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings");var o=Tracker.autorun(function(e){r(e),e.firstRun||t(angular.noop,0)});return e.$on("$destroy",function(){o.stop()}),o},this.stripDollarPrefixedKeys=function(e){if(!_.isObject(e)||e instanceof Date||e instanceof File||"oid"===EJSON.toJSONValue(e).$type||"object"===("undefined"==typeof FS?"undefined":r(FS))&&e instanceof FS.File)return e;var t=_.isArray(e)?[]:{};return _.each(e,function(e,r){("string"!=typeof r||"$"!==r.charAt(0))&&(t[r]=o.stripDollarPrefixedKeys(e))}),t},this.fulfill=function(e,t,r){return function(n,o){n?e.reject(null==t?n:t):"function"==typeof r?e.resolve(null==r?o:r(o)):e.resolve(null==r?o:r)}},this.promissor=function(t,r){return function(){var n=e.defer(),i=o.fulfill(n),a=_.toArray(arguments).concat(i);return t[r].apply(t,a),n.promise}},this.promiseAll=function(r){var n=e.all(r);return n["finally"](function(){t(angular.noop)}),n},this.getCollectionByName=function(e){return Mongo.Collection.get(e)},this.findIndexById=function(e,t){var r=_.find(e,function(e){return EJSON.equals(e._id,t._id)});return _.indexOf(e,r)}}]),n.run(["$rootScope","$meteorUtils",function(e,t){Object.getPrototypeOf(e).$meteorAutorun=function(e){return t.autorun(this,e)}}])},function(e,t){"use strict";var r=angular.module("angular-meteor.subscribe",["angular-meteor.settings"]);r.service("$meteorSubscribe",["$q","$angularMeteorSettings",function(e,t){var r=this;this._subscribe=function(e,r,n){t.suppressWarnings||console.warn("[angular-meteor.subscribe] Please note that this module is deprecated since 1.3.0 and will be removed in 1.4.0! Replace it with the new syntax described here: http://www.angular-meteor.com/api/1.3.6/subscribe. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings");var o=null,i=n[n.length-1];if(angular.isObject(i)&&angular.isFunction(i.onStop)){var a=i.onStop;n.pop()}return n.push({onReady:function(){r.resolve(o)},onStop:function(e){r.promise.$$state.status?a&&a.apply(this,Array.prototype.slice.call(arguments)):e?r.reject(e):r.reject(new Meteor.Error("Subscription Stopped","Subscription stopped by a call to stop method. Either by the client or by the server."))}}),o=Meteor.subscribe.apply(e,n)},this.subscribe=function(){var t=e.defer(),n=Array.prototype.slice.call(arguments);return r._subscribe(this,t,n),t.promise}}]),r.run(["$rootScope","$q","$meteorSubscribe",function(e,t,r){Object.getPrototypeOf(e).$meteorSubscribe=function(){var e=t.defer(),n=Array.prototype.slice.call(arguments),o=r._subscribe(this,e,n);return this.$on("$destroy",function(){o.stop()}),e.promise}}])},function(e,t){"use strict";var r=angular.module("angular-meteor.collection",["angular-meteor.stopper","angular-meteor.subscribe","angular-meteor.utils","diffArray","angular-meteor.settings"]);r.factory("AngularMeteorCollection",["$q","$meteorSubscribe","$meteorUtils","$rootScope","$timeout","diffArray","$angularMeteorSettings",function(e,t,r,n,o,i,a){function s(e,t,n,o){a.suppressWarnings||console.warn("[angular-meteor.$meteorCollection] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/meteorCollection. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings");var i=[];if(i._serverBackup=[],i._diffArrayFunc=n,i._hObserve=null,i._hNewCurAutorun=null,i._hDataAutorun=null,angular.isDefined(t))i.$$collection=t;else{var u=e();i.$$collection=r.getCollectionByName(u.collection.name)}return _.extend(i,s),i._startCurAutorun(e,o),i}return s._startCurAutorun=function(e,t){var r=this;r._hNewCurAutorun=Tracker.autorun(function(){Tracker.onInvalidate(function(){r._stopCursor()}),t&&r._setAutoClientSave(),r._updateCursor(e(),t)})},s.subscribe=function(){return t.subscribe.apply(this,arguments),this},s.save=function(e,t){e||(e=this),e=[].concat(e);var n=e.map(function(e){return this._upsertDoc(e,t)},this);return r.promiseAll(n)},s._upsertDoc=function(t,n){var o=e.defer(),i=this.$$collection,a=_.partial(r.fulfill,o,null);t=r.stripDollarPrefixedKeys(t);var s=t._id,u=i.findOne(s);if(u){delete t._id;var c=n?{$unset:t}:{$set:t};i.update(s,c,a(function(){return{_id:s,action:"updated"}}))}else i.insert(t,a(function(e){return{_id:e,action:"inserted"}}));return o.promise},s._updateDiff=function(e,t,r){r=r||angular.noop;var n=_.omit(t,"$pull"),o=[n];_.each(t.$pull,function(e,t){var r={};r[t]=e,o.push({$pull:r})}),this._updateParallel(e,o,r)},s._updateParallel=function(e,t,r){var n=this,o=_.after(t.length,r),i=function(e,t){return e?r(e):void o(null,t)};_.each(t,function(t){n.$$collection.update(e,t,i)})},s.remove=function(e){var t;e?(e=[].concat(e),t=_.map(e,function(e){return e._id||e})):t=_.pluck(this,"_id"),check(t,[Match.OneOf(String,Mongo.ObjectID)]);var n=t.map(function(e){return this._removeDoc(e)},this);return r.promiseAll(n)},s._removeDoc=function(t){var n=e.defer(),o=this.$$collection,i=r.fulfill(n,null,{_id:t,action:"removed"});return o.remove(t,i),n.promise},s._updateCursor=function(e,t){var n=this;n._hObserve&&n._stopObserving(),n._hObserve=e.observe({addedAt:function(e,t){n.splice(t,0,e),n._serverBackup.splice(t,0,e),n._setServerUpdateMode()},changedAt:function(e,t,r){i.deepCopyChanges(n[r],e),i.deepCopyRemovals(n[r],e),n._serverBackup[r]=n[r],n._setServerUpdateMode()},movedTo:function(e,t,r){n.splice(t,1),n.splice(r,0,e),n._serverBackup.splice(t,1),n._serverBackup.splice(r,0,e),n._setServerUpdateMode()},removedAt:function(e){var t=r.findIndexById(n,e);-1!=t?(n.splice(t,1),n._serverBackup.splice(t,1),n._setServerUpdateMode()):(t=r.findIndexById(n._serverBackup,e),-1!=t&&n._serverBackup.splice(t,1))}}),n._hDataAutorun=Tracker.autorun(function(){e.fetch(),n._serverMode&&n._unsetServerUpdateMode(t)})},s._stopObserving=function(){this._hObserve.stop(),this._hDataAutorun.stop(),delete this._serverMode,delete this._hUnsetTimeout},s._setServerUpdateMode=function(e){this._serverMode=!0,this._unsetAutoClientSave()},s._unsetServerUpdateMode=function(e){var t=this;t._hUnsetTimeout&&(o.cancel(t._hUnsetTimeout),t._hUnsetTimeout=null),t._hUnsetTimeout=o(function(){t._serverMode=!1;var r=i.getChanges(t,t._serverBackup,t._diffArrayFunc);t._saveChanges(r),e&&t._setAutoClientSave()},0)},s.stop=function(){this._stopCursor(),this._hNewCurAutorun.stop()},s._stopCursor=function(){this._unsetAutoClientSave(),this._hObserve&&(this._hObserve.stop(),this._hDataAutorun.stop()),this.splice(0),this._serverBackup.splice(0)},s._unsetAutoClientSave=function(e){this._hRegAutoBind&&(this._hRegAutoBind(),this._hRegAutoBind=null)},s._setAutoClientSave=function(){var e=this;e._unsetAutoClientSave(),e._hRegAutoBind=n.$watch(function(){return e},function(t,r){if(t!==r){var n=i.getChanges(e,r,e._diffArrayFunc);e._unsetAutoClientSave(),e._saveChanges(n),e._setAutoClientSave()}},!0)},s._saveChanges=function(e){var t=this,r=e.added.reverse().map(function(e){return t.splice(e.index,1),e.item});r.length&&t.save(r);var n=e.removed.map(function(e){return e.item});n.length&&t.remove(n),e.changed.forEach(function(e){t._updateDiff(e.selector,e.modifier)})},s}]),r.factory("$meteorCollectionFS",["$meteorCollection","diffArray","$angularMeteorSettings",function(e,t,r){function n(n,o,i){return r.suppressWarnings||console.warn("[angular-meteor.$meteorCollectionFS] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/files. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings"),new e(n,o,i,t.shallow)}return n}]),r.factory("$meteorCollection",["AngularMeteorCollection","$rootScope","diffArray",function(e,t,r){function n(t,n,o,i){if(!t)throw new TypeError("The first argument of $meteorCollection is undefined.");if(!angular.isFunction(t)&&!angular.isFunction(t.find))throw new TypeError("The first argument of $meteorCollection must be a function or a have a find function property.");return angular.isFunction(t)||(o=angular.isDefined(o)?o:t,t=_.bind(t.find,t)),n=angular.isDefined(n)?n:!0,i=i||r,new e(t,o,i,n)}return n}]),r.run(["$rootScope","$meteorCollection","$meteorCollectionFS","$meteorStopper",function(e,t,r,n){var o=Object.getPrototypeOf(e);o.$meteorCollection=n(t),o.$meteorCollectionFS=n(r)}])},function(e,t){"use strict";var r=angular.module("angular-meteor.object",["angular-meteor.utils","angular-meteor.subscribe","angular-meteor.collection","getUpdates","diffArray","angular-meteor.settings"]);r.factory("AngularMeteorObject",["$q","$meteorSubscribe","$meteorUtils","diffArray","getUpdates","AngularMeteorCollection","$angularMeteorSettings",function(e,t,r,n,o,i,a){function s(e,t,r){a.suppressWarnings||console.warn("[angular-meteor.$meteorObject] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/meteorObject. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings");var n=e._helpers,o=_.isFunction(n)?Object.create(n.prototype):{},u=e.findOne(t,r),c=_.pick(i,"_updateParallel");return _.extend(o,u),_.extend(o,s),_.extend(o,c),o.$$options=_.omit(r,"skip","limit"),o.$$collection=e,o.$$id=o._getId(t),o._serverBackup=u||{},o}return s.$$internalProps=["$$collection","$$options","$$id","$$hashkey","$$internalProps","$$scope","bind","save","reset","subscribe","stop","autorunComputation","unregisterAutoBind","unregisterAutoDestroy","getRawObject","_auto","_setAutos","_eventEmitter","_serverBackup","_updateDiff","_updateParallel","_getId"],s.getRawObject=function(){return angular.copy(_.omit(this,this.$$internalProps))},s.subscribe=function(){return t.subscribe.apply(this,arguments),this},s.save=function(t){var n,i=e.defer(),a=this.$$collection,s=_.partial(r.fulfill,i,null),u=a.findOne(this.$$id);if(u){if(t)n={$set:t};else if(n=o(u,this.getRawObject()),_.isEmpty(n))return e.when({action:"updated"});this._updateDiff(n,s({action:"updated"}))}else n=t?_.clone(t):this.getRawObject(),n._id=n._id||this.$$id,a.insert(n,s({action:"inserted"}));return i.promise},s._updateDiff=function(e,t){var r=this.$$id;i._updateDiff.call(this,r,e,t)},s.reset=function(e){var t=this,r=this.$$options,n=this.$$id,o=this.$$collection.findOne(n,r);if(o){var i,a=_.keys(o),s=_.pick(o,a);_.extend(t,s),_.extend(t._serverBackup,s),i=e?_.intersection(_.keys(t),_.keys(t._serverBackup)):_.keys(t);var u=_.keys(o),c=_.difference(i,u,t.$$internalProps);c.forEach(function(e){delete t[e],delete t._serverBackup[e]})}else _.keys(this.getRawObject()).forEach(function(e){delete t[e]}),t._serverBackup={}},s.stop=function(){this.unregisterAutoDestroy&&this.unregisterAutoDestroy(),this.unregisterAutoBind&&this.unregisterAutoBind(),this.autorunComputation&&this.autorunComputation.stop&&this.autorunComputation.stop()},s._getId=function(e){var t=_.extend({},this.$$options,{fields:{_id:1},reactive:!1,transform:null}),r=this.$$collection.findOne(e,t);return r?r._id:e instanceof Mongo.ObjectID?e:_.isString(e)?e:new Mongo.ObjectID},s}]),r.factory("$meteorObject",["$rootScope","$meteorUtils","getUpdates","AngularMeteorObject",function(e,t,r,n){function o(e,t,r,i){if(!e)throw new TypeError("The first argument of $meteorObject is undefined.");if(!angular.isFunction(e.findOne))throw new TypeError("The first argument of $meteorObject must be a function or a have a findOne function property.");var a=new n(e,t,i);return a._auto=r!==!1,_.extend(a,o),a._setAutos(),a}return o._setAutos=function(){var r=this;this.autorunComputation=t.autorun(e,function(){r.reset(!0)}),this.unregisterAutoBind=this._auto&&e.$watch(function(){return r.getRawObject()},function(e,t){e!==t&&r.save()},!0),this.unregisterAutoDestroy=e.$on("$destroy",function(){r&&r.stop&&r.pop()})},o}]),r.run(["$rootScope","$meteorObject","$meteorStopper",function(e,t,r){var n=Object.getPrototypeOf(e);n.$meteorObject=r(t)}])},function(e,t){"use strict";var r=angular.module("angular-meteor.user",["angular-meteor.utils","angular-meteor.core","angular-meteor.settings"]);r.service("$meteorUser",["$rootScope","$meteorUtils","$q","$angularMeteorSettings",function(e,t,r,n){var o=Package["accounts-base"];if(o){var i=this,a=o.Accounts;this.waitForUser=function(){n.suppressWarnings||console.warn("[angular-meteor.waitForUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings");var o=r.defer();return t.autorun(e,function(){Meteor.loggingIn()||o.resolve(Meteor.user())},!0),o.promise},this.requireUser=function(){n.suppressWarnings||console.warn("[angular-meteor.requireUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings");var o=r.defer();return t.autorun(e,function(){Meteor.loggingIn()||(null===Meteor.user()?o.reject("AUTH_REQUIRED"):o.resolve(Meteor.user()))},!0),o.promise},this.requireValidUser=function(e){return n.suppressWarnings||console.warn("[angular-meteor.requireValidUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings"),i.requireUser(!0).then(function(t){var n=e(t);return n===!0?t:"string"==typeof n?r.reject(n):r.reject("FORBIDDEN")})},this.loginWithPassword=t.promissor(Meteor,"loginWithPassword"),this.createUser=t.promissor(a,"createUser"),this.changePassword=t.promissor(a,"changePassword"),this.forgotPassword=t.promissor(a,"forgotPassword"),this.resetPassword=t.promissor(a,"resetPassword"),this.verifyEmail=t.promissor(a,"verifyEmail"),this.logout=t.promissor(Meteor,"logout"),this.logoutOtherClients=t.promissor(Meteor,"logoutOtherClients"),this.loginWithFacebook=t.promissor(Meteor,"loginWithFacebook"),this.loginWithTwitter=t.promissor(Meteor,"loginWithTwitter"),this.loginWithGoogle=t.promissor(Meteor,"loginWithGoogle"),this.loginWithGithub=t.promissor(Meteor,"loginWithGithub"),this.loginWithMeteorDeveloperAccount=t.promissor(Meteor,"loginWithMeteorDeveloperAccount"),this.loginWithMeetup=t.promissor(Meteor,"loginWithMeetup"),this.loginWithWeibo=t.promissor(Meteor,"loginWithWeibo")}}]),r.run(["$rootScope","$angularMeteorSettings","$$Core",function(e,t,r){var n=Object.getPrototypeOf(e);_.extend(n,r),e.autorun(function(){Meteor.user&&(e.currentUser=Meteor.user(),e.loggingIn=Meteor.loggingIn())})}])},function(e,t){"use strict";var r=angular.module("angular-meteor.methods",["angular-meteor.utils","angular-meteor.settings"]);r.service("$meteorMethods",["$q","$meteorUtils","$angularMeteorSettings",function(e,t,r){this.call=function(){r.suppressWarnings||console.warn("[angular-meteor.$meteor.call] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/methods. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings");var n=e.defer(),o=t.fulfill(n),i=_.toArray(arguments).concat(o);return Meteor.call.apply(this,i),n.promise}}])},function(e,t){"use strict";var r=angular.module("angular-meteor.session",["angular-meteor.utils","angular-meteor.settings"]);r.factory("$meteorSession",["$meteorUtils","$parse","$angularMeteorSettings",function(e,t,r){return function(n){return{bind:function(o,i){r.suppressWarnings||console.warn("[angular-meteor.session.bind] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://www.angular-meteor.com/api/1.3.0/session. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings");var a=t(i),s=a.assign;e.autorun(o,function(){s(o,Session.get(n))}),o.$watch(i,function(e,t){Session.set(n,a(o))},!0)}}}}])},function(e,t){"use strict";var r=angular.module("angular-meteor.camera",["angular-meteor.utils","angular-meteor.settings"]);r.service("$meteorCamera",["$q","$meteorUtils","$angularMeteorSettings",function(e,t,r){r.suppressWarnings||console.warn("[angular-meteor.camera] Please note that this module has moved to a separate package and is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/camera. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings");var n=Package["mdg:camera"];if(n){var o=n.MeteorCamera;this.getPicture=function(n){r.suppressWarnings||console.warn("[angular-meteor.camera] Please note that this module has moved to a separate package and is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/camera. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings"),n=n||{};var i=e.defer();return o.getPicture(n,t.fulfill(i)),i.promise}}}])},function(e,t){"use strict";var r=angular.module("angular-meteor.stopper",["angular-meteor.subscribe"]);r.factory("$meteorStopper",["$q","$meteorSubscribe",function(e,t){function r(e){return function(){var t=Array.prototype.slice.call(arguments),n=e.apply(this,t);return angular.extend(n,r),n.$$scope=this,this.$on("$destroy",function(){n.stop(),n.subscription&&n.subscription.stop()}),n}}return r.subscribe=function(){var r=Array.prototype.slice.call(arguments);return this.subscription=t._subscribe(this.$$scope,e.defer(),r),this},r}])},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=t.name="angular-meteor.utilities",n=t.utils="$$utils";angular.module(r,[]).service(n,["$rootScope",function(e){function t(e,t,r){return function(){for(var n=arguments.length,o=Array(n),i=0;n>i;i++)o[i]=arguments[i];var a=e.apply(t,o);return r.call(t,{result:a,args:o}),a}}function r(e,t,r){return _.keys(e).reduce(function(o,i){return o[i]=n.bind(e[i],t,r),o},{})}var n=this;this.isCursor=function(e){return e instanceof Meteor.Collection.Cursor},this.isScope=function(t){return t instanceof e.constructor},this.areSiblings=function(e,t){return _.isObject(e)&&_.isObject(t)&&Object.getPrototypeOf(e)===Object.getPrototypeOf(t)},this.bind=function(e,n,o){return o=_.isFunction(o)?o:angular.noop,_.isFunction(e)?t(e,n,o):_.isObject(e)?r(e,n,o):e}}])},function(e,t){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t1?r-1:0),o=1;r>o;o++)n[o-1]=arguments[o];return e._mixins.filter(_.isFunction).forEach(function(e){e.call.apply(e,[t].concat(n))}),t},this._extend=function(t){var n;return(n=_).extend.apply(n,[t].concat(r(e._mixins)))}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.name=void 0;var n=r(15),o=t.name="angular-meteor.scope";angular.module(o,[n.name]).run(["$rootScope",n.Mixer,function(e,t){var r=e.constructor,n=e.$new;t._autoExtend.push(r.prototype),t._autoConstruct.push(e),r.prototype.$new=function(){var e=n.apply(this,arguments);return t._construct(e)}}])},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);tn;n++)r[n]=arguments[n];var o=r.pop();return _.isFunction(o)&&(o=this.$bindToContext(o)),(e=Meteor).call.apply(e,r.concat([o]))},r.applyMethod=function(){for(var e,t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];var o=r.pop();return _.isFunction(o)&&(o=this.$bindToContext(o)),(e=Meteor).apply.apply(e,r.concat([o]))},r.$$autoStop=function(e){this.$on("$destroy",e.stop.bind(e))},r.$$throttledDigest=function(){var e=!this.$$destroyed&&!this.$$phase&&!this.$root.$$phase;e&&this.$digest()},r.$$defer=function(){var t=e.defer();return t.promise=t.promise["finally"](this.$$throttledDigest.bind(this)),t},r.$bindToContext=function(e){return t.bind(e,this,this.$$throttledDigest.bind(this))},r}])},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.reactive=t.ViewModel=t.name=void 0;var o=function(){function e(e,t){for(var r=0;r2?n-2:0),i=2;n>i;i++)o[i-2]=arguments[i];this.$$watchEntity.apply(this,[t,r].concat(o))}return this.$$vm.$$dependencies[t].depend(),e(t)(this.$$vm)},r.$$watchEntity=function(t,r){for(var n=this,o=_.partial(e(t),this.$$vm),i=o(),a=arguments.length,s=Array(a>2?a-2:0),u=2;a>u;u++)s[u-2]=arguments[u];r.call.apply(r,[this,o,function(e,r){ var o=e!==i||e!==r;o&&n.$$changed(t)}].concat(s))},r.$$setFnHelper=function(e,r){var n=this;this.autorun(function(o){var i=r.apply(n.$$vm);Tracker.nonreactive(function(){t.isCursor(i)?!function(){var t=n.$$handleCursor(e,i);o.onInvalidate(function(){t.stop(),n.$$vm[e].splice(0)})}():n.$$handleNonCursor(e,i),n.$$changed(e)})})},r.$$setValHelper=function(e,t){var r=this,n=arguments.length<=2||void 0===arguments[2]?!0:arguments[2];if(n){var o=_.isObject(t);this.getReactively(e,o)}Object.defineProperty(this.$$vm,e,{configurable:!0,enumerable:!0,get:function(){return t},set:function(n){t=n,r.$$changed(e)}})},r.$$handleCursor=function(e,t){var r=this;if(angular.isUndefined(this.$$vm[e]))this.$$setValHelper(e,t.fetch(),!1);else{var n=jsondiffpatch.diff(this.$$vm[e],t.fetch());jsondiffpatch.patch(this.$$vm[e],n)}var o=t.observe({addedAt:function(t,n){o&&(r.$$vm[e].splice(n,0,t),r.$$changed(e))},changedAt:function(t,n,o){var i=jsondiffpatch.diff(r.$$vm[e][o],t);jsondiffpatch.patch(r.$$vm[e][o],i),r.$$changed(e)},movedTo:function(t,n,o){r.$$vm[e].splice(n,1),r.$$vm[e].splice(o,0,t),r.$$changed(e)},removedAt:function(t,n){r.$$vm[e].splice(n,1),r.$$changed(e)}});return o},r.$$handleNonCursor=function(e,r){var n=this.$$vm[e];if(angular.isDefined(n)&&(delete this.$$vm[e],n=null),angular.isUndefined(n))this.$$setValHelper(e,r);else if(t.areSiblings(n,r)){var o=jsondiffpatch.diff(n,r);jsondiffpatch.patch(n,o),this.$$changed(e)}else this.$$vm[e]=r},r.$$depend=function(e){this.$$vm.$$dependencies[e].depend()},r.$$changed=function(e){this.$$throttledDigest(),this.$$vm.$$dependencies[e].changed()},r}])},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=t.name="angular-templates";try{angular.module(r)}catch(n){angular.module(r,[])}}]); //# sourceMappingURL=angular-meteor.min.js.map \ No newline at end of file diff --git a/dist/angular-meteor.min.js.map b/dist/angular-meteor.min.js.map index 92f74ec7e..88865f44d 100644 --- a/dist/angular-meteor.min.js.map +++ b/dist/angular-meteor.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///dist/angular-meteor.min.js","webpack:///webpack/bootstrap 506237d669ed75851a9d","webpack:///./src/angular-meteor.js","webpack:///./src/lib/get-updates.js","webpack:///./src/lib/diff-array.js","webpack:///./src/modules/angular-meteor-settings.js","webpack:///./src/modules/angular-meteor-ironrouter.js","webpack:///./src/modules/angular-meteor-utils.js","webpack:///./src/modules/angular-meteor-subscribe.js","webpack:///./src/modules/angular-meteor-collection.js","webpack:///./src/modules/angular-meteor-object.js","webpack:///./src/modules/angular-meteor-user.js","webpack:///./src/modules/angular-meteor-methods.js","webpack:///./src/modules/angular-meteor-session.js","webpack:///./src/modules/angular-meteor-camera.js","webpack:///./src/modules/angular-meteor-stopper.js","webpack:///./src/modules/utils.js","webpack:///./src/modules/mixer.js","webpack:///./src/modules/scope.js","webpack:///./src/modules/core.js","webpack:///./src/modules/view-model.js","webpack:///./src/modules/reactive.js","webpack:///./src/modules/templates.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","id","loaded","call","m","c","p","Object","defineProperty","value","name","undefined","_utils","_mixer","_scope","_core","_viewModel","_reactive","_templates","angular","run","Mixer","Core","ViewModel","Reactive","$Mixer","$$Core","$$ViewModel","$$Reactive","mixin","service","$meteorCollection","$meteorCollectionFS","$meteorObject","$meteorMethods","$meteorSession","$meteorSubscribe","$meteorUtils","$meteorCamera","$meteorUser","_this","this","collection","collectionFS","object","subscribe","session","autorun","getCollectionByName","getPicture","forEach","method","utils","rip","obj","level","_","reduce","clone","v","k","isObject","toPaths","keys","getKeyPaths","values","getDeepValues","map","isEmpty","isArray","subKey","flatten","arr","push","setFilled","assert","result","msg","throwErr","Error","getDifference","src","dst","isShallow","compare","srcKeys","dstKeys","chain","concat","uniq","without","diff","srcValue","dstValue","isDate","getTime","valueDiff","getUpdates","paths","set","createSet","unset","createUnset","pull","createPull","updates","undefinedKeys","getUndefinedKeys","omit","pick","arrKeyPaths","split","match","compact","filter","isUndefined","_module","factory","diffArray","lastSeqArray","seqArray","callbacks","preventNestedDiff","diffFn","Package","minimongo","LocalCollection","_diffQueryOrderedChanges","DiffSequence","diffQueryOrderedChanges","oldObjIds","newObjIds","posOld","posNew","posCur","lengthCur","length","each","doc","i","_id","idStringify","addedBefore","before","position","pos","addedAt","movedBefore","prevPosition","movedTo","removed","removedAt","idString","has","idParse","newItem","oldItem","changedAt","_idStringify","MongoID","_idParse","shallow","deepCopyChanges","setDiff","$set","deepKey","setDeep","deepCopyRemovals","unsetDiff","$unset","unsetDeep","getChanges","newCollection","oldCollection","diffMethod","changes","added","changed","item","index","selector","modifier","fromIndex","toIndex","initialKeys","initial","lastKey","last","subObj","nextKey","isNumStr","parseInt","isHash","deepObj","getDeep","splice","getPrototypeOf","prototype","str","constant","suppressWarnings","$compile","$document","$rootScope","Router","isLoaded","onAfterAction","req","res","next","Tracker","afterFlush","$$phase","$apply","_typeof","Symbol","iterator","constructor","angularMeteorUtils","$q","$timeout","$angularMeteorSettings","self","scope","fn","console","warn","comp","firstRun","noop","$on","stop","stripDollarPrefixedKeys","data","Date","File","EJSON","toJSONValue","$type","FS","out","charAt","fulfill","deferred","boundError","boundResult","err","reject","resolve","promissor","defer","args","toArray","arguments","apply","promise","promiseAll","promises","allPromise","all","string","Mongo","Collection","get","findIndexById","foundDoc","find","colDoc","equals","indexOf","$meteorAutorun","angularMeteorSubscribe","_subscribe","subscription","lastArg","isFunction","onStop","_onStop","pop","onReady","$$state","status","Array","slice","Meteor","angularMeteorCollection","AngularMeteorCollection","curDefFunc","diffArrayFunc","autoClientSave","_serverBackup","_diffArrayFunc","_hObserve","_hNewCurAutorun","_hDataAutorun","isDefined","$$collection","cursor","extend","_startCurAutorun","onInvalidate","_stopCursor","_setAutoClientSave","_updateCursor","save","docs","useUnsetModifier","_upsertDoc","createFulfill","partial","docId","isExist","findOne","update","action","insert","_updateDiff","callback","setters","$pull","prop","puller","_updateParallel","done","after","affectedDocsNum","remove","keyOrDocs","keyOrDoc","pluck","check","Match","OneOf","String","ObjectID","key","_removeDoc","_stopObserving","observe","atIndex","_setServerUpdateMode","oldDoc","removedIndex","fetch","_serverMode","_unsetServerUpdateMode","_hUnsetTimeout","_unsetAutoClientSave","cancel","_saveChanges","_hRegAutoBind","$watch","nItems","oItems","addedDocs","reverse","descriptor","removedDocs","reactiveFunc","TypeError","bind","$meteorStopper","scopeProto","angularMeteorObject","AngularMeteorObject","options","helpers","_helpers","create","collectionExtension","$$options","$$id","_getId","$$internalProps","getRawObject","copy","custom","mods","when","reset","keepClientProps","clientProps","docKeys","docExtension","intersection","serverProps","removedKeys","difference","unregisterAutoDestroy","unregisterAutoBind","autorunComputation","fields","reactive","transform","isString","auto","_auto","_setAutos","angularMeteorUser","pack","Accounts","waitForUser","loggingIn","user","requireUser","requireValidUser","validatorFn","then","valid","loginWithPassword","createUser","changePassword","forgotPassword","resetPassword","verifyEmail","logout","logoutOtherClients","loginWithFacebook","loginWithTwitter","loginWithGoogle","loginWithGithub","loginWithMeteorDeveloperAccount","loginWithMeetup","loginWithWeibo","ScopeProto","currentUser","angularMeteorMethods","angularMeteorSession","$parse","model","getter","setter","assign","Session","angularMeteorCamera","MeteorCamera","angularMeteorStopper","$meteorEntity","meteorEntity","$$scope","bindFn","context","tap","_len","_key","bindObj","bound","isCursor","Cursor","isScope","areSiblings","obj1","obj2","_toConsumableArray","arr2","from","_mixins","_autoExtend","_autoConstruct","union","_extend","_construct","_mixout","_ref","Scope","$new","$$utils","$bindToContext","computation","$$autoStop","subName","cb","_Meteor","ready","subscriptionId","callMethod","_Meteor2","applyMethod","_Meteor3","_len2","_key2","stoppable","$$throttledDigest","isDigestable","$$destroyed","$root","$digest","$$defer","_classCallCheck","instance","Constructor","_createClass","defineProperties","target","props","enumerable","configurable","writable","protoProps","staticProps","vm","$$vm","viewModel","proto","boundProto","_this2","_attached","_vm","$$dependencies","Dependency","$$setFnHelper","getReactively","isDeep","isBoolean","$$reactivateEntity","getCollectionReactively","$watchCollection","watcher","watcherArgs","$$watchEntity","depend","getVal","initialVal","val","oldVal","hasChanged","$$changed","_this3","nonreactive","observation","$$handleCursor","$$handleNonCursor","$$setValHelper","_this4","watch","newVal","_this5","jsondiffpatch","patch","$$depend","e"],"mappings":";CACS,SAAUA,GCGnB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAE,WACAE,GAAAJ,EACAK,QAAA,EAUA,OANAP,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,QAAA,EAGAF,EAAAD,QAvBA,GAAAD,KAqCA,OATAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,GAGAV,EAAA,KDOM,SAASI,EAAQD,EAASH,GAE/B,YAEAW,QAAOC,eAAeT,EAAS,cAC7BU,OAAO,IAETV,EAAQW,KAAOC,OAEff,EAAoB,GAEpBA,EAAoB,GAEpBA,EAAoB,GAEpBA,EAAoB,GAEpBA,EAAoB,GAEpBA,EAAoB,GAEpBA,EAAoB,GAEpBA,EAAoB,GAEpBA,EAAoB,GAEpBA,EAAoB,IAEpBA,EAAoB,IAEpBA,EAAoB,IAEpBA,EAAoB,GAEpB,IAAIgB,GAAShB,EAAoB,IAE7BiB,EAASjB,EAAoB,IAE7BkB,EAASlB,EAAoB,IAE7BmB,EAAQnB,EAAoB,IAE5BoB,EAAapB,EAAoB,IAEjCqB,EAAYrB,EAAoB,IAEhCsB,EAAatB,EAAoB,IEnEzBc,EAAAX,EAAAW,KAAO,gBAEpBS,SAAQnB,OAAOU,GF4EdE,EAAOF,KAAMG,EAAOH,KAAMI,EAAOJ,KAAMK,EAAML,KAAMM,EAAWN,KAAMO,E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U5O,WACblB,MAAK4c,KAAKzb,GACjBD,EAAI,MAGFxC,QAAQgG,YAAYxD,GACtBlB,KAAK2e,eAAexd,EAAG6K,OAGpB,IAAIyO,EAAQhB,YAAYvY,EAAG8K,GAAO,CACrC,GAAM9I,GAAO8b,cAAc9b,KAAKhC,EAAG8K,EACnCgT,eAAcC,MAAM/d,EAAGgC,GACvBlD,KAAKqe,UAAUld,OAEfnB,MAAK4c,KAAKzb,GAAK6K,GAhLK7M,EAqLb+f,SAAW,SAAS/d,GAC7BnB,KAAK4c,KAAKO,eAAehc,GAAG4c,UAtLN5e,EA0Lbkf,UAAY,SAASld,GAC9BnB,KAAKyb,oBACLzb,KAAK4c,KAAKO,eAAehc,GAAGqH,WAGvBrJ,MrBu8DL,SAAS5B,EAAQD,GAEtB,YAEAQ,QAAOC,eAAeT,EAAS,cAC7BU,OAAO,GsBnqEH,IAAMC,GAAAX,EAAAW,KAAO,mBAEpB,KACES,QAAQnB,OAAOU,GACf,MAAOkhB,GACPzgB,QAAQnB,OAAOU","file":"dist/angular-meteor.min.js","sourcesContent":["/*! angular-meteor v1.3.7-beta.1 */\n/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.name = undefined;\n\t\n\t__webpack_require__(1);\n\t\n\t__webpack_require__(2);\n\t\n\t__webpack_require__(3);\n\t\n\t__webpack_require__(4);\n\t\n\t__webpack_require__(5);\n\t\n\t__webpack_require__(6);\n\t\n\t__webpack_require__(7);\n\t\n\t__webpack_require__(8);\n\t\n\t__webpack_require__(9);\n\t\n\t__webpack_require__(10);\n\t\n\t__webpack_require__(11);\n\t\n\t__webpack_require__(12);\n\t\n\t__webpack_require__(13);\n\t\n\tvar _utils = __webpack_require__(14);\n\t\n\tvar _mixer = __webpack_require__(15);\n\t\n\tvar _scope = __webpack_require__(16);\n\t\n\tvar _core = __webpack_require__(17);\n\t\n\tvar _viewModel = __webpack_require__(18);\n\t\n\tvar _reactive = __webpack_require__(19);\n\t\n\tvar _templates = __webpack_require__(20);\n\t\n\t// legacy\n\t// lib\n\tvar name = exports.name = 'angular-meteor';\n\t\n\t// new\n\t\n\t\n\tangular.module(name, [\n\t// new\n\t_utils.name, _mixer.name, _scope.name, _core.name, _viewModel.name, _reactive.name, _templates.name,\n\t\n\t// legacy\n\t'angular-meteor.ironrouter', 'angular-meteor.utils', 'angular-meteor.subscribe', 'angular-meteor.collection', 'angular-meteor.object', 'angular-meteor.user', 'angular-meteor.methods', 'angular-meteor.session', 'angular-meteor.camera']).run([_mixer.Mixer, _core.Core, _viewModel.ViewModel, _reactive.Reactive, function ($Mixer, $$Core, $$ViewModel, $$Reactive) {\n\t // Load all mixins\n\t $Mixer.mixin($$Core).mixin($$ViewModel).mixin($$Reactive);\n\t}])\n\t\n\t// legacy\n\t// Putting all services under $meteor service for syntactic sugar\n\t.service('$meteor', ['$meteorCollection', '$meteorCollectionFS', '$meteorObject', '$meteorMethods', '$meteorSession', '$meteorSubscribe', '$meteorUtils', '$meteorCamera', '$meteorUser', function ($meteorCollection, $meteorCollectionFS, $meteorObject, $meteorMethods, $meteorSession, $meteorSubscribe, $meteorUtils, $meteorCamera, $meteorUser) {\n\t var _this = this;\n\t\n\t this.collection = $meteorCollection;\n\t this.collectionFS = $meteorCollectionFS;\n\t this.object = $meteorObject;\n\t this.subscribe = $meteorSubscribe.subscribe;\n\t this.call = $meteorMethods.call;\n\t this.session = $meteorSession;\n\t this.autorun = $meteorUtils.autorun;\n\t this.getCollectionByName = $meteorUtils.getCollectionByName;\n\t this.getPicture = $meteorCamera.getPicture;\n\t\n\t // $meteorUser\n\t ['loginWithPassword', 'requireUser', 'requireValidUser', 'waitForUser', 'createUser', 'changePassword', 'forgotPassword', 'resetPassword', 'verifyEmail', 'loginWithMeteorDeveloperAccount', 'loginWithFacebook', 'loginWithGithub', 'loginWithGoogle', 'loginWithMeetup', 'loginWithTwitter', 'loginWithWeibo', 'logout', 'logoutOtherClients'].forEach(function (method) {\n\t _this[method] = $meteorUser[method];\n\t });\n\t}]);\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, _\n\t */\n\t\n\t'use strict';\n\t\n\t// https://github.com/DAB0mB/get-updates\n\t\n\t(function () {\n\t var module = angular.module('getUpdates', []);\n\t\n\t var utils = function () {\n\t var rip = function rip(obj, level) {\n\t if (level < 1) return {};\n\t\n\t return _.reduce(obj, function (clone, v, k) {\n\t v = _.isObject(v) ? rip(v, --level) : v;\n\t clone[k] = v;\n\t return clone;\n\t }, {});\n\t };\n\t\n\t var toPaths = function toPaths(obj) {\n\t var keys = getKeyPaths(obj);\n\t var values = getDeepValues(obj);\n\t return _.object(keys, values);\n\t };\n\t\n\t var getKeyPaths = function getKeyPaths(obj) {\n\t var keys = _.keys(obj).map(function (k) {\n\t var v = obj[k];\n\t if (!_.isObject(v) || _.isEmpty(v) || _.isArray(v)) return k;\n\t\n\t return getKeyPaths(v).map(function (subKey) {\n\t return k + '.' + subKey;\n\t });\n\t });\n\t\n\t return _.flatten(keys);\n\t };\n\t\n\t var getDeepValues = function getDeepValues(obj, arr) {\n\t arr = arr || [];\n\t\n\t _.values(obj).forEach(function (v) {\n\t if (!_.isObject(v) || _.isEmpty(v) || _.isArray(v)) arr.push(v);else getDeepValues(v, arr);\n\t });\n\t\n\t return arr;\n\t };\n\t\n\t var flatten = function flatten(arr) {\n\t return arr.reduce(function (flattened, v, i) {\n\t if (_.isArray(v) && !_.isEmpty(v)) flattened.push.apply(flattened, flatten(v));else flattened.push(v);\n\t\n\t return flattened;\n\t }, []);\n\t };\n\t\n\t var setFilled = function setFilled(obj, k, v) {\n\t if (!_.isEmpty(v)) obj[k] = v;\n\t };\n\t\n\t var assert = function assert(result, msg) {\n\t if (!result) throwErr(msg);\n\t };\n\t\n\t var throwErr = function throwErr(msg) {\n\t throw Error('get-updates error - ' + msg);\n\t };\n\t\n\t return {\n\t rip: rip,\n\t toPaths: toPaths,\n\t getKeyPaths: getKeyPaths,\n\t getDeepValues: getDeepValues,\n\t setFilled: setFilled,\n\t assert: assert,\n\t throwErr: throwErr\n\t };\n\t }();\n\t\n\t var getDifference = function () {\n\t var getDifference = function getDifference(src, dst, isShallow) {\n\t var level;\n\t\n\t if (isShallow > 1) level = isShallow;else if (isShallow) level = 1;\n\t\n\t if (level) {\n\t src = utils.rip(src, level);\n\t dst = utils.rip(dst, level);\n\t }\n\t\n\t return compare(src, dst);\n\t };\n\t\n\t var compare = function compare(src, dst) {\n\t var srcKeys = _.keys(src);\n\t var dstKeys = _.keys(dst);\n\t\n\t var keys = _.chain([]).concat(srcKeys).concat(dstKeys).uniq().without('$$hashKey').value();\n\t\n\t return keys.reduce(function (diff, k) {\n\t var srcValue = src[k];\n\t var dstValue = dst[k];\n\t\n\t if (_.isDate(srcValue) && _.isDate(dstValue)) {\n\t if (srcValue.getTime() != dstValue.getTime()) diff[k] = dstValue;\n\t }\n\t\n\t if (_.isObject(srcValue) && _.isObject(dstValue)) {\n\t var valueDiff = getDifference(srcValue, dstValue);\n\t utils.setFilled(diff, k, valueDiff);\n\t } else if (srcValue !== dstValue) {\n\t diff[k] = dstValue;\n\t }\n\t\n\t return diff;\n\t }, {});\n\t };\n\t\n\t return getDifference;\n\t }();\n\t\n\t var getUpdates = function () {\n\t var getUpdates = function getUpdates(src, dst, isShallow) {\n\t utils.assert(_.isObject(src), 'first argument must be an object');\n\t utils.assert(_.isObject(dst), 'second argument must be an object');\n\t\n\t var diff = getDifference(src, dst, isShallow);\n\t var paths = utils.toPaths(diff);\n\t\n\t var set = createSet(paths);\n\t var unset = createUnset(paths);\n\t var pull = createPull(unset);\n\t\n\t var updates = {};\n\t utils.setFilled(updates, '$set', set);\n\t utils.setFilled(updates, '$unset', unset);\n\t utils.setFilled(updates, '$pull', pull);\n\t\n\t return updates;\n\t };\n\t\n\t var createSet = function createSet(paths) {\n\t var undefinedKeys = getUndefinedKeys(paths);\n\t return _.omit(paths, undefinedKeys);\n\t };\n\t\n\t var createUnset = function createUnset(paths) {\n\t var undefinedKeys = getUndefinedKeys(paths);\n\t var unset = _.pick(paths, undefinedKeys);\n\t\n\t return _.reduce(unset, function (result, v, k) {\n\t result[k] = true;\n\t return result;\n\t }, {});\n\t };\n\t\n\t var createPull = function createPull(unset) {\n\t var arrKeyPaths = _.keys(unset).map(function (k) {\n\t var split = k.match(/(.*)\\.\\d+$/);\n\t return split && split[1];\n\t });\n\t\n\t return _.compact(arrKeyPaths).reduce(function (pull, k) {\n\t pull[k] = null;\n\t return pull;\n\t }, {});\n\t };\n\t\n\t var getUndefinedKeys = function getUndefinedKeys(obj) {\n\t return _.keys(obj).filter(function (k) {\n\t var v = obj[k];\n\t return _.isUndefined(v);\n\t });\n\t };\n\t\n\t return getUpdates;\n\t }();\n\t\n\t module.value('getUpdates', getUpdates);\n\t})();\n\n/***/ },\n/* 2 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, _, Package\n\t */\n\t\n\t'use strict';\n\t\n\tvar _module = angular.module('diffArray', ['getUpdates']);\n\t\n\t_module.factory('diffArray', ['getUpdates', function (getUpdates) {\n\t var LocalCollection = Package.minimongo.LocalCollection;\n\t var idStringify = LocalCollection._idStringify || Package['mongo-id'].MongoID.idStringify;\n\t var idParse = LocalCollection._idParse || Package['mongo-id'].MongoID.idParse;\n\t\n\t // Calculates the differences between `lastSeqArray` and\n\t // `seqArray` and calls appropriate functions from `callbacks`.\n\t // Reuses Minimongo's diff algorithm implementation.\n\t // XXX Should be replaced with the original diffArray function here:\n\t // https://github.com/meteor/meteor/blob/devel/packages/observe-sequence/observe_sequence.js#L152\n\t // When it will become nested as well, tracking here: https://github.com/meteor/meteor/issues/3764\n\t function diffArray(lastSeqArray, seqArray, callbacks, preventNestedDiff) {\n\t preventNestedDiff = !!preventNestedDiff;\n\t\n\t var diffFn = Package.minimongo.LocalCollection._diffQueryOrderedChanges || Package['diff-sequence'].DiffSequence.diffQueryOrderedChanges;\n\t\n\t var oldObjIds = [];\n\t var newObjIds = [];\n\t var posOld = {}; // maps from idStringify'd ids\n\t var posNew = {}; // ditto\n\t var posCur = {};\n\t var lengthCur = lastSeqArray.length;\n\t\n\t _.each(seqArray, function (doc, i) {\n\t newObjIds.push({ _id: doc._id });\n\t posNew[idStringify(doc._id)] = i;\n\t });\n\t\n\t _.each(lastSeqArray, function (doc, i) {\n\t oldObjIds.push({ _id: doc._id });\n\t posOld[idStringify(doc._id)] = i;\n\t posCur[idStringify(doc._id)] = i;\n\t });\n\t\n\t // Arrays can contain arbitrary objects. We don't diff the\n\t // objects. Instead we always fire 'changedAt' callback on every\n\t // object. The consumer of `observe-sequence` should deal with\n\t // it appropriately.\n\t diffFn(oldObjIds, newObjIds, {\n\t addedBefore: function addedBefore(id, doc, before) {\n\t var position = before ? posCur[idStringify(before)] : lengthCur;\n\t\n\t _.each(posCur, function (pos, id) {\n\t if (pos >= position) posCur[id]++;\n\t });\n\t\n\t lengthCur++;\n\t posCur[idStringify(id)] = position;\n\t\n\t callbacks.addedAt(id, seqArray[posNew[idStringify(id)]], position, before);\n\t },\n\t\n\t movedBefore: function movedBefore(id, before) {\n\t var prevPosition = posCur[idStringify(id)];\n\t var position = before ? posCur[idStringify(before)] : lengthCur - 1;\n\t\n\t _.each(posCur, function (pos, id) {\n\t if (pos >= prevPosition && pos <= position) posCur[id]--;else if (pos <= prevPosition && pos >= position) posCur[id]++;\n\t });\n\t\n\t posCur[idStringify(id)] = position;\n\t\n\t callbacks.movedTo(id, seqArray[posNew[idStringify(id)]], prevPosition, position, before);\n\t },\n\t removed: function removed(id) {\n\t var prevPosition = posCur[idStringify(id)];\n\t\n\t _.each(posCur, function (pos, id) {\n\t if (pos >= prevPosition) posCur[id]--;\n\t });\n\t\n\t delete posCur[idStringify(id)];\n\t lengthCur--;\n\t\n\t callbacks.removedAt(id, lastSeqArray[posOld[idStringify(id)]], prevPosition);\n\t }\n\t });\n\t\n\t _.each(posNew, function (pos, idString) {\n\t if (!_.has(posOld, idString)) return;\n\t\n\t var id = idParse(idString);\n\t var newItem = seqArray[pos] || {};\n\t var oldItem = lastSeqArray[posOld[idString]];\n\t var updates = getUpdates(oldItem, newItem, preventNestedDiff);\n\t\n\t if (!_.isEmpty(updates)) callbacks.changedAt(id, updates, pos, oldItem);\n\t });\n\t }\n\t\n\t diffArray.shallow = function (lastSeqArray, seqArray, callbacks) {\n\t return diffArray(lastSeqArray, seqArray, callbacks, true);\n\t };\n\t\n\t diffArray.deepCopyChanges = function (oldItem, newItem) {\n\t var setDiff = getUpdates(oldItem, newItem).$set;\n\t\n\t _.each(setDiff, function (v, deepKey) {\n\t setDeep(oldItem, deepKey, v);\n\t });\n\t };\n\t\n\t diffArray.deepCopyRemovals = function (oldItem, newItem) {\n\t var unsetDiff = getUpdates(oldItem, newItem).$unset;\n\t\n\t _.each(unsetDiff, function (v, deepKey) {\n\t unsetDeep(oldItem, deepKey);\n\t });\n\t };\n\t\n\t // Finds changes between two collections\n\t diffArray.getChanges = function (newCollection, oldCollection, diffMethod) {\n\t var changes = { added: [], removed: [], changed: [] };\n\t\n\t diffMethod(oldCollection, newCollection, {\n\t addedAt: function addedAt(id, item, index) {\n\t changes.added.push({ item: item, index: index });\n\t },\n\t\n\t removedAt: function removedAt(id, item, index) {\n\t changes.removed.push({ item: item, index: index });\n\t },\n\t\n\t changedAt: function changedAt(id, updates, index, oldItem) {\n\t changes.changed.push({ selector: id, modifier: updates });\n\t },\n\t\n\t movedTo: function movedTo(id, item, fromIndex, toIndex) {\n\t // XXX do we need this?\n\t }\n\t });\n\t\n\t return changes;\n\t };\n\t\n\t var setDeep = function setDeep(obj, deepKey, v) {\n\t var split = deepKey.split('.');\n\t var initialKeys = _.initial(split);\n\t var lastKey = _.last(split);\n\t\n\t initialKeys.reduce(function (subObj, k, i) {\n\t var nextKey = split[i + 1];\n\t\n\t if (isNumStr(nextKey)) {\n\t if (subObj[k] === null) subObj[k] = [];\n\t if (subObj[k].length == parseInt(nextKey)) subObj[k].push(null);\n\t } else if (subObj[k] === null || !isHash(subObj[k])) {\n\t subObj[k] = {};\n\t }\n\t\n\t return subObj[k];\n\t }, obj);\n\t\n\t var deepObj = getDeep(obj, initialKeys);\n\t deepObj[lastKey] = v;\n\t return v;\n\t };\n\t\n\t var unsetDeep = function unsetDeep(obj, deepKey) {\n\t var split = deepKey.split('.');\n\t var initialKeys = _.initial(split);\n\t var lastKey = _.last(split);\n\t var deepObj = getDeep(obj, initialKeys);\n\t\n\t if (_.isArray(deepObj) && isNumStr(lastKey)) return !!deepObj.splice(lastKey, 1);else return delete deepObj[lastKey];\n\t };\n\t\n\t var getDeep = function getDeep(obj, keys) {\n\t return keys.reduce(function (subObj, k) {\n\t return subObj[k];\n\t }, obj);\n\t };\n\t\n\t var isHash = function isHash(obj) {\n\t return _.isObject(obj) && Object.getPrototypeOf(obj) === Object.prototype;\n\t };\n\t\n\t var isNumStr = function isNumStr(str) {\n\t return str.match(/^\\d+$/);\n\t };\n\t\n\t return diffArray;\n\t}]);\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tangular.module('angular-meteor.settings', []).constant('$angularMeteorSettings', {\n\t suppressWarnings: false\n\t});\n\n/***/ },\n/* 4 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tangular.module('angular-meteor.ironrouter', []).run(['$compile', '$document', '$rootScope', function ($compile, $document, $rootScope) {\n\t var Router = (Package['iron:router'] || {}).Router;\n\t if (!Router) return;\n\t\n\t var isLoaded = false;\n\t\n\t // Recompile after iron:router builds page\n\t Router.onAfterAction(function (req, res, next) {\n\t Tracker.afterFlush(function () {\n\t if (isLoaded) return;\n\t $compile($document)($rootScope);\n\t if (!$rootScope.$$phase) $rootScope.$apply();\n\t isLoaded = true;\n\t });\n\t });\n\t}]);\n\n/***/ },\n/* 5 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, _, Tracker, EJSON, FS, Mongo\n\t */\n\t\n\t'use strict';\n\t\n\tvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\t\n\tvar angularMeteorUtils = angular.module('angular-meteor.utils', ['angular-meteor.settings']);\n\t\n\tangularMeteorUtils.service('$meteorUtils', ['$q', '$timeout', '$angularMeteorSettings', function ($q, $timeout, $angularMeteorSettings) {\n\t\n\t var self = this;\n\t\n\t this.autorun = function (scope, fn) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.utils.autorun] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.6/autorun. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t // wrapping around Deps.autorun\n\t var comp = Tracker.autorun(function (c) {\n\t fn(c);\n\t // this is run immediately for the first call\n\t // but after that, we need to $apply to start Angular digest\n\t if (!c.firstRun) $timeout(angular.noop, 0);\n\t });\n\t\n\t // stop autorun when scope is destroyed\n\t scope.$on('$destroy', function () {\n\t comp.stop();\n\t });\n\t\n\t // return autorun object so that it can be stopped manually\n\t return comp;\n\t };\n\t\n\t // Borrowed from angularFire\n\t // https://github.com/firebase/angularfire/blob/master/src/utils.js#L445-L454\n\t this.stripDollarPrefixedKeys = function (data) {\n\t if (!_.isObject(data) || data instanceof Date || data instanceof File || EJSON.toJSONValue(data).$type === 'oid' || (typeof FS === 'undefined' ? 'undefined' : _typeof(FS)) === 'object' && data instanceof FS.File) return data;\n\t\n\t var out = _.isArray(data) ? [] : {};\n\t\n\t _.each(data, function (v, k) {\n\t if (typeof k !== 'string' || k.charAt(0) !== '$') out[k] = self.stripDollarPrefixedKeys(v);\n\t });\n\t\n\t return out;\n\t };\n\t\n\t // Returns a callback which fulfills promise\n\t this.fulfill = function (deferred, boundError, boundResult) {\n\t return function (err, result) {\n\t if (err) deferred.reject(boundError == null ? err : boundError);else if (typeof boundResult == \"function\") deferred.resolve(boundResult == null ? result : boundResult(result));else deferred.resolve(boundResult == null ? result : boundResult);\n\t };\n\t };\n\t\n\t // creates a function which invokes method with the given arguments and returns a promise\n\t this.promissor = function (obj, method) {\n\t return function () {\n\t var deferred = $q.defer();\n\t var fulfill = self.fulfill(deferred);\n\t var args = _.toArray(arguments).concat(fulfill);\n\t obj[method].apply(obj, args);\n\t return deferred.promise;\n\t };\n\t };\n\t\n\t // creates a $q.all() promise and call digestion loop on fulfillment\n\t this.promiseAll = function (promises) {\n\t var allPromise = $q.all(promises);\n\t\n\t allPromise.finally(function () {\n\t // calls digestion loop with no conflicts\n\t $timeout(angular.noop);\n\t });\n\t\n\t return allPromise;\n\t };\n\t\n\t this.getCollectionByName = function (string) {\n\t return Mongo.Collection.get(string);\n\t };\n\t\n\t this.findIndexById = function (collection, doc) {\n\t var foundDoc = _.find(collection, function (colDoc) {\n\t // EJSON.equals used to compare Mongo.ObjectIDs and Strings.\n\t return EJSON.equals(colDoc._id, doc._id);\n\t });\n\t\n\t return _.indexOf(collection, foundDoc);\n\t };\n\t}]);\n\t\n\tangularMeteorUtils.run(['$rootScope', '$meteorUtils', function ($rootScope, $meteorUtils) {\n\t Object.getPrototypeOf($rootScope).$meteorAutorun = function (fn) {\n\t return $meteorUtils.autorun(this, fn);\n\t };\n\t}]);\n\n/***/ },\n/* 6 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, Meteor\n\t */\n\t\n\t'use strict';\n\t\n\tvar angularMeteorSubscribe = angular.module('angular-meteor.subscribe', ['angular-meteor.settings']);\n\t\n\tangularMeteorSubscribe.service('$meteorSubscribe', ['$q', '$angularMeteorSettings', function ($q, $angularMeteorSettings) {\n\t\n\t var self = this;\n\t\n\t this._subscribe = function (scope, deferred, args) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.subscribe] Please note that this module is deprecated since 1.3.0 and will be removed in 1.4.0! Replace it with the new syntax described here: http://www.angular-meteor.com/api/1.3.6/subscribe. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t var subscription = null;\n\t var lastArg = args[args.length - 1];\n\t\n\t // User supplied onStop callback\n\t // save it for later use and remove\n\t // from subscription arguments\n\t if (angular.isObject(lastArg) && angular.isFunction(lastArg.onStop)) {\n\t var _onStop = lastArg.onStop;\n\t\n\t args.pop();\n\t }\n\t\n\t args.push({\n\t onReady: function onReady() {\n\t deferred.resolve(subscription);\n\t },\n\t onStop: function onStop(err) {\n\t if (!deferred.promise.$$state.status) {\n\t if (err) deferred.reject(err);else deferred.reject(new Meteor.Error(\"Subscription Stopped\", \"Subscription stopped by a call to stop method. Either by the client or by the server.\"));\n\t } else if (_onStop)\n\t // After promise was resolved or rejected\n\t // call user supplied onStop callback.\n\t _onStop.apply(this, Array.prototype.slice.call(arguments));\n\t }\n\t });\n\t\n\t subscription = Meteor.subscribe.apply(scope, args);\n\t\n\t return subscription;\n\t };\n\t\n\t this.subscribe = function () {\n\t var deferred = $q.defer();\n\t var args = Array.prototype.slice.call(arguments);\n\t var subscription = null;\n\t\n\t self._subscribe(this, deferred, args);\n\t\n\t return deferred.promise;\n\t };\n\t}]);\n\t\n\tangularMeteorSubscribe.run(['$rootScope', '$q', '$meteorSubscribe', function ($rootScope, $q, $meteorSubscribe) {\n\t Object.getPrototypeOf($rootScope).$meteorSubscribe = function () {\n\t var deferred = $q.defer();\n\t var args = Array.prototype.slice.call(arguments);\n\t\n\t var subscription = $meteorSubscribe._subscribe(this, deferred, args);\n\t\n\t this.$on('$destroy', function () {\n\t subscription.stop();\n\t });\n\t\n\t return deferred.promise;\n\t };\n\t}]);\n\n/***/ },\n/* 7 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, _, Tracker, check, Match, Mongo\n\t */\n\t\n\t'use strict';\n\t\n\tvar angularMeteorCollection = angular.module('angular-meteor.collection', ['angular-meteor.stopper', 'angular-meteor.subscribe', 'angular-meteor.utils', 'diffArray', 'angular-meteor.settings']);\n\t\n\t// The reason angular meteor collection is a factory function and not something\n\t// that inherit from array comes from here:\n\t// http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/\n\t// We went with the direct extensions approach.\n\tangularMeteorCollection.factory('AngularMeteorCollection', ['$q', '$meteorSubscribe', '$meteorUtils', '$rootScope', '$timeout', 'diffArray', '$angularMeteorSettings', function ($q, $meteorSubscribe, $meteorUtils, $rootScope, $timeout, diffArray, $angularMeteorSettings) {\n\t\n\t function AngularMeteorCollection(curDefFunc, collection, diffArrayFunc, autoClientSave) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.$meteorCollection] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/meteorCollection. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t var data = [];\n\t // Server backup data to evaluate what changes come from client\n\t // after each server update.\n\t data._serverBackup = [];\n\t // Array differ function.\n\t data._diffArrayFunc = diffArrayFunc;\n\t // Handler of the cursor observer.\n\t data._hObserve = null;\n\t // On new cursor autorun handler\n\t // (autorun for reactive variables).\n\t data._hNewCurAutorun = null;\n\t // On new data autorun handler\n\t // (autorun for cursor.fetch).\n\t data._hDataAutorun = null;\n\t\n\t if (angular.isDefined(collection)) {\n\t data.$$collection = collection;\n\t } else {\n\t var cursor = curDefFunc();\n\t data.$$collection = $meteorUtils.getCollectionByName(cursor.collection.name);\n\t }\n\t\n\t _.extend(data, AngularMeteorCollection);\n\t data._startCurAutorun(curDefFunc, autoClientSave);\n\t\n\t return data;\n\t }\n\t\n\t AngularMeteorCollection._startCurAutorun = function (curDefFunc, autoClientSave) {\n\t var self = this;\n\t\n\t self._hNewCurAutorun = Tracker.autorun(function () {\n\t // When the reactive func gets recomputated we need to stop any previous\n\t // observeChanges.\n\t Tracker.onInvalidate(function () {\n\t self._stopCursor();\n\t });\n\t\n\t if (autoClientSave) self._setAutoClientSave();\n\t self._updateCursor(curDefFunc(), autoClientSave);\n\t });\n\t };\n\t\n\t AngularMeteorCollection.subscribe = function () {\n\t $meteorSubscribe.subscribe.apply(this, arguments);\n\t return this;\n\t };\n\t\n\t AngularMeteorCollection.save = function (docs, useUnsetModifier) {\n\t // save whole collection\n\t if (!docs) docs = this;\n\t // save single doc\n\t docs = [].concat(docs);\n\t\n\t var promises = docs.map(function (doc) {\n\t return this._upsertDoc(doc, useUnsetModifier);\n\t }, this);\n\t\n\t return $meteorUtils.promiseAll(promises);\n\t };\n\t\n\t AngularMeteorCollection._upsertDoc = function (doc, useUnsetModifier) {\n\t var deferred = $q.defer();\n\t var collection = this.$$collection;\n\t var createFulfill = _.partial($meteorUtils.fulfill, deferred, null);\n\t\n\t // delete $$hashkey\n\t doc = $meteorUtils.stripDollarPrefixedKeys(doc);\n\t var docId = doc._id;\n\t var isExist = collection.findOne(docId);\n\t\n\t // update\n\t if (isExist) {\n\t // Deletes _id property (from the copy) so that\n\t // it can be $set using update.\n\t delete doc._id;\n\t var modifier = useUnsetModifier ? { $unset: doc } : { $set: doc };\n\t // NOTE: do not use #upsert() method, since it does not exist in some collections\n\t collection.update(docId, modifier, createFulfill(function () {\n\t return { _id: docId, action: 'updated' };\n\t }));\n\t }\n\t // insert\n\t else {\n\t collection.insert(doc, createFulfill(function (id) {\n\t return { _id: id, action: 'inserted' };\n\t }));\n\t }\n\t\n\t return deferred.promise;\n\t };\n\t\n\t // performs $pull operations parallely.\n\t // used for handling splice operations returned from getUpdates() to prevent conflicts.\n\t // see issue: https://github.com/Urigo/angular-meteor/issues/793\n\t AngularMeteorCollection._updateDiff = function (selector, update, callback) {\n\t callback = callback || angular.noop;\n\t var setters = _.omit(update, '$pull');\n\t var updates = [setters];\n\t\n\t _.each(update.$pull, function (pull, prop) {\n\t var puller = {};\n\t puller[prop] = pull;\n\t updates.push({ $pull: puller });\n\t });\n\t\n\t this._updateParallel(selector, updates, callback);\n\t };\n\t\n\t // performs each update operation parallely\n\t AngularMeteorCollection._updateParallel = function (selector, updates, callback) {\n\t var self = this;\n\t var done = _.after(updates.length, callback);\n\t\n\t var next = function next(err, affectedDocsNum) {\n\t if (err) return callback(err);\n\t done(null, affectedDocsNum);\n\t };\n\t\n\t _.each(updates, function (update) {\n\t self.$$collection.update(selector, update, next);\n\t });\n\t };\n\t\n\t AngularMeteorCollection.remove = function (keyOrDocs) {\n\t var keys;\n\t\n\t // remove whole collection\n\t if (!keyOrDocs) {\n\t keys = _.pluck(this, '_id');\n\t }\n\t // remove docs\n\t else {\n\t keyOrDocs = [].concat(keyOrDocs);\n\t\n\t keys = _.map(keyOrDocs, function (keyOrDoc) {\n\t return keyOrDoc._id || keyOrDoc;\n\t });\n\t }\n\t\n\t // Checks if all keys are correct.\n\t check(keys, [Match.OneOf(String, Mongo.ObjectID)]);\n\t\n\t var promises = keys.map(function (key) {\n\t return this._removeDoc(key);\n\t }, this);\n\t\n\t return $meteorUtils.promiseAll(promises);\n\t };\n\t\n\t AngularMeteorCollection._removeDoc = function (id) {\n\t var deferred = $q.defer();\n\t var collection = this.$$collection;\n\t var fulfill = $meteorUtils.fulfill(deferred, null, { _id: id, action: 'removed' });\n\t collection.remove(id, fulfill);\n\t return deferred.promise;\n\t };\n\t\n\t AngularMeteorCollection._updateCursor = function (cursor, autoClientSave) {\n\t var self = this;\n\t // XXX - consider adding an option for a non-orderd result for faster performance\n\t if (self._hObserve) self._stopObserving();\n\t\n\t self._hObserve = cursor.observe({\n\t addedAt: function addedAt(doc, atIndex) {\n\t self.splice(atIndex, 0, doc);\n\t self._serverBackup.splice(atIndex, 0, doc);\n\t self._setServerUpdateMode();\n\t },\n\t\n\t changedAt: function changedAt(doc, oldDoc, atIndex) {\n\t diffArray.deepCopyChanges(self[atIndex], doc);\n\t diffArray.deepCopyRemovals(self[atIndex], doc);\n\t self._serverBackup[atIndex] = self[atIndex];\n\t self._setServerUpdateMode();\n\t },\n\t\n\t movedTo: function movedTo(doc, fromIndex, toIndex) {\n\t self.splice(fromIndex, 1);\n\t self.splice(toIndex, 0, doc);\n\t self._serverBackup.splice(fromIndex, 1);\n\t self._serverBackup.splice(toIndex, 0, doc);\n\t self._setServerUpdateMode();\n\t },\n\t\n\t removedAt: function removedAt(oldDoc) {\n\t var removedIndex = $meteorUtils.findIndexById(self, oldDoc);\n\t\n\t if (removedIndex != -1) {\n\t self.splice(removedIndex, 1);\n\t self._serverBackup.splice(removedIndex, 1);\n\t self._setServerUpdateMode();\n\t } else {\n\t // If it's been removed on client then it's already not in collection\n\t // itself but still is in the _serverBackup.\n\t removedIndex = $meteorUtils.findIndexById(self._serverBackup, oldDoc);\n\t\n\t if (removedIndex != -1) {\n\t self._serverBackup.splice(removedIndex, 1);\n\t }\n\t }\n\t }\n\t });\n\t\n\t self._hDataAutorun = Tracker.autorun(function () {\n\t cursor.fetch();\n\t if (self._serverMode) self._unsetServerUpdateMode(autoClientSave);\n\t });\n\t };\n\t\n\t AngularMeteorCollection._stopObserving = function () {\n\t this._hObserve.stop();\n\t this._hDataAutorun.stop();\n\t delete this._serverMode;\n\t delete this._hUnsetTimeout;\n\t };\n\t\n\t AngularMeteorCollection._setServerUpdateMode = function (name) {\n\t this._serverMode = true;\n\t // To simplify server update logic, we don't follow\n\t // updates from the client at the same time.\n\t this._unsetAutoClientSave();\n\t };\n\t\n\t // Here we use $timeout to combine multiple updates that go\n\t // each one after another.\n\t AngularMeteorCollection._unsetServerUpdateMode = function (autoClientSave) {\n\t var self = this;\n\t\n\t if (self._hUnsetTimeout) {\n\t $timeout.cancel(self._hUnsetTimeout);\n\t self._hUnsetTimeout = null;\n\t }\n\t\n\t self._hUnsetTimeout = $timeout(function () {\n\t self._serverMode = false;\n\t // Finds updates that was potentially done from the client side\n\t // and saves them.\n\t var changes = diffArray.getChanges(self, self._serverBackup, self._diffArrayFunc);\n\t self._saveChanges(changes);\n\t // After, continues following client updates.\n\t if (autoClientSave) self._setAutoClientSave();\n\t }, 0);\n\t };\n\t\n\t AngularMeteorCollection.stop = function () {\n\t this._stopCursor();\n\t this._hNewCurAutorun.stop();\n\t };\n\t\n\t AngularMeteorCollection._stopCursor = function () {\n\t this._unsetAutoClientSave();\n\t\n\t if (this._hObserve) {\n\t this._hObserve.stop();\n\t this._hDataAutorun.stop();\n\t }\n\t\n\t this.splice(0);\n\t this._serverBackup.splice(0);\n\t };\n\t\n\t AngularMeteorCollection._unsetAutoClientSave = function (name) {\n\t if (this._hRegAutoBind) {\n\t this._hRegAutoBind();\n\t this._hRegAutoBind = null;\n\t }\n\t };\n\t\n\t AngularMeteorCollection._setAutoClientSave = function () {\n\t var self = this;\n\t\n\t // Always unsets auto save to keep only one $watch handler.\n\t self._unsetAutoClientSave();\n\t\n\t self._hRegAutoBind = $rootScope.$watch(function () {\n\t return self;\n\t }, function (nItems, oItems) {\n\t if (nItems === oItems) return;\n\t\n\t var changes = diffArray.getChanges(self, oItems, self._diffArrayFunc);\n\t self._unsetAutoClientSave();\n\t self._saveChanges(changes);\n\t self._setAutoClientSave();\n\t }, true);\n\t };\n\t\n\t AngularMeteorCollection._saveChanges = function (changes) {\n\t var self = this;\n\t\n\t // Saves added documents\n\t // Using reversed iteration to prevent indexes from changing during splice\n\t var addedDocs = changes.added.reverse().map(function (descriptor) {\n\t self.splice(descriptor.index, 1);\n\t return descriptor.item;\n\t });\n\t\n\t if (addedDocs.length) self.save(addedDocs);\n\t\n\t // Removes deleted documents\n\t var removedDocs = changes.removed.map(function (descriptor) {\n\t return descriptor.item;\n\t });\n\t\n\t if (removedDocs.length) self.remove(removedDocs);\n\t\n\t // Updates changed documents\n\t changes.changed.forEach(function (descriptor) {\n\t self._updateDiff(descriptor.selector, descriptor.modifier);\n\t });\n\t };\n\t\n\t return AngularMeteorCollection;\n\t}]);\n\t\n\tangularMeteorCollection.factory('$meteorCollectionFS', ['$meteorCollection', 'diffArray', '$angularMeteorSettings', function ($meteorCollection, diffArray, $angularMeteorSettings) {\n\t function $meteorCollectionFS(reactiveFunc, autoClientSave, collection) {\n\t\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.$meteorCollectionFS] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/files. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t return new $meteorCollection(reactiveFunc, autoClientSave, collection, diffArray.shallow);\n\t }\n\t\n\t return $meteorCollectionFS;\n\t}]);\n\t\n\tangularMeteorCollection.factory('$meteorCollection', ['AngularMeteorCollection', '$rootScope', 'diffArray', function (AngularMeteorCollection, $rootScope, diffArray) {\n\t function $meteorCollection(reactiveFunc, autoClientSave, collection, diffFn) {\n\t // Validate parameters\n\t if (!reactiveFunc) {\n\t throw new TypeError('The first argument of $meteorCollection is undefined.');\n\t }\n\t\n\t if (!(angular.isFunction(reactiveFunc) || angular.isFunction(reactiveFunc.find))) {\n\t throw new TypeError('The first argument of $meteorCollection must be a function or ' + 'a have a find function property.');\n\t }\n\t\n\t if (!angular.isFunction(reactiveFunc)) {\n\t collection = angular.isDefined(collection) ? collection : reactiveFunc;\n\t reactiveFunc = _.bind(reactiveFunc.find, reactiveFunc);\n\t }\n\t\n\t // By default auto save - true.\n\t autoClientSave = angular.isDefined(autoClientSave) ? autoClientSave : true;\n\t diffFn = diffFn || diffArray;\n\t return new AngularMeteorCollection(reactiveFunc, collection, diffFn, autoClientSave);\n\t }\n\t\n\t return $meteorCollection;\n\t}]);\n\t\n\tangularMeteorCollection.run(['$rootScope', '$meteorCollection', '$meteorCollectionFS', '$meteorStopper', function ($rootScope, $meteorCollection, $meteorCollectionFS, $meteorStopper) {\n\t var scopeProto = Object.getPrototypeOf($rootScope);\n\t scopeProto.$meteorCollection = $meteorStopper($meteorCollection);\n\t scopeProto.$meteorCollectionFS = $meteorStopper($meteorCollectionFS);\n\t}]);\n\n/***/ },\n/* 8 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, _, Mongo\n\t*/\n\t\n\t'use strict';\n\t\n\tvar angularMeteorObject = angular.module('angular-meteor.object', ['angular-meteor.utils', 'angular-meteor.subscribe', 'angular-meteor.collection', 'getUpdates', 'diffArray', 'angular-meteor.settings']);\n\t\n\tangularMeteorObject.factory('AngularMeteorObject', ['$q', '$meteorSubscribe', '$meteorUtils', 'diffArray', 'getUpdates', 'AngularMeteorCollection', '$angularMeteorSettings', function ($q, $meteorSubscribe, $meteorUtils, diffArray, getUpdates, AngularMeteorCollection, $angularMeteorSettings) {\n\t\n\t // A list of internals properties to not watch for, nor pass to the Document on update and etc.\n\t AngularMeteorObject.$$internalProps = ['$$collection', '$$options', '$$id', '$$hashkey', '$$internalProps', '$$scope', 'bind', 'save', 'reset', 'subscribe', 'stop', 'autorunComputation', 'unregisterAutoBind', 'unregisterAutoDestroy', 'getRawObject', '_auto', '_setAutos', '_eventEmitter', '_serverBackup', '_updateDiff', '_updateParallel', '_getId'];\n\t\n\t function AngularMeteorObject(collection, selector, options) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.$meteorObject] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/meteorObject. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t // Make data not be an object so we can extend it to preserve\n\t // Collection Helpers and the like\n\t var helpers = collection._helpers;\n\t var data = _.isFunction(helpers) ? Object.create(helpers.prototype) : {};\n\t var doc = collection.findOne(selector, options);\n\t var collectionExtension = _.pick(AngularMeteorCollection, '_updateParallel');\n\t _.extend(data, doc);\n\t _.extend(data, AngularMeteorObject);\n\t _.extend(data, collectionExtension);\n\t\n\t // Omit options that may spoil document finding\n\t data.$$options = _.omit(options, 'skip', 'limit');\n\t data.$$collection = collection;\n\t data.$$id = data._getId(selector);\n\t data._serverBackup = doc || {};\n\t\n\t return data;\n\t }\n\t\n\t AngularMeteorObject.getRawObject = function () {\n\t return angular.copy(_.omit(this, this.$$internalProps));\n\t };\n\t\n\t AngularMeteorObject.subscribe = function () {\n\t $meteorSubscribe.subscribe.apply(this, arguments);\n\t return this;\n\t };\n\t\n\t AngularMeteorObject.save = function (custom) {\n\t var deferred = $q.defer();\n\t var collection = this.$$collection;\n\t var createFulfill = _.partial($meteorUtils.fulfill, deferred, null);\n\t var oldDoc = collection.findOne(this.$$id);\n\t var mods;\n\t\n\t // update\n\t if (oldDoc) {\n\t if (custom) mods = { $set: custom };else {\n\t mods = getUpdates(oldDoc, this.getRawObject());\n\t // If there are no updates, there is nothing to do here, returning\n\t if (_.isEmpty(mods)) {\n\t return $q.when({ action: 'updated' });\n\t }\n\t }\n\t\n\t // NOTE: do not use #upsert() method, since it does not exist in some collections\n\t this._updateDiff(mods, createFulfill({ action: 'updated' }));\n\t }\n\t // insert\n\t else {\n\t if (custom) mods = _.clone(custom);else mods = this.getRawObject();\n\t\n\t mods._id = mods._id || this.$$id;\n\t collection.insert(mods, createFulfill({ action: 'inserted' }));\n\t }\n\t\n\t return deferred.promise;\n\t };\n\t\n\t AngularMeteorObject._updateDiff = function (update, callback) {\n\t var selector = this.$$id;\n\t AngularMeteorCollection._updateDiff.call(this, selector, update, callback);\n\t };\n\t\n\t AngularMeteorObject.reset = function (keepClientProps) {\n\t var self = this;\n\t var options = this.$$options;\n\t var id = this.$$id;\n\t var doc = this.$$collection.findOne(id, options);\n\t\n\t if (doc) {\n\t // extend SubObject\n\t var docKeys = _.keys(doc);\n\t var docExtension = _.pick(doc, docKeys);\n\t var clientProps;\n\t\n\t _.extend(self, docExtension);\n\t _.extend(self._serverBackup, docExtension);\n\t\n\t if (keepClientProps) {\n\t clientProps = _.intersection(_.keys(self), _.keys(self._serverBackup));\n\t } else {\n\t clientProps = _.keys(self);\n\t }\n\t\n\t var serverProps = _.keys(doc);\n\t var removedKeys = _.difference(clientProps, serverProps, self.$$internalProps);\n\t\n\t removedKeys.forEach(function (prop) {\n\t delete self[prop];\n\t delete self._serverBackup[prop];\n\t });\n\t } else {\n\t _.keys(this.getRawObject()).forEach(function (prop) {\n\t delete self[prop];\n\t });\n\t\n\t self._serverBackup = {};\n\t }\n\t };\n\t\n\t AngularMeteorObject.stop = function () {\n\t if (this.unregisterAutoDestroy) this.unregisterAutoDestroy();\n\t\n\t if (this.unregisterAutoBind) this.unregisterAutoBind();\n\t\n\t if (this.autorunComputation && this.autorunComputation.stop) this.autorunComputation.stop();\n\t };\n\t\n\t AngularMeteorObject._getId = function (selector) {\n\t var options = _.extend({}, this.$$options, {\n\t fields: { _id: 1 },\n\t reactive: false,\n\t transform: null\n\t });\n\t\n\t var doc = this.$$collection.findOne(selector, options);\n\t\n\t if (doc) return doc._id;\n\t if (selector instanceof Mongo.ObjectID) return selector;\n\t if (_.isString(selector)) return selector;\n\t return new Mongo.ObjectID();\n\t };\n\t\n\t return AngularMeteorObject;\n\t}]);\n\t\n\tangularMeteorObject.factory('$meteorObject', ['$rootScope', '$meteorUtils', 'getUpdates', 'AngularMeteorObject', function ($rootScope, $meteorUtils, getUpdates, AngularMeteorObject) {\n\t function $meteorObject(collection, id, auto, options) {\n\t // Validate parameters\n\t if (!collection) {\n\t throw new TypeError(\"The first argument of $meteorObject is undefined.\");\n\t }\n\t\n\t if (!angular.isFunction(collection.findOne)) {\n\t throw new TypeError(\"The first argument of $meteorObject must be a function or a have a findOne function property.\");\n\t }\n\t\n\t var data = new AngularMeteorObject(collection, id, options);\n\t // Making auto default true - http://stackoverflow.com/a/15464208/1426570\n\t data._auto = auto !== false;\n\t _.extend(data, $meteorObject);\n\t data._setAutos();\n\t return data;\n\t }\n\t\n\t $meteorObject._setAutos = function () {\n\t var self = this;\n\t\n\t this.autorunComputation = $meteorUtils.autorun($rootScope, function () {\n\t self.reset(true);\n\t });\n\t\n\t // Deep watches the model and performs autobind\n\t this.unregisterAutoBind = this._auto && $rootScope.$watch(function () {\n\t return self.getRawObject();\n\t }, function (item, oldItem) {\n\t if (item !== oldItem) self.save();\n\t }, true);\n\t\n\t this.unregisterAutoDestroy = $rootScope.$on('$destroy', function () {\n\t if (self && self.stop) self.pop();\n\t });\n\t };\n\t\n\t return $meteorObject;\n\t}]);\n\t\n\tangularMeteorObject.run(['$rootScope', '$meteorObject', '$meteorStopper', function ($rootScope, $meteorObject, $meteorStopper) {\n\t var scopeProto = Object.getPrototypeOf($rootScope);\n\t scopeProto.$meteorObject = $meteorStopper($meteorObject);\n\t}]);\n\n/***/ },\n/* 9 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, _, Package, Meteor\n\t */\n\t\n\t'use strict';\n\t\n\tvar angularMeteorUser = angular.module('angular-meteor.user', ['angular-meteor.utils', 'angular-meteor.core', 'angular-meteor.settings']);\n\t\n\t// requires package 'accounts-password'\n\tangularMeteorUser.service('$meteorUser', ['$rootScope', '$meteorUtils', '$q', '$angularMeteorSettings', function ($rootScope, $meteorUtils, $q, $angularMeteorSettings) {\n\t\n\t var pack = Package['accounts-base'];\n\t if (!pack) return;\n\t\n\t var self = this;\n\t var Accounts = pack.Accounts;\n\t\n\t this.waitForUser = function () {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.waitForUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t var deferred = $q.defer();\n\t\n\t $meteorUtils.autorun($rootScope, function () {\n\t if (!Meteor.loggingIn()) deferred.resolve(Meteor.user());\n\t }, true);\n\t\n\t return deferred.promise;\n\t };\n\t\n\t this.requireUser = function () {\n\t if (!$angularMeteorSettings.suppressWarnings) {\n\t console.warn('[angular-meteor.requireUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t }\n\t\n\t var deferred = $q.defer();\n\t\n\t $meteorUtils.autorun($rootScope, function () {\n\t if (!Meteor.loggingIn()) {\n\t if (Meteor.user() === null) deferred.reject(\"AUTH_REQUIRED\");else deferred.resolve(Meteor.user());\n\t }\n\t }, true);\n\t\n\t return deferred.promise;\n\t };\n\t\n\t this.requireValidUser = function (validatorFn) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.requireValidUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t return self.requireUser(true).then(function (user) {\n\t var valid = validatorFn(user);\n\t\n\t if (valid === true) return user;else if (typeof valid === \"string\") return $q.reject(valid);else return $q.reject(\"FORBIDDEN\");\n\t });\n\t };\n\t\n\t this.loginWithPassword = $meteorUtils.promissor(Meteor, 'loginWithPassword');\n\t this.createUser = $meteorUtils.promissor(Accounts, 'createUser');\n\t this.changePassword = $meteorUtils.promissor(Accounts, 'changePassword');\n\t this.forgotPassword = $meteorUtils.promissor(Accounts, 'forgotPassword');\n\t this.resetPassword = $meteorUtils.promissor(Accounts, 'resetPassword');\n\t this.verifyEmail = $meteorUtils.promissor(Accounts, 'verifyEmail');\n\t this.logout = $meteorUtils.promissor(Meteor, 'logout');\n\t this.logoutOtherClients = $meteorUtils.promissor(Meteor, 'logoutOtherClients');\n\t this.loginWithFacebook = $meteorUtils.promissor(Meteor, 'loginWithFacebook');\n\t this.loginWithTwitter = $meteorUtils.promissor(Meteor, 'loginWithTwitter');\n\t this.loginWithGoogle = $meteorUtils.promissor(Meteor, 'loginWithGoogle');\n\t this.loginWithGithub = $meteorUtils.promissor(Meteor, 'loginWithGithub');\n\t this.loginWithMeteorDeveloperAccount = $meteorUtils.promissor(Meteor, 'loginWithMeteorDeveloperAccount');\n\t this.loginWithMeetup = $meteorUtils.promissor(Meteor, 'loginWithMeetup');\n\t this.loginWithWeibo = $meteorUtils.promissor(Meteor, 'loginWithWeibo');\n\t}]);\n\t\n\tangularMeteorUser.run(['$rootScope', '$angularMeteorSettings', '$$Core', function ($rootScope, $angularMeteorSettings, $$Core) {\n\t\n\t var ScopeProto = Object.getPrototypeOf($rootScope);\n\t _.extend(ScopeProto, $$Core);\n\t\n\t $rootScope.autorun(function () {\n\t if (!Meteor.user) return;\n\t $rootScope.currentUser = Meteor.user();\n\t $rootScope.loggingIn = Meteor.loggingIn();\n\t });\n\t}]);\n\n/***/ },\n/* 10 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, _, Meteor\n\t */\n\t\n\t'use strict';\n\t\n\tvar angularMeteorMethods = angular.module('angular-meteor.methods', ['angular-meteor.utils', 'angular-meteor.settings']);\n\t\n\tangularMeteorMethods.service('$meteorMethods', ['$q', '$meteorUtils', '$angularMeteorSettings', function ($q, $meteorUtils, $angularMeteorSettings) {\n\t this.call = function () {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.$meteor.call] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/methods. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t var deferred = $q.defer();\n\t var fulfill = $meteorUtils.fulfill(deferred);\n\t var args = _.toArray(arguments).concat(fulfill);\n\t Meteor.call.apply(this, args);\n\t return deferred.promise;\n\t };\n\t}]);\n\n/***/ },\n/* 11 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, Session\n\t */\n\t\n\t'use strict';\n\t\n\tvar angularMeteorSession = angular.module('angular-meteor.session', ['angular-meteor.utils', 'angular-meteor.settings']);\n\t\n\tangularMeteorSession.factory('$meteorSession', ['$meteorUtils', '$parse', '$angularMeteorSettings', function ($meteorUtils, $parse, $angularMeteorSettings) {\n\t return function (session) {\n\t\n\t return {\n\t\n\t bind: function bind(scope, model) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.session.bind] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://www.angular-meteor.com/api/1.3.0/session. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t var getter = $parse(model);\n\t var setter = getter.assign;\n\t $meteorUtils.autorun(scope, function () {\n\t setter(scope, Session.get(session));\n\t });\n\t\n\t scope.$watch(model, function (newItem, oldItem) {\n\t Session.set(session, getter(scope));\n\t }, true);\n\t }\n\t };\n\t };\n\t}]);\n\n/***/ },\n/* 12 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, Package\n\t */\n\t\n\t'use strict';\n\t\n\tvar angularMeteorCamera = angular.module('angular-meteor.camera', ['angular-meteor.utils', 'angular-meteor.settings']);\n\t\n\t// requires package 'mdg:camera'\n\tangularMeteorCamera.service('$meteorCamera', ['$q', '$meteorUtils', '$angularMeteorSettings', function ($q, $meteorUtils, $angularMeteorSettings) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.camera] Please note that this module has moved to a separate package and is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/camera. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t var pack = Package['mdg:camera'];\n\t if (!pack) return;\n\t\n\t var MeteorCamera = pack.MeteorCamera;\n\t\n\t this.getPicture = function (options) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.camera] Please note that this module has moved to a separate package and is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/camera. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t options = options || {};\n\t var deferred = $q.defer();\n\t MeteorCamera.getPicture(options, $meteorUtils.fulfill(deferred));\n\t return deferred.promise;\n\t };\n\t}]);\n\n/***/ },\n/* 13 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular\n\t */\n\t\n\t'use strict';\n\t\n\tvar angularMeteorStopper = angular.module('angular-meteor.stopper', ['angular-meteor.subscribe']);\n\t\n\tangularMeteorStopper.factory('$meteorStopper', ['$q', '$meteorSubscribe', function ($q, $meteorSubscribe) {\n\t function $meteorStopper($meteorEntity) {\n\t return function () {\n\t var args = Array.prototype.slice.call(arguments);\n\t var meteorEntity = $meteorEntity.apply(this, args);\n\t\n\t angular.extend(meteorEntity, $meteorStopper);\n\t meteorEntity.$$scope = this;\n\t\n\t this.$on('$destroy', function () {\n\t meteorEntity.stop();\n\t if (meteorEntity.subscription) meteorEntity.subscription.stop();\n\t });\n\t\n\t return meteorEntity;\n\t };\n\t }\n\t\n\t $meteorStopper.subscribe = function () {\n\t var args = Array.prototype.slice.call(arguments);\n\t this.subscription = $meteorSubscribe._subscribe(this.$$scope, $q.defer(), args);\n\t return this;\n\t };\n\t\n\t return $meteorStopper;\n\t}]);\n\n/***/ },\n/* 14 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\tvar name = exports.name = 'angular-meteor.utilities';\n\tvar utils = exports.utils = '$$utils';\n\t\n\tangular.module(name, [])\n\t\n\t/*\n\t A utility service which is provided with general utility functions\n\t */\n\t.service(utils, ['$rootScope', function ($rootScope) {\n\t var self = this;\n\t\n\t // Checks if an object is a cursor\n\t this.isCursor = function (obj) {\n\t return obj instanceof Meteor.Collection.Cursor;\n\t };\n\t\n\t // Cheecks if an object is a scope\n\t this.isScope = function (obj) {\n\t return obj instanceof $rootScope.constructor;\n\t };\n\t\n\t // Checks if two objects are siblings\n\t this.areSiblings = function (obj1, obj2) {\n\t return _.isObject(obj1) && _.isObject(obj2) && Object.getPrototypeOf(obj1) === Object.getPrototypeOf(obj2);\n\t };\n\t\n\t // Binds function into a scpecified context. If an object is provided, will bind every\n\t // value in the object which is a function. If a tap function is provided, it will be\n\t // called right after the function has been invoked.\n\t this.bind = function (fn, context, tap) {\n\t tap = _.isFunction(tap) ? tap : angular.noop;\n\t if (_.isFunction(fn)) return bindFn(fn, context, tap);\n\t if (_.isObject(fn)) return bindObj(fn, context, tap);\n\t return fn;\n\t };\n\t\n\t function bindFn(fn, context, tap) {\n\t return function () {\n\t for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n\t args[_key] = arguments[_key];\n\t }\n\t\n\t var result = fn.apply(context, args);\n\t tap.call(context, {\n\t result: result,\n\t args: args\n\t });\n\t return result;\n\t };\n\t }\n\t\n\t function bindObj(obj, context, tap) {\n\t return _.keys(obj).reduce(function (bound, k) {\n\t bound[k] = self.bind(obj[k], context, tap);\n\t return bound;\n\t }, {});\n\t }\n\t}]);\n\n/***/ },\n/* 15 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\t\n\tvar name = exports.name = 'angular-meteor.mixer';\n\tvar Mixer = exports.Mixer = '$Mixer';\n\t\n\tangular.module(name, [])\n\t\n\t/*\n\t A service which lets us apply mixins into Scope.prototype.\n\t The flow is simple. Once we define a mixin, it will be stored in the `$Mixer`,\n\t and any time a `ChildScope` prototype is created\n\t it will be extended by the `$Mixer`.\n\t This concept is good because it keeps our code\n\t clean and simple, and easy to extend.\n\t So any time we would like to define a new behaviour to our scope,\n\t we will just use the `$Mixer` service.\n\t */\n\t.service(Mixer, function () {\n\t var _this = this;\n\t\n\t this._mixins = [];\n\t // Apply mixins automatically on specified contexts\n\t this._autoExtend = [];\n\t this._autoConstruct = [];\n\t\n\t // Adds a new mixin\n\t this.mixin = function (mixin) {\n\t if (!_.isObject(mixin)) {\n\t throw Error('argument 1 must be an object');\n\t }\n\t\n\t _this._mixins = _.union(_this._mixins, [mixin]);\n\t // Apply mixins to stored contexts\n\t _this._autoExtend.forEach(function (context) {\n\t return _this._extend(context);\n\t });\n\t _this._autoConstruct.forEach(function (context) {\n\t return _this._construct(context);\n\t });\n\t return _this;\n\t };\n\t\n\t // Removes a mixin. Useful mainly for test purposes\n\t this._mixout = function (mixin) {\n\t _this._mixins = _.without(_this._mixins, mixin);\n\t return _this;\n\t };\n\t\n\t // Invoke function mixins with the provided context and arguments\n\t this._construct = function (context) {\n\t for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n\t args[_key - 1] = arguments[_key];\n\t }\n\t\n\t _this._mixins.filter(_.isFunction).forEach(function (mixin) {\n\t mixin.call.apply(mixin, [context].concat(args));\n\t });\n\t\n\t return context;\n\t };\n\t\n\t // Extend prototype with the defined mixins\n\t this._extend = function (obj) {\n\t var _ref;\n\t\n\t return (_ref = _).extend.apply(_ref, [obj].concat(_toConsumableArray(_this._mixins)));\n\t };\n\t});\n\n/***/ },\n/* 16 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.name = undefined;\n\t\n\tvar _mixer = __webpack_require__(15);\n\t\n\tvar name = exports.name = 'angular-meteor.scope';\n\t\n\tangular.module(name, [_mixer.name]).run(['$rootScope', _mixer.Mixer, function ($rootScope, $Mixer) {\n\t var Scope = $rootScope.constructor;\n\t var $new = $rootScope.$new;\n\t\n\t // Apply extensions whether a mixin in defined.\n\t // Note that this way mixins which are initialized later\n\t // can be applied on rootScope.\n\t $Mixer._autoExtend.push(Scope.prototype);\n\t $Mixer._autoConstruct.push($rootScope);\n\t\n\t Scope.prototype.$new = function () {\n\t var scope = $new.apply(this, arguments);\n\t // Apply constructors to newly created scopes\n\t return $Mixer._construct(scope);\n\t };\n\t}]);\n\n/***/ },\n/* 17 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.Core = exports.name = undefined;\n\t\n\tvar _utils = __webpack_require__(14);\n\t\n\tvar _mixer = __webpack_require__(15);\n\t\n\tfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\t\n\tvar name = exports.name = 'angular-meteor.core';\n\tvar Core = exports.Core = '$$Core';\n\t\n\tangular.module(name, [_utils.name, _mixer.name])\n\t\n\t/*\n\t A mixin which provides us with core Meteor functions.\n\t */\n\t.factory(Core, ['$q', _utils.utils, function ($q, $$utils) {\n\t function $$Core() {}\n\t\n\t // Calls Meteor.autorun() which will be digested after each run and automatically destroyed\n\t $$Core.autorun = function (fn) {\n\t var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\t\n\t fn = this.$bindToContext(fn);\n\t\n\t if (!_.isFunction(fn)) {\n\t throw Error('argument 1 must be a function');\n\t }\n\t if (!_.isObject(options)) {\n\t throw Error('argument 2 must be an object');\n\t }\n\t\n\t var computation = Tracker.autorun(fn, options);\n\t this.$$autoStop(computation);\n\t return computation;\n\t };\n\t\n\t // Calls Meteor.subscribe() which will be digested after each invokation\n\t // and automatically destroyed\n\t $$Core.subscribe = function (subName, fn, cb) {\n\t fn = this.$bindToContext(fn || angular.noop);\n\t cb = cb ? this.$bindToContext(cb) : angular.noop;\n\t\n\t if (!_.isString(subName)) {\n\t throw Error('argument 1 must be a string');\n\t }\n\t if (!_.isFunction(fn)) {\n\t throw Error('argument 2 must be a function');\n\t }\n\t if (!_.isFunction(cb) && !_.isObject(cb)) {\n\t throw Error('argument 3 must be a function or an object');\n\t }\n\t\n\t var result = {};\n\t\n\t var computation = this.autorun(function () {\n\t var _Meteor;\n\t\n\t var args = fn();\n\t if (angular.isUndefined(args)) args = [];\n\t\n\t if (!_.isArray(args)) {\n\t throw Error('reactive function\\'s return value must be an array');\n\t }\n\t\n\t var subscription = (_Meteor = Meteor).subscribe.apply(_Meteor, [subName].concat(_toConsumableArray(args), [cb]));\n\t result.ready = subscription.ready.bind(subscription);\n\t result.subscriptionId = subscription.subscriptionId;\n\t });\n\t\n\t // Once the computation has been stopped,\n\t // any subscriptions made inside will be stopped as well\n\t result.stop = computation.stop.bind(computation);\n\t return result;\n\t };\n\t\n\t // Calls Meteor.call() wrapped by a digestion cycle\n\t $$Core.callMethod = function () {\n\t var _Meteor2;\n\t\n\t for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n\t args[_key] = arguments[_key];\n\t }\n\t\n\t var fn = args.pop();\n\t if (_.isFunction(fn)) fn = this.$bindToContext(fn);\n\t return (_Meteor2 = Meteor).call.apply(_Meteor2, args.concat([fn]));\n\t };\n\t\n\t // Calls Meteor.apply() wrapped by a digestion cycle\n\t $$Core.applyMethod = function () {\n\t var _Meteor3;\n\t\n\t for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n\t args[_key2] = arguments[_key2];\n\t }\n\t\n\t var fn = args.pop();\n\t if (_.isFunction(fn)) fn = this.$bindToContext(fn);\n\t return (_Meteor3 = Meteor).apply.apply(_Meteor3, args.concat([fn]));\n\t };\n\t\n\t $$Core.$$autoStop = function (stoppable) {\n\t this.$on('$destroy', stoppable.stop.bind(stoppable));\n\t };\n\t\n\t // Digests scope only if there is no phase at the moment\n\t $$Core.$$throttledDigest = function () {\n\t var isDigestable = !this.$$destroyed && !this.$$phase && !this.$root.$$phase;\n\t\n\t if (isDigestable) this.$digest();\n\t };\n\t\n\t // Creates a promise only that the digestion cycle will be called at its fulfillment\n\t $$Core.$$defer = function () {\n\t var deferred = $q.defer();\n\t // Once promise has been fulfilled, digest\n\t deferred.promise = deferred.promise.finally(this.$$throttledDigest.bind(this));\n\t return deferred;\n\t };\n\t\n\t // Binds an object or a function to the scope to the view model and digest it once it is invoked\n\t $$Core.$bindToContext = function (fn) {\n\t return $$utils.bind(fn, this, this.$$throttledDigest.bind(this));\n\t };\n\t\n\t return $$Core;\n\t}]);\n\n/***/ },\n/* 18 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.reactive = exports.ViewModel = exports.name = undefined;\n\t\n\tvar _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; }; }();\n\t\n\tvar _utils = __webpack_require__(14);\n\t\n\tvar _mixer = __webpack_require__(15);\n\t\n\tvar _core = __webpack_require__(17);\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tvar name = exports.name = 'angular-meteor.view-model';\n\tvar ViewModel = exports.ViewModel = '$$ViewModel';\n\tvar reactive = exports.reactive = '$reactive';\n\t\n\tangular.module(name, [_utils.name, _mixer.name, _core.name])\n\t\n\t/*\n\t A mixin which lets us bind a view model into a scope.\n\t Note that only a single view model can be bound,\n\t otherwise the scope might behave unexpectedly.\n\t Mainly used to define the controller as the view model,\n\t and very useful when wanting to use Angular's `controllerAs` syntax.\n\t */\n\t.factory(ViewModel, [_utils.utils, _mixer.Mixer, function ($$utils, $Mixer) {\n\t function $$ViewModel() {\n\t var vm = arguments.length <= 0 || arguments[0] === undefined ? this : arguments[0];\n\t\n\t // Defines the view model on the scope.\n\t this.$$vm = vm;\n\t }\n\t\n\t // Gets an object, wraps it with scope functions and returns it\n\t $$ViewModel.viewModel = function (vm) {\n\t var _this = this;\n\t\n\t if (!_.isObject(vm)) {\n\t throw Error('argument 1 must be an object');\n\t }\n\t\n\t // Apply mixin functions\n\t $Mixer._mixins.forEach(function (mixin) {\n\t // Reject methods which starts with double $\n\t var keys = _.keys(mixin).filter(function (k) {\n\t return k.match(/^(?!\\$\\$).*$/);\n\t });\n\t var proto = _.pick(mixin, keys);\n\t // Bind all the methods to the prototype\n\t var boundProto = $$utils.bind(proto, _this);\n\t // Add the methods to the view model\n\t _.extend(vm, boundProto);\n\t });\n\t\n\t // Apply mixin constructors on the view model\n\t $Mixer._construct(this, vm);\n\t return vm;\n\t };\n\t\n\t // Override $$Core.$bindToContext to be bound to view model instead of scope\n\t $$ViewModel.$bindToContext = function (fn) {\n\t return $$utils.bind(fn, this.$$vm, this.$$throttledDigest.bind(this));\n\t };\n\t\n\t return $$ViewModel;\n\t}])\n\t\n\t/*\n\t Illustrates the old API where a view model is created using $reactive service\n\t */\n\t.service(reactive, [_utils.utils, function ($$utils) {\n\t var Reactive = function () {\n\t function Reactive(vm) {\n\t var _this2 = this;\n\t\n\t _classCallCheck(this, Reactive);\n\t\n\t if (!_.isObject(vm)) {\n\t throw Error('argument 1 must be an object');\n\t }\n\t\n\t _.defer(function () {\n\t if (!_this2._attached) {\n\t console.warn('view model was not attached to any scope');\n\t }\n\t });\n\t\n\t this._vm = vm;\n\t }\n\t\n\t _createClass(Reactive, [{\n\t key: 'attach',\n\t value: function attach(scope) {\n\t this._attached = true;\n\t\n\t if (!$$utils.isScope(scope)) {\n\t throw Error('argument 1 must be a scope');\n\t }\n\t\n\t var viewModel = scope.viewModel(this._vm);\n\t\n\t // Similar to the old/Meteor API\n\t viewModel.call = viewModel.callMethod;\n\t viewModel.apply = viewModel.applyMethod;\n\t\n\t return viewModel;\n\t }\n\t }]);\n\t\n\t return Reactive;\n\t }();\n\t\n\t return function (vm) {\n\t return new Reactive(vm);\n\t };\n\t}]);\n\n/***/ },\n/* 19 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.Reactive = exports.name = undefined;\n\t\n\tvar _utils = __webpack_require__(14);\n\t\n\tvar _mixer = __webpack_require__(15);\n\t\n\tvar _core = __webpack_require__(17);\n\t\n\tvar _viewModel = __webpack_require__(18);\n\t\n\tvar name = exports.name = 'angular-meteor.reactive';\n\tvar Reactive = exports.Reactive = '$$Reactive';\n\t\n\tangular.module(name, [_utils.name, _mixer.name, _core.name, _viewModel.name])\n\t\n\t/*\n\t A mixin which enhance our reactive abilities by providing methods\n\t that are capable of updating our scope reactively.\n\t */\n\t.factory(Reactive, ['$parse', _utils.utils, function ($parse, $$utils) {\n\t function $$Reactive() {\n\t var vm = arguments.length <= 0 || arguments[0] === undefined ? this : arguments[0];\n\t\n\t // Helps us track changes made in the view model\n\t vm.$$dependencies = {};\n\t }\n\t\n\t // Gets an object containing functions and define their results as reactive properties.\n\t // Once a return value has been changed the property will be reset.\n\t $$Reactive.helpers = function () {\n\t var _this = this;\n\t\n\t var props = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t if (!_.isObject(props)) {\n\t throw Error('argument 1 must be an object');\n\t }\n\t\n\t _.each(props, function (v, k, i) {\n\t if (!_.isFunction(v)) {\n\t throw Error('helper ' + (i + 1) + ' must be a function');\n\t }\n\t\n\t if (!_this.$$vm.$$dependencies[k]) {\n\t // Registers a new dependency to the specified helper\n\t _this.$$vm.$$dependencies[k] = new Tracker.Dependency();\n\t }\n\t\n\t _this.$$setFnHelper(k, v);\n\t });\n\t };\n\t\n\t // Gets a model reactively\n\t $$Reactive.getReactively = function (k) {\n\t var isDeep = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];\n\t\n\t if (!_.isBoolean(isDeep)) {\n\t throw Error('argument 2 must be a boolean');\n\t }\n\t\n\t return this.$$reactivateEntity(k, this.$watch, isDeep);\n\t };\n\t\n\t // Gets a collection reactively\n\t $$Reactive.getCollectionReactively = function (k) {\n\t return this.$$reactivateEntity(k, this.$watchCollection);\n\t };\n\t\n\t // Gets an entity reactively, and once it has been changed the computation will be recomputed\n\t $$Reactive.$$reactivateEntity = function (k, watcher) {\n\t if (!_.isString(k)) {\n\t throw Error('argument 1 must be a string');\n\t }\n\t\n\t if (!this.$$vm.$$dependencies[k]) {\n\t this.$$vm.$$dependencies[k] = new Tracker.Dependency();\n\t\n\t for (var _len = arguments.length, watcherArgs = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n\t watcherArgs[_key - 2] = arguments[_key];\n\t }\n\t\n\t this.$$watchEntity.apply(this, [k, watcher].concat(watcherArgs));\n\t }\n\t\n\t this.$$vm.$$dependencies[k].depend();\n\t return $parse(k)(this.$$vm);\n\t };\n\t\n\t // Watches for changes in the view model, and if so will notify a change\n\t $$Reactive.$$watchEntity = function (k, watcher) {\n\t var _this2 = this;\n\t\n\t // Gets a deep property from the view model\n\t var getVal = _.partial($parse(k), this.$$vm);\n\t var initialVal = getVal();\n\t\n\t // Watches for changes in the view model\n\t\n\t for (var _len2 = arguments.length, watcherArgs = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {\n\t watcherArgs[_key2 - 2] = arguments[_key2];\n\t }\n\t\n\t watcher.call.apply(watcher, [this, getVal, function (val, oldVal) {\n\t var hasChanged = val !== initialVal || val !== oldVal;\n\t\n\t // Notify if a change has been detected\n\t if (hasChanged) _this2.$$changed(k);\n\t }].concat(watcherArgs));\n\t };\n\t\n\t // Invokes a function and sets the return value as a property\n\t $$Reactive.$$setFnHelper = function (k, fn) {\n\t var _this3 = this;\n\t\n\t this.autorun(function (computation) {\n\t // Invokes the reactive functon\n\t var model = fn.apply(_this3.$$vm);\n\t\n\t // Ignore notifications made by the following handler\n\t Tracker.nonreactive(function () {\n\t // If a cursor, observe its changes and update acoordingly\n\t if ($$utils.isCursor(model)) {\n\t (function () {\n\t var observation = _this3.$$handleCursor(k, model);\n\t\n\t computation.onInvalidate(function () {\n\t observation.stop();\n\t _this3.$$vm[k].splice(0);\n\t });\n\t })();\n\t } else {\n\t _this3.$$handleNonCursor(k, model);\n\t }\n\t\n\t // Notify change and update the view model\n\t _this3.$$changed(k);\n\t });\n\t });\n\t };\n\t\n\t // Sets a value helper as a setter and a getter which will notify computations once used\n\t $$Reactive.$$setValHelper = function (k, v) {\n\t var _this4 = this;\n\t\n\t var watch = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2];\n\t\n\t // If set, reactives property\n\t if (watch) {\n\t var isDeep = _.isObject(v);\n\t this.getReactively(k, isDeep);\n\t }\n\t\n\t Object.defineProperty(this.$$vm, k, {\n\t configurable: true,\n\t enumerable: true,\n\t\n\t get: function get() {\n\t return v;\n\t },\n\t set: function set(newVal) {\n\t v = newVal;\n\t _this4.$$changed(k);\n\t }\n\t });\n\t };\n\t\n\t // Fetching a cursor and updates properties once the result set has been changed\n\t $$Reactive.$$handleCursor = function (k, cursor) {\n\t var _this5 = this;\n\t\n\t // If not defined set it\n\t if (angular.isUndefined(this.$$vm[k])) {\n\t this.$$setValHelper(k, cursor.fetch(), false);\n\t }\n\t // If defined update it\n\t else {\n\t var diff = jsondiffpatch.diff(this.$$vm[k], cursor.fetch());\n\t jsondiffpatch.patch(this.$$vm[k], diff);\n\t }\n\t\n\t // Observe changes made in the result set\n\t var observation = cursor.observe({\n\t addedAt: function addedAt(doc, atIndex) {\n\t if (!observation) return;\n\t _this5.$$vm[k].splice(atIndex, 0, doc);\n\t _this5.$$changed(k);\n\t },\n\t changedAt: function changedAt(doc, oldDoc, atIndex) {\n\t var diff = jsondiffpatch.diff(_this5.$$vm[k][atIndex], doc);\n\t jsondiffpatch.patch(_this5.$$vm[k][atIndex], diff);\n\t _this5.$$changed(k);\n\t },\n\t movedTo: function movedTo(doc, fromIndex, toIndex) {\n\t _this5.$$vm[k].splice(fromIndex, 1);\n\t _this5.$$vm[k].splice(toIndex, 0, doc);\n\t _this5.$$changed(k);\n\t },\n\t removedAt: function removedAt(oldDoc, atIndex) {\n\t _this5.$$vm[k].splice(atIndex, 1);\n\t _this5.$$changed(k);\n\t }\n\t });\n\t\n\t return observation;\n\t };\n\t\n\t $$Reactive.$$handleNonCursor = function (k, data) {\n\t var v = this.$$vm[k];\n\t\n\t if (angular.isDefined(v)) {\n\t delete this.$$vm[k];\n\t v = null;\n\t }\n\t\n\t if (angular.isUndefined(v)) {\n\t this.$$setValHelper(k, data);\n\t }\n\t // Update property if the new value is from the same type\n\t else if ($$utils.areSiblings(v, data)) {\n\t var diff = jsondiffpatch.diff(v, data);\n\t jsondiffpatch.patch(v, diff);\n\t this.$$changed(k);\n\t } else {\n\t this.$$vm[k] = data;\n\t }\n\t };\n\t\n\t // Notifies dependency in view model\n\t $$Reactive.$$depend = function (k) {\n\t this.$$vm.$$dependencies[k].depend();\n\t };\n\t\n\t // Notifies change in view model\n\t $$Reactive.$$changed = function (k) {\n\t this.$$throttledDigest();\n\t this.$$vm.$$dependencies[k].changed();\n\t };\n\t\n\t return $$Reactive;\n\t}]);\n\n/***/ },\n/* 20 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\tvar name = exports.name = 'angular-templates';\n\t\n\ttry {\n\t angular.module(name);\n\t} catch (e) {\n\t angular.module(name, []);\n\t}\n\n/***/ }\n/******/ ]);\n\n\n/** WEBPACK FOOTER **\n ** dist/angular-meteor.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 506237d669ed75851a9d\n **/","// lib\nimport './lib/get-updates';\nimport './lib/diff-array';\n// legacy\nimport './modules/angular-meteor-settings';\nimport './modules/angular-meteor-ironrouter';\nimport './modules/angular-meteor-utils';\nimport './modules/angular-meteor-subscribe';\nimport './modules/angular-meteor-collection';\nimport './modules/angular-meteor-object';\nimport './modules/angular-meteor-user';\nimport './modules/angular-meteor-methods';\nimport './modules/angular-meteor-session';\nimport './modules/angular-meteor-camera';\nimport './modules/angular-meteor-stopper';\n\n// new\nimport { name as utilsName } from './modules/utils';\nimport { name as mixerName, Mixer } from './modules/mixer';\nimport { name as scopeName } from './modules/scope';\nimport { name as coreName, Core } from './modules/core';\nimport { name as viewModelName, ViewModel } from './modules/view-model';\nimport { name as reactiveName, Reactive } from './modules/reactive';\nimport { name as templatesName } from './modules/templates';\n\nexport const name = 'angular-meteor';\n\nangular.module(name, [\n // new\n utilsName,\n mixerName,\n scopeName,\n coreName,\n viewModelName,\n reactiveName,\n templatesName,\n\n // legacy\n 'angular-meteor.ironrouter',\n 'angular-meteor.utils',\n 'angular-meteor.subscribe',\n 'angular-meteor.collection',\n 'angular-meteor.object',\n 'angular-meteor.user',\n 'angular-meteor.methods',\n 'angular-meteor.session',\n 'angular-meteor.camera'\n\n])\n\n.run([\n Mixer,\n Core,\n ViewModel,\n Reactive,\n\n function($Mixer, $$Core, $$ViewModel, $$Reactive) {\n // Load all mixins\n $Mixer\n .mixin($$Core)\n .mixin($$ViewModel)\n .mixin($$Reactive);\n }\n])\n\n// legacy\n// Putting all services under $meteor service for syntactic sugar\n.service('$meteor', [\n '$meteorCollection',\n '$meteorCollectionFS',\n '$meteorObject',\n '$meteorMethods',\n '$meteorSession',\n '$meteorSubscribe',\n '$meteorUtils',\n '$meteorCamera',\n '$meteorUser',\n function($meteorCollection, $meteorCollectionFS, $meteorObject,\n $meteorMethods, $meteorSession, $meteorSubscribe, $meteorUtils,\n $meteorCamera, $meteorUser) {\n this.collection = $meteorCollection;\n this.collectionFS = $meteorCollectionFS;\n this.object = $meteorObject;\n this.subscribe = $meteorSubscribe.subscribe;\n this.call = $meteorMethods.call;\n this.session = $meteorSession;\n this.autorun = $meteorUtils.autorun;\n this.getCollectionByName = $meteorUtils.getCollectionByName;\n this.getPicture = $meteorCamera.getPicture;\n\n // $meteorUser\n [\n 'loginWithPassword',\n 'requireUser',\n 'requireValidUser',\n 'waitForUser',\n 'createUser',\n 'changePassword',\n 'forgotPassword',\n 'resetPassword',\n 'verifyEmail',\n 'loginWithMeteorDeveloperAccount',\n 'loginWithFacebook',\n 'loginWithGithub',\n 'loginWithGoogle',\n 'loginWithMeetup',\n 'loginWithTwitter',\n 'loginWithWeibo',\n 'logout',\n 'logoutOtherClients'\n ].forEach((method) => {\n this[method] = $meteorUser[method];\n });\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/angular-meteor.js\n **/","/*global\n angular, _\n */\n\n'use strict';\n\n// https://github.com/DAB0mB/get-updates\n(function() {\n var module = angular.module('getUpdates', []);\n\n var utils = (function() {\n var rip = function(obj, level) {\n if (level < 1) return {};\n\n return _.reduce(obj, function(clone, v, k) {\n v = _.isObject(v) ? rip(v, --level) : v;\n clone[k] = v;\n return clone;\n }, {});\n };\n\n var toPaths = function(obj) {\n var keys = getKeyPaths(obj);\n var values = getDeepValues(obj);\n return _.object(keys, values);\n };\n\n var getKeyPaths = function(obj) {\n var keys = _.keys(obj).map(function(k) {\n var v = obj[k];\n if (!_.isObject(v) || _.isEmpty(v) || _.isArray(v)) return k;\n\n return getKeyPaths(v).map(function(subKey) {\n return k + '.' + subKey;\n });\n });\n\n return _.flatten(keys);\n };\n\n var getDeepValues = function(obj,arr) {\n arr = arr || [];\n\n _.values(obj).forEach(function(v) {\n if (!_.isObject(v) || _.isEmpty(v) || _.isArray(v))\n arr.push(v);\n else\n getDeepValues(v, arr);\n });\n\n return arr;\n };\n\n var flatten = function(arr) {\n return arr.reduce(function(flattened, v, i) {\n if (_.isArray(v) && !_.isEmpty(v))\n flattened.push.apply(flattened, flatten(v));\n else\n flattened.push(v);\n\n return flattened;\n }, []);\n };\n\n var setFilled = function(obj, k, v) {\n if (!_.isEmpty(v)) obj[k] = v;\n };\n\n var assert = function(result, msg) {\n if (!result) throwErr(msg);\n };\n\n var throwErr = function(msg) {\n throw Error('get-updates error - ' + msg);\n };\n\n return {\n rip: rip,\n toPaths: toPaths,\n getKeyPaths: getKeyPaths,\n getDeepValues: getDeepValues,\n setFilled: setFilled,\n assert: assert,\n throwErr: throwErr\n };\n })();\n\n var getDifference = (function() {\n var getDifference = function(src, dst, isShallow) {\n var level;\n\n if (isShallow > 1)\n level = isShallow;\n else if (isShallow)\n level = 1;\n\n if (level) {\n src = utils.rip(src, level);\n dst = utils.rip(dst, level);\n }\n\n return compare(src, dst);\n };\n\n var compare = function(src, dst) {\n var srcKeys = _.keys(src);\n var dstKeys = _.keys(dst);\n\n var keys = _.chain([])\n .concat(srcKeys)\n .concat(dstKeys)\n .uniq()\n .without('$$hashKey')\n .value();\n\n return keys.reduce(function(diff, k) {\n var srcValue = src[k];\n var dstValue = dst[k];\n\n if (_.isDate(srcValue) && _.isDate(dstValue)) {\n if (srcValue.getTime() != dstValue.getTime()) diff[k] = dstValue;\n }\n\n if (_.isObject(srcValue) && _.isObject(dstValue)) {\n var valueDiff = getDifference(srcValue, dstValue);\n utils.setFilled(diff, k, valueDiff);\n }\n\n else if (srcValue !== dstValue) {\n diff[k] = dstValue;\n }\n\n return diff;\n }, {});\n };\n\n return getDifference;\n })();\n\n var getUpdates = (function() {\n var getUpdates = function(src, dst, isShallow) {\n utils.assert(_.isObject(src), 'first argument must be an object');\n utils.assert(_.isObject(dst), 'second argument must be an object');\n\n var diff = getDifference(src, dst, isShallow);\n var paths = utils.toPaths(diff);\n\n var set = createSet(paths);\n var unset = createUnset(paths);\n var pull = createPull(unset);\n\n var updates = {};\n utils.setFilled(updates, '$set', set);\n utils.setFilled(updates, '$unset', unset);\n utils.setFilled(updates, '$pull', pull);\n\n return updates;\n };\n\n var createSet = function(paths) {\n var undefinedKeys = getUndefinedKeys(paths);\n return _.omit(paths, undefinedKeys);\n };\n\n var createUnset = function(paths) {\n var undefinedKeys = getUndefinedKeys(paths);\n var unset = _.pick(paths, undefinedKeys);\n\n return _.reduce(unset, function(result, v, k) {\n result[k] = true;\n return result;\n }, {});\n };\n\n var createPull = function(unset) {\n var arrKeyPaths = _.keys(unset).map(function(k) {\n var split = k.match(/(.*)\\.\\d+$/);\n return split && split[1];\n });\n\n return _.compact(arrKeyPaths).reduce(function(pull, k) {\n pull[k] = null;\n return pull;\n }, {});\n };\n\n var getUndefinedKeys = function(obj) {\n return _.keys(obj).filter(function (k) {\n var v = obj[k];\n return _.isUndefined(v);\n });\n };\n\n return getUpdates;\n })();\n\n module.value('getUpdates', getUpdates);\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/lib/get-updates.js\n **/","/*global\n angular, _, Package\n */\n\n'use strict';\n\nvar _module = angular.module('diffArray', ['getUpdates']);\n\n_module.factory('diffArray', ['getUpdates',\n function(getUpdates) {\n var LocalCollection = Package.minimongo.LocalCollection;\n var idStringify = LocalCollection._idStringify || Package['mongo-id'].MongoID.idStringify;\n var idParse = LocalCollection._idParse || Package['mongo-id'].MongoID.idParse;\n\n // Calculates the differences between `lastSeqArray` and\n // `seqArray` and calls appropriate functions from `callbacks`.\n // Reuses Minimongo's diff algorithm implementation.\n // XXX Should be replaced with the original diffArray function here:\n // https://github.com/meteor/meteor/blob/devel/packages/observe-sequence/observe_sequence.js#L152\n // When it will become nested as well, tracking here: https://github.com/meteor/meteor/issues/3764\n function diffArray(lastSeqArray, seqArray, callbacks, preventNestedDiff) {\n preventNestedDiff = !!preventNestedDiff;\n\n var diffFn = Package.minimongo.LocalCollection._diffQueryOrderedChanges ||\n Package['diff-sequence'].DiffSequence.diffQueryOrderedChanges;\n\n var oldObjIds = [];\n var newObjIds = [];\n var posOld = {}; // maps from idStringify'd ids\n var posNew = {}; // ditto\n var posCur = {};\n var lengthCur = lastSeqArray.length;\n\n _.each(seqArray, function (doc, i) {\n newObjIds.push({_id: doc._id});\n posNew[idStringify(doc._id)] = i;\n });\n\n _.each(lastSeqArray, function (doc, i) {\n oldObjIds.push({_id: doc._id});\n posOld[idStringify(doc._id)] = i;\n posCur[idStringify(doc._id)] = i;\n });\n\n // Arrays can contain arbitrary objects. We don't diff the\n // objects. Instead we always fire 'changedAt' callback on every\n // object. The consumer of `observe-sequence` should deal with\n // it appropriately.\n diffFn(oldObjIds, newObjIds, {\n addedBefore: function (id, doc, before) {\n var position = before ? posCur[idStringify(before)] : lengthCur;\n\n _.each(posCur, function (pos, id) {\n if (pos >= position) posCur[id]++;\n });\n\n lengthCur++;\n posCur[idStringify(id)] = position;\n\n callbacks.addedAt(\n id,\n seqArray[posNew[idStringify(id)]],\n position,\n before\n );\n },\n\n movedBefore: function (id, before) {\n var prevPosition = posCur[idStringify(id)];\n var position = before ? posCur[idStringify(before)] : lengthCur - 1;\n\n _.each(posCur, function (pos, id) {\n if (pos >= prevPosition && pos <= position)\n posCur[id]--;\n else if (pos <= prevPosition && pos >= position)\n posCur[id]++;\n });\n\n posCur[idStringify(id)] = position;\n\n callbacks.movedTo(\n id,\n seqArray[posNew[idStringify(id)]],\n prevPosition,\n position,\n before\n );\n },\n removed: function (id) {\n var prevPosition = posCur[idStringify(id)];\n\n _.each(posCur, function (pos, id) {\n if (pos >= prevPosition) posCur[id]--;\n });\n\n delete posCur[idStringify(id)];\n lengthCur--;\n\n callbacks.removedAt(\n id,\n lastSeqArray[posOld[idStringify(id)]],\n prevPosition\n );\n }\n });\n\n _.each(posNew, function (pos, idString) {\n if (!_.has(posOld, idString)) return;\n\n var id = idParse(idString);\n var newItem = seqArray[pos] || {};\n var oldItem = lastSeqArray[posOld[idString]];\n var updates = getUpdates(oldItem, newItem, preventNestedDiff);\n\n if (!_.isEmpty(updates))\n callbacks.changedAt(id, updates, pos, oldItem);\n });\n }\n\n diffArray.shallow = function(lastSeqArray, seqArray, callbacks) {\n return diffArray(lastSeqArray, seqArray, callbacks, true);\n };\n\n diffArray.deepCopyChanges = function (oldItem, newItem) {\n var setDiff = getUpdates(oldItem, newItem).$set;\n\n _.each(setDiff, function(v, deepKey) {\n setDeep(oldItem, deepKey, v);\n });\n };\n\n diffArray.deepCopyRemovals = function (oldItem, newItem) {\n var unsetDiff = getUpdates(oldItem, newItem).$unset;\n\n _.each(unsetDiff, function(v, deepKey) {\n unsetDeep(oldItem, deepKey);\n });\n };\n\n // Finds changes between two collections\n diffArray.getChanges = function(newCollection, oldCollection, diffMethod) {\n var changes = {added: [], removed: [], changed: []};\n\n diffMethod(oldCollection, newCollection, {\n addedAt: function(id, item, index) {\n changes.added.push({item: item, index: index});\n },\n\n removedAt: function(id, item, index) {\n changes.removed.push({item: item, index: index});\n },\n\n changedAt: function(id, updates, index, oldItem) {\n changes.changed.push({selector: id, modifier: updates});\n },\n\n movedTo: function(id, item, fromIndex, toIndex) {\n // XXX do we need this?\n }\n });\n\n return changes;\n };\n\n var setDeep = function(obj, deepKey, v) {\n var split = deepKey.split('.');\n var initialKeys = _.initial(split);\n var lastKey = _.last(split);\n\n initialKeys.reduce(function(subObj, k, i) {\n var nextKey = split[i + 1];\n\n if (isNumStr(nextKey)) {\n if (subObj[k] === null) subObj[k] = [];\n if (subObj[k].length == parseInt(nextKey)) subObj[k].push(null);\n }\n\n else if (subObj[k] === null || !isHash(subObj[k])) {\n subObj[k] = {};\n }\n\n return subObj[k];\n }, obj);\n\n var deepObj = getDeep(obj, initialKeys);\n deepObj[lastKey] = v;\n return v;\n };\n\n var unsetDeep = function(obj, deepKey) {\n var split = deepKey.split('.');\n var initialKeys = _.initial(split);\n var lastKey = _.last(split);\n var deepObj = getDeep(obj, initialKeys);\n\n if (_.isArray(deepObj) && isNumStr(lastKey))\n return !!deepObj.splice(lastKey, 1);\n else\n return delete deepObj[lastKey];\n };\n\n var getDeep = function(obj, keys) {\n return keys.reduce(function(subObj, k) {\n return subObj[k];\n }, obj);\n };\n\n var isHash = function(obj) {\n return _.isObject(obj) &&\n Object.getPrototypeOf(obj) === Object.prototype;\n };\n\n var isNumStr = function(str) {\n return str.match(/^\\d+$/);\n };\n\n return diffArray;\n}]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/lib/diff-array.js\n **/","angular.module('angular-meteor.settings', [])\n .constant('$angularMeteorSettings', {\n suppressWarnings: false\n });\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-settings.js\n **/","angular.module('angular-meteor.ironrouter', [])\n\n\n.run([\n '$compile',\n '$document',\n '$rootScope',\n\nfunction ($compile, $document, $rootScope) {\n const Router = (Package['iron:router'] || {}).Router;\n if (!Router) return;\n\n let isLoaded = false;\n\n // Recompile after iron:router builds page\n Router.onAfterAction((req, res, next) => {\n Tracker.afterFlush(() => {\n if (isLoaded) return;\n $compile($document)($rootScope);\n if (!$rootScope.$$phase) $rootScope.$apply();\n isLoaded = true;\n });\n });\n}]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-ironrouter.js\n **/","/*global\n angular, _, Tracker, EJSON, FS, Mongo\n */\n\n'use strict';\n\nvar angularMeteorUtils = angular.module('angular-meteor.utils', ['angular-meteor.settings']);\n\nangularMeteorUtils.service('$meteorUtils', [\n '$q', '$timeout', '$angularMeteorSettings',\n function ($q, $timeout, $angularMeteorSettings) {\n\n var self = this;\n\n this.autorun = function(scope, fn) {\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.utils.autorun] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.6/autorun. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n\n // wrapping around Deps.autorun\n var comp = Tracker.autorun(function(c) {\n fn(c);\n // this is run immediately for the first call\n // but after that, we need to $apply to start Angular digest\n if (!c.firstRun) $timeout(angular.noop, 0);\n });\n\n // stop autorun when scope is destroyed\n scope.$on('$destroy', function() {\n comp.stop();\n });\n\n // return autorun object so that it can be stopped manually\n return comp;\n };\n\n // Borrowed from angularFire\n // https://github.com/firebase/angularfire/blob/master/src/utils.js#L445-L454\n this.stripDollarPrefixedKeys = function (data) {\n if (!_.isObject(data) ||\n data instanceof Date ||\n data instanceof File ||\n EJSON.toJSONValue(data).$type === 'oid' ||\n (typeof FS === 'object' && data instanceof FS.File))\n return data;\n\n var out = _.isArray(data) ? [] : {};\n\n _.each(data, function(v,k) {\n if(typeof k !== 'string' || k.charAt(0) !== '$')\n out[k] = self.stripDollarPrefixedKeys(v);\n });\n\n return out;\n };\n\n // Returns a callback which fulfills promise\n this.fulfill = function(deferred, boundError, boundResult) {\n return function(err, result) {\n if (err)\n deferred.reject(boundError == null ? err : boundError);\n else if (typeof boundResult == \"function\")\n deferred.resolve(boundResult == null ? result : boundResult(result));\n else\n deferred.resolve(boundResult == null ? result : boundResult);\n };\n };\n\n // creates a function which invokes method with the given arguments and returns a promise\n this.promissor = function(obj, method) {\n return function() {\n var deferred = $q.defer();\n var fulfill = self.fulfill(deferred);\n var args = _.toArray(arguments).concat(fulfill);\n obj[method].apply(obj, args);\n return deferred.promise;\n };\n };\n\n // creates a $q.all() promise and call digestion loop on fulfillment\n this.promiseAll = function(promises) {\n var allPromise = $q.all(promises);\n\n allPromise.finally(function() {\n // calls digestion loop with no conflicts\n $timeout(angular.noop);\n });\n\n return allPromise;\n };\n\n this.getCollectionByName = function(string){\n return Mongo.Collection.get(string);\n };\n\n this.findIndexById = function(collection, doc) {\n var foundDoc = _.find(collection, function(colDoc) {\n // EJSON.equals used to compare Mongo.ObjectIDs and Strings.\n return EJSON.equals(colDoc._id, doc._id);\n });\n\n return _.indexOf(collection, foundDoc);\n };\n }\n]);\n\nangularMeteorUtils.run([\n '$rootScope', '$meteorUtils',\n function($rootScope, $meteorUtils) {\n Object.getPrototypeOf($rootScope).$meteorAutorun = function(fn) {\n return $meteorUtils.autorun(this, fn);\n };\n}]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-utils.js\n **/","/*global\n angular, Meteor\n */\n\n'use strict';\nvar angularMeteorSubscribe = angular.module('angular-meteor.subscribe', ['angular-meteor.settings']);\n\nangularMeteorSubscribe.service('$meteorSubscribe', ['$q', '$angularMeteorSettings',\n function ($q, $angularMeteorSettings) {\n\n var self = this;\n\n this._subscribe = function(scope, deferred, args) {\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.subscribe] Please note that this module is deprecated since 1.3.0 and will be removed in 1.4.0! Replace it with the new syntax described here: http://www.angular-meteor.com/api/1.3.6/subscribe. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n var subscription = null;\n var lastArg = args[args.length - 1];\n\n // User supplied onStop callback\n // save it for later use and remove\n // from subscription arguments\n if (angular.isObject(lastArg) &&\n angular.isFunction(lastArg.onStop)) {\n var onStop = lastArg.onStop;\n\n args.pop();\n }\n\n args.push({\n onReady: function() {\n deferred.resolve(subscription);\n },\n onStop: function(err) {\n if (!deferred.promise.$$state.status) {\n if (err)\n deferred.reject(err);\n else\n deferred.reject(new Meteor.Error(\"Subscription Stopped\",\n \"Subscription stopped by a call to stop method. Either by the client or by the server.\"));\n } else if (onStop)\n // After promise was resolved or rejected\n // call user supplied onStop callback.\n onStop.apply(this, Array.prototype.slice.call(arguments));\n\n }\n });\n\n subscription = Meteor.subscribe.apply(scope, args);\n\n return subscription;\n };\n\n this.subscribe = function(){\n var deferred = $q.defer();\n var args = Array.prototype.slice.call(arguments);\n var subscription = null;\n\n self._subscribe(this, deferred, args);\n\n return deferred.promise;\n };\n }]);\n\nangularMeteorSubscribe.run(['$rootScope', '$q', '$meteorSubscribe',\n function($rootScope, $q, $meteorSubscribe) {\n Object.getPrototypeOf($rootScope).$meteorSubscribe = function() {\n var deferred = $q.defer();\n var args = Array.prototype.slice.call(arguments);\n\n var subscription = $meteorSubscribe._subscribe(this, deferred, args);\n\n this.$on('$destroy', function() {\n subscription.stop();\n });\n\n return deferred.promise;\n };\n}]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-subscribe.js\n **/","/*global\n angular, _, Tracker, check, Match, Mongo\n */\n\n'use strict';\n\nvar angularMeteorCollection = angular.module('angular-meteor.collection',\n ['angular-meteor.stopper', 'angular-meteor.subscribe', 'angular-meteor.utils', 'diffArray', 'angular-meteor.settings']);\n\n// The reason angular meteor collection is a factory function and not something\n// that inherit from array comes from here:\n// http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/\n// We went with the direct extensions approach.\nangularMeteorCollection.factory('AngularMeteorCollection', [\n '$q', '$meteorSubscribe', '$meteorUtils', '$rootScope', '$timeout', 'diffArray', '$angularMeteorSettings',\n function($q, $meteorSubscribe, $meteorUtils, $rootScope, $timeout, diffArray, $angularMeteorSettings) {\n\n function AngularMeteorCollection(curDefFunc, collection, diffArrayFunc, autoClientSave) {\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.$meteorCollection] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/meteorCollection. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n var data = [];\n // Server backup data to evaluate what changes come from client\n // after each server update.\n data._serverBackup = [];\n // Array differ function.\n data._diffArrayFunc = diffArrayFunc;\n // Handler of the cursor observer.\n data._hObserve = null;\n // On new cursor autorun handler\n // (autorun for reactive variables).\n data._hNewCurAutorun = null;\n // On new data autorun handler\n // (autorun for cursor.fetch).\n data._hDataAutorun = null;\n\n if (angular.isDefined(collection)) {\n data.$$collection = collection;\n } else {\n var cursor = curDefFunc();\n data.$$collection = $meteorUtils.getCollectionByName(cursor.collection.name);\n }\n\n _.extend(data, AngularMeteorCollection);\n data._startCurAutorun(curDefFunc, autoClientSave);\n\n return data;\n }\n\n AngularMeteorCollection._startCurAutorun = function(curDefFunc, autoClientSave) {\n var self = this;\n\n self._hNewCurAutorun = Tracker.autorun(function() {\n // When the reactive func gets recomputated we need to stop any previous\n // observeChanges.\n Tracker.onInvalidate(function() {\n self._stopCursor();\n });\n\n if (autoClientSave) self._setAutoClientSave();\n self._updateCursor(curDefFunc(), autoClientSave);\n });\n };\n\n AngularMeteorCollection.subscribe = function() {\n $meteorSubscribe.subscribe.apply(this, arguments);\n return this;\n };\n\n AngularMeteorCollection.save = function(docs, useUnsetModifier) {\n // save whole collection\n if (!docs) docs = this;\n // save single doc\n docs = [].concat(docs);\n\n var promises = docs.map(function(doc) {\n return this._upsertDoc(doc, useUnsetModifier);\n }, this);\n\n return $meteorUtils.promiseAll(promises);\n };\n\n AngularMeteorCollection._upsertDoc = function(doc, useUnsetModifier) {\n var deferred = $q.defer();\n var collection = this.$$collection;\n var createFulfill = _.partial($meteorUtils.fulfill, deferred, null);\n\n // delete $$hashkey\n doc = $meteorUtils.stripDollarPrefixedKeys(doc);\n var docId = doc._id;\n var isExist = collection.findOne(docId);\n\n // update\n if (isExist) {\n // Deletes _id property (from the copy) so that\n // it can be $set using update.\n delete doc._id;\n var modifier = useUnsetModifier ? {$unset: doc} : {$set: doc};\n // NOTE: do not use #upsert() method, since it does not exist in some collections\n collection.update(docId, modifier, createFulfill(function() {\n return {_id: docId, action: 'updated'};\n }));\n }\n // insert\n else {\n collection.insert(doc, createFulfill(function(id) {\n return {_id: id, action: 'inserted'};\n }));\n }\n\n return deferred.promise;\n };\n\n // performs $pull operations parallely.\n // used for handling splice operations returned from getUpdates() to prevent conflicts.\n // see issue: https://github.com/Urigo/angular-meteor/issues/793\n AngularMeteorCollection._updateDiff = function(selector, update, callback) {\n callback = callback || angular.noop;\n var setters = _.omit(update, '$pull');\n var updates = [setters];\n\n _.each(update.$pull, function(pull, prop) {\n var puller = {};\n puller[prop] = pull;\n updates.push({ $pull: puller });\n });\n\n this._updateParallel(selector, updates, callback);\n };\n\n // performs each update operation parallely\n AngularMeteorCollection._updateParallel = function(selector, updates, callback) {\n var self = this;\n var done = _.after(updates.length, callback);\n\n var next = function(err, affectedDocsNum) {\n if (err) return callback(err);\n done(null, affectedDocsNum);\n };\n\n _.each(updates, function(update) {\n self.$$collection.update(selector, update, next);\n });\n };\n\n AngularMeteorCollection.remove = function(keyOrDocs) {\n var keys;\n\n // remove whole collection\n if (!keyOrDocs) {\n keys = _.pluck(this, '_id');\n }\n // remove docs\n else {\n keyOrDocs = [].concat(keyOrDocs);\n\n keys = _.map(keyOrDocs, function(keyOrDoc) {\n return keyOrDoc._id || keyOrDoc;\n });\n }\n\n // Checks if all keys are correct.\n check(keys, [Match.OneOf(String, Mongo.ObjectID)]);\n\n var promises = keys.map(function(key) {\n return this._removeDoc(key);\n }, this);\n\n return $meteorUtils.promiseAll(promises);\n };\n\n AngularMeteorCollection._removeDoc = function(id) {\n var deferred = $q.defer();\n var collection = this.$$collection;\n var fulfill = $meteorUtils.fulfill(deferred, null, { _id: id, action: 'removed' });\n collection.remove(id, fulfill);\n return deferred.promise;\n };\n\n AngularMeteorCollection._updateCursor = function(cursor, autoClientSave) {\n var self = this;\n // XXX - consider adding an option for a non-orderd result for faster performance\n if (self._hObserve) self._stopObserving();\n\n\n self._hObserve = cursor.observe({\n addedAt: function(doc, atIndex) {\n self.splice(atIndex, 0, doc);\n self._serverBackup.splice(atIndex, 0, doc);\n self._setServerUpdateMode();\n },\n\n changedAt: function(doc, oldDoc, atIndex) {\n diffArray.deepCopyChanges(self[atIndex], doc);\n diffArray.deepCopyRemovals(self[atIndex], doc);\n self._serverBackup[atIndex] = self[atIndex];\n self._setServerUpdateMode();\n },\n\n movedTo: function(doc, fromIndex, toIndex) {\n self.splice(fromIndex, 1);\n self.splice(toIndex, 0, doc);\n self._serverBackup.splice(fromIndex, 1);\n self._serverBackup.splice(toIndex, 0, doc);\n self._setServerUpdateMode();\n },\n\n removedAt: function(oldDoc) {\n var removedIndex = $meteorUtils.findIndexById(self, oldDoc);\n\n if (removedIndex != -1) {\n self.splice(removedIndex, 1);\n self._serverBackup.splice(removedIndex, 1);\n self._setServerUpdateMode();\n } else {\n // If it's been removed on client then it's already not in collection\n // itself but still is in the _serverBackup.\n removedIndex = $meteorUtils.findIndexById(self._serverBackup, oldDoc);\n\n if (removedIndex != -1) {\n self._serverBackup.splice(removedIndex, 1);\n }\n }\n }\n });\n\n self._hDataAutorun = Tracker.autorun(function() {\n cursor.fetch();\n if (self._serverMode) self._unsetServerUpdateMode(autoClientSave);\n });\n };\n\n AngularMeteorCollection._stopObserving = function() {\n this._hObserve.stop();\n this._hDataAutorun.stop();\n delete this._serverMode;\n delete this._hUnsetTimeout;\n };\n\n AngularMeteorCollection._setServerUpdateMode = function(name) {\n this._serverMode = true;\n // To simplify server update logic, we don't follow\n // updates from the client at the same time.\n this._unsetAutoClientSave();\n };\n\n // Here we use $timeout to combine multiple updates that go\n // each one after another.\n AngularMeteorCollection._unsetServerUpdateMode = function(autoClientSave) {\n var self = this;\n\n if (self._hUnsetTimeout) {\n $timeout.cancel(self._hUnsetTimeout);\n self._hUnsetTimeout = null;\n }\n\n self._hUnsetTimeout = $timeout(function() {\n self._serverMode = false;\n // Finds updates that was potentially done from the client side\n // and saves them.\n var changes = diffArray.getChanges(self, self._serverBackup, self._diffArrayFunc);\n self._saveChanges(changes);\n // After, continues following client updates.\n if (autoClientSave) self._setAutoClientSave();\n }, 0);\n };\n\n AngularMeteorCollection.stop = function() {\n this._stopCursor();\n this._hNewCurAutorun.stop();\n };\n\n AngularMeteorCollection._stopCursor = function() {\n this._unsetAutoClientSave();\n\n if (this._hObserve) {\n this._hObserve.stop();\n this._hDataAutorun.stop();\n }\n\n this.splice(0);\n this._serverBackup.splice(0);\n };\n\n AngularMeteorCollection._unsetAutoClientSave = function(name) {\n if (this._hRegAutoBind) {\n this._hRegAutoBind();\n this._hRegAutoBind = null;\n }\n };\n\n AngularMeteorCollection._setAutoClientSave = function() {\n var self = this;\n\n // Always unsets auto save to keep only one $watch handler.\n self._unsetAutoClientSave();\n\n self._hRegAutoBind = $rootScope.$watch(function() {\n return self;\n }, function(nItems, oItems) {\n if (nItems === oItems) return;\n\n var changes = diffArray.getChanges(self, oItems, self._diffArrayFunc);\n self._unsetAutoClientSave();\n self._saveChanges(changes);\n self._setAutoClientSave();\n }, true);\n };\n\n AngularMeteorCollection._saveChanges = function(changes) {\n var self = this;\n\n // Saves added documents\n // Using reversed iteration to prevent indexes from changing during splice\n var addedDocs = changes.added.reverse().map(function(descriptor) {\n self.splice(descriptor.index, 1);\n return descriptor.item;\n });\n\n if (addedDocs.length) self.save(addedDocs);\n\n // Removes deleted documents\n var removedDocs = changes.removed.map(function(descriptor) {\n return descriptor.item;\n });\n\n if (removedDocs.length) self.remove(removedDocs);\n\n // Updates changed documents\n changes.changed.forEach(function(descriptor) {\n self._updateDiff(descriptor.selector, descriptor.modifier);\n });\n };\n\n return AngularMeteorCollection;\n}]);\n\nangularMeteorCollection.factory('$meteorCollectionFS', [\n '$meteorCollection', 'diffArray', '$angularMeteorSettings',\n function($meteorCollection, diffArray, $angularMeteorSettings) {\n function $meteorCollectionFS(reactiveFunc, autoClientSave, collection) {\n\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.$meteorCollectionFS] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/files. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n return new $meteorCollection(reactiveFunc, autoClientSave, collection, diffArray.shallow);\n }\n\n return $meteorCollectionFS;\n}]);\n\nangularMeteorCollection.factory('$meteorCollection', [\n 'AngularMeteorCollection', '$rootScope', 'diffArray',\n function(AngularMeteorCollection, $rootScope, diffArray) {\n function $meteorCollection(reactiveFunc, autoClientSave, collection, diffFn) {\n // Validate parameters\n if (!reactiveFunc) {\n throw new TypeError('The first argument of $meteorCollection is undefined.');\n }\n\n if (!(angular.isFunction(reactiveFunc) || angular.isFunction(reactiveFunc.find))) {\n throw new TypeError(\n 'The first argument of $meteorCollection must be a function or ' +\n 'a have a find function property.');\n }\n\n if (!angular.isFunction(reactiveFunc)) {\n collection = angular.isDefined(collection) ? collection : reactiveFunc;\n reactiveFunc = _.bind(reactiveFunc.find, reactiveFunc);\n }\n\n // By default auto save - true.\n autoClientSave = angular.isDefined(autoClientSave) ? autoClientSave : true;\n diffFn = diffFn || diffArray;\n return new AngularMeteorCollection(reactiveFunc, collection, diffFn, autoClientSave);\n }\n\n return $meteorCollection;\n}]);\n\nangularMeteorCollection.run([\n '$rootScope', '$meteorCollection', '$meteorCollectionFS', '$meteorStopper',\n function($rootScope, $meteorCollection, $meteorCollectionFS, $meteorStopper) {\n var scopeProto = Object.getPrototypeOf($rootScope);\n scopeProto.$meteorCollection = $meteorStopper($meteorCollection);\n scopeProto.$meteorCollectionFS = $meteorStopper($meteorCollectionFS);\n}]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-collection.js\n **/","/*global\n angular, _, Mongo\n*/\n\n'use strict';\n\nvar angularMeteorObject = angular.module('angular-meteor.object',\n ['angular-meteor.utils', 'angular-meteor.subscribe', 'angular-meteor.collection', 'getUpdates', 'diffArray', 'angular-meteor.settings']);\n\nangularMeteorObject.factory('AngularMeteorObject', [\n '$q', '$meteorSubscribe', '$meteorUtils', 'diffArray', 'getUpdates', 'AngularMeteorCollection', '$angularMeteorSettings',\n function($q, $meteorSubscribe, $meteorUtils, diffArray, getUpdates, AngularMeteorCollection, $angularMeteorSettings) {\n\n // A list of internals properties to not watch for, nor pass to the Document on update and etc.\n AngularMeteorObject.$$internalProps = [\n '$$collection', '$$options', '$$id', '$$hashkey', '$$internalProps', '$$scope',\n 'bind', 'save', 'reset', 'subscribe', 'stop', 'autorunComputation', 'unregisterAutoBind', 'unregisterAutoDestroy', 'getRawObject',\n '_auto', '_setAutos', '_eventEmitter', '_serverBackup', '_updateDiff', '_updateParallel', '_getId'\n ];\n\n function AngularMeteorObject (collection, selector, options){\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.$meteorObject] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/meteorObject. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n // Make data not be an object so we can extend it to preserve\n // Collection Helpers and the like\n var helpers = collection._helpers;\n var data = _.isFunction(helpers) ? Object.create(helpers.prototype) : {};\n var doc = collection.findOne(selector, options);\n var collectionExtension = _.pick(AngularMeteorCollection, '_updateParallel');\n _.extend(data, doc);\n _.extend(data, AngularMeteorObject);\n _.extend(data, collectionExtension);\n\n // Omit options that may spoil document finding\n data.$$options = _.omit(options, 'skip', 'limit');\n data.$$collection = collection;\n data.$$id = data._getId(selector);\n data._serverBackup = doc || {};\n\n return data;\n }\n\n AngularMeteorObject.getRawObject = function () {\n return angular.copy(_.omit(this, this.$$internalProps));\n };\n\n AngularMeteorObject.subscribe = function () {\n $meteorSubscribe.subscribe.apply(this, arguments);\n return this;\n };\n\n AngularMeteorObject.save = function(custom) {\n var deferred = $q.defer();\n var collection = this.$$collection;\n var createFulfill = _.partial($meteorUtils.fulfill, deferred, null);\n var oldDoc = collection.findOne(this.$$id);\n var mods;\n\n // update\n if (oldDoc) {\n if (custom)\n mods = { $set: custom };\n else {\n mods = getUpdates(oldDoc, this.getRawObject());\n // If there are no updates, there is nothing to do here, returning\n if (_.isEmpty(mods)) {\n return $q.when({ action: 'updated' });\n }\n }\n\n // NOTE: do not use #upsert() method, since it does not exist in some collections\n this._updateDiff(mods, createFulfill({ action: 'updated' }));\n }\n // insert\n else {\n if (custom)\n mods = _.clone(custom);\n else\n mods = this.getRawObject();\n\n mods._id = mods._id || this.$$id;\n collection.insert(mods, createFulfill({ action: 'inserted' }));\n }\n\n return deferred.promise;\n };\n\n AngularMeteorObject._updateDiff = function(update, callback) {\n var selector = this.$$id;\n AngularMeteorCollection._updateDiff.call(this, selector, update, callback);\n };\n\n AngularMeteorObject.reset = function(keepClientProps) {\n var self = this;\n var options = this.$$options;\n var id = this.$$id;\n var doc = this.$$collection.findOne(id, options);\n\n if (doc) {\n // extend SubObject\n var docKeys = _.keys(doc);\n var docExtension = _.pick(doc, docKeys);\n var clientProps;\n\n _.extend(self, docExtension);\n _.extend(self._serverBackup, docExtension);\n\n if (keepClientProps) {\n clientProps = _.intersection(_.keys(self), _.keys(self._serverBackup));\n } else {\n clientProps = _.keys(self);\n }\n\n var serverProps = _.keys(doc);\n var removedKeys = _.difference(clientProps, serverProps, self.$$internalProps);\n\n removedKeys.forEach(function (prop) {\n delete self[prop];\n delete self._serverBackup[prop];\n });\n }\n\n else {\n _.keys(this.getRawObject()).forEach(function(prop) {\n delete self[prop];\n });\n\n self._serverBackup = {};\n }\n };\n\n AngularMeteorObject.stop = function () {\n if (this.unregisterAutoDestroy)\n this.unregisterAutoDestroy();\n\n if (this.unregisterAutoBind)\n this.unregisterAutoBind();\n\n if (this.autorunComputation && this.autorunComputation.stop)\n this.autorunComputation.stop();\n };\n\n AngularMeteorObject._getId = function(selector) {\n var options = _.extend({}, this.$$options, {\n fields: { _id: 1 },\n reactive: false,\n transform: null\n });\n\n var doc = this.$$collection.findOne(selector, options);\n\n if (doc) return doc._id;\n if (selector instanceof Mongo.ObjectID) return selector;\n if (_.isString(selector)) return selector;\n return new Mongo.ObjectID();\n };\n\n return AngularMeteorObject;\n}]);\n\n\nangularMeteorObject.factory('$meteorObject', [\n '$rootScope', '$meteorUtils', 'getUpdates', 'AngularMeteorObject',\n function($rootScope, $meteorUtils, getUpdates, AngularMeteorObject) {\n function $meteorObject(collection, id, auto, options) {\n // Validate parameters\n if (!collection) {\n throw new TypeError(\"The first argument of $meteorObject is undefined.\");\n }\n\n if (!angular.isFunction(collection.findOne)) {\n throw new TypeError(\"The first argument of $meteorObject must be a function or a have a findOne function property.\");\n }\n\n var data = new AngularMeteorObject(collection, id, options);\n // Making auto default true - http://stackoverflow.com/a/15464208/1426570\n data._auto = auto !== false;\n _.extend(data, $meteorObject);\n data._setAutos();\n return data;\n }\n\n $meteorObject._setAutos = function() {\n var self = this;\n\n this.autorunComputation = $meteorUtils.autorun($rootScope, function() {\n self.reset(true);\n });\n\n // Deep watches the model and performs autobind\n this.unregisterAutoBind = this._auto && $rootScope.$watch(function(){\n return self.getRawObject();\n }, function (item, oldItem) {\n if (item !== oldItem) self.save();\n }, true);\n\n this.unregisterAutoDestroy = $rootScope.$on('$destroy', function() {\n if (self && self.stop) self.pop();\n });\n };\n\n return $meteorObject;\n}]);\n\nangularMeteorObject.run([\n '$rootScope', '$meteorObject', '$meteorStopper',\n function ($rootScope, $meteorObject, $meteorStopper) {\n var scopeProto = Object.getPrototypeOf($rootScope);\n scopeProto.$meteorObject = $meteorStopper($meteorObject);\n}]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-object.js\n **/","/*global\n angular, _, Package, Meteor\n */\n\n'use strict';\n\nvar angularMeteorUser = angular.module('angular-meteor.user', [\n 'angular-meteor.utils',\n 'angular-meteor.core',\n 'angular-meteor.settings'\n]);\n\n// requires package 'accounts-password'\nangularMeteorUser.service('$meteorUser', [\n '$rootScope', '$meteorUtils', '$q', '$angularMeteorSettings',\n function($rootScope, $meteorUtils, $q, $angularMeteorSettings){\n\n var pack = Package['accounts-base'];\n if (!pack) return;\n\n var self = this;\n var Accounts = pack.Accounts;\n\n this.waitForUser = function(){\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.waitForUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n var deferred = $q.defer();\n\n $meteorUtils.autorun($rootScope, function(){\n if ( !Meteor.loggingIn() )\n deferred.resolve( Meteor.user() );\n }, true);\n\n return deferred.promise;\n };\n\n this.requireUser = function(){\n if (!$angularMeteorSettings.suppressWarnings) {\n console.warn('[angular-meteor.requireUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n }\n\n var deferred = $q.defer();\n\n $meteorUtils.autorun($rootScope, function(){\n if ( !Meteor.loggingIn() ) {\n if ( Meteor.user() === null)\n deferred.reject(\"AUTH_REQUIRED\");\n else\n deferred.resolve( Meteor.user() );\n }\n }, true);\n\n return deferred.promise;\n };\n\n this.requireValidUser = function(validatorFn) {\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.requireValidUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n return self.requireUser(true).then(function(user){\n var valid = validatorFn( user );\n\n if ( valid === true )\n return user;\n else if ( typeof valid === \"string\" )\n return $q.reject( valid );\n else\n return $q.reject( \"FORBIDDEN\" );\n\t });\n\t };\n\n this.loginWithPassword = $meteorUtils.promissor(Meteor, 'loginWithPassword');\n this.createUser = $meteorUtils.promissor(Accounts, 'createUser');\n this.changePassword = $meteorUtils.promissor(Accounts, 'changePassword');\n this.forgotPassword = $meteorUtils.promissor(Accounts, 'forgotPassword');\n this.resetPassword = $meteorUtils.promissor(Accounts, 'resetPassword');\n this.verifyEmail = $meteorUtils.promissor(Accounts, 'verifyEmail');\n this.logout = $meteorUtils.promissor(Meteor, 'logout');\n this.logoutOtherClients = $meteorUtils.promissor(Meteor, 'logoutOtherClients');\n this.loginWithFacebook = $meteorUtils.promissor(Meteor, 'loginWithFacebook');\n this.loginWithTwitter = $meteorUtils.promissor(Meteor, 'loginWithTwitter');\n this.loginWithGoogle = $meteorUtils.promissor(Meteor, 'loginWithGoogle');\n this.loginWithGithub = $meteorUtils.promissor(Meteor, 'loginWithGithub');\n this.loginWithMeteorDeveloperAccount = $meteorUtils.promissor(Meteor, 'loginWithMeteorDeveloperAccount');\n this.loginWithMeetup = $meteorUtils.promissor(Meteor, 'loginWithMeetup');\n this.loginWithWeibo = $meteorUtils.promissor(Meteor, 'loginWithWeibo');\n }\n]);\n\nangularMeteorUser.run([\n '$rootScope', '$angularMeteorSettings', '$$Core',\n function($rootScope, $angularMeteorSettings, $$Core){\n\n let ScopeProto = Object.getPrototypeOf($rootScope);\n _.extend(ScopeProto, $$Core);\n\n $rootScope.autorun(function(){\n if (!Meteor.user) return;\n $rootScope.currentUser = Meteor.user();\n $rootScope.loggingIn = Meteor.loggingIn();\n });\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-user.js\n **/","/*global\n angular, _, Meteor\n */\n\n'use strict';\n\nvar angularMeteorMethods = angular.module('angular-meteor.methods', ['angular-meteor.utils', 'angular-meteor.settings']);\n\nangularMeteorMethods.service('$meteorMethods', [\n '$q', '$meteorUtils', '$angularMeteorSettings',\n function($q, $meteorUtils, $angularMeteorSettings) {\n this.call = function(){\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.$meteor.call] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/methods. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n var deferred = $q.defer();\n var fulfill = $meteorUtils.fulfill(deferred);\n var args = _.toArray(arguments).concat(fulfill);\n Meteor.call.apply(this, args);\n return deferred.promise;\n };\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-methods.js\n **/","/*global\n angular, Session\n */\n\n'use strict';\nvar angularMeteorSession = angular.module('angular-meteor.session', ['angular-meteor.utils', 'angular-meteor.settings']);\n\nangularMeteorSession.factory('$meteorSession', ['$meteorUtils', '$parse', '$angularMeteorSettings',\n function ($meteorUtils, $parse, $angularMeteorSettings) {\n return function (session) {\n\n return {\n\n bind: function(scope, model) {\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.session.bind] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://www.angular-meteor.com/api/1.3.0/session. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n var getter = $parse(model);\n var setter = getter.assign;\n $meteorUtils.autorun(scope, function() {\n setter(scope, Session.get(session));\n });\n\n scope.$watch(model, function(newItem, oldItem) {\n Session.set(session, getter(scope));\n }, true);\n\n }\n };\n };\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-session.js\n **/","/*global\n angular, Package\n */\n\n'use strict';\n\nvar angularMeteorCamera = angular.module('angular-meteor.camera', ['angular-meteor.utils', 'angular-meteor.settings']);\n\n// requires package 'mdg:camera'\nangularMeteorCamera.service('$meteorCamera', [\n '$q', '$meteorUtils', '$angularMeteorSettings',\n function ($q, $meteorUtils, $angularMeteorSettings) {\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.camera] Please note that this module has moved to a separate package and is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/camera. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n var pack = Package['mdg:camera'];\n if (!pack) return;\n\n var MeteorCamera = pack.MeteorCamera;\n\n this.getPicture = function(options){\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.camera] Please note that this module has moved to a separate package and is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/camera. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n options = options || {};\n var deferred = $q.defer();\n MeteorCamera.getPicture(options, $meteorUtils.fulfill(deferred));\n return deferred.promise;\n };\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-camera.js\n **/","/*global\n angular\n */\n\n'use strict';\n\nvar angularMeteorStopper = angular.module('angular-meteor.stopper',\n ['angular-meteor.subscribe']);\n\nangularMeteorStopper.factory('$meteorStopper', ['$q', '$meteorSubscribe',\n function($q, $meteorSubscribe) {\n function $meteorStopper($meteorEntity) {\n return function() {\n var args = Array.prototype.slice.call(arguments);\n var meteorEntity = $meteorEntity.apply(this, args);\n\n angular.extend(meteorEntity, $meteorStopper);\n meteorEntity.$$scope = this;\n\n this.$on('$destroy', function () {\n meteorEntity.stop();\n if (meteorEntity.subscription) meteorEntity.subscription.stop();\n });\n\n return meteorEntity;\n };\n }\n\n $meteorStopper.subscribe = function() {\n var args = Array.prototype.slice.call(arguments);\n this.subscription = $meteorSubscribe._subscribe(this.$$scope, $q.defer(), args);\n return this;\n };\n\n return $meteorStopper;\n}]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-stopper.js\n **/","export const name = 'angular-meteor.utilities';\nexport const utils = '$$utils';\n\nangular.module(name, [])\n\n/*\n A utility service which is provided with general utility functions\n */\n.service(utils, [\n '$rootScope',\n\n function($rootScope) {\n const self = this;\n\n // Checks if an object is a cursor\n this.isCursor = (obj) => {\n return obj instanceof Meteor.Collection.Cursor;\n };\n\n // Cheecks if an object is a scope\n this.isScope = (obj) => {\n return obj instanceof $rootScope.constructor;\n };\n\n // Checks if two objects are siblings\n this.areSiblings = (obj1, obj2) => {\n return _.isObject(obj1) && _.isObject(obj2) &&\n Object.getPrototypeOf(obj1) === Object.getPrototypeOf(obj2);\n };\n\n // Binds function into a scpecified context. If an object is provided, will bind every\n // value in the object which is a function. If a tap function is provided, it will be\n // called right after the function has been invoked.\n this.bind = (fn, context, tap) => {\n tap = _.isFunction(tap) ? tap : angular.noop;\n if (_.isFunction(fn)) return bindFn(fn, context, tap);\n if (_.isObject(fn)) return bindObj(fn, context, tap);\n return fn;\n };\n\n function bindFn(fn, context, tap) {\n return (...args) => {\n const result = fn.apply(context, args);\n tap.call(context, {\n result,\n args\n });\n return result;\n };\n }\n\n function bindObj(obj, context, tap) {\n return _.keys(obj).reduce((bound, k) => {\n bound[k] = self.bind(obj[k], context, tap);\n return bound;\n }, {});\n }\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/utils.js\n **/","export const name = 'angular-meteor.mixer';\nexport const Mixer = '$Mixer';\n\nangular.module(name, [])\n\n/*\n A service which lets us apply mixins into Scope.prototype.\n The flow is simple. Once we define a mixin, it will be stored in the `$Mixer`,\n and any time a `ChildScope` prototype is created\n it will be extended by the `$Mixer`.\n This concept is good because it keeps our code\n clean and simple, and easy to extend.\n So any time we would like to define a new behaviour to our scope,\n we will just use the `$Mixer` service.\n */\n.service(Mixer, function() {\n this._mixins = [];\n // Apply mixins automatically on specified contexts\n this._autoExtend = [];\n this._autoConstruct = [];\n\n // Adds a new mixin\n this.mixin = (mixin) => {\n if (!_.isObject(mixin)) {\n throw Error('argument 1 must be an object');\n }\n\n this._mixins = _.union(this._mixins, [mixin]);\n // Apply mixins to stored contexts\n this._autoExtend.forEach(context => this._extend(context));\n this._autoConstruct.forEach(context => this._construct(context));\n return this;\n };\n\n // Removes a mixin. Useful mainly for test purposes\n this._mixout = (mixin) => {\n this._mixins = _.without(this._mixins, mixin);\n return this;\n };\n\n // Invoke function mixins with the provided context and arguments\n this._construct = (context, ...args) => {\n this._mixins.filter(_.isFunction).forEach((mixin) => {\n mixin.call(context, ...args);\n });\n\n return context;\n };\n\n // Extend prototype with the defined mixins\n this._extend = (obj) => {\n return _.extend(obj, ...this._mixins);\n };\n});\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/mixer.js\n **/","import { name as mixerName, Mixer } from './mixer';\n\nexport const name = 'angular-meteor.scope';\n\nangular.module(name, [\n mixerName\n])\n\n.run([\n '$rootScope',\n Mixer,\n function($rootScope, $Mixer) {\n const Scope = $rootScope.constructor;\n const $new = $rootScope.$new;\n\n // Apply extensions whether a mixin in defined.\n // Note that this way mixins which are initialized later\n // can be applied on rootScope.\n $Mixer._autoExtend.push(Scope.prototype);\n $Mixer._autoConstruct.push($rootScope);\n\n Scope.prototype.$new = function() {\n const scope = $new.apply(this, arguments);\n // Apply constructors to newly created scopes\n return $Mixer._construct(scope);\n };\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/scope.js\n **/","import { name as utilsName, utils } from './utils';\nimport { name as mixerName } from './mixer';\n\nexport const name = 'angular-meteor.core';\nexport const Core = '$$Core';\n\nangular.module(name, [\n utilsName,\n mixerName\n])\n\n\n/*\n A mixin which provides us with core Meteor functions.\n */\n.factory(Core, [\n '$q',\n utils,\n\n function($q, $$utils) {\n function $$Core() {}\n\n // Calls Meteor.autorun() which will be digested after each run and automatically destroyed\n $$Core.autorun = function(fn, options = {}) {\n fn = this.$bindToContext(fn);\n\n if (!_.isFunction(fn)) {\n throw Error('argument 1 must be a function');\n }\n if (!_.isObject(options)) {\n throw Error('argument 2 must be an object');\n }\n\n const computation = Tracker.autorun(fn, options);\n this.$$autoStop(computation);\n return computation;\n };\n\n // Calls Meteor.subscribe() which will be digested after each invokation\n // and automatically destroyed\n $$Core.subscribe = function(subName, fn, cb) {\n fn = this.$bindToContext(fn || angular.noop);\n cb = cb ? this.$bindToContext(cb) : angular.noop;\n\n if (!_.isString(subName)) {\n throw Error('argument 1 must be a string');\n }\n if (!_.isFunction(fn)) {\n throw Error('argument 2 must be a function');\n }\n if (!_.isFunction(cb) && !_.isObject(cb)) {\n throw Error('argument 3 must be a function or an object');\n }\n\n const result = {};\n\n const computation = this.autorun(() => {\n let args = fn();\n if (angular.isUndefined(args)) args = [];\n\n if (!_.isArray(args)) {\n throw Error(`reactive function's return value must be an array`);\n }\n\n const subscription = Meteor.subscribe(subName, ...args, cb);\n result.ready = subscription.ready.bind(subscription);\n result.subscriptionId = subscription.subscriptionId;\n });\n\n // Once the computation has been stopped,\n // any subscriptions made inside will be stopped as well\n result.stop = computation.stop.bind(computation);\n return result;\n };\n\n // Calls Meteor.call() wrapped by a digestion cycle\n $$Core.callMethod = function(...args) {\n let fn = args.pop();\n if (_.isFunction(fn)) fn = this.$bindToContext(fn);\n return Meteor.call(...args, fn);\n };\n\n // Calls Meteor.apply() wrapped by a digestion cycle\n $$Core.applyMethod = function(...args) {\n let fn = args.pop();\n if (_.isFunction(fn)) fn = this.$bindToContext(fn);\n return Meteor.apply(...args, fn);\n };\n\n $$Core.$$autoStop = function(stoppable) {\n this.$on('$destroy', stoppable.stop.bind(stoppable));\n };\n\n // Digests scope only if there is no phase at the moment\n $$Core.$$throttledDigest = function() {\n const isDigestable = !this.$$destroyed &&\n !this.$$phase &&\n !this.$root.$$phase;\n\n if (isDigestable) this.$digest();\n };\n\n // Creates a promise only that the digestion cycle will be called at its fulfillment\n $$Core.$$defer = function() {\n const deferred = $q.defer();\n // Once promise has been fulfilled, digest\n deferred.promise = deferred.promise.finally(this.$$throttledDigest.bind(this));\n return deferred;\n };\n\n // Binds an object or a function to the scope to the view model and digest it once it is invoked\n $$Core.$bindToContext = function(fn) {\n return $$utils.bind(fn, this, this.$$throttledDigest.bind(this));\n };\n\n return $$Core;\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/core.js\n **/","import { name as utilsName, utils } from './utils';\nimport { name as mixerName, Mixer } from './mixer';\nimport { name as coreName } from './core';\n\nexport const name = 'angular-meteor.view-model';\nexport const ViewModel = '$$ViewModel';\nexport const reactive = '$reactive';\n\nangular.module(name, [\n utilsName,\n mixerName,\n coreName\n])\n\n/*\n A mixin which lets us bind a view model into a scope.\n Note that only a single view model can be bound,\n otherwise the scope might behave unexpectedly.\n Mainly used to define the controller as the view model,\n and very useful when wanting to use Angular's `controllerAs` syntax.\n */\n.factory(ViewModel, [\n utils,\n Mixer,\n\n function($$utils, $Mixer) {\n function $$ViewModel(vm = this) {\n // Defines the view model on the scope.\n this.$$vm = vm;\n }\n\n // Gets an object, wraps it with scope functions and returns it\n $$ViewModel.viewModel = function(vm) {\n if (!_.isObject(vm)) {\n throw Error('argument 1 must be an object');\n }\n\n // Apply mixin functions\n $Mixer._mixins.forEach((mixin) => {\n // Reject methods which starts with double $\n const keys = _.keys(mixin).filter(k => k.match(/^(?!\\$\\$).*$/));\n const proto = _.pick(mixin, keys);\n // Bind all the methods to the prototype\n const boundProto = $$utils.bind(proto, this);\n // Add the methods to the view model\n _.extend(vm, boundProto);\n });\n\n // Apply mixin constructors on the view model\n $Mixer._construct(this, vm);\n return vm;\n };\n\n // Override $$Core.$bindToContext to be bound to view model instead of scope\n $$ViewModel.$bindToContext = function(fn) {\n return $$utils.bind(fn, this.$$vm, this.$$throttledDigest.bind(this));\n };\n\n return $$ViewModel;\n }\n])\n\n\n/*\n Illustrates the old API where a view model is created using $reactive service\n */\n.service(reactive, [\n utils,\n\n function($$utils) {\n class Reactive {\n constructor(vm) {\n if (!_.isObject(vm)) {\n throw Error('argument 1 must be an object');\n }\n\n _.defer(() => {\n if (!this._attached) {\n console.warn('view model was not attached to any scope');\n }\n });\n\n this._vm = vm;\n }\n\n attach(scope) {\n this._attached = true;\n\n if (!$$utils.isScope(scope)) {\n throw Error('argument 1 must be a scope');\n }\n\n const viewModel = scope.viewModel(this._vm);\n\n // Similar to the old/Meteor API\n viewModel.call = viewModel.callMethod;\n viewModel.apply = viewModel.applyMethod;\n\n return viewModel;\n }\n }\n\n return (vm) => new Reactive(vm);\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/view-model.js\n **/","import { name as utilsName, utils } from './utils';\nimport { name as mixerName } from './mixer';\nimport { name as coreName } from './core';\nimport { name as viewModelName } from './view-model';\n\nexport const name = 'angular-meteor.reactive';\nexport const Reactive = '$$Reactive';\n\nangular.module(name, [\n utilsName,\n mixerName,\n coreName,\n viewModelName\n])\n\n\n/*\n A mixin which enhance our reactive abilities by providing methods\n that are capable of updating our scope reactively.\n */\n.factory(Reactive, [\n '$parse',\n utils,\n\n function($parse, $$utils) {\n function $$Reactive(vm = this) {\n // Helps us track changes made in the view model\n vm.$$dependencies = {};\n }\n\n // Gets an object containing functions and define their results as reactive properties.\n // Once a return value has been changed the property will be reset.\n $$Reactive.helpers = function(props = {}) {\n if (!_.isObject(props)) {\n throw Error('argument 1 must be an object');\n }\n\n _.each(props, (v, k, i) => {\n if (!_.isFunction(v)) {\n throw Error(`helper ${i + 1} must be a function`);\n }\n\n if (!this.$$vm.$$dependencies[k]) {\n // Registers a new dependency to the specified helper\n this.$$vm.$$dependencies[k] = new Tracker.Dependency();\n }\n\n this.$$setFnHelper(k, v);\n });\n };\n\n // Gets a model reactively\n $$Reactive.getReactively = function(k, isDeep = false) {\n if (!_.isBoolean(isDeep)) {\n throw Error('argument 2 must be a boolean');\n }\n\n return this.$$reactivateEntity(k, this.$watch, isDeep);\n };\n\n // Gets a collection reactively\n $$Reactive.getCollectionReactively = function(k) {\n return this.$$reactivateEntity(k, this.$watchCollection);\n };\n\n // Gets an entity reactively, and once it has been changed the computation will be recomputed\n $$Reactive.$$reactivateEntity = function(k, watcher, ...watcherArgs) {\n if (!_.isString(k)) {\n throw Error('argument 1 must be a string');\n }\n\n if (!this.$$vm.$$dependencies[k]) {\n this.$$vm.$$dependencies[k] = new Tracker.Dependency();\n this.$$watchEntity(k, watcher, ...watcherArgs);\n }\n\n this.$$vm.$$dependencies[k].depend();\n return $parse(k)(this.$$vm);\n };\n\n // Watches for changes in the view model, and if so will notify a change\n $$Reactive.$$watchEntity = function(k, watcher, ...watcherArgs) {\n // Gets a deep property from the view model\n const getVal = _.partial($parse(k), this.$$vm);\n const initialVal = getVal();\n\n // Watches for changes in the view model\n watcher.call(this, getVal, (val, oldVal) => {\n const hasChanged =\n val !== initialVal ||\n val !== oldVal;\n\n // Notify if a change has been detected\n if (hasChanged) this.$$changed(k);\n }, ...watcherArgs);\n };\n\n // Invokes a function and sets the return value as a property\n $$Reactive.$$setFnHelper = function(k, fn) {\n this.autorun((computation) => {\n // Invokes the reactive functon\n const model = fn.apply(this.$$vm);\n\n // Ignore notifications made by the following handler\n Tracker.nonreactive(() => {\n // If a cursor, observe its changes and update acoordingly\n if ($$utils.isCursor(model)) {\n const observation = this.$$handleCursor(k, model);\n\n computation.onInvalidate(() => {\n observation.stop();\n this.$$vm[k].splice(0);\n });\n } else {\n this.$$handleNonCursor(k, model);\n }\n\n // Notify change and update the view model\n this.$$changed(k);\n });\n });\n };\n\n // Sets a value helper as a setter and a getter which will notify computations once used\n $$Reactive.$$setValHelper = function(k, v, watch = true) {\n // If set, reactives property\n if (watch) {\n const isDeep = _.isObject(v);\n this.getReactively(k, isDeep);\n }\n\n Object.defineProperty(this.$$vm, k, {\n configurable: true,\n enumerable: true,\n\n get: () => {\n return v;\n },\n set: (newVal) => {\n v = newVal;\n this.$$changed(k);\n }\n });\n };\n\n // Fetching a cursor and updates properties once the result set has been changed\n $$Reactive.$$handleCursor = function(k, cursor) {\n // If not defined set it\n if (angular.isUndefined(this.$$vm[k])) {\n this.$$setValHelper(k, cursor.fetch(), false);\n }\n // If defined update it\n else {\n const diff = jsondiffpatch.diff(this.$$vm[k], cursor.fetch());\n jsondiffpatch.patch(this.$$vm[k], diff);\n }\n\n // Observe changes made in the result set\n const observation = cursor.observe({\n addedAt: (doc, atIndex) => {\n if (!observation) return;\n this.$$vm[k].splice(atIndex, 0, doc);\n this.$$changed(k);\n },\n changedAt: (doc, oldDoc, atIndex) => {\n const diff = jsondiffpatch.diff(this.$$vm[k][atIndex], doc);\n jsondiffpatch.patch(this.$$vm[k][atIndex], diff);\n this.$$changed(k);\n },\n movedTo: (doc, fromIndex, toIndex) => {\n this.$$vm[k].splice(fromIndex, 1);\n this.$$vm[k].splice(toIndex, 0, doc);\n this.$$changed(k);\n },\n removedAt: (oldDoc, atIndex) => {\n this.$$vm[k].splice(atIndex, 1);\n this.$$changed(k);\n }\n });\n\n return observation;\n };\n\n $$Reactive.$$handleNonCursor = function(k, data) {\n let v = this.$$vm[k];\n\n if (angular.isDefined(v)) {\n delete this.$$vm[k];\n v = null;\n }\n\n if (angular.isUndefined(v)) {\n this.$$setValHelper(k, data);\n }\n // Update property if the new value is from the same type\n else if ($$utils.areSiblings(v, data)) {\n const diff = jsondiffpatch.diff(v, data);\n jsondiffpatch.patch(v, diff);\n this.$$changed(k);\n } else {\n this.$$vm[k] = data;\n }\n };\n\n // Notifies dependency in view model\n $$Reactive.$$depend = function(k) {\n this.$$vm.$$dependencies[k].depend();\n };\n\n // Notifies change in view model\n $$Reactive.$$changed = function(k) {\n this.$$throttledDigest();\n this.$$vm.$$dependencies[k].changed();\n };\n\n return $$Reactive;\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/reactive.js\n **/","export const name = 'angular-templates';\n\ntry {\n angular.module(name);\n} catch (e) {\n angular.module(name, []);\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/templates.js\n **/"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///dist/angular-meteor.min.js","webpack:///webpack/bootstrap 506237d669ed75851a9d","webpack:///./src/angular-meteor.js","webpack:///./src/lib/get-updates.js","webpack:///./src/lib/diff-array.js","webpack:///./src/modules/angular-meteor-settings.js","webpack:///./src/modules/angular-meteor-ironrouter.js","webpack:///./src/modules/angular-meteor-utils.js","webpack:///./src/modules/angular-meteor-subscribe.js","webpack:///./src/modules/angular-meteor-collection.js","webpack:///./src/modules/angular-meteor-object.js","webpack:///./src/modules/angular-meteor-user.js","webpack:///./src/modules/angular-meteor-methods.js","webpack:///./src/modules/angular-meteor-session.js","webpack:///./src/modules/angular-meteor-camera.js","webpack:///./src/modules/angular-meteor-stopper.js","webpack:///./src/modules/utils.js","webpack:///./src/modules/mixer.js","webpack:///./src/modules/scope.js","webpack:///./src/modules/core.js","webpack:///./src/modules/view-model.js","webpack:///./src/modules/reactive.js","webpack:///./src/modules/templates.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","id","loaded","call","m","c","p","Object","defineProperty","value","name","undefined","_utils","_mixer","_scope","_core","_viewModel","_reactive","_templates","angular","run","Mixer","Core","ViewModel","Reactive","$Mixer","$$Core","$$ViewModel","$$Reactive","mixin","service","$meteorCollection","$meteorCollectionFS","$meteorObject","$meteorMethods","$meteorSession","$meteorSubscribe","$meteorUtils","$meteorCamera","$meteorUser","_this","this","collection","collectionFS","object","subscribe","session","autorun","getCollectionByName","getPicture","forEach","method","utils","rip","obj","level","_","reduce","clone","v","k","isObject","toPaths","keys","getKeyPaths","values","getDeepValues","map","isEmpty","isArray","subKey","flatten","arr","push","setFilled","assert","result","msg","throwErr","Error","getDifference","src","dst","isShallow","compare","srcKeys","dstKeys","chain","concat","uniq","without","diff","srcValue","dstValue","isDate","getTime","valueDiff","getUpdates","paths","set","createSet","unset","createUnset","pull","createPull","updates","undefinedKeys","getUndefinedKeys","omit","pick","arrKeyPaths","split","match","compact","filter","isUndefined","_module","factory","diffArray","lastSeqArray","seqArray","callbacks","preventNestedDiff","diffFn","Package","minimongo","LocalCollection","_diffQueryOrderedChanges","DiffSequence","diffQueryOrderedChanges","oldObjIds","newObjIds","posOld","posNew","posCur","lengthCur","length","each","doc","i","_id","idStringify","addedBefore","before","position","pos","addedAt","movedBefore","prevPosition","movedTo","removed","removedAt","idString","has","idParse","newItem","oldItem","changedAt","_idStringify","MongoID","_idParse","shallow","deepCopyChanges","setDiff","$set","deepKey","setDeep","deepCopyRemovals","unsetDiff","$unset","unsetDeep","getChanges","newCollection","oldCollection","diffMethod","changes","added","changed","item","index","selector","modifier","fromIndex","toIndex","initialKeys","initial","lastKey","last","subObj","nextKey","isNumStr","parseInt","isHash","deepObj","getDeep","splice","getPrototypeOf","prototype","str","constant","suppressWarnings","$compile","$document","$rootScope","Router","isLoaded","onAfterAction","req","res","next","Tracker","afterFlush","$$phase","$apply","_typeof","Symbol","iterator","constructor","angularMeteorUtils","$q","$timeout","$angularMeteorSettings","self","scope","fn","console","warn","comp","firstRun","noop","$on","stop","stripDollarPrefixedKeys","data","Date","File","EJSON","toJSONValue","$type","FS","out","charAt","fulfill","deferred","boundError","boundResult","err","reject","resolve","promissor","defer","args","toArray","arguments","apply","promise","promiseAll","promises","allPromise","all","string","Mongo","Collection","get","findIndexById","foundDoc","find","colDoc","equals","indexOf","$meteorAutorun","angularMeteorSubscribe","_subscribe","subscription","lastArg","isFunction","onStop","_onStop","pop","onReady","$$state","status","Array","slice","Meteor","angularMeteorCollection","AngularMeteorCollection","curDefFunc","diffArrayFunc","autoClientSave","_serverBackup","_diffArrayFunc","_hObserve","_hNewCurAutorun","_hDataAutorun","isDefined","$$collection","cursor","extend","_startCurAutorun","onInvalidate","_stopCursor","_setAutoClientSave","_updateCursor","save","docs","useUnsetModifier","_upsertDoc","createFulfill","partial","docId","isExist","findOne","update","action","insert","_updateDiff","callback","setters","$pull","prop","puller","_updateParallel","done","after","affectedDocsNum","remove","keyOrDocs","keyOrDoc","pluck","check","Match","OneOf","String","ObjectID","key","_removeDoc","_stopObserving","observe","atIndex","_setServerUpdateMode","oldDoc","removedIndex","fetch","_serverMode","_unsetServerUpdateMode","_hUnsetTimeout","_unsetAutoClientSave","cancel","_saveChanges","_hRegAutoBind","$watch","nItems","oItems","addedDocs","reverse","descriptor","removedDocs","reactiveFunc","TypeError","bind","$meteorStopper","scopeProto","angularMeteorObject","AngularMeteorObject","options","helpers","_helpers","create","collectionExtension","$$options","$$id","_getId","$$internalProps","getRawObject","copy","custom","mods","when","reset","keepClientProps","clientProps","docKeys","docExtension","intersection","serverProps","removedKeys","difference","unregisterAutoDestroy","unregisterAutoBind","autorunComputation","fields","reactive","transform","isString","auto","_auto","_setAutos","angularMeteorUser","pack","Accounts","waitForUser","loggingIn","user","requireUser","requireValidUser","validatorFn","then","valid","loginWithPassword","createUser","changePassword","forgotPassword","resetPassword","verifyEmail","logout","logoutOtherClients","loginWithFacebook","loginWithTwitter","loginWithGoogle","loginWithGithub","loginWithMeteorDeveloperAccount","loginWithMeetup","loginWithWeibo","ScopeProto","currentUser","angularMeteorMethods","angularMeteorSession","$parse","model","getter","setter","assign","Session","angularMeteorCamera","MeteorCamera","angularMeteorStopper","$meteorEntity","meteorEntity","$$scope","bindFn","context","tap","_len","_key","bindObj","bound","isCursor","Cursor","isScope","areSiblings","obj1","obj2","_toConsumableArray","arr2","from","_mixins","_autoExtend","_autoConstruct","union","_extend","_construct","_mixout","_ref","Scope","$new","$$utils","$bindToContext","computation","$$autoStop","subName","cb","_Meteor","ready","subscriptionId","callMethod","_Meteor2","applyMethod","_Meteor3","_len2","_key2","stoppable","$$throttledDigest","isDigestable","$$destroyed","$root","$digest","$$defer","_classCallCheck","instance","Constructor","_createClass","defineProperties","target","props","enumerable","configurable","writable","protoProps","staticProps","vm","$$vm","viewModel","proto","boundProto","_this2","_attached","_vm","$$dependencies","Dependency","$$setFnHelper","getReactively","isDeep","isBoolean","$$reactivateEntity","getCollectionReactively","$watchCollection","watcher","watcherArgs","$$watchEntity","depend","getVal","initialVal","val","oldVal","hasChanged","$$changed","_this3","nonreactive","observation","$$handleCursor","$$handleNonCursor","$$setValHelper","_this4","watch","newVal","_this5","jsondiffpatch","patch","$$depend","e"],"mappings":";CACS,SAAUA,GCGnB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAA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N5e,EA0Lbkf,UAAY,SAASld,GAC9BnB,KAAKyb,oBACLzb,KAAK4c,KAAKO,eAAehc,GAAGqH,WAGvBrJ,MrBu8DL,SAAS5B,EAAQD,GAEtB,YAEAQ,QAAOC,eAAeT,EAAS,cAC7BU,OAAO,GsBnqEH,IAAMC,GAAAX,EAAAW,KAAO,mBAEpB,KACES,QAAQnB,OAAOU,GACf,MAAOkhB,GACPzgB,QAAQnB,OAAOU","file":"dist/angular-meteor.min.js","sourcesContent":["/*! angular-meteor v1.3.7 */\n/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.name = undefined;\n\t\n\t__webpack_require__(1);\n\t\n\t__webpack_require__(2);\n\t\n\t__webpack_require__(3);\n\t\n\t__webpack_require__(4);\n\t\n\t__webpack_require__(5);\n\t\n\t__webpack_require__(6);\n\t\n\t__webpack_require__(7);\n\t\n\t__webpack_require__(8);\n\t\n\t__webpack_require__(9);\n\t\n\t__webpack_require__(10);\n\t\n\t__webpack_require__(11);\n\t\n\t__webpack_require__(12);\n\t\n\t__webpack_require__(13);\n\t\n\tvar _utils = __webpack_require__(14);\n\t\n\tvar _mixer = __webpack_require__(15);\n\t\n\tvar _scope = __webpack_require__(16);\n\t\n\tvar _core = __webpack_require__(17);\n\t\n\tvar _viewModel = __webpack_require__(18);\n\t\n\tvar _reactive = __webpack_require__(19);\n\t\n\tvar _templates = __webpack_require__(20);\n\t\n\t// legacy\n\t// lib\n\tvar name = exports.name = 'angular-meteor';\n\t\n\t// new\n\t\n\t\n\tangular.module(name, [\n\t// new\n\t_utils.name, _mixer.name, _scope.name, _core.name, _viewModel.name, _reactive.name, _templates.name,\n\t\n\t// legacy\n\t'angular-meteor.ironrouter', 'angular-meteor.utils', 'angular-meteor.subscribe', 'angular-meteor.collection', 'angular-meteor.object', 'angular-meteor.user', 'angular-meteor.methods', 'angular-meteor.session', 'angular-meteor.camera']).run([_mixer.Mixer, _core.Core, _viewModel.ViewModel, _reactive.Reactive, function ($Mixer, $$Core, $$ViewModel, $$Reactive) {\n\t // Load all mixins\n\t $Mixer.mixin($$Core).mixin($$ViewModel).mixin($$Reactive);\n\t}])\n\t\n\t// legacy\n\t// Putting all services under $meteor service for syntactic sugar\n\t.service('$meteor', ['$meteorCollection', '$meteorCollectionFS', '$meteorObject', '$meteorMethods', '$meteorSession', '$meteorSubscribe', '$meteorUtils', '$meteorCamera', '$meteorUser', function ($meteorCollection, $meteorCollectionFS, $meteorObject, $meteorMethods, $meteorSession, $meteorSubscribe, $meteorUtils, $meteorCamera, $meteorUser) {\n\t var _this = this;\n\t\n\t this.collection = $meteorCollection;\n\t this.collectionFS = $meteorCollectionFS;\n\t this.object = $meteorObject;\n\t this.subscribe = $meteorSubscribe.subscribe;\n\t this.call = $meteorMethods.call;\n\t this.session = $meteorSession;\n\t this.autorun = $meteorUtils.autorun;\n\t this.getCollectionByName = $meteorUtils.getCollectionByName;\n\t this.getPicture = $meteorCamera.getPicture;\n\t\n\t // $meteorUser\n\t ['loginWithPassword', 'requireUser', 'requireValidUser', 'waitForUser', 'createUser', 'changePassword', 'forgotPassword', 'resetPassword', 'verifyEmail', 'loginWithMeteorDeveloperAccount', 'loginWithFacebook', 'loginWithGithub', 'loginWithGoogle', 'loginWithMeetup', 'loginWithTwitter', 'loginWithWeibo', 'logout', 'logoutOtherClients'].forEach(function (method) {\n\t _this[method] = $meteorUser[method];\n\t });\n\t}]);\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, _\n\t */\n\t\n\t'use strict';\n\t\n\t// https://github.com/DAB0mB/get-updates\n\t\n\t(function () {\n\t var module = angular.module('getUpdates', []);\n\t\n\t var utils = function () {\n\t var rip = function rip(obj, level) {\n\t if (level < 1) return {};\n\t\n\t return _.reduce(obj, function (clone, v, k) {\n\t v = _.isObject(v) ? rip(v, --level) : v;\n\t clone[k] = v;\n\t return clone;\n\t }, {});\n\t };\n\t\n\t var toPaths = function toPaths(obj) {\n\t var keys = getKeyPaths(obj);\n\t var values = getDeepValues(obj);\n\t return _.object(keys, values);\n\t };\n\t\n\t var getKeyPaths = function getKeyPaths(obj) {\n\t var keys = _.keys(obj).map(function (k) {\n\t var v = obj[k];\n\t if (!_.isObject(v) || _.isEmpty(v) || _.isArray(v)) return k;\n\t\n\t return getKeyPaths(v).map(function (subKey) {\n\t return k + '.' + subKey;\n\t });\n\t });\n\t\n\t return _.flatten(keys);\n\t };\n\t\n\t var getDeepValues = function getDeepValues(obj, arr) {\n\t arr = arr || [];\n\t\n\t _.values(obj).forEach(function (v) {\n\t if (!_.isObject(v) || _.isEmpty(v) || _.isArray(v)) arr.push(v);else getDeepValues(v, arr);\n\t });\n\t\n\t return arr;\n\t };\n\t\n\t var flatten = function flatten(arr) {\n\t return arr.reduce(function (flattened, v, i) {\n\t if (_.isArray(v) && !_.isEmpty(v)) flattened.push.apply(flattened, flatten(v));else flattened.push(v);\n\t\n\t return flattened;\n\t }, []);\n\t };\n\t\n\t var setFilled = function setFilled(obj, k, v) {\n\t if (!_.isEmpty(v)) obj[k] = v;\n\t };\n\t\n\t var assert = function assert(result, msg) {\n\t if (!result) throwErr(msg);\n\t };\n\t\n\t var throwErr = function throwErr(msg) {\n\t throw Error('get-updates error - ' + msg);\n\t };\n\t\n\t return {\n\t rip: rip,\n\t toPaths: toPaths,\n\t getKeyPaths: getKeyPaths,\n\t getDeepValues: getDeepValues,\n\t setFilled: setFilled,\n\t assert: assert,\n\t throwErr: throwErr\n\t };\n\t }();\n\t\n\t var getDifference = function () {\n\t var getDifference = function getDifference(src, dst, isShallow) {\n\t var level;\n\t\n\t if (isShallow > 1) level = isShallow;else if (isShallow) level = 1;\n\t\n\t if (level) {\n\t src = utils.rip(src, level);\n\t dst = utils.rip(dst, level);\n\t }\n\t\n\t return compare(src, dst);\n\t };\n\t\n\t var compare = function compare(src, dst) {\n\t var srcKeys = _.keys(src);\n\t var dstKeys = _.keys(dst);\n\t\n\t var keys = _.chain([]).concat(srcKeys).concat(dstKeys).uniq().without('$$hashKey').value();\n\t\n\t return keys.reduce(function (diff, k) {\n\t var srcValue = src[k];\n\t var dstValue = dst[k];\n\t\n\t if (_.isDate(srcValue) && _.isDate(dstValue)) {\n\t if (srcValue.getTime() != dstValue.getTime()) diff[k] = dstValue;\n\t }\n\t\n\t if (_.isObject(srcValue) && _.isObject(dstValue)) {\n\t var valueDiff = getDifference(srcValue, dstValue);\n\t utils.setFilled(diff, k, valueDiff);\n\t } else if (srcValue !== dstValue) {\n\t diff[k] = dstValue;\n\t }\n\t\n\t return diff;\n\t }, {});\n\t };\n\t\n\t return getDifference;\n\t }();\n\t\n\t var getUpdates = function () {\n\t var getUpdates = function getUpdates(src, dst, isShallow) {\n\t utils.assert(_.isObject(src), 'first argument must be an object');\n\t utils.assert(_.isObject(dst), 'second argument must be an object');\n\t\n\t var diff = getDifference(src, dst, isShallow);\n\t var paths = utils.toPaths(diff);\n\t\n\t var set = createSet(paths);\n\t var unset = createUnset(paths);\n\t var pull = createPull(unset);\n\t\n\t var updates = {};\n\t utils.setFilled(updates, '$set', set);\n\t utils.setFilled(updates, '$unset', unset);\n\t utils.setFilled(updates, '$pull', pull);\n\t\n\t return updates;\n\t };\n\t\n\t var createSet = function createSet(paths) {\n\t var undefinedKeys = getUndefinedKeys(paths);\n\t return _.omit(paths, undefinedKeys);\n\t };\n\t\n\t var createUnset = function createUnset(paths) {\n\t var undefinedKeys = getUndefinedKeys(paths);\n\t var unset = _.pick(paths, undefinedKeys);\n\t\n\t return _.reduce(unset, function (result, v, k) {\n\t result[k] = true;\n\t return result;\n\t }, {});\n\t };\n\t\n\t var createPull = function createPull(unset) {\n\t var arrKeyPaths = _.keys(unset).map(function (k) {\n\t var split = k.match(/(.*)\\.\\d+$/);\n\t return split && split[1];\n\t });\n\t\n\t return _.compact(arrKeyPaths).reduce(function (pull, k) {\n\t pull[k] = null;\n\t return pull;\n\t }, {});\n\t };\n\t\n\t var getUndefinedKeys = function getUndefinedKeys(obj) {\n\t return _.keys(obj).filter(function (k) {\n\t var v = obj[k];\n\t return _.isUndefined(v);\n\t });\n\t };\n\t\n\t return getUpdates;\n\t }();\n\t\n\t module.value('getUpdates', getUpdates);\n\t})();\n\n/***/ },\n/* 2 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, _, Package\n\t */\n\t\n\t'use strict';\n\t\n\tvar _module = angular.module('diffArray', ['getUpdates']);\n\t\n\t_module.factory('diffArray', ['getUpdates', function (getUpdates) {\n\t var LocalCollection = Package.minimongo.LocalCollection;\n\t var idStringify = LocalCollection._idStringify || Package['mongo-id'].MongoID.idStringify;\n\t var idParse = LocalCollection._idParse || Package['mongo-id'].MongoID.idParse;\n\t\n\t // Calculates the differences between `lastSeqArray` and\n\t // `seqArray` and calls appropriate functions from `callbacks`.\n\t // Reuses Minimongo's diff algorithm implementation.\n\t // XXX Should be replaced with the original diffArray function here:\n\t // https://github.com/meteor/meteor/blob/devel/packages/observe-sequence/observe_sequence.js#L152\n\t // When it will become nested as well, tracking here: https://github.com/meteor/meteor/issues/3764\n\t function diffArray(lastSeqArray, seqArray, callbacks, preventNestedDiff) {\n\t preventNestedDiff = !!preventNestedDiff;\n\t\n\t var diffFn = Package.minimongo.LocalCollection._diffQueryOrderedChanges || Package['diff-sequence'].DiffSequence.diffQueryOrderedChanges;\n\t\n\t var oldObjIds = [];\n\t var newObjIds = [];\n\t var posOld = {}; // maps from idStringify'd ids\n\t var posNew = {}; // ditto\n\t var posCur = {};\n\t var lengthCur = lastSeqArray.length;\n\t\n\t _.each(seqArray, function (doc, i) {\n\t newObjIds.push({ _id: doc._id });\n\t posNew[idStringify(doc._id)] = i;\n\t });\n\t\n\t _.each(lastSeqArray, function (doc, i) {\n\t oldObjIds.push({ _id: doc._id });\n\t posOld[idStringify(doc._id)] = i;\n\t posCur[idStringify(doc._id)] = i;\n\t });\n\t\n\t // Arrays can contain arbitrary objects. We don't diff the\n\t // objects. Instead we always fire 'changedAt' callback on every\n\t // object. The consumer of `observe-sequence` should deal with\n\t // it appropriately.\n\t diffFn(oldObjIds, newObjIds, {\n\t addedBefore: function addedBefore(id, doc, before) {\n\t var position = before ? posCur[idStringify(before)] : lengthCur;\n\t\n\t _.each(posCur, function (pos, id) {\n\t if (pos >= position) posCur[id]++;\n\t });\n\t\n\t lengthCur++;\n\t posCur[idStringify(id)] = position;\n\t\n\t callbacks.addedAt(id, seqArray[posNew[idStringify(id)]], position, before);\n\t },\n\t\n\t movedBefore: function movedBefore(id, before) {\n\t var prevPosition = posCur[idStringify(id)];\n\t var position = before ? posCur[idStringify(before)] : lengthCur - 1;\n\t\n\t _.each(posCur, function (pos, id) {\n\t if (pos >= prevPosition && pos <= position) posCur[id]--;else if (pos <= prevPosition && pos >= position) posCur[id]++;\n\t });\n\t\n\t posCur[idStringify(id)] = position;\n\t\n\t callbacks.movedTo(id, seqArray[posNew[idStringify(id)]], prevPosition, position, before);\n\t },\n\t removed: function removed(id) {\n\t var prevPosition = posCur[idStringify(id)];\n\t\n\t _.each(posCur, function (pos, id) {\n\t if (pos >= prevPosition) posCur[id]--;\n\t });\n\t\n\t delete posCur[idStringify(id)];\n\t lengthCur--;\n\t\n\t callbacks.removedAt(id, lastSeqArray[posOld[idStringify(id)]], prevPosition);\n\t }\n\t });\n\t\n\t _.each(posNew, function (pos, idString) {\n\t if (!_.has(posOld, idString)) return;\n\t\n\t var id = idParse(idString);\n\t var newItem = seqArray[pos] || {};\n\t var oldItem = lastSeqArray[posOld[idString]];\n\t var updates = getUpdates(oldItem, newItem, preventNestedDiff);\n\t\n\t if (!_.isEmpty(updates)) callbacks.changedAt(id, updates, pos, oldItem);\n\t });\n\t }\n\t\n\t diffArray.shallow = function (lastSeqArray, seqArray, callbacks) {\n\t return diffArray(lastSeqArray, seqArray, callbacks, true);\n\t };\n\t\n\t diffArray.deepCopyChanges = function (oldItem, newItem) {\n\t var setDiff = getUpdates(oldItem, newItem).$set;\n\t\n\t _.each(setDiff, function (v, deepKey) {\n\t setDeep(oldItem, deepKey, v);\n\t });\n\t };\n\t\n\t diffArray.deepCopyRemovals = function (oldItem, newItem) {\n\t var unsetDiff = getUpdates(oldItem, newItem).$unset;\n\t\n\t _.each(unsetDiff, function (v, deepKey) {\n\t unsetDeep(oldItem, deepKey);\n\t });\n\t };\n\t\n\t // Finds changes between two collections\n\t diffArray.getChanges = function (newCollection, oldCollection, diffMethod) {\n\t var changes = { added: [], removed: [], changed: [] };\n\t\n\t diffMethod(oldCollection, newCollection, {\n\t addedAt: function addedAt(id, item, index) {\n\t changes.added.push({ item: item, index: index });\n\t },\n\t\n\t removedAt: function removedAt(id, item, index) {\n\t changes.removed.push({ item: item, index: index });\n\t },\n\t\n\t changedAt: function changedAt(id, updates, index, oldItem) {\n\t changes.changed.push({ selector: id, modifier: updates });\n\t },\n\t\n\t movedTo: function movedTo(id, item, fromIndex, toIndex) {\n\t // XXX do we need this?\n\t }\n\t });\n\t\n\t return changes;\n\t };\n\t\n\t var setDeep = function setDeep(obj, deepKey, v) {\n\t var split = deepKey.split('.');\n\t var initialKeys = _.initial(split);\n\t var lastKey = _.last(split);\n\t\n\t initialKeys.reduce(function (subObj, k, i) {\n\t var nextKey = split[i + 1];\n\t\n\t if (isNumStr(nextKey)) {\n\t if (subObj[k] === null) subObj[k] = [];\n\t if (subObj[k].length == parseInt(nextKey)) subObj[k].push(null);\n\t } else if (subObj[k] === null || !isHash(subObj[k])) {\n\t subObj[k] = {};\n\t }\n\t\n\t return subObj[k];\n\t }, obj);\n\t\n\t var deepObj = getDeep(obj, initialKeys);\n\t deepObj[lastKey] = v;\n\t return v;\n\t };\n\t\n\t var unsetDeep = function unsetDeep(obj, deepKey) {\n\t var split = deepKey.split('.');\n\t var initialKeys = _.initial(split);\n\t var lastKey = _.last(split);\n\t var deepObj = getDeep(obj, initialKeys);\n\t\n\t if (_.isArray(deepObj) && isNumStr(lastKey)) return !!deepObj.splice(lastKey, 1);else return delete deepObj[lastKey];\n\t };\n\t\n\t var getDeep = function getDeep(obj, keys) {\n\t return keys.reduce(function (subObj, k) {\n\t return subObj[k];\n\t }, obj);\n\t };\n\t\n\t var isHash = function isHash(obj) {\n\t return _.isObject(obj) && Object.getPrototypeOf(obj) === Object.prototype;\n\t };\n\t\n\t var isNumStr = function isNumStr(str) {\n\t return str.match(/^\\d+$/);\n\t };\n\t\n\t return diffArray;\n\t}]);\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tangular.module('angular-meteor.settings', []).constant('$angularMeteorSettings', {\n\t suppressWarnings: false\n\t});\n\n/***/ },\n/* 4 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tangular.module('angular-meteor.ironrouter', []).run(['$compile', '$document', '$rootScope', function ($compile, $document, $rootScope) {\n\t var Router = (Package['iron:router'] || {}).Router;\n\t if (!Router) return;\n\t\n\t var isLoaded = false;\n\t\n\t // Recompile after iron:router builds page\n\t Router.onAfterAction(function (req, res, next) {\n\t Tracker.afterFlush(function () {\n\t if (isLoaded) return;\n\t $compile($document)($rootScope);\n\t if (!$rootScope.$$phase) $rootScope.$apply();\n\t isLoaded = true;\n\t });\n\t });\n\t}]);\n\n/***/ },\n/* 5 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, _, Tracker, EJSON, FS, Mongo\n\t */\n\t\n\t'use strict';\n\t\n\tvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\t\n\tvar angularMeteorUtils = angular.module('angular-meteor.utils', ['angular-meteor.settings']);\n\t\n\tangularMeteorUtils.service('$meteorUtils', ['$q', '$timeout', '$angularMeteorSettings', function ($q, $timeout, $angularMeteorSettings) {\n\t\n\t var self = this;\n\t\n\t this.autorun = function (scope, fn) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.utils.autorun] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.6/autorun. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t // wrapping around Deps.autorun\n\t var comp = Tracker.autorun(function (c) {\n\t fn(c);\n\t // this is run immediately for the first call\n\t // but after that, we need to $apply to start Angular digest\n\t if (!c.firstRun) $timeout(angular.noop, 0);\n\t });\n\t\n\t // stop autorun when scope is destroyed\n\t scope.$on('$destroy', function () {\n\t comp.stop();\n\t });\n\t\n\t // return autorun object so that it can be stopped manually\n\t return comp;\n\t };\n\t\n\t // Borrowed from angularFire\n\t // https://github.com/firebase/angularfire/blob/master/src/utils.js#L445-L454\n\t this.stripDollarPrefixedKeys = function (data) {\n\t if (!_.isObject(data) || data instanceof Date || data instanceof File || EJSON.toJSONValue(data).$type === 'oid' || (typeof FS === 'undefined' ? 'undefined' : _typeof(FS)) === 'object' && data instanceof FS.File) return data;\n\t\n\t var out = _.isArray(data) ? [] : {};\n\t\n\t _.each(data, function (v, k) {\n\t if (typeof k !== 'string' || k.charAt(0) !== '$') out[k] = self.stripDollarPrefixedKeys(v);\n\t });\n\t\n\t return out;\n\t };\n\t\n\t // Returns a callback which fulfills promise\n\t this.fulfill = function (deferred, boundError, boundResult) {\n\t return function (err, result) {\n\t if (err) deferred.reject(boundError == null ? err : boundError);else if (typeof boundResult == \"function\") deferred.resolve(boundResult == null ? result : boundResult(result));else deferred.resolve(boundResult == null ? result : boundResult);\n\t };\n\t };\n\t\n\t // creates a function which invokes method with the given arguments and returns a promise\n\t this.promissor = function (obj, method) {\n\t return function () {\n\t var deferred = $q.defer();\n\t var fulfill = self.fulfill(deferred);\n\t var args = _.toArray(arguments).concat(fulfill);\n\t obj[method].apply(obj, args);\n\t return deferred.promise;\n\t };\n\t };\n\t\n\t // creates a $q.all() promise and call digestion loop on fulfillment\n\t this.promiseAll = function (promises) {\n\t var allPromise = $q.all(promises);\n\t\n\t allPromise.finally(function () {\n\t // calls digestion loop with no conflicts\n\t $timeout(angular.noop);\n\t });\n\t\n\t return allPromise;\n\t };\n\t\n\t this.getCollectionByName = function (string) {\n\t return Mongo.Collection.get(string);\n\t };\n\t\n\t this.findIndexById = function (collection, doc) {\n\t var foundDoc = _.find(collection, function (colDoc) {\n\t // EJSON.equals used to compare Mongo.ObjectIDs and Strings.\n\t return EJSON.equals(colDoc._id, doc._id);\n\t });\n\t\n\t return _.indexOf(collection, foundDoc);\n\t };\n\t}]);\n\t\n\tangularMeteorUtils.run(['$rootScope', '$meteorUtils', function ($rootScope, $meteorUtils) {\n\t Object.getPrototypeOf($rootScope).$meteorAutorun = function (fn) {\n\t return $meteorUtils.autorun(this, fn);\n\t };\n\t}]);\n\n/***/ },\n/* 6 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, Meteor\n\t */\n\t\n\t'use strict';\n\t\n\tvar angularMeteorSubscribe = angular.module('angular-meteor.subscribe', ['angular-meteor.settings']);\n\t\n\tangularMeteorSubscribe.service('$meteorSubscribe', ['$q', '$angularMeteorSettings', function ($q, $angularMeteorSettings) {\n\t\n\t var self = this;\n\t\n\t this._subscribe = function (scope, deferred, args) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.subscribe] Please note that this module is deprecated since 1.3.0 and will be removed in 1.4.0! Replace it with the new syntax described here: http://www.angular-meteor.com/api/1.3.6/subscribe. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t var subscription = null;\n\t var lastArg = args[args.length - 1];\n\t\n\t // User supplied onStop callback\n\t // save it for later use and remove\n\t // from subscription arguments\n\t if (angular.isObject(lastArg) && angular.isFunction(lastArg.onStop)) {\n\t var _onStop = lastArg.onStop;\n\t\n\t args.pop();\n\t }\n\t\n\t args.push({\n\t onReady: function onReady() {\n\t deferred.resolve(subscription);\n\t },\n\t onStop: function onStop(err) {\n\t if (!deferred.promise.$$state.status) {\n\t if (err) deferred.reject(err);else deferred.reject(new Meteor.Error(\"Subscription Stopped\", \"Subscription stopped by a call to stop method. Either by the client or by the server.\"));\n\t } else if (_onStop)\n\t // After promise was resolved or rejected\n\t // call user supplied onStop callback.\n\t _onStop.apply(this, Array.prototype.slice.call(arguments));\n\t }\n\t });\n\t\n\t subscription = Meteor.subscribe.apply(scope, args);\n\t\n\t return subscription;\n\t };\n\t\n\t this.subscribe = function () {\n\t var deferred = $q.defer();\n\t var args = Array.prototype.slice.call(arguments);\n\t var subscription = null;\n\t\n\t self._subscribe(this, deferred, args);\n\t\n\t return deferred.promise;\n\t };\n\t}]);\n\t\n\tangularMeteorSubscribe.run(['$rootScope', '$q', '$meteorSubscribe', function ($rootScope, $q, $meteorSubscribe) {\n\t Object.getPrototypeOf($rootScope).$meteorSubscribe = function () {\n\t var deferred = $q.defer();\n\t var args = Array.prototype.slice.call(arguments);\n\t\n\t var subscription = $meteorSubscribe._subscribe(this, deferred, args);\n\t\n\t this.$on('$destroy', function () {\n\t subscription.stop();\n\t });\n\t\n\t return deferred.promise;\n\t };\n\t}]);\n\n/***/ },\n/* 7 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, _, Tracker, check, Match, Mongo\n\t */\n\t\n\t'use strict';\n\t\n\tvar angularMeteorCollection = angular.module('angular-meteor.collection', ['angular-meteor.stopper', 'angular-meteor.subscribe', 'angular-meteor.utils', 'diffArray', 'angular-meteor.settings']);\n\t\n\t// The reason angular meteor collection is a factory function and not something\n\t// that inherit from array comes from here:\n\t// http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/\n\t// We went with the direct extensions approach.\n\tangularMeteorCollection.factory('AngularMeteorCollection', ['$q', '$meteorSubscribe', '$meteorUtils', '$rootScope', '$timeout', 'diffArray', '$angularMeteorSettings', function ($q, $meteorSubscribe, $meteorUtils, $rootScope, $timeout, diffArray, $angularMeteorSettings) {\n\t\n\t function AngularMeteorCollection(curDefFunc, collection, diffArrayFunc, autoClientSave) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.$meteorCollection] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/meteorCollection. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t var data = [];\n\t // Server backup data to evaluate what changes come from client\n\t // after each server update.\n\t data._serverBackup = [];\n\t // Array differ function.\n\t data._diffArrayFunc = diffArrayFunc;\n\t // Handler of the cursor observer.\n\t data._hObserve = null;\n\t // On new cursor autorun handler\n\t // (autorun for reactive variables).\n\t data._hNewCurAutorun = null;\n\t // On new data autorun handler\n\t // (autorun for cursor.fetch).\n\t data._hDataAutorun = null;\n\t\n\t if (angular.isDefined(collection)) {\n\t data.$$collection = collection;\n\t } else {\n\t var cursor = curDefFunc();\n\t data.$$collection = $meteorUtils.getCollectionByName(cursor.collection.name);\n\t }\n\t\n\t _.extend(data, AngularMeteorCollection);\n\t data._startCurAutorun(curDefFunc, autoClientSave);\n\t\n\t return data;\n\t }\n\t\n\t AngularMeteorCollection._startCurAutorun = function (curDefFunc, autoClientSave) {\n\t var self = this;\n\t\n\t self._hNewCurAutorun = Tracker.autorun(function () {\n\t // When the reactive func gets recomputated we need to stop any previous\n\t // observeChanges.\n\t Tracker.onInvalidate(function () {\n\t self._stopCursor();\n\t });\n\t\n\t if (autoClientSave) self._setAutoClientSave();\n\t self._updateCursor(curDefFunc(), autoClientSave);\n\t });\n\t };\n\t\n\t AngularMeteorCollection.subscribe = function () {\n\t $meteorSubscribe.subscribe.apply(this, arguments);\n\t return this;\n\t };\n\t\n\t AngularMeteorCollection.save = function (docs, useUnsetModifier) {\n\t // save whole collection\n\t if (!docs) docs = this;\n\t // save single doc\n\t docs = [].concat(docs);\n\t\n\t var promises = docs.map(function (doc) {\n\t return this._upsertDoc(doc, useUnsetModifier);\n\t }, this);\n\t\n\t return $meteorUtils.promiseAll(promises);\n\t };\n\t\n\t AngularMeteorCollection._upsertDoc = function (doc, useUnsetModifier) {\n\t var deferred = $q.defer();\n\t var collection = this.$$collection;\n\t var createFulfill = _.partial($meteorUtils.fulfill, deferred, null);\n\t\n\t // delete $$hashkey\n\t doc = $meteorUtils.stripDollarPrefixedKeys(doc);\n\t var docId = doc._id;\n\t var isExist = collection.findOne(docId);\n\t\n\t // update\n\t if (isExist) {\n\t // Deletes _id property (from the copy) so that\n\t // it can be $set using update.\n\t delete doc._id;\n\t var modifier = useUnsetModifier ? { $unset: doc } : { $set: doc };\n\t // NOTE: do not use #upsert() method, since it does not exist in some collections\n\t collection.update(docId, modifier, createFulfill(function () {\n\t return { _id: docId, action: 'updated' };\n\t }));\n\t }\n\t // insert\n\t else {\n\t collection.insert(doc, createFulfill(function (id) {\n\t return { _id: id, action: 'inserted' };\n\t }));\n\t }\n\t\n\t return deferred.promise;\n\t };\n\t\n\t // performs $pull operations parallely.\n\t // used for handling splice operations returned from getUpdates() to prevent conflicts.\n\t // see issue: https://github.com/Urigo/angular-meteor/issues/793\n\t AngularMeteorCollection._updateDiff = function (selector, update, callback) {\n\t callback = callback || angular.noop;\n\t var setters = _.omit(update, '$pull');\n\t var updates = [setters];\n\t\n\t _.each(update.$pull, function (pull, prop) {\n\t var puller = {};\n\t puller[prop] = pull;\n\t updates.push({ $pull: puller });\n\t });\n\t\n\t this._updateParallel(selector, updates, callback);\n\t };\n\t\n\t // performs each update operation parallely\n\t AngularMeteorCollection._updateParallel = function (selector, updates, callback) {\n\t var self = this;\n\t var done = _.after(updates.length, callback);\n\t\n\t var next = function next(err, affectedDocsNum) {\n\t if (err) return callback(err);\n\t done(null, affectedDocsNum);\n\t };\n\t\n\t _.each(updates, function (update) {\n\t self.$$collection.update(selector, update, next);\n\t });\n\t };\n\t\n\t AngularMeteorCollection.remove = function (keyOrDocs) {\n\t var keys;\n\t\n\t // remove whole collection\n\t if (!keyOrDocs) {\n\t keys = _.pluck(this, '_id');\n\t }\n\t // remove docs\n\t else {\n\t keyOrDocs = [].concat(keyOrDocs);\n\t\n\t keys = _.map(keyOrDocs, function (keyOrDoc) {\n\t return keyOrDoc._id || keyOrDoc;\n\t });\n\t }\n\t\n\t // Checks if all keys are correct.\n\t check(keys, [Match.OneOf(String, Mongo.ObjectID)]);\n\t\n\t var promises = keys.map(function (key) {\n\t return this._removeDoc(key);\n\t }, this);\n\t\n\t return $meteorUtils.promiseAll(promises);\n\t };\n\t\n\t AngularMeteorCollection._removeDoc = function (id) {\n\t var deferred = $q.defer();\n\t var collection = this.$$collection;\n\t var fulfill = $meteorUtils.fulfill(deferred, null, { _id: id, action: 'removed' });\n\t collection.remove(id, fulfill);\n\t return deferred.promise;\n\t };\n\t\n\t AngularMeteorCollection._updateCursor = function (cursor, autoClientSave) {\n\t var self = this;\n\t // XXX - consider adding an option for a non-orderd result for faster performance\n\t if (self._hObserve) self._stopObserving();\n\t\n\t self._hObserve = cursor.observe({\n\t addedAt: function addedAt(doc, atIndex) {\n\t self.splice(atIndex, 0, doc);\n\t self._serverBackup.splice(atIndex, 0, doc);\n\t self._setServerUpdateMode();\n\t },\n\t\n\t changedAt: function changedAt(doc, oldDoc, atIndex) {\n\t diffArray.deepCopyChanges(self[atIndex], doc);\n\t diffArray.deepCopyRemovals(self[atIndex], doc);\n\t self._serverBackup[atIndex] = self[atIndex];\n\t self._setServerUpdateMode();\n\t },\n\t\n\t movedTo: function movedTo(doc, fromIndex, toIndex) {\n\t self.splice(fromIndex, 1);\n\t self.splice(toIndex, 0, doc);\n\t self._serverBackup.splice(fromIndex, 1);\n\t self._serverBackup.splice(toIndex, 0, doc);\n\t self._setServerUpdateMode();\n\t },\n\t\n\t removedAt: function removedAt(oldDoc) {\n\t var removedIndex = $meteorUtils.findIndexById(self, oldDoc);\n\t\n\t if (removedIndex != -1) {\n\t self.splice(removedIndex, 1);\n\t self._serverBackup.splice(removedIndex, 1);\n\t self._setServerUpdateMode();\n\t } else {\n\t // If it's been removed on client then it's already not in collection\n\t // itself but still is in the _serverBackup.\n\t removedIndex = $meteorUtils.findIndexById(self._serverBackup, oldDoc);\n\t\n\t if (removedIndex != -1) {\n\t self._serverBackup.splice(removedIndex, 1);\n\t }\n\t }\n\t }\n\t });\n\t\n\t self._hDataAutorun = Tracker.autorun(function () {\n\t cursor.fetch();\n\t if (self._serverMode) self._unsetServerUpdateMode(autoClientSave);\n\t });\n\t };\n\t\n\t AngularMeteorCollection._stopObserving = function () {\n\t this._hObserve.stop();\n\t this._hDataAutorun.stop();\n\t delete this._serverMode;\n\t delete this._hUnsetTimeout;\n\t };\n\t\n\t AngularMeteorCollection._setServerUpdateMode = function (name) {\n\t this._serverMode = true;\n\t // To simplify server update logic, we don't follow\n\t // updates from the client at the same time.\n\t this._unsetAutoClientSave();\n\t };\n\t\n\t // Here we use $timeout to combine multiple updates that go\n\t // each one after another.\n\t AngularMeteorCollection._unsetServerUpdateMode = function (autoClientSave) {\n\t var self = this;\n\t\n\t if (self._hUnsetTimeout) {\n\t $timeout.cancel(self._hUnsetTimeout);\n\t self._hUnsetTimeout = null;\n\t }\n\t\n\t self._hUnsetTimeout = $timeout(function () {\n\t self._serverMode = false;\n\t // Finds updates that was potentially done from the client side\n\t // and saves them.\n\t var changes = diffArray.getChanges(self, self._serverBackup, self._diffArrayFunc);\n\t self._saveChanges(changes);\n\t // After, continues following client updates.\n\t if (autoClientSave) self._setAutoClientSave();\n\t }, 0);\n\t };\n\t\n\t AngularMeteorCollection.stop = function () {\n\t this._stopCursor();\n\t this._hNewCurAutorun.stop();\n\t };\n\t\n\t AngularMeteorCollection._stopCursor = function () {\n\t this._unsetAutoClientSave();\n\t\n\t if (this._hObserve) {\n\t this._hObserve.stop();\n\t this._hDataAutorun.stop();\n\t }\n\t\n\t this.splice(0);\n\t this._serverBackup.splice(0);\n\t };\n\t\n\t AngularMeteorCollection._unsetAutoClientSave = function (name) {\n\t if (this._hRegAutoBind) {\n\t this._hRegAutoBind();\n\t this._hRegAutoBind = null;\n\t }\n\t };\n\t\n\t AngularMeteorCollection._setAutoClientSave = function () {\n\t var self = this;\n\t\n\t // Always unsets auto save to keep only one $watch handler.\n\t self._unsetAutoClientSave();\n\t\n\t self._hRegAutoBind = $rootScope.$watch(function () {\n\t return self;\n\t }, function (nItems, oItems) {\n\t if (nItems === oItems) return;\n\t\n\t var changes = diffArray.getChanges(self, oItems, self._diffArrayFunc);\n\t self._unsetAutoClientSave();\n\t self._saveChanges(changes);\n\t self._setAutoClientSave();\n\t }, true);\n\t };\n\t\n\t AngularMeteorCollection._saveChanges = function (changes) {\n\t var self = this;\n\t\n\t // Saves added documents\n\t // Using reversed iteration to prevent indexes from changing during splice\n\t var addedDocs = changes.added.reverse().map(function (descriptor) {\n\t self.splice(descriptor.index, 1);\n\t return descriptor.item;\n\t });\n\t\n\t if (addedDocs.length) self.save(addedDocs);\n\t\n\t // Removes deleted documents\n\t var removedDocs = changes.removed.map(function (descriptor) {\n\t return descriptor.item;\n\t });\n\t\n\t if (removedDocs.length) self.remove(removedDocs);\n\t\n\t // Updates changed documents\n\t changes.changed.forEach(function (descriptor) {\n\t self._updateDiff(descriptor.selector, descriptor.modifier);\n\t });\n\t };\n\t\n\t return AngularMeteorCollection;\n\t}]);\n\t\n\tangularMeteorCollection.factory('$meteorCollectionFS', ['$meteorCollection', 'diffArray', '$angularMeteorSettings', function ($meteorCollection, diffArray, $angularMeteorSettings) {\n\t function $meteorCollectionFS(reactiveFunc, autoClientSave, collection) {\n\t\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.$meteorCollectionFS] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/files. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t return new $meteorCollection(reactiveFunc, autoClientSave, collection, diffArray.shallow);\n\t }\n\t\n\t return $meteorCollectionFS;\n\t}]);\n\t\n\tangularMeteorCollection.factory('$meteorCollection', ['AngularMeteorCollection', '$rootScope', 'diffArray', function (AngularMeteorCollection, $rootScope, diffArray) {\n\t function $meteorCollection(reactiveFunc, autoClientSave, collection, diffFn) {\n\t // Validate parameters\n\t if (!reactiveFunc) {\n\t throw new TypeError('The first argument of $meteorCollection is undefined.');\n\t }\n\t\n\t if (!(angular.isFunction(reactiveFunc) || angular.isFunction(reactiveFunc.find))) {\n\t throw new TypeError('The first argument of $meteorCollection must be a function or ' + 'a have a find function property.');\n\t }\n\t\n\t if (!angular.isFunction(reactiveFunc)) {\n\t collection = angular.isDefined(collection) ? collection : reactiveFunc;\n\t reactiveFunc = _.bind(reactiveFunc.find, reactiveFunc);\n\t }\n\t\n\t // By default auto save - true.\n\t autoClientSave = angular.isDefined(autoClientSave) ? autoClientSave : true;\n\t diffFn = diffFn || diffArray;\n\t return new AngularMeteorCollection(reactiveFunc, collection, diffFn, autoClientSave);\n\t }\n\t\n\t return $meteorCollection;\n\t}]);\n\t\n\tangularMeteorCollection.run(['$rootScope', '$meteorCollection', '$meteorCollectionFS', '$meteorStopper', function ($rootScope, $meteorCollection, $meteorCollectionFS, $meteorStopper) {\n\t var scopeProto = Object.getPrototypeOf($rootScope);\n\t scopeProto.$meteorCollection = $meteorStopper($meteorCollection);\n\t scopeProto.$meteorCollectionFS = $meteorStopper($meteorCollectionFS);\n\t}]);\n\n/***/ },\n/* 8 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, _, Mongo\n\t*/\n\t\n\t'use strict';\n\t\n\tvar angularMeteorObject = angular.module('angular-meteor.object', ['angular-meteor.utils', 'angular-meteor.subscribe', 'angular-meteor.collection', 'getUpdates', 'diffArray', 'angular-meteor.settings']);\n\t\n\tangularMeteorObject.factory('AngularMeteorObject', ['$q', '$meteorSubscribe', '$meteorUtils', 'diffArray', 'getUpdates', 'AngularMeteorCollection', '$angularMeteorSettings', function ($q, $meteorSubscribe, $meteorUtils, diffArray, getUpdates, AngularMeteorCollection, $angularMeteorSettings) {\n\t\n\t // A list of internals properties to not watch for, nor pass to the Document on update and etc.\n\t AngularMeteorObject.$$internalProps = ['$$collection', '$$options', '$$id', '$$hashkey', '$$internalProps', '$$scope', 'bind', 'save', 'reset', 'subscribe', 'stop', 'autorunComputation', 'unregisterAutoBind', 'unregisterAutoDestroy', 'getRawObject', '_auto', '_setAutos', '_eventEmitter', '_serverBackup', '_updateDiff', '_updateParallel', '_getId'];\n\t\n\t function AngularMeteorObject(collection, selector, options) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.$meteorObject] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/meteorObject. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t // Make data not be an object so we can extend it to preserve\n\t // Collection Helpers and the like\n\t var helpers = collection._helpers;\n\t var data = _.isFunction(helpers) ? Object.create(helpers.prototype) : {};\n\t var doc = collection.findOne(selector, options);\n\t var collectionExtension = _.pick(AngularMeteorCollection, '_updateParallel');\n\t _.extend(data, doc);\n\t _.extend(data, AngularMeteorObject);\n\t _.extend(data, collectionExtension);\n\t\n\t // Omit options that may spoil document finding\n\t data.$$options = _.omit(options, 'skip', 'limit');\n\t data.$$collection = collection;\n\t data.$$id = data._getId(selector);\n\t data._serverBackup = doc || {};\n\t\n\t return data;\n\t }\n\t\n\t AngularMeteorObject.getRawObject = function () {\n\t return angular.copy(_.omit(this, this.$$internalProps));\n\t };\n\t\n\t AngularMeteorObject.subscribe = function () {\n\t $meteorSubscribe.subscribe.apply(this, arguments);\n\t return this;\n\t };\n\t\n\t AngularMeteorObject.save = function (custom) {\n\t var deferred = $q.defer();\n\t var collection = this.$$collection;\n\t var createFulfill = _.partial($meteorUtils.fulfill, deferred, null);\n\t var oldDoc = collection.findOne(this.$$id);\n\t var mods;\n\t\n\t // update\n\t if (oldDoc) {\n\t if (custom) mods = { $set: custom };else {\n\t mods = getUpdates(oldDoc, this.getRawObject());\n\t // If there are no updates, there is nothing to do here, returning\n\t if (_.isEmpty(mods)) {\n\t return $q.when({ action: 'updated' });\n\t }\n\t }\n\t\n\t // NOTE: do not use #upsert() method, since it does not exist in some collections\n\t this._updateDiff(mods, createFulfill({ action: 'updated' }));\n\t }\n\t // insert\n\t else {\n\t if (custom) mods = _.clone(custom);else mods = this.getRawObject();\n\t\n\t mods._id = mods._id || this.$$id;\n\t collection.insert(mods, createFulfill({ action: 'inserted' }));\n\t }\n\t\n\t return deferred.promise;\n\t };\n\t\n\t AngularMeteorObject._updateDiff = function (update, callback) {\n\t var selector = this.$$id;\n\t AngularMeteorCollection._updateDiff.call(this, selector, update, callback);\n\t };\n\t\n\t AngularMeteorObject.reset = function (keepClientProps) {\n\t var self = this;\n\t var options = this.$$options;\n\t var id = this.$$id;\n\t var doc = this.$$collection.findOne(id, options);\n\t\n\t if (doc) {\n\t // extend SubObject\n\t var docKeys = _.keys(doc);\n\t var docExtension = _.pick(doc, docKeys);\n\t var clientProps;\n\t\n\t _.extend(self, docExtension);\n\t _.extend(self._serverBackup, docExtension);\n\t\n\t if (keepClientProps) {\n\t clientProps = _.intersection(_.keys(self), _.keys(self._serverBackup));\n\t } else {\n\t clientProps = _.keys(self);\n\t }\n\t\n\t var serverProps = _.keys(doc);\n\t var removedKeys = _.difference(clientProps, serverProps, self.$$internalProps);\n\t\n\t removedKeys.forEach(function (prop) {\n\t delete self[prop];\n\t delete self._serverBackup[prop];\n\t });\n\t } else {\n\t _.keys(this.getRawObject()).forEach(function (prop) {\n\t delete self[prop];\n\t });\n\t\n\t self._serverBackup = {};\n\t }\n\t };\n\t\n\t AngularMeteorObject.stop = function () {\n\t if (this.unregisterAutoDestroy) this.unregisterAutoDestroy();\n\t\n\t if (this.unregisterAutoBind) this.unregisterAutoBind();\n\t\n\t if (this.autorunComputation && this.autorunComputation.stop) this.autorunComputation.stop();\n\t };\n\t\n\t AngularMeteorObject._getId = function (selector) {\n\t var options = _.extend({}, this.$$options, {\n\t fields: { _id: 1 },\n\t reactive: false,\n\t transform: null\n\t });\n\t\n\t var doc = this.$$collection.findOne(selector, options);\n\t\n\t if (doc) return doc._id;\n\t if (selector instanceof Mongo.ObjectID) return selector;\n\t if (_.isString(selector)) return selector;\n\t return new Mongo.ObjectID();\n\t };\n\t\n\t return AngularMeteorObject;\n\t}]);\n\t\n\tangularMeteorObject.factory('$meteorObject', ['$rootScope', '$meteorUtils', 'getUpdates', 'AngularMeteorObject', function ($rootScope, $meteorUtils, getUpdates, AngularMeteorObject) {\n\t function $meteorObject(collection, id, auto, options) {\n\t // Validate parameters\n\t if (!collection) {\n\t throw new TypeError(\"The first argument of $meteorObject is undefined.\");\n\t }\n\t\n\t if (!angular.isFunction(collection.findOne)) {\n\t throw new TypeError(\"The first argument of $meteorObject must be a function or a have a findOne function property.\");\n\t }\n\t\n\t var data = new AngularMeteorObject(collection, id, options);\n\t // Making auto default true - http://stackoverflow.com/a/15464208/1426570\n\t data._auto = auto !== false;\n\t _.extend(data, $meteorObject);\n\t data._setAutos();\n\t return data;\n\t }\n\t\n\t $meteorObject._setAutos = function () {\n\t var self = this;\n\t\n\t this.autorunComputation = $meteorUtils.autorun($rootScope, function () {\n\t self.reset(true);\n\t });\n\t\n\t // Deep watches the model and performs autobind\n\t this.unregisterAutoBind = this._auto && $rootScope.$watch(function () {\n\t return self.getRawObject();\n\t }, function (item, oldItem) {\n\t if (item !== oldItem) self.save();\n\t }, true);\n\t\n\t this.unregisterAutoDestroy = $rootScope.$on('$destroy', function () {\n\t if (self && self.stop) self.pop();\n\t });\n\t };\n\t\n\t return $meteorObject;\n\t}]);\n\t\n\tangularMeteorObject.run(['$rootScope', '$meteorObject', '$meteorStopper', function ($rootScope, $meteorObject, $meteorStopper) {\n\t var scopeProto = Object.getPrototypeOf($rootScope);\n\t scopeProto.$meteorObject = $meteorStopper($meteorObject);\n\t}]);\n\n/***/ },\n/* 9 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, _, Package, Meteor\n\t */\n\t\n\t'use strict';\n\t\n\tvar angularMeteorUser = angular.module('angular-meteor.user', ['angular-meteor.utils', 'angular-meteor.core', 'angular-meteor.settings']);\n\t\n\t// requires package 'accounts-password'\n\tangularMeteorUser.service('$meteorUser', ['$rootScope', '$meteorUtils', '$q', '$angularMeteorSettings', function ($rootScope, $meteorUtils, $q, $angularMeteorSettings) {\n\t\n\t var pack = Package['accounts-base'];\n\t if (!pack) return;\n\t\n\t var self = this;\n\t var Accounts = pack.Accounts;\n\t\n\t this.waitForUser = function () {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.waitForUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t var deferred = $q.defer();\n\t\n\t $meteorUtils.autorun($rootScope, function () {\n\t if (!Meteor.loggingIn()) deferred.resolve(Meteor.user());\n\t }, true);\n\t\n\t return deferred.promise;\n\t };\n\t\n\t this.requireUser = function () {\n\t if (!$angularMeteorSettings.suppressWarnings) {\n\t console.warn('[angular-meteor.requireUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t }\n\t\n\t var deferred = $q.defer();\n\t\n\t $meteorUtils.autorun($rootScope, function () {\n\t if (!Meteor.loggingIn()) {\n\t if (Meteor.user() === null) deferred.reject(\"AUTH_REQUIRED\");else deferred.resolve(Meteor.user());\n\t }\n\t }, true);\n\t\n\t return deferred.promise;\n\t };\n\t\n\t this.requireValidUser = function (validatorFn) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.requireValidUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t return self.requireUser(true).then(function (user) {\n\t var valid = validatorFn(user);\n\t\n\t if (valid === true) return user;else if (typeof valid === \"string\") return $q.reject(valid);else return $q.reject(\"FORBIDDEN\");\n\t });\n\t };\n\t\n\t this.loginWithPassword = $meteorUtils.promissor(Meteor, 'loginWithPassword');\n\t this.createUser = $meteorUtils.promissor(Accounts, 'createUser');\n\t this.changePassword = $meteorUtils.promissor(Accounts, 'changePassword');\n\t this.forgotPassword = $meteorUtils.promissor(Accounts, 'forgotPassword');\n\t this.resetPassword = $meteorUtils.promissor(Accounts, 'resetPassword');\n\t this.verifyEmail = $meteorUtils.promissor(Accounts, 'verifyEmail');\n\t this.logout = $meteorUtils.promissor(Meteor, 'logout');\n\t this.logoutOtherClients = $meteorUtils.promissor(Meteor, 'logoutOtherClients');\n\t this.loginWithFacebook = $meteorUtils.promissor(Meteor, 'loginWithFacebook');\n\t this.loginWithTwitter = $meteorUtils.promissor(Meteor, 'loginWithTwitter');\n\t this.loginWithGoogle = $meteorUtils.promissor(Meteor, 'loginWithGoogle');\n\t this.loginWithGithub = $meteorUtils.promissor(Meteor, 'loginWithGithub');\n\t this.loginWithMeteorDeveloperAccount = $meteorUtils.promissor(Meteor, 'loginWithMeteorDeveloperAccount');\n\t this.loginWithMeetup = $meteorUtils.promissor(Meteor, 'loginWithMeetup');\n\t this.loginWithWeibo = $meteorUtils.promissor(Meteor, 'loginWithWeibo');\n\t}]);\n\t\n\tangularMeteorUser.run(['$rootScope', '$angularMeteorSettings', '$$Core', function ($rootScope, $angularMeteorSettings, $$Core) {\n\t\n\t var ScopeProto = Object.getPrototypeOf($rootScope);\n\t _.extend(ScopeProto, $$Core);\n\t\n\t $rootScope.autorun(function () {\n\t if (!Meteor.user) return;\n\t $rootScope.currentUser = Meteor.user();\n\t $rootScope.loggingIn = Meteor.loggingIn();\n\t });\n\t}]);\n\n/***/ },\n/* 10 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, _, Meteor\n\t */\n\t\n\t'use strict';\n\t\n\tvar angularMeteorMethods = angular.module('angular-meteor.methods', ['angular-meteor.utils', 'angular-meteor.settings']);\n\t\n\tangularMeteorMethods.service('$meteorMethods', ['$q', '$meteorUtils', '$angularMeteorSettings', function ($q, $meteorUtils, $angularMeteorSettings) {\n\t this.call = function () {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.$meteor.call] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/methods. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t var deferred = $q.defer();\n\t var fulfill = $meteorUtils.fulfill(deferred);\n\t var args = _.toArray(arguments).concat(fulfill);\n\t Meteor.call.apply(this, args);\n\t return deferred.promise;\n\t };\n\t}]);\n\n/***/ },\n/* 11 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, Session\n\t */\n\t\n\t'use strict';\n\t\n\tvar angularMeteorSession = angular.module('angular-meteor.session', ['angular-meteor.utils', 'angular-meteor.settings']);\n\t\n\tangularMeteorSession.factory('$meteorSession', ['$meteorUtils', '$parse', '$angularMeteorSettings', function ($meteorUtils, $parse, $angularMeteorSettings) {\n\t return function (session) {\n\t\n\t return {\n\t\n\t bind: function bind(scope, model) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.session.bind] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://www.angular-meteor.com/api/1.3.0/session. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t var getter = $parse(model);\n\t var setter = getter.assign;\n\t $meteorUtils.autorun(scope, function () {\n\t setter(scope, Session.get(session));\n\t });\n\t\n\t scope.$watch(model, function (newItem, oldItem) {\n\t Session.set(session, getter(scope));\n\t }, true);\n\t }\n\t };\n\t };\n\t}]);\n\n/***/ },\n/* 12 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular, Package\n\t */\n\t\n\t'use strict';\n\t\n\tvar angularMeteorCamera = angular.module('angular-meteor.camera', ['angular-meteor.utils', 'angular-meteor.settings']);\n\t\n\t// requires package 'mdg:camera'\n\tangularMeteorCamera.service('$meteorCamera', ['$q', '$meteorUtils', '$angularMeteorSettings', function ($q, $meteorUtils, $angularMeteorSettings) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.camera] Please note that this module has moved to a separate package and is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/camera. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t var pack = Package['mdg:camera'];\n\t if (!pack) return;\n\t\n\t var MeteorCamera = pack.MeteorCamera;\n\t\n\t this.getPicture = function (options) {\n\t if (!$angularMeteorSettings.suppressWarnings) console.warn('[angular-meteor.camera] Please note that this module has moved to a separate package and is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/camera. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\t\n\t options = options || {};\n\t var deferred = $q.defer();\n\t MeteorCamera.getPicture(options, $meteorUtils.fulfill(deferred));\n\t return deferred.promise;\n\t };\n\t}]);\n\n/***/ },\n/* 13 */\n/***/ function(module, exports) {\n\n\t/*global\n\t angular\n\t */\n\t\n\t'use strict';\n\t\n\tvar angularMeteorStopper = angular.module('angular-meteor.stopper', ['angular-meteor.subscribe']);\n\t\n\tangularMeteorStopper.factory('$meteorStopper', ['$q', '$meteorSubscribe', function ($q, $meteorSubscribe) {\n\t function $meteorStopper($meteorEntity) {\n\t return function () {\n\t var args = Array.prototype.slice.call(arguments);\n\t var meteorEntity = $meteorEntity.apply(this, args);\n\t\n\t angular.extend(meteorEntity, $meteorStopper);\n\t meteorEntity.$$scope = this;\n\t\n\t this.$on('$destroy', function () {\n\t meteorEntity.stop();\n\t if (meteorEntity.subscription) meteorEntity.subscription.stop();\n\t });\n\t\n\t return meteorEntity;\n\t };\n\t }\n\t\n\t $meteorStopper.subscribe = function () {\n\t var args = Array.prototype.slice.call(arguments);\n\t this.subscription = $meteorSubscribe._subscribe(this.$$scope, $q.defer(), args);\n\t return this;\n\t };\n\t\n\t return $meteorStopper;\n\t}]);\n\n/***/ },\n/* 14 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\tvar name = exports.name = 'angular-meteor.utilities';\n\tvar utils = exports.utils = '$$utils';\n\t\n\tangular.module(name, [])\n\t\n\t/*\n\t A utility service which is provided with general utility functions\n\t */\n\t.service(utils, ['$rootScope', function ($rootScope) {\n\t var self = this;\n\t\n\t // Checks if an object is a cursor\n\t this.isCursor = function (obj) {\n\t return obj instanceof Meteor.Collection.Cursor;\n\t };\n\t\n\t // Cheecks if an object is a scope\n\t this.isScope = function (obj) {\n\t return obj instanceof $rootScope.constructor;\n\t };\n\t\n\t // Checks if two objects are siblings\n\t this.areSiblings = function (obj1, obj2) {\n\t return _.isObject(obj1) && _.isObject(obj2) && Object.getPrototypeOf(obj1) === Object.getPrototypeOf(obj2);\n\t };\n\t\n\t // Binds function into a scpecified context. If an object is provided, will bind every\n\t // value in the object which is a function. If a tap function is provided, it will be\n\t // called right after the function has been invoked.\n\t this.bind = function (fn, context, tap) {\n\t tap = _.isFunction(tap) ? tap : angular.noop;\n\t if (_.isFunction(fn)) return bindFn(fn, context, tap);\n\t if (_.isObject(fn)) return bindObj(fn, context, tap);\n\t return fn;\n\t };\n\t\n\t function bindFn(fn, context, tap) {\n\t return function () {\n\t for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n\t args[_key] = arguments[_key];\n\t }\n\t\n\t var result = fn.apply(context, args);\n\t tap.call(context, {\n\t result: result,\n\t args: args\n\t });\n\t return result;\n\t };\n\t }\n\t\n\t function bindObj(obj, context, tap) {\n\t return _.keys(obj).reduce(function (bound, k) {\n\t bound[k] = self.bind(obj[k], context, tap);\n\t return bound;\n\t }, {});\n\t }\n\t}]);\n\n/***/ },\n/* 15 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\t\n\tvar name = exports.name = 'angular-meteor.mixer';\n\tvar Mixer = exports.Mixer = '$Mixer';\n\t\n\tangular.module(name, [])\n\t\n\t/*\n\t A service which lets us apply mixins into Scope.prototype.\n\t The flow is simple. Once we define a mixin, it will be stored in the `$Mixer`,\n\t and any time a `ChildScope` prototype is created\n\t it will be extended by the `$Mixer`.\n\t This concept is good because it keeps our code\n\t clean and simple, and easy to extend.\n\t So any time we would like to define a new behaviour to our scope,\n\t we will just use the `$Mixer` service.\n\t */\n\t.service(Mixer, function () {\n\t var _this = this;\n\t\n\t this._mixins = [];\n\t // Apply mixins automatically on specified contexts\n\t this._autoExtend = [];\n\t this._autoConstruct = [];\n\t\n\t // Adds a new mixin\n\t this.mixin = function (mixin) {\n\t if (!_.isObject(mixin)) {\n\t throw Error('argument 1 must be an object');\n\t }\n\t\n\t _this._mixins = _.union(_this._mixins, [mixin]);\n\t // Apply mixins to stored contexts\n\t _this._autoExtend.forEach(function (context) {\n\t return _this._extend(context);\n\t });\n\t _this._autoConstruct.forEach(function (context) {\n\t return _this._construct(context);\n\t });\n\t return _this;\n\t };\n\t\n\t // Removes a mixin. Useful mainly for test purposes\n\t this._mixout = function (mixin) {\n\t _this._mixins = _.without(_this._mixins, mixin);\n\t return _this;\n\t };\n\t\n\t // Invoke function mixins with the provided context and arguments\n\t this._construct = function (context) {\n\t for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n\t args[_key - 1] = arguments[_key];\n\t }\n\t\n\t _this._mixins.filter(_.isFunction).forEach(function (mixin) {\n\t mixin.call.apply(mixin, [context].concat(args));\n\t });\n\t\n\t return context;\n\t };\n\t\n\t // Extend prototype with the defined mixins\n\t this._extend = function (obj) {\n\t var _ref;\n\t\n\t return (_ref = _).extend.apply(_ref, [obj].concat(_toConsumableArray(_this._mixins)));\n\t };\n\t});\n\n/***/ },\n/* 16 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.name = undefined;\n\t\n\tvar _mixer = __webpack_require__(15);\n\t\n\tvar name = exports.name = 'angular-meteor.scope';\n\t\n\tangular.module(name, [_mixer.name]).run(['$rootScope', _mixer.Mixer, function ($rootScope, $Mixer) {\n\t var Scope = $rootScope.constructor;\n\t var $new = $rootScope.$new;\n\t\n\t // Apply extensions whether a mixin in defined.\n\t // Note that this way mixins which are initialized later\n\t // can be applied on rootScope.\n\t $Mixer._autoExtend.push(Scope.prototype);\n\t $Mixer._autoConstruct.push($rootScope);\n\t\n\t Scope.prototype.$new = function () {\n\t var scope = $new.apply(this, arguments);\n\t // Apply constructors to newly created scopes\n\t return $Mixer._construct(scope);\n\t };\n\t}]);\n\n/***/ },\n/* 17 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.Core = exports.name = undefined;\n\t\n\tvar _utils = __webpack_require__(14);\n\t\n\tvar _mixer = __webpack_require__(15);\n\t\n\tfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\t\n\tvar name = exports.name = 'angular-meteor.core';\n\tvar Core = exports.Core = '$$Core';\n\t\n\tangular.module(name, [_utils.name, _mixer.name])\n\t\n\t/*\n\t A mixin which provides us with core Meteor functions.\n\t */\n\t.factory(Core, ['$q', _utils.utils, function ($q, $$utils) {\n\t function $$Core() {}\n\t\n\t // Calls Meteor.autorun() which will be digested after each run and automatically destroyed\n\t $$Core.autorun = function (fn) {\n\t var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\t\n\t fn = this.$bindToContext(fn);\n\t\n\t if (!_.isFunction(fn)) {\n\t throw Error('argument 1 must be a function');\n\t }\n\t if (!_.isObject(options)) {\n\t throw Error('argument 2 must be an object');\n\t }\n\t\n\t var computation = Tracker.autorun(fn, options);\n\t this.$$autoStop(computation);\n\t return computation;\n\t };\n\t\n\t // Calls Meteor.subscribe() which will be digested after each invokation\n\t // and automatically destroyed\n\t $$Core.subscribe = function (subName, fn, cb) {\n\t fn = this.$bindToContext(fn || angular.noop);\n\t cb = cb ? this.$bindToContext(cb) : angular.noop;\n\t\n\t if (!_.isString(subName)) {\n\t throw Error('argument 1 must be a string');\n\t }\n\t if (!_.isFunction(fn)) {\n\t throw Error('argument 2 must be a function');\n\t }\n\t if (!_.isFunction(cb) && !_.isObject(cb)) {\n\t throw Error('argument 3 must be a function or an object');\n\t }\n\t\n\t var result = {};\n\t\n\t var computation = this.autorun(function () {\n\t var _Meteor;\n\t\n\t var args = fn();\n\t if (angular.isUndefined(args)) args = [];\n\t\n\t if (!_.isArray(args)) {\n\t throw Error('reactive function\\'s return value must be an array');\n\t }\n\t\n\t var subscription = (_Meteor = Meteor).subscribe.apply(_Meteor, [subName].concat(_toConsumableArray(args), [cb]));\n\t result.ready = subscription.ready.bind(subscription);\n\t result.subscriptionId = subscription.subscriptionId;\n\t });\n\t\n\t // Once the computation has been stopped,\n\t // any subscriptions made inside will be stopped as well\n\t result.stop = computation.stop.bind(computation);\n\t return result;\n\t };\n\t\n\t // Calls Meteor.call() wrapped by a digestion cycle\n\t $$Core.callMethod = function () {\n\t var _Meteor2;\n\t\n\t for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n\t args[_key] = arguments[_key];\n\t }\n\t\n\t var fn = args.pop();\n\t if (_.isFunction(fn)) fn = this.$bindToContext(fn);\n\t return (_Meteor2 = Meteor).call.apply(_Meteor2, args.concat([fn]));\n\t };\n\t\n\t // Calls Meteor.apply() wrapped by a digestion cycle\n\t $$Core.applyMethod = function () {\n\t var _Meteor3;\n\t\n\t for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n\t args[_key2] = arguments[_key2];\n\t }\n\t\n\t var fn = args.pop();\n\t if (_.isFunction(fn)) fn = this.$bindToContext(fn);\n\t return (_Meteor3 = Meteor).apply.apply(_Meteor3, args.concat([fn]));\n\t };\n\t\n\t $$Core.$$autoStop = function (stoppable) {\n\t this.$on('$destroy', stoppable.stop.bind(stoppable));\n\t };\n\t\n\t // Digests scope only if there is no phase at the moment\n\t $$Core.$$throttledDigest = function () {\n\t var isDigestable = !this.$$destroyed && !this.$$phase && !this.$root.$$phase;\n\t\n\t if (isDigestable) this.$digest();\n\t };\n\t\n\t // Creates a promise only that the digestion cycle will be called at its fulfillment\n\t $$Core.$$defer = function () {\n\t var deferred = $q.defer();\n\t // Once promise has been fulfilled, digest\n\t deferred.promise = deferred.promise.finally(this.$$throttledDigest.bind(this));\n\t return deferred;\n\t };\n\t\n\t // Binds an object or a function to the scope to the view model and digest it once it is invoked\n\t $$Core.$bindToContext = function (fn) {\n\t return $$utils.bind(fn, this, this.$$throttledDigest.bind(this));\n\t };\n\t\n\t return $$Core;\n\t}]);\n\n/***/ },\n/* 18 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.reactive = exports.ViewModel = exports.name = undefined;\n\t\n\tvar _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; }; }();\n\t\n\tvar _utils = __webpack_require__(14);\n\t\n\tvar _mixer = __webpack_require__(15);\n\t\n\tvar _core = __webpack_require__(17);\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tvar name = exports.name = 'angular-meteor.view-model';\n\tvar ViewModel = exports.ViewModel = '$$ViewModel';\n\tvar reactive = exports.reactive = '$reactive';\n\t\n\tangular.module(name, [_utils.name, _mixer.name, _core.name])\n\t\n\t/*\n\t A mixin which lets us bind a view model into a scope.\n\t Note that only a single view model can be bound,\n\t otherwise the scope might behave unexpectedly.\n\t Mainly used to define the controller as the view model,\n\t and very useful when wanting to use Angular's `controllerAs` syntax.\n\t */\n\t.factory(ViewModel, [_utils.utils, _mixer.Mixer, function ($$utils, $Mixer) {\n\t function $$ViewModel() {\n\t var vm = arguments.length <= 0 || arguments[0] === undefined ? this : arguments[0];\n\t\n\t // Defines the view model on the scope.\n\t this.$$vm = vm;\n\t }\n\t\n\t // Gets an object, wraps it with scope functions and returns it\n\t $$ViewModel.viewModel = function (vm) {\n\t var _this = this;\n\t\n\t if (!_.isObject(vm)) {\n\t throw Error('argument 1 must be an object');\n\t }\n\t\n\t // Apply mixin functions\n\t $Mixer._mixins.forEach(function (mixin) {\n\t // Reject methods which starts with double $\n\t var keys = _.keys(mixin).filter(function (k) {\n\t return k.match(/^(?!\\$\\$).*$/);\n\t });\n\t var proto = _.pick(mixin, keys);\n\t // Bind all the methods to the prototype\n\t var boundProto = $$utils.bind(proto, _this);\n\t // Add the methods to the view model\n\t _.extend(vm, boundProto);\n\t });\n\t\n\t // Apply mixin constructors on the view model\n\t $Mixer._construct(this, vm);\n\t return vm;\n\t };\n\t\n\t // Override $$Core.$bindToContext to be bound to view model instead of scope\n\t $$ViewModel.$bindToContext = function (fn) {\n\t return $$utils.bind(fn, this.$$vm, this.$$throttledDigest.bind(this));\n\t };\n\t\n\t return $$ViewModel;\n\t}])\n\t\n\t/*\n\t Illustrates the old API where a view model is created using $reactive service\n\t */\n\t.service(reactive, [_utils.utils, function ($$utils) {\n\t var Reactive = function () {\n\t function Reactive(vm) {\n\t var _this2 = this;\n\t\n\t _classCallCheck(this, Reactive);\n\t\n\t if (!_.isObject(vm)) {\n\t throw Error('argument 1 must be an object');\n\t }\n\t\n\t _.defer(function () {\n\t if (!_this2._attached) {\n\t console.warn('view model was not attached to any scope');\n\t }\n\t });\n\t\n\t this._vm = vm;\n\t }\n\t\n\t _createClass(Reactive, [{\n\t key: 'attach',\n\t value: function attach(scope) {\n\t this._attached = true;\n\t\n\t if (!$$utils.isScope(scope)) {\n\t throw Error('argument 1 must be a scope');\n\t }\n\t\n\t var viewModel = scope.viewModel(this._vm);\n\t\n\t // Similar to the old/Meteor API\n\t viewModel.call = viewModel.callMethod;\n\t viewModel.apply = viewModel.applyMethod;\n\t\n\t return viewModel;\n\t }\n\t }]);\n\t\n\t return Reactive;\n\t }();\n\t\n\t return function (vm) {\n\t return new Reactive(vm);\n\t };\n\t}]);\n\n/***/ },\n/* 19 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.Reactive = exports.name = undefined;\n\t\n\tvar _utils = __webpack_require__(14);\n\t\n\tvar _mixer = __webpack_require__(15);\n\t\n\tvar _core = __webpack_require__(17);\n\t\n\tvar _viewModel = __webpack_require__(18);\n\t\n\tvar name = exports.name = 'angular-meteor.reactive';\n\tvar Reactive = exports.Reactive = '$$Reactive';\n\t\n\tangular.module(name, [_utils.name, _mixer.name, _core.name, _viewModel.name])\n\t\n\t/*\n\t A mixin which enhance our reactive abilities by providing methods\n\t that are capable of updating our scope reactively.\n\t */\n\t.factory(Reactive, ['$parse', _utils.utils, function ($parse, $$utils) {\n\t function $$Reactive() {\n\t var vm = arguments.length <= 0 || arguments[0] === undefined ? this : arguments[0];\n\t\n\t // Helps us track changes made in the view model\n\t vm.$$dependencies = {};\n\t }\n\t\n\t // Gets an object containing functions and define their results as reactive properties.\n\t // Once a return value has been changed the property will be reset.\n\t $$Reactive.helpers = function () {\n\t var _this = this;\n\t\n\t var props = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t if (!_.isObject(props)) {\n\t throw Error('argument 1 must be an object');\n\t }\n\t\n\t _.each(props, function (v, k, i) {\n\t if (!_.isFunction(v)) {\n\t throw Error('helper ' + (i + 1) + ' must be a function');\n\t }\n\t\n\t if (!_this.$$vm.$$dependencies[k]) {\n\t // Registers a new dependency to the specified helper\n\t _this.$$vm.$$dependencies[k] = new Tracker.Dependency();\n\t }\n\t\n\t _this.$$setFnHelper(k, v);\n\t });\n\t };\n\t\n\t // Gets a model reactively\n\t $$Reactive.getReactively = function (k) {\n\t var isDeep = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];\n\t\n\t if (!_.isBoolean(isDeep)) {\n\t throw Error('argument 2 must be a boolean');\n\t }\n\t\n\t return this.$$reactivateEntity(k, this.$watch, isDeep);\n\t };\n\t\n\t // Gets a collection reactively\n\t $$Reactive.getCollectionReactively = function (k) {\n\t return this.$$reactivateEntity(k, this.$watchCollection);\n\t };\n\t\n\t // Gets an entity reactively, and once it has been changed the computation will be recomputed\n\t $$Reactive.$$reactivateEntity = function (k, watcher) {\n\t if (!_.isString(k)) {\n\t throw Error('argument 1 must be a string');\n\t }\n\t\n\t if (!this.$$vm.$$dependencies[k]) {\n\t this.$$vm.$$dependencies[k] = new Tracker.Dependency();\n\t\n\t for (var _len = arguments.length, watcherArgs = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n\t watcherArgs[_key - 2] = arguments[_key];\n\t }\n\t\n\t this.$$watchEntity.apply(this, [k, watcher].concat(watcherArgs));\n\t }\n\t\n\t this.$$vm.$$dependencies[k].depend();\n\t return $parse(k)(this.$$vm);\n\t };\n\t\n\t // Watches for changes in the view model, and if so will notify a change\n\t $$Reactive.$$watchEntity = function (k, watcher) {\n\t var _this2 = this;\n\t\n\t // Gets a deep property from the view model\n\t var getVal = _.partial($parse(k), this.$$vm);\n\t var initialVal = getVal();\n\t\n\t // Watches for changes in the view model\n\t\n\t for (var _len2 = arguments.length, watcherArgs = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {\n\t watcherArgs[_key2 - 2] = arguments[_key2];\n\t }\n\t\n\t watcher.call.apply(watcher, [this, getVal, function (val, oldVal) {\n\t var hasChanged = val !== initialVal || val !== oldVal;\n\t\n\t // Notify if a change has been detected\n\t if (hasChanged) _this2.$$changed(k);\n\t }].concat(watcherArgs));\n\t };\n\t\n\t // Invokes a function and sets the return value as a property\n\t $$Reactive.$$setFnHelper = function (k, fn) {\n\t var _this3 = this;\n\t\n\t this.autorun(function (computation) {\n\t // Invokes the reactive functon\n\t var model = fn.apply(_this3.$$vm);\n\t\n\t // Ignore notifications made by the following handler\n\t Tracker.nonreactive(function () {\n\t // If a cursor, observe its changes and update acoordingly\n\t if ($$utils.isCursor(model)) {\n\t (function () {\n\t var observation = _this3.$$handleCursor(k, model);\n\t\n\t computation.onInvalidate(function () {\n\t observation.stop();\n\t _this3.$$vm[k].splice(0);\n\t });\n\t })();\n\t } else {\n\t _this3.$$handleNonCursor(k, model);\n\t }\n\t\n\t // Notify change and update the view model\n\t _this3.$$changed(k);\n\t });\n\t });\n\t };\n\t\n\t // Sets a value helper as a setter and a getter which will notify computations once used\n\t $$Reactive.$$setValHelper = function (k, v) {\n\t var _this4 = this;\n\t\n\t var watch = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2];\n\t\n\t // If set, reactives property\n\t if (watch) {\n\t var isDeep = _.isObject(v);\n\t this.getReactively(k, isDeep);\n\t }\n\t\n\t Object.defineProperty(this.$$vm, k, {\n\t configurable: true,\n\t enumerable: true,\n\t\n\t get: function get() {\n\t return v;\n\t },\n\t set: function set(newVal) {\n\t v = newVal;\n\t _this4.$$changed(k);\n\t }\n\t });\n\t };\n\t\n\t // Fetching a cursor and updates properties once the result set has been changed\n\t $$Reactive.$$handleCursor = function (k, cursor) {\n\t var _this5 = this;\n\t\n\t // If not defined set it\n\t if (angular.isUndefined(this.$$vm[k])) {\n\t this.$$setValHelper(k, cursor.fetch(), false);\n\t }\n\t // If defined update it\n\t else {\n\t var diff = jsondiffpatch.diff(this.$$vm[k], cursor.fetch());\n\t jsondiffpatch.patch(this.$$vm[k], diff);\n\t }\n\t\n\t // Observe changes made in the result set\n\t var observation = cursor.observe({\n\t addedAt: function addedAt(doc, atIndex) {\n\t if (!observation) return;\n\t _this5.$$vm[k].splice(atIndex, 0, doc);\n\t _this5.$$changed(k);\n\t },\n\t changedAt: function changedAt(doc, oldDoc, atIndex) {\n\t var diff = jsondiffpatch.diff(_this5.$$vm[k][atIndex], doc);\n\t jsondiffpatch.patch(_this5.$$vm[k][atIndex], diff);\n\t _this5.$$changed(k);\n\t },\n\t movedTo: function movedTo(doc, fromIndex, toIndex) {\n\t _this5.$$vm[k].splice(fromIndex, 1);\n\t _this5.$$vm[k].splice(toIndex, 0, doc);\n\t _this5.$$changed(k);\n\t },\n\t removedAt: function removedAt(oldDoc, atIndex) {\n\t _this5.$$vm[k].splice(atIndex, 1);\n\t _this5.$$changed(k);\n\t }\n\t });\n\t\n\t return observation;\n\t };\n\t\n\t $$Reactive.$$handleNonCursor = function (k, data) {\n\t var v = this.$$vm[k];\n\t\n\t if (angular.isDefined(v)) {\n\t delete this.$$vm[k];\n\t v = null;\n\t }\n\t\n\t if (angular.isUndefined(v)) {\n\t this.$$setValHelper(k, data);\n\t }\n\t // Update property if the new value is from the same type\n\t else if ($$utils.areSiblings(v, data)) {\n\t var diff = jsondiffpatch.diff(v, data);\n\t jsondiffpatch.patch(v, diff);\n\t this.$$changed(k);\n\t } else {\n\t this.$$vm[k] = data;\n\t }\n\t };\n\t\n\t // Notifies dependency in view model\n\t $$Reactive.$$depend = function (k) {\n\t this.$$vm.$$dependencies[k].depend();\n\t };\n\t\n\t // Notifies change in view model\n\t $$Reactive.$$changed = function (k) {\n\t this.$$throttledDigest();\n\t this.$$vm.$$dependencies[k].changed();\n\t };\n\t\n\t return $$Reactive;\n\t}]);\n\n/***/ },\n/* 20 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\tvar name = exports.name = 'angular-templates';\n\t\n\ttry {\n\t angular.module(name);\n\t} catch (e) {\n\t angular.module(name, []);\n\t}\n\n/***/ }\n/******/ ]);\n\n\n/** WEBPACK FOOTER **\n ** dist/angular-meteor.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 506237d669ed75851a9d\n **/","// lib\nimport './lib/get-updates';\nimport './lib/diff-array';\n// legacy\nimport './modules/angular-meteor-settings';\nimport './modules/angular-meteor-ironrouter';\nimport './modules/angular-meteor-utils';\nimport './modules/angular-meteor-subscribe';\nimport './modules/angular-meteor-collection';\nimport './modules/angular-meteor-object';\nimport './modules/angular-meteor-user';\nimport './modules/angular-meteor-methods';\nimport './modules/angular-meteor-session';\nimport './modules/angular-meteor-camera';\nimport './modules/angular-meteor-stopper';\n\n// new\nimport { name as utilsName } from './modules/utils';\nimport { name as mixerName, Mixer } from './modules/mixer';\nimport { name as scopeName } from './modules/scope';\nimport { name as coreName, Core } from './modules/core';\nimport { name as viewModelName, ViewModel } from './modules/view-model';\nimport { name as reactiveName, Reactive } from './modules/reactive';\nimport { name as templatesName } from './modules/templates';\n\nexport const name = 'angular-meteor';\n\nangular.module(name, [\n // new\n utilsName,\n mixerName,\n scopeName,\n coreName,\n viewModelName,\n reactiveName,\n templatesName,\n\n // legacy\n 'angular-meteor.ironrouter',\n 'angular-meteor.utils',\n 'angular-meteor.subscribe',\n 'angular-meteor.collection',\n 'angular-meteor.object',\n 'angular-meteor.user',\n 'angular-meteor.methods',\n 'angular-meteor.session',\n 'angular-meteor.camera'\n\n])\n\n.run([\n Mixer,\n Core,\n ViewModel,\n Reactive,\n\n function($Mixer, $$Core, $$ViewModel, $$Reactive) {\n // Load all mixins\n $Mixer\n .mixin($$Core)\n .mixin($$ViewModel)\n .mixin($$Reactive);\n }\n])\n\n// legacy\n// Putting all services under $meteor service for syntactic sugar\n.service('$meteor', [\n '$meteorCollection',\n '$meteorCollectionFS',\n '$meteorObject',\n '$meteorMethods',\n '$meteorSession',\n '$meteorSubscribe',\n '$meteorUtils',\n '$meteorCamera',\n '$meteorUser',\n function($meteorCollection, $meteorCollectionFS, $meteorObject,\n $meteorMethods, $meteorSession, $meteorSubscribe, $meteorUtils,\n $meteorCamera, $meteorUser) {\n this.collection = $meteorCollection;\n this.collectionFS = $meteorCollectionFS;\n this.object = $meteorObject;\n this.subscribe = $meteorSubscribe.subscribe;\n this.call = $meteorMethods.call;\n this.session = $meteorSession;\n this.autorun = $meteorUtils.autorun;\n this.getCollectionByName = $meteorUtils.getCollectionByName;\n this.getPicture = $meteorCamera.getPicture;\n\n // $meteorUser\n [\n 'loginWithPassword',\n 'requireUser',\n 'requireValidUser',\n 'waitForUser',\n 'createUser',\n 'changePassword',\n 'forgotPassword',\n 'resetPassword',\n 'verifyEmail',\n 'loginWithMeteorDeveloperAccount',\n 'loginWithFacebook',\n 'loginWithGithub',\n 'loginWithGoogle',\n 'loginWithMeetup',\n 'loginWithTwitter',\n 'loginWithWeibo',\n 'logout',\n 'logoutOtherClients'\n ].forEach((method) => {\n this[method] = $meteorUser[method];\n });\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/angular-meteor.js\n **/","/*global\n angular, _\n */\n\n'use strict';\n\n// https://github.com/DAB0mB/get-updates\n(function() {\n var module = angular.module('getUpdates', []);\n\n var utils = (function() {\n var rip = function(obj, level) {\n if (level < 1) return {};\n\n return _.reduce(obj, function(clone, v, k) {\n v = _.isObject(v) ? rip(v, --level) : v;\n clone[k] = v;\n return clone;\n }, {});\n };\n\n var toPaths = function(obj) {\n var keys = getKeyPaths(obj);\n var values = getDeepValues(obj);\n return _.object(keys, values);\n };\n\n var getKeyPaths = function(obj) {\n var keys = _.keys(obj).map(function(k) {\n var v = obj[k];\n if (!_.isObject(v) || _.isEmpty(v) || _.isArray(v)) return k;\n\n return getKeyPaths(v).map(function(subKey) {\n return k + '.' + subKey;\n });\n });\n\n return _.flatten(keys);\n };\n\n var getDeepValues = function(obj,arr) {\n arr = arr || [];\n\n _.values(obj).forEach(function(v) {\n if (!_.isObject(v) || _.isEmpty(v) || _.isArray(v))\n arr.push(v);\n else\n getDeepValues(v, arr);\n });\n\n return arr;\n };\n\n var flatten = function(arr) {\n return arr.reduce(function(flattened, v, i) {\n if (_.isArray(v) && !_.isEmpty(v))\n flattened.push.apply(flattened, flatten(v));\n else\n flattened.push(v);\n\n return flattened;\n }, []);\n };\n\n var setFilled = function(obj, k, v) {\n if (!_.isEmpty(v)) obj[k] = v;\n };\n\n var assert = function(result, msg) {\n if (!result) throwErr(msg);\n };\n\n var throwErr = function(msg) {\n throw Error('get-updates error - ' + msg);\n };\n\n return {\n rip: rip,\n toPaths: toPaths,\n getKeyPaths: getKeyPaths,\n getDeepValues: getDeepValues,\n setFilled: setFilled,\n assert: assert,\n throwErr: throwErr\n };\n })();\n\n var getDifference = (function() {\n var getDifference = function(src, dst, isShallow) {\n var level;\n\n if (isShallow > 1)\n level = isShallow;\n else if (isShallow)\n level = 1;\n\n if (level) {\n src = utils.rip(src, level);\n dst = utils.rip(dst, level);\n }\n\n return compare(src, dst);\n };\n\n var compare = function(src, dst) {\n var srcKeys = _.keys(src);\n var dstKeys = _.keys(dst);\n\n var keys = _.chain([])\n .concat(srcKeys)\n .concat(dstKeys)\n .uniq()\n .without('$$hashKey')\n .value();\n\n return keys.reduce(function(diff, k) {\n var srcValue = src[k];\n var dstValue = dst[k];\n\n if (_.isDate(srcValue) && _.isDate(dstValue)) {\n if (srcValue.getTime() != dstValue.getTime()) diff[k] = dstValue;\n }\n\n if (_.isObject(srcValue) && _.isObject(dstValue)) {\n var valueDiff = getDifference(srcValue, dstValue);\n utils.setFilled(diff, k, valueDiff);\n }\n\n else if (srcValue !== dstValue) {\n diff[k] = dstValue;\n }\n\n return diff;\n }, {});\n };\n\n return getDifference;\n })();\n\n var getUpdates = (function() {\n var getUpdates = function(src, dst, isShallow) {\n utils.assert(_.isObject(src), 'first argument must be an object');\n utils.assert(_.isObject(dst), 'second argument must be an object');\n\n var diff = getDifference(src, dst, isShallow);\n var paths = utils.toPaths(diff);\n\n var set = createSet(paths);\n var unset = createUnset(paths);\n var pull = createPull(unset);\n\n var updates = {};\n utils.setFilled(updates, '$set', set);\n utils.setFilled(updates, '$unset', unset);\n utils.setFilled(updates, '$pull', pull);\n\n return updates;\n };\n\n var createSet = function(paths) {\n var undefinedKeys = getUndefinedKeys(paths);\n return _.omit(paths, undefinedKeys);\n };\n\n var createUnset = function(paths) {\n var undefinedKeys = getUndefinedKeys(paths);\n var unset = _.pick(paths, undefinedKeys);\n\n return _.reduce(unset, function(result, v, k) {\n result[k] = true;\n return result;\n }, {});\n };\n\n var createPull = function(unset) {\n var arrKeyPaths = _.keys(unset).map(function(k) {\n var split = k.match(/(.*)\\.\\d+$/);\n return split && split[1];\n });\n\n return _.compact(arrKeyPaths).reduce(function(pull, k) {\n pull[k] = null;\n return pull;\n }, {});\n };\n\n var getUndefinedKeys = function(obj) {\n return _.keys(obj).filter(function (k) {\n var v = obj[k];\n return _.isUndefined(v);\n });\n };\n\n return getUpdates;\n })();\n\n module.value('getUpdates', getUpdates);\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/lib/get-updates.js\n **/","/*global\n angular, _, Package\n */\n\n'use strict';\n\nvar _module = angular.module('diffArray', ['getUpdates']);\n\n_module.factory('diffArray', ['getUpdates',\n function(getUpdates) {\n var LocalCollection = Package.minimongo.LocalCollection;\n var idStringify = LocalCollection._idStringify || Package['mongo-id'].MongoID.idStringify;\n var idParse = LocalCollection._idParse || Package['mongo-id'].MongoID.idParse;\n\n // Calculates the differences between `lastSeqArray` and\n // `seqArray` and calls appropriate functions from `callbacks`.\n // Reuses Minimongo's diff algorithm implementation.\n // XXX Should be replaced with the original diffArray function here:\n // https://github.com/meteor/meteor/blob/devel/packages/observe-sequence/observe_sequence.js#L152\n // When it will become nested as well, tracking here: https://github.com/meteor/meteor/issues/3764\n function diffArray(lastSeqArray, seqArray, callbacks, preventNestedDiff) {\n preventNestedDiff = !!preventNestedDiff;\n\n var diffFn = Package.minimongo.LocalCollection._diffQueryOrderedChanges ||\n Package['diff-sequence'].DiffSequence.diffQueryOrderedChanges;\n\n var oldObjIds = [];\n var newObjIds = [];\n var posOld = {}; // maps from idStringify'd ids\n var posNew = {}; // ditto\n var posCur = {};\n var lengthCur = lastSeqArray.length;\n\n _.each(seqArray, function (doc, i) {\n newObjIds.push({_id: doc._id});\n posNew[idStringify(doc._id)] = i;\n });\n\n _.each(lastSeqArray, function (doc, i) {\n oldObjIds.push({_id: doc._id});\n posOld[idStringify(doc._id)] = i;\n posCur[idStringify(doc._id)] = i;\n });\n\n // Arrays can contain arbitrary objects. We don't diff the\n // objects. Instead we always fire 'changedAt' callback on every\n // object. The consumer of `observe-sequence` should deal with\n // it appropriately.\n diffFn(oldObjIds, newObjIds, {\n addedBefore: function (id, doc, before) {\n var position = before ? posCur[idStringify(before)] : lengthCur;\n\n _.each(posCur, function (pos, id) {\n if (pos >= position) posCur[id]++;\n });\n\n lengthCur++;\n posCur[idStringify(id)] = position;\n\n callbacks.addedAt(\n id,\n seqArray[posNew[idStringify(id)]],\n position,\n before\n );\n },\n\n movedBefore: function (id, before) {\n var prevPosition = posCur[idStringify(id)];\n var position = before ? posCur[idStringify(before)] : lengthCur - 1;\n\n _.each(posCur, function (pos, id) {\n if (pos >= prevPosition && pos <= position)\n posCur[id]--;\n else if (pos <= prevPosition && pos >= position)\n posCur[id]++;\n });\n\n posCur[idStringify(id)] = position;\n\n callbacks.movedTo(\n id,\n seqArray[posNew[idStringify(id)]],\n prevPosition,\n position,\n before\n );\n },\n removed: function (id) {\n var prevPosition = posCur[idStringify(id)];\n\n _.each(posCur, function (pos, id) {\n if (pos >= prevPosition) posCur[id]--;\n });\n\n delete posCur[idStringify(id)];\n lengthCur--;\n\n callbacks.removedAt(\n id,\n lastSeqArray[posOld[idStringify(id)]],\n prevPosition\n );\n }\n });\n\n _.each(posNew, function (pos, idString) {\n if (!_.has(posOld, idString)) return;\n\n var id = idParse(idString);\n var newItem = seqArray[pos] || {};\n var oldItem = lastSeqArray[posOld[idString]];\n var updates = getUpdates(oldItem, newItem, preventNestedDiff);\n\n if (!_.isEmpty(updates))\n callbacks.changedAt(id, updates, pos, oldItem);\n });\n }\n\n diffArray.shallow = function(lastSeqArray, seqArray, callbacks) {\n return diffArray(lastSeqArray, seqArray, callbacks, true);\n };\n\n diffArray.deepCopyChanges = function (oldItem, newItem) {\n var setDiff = getUpdates(oldItem, newItem).$set;\n\n _.each(setDiff, function(v, deepKey) {\n setDeep(oldItem, deepKey, v);\n });\n };\n\n diffArray.deepCopyRemovals = function (oldItem, newItem) {\n var unsetDiff = getUpdates(oldItem, newItem).$unset;\n\n _.each(unsetDiff, function(v, deepKey) {\n unsetDeep(oldItem, deepKey);\n });\n };\n\n // Finds changes between two collections\n diffArray.getChanges = function(newCollection, oldCollection, diffMethod) {\n var changes = {added: [], removed: [], changed: []};\n\n diffMethod(oldCollection, newCollection, {\n addedAt: function(id, item, index) {\n changes.added.push({item: item, index: index});\n },\n\n removedAt: function(id, item, index) {\n changes.removed.push({item: item, index: index});\n },\n\n changedAt: function(id, updates, index, oldItem) {\n changes.changed.push({selector: id, modifier: updates});\n },\n\n movedTo: function(id, item, fromIndex, toIndex) {\n // XXX do we need this?\n }\n });\n\n return changes;\n };\n\n var setDeep = function(obj, deepKey, v) {\n var split = deepKey.split('.');\n var initialKeys = _.initial(split);\n var lastKey = _.last(split);\n\n initialKeys.reduce(function(subObj, k, i) {\n var nextKey = split[i + 1];\n\n if (isNumStr(nextKey)) {\n if (subObj[k] === null) subObj[k] = [];\n if (subObj[k].length == parseInt(nextKey)) subObj[k].push(null);\n }\n\n else if (subObj[k] === null || !isHash(subObj[k])) {\n subObj[k] = {};\n }\n\n return subObj[k];\n }, obj);\n\n var deepObj = getDeep(obj, initialKeys);\n deepObj[lastKey] = v;\n return v;\n };\n\n var unsetDeep = function(obj, deepKey) {\n var split = deepKey.split('.');\n var initialKeys = _.initial(split);\n var lastKey = _.last(split);\n var deepObj = getDeep(obj, initialKeys);\n\n if (_.isArray(deepObj) && isNumStr(lastKey))\n return !!deepObj.splice(lastKey, 1);\n else\n return delete deepObj[lastKey];\n };\n\n var getDeep = function(obj, keys) {\n return keys.reduce(function(subObj, k) {\n return subObj[k];\n }, obj);\n };\n\n var isHash = function(obj) {\n return _.isObject(obj) &&\n Object.getPrototypeOf(obj) === Object.prototype;\n };\n\n var isNumStr = function(str) {\n return str.match(/^\\d+$/);\n };\n\n return diffArray;\n}]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/lib/diff-array.js\n **/","angular.module('angular-meteor.settings', [])\n .constant('$angularMeteorSettings', {\n suppressWarnings: false\n });\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-settings.js\n **/","angular.module('angular-meteor.ironrouter', [])\n\n\n.run([\n '$compile',\n '$document',\n '$rootScope',\n\nfunction ($compile, $document, $rootScope) {\n const Router = (Package['iron:router'] || {}).Router;\n if (!Router) return;\n\n let isLoaded = false;\n\n // Recompile after iron:router builds page\n Router.onAfterAction((req, res, next) => {\n Tracker.afterFlush(() => {\n if (isLoaded) return;\n $compile($document)($rootScope);\n if (!$rootScope.$$phase) $rootScope.$apply();\n isLoaded = true;\n });\n });\n}]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-ironrouter.js\n **/","/*global\n angular, _, Tracker, EJSON, FS, Mongo\n */\n\n'use strict';\n\nvar angularMeteorUtils = angular.module('angular-meteor.utils', ['angular-meteor.settings']);\n\nangularMeteorUtils.service('$meteorUtils', [\n '$q', '$timeout', '$angularMeteorSettings',\n function ($q, $timeout, $angularMeteorSettings) {\n\n var self = this;\n\n this.autorun = function(scope, fn) {\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.utils.autorun] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.6/autorun. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n\n // wrapping around Deps.autorun\n var comp = Tracker.autorun(function(c) {\n fn(c);\n // this is run immediately for the first call\n // but after that, we need to $apply to start Angular digest\n if (!c.firstRun) $timeout(angular.noop, 0);\n });\n\n // stop autorun when scope is destroyed\n scope.$on('$destroy', function() {\n comp.stop();\n });\n\n // return autorun object so that it can be stopped manually\n return comp;\n };\n\n // Borrowed from angularFire\n // https://github.com/firebase/angularfire/blob/master/src/utils.js#L445-L454\n this.stripDollarPrefixedKeys = function (data) {\n if (!_.isObject(data) ||\n data instanceof Date ||\n data instanceof File ||\n EJSON.toJSONValue(data).$type === 'oid' ||\n (typeof FS === 'object' && data instanceof FS.File))\n return data;\n\n var out = _.isArray(data) ? [] : {};\n\n _.each(data, function(v,k) {\n if(typeof k !== 'string' || k.charAt(0) !== '$')\n out[k] = self.stripDollarPrefixedKeys(v);\n });\n\n return out;\n };\n\n // Returns a callback which fulfills promise\n this.fulfill = function(deferred, boundError, boundResult) {\n return function(err, result) {\n if (err)\n deferred.reject(boundError == null ? err : boundError);\n else if (typeof boundResult == \"function\")\n deferred.resolve(boundResult == null ? result : boundResult(result));\n else\n deferred.resolve(boundResult == null ? result : boundResult);\n };\n };\n\n // creates a function which invokes method with the given arguments and returns a promise\n this.promissor = function(obj, method) {\n return function() {\n var deferred = $q.defer();\n var fulfill = self.fulfill(deferred);\n var args = _.toArray(arguments).concat(fulfill);\n obj[method].apply(obj, args);\n return deferred.promise;\n };\n };\n\n // creates a $q.all() promise and call digestion loop on fulfillment\n this.promiseAll = function(promises) {\n var allPromise = $q.all(promises);\n\n allPromise.finally(function() {\n // calls digestion loop with no conflicts\n $timeout(angular.noop);\n });\n\n return allPromise;\n };\n\n this.getCollectionByName = function(string){\n return Mongo.Collection.get(string);\n };\n\n this.findIndexById = function(collection, doc) {\n var foundDoc = _.find(collection, function(colDoc) {\n // EJSON.equals used to compare Mongo.ObjectIDs and Strings.\n return EJSON.equals(colDoc._id, doc._id);\n });\n\n return _.indexOf(collection, foundDoc);\n };\n }\n]);\n\nangularMeteorUtils.run([\n '$rootScope', '$meteorUtils',\n function($rootScope, $meteorUtils) {\n Object.getPrototypeOf($rootScope).$meteorAutorun = function(fn) {\n return $meteorUtils.autorun(this, fn);\n };\n}]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-utils.js\n **/","/*global\n angular, Meteor\n */\n\n'use strict';\nvar angularMeteorSubscribe = angular.module('angular-meteor.subscribe', ['angular-meteor.settings']);\n\nangularMeteorSubscribe.service('$meteorSubscribe', ['$q', '$angularMeteorSettings',\n function ($q, $angularMeteorSettings) {\n\n var self = this;\n\n this._subscribe = function(scope, deferred, args) {\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.subscribe] Please note that this module is deprecated since 1.3.0 and will be removed in 1.4.0! Replace it with the new syntax described here: http://www.angular-meteor.com/api/1.3.6/subscribe. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n var subscription = null;\n var lastArg = args[args.length - 1];\n\n // User supplied onStop callback\n // save it for later use and remove\n // from subscription arguments\n if (angular.isObject(lastArg) &&\n angular.isFunction(lastArg.onStop)) {\n var onStop = lastArg.onStop;\n\n args.pop();\n }\n\n args.push({\n onReady: function() {\n deferred.resolve(subscription);\n },\n onStop: function(err) {\n if (!deferred.promise.$$state.status) {\n if (err)\n deferred.reject(err);\n else\n deferred.reject(new Meteor.Error(\"Subscription Stopped\",\n \"Subscription stopped by a call to stop method. Either by the client or by the server.\"));\n } else if (onStop)\n // After promise was resolved or rejected\n // call user supplied onStop callback.\n onStop.apply(this, Array.prototype.slice.call(arguments));\n\n }\n });\n\n subscription = Meteor.subscribe.apply(scope, args);\n\n return subscription;\n };\n\n this.subscribe = function(){\n var deferred = $q.defer();\n var args = Array.prototype.slice.call(arguments);\n var subscription = null;\n\n self._subscribe(this, deferred, args);\n\n return deferred.promise;\n };\n }]);\n\nangularMeteorSubscribe.run(['$rootScope', '$q', '$meteorSubscribe',\n function($rootScope, $q, $meteorSubscribe) {\n Object.getPrototypeOf($rootScope).$meteorSubscribe = function() {\n var deferred = $q.defer();\n var args = Array.prototype.slice.call(arguments);\n\n var subscription = $meteorSubscribe._subscribe(this, deferred, args);\n\n this.$on('$destroy', function() {\n subscription.stop();\n });\n\n return deferred.promise;\n };\n}]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-subscribe.js\n **/","/*global\n angular, _, Tracker, check, Match, Mongo\n */\n\n'use strict';\n\nvar angularMeteorCollection = angular.module('angular-meteor.collection',\n ['angular-meteor.stopper', 'angular-meteor.subscribe', 'angular-meteor.utils', 'diffArray', 'angular-meteor.settings']);\n\n// The reason angular meteor collection is a factory function and not something\n// that inherit from array comes from here:\n// http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/\n// We went with the direct extensions approach.\nangularMeteorCollection.factory('AngularMeteorCollection', [\n '$q', '$meteorSubscribe', '$meteorUtils', '$rootScope', '$timeout', 'diffArray', '$angularMeteorSettings',\n function($q, $meteorSubscribe, $meteorUtils, $rootScope, $timeout, diffArray, $angularMeteorSettings) {\n\n function AngularMeteorCollection(curDefFunc, collection, diffArrayFunc, autoClientSave) {\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.$meteorCollection] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/meteorCollection. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n var data = [];\n // Server backup data to evaluate what changes come from client\n // after each server update.\n data._serverBackup = [];\n // Array differ function.\n data._diffArrayFunc = diffArrayFunc;\n // Handler of the cursor observer.\n data._hObserve = null;\n // On new cursor autorun handler\n // (autorun for reactive variables).\n data._hNewCurAutorun = null;\n // On new data autorun handler\n // (autorun for cursor.fetch).\n data._hDataAutorun = null;\n\n if (angular.isDefined(collection)) {\n data.$$collection = collection;\n } else {\n var cursor = curDefFunc();\n data.$$collection = $meteorUtils.getCollectionByName(cursor.collection.name);\n }\n\n _.extend(data, AngularMeteorCollection);\n data._startCurAutorun(curDefFunc, autoClientSave);\n\n return data;\n }\n\n AngularMeteorCollection._startCurAutorun = function(curDefFunc, autoClientSave) {\n var self = this;\n\n self._hNewCurAutorun = Tracker.autorun(function() {\n // When the reactive func gets recomputated we need to stop any previous\n // observeChanges.\n Tracker.onInvalidate(function() {\n self._stopCursor();\n });\n\n if (autoClientSave) self._setAutoClientSave();\n self._updateCursor(curDefFunc(), autoClientSave);\n });\n };\n\n AngularMeteorCollection.subscribe = function() {\n $meteorSubscribe.subscribe.apply(this, arguments);\n return this;\n };\n\n AngularMeteorCollection.save = function(docs, useUnsetModifier) {\n // save whole collection\n if (!docs) docs = this;\n // save single doc\n docs = [].concat(docs);\n\n var promises = docs.map(function(doc) {\n return this._upsertDoc(doc, useUnsetModifier);\n }, this);\n\n return $meteorUtils.promiseAll(promises);\n };\n\n AngularMeteorCollection._upsertDoc = function(doc, useUnsetModifier) {\n var deferred = $q.defer();\n var collection = this.$$collection;\n var createFulfill = _.partial($meteorUtils.fulfill, deferred, null);\n\n // delete $$hashkey\n doc = $meteorUtils.stripDollarPrefixedKeys(doc);\n var docId = doc._id;\n var isExist = collection.findOne(docId);\n\n // update\n if (isExist) {\n // Deletes _id property (from the copy) so that\n // it can be $set using update.\n delete doc._id;\n var modifier = useUnsetModifier ? {$unset: doc} : {$set: doc};\n // NOTE: do not use #upsert() method, since it does not exist in some collections\n collection.update(docId, modifier, createFulfill(function() {\n return {_id: docId, action: 'updated'};\n }));\n }\n // insert\n else {\n collection.insert(doc, createFulfill(function(id) {\n return {_id: id, action: 'inserted'};\n }));\n }\n\n return deferred.promise;\n };\n\n // performs $pull operations parallely.\n // used for handling splice operations returned from getUpdates() to prevent conflicts.\n // see issue: https://github.com/Urigo/angular-meteor/issues/793\n AngularMeteorCollection._updateDiff = function(selector, update, callback) {\n callback = callback || angular.noop;\n var setters = _.omit(update, '$pull');\n var updates = [setters];\n\n _.each(update.$pull, function(pull, prop) {\n var puller = {};\n puller[prop] = pull;\n updates.push({ $pull: puller });\n });\n\n this._updateParallel(selector, updates, callback);\n };\n\n // performs each update operation parallely\n AngularMeteorCollection._updateParallel = function(selector, updates, callback) {\n var self = this;\n var done = _.after(updates.length, callback);\n\n var next = function(err, affectedDocsNum) {\n if (err) return callback(err);\n done(null, affectedDocsNum);\n };\n\n _.each(updates, function(update) {\n self.$$collection.update(selector, update, next);\n });\n };\n\n AngularMeteorCollection.remove = function(keyOrDocs) {\n var keys;\n\n // remove whole collection\n if (!keyOrDocs) {\n keys = _.pluck(this, '_id');\n }\n // remove docs\n else {\n keyOrDocs = [].concat(keyOrDocs);\n\n keys = _.map(keyOrDocs, function(keyOrDoc) {\n return keyOrDoc._id || keyOrDoc;\n });\n }\n\n // Checks if all keys are correct.\n check(keys, [Match.OneOf(String, Mongo.ObjectID)]);\n\n var promises = keys.map(function(key) {\n return this._removeDoc(key);\n }, this);\n\n return $meteorUtils.promiseAll(promises);\n };\n\n AngularMeteorCollection._removeDoc = function(id) {\n var deferred = $q.defer();\n var collection = this.$$collection;\n var fulfill = $meteorUtils.fulfill(deferred, null, { _id: id, action: 'removed' });\n collection.remove(id, fulfill);\n return deferred.promise;\n };\n\n AngularMeteorCollection._updateCursor = function(cursor, autoClientSave) {\n var self = this;\n // XXX - consider adding an option for a non-orderd result for faster performance\n if (self._hObserve) self._stopObserving();\n\n\n self._hObserve = cursor.observe({\n addedAt: function(doc, atIndex) {\n self.splice(atIndex, 0, doc);\n self._serverBackup.splice(atIndex, 0, doc);\n self._setServerUpdateMode();\n },\n\n changedAt: function(doc, oldDoc, atIndex) {\n diffArray.deepCopyChanges(self[atIndex], doc);\n diffArray.deepCopyRemovals(self[atIndex], doc);\n self._serverBackup[atIndex] = self[atIndex];\n self._setServerUpdateMode();\n },\n\n movedTo: function(doc, fromIndex, toIndex) {\n self.splice(fromIndex, 1);\n self.splice(toIndex, 0, doc);\n self._serverBackup.splice(fromIndex, 1);\n self._serverBackup.splice(toIndex, 0, doc);\n self._setServerUpdateMode();\n },\n\n removedAt: function(oldDoc) {\n var removedIndex = $meteorUtils.findIndexById(self, oldDoc);\n\n if (removedIndex != -1) {\n self.splice(removedIndex, 1);\n self._serverBackup.splice(removedIndex, 1);\n self._setServerUpdateMode();\n } else {\n // If it's been removed on client then it's already not in collection\n // itself but still is in the _serverBackup.\n removedIndex = $meteorUtils.findIndexById(self._serverBackup, oldDoc);\n\n if (removedIndex != -1) {\n self._serverBackup.splice(removedIndex, 1);\n }\n }\n }\n });\n\n self._hDataAutorun = Tracker.autorun(function() {\n cursor.fetch();\n if (self._serverMode) self._unsetServerUpdateMode(autoClientSave);\n });\n };\n\n AngularMeteorCollection._stopObserving = function() {\n this._hObserve.stop();\n this._hDataAutorun.stop();\n delete this._serverMode;\n delete this._hUnsetTimeout;\n };\n\n AngularMeteorCollection._setServerUpdateMode = function(name) {\n this._serverMode = true;\n // To simplify server update logic, we don't follow\n // updates from the client at the same time.\n this._unsetAutoClientSave();\n };\n\n // Here we use $timeout to combine multiple updates that go\n // each one after another.\n AngularMeteorCollection._unsetServerUpdateMode = function(autoClientSave) {\n var self = this;\n\n if (self._hUnsetTimeout) {\n $timeout.cancel(self._hUnsetTimeout);\n self._hUnsetTimeout = null;\n }\n\n self._hUnsetTimeout = $timeout(function() {\n self._serverMode = false;\n // Finds updates that was potentially done from the client side\n // and saves them.\n var changes = diffArray.getChanges(self, self._serverBackup, self._diffArrayFunc);\n self._saveChanges(changes);\n // After, continues following client updates.\n if (autoClientSave) self._setAutoClientSave();\n }, 0);\n };\n\n AngularMeteorCollection.stop = function() {\n this._stopCursor();\n this._hNewCurAutorun.stop();\n };\n\n AngularMeteorCollection._stopCursor = function() {\n this._unsetAutoClientSave();\n\n if (this._hObserve) {\n this._hObserve.stop();\n this._hDataAutorun.stop();\n }\n\n this.splice(0);\n this._serverBackup.splice(0);\n };\n\n AngularMeteorCollection._unsetAutoClientSave = function(name) {\n if (this._hRegAutoBind) {\n this._hRegAutoBind();\n this._hRegAutoBind = null;\n }\n };\n\n AngularMeteorCollection._setAutoClientSave = function() {\n var self = this;\n\n // Always unsets auto save to keep only one $watch handler.\n self._unsetAutoClientSave();\n\n self._hRegAutoBind = $rootScope.$watch(function() {\n return self;\n }, function(nItems, oItems) {\n if (nItems === oItems) return;\n\n var changes = diffArray.getChanges(self, oItems, self._diffArrayFunc);\n self._unsetAutoClientSave();\n self._saveChanges(changes);\n self._setAutoClientSave();\n }, true);\n };\n\n AngularMeteorCollection._saveChanges = function(changes) {\n var self = this;\n\n // Saves added documents\n // Using reversed iteration to prevent indexes from changing during splice\n var addedDocs = changes.added.reverse().map(function(descriptor) {\n self.splice(descriptor.index, 1);\n return descriptor.item;\n });\n\n if (addedDocs.length) self.save(addedDocs);\n\n // Removes deleted documents\n var removedDocs = changes.removed.map(function(descriptor) {\n return descriptor.item;\n });\n\n if (removedDocs.length) self.remove(removedDocs);\n\n // Updates changed documents\n changes.changed.forEach(function(descriptor) {\n self._updateDiff(descriptor.selector, descriptor.modifier);\n });\n };\n\n return AngularMeteorCollection;\n}]);\n\nangularMeteorCollection.factory('$meteorCollectionFS', [\n '$meteorCollection', 'diffArray', '$angularMeteorSettings',\n function($meteorCollection, diffArray, $angularMeteorSettings) {\n function $meteorCollectionFS(reactiveFunc, autoClientSave, collection) {\n\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.$meteorCollectionFS] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/files. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n return new $meteorCollection(reactiveFunc, autoClientSave, collection, diffArray.shallow);\n }\n\n return $meteorCollectionFS;\n}]);\n\nangularMeteorCollection.factory('$meteorCollection', [\n 'AngularMeteorCollection', '$rootScope', 'diffArray',\n function(AngularMeteorCollection, $rootScope, diffArray) {\n function $meteorCollection(reactiveFunc, autoClientSave, collection, diffFn) {\n // Validate parameters\n if (!reactiveFunc) {\n throw new TypeError('The first argument of $meteorCollection is undefined.');\n }\n\n if (!(angular.isFunction(reactiveFunc) || angular.isFunction(reactiveFunc.find))) {\n throw new TypeError(\n 'The first argument of $meteorCollection must be a function or ' +\n 'a have a find function property.');\n }\n\n if (!angular.isFunction(reactiveFunc)) {\n collection = angular.isDefined(collection) ? collection : reactiveFunc;\n reactiveFunc = _.bind(reactiveFunc.find, reactiveFunc);\n }\n\n // By default auto save - true.\n autoClientSave = angular.isDefined(autoClientSave) ? autoClientSave : true;\n diffFn = diffFn || diffArray;\n return new AngularMeteorCollection(reactiveFunc, collection, diffFn, autoClientSave);\n }\n\n return $meteorCollection;\n}]);\n\nangularMeteorCollection.run([\n '$rootScope', '$meteorCollection', '$meteorCollectionFS', '$meteorStopper',\n function($rootScope, $meteorCollection, $meteorCollectionFS, $meteorStopper) {\n var scopeProto = Object.getPrototypeOf($rootScope);\n scopeProto.$meteorCollection = $meteorStopper($meteorCollection);\n scopeProto.$meteorCollectionFS = $meteorStopper($meteorCollectionFS);\n}]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-collection.js\n **/","/*global\n angular, _, Mongo\n*/\n\n'use strict';\n\nvar angularMeteorObject = angular.module('angular-meteor.object',\n ['angular-meteor.utils', 'angular-meteor.subscribe', 'angular-meteor.collection', 'getUpdates', 'diffArray', 'angular-meteor.settings']);\n\nangularMeteorObject.factory('AngularMeteorObject', [\n '$q', '$meteorSubscribe', '$meteorUtils', 'diffArray', 'getUpdates', 'AngularMeteorCollection', '$angularMeteorSettings',\n function($q, $meteorSubscribe, $meteorUtils, diffArray, getUpdates, AngularMeteorCollection, $angularMeteorSettings) {\n\n // A list of internals properties to not watch for, nor pass to the Document on update and etc.\n AngularMeteorObject.$$internalProps = [\n '$$collection', '$$options', '$$id', '$$hashkey', '$$internalProps', '$$scope',\n 'bind', 'save', 'reset', 'subscribe', 'stop', 'autorunComputation', 'unregisterAutoBind', 'unregisterAutoDestroy', 'getRawObject',\n '_auto', '_setAutos', '_eventEmitter', '_serverBackup', '_updateDiff', '_updateParallel', '_getId'\n ];\n\n function AngularMeteorObject (collection, selector, options){\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.$meteorObject] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/meteorObject. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n // Make data not be an object so we can extend it to preserve\n // Collection Helpers and the like\n var helpers = collection._helpers;\n var data = _.isFunction(helpers) ? Object.create(helpers.prototype) : {};\n var doc = collection.findOne(selector, options);\n var collectionExtension = _.pick(AngularMeteorCollection, '_updateParallel');\n _.extend(data, doc);\n _.extend(data, AngularMeteorObject);\n _.extend(data, collectionExtension);\n\n // Omit options that may spoil document finding\n data.$$options = _.omit(options, 'skip', 'limit');\n data.$$collection = collection;\n data.$$id = data._getId(selector);\n data._serverBackup = doc || {};\n\n return data;\n }\n\n AngularMeteorObject.getRawObject = function () {\n return angular.copy(_.omit(this, this.$$internalProps));\n };\n\n AngularMeteorObject.subscribe = function () {\n $meteorSubscribe.subscribe.apply(this, arguments);\n return this;\n };\n\n AngularMeteorObject.save = function(custom) {\n var deferred = $q.defer();\n var collection = this.$$collection;\n var createFulfill = _.partial($meteorUtils.fulfill, deferred, null);\n var oldDoc = collection.findOne(this.$$id);\n var mods;\n\n // update\n if (oldDoc) {\n if (custom)\n mods = { $set: custom };\n else {\n mods = getUpdates(oldDoc, this.getRawObject());\n // If there are no updates, there is nothing to do here, returning\n if (_.isEmpty(mods)) {\n return $q.when({ action: 'updated' });\n }\n }\n\n // NOTE: do not use #upsert() method, since it does not exist in some collections\n this._updateDiff(mods, createFulfill({ action: 'updated' }));\n }\n // insert\n else {\n if (custom)\n mods = _.clone(custom);\n else\n mods = this.getRawObject();\n\n mods._id = mods._id || this.$$id;\n collection.insert(mods, createFulfill({ action: 'inserted' }));\n }\n\n return deferred.promise;\n };\n\n AngularMeteorObject._updateDiff = function(update, callback) {\n var selector = this.$$id;\n AngularMeteorCollection._updateDiff.call(this, selector, update, callback);\n };\n\n AngularMeteorObject.reset = function(keepClientProps) {\n var self = this;\n var options = this.$$options;\n var id = this.$$id;\n var doc = this.$$collection.findOne(id, options);\n\n if (doc) {\n // extend SubObject\n var docKeys = _.keys(doc);\n var docExtension = _.pick(doc, docKeys);\n var clientProps;\n\n _.extend(self, docExtension);\n _.extend(self._serverBackup, docExtension);\n\n if (keepClientProps) {\n clientProps = _.intersection(_.keys(self), _.keys(self._serverBackup));\n } else {\n clientProps = _.keys(self);\n }\n\n var serverProps = _.keys(doc);\n var removedKeys = _.difference(clientProps, serverProps, self.$$internalProps);\n\n removedKeys.forEach(function (prop) {\n delete self[prop];\n delete self._serverBackup[prop];\n });\n }\n\n else {\n _.keys(this.getRawObject()).forEach(function(prop) {\n delete self[prop];\n });\n\n self._serverBackup = {};\n }\n };\n\n AngularMeteorObject.stop = function () {\n if (this.unregisterAutoDestroy)\n this.unregisterAutoDestroy();\n\n if (this.unregisterAutoBind)\n this.unregisterAutoBind();\n\n if (this.autorunComputation && this.autorunComputation.stop)\n this.autorunComputation.stop();\n };\n\n AngularMeteorObject._getId = function(selector) {\n var options = _.extend({}, this.$$options, {\n fields: { _id: 1 },\n reactive: false,\n transform: null\n });\n\n var doc = this.$$collection.findOne(selector, options);\n\n if (doc) return doc._id;\n if (selector instanceof Mongo.ObjectID) return selector;\n if (_.isString(selector)) return selector;\n return new Mongo.ObjectID();\n };\n\n return AngularMeteorObject;\n}]);\n\n\nangularMeteorObject.factory('$meteorObject', [\n '$rootScope', '$meteorUtils', 'getUpdates', 'AngularMeteorObject',\n function($rootScope, $meteorUtils, getUpdates, AngularMeteorObject) {\n function $meteorObject(collection, id, auto, options) {\n // Validate parameters\n if (!collection) {\n throw new TypeError(\"The first argument of $meteorObject is undefined.\");\n }\n\n if (!angular.isFunction(collection.findOne)) {\n throw new TypeError(\"The first argument of $meteorObject must be a function or a have a findOne function property.\");\n }\n\n var data = new AngularMeteorObject(collection, id, options);\n // Making auto default true - http://stackoverflow.com/a/15464208/1426570\n data._auto = auto !== false;\n _.extend(data, $meteorObject);\n data._setAutos();\n return data;\n }\n\n $meteorObject._setAutos = function() {\n var self = this;\n\n this.autorunComputation = $meteorUtils.autorun($rootScope, function() {\n self.reset(true);\n });\n\n // Deep watches the model and performs autobind\n this.unregisterAutoBind = this._auto && $rootScope.$watch(function(){\n return self.getRawObject();\n }, function (item, oldItem) {\n if (item !== oldItem) self.save();\n }, true);\n\n this.unregisterAutoDestroy = $rootScope.$on('$destroy', function() {\n if (self && self.stop) self.pop();\n });\n };\n\n return $meteorObject;\n}]);\n\nangularMeteorObject.run([\n '$rootScope', '$meteorObject', '$meteorStopper',\n function ($rootScope, $meteorObject, $meteorStopper) {\n var scopeProto = Object.getPrototypeOf($rootScope);\n scopeProto.$meteorObject = $meteorStopper($meteorObject);\n}]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-object.js\n **/","/*global\n angular, _, Package, Meteor\n */\n\n'use strict';\n\nvar angularMeteorUser = angular.module('angular-meteor.user', [\n 'angular-meteor.utils',\n 'angular-meteor.core',\n 'angular-meteor.settings'\n]);\n\n// requires package 'accounts-password'\nangularMeteorUser.service('$meteorUser', [\n '$rootScope', '$meteorUtils', '$q', '$angularMeteorSettings',\n function($rootScope, $meteorUtils, $q, $angularMeteorSettings){\n\n var pack = Package['accounts-base'];\n if (!pack) return;\n\n var self = this;\n var Accounts = pack.Accounts;\n\n this.waitForUser = function(){\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.waitForUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n var deferred = $q.defer();\n\n $meteorUtils.autorun($rootScope, function(){\n if ( !Meteor.loggingIn() )\n deferred.resolve( Meteor.user() );\n }, true);\n\n return deferred.promise;\n };\n\n this.requireUser = function(){\n if (!$angularMeteorSettings.suppressWarnings) {\n console.warn('[angular-meteor.requireUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n }\n\n var deferred = $q.defer();\n\n $meteorUtils.autorun($rootScope, function(){\n if ( !Meteor.loggingIn() ) {\n if ( Meteor.user() === null)\n deferred.reject(\"AUTH_REQUIRED\");\n else\n deferred.resolve( Meteor.user() );\n }\n }, true);\n\n return deferred.promise;\n };\n\n this.requireValidUser = function(validatorFn) {\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.requireValidUser] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://info.meteor.com/blog/angular-meteor-1.3. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n return self.requireUser(true).then(function(user){\n var valid = validatorFn( user );\n\n if ( valid === true )\n return user;\n else if ( typeof valid === \"string\" )\n return $q.reject( valid );\n else\n return $q.reject( \"FORBIDDEN\" );\n\t });\n\t };\n\n this.loginWithPassword = $meteorUtils.promissor(Meteor, 'loginWithPassword');\n this.createUser = $meteorUtils.promissor(Accounts, 'createUser');\n this.changePassword = $meteorUtils.promissor(Accounts, 'changePassword');\n this.forgotPassword = $meteorUtils.promissor(Accounts, 'forgotPassword');\n this.resetPassword = $meteorUtils.promissor(Accounts, 'resetPassword');\n this.verifyEmail = $meteorUtils.promissor(Accounts, 'verifyEmail');\n this.logout = $meteorUtils.promissor(Meteor, 'logout');\n this.logoutOtherClients = $meteorUtils.promissor(Meteor, 'logoutOtherClients');\n this.loginWithFacebook = $meteorUtils.promissor(Meteor, 'loginWithFacebook');\n this.loginWithTwitter = $meteorUtils.promissor(Meteor, 'loginWithTwitter');\n this.loginWithGoogle = $meteorUtils.promissor(Meteor, 'loginWithGoogle');\n this.loginWithGithub = $meteorUtils.promissor(Meteor, 'loginWithGithub');\n this.loginWithMeteorDeveloperAccount = $meteorUtils.promissor(Meteor, 'loginWithMeteorDeveloperAccount');\n this.loginWithMeetup = $meteorUtils.promissor(Meteor, 'loginWithMeetup');\n this.loginWithWeibo = $meteorUtils.promissor(Meteor, 'loginWithWeibo');\n }\n]);\n\nangularMeteorUser.run([\n '$rootScope', '$angularMeteorSettings', '$$Core',\n function($rootScope, $angularMeteorSettings, $$Core){\n\n let ScopeProto = Object.getPrototypeOf($rootScope);\n _.extend(ScopeProto, $$Core);\n\n $rootScope.autorun(function(){\n if (!Meteor.user) return;\n $rootScope.currentUser = Meteor.user();\n $rootScope.loggingIn = Meteor.loggingIn();\n });\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-user.js\n **/","/*global\n angular, _, Meteor\n */\n\n'use strict';\n\nvar angularMeteorMethods = angular.module('angular-meteor.methods', ['angular-meteor.utils', 'angular-meteor.settings']);\n\nangularMeteorMethods.service('$meteorMethods', [\n '$q', '$meteorUtils', '$angularMeteorSettings',\n function($q, $meteorUtils, $angularMeteorSettings) {\n this.call = function(){\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.$meteor.call] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/methods. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n var deferred = $q.defer();\n var fulfill = $meteorUtils.fulfill(deferred);\n var args = _.toArray(arguments).concat(fulfill);\n Meteor.call.apply(this, args);\n return deferred.promise;\n };\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-methods.js\n **/","/*global\n angular, Session\n */\n\n'use strict';\nvar angularMeteorSession = angular.module('angular-meteor.session', ['angular-meteor.utils', 'angular-meteor.settings']);\n\nangularMeteorSession.factory('$meteorSession', ['$meteorUtils', '$parse', '$angularMeteorSettings',\n function ($meteorUtils, $parse, $angularMeteorSettings) {\n return function (session) {\n\n return {\n\n bind: function(scope, model) {\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.session.bind] Please note that this method is deprecated since 1.3.0 and will be removed in 1.4.0! http://www.angular-meteor.com/api/1.3.0/session. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n var getter = $parse(model);\n var setter = getter.assign;\n $meteorUtils.autorun(scope, function() {\n setter(scope, Session.get(session));\n });\n\n scope.$watch(model, function(newItem, oldItem) {\n Session.set(session, getter(scope));\n }, true);\n\n }\n };\n };\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-session.js\n **/","/*global\n angular, Package\n */\n\n'use strict';\n\nvar angularMeteorCamera = angular.module('angular-meteor.camera', ['angular-meteor.utils', 'angular-meteor.settings']);\n\n// requires package 'mdg:camera'\nangularMeteorCamera.service('$meteorCamera', [\n '$q', '$meteorUtils', '$angularMeteorSettings',\n function ($q, $meteorUtils, $angularMeteorSettings) {\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.camera] Please note that this module has moved to a separate package and is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/camera. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n var pack = Package['mdg:camera'];\n if (!pack) return;\n\n var MeteorCamera = pack.MeteorCamera;\n\n this.getPicture = function(options){\n if (!$angularMeteorSettings.suppressWarnings)\n console.warn('[angular-meteor.camera] Please note that this module has moved to a separate package and is deprecated since 1.3.0 and will be removed in 1.4.0! For more info: http://www.angular-meteor.com/api/1.3.0/camera. You can disable this warning by following this guide http://www.angular-meteor.com/api/1.3.6/settings');\n\n options = options || {};\n var deferred = $q.defer();\n MeteorCamera.getPicture(options, $meteorUtils.fulfill(deferred));\n return deferred.promise;\n };\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-camera.js\n **/","/*global\n angular\n */\n\n'use strict';\n\nvar angularMeteorStopper = angular.module('angular-meteor.stopper',\n ['angular-meteor.subscribe']);\n\nangularMeteorStopper.factory('$meteorStopper', ['$q', '$meteorSubscribe',\n function($q, $meteorSubscribe) {\n function $meteorStopper($meteorEntity) {\n return function() {\n var args = Array.prototype.slice.call(arguments);\n var meteorEntity = $meteorEntity.apply(this, args);\n\n angular.extend(meteorEntity, $meteorStopper);\n meteorEntity.$$scope = this;\n\n this.$on('$destroy', function () {\n meteorEntity.stop();\n if (meteorEntity.subscription) meteorEntity.subscription.stop();\n });\n\n return meteorEntity;\n };\n }\n\n $meteorStopper.subscribe = function() {\n var args = Array.prototype.slice.call(arguments);\n this.subscription = $meteorSubscribe._subscribe(this.$$scope, $q.defer(), args);\n return this;\n };\n\n return $meteorStopper;\n}]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/angular-meteor-stopper.js\n **/","export const name = 'angular-meteor.utilities';\nexport const utils = '$$utils';\n\nangular.module(name, [])\n\n/*\n A utility service which is provided with general utility functions\n */\n.service(utils, [\n '$rootScope',\n\n function($rootScope) {\n const self = this;\n\n // Checks if an object is a cursor\n this.isCursor = (obj) => {\n return obj instanceof Meteor.Collection.Cursor;\n };\n\n // Cheecks if an object is a scope\n this.isScope = (obj) => {\n return obj instanceof $rootScope.constructor;\n };\n\n // Checks if two objects are siblings\n this.areSiblings = (obj1, obj2) => {\n return _.isObject(obj1) && _.isObject(obj2) &&\n Object.getPrototypeOf(obj1) === Object.getPrototypeOf(obj2);\n };\n\n // Binds function into a scpecified context. If an object is provided, will bind every\n // value in the object which is a function. If a tap function is provided, it will be\n // called right after the function has been invoked.\n this.bind = (fn, context, tap) => {\n tap = _.isFunction(tap) ? tap : angular.noop;\n if (_.isFunction(fn)) return bindFn(fn, context, tap);\n if (_.isObject(fn)) return bindObj(fn, context, tap);\n return fn;\n };\n\n function bindFn(fn, context, tap) {\n return (...args) => {\n const result = fn.apply(context, args);\n tap.call(context, {\n result,\n args\n });\n return result;\n };\n }\n\n function bindObj(obj, context, tap) {\n return _.keys(obj).reduce((bound, k) => {\n bound[k] = self.bind(obj[k], context, tap);\n return bound;\n }, {});\n }\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/utils.js\n **/","export const name = 'angular-meteor.mixer';\nexport const Mixer = '$Mixer';\n\nangular.module(name, [])\n\n/*\n A service which lets us apply mixins into Scope.prototype.\n The flow is simple. Once we define a mixin, it will be stored in the `$Mixer`,\n and any time a `ChildScope` prototype is created\n it will be extended by the `$Mixer`.\n This concept is good because it keeps our code\n clean and simple, and easy to extend.\n So any time we would like to define a new behaviour to our scope,\n we will just use the `$Mixer` service.\n */\n.service(Mixer, function() {\n this._mixins = [];\n // Apply mixins automatically on specified contexts\n this._autoExtend = [];\n this._autoConstruct = [];\n\n // Adds a new mixin\n this.mixin = (mixin) => {\n if (!_.isObject(mixin)) {\n throw Error('argument 1 must be an object');\n }\n\n this._mixins = _.union(this._mixins, [mixin]);\n // Apply mixins to stored contexts\n this._autoExtend.forEach(context => this._extend(context));\n this._autoConstruct.forEach(context => this._construct(context));\n return this;\n };\n\n // Removes a mixin. Useful mainly for test purposes\n this._mixout = (mixin) => {\n this._mixins = _.without(this._mixins, mixin);\n return this;\n };\n\n // Invoke function mixins with the provided context and arguments\n this._construct = (context, ...args) => {\n this._mixins.filter(_.isFunction).forEach((mixin) => {\n mixin.call(context, ...args);\n });\n\n return context;\n };\n\n // Extend prototype with the defined mixins\n this._extend = (obj) => {\n return _.extend(obj, ...this._mixins);\n };\n});\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/mixer.js\n **/","import { name as mixerName, Mixer } from './mixer';\n\nexport const name = 'angular-meteor.scope';\n\nangular.module(name, [\n mixerName\n])\n\n.run([\n '$rootScope',\n Mixer,\n function($rootScope, $Mixer) {\n const Scope = $rootScope.constructor;\n const $new = $rootScope.$new;\n\n // Apply extensions whether a mixin in defined.\n // Note that this way mixins which are initialized later\n // can be applied on rootScope.\n $Mixer._autoExtend.push(Scope.prototype);\n $Mixer._autoConstruct.push($rootScope);\n\n Scope.prototype.$new = function() {\n const scope = $new.apply(this, arguments);\n // Apply constructors to newly created scopes\n return $Mixer._construct(scope);\n };\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/scope.js\n **/","import { name as utilsName, utils } from './utils';\nimport { name as mixerName } from './mixer';\n\nexport const name = 'angular-meteor.core';\nexport const Core = '$$Core';\n\nangular.module(name, [\n utilsName,\n mixerName\n])\n\n\n/*\n A mixin which provides us with core Meteor functions.\n */\n.factory(Core, [\n '$q',\n utils,\n\n function($q, $$utils) {\n function $$Core() {}\n\n // Calls Meteor.autorun() which will be digested after each run and automatically destroyed\n $$Core.autorun = function(fn, options = {}) {\n fn = this.$bindToContext(fn);\n\n if (!_.isFunction(fn)) {\n throw Error('argument 1 must be a function');\n }\n if (!_.isObject(options)) {\n throw Error('argument 2 must be an object');\n }\n\n const computation = Tracker.autorun(fn, options);\n this.$$autoStop(computation);\n return computation;\n };\n\n // Calls Meteor.subscribe() which will be digested after each invokation\n // and automatically destroyed\n $$Core.subscribe = function(subName, fn, cb) {\n fn = this.$bindToContext(fn || angular.noop);\n cb = cb ? this.$bindToContext(cb) : angular.noop;\n\n if (!_.isString(subName)) {\n throw Error('argument 1 must be a string');\n }\n if (!_.isFunction(fn)) {\n throw Error('argument 2 must be a function');\n }\n if (!_.isFunction(cb) && !_.isObject(cb)) {\n throw Error('argument 3 must be a function or an object');\n }\n\n const result = {};\n\n const computation = this.autorun(() => {\n let args = fn();\n if (angular.isUndefined(args)) args = [];\n\n if (!_.isArray(args)) {\n throw Error(`reactive function's return value must be an array`);\n }\n\n const subscription = Meteor.subscribe(subName, ...args, cb);\n result.ready = subscription.ready.bind(subscription);\n result.subscriptionId = subscription.subscriptionId;\n });\n\n // Once the computation has been stopped,\n // any subscriptions made inside will be stopped as well\n result.stop = computation.stop.bind(computation);\n return result;\n };\n\n // Calls Meteor.call() wrapped by a digestion cycle\n $$Core.callMethod = function(...args) {\n let fn = args.pop();\n if (_.isFunction(fn)) fn = this.$bindToContext(fn);\n return Meteor.call(...args, fn);\n };\n\n // Calls Meteor.apply() wrapped by a digestion cycle\n $$Core.applyMethod = function(...args) {\n let fn = args.pop();\n if (_.isFunction(fn)) fn = this.$bindToContext(fn);\n return Meteor.apply(...args, fn);\n };\n\n $$Core.$$autoStop = function(stoppable) {\n this.$on('$destroy', stoppable.stop.bind(stoppable));\n };\n\n // Digests scope only if there is no phase at the moment\n $$Core.$$throttledDigest = function() {\n const isDigestable = !this.$$destroyed &&\n !this.$$phase &&\n !this.$root.$$phase;\n\n if (isDigestable) this.$digest();\n };\n\n // Creates a promise only that the digestion cycle will be called at its fulfillment\n $$Core.$$defer = function() {\n const deferred = $q.defer();\n // Once promise has been fulfilled, digest\n deferred.promise = deferred.promise.finally(this.$$throttledDigest.bind(this));\n return deferred;\n };\n\n // Binds an object or a function to the scope to the view model and digest it once it is invoked\n $$Core.$bindToContext = function(fn) {\n return $$utils.bind(fn, this, this.$$throttledDigest.bind(this));\n };\n\n return $$Core;\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/core.js\n **/","import { name as utilsName, utils } from './utils';\nimport { name as mixerName, Mixer } from './mixer';\nimport { name as coreName } from './core';\n\nexport const name = 'angular-meteor.view-model';\nexport const ViewModel = '$$ViewModel';\nexport const reactive = '$reactive';\n\nangular.module(name, [\n utilsName,\n mixerName,\n coreName\n])\n\n/*\n A mixin which lets us bind a view model into a scope.\n Note that only a single view model can be bound,\n otherwise the scope might behave unexpectedly.\n Mainly used to define the controller as the view model,\n and very useful when wanting to use Angular's `controllerAs` syntax.\n */\n.factory(ViewModel, [\n utils,\n Mixer,\n\n function($$utils, $Mixer) {\n function $$ViewModel(vm = this) {\n // Defines the view model on the scope.\n this.$$vm = vm;\n }\n\n // Gets an object, wraps it with scope functions and returns it\n $$ViewModel.viewModel = function(vm) {\n if (!_.isObject(vm)) {\n throw Error('argument 1 must be an object');\n }\n\n // Apply mixin functions\n $Mixer._mixins.forEach((mixin) => {\n // Reject methods which starts with double $\n const keys = _.keys(mixin).filter(k => k.match(/^(?!\\$\\$).*$/));\n const proto = _.pick(mixin, keys);\n // Bind all the methods to the prototype\n const boundProto = $$utils.bind(proto, this);\n // Add the methods to the view model\n _.extend(vm, boundProto);\n });\n\n // Apply mixin constructors on the view model\n $Mixer._construct(this, vm);\n return vm;\n };\n\n // Override $$Core.$bindToContext to be bound to view model instead of scope\n $$ViewModel.$bindToContext = function(fn) {\n return $$utils.bind(fn, this.$$vm, this.$$throttledDigest.bind(this));\n };\n\n return $$ViewModel;\n }\n])\n\n\n/*\n Illustrates the old API where a view model is created using $reactive service\n */\n.service(reactive, [\n utils,\n\n function($$utils) {\n class Reactive {\n constructor(vm) {\n if (!_.isObject(vm)) {\n throw Error('argument 1 must be an object');\n }\n\n _.defer(() => {\n if (!this._attached) {\n console.warn('view model was not attached to any scope');\n }\n });\n\n this._vm = vm;\n }\n\n attach(scope) {\n this._attached = true;\n\n if (!$$utils.isScope(scope)) {\n throw Error('argument 1 must be a scope');\n }\n\n const viewModel = scope.viewModel(this._vm);\n\n // Similar to the old/Meteor API\n viewModel.call = viewModel.callMethod;\n viewModel.apply = viewModel.applyMethod;\n\n return viewModel;\n }\n }\n\n return (vm) => new Reactive(vm);\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/view-model.js\n **/","import { name as utilsName, utils } from './utils';\nimport { name as mixerName } from './mixer';\nimport { name as coreName } from './core';\nimport { name as viewModelName } from './view-model';\n\nexport const name = 'angular-meteor.reactive';\nexport const Reactive = '$$Reactive';\n\nangular.module(name, [\n utilsName,\n mixerName,\n coreName,\n viewModelName\n])\n\n\n/*\n A mixin which enhance our reactive abilities by providing methods\n that are capable of updating our scope reactively.\n */\n.factory(Reactive, [\n '$parse',\n utils,\n\n function($parse, $$utils) {\n function $$Reactive(vm = this) {\n // Helps us track changes made in the view model\n vm.$$dependencies = {};\n }\n\n // Gets an object containing functions and define their results as reactive properties.\n // Once a return value has been changed the property will be reset.\n $$Reactive.helpers = function(props = {}) {\n if (!_.isObject(props)) {\n throw Error('argument 1 must be an object');\n }\n\n _.each(props, (v, k, i) => {\n if (!_.isFunction(v)) {\n throw Error(`helper ${i + 1} must be a function`);\n }\n\n if (!this.$$vm.$$dependencies[k]) {\n // Registers a new dependency to the specified helper\n this.$$vm.$$dependencies[k] = new Tracker.Dependency();\n }\n\n this.$$setFnHelper(k, v);\n });\n };\n\n // Gets a model reactively\n $$Reactive.getReactively = function(k, isDeep = false) {\n if (!_.isBoolean(isDeep)) {\n throw Error('argument 2 must be a boolean');\n }\n\n return this.$$reactivateEntity(k, this.$watch, isDeep);\n };\n\n // Gets a collection reactively\n $$Reactive.getCollectionReactively = function(k) {\n return this.$$reactivateEntity(k, this.$watchCollection);\n };\n\n // Gets an entity reactively, and once it has been changed the computation will be recomputed\n $$Reactive.$$reactivateEntity = function(k, watcher, ...watcherArgs) {\n if (!_.isString(k)) {\n throw Error('argument 1 must be a string');\n }\n\n if (!this.$$vm.$$dependencies[k]) {\n this.$$vm.$$dependencies[k] = new Tracker.Dependency();\n this.$$watchEntity(k, watcher, ...watcherArgs);\n }\n\n this.$$vm.$$dependencies[k].depend();\n return $parse(k)(this.$$vm);\n };\n\n // Watches for changes in the view model, and if so will notify a change\n $$Reactive.$$watchEntity = function(k, watcher, ...watcherArgs) {\n // Gets a deep property from the view model\n const getVal = _.partial($parse(k), this.$$vm);\n const initialVal = getVal();\n\n // Watches for changes in the view model\n watcher.call(this, getVal, (val, oldVal) => {\n const hasChanged =\n val !== initialVal ||\n val !== oldVal;\n\n // Notify if a change has been detected\n if (hasChanged) this.$$changed(k);\n }, ...watcherArgs);\n };\n\n // Invokes a function and sets the return value as a property\n $$Reactive.$$setFnHelper = function(k, fn) {\n this.autorun((computation) => {\n // Invokes the reactive functon\n const model = fn.apply(this.$$vm);\n\n // Ignore notifications made by the following handler\n Tracker.nonreactive(() => {\n // If a cursor, observe its changes and update acoordingly\n if ($$utils.isCursor(model)) {\n const observation = this.$$handleCursor(k, model);\n\n computation.onInvalidate(() => {\n observation.stop();\n this.$$vm[k].splice(0);\n });\n } else {\n this.$$handleNonCursor(k, model);\n }\n\n // Notify change and update the view model\n this.$$changed(k);\n });\n });\n };\n\n // Sets a value helper as a setter and a getter which will notify computations once used\n $$Reactive.$$setValHelper = function(k, v, watch = true) {\n // If set, reactives property\n if (watch) {\n const isDeep = _.isObject(v);\n this.getReactively(k, isDeep);\n }\n\n Object.defineProperty(this.$$vm, k, {\n configurable: true,\n enumerable: true,\n\n get: () => {\n return v;\n },\n set: (newVal) => {\n v = newVal;\n this.$$changed(k);\n }\n });\n };\n\n // Fetching a cursor and updates properties once the result set has been changed\n $$Reactive.$$handleCursor = function(k, cursor) {\n // If not defined set it\n if (angular.isUndefined(this.$$vm[k])) {\n this.$$setValHelper(k, cursor.fetch(), false);\n }\n // If defined update it\n else {\n const diff = jsondiffpatch.diff(this.$$vm[k], cursor.fetch());\n jsondiffpatch.patch(this.$$vm[k], diff);\n }\n\n // Observe changes made in the result set\n const observation = cursor.observe({\n addedAt: (doc, atIndex) => {\n if (!observation) return;\n this.$$vm[k].splice(atIndex, 0, doc);\n this.$$changed(k);\n },\n changedAt: (doc, oldDoc, atIndex) => {\n const diff = jsondiffpatch.diff(this.$$vm[k][atIndex], doc);\n jsondiffpatch.patch(this.$$vm[k][atIndex], diff);\n this.$$changed(k);\n },\n movedTo: (doc, fromIndex, toIndex) => {\n this.$$vm[k].splice(fromIndex, 1);\n this.$$vm[k].splice(toIndex, 0, doc);\n this.$$changed(k);\n },\n removedAt: (oldDoc, atIndex) => {\n this.$$vm[k].splice(atIndex, 1);\n this.$$changed(k);\n }\n });\n\n return observation;\n };\n\n $$Reactive.$$handleNonCursor = function(k, data) {\n let v = this.$$vm[k];\n\n if (angular.isDefined(v)) {\n delete this.$$vm[k];\n v = null;\n }\n\n if (angular.isUndefined(v)) {\n this.$$setValHelper(k, data);\n }\n // Update property if the new value is from the same type\n else if ($$utils.areSiblings(v, data)) {\n const diff = jsondiffpatch.diff(v, data);\n jsondiffpatch.patch(v, diff);\n this.$$changed(k);\n } else {\n this.$$vm[k] = data;\n }\n };\n\n // Notifies dependency in view model\n $$Reactive.$$depend = function(k) {\n this.$$vm.$$dependencies[k].depend();\n };\n\n // Notifies change in view model\n $$Reactive.$$changed = function(k) {\n this.$$throttledDigest();\n this.$$vm.$$dependencies[k].changed();\n };\n\n return $$Reactive;\n }\n]);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/reactive.js\n **/","export const name = 'angular-templates';\n\ntry {\n angular.module(name);\n} catch (e) {\n angular.module(name, []);\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/modules/templates.js\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/package.json b/package.json index 0a4940145..69611f054 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-meteor", - "version": "1.3.7-beta.1", + "version": "1.3.7", "main": "dist/angular-meteor.js", "description": "Combining the simplicity and power of AngularJS and Meteor", "keywords": [ diff --git a/packages/angular-meteor-data/.versions b/packages/angular-meteor-data/.versions index 97b130db8..2f3e594da 100644 --- a/packages/angular-meteor-data/.versions +++ b/packages/angular-meteor-data/.versions @@ -1,4 +1,4 @@ -angular-meteor-data@0.3.0-beta.1 +angular-meteor-data@0.3.0 angular:angular@1.4.8 babel-compiler@5.8.24_1 babel-runtime@0.1.4 diff --git a/packages/angular-meteor-data/package.js b/packages/angular-meteor-data/package.js index f272562c5..c25857bdd 100644 --- a/packages/angular-meteor-data/package.js +++ b/packages/angular-meteor-data/package.js @@ -1,12 +1,12 @@ Package.describe({ name: 'angular-meteor-data', summary: 'Everything you need to use AngularJS in your Meteor app', - version: '0.3.0-beta.1', + version: '0.3.0', git: 'https://github.com/Urigo/angular-meteor.git' }); Npm.depends({ - 'angular-meteor': '1.3.7-beta.1' + 'angular-meteor': '1.3.7' }); Package.onUse(function (api) { diff --git a/packages/angular-with-blaze/.versions b/packages/angular-with-blaze/.versions index 39ddf041f..921ca6fbe 100644 --- a/packages/angular-with-blaze/.versions +++ b/packages/angular-with-blaze/.versions @@ -1,6 +1,6 @@ angular-blaze-templates-compiler@0.0.1 -angular-meteor-data@0.3.0-beta.1 -angular-with-blaze@1.3.7-beta.1 +angular-meteor-data@0.3.0 +angular-with-blaze@1.3.7 angular:angular@1.4.8 babel-compiler@5.8.24_1 babel-runtime@0.1.4 diff --git a/packages/angular-with-blaze/package.js b/packages/angular-with-blaze/package.js index 9482dc7e5..28758b419 100644 --- a/packages/angular-with-blaze/package.js +++ b/packages/angular-with-blaze/package.js @@ -1,7 +1,7 @@ Package.describe({ name: "angular-with-blaze", summary: "Everything you need to use both AngularJS and Blaze templates in your Meteor app", - version: "1.3.7-beta.1", + version: "1.3.7", git: "https://github.com/Urigo/angular-meteor.git", documentation: "../../README.md" }); @@ -12,7 +12,7 @@ Package.onUse(function (api) { api.imply([ 'blaze-html-templates', - 'angular-meteor-data@0.3.0-beta.1', + 'angular-meteor-data@0.3.0', 'angular-blaze-templates-compiler@0.0.1' ]); }); diff --git a/packages/angular/.versions b/packages/angular/.versions index f6f3af2b6..c47b76921 100644 --- a/packages/angular/.versions +++ b/packages/angular/.versions @@ -1,5 +1,5 @@ -angular@1.3.7-beta.1_1 -angular-meteor-data@0.3.0-beta.1 +angular@1.3.7 +angular-meteor-data@0.3.0 angular-templates@1.0.0 angular:angular@1.4.8 babel-compiler@5.8.24_1 diff --git a/packages/angular/package.js b/packages/angular/package.js index 2bd94fadc..fa0e01c1b 100644 --- a/packages/angular/package.js +++ b/packages/angular/package.js @@ -1,7 +1,7 @@ Package.describe({ name: "angular", summary: "Everything you need to use AngularJS in your Meteor app", - version: "1.3.7-beta.1_1", + version: "1.3.7", git: "https://github.com/Urigo/angular-meteor.git", documentation: "../../README.md" }); @@ -10,7 +10,7 @@ Package.onUse(function (api) { api.versionsFrom('METEOR@1.2.0.1'); api.imply([ - 'angular-meteor-data@0.3.0-beta.1', + 'angular-meteor-data@0.3.0', 'angular-templates@1.0.0', 'pbastowski:angular-babel@1.0.9' ]); diff --git a/packages/urigo-angular/.versions b/packages/urigo-angular/.versions index a4ce2c623..19bc91134 100644 --- a/packages/urigo-angular/.versions +++ b/packages/urigo-angular/.versions @@ -1,6 +1,6 @@ -angular@1.3.6 -angular-meteor-data@0.2.0 -angular-templates@0.0.3 +angular@1.3.7 +angular-meteor-data@0.3.0 +angular-templates@1.0.0 angular:angular@1.4.8 babel-compiler@5.8.24_1 babel-runtime@0.1.4 @@ -53,6 +53,6 @@ templating-tools@1.0.0 tracker@1.0.9 ui@1.0.8 underscore@1.0.4 -urigo:angular@1.3.6 +urigo:angular@1.3.7 webapp@1.2.3 webapp-hashing@1.0.5 diff --git a/packages/urigo-angular/package.js b/packages/urigo-angular/package.js index a12cc2b83..53fe94fa2 100644 --- a/packages/urigo-angular/package.js +++ b/packages/urigo-angular/package.js @@ -1,11 +1,11 @@ Package.describe({ name: "urigo:angular", summary: "Deprecated: use the official `angular` package instead!", - version: "1.3.6", + version: "1.3.7", git: "https://github.com/Urigo/angular-meteor.git", documentation: null }); Package.on_use(function (api) { - api.imply("angular@1.3.6"); + api.imply("angular@1.3.7"); });