text: (function(e,n){typeof exports==="object"&&typeof module!=="undefined"?module.exports=n():typeof define==="function"&&define.amd?define(n):e.Ractive.adaptors.Backbone=n()})(this,function(){"use strict";var e="_ractiveAdaptorsBackboneLock";function n(n){n[e]=(n[e]||0)+1;return function t(){n[e]-=1;if(!n[e]){delete n[e]}}}function t(n){return!!n[e]}var o={Backbone:typeof window!=="undefined"&&window.Backbone||null,filter:function c(e){if(!o.Backbone){throw new Error("Could not find Backbone. You must call adaptor.init(Backbone) - see http://TKTKTK.com for more information")}return e instanceof o.Backbone.Model||e instanceof o.Backbone.Collection},wrap:function f(e,n,t,r){if(n instanceof o.Backbone.Model){return new i(e,n,t,r)}return new a(e,n,t,r)}};function i(e,t,o,i){this.value=t;t.on("change",this.modelChangeHandler=function(){var o=n(t);e.set(i(t.changed));o()})}i.prototype={teardown:function u(){this.value.off("change",this.modelChangeHandler)},get:function s(){return this.value.toJSON()},set:function l(e,n){if(!t(this.value)&&e.indexOf(".")===-1){this.value.set(e,n)}},reset:function d(e){if(e instanceof o.Backbone.Model||!(e instanceof Object)){return false}this.value.set(e)}};function a(e,t,o){this.value=t;t.on("add remove reset sort",this.changeHandler=function(){var i=n(t);e.set(o,t.models);i()})}a.prototype={teardown:function h(){this.value.off("add remove reset sort",this.changeHandler)},get:function v(){return this.value.models},reset:function p(e){if(t(this.value)){return}if(e instanceof o.Backbone.Collection||Object.prototype.toString.call(e)!=="[object Array]"){return false}this.value.reset(e)}};var r=o;return r});