1var lt=Object.defineProperty;var zt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var $t=Object.prototype.hasOwnProperty;var Q=(t,e)=>{for(var n in e)lt(t,n,{get:e[n],enumerable:!0})},ut=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Vt(e))!$t.call(t,o)&&o!==n&<(t,o,{get:()=>e[o],enumerable:!(r=zt(e,o))||r.enumerable});return t},x=(t,e,n)=>(ut(t,e,"default"),n&&ut(n,e,"default"));var at={};Q(at,{CKEditor:()=>z,CKEditorContext:()=>be,loadCKEditorCloud:()=>G,useCKEditorCloud:()=>Ot,useMultiRootEditor:()=>_e,withCKEditorCloud:()=>Se});var d={};Q(d,{default:()=>k});x(d,Ke);import*as Ke from"../../../frontend-js-react-web/__liferay__/exports/react.js";import Nt from"../../../frontend-js-react-web/__liferay__/exports/react.js";var k=Nt;var P={};Q(P,{default:()=>_});x(P,xe);import*as xe from"../../../frontend-js-react-web/__liferay__/exports/prop-types.js";import Ut from"../../../frontend-js-react-web/__liferay__/exports/prop-types.js";var _=Ut;function dt(){let t={resolve:null,promise:null};return t.promise=new Promise(e=>{t.resolve=e}),t}function Ft(t,{timeOutAfter:e=500,retryAfter:n=100}={}){return new Promise((r,o)=>{let a=Date.now(),i=null,s=setTimeout(()=>{o(i??new Error("Timeout"))},e),c=async()=>{try{let f=await t();clearTimeout(s),r(f)}catch(f){i=f,Date.now()-a>e?o(f):setTimeout(c,n)}};c()})}var U=new Map;function ft(t,{attributes:e}={}){if(U.has(t))return U.get(t);let n=document.querySelector(`script[src="${t}"]`);n&&(console.warn(`Script with "${t}" src is already present in DOM!`),n.remove());let r=new Promise((o,a)=>{let i=document.createElement("script");i.onerror=a,i.onload=()=>{o()};for(let[c,f]of Object.entries(e||{}))i.setAttribute(c,f);i.setAttribute("data-injected-by","ckeditor-integration"),i.type="text/javascript",i.async=!0,i.src=t,document.head.appendChild(i);let s=new MutationObserver(c=>{c.flatMap(g=>Array.from(g.removedNodes)).includes(i)&&(U.delete(t),s.disconnect())});s.observe(document.head,{childList:!0,subtree:!0})});return U.set(t,r),r}async function ht(t,e){await Promise.all(t.map(n=>ft(n,e)))}var F=new Map;function qt({href:t,placementInHead:e="start",attributes:n={}}){if(F.has(t))return F.get(t);let r=document.querySelector(`link[href="${t}"][rel="stylesheet"]`);r&&(console.warn(`Stylesheet with "${t}" href is already present in DOM!`),r.remove());let o=i=>{let s=Array.from(document.head.querySelectorAll('link[data-injected-by="ckeditor-integration"]'));switch(e){case"start":s.length?s.slice(-1)[0].after(i):document.head.insertBefore(i,document.head.firstChild);break;case"end":document.head.appendChild(i);break}},a=new Promise((i,s)=>{let c=document.createElement("link");for(let[g,v]of Object.entries(n||{}))c.setAttribute(g,v);c.setAttribute("data-injected-by","ckeditor-integration"),c.rel="stylesheet",c.href=t,c.onerror=s,c.onload=()=>{i()},o(c);let f=new MutationObserver(g=>{g.flatMap(S=>Array.from(S.removedNodes)).includes(c)&&(F.delete(t),f.disconnect())});f.observe(document.head,{childList:!0,subtree:!0})});return F.set(t,a),a}function mt(){return typeof window>"u"}function yt(t){let e=null;return(...n)=>(e||(e={current:t(...n)}),e.current)}function Z(t,e){return e.length=0,e.push(...t),e}function B(t,e){for(let n of Object.getOwnPropertyNames(e))delete e[n];for(let[n,r]of Object.entries(t))r!==e&&n!=="prototype"&&n!=="__proto__"&&(e[n]=r);return e}function Ht(t,{attributes:e}={}){if(document.head.querySelector(`link[href="${t}"][rel="preload"]`))return;let n=document.createElement("link");for(let[r,o]of Object.entries(e||{}))n.setAttribute(r,o);n.setAttribute("data-injected-by","ckeditor-integration"),n.rel="preload",n.as=Jt(t),n.href=t,document.head.insertBefore(n,document.head.firstChild)}function Jt(t){switch(!0){case/\.css$/.test(t):return"style";case/\.js$/.test(t):return"script";default:return"fetch"}}function gt(t,e){if(t===e)return!0;if(!t||!e)return!1;for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!1;return!0}var C=new Array(256).fill("").map((t,e)=>("0"+e.toString(16)).slice(-2));function q(){let[t,e,n,r]=crypto.getRandomValues(new Uint32Array(4));return"e"+C[t>>0&255]+C[t>>8&255]+C[t>>16&255]+C[t>>24&255]+C[e>>0&255]+C[e>>8&255]+C[e>>16&255]+C[e>>24&255]+C[n>>0&255]+C[n>>8&255]+C[n>>16&255]+C[n>>24&255]+C[r>>0&255]+C[r>>8&255]+C[r>>16&255]+C[r>>24&255]}function W(t){return Array.from(new Set(t))}async function H(t,e){let n=()=>t.map(r=>
1window[r]).filter(Boolean)[0];return Ft(()=>{let r=n();if(!r)throw new Error(`Window entry "${t.join(",")}" not found.`);return r},e)}function Gt(t,e){let n=Object.entries(t).filter(([r,o])=>e(o,r));return Object.fromEntries(n)}function Yt(t){return Gt(t,e=>e!=null)}function pt(t,e){let n=Object.entries(t).map(([r,o])=>[r,e(o,r)]);return Object.fromEntries(n)}function tt(t,e){return e.filter(n=>!t.includes(n))}function et(t){return!!t&&/^\d+\.\d+\.\d+/.test(t)}function J(t){return t?["nightly","alpha","internal"].some(e=>t.includes(e)):!1}function Xt(t){return et(t)||J(t)}function Et(t){if(!et(t))throw new Error(`Invalid semantic version: ${t||"<blank>"}.`);let[e,n,r]=t.split(".");return{major:Number.parseInt(e,10),minor:Number.parseInt(n,10),patch:Number.parseInt(r,10)}}function Qt(t){if(J(t))return 3;let{major:e}=Et(t);switch(!0){case e>=44:return 3;case e>=38:return 2;default:return 1}}function Zt(){let{CKEDITOR_VERSION:t,CKEDITOR:e}=window;return Xt(t)?{source:e?"cdn":"npm",version:t}:null}var te="https://cdn.ckeditor.com";function bt(t,e,n){return`${te}/${t}/${n}/${e}`}var ee="https://cdn.ckbox.io";function ne(t,e,n){return`${ee}/${t}/${n}/${e}`}var re="https://ckeditor.com/docs/ckeditor5";function oe(t,e="latest"){return`${re}/${e}/${t}`}function ie({version:t,translations:e,createCustomCdnUrl:n=bt}){let r={scripts:[n("ckeditor5","ckeditor5.umd.js",t),...tt(["en"],e||[]).map(o=>n("ckeditor5",`translations/${o}.umd.js`,t))],stylesheets:[n("ckeditor5","ckeditor5.css",t)]};return{preload:[...r.stylesheets,...r.scripts],scripts:[async o=>ht(r.scripts,o)],stylesheets:r.stylesheets,checkPluginLoaded:async()=>H(["CKEDITOR"]),beforeInject:()=>{let o=Zt();switch(o?.source){case"npm":throw new Error("CKEditor 5 is already loaded from npm. Check the migration guide for more details: "+oe("updating/migration-to-cdn/vanilla-js.html"));case"cdn":if(o.version!==t)throw new Error(`CKEditor 5 is already loaded from CDN in version ${o.version}. Remove the old <script> and <link> tags loading CKEditor 5 to allow loading the ${t} version.`);break}}}}function se({version:t,translations:e,createCustomCdnUrl:n=bt}){let r={scripts:[n("ckeditor5-premium-features","ckeditor5-premium-features.umd.js",t),...tt(["en"],e||[]).map(o=>n("ckeditor5-premium-features",`translations/${o}.umd.js`,t))],stylesheets:[n("ckeditor5-premium-features","ckeditor5-premium-features.css",t)]};return{preload:[...r.stylesheets,...r.scripts],scripts:[async o=>ht(r.scripts,o)],stylesheets:r.stylesheets,checkPluginLoaded:async()=>H(["CKEDITOR_PREMIUM_FEATURES"])}}async function ae(t){let{htmlAttributes:e={},scripts:n=[],stylesheets:r=[],preload:o,beforeInject:a,checkPluginLoaded:i}=nt(t);a?.(),o||(o=W([...r.filter(s=>typeof s=="string"),...n.filter(s=>typeof s=="string")]));for(let s of o)Ht(s,{attributes:e});await Promise.all(W(r).map(s=>qt({href:s,attributes:e,placementInHead:"start"})));for(let s of W(n)){let c={attributes:e};typeof s=="string"?await ft(s,c):await s(c)}return i?.()}function nt(t){return Array.isArray(t)?{scripts:t.filter(e=>typeof e=="function"||e.endsWith(".js")),stylesheets:t.filter(e=>e.endsWith(".css"))}:typeof t=="function"?{checkPluginLoaded:t}:t}function Ct(t){let e=pt(Yt(t),nt);return{...Object.values(e).reduce((a,i)=>(a.scripts.push(...i.scripts??[]),a.stylesheets.push(...i.stylesheets??[]),a.preload.push(...i.preload??[]),a),{preload:[],scripts:[],stylesheets:[]}),beforeInject:()=>{for(let a of Object.values(e))a.beforeInject?.()},checkPluginLoaded:async()=>{let a=Object.create(null);for(let[i,s]of Object.entries(e))a[i]=await s?.checkPluginLoaded?.();return a}}}function ce(){let t=window.CKBox?.version;return et(t)?{source:"cdn",version:t}:null}function ue({version:t,theme:e="lark",translations:n,createCustomCdnUrl:r=ne}){return{scripts:[r("ckbox","ckbox.js",t),...tt(["en"],n||[]).map(o=>r("ckbox",`translations/${o}.js`,t))],...e&&{stylesheets:[r("ckbox",`styles/themes/${e}.css`,t)]},checkPluginLoaded:async()=>H(["CKBox"]),beforeInject:()=>{let o=ce();if(o&&o.version!==t)throw new Error(`CKBox is already loaded from CDN in version ${o.version}. Remove the old <script> and <link> tags loading CKBox to allow loading the ${t} version.`)}}}function le(t){if(J(t))return!0;let{major:e}=Et(t);switch(Qt(t)){case 3:return!0;default:return e===43}}function de(t){let e=pt(t,(n,r)=>{if(!n)return;let o=nt(n);return{checkPluginLoaded:async()=>H([r]),...o}});return Ct(e)}function G(t){let{version:e,translations:n,plugins:r,premium:o,ckbox:a,createCustomCdnUrl:i,injectedHtmlElementsAttributes:s={crossorigin:"anonymous"}}=t;fe(e);let c=Ct({CKEditor:ie({version:e,translations:n,createCustomCdnUrl:i}
1),...o&&{CKEditorPremiumFeatures:se({version:e,translations:n,createCustomCdnUrl:i})},...a&&{CKBox:ue(a)},loadedPlugins:de(r??{})});return ae({...c,htmlAttributes:s})}function fe(t){if(J(t)&&console.warn("You are using a testing version of CKEditor 5. Please remember that it is not suitable for production environments."),!le(t))throw new Error(`The CKEditor 5 CDN can't be used with the given editor version: ${t}. Please make sure you are using at least the CKEditor 5 version 44.`)}var he=Object.defineProperty,me=(t,e,n)=>e in t?he(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,w=(t,e,n)=>me(t,typeof e!="symbol"?e+"":e,n);var Rt=class vt{constructor(e,n){w(this,"_lifecycle"),w(this,"_element"),w(this,"_releaseLock",null),w(this,"_value",null),w(this,"_afterMountCallbacks",[]),w(this,"_state",{destroyedBeforeInitialization:!1,mountingInProgress:null}),w(this,"release",yt(()=>{let{_releaseLock:r,_state:o,_element:a,_lifecycle:i}=this;o.mountingInProgress?o.mountingInProgress.then(()=>i.unmount({element:a,mountResult:this.value})).catch(s=>{console.error("Semaphore unmounting error:",s)}).then(r.resolve).then(()=>{this._value=null}):(o.destroyedBeforeInitialization=!0,r.resolve())})),this._element=e,this._lifecycle=n,this._lock()}get value(){return this._value}unsafeSetValue(e){this._value=e,this._afterMountCallbacks.forEach(n=>n(e)),this._afterMountCallbacks=[]}runAfterMount(e){let{_value:n,_afterMountCallbacks:r}=this;n?e(n):r.push(e)}_lock(){let{_semaphores:e}=vt,{_state:n,_element:r,_lifecycle:o}=this,a=e.get(r)||Promise.resolve(null),i=dt();this._releaseLock=i;let s=a.then(()=>n.destroyedBeforeInitialization?Promise.resolve(void 0):(n.mountingInProgress=o.mount().then(c=>(c&&this.unsafeSetValue(c),c)),n.mountingInProgress)).then(async c=>{c&&o.afterMount&&await o.afterMount({element:r,mountResult:c})}).then(()=>i.promise).catch(c=>{console.error("Semaphore mounting error:",c)}).then(()=>{e.get(r)===s&&e.delete(r)});e.set(r,s)}};w(Rt,"_semaphores",new Map);var kt=Rt;var St="$__CKEditorReactContextMetadata";function ye(t,e){return{...e,[St]:t}}function ge(t){return t.get(St)}var pe=()=>{let t=(0,d.useRef)(!1);return(0,d.useEffect)(()=>(t.current=!0,()=>{t.current=!1}),[]),t};var T=t=>{let e=(0,d.useRef)();return e.current=t,(0,d.useCallback)((...n)=>e.current(...n),[])};var Ee=({currentContextWatchdog:t,onChangeInitializedEditors:e})=>{let n=T(e||(()=>{}));(0,d.useEffect)(()=>{var r;if(t.status!=="initialized")return;let{watchdog:o}=t,a=(r=o?.context)==null?void 0:r.editors;if(!a)return;let i=()=>[...a].reduce((f,g)=>{var v;if(g.state!=="ready")return f;let S=ge(g.config),D=(v=S?.name)!=null?v:g.id;return f[D]={instance:g,metadata:S},f},Object.create({})),s=()=>{n(i(),o)},c=(f,g)=>{g.once("ready",s,{priority:"lowest"}),g.once("destroy",s,{priority:"lowest"})};return a.on("add",c),()=>{a.off("add",c)}},[t])};var st=k.createContext(null),be=t=>{let{id:e,context:n,watchdogConfig:r,children:o,config:a,onReady:i,contextWatchdog:s,isLayoutReady:c=!0,onChangeInitializedEditors:f,onError:g=(I,R)=>console.error(I,R)}=t,v=pe(),S=(0,d.useRef)(null),[D,M]=(0,d.useState)({status:"initializing"});(0,d.useEffect)(()=>{c?V():M({status:"initializing"})},[e,c]),(0,d.useEffect)(()=>()=>{D.status==="initialized"&&D.watchdog.destroy()},[D]),Ee({currentContextWatchdog:D,onChangeInitializedEditors:f});function X(){return S.current=q(),S.current}function O(I){return S.current===I&&v.current}function V(){let I=X(),R=new s(n,r);return R.on("error",(L,$)=>{O(I)&&g($.error,{phase:"runtime",willContextRestart:$.causesRestart})}),R.on("stateChange",()=>{i&&R.state==="ready"&&O(I)&&i(R.context,R)}),R.create(a).then(()=>{O(I)?M({status:"initialized",watchdog:R}):R.destroy()}).catch(L=>{O(I)&&(g(L,{phase:"initialization",willContextRestart:!1}),M({status:"error",error:L}))}),R}return k.createElement(st.Provider,{value:D},o)},Ce=t=>!!t&&typeof t=="object"&&"status"in t&&["initializing","initialized","error"].includes(t.status),Dt=t=>e=>Ce(e)&&e.status===t,wt=Dt("initializing"),it=t=>Dt("initialized")(t)&&t.watchdog.state==="ready";var rt="Lock from React integration (@ckeditor/ckeditor5-react)",z=class extends k.Component{constructor(e){super(e),w(this,"domContainer",k.createRef()),w(this,"editorSemaphore",null),this._checkVersion()}_checkVersion(){let{CKEDITOR_VERSION:e}=window;if(!e)return console.warn('Cannot find the "CKEDITOR_VERSION" in the "window" scope.');
1let[n]=e.split(".").map(Number);n>=42||e.startsWith("0.0.0")||console.warn("The <CKEditor> component requires using CKEditor 5 in version 42+ or nightly build.")}get _semaphoreValue(){let{editorSemaphore:e}=this;return e?e.value:null}get watchdog(){let{_semaphoreValue:e}=this;return e?e.watchdog:null}get editor(){let{_semaphoreValue:e}=this;return e?e.instance:null}shouldComponentUpdate(e){let{props:n,editorSemaphore:r}=this;return e.id!==n.id||e.disableWatchdog!==n.disableWatchdog?!0:(r&&(r.runAfterMount(({instance:o})=>{this._shouldUpdateEditorData(n,e,o)&&o.data.set(e.data)}),"disabled"in e&&r.runAfterMount(({instance:o})=>{e.disabled?o.enableReadOnlyMode(rt):o.disableReadOnlyMode(rt)})),!1)}componentDidMount(){wt(this.context)||this._initLifeCycleSemaphore()}componentDidUpdate(){wt(this.context)||this._initLifeCycleSemaphore()}componentWillUnmount(){this._unlockLifeCycleSemaphore()}_unlockLifeCycleSemaphore(){this.editorSemaphore&&(this.editorSemaphore.release(),this.editorSemaphore=null)}_initLifeCycleSemaphore(){this._unlockLifeCycleSemaphore(),this.editorSemaphore=new kt(this.domContainer.current,{mount:async()=>this._initializeEditor(),afterMount:({mountResult:e})=>{let{onReady:n}=this.props;n&&this.domContainer.current!==null&&n(e.instance)},unmount:async({element:e,mountResult:n})=>{let{onAfterDestroy:r}=this.props;try{await this._destroyEditor(n),e.innerHTML=""}finally{r&&r(n.instance)}}})}render(){return k.createElement("div",{ref:this.domContainer})}async _initializeEditor(){if(this.props.disableWatchdog)return{instance:await this._createEditor(this.domContainer.current,this._getConfig()),watchdog:null};let e=it(this.context)?new Y(this.context.watchdog):new this.props.editor.EditorWatchdog(this.props.editor,this.props.watchdogConfig),n={current:0};return e.setCreator(async(r,o)=>{var a;let{editorSemaphore:i}=this,{onAfterDestroy:s}=this.props;n.current>0&&s&&((a=i?.value)!=null&&a.instance)&&s(i.value.instance);let c=await this._createEditor(r,o);return i&&n.current>0&&(i.unsafeSetValue({instance:c,watchdog:e}),setTimeout(()=>{this.props.onReady&&this.props.onReady(e.editor)})),n.current++,c}),e.on("error",(r,{error:o,causesRestart:a})=>{(this.props.onError||console.error)(o,{phase:"runtime",willEditorRestart:a})}),await e.create(this.domContainer.current,this._getConfig()).catch(r=>{(this.props.onError||console.error)(r,{phase:"initialization",willEditorRestart:!1})}),{watchdog:e,instance:e.editor}}_createEditor(e,n){let{contextItemMetadata:r}=this.props;return r&&(n=ye(r,n)),this.props.editor.create(e,n).then(o=>{if("disabled"in this.props){this.props.disabled&&o.enableReadOnlyMode(rt)}let a=o.model.document,i=o.editing.view.document;return a.on("change:data",s=>{this.props.onChange&&this.props.onChange(s,o)}),i.on("focus",s=>{this.props.onFocus&&this.props.onFocus(s,o)}),i.on("blur",s=>{this.props.onBlur&&this.props.onBlur(s,o)}),o})}async _destroyEditor(e){let{watchdog:n,instance:r}=e;return new Promise((o,a)=>{setTimeout(async()=>{try{if(n)return await n.destroy(),o();if(r)return await r.destroy(),o();o()}catch(i){console.error(i),a(i)}})})}_shouldUpdateEditorData(e,n,r){return!(e.data===n.data||r.data.get()===n.data)}_getConfig(){let e=this.props.config||{};return this.props.data&&e.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."),{...e,initialData:e.initialData||this.props.data||""}}};w(z,"contextType",st);w(z,"propTypes",{editor:_.func.isRequired,data:_.string,config:_.object,disableWatchdog:_.bool,watchdogConfig:_.object,onChange:_.func,onReady:_.func,onFocus:_.func,onBlur:_.func,onError:_.func,disabled:_.bool,id:_.any});var Y=class{constructor(e){w(this,"_contextWatchdog"),w(this,"_id"),w(this,"_creator"),this._contextWatchdog=e,this._id=q()}setCreator(e){this._creator=e}create(e,n){return this._contextWatchdog.add({sourceElementOrData:e,config:n,creator:this._creator,id:this._id,type:"editor"})}on(e,n){this._contextWatchdog.on("itemError",(r,{itemId:o,error:a})=>{o===this._id&&n(null,{error:a,causesRestart:void 0})})}destroy(){return this._contextWatchdog.state==="ready"?this._contextWatchdog.remove(this._id):Promise.resolve()}get editor(){return this._contextWatchdog.getItem(this._id)}};var we=()=>{let t=(0,d.useRef)(null),[e,n]=(0,d.useState)(()=>Date.now()),r=()=>{n(Date.now())},o=(f=!0)=>{t.current&&(t.current.release(),t.current=null),f&&n(Date.now())},a=f=>{var g;(g=t.current)==null||g.unsafeSetValue(f),r()},i=f=>{t.current&&t.current.runAfterMount(f)};return{get current(){return t.current},revision:e,createAttributeRef:f=>({get current(){return!t.current||!t.current.value?null:t.current.value[f]}}),unsafeSetValue:a,release:o,replace:f=>{o(!1),t.current=f(),r(),i(r)},runAfterMount:i}};function It(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var Kt=(t,e)=>
1{let[n,r]=(0,d.useState)(null);gt(n,e)||(t(),r([...e]))};var _t=(t,e,n)=>{Kt(()=>{t&&t.runAfterMount(e)},[t,...n])};var ot="Lock from React integration (@ckeditor/ckeditor5-react)",_e=t=>{let e=(0,d.useRef)(t.semaphoreElement||null),n=we(),r={watchdog:n.createAttributeRef("watchdog"),instance:n.createAttributeRef("instance")},o=(0,d.useContext)(st),[a,i]=(0,d.useState)(()=>Object.keys(t.data)),[s,c]=(0,d.useState)({...t.data}),[f,g]=(0,d.useState)({...t.rootsAttributes}),v=(0,d.useRef)(!0),S=()=>{let u=r.instance.current;if(!u)return;let p=l=>{l.name&&!u.editing.view.getDomRoot(l.name)&&u.editing.view.attachDomRoot(document.createElement("div"),l.name)};Object.values(u.ui.view.editables).forEach(p)};(0,d.useEffect)(()=>{let u=e.current;if(!(o&&!it(o))&&!(!u||t.isLayoutReady===!1))return n.replace(()=>new kt(u,{mount:R,afterMount:({mountResult:p})=>{let{onReady:l}=t;l&&e.current!==null&&l(p.instance)},unmount:async({element:p,mountResult:l})=>{let{onAfterDestroy:h}=t;try{await I(l),p.innerHTML=""}finally{h&&h(l.instance)}}})),()=>{S(),n.release(!1)}},[t.id,t.isLayoutReady,o?.status]);let D=()=>{let u=t.config||{};return t.data&&u.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."),{...u,rootsAttributes:f}},M=T((u,p)=>{let l=u.model.document;if(!t.disableTwoWayDataBinding){let h={},m={};
1l.differ.getChanges().forEach(y=>{let E;if(y.type=="insert"||y.type=="remove"?E=y.position.root:E=y.range.root,!E.isAttached())return;let{rootName:K}=E;h[K]=u.getData({rootName:K})}),l.differ.getChangedRoots().forEach(y=>{if(y.state){h[y.name]!==void 0&&delete h[y.name];return}let E=y.name;m[E]=u.getRootAttributes(E)}),Object.keys(h).length&&c(y=>({...y,...h})),Object.keys(m).length&&g(y=>({...y,...m}))}t.onChange&&t.onChange(p,u)}),X=T((u,p,l)=>{let h=l.rootName;t.disableTwoWayDataBinding||(c(m=>({...m,[h]:u.getData({rootName:h})})),g(m=>({...m,[h]:u.getRootAttributes(h)}))),i(m=>W([...m,l.rootName]))}),O=T((u,p,l)=>{let h=l.rootName;t.disableTwoWayDataBinding||(c(m=>{let{[h]:y,...E}=m;return{...E}}),g(m=>{let{[h]:y,...E}=m;return{...E}})),i(m=>m.filter(y=>y!==h))}),V=T((u,p)=>(B({...t.rootsAttributes},f),B({...t.data},s),Z(Object.keys(t.data),a),t.editor.create(u,p).then(l=>{let h=l.getFullData();if(B({...h},s),B({...l.getRootsAttributes()},f),Z(Object.keys(h),a),t.disabled){l.enableReadOnlyMode(ot)}let m=l.model.document,y=l.editing.view.document;return m.on("change:data",E=>M(l,E)),l.on("addRoot",(E,K)=>X(l,E,K)),l.on("detachRoot",(E,K)=>O(l,E,K)),y.on("focus",E=>{t.onFocus&&t.onFocus(E,l)}),y.on("blur",E=>{t.onBlur&&t.onBlur(E,l)}),l}))),I=u=>{let{watchdog:p,instance:l}=u;return new Promise((h,m)=>{setTimeout(async()=>{try{if(p)return await p.destroy(),h();if(l)return await l.destroy(),h();h()}catch(y){console.error(y),m(y)}})})},R=async()=>{if(t.disableWatchdog)return{instance:await V(t.data,D()),watchdog:null};let u=it(o)?new Y(o.watchdog):new t.editor.EditorWatchdog(t.editor,t.watchdogConfig),p={current:0};return u.setCreator(async(l,h)=>{let{onAfterDestroy:m}=t;p.current>0&&m&&r.instance.current&&m(r.instance.current);let y=await V(s,h);return p.current>0&&(n.unsafeSetValue({instance:y,watchdog:u}),setTimeout(()=>{t.onReady&&t.onReady(u.editor)})),p.current++,y}),u.on("error",(l,{error:h,causesRestart:m})=>{(t.onError||console.error)(h,{phase:"runtime",willEditorRestart:m})}),await u.create(s,D()).catch(l=>{throw(t.onError||console.error)(l,{phase:"initialization",willEditorRestart:!1}),l}),{watchdog:u,instance:u.editor}},L=(u,p)=>{let l=Object.keys(u),h=Object.keys(p);return{addedKeys:h.filter(m=>!l.includes(m)),removedKeys:l.filter(m=>!h.includes(m))}},$=(0,d.useCallback)(u=>{n.runAfterMount(()=>{v.current=!0,c(u)})},[c]),jt=(0,d.useCallback)(u=>{n.runAfterMount(()=>{v.current=!0,g(u)})},[g]),Pt=k.createElement(xt,{ref:e,editor:r.instance.current});_t(n.current,({instance:u})=>{t.disabled?u.enableReadOnlyMode(ot):u.disableReadOnlyMode(ot)},[t.disabled]),_t(n.current,({instance:u})=>{if(v.current){v.current=!1;let p=Object.keys(s),l=Object.keys(f);if(!p.every(b=>l.includes(b)))throw console.error("`data` and `attributes` objects must have the same keys (roots)."),new Error("`data` and `attributes` objects must have the same keys (roots).");let h=u.getFullData(),m=u.getRootsAttributes(),{addedKeys:y,removedKeys:E}=L(h,s||{}),K=p.filter(b=>h[b]!==void 0&&JSON.stringify(h[b])!==JSON.stringify(s[b])),ct=l.filter(b=>JSON.stringify(m[b])!==JSON.stringify(f[b])),Mt=b=>{b.forEach(A=>{u.addRoot(A,{data:s[A]||"",attributes:f?.[A]||{},isUndoable:!0})})},Lt=b=>{b.forEach(A=>{u.detachRoot(A,!0)})},Wt=b=>{let A=b.reduce((j,N)=>({...j,[N]:s[N]}),Object.create(null));u.data.set(A,{suppressErrorInCollaboration:!0})},Bt=(b,A)=>{A.forEach(j=>{Object.keys(f[j]).forEach(N=>{u.registerRootAttribute(N)}),b.clearAttributes(u.model.document.getRoot(j)),b.setAttributes(f[j],u.model.document.getRoot(j))})};setTimeout(()=>{u.model.change(b=>{Mt(y),Lt(E),K.length&&Wt(K),ct.length&&Bt(b,ct)})})}},[s,f]);let Tt=a.map(u=>k.createElement(At,{key:u,id:u,rootName:u,semaphore:n}));return{editor:r.instance.current,editableElements:Tt,toolbarElement:Pt,data:s,setData:$,attributes:f,setAttributes:jt}},At=(0,d.memo)((0,d.forwardRef)(({id:t,semaphore:e,rootName:n},r)=>{let o=(0,d.useRef)(null);return(0,d.useEffect)(()=>{let a,i;return e.runAfterMount(({instance:s})=>{if(!o.current)return;i=s;let{ui:c,model:f}=i,g=f.document.getRoot(n);g&&i.ui.getEditableElement(n)&&i.detachEditable(g),a=c.view.createEditable(n,o.current),c.addEditable(a),s.editing.view.forceRender()}),()=>{if(i&&i.state!=="destroyed"&&o.current){let s=i.model.document.getRoot(n);s&&i.detachEditable(s)}}},[e.revision]),k.createElement("div",{key:e.revision,id:t,ref:It(r,o)})}));At.displayName="EditorEditable";var xt=(0,d.forwardRef)(({editor:t},e)=>{let n=(0,d.useRef)(null);return(0,d.useEffect)(()=>{let r=n.current;if(!t||!r)return;let o=t.ui.view.toolbar.element;return r.appendChild(o),()=>{r.contains(o)&&r.removeChild(o)}},[t&&t.id]),k.createElement("div",{ref:It(n,e)})});xt.displayName="EditorToolbarWrapper";var Re=()=>{let t=(0,d.useRef)(!1);return(0,d.useEffect)(()=>(t.current=!1,()=>{t.current=!0}),[]),t};var ve=t=>{let[e,n]=(0,d.useState)({status:"idle"}),r=Re(),o=(0,d.useRef)(null);return[T(async(...i)=>{if(r.current||mt())return null;let s=q();o.current=s;try{e.status!=="loading"&&n({status:"loading"});let c=await t(...i);return!r.current&&o.current===s&&n({status:"success",data:c}),c}catch(c){console.error(c),!r.current&&o.current===s&&n({status:"error",error:c})}return null}),e]};var ke=(t,e)=>
1{let[n,r]=ve(t);return Kt(n,e),r.status==="idle"?{status:"loading"}:r};function Ot(t){let e=JSON.stringify(t),n=ke(async()=>G(t),[e]);return n.status==="success"?{...n.data,status:"success"}:n}var Se=t=>e=>{let n=r=>{var o,a;let i=Ot(t.cloud);switch(i.status){case"error":return t.renderError?t.renderError(i.error):"Unable to load CKEditor Cloud data!";case"success":return k.createElement(e,{...r,cloud:i});default:return(a=(o=t.renderLoader)==null?void 0:o.call(t))!=null?a:null}};return n.displayName="ComponentWithCKEditorCloud",n};var{loadCKEditorCloud:Le,CKEditor:We,CKEditorContext:Be,useCKEditorCloud:ze,useMultiRootEditor:Ve,withCKEditorCloud:$e}=at;export{We as CKEditor,Be as CKEditorContext,Le as loadCKEditorCloud,ze as useCKEditorCloud,Ve as useMultiRootEditor,$e as withCKEditorCloud}; 2/*! Bundled license information: 3 4@ckeditor/ckeditor5-integrations-common/dist/index.js: 5 (** 6 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. 7 * For licensing, see LICENSE.md. 8 *) 9 10@ckeditor/ckeditor5-integrations-common/dist/index.js: 11 (** 12 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. 13 * For licensing, see LICENSE.md. 14 *) 15 16@ckeditor/ckeditor5-integrations-common/dist/index.js: 17 (** 18 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. 19 * For licensing, see LICENSE.md. 20 *) 21 22@ckeditor/ckeditor5-integrations-common/dist/index.js: 23 (** 24 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. 25 * For licensing, see LICENSE.md. 26 *) 27 28@ckeditor/ckeditor5-integrations-common/dist/index.js: 29 (** 30 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. 31 * For licensing, see LICENSE.md. 32 *) 33 34@ckeditor/ckeditor5-react/dist/index.js: 35 (** 36 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. 37 * For licensing, see LICENSE.md. 38 *) 39 (* istanbul ignore else -- @preserve *) 40 (* istanbul ignore next -- @preserve *) 41*/ 42//# sourceMappingURL=@ckeditor$ckeditor5-react.js.map
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.