1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3813],{3813:function(t,e,r){var o,i,s;/*! 2 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. 3 * For licensing, see LICENSE.md. 4 */self,t.exports=(o=r(67294),i=r(45697),s=r(19695),(()=>{"use strict";var t={546:t=>{t.exports=s},949:t=>{t.exports=i},155:t=>{t.exports=o}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,n),i.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{n.r(r),n.d(r,{CKEditor:()=>u,CKEditorContext:()=>c,useMultiRootEditor:()=>f});var t=n(155),e=n.n(t),o=n(949),i=n.n(o);let s=Array(256).fill("").map((t,e)=>("0"+e.toString(16)).slice(-2));var a=n(546);let d=e().createContext("contextWatchdog");let c=class c extends e().Component{constructor(t,e){super(t,e),this.contextWatchdog=null,this.props.isLayoutReady&&this._initializeContextWatchdog(this.props.config)}shouldComponentUpdate(t){return this._shouldComponentUpdate(t)}async _shouldComponentUpdate(t){return t.id!==this.props.id&&(this.contextWatchdog&&await this.contextWatchdog.destroy(),await this._initializeContextWatchdog(t.config)),t.isLayoutReady&&!this.contextWatchdog?(await this._initializeContextWatchdog(t.config),!0):this.props.children!==t.children}render(){return e().createElement(d.Provider,{value:this.contextWatchdog},this.props.children)}componentWillUnmount(){this._destroyContext()}async _initializeContextWatchdog(t){this.contextWatchdog=new a.ContextWatchdog(this.props.context,this.props.watchdogConfig),this.contextWatchdog.on("error",(t,e)=>{this.props.onError(e.error,{phase:"runtime",willContextRestart:e.causesRestart})}),this.contextWatchdog.on("stateChange",()=>{"ready"===this.contextWatchdog.state&&this.props.onReady&&this.props.onReady(this.contextWatchdog.context)}),await this.contextWatchdog.create(t).catch(t=>{this.props.onError(t,{phase:"initialization",willContextRestart:!1})})}async _destroyContext(){this.contextWatchdog&&(await this.contextWatchdog.destroy(),this.contextWatchdog=null)}};c.defaultProps={isLayoutReady:!0,onError:(t,e)=>console.error(t,e)},c.propTypes={id:i().string,isLayoutReady:i().bool,context:i().func,watchdogConfig:i().object,config:i().object,onReady:i().func,onError:i().func};let h="Lock from React integration (@ckeditor/ckeditor5-react)";let u=class u extends e().Component{constructor(t){super(t),this.editorDestructionInProgress=null,this.domContainer=e().createRef(),this.watchdog=null;let{CKEDITOR_VERSION:r}=window;if(r){let[t]=r.split(".").map(Number);t<37&&console.warn("The <CKEditor> component requires using CKEditor 5 in version 37 or higher.")}else console.warn('Cannot find the "CKEDITOR_VERSION" in the "window" scope.')}get editor(){return this.props.disableWatchdog?this.instance:this.watchdog?this.watchdog.editor:null}shouldComponentUpdate(t){return!!this.editor&&(t.id!==this.props.id||t.disableWatchdog!==this.props.disableWatchdog||(this._shouldUpdateEditor(t)&&this.editor.data.set(t.data),"disabled"in t&&(t.disabled?this.editor.enableReadOnlyMode(h):this.editor.disableReadOnlyMode(h)),!1))}async componentDidMount(){await this._initializeEditor()}async componentDidUpdate(){await this._destroyEditor(),await this._initializeEditor()}async componentWillUnmount(){await this._destroyEditor()}render(){return e().createElement("div",{ref:this.domContainer})}async _initializeEditor(){await this.editorDestructionInProgress,this.props.disableWatchdog?this.instance=await this._createEditor(this.domContainer.current,this._getConfig()):this.watchdog||(this.context instanceof a.ContextWatchdog?this.watchdog=new l(this.context):this.watchdog=new u._EditorWatchdog(this.props.editor,this.props.watchdogConfig),this.watchdog.setCreator((t,e)=>this._createEditor(t,e)),this.watchdog.on("error",(t,{error:e,causesRestart:r})=>{(this.props.onError||console.error)(e,{phase:"runtime",willEditorRestart:r})}),await this.watchdog.create(this.domContainer.current,this._getConfig()).catch(t=>{(this.props.onError||console.error)(t,{phase:"initialization",willEditorRestart:!1})}))}_createEditor(t,e){return this.props.editor.create(t,e).then(t=>{"disabled"in this.props&&this.props.disabled&&t.enableReadOnlyMode(h);let e=t.model.document,r=t.editing.view.document;return e.on("change:data",e=>{this.props.onChange&&this.props.onChange(e,t)}),r.on("focus",e=>{this.props.onFocus&&this.props.onFocus(e,t)}),r.on("blur",e=>{this.props.onBlur&&this.props.onBlur(e,t)}),setTimeout(()=>{this.props.onReady&&this.props.onReady(t)}),t})}async _destroyEditor(){this.editorDestructionInProgress=new Promise(t=>{setTimeout(async()=>this.watchdog?(await this.watchdog.destroy(),this.watchdog=null,t()):this.instance?(await this.instance.destroy(),this.instance=null,t()):void t())})}_shouldUpdateEditor(t){return this.props.data!==t.data&&this.editor.data.get()!==t.data}_getConfig(){let t=this.props.config||{};return this.props.data&&t.initialData&&console.warn("Editor data should be provided either using `config.initialData` or `content` property. The config value takes precedence over `content` property and will be used when both are specified."),{...t,initialData:t.initialData||this.props.data||""}}};u.contextType=d,u.propTypes={editor:i().func.isRequired,data:i().string,config:i().object,disableWatchdog:i().bool,w
4atchdogConfig:i().object,onChange:i().func,onReady:i().func,onFocus:i().func,onBlur:i().func,onError:i().func,disabled:i().bool,id:i().any},u._EditorWatchdog=a.EditorWatchdog;let l=class l{constructor(t){this._contextWatchdog=t,this._id=function(){let t=4294967296*Math.random()>>>0,e=4294967296*Math.random()>>>0,r=4294967296*Math.random()>>>0,o=4294967296*Math.random()>>>0;return"e"+s[255&t]+s[t>>8&255]+s[t>>16&255]+s[t>>24&255]+s[255&e]+s[e>>8&255]+s[e>>16&255]+s[e>>24&255]+s[255&r]+s[r>>8&255]+s[r>>16&255]+s[r>>24&255]+s[255&o]+s[o>>8&255]+s[o>>16&255]+s[o>>24&255]}()}setCreator(t){this._creator=t}create(t,e){return this._contextWatchdog.add({sourceElementOrData:t,config:e,creator:this._creator,id:this._id,type:"editor"})}on(t,e){this._contextWatchdog.on("itemError",(t,{itemId:r,error:o})=>{r===this._id&&e(null,{error:o,causesRestart:void 0})})}destroy(){return"ready"===this._contextWatchdog.state?this._contextWatchdog.remove(this._id):Promise.resolve()}get editor(){return this._contextWatchdog.getItem(this._id)}};let m="Lock from React integration (@ckeditor/ckeditor5-react)",g=({editor:r})=>{let o=(0,t.useRef)(null);return(0,t.useEffect)(()=>
4{let t=o.current;if(!r||!t)return;let e=r.ui.view.toolbar.element;return t&&t.appendChild(e),()=>{t&&t.removeChild(e)}},[r&&r.id]),e().createElement("div",{ref:o})},f=r=>{let o=(0,t.useRef)(null),i=(0,t.useRef)(null),s=(0,t.useContext)(d),[h,p]=(0,t.useState)(null),[y,b]=(0,t.useState)(r.data),[w,P]=(0,t.useState)(r.rootsAttributes||{}),[N,S]=(0,t.useState)([]),T=(0,t.useRef)(!0);(0,t.useEffect)(()=>((async()=>{await i.current,!1!==r.isLayoutReady&&await v()})(),()=>{x().then(()=>{i.current=null})}),[r.isLayoutReady]),(0,t.useEffect)(()=>{h&&(r.disabled?h.enableReadOnlyMode(m):h.disableReadOnlyMode(m))},[r.disabled]),(0,t.useEffect)(()=>{if(h&&!i.current){let t=h.getFullData();b({...t}),P({...h.getRootsAttributes()}),S([...Object.keys(t).map(t=>C(h,t))])}},[h&&h.id]);let E=()=>{let t=r.config||{};return r.data&&t.initialData&&console.warn("Editor data should be provided either using `config.initialData` or `data` property. The config value takes precedence over `data` property and will be used when both are specified."),{...t,rootsAttributes:w}},C=(t,r)=>e().createElement("div",{id:r,key:r,ref:e=>{if(e){let o=t.ui.view.createEditable(r,e);t.ui.addEditable(o),t.editing.view.forceRender()}}}),R=(t,e)=>r.editor.create(t,e).then(t=>{r.disabled&&r.disabled&&t.enableReadOnlyMode(m);let e=t.model.document,o=t.editing.view.document;return e.on("change:data",e=>((t,e)=>{let o=t.model.document;if(!r.disableTwoWayDataBinding){let e={},r={};
4o.differ.getChanges().forEach(r=>{let o;if(!(o="insert"==r.type||"remove"==r.type?r.position.root:r.range.root).isAttached())return;let{rootName:i}=o;e[i]=t.getData({rootName:i})}),o.differ.getChangedRoots().forEach(o=>{if(o.state)return void(void 0!==e[o.name]&&delete e[o.name]);let i=o.name;r[i]=t.getRootAttributes(i)}),Object.keys(e).length&&b(t=>({...t,...e})),Object.keys(r).length&&P(t=>({...t,...r}))}r.onChange&&r.onChange(e,t)})(t,e)),t.on("addRoot",(e,o)=>((t,e,o)=>{let i=o.rootName,s=C(t,i);r.disableTwoWayDataBinding||(b(e=>({...e,[i]:t.getData({rootName:i})})),P(e=>({...e,[i]:t.getRootAttributes(i)}))),S(t=>[...t,s])})(t,0,o)),t.on("detachRoot",(e,o)=>((t,e,o)=>{let i=o.rootName;S(t=>t.filter(t=>t.props.id!==i)),r.disableTwoWayDataBinding||(b(t=>{let{[i]:e,...r}=t;return{...r}}),P(t=>{let{[i]:e,...r}=t;return{...r}})),t.detachEditable(o)})(t,0,o)),o.on("focus",e=>{r.onFocus&&r.onFocus(e,t)}),o.on("blur",e=>{r.onBlur&&r.onBlur(e,t)}),p(t),r.onReady&&r.onReady(t),t}),x=async()=>{p(null),b({}),P({}),S([]),i.current=new Promise(t=>{setTimeout(async()=>o.current?(await o.current.destroy(),o.current=null,t()):h?(await h.destroy(),t()):void t())})},v=async()=>{if(r.disableWatchdog)return void await R(r.data,E());if(o.current)return;s instanceof a.ContextWatchdog?o.current=new l(s):o.current=new a.EditorWatchdog(r.editor,r.watchdogConfig);let t=o.current;t.setCreator((t,e)=>R(t,e)),t.on("error",(t,{error:e,causesRestart:o})=>{(r.onError||console.error)(e,{phase:"runtime",willEditorRestart:o})}),await t.create(y,E()).catch(t=>{(r.onError||console.error)(t,{phase:"initialization",willEditorRestart:!1})})};(0,t.useEffect)(()=>{if(h&&T.current){T.current=!1;let t=Object.keys(y),e=Object.keys(w);if(!t.every(t=>e.includes(t)))throw Error("`data` and `attributes` objects must have the same keys (roots).");let r=h.getFullData(),o=h.getRootsAttributes(),{addedKeys:i,removedKeys:s}=W(r,y||{}),a=t.some(t=>void 0!==r[t]&&JSON.stringify(r[t])!==JSON.stringify(y[t])),d=e.filter(t=>JSON.stringify(o[t])!==JSON.stringify(w[t]));h.model.change(t=>{_(i),k(s),a&&O(),d.length&&D(t,d)})}},[y,w]);let W=(t,e)=>{let r=Object.keys(t),o=Object.keys(e);return{addedKeys:o.filter(t=>!r.includes(t)),removedKeys:r.filter(t=>!o.includes(t))}},_=t=>{t.forEach(t=>{h.addRoot(t,{data:y[t]||"",attributes:(null==w?void 0:w[t])||{},isUndoable:!0})})},k=t=>{t.forEach(t=>{h.detachRoot(t,!0)})},O=()=>{h.data.set(y,{suppressErrorInCollaboration:!0})},D=(t,e)=>{e.forEach(e=>{Object.keys(w[e]).forEach(t=>{h.registerRootAttribute(t)}),t.clearAttributes(h.model.document.getRoot(e)),t.setAttributes(w[e],h.model.document.getRoot(e))})},I=(0,t.useCallback)(t=>{T.current=!0,b(t)},[b]),A=(0,t.useCallback)(t=>{T.current=!0,P(t)},[P]);return{editor:h,editableElements:N,toolbarElement:e().createElement(g,{editor:h}),data:y,setData:I,attributes:w,setAttributes:A}}})(),r})())},19695:function(t,e,r){"use strict";r.r(e),r.d(e,{ContextWatchdog:function(){return ContextWatchdog},EditorWatchdog:function(){return EditorWatchdog},Watchdog:function(){return Watchdog}});/** 5 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. 6 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license 7 */let Watchdog=class Watchdog{constructor(t){if(this.crashes=[],this.state="initializing",this._now=Date.now,this.crashes=[],this._crashNumberLimit="number"==typeof t.crashNumberLimit?t.crashNumberLimit:3,this._minimumNonErrorTimePeriod="number"==typeof t.minimumNonErrorTimePeriod?t.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=t=>{let e="error"in t?t.error:t.reason;e instanceof Error&&this._handleError(e,t)},this._listeners={},!this._restart)throw Error("The Watchdog class was split into the abstract `Watchdog` class and the `EditorWatchdog` class. Please, use `EditorWatchdog` if you have used the `Watchdog` class previously.")}destroy(){this._stopErrorHandling(),this._listeners={}}on(t,e){this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e)}off(t,e){this._listeners[t]=this._listeners[t].filter(t=>t!==e)}_fire(t,...e){let r=this._listeners[t]||[];for(let t of r)t.apply(this,[null,...e])}_startErrorHandling(){window.addEventListener("error",this._boundErrorHandler),window.addEventListener("unhandledrejection",this._boundErrorHandler)}_stopErrorHandling(){window.removeEventListener("error",this._boundErrorHandler),window.removeEventListener("unhandledrejection",this._boundErrorHandler)}_handleError(t,e){if(this._shouldReactToError(t)){this.crashes.push({message:t.message,stack:t.stack,filename:e instanceof ErrorEvent?e.filename:void 0,lineno:e instanceof ErrorEvent?e.lineno:void 0,colno:e instanceof ErrorEvent?e.colno:void 0,date:this._now()});let r=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:t,causesRestart:r}),r?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(t){return t.is&&t.is("CKEditorError")&&void 0!==t.context&&null!==t.context&&"ready"===this.state&&this._isErrorComingFromThisItem(t)}
7_shouldRestart(){if(this.crashes.length<=this._crashNumberLimit)return!0;let t=this.crashes[this.crashes.length-1].date,e=this.crashes[this.crashes.length-1-this._crashNumberLimit].date,r=(t-e)/this._crashNumberLimit;return r>this._minimumNonErrorTimePeriod}};/** 8 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. 9 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license 10 */function getsubnodes_getSubNodes(t,e=new Set){let r=[t],o=new Set,i=0;for(;r.length>i;){let t=r[i++];if(!(o.has(t)||!shouldNodeBeIncluded(t)||e.has(t))){if(o.add(t),Symbol.iterator in t)try{for(let e of t)r.push(e)}catch(t){}else for(let e in t)"defaultValue"!==e&&r.push(t[e])}}return o}function shouldNodeBeIncluded(t){let e=Object.prototype.toString.call(t),r=typeof t;return!("number"===r||"boolean"===r||"string"===r||"symbol"===r||"function"===r||"[object Date]"===e||"[object RegExp]"===e||"[object Module]"===e||null==t||t._watchdogExcluded||t instanceof EventTarget||t instanceof Event)}/** 11 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. 12 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license 13 */function areConnectedThroughProperties(t,e,r=new Set){if(t===e&&isObject(t))return!0;let o=getsubnodes_getSubNodes(t,r),i=getsubnodes_getSubNodes(e,r);for(let t of o)if(i.has(t))return!0;return!1}function isObject(t){return"object"==typeof t&&null!==t}var o=r(77226),i=r(66092),lodash_es_now=function(){return i.Z.Date.now()},s=/\s/,_trimmedEndIndex=function(t){for(var e=t.length;e--&&s.test(t.charAt(e)););return e},a=/^\s+/,d=r(72714),h=0/0,m=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,y=/^0o[0-7]+$/i,b=parseInt,lodash_es_toNumber=function(t){if("number"==typeof t)return t;if((0,d.Z)(t))return h;if((0,o.Z)(t)){var e,r="function"==typeof t.valueOf?t.valueOf():t;t=(0,o.Z)(r)?r+"":r}if("string"!=typeof t)return 0===t?t:+t;t=(e=t)?e.slice(0,_trimmedEndIndex(e)+1).replace(a,""):e;var i=p.test(t);return i||y.test(t)?b(t.slice(2),i?2:8):m.test(t)?h:+t},w=Math.max,P=Math.min,lodash_es_debounce=function(t,e,r){var i,s,a,d,h,m,p=0,y=!1,b=!1,N=!0;if("function"!=typeof t)throw TypeError("Expected a function");function invokeFunc(e){var r=i,o=s;return i=s=void 0,p=e,d=t.apply(o,r)}function leadingEdge(t){return p=t,h=setTimeout(timerExpired,e),y?invokeFunc(t):d}function remainingWait(t){var r=t-m,o=t-p,i=e-r;return b?P(i,a-o):i}function shouldInvoke(t){var r=t-m,o=t-p;return void 0===m||r>=e||r<0||b&&o>=a}function timerExpired(){var t=lodash_es_now();if(shouldInvoke(t))return trailingEdge(t);h=setTimeout(timerExpired,remainingWait(t))}function trailingEdge(t){return(h=void 0,N&&i)?invokeFunc(t):(i=s=void 0,d)}function cancel(){void 0!==h&&clearTimeout(h),p=0,i=m=s=h=void 0}function flush(){return void 0===h?d:trailingEdge(lodash_es_now())}function debounced(){var t=lodash_es_now(),r=shouldInvoke(t);if(i=arguments,s=this,m=t,r){if(void 0===h)return leadingEdge(m);if(b)return clearTimeout(h),h=setTimeout(timerExpired,e),invokeFunc(m)}return void 0===h&&(h=setTimeout(timerExpired,e)),d}return e=lodash_es_toNumber(e)||0,(0,o.Z)(r)&&(y=!!r.leading,a=(b="maxWait"in r)?w(lodash_es_toNumber(r.maxWait)||0,e):a,N="trailing"in r?!!r.trailing:N),debounced.cancel=cancel,debounced.flush=flush,debounced},lodash_es_throttle=function(t,e,r){var i=!0,s=!0;if("function"!=typeof t)throw TypeError("Expected a function");return(0,o.Z)(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),lodash_es_debounce(t,e,{leading:i,maxWait:e,trailing:s})},N=r(18533),S=r(37514),lodash_es_isElement=function(t){return(0,N.Z)(t)&&1===t.nodeType&&!(0,S.Z)(t)},T=r(75893);/** 14 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. 15 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license 16 */let EditorWatchdog=class EditorWatchdog extends Watchdog{constructor(t,e={}){super(e),this._editor=null,this._lifecyclePromise=null,this._initUsingData=!0,this._editables={},this._throttledSave=lodash_es_throttle(this._save.bind(this),"number"==typeof e.saveInterval?e.saveInterval:5e3),t&&(this._creator=(e,r)=>t.create(e,r)),this._destructor=t=>t.destroy()}get editor(){return this._editor}get _item(){return this._editor}setCreator(t){this._creator=t}setDestructor(t){this._destructor=t}_restart(){return Promise.resolve().then(()=>(this.state="initializing",this._fire("stateChange"),this._destroy())).catch(t=>{console.error("An error happened during the editor destroying.",t)}).then(()=>{let t={},e=[],r=this._config.rootsAttributes||{},o={};for(let[i,s]of Object.entries(this._data.roots))s.isLoaded?(t[i]="",o[i]=r[i]||{}):e.push(i);let i={...this._config,extraPlugins:this._config.extraPlugins||[],lazyRoots:e,rootsAttributes:o,_watchdogInitialData:this._data};return(delete i.initialData,i.extraPlugins.push(EditorWatchdogInitPlugin),this._initUsingData)?this.create(t,i,i.context):lodash_es_isElement(this._elementOrData)?this.create(this._elementOrData,i,i.context):this.create(this._editables,i,i.context)}).then(()=>{this._fire("restart")})}create(t=this._elementOrData,e=this._config,r){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then(()=>(super._startErrorHandling(),this._elementOrData=t,this._initUsingData="string"==typeof t||Object.keys(t).length>0&&"string"==typeof Object.values(t)[0],this._config=this._cloneEditorConfiguration(e)||{},this._config.context=r,this._creator(t,this._config))).then(t=>{this._editor=t,t.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=t.model.document.version,this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this.state="ready",this._fire("stateChange")}).finally(()=>{this._lifecyclePromise=null}),this._lifecyclePromise}destroy(){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())).finally(()=>{this._lifecyclePromise=null}),this._lifecyclePromise}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling(),this._throttledSave.cancel();let t=this._editor;return this._editor=null,t.model.document.off("change:data",this._throttledSave),this._destructor(t)})}_save(){let t=this._editor.model.document.version;try{this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this._lastDocumentVersion=t}catch(t){console.error(t,"An error happened during restoring editor data. Editor will be restored from the previously saved data.")}}_setExcludedProperties(t){this._excludedProps=t}_getData(){let t=this._editor,e=t.model.document.roots.filter(t=>t.isAttached()&&"$graveyard"!=t.rootName),{plugins:r}=t,o=r.has("CommentsRepository")&&r.get("CommentsRepository"),i=r.has("TrackChanges")&&r.get("TrackChanges"),s={roots:{},markers:{},commentThreads:JSON.stringify([]),suggestions:JSON.stringify([])};for(let r of(e.forEach(t=>{s.roots[t.rootName]={content:JSON.stringify(Array.from(t.getChildren())),attributes:JSON.stringify(Array.from(t.getAttributes())),isLoaded:t._isLoaded}}),t.model.markers))r._affectsData&&(s.markers[r.name]={rangeJSON:r.getRange().toJSON(),usingOperation:r._managedUsingOperations,affectsData:r._affectsData});return o&&(s.commentThreads=JSON.stringify(o.getCommentThreads({toJSON:!0,skipNotAttached:!0}))),i&&(s.suggestions=JSON.stringify(i.getSuggestions({toJSON:!0,skipNotAttached:!0}))),s}_getEditables(){let t={};for(let e of this.editor.model.document.getRootNames()){let r=this.editor.ui.getEditableElement(e);r&&(t[e]=r)}return t}_isErrorComingFromThisItem(t){return areConnectedThroughProperties(this._editor,t.context,this._excludedProps)}_cloneEditorConfiguration(t){var e;return e="function"==typeof(e=(t,e)=>{if(lodash_es_isElement(t)||"context"===e)return t})?e:void 0,(0,T.Z)(t,5,e)}};let EditorWatchdogInitPlugin=class EditorWatchdogInitPlugin{constructor(t){this.editor=t,this._data=t.config.get("_watchdogInitialData")}init(){this.editor.data.on("init",t=>{t.stop(),this.editor.model.enqueueChange({isUndoable:!1},t=>{this._restoreCollaborationData(),this._restoreEditorData(t)}),this.editor.data.fire("ready")},{priority:999})}_createNode(t,e){if(!("name"in e))return t.createText(e.data,e.attributes);{let r=t.createElement(e.name,e.attributes);if(e.children)for(let o of e.children)r._appendChild(this._createNode(t,o));return r}}_restoreEditorData(t){let e=this.editor;
16Object.entries(this._data.roots).forEach(([r,{content:o,attributes:i}])=>{let s=JSON.parse(o),a=JSON.parse(i),d=e.model.document.getRoot(r);for(let[e,r]of a)t.setAttribute(e,r,d);for(let e of s){let r=this._createNode(t,e);t.insert(r,d,"end")}}),Object.entries(this._data.markers).forEach(([r,o])=>{let{document:i}=e.model,{rangeJSON:{start:s,end:a},...d}=o,h=i.getRoot(s.root),m=t.createPositionFromPath(h,s.path,s.stickiness),p=t.createPositionFromPath(h,a.path,a.stickiness),y=t.createRange(m,p);t.addMarker(r,{range:y,...d})})}_restoreCollaborationData(){let t=JSON.parse(this._data.commentThreads),e=JSON.parse(this._data.suggestions);t.forEach(t=>{let e=this.editor.config.get("collaboration.channelId"),r=this.editor.plugins.get("CommentsRepository");if(r.hasCommentThread(t.threadId)){let e=r.getCommentThread(t.threadId);e.remove()}r.addCommentThread({channelId:e,...t})}),e.forEach(t=>{let e=this.editor.plugins.get("TrackChangesEditing");if(e.hasSuggestion(t.id)){let r=e.getSuggestion(t.id);r.attributes=t.attributes}else e.addSuggestionData(t)})}};/** 17 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. 18 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license 19 */let I=Symbol("MainQueueId");let ContextWatchdog=class ContextWatchdog extends Watchdog{constructor(t,e={}){super(e),this._watchdogs=new Map,this._context=null,this._contextProps=new Set,this._actionQueues=new ActionQueues,this._watchdogConfig=e,this._creator=e=>t.create(e),this._destructor=t=>t.destroy(),this._actionQueues.onEmpty(()=>{"initializing"===this.state&&(this.state="ready",this._fire("stateChange"))})}setCreator(t){this._creator=t}setDestructor(t){this._destructor=t}get context(){return this._context}create(t={}){return this._actionQueues.enqueue(I,()=>(this._contextConfig=t,this._create()))}getItem(t){let e=this._getWatchdog(t);return e._item}getItemState(t){let e=this._getWatchdog(t);return e.state}add(t){let e=toArray(t);return Promise.all(e.map(t=>this._actionQueues.enqueue(t.id,()=>{let e;if("destroyed"===this.state)throw Error("Cannot add items to destroyed watchdog.");if(!this._context)throw Error("Context was not created yet. You should call the `ContextWatchdog#create()` method first.");if(this._watchdogs.has(t.id))throw Error(`Item with the given id is already added: '${t.id}'.`);if("editor"===t.type)return(e=new EditorWatchdog(null,this._watchdogConfig)).setCreator(t.creator),e._setExcludedProperties(this._contextProps),t.destructor&&e.setDestructor(t.destructor),this._watchdogs.set(t.id,e),e.on("error",(r,{error:o,causesRestart:i})=>{this._fire("itemError",{itemId:t.id,error:o}),i&&this._actionQueues.enqueue(t.id,()=>new Promise(r=>{let rethrowRestartEventOnce=()=>{e.off("restart",rethrowRestartEventOnce),this._fire("itemRestart",{itemId:t.id}),r()};e.on("restart",rethrowRestartEventOnce)}))}),e.create(t.sourceElementOrData,t.config,this._context);throw Error(`Not supported item type: '${t.type}'.`)})))}remove(t){let e=toArray(t);return Promise.all(e.map(t=>this._actionQueues.enqueue(t,()=>{let e=this._getWatchdog(t);return this._watchdogs.delete(t),e.destroy()})))}destroy(){return this._actionQueues.enqueue(I,()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_restart(){return this._actionQueues.enqueue(I,()=>(this.state="initializing",this._fire("stateChange"),this._destroy().catch(t=>{console.error("An error happened during destroying the context or items.",t)}).then(()=>this._create()).then(()=>this._fire("restart"))))}_create(){return Promise.resolve().then(()=>(this._startErrorHandling(),this._creator(this._contextConfig))).then(t=>(this._context=t,this._contextProps=getsubnodes_getSubNodes(this._context),Promise.all(Array.from(this._watchdogs.values()).map(t=>(t._setExcludedProperties(this._contextProps),t.create(void 0,void 0,this._context))))))}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling();let t=this._context;return this._context=null,this._contextProps=new Set,Promise.all(Array.from(this._watchdogs.values()).map(t=>t.destroy())).then(()=>this._destructor(t))})}_getWatchdog(t){let e=this._watchdogs.get(t);if(!e)throw Error(`Item with the given id was not registered: ${t}.`);return e}_isErrorComingFromThisItem(t){for(let e of this._watchdogs.values())if(e._isErrorComingFromThisItem(t))return!1;return areConnectedThroughProperties(this._context,t.context)}};let ActionQueues=class ActionQueues{constructor(){this._onEmptyCallbacks=[],this._queues=new Map,this._activeActions=0}onEmpty(t){this._onEmptyCallbacks.push(t)}enqueue(t,e){let r=t===I;this._activeActions++,this._queues.get(t)||this._queues.set(t,Promise.resolve());let o=r?Promise.all(this._queues.values()):Promise.all([this._queues.get(I),this._queues.get(t)]),i=o.then(e),s=i.catch(()=>{});return this._queues.set(t,s),i.finally(()=>{this._activeActions--,this._queues.get(t)===s&&0===this._activeActions&&this._onEmptyCallbacks.forEach(t=>t())})}};function toArray(t){return Array.isArray(t)?t:[t]}/** 20 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. 21 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license 22 */}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.