/*
 Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
 For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
(function(){function n(a){if(!a||a.type!=CKEDITOR.NODE_ELEMENT||"form"!=a.getName())return[];for(var d=[],f=["style","className"],e=0;e<f.length;e++){var b=a.$.elements.namedItem(f[e]);b&&(b=new CKEDITOR.dom.element(b),d.push([b,b.nextSibling]),b.remove())}return d}function t(a,d){if(a&&a.type==CKEDITOR.NODE_ELEMENT&&"form"==a.getName()&&0<d.length)for(var f=d.length-1;0<=f;f--){var e=d[f][0],b=d[f][1];b?e.insertBefore(b):e.appendTo(a)}}function r(a,d){var f=n(a),e={},b=a.$;d||(e["class"]=b.className||
"",b.className="");e.inline=b.style.cssText||"";d||(b.style.cssText="position: static; overflow: visible");t(f);return e}function u(a,d){var f=n(a),e=a.$;"class"in d&&(e.className=d["class"]);"inline"in d&&(e.style.cssText=d.inline);t(f)}function v(a){!a.editable().isInline()&&a.editable().hasFocus&&(a.toolbox.focus(),a.focus())}CKEDITOR.plugins.add("maximize",{lang:"af,ar,az,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,es-mx,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn",
icons:"maximize",hidpi:!0,init:function(a){function d(){var g=b.getViewPaneSize();a.resize(g.width,g.height,null,!0)}if(a.elementMode!=CKEDITOR.ELEMENT_MODE_INLINE){var f=a.lang,e=CKEDITOR.document,b=e.getWindow(),l,m,p,n=CKEDITOR.TRISTATE_OFF;a.addCommand("maximize",{modes:{wysiwyg:!CKEDITOR.env.iOS,source:!CKEDITOR.env.iOS},readOnly:1,editorFocus:!1,exec:function(){var g=a.container.getFirst(function(a){return a.type==CKEDITOR.NODE_ELEMENT&&a.hasClass("cke_inner")}),h=a.ui.space("contents");if("wysiwyg"==
a.mode){var c=a.getSelection();l=c&&c.getRanges();m=b.getScrollPosition()}else{var k=a.editable().$;l=!CKEDITOR.env.ie&&[k.selectionStart,k.selectionEnd];m=[k.scrollLeft,k.scrollTop]}if(this.state==CKEDITOR.TRISTATE_OFF){b.on("resize",d);p=b.getScrollPosition();for(c=a.container;c=c.getParent();)c.setCustomData("maximize_saved_styles",r(c)),c.setStyle("z-index",a.config.baseFloatZIndex-5);h.setCustomData("maximize_saved_styles",r(h,!0));g.setCustomData("maximize_saved_styles",r(g,!0));h={overflow:CKEDITOR.env.webkit?
"":"hidden",width:0,height:0};e.getDocumentElement().setStyles(h);!CKEDITOR.env.gecko&&e.getDocumentElement().setStyle("position","fixed");CKEDITOR.env.gecko&&CKEDITOR.env.quirks||e.getBody().setStyles(h);CKEDITOR.env.ie?setTimeout(function(){b.$.scrollTo(0,0)},0):b.$.scrollTo(0,0);g.setStyle("position",CKEDITOR.env.gecko&&CKEDITOR.env.quirks?"fixed":"absolute");g.$.offsetLeft;g.setStyles({"z-index":a.config.baseFloatZIndex-5,left:"0px",top:"0px"});g.addClass("cke_maximized");d();h=g.getDocumentPosition();
g.setStyles({left:-1*h.x+"px",top:-1*h.y+"px"});CKEDITOR.env.gecko&&v(a)}else if(this.state==CKEDITOR.TRISTATE_ON){b.removeListener("resize",d);for(var c=[h,g],q=0;q<c.length;q++)u(c[q],c[q].getCustomData("maximize_saved_styles")),c[q].removeCustomData("maximize_saved_styles");for(c=a.container;c=c.getParent();)u(c,c.getCustomData("maximize_saved_styles")),c.removeCustomData("maximize_saved_styles");CKEDITOR.env.ie?setTimeout(function(){b.$.scrollTo(p.x,p.y)},0):b.$.scrollTo(p.x,p.y);g.removeClass("cke_maximized");
CKEDITOR.env.webkit&&(g.setStyle("display","inline"),setTimeout(function(){g.setStyle("display","block")},0));a.fire("resize",{outerHeight:a.container.$.offsetHeight,contentsHeight:h.$.offsetHeight,outerWidth:a.container.$.offsetWidth})}this.toggleState();if(c=this.uiItems[0])h=this.state==CKEDITOR.TRISTATE_OFF?f.maximize.maximize:f.maximize.minimize,c=CKEDITOR.document.getById(c._.id),c.getChild(1).setHtml(h),c.setAttribute("title",h),c.setAttribute("href",'javascript:void("'+h+'");');"wysiwyg"==
a.mode?l?(CKEDITOR.env.gecko&&v(a),a.getSelection().selectRanges(l),(k=a.getSelection().getStartElement())&&k.scrollIntoView(!0)):b.$.scrollTo(m.x,m.y):(l&&(k.selectionStart=l[0],k.selectionEnd=l[1]),k.scrollLeft=m[0],k.scrollTop=m[1]);l=m=null;n=this.state;a.fire("maximize",this.state)},canUndo:!1});a.ui.addButton&&a.ui.addButton("Maximize",{label:f.maximize.maximize,command:"maximize",toolbar:"tools,10"});a.on("mode",function(){var b=a.getCommand("maximize");b.setState(b.state==CKEDITOR.TRISTATE_DISABLED?
CKEDITOR.TRISTATE_DISABLED:n)},null,null,100);if(a.config.maximize_historyIntegration)b.on(a.config.maximize_historyIntegration===CKEDITOR.HISTORY_NATIVE?"popstate":"hashchange",function(){var b=a.getCommand("maximize");b.state===CKEDITOR.TRISTATE_ON&&b.exec()})}}});CKEDITOR.config.maximize_historyIntegration=CKEDITOR.HISTORY_NATIVE})();