/*
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 e(e){CKEDITOR.tools.extend(this,e),this.queue=[],this.init?this.init(CKEDITOR.tools.bind(function(){for(var e;e=this.queue.pop();)e.call(this);this.ready=!0},this)):this.ready=!0}function t(e){var t=e.config.codeSnippet_codeClass,i=/\r?\n/g,n=new CKEDITOR.dom.element("textarea");e.widgets.add("codeSnippet",{allowedContent:"pre; code(language-*)",requiredContent:"pre",styleableElements:"pre",template:'
',dialog:"codeSnippet",pathName:e.lang.codesnippet.pathName,mask:!0,parts:{pre:"pre",code:"code"},highlight:function(){var t=this,n=this.data,s=function(n){t.parts.code.setHtml(e.plugins.codesnippet.isSupportedEnvironment()?n:n.replace(i,"
"))};s(CKEDITOR.tools.htmlEncode(n.code)),e._.codesnippet.highlighter.highlight(n.code,n.lang,function(t){e.fire("lockSnapshot"),s(t),e.fire("unlockSnapshot")})},data:function(){var e=this.data,t=this.oldData;e.code&&this.parts.code.setHtml(CKEDITOR.tools.htmlEncode(e.code)),t&&e.lang!=t.lang&&this.parts.code.removeClass("language-"+t.lang),e.lang&&(this.parts.code.addClass("language-"+e.lang),this.highlight()),this.oldData=CKEDITOR.tools.copy(e)},upcast:function(i,o){if("pre"==i.name){for(var a,h=[],l=i.children,p=l.length-1;p>=0;p--)a=l[p],a.type==CKEDITOR.NODE_TEXT&&a.value.match(s)||h.push(a);var c;if(1==h.length&&"code"==(c=h[0]).name&&1==c.children.length&&c.children[0].type==CKEDITOR.NODE_TEXT)return(h=e._.codesnippet.langsRegex.exec(c.attributes["class"]))&&(o.lang=h[1]),n.setHtml(c.getHtml()),o.code=n.getValue(),c.addClass(t),i}},downcast:function(e){var i=e.getFirst("code");return i.children.length=0,i.removeClass(t),i.add(new CKEDITOR.htmlParser.text(CKEDITOR.tools.htmlEncode(this.data.code))),e}});var s=/^[\s\n\r]*$/}CKEDITOR.plugins.add("codesnippet",{requires:"widget,dialog",lang:"ar,az,bg,ca,cs,da,de,de-ch,el,en,en-au,en-gb,eo,es,es-mx,et,eu,fa,fi,fr,fr-ca,gl,he,hr,hu,id,it,ja,km,ko,ku,lt,lv,nb,nl,no,oc,pl,pt,pt-br,ro,ru,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn",icons:"codesnippet",hidpi:!0,isSupportedEnvironment:function(){return!CKEDITOR.env.ie||8