text: !function(a){var b,c;!function(){var a={},d={};b=function(b,c,d){a[b]={deps:c,callback:d}},c=function(b){function e(a){if("."!==a.charAt(0))return a;for(var c=a.split("/"),d=b.split("/").slice(0,-1),e=0,f=c.length;f>e;e++){var g=c[e];if(".."===g)d.pop();else{if("."===g)continue;d.push(g)}}return d.join("/")}if(d[b])return d[b];if(d[b]={},!a[b])throw new Error("Could not find module "+b);for(var f,g=a[b],h=g.deps,i=g.callback,j=[],k=0,l=h.length;l>k;k++)"exports"===h[k]?j.push(f={}):j.push(c(e(h[k])));var m=i.apply(this,j);return d[b]=f||m},c.entries=a}(),b("ember-share",["ember-share/mixins/share-text","ember-share/models/share-proxy","ember-share/models/share-array","ember-share/store","ember-share/utils","ember-share/attr","exports"],function(a,b,c,d,e,f,g){"use strict";var h=a["default"],i=b["default"],j=c["default"],k=d["default"],l=e["default"],m=f["default"];g.attr=m,g.ShareTextMixin=h,g.ShareProxy=i,g.ShareArray=j,g.Store=k,g.Utils=l}),b("ember-share/attr",["exports"],function(a){"use strict";a["default"]=function(){var a,b;return a={},b=null,_.forEach(arguments,function(c){return _.isPlainObject(c)?a=c:_.isString(c)?b=null:void 0}),Ember.computed({get:function(b){var c;return this.get(null!=(c="doc.data."+b)?c:Ember.get(a,"defaultValue"))},set:function(a,c,d){var e;return null!=b&&(c=window[b.toUpperCase(b)](c)),e=this.get(a),a=a.split("."),this.get("doc").submitOp([{p:a,od:e,oi:c}]),c}})}}),b("ember-share/mixins/share-text",["../utils","exports"],function(a,b){"use strict";var c=(a.isArray,a.diff);b["default"]=Ember.Mixin.create({textKeys:[],triggerEvents:!1,textEvents:function(){this._textContexts=new Array(this.textKeys.length),this._handlers=new Array(2*this._textContexts.length);for(var a=0;a<this.textKeys.length;a++){var b=this.textKeys[a],c=this._context.createContextAt([b]);this._handlers[b]=new Array(2),this._handlers[b].push(c.on("insert",Ember.run.bind(this,this.handleInsert,b))),this._handlers[b].push(c.on("delete",Ember.run.bind(this,this.handleDelete,b))),this._textContexts[b]=c}}.on("init"),setUnknownProperty:function(a,b){this.textKeys.indexOf(a)>=0?this.textOp(a,b):this._super(a,b)},textOp:function(a,b){if(void 0!==this._context.get()){this.propertyWillChange(a);var d=c.diff(this._cache[a]||"",b.replace(/\r\n/g,"\n"));this._cache[a]=b.replace(/\r\n/g,"\n");for(var e=0,f=0;f<d.length;f++)d[f].added?this._context.insert([a,e],d[f].value):d[f].removed&&this._context.remove([a,e],d[f].value.length),e+=d[f].value.length;this.propertyDidChange(a)}},handleInsert:function(a,b,c){this.propertyWillChange(a),void 0===this._cache[a]&&this.get(a);var d=this._cache[a].slice(0,b)+c+this._cache[a].slice(b);this._cache[a]=d,this.triggerEvents&&this.trigger("textInsert",b,c),this.propertyDidChange(a)},handleDelete:function(a,b,c){void 0===this._cache[a]&&this.get(a),this.propertyWillChange(a);var d=c.length,e=this._cache[a].slice(0,b)+this._cache[a].slice(b+d);this._cache[a]=e,this.triggerEvents&&this.trigger("textDelete",b,c),this.propertyDidChange(a)},willDestroy:function(){for(var a in this._textContexts)this._textContexts[a].removeListener(this._handlers[a][0]),this._textContexts[a].removeListener(this._handlers[a][1]),this._textContexts[a].destroy();this._super()}})}),b("ember-share/models/share-array",["./share-proxy","exports"],function(a,b){"use strict";a["default"];b["default"]=Ember.Object.extend(Ember.MutableArray,{_context:null,_cache:null,itemType:"share-proxy",init:function(){this._cache=[],this._factory=this.container.lookupFactory("model:"+this.itemType);var a=this;this._context.on("delete",function(b,c){a.arrayContentWillChange(b,1,0),a._cache.splice(b,1);var d=a._context.path.length;a._cache.forEach(function(a,b){a._context.path[d]=b}),a.arrayContentDidChange(b,1,0)}),this._context.on("insert",function(b,c){a.arrayContentWillChange(b,0,1);var d=a._factory.create({_context:a._context.createContextAt(b)});a._cache.splice(b,0,d);var e=a._context.path.length;a._cache.forEach(function(a,b){a._context.path[e]=b}),a.arrayContentDidChange(b,0,1)})},length:function(){return this._context.get().length}.property()["volatile"](),objectAt:function(a){return void 0===this._cache[a]&&void 0!==this._context.get(a)&&(this._cache[a]=this._factory.create({_context:this._context.createContextAt(a)})),this._cache[a]},replace:function(a,b,c){var d=c.length,e=new Array(d+2);e[0]=a,e[1]=b,this.arrayContentWillChange(a,b,d),b>0&&this._context.remove([a],b);for(var f=0;d>f;f++)this._context.insert([a+f],c[f]),e[2+f]=this._factory.create({id:c[f].id,_context:this._context.createContextAt(a+f)});this._cache.splice.apply(this._cache,e),this.arrayContentDidChange(a,b,d)},toJSON:function(){return this._context.get()}})}),b("ember-share/models/share-proxy",["exports"],function(a){"use strict";var b=function(a){return null!=a.ld||null!=a.lm||null!=a.li},c=function(a){return{idx:_.last(a.p),p:_.slice(a.p,0,a.p.length-1).join("."),addAmt:null!=a.li?1:0,removeAmt:null!=a.ld?1:0}};a["default"]=Ember.Object.extend({unload:function(){return this.get("_store").unload(this.get("_type"),this)},setOpsInit:function(){var a,d=this,e=function(a){return function(e,f){f||_.forEach(e,function(e){if(b(e)){var f=c(e);d.get(f.p)["arrayContent"+a+"Change"](f.idx,f.removeAmt,f.addAmt)}else d["property"+a+"Change"](e.p.join("."))})}};a=this.get("doc"),a.on("before op",e("Will")),a.on("op",e("Did"))}.on("init")})}),b("ember-share/store",["./utils","exports"],function(a,b){"use strict";var c=a.guid,d=a.patchShare,e=Ember.RSVP.Promise;b["default"]=Ember.Object.extend({socket:null,connection:null,url:window.location.hostname,init:function(){this.checkConnection=Ember.Deferred.create({});var a=this;if(this.cache={},!window.sharedb)throw new Error("sharedb client not included");if(void 0===window.BCSocket&&void 0===window.Primus)throw new Error("No Socket library included");this.beforeConnect?this.beforeConnect().then(function(){Ember.sendEvent(a,"connect")}):Ember.sendEvent(this,"connect")},doConnect:function(a){var b=this;if(window.BCSocket)this.setProperties(a),this.socket=new BCSocket(this.get("url"),{reconnect:!0}),this.socket.onerror=function(a){Ember.sendEvent(b,"connectionError",[a])},this.socket.onopen=function(){b.checkConnection.resolve(),Ember.sendEvent(b,"connectionOpen")},this.socket.onclose=function(){Ember.sendEvent(b,"connectionEnd")};else{if(!window.Primus)throw new Error("No Socket library included");d(),this.setProperties(a);var c=this.get("url");this.get("protocol")&&(c=this.get("protocol")+"://"+c),this.get("port")&&(c+=":"+this.get("port")),this.socket=new Primus(c),this.socket.on("error",function(a){Ember.sendEvent(b,"connectionError",[a])}),this.socket.on("open",function(){b.checkConnection.resolve(),Ember.sendEvent(b,"connectionOpen")}),this.socket.on("end",function(){Ember.sendEvent(b,"connectionEnd")})}this.connection=new sharedb.Connection(this.socket)}.on("connect"),find:function(a,b){a=a.pluralize();var c=this;return this.checkConnection.then(function(){return c.findQuery(a,{_id:b}).then(function(a){return a[0]},function(a){return a})})},createRecord:function(a,b){a=a.pluralize();var d=this;return d.checkConnection.then(function(){var f=d.connection.get(a,c());return e.all([d.whenReady(f).then(function(a){return d.create(a,b)}),d.subscribe(f)]).then(function(){var b=d._createModel(a,f);return d._cacheFor(a).addObject(b),b})})},deleteRecord:function(a){},findAndSubscribeQuery:function(a,b){a=a.pluralize();var c=this;return c.cache[a]=[],this.checkConnection.then(function(){return new e(function(d,e){function f(b,f,g){return null!==b?e(b):void d(c._resolveModels(a,f))}b=c.connection.createSubscribeQuery(a,b,null,f),b.on("insert",function(b){c._resolveModels(a,b)}),b.on("remove",function(b){for(var d=0;d<b.length;d++){var e=c._resolveModel(a,b[d]);e.then(function(b){c.unload(a,b)})}})})})},findQuery:function(a,b){a=a.pluralize();var c=this;return c.cache[a]=[],this.checkConnection.then(function(){return new e(function(d,e){function f(b,f,g){return null!==b?e(b):void d(c._resolveModels(a,f))}c.connection.createFetchQuery(a,b,null,f)})})},findAll:function(a,b){throw a=a.pluralize(),new Error("findAll not implemented")},_cacheFor:function(a){a=a.pluralize();var b=this.cache[a];return void 0===b&&(this.cache[a]=b=[]),b},_factoryFor:function(a){return this.container.lookupFactory("model:"+a.singularize())},_createModel:function(a,b){var c=this._factoryFor(a);if(a=a.pluralize(),c){var d=c.create({id:b.id,doc:b,_type:a,_store:this});return d}throw new Error("Cannot find model for "+a)},_resolveModel:function(a,b){var c=this._cacheFor(a.pluralize()),d=Ember.get(b,"id")||Ember.get(b,"_id"),f=c.findBy("id",d);if(void 0!==f)return e.resolve(f);var g=this;return g.subscribe(b).then(function(b){return g._createModel(a,b)})},_resolveModels:function(a,b){a=a.pluralize();for(var c=this._cacheFor(a),d=new Array(b.length),f=0;f<b.length;f++)d[f]=this._resolveModel(a,b[f]);return new e(function(a,b){e.all(d).then(function(b){c.addObjects(b),a(c)})["catch"](function(a){b(a)})})},whenReady:function(a){return"ready"===a.state?e.resolve(a):new e(function(b,c){a.on("load",function(){Ember.run(null,b,a)})})},unload:function(a,b){a=a.pluralize();var c=this._cacheFor(a);c.removeObject(b)},peekAll:function(a){return a=a.pluralize(),this._cacheFor(a)},subscribe:function(a){return a.subscribed?e.resolve(a):new e(function(b,c){a.subscribe(function(d){void 0===d?Ember.run(null,b,a):Ember.run(null,c,d)})})},create:function(a,b){return new e(function(c,d){a.create(b,"json0",function(b){void 0===b?Ember.run(null,c,a):Ember.run(null,d,b)})})}})}),b("ember-share/utils",["exports"],function(a){"use strict";function b(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})}function c(a){return{newPos:a.newPos,components:a.components.slice(0)}}function d(){var a={};a[window.Primus.CLOSED]="disconnected",a[window.Primus.OPENING]="connecting",a[window.Primus.OPEN]="connected",window.sharedb.Connection.prototype.bindToSocket=function(b){function c(b){var c=a[b];d._setState(c)}var d=this;this.state=0===b.readyState||1===b.readyState?"connecting":"disconnected",c(Primus.OPENING),c(b.readyState),this.canSend="connected"===this.state,this.socket={send:function(a){b.write(a)}},b.on("data",function(a){if(a.a)try{d.handleMessage(a)}catch(b){throw d.emit("error",b),b}}),b.on("readyStateChange",function(){c(b.readyState)}),b.on("reconnecting",function(){"disconnected"===d.state&&(c(Primus.OPENING),d.canSend=!1)})}}var e=function(a){this.ignoreWhitespace=a};e.prototype={diff:function(a,b){if(b===a)return[{value:b}];if(!b)return[{value:a,removed:!0}];if(!a)return[{value:b,added:!0}];b=this.tokenize(b),a=this.tokenize(a);var d=b.length,e=a.length,f=d+e,g=[{newPos:-1,components:[]}],h=this.extractCommon(g[0],b,a,0);if(g[0].newPos+1>=d&&h+1>=e)return g[0].components;for(var i=1;f>=i;i++)for(var j=-1*i;i>=j;j+=2){var k,l=g[j-1],m=g[j+1];h=(m?m.newPos:0)-j,l&&(g[j-1]=void 0);var n=l&&l.newPos+1<d,o=m&&h>=0&&e>h;if(n||o){if(!n||o&&l.newPos<m.newPos?(k=c(m),this.pushComponent(k.components,a[h],void 0,!0)):(k=c(l),k.newPos++,this.pushComponent(k.components,b[k.newPos],!0,void 0)),h=this.extractCommon(k,b,a,j),k.newPos+1>=d&&h+1>=e)return k.components;g[j]=k}else g[j]=void 0}},pushComponent:function(a,b,c,d){var e=a[a.length-1];e&&e.added===c&&e.removed===d?a[a.length-1]={value:this.join(e.value,b),added:c,removed:d}:a.push({value:b,added:c,removed:d})},extractCommon:function(a,b,c,d){for(var e=b.length,f=c.length,g=a.newPos,h=g-d;e>g+1&&f>h+1&&this.equals(b[g+1],c[h+1]);)g++,h++,this.pushComponent(a.components,b[g],void 0,void 0);return a.newPos=g,h},equals:function(a,b){var c=/\S/;return!this.ignoreWhitespace||c.test(a)||c.test(b)?a===b:!0},join:function(a,b){return a+b},tokenize:function(a){return a}};var f=Array.isArray||function(a){return a instanceof Array},g=new e(!1);a.guid=b,a.diff=g,a.isArray=f,a.patchShare=d}),a.EmberShare=c("ember-share")}(window);