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


window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dijit._editor._Plugin"],["require","dijit._Widget"],["require","dijit.form.Button"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dijit._editor._Plugin"]){_4._hasResource["dijit._editor._Plugin"]=true;_4.provide("dijit._editor._Plugin");_4.require("dijit._Widget");_4.require("dijit.form.Button");_4.declare("dijit._editor._Plugin",null,{constructor:function(_7,_8){this.params=_7||{};_4.mixin(this,this.params);this._connects=[];this._attrPairNames={};},editor:null,iconClassPrefix:"dijitEditorIcon",button:null,command:"",useDefaultCommand:true,buttonClass:_5.form.Button,disabled:false,getLabel:function(_9){return this.editor.commands[_9];},_initButton:function(){if(this.command.length){var _a=this.getLabel(this.command),_b=this.editor,_c=this.iconClassPrefix+" "+this.iconClassPrefix+this.command.charAt(0).toUpperCase()+this.command.substr(1);if(!this.button){var _d=_4.mixin({label:_a,dir:_b.dir,lang:_b.lang,showLabel:false,iconClass:_c,dropDown:this.dropDown,tabIndex:"-1"},this.params||{});this.button=new this.buttonClass(_d);}}if(this.get("disabled")&&this.button){this.button.set("disabled",this.get("disabled"));}},destroy:function(){_4.forEach(this._connects,_4.disconnect);if(this.dropDown){this.dropDown.destroyRecursive();}},connect:function(o,f,tf){this._connects.push(_4.connect(o,f,this,tf));},updateState:function(){var e=this.editor,c=this.command,_e,_f;if(!e||!e.isLoaded||!c.length){return;}var _10=this.get("disabled");if(this.button){try{_f=!_10&&e.queryCommandEnabled(c);if(this.enabled!==_f){this.enabled=_f;this.button.set("disabled",!_f);}if(typeof this.button.checked=="boolean"){_e=e.queryCommandState(c);if(this.checked!==_e){this.checked=_e;this.button.set("checked",e.queryCommandState(c));}}}catch(e){console.log(e);}}},setEditor:function(_11){this.editor=_11;this._initButton();if(this.button&&this.useDefaultCommand){if(this.editor.queryCommandAvailable(this.command)){this.connect(this.button,"onClick",_4.hitch(this.editor,"execCommand",this.command,this.commandArg));}else{this.button.domNode.style.display="none";}}this.connect(this.editor,"onNormalizedDisplayChanged","updateState");},setToolbar:function(_12){if(this.button){_12.addChild(this.button);}},set:function(_13,_14){if(typeof _13==="object"){for(var x in _13){this.set(x,_13[x]);}return this;}var _15=this._getAttrNames(_13);if(this[_15.s]){var _16=this[_15.s].apply(this,Array.prototype.slice.call(arguments,1));}else{this._set(_13,_14);}return _16||this;},get:function(_17){var _18=this._getAttrNames(_17);return this[_18.g]?this[_18.g]():this[_17];},_setDisabledAttr:function(_19){this.disabled=_19;this.updateState();},_getAttrNames:function(_1a){var apn=this._attrPairNames;if(apn[_1a]){return apn[_1a];}var uc=_1a.charAt(0).toUpperCase()+_1a.substr(1);return (apn[_1a]={s:"_set"+uc+"Attr",g:"_get"+uc+"Attr"});},_set:function(_1b,_1c){var _1d=this[_1b];this[_1b]=_1c;}});}}};});