//>>built
define("dojox/color/Colorspace",["./_base","dojo/_base/lang","dojox/math/matrix"],function(e,y,t){e.Colorspace=new function(){var h=this,n={2:{E:{x:1/3,y:1/3,t:5400},D50:{x:.34567,y:.3585,t:5E3},D55:{x:.33242,y:.34743,t:5500},D65:{x:.31271,y:.32902,t:6500},D75:{x:.29902,y:.31485,t:7500},A:{x:.44757,y:.40745,t:2856},B:{x:.34842,y:.35161,t:4874},C:{x:.31006,y:.31616,t:6774},9300:{x:.2848,y:.2932,t:9300},F2:{x:.37207,y:.37512,t:4200},F7:{x:.31285,y:.32918,t:6500},F11:{x:.38054,y:.37691,t:4E3}},10:{E:{x:1/
3,y:1/3,t:5400},D50:{x:.34773,y:.35952,t:5E3},D55:{x:.33411,y:.34877,t:5500},D65:{x:.31382,y:.331,t:6500},D75:{x:.29968,y:.3174,t:7500},A:{x:.45117,y:.40594,t:2856},B:{x:.3498,y:.3527,t:4874},C:{x:.31039,y:.31905,t:6774},F2:{x:.37928,y:.36723,t:4200},F7:{x:.31565,y:.32951,t:6500},F11:{x:.38543,y:.3711,t:4E3}}},m={"Adobe RGB 98":[2.2,"D65",.64,.33,.297361,.21,.71,.627355,.15,.06,.075285],"Apple RGB":[1.8,"D65",.625,.34,.244634,.28,.595,.672034,.155,.07,.083332],"Best RGB":[2.2,"D50",.7347,.2653,.228457,
.215,.775,.737352,.13,.035,.034191],"Beta RGB":[2.2,"D50",.6888,.3112,.303273,.1986,.7551,.663786,.1265,.0352,.032941],"Bruce RGB":[2.2,"D65",.64,.33,.240995,.28,.65,.683554,.15,.06,.075452],"CIE RGB":[2.2,"E",.735,.265,.176204,.274,.717,.812985,.167,.009,.010811],"ColorMatch RGB":[1.8,"D50",.63,.34,.274884,.295,.605,.658132,.15,.075,.066985],"DON RGB 4":[2.2,"D50",.696,.3,.27835,.215,.765,.68797,.13,.035,.03368],"ECI RGB":[1.8,"D50",.67,.33,.32025,.21,.71,.602071,.14,.08,.077679],"EktaSpace PS5":[2.2,
"D50",.695,.305,.260629,.26,.7,.734946,.11,.005,.004425],"NTSC RGB":[2.2,"C",.67,.33,.298839,.21,.71,.586811,.14,.08,.11435],"PAL/SECAM RGB":[2.2,"D65",.64,.33,.222021,.29,.6,.706645,.15,.06,.071334],"Pro Photo RGB":[1.8,"D50",.7347,.2653,.28804,.1596,.8404,.711874,.0366,1E-4,8.6E-5],"SMPTE/C RGB":[2.2,"D65",.63,.34,.212395,.31,.595,.701049,.155,.07,.086556],sRGB:[2.2,"D65",.64,.33,.212656,.3,.6,.715158,.15,.06,.072186],"Wide Gamut RGB":[2.2,"D50",.735,.265,.258187,.115,.826,.724938,.157,.018,.016875]},
l={"XYZ scaling":{ma:[[1,0,0],[0,1,0],[0,0,1]],mai:[[1,0,0],[0,1,0],[0,0,1]]},Bradford:{ma:[[.8951,-.7502,.0389],[.2664,1.7135,-.0685],[-.1614,.0367,1.0296]],mai:[[.986993,.432305,-.008529],[-.147054,.51836,.040043],[.159963,.049291,.968487]]},"Von Kries":{ma:[[.40024,-.2263,0],[.7076,1.16532,0],[-.08081,.0457,.91822]],mai:[[1.859936,.361191,0],[-1.129382,.638812,0],[.219897,-6E-6,1.089064]]}},c={XYZ:{xyY:function(a,b){b=dojo.mixin({whitepoint:"D65",observer:"10",useApproximation:!0},b||{});var d=
h.whitepoint(b.whitepoint,b.observer),f=a.X+a.Y+a.Z;if(0==f){var g=d.x;d=d.y}else g=a.X/f,d=a.Y/f;return{x:g,y:d,Y:a.Y}},Lab:function(a,b){b=dojo.mixin({whitepoint:"D65",observer:"10",useApproximation:!0},b||{});var d=h.kappa(b.useApproximation),f=h.epsilon(b.useApproximation),g=h.whitepoint(b.whitepoint,b.observer),k=a.X/g.x,p=a.Y/g.y;g=a.z/g.z;p=p>f?Math.pow(p,1/3):(d*p+16)/116;return{L:116*p-16,a:500*((k>f?Math.pow(k,1/3):(d*k+16)/116)-p),b:200*(p-(g>f?Math.pow(g,1/3):(d*g+16)/116))}},Luv:function(a,
b){b=dojo.mixin({whitepoint:"D65",observer:"10",useApproximation:!0},b||{});var d=h.kappa(b.useApproximation),f=h.epsilon(b.useApproximation),g=h.whitepoint(b.whitepoint,b.observer),k=a.Y/g.y;d=k>f?116*Math.pow(k,1/3)-16:d*k;return{L:d,u:13*d*(4*a.X/(a.X+15*a.Y+3*a.Z)-4*g.x/(g.x+15*g.y+3*g.z)),v:13*d*(9*a.Y/(a.X+15*a.Y+3*a.Z)-9*g.y/(g.x+15*g.y+3*g.z))}}},xyY:{XYZ:function(a){if(0==a.y){var b=0,d=0;a=0}else b=a.x*a.Y/a.y,d=a.Y,a=(1-a.x-a.y)*a.Y/a.y;return{X:b,Y:d,Z:a}}},Lab:{XYZ:function(a,b){b=dojo.mixin({whitepoint:"D65",
observer:"10",useApproximation:!0},b||{});var d=b.useApproximation,f=h.kappa(d);d=h.epsilon(d);var g=h.whitepoint(b.whitepoint,b.observer),k=a.L>f*d?Math.pow((a.L+16)/116,3):a.L/f,p=k>d?(a.L+16)/116:(f*k+16)/116,u=a.a/500+p;p-=a.b/200;var w=Math.pow(u,3),r=Math.pow(p,3);return{X:(w>d?w:(116*u-16)/f)*g.x,Y:k*g.y,Z:(r>d?r:(116*p-16)/f)*g.z}},LCHab:function(a){var b=a.L,d=Math.pow(a.a*a.a+a.b*a.b,.5);a=180/Math.PI*Math.atan(a.b,a.a);0>a&&(a+=360);360>a&&(a-=360);return{L:b,C:d,H:a}}},LCHab:{Lab:function(a){var b=
a.L,d=a.C/Math.pow(Math.pow(Math.tan(Math.PI/180*a.H),2)+1,.5);90<lchH&&270>a.H&&(d=-d);var f=Math.pow(Math.pow(a.C,2)-Math.pow(d,2),.5);180<a.H&&(f=-f);return{L:b,a:d,b:f}}},Luv:{XYZ:function(a,b){b=dojo.mixin({whitepoint:"D65",observer:"10",useApproximation:!0},b||{});var d=b.useApproximation,f=h.kappa(d),g=h.epsilon(d);d=h.whitepoint(b.whitepoint,b.observer);var k=9*d.y/(d.x+15*d.y+3*d.z);f=a.L>f*g?Math.pow((a.L+16)/116,3):a.L/f;g=1/3*(52*a.L/(a.u+4*d.x/(d.x+15*d.y+3*d.z)*a.L*13)-1);d=-5*f;k=(f*
(39*a.L/(a.v+13*a.L*k)-5)-d)/(g- -(1/3));return{X:k,Y:f,Z:k*g+d}},LCHuv:function(a){var b=a.L,d=Math.pow(a.u*a.u+a.v*a*v,.5);a=180/Math.PI*Math.atan(a.v,a.u);0>a&&(a+=360);360<a&&(a-=360);return{L:b,C:d,H:a}}},LCHuv:{Luv:function(a){var b=a.L,d=a.C/Math.pow(Math.pow(Math.tan(Math.PI/180*a.H),2)+1,.5),f=Math.pow(a.C*a.C-d*d,.5);90<a.H&&270<a.H&&(d*=-1);180<a.H&&(f*=-1);return{L:b,u:d,v:f}}}},q={CMY:{CMYK:function(a,b){return e.fromCmy(a).toCmyk()},HSL:function(a,b){return e.fromCmy(a).toHsl()},HSV:function(a,
b){return e.fromCmy(a).toHsv()},Lab:function(a,b){return c.XYZ.Lab(e.fromCmy(a).toXYZ(b))},LCHab:function(a,b){return c.Lab.LCHab(q.CMY.Lab(a))},LCHuv:function(a,b){return c.LCHuv.Luv(c.Luv.XYZ(e.fromCmy(a).toXYZ(b)))},Luv:function(a,b){return c.Luv.XYZ(e.fromCmy(a).toXYZ(b))},RGB:function(a,b){return e.fromCmy(a)},XYZ:function(a,b){return e.fromCmy(a).toXYZ(b)},xyY:function(a,b){return c.XYZ.xyY(e.fromCmy(a).toXYZ(b))}},CMYK:{CMY:function(a,b){return e.fromCmyk(a).toCmy()},HSL:function(a,b){return e.fromCmyk(a).toHsl()},
HSV:function(a,b){return e.fromCmyk(a).toHsv()},Lab:function(a,b){return c.XYZ.Lab(e.fromCmyk(a).toXYZ(b))},LCHab:function(a,b){return c.Lab.LCHab(q.CMYK.Lab(a))},LCHuv:function(a,b){return c.LCHuv.Luv(c.Luv.XYZ(e.fromCmyk(a).toXYZ(b)))},Luv:function(a,b){return c.Luv.XYZ(e.fromCmyk(a).toXYZ(b))},RGB:function(a,b){return e.fromCmyk(a)},XYZ:function(a,b){return e.fromCmyk(a).toXYZ(b)},xyY:function(a,b){return c.XYZ.xyY(e.fromCmyk(a).toXYZ(b))}},HSL:{CMY:function(a,b){return e.fromHsl(a).toCmy()},CMYK:function(a,
b){return e.fromHsl(a).toCmyk()},HSV:function(a,b){return e.fromHsl(a).toHsv()},Lab:function(a,b){return c.XYZ.Lab(e.fromHsl(a).toXYZ(b))},LCHab:function(a,b){return c.Lab.LCHab(q.CMYK.Lab(a))},LCHuv:function(a,b){return c.LCHuv.Luv(c.Luv.XYZ(e.fromHsl(a).toXYZ(b)))},Luv:function(a,b){return c.Luv.XYZ(e.fromHsl(a).toXYZ(b))},RGB:function(a,b){return e.fromHsl(a)},XYZ:function(a,b){return e.fromHsl(a).toXYZ(b)},xyY:function(a,b){return c.XYZ.xyY(e.fromHsl(a).toXYZ(b))}},HSV:{CMY:function(a,b){return e.fromHsv(a).toCmy()},
CMYK:function(a,b){return e.fromHsv(a).toCmyk()},HSL:function(a,b){return e.fromHsv(a).toHsl()},Lab:function(a,b){return c.XYZ.Lab(e.fromHsv(a).toXYZ(b))},LCHab:function(a,b){return c.Lab.LCHab(q.CMYK.Lab(a))},LCHuv:function(a,b){return c.LCHuv.Luv(c.Luv.XYZ(e.fromHsv(a).toXYZ(b)))},Luv:function(a,b){return c.Luv.XYZ(e.fromHsv(a).toXYZ(b))},RGB:function(a,b){return e.fromHsv(a)},XYZ:function(a,b){return e.fromHsv(a).toXYZ(b)},xyY:function(a,b){return c.XYZ.xyY(e.fromHsv(a).toXYZ(b))}},Lab:{CMY:function(a,
b){return e.fromXYZ(c.Lab.XYZ(a,b)).toCmy()},CMYK:function(a,b){return e.fromXYZ(c.Lab.XYZ(a,b)).toCmyk()},HSL:function(a,b){return e.fromXYZ(c.Lab.XYZ(a,b)).toHsl()},HSV:function(a,b){return e.fromXYZ(c.Lab.XYZ(a,b)).toHsv()},LCHab:function(a,b){return c.Lab.LCHab(a,b)},LCHuv:function(a,b){return c.Luv.LCHuv(c.Lab.XYZ(a,b),b)},Luv:function(a,b){return c.XYZ.Luv(c.Lab.XYZ(a,b),b)},RGB:function(a,b){return e.fromXYZ(c.Lab.XYZ(a,b))},XYZ:function(a,b){return c.Lab.XYZ(a,b)},xyY:function(a,b){return c.XYZ.xyY(c.Lab.XYZ(a,
b),b)}},LCHab:{CMY:function(a,b){return e.fromXYZ(c.Lab.XYZ(c.LCHab.Lab(a),b),b).toCmy()},CMYK:function(a,b){return e.fromXYZ(c.Lab.XYZ(c.LCHab.Lab(a),b),b).toCmyk()},HSL:function(a,b){return e.fromXYZ(c.Lab.XYZ(c.LCHab.Lab(a),b),b).toHsl()},HSV:function(a,b){return e.fromXYZ(c.Lab.XYZ(c.LCHab.Lab(a),b),b).toHsv()},Lab:function(a,b){return c.Lab.LCHab(a,b)},LCHuv:function(a,b){return c.Luv.LCHuv(c.XYZ.Luv(c.Lab.XYZ(c.LCHab.Lab(a),b),b),b)},Luv:function(a,b){return c.XYZ.Luv(c.Lab.XYZ(c.LCHab.Lab(a),
b),b)},RGB:function(a,b){return e.fromXYZ(c.Lab.XYZ(c.LCHab.Lab(a),b),b)},XYZ:function(a,b){return c.Lab.XYZ(c.LCHab.Lab(a,b),b)},xyY:function(a,b){return c.XYZ.xyY(c.Lab.XYZ(c.LCHab.Lab(a),b),b)}},LCHuv:{CMY:function(a,b){return e.fromXYZ(c.Luv.XYZ(c.LCHuv.Luv(a),b),b).toCmy()},CMYK:function(a,b){return e.fromXYZ(c.Luv.XYZ(c.LCHuv.Luv(a),b),b).toCmyk()},HSL:function(a,b){return e.fromXYZ(c.Luv.XYZ(c.LCHuv.Luv(a),b),b).toHsl()},HSV:function(a,b){return e.fromXYZ(c.Luv.XYZ(c.LCHuv.Luv(a),b),b).toHsv()},
Lab:function(a,b){return c.XYZ.Lab(c.Luv.XYZ(c.LCHuv.Luv(a),b),b)},LCHab:function(a,b){return c.Lab.LCHab(c.XYZ.Lab(c.Luv.XYZ(c.LCHuv.Luv(a),b),b),b)},Luv:function(a,b){return c.LCHuv.Luv(a,b)},RGB:function(a,b){return e.fromXYZ(c.Luv.XYZ(c.LCHuv.Luv(a),b),b)},XYZ:function(a,b){return c.Luv.XYZ(c.LCHuv.Luv(a),b)},xyY:function(a,b){return c.XYZ.xyY(c.Luv.XYZ(c.LCHuv.Luv(a),b),b)}},Luv:{CMY:function(a,b){return e.fromXYZ(c.Luv.XYZ(a,b),b).toCmy()},CMYK:function(a,b){return e.fromXYZ(c.Luv.XYZ(a,b),
b).toCmyk()},HSL:function(a,b){return e.fromXYZ(c.Luv.XYZ(a,b),b).toHsl()},HSV:function(a,b){return e.fromXYZ(c.Luv.XYZ(a,b),b).toHsv()},Lab:function(a,b){return c.XYZ.Lab(c.Luv.XYZ(a,b),b)},LCHab:function(a,b){return c.Lab.LCHab(c.XYZ.Lab(c.Luv.XYZ(a,b),b),b)},LCHuv:function(a,b){return c.Luv.LCHuv(a,b)},RGB:function(a,b){return e.fromXYZ(c.Luv.XYZ(a,b),b)},XYZ:function(a,b){return c.Luv.XYZ(a,b)},xyY:function(a,b){return c.XYZ.xyY(c.Luv.XYZ(a,b),b)}},RGB:{CMY:function(a,b){return a.toCmy()},CMYK:function(a,
b){return a.toCmyk()},HSL:function(a,b){return a.toHsl()},HSV:function(a,b){return a.toHsv()},Lab:function(a,b){return c.XYZ.Lab(a.toXYZ(b),b)},LCHab:function(a,b){return c.LCHab.Lab(c.XYZ.Lab(a.toXYZ(b),b),b)},LCHuv:function(a,b){return c.LCHuv.Luv(c.XYZ.Luv(a.toXYZ(b),b),b)},Luv:function(a,b){return c.XYZ.Luv(a.toXYZ(b),b)},XYZ:function(a,b){return a.toXYZ(b)},xyY:function(a,b){return c.XYZ.xyY(a.toXYZ(b),b)}},XYZ:{CMY:function(a,b){return e.fromXYZ(a,b).toCmy()},CMYK:function(a,b){return e.fromXYZ(a,
b).toCmyk()},HSL:function(a,b){return e.fromXYZ(a,b).toHsl()},HSV:function(a,b){return e.fromXYZ(a,b).toHsv()},Lab:function(a,b){return c.XYZ.Lab(a,b)},LCHab:function(a,b){return c.Lab.LCHab(c.XYZ.Lab(a,b),b)},LCHuv:function(a,b){return c.Luv.LCHuv(c.XYZ.Luv(a,b),b)},Luv:function(a,b){return c.XYZ.Luv(a,b)},RGB:function(a,b){return e.fromXYZ(a,b)},xyY:function(a,b){return c.XYZ.xyY(e.fromXYZ(a,b),b)}},xyY:{CMY:function(a,b){return e.fromXYZ(c.xyY.XYZ(a,b),b).toCmy()},CMYK:function(a,b){return e.fromXYZ(c.xyY.XYZ(a,
b),b).toCmyk()},HSL:function(a,b){return e.fromXYZ(c.xyY.XYZ(a,b),b).toHsl()},HSV:function(a,b){return e.fromXYZ(c.xyY.XYZ(a,b),b).toHsv()},Lab:function(a,b){return c.Lab.XYZ(c.xyY.XYZ(a,b),b)},LCHab:function(a,b){return c.LCHab.Lab(c.Lab.XYZ(c.xyY.XYZ(a,b),b),b)},LCHuv:function(a,b){return c.LCHuv.Luv(c.Luv.XYZ(c.xyY.XYZ(a,b),b),b)},Luv:function(a,b){return c.Luv.XYZ(c.xyY.XYZ(a,b),b)},RGB:function(a,b){return e.fromXYZ(c.xyY.XYZ(a,b),b)},XYZ:function(a,b){return c.xyY.XYZ(a,b)}}};this.whitepoint=
function(a,b){b=b||"10";var d=0,f=0,g=0;n[b]&&n[b][a]&&(d=n[b][a].x,f=n[b][a].y,g=n[b][a].t);return this.convert({x:d,y:f,z:1-d-f,t:g,Y:1},"xyY","XYZ")};this.tempToWhitepoint=function(a){if(4E3>a||25E3<a)return{x:0,y:0};var b=a*a,d=b*a,f=Math.pow(10,9),g=Math.pow(10,6),k=Math.pow(10,3);a=7E3>=a?-4.607*f/d+2.9678*g/b+.09911*k/a+.2444063:-2.0064*f/d+1.9018*g/b+.24748*k/a+.23704;return{x:a,y:-3*a*a+2.87*a-.275}};this.primaries=function(a){a=dojo.mixin({profile:"sRGB",whitepoint:"D65",observer:"10",adaptor:"Bradford"},
a||{});var b=[];m[a.profile]&&(b=m[a.profile].slice(0));b={name:a.profile,gamma:b[0],whitepoint:b[1],xr:b[2],yr:b[3],Yr:b[4],xg:b[5],yg:b[6],Yg:b[7],xb:b[8],yb:b[9],Yb:b[10]};if(a.whitepoint!=b.whitepoint){var d=this.convert(this.adapt({color:this.convert({x:xr,y:yr,Y:Yr},"xyY","XYZ"),adaptor:a.adaptor,source:b.whitepoint,destination:a.whitepoint}),"XYZ","xyY"),f=this.convert(this.adapt({color:this.convert({x:xg,y:yg,Y:Yg},"xyY","XYZ"),adaptor:a.adaptor,source:b.whitepoint,destination:a.whitepoint}),
"XYZ","xyY"),g=this.convert(this.adapt({color:this.convert({x:xb,y:yb,Y:Yb},"xyY","XYZ"),adaptor:a.adaptor,source:b.whitepoint,destination:a.whitepoint}),"XYZ","xyY");b=dojo.mixin(b,{xr:d.x,yr:d.y,Yr:d.Y,xg:f.x,yg:f.y,Yg:f.Y,xb:g.x,yb:g.y,Yb:g.Y,whitepoint:a.whitepoint})}return dojo.mixin(b,{zr:1-b.xr-b.yr,zg:1-b.xg-b.yg,zb:1-b.xb-b.yb})};this.adapt=function(a){a=dojo.mixin({adaptor:"Bradford",destination:"D65"},a);var b=this.whitepoint(a.source),d=this.whitepoint(a.destination);if(l[a.adaptor])var f=
l[a.adaptor].ma,g=l[a.adaptor].mai;b=t.multiply([[b.x,b.y,b.z]],f);d=t.multiply([[d.x,d.y,d.z]],f);f=t.multiply(t.multiply(f,[[d[0][0]/b[0][0],0,0],[0,d[0][1]/b[0][1],0],[0,0,d[0][2]/b[0][2]]]),g);a=t.multiply([[a.color.X,a.color.Y,a.color.Z]],f)[0];return{X:a[0],Y:a[1],Z:a[2]}};this.matrix=function(a,b){var d=this.whitepoint(b.whitepoint),f=b.xr/b.yr,g=(1-b.xr-b.yr)/b.yr,k=b.xg/b.yg,p=(1-b.xg-b.yg)/b.yg,u=b.xb/b.yb,w=(1-b.xb-b.yb)/b.yb,r=t.multiply([[d.X,d.Y,d.Z]],t.inverse([[f,1,g],[k,1,p],[u,1,
w]]));d=r[0][0];var x=r[0][1];r=r[0][2];f=[[d*f,1*d,d*g],[x*k,1*x,x*p],[r*u,1*r,r*w]];return"RGB"==a?t.inverse(f):f};this.epsilon=function(a){return a||"undefined"==typeof a?.008856:216/24289};this.kappa=function(a){return a||"undefined"==typeof a?903.3:24389/27};this.convert=function(a,b,d,f){if(q[b]&&q[b][d])return q[b][d](a,f)}};dojo.mixin(e,{fromXYZ:function(h,n){n=n||{};var m=e.Colorspace.primaries(n),l=e.Colorspace.matrix("RGB",m),c=dojox.math.matrix.multiply([[h.X,h.Y,h.Z]],l),q=c[0][0];l=
c[0][1];c=c[0][2];"sRGB"==m.profile?(q=.0031308<q?1.055*Math.pow(q,1/2.4)-.055:12.92*q,l=.0031308<l?1.055*Math.pow(l,1/2.4)-.055:12.92*l,m=.0031308<c?1.055*Math.pow(c,1/2.4)-.055:12.92*c):(q=Math.pow(q,1/m.gamma),l=Math.pow(l,1/m.gamma),m=Math.pow(c,1/m.gamma));return new e.Color({r:Math.floor(255*q),g:Math.floor(255*l),b:Math.floor(255*m)})}});dojo.extend(e.Color,{toXYZ:function(h){h=h||{};var n=e.Colorspace.primaries(h);h=e.Colorspace.matrix("XYZ",n);var m=this.r/255,l=this.g/255,c=this.b/255;"sRGB"==
n.profile?(m=.04045<m?Math.pow((m+.055)/1.055,2.4):m/12.92,l=.04045<l?Math.pow((l+.055)/1.055,2.4):l/12.92,n=.04045<c?Math.pow((c+.055)/1.055,2.4):c/12.92):(m=Math.pow(m,n.gamma),l=Math.pow(l,n.gamma),n=Math.pow(c,n.gamma));h=t([[m,l,n]],h);return{X:h[0][0],Y:h[0][1],Z:h[0][2]}}});return e.Colorspace});