/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
'use strict';var c=require("@lexical/react/LexicalCollaborationContext"),f=require("@lexical/react/LexicalComposerContext"),n=require("react");
exports.LexicalNestedComposer=function({initialEditor:a,children:p,initialNodes:k,initialTheme:q,skipCollabChecks:r}){let l=n.useRef(!1),g=n.useContext(f.LexicalComposerContext);if(null==g)throw Error("Minified Lexical error #9; visit https://lexical.dev/docs/error?code=9 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");let [d,{getTheme:t}]=g,w=n.useMemo(()=>{var b=q||t()||void 0;const u=f.createLexicalComposerContext(g,b);void 0!==b&&
(a._config.theme=b);a._parentEditor=d;if(k)for(var e of k)b=e.getType(),a._nodes.set(b,{klass:e,replace:null,transforms:new Set});else{e=a._nodes=new Map(d._nodes);for(const [v,m]of e)a._nodes.set(v,{klass:m.klass,replace:m.replace,transforms:new Set})}a._config.namespace=d._config.namespace;return[a,u]},[]),{isCollabActive:x,yjsDocMap:y}=c.useCollaborationContext(),h=r||l.current||y.has(a.getKey());n.useEffect(()=>{h&&(l.current=!0)},[h]);n.useEffect(()=>d.registerEditableListener(b=>{a.setEditable(b)}),
[a,d]);return n.createElement(f.LexicalComposerContext.Provider,{value:w},!x||h?p:null)}
