NEW_CKEDITOR.plugins.add("panelbutton",{requires:"button",onLoad:function(){function t(t){var e=this._;e.state!=NEW_CKEDITOR.TRISTATE_DISABLED&&(this.createPanel(t),e.on?e.panel.hide():e.panel.showBlock(this._.id,this.document.getById(this._.id),4))}NEW_CKEDITOR.ui.panelButton=NEW_CKEDITOR.tools.createClass({base:NEW_CKEDITOR.ui.button,$:function(e){var n=e.panel||{};delete e.panel,this.base(e),this.document=n.parent&&n.parent.getDocument()||NEW_CKEDITOR.document,n.block={attributes:n.attributes},n.toolbarRelated=!0,this.hasArrow="listbox",this.click=t,this._={panelDefinition:n}},statics:{handler:{create:function(t){return new NEW_CKEDITOR.ui.panelButton(t)}}},proto:{createPanel:function(t){var e=this._;if(!e.panel){var n=this._.panelDefinition,o=this._.panelDefinition.block,a=n.parent||NEW_CKEDITOR.document.getBody(),i=NEW_CKEDITOR.document.getById(this._.id),s=this._.panel=new NEW_CKEDITOR.ui.floatPanel(t,a,n),d=(n=s.addBlock(e.id,o),this),l=t.getCommand(this.command);s.onShow=function(){d.className&&this.element.addClass(d.className+"_panel"),d.setState(NEW_CKEDITOR.TRISTATE_ON),i.setAttribute("aria-expanded","true"),e.on=1,d.editorFocus&&t.focus(),d.onOpen&&d.onOpen()},s.onHide=function(n){d.className&&this.element.getFirst().removeClass(d.className+"_panel"),!d.modes&&l?d.setStateFromCommand(l):d.setState(d.modes&&d.modes[t.mode]?NEW_CKEDITOR.TRISTATE_OFF:NEW_CKEDITOR.TRISTATE_DISABLED),e.on=0,i.setAttribute("aria-expanded","false"),!n&&d.onClose&&d.onClose()},s.onEscape=function(){s.hide(1),d.document.getById(e.id).focus()},this.onBlock&&this.onBlock(s,n),n.onHide=function(){e.on=0,!d.modes&&d.command?d.setStateFromCommand(l):d.setState(NEW_CKEDITOR.TRISTATE_OFF)}}},setStateFromCommand:function(t){this.setState(t.state)}}})},beforeInit:function(t){t.ui.addHandler(NEW_CKEDITOR.UI_PANELBUTTON,NEW_CKEDITOR.ui.panelButton.handler)}}),NEW_CKEDITOR.UI_PANELBUTTON="panelbutton";