//>>built
define("dijit/_PaletteMixin","dojo/_base/declare dojo/dom-attr dojo/dom-class dojo/dom-construct dojo/keys dojo/_base/lang dojo/on ./_CssStateMixin ./a11yclick ./focus ./typematic".split(" "),function(r,l,m,n,t,g,u,v,w,h,x){return r("dijit._PaletteMixin",v,{defaultTimeout:500,timeoutChangeRate:.9,value:"",_selectedCell:-1,tabIndex:"0",cellClass:"dijitPaletteCell",dyeClass:null,_dyeFactory:function(a){return new ("string"==typeof this.dyeClass?g.getObject(this.dyeClass):this.dyeClass)(a)},_preparePalette:function(a,
b){this._cells=[];var c=this._blankGif;this.own(u(this.gridNode,w,g.hitch(this,"_onCellClick")));for(var e=0;e<a.length;e++)for(var y=n.create("tr",{tabIndex:"-1",role:"row"},this.gridNode),f=0;f<a[e].length;f++){var d=a[e][f];if(d){var p=this._dyeFactory(d,e,f,b[d]);d=n.create("td",{"class":this.cellClass,tabIndex:"-1",title:b[d],role:"gridcell"},y);p.fillCell(d,c);d.idx=this._cells.length;this._cells.push({node:d,dye:p})}}this._xDim=a[0].length;this._yDim=a.length;var q={UP_ARROW:-this._xDim,DOWN_ARROW:this._xDim,
RIGHT_ARROW:this.isLeftToRight()?1:-1,LEFT_ARROW:this.isLeftToRight()?-1:1},k;for(k in q)this.own(x.addKeyListener(this.domNode,{keyCode:t[k],ctrlKey:!1,altKey:!1,shiftKey:!1},this,function(){var z=q[k];return function(A){this._navigateByKey(z,A)}}(),this.timeoutChangeRate,this.defaultTimeout))},postCreate:function(){this.inherited(arguments);this._setCurrent(this._cells[0].node)},focus:function(){h.focus(this._currentFocus)},_onCellClick:function(a){for(var b=a.target;"TD"!=b.tagName;){if(!b.parentNode||
b==this.gridNode)return;b=b.parentNode}var c=this._getDye(b).getValue();this._setCurrent(b);h.focus(b);this._setValueAttr(c,!0);a.stopPropagation();a.preventDefault()},_setCurrent:function(a){"_currentFocus"in this&&l.set(this._currentFocus,"tabIndex","-1");(this._currentFocus=a)&&l.set(a,"tabIndex",this.tabIndex)},_setValueAttr:function(a,b){0<=this._selectedCell&&m.remove(this._cells[this._selectedCell].node,this.cellClass+"Selected");this._selectedCell=-1;if(a)for(var c=0;c<this._cells.length;c++)if(a==
this._cells[c].dye.getValue()){this._selectedCell=c;m.add(this._cells[c].node,this.cellClass+"Selected");break}this._set("value",0<=this._selectedCell?a:null);if(b||void 0===b)this.onChange(a)},onChange:function(){},_navigateByKey:function(a,b){if(-1!=b){var c=this._currentFocus.idx+a;c<this._cells.length&&-1<c&&(c=this._cells[c].node,this._setCurrent(c),this.defer(g.hitch(h,"focus",c)))}},_getDye:function(a){return this._cells[a.idx].dye}})});