UNPKG

angular-meteor

Version:

Combining the simplicity and power of AngularJS and Meteor

4 lines 37.5 kB
/*! angular-meteor v1.3.12 */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("underscore"),require("jsondiffpatch")):"function"==typeof define&&define.amd?define(["underscore","jsondiffpatch"],t):"object"==typeof exports?exports.angularMeteor=t(require("underscore"),require("jsondiffpatch")):e.angularMeteor=t(e._,e.jsondiffpatch)}(this,function(e,t){return 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}),r(1),r(4),r(5),r(6),r(7),r(8),r(9),r(10),r(11),r(12),r(13),r(14),r(15);var n=r(16),o=r(17),i=r(18),a=r(19),u=r(20),s=r(21),l=r(23),c="angular-meteor";t.default=c,angular.module(c,[n.name,o.name,i.name,a.name,u.name,s.name,l.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,u.ViewModel,s.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,u,s){var l=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=u.getPicture,["loginWithPassword","requireUser","requireValidUser","waitForUser","createUser","changePassword","forgotPassword","resetPassword","verifyEmail","loginWithMeteorDeveloperAccount","loginWithFacebook","loginWithGithub","loginWithGoogle","loginWithMeetup","loginWithTwitter","loginWithWeibo","logout","logoutOtherClients"].forEach(function(e){l[e]=s[e]})}]),e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var o=r(2),i=n(o);!function(){var e=angular.module("getUpdates",[]),t=function(){var e=function e(t,r){return r<1?{}:i.default.reduce(t,function(t,n,o){return n=i.default.isObject(n)?e(n,--r):n,t[o]=n,t},{})},t=function(e){var t=r(e),o=n(e);return i.default.object(t,o)},r=function e(t){var r=i.default.keys(t).map(function(r){var n=t[r];return!i.default.isObject(n)||i.default.isEmpty(n)||i.default.isArray(n)?r:e(n).map(function(e){return r+"."+e})});return i.default.flatten(r)},n=function e(t,r){return r=r||[],i.default.values(t).forEach(function(t){!i.default.isObject(t)||i.default.isEmpty(t)||i.default.isArray(t)?r.push(t):e(t,r)}),r},o=function(e,t,r){i.default.isEmpty(r)||(e[t]=r)},a=function(e,t){e||u(t)},u=function(e){throw Error("get-updates error - "+e)};return{rip:e,toPaths:t,getKeyPaths:r,getDeepValues:n,setFilled:o,assert:a,throwErr:u}}(),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=i.default.keys(r),a=i.default.keys(n),u=i.default.chain([]).concat(o).concat(a).uniq().without("$$hashKey").value();return u.reduce(function(o,a){var u=r[a],s=n[a];if(i.default.isDate(u)&&i.default.isDate(s)&&u.getTime()!=s.getTime()&&(o[a]=s),i.default.isObject(u)&&i.default.isObject(s)){var l=e(u,s);t.setFilled(o,a,l)}else u!==s&&(o[a]=s);return o},{})};return e}(),n=function(){var e=function(e,u,s){t.assert(i.default.isObject(e),"first argument must be an object"),t.assert(i.default.isObject(u),"second argument must be an object");var l=r(e,u,s),c=t.toPaths(l),f=n(c),d=o(c),p=a(d),h={};return t.setFilled(h,"$set",f),t.setFilled(h,"$unset",d),t.setFilled(h,"$pull",p),h},n=function(e){var t=u(e);return i.default.omit(e,t)},o=function(e){var t=u(e),r=i.default.pick(e,t);return i.default.reduce(r,function(e,t,r){return e[r]=!0,e},{})},a=function(e){var t=i.default.keys(e).map(function(e){var t=e.match(/(.*)\.\d+$/);return t&&t[1]});return i.default.compact(t).reduce(function(e,t){return e[t]=null,e},{})},u=function(e){return i.default.keys(e).filter(function(t){var r=e[t];return i.default.isUndefined(r)})};return e}();e.value("getUpdates",n)}()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(3),i=n(o);if("undefined"==typeof i.default&&"undefined"==typeof Package.underscore)throw new Error("underscore is missing");t.default=i.default||Package.underscore._,e.exports=t.default},function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var o=r(2),i=n(o),a=angular.module("diffArray",["getUpdates"]);a.factory("diffArray",["getUpdates",function(e){function t(t,r,a,u){u=!!u;var s=Package.minimongo.LocalCollection._diffQueryOrderedChanges||Package["diff-sequence"].DiffSequence.diffQueryOrderedChanges,l=[],c=[],f={},d={},p={},h=t.length;i.default.each(r,function(e,t){c.push({_id:e._id}),d[n(e._id)]=t}),i.default.each(t,function(e,t){l.push({_id:e._id}),f[n(e._id)]=t,p[n(e._id)]=t}),s(l,c,{addedBefore:function(e,t,o){var u=o?p[n(o)]:h;i.default.each(p,function(e,t){e>=u&&p[t]++}),h++,p[n(e)]=u,a.addedAt(e,r[d[n(e)]],u,o)},movedBefore:function(e,t){var o=p[n(e)],u=t?p[n(t)]:h-1;i.default.each(p,function(e,t){e>=o&&e<=u?p[t]--:e<=o&&e>=u&&p[t]++}),p[n(e)]=u,a.movedTo(e,r[d[n(e)]],o,u,t)},removed:function(e){var r=p[n(e)];i.default.each(p,function(e,t){e>=r&&p[t]--}),delete p[n(e)],h--,a.removedAt(e,t[f[n(e)]],r)}}),i.default.each(d,function(n,s){if(i.default.has(f,s)){var l=o(s),c=r[n]||{},d=t[f[s]],p=e(d,c,u);i.default.isEmpty(p)||a.changedAt(l,p,n,d)}})}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;i.default.each(n,function(e,r){a(t,r,e)})},t.deepCopyRemovals=function(t,r){var n=e(t,r).$unset;i.default.each(n,function(e,r){u(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 a=function(e,t,r){var n=t.split("."),o=i.default.initial(n),a=i.default.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]&&l(e[t])||(e[t]={}),e[t]},e);var u=s(e,o);return u[a]=r,r},u=function(e,t){var r=t.split("."),n=i.default.initial(r),o=i.default.last(r),a=s(e,n);return i.default.isArray(a)&&c(o)?!!a.splice(o,1):delete a[o]},s=function(e,t){return t.reduce(function(e,t){return e[t]},e)},l=function(e){return i.default.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:!0})},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,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(2),a=n(i),u=angular.module("angular-meteor.utils",["angular-meteor.settings"]);u.service("$meteorUtils",["$q","$timeout","$angularMeteorSettings",function(e,t,r){var n=this;this.autorun=function(e,n){r.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){n(e),e.firstRun||t(angular.noop,0)});return e.$on("$destroy",function(){o.stop()}),o},this.stripDollarPrefixedKeys=function(e){if(!a.default.isObject(e)||e instanceof Date||e instanceof File||"oid"===EJSON.toJSONValue(e).$type||"object"===("undefined"==typeof FS?"undefined":o(FS))&&e instanceof FS.File)return e;var t=a.default.isArray(e)?[]:{};return a.default.each(e,function(e,r){"string"==typeof r&&"$"===r.charAt(0)||(t[r]=n.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 o=e.defer(),i=n.fulfill(o),u=a.default.toArray(arguments).concat(i);return t[r].apply(t,u),o.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=a.default.find(e,function(e){return EJSON.equals(e._id,t._id)});return a.default.indexOf(e,r)}}]),u.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,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var o=r(2),i=n(o),a=angular.module("angular-meteor.collection",["angular-meteor.stopper","angular-meteor.subscribe","angular-meteor.utils","diffArray","angular-meteor.settings"]);a.factory("AngularMeteorCollection",["$q","$meteorSubscribe","$meteorUtils","$rootScope","$timeout","diffArray","$angularMeteorSettings",function(e,t,r,n,o,a,u){function s(e,t,n,o){u.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 a=[];if(a._serverBackup=[],a._diffArrayFunc=n,a._hObserve=null,a._hNewCurAutorun=null,a._hDataAutorun=null,angular.isDefined(t))a.$$collection=t;else{var l=e();a.$$collection=r.getCollectionByName(l.collection.name)}return i.default.extend(a,s),a._startCurAutorun(e,o),a}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(),a=this.$$collection,u=i.default.partial(r.fulfill,o,null);t=r.stripDollarPrefixedKeys(t);var s=t._id,l=a.findOne(s);if(l){delete t._id;var c=n?{$unset:t}:{$set:t};a.update(s,c,u(function(){return{_id:s,action:"updated"}}))}else a.insert(t,u(function(e){return{_id:e,action:"inserted"}}));return o.promise},s._updateDiff=function(e,t,r){r=r||angular.noop;var n=i.default.omit(t,"$pull"),o=[n];i.default.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=i.default.after(t.length,r),a=function(e,t){return e?r(e):void o(null,t)};i.default.each(t,function(t){n.$$collection.update(e,t,a)})},s.remove=function(e){var t;e?(e=[].concat(e),t=i.default.map(e,function(e){return e._id||e})):t=i.default.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){a.deepCopyChanges(n[r],e),a.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);t!=-1?(n.splice(t,1),n._serverBackup.splice(t,1),n._setServerUpdateMode()):(t=r.findIndexById(n._serverBackup,e),t!=-1&&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=a.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=a.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}]),a.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}]),a.factory("$meteorCollection",["AngularMeteorCollection","$rootScope","diffArray",function(e,t,r){function n(t,n,o,a){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=i.default.bind(t.find,t)),n=!angular.isDefined(n)||n,a=a||r,new e(t,o,a,n)}return n}]),a.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,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var o=r(2),i=n(o),a=angular.module("angular-meteor.object",["angular-meteor.utils","angular-meteor.subscribe","angular-meteor.collection","getUpdates","diffArray","angular-meteor.settings"]);a.factory("AngularMeteorObject",["$q","$meteorSubscribe","$meteorUtils","diffArray","getUpdates","AngularMeteorCollection","$angularMeteorSettings",function(e,t,r,n,o,a,u){function s(e,t,r){u.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=i.default.isFunction(n)?Object.create(n.prototype):{},l=e.findOne(t,r),c=i.default.pick(a,"_updateParallel");return i.default.extend(o,l),i.default.extend(o,s),i.default.extend(o,c),o.$$options=i.default.omit(r,"skip","limit"),o.$$collection=e,o.$$id=o._getId(t),o._serverBackup=l||{},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(i.default.omit(this,this.$$internalProps))},s.subscribe=function(){return t.subscribe.apply(this,arguments),this},s.save=function(t){var n,a=e.defer(),u=this.$$collection,s=i.default.partial(r.fulfill,a,null),l=u.findOne(this.$$id);if(l){if(t)n={$set:t};else if(n=o(l,this.getRawObject()),i.default.isEmpty(n))return e.when({action:"updated"});this._updateDiff(n,s({action:"updated"}))}else n=t?i.default.clone(t):this.getRawObject(),n._id=n._id||this.$$id,u.insert(n,s({action:"inserted"}));return a.promise},s._updateDiff=function(e,t){var r=this.$$id;a._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 a,u=i.default.keys(o),s=i.default.pick(o,u);i.default.extend(t,s),i.default.extend(t._serverBackup,s),a=e?i.default.intersection(i.default.keys(t),i.default.keys(t._serverBackup)):i.default.keys(t);var l=i.default.keys(o),c=i.default.difference(a,l,t.$$internalProps);c.forEach(function(e){delete t[e],delete t._serverBackup[e]})}else i.default.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=i.default.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:i.default.isString(e)?e:new Mongo.ObjectID},s}]),a.factory("$meteorObject",["$rootScope","$meteorUtils","getUpdates","AngularMeteorObject",function(e,t,r,n){function o(e,t,r,a){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 u=new n(e,t,a);return u._auto=r!==!1,i.default.extend(u,o),u._setAutos(),u}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.stop()})},o}]),a.run(["$rootScope","$meteorObject","$meteorStopper",function(e,t,r){var n=Object.getPrototypeOf(e);n.$meteorObject=r(t)}])},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var o=r(2),i=n(o),a=angular.module("angular-meteor.user",["angular-meteor.utils","angular-meteor.core","angular-meteor.settings"]);a.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")}}]),a.run(["$rootScope","$angularMeteorSettings","$$Core",function(e,t,r){var n=Object.getPrototypeOf(e);i.default.extend(n,r),e.autorun(function(){Meteor.user&&(e.currentUser=Meteor.user(),e.loggingIn=Meteor.loggingIn())})}])},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var o=r(2),i=n(o),a=angular.module("angular-meteor.methods",["angular-meteor.utils","angular-meteor.settings"]);a.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),a=i.default.toArray(arguments).concat(o);return Meteor.call.apply(this,a),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),u=a.assign;e.autorun(o,function(){u(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,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.name=void 0;var o=r(2),i=n(o),a=t.name="angular-meteor.utilities",u=t.utils="$$utils";angular.module(a,[]).service(u,["$rootScope",function(e){function t(e,t,r){return function(){for(var n=arguments.length,o=Array(n),i=0;i<n;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 i.default.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.isViewModel=function(e){return i.default.isObject(e)&&e.$$dependencies},this.areSiblings=function(e,t){return i.default.isObject(e)&&i.default.isObject(t)&&Object.getPrototypeOf(e)===Object.getPrototypeOf(t)},this.bind=function(e,n,o){return o=i.default.isFunction(o)?o:angular.noop,i.default.isFunction(e)?t(e,n,o):i.default.isObject(e)?r(e,n,o):e}}])},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.Mixer=t.name=void 0;var i=r(2),a=n(i),u=t.name="angular-meteor.mixer",s=t.Mixer="$Mixer";angular.module(u,[]).service(s,function(){var e=this,t=void 0;this._mixins=[],this._autoExtend=[],this._autoConstruct=[],this.mixin=function(t){if(!a.default.isObject(t))throw Error("argument 1 must be an object");return e._mixins=a.default.union(e._mixins,[t]),e._autoExtend.forEach(function(t){return e._extend(t)}),e._autoConstruct.forEach(function(t){return e._construct(t)}),e},this._mixout=function(t){return e._mixins=a.default.without(e._mixins,t),e},this._construct=function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return e._mixins.filter(a.default.isFunction).forEach(function(e){e.call.apply(e,[t].concat(n))}),t},this._extend=function(r,n){var i=a.default.defaults({},n,{pattern:/.*/}),u=i.pattern,s=i.context,l=e._mixins.map(function(e){var r=a.default.keys(e).filter(function(e){return e.match(u)}).filter(function(t){return a.default.isFunction(e[t])});return r.reduce(function(r,n){var o=e[n];return r[n]=function(){var e=s||this,r=t;t=this;try{for(var n=arguments.length,i=Array(n),a=0;a<n;a++)i[a]=arguments[a];return o.apply(e,i)}finally{t=r}},r},{})});return a.default.extend.apply(a.default,[r].concat(o(l)))},Object.defineProperty(this,"caller",{configurable:!0,enumerable:!0,get:function(){return t}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.name=void 0;var n=r(17),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){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.Core=t.name=void 0;var i=r(2),a=n(i),u=r(16),s=r(17),l=t.name="angular-meteor.core",c=t.Core="$$Core";angular.module(l,[u.name,s.name]).factory(c,["$q",u.utils,s.Mixer,function(e,t,r){function n(){}return n.autorun=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e=this.$bindToContext(r.caller,e),!a.default.isFunction(e))throw Error("argument 1 must be a function");if(!a.default.isObject(t))throw Error("argument 2 must be an object");var n=Tracker.autorun(e,t);return n.stop=this.$$autoStop(n),n},n.subscribe=function(e,t,n){t=this.$bindToContext(r.caller,t||angular.noop),n=n?this.$bindToContext(r.caller,n):angular.noop;var i={onStart:angular.noop};if(!a.default.isString(e))throw Error("argument 1 must be a string");if(!a.default.isFunction(t))throw Error("argument 2 must be a function");if(!a.default.isFunction(n)&&!a.default.isObject(n))throw Error("argument 3 must be a function or an object");if(a.default.isObject(n))for(var u in i)i.hasOwnProperty(u)&&n[u]&&(i[u]=n[u],delete n[u]);var s={},l=this.autorun(function(){var r,u=t();if(angular.isUndefined(u)&&(u=[]),!a.default.isArray(u))throw Error("reactive function's return value must be an array");var l=(r=Meteor).subscribe.apply(r,[e].concat(o(u),[n]));i.onStart(),s.ready=l.ready.bind(l),s.subscriptionId=l.subscriptionId});return s.stop=l.stop.bind(l),s},n.callMethod=function(){for(var e,t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];var i=n.pop();return a.default.isFunction(i)&&(i=this.$bindToContext(r.caller,i)),(e=Meteor).call.apply(e,n.concat([i]))},n.applyMethod=function(){for(var e,t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];var i=n.pop();return a.default.isFunction(i)&&(i=this.$bindToContext(r.caller,i)),(e=Meteor).apply.apply(e,n.concat([i]))},n.$$autoStop=function(e){var t=void 0,r=e.stop.bind(e),n=function(){return t(),r.apply(void 0,arguments)};return t=this.$on("$destroy",n),n},n.$$throttledDigest=function(){var e=this,t=!this.$$destroyed&&!this.$$phase&&!this.$root.$$phase;t&&Tracker.nonreactive(function(){return e.$digest()})},n.$$defer=function(){var t=e.defer();return t.promise=t.promise.finally(this.$$throttledDigest.bind(this)),t},n.$bindToContext=function(e,r){return a.default.isFunction(e)&&(r=e,e=this), t.bind(r,e,this.$$throttledDigest.bind(this))},n}])},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.reactive=t.ViewModel=t.name=void 0;var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(2),u=n(a),s=r(16),l=r(17),c=r(19),f=t.name="angular-meteor.view-model",d=t.ViewModel="$$ViewModel",p=t.reactive="$reactive";angular.module(f,[s.name,l.name,c.name]).factory(d,[s.utils,l.Mixer,function(e,t){function r(){}return r.viewModel=function(e){if(!u.default.isObject(e))throw Error("argument 1 must be an object");return t._extend(e,{pattern:/^(?!\$\$).*$/,context:this}),t._construct(this,e),e},r}]).service(p,[s.utils,function(e){var t=function(){function t(e){var r=this;if(o(this,t),!u.default.isObject(e))throw Error("argument 1 must be an object");u.default.defer(function(){r._attached||console.warn("view model was not attached to any scope")}),this._vm=e}return i(t,[{key:"attach",value:function(t){if(this._attached=!0,!e.isScope(t))throw Error("argument 1 must be a scope");var r=t.viewModel(this._vm);return r.call=r.callMethod,r.apply=r.applyMethod,r}}]),t}();return function(e){return new t(e)}}])},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Reactive=t.name=void 0;var o=r(22),i=n(o),a=r(2),u=n(a),s=r(16),l=r(17),c=r(19),f=r(20),d=t.name="angular-meteor.reactive",p=t.Reactive="$$Reactive";angular.module(d,[s.name,l.name,c.name,f.name]).factory(p,["$parse",s.utils,l.Mixer,function(e,t,r){function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;e.$$dependencies={}}return n.helpers=function(e,n){var o=this;if(t.isViewModel(e)){if(!u.default.isObject(n))throw Error("argument 2 must be an object")}else if(n=e,e=r.caller,!u.default.isObject(n))throw Error("argument 1 must be an object");u.default.each(n,function(e,t){if(!u.default.isFunction(e))throw Error("helper '"+t+"' must be a function")}),u.default.each(n,function(t,r){e.$$dependencies[r]||(e.$$dependencies[r]=new Tracker.Dependency),o.$$setFnHelper(e,r,t)})},n.getReactively=function(e,n,o){if(t.isViewModel(e)){if(angular.isUndefined(o)&&(o=!1),!u.default.isString(n))throw Error("argument 2 must be a string");if(!u.default.isBoolean(o))throw Error("argument 3 must be a boolean")}else{if(o=!!angular.isDefined(n)&&n,n=e,e=r.caller,!u.default.isString(n))throw Error("argument 1 must be a string");if(!u.default.isBoolean(o))throw Error("argument 2 must be a boolean")}return this.$$reactivateEntity(e,n,this.$watch,o)},n.getCollectionReactively=function(e,n){if(t.isViewModel(e)){if(!u.default.isString(n))throw Error("argument 2 must be a string")}else if(n=e,e=r.caller,!u.default.isString(n))throw Error("argument 1 must be a string");return this.$$reactivateEntity(e,n,this.$watchCollection)},n.$$reactivateEntity=function(t,r,n){if(!t.$$dependencies[r]){t.$$dependencies[r]=new Tracker.Dependency;for(var o=arguments.length,i=Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];this.$$watchEntity.apply(this,[t,r,n].concat(i))}return t.$$dependencies[r].depend(),e(r)(t)},n.$$watchEntity=function(t,r,n){for(var o=this,i=u.default.partial(e(r),t),a=i(),s=arguments.length,l=Array(s>3?s-3:0),c=3;c<s;c++)l[c-3]=arguments[c];n.call.apply(n,[this,i,function(e,n){var i=e!==a||e!==n;i&&o.$$changed(t,r)}].concat(l))},n.$$setFnHelper=function(e,r,n){var o=this,a=null,u=null,s=[];this.autorun(function(){var l=n.apply(e);Tracker.nonreactive(function(){if(t.isCursor(l)){var n=void 0;angular.isUndefined(e[r])&&o.$$setValHelper(e,r,[],!1),a&&(s=u.fetch(),a.stop(),a=null);var c=o.$$handleCursor(e,r,l);if(a=c.observation,n=c.data,0!==s.length){var f=i.default.diff(s,n);e[r]=i.default.patch(s,f)}else e[r]=n;u=l,s=n}else o.$$handleNonCursor(e,r,l);o.$$changed(e,r)})})},n.$$setValHelper=function(e,t,r){var n=this,o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(o){var i=u.default.isObject(r);this.getReactively(e,t,i)}Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:function(){return r},set:function(o){r=o,n.$$changed(e,t)}})},n.$$handleCursor=function(e,t,r){var n=this,o=[],a=r.observe({addedAt:function(r,i){return a?(e[t].splice(i,0,r),void n.$$changed(e,t)):void o.push(r)},changedAt:function(r,o,a){var u=i.default.diff(e[t][a],r);i.default.patch(e[t][a],u),n.$$changed(e,t)},movedTo:function(r,o,i){e[t].splice(o,1),e[t].splice(i,0,r),n.$$changed(e,t)},removedAt:function(r,o){e[t].splice(o,1),n.$$changed(e,t)}});return{observation:a,data:o}},n.$$handleNonCursor=function(e,r,n){var o=e[r];if(angular.isDefined(o)&&(delete e[r],o=null),angular.isUndefined(o))this.$$setValHelper(e,r,n);else if(t.areSiblings(o,n)){var a=i.default.diff(o,n);i.default.patch(o,a),this.$$changed(e,r)}else e[r]=n},n.$$depend=function(e,t){e.$$dependencies[t].depend()},n.$$changed=function(e,t){this.$$throttledDigest(),e.$$dependencies[t].changed()},n}])},function(e,r){e.exports=t},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=t.name="angular-templates";try{angular.module(r)}catch(e){angular.module(r,[])}}])}); //# sourceMappingURL=angular-meteor.min.js.map