/*
	Copyright (c) 2004-2016, The JS Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/

//>>built
define("dojo/_base/lang",["./kernel","../has","../sniff"],function(k,l){l.add("bug-for-in-skips-shadowed",function(){for(var a in{toString:1})return 0;return 1});var m=l("bug-for-in-skips-shadowed")?"hasOwnProperty valueOf isPrototypeOf propertyIsEnumerable toLocaleString toString constructor".split(" "):[],r=m.length,n=function(a,c,b){b||(b=a[0]&&k.scopeMap[a[0]]?k.scopeMap[a.shift()][1]:k.global);try{for(var d=0;d<a.length;d++){var f=a[d];if("__proto__"===f||"constructor"===f)return;if(!(f in b))if(c)b[f]=
{};else return;b=b[f]}return b}catch(g){}},p=Object.prototype.toString,q=function(a,c,b){return(b||[]).concat(Array.prototype.slice.call(a,c||0))},t=/\{([^\}]+)\}/g,e={_extraNames:m,_mixin:function(a,c,b){var d,f={};for(h in c){var g=c[h];h in a&&(a[h]===g||h in f&&f[h]===g)||(a[h]=b?b(g):g)}if(l("bug-for-in-skips-shadowed")&&c)for(d=0;d<r;++d){var h=m[d];g=c[h];h in a&&(a[h]===g||h in f&&f[h]===g)||(a[h]=b?b(g):g)}return a},mixin:function(a,c){a||(a={});for(var b=1,d=arguments.length;b<d;b++)e._mixin(a,
arguments[b]);return a},setObject:function(a,c,b){var d=a.split(".");a=d.pop();return(b=n(d,!0,b))&&a?b[a]=c:void 0},getObject:function(a,c,b){return a?n(a.split("."),c,b):b},exists:function(a,c){return void 0!==e.getObject(a,!1,c)},isString:function(a){return"string"==typeof a||a instanceof String},isArray:Array.isArray||function(a){return"[object Array]"==p.call(a)},isFunction:function(a){return"[object Function]"===p.call(a)},isObject:function(a){return void 0!==a&&(null===a||"object"==typeof a||
e.isArray(a)||e.isFunction(a))},isArrayLike:function(a){return!!a&&!e.isString(a)&&!e.isFunction(a)&&!(a.tagName&&"form"==a.tagName.toLowerCase())&&(e.isArray(a)||isFinite(a.length))},isAlien:function(a){return a&&!e.isFunction(a)&&/\{\s*\[native code\]\s*\}/.test(String(a))},extend:function(a,c){for(var b=1,d=arguments.length;b<d;b++)e._mixin(a.prototype,arguments[b]);return a},_hitchArgs:function(a,c){var b=e._toArray(arguments,2),d=e.isString(c);return function(){var f=e._toArray(arguments),g=
d?(a||k.global)[c]:c;return g&&g.apply(a||this,b.concat(f))}},hitch:function(a,c){if(2<arguments.length)return e._hitchArgs.apply(k,arguments);c||(c=a,a=null);if(e.isString(c)){a=a||k.global;if(!a[c])throw['lang.hitch: scope["',c,'"] is null (scope\x3d"',a,'")'].join("");return function(){return a[c].apply(a,arguments||[])}}return a?function(){return c.apply(a,arguments||[])}:c},delegate:function(){function a(){}return function(c,b){a.prototype=c;var d=new a;a.prototype=null;b&&e._mixin(d,b);return d}}(),
_toArray:l("ie")?function(){function a(c,b,d){d=d||[];for(b=b||0;b<c.length;b++)d.push(c[b]);return d}return function(c){return(c.item?a:q).apply(this,arguments)}}():q,partial:function(a){return e.hitch.apply(k,[null].concat(e._toArray(arguments)))},clone:function(a){if(!a||"object"!=typeof a||e.isFunction(a))return a;if(a.nodeType&&"cloneNode"in a)return a.cloneNode(!0);if(a instanceof Date)return new Date(a.getTime());if(a instanceof RegExp)return new RegExp(a);var c;if(e.isArray(a)){var b=[];var d=
0;for(c=a.length;d<c;++d)d in a&&(b[d]=e.clone(a[d]))}else b=a.constructor?new a.constructor:{};return e._mixin(b,a,e.clone)},trim:String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},replace:function(a,c,b){return a.replace(b||t,e.isFunction(c)?c:function(d,f){return e.getObject(f,!1,c)})}};e.mixin(k,e);return e});