/*
	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/declare",["./kernel","../has","./lang"],function(y,u,v){function q(c,b){throw Error("declare"+(b?" "+b:"")+": "+c);}function C(c,b){for(var a=[],d=[{cls:0,refs:[]}],e={},f=1,k=c.length,h=0,g,l,m,n,p;h<k;++h){(g=c[h])?"[object Function]"!=r.call(g)&&q("mixin #"+h+" is not a callable constructor.",b):q("mixin #"+h+" is unknown. Did you use dojo.require to pull it in?",b);l=g._meta?g._meta.bases:[g];m=0;for(g=l.length-1;0<=g;--g)n=l[g].prototype,n.hasOwnProperty("declaredClass")||
(n.declaredClass="uniqName_"+D++),n=n.declaredClass,e.hasOwnProperty(n)||(e[n]={count:0,refs:[],cls:l[g]},++f),n=e[n],m&&m!==n&&(n.refs.push(m),++m.count),m=n;++m.count;d[0].refs.push(m)}for(;d.length;){m=d.pop();a.push(m.cls);for(--f;p=m.refs,1==p.length;){m=p[0];if(!m||--m.count){m=0;break}a.push(m.cls);--f}if(m)for(h=0,k=p.length;h<k;++h)m=p[h],--m.count||d.push(m)}f&&q("can't build consistent linearization",b);g=c[0];a[0]=g?g._meta&&g===a[a.length-g._meta.bases.length]?g._meta.bases.length:1:
0;return a}function A(c,b,a,d){var e,f,k,h,g,l,m=this._inherited=this._inherited||{};"string"===typeof c&&(e=c,c=b,b=a,a=d);if("function"===typeof c)k=c,c=b,b=a;else try{k=c.callee}catch(n){if(n instanceof TypeError)q("strict mode inherited() requires the caller function to be passed before arguments",this.declaredClass);else throw n;}(e=e||k.nom)||q("can't deduce a name to call inherited()",this.declaredClass);a=d=0;h=this.constructor._meta;d=h.bases;l=m.p;if("constructor"!=e){if(m.c!==k&&(l=0,g=
d[0],h=g._meta,h.hidden[e]!==k)){(f=h.chains)&&"string"==typeof f[e]&&q("calling chained method with inherited: "+e,this.declaredClass);do if(h=g._meta,f=g.prototype,h&&(f[e]===k&&f.hasOwnProperty(e)||h.hidden[e]===k))break;while(g=d[++l]);l=g?l:-1}if(g=d[++l])if(f=g.prototype,g._meta&&f.hasOwnProperty(e))a=f[e];else{k=p[e];do if(f=g.prototype,(a=f[e])&&(g._meta?f.hasOwnProperty(e):a!==k))break;while(g=d[++l])}a=g&&a||p[e]}else{if(m.c!==k&&(l=0,(h=d[0]._meta)&&h.ctor!==k)){for((f=h.chains)&&"manual"===
f.constructor||q("calling chained constructor with inherited",this.declaredClass);(g=d[++l])&&(!(h=g._meta)||h.ctor!==k););l=g?l:-1}for(;(g=d[++l])&&!(a=(h=g._meta)?h.ctor:g););a=g&&a}m.c=a;m.p=l;if(a)return!0===b?a:a.apply(this,b||c)}function E(c,b,a){return"string"===typeof c?"function"===typeof b?this.__inherited(c,b,a,!0):this.__inherited(c,b,!0):"function"===typeof c?this.__inherited(c,b,!0):this.__inherited(c,!0)}function F(c,b,a,d){var e=this.getInherited(c,b,a);if(e)return e.apply(this,d||
a||b||c)}function G(c){for(var b=this.constructor._meta.bases,a=0,d=b.length;a<d;++a)if(b[a]===c)return!0;return this instanceof c}function H(c,b){for(var a in b)"constructor"!=a&&b.hasOwnProperty(a)&&(c[a]=b[a]);if(u("bug-for-in-skips-shadowed"))for(var d=v._extraNames,e=d.length;e;)a=d[--e],"constructor"!=a&&b.hasOwnProperty(a)&&(c[a]=b[a])}function I(c){t.safeMixin(this.prototype,c);return this}function J(c,b){c instanceof Array||"function"===typeof c||(b=c,c=void 0);b=b||{};c=c||[];return t([this].concat(c),
b)}function K(c,b){return function(){var a=arguments,d=a,e=a[0],f,k;k=c.length;var h;if(!(this instanceof a.callee))return z(a);if(b&&(e&&e.preamble||this.preamble))for(h=Array(c.length),h[0]=a,f=0;;){(e=a[0])&&(e=e.preamble)&&(a=e.apply(this,a)||a);e=c[f].prototype;(e=e.hasOwnProperty("preamble")&&e.preamble)&&(a=e.apply(this,a)||a);if(++f==k)break;h[f]=a}for(f=k-1;0<=f;--f)e=c[f],(e=(k=e._meta)?k.ctor:e)&&e.apply(this,h?h[f]:a);(e=this.postscript)&&e.apply(this,d)}}function L(c,b){return function(){var a=
arguments,d=a,e=a[0];if(!(this instanceof a.callee))return z(a);b&&(e&&(e=e.preamble)&&(d=e.apply(this,d)||d),(e=this.preamble)&&e.apply(this,d));c&&c.apply(this,a);(e=this.postscript)&&e.apply(this,a)}}function M(c){return function(){var b=arguments,a=0,d,e;if(!(this instanceof b.callee))return z(b);for(;d=c[a];++a)if(d=(e=d._meta)?e.ctor:d){d.apply(this,b);break}(d=this.postscript)&&d.apply(this,b)}}function N(c,b,a){return function(){var d,e,f=0,k=1;a&&(f=b.length-1,k=-1);for(;d=b[f];f+=k)e=d._meta,
(d=(e?e.hidden:d.prototype)[c])&&d.apply(this,arguments)}}function B(c){w.prototype=c.prototype;c=new w;w.prototype=null;return c}function z(c){var b=c.callee,a=B(b);b.apply(a,c);return a}function t(c,b,a){"string"!=typeof c&&(a=b,b=c,c="");a=a||{};var d,e,f,k,h,g,l,m=1,n=b;"[object Array]"==r.call(b)?(g=C(b,c),f=g[0],m=g.length-f,b=g[m]):(g=[0],b?"[object Function]"==r.call(b)?(f=b._meta,g=g.concat(f?f.bases:b)):q("base class is not a callable constructor.",c):null!==b&&q("unknown base class. Did you use dojo.require to pull it in?",
c));if(b)for(e=m-1;;--e){d=B(b);if(!e)break;f=g[e];(f._meta?H:x)(d,f.prototype);k=u("csp-restrictions")?function(){}:new Function;k.superclass=b;k.prototype=d;b=d.constructor=k}else d={};t.safeMixin(d,a);f=a.constructor;f!==p.constructor&&(f.nom="constructor",d.constructor=f);for(e=m-1;e;--e)(f=g[e]._meta)&&f.chains&&(l=x(l||{},f.chains));d["-chains-"]&&(l=x(l||{},d["-chains-"]));b&&b.prototype&&b.prototype["-chains-"]&&(l=x(l||{},b.prototype["-chains-"]));f=!l||!l.hasOwnProperty("constructor");g[0]=
k=l&&"manual"===l.constructor?M(g):1==g.length?L(a.constructor,f):K(g,f);k._meta={bases:g,hidden:a,chains:l,parents:n,ctor:a.constructor};k.superclass=b&&b.prototype;k.extend=I;k.createSubclass=J;k.prototype=d;d.constructor=k;d.getInherited=E;d.isInstanceOf=G;d.inherited=O;d.__inherited=A;c&&(d.declaredClass=c,v.setObject(c,k));if(l)for(h in l)d[h]&&"string"==typeof l[h]&&"constructor"!=h&&(f=d[h]=N(h,g,"after"===l[h]),f.nom=h);return k}var x=v.mixin,p=Object.prototype,r=p.toString,w,D=0;w=u("csp-restrictions")?
function(){}:new Function;var O=y.config.isDebug?F:A;y.safeMixin=t.safeMixin=function(c,b){var a,d;for(a in b)d=b[a],d===p[a]&&a in p||"constructor"==a||("[object Function]"==r.call(d)&&(d.nom=a),c[a]=d);if(u("bug-for-in-skips-shadowed")&&b)for(var e=v._extraNames,f=e.length;f;)a=e[--f],d=b[a],d===p[a]&&a in p||"constructor"==a||("[object Function]"==r.call(d)&&(d.nom=a),c[a]=d);return c};return y.declare=t});