//>>built
define("dojox/mvc/sync",["dojo/_base/lang","dojo/_base/config","dojo/_base/array","dojo/has"],function(e,u,z,k){function v(a,d,b,c,g,h,m,w,l,r){if(!(b(l,w)||"*"==g&&0>z.indexOf(c.get("properties")||[m],m)||"*"==g&&m in(r||{}))){b="*"==g?m:g;k("mvc-bindings-log-api")&&B(c,b,h,m);try{l=a?a(l,d):l}catch(q){k("mvc-bindings-log-api");return}k("mvc-bindings-log-api");e.isFunction(c.set)?c.set(b,l):c[b]=l}}var t=e.getObject("dojox.mvc",!0);k.add("mvc-bindings-log-api",(u.mvc||{}).debugBindings);var B=k("mvc-bindings-log-api")?
function(a,d,b,c){return[[b.canConvertToLoggable||!b.declaredClass?b:b.declaredClass,c].join(":"),[a.canConvertToLoggable||!a.declaredClass?a:a.declaredClass,d].join(":")]}:"";u={from:1,to:2,both:3};var C=function(a,d,b,c,g){var h=(g||{}).converter;if(h){var m={source:a,target:b};var w=h.format&&e.hitch(m,h.format);var l=h.parse&&e.hitch(m,h.parse)}var r=[],q=[],x=e.mixin({},a.constraints,b.constraints);h=(g||{}).bindDirection||t.both;var y=(g||{}).equals||C.equals;k("mvc-bindings-log-api")&&B(a,
d,b,c);if("*"==c){if("*"!=d)throw Error("Unmatched wildcard is specified between source and target.");g=b.get("properties");if(!g){g=[];for(var n in b)b.hasOwnProperty(n)&&"_watchCallbacks"!=n&&g.push(n)}q=b.get("excludes")}else g=[d];h&t.from&&(e.isFunction(a.set)&&e.isFunction(a.watch)?r.push(a.watch.apply(a,("*"!=d?[d]:[]).concat([function(f,p,A){v(w,x,y,b,c,a,f,p,A,q)}]))):k("mvc-bindings-log-api"),z.forEach(g,function(f){if("*"!=c||!(f in(q||{}))){var p=e.isFunction(a.get)?a.get(f):a[f];v(w,
x,y,b,"*"==c?f:c,a,f,void 0,p)}}));h&t.to&&(h&t.from||z.forEach(g,function(f){if("*"!=c||!(f in(q||{}))){var p=e.isFunction(b.get)?b.get(c):b[c];v(l,x,y,a,f,b,"*"==c?f:c,void 0,p)}}),e.isFunction(b.set)&&e.isFunction(b.watch)?r.push(b.watch.apply(b,("*"!=c?[c]:[]).concat([function(f,p,A){v(l,x,y,a,d,b,f,p,A,q)}]))):k("mvc-bindings-log-api"));k("mvc-bindings-log-api");n={};n.unwatch=n.remove=function(){for(var f=null;f=r.pop();)f.unwatch();k("mvc-bindings-log-api")};return n};e.mixin(t,u);return e.setObject("dojox.mvc.sync",
e.mixin(C,{equals:function(a,d){return a===d||"number"==typeof a&&isNaN(a)&&"number"==typeof d&&isNaN(d)||e.isFunction((a||{}).getTime)&&e.isFunction((d||{}).getTime)&&a.getTime()==d.getTime()||(e.isFunction((a||{}).equals)?a.equals(d):e.isFunction((d||{}).equals)?d.equals(a):!1)}},u))});