freeswitch/htdocs/portal/assets/js/ember-data.min.js

16 lines
75 KiB
JavaScript
Raw Normal View History

// ==========================================================================
// Project: Ember Data
// Copyright: ©2011-2012 Tilde Inc. and contributors.
// Portions ©2011 Living Social Inc. and contributors.
// License: Licensed under MIT license (see license.js)
// ==========================================================================
// Version: v0.14
// Last commit: d9cd270 (2013-08-31 17:12:14 -0700)
!function(){var e,t;!function(){var r={},n={};e=function(e,t,n){r[e]={deps:t,callback:n}},t=function(e){if(n[e])return n[e];n[e]={};var i,a,o,s,c;if(i=r[e],!i)throw new Error("Module '"+e+"' not found.");a=i.deps,o=i.callback,s=[];for(var d=0,u=a.length;u>d;d++)"exports"===a[d]?s.push(c={}):s.push(t(a[d]));var h=o.apply(this,s);return n[e]=c||h}}(),function(){"undefined"==typeof DS&&(DS=Ember.Namespace.create({VERSION:"0.14"}),"undefined"!=typeof window&&(window.DS=DS))}(),function(){var e=Ember.get;Ember.set,DS.NewJSONSerializer=Ember.Object.extend({deserialize:function(t,r){return e(this,"store"),t.eachRelationship(function(e,t){var n=t.type,i=r[e];null!=i&&("belongsTo"===t.kind?this.deserializeRecordId(r,e,n,i):"hasMany"===t.kind&&this.deserializeRecordIds(r,e,n,i))},this),r},deserializeRecordId:function(t,r,n,i){("number"==typeof i||"string"==typeof i)&&(t[r]=e(this,"store").recordFor(n,i))},deserializeRecordIds:function(e,t,r,n){for(var i=0,a=n.length;a>i;i++)this.deserializeRecordId(n,i,r,n[i])}})}(),function(){if(Ember.DataAdapter){var e=Ember.get,t=Ember.String.capitalize,r=Ember.String.underscore,n=window.DS;n.DebugAdapter=Ember.DataAdapter.extend({getFilters:function(){return[{name:"isNew",desc:"New"},{name:"isModified",desc:"Modified"},{name:"isClean",desc:"Clean"}]},detect:function(e){return e!==n.Model&&n.Model.detect(e)},columnsForType:function(n){var i=[{name:"id",desc:"Id"}],a=0,o=this;return Ember.A(e(n,"attributes")).forEach(function(e){if(a++>o.attributeLimit)return!1;var n=t(r(e).replace("_"," "));i.push({name:e,desc:n})}),i},getRecords:function(e){return this.get("store").all(e)},getRecordColumnValues:function(t){var r=this,n=0,i={id:e(t,"id")};return t.eachAttribute(function(a){if(n++>r.attributeLimit)return!1;var o=e(t,a);i[a]=o}),i},getRecordKeywords:function(t){var r=[],n=Ember.A(["id"]);return t.eachAttribute(function(e){n.push(e)}),n.forEach(function(n){r.push(e(t,n))}),r},getRecordFilterValues:function(e){return{isNew:e.get("isNew"),isModified:e.get("isDirty")&&!e.get("isNew"),isClean:!e.get("isDirty")}},getRecordColor:function(e){var t="black";return e.get("isNew")?t="green":e.get("isDirty")&&(t="blue"),t},observeRecord:function(e,t){var r=Ember.A(),n=this,i=Ember.A(["id","isNew","isDirty"]);e.eachAttribute(function(e){i.push(e)}),i.forEach(function(i){var a=function(){t(n.wrapRecord(e))};Ember.addObserver(e,i,a),r.push(function(){Ember.removeObserver(e,i,a)})});var a=function(){r.forEach(function(e){e()})};return a}})}}(),function(){Ember.set,Ember.onLoad("Ember.Application",function(e){e.initializer({name:"store",initialize:function(e,t){t.register("store:main",t.Store),t.register("serializer:_default",DS.NewJSONSerializer),e.lookup("store:main")}}),DS.DebugAdapter&&e.initializer({name:"dataAdapter",initialize:function(e,t){t.register("dataAdapter:main",DS.DebugAdapter)}}),e.initializer({name:"injectStore",initialize:function(e,t){t.inject("controller","store","store:main"),t.inject("route","store","store:main"),t.inject("dataAdapter","store","store:main")}})})}(),function(){Ember.Date=Ember.Date||{};var e=Date.parse,t=[1,4,5,6,7,10,11];Ember.Date.parse=function(r){var n,i,a=0;if(i=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(r)){for(var o,s=0;o=t[s];++s)i[o]=+i[o]||0;i[2]=(+i[2]||1)-1,i[3]=+i[3]||1,"Z"!==i[8]&&void 0!==i[9]&&(a=60*i[10]+i[11],"+"===i[9]&&(a=0-a)),n=Date.UTC(i[1],i[2],i[3],i[4],i[5]+a,i[6],i[7])}else n=e?e(r):0/0;return n},(Ember.EXTEND_PROTOTYPES===!0||Ember.EXTEND_PROTOTYPES.Date)&&(Date.parse=Ember.Date.parse)}(),function(){var e=Ember.Evented,t=Ember.DeferredMixin,r=(Ember.run,Ember.get),n=Ember.Mixin.create(e,t,{init:function(){this._super.apply(this,arguments),this.one("didLoad",this,function(){this.resolve(this)}),this.one("becameError",this,function(){this.reject(this)}),r(this,"isLoaded")&&this.trigger("didLoad")}});DS.LoadPromise=n}(),function(){var e=Ember.get;Ember.set;var t=DS.LoadPromise;DS.RecordArray=Ember.ArrayProxy.extend(t,{type:null,content:null,isLoaded:!1,isUp
}(),function(){function e(e,r,n){var i=t(e,"data"),a=i[n];return void 0===a&&(a="function"==typeof r.defaultValue?r.defaultValue():r.defaultValue),a}var t=Ember.get;DS.Model.reopenClass({attributes:Ember.computed(function(){var e=Ember.Map.create();return this.eachComputedProperty(function(t,r){r.isAttribute&&(r.name=t,e.set(t,r))}),e})}),DS.Model.reopen({eachAttribute:function(e,r){t(this.constructor,"attributes").forEach(function(t,n){e.call(r,t,n)},r)},attributeWillChange:Ember.beforeObserver(function(e,r){var n=t(e,"_reference"),i=t(e,"store");e.send("willSetProperty",{reference:n,store:i,name:r})}),attributeDidChange:Ember.observer(function(e,t){e.send("didSetProperty",{name:t})})}),DS.attr=function(t,r){r=r||{};var n={type:t,isAttribute:!0,options:r};return Ember.computed(function(t,n){return arguments.length>1||(n=e(this,r,t)),n}).property("data").meta(n)}}(),function(){var e=DS.AttributeChange=function(e){this.reference=e.reference,this.store=e.store,this.name=e.name,this.oldValue=e.oldValue};e.createChange=function(t){return new e(t)},e.prototype={sync:function(){this.store.recordAttributeDidChange(this.reference,this.name,this.value,this.oldValue),this.destroy()},destroy:function(){var e=this.reference.record;delete e._changesToSync[this.name]}}}(),function(){var e=Ember.get,t=Ember.set,r=Ember.EnumerableUtils.forEach;DS.RelationshipChange=function(e){this.parentReference=e.parentReference,this.childReference=e.childReference,this.firstRecordReference=e.firstRecordReference,this.firstRecordKind=e.firstRecordKind,this.firstRecordName=e.firstRecordName,this.secondRecordReference=e.secondRecordReference,this.secondRecordKind=e.secondRecordKind,this.secondRecordName=e.secondRecordName,this.changeType=e.changeType,this.store=e.store,this.committed={}},DS.RelationshipChangeAdd=function(e){DS.RelationshipChange.call(this,e)},DS.RelationshipChangeRemove=function(e){DS.RelationshipChange.call(this,e)},DS.RelationshipChange.create=function(e){return new DS.RelationshipChange(e)},DS.RelationshipChangeAdd.create=function(e){return new DS.RelationshipChangeAdd(e)},DS.RelationshipChangeRemove.create=function(e){return new DS.RelationshipChangeRemove(e)},DS.OneToManyChange={},DS.OneToNoneChange={},DS.ManyToNoneChange={},DS.OneToOneChange={},DS.ManyToManyChange={},DS.RelationshipChange._createChange=function(e){return"add"===e.changeType?DS.RelationshipChangeAdd.create(e):"remove"===e.changeType?DS.RelationshipChangeRemove.create(e):void 0},DS.RelationshipChange.determineRelationshipType=function(e,t){var r,n,i=t.key,a=t.kind,o=e.inverseFor(i);return o&&(r=o.name,n=o.kind),o?"belongsTo"===n?"belongsTo"===a?"oneToOne":"manyToOne":"belongsTo"===a?"oneToMany":"manyToMany":"belongsTo"===a?"oneToNone":"manyToNone"},DS.RelationshipChange.createChange=function(e,t,r,n){var i,a=e.type;return i=DS.RelationshipChange.determineRelationshipType(a,n),"oneToMany"===i?DS.OneToManyChange.createChange(e,t,r,n):"manyToOne"===i?DS.OneToManyChange.createChange(t,e,r,n):"oneToNone"===i?DS.OneToNoneChange.createChange(e,t,r,n):"manyToNone"===i?DS.ManyToNoneChange.createChange(e,t,r,n):"oneToOne"===i?DS.OneToOneChange.createChange(e,t,r,n):"manyToMany"===i?DS.ManyToManyChange.createChange(e,t,r,n):void 0},DS.OneToNoneChange.createChange=function(e,t,r,n){var i=n.key,a=DS.RelationshipChange._createChange({parentReference:t,childReference:e,firstRecordReference:e,store:r,changeType:n.changeType,firstRecordName:i,firstRecordKind:"belongsTo"});return r.addRelationshipChangeFor(e,i,t,null,a),a},DS.ManyToNoneChange.createChange=function(e,t,r,n){var i=n.key,a=DS.RelationshipChange._createChange({parentReference:e,childReference:t,secondRecordReference:e,store:r,changeType:n.changeType,secondRecordName:n.key,secondRecordKind:"hasMany"});return r.addRelationshipChangeFor(e,i,t,null,a),a},DS.ManyToManyChange.createChange=function(e,t,r,n){var i=n.key,a=DS.RelationshipChange._createChange({parentReference:t,childReference:e,firstRecordReference:e,secondRecordReference:t,firstRecordKind:"hasMany",secondRecordKind:"hasMany",store:r,changeType:n.changeType,firs
return e.forEach(function(e){n.shouldSave(e)&&t.add(e)}),t}var n=this;this.groupByType(t.created).forEach(function(t,n){this.createRecords(e,t,r(n))},this),this.groupByType(t.updated).forEach(function(t,n){this.updateRecords(e,t,r(n))},this),this.groupByType(t.deleted).forEach(function(t,n){this.deleteRecords(e,t,r(n))},this)},shouldSave:function(){return!0},createRecord:Ember.required(Function),createRecords:function(e,t,r){r.forEach(function(r){this.createRecord(e,t,r)},this)},updateRecord:Ember.required(Function),updateRecords:function(e,t,r){r.forEach(function(r){this.updateRecord(e,t,r)},this)},deleteRecord:Ember.required(Function),deleteRecords:function(e,t,r){r.forEach(function(r){this.deleteRecord(e,t,r)},this)},findMany:function(e,t,r){r.forEach(function(r){this.find(e,t,r)},this)}}),DS.Adapter.reopenClass({registerTransform:function(e,t){var r=this._registeredTransforms||{};r[e]=t,this._registeredTransforms=r},registerEnumTransform:function(e,t){var r=this._registeredEnumTransforms||{};r[e]=t,this._registeredEnumTransforms=r},map:DS._Mappable.generateMapFunctionFor("attributes",function(e,t,r){var i=r.get(e);n(i,t)}),configure:DS._Mappable.generateMapFunctionFor("configurations",function(e,t,r){var i=r.get(e),a=t&&t.mappings;a&&(this.map(e,a),delete t.mappings),n(i,t)}),resolveMapConflict:function(e,t){return n(t,e),t}})}(),function(){var e=Ember.get;Ember.set,DS.FixtureSerializer=DS.Serializer.extend({deserializeValue:function(e){return e},serializeValue:function(e){return e},addId:function(e,t,r){e[t]=r},addAttribute:function(e,t,r){e[t]=r},addBelongsTo:function(t,r,n,i){var a=e(r,i.key+".id");Ember.isNone(a)||(t[n]=a)},addHasMany:function(t,r,n,i){var a=e(r,i.key).map(function(e){return e.get("id")});t[i.key]=a},extract:function(e,t,r,n){n&&e.updateId(n,t),this.extractRecordRepresentation(e,r,t)},extractMany:function(e,t,r,n){var i=t,a=[];n&&(n=n.toArray());for(var o=0;o<i.length;o++){n&&e.updateId(n[o],i[o]);var s=this.extractRecordRepresentation(e,r,i[o]);a.push(s)}e.populateArray(a)},extractId:function(e,t){var r=this._primaryKey(e);return t.hasOwnProperty(r)?t[r]+"":null},extractAttribute:function(e,t,r){var n=this._keyForAttributeName(e,r);return t[n]},extractHasMany:function(e,t,r){return t[r]},extractBelongsTo:function(e,t,r){var n=t[r];return null!=n&&(n+=""),n},extractBelongsToPolymorphic:function(e,t,r){var n,i=this.keyForPolymorphicId(r),a=t[i];return a?(n=this.keyForPolymorphicType(r),{id:a,type:t[n]}):null},keyForPolymorphicId:function(e){return e},keyForPolymorphicType:function(e){return e+"_type"}})}(),function(){var e=Ember.get,t=Ember.String.fmt,r=Ember.EnumerableUtils.indexOf;DS.FixtureAdapter=DS.Adapter.extend({simulateRemoteResponse:!0,latency:50,serializer:DS.FixtureSerializer,fixturesForType:function(e){if(e.FIXTURES){var r=Ember.A(e.FIXTURES);return r.map(function(e){var r=typeof e.id;if("number"!==r&&"string"!==r)throw new Error(t("the id property must be defined as a number or string for fixture %@",[e]));return e.id=e.id+"",e})}return null},queryFixtures:function(){},updateFixtures:function(e,t){e.FIXTURES||(e.FIXTURES=[]);var r=e.FIXTURES;this.deleteLoadedFixture(e,t),r.push(t)},mockJSON:function(e,t){return this.serialize(t,{includeId:!0})},generateIdForRecord:function(e,t){return Ember.guidFor(t)},find:function(e,t,r){var n,i=this.fixturesForType(t);i&&(n=Ember.A(i).findProperty("id",r)),n&&this.simulateRemoteCall(function(){this.didFindRecord(e,t,n,r)},this)},findMany:function(e,t,n){var i=this.fixturesForType(t);i&&(i=i.filter(function(e){return-1!==r(n,e.id)})),i&&this.simulateRemoteCall(function(){this.didFindMany(e,t,i)},this)},findAll:function(e,t){var r=this.fixturesForType(t);this.simulateRemoteCall(function(){this.didFindAll(e,t,r)},this)},findQuery:function(e,t,r,n){var i=this.fixturesForType(t);i=this.queryFixtures(i,r,t),i&&this.simulateRemoteCall(function(){this.didFindQuery(e,t,i,n)},this)},createRecord:function(e,t,r){var n=this.mockJSON(t,r);this.updateFixtures(t,n),this.simulateRemoteCall(function(){this.didCreateRecord(e,t,r,n)},this)},updateRecord:function(e,t