//>>built define(["dojo/_base/lang","dojo/_base/array","./_base"],function(k,h,c){function t(a,b,d){var e=new c.Palette;e.colors=[];h.forEach(a.colors,function(a){e.colors.push(new c.Color({r:Math.min(255,Math.max(0,"dr"==b?a.r+d:a.r)),g:Math.min(255,Math.max(0,"dg"==b?a.g+d:a.g)),b:Math.min(255,Math.max(0,"db"==b?a.b+d:a.b)),a:Math.min(1,Math.max(0,"da"==b?a.a+d:a.a))}))});return e}function l(a,b,d){var e=new c.Palette;e.colors=[];h.forEach(a.colors,function(a){a=a.toCmy();e.colors.push(c.fromCmy(Math.min(100, Math.max(0,"dc"==b?a.c+d:a.c)),Math.min(100,Math.max(0,"dm"==b?a.m+d:a.m)),Math.min(100,Math.max(0,"dy"==b?a.y+d:a.y))))});return e}function p(a,b,d){var e=new c.Palette;e.colors=[];h.forEach(a.colors,function(a){a=a.toCmyk();e.colors.push(c.fromCmyk(Math.min(100,Math.max(0,"dc"==b?a.c+d:a.c)),Math.min(100,Math.max(0,"dm"==b?a.m+d:a.m)),Math.min(100,Math.max(0,"dy"==b?a.y+d:a.y)),Math.min(100,Math.max(0,"dk"==b?a.b+d:a.b))))});return e}function q(a,b,d){var e=new c.Palette;e.colors=[];h.forEach(a.colors, function(a){a=a.toHsl();e.colors.push(c.fromHsl(("dh"==b?a.h+d:a.h)%360,Math.min(100,Math.max(0,"ds"==b?a.s+d:a.s)),Math.min(100,Math.max(0,"dl"==b?a.l+d:a.l))))});return e}function r(a,b,d){var e=new c.Palette;e.colors=[];h.forEach(a.colors,function(a){a=a.toHsv();e.colors.push(c.fromHsv(("dh"==b?a.h+d:a.h)%360,Math.min(100,Math.max(0,"ds"==b?a.s+d:a.s)),Math.min(100,Math.max(0,"dv"==b?a.v+d:a.v))))});return e}c.Palette=function(a){this.colors=[];a instanceof c.Palette?this.colors=a.colors.slice(0): a instanceof c.Color?this.colors=[null,null,a,null,null]:k.isArray(a)?this.colors=h.map(a.slice(0),function(a){return k.isString(a)?new c.Color(a):a}):k.isString(a)&&(this.colors=[null,null,new c.Color(a),null,null])};k.extend(c.Palette,{transform:function(a){var b=t;if(a.use){var c=a.use.toLowerCase();0==c.indexOf("hs")?b="l"==c.charAt(2)?q:r:0==c.indexOf("cmy")&&(b="k"==c.charAt(3)?p:l)}else if("dc"in a||"dm"in a||"dy"in a)b="dk"in a?p:l;else if("dh"in a||"ds"in a)b="dv"in a?r:q;var c=this,e;for(e in a)"use"!= e&&(c=b(c,e,a[e]));return c},clone:function(){return new c.Palette(this)}});k.mixin(c.Palette,{generators:{analogous:function(a){var b=a.high||60,d=a.low||18;a=(k.isString(a.base)?new c.Color(a.base):a.base).toHsv();var e=Math.max(10,95>=a.s?a.s+5:100-(a.s-95)),g=92<=a.v?a.v-9:Math.max(a.v+9,20),f=90>=a.v?Math.max(a.v+5,20):95+Math.ceil((a.v-90)/2),n=[e,12*b.h+137?2*b.h+137:Math.floor(b.h/2)-137,e=100-.9*(100-b.s),g=Math.min(100,b.s+20),f=202*a.h+137?2*a.h+137:Math.floor(a.h/2)-137,g=(e-d+360)%360,d=(e+d)%360,e=100-.9*(100-a.s),f=Math.min(100,a.s+20),h=202*b.h+18?2*b.h+18:Math.floor(b.h/2)-18,e=360>2*b.h+120?2*b.h+120:Math.floor(b.h/2)-120,g=360>2*b.h+99?2*b.h+99:Math.floor(b.h/2)-99,f=80