diff --git a/seminar/.~lock.profile_vysledkovka.txt# b/seminar/.~lock.profile_vysledkovka.txt#
new file mode 100644
index 00000000..cf1b89b4
--- /dev/null
+++ b/seminar/.~lock.profile_vysledkovka.txt#
@@ -0,0 +1 @@
+,anet,erebus,25.03.2020 22:21,file:///home/anet/.config/libreoffice/4;
\ No newline at end of file
diff --git a/seminar/lisak.pdf b/seminar/lisak.pdf
new file mode 100644
index 00000000..64f11598
Binary files /dev/null and b/seminar/lisak.pdf differ
diff --git a/seminar/models.py b/seminar/models.py
index cf8cd6a9..57a44404 100644
--- a/seminar/models.py
+++ b/seminar/models.py
@@ -743,12 +743,17 @@ class Problem(SeminarModelBase,PolymorphicModel):
return 'document.createEvent("Event").timeStamp&&(Gn=function(){return Qn.now()})}function Kn(){var t,e;for(Yn=Gn(),Hn=!0,Bn.sort((function(t,e){return t.id-e.id})),qn=0;qn0&&(n=Sr,u=s,d=r.length):e===Pr?l>0&&(n=Pr,u=l,d=c.length):(u=Math.max(s,l),n=u>0?s>l?Sr:Pr:null,d=n?n===Sr?r.length:c.length:0);var h=n===Sr&&Vr.test(i[Er+"Property"]);return{type:n,timeout:u,propCount:d,hasTransform:h}}function Br(t,e){while(t.lengtho)return NaN;return parseInt(r,i)}return+l};if(r(b,!w(" 0o1")||!w("0b1")||w("+0x1"))){for(var y,x=function(t){var e=arguments.length<1?0:t,n=this;return n instanceof x&&(_?d((function(){v.valueOf.call(n)})):c(n)!=b)?l(new w(k(e)),n,x):k(e)},A=i?f(w):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),C=0;A.length>C;C++)a(w,y=A[C])&&!a(x,y)&&m(x,y,p(w,y));x.prototype=v,v.constructor=x,s(o,b,x)}},ac1f:function(t,e,n){"use strict";var i=n("23e7"),o=n("9263");i({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},ad6d:function(t,e,n){"use strict";var i=n("825a");t.exports=function(){var t=i(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},ae93:function(t,e,n){"use strict";var i,o,r,s=n("e163"),a=n("9112"),c=n("5135"),l=n("b622"),u=n("c430"),d=l("iterator"),h=!1,f=function(){return this};[].keys&&(r=[].keys(),"next"in r?(o=s(s(r)),o!==Object.prototype&&(i=o)):h=!0),void 0==i&&(i={}),u||c(i,d)||a(i,d,f),t.exports={IteratorPrototype:i,BUGGY_SAFARI_ITERATORS:h}},b50d:function(t,e,n){"use strict";var i=n("c532"),o=n("467f"),r=n("30b5"),s=n("83b9"),a=n("c345"),c=n("3934"),l=n("2d83");t.exports=function(t){return new Promise((function(e,u){var d=t.data,h=t.headers;i.isFormData(d)&&delete h["Content-Type"];var f=new XMLHttpRequest;if(t.auth){var p=t.auth.username||"",m=t.auth.password||"";h.Authorization="Basic "+btoa(p+":"+m)}var g=s(t.baseURL,t.url);if(f.open(t.method.toUpperCase(),r(g,t.params,t.paramsSerializer),!0),f.timeout=t.timeout,f.onreadystatechange=function(){if(f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in f?a(f.getAllResponseHeaders()):null,i=t.responseType&&"text"!==t.responseType?f.response:f.responseText,r={data:i,status:f.status,statusText:f.statusText,headers:n,config:t,request:f};o(e,u,r),f=null}},f.onabort=function(){f&&(u(l("Request aborted",t,"ECONNABORTED",f)),f=null)},f.onerror=function(){u(l("Network Error",t,null,f)),f=null},f.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),u(l(e,t,"ECONNABORTED",f)),f=null},i.isStandardBrowserEnv()){var b=n("7aac"),w=(t.withCredentials||c(g))&&t.xsrfCookieName?b.read(t.xsrfCookieName):void 0;w&&(h[t.xsrfHeaderName]=w)}if("setRequestHeader"in f&&i.forEach(h,(function(t,e){"undefined"===typeof d&&"content-type"===e.toLowerCase()?delete h[e]:f.setRequestHeader(e,t)})),i.isUndefined(t.withCredentials)||(f.withCredentials=!!t.withCredentials),t.responseType)try{f.responseType=t.responseType}catch(v){if("json"!==t.responseType)throw v}"function"===typeof t.onDownloadProgress&&f.addEventListener("progress",t.onDownloadProgress),"function"===typeof t.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){f&&(f.abort(),u(t),f=null)})),void 0===d&&(d=null),f.send(d)}))}},b575:function(t,e,n){var i,o,r,s,a,c,l,u,d=n("da84"),h=n("06cf").f,f=n("c6b6"),p=n("2cf4").set,m=n("1cdc"),g=d.MutationObserver||d.WebKitMutationObserver,b=d.process,w=d.Promise,v="process"==f(b),_=h(d,"queueMicrotask"),k=_&&_.value;k||(i=function(){var t,e;v&&(t=b.domain)&&t.exit();while(o){e=o.fn,o=o.next;try{e()}catch(n){throw o?s():r=void 0,n}}r=void 0,t&&t.enter()},v?s=function(){b.nextTick(i)}:g&&!m?(a=!0,c=document.createTextNode(""),new g(i).observe(c,{characterData:!0}),s=function(){c.data=a=!a}):w&&w.resolve?(l=w.resolve(void 0),u=l.then,s=function(){u.call(l,i)}):s=function(){p.call(d,i)}),t.exports=k||function(t){var e={fn:t,next:void 0};r&&(r.next=e),o||(o=e,s()),r=e}},b622:function(t,e,n){var i=n("da84"),o=n("5692"),r=n("5135"),s=n("90e3"),a=n("4930"),c=n("fdbf"),l=o("wks"),u=i.Symbol,d=c?u:u&&u.withoutSetter||s;t.exports=function(t){return r(l,t)||(a&&r(u,t)?l[t]=u[t]:l[t]=d("Symbol."+t)),l[t]}},bc3a:function(t,e,n){t.exports=n("cee4")},c04e:function(t,e,n){var i=n("861d");t.exports=function(t,e){if(!i(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!i(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!i(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!i(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},c345:function(t,e,n){"use strict";var i=n("c532"),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(t){var e,n,r,s={};return t?(i.forEach(t.split("\n"),(function(t){if(r=t.indexOf(":"),e=i.trim(t.substr(0,r)).toLowerCase(),n=i.trim(t.substr(r+1)),e){if(s[e]&&o.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([n]):s[e]?s[e]+", "+n:n}})),s):s}},c401:function(t,e,n){"use strict";var i=n("c532");t.exports=function(t,e,n){return i.forEach(n,(function(n){t=n(t,e)})),t}},c430:function(t,e){t.exports=!1},c532:function(t,e,n){"use strict";var i=n("1d2b"),o=Object.prototype.toString;function r(t){return"[object Array]"===o.call(t)}function s(t){return"undefined"===typeof t}function a(t){return null!==t&&!s(t)&&null!==t.constructor&&!s(t.constructor)&&"function"===typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function c(t){return"[object ArrayBuffer]"===o.call(t)}function l(t){return"undefined"!==typeof FormData&&t instanceof FormData}function u(t){var e;return e="undefined"!==typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function d(t){return"string"===typeof t}function h(t){return"number"===typeof t}function f(t){return null!==t&&"object"===typeof t}function p(t){return"[object Date]"===o.call(t)}function m(t){return"[object File]"===o.call(t)}function g(t){return"[object Blob]"===o.call(t)}function b(t){return"[object Function]"===o.call(t)}function w(t){return f(t)&&b(t.pipe)}function v(t){return"undefined"!==typeof URLSearchParams&&t instanceof URLSearchParams}function _(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function k(){return("undefined"===typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!==typeof window&&"undefined"!==typeof document)}function y(t,e){if(null!==t&&"undefined"!==typeof t)if("object"!==typeof t&&(t=[t]),r(t))for(var n=0,i=t.length;nc)i(a,n=e[c++])&&(~r(l,n)||l.push(n));return l}},cc12:function(t,e,n){var i=n("da84"),o=n("861d"),r=i.document,s=o(r)&&o(r.createElement);t.exports=function(t){return s?r.createElement(t):{}}},cca6:function(t,e,n){var i=n("23e7"),o=n("60da");i({target:"Object",stat:!0,forced:Object.assign!==o},{assign:o})},cdf9:function(t,e,n){var i=n("825a"),o=n("861d"),r=n("f069");t.exports=function(t,e){if(i(t),o(e)&&e.constructor===t)return e;var n=r.f(t),s=n.resolve;return s(e),n.promise}},ce4e:function(t,e,n){var i=n("da84"),o=n("9112");t.exports=function(t,e){try{o(i,t,e)}catch(n){i[t]=e}return e}},cee4:function(t,e,n){"use strict";var i=n("c532"),o=n("1d2b"),r=n("0a06"),s=n("4a7b"),a=n("2444");function c(t){var e=new r(t),n=o(r.prototype.request,e);return i.extend(n,r.prototype,e),i.extend(n,e),n}var l=c(a);l.Axios=r,l.create=function(t){return c(s(l.defaults,t))},l.Cancel=n("7a77"),l.CancelToken=n("8df4"),l.isCancel=n("2e67"),l.all=function(t){return Promise.all(t)},l.spread=n("0df6"),t.exports=l,t.exports.default=l},d012:function(t,e){t.exports={}},d039:function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},d066:function(t,e,n){var i=n("428f"),o=n("da84"),r=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?r(i[t])||r(o[t]):i[t]&&i[t][e]||o[t]&&o[t][e]}},d1e7:function(t,e,n){"use strict";var i={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,r=o&&!i.call({1:2},1);e.f=r?function(t){var e=o(this,t);return!!e&&e.enumerable}:i},d2bb:function(t,e,n){var i=n("825a"),o=n("3bbe");t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set,t.call(n,[]),e=n instanceof Array}catch(r){}return function(n,r){return i(n),o(r),e?t.call(n,r):n.__proto__=r,n}}():void 0)},d44e:function(t,e,n){var i=n("9bf2").f,o=n("5135"),r=n("b622"),s=r("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,s)&&i(t,s,{configurable:!0,value:e})}},d784:function(t,e,n){"use strict";n("ac1f");var i=n("6eeb"),o=n("d039"),r=n("b622"),s=n("9263"),a=n("9112"),c=r("species"),l=!o((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")})),u=function(){return"$0"==="a".replace(/./,"$0")}(),d=r("replace"),h=function(){return!!/./[d]&&""===/./[d]("a","$0")}(),f=!o((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));t.exports=function(t,e,n,d){var p=r(t),m=!o((function(){var e={};return e[p]=function(){return 7},7!=""[t](e)})),g=m&&!o((function(){var e=!1,n=/a/;return"split"===t&&(n={},n.constructor={},n.constructor[c]=function(){return n},n.flags="",n[p]=/./[p]),n.exec=function(){return e=!0,null},n[p](""),!e}));if(!m||!g||"replace"===t&&(!l||!u||h)||"split"===t&&!f){var b=/./[p],w=n(p,""[t],(function(t,e,n,i,o){return e.exec===s?m&&!o?{done:!0,value:b.call(e,n,i)}:{done:!0,value:t.call(n,e,i)}:{done:!1}}),{REPLACE_KEEPS_$0:u,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:h}),v=w[0],_=w[1];i(String.prototype,t,v),i(RegExp.prototype,p,2==e?function(t,e){return _.call(t,this,e)}:function(t){return _.call(t,this)})}d&&a(RegExp.prototype[p],"sham",!0)}},d925:function(t,e,n){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},da84:function(t,e,n){(function(e){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||Function("return this")()}).call(this,n("c8ba"))},df75:function(t,e,n){var i=n("ca84"),o=n("7839");t.exports=Object.keys||function(t){return i(t,o)}},df7c:function(t,e,n){(function(t){function n(t,e){for(var n=0,i=t.length-1;i>=0;i--){var o=t[i];"."===o?t.splice(i,1):".."===o?(t.splice(i,1),n++):n&&(t.splice(i,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function i(t){"string"!==typeof t&&(t+="");var e,n=0,i=-1,o=!0;for(e=t.length-1;e>=0;--e)if(47===t.charCodeAt(e)){if(!o){n=e+1;break}}else-1===i&&(o=!1,i=e+1);return-1===i?"":t.slice(n,i)}function o(t,e){if(t.filter)return t.filter(e);for(var n=[],i=0;i=1;--r)if(e=t.charCodeAt(r),47===e){if(!o){i=r;break}}else o=!1;return-1===i?n?"/":".":n&&1===i?"/":t.slice(0,i)},e.basename=function(t,e){var n=i(t);return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},e.extname=function(t){"string"!==typeof t&&(t+="");for(var e=-1,n=0,i=-1,o=!0,r=0,s=t.length-1;s>=0;--s){var a=t.charCodeAt(s);if(47!==a)-1===i&&(o=!1,i=s+1),46===a?-1===e?e=s:1!==r&&(r=1):-1!==e&&(r=-1);else if(!o){n=s+1;break}}return-1===e||-1===i||0===r||1===r&&e===i-1&&e===n+1?"":t.slice(e,i)};var r="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)}}).call(this,n("4362"))},e163:function(t,e,n){var i=n("5135"),o=n("7b0b"),r=n("f772"),s=n("e177"),a=r("IE_PROTO"),c=Object.prototype;t.exports=s?Object.getPrototypeOf:function(t){return t=o(t),i(t,a)?t[a]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?c:null}},e177:function(t,e,n){var i=n("d039");t.exports=!i((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},e260:function(t,e,n){"use strict";var i=n("fc6a"),o=n("44d2"),r=n("3f8c"),s=n("69f3"),a=n("7dd0"),c="Array Iterator",l=s.set,u=s.getterFor(c);t.exports=a(Array,"Array",(function(t,e){l(this,{type:c,target:i(t),index:0,kind:e})}),(function(){var t=u(this),e=t.target,n=t.kind,i=t.index++;return!e||i>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:i,done:!1}:"values"==n?{value:e[i],done:!1}:{value:[i,e[i]],done:!1}}),"values"),r.Arguments=r.Array,o("keys"),o("values"),o("entries")},e2cc:function(t,e,n){var i=n("6eeb");t.exports=function(t,e,n){for(var o in e)i(t,o,e[o],n);return t}},e39b:function(t,e,n){
+/*!
+ * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+!function(t){t.en=Object.assign(t.en||{},{a:"Cannot upload file:",b:"Image toolbar",c:"Table toolbar",d:"Upload in progress",e:"Block quote",f:"Bold",g:"Choose heading",h:"Heading",i:"Italic",j:"image widget",k:"Full size image",l:"Side image",m:"Left aligned image",n:"Centered image",o:"Right aligned image",p:"Enter image caption",q:"Insert image",r:"Upload failed",s:"Increase indent",t:"Decrease indent",u:"Numbered List",v:"Bulleted List",w:"Link",x:"media widget",y:"Insert media",z:"The URL must not be empty.",aa:"This media URL is not supported.",ab:"Insert table",ac:"Header column",ad:"Insert column left",ae:"Insert column right",af:"Delete column",ag:"Column",ah:"Header row",ai:"Insert row below",aj:"Insert row above",ak:"Delete row",al:"Row",am:"Merge cell up",an:"Merge cell right",ao:"Merge cell down",ap:"Merge cell left",aq:"Split cell vertically",ar:"Split cell horizontally",as:"Merge cells",at:"Widget toolbar",au:"Change image text alternative",av:"Editor toolbar",aw:"Show more items",ax:"Rich Text Editor",ay:"Rich Text Editor, %0",az:"%0 of %1",ba:"Previous",bb:"Next",bc:"Save",bd:"Cancel",be:"Text alternative",bf:"Dropdown toolbar",bg:"Undo",bh:"Redo",bi:"Open in a new tab",bj:"Downloadable",bk:"Paste the media URL in the input.",bl:"Tip: Paste the URL into the content to embed faster.",bm:"Media URL",bn:"Unlink",bo:"Edit link",bp:"Open link in new tab",bq:"This link has no URL",br:"Link URL",bs:"Paragraph",bt:"Heading 1",bu:"Heading 2",bv:"Heading 3",bw:"Heading 4",bx:"Heading 5",by:"Heading 6"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),function(e,n){t.exports=n()}(window,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=95)}([function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return r}));const i="https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html";class o extends Error{constructor(t,e,n){t=r(t),n&&(t+=" "+JSON.stringify(n)),super(t),this.name="CKEditorError",this.context=e,this.data=n}is(t){return"CKEditorError"===t}static rethrowUnexpectedError(t,e){if(t.is&&t.is("CKEditorError"))throw t;throw new o("unexpected-error",e,{originalError:{message:t.message,stack:t.stack,name:t.name}})}}function r(t){const e=t.match(/^([^:]+):/);return e?t+` Read more: ${i}#error-${e[1]}\n`:t}},function(t,e,n){"use strict";var i={},o=function(){var t;return function(){return void 0===t&&(t=Boolean(window&&document&&document.all&&!window.atob)),t}}(),r=function(){var t={};return function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}t[e]=n}return t[e]}}();function s(t,e){for(var n=[],i={},o=0;o
").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).indexOf("
")>-1&&(t=`
${t}
`),t}(i.getData("text/plain"))),o=this._htmlDataProcessor.toView(o),this.fire("inputTransformation",{content:o,dataTransfer:i}),n.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(t,e)=>{if(!e.content.isEmpty){const t=this.editor.data,n=this.editor.model,i=t.toModel(e.content,"$clipboardHolder");if(0==i.childCount)return;n.insertContent(i)}},{priority:"low"}),this.listenTo(i,"copy",o,{priority:"low"}),this.listenTo(i,"cut",(e,n)=>{t.isReadOnly?n.preventDefault():o(e,n)},{priority:"low"}),this.listenTo(i,"clipboardOutput",(n,i)=>{i.content.isEmpty||(i.dataTransfer.setData("text/html",this._htmlDataProcessor.toData(i.content)),i.dataTransfer.setData("text/plain",function t(e){let n="";if(e.is("text")||e.is("textProxy"))n=e.data;else if(e.is("img")&&e.hasAttribute("alt"))n=e.getAttribute("alt");else{let i=null;for(const o of e.getChildren()){const e=t(o);i&&(i.is("containerElement")||o.is("containerElement"))&&(xu.includes(i.name)||xu.includes(o.name)?n+="\n":n+="\n\n"),n+=e,i=o}}return n}(i.content))),"cut"==i.method&&t.model.deleteContent(e.selection)},{priority:"low"})}}class Cu{constructor(t){this.editor=t,this.set("value",void 0),this.set("isEnabled",!1),this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.on("execute",t=>{this.isEnabled||t.stop()},{priority:"high"}),this.listenTo(t,"change:isReadOnly",(t,e,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})}refresh(){this.isEnabled=!0}forceDisabled(t){this._disableStack.add(t),1==this._disableStack.size&&(this.on("set:isEnabled",Tu,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(t){this._disableStack.delete(t),0==this._disableStack.size&&(this.off("set:isEnabled",Tu),this.refresh())}execute(){}destroy(){this.stopListening()}}function Tu(t){t.return=!1,t.stop()}function*Su(t,e){for(const n of e)n&&t.getAttributeProperties(n[0]).copyOnEnter&&(yield n)}ci(Cu,Fi);class Pu extends Cu{execute(){const t=this.editor.model,e=t.document;t.change(n=>{!function(t,e,n,i){const o=n.isCollapsed,r=n.getFirstRange(),s=r.start.parent,a=r.end.parent;if(i.isLimit(s)||i.isLimit(a))o||s!=a||t.deleteContent(n);else if(o){const t=Su(e.model.schema,n.getAttributes());Eu(e,r.start),e.setSelectionAttribute(t)}else{const i=!(r.start.isAtStart&&r.end.isAtEnd),o=s==a;t.deleteContent(n,{leaveUnmerged:i}),i&&(o?Eu(e,n.focus):e.setSelection(a,0))}}(this.editor.model,n,e.selection,t.schema),this.fire("afterExecute",{writer:n})})}}function Eu(t,e){t.split(e),t.setSelection(e.parent.nextSibling,0)}class Mu extends dr{constructor(t){super(t);const e=this.document;e.on("keydown",(t,n)=>{if(this.isEnabled&&n.keyCode==bo.enter){let i;e.once("enter",t=>i=t,{priority:"highest"}),e.fire("enter",new Zr(e,n.domEvent,{isSoft:n.shiftKey})),i&&i.stop.called&&t.stop()}})}observe(){}}class Iu extends _u{static get pluginName(){return"Enter"}init(){const t=this.editor,e=t.editing.view,n=e.document;e.addObserver(Mu),t.commands.add("enter",new Pu(t)),this.listenTo(n,"enter",(n,i)=>{i.preventDefault(),i.isSoft||(t.execute("enter"),e.scrollToTheSelection())},{priority:"low"})}}class Ou extends Cu{execute(){const t=this.editor.model,e=t.document;t.change(n=>{!function(t,e,n){const i=n.isCollapsed,o=n.getFirstRange(),r=o.start.parent,s=o.end.parent,a=r==s;if(i){const i=Su(t.schema,n.getAttributes());Nu(e,o.end),e.removeSelectionAttribute(n.getAttributeKeys()),e.setSelectionAttribute(i)}else{const i=!(o.start.isAtStart&&o.end.isAtEnd);t.deleteContent(n,{leaveUnmerged:i}),a?Nu(e,n.focus):i&&e.setSelection(s,0)}}(t,n,e.selection),this.fire("afterExecute",{writer:n})})}refresh(){const t=this.editor.model,e=t.document;this.isEnabled=function(t,e){if(e.rangeCount>1)return!1;const n=e.anchor;if(!n||!t.checkChild(n,"softBreak"))return!1;const i=e.getFirstRange(),o=i.start.parent,r=i.end.parent;return!Ru(o,t)&&!Ru(r,t)||o===r}(t.schema,e.selection)}}function Nu(t,e){const n=t.createElement("softBreak");t.insert(n,e),t.setSelection(n,"after")}function Ru(t,e){return!t.is("rootElement")&&(e.isLimit(t)||Ru(t.parent,e))}class ju extends _u{static get pluginName(){return"ShiftEnter"}init(){const t=this.editor,e=t.model.schema,n=t.conversion,i=t.editing.view,o=i.document;e.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(t,e)=>e.createEmptyElement("br")}),i.addObserver(Mu),t.commands.add("shiftEnter",new Ou(t)),this.listenTo(o,"enter",(e,n)=>{n.preventDefault(),n.isSoft&&(t.execute("shiftEnter"),i.scrollToTheSelection())},{priority:"low"})}}class Du{constructor(t,e=20){this.model=t,this.size=0,this.limit=e,this.isLocked=!1,this._changeCallback=(t,e)=>{"transparent"!=e.type&&e!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch()),this._batch}input(t){this.size+=t,this.size>=this.limit&&this._reset(!0)}lock(){this.isLocked=!0}unlock(){this.isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(t){this.isLocked&&!t||(this._batch=null,this.size=0)}}class Lu extends Cu{constructor(t,e){super(t),this._buffer=new Du(t.model,e),this._batches=new WeakSet}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(t={}){const e=this.editor.model,n=e.document,i=t.text||"",o=i.length,r=t.range||n.selection.getFirstRange(),s=t.resultRange;e.enqueueChange(this._buffer.batch,t=>{const a=r.isCollapsed;this._buffer.lock(),e.deleteContent(e.createSelection(r)),i&&e.insertContent(t.createText(i,n.selection.getAttributes()),r.start),s?t.setSelection(s):a&&t.setSelection(r.start.getShiftedBy(o)),this._buffer.unlock(),this._buffer.input(o),this._batches.add(this._buffer.batch)})}}function Vu(t){let e=null;const n=t.model,i=t.editing.view,o=t.commands.get("input");function r(t){const r=n.document,a=i.document.isComposing,c=e&&e.isEqual(r.selection);e=null,o.isEnabled&&(function(t){return!!t.ctrlKey||zu.includes(t.keyCode)}(t)||r.selection.isCollapsed||a&&229===t.keyCode||!a&&229===t.keyCode&&c||s())}function s(){const t=o.buffer;t.lock(),n.enqueueChange(t.batch,()=>{n.deleteContent(n.document.selection)}),t.unlock()}po.isAndroid?i.document.on("beforeinput",(t,e)=>r(e),{priority:"lowest"}):i.document.on("keydown",(t,e)=>r(e),{priority:"lowest"}),i.document.on("compositionstart",(function(){const t=n.document,e=1!==t.selection.rangeCount||t.selection.getFirstRange().isFlat;t.selection.isCollapsed||e||s()}),{priority:"lowest"}),i.document.on("compositionend",()=>{e=n.createSelection(n.document.selection)},{priority:"lowest"})}const zu=[wo("arrowUp"),wo("arrowRight"),wo("arrowDown"),wo("arrowLeft"),9,16,17,18,19,20,27,33,34,35,36,45,91,93,144,145,173,174,175,176,177,178,179,255];for(let mb=112;mb<=135;mb++)zu.push(mb);function Bu(t){if(t.newChildren.length-t.oldChildren.length!=1)return;const e=function(t,e){const n=[];let i,o=0;return t.forEach(t=>{"equal"==t?(r(),o++):"insert"==t?(s("insert")?i.values.push(e[o]):(r(),i={type:"insert",index:o,values:[e[o]]}),o++):s("delete")?i.howMany++:(r(),i={type:"delete",index:o,howMany:1})}),r(),n;function r(){i&&(n.push(i),i=null)}function s(t){return i&&i.type==t}}(Yo(t.oldChildren,t.newChildren,Fu),t.newChildren);if(e.length>1)return;const n=e[0];return n.values[0]&&n.values[0].is("text")?n:void 0}function Fu(t,e){return t&&t.is("text")&&e&&e.is("text")?t.data===e.data:t===e}class Uu{constructor(t){this.editor=t,this.editing=this.editor.editing}handle(t,e){if(function(t){if(0==t.length)return!1;for(const e of t)if("children"===e.type&&!Bu(e))return!0;return!1}(t))this._handleContainerChildrenMutations(t,e);else for(const n of t)this._handleTextMutation(n,e),this._handleTextNodeInsertion(n)}_handleContainerChildrenMutations(t,e){const n=function(t){const e=t.map(t=>t.node).reduce((t,e)=>t.getCommonAncestor(e,{includeSelf:!0}));if(e)return e.getAncestors({includeSelf:!0,parentFirst:!0}).find(t=>t.is("containerElement")||t.is("rootElement"))}(t);if(!n)return;const i=this.editor.editing.view.domConverter.mapViewToDom(n),o=new or,r=this.editor.data.toModel(o.domToView(i)).getChild(0),s=this.editor.editing.mapper.toModelElement(n);if(!s)return;const a=Array.from(r.getChildren()),c=Array.from(s.getChildren()),l=a[a.length-1],u=c[c.length-1];l&&l.is("softBreak")&&u&&!u.is("softBreak")&&a.pop();const d=this.editor.model.schema;if(!$u(a,d)||!$u(c,d))return;const h=a.map(t=>t.is("text")?t.data:"@").join("").replace(/\u00A0/g," "),f=c.map(t=>t.is("text")?t.data:"@").join("").replace(/\u00A0/g," ");if(f===h)return;const p=Yo(f,h),{firstChangeAt:m,insertions:g,deletions:b}=Hu(p);let w=null;e&&(w=this.editing.mapper.toModelRange(e.getFirstRange()));const v=h.substr(m,g),_=this.editor.model.createRange(this.editor.model.createPositionAt(s,m),this.editor.model.createPositionAt(s,m+b));this.editor.execute("input",{text:v,range:_,resultRange:w})}_handleTextMutation(t,e){if("text"!=t.type)return;const n=t.newText.replace(/\u00A0/g," "),i=t.oldText.replace(/\u00A0/g," ");if(i===n)return;const o=Yo(i,n),{firstChangeAt:r,insertions:s,deletions:a}=Hu(o);let c=null;e&&(c=this.editing.mapper.toModelRange(e.getFirstRange()));const l=this.editing.view.createPositionAt(t.node,r),u=this.editing.mapper.toModelPosition(l),d=this.editor.model.createRange(u,u.getShiftedBy(a)),h=n.substr(r,s);this.editor.execute("input",{text:h,range:d,resultRange:c})}_handleTextNodeInsertion(t){if("children"!=t.type)return;const e=Bu(t),n=this.editing.view.createPositionAt(t.node,e.index),i=this.editing.mapper.toModelPosition(n),o=e.values[0].data;this.editor.execute("input",{text:o.replace(/\u00A0/g," "),range:this.editor.model.createRange(i)})}}function $u(t,e){return t.every(t=>e.isInline(t))}function Hu(t){let e=null,n=null;for(let r=0;r