sykpcomposer 1.20.111 → 1.20.112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { O as a, Q as m } from "./index-5ec7083a.js";
1
+ import { O as a, Q as m } from "./index-c22c641e.js";
2
2
  import "react";
3
3
  import "react-dom";
4
4
  export {
package/dist/index.umd.js CHANGED
@@ -61,7 +61,7 @@ Check the top-level render call using <`+Ne+">.")}return He}}function Ct(Se,He){
61
61
  `):q)),Q};var Bn=/^(?:focusinfocus|focusoutblur)$/,zn=function(q){q.stopPropagation()};y.extend(y.event,{trigger:function(q,Q,te,le){var ye,be,Oe,tt,Ye,dt,Rt,Ht,Et=[te||b],Qt=d.call(q,"type")?q.type:q,Mn=d.call(q,"namespace")?q.namespace.split("."):[];if(be=Ht=Oe=te=te||b,!(te.nodeType===3||te.nodeType===8)&&!Bn.test(Qt+y.event.triggered)&&(Qt.indexOf(".")>-1&&(Mn=Qt.split("."),Qt=Mn.shift(),Mn.sort()),Ye=Qt.indexOf(":")<0&&"on"+Qt,q=q[y.expando]?q:new y.Event(Qt,typeof q=="object"&&q),q.isTrigger=le?2:3,q.namespace=Mn.join("."),q.rnamespace=q.namespace?new RegExp("(^|\\.)"+Mn.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,q.result=void 0,q.target||(q.target=te),Q=Q==null?[q]:y.makeArray(Q,[q]),Rt=y.event.special[Qt]||{},!(!le&&Rt.trigger&&Rt.trigger.apply(te,Q)===!1))){if(!le&&!Rt.noBubble&&!g(te)){for(tt=Rt.delegateType||Qt,Bn.test(tt+Qt)||(be=be.parentNode);be;be=be.parentNode)Et.push(be),Oe=be;Oe===(te.ownerDocument||b)&&Et.push(Oe.defaultView||Oe.parentWindow||t)}for(ye=0;(be=Et[ye++])&&!q.isPropagationStopped();)Ht=be,q.type=ye>1?tt:Rt.bindType||Qt,dt=(ce.get(be,"events")||Object.create(null))[q.type]&&ce.get(be,"handle"),dt&&dt.apply(be,Q),dt=Ye&&be[Ye],dt&&dt.apply&&ae(be)&&(q.result=dt.apply(be,Q),q.result===!1&&q.preventDefault());return q.type=Qt,!le&&!q.isDefaultPrevented()&&(!Rt._default||Rt._default.apply(Et.pop(),Q)===!1)&&ae(te)&&Ye&&m(te[Qt])&&!g(te)&&(Oe=te[Ye],Oe&&(te[Ye]=null),y.event.triggered=Qt,q.isPropagationStopped()&&Ht.addEventListener(Qt,zn),te[Qt](),q.isPropagationStopped()&&Ht.removeEventListener(Qt,zn),y.event.triggered=void 0,Oe&&(te[Ye]=Oe)),q.result}},simulate:function(q,Q,te){var le=y.extend(new y.Event,te,{type:q,isSimulated:!0});y.event.trigger(le,null,Q)}}),y.fn.extend({trigger:function(q,Q){return this.each(function(){y.event.trigger(q,Q,this)})},triggerHandler:function(q,Q){var te=this[0];if(te)return y.event.trigger(q,Q,te,!0)}});var oi=/\[\]$/,Ko=/\r?\n/g,ki=/^(?:submit|button|image|reset|file)$/i,ls=/^(?:input|select|textarea|keygen)/i;function cs(q,Q,te,le){var ye;if(Array.isArray(Q))y.each(Q,function(be,Oe){te||oi.test(q)?le(q,Oe):cs(q+"["+(typeof Oe=="object"&&Oe!=null?be:"")+"]",Oe,te,le)});else if(!te&&E(Q)==="object")for(ye in Q)cs(q+"["+ye+"]",Q[ye],te,le);else le(q,Q)}y.param=function(q,Q){var te,le=[],ye=function(be,Oe){var tt=m(Oe)?Oe():Oe;le[le.length]=encodeURIComponent(be)+"="+encodeURIComponent(tt??"")};if(q==null)return"";if(Array.isArray(q)||q.jquery&&!y.isPlainObject(q))y.each(q,function(){ye(this.name,this.value)});else for(te in q)cs(te,q[te],Q,ye);return le.join("&")},y.fn.extend({serialize:function(){return y.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var q=y.prop(this,"elements");return q?y.makeArray(q):this}).filter(function(){var q=this.type;return this.name&&!y(this).is(":disabled")&&ls.test(this.nodeName)&&!ki.test(q)&&(this.checked||!Ct.test(q))}).map(function(q,Q){var te=y(this).val();return te==null?null:Array.isArray(te)?y.map(te,function(le){return{name:Q.name,value:le.replace(Ko,`\r
62
62
  `)}}):{name:Q.name,value:te.replace(Ko,`\r
63
63
  `)}}).get()}});var ks=/%20/g,Ro=/#.*$/,Ts=/([?&])_=[^&]*/,Jl=/^(.*?):[ \t]*([^\r\n]*)$/mg,_u=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ef=/^(?:GET|HEAD)$/,ca=/^\/\//,ua={},da={},As="*/".concat("*"),Ui=b.createElement("a");Ui.href=jo.href;function pi(q){return function(Q,te){typeof Q!="string"&&(te=Q,Q="*");var le,ye=0,be=Q.toLowerCase().match(Z)||[];if(m(te))for(;le=be[ye++];)le[0]==="+"?(le=le.slice(1)||"*",(q[le]=q[le]||[]).unshift(te)):(q[le]=q[le]||[]).push(te)}}function Hi(q,Q,te,le){var ye={},be=q===da;function Oe(tt){var Ye;return ye[tt]=!0,y.each(q[tt]||[],function(dt,Rt){var Ht=Rt(Q,te,le);if(typeof Ht=="string"&&!be&&!ye[Ht])return Q.dataTypes.unshift(Ht),Oe(Ht),!1;if(be)return!(Ye=Ht)}),Ye}return Oe(Q.dataTypes[0])||!ye["*"]&&Oe("*")}function Ti(q,Q){var te,le,ye=y.ajaxSettings.flatOptions||{};for(te in Q)Q[te]!==void 0&&((ye[te]?q:le||(le={}))[te]=Q[te]);return le&&y.extend(!0,q,le),q}function qi(q,Q,te){for(var le,ye,be,Oe,tt=q.contents,Ye=q.dataTypes;Ye[0]==="*";)Ye.shift(),le===void 0&&(le=q.mimeType||Q.getResponseHeader("Content-Type"));if(le){for(ye in tt)if(tt[ye]&&tt[ye].test(le)){Ye.unshift(ye);break}}if(Ye[0]in te)be=Ye[0];else{for(ye in te){if(!Ye[0]||q.converters[ye+" "+Ye[0]]){be=ye;break}Oe||(Oe=ye)}be=be||Oe}if(be)return be!==Ye[0]&&Ye.unshift(be),te[be]}function Ai(q,Q,te,le){var ye,be,Oe,tt,Ye,dt={},Rt=q.dataTypes.slice();if(Rt[1])for(Oe in q.converters)dt[Oe.toLowerCase()]=q.converters[Oe];for(be=Rt.shift();be;)if(q.responseFields[be]&&(te[q.responseFields[be]]=Q),!Ye&&le&&q.dataFilter&&(Q=q.dataFilter(Q,q.dataType)),Ye=be,be=Rt.shift(),be){if(be==="*")be=Ye;else if(Ye!=="*"&&Ye!==be){if(Oe=dt[Ye+" "+be]||dt["* "+be],!Oe){for(ye in dt)if(tt=ye.split(" "),tt[1]===be&&(Oe=dt[Ye+" "+tt[0]]||dt["* "+tt[0]],Oe)){Oe===!0?Oe=dt[ye]:dt[ye]!==!0&&(be=tt[0],Rt.unshift(tt[1]));break}}if(Oe!==!0)if(Oe&&q.throws)Q=Oe(Q);else try{Q=Oe(Q)}catch(Ht){return{state:"parsererror",error:Oe?Ht:"No conversion from "+Ye+" to "+be}}}}return{state:"success",data:Q}}y.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:jo.href,type:"GET",isLocal:_u.test(jo.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":As,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":y.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(q,Q){return Q?Ti(Ti(q,y.ajaxSettings),Q):Ti(y.ajaxSettings,q)},ajaxPrefilter:pi(ua),ajaxTransport:pi(da),ajax:function(q,Q){typeof q=="object"&&(Q=q,q=void 0),Q=Q||{};var te,le,ye,be,Oe,tt,Ye,dt,Rt,Ht,Et=y.ajaxSetup({},Q),Qt=Et.context||Et,Mn=Et.context&&(Qt.nodeType||Qt.jquery)?y(Qt):y.event,tr=y.Deferred(),Ln=y.Callbacks("once memory"),eo=Et.statusCode||{},Ar={},ko={},wr="canceled",Ke={readyState:0,getResponseHeader:function(wt){var Gt;if(Ye){if(!be)for(be={};Gt=Jl.exec(ye);)be[Gt[1].toLowerCase()+" "]=(be[Gt[1].toLowerCase()+" "]||[]).concat(Gt[2]);Gt=be[wt.toLowerCase()+" "]}return Gt==null?null:Gt.join(", ")},getAllResponseHeaders:function(){return Ye?ye:null},setRequestHeader:function(wt,Gt){return Ye==null&&(wt=ko[wt.toLowerCase()]=ko[wt.toLowerCase()]||wt,Ar[wt]=Gt),this},overrideMimeType:function(wt){return Ye==null&&(Et.mimeType=wt),this},statusCode:function(wt){var Gt;if(wt)if(Ye)Ke.always(wt[Ke.status]);else for(Gt in wt)eo[Gt]=[eo[Gt],wt[Gt]];return this},abort:function(wt){var Gt=wt||wr;return te&&te.abort(Gt),xt(0,Gt),this}};if(tr.promise(Ke),Et.url=((q||Et.url||jo.href)+"").replace(ca,jo.protocol+"//"),Et.type=Q.method||Q.type||Et.method||Et.type,Et.dataTypes=(Et.dataType||"*").toLowerCase().match(Z)||[""],Et.crossDomain==null){tt=b.createElement("a");try{tt.href=Et.url,tt.href=tt.href,Et.crossDomain=Ui.protocol+"//"+Ui.host!=tt.protocol+"//"+tt.host}catch{Et.crossDomain=!0}}if(Et.data&&Et.processData&&typeof Et.data!="string"&&(Et.data=y.param(Et.data,Et.traditional)),Hi(ua,Et,Q,Ke),Ye)return Ke;dt=y.event&&Et.global,dt&&y.active++===0&&y.event.trigger("ajaxStart"),Et.type=Et.type.toUpperCase(),Et.hasContent=!ef.test(Et.type),le=Et.url.replace(Ro,""),Et.hasContent?Et.data&&Et.processData&&(Et.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&(Et.data=Et.data.replace(ks,"+")):(Ht=Et.url.slice(le.length),Et.data&&(Et.processData||typeof Et.data=="string")&&(le+=(zi.test(le)?"&":"?")+Et.data,delete Et.data),Et.cache===!1&&(le=le.replace(Ts,"$1"),Ht=(zi.test(le)?"&":"?")+"_="+ur.guid+++Ht),Et.url=le+Ht),Et.ifModified&&(y.lastModified[le]&&Ke.setRequestHeader("If-Modified-Since",y.lastModified[le]),y.etag[le]&&Ke.setRequestHeader("If-None-Match",y.etag[le])),(Et.data&&Et.hasContent&&Et.contentType!==!1||Q.contentType)&&Ke.setRequestHeader("Content-Type",Et.contentType),Ke.setRequestHeader("Accept",Et.dataTypes[0]&&Et.accepts[Et.dataTypes[0]]?Et.accepts[Et.dataTypes[0]]+(Et.dataTypes[0]!=="*"?", "+As+"; q=0.01":""):Et.accepts["*"]);for(Rt in Et.headers)Ke.setRequestHeader(Rt,Et.headers[Rt]);if(Et.beforeSend&&(Et.beforeSend.call(Qt,Ke,Et)===!1||Ye))return Ke.abort();if(wr="abort",Ln.add(Et.complete),Ke.done(Et.success),Ke.fail(Et.error),te=Hi(da,Et,Q,Ke),!te)xt(-1,"No Transport");else{if(Ke.readyState=1,dt&&Mn.trigger("ajaxSend",[Ke,Et]),Ye)return Ke;Et.async&&Et.timeout>0&&(Oe=t.setTimeout(function(){Ke.abort("timeout")},Et.timeout));try{Ye=!1,te.send(Ar,xt)}catch(wt){if(Ye)throw wt;xt(-1,wt)}}function xt(wt,Gt,jn,On){var vn,pn,ar,Sr,Fo,oo=Gt;Ye||(Ye=!0,Oe&&t.clearTimeout(Oe),te=void 0,ye=On||"",Ke.readyState=wt>0?4:0,vn=wt>=200&&wt<300||wt===304,jn&&(Sr=qi(Et,Ke,jn)),!vn&&y.inArray("script",Et.dataTypes)>-1&&y.inArray("json",Et.dataTypes)<0&&(Et.converters["text script"]=function(){}),Sr=Ai(Et,Sr,Ke,vn),vn?(Et.ifModified&&(Fo=Ke.getResponseHeader("Last-Modified"),Fo&&(y.lastModified[le]=Fo),Fo=Ke.getResponseHeader("etag"),Fo&&(y.etag[le]=Fo)),wt===204||Et.type==="HEAD"?oo="nocontent":wt===304?oo="notmodified":(oo=Sr.state,pn=Sr.data,ar=Sr.error,vn=!ar)):(ar=oo,(wt||!oo)&&(oo="error",wt<0&&(wt=0))),Ke.status=wt,Ke.statusText=(Gt||oo)+"",vn?tr.resolveWith(Qt,[pn,oo,Ke]):tr.rejectWith(Qt,[Ke,oo,ar]),Ke.statusCode(eo),eo=void 0,dt&&Mn.trigger(vn?"ajaxSuccess":"ajaxError",[Ke,Et,vn?pn:ar]),Ln.fireWith(Qt,[Ke,oo]),dt&&(Mn.trigger("ajaxComplete",[Ke,Et]),--y.active||y.event.trigger("ajaxStop")))}return Ke},getJSON:function(q,Q,te){return y.get(q,Q,te,"json")},getScript:function(q,Q){return y.get(q,void 0,Q,"script")}}),y.each(["get","post"],function(q,Q){y[Q]=function(te,le,ye,be){return m(le)&&(be=be||ye,ye=le,le=void 0),y.ajax(y.extend({url:te,type:Q,dataType:be,data:le,success:ye},y.isPlainObject(te)&&te))}}),y.ajaxPrefilter(function(q){var Q;for(Q in q.headers)Q.toLowerCase()==="content-type"&&(q.contentType=q.headers[Q]||"")}),y._evalUrl=function(q,Q,te){return y.ajax({url:q,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(le){y.globalEval(le,Q,te)}})},y.fn.extend({wrapAll:function(q){var Q;return this[0]&&(m(q)&&(q=q.call(this[0])),Q=y(q,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&Q.insertBefore(this[0]),Q.map(function(){for(var te=this;te.firstElementChild;)te=te.firstElementChild;return te}).append(this)),this},wrapInner:function(q){return m(q)?this.each(function(Q){y(this).wrapInner(q.call(this,Q))}):this.each(function(){var Q=y(this),te=Q.contents();te.length?te.wrapAll(q):Q.append(q)})},wrap:function(q){var Q=m(q);return this.each(function(te){y(this).wrapAll(Q?q.call(this,te):q)})},unwrap:function(q){return this.parent(q).not("body").each(function(){y(this).replaceWith(this.childNodes)}),this}}),y.expr.pseudos.hidden=function(q){return!y.expr.pseudos.visible(q)},y.expr.pseudos.visible=function(q){return!!(q.offsetWidth||q.offsetHeight||q.getClientRects().length)},y.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch{}};var Wi={0:200,1223:204},fo=y.ajaxSettings.xhr();h.cors=!!fo&&"withCredentials"in fo,h.ajax=fo=!!fo,y.ajaxTransport(function(q){var Q,te;if(h.cors||fo&&!q.crossDomain)return{send:function(le,ye){var be,Oe=q.xhr();if(Oe.open(q.type,q.url,q.async,q.username,q.password),q.xhrFields)for(be in q.xhrFields)Oe[be]=q.xhrFields[be];q.mimeType&&Oe.overrideMimeType&&Oe.overrideMimeType(q.mimeType),!q.crossDomain&&!le["X-Requested-With"]&&(le["X-Requested-With"]="XMLHttpRequest");for(be in le)Oe.setRequestHeader(be,le[be]);Q=function(tt){return function(){Q&&(Q=te=Oe.onload=Oe.onerror=Oe.onabort=Oe.ontimeout=Oe.onreadystatechange=null,tt==="abort"?Oe.abort():tt==="error"?typeof Oe.status!="number"?ye(0,"error"):ye(Oe.status,Oe.statusText):ye(Wi[Oe.status]||Oe.status,Oe.statusText,(Oe.responseType||"text")!=="text"||typeof Oe.responseText!="string"?{binary:Oe.response}:{text:Oe.responseText},Oe.getAllResponseHeaders()))}},Oe.onload=Q(),te=Oe.onerror=Oe.ontimeout=Q("error"),Oe.onabort!==void 0?Oe.onabort=te:Oe.onreadystatechange=function(){Oe.readyState===4&&t.setTimeout(function(){Q&&te()})},Q=Q("abort");try{Oe.send(q.hasContent&&q.data||null)}catch(tt){if(Q)throw tt}},abort:function(){Q&&Q()}}}),y.ajaxPrefilter(function(q){q.crossDomain&&(q.contents.script=!1)}),y.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(q){return y.globalEval(q),q}}}),y.ajaxPrefilter("script",function(q){q.cache===void 0&&(q.cache=!1),q.crossDomain&&(q.type="GET")}),y.ajaxTransport("script",function(q){if(q.crossDomain||q.scriptAttrs){var Q,te;return{send:function(le,ye){Q=y("<script>").attr(q.scriptAttrs||{}).prop({charset:q.scriptCharset,src:q.url}).on("load error",te=function(be){Q.remove(),te=null,be&&ye(be.type==="error"?404:200,be.type)}),b.head.appendChild(Q[0])},abort:function(){te&&te()}}}});var Xr=[],Do=/(=)\?(?=&|$)|\?\?/;y.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var q=Xr.pop()||y.expando+"_"+ur.guid++;return this[q]=!0,q}}),y.ajaxPrefilter("json jsonp",function(q,Q,te){var le,ye,be,Oe=q.jsonp!==!1&&(Do.test(q.url)?"url":typeof q.data=="string"&&(q.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&Do.test(q.data)&&"data");if(Oe||q.dataTypes[0]==="jsonp")return le=q.jsonpCallback=m(q.jsonpCallback)?q.jsonpCallback():q.jsonpCallback,Oe?q[Oe]=q[Oe].replace(Do,"$1"+le):q.jsonp!==!1&&(q.url+=(zi.test(q.url)?"&":"?")+q.jsonp+"="+le),q.converters["script json"]=function(){return be||y.error(le+" was not called"),be[0]},q.dataTypes[0]="json",ye=t[le],t[le]=function(){be=arguments},te.always(function(){ye===void 0?y(t).removeProp(le):t[le]=ye,q[le]&&(q.jsonpCallback=Q.jsonpCallback,Xr.push(le)),be&&m(ye)&&ye(be[0]),be=ye=void 0}),"script"}),h.createHTMLDocument=function(){var q=b.implementation.createHTMLDocument("").body;return q.innerHTML="<form></form><form></form>",q.childNodes.length===2}(),y.parseHTML=function(q,Q,te){if(typeof q!="string")return[];typeof Q=="boolean"&&(te=Q,Q=!1);var le,ye,be;return Q||(h.createHTMLDocument?(Q=b.implementation.createHTMLDocument(""),le=Q.createElement("base"),le.href=b.location.href,Q.head.appendChild(le)):Q=b),ye=z.exec(q),be=!te&&[],ye?[Q.createElement(ye[1])]:(ye=vt([q],Q,be),be&&be.length&&y(be).remove(),y.merge([],ye.childNodes))},y.fn.load=function(q,Q,te){var le,ye,be,Oe=this,tt=q.indexOf(" ");return tt>-1&&(le=ri(q.slice(tt)),q=q.slice(0,tt)),m(Q)?(te=Q,Q=void 0):Q&&typeof Q=="object"&&(ye="POST"),Oe.length>0&&y.ajax({url:q,type:ye||"GET",dataType:"html",data:Q}).done(function(Ye){be=arguments,Oe.html(le?y("<div>").append(y.parseHTML(Ye)).find(le):Ye)}).always(te&&function(Ye,dt){Oe.each(function(){te.apply(this,be||[Ye.responseText,dt,Ye])})}),this},y.expr.pseudos.animated=function(q){return y.grep(y.timers,function(Q){return q===Q.elem}).length},y.offset={setOffset:function(q,Q,te){var le,ye,be,Oe,tt,Ye,dt,Rt=y.css(q,"position"),Ht=y(q),Et={};Rt==="static"&&(q.style.position="relative"),tt=Ht.offset(),be=y.css(q,"top"),Ye=y.css(q,"left"),dt=(Rt==="absolute"||Rt==="fixed")&&(be+Ye).indexOf("auto")>-1,dt?(le=Ht.position(),Oe=le.top,ye=le.left):(Oe=parseFloat(be)||0,ye=parseFloat(Ye)||0),m(Q)&&(Q=Q.call(q,te,y.extend({},tt))),Q.top!=null&&(Et.top=Q.top-tt.top+Oe),Q.left!=null&&(Et.left=Q.left-tt.left+ye),"using"in Q?Q.using.call(q,Et):Ht.css(Et)}},y.fn.extend({offset:function(q){if(arguments.length)return q===void 0?this:this.each(function(ye){y.offset.setOffset(this,q,ye)});var Q,te,le=this[0];if(le)return le.getClientRects().length?(Q=le.getBoundingClientRect(),te=le.ownerDocument.defaultView,{top:Q.top+te.pageYOffset,left:Q.left+te.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var q,Q,te,le=this[0],ye={top:0,left:0};if(y.css(le,"position")==="fixed")Q=le.getBoundingClientRect();else{for(Q=this.offset(),te=le.ownerDocument,q=le.offsetParent||te.documentElement;q&&(q===te.body||q===te.documentElement)&&y.css(q,"position")==="static";)q=q.parentNode;q&&q!==le&&q.nodeType===1&&(ye=y(q).offset(),ye.top+=y.css(q,"borderTopWidth",!0),ye.left+=y.css(q,"borderLeftWidth",!0))}return{top:Q.top-ye.top-y.css(le,"marginTop",!0),left:Q.left-ye.left-y.css(le,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var q=this.offsetParent;q&&y.css(q,"position")==="static";)q=q.offsetParent;return q||Xe})}}),y.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(q,Q){var te=Q==="pageYOffset";y.fn[q]=function(le){return Ee(this,function(ye,be,Oe){var tt;if(g(ye)?tt=ye:ye.nodeType===9&&(tt=ye.defaultView),Oe===void 0)return tt?tt[Q]:ye[be];tt?tt.scrollTo(te?tt.pageXOffset:Oe,te?Oe:tt.pageYOffset):ye[be]=Oe},q,le,arguments.length)}}),y.each(["top","left"],function(q,Q){y.cssHooks[Q]=nt(h.pixelPosition,function(te,le){if(le)return le=qe(te,Q),Dt.test(le)?y(te).position()[Q]+"px":le})}),y.each({Height:"height",Width:"width"},function(q,Q){y.each({padding:"inner"+q,content:Q,"":"outer"+q},function(te,le){y.fn[le]=function(ye,be){var Oe=arguments.length&&(te||typeof ye!="boolean"),tt=te||(ye===!0||be===!0?"margin":"border");return Ee(this,function(Ye,dt,Rt){var Ht;return g(Ye)?le.indexOf("outer")===0?Ye["inner"+q]:Ye.document.documentElement["client"+q]:Ye.nodeType===9?(Ht=Ye.documentElement,Math.max(Ye.body["scroll"+q],Ht["scroll"+q],Ye.body["offset"+q],Ht["offset"+q],Ht["client"+q])):Rt===void 0?y.css(Ye,dt,tt):y.style(Ye,dt,Rt,tt)},Q,Oe?ye:void 0,Oe)}})}),y.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(q,Q){y.fn[Q]=function(te){return this.on(Q,te)}}),y.fn.extend({bind:function(q,Q,te){return this.on(q,null,Q,te)},unbind:function(q,Q){return this.off(q,null,Q)},delegate:function(q,Q,te,le){return this.on(Q,q,te,le)},undelegate:function(q,Q,te){return arguments.length===1?this.off(q,"**"):this.off(Q,q||"**",te)},hover:function(q,Q){return this.on("mouseenter",q).on("mouseleave",Q||q)}}),y.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(q,Q){y.fn[Q]=function(te,le){return arguments.length>0?this.on(Q,null,te,le):this.trigger(Q)}});var hi=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;y.proxy=function(q,Q){var te,le,ye;if(typeof Q=="string"&&(te=q[Q],Q=q,q=te),!!m(q))return le=o.call(arguments,2),ye=function(){return q.apply(Q||this,le.concat(o.call(arguments)))},ye.guid=q.guid=q.guid||y.guid++,ye},y.holdReady=function(q){q?y.readyWait++:y.ready(!0)},y.isArray=Array.isArray,y.parseJSON=JSON.parse,y.nodeName=C,y.isFunction=m,y.isWindow=g,y.camelCase=ue,y.type=E,y.now=Date.now,y.isNumeric=function(q){var Q=y.type(q);return(Q==="number"||Q==="string")&&!isNaN(q-parseFloat(q))},y.trim=function(q){return q==null?"":(q+"").replace(hi,"$1")};var Lo=t.jQuery,us=t.$;return y.noConflict=function(q){return t.$===y&&(t.$=us),q&&t.jQuery===y&&(t.jQuery=Lo),y},typeof n>"u"&&(t.jQuery=t.$=y),y})})(C1);var IT=C1.exports;const Nl=Hu(IT);function MT({nodeKey:l}){const[t]=yn(),[n,e,s]=jc(l),o=fe.useCallback(r=>{if(r.preventDefault(),n&&dr(kt())){const a=Dn(l);if(Xm(a)){const c=a.getPageNo();a.remove(),console.log("Deleted Page Break:",c);const u=In().getChildren();for(const d of u)if(Xm(d)){const f=d.getPageNo();f>c&&d.setPageNo(f-1)}return!0}}return!1},[n,l]);return fe.useEffect(()=>mr(t.registerCommand(_a,r=>{const a=t.getElementByKey(l);return r.target===a?(r.shiftKey||s(),e(!n),!0):!1},Jn),t.registerCommand(Qi,o,Jn),t.registerCommand(Zi,o,Jn)),[s,t,n,l,o,e]),fe.useEffect(()=>{const r=t.getElementByKey(l);r!==null&&(r.className=n?"selected":"")},[t,n,l]),null}class Da extends qs{constructor(n=1,e){super(e);Hn(this,"__pageNumber");this.__pageNumber=n}static getType(){return"page-break"}getPageNo(){return this.__pageNumber}setPageNo(n){const e=this.getWritable();e.__pageNumber=n}static clone(n){return new Da(n.__pageNumber,n.__key)}static importJSON(n){return new Da(n.pageNumber)}static importDOM(){return{figure:n=>n.getAttribute("type")!==this.getType()?null:{conversion:RT,priority:xi}}}exportJSON(){return{type:this.getType(),version:1,pageNumber:this.__pageNumber}}createDOM(){const n=document.createElement("figure"),e=document.createElement("span");return n.style.pageBreakAfter="always",n.setAttribute("type","page-break"),e.style.position="absolute",e.style.left="97%",e.style.bottom="0",n.append(e),n.setAttribute("data-page-number",this.__pageNumber.toString()),n}getTextContent(){return`
64
- `}isInline(){return!1}updateDOM(){return!1}decorate(){return re.jsx(MT,{nodeKey:this.__key})}static fromCodoxNode(n){const e=n.pageNumber,s={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,pageNumber:e,style:"",id:n.codox_metadata.id};return console.log("[DEMO DEBUG][PageBreakNode][fromCodoxNode]: ",{codoxNode:n,originalJsonNode:s}),new Da(s.pageNumber)}toCodoxNode(){const n=this.exportJSON(),e={type:"page-break",text:"",pageNumber:n.pageNumber,style:"",version:n.version,codox_metadata:{type:n.type,id:n.pageNumber}};return console.log("[DEMO DEBUG][PageBreakNode][toCodoxNode]: ",{convertedNode:e,originalJsonNode:n}),e}}function RT(l){const t=l.getAttribute("data-page-number"),n=t?parseInt(t,10):1;return{node:j1(n)}}function j1(l){if(l===void 0){const t=Nl("p").length-1;l=Math.ceil(t/20)||1}return new Da(l)}function Xm(l){return l instanceof Da}const DT=rr.lazy(()=>Promise.resolve().then(()=>kD));function LT(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function FT(l=""){return{text:l,uid:LT(),votes:[]}}function k1(l,t,n){return{text:t,uid:l.uid,votes:n||Array.from(l.votes)}}function BT(l){const t=l.getAttribute("data-lexical-poll-question"),n=l.getAttribute("data-lexical-poll-options");return t!==null&&n!==null?{node:T1(t,JSON.parse(n))}:null}let ey=class sk extends qs{constructor(n,e,s){super(s);Hn(this,"__question");Hn(this,"__options");this.__question=n,this.__options=e}static getType(){return"poll"}static clone(n){return new sk(n.__question,n.__options,n.__key)}static importJSON(n){const e=T1(n.question,n.options);return n.options.forEach(e.addOption),e}exportJSON(){return{options:this.__options,question:this.__question,type:"poll",version:1}}addOption(n){const e=this.getWritable(),s=Array.from(e.__options);s.push(n),e.__options=s}deleteOption(n){const e=this.getWritable(),s=Array.from(e.__options),o=s.indexOf(n);s.splice(o,1),e.__options=s}setOptionText(n,e){const s=this.getWritable(),o=k1(n,e),r=Array.from(s.__options),a=r.indexOf(n);r[a]=o,s.__options=r}toggleVote(n,e){const s=this.getWritable(),o=n.votes,r=Array.from(o),a=o.indexOf(e);a===-1?r.push(e):r.splice(a,1);const c=k1(n,n.text,r),i=Array.from(s.__options),u=i.indexOf(n);i[u]=c,s.__options=i}static importDOM(){return{span:n=>n.hasAttribute("data-lexical-poll-question")?{conversion:BT,priority:2}:null}}exportDOM(){const n=document.createElement("span");return n.setAttribute("data-lexical-poll-question",this.__question),n.setAttribute("data-lexical-poll-options",JSON.stringify(this.__options)),{element:n}}createDOM(){const n=document.createElement("span");return n.style.display="inline-block",n}updateDOM(){return!1}decorate(){return re.jsx(fe.Suspense,{fallback:null,children:re.jsx(DT,{question:this.__question,options:this.__options,nodeKey:this.__key})})}};function T1(l,t){return new ey(l,t)}function A1(l){return l instanceof ey}const zT="https://platform.twitter.com/widgets.js";function UT(l){const t=l.getAttribute("data-lexical-tweet-id");return t?{node:N1(t)}:null}let O1=!0;function HT({className:l,format:t,loadingComponent:n,nodeKey:e,onError:s,onLoad:o,tweetID:r}){const a=fe.useRef(null),c=fe.useRef(""),[i,u]=fe.useState(!1),d=fe.useCallback(async()=>{try{await window.twttr.widgets.createTweet(r,a.current),u(!1),O1=!1,o&&o()}catch(f){s&&s(String(f))}},[s,o,r]);return fe.useEffect(()=>{var f;if(r!==c.current){if(u(!0),O1){const p=document.createElement("script");p.src=zT,p.async=!0,(f=document.body)==null||f.appendChild(p),p.onload=d,s&&(p.onerror=s)}else d();c&&(c.current=r)}},[d,s,r]),re.jsxs(w1,{className:l,format:t,nodeKey:e,children:[i?n:null,re.jsx("div",{style:{display:"inline-block",width:"550px"},ref:a})]})}class Ip extends Gm{constructor(n,e,s){super(e,s);Hn(this,"__id");this.__id=n}static getType(){return"tweet"}static clone(n){return new Ip(n.__id,n.__format,n.__key)}static importJSON(n){const e=N1(n.id);return e.setFormat(n.format),e}exportJSON(){return{...super.exportJSON(),id:this.getId(),type:"tweet",version:1}}static importDOM(){return{div:n=>n.hasAttribute("data-lexical-tweet-id")?{conversion:UT,priority:2}:null}}exportDOM(){const n=document.createElement("div");n.setAttribute("data-lexical-tweet-id",this.__id);const e=document.createTextNode(this.getTextContent());return n.append(e),{element:n}}getId(){return this.__id}getTextContent(n,e){return`https://x.com/i/web/status/${this.__id}`}decorate(n,e){const s=e.theme.embedBlock||{},o={base:s.base||"",focus:s.focus||""};return re.jsx(HT,{className:o,format:this.__format,loadingComponent:"Loading...",nodeKey:this.getKey(),tweetID:this.__id})}}function N1(l){return new Ip(l)}class Sd extends qs{constructor(n,e,s){console.log("referencedText",e);super(s);Hn(this,"__referencedElementId");Hn(this,"__text");this.__referencedElementId=n,this.__text=e}static getType(){return"reference"}static clone(n){return new Sd(n.__referencedElementId,n.__text,n.__key)}createDOM(n){const e=document.createElement("span");e.style.cursor="pointer",e.style.background="#f8f6e2",e.style.fontSize="17px",e.setAttribute("data-node-type","reference"),e.setAttribute("data-ref-id",this.__referencedElementId),e.setAttribute("data-lexical-node-key",this.__key),e.setAttribute("id",this.__referencedElementId),e.setAttribute("data-cross-ref","true"),e.textContent=this.__text,e.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation();const r=e.closest('[class^="editor-autosave-"]');if(!r)return;const a=Array.from(r.classList).find(i=>i.startsWith("editor-autosave-"));if(!a)return;a.replace("editor-autosave-","");const c=r.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);c?(c.scrollIntoView({behavior:"smooth",block:"center"}),c.classList.add("reference-highlight"),setTimeout(()=>{c.classList.remove("reference-highlight")},1e3),setTimeout(()=>{if(c instanceof HTMLInputElement||c instanceof HTMLTextAreaElement)c.focus(),c.setSelectionRange(c.value.length,c.value.length);else if(c.isContentEditable){c.focus();const i=document.createRange(),u=window.getSelection();i.selectNodeContents(c),i.collapse(!1),u==null||u.removeAllRanges(),u==null||u.addRange(i)}else c.setAttribute("tabindex","-1"),c.focus()},500)):console.warn(`Referenced element with data-ref-id="ref-${this.__referencedElementId}" not found.`)});const s=document.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);return s&&new MutationObserver(()=>{const r=s.textContent;document.querySelectorAll(`[data-cross-ref][id="${this.__referencedElementId}"]`).forEach(c=>{c.textContent!==r&&(c.textContent=r||"")})}).observe(s,{childList:!0,characterData:!0,subtree:!0}),e}updateDOM(n,e,s){const o=document.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);if(console.log("first",this.__text,o),o){const r=o.textContent;console.log("newText",r),e.textContent!==this.__text&&(e.textContent=this.__text||"")}return!1}decorate(n,e){return re.jsx(re.Fragment,{})}static importJSON(n){return P1(n.id,n.text)}exportJSON(){return{type:"reference",id:this.__referencedElementId,text:this.__text,version:1}}static importDOM(){return{span:n=>n.hasAttribute("data-cross-ref")?{conversion:e=>{const s=e.getAttribute("id")||"",o=e.textContent||"";return{node:new Sd(s,o)}},priority:2}:null}}toCodoxNode(){const n=this.exportJSON(),e={type:"text",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"cursor: pointer; background: #f8f6e2; font-size: 17px;",codox_metadata:{type:n.type,referencedElementId:n.id}};return console.log("[DEMO DEBUG][ReferenceNode][toCodoxNode]:",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){return{type:n.codox_metadata.type,version:n.version,text:n.text,id:n.codox_metadata.referencedElementId}}}function P1(l,t){return new Sd(l,t)}class Pl extends Yr{static getType(){return"dividerText"}static clone(t){return new Pl(t.__text,t.__key)}constructor(t="_______________________________",n){super(t,n)}createDOM(t){const n=super.createDOM(t);return n.dataset.divider="true",n.contentEditable="false",n}updateDOM(t,n,e){return n.dataset.divider="true",super.updateDOM(t,n,e)}exportJSON(){return{...super.exportJSON(),type:"dividerText",id:this.getKey(),version:1,detail:0,format:0,mode:"normal",text:"_______________________________",style:""}}static importJSON(t){const n=t.id??t.key,e=t.text??"_______________________________";return new Pl(e,n)}exportDOM(){const t=document.createElement("span");return t.textContent=this.__text,t.dataset.divider="true",{element:t}}static importDOM(){return{span:t=>t.dataset.divider==="true"||t.textContent==="_______________________________"?{conversion:()=>({node:new Pl}),priority:2}:null}}toCodoxNode(){const t=this.exportJSON();return{type:"text",text:t.text,format:t.format,detail:t.detail,version:t.version,codox_metadata:{type:t.type,id:t.id,_namespace:"dividerText"}}}static fromCodoxNode(t){return{type:"dividerText",text:t.text,format:t.format,detail:t.detail,version:t.version,id:t.codox_metadata.id,mode:t.mode??"normal",style:t.style??""}}}function I1(){return new Pl}function ty(l){return l instanceof Pl}const M1=po();function Mp(l){const t={m:1e3,cm:900,d:500,cd:400,c:100,xc:90,l:50,xl:40,x:10,ix:9,v:5,iv:4,i:1};let n="";for(let e in t)for(;l>=t[e];)n+=e,l-=t[e];return n}function R1(){const[l]=yn(),t=(s,o)=>{o(s),At(s)&&s.getChildren().forEach(r=>t(r,o))},n=()=>{l.update(()=>{const s=In(),o=[];t(s,a=>{ny(a)&&o.push(a)});let r=!1;for(let a=0;a<o.length;a++)if(o[a].getNumber()!==a+1){r=!0;break}r&&o.forEach((a,c)=>{const i=c+1;a.setNumber(i);const u=a.getContentKey(),d=Dn(u);if(gr(d)){const f=d.getFirstChild();if(Wt(f)){const p=f.getTextContent(),h=p.replace(/^\[[^\]]*\]/,`[${Mp(i)}]`);h!==p&&f.setTextContent(h)}}})})},e=()=>{l.update(()=>{var b;const s=In(),o=kt(),r=WT(0);o&&o.insertNodes([r]);const a=En(),c=or("[?] ");a.append(c),s.append(a),r.setContentKey(a.getKey());const i=[];t(s,v=>{ny(v)&&i.push(v)});const d=i.map(v=>v.getContentKey()).map(v=>Dn(v)).filter(v=>v!==null);d==null||d.forEach(v=>{v&&s.append(v)});let f=!1;if(s.getChildren().forEach(v=>{if(gr(v)){const _=v.getFirstChild();if((_&&ty(_)||_&&Wt(_)&&_.getTextContent().includes("_______________________________"))&&(f=!0,!ty(_)&&_.getTextContent().includes("_______________________________"))){const E=I1();_.replace(E)}}}),!f&&(d==null?void 0:d.length)>0){const v=En();v.append(I1()),(b=d[0])==null||b.insertBefore(v)}const p=[];if(s.getChildren().forEach(v=>{if(gr(v)){const _=v.getFirstChild();(_&&ty(_)||_&&Wt(_)&&_.getTextContent().includes("_______________________________"))&&p.push(v)}}),p.length>1)for(let v=1;v<p.length;v++)p[v].remove();const h=[];t(s,v=>{ny(v)&&h.push(v)}),h.forEach((v,_)=>{const E=_+1;v.setNumber(E);const S=v.getContentKey(),w=Dn(S);if(gr(w)){const y=w.getFirstChild();if(Wt(y)){const x=y.getTextContent(),C=x.replace(/^\[[^\]]*\]/,`[${Mp(E)}]`);C!==x&&y.setTextContent(C)}}});const m=c.getTextContentSize(),g=bc();g.anchor.set(c.getKey(),m,"text"),g.focus.set(c.getKey(),m,"text"),jr(g),setTimeout(()=>{const v=l.getElementByKey(a.getKey());v&&v.scrollIntoView({behavior:"smooth",block:"end"})},100)})};return fe.useEffect(()=>{const s=l.registerCommand(M1,()=>(e(),!0),0);return l.update(()=>{setTimeout(n,100)}),s},[l]),null}class Il extends Yr{constructor(n,e,s,o){super(s||`[${n??"?"}]`,o);Hn(this,"__number");Hn(this,"__contentKey");this.__number=n??0,this.__contentKey=e??""}static getType(){return"endnote"}static clone(n){return new Il(n.__number,n.__contentKey,n.__text,n.__key)}static importJSON(n){const e=n.number??0,s=n.contentKey??"",o=n.text??`[${Mp(e)}]`,r=n.id??n.key;return new Il(e,s,o,r)}exportJSON(){return{...super.exportJSON(),number:this.__number,contentKey:this.__contentKey,type:"endnote",version:1,id:this.getKey()}}setNumber(n){const e=this.getWritable();e.__number=n,this.setTextContent(`[${Mp(n)}]`)}setContentKey(n){const e=this.getWritable();e.__contentKey=n}getContentKey(){return this.__contentKey}createDOM(n){const e=super.createDOM(n);return e.style.cssText="cursor: pointer; vertical-align: super; font-size: 0.8em;",e.dataset.endnote="true",e}exportDOM(){const n=document.createElement("span");return n.dataset.lexicalEndnote="true",n.dataset.contentKey=this.__contentKey,n.textContent=this.__text,{element:n}}static importDOM(){return{span:n=>n.dataset.lexicalEndnote==="true"?{conversion:qT,priority:1}:null}}getNumber(){return this.__number}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}toCodoxNode(){const n=this.exportJSON();return{type:"text",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,codox_metadata:{type:n.type,id:n.id,contentKey:n.contentKey,number:n.number,_namespace:"endnote"}}}static fromCodoxNode(n){return{type:"endnote",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,number:n.codox_metadata.number,contentKey:n.codox_metadata.contentKey,id:n.codox_metadata.id,style:n.style??""}}}function qT(l){var o;const t=(o=l.textContent)==null?void 0:o.match(/\[(\d+)\]/),n=t?parseInt(t[1],10):1,e=l.dataset.contentKey||"";return{node:new Il(n,e)}}function WT(l,t){return new Il(l,t||"")}function ny(l){return l instanceof Il}class Wo extends Yr{constructor(n,e,s,o){super(n,o);Hn(this,"__color");Hn(this,"__id");this.__color=e,this.__id=s}static getType(){return"colored"}getId(){return this.__id}static clone(n){return new Wo(n.__text,n.__color,n.__id,n.__key)}createDOM(n){const e=super.createDOM(n);return e.style.color=this.__color,e.setAttribute("id",this.__id),e.setAttribute("data-ref-id",`ref-${this.__id}`),e}updateDOM(n,e,s){const o=super.updateDOM(n,e,s);return n.__color!==this.__color&&(e.style.color=this.__color),n.__id!==this.__id&&(e.setAttribute("id",this.__id),e.setAttribute("data-ref-id",`ref-${this.__id}`)),o}exportJSON(){return{...super.exportJSON(),type:"colored",color:this.__color,id:this.__id}}static importJSON(n){return new Wo(n.text,n.color,n.id)}toCodoxNode(){const n=this.exportJSON(),e={type:"text",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:`color:${n.color};`,codox_metadata:{type:n.type,id:n.id}};return console.log("[DEMO DEBUG][ColoredNode][toCodoxNode]:",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){let e="";n.style.split(";").forEach(o=>{o.startsWith("color:")&&(e=o.split(":")[1])});const s={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"",id:n.codox_metadata.id,color:e};return console.log("[DEMO DEBUG][ColoredNode][fromCodoxNode]:",{codoxNode:n,originalJsonNode:s}),s}}const D1=[];class $s extends Br{constructor(n=D1,e){super(e);Hn(this,"__ids");this.__ids=n}static getType(){return"mark"}static clone(n){return new $s(n.__ids,n.__key)}static importDOM(){return{mark:n=>({conversion:e=>{var o;const s=((o=e.getAttribute("data-ids"))==null?void 0:o.split(","))||[];return{node:new $s(s)}},priority:1})}}static importJSON(n){return new $s(n.ids)}exportJSON(){return{...super.exportJSON(),ids:Array.from(this.__ids),type:this.__type}}createDOM(n){const e=document.createElement("mark");return zr(e,n.theme.mark),this.__ids.length>0&&e.setAttribute("data-ids",this.__ids.join(",")),e}updateDOM(n,e,s){const o=n.__ids,r=this.__ids;return o.join(",")!==r.join(",")&&e.setAttribute("data-ids",r.join(",")),!1}exportDOM(){const n=document.createElement("mark");return this.__ids.length>0&&n.setAttribute("data-ids",this.__ids.join(",")),{element:n}}hasID(n){return this.__ids.includes(n)}getIDs(){return Array.from(this.__ids)}setIDs(n){return this.__ids=n,this}addID(n){return this.__ids.includes(n)||(this.__ids=[...this.__ids,n]),this}deleteID(n){const e=this.__ids.indexOf(n);e>-1&&this.__ids.splice(e,1)}insertNewAfter(n,e=!0){const s=ry(this.__ids);return this.insertAfter(s,e),s}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}}function ry(l=D1){return Pr(new $s(l))}function Ml(l){return l instanceof $s}function L1(l){const t=l.getChildren();let n=null;for(let e=0;e<t.length;e++){const s=t[e];n===null?l.insertBefore(s):n.insertAfter(s),n=s}l.remove()}function JT(l,t,n,e){const s=bc(),[o,r]=l.isBackward()?[l.focus,l.anchor]:[l.anchor,l.focus];s.anchor.set(o.key,o.offset,o.type),s.focus.set(r.key,r.offset,r.type);let a,c;const i=s.extract();for(const u of i){if(At(c)&&c.isParentOf(u))continue;let d=null;if(Wt(u))d=u;else{if(Ml(u))continue;(At(u)||hr(u))&&u.isInline()&&(d=u)}if(d!==null){if(d&&d.is(a))continue;const f=d.getParent();(f==null||!f.is(a))&&(c=void 0),a=f,c===void 0&&(c=(e||ry)([n]),d.insertBefore(c)),c.append(d)}else a=void 0,c=void 0}At(c)&&(t?c.selectStart():c.selectEnd())}function VT(l,t){let n=l;for(;n!==null;){if(Ml(n))return n.getIDs();if(Wt(n)&&t===n.getTextContentSize()){const e=n.getNextSibling();if(Ml(e))return e.getIDs()}n=n.getParent()}return null}const F1=[$s,xp,gd,hd,wp,Am,xs,Vs,Tl,bp,Pm,pd,Ec,Y_,ey,Op,Zm,xd,wd,Oc,zm,Ip,Ap,bd,_d,Tp,Da,Np,Pp,Sd,Il,Wo,Pa,Pl],QD="";function oy(...l){return l.filter(Boolean).join(" ")}function Fi({"data-test-id":l,children:t,className:n,onClick:e,disabled:s,small:o,title:r}){return re.jsx("button",{disabled:s,className:oy("Button__root",s&&"Button__disabled",o&&"Button__small",n),onClick:e,title:r,"aria-label":r,...l&&{"data-test-id":l},children:t})}const XD="";function Rp({"data-test-id":l,children:t}){return re.jsx("div",{className:"DialogActions","data-test-id":l,children:t})}const e4="";function Nc({label:l,value:t,onChange:n,placeholder:e="","data-test-id":s,type:o="text"}){return re.jsxs("div",{className:"Input__wrapper",children:[re.jsx("label",{className:"Input__label",children:l}),re.jsx("input",{type:o,className:"Input__input",placeholder:e,value:t,onChange:r=>{n(r.target.value)},"data-test-id":s,max:o==="number"?20:void 0})]})}const KT=fe.createContext({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function B1({children:l}){const[t,n]=fe.useState({cellEditorConfig:null,cellEditorPlugins:null});return re.jsx(KT.Provider,{value:fe.useMemo(()=>({cellEditorConfig:t.cellEditorConfig,cellEditorPlugins:t.cellEditorPlugins,set:(e,s)=>{n({cellEditorConfig:e,cellEditorPlugins:s})}}),[t.cellEditorConfig,t.cellEditorPlugins]),children:l})}const Dp=(l,t)=>{let n=5381;const e=String(t);for(let s=0;s<e.length;s++)n=(n<<5)+n+e.charCodeAt(s);return`table-${t}-${Math.abs(n%1e6)}`};function $T({activeEditor:l,onClose:t,enableCaptions:n=!0}){const[e,s]=fe.useState("5"),[o,r]=fe.useState("5"),[a,c]=fe.useState(""),[i,u]=fe.useState(!0);fe.useState(!0);let d=Number(localStorage.getItem("tableCount"))||1;fe.useEffect(()=>{const h=Number(e),m=Number(o);h&&h>0&&h<=500&&m&&m>0&&m<=20?u(!1):u(!0)},[e,o]);const f=()=>{l.update(()=>{const m=In().getChildren().filter(fr);if(m.length===0){console.warn("No tables found in the document!");return}const g=m.map(b=>{let v=a;const _=b.getPreviousSibling();if(_&&gr(_)){const E=_.getChildren().filter(S=>S.getType()==="text");E.length>1&&(v=E[1].getTextContent())}return{caption:v,content:b.getChildren().map(E=>E.getChildren().map(S=>S.getTextContent()))}});localStorage.setItem("savedTableData",JSON.stringify(g))})},p=()=>{if(!e||!o)return;const h=d;l.update(()=>{if(n){const m=En();m.setFormat("left");const v=In().getChildren().filter(fr).length,_=Dp(a||`Table ${h}`,v),E=new Wo(`Table ${h}:`,"black",_);E.setStyle("font-weight: bold; margin-right: 8px;");const S=a.trim()===""?".":a,w=or(S);w.setStyle(a?"color: black; font-style: italic; font-weight: bold;":"color: gray; font-style: italic; font-weight: normal;"),m.getChildren().forEach(T=>T.remove());const y=rs();m.append(E),m.append(w),m.append(y),ei([m]);const x={rows:!0,columns:!1},C=Um(Number(e),Number(o),x);if(!C){console.error("Failed to create TableNode");return}C.__captionId=_,ei([C])}else{const m={rows:!0,columns:!1},g=Um(Number(e),Number(o),m);if(!g){console.error("Failed to create TableNode");return}ei([g,rs()])}}),l.update(()=>{if(n){const g=In().getChildren().filter(fr);let b=1;g.forEach(v=>{var C;const _=v.getPreviousSibling(),w=In().getChildren().filter(fr).length,y=v.__captionId||Dp(`Table ${b}`,w),x=v.getNextSibling();if(x&&gr(x)&&x.getChildren().forEach(T=>{T.getTextContent().startsWith("Table")&&T.remove()}),_&&gr(_)){let T=null;if(_.getChildren().forEach(D=>{D.getTextContent().startsWith("Table")&&(T=D)}),T){const D=((C=T.getId)==null?void 0:C.call(T))||y;T.remove();const F=new Wo(`Table ${b}:`,"black",D),I=_.getFirstChild();I!==null?I.insertBefore(F):_.append(F)}else if(n){const D=new Wo(`Table ${b}:`,"black",y),F=_.getFirstChild();F!==null?F.insertBefore(D):_.append(D)}}else{const T=`Table ${b}:`,D=En();D.setFormat("left");const F=new Wo(T,"black",y);F.setStyle("font-weight: bold; margin-right: 5px;");const I=a.trim()===""?"Caption text here":a,B=or(I);B.setStyle("color: black; font-style: italic; font-weight: normal;"),D.append(F),D.append(or(" ")),D.append(B),v.insertBefore(D)}b++})}}),d++,localStorage.setItem("tableCount",d.toString()),setTimeout(()=>{f()},50),t==null||t()};return re.jsxs(re.Fragment,{children:[re.jsx(Nc,{placeholder:"# of rows (1-500)",label:"Rows",onChange:s,value:e,type:"number"}),re.jsx(Nc,{placeholder:"# of columns (1-50)",label:"Columns",onChange:r,value:o,type:"number"}),n&&re.jsx(Nc,{placeholder:"Enter table caption",label:"Caption",value:a,onChange:c}),re.jsx(Rp,{children:re.jsx(Fi,{disabled:i,onClick:p,children:"Confirm"})})]})}const t4="",iy={blockCursor:"PlaygroundEditorTheme__blockCursor",characterLimit:"PlaygroundEditorTheme__characterLimit",code:"PlaygroundEditorTheme__code",codeHighlight:{atrule:"PlaygroundEditorTheme__tokenAttr",attr:"PlaygroundEditorTheme__tokenAttr",boolean:"PlaygroundEditorTheme__tokenProperty",builtin:"PlaygroundEditorTheme__tokenSelector",cdata:"PlaygroundEditorTheme__tokenComment",char:"PlaygroundEditorTheme__tokenSelector",class:"PlaygroundEditorTheme__tokenFunction","class-name":"PlaygroundEditorTheme__tokenFunction",comment:"PlaygroundEditorTheme__tokenComment",constant:"PlaygroundEditorTheme__tokenProperty",deleted:"PlaygroundEditorTheme__tokenProperty",doctype:"PlaygroundEditorTheme__tokenComment",entity:"PlaygroundEditorTheme__tokenOperator",function:"PlaygroundEditorTheme__tokenFunction",important:"PlaygroundEditorTheme__tokenVariable",inserted:"PlaygroundEditorTheme__tokenSelector",keyword:"PlaygroundEditorTheme__tokenAttr",namespace:"PlaygroundEditorTheme__tokenVariable",number:"PlaygroundEditorTheme__tokenProperty",operator:"PlaygroundEditorTheme__tokenOperator",prolog:"PlaygroundEditorTheme__tokenComment",property:"PlaygroundEditorTheme__tokenProperty",punctuation:"PlaygroundEditorTheme__tokenPunctuation",regex:"PlaygroundEditorTheme__tokenVariable",selector:"PlaygroundEditorTheme__tokenSelector",string:"PlaygroundEditorTheme__tokenSelector",symbol:"PlaygroundEditorTheme__tokenProperty",tag:"PlaygroundEditorTheme__tokenProperty",url:"PlaygroundEditorTheme__tokenOperator",variable:"PlaygroundEditorTheme__tokenVariable"},embedBlock:{base:"PlaygroundEditorTheme__embedBlock",focus:"PlaygroundEditorTheme__embedBlockFocus"},hashtag:"PlaygroundEditorTheme__hashtag",heading:{h1:"PlaygroundEditorTheme__h1",h2:"PlaygroundEditorTheme__h2",h3:"PlaygroundEditorTheme__h3",h4:"PlaygroundEditorTheme__h4",h5:"PlaygroundEditorTheme__h5",h6:"PlaygroundEditorTheme__h6"},image:"editor-image",indent:"PlaygroundEditorTheme__indent",inlineImage:"inline-editor-image",layoutContainer:"PlaygroundEditorTheme__layoutContainer",layoutItem:"PlaygroundEditorTheme__layoutItem",link:"PlaygroundEditorTheme__link",list:{checklist:"PlaygroundEditorTheme__checklist",listitem:"PlaygroundEditorTheme__listItem",listitemChecked:"PlaygroundEditorTheme__listItemChecked",listitemUnchecked:"PlaygroundEditorTheme__listItemUnchecked",nested:{listitem:"PlaygroundEditorTheme__nestedListItem"},olDepth:["PlaygroundEditorTheme__ol1","PlaygroundEditorTheme__ol2","PlaygroundEditorTheme__ol3","PlaygroundEditorTheme__ol4","PlaygroundEditorTheme__ol5"],ul:"PlaygroundEditorTheme__ul"},ltr:"PlaygroundEditorTheme__ltr",mark:"PlaygroundEditorTheme__mark",markOverlap:"PlaygroundEditorTheme__markOverlap",paragraph:"PlaygroundEditorTheme__paragraph",quote:"PlaygroundEditorTheme__quote",rtl:"PlaygroundEditorTheme__rtl",table:"PlaygroundEditorTheme__table",tableAddColumns:"PlaygroundEditorTheme__tableAddColumns",tableAddRows:"PlaygroundEditorTheme__tableAddRows",tableCell:"PlaygroundEditorTheme__tableCell",tableCellActionButton:"PlaygroundEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"PlaygroundEditorTheme__tableCellActionButtonContainer",tableCellEditing:"PlaygroundEditorTheme__tableCellEditing",tableCellHeader:"PlaygroundEditorTheme__tableCellHeader",tableCellPrimarySelected:"PlaygroundEditorTheme__tableCellPrimarySelected",tableCellResizer:"PlaygroundEditorTheme__tableCellResizer",tableCellSelected:"PlaygroundEditorTheme__tableCellSelected",tableCellSortedIndicator:"PlaygroundEditorTheme__tableCellSortedIndicator",tableResizeRuler:"PlaygroundEditorTheme__tableCellResizeRuler",tableSelected:"PlaygroundEditorTheme__tableSelected",tableSelection:"PlaygroundEditorTheme__tableSelection",text:{bold:"PlaygroundEditorTheme__textBold",code:"PlaygroundEditorTheme__textCode",italic:"PlaygroundEditorTheme__textItalic",strikethrough:"PlaygroundEditorTheme__textStrikethrough",subscript:"PlaygroundEditorTheme__textSubscript",superscript:"PlaygroundEditorTheme__textSuperscript",underline:"PlaygroundEditorTheme__textUnderline",underlineStrikethrough:"PlaygroundEditorTheme__textUnderlineStrikethrough"}};function Lp({defaultSelection:l}){const[t]=yn();return fe.useEffect(()=>{t.focus(()=>{const n=document.activeElement,e=t.getRootElement();e===null||n!==null&&e.contains(n)||e.focus({preventScroll:!0})},{defaultSelection:l})},[l,t]),null}function sy(){return In().getTextContent()}function ay(l,t=!0){if(l)return!1;let n=sy();return t&&(n=n.trim()),n===""}function GT(l){if(!ay(l,!1))return!1;const t=In().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){const s=t[e];if(hr(s))return!1;if(At(s)){if(!gr(s)||s.__indent!==0)return!1;const o=s.getChildren(),r=o.length;for(let a=0;a<r;a++){const c=o[e];if(!Wt(c))return!1}}}return!0}function z1(l){return()=>GT(l)}function YT(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var ZT=YT(function(l){const t=new URLSearchParams;t.append("code",l);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${l}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function QT(l,t,n,e){const s=r=>r instanceof n,o=r=>{const a=or(r.getTextContent());a.setFormat(r.getFormat()),r.replace(a)};return[l.registerNodeTransform(Yr,r=>{if(!r.isSimpleText())return;let a,c=r.getPreviousSibling(),i=r.getTextContent(),u=r;if(Wt(c)){const f=c.getTextContent(),p=t(f+i);if(s(c)){if(p===null||(h=>h.getLatest().__mode)(c)!==0)return void o(c);{const h=p.end-f.length;if(h>0){const m=f+i.slice(0,h);if(c.select(),c.setTextContent(m),h===i.length)r.remove();else{const g=i.slice(h);r.setTextContent(g)}return}}}else if(p===null||p.start<f.length)return}let d=0;for(;;){a=t(i);let f,p=a===null?"":i.slice(a.end);if(i=p,p===""){const m=u.getNextSibling();if(Wt(m)){p=u.getTextContent()+m.getTextContent();const g=t(p);if(g===null)return void(s(m)?o(m):m.markDirty());if(g.start!==0)return}}if(a===null)return;if(a.start===0&&Wt(c)&&c.isTextEntity()){d+=a.end;continue}a.start===0?[f,u]=u.splitText(a.end):[,f,u]=u.splitText(a.start+d,a.end+d),f===void 0&&ZT(165,"nodeToReplace");const h=e(f);if(h.setFormat(f.getFormat()),f.replace(h),u==null)return;d=0,c=h}}),l.registerNodeTransform(n,r=>{const a=r.getTextContent(),c=t(a);if(c===null||c.start!==0)return void o(r);if(a.length>c.end)return void r.splitText(c.end);const i=r.getPreviousSibling();Wt(i)&&i.isTextEntity()&&(o(i),o(r));const u=r.getNextSibling();Wt(u)&&u.isTextEntity()&&(o(u),s(r)&&o(r))})]}function U1(l,t,n){const[e]=yn();fe.useEffect(()=>mr(...QT(e,l,t,n)),[n,e,l,t])}const XT=new RegExp(function(){const{alpha:l,alphanumeric:t,hashChars:n}=function(){const s=String.fromCharCode,o="A-Za-zªµºÀ-ÖØ-öø-Ɂɐ-ˁˆ-ˑˠ-ˤˮͺΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϵϷ-ҁҊ-ӎӐ-ӹԀ-ԏԱ-Ֆՙա-ևא-תװ-ײء-غـ-يٮ-ٯٱ-ۓەۥ-ۦۮ-ۯۺ-ۼۿܐܒ-ܯݍ-ݭހ-ޥޱऄ-हऽॐक़-ॡॽঅ-ঌএ-ঐও-নপ-রলশ-হঽৎড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલ-ળવ-હઽૐૠ-ૡଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହଽଡ଼-ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡඅ-ඖක-නඳ-රලව-ෆก-ะา-ำเ-ๆກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ະາ-ຳຽເ-ໄໆໜ-ໝༀཀ-ཇཉ-ཪྈ-ྋက-အဣ-ဧဩ-ဪၐ-ၕႠ-Ⴥა-ჺჼᄀ-ᅙᅟ-ᆢᆨ-ᇹሀ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙶᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦩᧁ-ᧇᨀ-ᨖᴀ-ᶿḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₔℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℱℳ-ℹℼ-ℿⅅ-ⅉⰀ-Ⱞⰰ-ⱞⲀ-ⳤⴀ-ⴥⴰ-ⵥⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〆〱-〵〻-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄬㄱ-ㆎㆠ-ㆷㇰ-ㇿ㐀-䶵一-龻ꀀ-ꒌꠀ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢ가-힣豈-鶴侮-頻並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ̀-ͯ҃-֑҆-ֹֻ-ֽֿׁ-ׂׄ-ׇׅؐ-ًؕ-ٰٞۖ-ۜ۟-ۤۧ-۪ۨ-ܑۭܰ-݊ަ-ްँ-ः़ा-्॑-॔ॢ-ॣঁ-ঃ়া-ৄে-ৈো-্ৗৢ-ৣਁ-ਃ਼ਾ-ੂੇ-ੈੋ-੍ੰ-ੱઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣଁ-ଃ଼ା-ୃେ-ୈୋ-୍ୖ-ୗஂா-ூெ-ைொ-்ௗఁ-ఃా-ౄె-ైొ-్ౕ-ౖಂ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕ-ೖം-ഃാ-ൃെ-ൈൊ-്ൗං-ඃ්ා-ුූෘ-ෟෲ-ෳัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-༹༙༵༷༾-༿ཱ-྄྆-྇ྐ-ྗྙ-ྼ࿆ာ-ဲံ-္ၖ-ၙ፟ᜒ-᜔ᜲ-᜴ᝒ-ᝓᝲ-ᝳា-៓៝᠋-᠍ᢩᤠ-ᤫᤰ-᤻ᦰ-ᧀᧈ-ᧉᨗ-ᨛ᷀-᷃⃐-⃥⃜⃡-⃫〪-゙〯-゚ꠂ꠆ꠋꠣ-ꠧﬞ︀-️︠-︣À-ÖØ-öø-ÿĀ-ɏɓ-ɔɖ-ɗəɛɣɨɯɲʉʋʻ̀-ͯḀ-ỿЀ-ӿԀ-ԧⷠ-ⷿꙀ-֑ꚟ-ֿׁ-ׂׄ-ׇׅא-תװ-״﬒-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﭏؐ-ؚؠ-ٟٮ-ۓە-ۜ۞-۪ۨ-ۯۺ-ۼۿݐ-ݿࢠࢢ-ࢬࣤ-ࣾﭐ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼ‌-‌ก-ฺเ-๎ᄀ-ᇿ㄰-ㆅꥠ-꥿가-힯ힰ-퟿ᄀ-ᅵァ-ヺー-ヾヲ-゚0-9A-Za-zぁ-ゖ゙-ゞ㐀-䶿一-鿿"+s(173824)+"-"+s(177983)+s(177984)+"-"+s(178207)+s(194560)+"-"+s(195103)+"〃々〻";return{alpha:o,alphanumeric:o+"0-9٠-٩۰-۹०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉០-៩᠐-᠙᥆-᥏᧐-᧙0-9_",hashChars:"#\\uFF03"}}(),e="["+t+"]";return"("+("^|$|[^&/"+t+"]")+")("+("["+n+"]")+")("+e+"*"+("["+l+"]")+e+"*)"}(),"i");function H1(){const[l]=yn();fe.useEffect(()=>{if(!l.hasNodes([bp]))throw new Error("HashtagPlugin: HashtagNode not registered on editor")},[l]);const t=fe.useCallback(e=>D_(e.getTextContent()),[]),n=fe.useCallback(e=>{const s=XT.exec(e);if(s===null)return null;const o=s[3].length+1,r=s.index+s[1].length;return{end:r+o,start:r}},[]);return U1(n,bp,t),null}function q1(){const[l]=yn();return fe.useEffect(()=>{if(!l.hasNodes([gd,hd]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[l]),function(t){fe.useEffect(()=>mr(t.registerCommand($_,()=>(z_(t,"number"),!0),Jn),t.registerCommand(K_,()=>(z_(t,"bullet"),!0),Jn),t.registerCommand(G_,()=>(q2(t),!0),Jn),t.registerCommand(yl,()=>!!V2(),Jn)),[t])}(l),null}const eA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe.useLayoutEffect:fe.useEffect;function tA(l){return{initialValueFn:()=>l.isEditable(),subscribe:t=>l.registerEditableListener(t)}}function ly(){return function(l){const[t]=yn(),n=fe.useMemo(()=>l(t),[t,l]),e=fe.useRef(n.initialValueFn()),[s,o]=fe.useState(e.current);return eA(()=>{const{initialValueFn:r,subscribe:a}=n,c=r();return e.current!==c&&(e.current=c,o(c)),a(i=>{e.current=i,o(i)})},[n,l]),s}(tA)}function W1(l){const t=window.location.origin,n=e=>{if(e.origin!==t)return;const s=l.getRootElement();if(document.activeElement!==s)return;const o=e.data;if(typeof o=="string"){let r;try{r=JSON.parse(o)}catch{return}if(r&&r.protocol==="nuanria_messaging"&&r.type==="request"){const a=r.payload;if(a&&a.functionId==="makeChanges"){const c=a.args;if(c){const[i,u,d,f,p,h]=c;l.update(()=>{const m=kt();if(St(m)){const g=m.anchor;let b=g.getNode(),v=0,_=0;if(Wt(b)&&i>=0&&u>=0&&(v=i,_=i+u,m.setTextNodeRange(b,v,b,_)),v===_&&d===""||(m.insertRawText(d),b=g.getNode()),Wt(b)){v=f,_=f+p;const E=b.getTextContentSize();v=v>E?E:v,_=_>E?E:_,m.setTextNodeRange(b,v,b,_)}e.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}function Ed(l,t){const n=t.body?t.body.childNodes:[];let e=[];const s=[];for(let o=0;o<n.length;o++){const r=n[o];if(!V1.has(r.nodeName)){const a=K1(r,l,s,!1);a!==null&&(e=e.concat(a))}}return function(o){for(const r of o)r.getNextSibling()instanceof wm&&r.insertAfter(rs());for(const r of o){const a=r.getChildren();for(const c of a)r.insertBefore(c);r.remove()}}(s),e}function cy(l,t){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const n=document.createElement("div"),e=In().getChildren();for(let s=0;s<e.length;s++)J1(l,e[s],n,t);return n.innerHTML}function J1(l,t,n,e=null){let s=e===null||t.isSelected(e);const o=At(t)&&t.excludeFromCopy("html");let r=t;if(e!==null){let p=d_(t);p=Wt(p)&&e!==null?f_(e,p):p,r=p}const a=At(r)?r.getChildren():[],c=l._nodes.get(r.getType());let i;i=c&&c.exportDOM!==void 0?c.exportDOM(l,r):r.exportDOM(l);const{element:u,after:d}=i;if(!u)return!1;const f=document.createDocumentFragment();for(let p=0;p<a.length;p++){const h=a[p],m=J1(l,h,f,e);!s&&At(t)&&m&&t.extractWithChild(h,e,"html")&&(s=!0)}if(s&&!o){if(Di(u)&&u.append(f),n.append(u),d){const p=d.call(r,u);p&&u.replaceWith(p)}}else n.append(f);return s}const V1=new Set(["STYLE","SCRIPT"]);function K1(l,t,n,e,s=new Map,o){let r=[];if(V1.has(l.nodeName))return r;let a=null;const c=function(h,m){const{nodeName:g}=h,b=m._htmlConversions.get(g.toLowerCase());let v=null;if(b!==void 0)for(const _ of b){const E=_(h);E!==null&&(v===null||(v.priority||0)<(E.priority||0))&&(v=E)}return v!==null?v.conversion:null}(l,t),i=c?c(l):null;let u=null;if(i!==null){u=i.after;const h=i.node;if(a=Array.isArray(h)?h[h.length-1]:h,a!==null){for(const[,m]of s)if(a=m(a,o),!a)break;a&&r.push(...Array.isArray(h)?h:[a])}i.forChild!=null&&s.set(l.nodeName,i.forChild)}const d=l.childNodes;let f=[];const p=(a==null||!ro(a))&&(a!=null&&mm(a)||e);for(let h=0;h<d.length;h++)f.push(...K1(d[h],t,n,p,new Map(s),a));return u!=null&&(f=u(f)),Gk(l)&&(f=nA(l,f,p?()=>{const h=new wm;return n.push(h),h}:En)),a==null?r=r.concat(f):At(a)&&a.append(...f),r}function nA(l,t,n){const e=l.style.textAlign,s=[];let o=[];for(let r=0;r<t.length;r++){const a=t[r];if(mm(a))e&&!a.getFormat()&&a.setFormat(e),s.push(a);else if(o.push(a),r===t.length-1||r<t.length-1&&mm(t[r+1])){const c=n();c.setFormat(e),c.append(...o),s.push(c),o=[]}}return s}function rA(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Fp=rA(function(l){const t=new URLSearchParams;t.append("code",l);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${l}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const oA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,$1=l=>oA?(l||window).getSelection():null;function G1(l){const t=kt();return t==null&&Fp(166),St(t)&&t.isCollapsed()||t.getNodes().length===0?"":cy(l,t)}function iA(l){const t=kt();return t==null&&Fp(166),St(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(sA(l,t))}function Y1(l,t){const n=l.getData("text/plain")||l.getData("text/uri-list");n!=null&&t.insertRawText(n)}function Z1(l,t,n){const e=l.getData("application/x-lexical-editor");if(e)try{const r=JSON.parse(e);if(r.namespace===n._config.namespace&&Array.isArray(r.nodes))return Q1(n,aA(r.nodes),t)}catch{}const s=l.getData("text/html");if(s)try{const r=new DOMParser().parseFromString(s,"text/html");return Q1(n,Ed(n,r),t)}catch{}const o=l.getData("text/plain")||l.getData("text/uri-list");if(o!=null)if(St(t)){const r=o.split(/(\r?\n|\t)/);r[r.length-1]===""&&r.pop();for(let a=0;a<r.length;a++){const c=kt();if(St(c)){const i=r[a];i===`
64
+ `}isInline(){return!1}updateDOM(){return!1}decorate(){return re.jsx(MT,{nodeKey:this.__key})}static fromCodoxNode(n){const e=n.pageNumber,s={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,pageNumber:e,style:"",id:n.codox_metadata.id};return console.log("[DEMO DEBUG][PageBreakNode][fromCodoxNode]: ",{codoxNode:n,originalJsonNode:s}),new Da(s.pageNumber)}toCodoxNode(){const n=this.exportJSON(),e={type:"page-break",text:"",pageNumber:n.pageNumber,style:"",version:n.version,codox_metadata:{type:n.type,id:n.pageNumber}};return console.log("[DEMO DEBUG][PageBreakNode][toCodoxNode]: ",{convertedNode:e,originalJsonNode:n}),e}}function RT(l){const t=l.getAttribute("data-page-number"),n=t?parseInt(t,10):1;return{node:j1(n)}}function j1(l){if(l===void 0){const t=Nl("p").length-1;l=Math.ceil(t/20)||1}return new Da(l)}function Xm(l){return l instanceof Da}const DT=rr.lazy(()=>Promise.resolve().then(()=>kD));function LT(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function FT(l=""){return{text:l,uid:LT(),votes:[]}}function k1(l,t,n){return{text:t,uid:l.uid,votes:n||Array.from(l.votes)}}function BT(l){const t=l.getAttribute("data-lexical-poll-question"),n=l.getAttribute("data-lexical-poll-options");return t!==null&&n!==null?{node:T1(t,JSON.parse(n))}:null}let ey=class sk extends qs{constructor(n,e,s){super(s);Hn(this,"__question");Hn(this,"__options");this.__question=n,this.__options=e}static getType(){return"poll"}static clone(n){return new sk(n.__question,n.__options,n.__key)}static importJSON(n){const e=T1(n.question,n.options);return n.options.forEach(e.addOption),e}exportJSON(){return{options:this.__options,question:this.__question,type:"poll",version:1}}addOption(n){const e=this.getWritable(),s=Array.from(e.__options);s.push(n),e.__options=s}deleteOption(n){const e=this.getWritable(),s=Array.from(e.__options),o=s.indexOf(n);s.splice(o,1),e.__options=s}setOptionText(n,e){const s=this.getWritable(),o=k1(n,e),r=Array.from(s.__options),a=r.indexOf(n);r[a]=o,s.__options=r}toggleVote(n,e){const s=this.getWritable(),o=n.votes,r=Array.from(o),a=o.indexOf(e);a===-1?r.push(e):r.splice(a,1);const c=k1(n,n.text,r),i=Array.from(s.__options),u=i.indexOf(n);i[u]=c,s.__options=i}static importDOM(){return{span:n=>n.hasAttribute("data-lexical-poll-question")?{conversion:BT,priority:2}:null}}exportDOM(){const n=document.createElement("span");return n.setAttribute("data-lexical-poll-question",this.__question),n.setAttribute("data-lexical-poll-options",JSON.stringify(this.__options)),{element:n}}createDOM(){const n=document.createElement("span");return n.style.display="inline-block",n}updateDOM(){return!1}decorate(){return re.jsx(fe.Suspense,{fallback:null,children:re.jsx(DT,{question:this.__question,options:this.__options,nodeKey:this.__key})})}};function T1(l,t){return new ey(l,t)}function A1(l){return l instanceof ey}const zT="https://platform.twitter.com/widgets.js";function UT(l){const t=l.getAttribute("data-lexical-tweet-id");return t?{node:N1(t)}:null}let O1=!0;function HT({className:l,format:t,loadingComponent:n,nodeKey:e,onError:s,onLoad:o,tweetID:r}){const a=fe.useRef(null),c=fe.useRef(""),[i,u]=fe.useState(!1),d=fe.useCallback(async()=>{try{await window.twttr.widgets.createTweet(r,a.current),u(!1),O1=!1,o&&o()}catch(f){s&&s(String(f))}},[s,o,r]);return fe.useEffect(()=>{var f;if(r!==c.current){if(u(!0),O1){const p=document.createElement("script");p.src=zT,p.async=!0,(f=document.body)==null||f.appendChild(p),p.onload=d,s&&(p.onerror=s)}else d();c&&(c.current=r)}},[d,s,r]),re.jsxs(w1,{className:l,format:t,nodeKey:e,children:[i?n:null,re.jsx("div",{style:{display:"inline-block",width:"550px"},ref:a})]})}class Ip extends Gm{constructor(n,e,s){super(e,s);Hn(this,"__id");this.__id=n}static getType(){return"tweet"}static clone(n){return new Ip(n.__id,n.__format,n.__key)}static importJSON(n){const e=N1(n.id);return e.setFormat(n.format),e}exportJSON(){return{...super.exportJSON(),id:this.getId(),type:"tweet",version:1}}static importDOM(){return{div:n=>n.hasAttribute("data-lexical-tweet-id")?{conversion:UT,priority:2}:null}}exportDOM(){const n=document.createElement("div");n.setAttribute("data-lexical-tweet-id",this.__id);const e=document.createTextNode(this.getTextContent());return n.append(e),{element:n}}getId(){return this.__id}getTextContent(n,e){return`https://x.com/i/web/status/${this.__id}`}decorate(n,e){const s=e.theme.embedBlock||{},o={base:s.base||"",focus:s.focus||""};return re.jsx(HT,{className:o,format:this.__format,loadingComponent:"Loading...",nodeKey:this.getKey(),tweetID:this.__id})}}function N1(l){return new Ip(l)}class Sd extends qs{constructor(n,e,s){console.log("referencedText",e);super(s);Hn(this,"__referencedElementId");Hn(this,"__text");this.__referencedElementId=n,this.__text=e}static getType(){return"reference"}static clone(n){return new Sd(n.__referencedElementId,n.__text,n.__key)}createDOM(n){const e=document.createElement("span");e.style.cursor="pointer",e.style.background="#f8f6e2",e.style.fontSize="17px",e.setAttribute("data-node-type","reference"),e.setAttribute("data-ref-id",this.__referencedElementId),e.setAttribute("data-lexical-node-key",this.__key),e.setAttribute("id",this.__referencedElementId),e.setAttribute("data-cross-ref","true"),e.textContent=this.__text,e.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation();const r=e.closest('[class^="editor-autosave-"]');if(!r)return;const a=Array.from(r.classList).find(i=>i.startsWith("editor-autosave-"));if(!a)return;a.replace("editor-autosave-","");const c=r.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);c?(c.scrollIntoView({behavior:"smooth",block:"center"}),c.classList.add("reference-highlight"),setTimeout(()=>{c.classList.remove("reference-highlight")},1e3),setTimeout(()=>{if(c instanceof HTMLInputElement||c instanceof HTMLTextAreaElement)c.focus(),c.setSelectionRange(c.value.length,c.value.length);else if(c.isContentEditable){c.focus();const i=document.createRange(),u=window.getSelection();i.selectNodeContents(c),i.collapse(!1),u==null||u.removeAllRanges(),u==null||u.addRange(i)}else c.setAttribute("tabindex","-1"),c.focus()},500)):console.warn(`Referenced element with data-ref-id="ref-${this.__referencedElementId}" not found.`)});const s=document.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);return s&&new MutationObserver(()=>{const r=s.textContent;document.querySelectorAll(`[data-cross-ref][id="${this.__referencedElementId}"]`).forEach(c=>{c.textContent!==r&&(c.textContent=r||"")})}).observe(s,{childList:!0,characterData:!0,subtree:!0}),e}updateDOM(n,e,s){const o=document.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);if(console.log("first",this.__text,o),o){const r=o.textContent;console.log("newText",r),e.textContent!==this.__text&&(e.textContent=this.__text||"")}return!1}decorate(n,e){return re.jsx(re.Fragment,{})}static importJSON(n){return P1(n.id,n.text)}exportJSON(){return{type:"reference",id:this.__referencedElementId,text:this.__text,version:1}}static importDOM(){return{span:n=>n.hasAttribute("data-cross-ref")?{conversion:e=>{const s=e.getAttribute("id")||"",o=e.textContent||"";return{node:new Sd(s,o)}},priority:2}:null}}toCodoxNode(){const n=this.exportJSON(),e={type:"text",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"cursor: pointer; background: #f8f6e2; font-size: 17px;",codox_metadata:{type:n.type,referencedElementId:n.id}};return console.log("[DEMO DEBUG][ReferenceNode][toCodoxNode]:",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){return{type:n.codox_metadata.type,version:n.version,text:n.text,id:n.codox_metadata.referencedElementId}}}function P1(l,t){return new Sd(l,t)}class Pl extends Yr{static getType(){return"dividerText"}static clone(t){return new Pl(t.__text,t.__key)}constructor(t="_______________________________",n){super(t,n)}createDOM(t){const n=super.createDOM(t);return n.dataset.divider="true",n.contentEditable="false",n}updateDOM(t,n,e){return n.dataset.divider="true",super.updateDOM(t,n,e)}exportJSON(){return{...super.exportJSON(),type:"dividerText",id:this.getKey(),version:1,detail:0,format:0,mode:"normal",text:"_______________________________",style:""}}static importJSON(t){const n=t.id??t.key,e=t.text??"_______________________________";return new Pl(e,n)}exportDOM(){const t=document.createElement("span");return t.textContent=this.__text,t.dataset.divider="true",{element:t}}static importDOM(){return{span:t=>t.dataset.divider==="true"||t.textContent==="_______________________________"?{conversion:()=>({node:new Pl}),priority:2}:null}}toCodoxNode(){const t=this.exportJSON();return{type:"text",text:t.text,format:t.format,detail:t.detail,version:t.version,codox_metadata:{type:t.type,id:t.id,_namespace:"dividerText"}}}static fromCodoxNode(t){return{type:"dividerText",text:t.text,format:t.format,detail:t.detail,version:t.version,id:t.codox_metadata.id,mode:t.mode??"normal",style:t.style??""}}}function I1(){return new Pl}function ty(l){return l instanceof Pl}const M1=po();function Mp(l){const t={m:1e3,cm:900,d:500,cd:400,c:100,xc:90,l:50,xl:40,x:10,ix:9,v:5,iv:4,i:1};let n="";for(let e in t)for(;l>=t[e];)n+=e,l-=t[e];return n}function R1(){const[l]=yn(),t=(s,o)=>{o(s),At(s)&&s.getChildren().forEach(r=>t(r,o))},n=()=>{l.update(()=>{const s=In(),o=[];t(s,a=>{ny(a)&&o.push(a)});let r=!1;for(let a=0;a<o.length;a++)if(o[a].getNumber()!==a+1){r=!0;break}r&&o.forEach((a,c)=>{const i=c+1;a.setNumber(i);const u=a.getContentKey(),d=Dn(u);if(gr(d)){const f=d.getFirstChild();if(Wt(f)){const p=f.getTextContent(),h=p.replace(/^\[[^\]]*\]/,`[${Mp(i)}]`);h!==p&&f.setTextContent(h)}}})})},e=()=>{l.update(()=>{var b;const s=In(),o=kt(),r=WT(0);o&&o.insertNodes([r]);const a=En(),c=or("[?] ");a.append(c),s.append(a),r.setContentKey(a.getKey());const i=[];t(s,v=>{ny(v)&&i.push(v)});const d=i.map(v=>v.getContentKey()).map(v=>Dn(v)).filter(v=>v!==null);d==null||d.forEach(v=>{v&&s.append(v)});let f=!1;if(s.getChildren().forEach(v=>{if(gr(v)){const _=v.getFirstChild();if((_&&ty(_)||_&&Wt(_)&&_.getTextContent().includes("_______________________________"))&&(f=!0,!ty(_)&&_.getTextContent().includes("_______________________________"))){const E=I1();_.replace(E)}}}),!f&&(d==null?void 0:d.length)>0){const v=En();v.append(I1()),(b=d[0])==null||b.insertBefore(v)}const p=[];if(s.getChildren().forEach(v=>{if(gr(v)){const _=v.getFirstChild();(_&&ty(_)||_&&Wt(_)&&_.getTextContent().includes("_______________________________"))&&p.push(v)}}),p.length>1)for(let v=1;v<p.length;v++)p[v].remove();const h=[];t(s,v=>{ny(v)&&h.push(v)}),h.forEach((v,_)=>{const E=_+1;v.setNumber(E);const S=v.getContentKey(),w=Dn(S);if(gr(w)){const y=w.getFirstChild();if(Wt(y)){const x=y.getTextContent(),C=x.replace(/^\[[^\]]*\]/,`[${Mp(E)}]`);C!==x&&y.setTextContent(C)}}});const m=c.getTextContentSize(),g=bc();g.anchor.set(c.getKey(),m,"text"),g.focus.set(c.getKey(),m,"text"),jr(g),setTimeout(()=>{const v=l.getElementByKey(a.getKey());v&&v.scrollIntoView({behavior:"smooth",block:"end"})},100)})};return fe.useEffect(()=>{const s=l.registerCommand(M1,()=>(e(),!0),0);return l.update(()=>{setTimeout(n,100)}),s},[l]),null}class Il extends Yr{constructor(n,e,s,o){super(s||`[${n??"?"}]`,o);Hn(this,"__number");Hn(this,"__contentKey");this.__number=n??0,this.__contentKey=e??""}static getType(){return"endnote"}static clone(n){return new Il(n.__number,n.__contentKey,n.__text,n.__key)}static importJSON(n){const e=n.number??0,s=n.contentKey??"",o=n.text??`[${Mp(e)}]`,r=n.id??n.key;return new Il(e,s,o,r)}exportJSON(){return{...super.exportJSON(),number:this.__number,contentKey:this.__contentKey,type:"endnote",version:1,id:this.getKey()}}setNumber(n){const e=this.getWritable();e.__number=n,this.setTextContent(`[${Mp(n)}]`)}setContentKey(n){const e=this.getWritable();e.__contentKey=n}getContentKey(){return this.__contentKey}createDOM(n){const e=super.createDOM(n);return e.style.cssText="cursor: pointer; vertical-align: super; font-size: 0.8em;",e.dataset.endnote="true",e}exportDOM(){const n=document.createElement("span");return n.dataset.lexicalEndnote="true",n.dataset.contentKey=this.__contentKey,n.textContent=this.__text,{element:n}}static importDOM(){return{span:n=>n.dataset.lexicalEndnote==="true"?{conversion:qT,priority:1}:null}}getNumber(){return this.__number}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}toCodoxNode(){const n=this.exportJSON();return{type:"text",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,codox_metadata:{type:n.type,id:n.id,contentKey:n.contentKey,number:n.number,_namespace:"endnote"}}}static fromCodoxNode(n){return{type:"endnote",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,number:n.codox_metadata.number,contentKey:n.codox_metadata.contentKey,id:n.codox_metadata.id,style:n.style??""}}}function qT(l){var o;const t=(o=l.textContent)==null?void 0:o.match(/\[(\d+)\]/),n=t?parseInt(t[1],10):1,e=l.dataset.contentKey||"";return{node:new Il(n,e)}}function WT(l,t){return new Il(l,t||"")}function ny(l){return l instanceof Il}class Wo extends Yr{constructor(n,e,s,o){super(n,o);Hn(this,"__color");Hn(this,"__id");this.__color=e,this.__id=s}static getType(){return"colored"}getId(){return this.__id}static clone(n){return new Wo(n.__text,n.__color,n.__id,n.__key)}createDOM(n){const e=super.createDOM(n);return e.style.color=this.__color,e.setAttribute("id",this.__id),e.setAttribute("data-ref-id",`ref-${this.__id}`),e}updateDOM(n,e,s){const o=super.updateDOM(n,e,s);return n.__color!==this.__color&&(e.style.color=this.__color),n.__id!==this.__id&&(e.setAttribute("id",this.__id),e.setAttribute("data-ref-id",`ref-${this.__id}`)),o}exportJSON(){return{...super.exportJSON(),type:"colored",color:this.__color,id:this.__id}}static importJSON(n){return new Wo(n.text,n.color,n.id)}toCodoxNode(){const n=this.exportJSON(),e={type:"text",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:`color:${n.color};`,codox_metadata:{type:n.type,id:n.id}};return console.log("[DEMO DEBUG][ColoredNode][toCodoxNode]:",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){let e="";n.style.split(";").forEach(o=>{o.startsWith("color:")&&(e=o.split(":")[1])});const s={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"",id:n.codox_metadata.id,color:e};return console.log("[DEMO DEBUG][ColoredNode][fromCodoxNode]:",{codoxNode:n,originalJsonNode:s}),s}}const D1=[];class $s extends Br{constructor(n=D1,e){super(e);Hn(this,"__ids");this.__ids=n}static getType(){return"mark"}static clone(n){return new $s(n.__ids,n.__key)}static importDOM(){return{mark:n=>({conversion:e=>{var o;const s=((o=e.getAttribute("data-ids"))==null?void 0:o.split(","))||[];return{node:new $s(s)}},priority:1})}}static importJSON(n){return new $s(n.ids)}exportJSON(){return{...super.exportJSON(),ids:Array.from(this.__ids),type:this.__type}}createDOM(n){const e=document.createElement("mark");return zr(e,n.theme.mark),this.__ids.length>0&&e.setAttribute("data-ids",this.__ids.join(",")),e}updateDOM(n,e,s){const o=n.__ids,r=this.__ids;return o.join(",")!==r.join(",")&&e.setAttribute("data-ids",r.join(",")),!1}exportDOM(){const n=document.createElement("mark");return this.__ids.length>0&&n.setAttribute("data-ids",this.__ids.join(",")),{element:n}}hasID(n){return this.__ids.includes(n)}getIDs(){return Array.from(this.__ids)}setIDs(n){return this.__ids=n,this}addID(n){return this.__ids.includes(n)||(this.__ids=[...this.__ids,n]),this}deleteID(n){const e=this.__ids.indexOf(n);e>-1&&this.__ids.splice(e,1)}insertNewAfter(n,e=!0){const s=ry(this.__ids);return this.insertAfter(s,e),s}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}}function ry(l=D1){return Pr(new $s(l))}function Ml(l){return l instanceof $s}function L1(l){const t=l.getChildren();let n=null;for(let e=0;e<t.length;e++){const s=t[e];n===null?l.insertBefore(s):n.insertAfter(s),n=s}l.remove()}function JT(l,t,n,e){const s=bc(),[o,r]=l.isBackward()?[l.focus,l.anchor]:[l.anchor,l.focus];s.anchor.set(o.key,o.offset,o.type),s.focus.set(r.key,r.offset,r.type);let a,c;const i=s.extract();for(const u of i){if(At(c)&&c.isParentOf(u))continue;let d=null;if(Wt(u))d=u;else{if(Ml(u))continue;(At(u)||hr(u))&&u.isInline()&&(d=u)}if(d!==null){if(d&&d.is(a))continue;const f=d.getParent();(f==null||!f.is(a))&&(c=void 0),a=f,c===void 0&&(c=(e||ry)([n]),d.insertBefore(c)),c.append(d)}else a=void 0,c=void 0}At(c)&&(t?c.selectStart():c.selectEnd())}function VT(l,t){let n=l;for(;n!==null;){if(Ml(n))return n.getIDs();if(Wt(n)&&t===n.getTextContentSize()){const e=n.getNextSibling();if(Ml(e))return e.getIDs()}n=n.getParent()}return null}const F1=[$s,xp,gd,hd,wp,Am,xs,Vs,Tl,bp,Pm,pd,Ec,Y_,ey,Op,Zm,xd,wd,Oc,zm,Ip,Ap,bd,_d,Tp,Da,Np,Pp,Sd,Il,Wo,Pa,Pl],QD="";function oy(...l){return l.filter(Boolean).join(" ")}function Fi({"data-test-id":l,children:t,className:n,onClick:e,disabled:s,small:o,title:r}){return re.jsx("button",{disabled:s,className:oy("Button__root",s&&"Button__disabled",o&&"Button__small",n),onClick:e,title:r,"aria-label":r,...l&&{"data-test-id":l},children:t})}const XD="";function Rp({"data-test-id":l,children:t}){return re.jsx("div",{className:"DialogActions","data-test-id":l,children:t})}const e4="";function Nc({label:l,value:t,onChange:n,placeholder:e="","data-test-id":s,type:o="text"}){return re.jsxs("div",{className:"Input__wrapper",children:[re.jsx("label",{className:"Input__label",children:l}),re.jsx("input",{type:o,className:"Input__input",placeholder:e,value:t,onChange:r=>{n(r.target.value)},"data-test-id":s,max:o==="number"?20:void 0})]})}const KT=fe.createContext({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function B1({children:l}){const[t,n]=fe.useState({cellEditorConfig:null,cellEditorPlugins:null});return re.jsx(KT.Provider,{value:fe.useMemo(()=>({cellEditorConfig:t.cellEditorConfig,cellEditorPlugins:t.cellEditorPlugins,set:(e,s)=>{n({cellEditorConfig:e,cellEditorPlugins:s})}}),[t.cellEditorConfig,t.cellEditorPlugins]),children:l})}const Dp=(l,t)=>{let n=5381;const e=String(t);for(let s=0;s<e.length;s++)n=(n<<5)+n+e.charCodeAt(s);return`table-${t}-${Math.abs(n%1e6)}`};function $T({activeEditor:l,onClose:t,enableCaptions:n=!0}){const[e,s]=fe.useState("5"),[o,r]=fe.useState("5"),[a,c]=fe.useState(""),[i,u]=fe.useState(!0);fe.useState(!0);let d=Number(localStorage.getItem("tableCount"))||1;fe.useEffect(()=>{const h=Number(e),m=Number(o);h&&h>0&&h<=500&&m&&m>0&&m<=20?u(!1):u(!0)},[e,o]);const f=()=>{l.update(()=>{const m=In().getChildren().filter(fr);if(m.length===0){console.warn("No tables found in the document!");return}const g=m.map(b=>{let v=a;const _=b.getPreviousSibling();if(_&&gr(_)){const E=_.getChildren().filter(S=>S.getType()==="text");E.length>1&&(v=E[1].getTextContent())}return{caption:v,content:b.getChildren().map(E=>E.getChildren().map(S=>S.getTextContent()))}});localStorage.setItem("savedTableData",JSON.stringify(g))})},p=()=>{if(!e||!o)return;const h=d;l.update(()=>{if(n){const m=En();m.setFormat("left");const v=In().getChildren().filter(fr).length,_=Dp(a||`Table ${h}`,v),E=new Wo(`Table ${h}:`,"black",_);E.setStyle("font-weight: bold; margin-right: 8px;");const S=a.trim()===""?".":a,w=or(S);w.setStyle(a?"color: black; font-style: italic; font-weight: bold;":"color: gray; font-style: italic; font-weight: normal;"),m.getChildren().forEach(T=>T.remove());const y=rs();m.append(E),m.append(w),m.append(y),ei([m]);const x={rows:!0,columns:!1},C=Um(Number(e),Number(o),x);if(!C){console.error("Failed to create TableNode");return}C.__captionId=_,ei([C])}else{const m={rows:!0,columns:!1},g=Um(Number(e),Number(o),m);if(!g){console.error("Failed to create TableNode");return}ei([g,rs()])}}),l.update(()=>{if(n){const g=In().getChildren().filter(fr);let b=1;g.forEach(v=>{var C;const _=v.getPreviousSibling(),w=In().getChildren().filter(fr).length,y=v.__captionId||Dp(`Table ${b}`,w),x=v.getNextSibling();if(x&&gr(x)&&x.getChildren().forEach(T=>{T.getTextContent().startsWith("Table")&&T.remove()}),_&&gr(_)){let T=null;if(_.getChildren().forEach(D=>{D.getTextContent().startsWith("Table")&&(T=D)}),T){const D=((C=T.getId)==null?void 0:C.call(T))||y;T.remove();const F=new Wo(`Table ${b}:`,"black",D),I=_.getFirstChild();I!==null?I.insertBefore(F):_.append(F)}else if(n){const D=new Wo(`Table ${b}:`,"black",y),F=_.getFirstChild();F!==null?F.insertBefore(D):_.append(D)}}else{const T=`Table ${b}:`,D=En();D.setFormat("left");const F=new Wo(T,"black",y);F.setStyle("font-weight: bold; margin-right: 5px;");const I=a.trim()===""?"Caption text here":a,B=or(I);B.setStyle("color: black; font-style: italic; font-weight: normal;"),D.append(F),D.append(or(" ")),D.append(B),v.insertBefore(D)}b++})}}),d++,localStorage.setItem("tableCount",d.toString()),setTimeout(()=>{f()},50),t==null||t()};return re.jsxs(re.Fragment,{children:[re.jsx(Nc,{placeholder:"# of rows (1-500)",label:"Rows",onChange:s,value:e,type:"number"}),re.jsx(Nc,{placeholder:"# of columns (1-20)",label:"Columns",onChange:r,value:o,type:"number"}),n&&re.jsx(Nc,{placeholder:"Enter table caption",label:"Caption",value:a,onChange:c}),re.jsx(Rp,{children:re.jsx(Fi,{disabled:i,onClick:p,children:"Confirm"})})]})}const t4="",iy={blockCursor:"PlaygroundEditorTheme__blockCursor",characterLimit:"PlaygroundEditorTheme__characterLimit",code:"PlaygroundEditorTheme__code",codeHighlight:{atrule:"PlaygroundEditorTheme__tokenAttr",attr:"PlaygroundEditorTheme__tokenAttr",boolean:"PlaygroundEditorTheme__tokenProperty",builtin:"PlaygroundEditorTheme__tokenSelector",cdata:"PlaygroundEditorTheme__tokenComment",char:"PlaygroundEditorTheme__tokenSelector",class:"PlaygroundEditorTheme__tokenFunction","class-name":"PlaygroundEditorTheme__tokenFunction",comment:"PlaygroundEditorTheme__tokenComment",constant:"PlaygroundEditorTheme__tokenProperty",deleted:"PlaygroundEditorTheme__tokenProperty",doctype:"PlaygroundEditorTheme__tokenComment",entity:"PlaygroundEditorTheme__tokenOperator",function:"PlaygroundEditorTheme__tokenFunction",important:"PlaygroundEditorTheme__tokenVariable",inserted:"PlaygroundEditorTheme__tokenSelector",keyword:"PlaygroundEditorTheme__tokenAttr",namespace:"PlaygroundEditorTheme__tokenVariable",number:"PlaygroundEditorTheme__tokenProperty",operator:"PlaygroundEditorTheme__tokenOperator",prolog:"PlaygroundEditorTheme__tokenComment",property:"PlaygroundEditorTheme__tokenProperty",punctuation:"PlaygroundEditorTheme__tokenPunctuation",regex:"PlaygroundEditorTheme__tokenVariable",selector:"PlaygroundEditorTheme__tokenSelector",string:"PlaygroundEditorTheme__tokenSelector",symbol:"PlaygroundEditorTheme__tokenProperty",tag:"PlaygroundEditorTheme__tokenProperty",url:"PlaygroundEditorTheme__tokenOperator",variable:"PlaygroundEditorTheme__tokenVariable"},embedBlock:{base:"PlaygroundEditorTheme__embedBlock",focus:"PlaygroundEditorTheme__embedBlockFocus"},hashtag:"PlaygroundEditorTheme__hashtag",heading:{h1:"PlaygroundEditorTheme__h1",h2:"PlaygroundEditorTheme__h2",h3:"PlaygroundEditorTheme__h3",h4:"PlaygroundEditorTheme__h4",h5:"PlaygroundEditorTheme__h5",h6:"PlaygroundEditorTheme__h6"},image:"editor-image",indent:"PlaygroundEditorTheme__indent",inlineImage:"inline-editor-image",layoutContainer:"PlaygroundEditorTheme__layoutContainer",layoutItem:"PlaygroundEditorTheme__layoutItem",link:"PlaygroundEditorTheme__link",list:{checklist:"PlaygroundEditorTheme__checklist",listitem:"PlaygroundEditorTheme__listItem",listitemChecked:"PlaygroundEditorTheme__listItemChecked",listitemUnchecked:"PlaygroundEditorTheme__listItemUnchecked",nested:{listitem:"PlaygroundEditorTheme__nestedListItem"},olDepth:["PlaygroundEditorTheme__ol1","PlaygroundEditorTheme__ol2","PlaygroundEditorTheme__ol3","PlaygroundEditorTheme__ol4","PlaygroundEditorTheme__ol5"],ul:"PlaygroundEditorTheme__ul"},ltr:"PlaygroundEditorTheme__ltr",mark:"PlaygroundEditorTheme__mark",markOverlap:"PlaygroundEditorTheme__markOverlap",paragraph:"PlaygroundEditorTheme__paragraph",quote:"PlaygroundEditorTheme__quote",rtl:"PlaygroundEditorTheme__rtl",table:"PlaygroundEditorTheme__table",tableAddColumns:"PlaygroundEditorTheme__tableAddColumns",tableAddRows:"PlaygroundEditorTheme__tableAddRows",tableCell:"PlaygroundEditorTheme__tableCell",tableCellActionButton:"PlaygroundEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"PlaygroundEditorTheme__tableCellActionButtonContainer",tableCellEditing:"PlaygroundEditorTheme__tableCellEditing",tableCellHeader:"PlaygroundEditorTheme__tableCellHeader",tableCellPrimarySelected:"PlaygroundEditorTheme__tableCellPrimarySelected",tableCellResizer:"PlaygroundEditorTheme__tableCellResizer",tableCellSelected:"PlaygroundEditorTheme__tableCellSelected",tableCellSortedIndicator:"PlaygroundEditorTheme__tableCellSortedIndicator",tableResizeRuler:"PlaygroundEditorTheme__tableCellResizeRuler",tableSelected:"PlaygroundEditorTheme__tableSelected",tableSelection:"PlaygroundEditorTheme__tableSelection",text:{bold:"PlaygroundEditorTheme__textBold",code:"PlaygroundEditorTheme__textCode",italic:"PlaygroundEditorTheme__textItalic",strikethrough:"PlaygroundEditorTheme__textStrikethrough",subscript:"PlaygroundEditorTheme__textSubscript",superscript:"PlaygroundEditorTheme__textSuperscript",underline:"PlaygroundEditorTheme__textUnderline",underlineStrikethrough:"PlaygroundEditorTheme__textUnderlineStrikethrough"}};function Lp({defaultSelection:l}){const[t]=yn();return fe.useEffect(()=>{t.focus(()=>{const n=document.activeElement,e=t.getRootElement();e===null||n!==null&&e.contains(n)||e.focus({preventScroll:!0})},{defaultSelection:l})},[l,t]),null}function sy(){return In().getTextContent()}function ay(l,t=!0){if(l)return!1;let n=sy();return t&&(n=n.trim()),n===""}function GT(l){if(!ay(l,!1))return!1;const t=In().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){const s=t[e];if(hr(s))return!1;if(At(s)){if(!gr(s)||s.__indent!==0)return!1;const o=s.getChildren(),r=o.length;for(let a=0;a<r;a++){const c=o[e];if(!Wt(c))return!1}}}return!0}function z1(l){return()=>GT(l)}function YT(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var ZT=YT(function(l){const t=new URLSearchParams;t.append("code",l);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${l}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function QT(l,t,n,e){const s=r=>r instanceof n,o=r=>{const a=or(r.getTextContent());a.setFormat(r.getFormat()),r.replace(a)};return[l.registerNodeTransform(Yr,r=>{if(!r.isSimpleText())return;let a,c=r.getPreviousSibling(),i=r.getTextContent(),u=r;if(Wt(c)){const f=c.getTextContent(),p=t(f+i);if(s(c)){if(p===null||(h=>h.getLatest().__mode)(c)!==0)return void o(c);{const h=p.end-f.length;if(h>0){const m=f+i.slice(0,h);if(c.select(),c.setTextContent(m),h===i.length)r.remove();else{const g=i.slice(h);r.setTextContent(g)}return}}}else if(p===null||p.start<f.length)return}let d=0;for(;;){a=t(i);let f,p=a===null?"":i.slice(a.end);if(i=p,p===""){const m=u.getNextSibling();if(Wt(m)){p=u.getTextContent()+m.getTextContent();const g=t(p);if(g===null)return void(s(m)?o(m):m.markDirty());if(g.start!==0)return}}if(a===null)return;if(a.start===0&&Wt(c)&&c.isTextEntity()){d+=a.end;continue}a.start===0?[f,u]=u.splitText(a.end):[,f,u]=u.splitText(a.start+d,a.end+d),f===void 0&&ZT(165,"nodeToReplace");const h=e(f);if(h.setFormat(f.getFormat()),f.replace(h),u==null)return;d=0,c=h}}),l.registerNodeTransform(n,r=>{const a=r.getTextContent(),c=t(a);if(c===null||c.start!==0)return void o(r);if(a.length>c.end)return void r.splitText(c.end);const i=r.getPreviousSibling();Wt(i)&&i.isTextEntity()&&(o(i),o(r));const u=r.getNextSibling();Wt(u)&&u.isTextEntity()&&(o(u),s(r)&&o(r))})]}function U1(l,t,n){const[e]=yn();fe.useEffect(()=>mr(...QT(e,l,t,n)),[n,e,l,t])}const XT=new RegExp(function(){const{alpha:l,alphanumeric:t,hashChars:n}=function(){const s=String.fromCharCode,o="A-Za-zªµºÀ-ÖØ-öø-Ɂɐ-ˁˆ-ˑˠ-ˤˮͺΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϵϷ-ҁҊ-ӎӐ-ӹԀ-ԏԱ-Ֆՙա-ևא-תװ-ײء-غـ-يٮ-ٯٱ-ۓەۥ-ۦۮ-ۯۺ-ۼۿܐܒ-ܯݍ-ݭހ-ޥޱऄ-हऽॐक़-ॡॽঅ-ঌএ-ঐও-নপ-রলশ-হঽৎড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલ-ળવ-હઽૐૠ-ૡଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହଽଡ଼-ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡඅ-ඖක-නඳ-රලව-ෆก-ะา-ำเ-ๆກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ະາ-ຳຽເ-ໄໆໜ-ໝༀཀ-ཇཉ-ཪྈ-ྋက-အဣ-ဧဩ-ဪၐ-ၕႠ-Ⴥა-ჺჼᄀ-ᅙᅟ-ᆢᆨ-ᇹሀ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙶᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦩᧁ-ᧇᨀ-ᨖᴀ-ᶿḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₔℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℱℳ-ℹℼ-ℿⅅ-ⅉⰀ-Ⱞⰰ-ⱞⲀ-ⳤⴀ-ⴥⴰ-ⵥⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〆〱-〵〻-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄬㄱ-ㆎㆠ-ㆷㇰ-ㇿ㐀-䶵一-龻ꀀ-ꒌꠀ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢ가-힣豈-鶴侮-頻並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ̀-ͯ҃-֑҆-ֹֻ-ֽֿׁ-ׂׄ-ׇׅؐ-ًؕ-ٰٞۖ-ۜ۟-ۤۧ-۪ۨ-ܑۭܰ-݊ަ-ްँ-ः़ा-्॑-॔ॢ-ॣঁ-ঃ়া-ৄে-ৈো-্ৗৢ-ৣਁ-ਃ਼ਾ-ੂੇ-ੈੋ-੍ੰ-ੱઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣଁ-ଃ଼ା-ୃେ-ୈୋ-୍ୖ-ୗஂா-ூெ-ைொ-்ௗఁ-ఃా-ౄె-ైొ-్ౕ-ౖಂ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕ-ೖം-ഃാ-ൃെ-ൈൊ-്ൗං-ඃ්ා-ුූෘ-ෟෲ-ෳัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-༹༙༵༷༾-༿ཱ-྄྆-྇ྐ-ྗྙ-ྼ࿆ာ-ဲံ-္ၖ-ၙ፟ᜒ-᜔ᜲ-᜴ᝒ-ᝓᝲ-ᝳា-៓៝᠋-᠍ᢩᤠ-ᤫᤰ-᤻ᦰ-ᧀᧈ-ᧉᨗ-ᨛ᷀-᷃⃐-⃥⃜⃡-⃫〪-゙〯-゚ꠂ꠆ꠋꠣ-ꠧﬞ︀-️︠-︣À-ÖØ-öø-ÿĀ-ɏɓ-ɔɖ-ɗəɛɣɨɯɲʉʋʻ̀-ͯḀ-ỿЀ-ӿԀ-ԧⷠ-ⷿꙀ-֑ꚟ-ֿׁ-ׂׄ-ׇׅא-תװ-״﬒-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﭏؐ-ؚؠ-ٟٮ-ۓە-ۜ۞-۪ۨ-ۯۺ-ۼۿݐ-ݿࢠࢢ-ࢬࣤ-ࣾﭐ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼ‌-‌ก-ฺเ-๎ᄀ-ᇿ㄰-ㆅꥠ-꥿가-힯ힰ-퟿ᄀ-ᅵァ-ヺー-ヾヲ-゚0-9A-Za-zぁ-ゖ゙-ゞ㐀-䶿一-鿿"+s(173824)+"-"+s(177983)+s(177984)+"-"+s(178207)+s(194560)+"-"+s(195103)+"〃々〻";return{alpha:o,alphanumeric:o+"0-9٠-٩۰-۹०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉០-៩᠐-᠙᥆-᥏᧐-᧙0-9_",hashChars:"#\\uFF03"}}(),e="["+t+"]";return"("+("^|$|[^&/"+t+"]")+")("+("["+n+"]")+")("+e+"*"+("["+l+"]")+e+"*)"}(),"i");function H1(){const[l]=yn();fe.useEffect(()=>{if(!l.hasNodes([bp]))throw new Error("HashtagPlugin: HashtagNode not registered on editor")},[l]);const t=fe.useCallback(e=>D_(e.getTextContent()),[]),n=fe.useCallback(e=>{const s=XT.exec(e);if(s===null)return null;const o=s[3].length+1,r=s.index+s[1].length;return{end:r+o,start:r}},[]);return U1(n,bp,t),null}function q1(){const[l]=yn();return fe.useEffect(()=>{if(!l.hasNodes([gd,hd]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[l]),function(t){fe.useEffect(()=>mr(t.registerCommand($_,()=>(z_(t,"number"),!0),Jn),t.registerCommand(K_,()=>(z_(t,"bullet"),!0),Jn),t.registerCommand(G_,()=>(q2(t),!0),Jn),t.registerCommand(yl,()=>!!V2(),Jn)),[t])}(l),null}const eA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe.useLayoutEffect:fe.useEffect;function tA(l){return{initialValueFn:()=>l.isEditable(),subscribe:t=>l.registerEditableListener(t)}}function ly(){return function(l){const[t]=yn(),n=fe.useMemo(()=>l(t),[t,l]),e=fe.useRef(n.initialValueFn()),[s,o]=fe.useState(e.current);return eA(()=>{const{initialValueFn:r,subscribe:a}=n,c=r();return e.current!==c&&(e.current=c,o(c)),a(i=>{e.current=i,o(i)})},[n,l]),s}(tA)}function W1(l){const t=window.location.origin,n=e=>{if(e.origin!==t)return;const s=l.getRootElement();if(document.activeElement!==s)return;const o=e.data;if(typeof o=="string"){let r;try{r=JSON.parse(o)}catch{return}if(r&&r.protocol==="nuanria_messaging"&&r.type==="request"){const a=r.payload;if(a&&a.functionId==="makeChanges"){const c=a.args;if(c){const[i,u,d,f,p,h]=c;l.update(()=>{const m=kt();if(St(m)){const g=m.anchor;let b=g.getNode(),v=0,_=0;if(Wt(b)&&i>=0&&u>=0&&(v=i,_=i+u,m.setTextNodeRange(b,v,b,_)),v===_&&d===""||(m.insertRawText(d),b=g.getNode()),Wt(b)){v=f,_=f+p;const E=b.getTextContentSize();v=v>E?E:v,_=_>E?E:_,m.setTextNodeRange(b,v,b,_)}e.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}function Ed(l,t){const n=t.body?t.body.childNodes:[];let e=[];const s=[];for(let o=0;o<n.length;o++){const r=n[o];if(!V1.has(r.nodeName)){const a=K1(r,l,s,!1);a!==null&&(e=e.concat(a))}}return function(o){for(const r of o)r.getNextSibling()instanceof wm&&r.insertAfter(rs());for(const r of o){const a=r.getChildren();for(const c of a)r.insertBefore(c);r.remove()}}(s),e}function cy(l,t){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const n=document.createElement("div"),e=In().getChildren();for(let s=0;s<e.length;s++)J1(l,e[s],n,t);return n.innerHTML}function J1(l,t,n,e=null){let s=e===null||t.isSelected(e);const o=At(t)&&t.excludeFromCopy("html");let r=t;if(e!==null){let p=d_(t);p=Wt(p)&&e!==null?f_(e,p):p,r=p}const a=At(r)?r.getChildren():[],c=l._nodes.get(r.getType());let i;i=c&&c.exportDOM!==void 0?c.exportDOM(l,r):r.exportDOM(l);const{element:u,after:d}=i;if(!u)return!1;const f=document.createDocumentFragment();for(let p=0;p<a.length;p++){const h=a[p],m=J1(l,h,f,e);!s&&At(t)&&m&&t.extractWithChild(h,e,"html")&&(s=!0)}if(s&&!o){if(Di(u)&&u.append(f),n.append(u),d){const p=d.call(r,u);p&&u.replaceWith(p)}}else n.append(f);return s}const V1=new Set(["STYLE","SCRIPT"]);function K1(l,t,n,e,s=new Map,o){let r=[];if(V1.has(l.nodeName))return r;let a=null;const c=function(h,m){const{nodeName:g}=h,b=m._htmlConversions.get(g.toLowerCase());let v=null;if(b!==void 0)for(const _ of b){const E=_(h);E!==null&&(v===null||(v.priority||0)<(E.priority||0))&&(v=E)}return v!==null?v.conversion:null}(l,t),i=c?c(l):null;let u=null;if(i!==null){u=i.after;const h=i.node;if(a=Array.isArray(h)?h[h.length-1]:h,a!==null){for(const[,m]of s)if(a=m(a,o),!a)break;a&&r.push(...Array.isArray(h)?h:[a])}i.forChild!=null&&s.set(l.nodeName,i.forChild)}const d=l.childNodes;let f=[];const p=(a==null||!ro(a))&&(a!=null&&mm(a)||e);for(let h=0;h<d.length;h++)f.push(...K1(d[h],t,n,p,new Map(s),a));return u!=null&&(f=u(f)),Gk(l)&&(f=nA(l,f,p?()=>{const h=new wm;return n.push(h),h}:En)),a==null?r=r.concat(f):At(a)&&a.append(...f),r}function nA(l,t,n){const e=l.style.textAlign,s=[];let o=[];for(let r=0;r<t.length;r++){const a=t[r];if(mm(a))e&&!a.getFormat()&&a.setFormat(e),s.push(a);else if(o.push(a),r===t.length-1||r<t.length-1&&mm(t[r+1])){const c=n();c.setFormat(e),c.append(...o),s.push(c),o=[]}}return s}function rA(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Fp=rA(function(l){const t=new URLSearchParams;t.append("code",l);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${l}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const oA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,$1=l=>oA?(l||window).getSelection():null;function G1(l){const t=kt();return t==null&&Fp(166),St(t)&&t.isCollapsed()||t.getNodes().length===0?"":cy(l,t)}function iA(l){const t=kt();return t==null&&Fp(166),St(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(sA(l,t))}function Y1(l,t){const n=l.getData("text/plain")||l.getData("text/uri-list");n!=null&&t.insertRawText(n)}function Z1(l,t,n){const e=l.getData("application/x-lexical-editor");if(e)try{const r=JSON.parse(e);if(r.namespace===n._config.namespace&&Array.isArray(r.nodes))return Q1(n,aA(r.nodes),t)}catch{}const s=l.getData("text/html");if(s)try{const r=new DOMParser().parseFromString(s,"text/html");return Q1(n,Ed(n,r),t)}catch{}const o=l.getData("text/plain")||l.getData("text/uri-list");if(o!=null)if(St(t)){const r=o.split(/(\r?\n|\t)/);r[r.length-1]===""&&r.pop();for(let a=0;a<r.length;a++){const c=kt();if(St(c)){const i=r[a];i===`
65
65
  `||i===`\r
66
66
  `?c.insertParagraph():i===" "?c.insertNodes([vc()]):c.insertText(i)}}}else t.insertRawText(o)}function Q1(l,t,n){l.dispatchCommand(Nv,{nodes:t,selection:n})||n.insertNodes(t)}function X1(l,t,n,e=[]){let s=t===null||n.isSelected(t);const o=At(n)&&n.excludeFromCopy("html");let r=n;if(t!==null){let i=d_(n);i=Wt(i)&&t!==null?f_(t,i):i,r=i}const a=At(r)?r.getChildren():[],c=function(i){const u=i.exportJSON(),d=i.constructor;if(u.type!==d.getType()&&Fp(58,d.name),At(i)){const f=u.children;Array.isArray(f)||Fp(59,d.name)}return u}(r);if(Wt(r)){const i=r.__text;i.length>0?c.text=i:s=!1}for(let i=0;i<a.length;i++){const u=a[i],d=X1(l,t,u,c.children);!s&&At(n)&&d&&n.extractWithChild(u,t,"clone")&&(s=!0)}if(s&&!o)e.push(c);else if(Array.isArray(c.children))for(let i=0;i<c.children.length;i++){const u=c.children[i];e.push(u)}return s}function sA(l,t){const n=[],e=In().getChildren();for(let s=0;s<e.length;s++)X1(l,t,e[s],n);return{namespace:l._config.namespace,nodes:n}}function aA(l){const t=[];for(let n=0;n<l.length;n++){const e=l[n],s=f2(e);Wt(s)&&v2(s),t.push(s)}return t}let Pc=null;async function ew(l,t){if(Pc!==null)return!1;if(t!==null)return new Promise((a,c)=>{l.update(()=>{a(tw(l,t))})});const n=l.getRootElement(),e=l._window==null?window.document:l._window.document,s=$1(l._window);if(n===null||s===null)return!1;const o=e.createElement("span");o.style.cssText="position: fixed; top: -1000px;",o.append(e.createTextNode("#")),n.append(o);const r=new Range;return r.setStart(o,0),r.setEnd(o,1),s.removeAllRanges(),s.addRange(r),new Promise((a,c)=>{const i=l.registerCommand(Vu,u=>(Ws(u,ClipboardEvent)&&(i(),Pc!==null&&(window.clearTimeout(Pc),Pc=null),a(tw(l,u))),!0),mo);Pc=window.setTimeout(()=>{i(),Pc=null,a(!1)},50),e.execCommand("copy"),o.remove()})}function tw(l,t){const n=$1(l._window);if(!n)return!1;const e=n.anchorNode,s=n.focusNode;if(e!==null&&s!==null&&!Gu(l,e,s))return!1;t.preventDefault();const o=t.clipboardData,r=kt();if(o===null||r===null)return!1;const a=G1(l),c=iA(l);let i="";return r!==null&&(i=r.getTextContent()),a!==null&&o.setData("text/html",a),c!==null&&o.setData("application/x-lexical-editor",c),o.setData("text/plain",i),!0}function nw(l,t){if(document.caretRangeFromPoint!==void 0){const n=document.caretRangeFromPoint(l,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const n=document.caretPositionFromPoint(l,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}const Ic=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,lA=Ic&&"documentMode"in document?document.documentMode:null,cA=!(!Ic||!("InputEvent"in window)||lA)&&"getTargetRanges"in new window.InputEvent("input"),uA=Ic&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),dA=Ic&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,fA=Ic&&/^(?=.*Chrome).*/i.test(navigator.userAgent),pA=Ic&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!fA,uy=po();class Bp extends Br{static getType(){return"quote"}static clone(t){return new Bp(t.__key)}constructor(t){super(t)}createDOM(t){const n=document.createElement("blockquote");return zr(n,t.theme.quote),n}updateDOM(t,n){return!1}static importDOM(){return{blockquote:t=>({conversion:gA,priority:0})}}exportDOM(t){const{element:n}=super.exportDOM(t);if(n&&Di(n)){this.isEmpty()&&n.append(document.createElement("br"));const e=this.getFormatType();n.style.textAlign=e;const s=this.getDirection();s&&(n.dir=s)}return{element:n}}static importJSON(t){const n=rw();return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(t,n){const e=En(),s=this.getDirection();return e.setDirection(s),this.insertAfter(e,n),e}collapseAtStart(){const t=En();return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}}function rw(){return Pr(new Bp)}function hA(l){return l instanceof Bp}class zp extends Br{static getType(){return"heading"}static clone(t){return new zp(t.__tag,t.__key)}constructor(t,n){super(n),this.__tag=t}getTag(){return this.__tag}createDOM(t){const n=this.__tag,e=document.createElement(n),s=t.theme.heading;if(s!==void 0){const o=s[n];zr(e,o)}return e}updateDOM(t,n){return!1}static importDOM(){return{h1:t=>({conversion:Mc,priority:0}),h2:t=>({conversion:Mc,priority:0}),h3:t=>({conversion:Mc,priority:0}),h4:t=>({conversion:Mc,priority:0}),h5:t=>({conversion:Mc,priority:0}),h6:t=>({conversion:Mc,priority:0}),p:t=>{const n=t.firstChild;return n!==null&&ow(n)?{conversion:()=>({node:null}),priority:3}:null},span:t=>ow(t)?{conversion:n=>({node:Cd("h1")}),priority:3}:null}}exportDOM(t){const{element:n}=super.exportDOM(t);if(n&&Di(n)){this.isEmpty()&&n.append(document.createElement("br"));const e=this.getFormatType();n.style.textAlign=e;const s=this.getDirection();s&&(n.dir=s)}return{element:n}}static importJSON(t){const n=Cd(t.tag);return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(t,n=!0){const e=t?t.anchor.offset:0,s=e!==this.getTextContentSize()&&t?Cd(this.getTag()):En(),o=this.getDirection();if(s.setDirection(o),this.insertAfter(s,n),e===0&&!this.isEmpty()&&t){const r=En();r.select(),this.replace(r,!0)}return s}collapseAtStart(){const t=this.isEmpty()?En():Cd(this.getTag());return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}extractWithChild(){return!0}}function ow(l){return l.nodeName.toLowerCase()==="span"&&l.style.fontSize==="26pt"}function Mc(l){const t=l.nodeName.toLowerCase();let n=null;return t!=="h1"&&t!=="h2"&&t!=="h3"&&t!=="h4"&&t!=="h5"&&t!=="h6"||(n=Cd(t),l.style!==null&&n.setFormat(l.style.textAlign)),{node:n}}function gA(l){const t=rw();return l.style!==null&&t.setFormat(l.style.textAlign),{node:t}}function Cd(l){return Pr(new zp(l))}function Up(l){return l instanceof zp}function Hp(l){let t=null;if(Ws(l,DragEvent)?t=l.dataTransfer:Ws(l,ClipboardEvent)&&(t=l.clipboardData),t===null)return[!1,[],!1];const n=t.types,e=n.includes("Files"),s=n.includes("text/html")||n.includes("text/plain");return[e,Array.from(t.files),s]}function iw(l){const t=kt();if(!St(t))return!1;const n=new Set,e=t.getNodes();for(let s=0;s<e.length;s++){const o=e[s],r=o.getKey();if(n.has(r))continue;const a=er(o,i=>At(i)&&!i.isInline());if(a===null)continue;const c=a.getKey();a.canIndent()&&!n.has(c)&&(n.add(c),l(a))}return n.size>0}function qp(l){const t=ho(l);return hr(t)}function mA(l){return mr(l.registerCommand(_a,t=>{const n=kt();return!!dr(n)&&(n.clear(),!0)},0),l.registerCommand(Yi,t=>{const n=kt();return!!St(n)&&(n.deleteCharacter(t),!0)},Tn),l.registerCommand(vl,t=>{const n=kt();return!!St(n)&&(n.deleteWord(t),!0)},Tn),l.registerCommand(Sa,t=>{const n=kt();return!!St(n)&&(n.deleteLine(t),!0)},Tn),l.registerCommand(xa,t=>{const n=kt();if(typeof t=="string")n!==null&&n.insertText(t);else{if(n===null)return!1;const e=t.dataTransfer;if(e!=null)Z1(e,n,l);else if(St(n)){const s=t.data;return s&&n.insertText(s),!0}}return!0},Tn),l.registerCommand(Tf,()=>{const t=kt();return!!St(t)&&(t.removeText(),!0)},Tn),l.registerCommand(Gr,t=>{const n=kt();return!!St(n)&&(n.formatText(t),!0)},Tn),l.registerCommand(bl,t=>{const n=kt();if(!St(n)&&!dr(n))return!1;const e=n.getNodes();for(const s of e){const o=er(s,r=>At(r)&&!r.isInline());o!==null&&o.setFormat(t)}return!0},Tn),l.registerCommand(wa,t=>{const n=kt();return!!St(n)&&(n.insertLineBreak(t),!0)},Tn),l.registerCommand(yl,()=>{const t=kt();return!!St(t)&&(t.insertParagraph(),!0)},Tn),l.registerCommand(gk,()=>(ei([vc()]),!0),Tn),l.registerCommand(Iv,()=>iw(t=>{const n=t.getIndent();t.setIndent(n+1)}),Tn),l.registerCommand(Mv,()=>iw(t=>{const n=t.getIndent();n>0&&t.setIndent(n-1)}),Tn),l.registerCommand(Wu,t=>{const n=kt();if(dr(n)&&!qp(t.target)){const e=n.getNodes();if(e.length>0)return e[0].selectPrevious(),!0}else if(St(n)){const e=ed(n.focus,!0);if(!t.shiftKey&&hr(e)&&!e.isIsolated()&&!e.isInline())return e.selectPrevious(),t.preventDefault(),!0}return!1},Tn),l.registerCommand(Ju,t=>{const n=kt();if(dr(n)){const e=n.getNodes();if(e.length>0)return e[0].selectNext(0,0),!0}else if(St(n)){if(function(s){const o=s.focus;return o.key==="root"&&o.offset===In().getChildrenSize()}(n))return t.preventDefault(),!0;const e=ed(n.focus,!1);if(!t.shiftKey&&hr(e)&&!e.isIsolated()&&!e.isInline())return e.selectNext(),t.preventDefault(),!0}return!1},Tn),l.registerCommand(Of,t=>{const n=kt();if(dr(n)){const e=n.getNodes();if(e.length>0)return t.preventDefault(),e[0].selectPrevious(),!0}if(!St(n))return!1;if(hp(n,!0)){const e=t.shiftKey;return t.preventDefault(),gp(n,e,!0),!0}return!1},Tn),l.registerCommand(Af,t=>{const n=kt();if(dr(n)&&!qp(t.target)){const s=n.getNodes();if(s.length>0)return t.preventDefault(),s[0].selectNext(0,0),!0}if(!St(n))return!1;const e=t.shiftKey;return!!hp(n,!1)&&(t.preventDefault(),gp(n,e,!1),!0)},Tn),l.registerCommand(Zi,t=>{if(qp(t.target))return!1;const n=kt();if(!St(n))return!1;t.preventDefault();const{anchor:e}=n,s=e.getNode();return n.isCollapsed()&&e.offset===0&&!Uo(s)&&Cm(s).getIndent()>0?l.dispatchCommand(Mv,void 0):l.dispatchCommand(Yi,!0)},Tn),l.registerCommand(Qi,t=>{if(qp(t.target))return!1;const n=kt();return!!St(n)&&(t.preventDefault(),l.dispatchCommand(Yi,!1))},Tn),l.registerCommand(Ls,t=>{const n=kt();if(!St(n))return!1;if(t!==null){if((dA||uA||pA)&&cA)return!1;if(t.preventDefault(),t.shiftKey)return l.dispatchCommand(wa,!1)}return l.dispatchCommand(yl,void 0)},Tn),l.registerCommand(Fs,()=>{const t=kt();return!!St(t)&&(l.blur(),!0)},Tn),l.registerCommand(Pf,t=>{const[,n]=Hp(t);if(n.length>0){const s=nw(t.clientX,t.clientY);if(s!==null){const{offset:o,node:r}=s,a=ho(r);if(a!==null){const c=bc();if(Wt(a))c.anchor.set(a.getKey(),o,"text"),c.focus.set(a.getKey(),o,"text");else{const u=a.getParentOrThrow().getKey(),d=a.getIndexWithinParent()+1;c.anchor.set(u,d,"element"),c.focus.set(u,d,"element")}const i=Bg(c);jr(i)}l.dispatchCommand(uy,n)}return t.preventDefault(),!0}const e=kt();return!!St(e)},Tn),l.registerCommand(lc,t=>{const[n]=Hp(t),e=kt();return!(n&&!St(e))},Tn),l.registerCommand(Cg,t=>{const[n]=Hp(t),e=kt();if(n&&!St(e))return!1;const s=nw(t.clientX,t.clientY);if(s!==null){const o=ho(s.node);hr(o)&&t.preventDefault()}return!0},Tn),l.registerCommand(If,()=>(lb(),!0),Tn),l.registerCommand(Vu,t=>(ew(l,Ws(t,ClipboardEvent)?t:null),!0),Tn),l.registerCommand(Ku,t=>(async function(n,e){await ew(e,Ws(n,ClipboardEvent)?n:null),e.update(()=>{const s=kt();St(s)?s.removeText():dr(s)&&s.getNodes().forEach(o=>o.remove())})}(t,l),!0),Tn),l.registerCommand(ys,t=>{const[,n,e]=Hp(t);return n.length>0&&!e?(l.dispatchCommand(uy,n),!0):zg(t.target)?!1:kt()!==null&&(function(s,o){s.preventDefault(),o.update(()=>{const r=kt(),a=Ws(s,InputEvent)||Ws(s,KeyboardEvent)?null:s.clipboardData;a!=null&&r!==null&&Z1(a,r,o)},{tag:"paste"})}(t,l),!0)},Tn))}const dy=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe.useLayoutEffect:fe.useEffect;function sw(l){return l.getEditorState().read(z1(l.isComposing()))}function Wp({contentEditable:l,placeholder:t,ErrorBoundary:n}){const[e]=yn(),s=function(o,r){const[a,c]=fe.useState(()=>o.getDecorators());return dy(()=>o.registerDecoratorListener(i=>{ao.flushSync(()=>{c(i)})}),[o]),fe.useEffect(()=>{c(o.getDecorators())},[o]),fe.useMemo(()=>{const i=[],u=Object.keys(a);for(let d=0;d<u.length;d++){const f=u[d],p=re.jsx(r,{onError:m=>o._onError(m),children:re.jsx(fe.Suspense,{fallback:null,children:a[f]})}),h=o.getElementByKey(f);h!==null&&i.push(ao.createPortal(p,h,f))}return i},[r,a,o])}(e,n);return function(o){dy(()=>mr(mA(o),W1(o)),[o])}(e),re.jsxs(re.Fragment,{children:[l,re.jsx(yA,{content:t}),s]})}function yA({content:l}){const[t]=yn(),n=function(s){const[o,r]=fe.useState(()=>sw(s));return dy(()=>{function a(){const c=sw(s);r(c)}return a(),mr(s.registerUpdateListener(()=>{a()}),s.registerEditableListener(()=>{a()}))},[s]),o}(t),e=ly();return n?typeof l=="function"?l(e):l:null}function vA(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Jp=vA(function(l){const t=new URLSearchParams;t.append("code",l);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${l}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function aw({hasCellMerge:l=!0,hasCellBackgroundColor:t=!0,hasTabHandler:n=!0}){const[e]=yn();return fe.useEffect(()=>(e.hasNodes([xs,Vs,Tl])||Jp(10),mr(e.registerCommand(tT,({columns:s,rows:o,includeHeaders:r})=>{const a=Um(Number(o),Number(s),r);Cl(a);const c=a.getFirstDescendant();return Wt(c)&&c.select(),!0},Tn),e.registerNodeTransform(xs,s=>{const[o]=a1(s,null,null),r=o.reduce((a,c)=>Math.max(a,c.length),0);for(let a=0;a<o.length;++a){const c=o[a].length;if(c===r)continue;const i=o[a][c-1].cell;for(let u=c;u<r;++u){const d=Si(0);d.append(En()),i!==null?i.insertAfter(d):w_(i,d)}}}))),[e]),fe.useEffect(()=>{const s=new Map,o=a=>{const c=a.getKey(),i=e.getElementByKey(c);if(i&&!s.has(c)){const u=pT(a,i,e,n);s.set(c,u)}};e.getEditorState().read(()=>{const a=cb(xs);for(const c of a)fr(c)&&o(c)});const r=e.registerMutationListener(xs,a=>{for(const[c,i]of a)if(i==="created")e.getEditorState().read(()=>{const u=Dn(c);fr(u)&&o(u)});else if(i==="destroyed"){const u=s.get(c);u!==void 0&&(u.removeListeners(),s.delete(c))}});return()=>{r();for(const[,a]of s)a.removeListeners()}},[e,n]),fe.useEffect(()=>{if(!l)return e.registerNodeTransform(Vs,s=>{if(s.getColSpan()>1||s.getRowSpan()>1){const[,,o]=Po(s),[r]=is(o,s,s),a=r.length,c=r[0].length;let i=o.getFirstChild();Dr(i)||Jp(175);const u=[];for(let d=0;d<a;d++){d!==0&&(i=i.getNextSibling(),Dr(i)||Jp(175));let f=null;for(let p=0;p<c;p++){const h=r[d][p],m=h.cell;if(h.startRow===d&&h.startColumn===p)f=m,u.push(m);else if(m.getColSpan()>1||m.getRowSpan()>1){bn(m)||Jp(176);const g=Si(m.__headerState);f!==null?f.insertAfter(g):w_(i,g)}}}for(const d of u)d.setColSpan(1),d.setRowSpan(1)}})},[e,l]),fe.useEffect(()=>{if(!t)return e.registerNodeTransform(Vs,s=>{s.getBackgroundColor()!==null&&s.setBackgroundColor(null)})},[e,t,l]),null}function bA(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var _A=bA(function(l){const t=new URLSearchParams;t.append("code",l);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${l}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function lw(l,t=n=>n){return n=>{const e=l.exec(n);return e===null?null:{index:e.index,length:e[0].length,text:e[0],url:t(e[0])}}}function cw(l,t){for(let n=0;n<t.length;n++){const e=t[n](l);if(e)return e}return null}const wA=/[.,;\s]/;function Vp(l){return wA.test(l)}function uw(l){return Vp(l[l.length-1])}function fy(l){return Vp(l[0])}function dw(l){let t=l.getPreviousSibling();return At(t)&&(t=t.getLastDescendant()),t===null||bs(t)||Wt(t)&&uw(t.getTextContent())}function fw(l){let t=l.getNextSibling();return At(t)&&(t=t.getFirstDescendant()),t===null||bs(t)||Wt(t)&&fy(t.getTextContent())}function xA(l,t,n,e){return(l>0?Vp(n[l-1]):dw(e[0]))?t<n.length?Vp(n[t]):fw(e[e.length-1]):!1}function SA(l,t,n){const e=[],s=[],o=[];let r=0,a=0;const c=[...l];for(;c.length>0;){const i=c[0],u=i.getTextContent().length,d=a;a+u<=t?(e.push(i),r+=u):d>=n?o.push(i):s.push(i),a+=u,c.shift()}return[r,e,s,o]}function EA(l,t,n,e){const s=Rm(e.url,e.attributes);if(l.length===1){let o,r=l[0];t===0?[o,r]=r.splitText(n):[,o,r]=r.splitText(t,n);const a=or(e.text);return a.setFormat(o.getFormat()),a.setDetail(o.getDetail()),a.setStyle(o.getStyle()),s.append(a),o.replace(s),r}if(l.length>1){const o=l[0];let r,a=o.getTextContent().length;t===0?r=o:[,r]=o.splitText(t);const c=[];let i;for(let p=1;p<l.length;p++){const h=l[p],m=h.getTextContent().length,g=a;if(g<n)if(a+m<=n)c.push(h);else{const[b,v]=h.splitText(n-g);c.push(b),i=v}a+=m}const u=kt(),d=u?u.getNodes().find(Wt):void 0,f=or(r.getTextContent());return f.setFormat(r.getFormat()),f.setDetail(r.getDetail()),f.setStyle(r.getStyle()),s.append(f,...c),d&&d===r&&(St(u)?f.select(u.anchor.offset,u.focus.offset):dr(u)&&f.select(0,f.getTextContent().length)),r.replace(s),i}}function py(l,t,n){const e=l.getChildren(),s=e.length;for(let c=0;c<s;c++){const i=e[c];if(!Wt(i)||!i.isSimpleText())return Kp(l),void n(null,l.getURL())}const o=l.getTextContent(),r=cw(o,t);if(r===null||r.text!==o||!dw(l)||!fw(l))return Kp(l),void n(null,l.getURL());const a=l.getURL();if(a!==r.url&&(l.setURL(r.url),n(r.url,a)),r.attributes){const c=l.getRel();c!==r.attributes.rel&&(l.setRel(r.attributes.rel||null),n(r.attributes.rel||null,c));const i=l.getTarget();i!==r.attributes.target&&(l.setTarget(r.attributes.target||null),n(r.attributes.target||null,i))}}function Kp(l){const t=l.getChildren();for(let n=t.length-1;n>=0;n--)l.insertAfter(t[n]);return l.remove(),t.map(n=>n.getLatest())}function CA(l,t,n){fe.useEffect(()=>{l.hasNodes([pd])||_A(77);const e=(s,o)=>{n&&n(s,o)};return mr(l.registerNodeTransform(Yr,s=>{const o=s.getParentOrThrow(),r=s.getPreviousSibling();if(Cc(o)&&!o.getIsUnlinked())py(o,t,e);else if(!Ho(o)){if(s.isSimpleText()&&(fy(s.getTextContent())||!Cc(r))){const a=function(c){const i=[c];let u=c.getNextSibling();for(;u!==null&&Wt(u)&&u.isSimpleText()&&(i.push(u),!/[\s]/.test(u.getTextContent()));)u=u.getNextSibling();return i}(s);(function(c,i,u){let d=[...c];const f=d.map(g=>g.getTextContent()).join("");let p,h=f,m=0;for(;(p=cw(h,i))&&p!==null;){const g=p.index,b=g+p.length;if(xA(m+g,m+b,f,d)){const[v,,_,E]=SA(d,m+g,m+b),S=EA(_,m+g-v,m+b-v,p);d=S?[S,...E]:E,u(p.url,null),m=0}else m+=b;h=h.substring(b)}})(a,t,e)}(function(a,c,i){const u=a.getPreviousSibling(),d=a.getNextSibling(),f=a.getTextContent();!Cc(u)||u.getIsUnlinked()||fy(f)&&!/^\.[a-zA-Z0-9]{1,}/.test(f)||(u.append(a),py(u,c,i),i(null,u.getURL())),!Cc(d)||d.getIsUnlinked()||uw(f)||(Kp(d),py(d,c,i),i(null,d.getURL()))})(s,t,e)}}),l.registerCommand(Ia,s=>{const o=kt();return s!==null||!St(o)||o.extract().forEach(r=>{const a=r.getParent();if(Cc(a))return a.setIsUnlinked(!a.getIsUnlinked()),a.markDirty(),!0}),!1},Jn))},[l,t,n])}function jA({matchers:l,onChange:t}){const[n]=yn();return CA(n,l,t),null}const kA=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,TA=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,AA=[lw(kA,l=>l.startsWith("http")?l:`https://${l}`),lw(TA,l=>`mailto:${l}`)];function pw(){return re.jsx(jA,{matchers:AA})}function OA({accept:l,label:t,onChange:n,"data-test-id":e}){return re.jsxs("div",{className:"Input__wrapper",children:[re.jsx("label",{className:"Input__label",children:t}),re.jsx("input",{type:"file",accept:l,className:"Input__input",onChange:s=>n(s.target.files),"data-test-id":e})]})}const Rc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",NA=l=>Rc?(l||window).getSelection():null,$p=po();function PA({onClick:l}){const[t,n]=fe.useState(""),[e,s]=fe.useState(""),o=t==="",r=a=>{const c=new FileReader;c.onload=function(){return typeof c.result=="string"&&n(c.result),""},a!==null&&c.readAsDataURL(a[0])};return re.jsxs(re.Fragment,{children:[re.jsx(OA,{label:"Image Upload",onChange:r,accept:"image/*","data-test-id":"image-modal-file-upload"}),re.jsx(Nc,{label:"Alt Text",placeholder:"Descriptive alternative text",onChange:s,value:e,"data-test-id":"image-modal-alt-text-input"}),re.jsx(Rp,{children:re.jsx(Fi,{"data-test-id":"image-modal-file-upload-btn",disabled:o,onClick:()=>l({altText:e,src:t}),children:"Confirm"})})]})}function IA({activeEditor:l,onClose:t,enableCaptions:n}){const[e,s]=fe.useState("file"),o=fe.useRef(!1);fe.useEffect(()=>{o.current=!1;const a=c=>{o.current=c.altKey};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}},[l]);const r=a=>{l.dispatchCommand($p,a),console.log("line 202 imageplugin insert image"),t()};return re.jsx(re.Fragment,{children:e==="file"&&re.jsx(PA,{onClick:r})})}function hw(l,t,n,e,s){l.preventDefault();const o=l.clipboardData;if(!o)return!1;const r=o.items;if(!r||r.length===0)return!1;let a=!1,c=!1;const i=r.length>1?r[1]:r[0];let u=1;if(u===1){if(u=2,i.type==="text/html"&&!a){const d=o.getData("text/html"),p=new DOMParser().parseFromString(d,"text/html").querySelector("img");p&&p.src&&(fetch(p.src).then(h=>h.blob()).then(h=>{const m=new File([h],"pasted-image.png",{type:"image/png"});gw(m,t,e)}).catch(h=>console.error("Error fetching pasted image:",h)),a=!0)}else if(i.type.startsWith("image/")&&!a){const d=i.getAsFile();d&&(gw(d,t,e,s),a=!0)}}return!(!a&&!c)}function gw(l,t,n,e){const s=new FileReader;s.onload=()=>{const o=s.result,a={altText:l.name,src:o};t.update(()=>{const u=In().getChildren().filter(b=>gr(b)&&b.getChildren().some(v=>v.getTextContent().startsWith("Figure"))).length+1,d=`Figure ${u}:`,f=Dc("Figure",u,e),p=new Wo(d,"black",f);p.__captionId=f;const h=Ac({...a,figureLabel:d});h.__captionId=f;const m=En();m.setFormat("left");const g=rs();if(m.append(h,g),n){const v=or("");v.setStyle("color: black; font-style: italic; font-weight: bold;"),m.append(p,v)}if(ei([m]),ro(h.getParentOrThrow())&&jm(h,En).selectEnd(),n){const b=In().getChildren();let v=1;b.forEach(_=>{if(gr(_)){const E=_.getChildren().find(S=>S.getTextContent().startsWith("Figure"));if(E){const S=E.getTextContent(),w=S.indexOf(":"),y=w!==-1?S.slice(w):"",x=`Figure ${v++}${y}`;(Wt(E)||E instanceof Wo)&&E.setTextContent(x)}}})}})},s.readAsDataURL(l)}function mw({enableCaptions:l=!0,wpAndTaskId:t}){const[n]=yn(),[e,s]=fe.useState("");return fe.useEffect(()=>{if(!n.hasNodes([Op]))throw new Error("ImagesPlugin: ImageNode not registered on editor");let o=0;return mr(n.registerCommand($p,r=>{o+=1;const a=Dc("Figure",o,t);if(l){const c=`Figure ${o}:`,i=Dc("Figure",o,t),u=new Wo(c,"black",i);u.__captionId=i,u.__captionId=a;const d=Ac({...r});d.__captionId=a;const f=En();f.setFormat("left");const p=e.trim()===""?"":e,h=or(p);h.setStyle(p?"color: black; font-style: italic; font-weight: bold;":"color: gray; font-style: italic; font-weight: normal;"),f.append(d,u,h),ei([f]),ro(d.getParentOrThrow())&&jm(d,En).selectEnd()}else{const c=Ac(r),i=En();i.setFormat("left"),i.append(c),ei([i]),ro(c.getParentOrThrow())&&jm(c,En).selectEnd()}return n.update(()=>{const i=In().getChildren().filter(gr);let u=1;i.forEach(d=>{const f=d.getChildren().find(v=>v.getTextContent().startsWith("Figure"));if(!f)return;const p=f.__captionId,h=d.getChildren().find(Ks),m=h?h.__captionId:void 0,g=p??m??Dc(f.getTextContent(),u,t),b=new Wo(`Figure ${u}:`,"black",g);b.__captionId=g,u++})}),!0},Tn),n.registerCommand(lc,r=>RA(r),xi),n.registerCommand(Cg,r=>DA(r),Jn),n.registerCommand(Pf,r=>LA(r,n),xi),n.registerCommand(ys,r=>{var c;const a=(c=r.clipboardData)==null?void 0:c.items;return(a==null?void 0:a.length)<=2&&(a!=null&&a.length)?hw(r,n,e,l,t):!1},xi))},[l,n]),null}function Dc(l,t,n){let e=5381;const s=String(t);for(let o=0;o<s.length;o++)e=(e<<5)+e+s.charCodeAt(o);return`${n}-Image-${t}-${Math.abs(e%1e6)}`}const MA="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",yw=document.createElement("img");yw.src=MA;function RA(l){const t=hy();if(!t)return!1;const n=l.dataTransfer;return n?(n.setData("text/plain","_"),n.setDragImage(yw,0,0),n.setData("application/x-lexical-drag",JSON.stringify({data:{altText:t.__altText,caption:t.__caption,height:t.__height,key:t.getKey(),maxWidth:t.__maxWidth,showCaption:t.__showCaption,src:t.__src,width:t.__width},type:"image"})),!0):!1}function DA(l){return hy()?(vw(l)||l.preventDefault(),!0):!1}function LA(l,t){const n=hy();if(!n)return!1;const e=FA(l);if(!e)return!1;if(l.preventDefault(),vw(l)){const s=BA(l);n.remove();const o=bc();s!=null&&o.applyDOMRange(s),jr(o),t.dispatchCommand($p,e)}return!0}function hy(){const l=kt();if(!dr(l))return null;const n=l.getNodes()[0];return Ks(n)?n:null}function FA(l){var s;const t=(s=l.dataTransfer)==null?void 0:s.getData("application/x-lexical-drag");if(!t)return null;const{type:n,data:e}=JSON.parse(t);return n!=="image"?null:e}function vw(l){const t=l.target;return!!(t&&t instanceof HTMLElement&&!t.closest("code, span.editor-image")&&t.parentElement&&t.parentElement.closest("div.ContentEditable__root"))}function BA(l){let t;const n=l.target,e=n==null?null:n.nodeType===9?n.defaultView:n.ownerDocument.defaultView,s=NA(e);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(l.clientX,l.clientY);else if(l.rangeParent&&s!==null)s.collapse(l.rangeParent,l.rangeOffset||0),t=s.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return t}const bw=["image/","image/heic","image/heif","image/gif","image/webp"];function _w(){const[l]=yn();return fe.useEffect(()=>l.registerCommand(uy,t=>((async()=>{const n=await j2(t,[bw].flatMap(e=>e));for(const{file:e,result:s}of n)v_(e,bw)&&l.dispatchCommand($p,{altText:e.name,src:s})})(),!0),Jn),[l]),null}const zA=/(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])(congrats|congratulations|gratuluju|gratuluji|gratulujeme|blahopřeju|blahopřeji|blahopřejeme|Til lykke|Tillykke|Glückwunsch|Gratuliere|felicitaciones|enhorabuena|paljon onnea|onnittelut|Félicitations|gratula|gratulálok|gratulálunk|congratulazioni|complimenti|おめでとう|おめでとうございます|축하해|축하해요|gratulerer|Gefeliciteerd|gratulacje|Parabéns|parabéns|felicitações|felicitări|мои поздравления|поздравляем|поздравляю|gratulujem|blahoželám|ยินดีด้วย|ขอแสดงความยินดี|tebrikler|tebrik ederim|恭喜|祝贺你|恭喜你|恭喜|恭喜|baie geluk|veels geluk|অভিনন্দন|Čestitam|Čestitke|Čestitamo|Συγχαρητήρια|Μπράβο|અભિનંદન|badhai|बधाई|अभिनंदन|Честитам|Свака част|hongera|வாழ்த்துகள்|வாழ்த்துக்கள்|అభినందనలు|അഭിനന്ദനങ്ങൾ|Chúc mừng|מזל טוב|mazel tov|mazal tov)(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])/i;function ww(){const[l]=yn();fe.useEffect(()=>{if(!l.hasNodes([Oc]))throw new Error("KeywordsPlugin: KeywordNode not registered on editor")},[l]);const t=fe.useCallback(e=>S1(e.getTextContent()),[]),n=fe.useCallback(e=>{const s=zA.exec(e);if(s===null)return null;const o=s[2].length,r=s.index+s[1].length;return{end:r+o,start:r}},[]);return U1(n,Oc,t),null}function UA({validateUrl:l}){const[t]=yn();return fe.useEffect(()=>{if(!t.hasNodes([Ec]))throw new Error("LinkPlugin: LinkNode not registered on editor");return mr(t.registerCommand(Ia,n=>{if(n===null)return Dm(n),!0;if(typeof n=="string")return!(l!==void 0&&!l(n))&&(Dm(n),!0);{const{url:e,target:s,rel:o,title:r}=n;return Dm(e,{rel:o,target:s,title:r}),!0}},Jn),l!==void 0?t.registerCommand(ys,n=>{const e=kt();if(!St(e)||e.isCollapsed()||!Ws(n,ClipboardEvent))return!1;const s=n;if(s.clipboardData===null)return!1;const o=s.clipboardData.getData("text");return!!l(o)&&!e.getNodes().some(r=>At(r))&&(t.dispatchCommand(Ia,o),n.preventDefault(),!0)},Jn):()=>{})},[t,l]),null}const HA=new Set(["http:","https:","mailto:","sms:","tel:"]);function xw(l){try{const t=new URL(l);if(!HA.has(t.protocol))return"about:blank"}catch{return l}return l}const qA=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/);function WA(l){return l==="https://"||qA.test(l)}function gy(){return re.jsx(UA,{validateUrl:WA})}function JA(l){const t=l.getNodes();return t.length===0?new Set([l.anchor.getNode().getParentOrThrow(),l.focus.getNode().getParentOrThrow()]):new Set(t.map(n=>At(n)?n:n.getParentOrThrow()))}function VA(l){const t=kt();if(!St(t))return!1;const n=JA(t);let e=0;for(const s of n)if(sr(s))e=Math.max(Lm(s)+1,e);else if(Kr(s)){const o=s.getParent();if(!sr(o))throw new Error("ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent.");e=Math.max(Lm(o)+1,e)}return e<=l}function Sw({maxDepth:l}){const[t]=yn();return fe.useEffect(()=>t.registerCommand(Iv,()=>!VA(l??7),mo),[t,l]),null}const KA=1,$A=100;let Ew=0,Cw=!1;function GA(){window.addEventListener("keydown",l=>{l.key==="Tab"&&(Ew=l.timeStamp)},!0)}function jw(){const[l]=yn();return fe.useEffect(()=>(Cw||(GA(),Cw=!0),l.registerCommand(jg,t=>{const n=kt();return St(n)&&Ew+$A>t.timeStamp&&jr(n.clone()),!1},KA)),[l]),null}const n4="";function YA({onClose:l,children:t,title:n,closeOnClickOutside:e}){const s=fe.useRef(null);return fe.useEffect(()=>{s.current!==null&&s.current.focus()},[]),fe.useEffect(()=>{let o=null;const r=i=>{i.key==="Escape"&&l()},a=i=>{const u=i.target;s.current!==null&&!s.current.contains(u)&&e&&l()},c=s.current;return c!==null&&(o=c.parentElement,o!==null&&o.addEventListener("click",a)),window.addEventListener("keydown",r),()=>{window.removeEventListener("keydown",r),o!==null&&(o==null||o.removeEventListener("click",a))}},[e,l]),re.jsx("div",{className:"Modal__overlay",role:"dialog",children:re.jsxs("div",{className:"Modal__modal",tabIndex:-1,ref:s,children:[re.jsx("h2",{className:"Modal__title",children:n}),re.jsx("button",{className:"Modal__closeButton","aria-label":"Close modal",type:"button",onClick:l,children:"X"}),re.jsx("div",{className:"Modal__content",children:t})]})})}function ZA({onClose:l,children:t,title:n,closeOnClickOutside:e=!1}){return ao.createPortal(re.jsx(YA,{onClose:l,title:n,closeOnClickOutside:e,children:t}),document.body)}function La(){const[l,t]=fe.useState(null),n=fe.useCallback(()=>{t(null)},[]),e=fe.useMemo(()=>{if(l===null)return null;const{title:o,content:r,closeOnClickOutside:a}=l;return re.jsx(ZA,{onClose:n,title:o,closeOnClickOutside:a,children:r})},[l,n]),s=fe.useCallback((o,r,a=!1)=>{t({closeOnClickOutside:a,content:r(n),title:o})},[n]);return[e,s]}const r4="";let my=!1;const QA=["#d0021b","#f5a623","#f8e71c","#8b572a","#7ed321","#417505","#bd10e0","#9013fe","#4a90e2","#50e3c2","#b8e986","#000000","#4a4a4a","#9b9b9b","#ffffff"],jd=214,kw=150;function XA({color:l,onChange:t}){const[n,e]=fe.useState(Lc("hex",l)),[s,o]=fe.useState(l),r=fe.useRef(null),a=fe.useMemo(()=>({x:n.hsv.s/100*jd,y:(100-n.hsv.v)/100*kw}),[n.hsv.s,n.hsv.v]),c=fe.useMemo(()=>({x:n.hsv.h/360*jd}),[n.hsv]),i=f=>{if(o(f),/^#[0-9A-Fa-f]{6}$/i.test(f)){const p=Lc("hex",f);e(p)}},u=({x:f,y:p})=>{const h={...n.hsv,s:f/jd*100,v:100-p/kw*100},m=Lc("hsv",h);e(m),o(m.hex)},d=({x:f})=>{const p={...n.hsv,h:f/jd*360},h=Lc("hsv",p);e(h),o(h.hex)};return fe.useEffect(()=>{r.current!==null&&t&&(t(n.hex,my),o(n.hex))},[n,t]),fe.useEffect(()=>{if(l===void 0)return;const f=Lc("hex",l);e(f),o(f.hex)},[l]),re.jsxs("div",{className:"color-picker-wrapper",style:{width:jd},ref:r,children:[re.jsx(Nc,{label:"Hex",onChange:i,value:s}),re.jsx("div",{className:"color-picker-basic-color",children:QA.map(f=>re.jsx("button",{className:f===n.hex?" active":"",style:{backgroundColor:f},onClick:()=>{o(f),e(Lc("hex",f))}},f))}),re.jsx(Tw,{className:"color-picker-saturation",style:{backgroundColor:`hsl(${n.hsv.h}, 100%, 50%)`},onChange:u,children:re.jsx("div",{className:"color-picker-saturation_cursor",style:{backgroundColor:n.hex,left:a.x,top:a.y}})}),re.jsx(Tw,{className:"color-picker-hue",onChange:d,children:re.jsx("div",{className:"color-picker-hue_cursor",style:{backgroundColor:`hsl(${n.hsv.h}, 100%, 50%)`,left:c.x}})}),re.jsx("div",{className:"color-picker-color",style:{backgroundColor:n.hex}})]})}function Tw({className:l,style:t,onChange:n,children:e}){const s=fe.useRef(null),o=fe.useRef(!1),r=c=>{if(s.current){const{current:i}=s,{width:u,height:d,left:f,top:p}=i.getBoundingClientRect(),h=Aw(c.clientX-f,u,0),m=Aw(c.clientY-p,d,0);n({x:h,y:m})}},a=c=>{if(c.button!==0)return;r(c);const i=d=>{o.current=!0,my=!0,r(d)},u=d=>{o.current&&(my=!1),document.removeEventListener("mousemove",i,!1),document.removeEventListener("mouseup",u,!1),r(d),o.current=!1};document.addEventListener("mousemove",i,!1),document.addEventListener("mouseup",u,!1)};return re.jsx("div",{ref:s,className:l,style:t,onMouseDown:a,children:e})}function Aw(l,t,n){return l>t?t:l<n?n:l}function Ow(l){if(l.startsWith("#")){if(l.length===4||l.length===5)return l=l.split("").map((t,n)=>n?t+t:"#").join(""),l;if(l.length===7||l.length===9)return l}else{const t=document.createElement("canvas").getContext("2d");if(!t)throw new Error("2d context not supported or canvas already initialized");return t.fillStyle=l,t.fillStyle}return"#000000"}function Nw(l){const t=(l.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(n,e,s,o)=>"#"+e+e+s+s+o+o).substring(1).match(/.{2}/g)||[]).map(n=>parseInt(n,16));return{b:t[2],g:t[1],r:t[0]}}function yy({r:l,g:t,b:n}){l/=255,t/=255,n/=255;const e=Math.max(l,t,n),s=e-Math.min(l,t,n),o=s?(e===l?(t-n)/s+(t<n?6:0):e===t?2+(n-l)/s:4+(l-t)/s)*60:0,r=e?s/e*100:0,a=e*100;return{h:o,s:r,v:a}}function eO({h:l,s:t,v:n}){t/=100,n/=100;const e=~~(l/60),s=l/60-e,o=n*(1-t),r=n*(1-t*s),a=n*(1-t*(1-s)),c=e%6,i=Math.round([n,r,o,o,a,n][c]*255),u=Math.round([a,n,n,r,o,o][c]*255);return{b:Math.round([o,o,a,n,n,r][c]*255),g:u,r:i}}function Pw({b:l,g:t,r:n}){return"#"+[n,t,l].map(e=>e.toString(16).padStart(2,"0")).join("")}function Lc(l,t){let n=Ow("#121212"),e=Nw(n),s=yy(e);return l==="hex"?(n=Ow(t),e=Nw(n),s=yy(e)):l==="rgb"?(e=t,n=Pw(e),s=yy(e)):l==="hsv"&&(s=t,e=eO(s),n=Pw(e)),{hex:n,hsv:s,rgb:e}}function tO(l,t,...n){if(!l)throw new Error("Internal Lexical error: invariant() is meant to be replaced at compile time. There is no runtime version. Error: "+t)}function vy(l){const t=l.getShape();return{columns:t.toX-t.fromX+1,rows:t.toY-t.fromY+1}}function nO(l){const t=l.getNodes(),n=[];let e=null,s=null,o=0;for(let r=0;r<t.length;r++){const a=t[r];if(bn(a)){const c=a.getParentOrThrow();if(tO(Dr(c),"Expected CellNode to have a RowNode parent"),e!==c){if(s!==null&&o!==s)return!1;e!==null&&(s=o),e=c,o=0}const i=a.__colSpan;for(let u=0;u<i;u++)n[o+u]===void 0&&(n[o+u]=0),n[o+u]+=a.__rowSpan;o+=i}}return(s===null||o===s)&&n.every(r=>r===n[0])}function rO(){const l=kt();if(St(l)&&!l.isCollapsed()||cr(l)&&!l.anchor.is(l.focus)||!St(l)&&!cr(l))return!1;const[t]=Po(l.anchor);return t.__colSpan>1||t.__rowSpan>1}function Iw(l){if(l.getChildrenSize()!==1)return!1;const t=l.getFirstChildOrThrow();return!(!gr(t)||!t.isEmpty())}function oO(l){const t=l.getLastDescendant();Wt(t)?t.select():At(t)?t.selectEnd():t!==null&&t.selectNext()}function Mw(l){return l.getEditorState().read(()=>{const t=kt();if(St(t)||cr(t)){const[n]=Po(t.anchor);if(bn(n))return n.getBackgroundColor()}return null})}function iO({onClose:l,tableCellNode:t,setIsMenuOpen:n,contextRef:e,cellMerge:s,showColorPickerModal:o}){const[r]=yn(),a=fe.useRef(null),[c,i]=fe.useState(t),[u,d]=fe.useState({columns:1,rows:1}),[f,p]=fe.useState(!1),[h,m]=fe.useState(!1),[g,b]=fe.useState(()=>Mw(r)||"");fe.useEffect(()=>r.registerMutationListener(Vs,B=>{B.get(c.getKey())==="updated"&&(r.getEditorState().read(()=>{i(c.getLatest())}),b(Mw(r)||""))}),[r,c]),fe.useEffect(()=>{r.getEditorState().read(()=>{const B=kt();if(cr(B)){const A=vy(B);d(vy(B)),p(nO(B)&&(A.columns>1||A.rows>1))}m(rO())})},[r]),fe.useEffect(()=>{const B=e.current,A=a.current,j=r.getRootElement();if(B!=null&&A!=null&&j!=null){const O=j.getBoundingClientRect(),L=B.getBoundingClientRect();A.style.opacity="1";const N=A.getBoundingClientRect(),U=5;let M=L.right+U;if(M+N.width>window.innerWidth||M+N.width>O.right){const K=L.left-N.width-U;M=(K<0?U:K)+window.pageXOffset}A.style.left=`${M+window.pageXOffset}px`;let z=L.top;if(z+N.height>window.innerHeight){const K=L.bottom-N.height;z=(K<0?U:K)+window.pageYOffset}A.style.top=`${z+ +window.pageYOffset}px`}},[e,a,r]),fe.useEffect(()=>{function B(A){a.current!=null&&e.current!=null&&!a.current.contains(A.target)&&!e.current.contains(A.target)&&n(!1)}return window.addEventListener("click",B),()=>window.removeEventListener("click",B)},[n,e]);const v=fe.useCallback(()=>{r.update(()=>{if(c.isAttached()){const A=Ma(c),j=r.getElementByKey(A.getKey());if(!j)throw new Error("Expected to find tableElement in DOM");const O=hT(j);O!==null&&O.clearHighlight(),A.markDirty(),i(c.getLatest())}In().selectStart()})},[r,c]),_=()=>{r.update(()=>{const B=kt();if(cr(B)){const{columns:A,rows:j}=vy(B),O=B.getNodes();let L=null;for(let N=0;N<O.length;N++){const U=O[N];if(bn(U))if(L===null){U.setColSpan(A).setRowSpan(j),L=U;const M=Iw(U);let z;M&&gr(z=U.getFirstChild())&&z.remove()}else bn(L)&&(Iw(U)||L.append(...U.getChildren()),U.remove())}L!==null&&(L.getChildrenSize()===0&&L.append(En()),oO(L)),l()}})},E=()=>{r.update(()=>{uT()})},S=fe.useCallback(B=>{r.update(()=>{sT(B),l()})},[r,l]),w=fe.useCallback(B=>{r.update(()=>{for(let A=0;A<u.columns;A++)aT(B);l()})},[r,l,u.columns]),y=fe.useCallback(()=>{r.update(()=>{lT(),l()})},[r,l]),x=fe.useCallback(()=>{r.update(()=>{Ma(c).remove(),v(),l()})},[r,c,v,l]),C=fe.useCallback(()=>{r.update(()=>{cT(),l()})},[r,l]),T=fe.useCallback(()=>{r.update(()=>{const B=Ma(c),A=s1(c),j=B.getChildren();if(A>=j.length||A<0)throw new Error("Expected table cell to be inside of table row.");const O=j[A];if(!Dr(O))throw new Error("Expected table row");O.getChildren().forEach(L=>{if(!bn(L))throw new Error("Expected table cell");L.toggleHeaderStyle(Ur.ROW)}),v(),l()})},[r,c,v,l]),D=fe.useCallback(()=>{r.update(()=>{const B=Ma(c),A=Hm(c),j=B.getChildren(),O=Math.max(...j.map(L=>L.getChildren().length));if(A>=O||A<0)throw new Error("Expected table cell to be inside of table row.");for(let L=0;L<j.length;L++){const N=j[L];if(!Dr(N))throw new Error("Expected table row");const U=N.getChildren();if(A>=U.length)continue;const M=U[A];if(!bn(M))throw new Error("Expected table cell");M.toggleHeaderStyle(Ur.COLUMN)}v(),l()})},[r,c,v,l]),F=fe.useCallback(B=>{r.update(()=>{const A=kt();if(St(A)||cr(A)){const[j]=Po(A.anchor);if(bn(j)&&j.setBackgroundColor(B),cr(A)){const O=A.getNodes();for(let L=0;L<O.length;L++){const N=O[L];bn(N)&&N.setBackgroundColor(B)}}}})},[r]);let I=null;return s&&(f?I=re.jsx("button",{type:"button",className:"item",onClick:()=>_(),"data-test-id":"table-merge-cells",children:"Merge cells"}):h&&(I=re.jsx("button",{type:"button",className:"item",onClick:()=>E(),"data-test-id":"table-unmerge-cells",children:"Unmerge cells"}))),ao.createPortal(re.jsxs("div",{className:"dropdown",ref:a,onClick:B=>{B.stopPropagation()},children:[I,re.jsx("button",{type:"button",className:"item",onClick:()=>o("Cell background color",()=>re.jsx(XA,{color:g,onChange:F})),"data-test-id":"table-background-color",children:re.jsx("span",{className:"text",children:"Background color"})}),re.jsx("hr",{}),re.jsx("button",{type:"button",className:"item",onClick:()=>S(!1),"data-test-id":"table-insert-row-above",children:re.jsxs("span",{className:"text",children:["Insert"," ",u.rows===1?"row":`${u.rows} rows`," ","above"]})}),re.jsx("button",{type:"button",className:"item",onClick:()=>S(!0),"data-test-id":"table-insert-row-below",children:re.jsxs("span",{className:"text",children:["Insert"," ",u.rows===1?"row":`${u.rows} rows`," ","below"]})}),re.jsx("hr",{}),re.jsx("button",{type:"button",className:"item",onClick:()=>w(!1),"data-test-id":"table-insert-column-before",children:re.jsxs("span",{className:"text",children:["Insert"," ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),re.jsx("button",{type:"button",className:"item",onClick:()=>w(!0),"data-test-id":"table-insert-column-after",children:re.jsxs("span",{className:"text",children:["Insert"," ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),re.jsx("hr",{}),re.jsx("button",{type:"button",className:"item",onClick:()=>C(),"data-test-id":"table-delete-columns",children:re.jsx("span",{className:"text",children:"Delete column"})}),re.jsx("button",{type:"button",className:"item",onClick:()=>y(),"data-test-id":"table-delete-rows",children:re.jsx("span",{className:"text",children:"Delete row"})}),re.jsx("button",{type:"button",className:"item",onClick:()=>x(),"data-test-id":"table-delete",children:re.jsx("span",{className:"text",children:"Delete table"})}),re.jsx("hr",{}),re.jsx("button",{type:"button",className:"item",onClick:()=>T(),children:re.jsxs("span",{className:"text",children:[(c.__headerState&Ur.ROW)===Ur.ROW?"Remove":"Add"," ","row header"]})}),re.jsx("button",{type:"button",className:"item",onClick:()=>D(),"data-test-id":"table-column-header",children:re.jsxs("span",{className:"text",children:[(c.__headerState&Ur.COLUMN)===Ur.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function sO({anchorElem:l,cellMerge:t}){const[n]=yn(),e=fe.useRef(null),s=fe.useRef(null),[o,r]=fe.useState(!1),[a,c]=fe.useState(null),[i,u]=La(),d=fe.useCallback(()=>{const p=e.current,h=kt(),m=window.getSelection(),g=document.activeElement;if(h==null||p==null){c(null);return}const b=n.getRootElement();if(St(h)&&b!==null&&m!==null&&b.contains(m.anchorNode)){const v=iT(h.anchor.getNode());if(v==null){c(null);return}if(n.getElementByKey(v.getKey())==null){c(null);return}c(v)}else g||c(null)},[n]);fe.useEffect(()=>n.registerUpdateListener(()=>{n.getEditorState().read(()=>{d()})})),fe.useEffect(()=>{const p=e.current;if(p!=null&&a!=null){const h=n.getElementByKey(a.getKey());if(h!=null){const m=h.getBoundingClientRect(),g=p.getBoundingClientRect(),b=l.getBoundingClientRect(),v=m.top-b.top+4,_=m.right-g.width-10-b.left;p.style.opacity="1",p.style.transform=`translate(${_}px, ${v}px)`}else p.style.opacity="0",p.style.transform="translate(-10000px, -10000px)"}},[e,a,n,l]);const f=fe.useRef(a);return fe.useEffect(()=>{f.current!==a&&r(!1),f.current=a},[f,a]),re.jsx("div",{className:"table-cell-action-button-container",ref:e,children:a!=null&&re.jsxs(re.Fragment,{children:[re.jsx("button",{type:"button",className:"table-cell-action-button chevron-down",onClick:p=>{p.stopPropagation(),r(!o)},ref:s,children:re.jsx("i",{className:"chevron-down"})}),i,o&&re.jsx(iO,{contextRef:s,setIsMenuOpen:r,onClose:()=>r(!1),tableCellNode:a,cellMerge:t,showColorPickerModal:u})]})})}function Rw({anchorElem:l=document.body,cellMerge:t=!1}){const n=ly();return ao.createPortal(n?re.jsx(sO,{anchorElem:l,cellMerge:t}):null,l)}const o4="",aO=33,lO=50;function cO({editor:l}){const t=fe.useRef(null),n=fe.useRef(null),e=fe.useRef(null),s=fe.useRef(null),[o,r]=fe.useState(null),[a,c]=fe.useState(null),[i,u]=fe.useState(!1),[d,f]=fe.useState(null);fe.useEffect(()=>l.registerCommand(ai,S=>{const w=kt(),y=cr(w);return i!==y&&u(y),!1},xi));const p=fe.useCallback(()=>{c(null),t.current=null,f(null),s.current=null,e.current=null},[]);fe.useEffect(()=>{const S=w=>{setTimeout(()=>{const y=w.target;if(d){r({x:w.clientX,y:w.clientY});return}if(!(n.current&&n.current.contains(y))&&t.current!==y){t.current=y;const x=Jm(y);x&&a!==x?l.update(()=>{const C=ho(x.elem);if(!C)return;const T=Ma(C),D=l.getElementByKey(T.getKey());if(!D){console.error("TableCellResizer: Table element not found.");return}t.current=y,e.current=D.getBoundingClientRect(),c(x)}):x==null&&p()}},0)};return document.addEventListener("mousemove",S),()=>{document.removeEventListener("mousemove",S)}},[a,d,l,p]);const h=S=>S==="bottom",m=fe.useCallback(S=>{if(!a){console.error("TableCellResizer: Expected active cell.");return}l.update(()=>{const w=ho(a.elem);if(!bn(w)){console.error("TableCellResizer: Table cell node not found.");return}const y=Ma(w),x=s1(w),C=y.getChildren();if(x>=C.length||x<0){console.error("Expected table cell to be inside of table row.");return}const T=C[x];if(!Dr(T)){console.error("Expected table row");return}T.setHeight(S)})},[a,l]),g=fe.useCallback(S=>{if(!a){console.error("TableCellResizer: Expected active cell.");return}l.update(()=>{const w=ho(a.elem);if(!bn(w)){console.error("TableCellResizer: Table cell node not found.");return}const y=Ma(w),x=Hm(w),C=y.getChildren();for(let T=0;T<C.length;T++){const D=C[T];if(!Dr(D)){console.error("Expected table row");return}const F=D.getChildren(),A=F.map(O=>O.getColSpan()).reduce((O,L)=>{const N=O[O.length-1]??0;return O.push(N+L),O},[]).findIndex(O=>O>x);if(A>=F.length||A<0){console.error("Expected table cell to be inside of table row.");return}const j=F[A];if(!bn(j)){console.error("Expected table cell");return}j.setWidth(S)}})},[a,l]),b=fe.useCallback(S=>{const w=y=>{if(y.preventDefault(),y.stopPropagation(),!a){console.error("TableCellResizer: Expected active cell.");return}if(s.current){const{x,y:C}=s.current;if(a===null)return;if(h(S)){const T=a.elem.getBoundingClientRect().height,D=Math.abs(y.clientY-C),F=S==="bottom"&&C>y.clientY;m(Math.max(F?T-D:D+T,aO))}else{const T=getComputedStyle(a.elem);let D=a.elem.clientWidth;D-=parseFloat(T.paddingLeft)+parseFloat(T.paddingRight);const F=Math.abs(y.clientX-x),I=S==="right"&&x>y.clientX;g(Math.max(I?D-F:F+D,lO))}p(),document.removeEventListener("mouseup",w)}};return w},[a,p,g,m]),v=fe.useCallback(S=>w=>{if(w.preventDefault(),w.stopPropagation(),!a){console.error("TableCellResizer: Expected active cell.");return}s.current={x:w.clientX,y:w.clientY},r(s.current),f(S),document.addEventListener("mouseup",b(S))},[a,b]),E=fe.useCallback(()=>{if(a){const{height:S,width:w,top:y,left:x}=a.elem.getBoundingClientRect(),C={bottom:{backgroundColor:"none",cursor:"row-resize",height:"10px",left:`${window.pageXOffset+x}px`,top:`${window.pageYOffset+y+S}px`,width:`${w}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${S}px`,left:`${window.pageXOffset+x+w}px`,top:`${window.pageYOffset+y}px`,width:"10px"}},T=e.current;return d&&o&&T&&(h(d)?(C[d].left=`${window.pageXOffset+T.left}px`,C[d].top=`${window.pageYOffset+o.y}px`,C[d].height="3px",C[d].width=`${T.width}px`):(C[d].top=`${window.pageYOffset+T.top}px`,C[d].left=`${window.pageXOffset+o.x}px`,C[d].width="3px",C[d].height=`${T.height}px`),C[d].backgroundColor="#adf"),C}return{bottom:null,left:null,right:null,top:null}},[a,d,o])();return re.jsx("div",{ref:n,children:a!=null&&!i&&re.jsxs(re.Fragment,{children:[re.jsx("div",{className:"TableCellResizer__resizer TableCellResizer__ui",style:E.right||void 0,onMouseDown:v("right")}),re.jsx("div",{className:"TableCellResizer__resizer TableCellResizer__ui",style:E.bottom||void 0,onMouseDown:v("bottom")})]})})}function Dw({isEditable:l=!0}){const[t]=yn();return fe.useMemo(()=>l?ao.createPortal(re.jsx(cO,{editor:t}),document.body):null,[t,l])}const Lw=rr.createContext(null),Fw=4;function Zr({children:l,className:t,onClick:n,title:e}){const s=fe.useRef(null),o=rr.useContext(Lw);if(o===null)throw new Error("DropDownItem must be used within a DropDown");const{registerItem:r}=o;return fe.useEffect(()=>{s&&s.current&&r(s)},[s,r]),re.jsx("button",{className:t,onClick:n,ref:s,title:e,type:"button",children:l})}function uO({children:l,dropDownRef:t,onClose:n}){const[e,s]=fe.useState(),[o,r]=fe.useState(),a=fe.useCallback(u=>{s(d=>d?[...d,u]:[u])},[s]),c=u=>{if(!e)return;const d=u.key;["Escape","ArrowUp","ArrowDown","Tab"].includes(d)&&u.preventDefault(),d==="Escape"||d==="Tab"?n():d==="ArrowUp"?r(f=>{if(!f)return e[0];const p=e.indexOf(f)-1;return e[p===-1?e.length-1:p]}):d==="ArrowDown"&&r(f=>f?e[e.indexOf(f)+1]:e[0])},i=fe.useMemo(()=>({registerItem:a}),[a]);return fe.useEffect(()=>{e&&!o&&r(e[0]),o&&o.current&&o.current.focus()},[e,o]),re.jsx(Lw.Provider,{value:i,children:re.jsx("div",{className:"dropdown",ref:t,onKeyDown:c,children:l})})}function Rl({disabled:l=!1,buttonLabel:t,buttonAriaLabel:n,buttonClassName:e,buttonIconClassName:s,children:o,stopCloseOnClickSelf:r}){const a=fe.useRef(null),c=fe.useRef(null),[i,u]=fe.useState(!1),d=()=>{u(!1),c&&c.current&&c.current.focus()};return fe.useEffect(()=>{const f=c.current,p=a.current;if(i&&f!==null&&p!==null){const{top:h,left:m}=f.getBoundingClientRect();p.style.top=`${h+f.offsetHeight+Fw}px`,p.style.left=`${Math.min(m,window.innerWidth-p.offsetWidth-20)}px`}},[a,c,i]),fe.useEffect(()=>{const f=c.current;if(f!==null&&i){const p=h=>{const m=h.target;r&&a.current&&a.current.contains(m)||f.contains(m)||u(!1)};return document.addEventListener("click",p),()=>{document.removeEventListener("click",p)}}},[a,c,i,r]),fe.useEffect(()=>{const f=()=>{if(i){const p=c.current,h=a.current;if(p!==null&&h!==null){const{top:m}=p.getBoundingClientRect(),g=m+p.offsetHeight+Fw;g!==h.getBoundingClientRect().top&&(h.style.top=`${g}px`)}}};return document.addEventListener("scroll",f),()=>{document.removeEventListener("scroll",f)}},[c,a,i]),re.jsxs(re.Fragment,{children:[re.jsxs("button",{type:"button",disabled:l,"aria-label":n||t,className:e,onClick:()=>u(!i),ref:c,children:[s&&re.jsx("span",{className:s}),t&&re.jsx("span",{className:"text dropdown-button-text",children:t}),re.jsx("i",{className:"chevron-down"})]}),i&&ao.createPortal(re.jsx(uO,{dropDownRef:a,onClose:d,children:o}),document.body)]})}function Bw(l){const t=l.anchor,n=l.focus,e=l.anchor.getNode(),s=l.focus.getNode();return e===s?e:l.isBackward()?p_(n)?e:s:p_(t)?e:s}function dO(l){(()=>{l.update(()=>{In().getChildren().forEach(()=>{In().getChildren().filter(r=>{Xm(r)&&r.__pageNumber})});const e=j1(),s=kt();s!==null&&St(s)&&(s.anchor.getNode().getTopLevelElementOrThrow().insertAfter(e),e.selectEnd())})})()}const zw=8,Uw=72,Fa={h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",paragraph:"Normal"},fO=({selectionFontSize:l,disabled:t,editor:n,blockType:e,styleConfig:s,isenterPressed:o,currentElementClick:r,currentElementSelect:a,wpAndTaskId:c})=>{const[i,u]=rr.useState(l),[d,f]=rr.useState(e),[p,h]=rr.useState("");rr.useState([]),rr.useState("");const{heading:m}=s||{},g=S=>{S&&S.title&&n.update(()=>{if(n.isEditable()){const w=kt();w&&Sm(w,S)}})},b=S=>{u(S.target.value)},v=()=>{const S=Number(i);if(!isNaN(S)){const w=Math.min(Math.max(S,zw),Uw);u(String(w)),g({"font-size":`${w}px`})}},_=S=>{var y,x,C;h(S),n.update(()=>{const T=kt();St(T)&&_2(T,()=>kl(S))});let w=null;if(m)switch(S){case"h1":w=((y=m.find(T=>T.title==="Heading1"))==null?void 0:y.fontSize)??56;break;case"h2":w=((x=m.find(T=>T.title==="Heading2"))==null?void 0:x.fontSize)??14;break;case"h3":w=((C=m.find(T=>T.title==="Heading3"))==null?void 0:C.fontSize)??12;break;case"paragraph":w=15;break;default:w=15}u(w),h(S),f(S)},E=()=>{u("15")};return rr.useEffect(()=>{E()},[o]),rr.useEffect(()=>{const S=()=>{n.update(()=>{const w=kt();if(w!==null){const x=w.getNodes()[0];if(!Wt(x)){const C=x.getType();C in Fa&&f(C)}}})};return n.registerUpdateListener(S),()=>{n.registerUpdateListener(S)}},[n]),rr.useEffect(()=>{var S,w,y;switch(r.tagName){case"P":f("paragraph"),u("15");break;case"H1":f("h1");const x=((S=s.heading.find(D=>D.title==="Heading1"))==null?void 0:S.fontSize)??"16";u(x);break;case"H2":f("h2");const C=((w=s.heading.find(D=>D.title==="Heading2"))==null?void 0:w.fontSize)??"14";u(C);break;case"H3":f("h3");const T=((y=s.heading.find(D=>D.title==="Heading3"))==null?void 0:y.fontSize)??"12";u(T);break;default:f("paragraph"),u("15");break}},[r]),rr.useEffect(()=>{var w,y,x;if(!a){u("15"),f("paragraph");return}switch(a.trim()){case"P":u("15"),f("paragraph");break;case"h1":f("h1");const C=((w=s.heading.find(F=>F.title==="Heading1"))==null?void 0:w.fontSize)??"16";u(C);break;case"h2":f("h2");const T=((y=s.heading.find(F=>F.title==="Heading2"))==null?void 0:y.fontSize)??"14";u(T);break;case"h3":f("h3");const D=((x=s.heading.find(F=>F.title==="Heading3"))==null?void 0:x.fontSize)??"12";u(D);break;default:f("paragraph"),u("15");break}},[a]),re.jsxs(re.Fragment,{children:[s&&s.heading?re.jsxs(Rl,{disabled:t,buttonClassName:"toolbar-item block-controls",buttonAriaLabel:"Formatting options for text style",buttonIconClassName:"icon block-type "+d,buttonLabel:Fa[d],children:[re.jsxs(Zr,{className:`item ${d==="paragraph"?"active":""}`,onClick:()=>_("paragraph"),children:[re.jsx("i",{className:"icon paragraph"}),re.jsx("span",{className:"text",children:Fa.paragraph})]}),s.heading&&s.heading.find(S=>S.title==="Heading1")&&re.jsxs(Zr,{className:`item ${d==="h1"?"active":""}`,onClick:()=>_("h1"),children:[re.jsx("i",{className:"icon h1"}),re.jsx("span",{className:"text",children:Fa.h1})]}),s.heading&&s.heading.find(S=>S.title==="Heading2")&&re.jsxs(Zr,{className:`item ${d==="h2"?"active":""}`,onClick:()=>_("h2"),children:[re.jsx("i",{className:"icon h2"}),re.jsx("span",{className:"text",children:Fa.h2})]}),s.heading&&s.heading.find(S=>S.title==="Heading3")&&re.jsxs(Zr,{className:`item ${d==="h3"?"active":""}`,onClick:()=>_("h3"),children:[re.jsx("i",{className:"icon h3"}),re.jsx("span",{className:"text",children:Fa.h3})]}),s.heading&&s.heading.find(S=>S.title==="Heading5")&&re.jsxs(Zr,{className:`item ${d==="h4"?"active":""}`,onClick:()=>_("h4"),children:[re.jsx("i",{className:"icon h4"}),re.jsx("span",{className:"text",children:Fa.h4})]}),s.heading&&s.heading.find(S=>S.title==="Heading5")&&re.jsxs(Zr,{className:`item ${d==="h5"?"active":""}`,onClick:()=>_("h5"),children:[re.jsx("i",{className:"icon h5"}),re.jsx("span",{className:"text",children:Fa.h5})]})]}):"",re.jsx("input",{style:{width:"25px",marginLeft:"5px",paddingLeft:"7px"},title:"Font Size",type:"text",value:11,disabled:t,readOnly:!0,className:"toolbar-item font-size-input input-font-size-value",min:zw,max:Uw,onChange:b,onBlur:v})]})},pO=Rc&&"documentMode"in document?document.documentMode:null,Ba=Rc&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);Rc&&"InputEvent"in window&&!pO&&"getTargetRanges"in new window.InputEvent("input");const hO="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik0xMi41NTM1IDE2LjUwNjFDMTIuNDExNCAxNi42NjE1IDEyLjIxMDYgMTYuNzUgMTIgMTYuNzVDMTEuNzg5NCAxNi43NSAxMS41ODg2IDE2LjY2MTUgMTEuNDQ2NSAxNi41MDYxTDcuNDQ2NDggMTIuMTMxMUM3LjE2Njk4IDExLjgyNTQgNy4xODgyMiAxMS4zNTEgNy40OTM5MiAxMS4wNzE1QzcuNzk5NjMgMTAuNzkyIDguMjc0MDIgMTAuODEzMiA4LjU1MzUyIDExLjExODlMMTEuMjUgMTQuMDY4MlYzQzExLjI1IDIuNTg1NzkgMTEuNTg1OCAyLjI1IDEyIDIuMjVDMTIuNDE0MiAyLjI1IDEyLjc1IDIuNTg1NzkgMTIuNzUgM1YxNC4wNjgyTDE1LjQ0NjUgMTEuMTE4OUMxNS43MjYgMTAuODEzMiAxNi4yMDA0IDEwLjc5MiAxNi41MDYxIDExLjA3MTVDMTYuODExOCAxMS4zNTEgMTYuODMzIDExLjgyNTQgMTYuNTUzNSAxMi4xMzExTDEyLjU1MzUgMTYuNTA2MVoiIGZpbGw9IiMxQzI3NEMiLz4NCjxwYXRoIGQ9Ik0zLjc1IDE1QzMuNzUgMTQuNTg1OCAzLjQxNDIyIDE0LjI1IDMgMTQuMjVDMi41ODU3OSAxNC4yNSAyLjI1IDE0LjU4NTggMi4yNSAxNVYxNS4wNTQ5QzIuMjQ5OTggMTYuNDIyNSAyLjI0OTk2IDE3LjUyNDggMi4zNjY1MiAxOC4zOTE4QzIuNDg3NTQgMTkuMjkxOSAyLjc0NjQzIDIwLjA0OTcgMy4zNDgzNSAyMC42NTE2QzMuOTUwMjcgMjEuMjUzNiA0LjcwODE0IDIxLjUxMjUgNS42MDgyNSAyMS42MzM1QzYuNDc1MjIgMjEuNzUgNy41Nzc1NCAyMS43NSA4Ljk0NTEzIDIxLjc1SDE1LjA1NDlDMTYuNDIyNSAyMS43NSAxNy41MjQ4IDIxLjc1IDE4LjM5MTggMjEuNjMzNUMxOS4yOTE5IDIxLjUxMjUgMjAuMDQ5NyAyMS4yNTM2IDIwLjY1MTcgMjAuNjUxNkMyMS4yNTM2IDIwLjA0OTcgMjEuNTEyNSAxOS4yOTE5IDIxLjYzMzUgMTguMzkxOEMyMS43NSAxNy41MjQ4IDIxLjc1IDE2LjQyMjUgMjEuNzUgMTUuMDU0OVYxNUMyMS43NSAxNC41ODU4IDIxLjQxNDIgMTQuMjUgMjEgMTQuMjVDMjAuNTg1OCAxNC4yNSAyMC4yNSAxNC41ODU4IDIwLjI1IDE1QzIwLjI1IDE2LjQzNTQgMjAuMjQ4NCAxNy40MzY1IDIwLjE0NjkgMTguMTkxOUMyMC4wNDgyIDE4LjkyNTcgMTkuODY3OCAxOS4zMTQyIDE5LjU5MSAxOS41OTFDMTkuMzE0MiAxOS44Njc4IDE4LjkyNTcgMjAuMDQ4MiAxOC4xOTE5IDIwLjE0NjlDMTcuNDM2NSAyMC4yNDg0IDE2LjQzNTQgMjAuMjUgMTUgMjAuMjVIOUM3LjU2NDU5IDIwLjI1IDYuNTYzNDcgMjAuMjQ4NCA1LjgwODEyIDIwLjE0NjlDNS4wNzQzNSAyMC4wNDgyIDQuNjg1NzcgMTkuODY3OCA0LjQwOTAxIDE5LjU5MUM0LjEzMjI1IDE5LjMxNDIgMy45NTE4IDE4LjkyNTcgMy44NTMxNSAxOC4xOTE5QzMuNzUxNTkgMTcuNDM2NSAzLjc1IDE2LjQzNTQgMy43NSAxNVoiIGZpbGw9IiMxQzI3NEMiLz4NCjwvc3ZnPg==";var Hw={exports:{}};(function(l,t){(function(n,e){e()})(ba,function(){function n(i,u){return typeof u>"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(i.type)?new Blob(["\uFEFF",i],{type:i.type}):i}function e(i,u,d){var f=new XMLHttpRequest;f.open("GET",i),f.responseType="blob",f.onload=function(){c(f.response,u,d)},f.onerror=function(){console.error("could not download file")},f.send()}function s(i){var u=new XMLHttpRequest;u.open("HEAD",i,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function o(i){try{i.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),i.dispatchEvent(u)}}var r=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ba=="object"&&ba.global===ba?ba:void 0,a=r.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),c=r.saveAs||(typeof window!="object"||window!==r?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(i,u,d){var f=r.URL||r.webkitURL,p=document.createElement("a");u=u||i.name||"download",p.download=u,p.rel="noopener",typeof i=="string"?(p.href=i,p.origin===location.origin?o(p):s(p.href)?e(i,u,d):o(p,p.target="_blank")):(p.href=f.createObjectURL(i),setTimeout(function(){f.revokeObjectURL(p.href)},4e4),setTimeout(function(){o(p)},0))}:"msSaveOrOpenBlob"in navigator?function(i,u,d){if(u=u||i.name||"download",typeof i!="string")navigator.msSaveOrOpenBlob(n(i,d),u);else if(s(i))e(i,u,d);else{var f=document.createElement("a");f.href=i,f.target="_blank",setTimeout(function(){o(f)})}}:function(i,u,d,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof i=="string")return e(i,u,d);var p=i.type==="application/octet-stream",h=/constructor/i.test(r.HTMLElement)||r.safari,m=/CriOS\/[\d]+/.test(navigator.userAgent);if((m||p&&h||a)&&typeof FileReader<"u"){var g=new FileReader;g.onloadend=function(){var _=g.result;_=m?_:_.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=_:location=_,f=null},g.readAsDataURL(i)}else{var b=r.URL||r.webkitURL,v=b.createObjectURL(i);f?f.location=v:location.href=v,f=null,setTimeout(function(){b.revokeObjectURL(v)},4e4)}});r.saveAs=c.saveAs=c,l.exports=c})})(Hw);var gO=Hw.exports;function mO(l){const t=document.createElement("div");return t.innerHTML=l,t.querySelectorAll("*").forEach(e=>{let s="";if(e.classList.contains("PlaygroundEditorTheme__textItalic")&&e.classList.contains("PlaygroundEditorTheme__textStrikethrough")){s+="text-decoration: line-through; ";const o=document.createElement("span");o.style.cssText=s.trim();const r=document.createElement("i");r.innerHTML=e.innerHTML,o.appendChild(r),e.innerHTML="",e.appendChild(o)}else if(e.classList.contains("PlaygroundEditorTheme__textBold")&&e.classList.contains("PlaygroundEditorTheme__textItalic")&&e.classList.contains("PlaygroundEditorTheme__textStrikethrough")){s+="text-decoration: line-through; ";const o=document.createElement("span");o.style.cssText=s.trim();const r=document.createElement("i"),a=document.createElement("strong");a.innerHTML=e.innerHTML,r.appendChild(a),o.appendChild(r),e.innerHTML="",e.appendChild(o)}else{if(e.classList.contains("PlaygroundEditorTheme__textStrikethrough")&&(s+="text-decoration: line-through; "),e.classList.contains("PlaygroundEditorTheme__textUnderlineStrikethrough")&&(s+="text-decoration: line-through underline; "),e.classList.contains("PlaygroundEditorTheme__textBold")){const o=document.createElement("strong");o.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(o)}if(e.classList.contains("PlaygroundEditorTheme__textItalic")){const o=document.createElement("i");o.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(o)}if(e.classList.contains("PlaygroundEditorTheme__textUnderline")){const o=document.createElement("u");o.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(o)}if(s){const o=document.createElement("span");o.style.cssText=s.trim(),o.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(o)}}}),t.innerHTML}function yO(l){const t=document.createElement("div");t.innerHTML=l;const n=t.querySelectorAll(".PlaygroundEditorTheme__table");return n.length===0?l:(n.forEach(e=>{e.style.width="100%",e.style.borderCollapse="collapse",e.style.border="1px solid black",e.style.fontFamily="Times New Roman",e.style.fontSize="11pt",e.querySelectorAll("tr").forEach((o,r)=>{o.style.border="1px solid black";const a=o.querySelectorAll("td, th"),i=100/a.length+"%";a.forEach(u=>{u.style.width=i,u.style.height="20px",u.style.border="1px solid black",u.style.padding="5px 8px",u.style.textAlign="left",u.style.verticalAlign="middle",u.innerHTML.trim()||(u.innerHTML="&nbsp;"),u.querySelectorAll(".PlaygroundEditorTheme__textUnderline").forEach(p=>{p.style.textDecoration="underline"}),u.querySelectorAll(".PlaygroundEditorTheme__textStrikethrough").forEach(p=>{p.style.textDecoration="line-through"}),u.classList.contains("PlaygroundEditorTheme__tableCellHeader")&&(u.style.fontWeight="bold",u.style.backgroundColor="#d9d9d9",u.style.textAlign="center")})})}),t.innerHTML)}function qw(l){return l=l.replace(/<br\s*\/?>/g,""),l.includes("Crop")&&(l=l.replace(/Crop/g,"")),Ww(l)}function Ww(l){const t=document.createElement("div");return t.innerHTML=l,t.querySelectorAll("h1").forEach(s=>{const o=s.querySelector("p");o&&o.remove()}),t.innerHTML}function Jw(l){const n=new DOMParser().parseFromString(l,"text/html"),e=o=>{o.forEach(r=>{if(r.children.length>0&&Array.from(r.children).every(c=>c.tagName==="TABLE")){const c=document.createDocumentFragment();Array.from(r.children).forEach(i=>{i.tagName==="TABLE"&&c.appendChild(i.cloneNode(!0))}),r.replaceWith(c)}else if(r.children.length===1&&r.children[0].tagName==="P"){const c=r.children[0],i=c.innerHTML.trim();i===""||/^<br\s*\/?>$/i.test(i)?r.replaceWith(c):c.replaceWith(...c.childNodes)}})},s=Array.from(n.querySelectorAll("h1, h2, h3, h4, h5, h6, p"));return e(s),n.body.innerHTML}const vO=async(l,t,n,e)=>{await bO({title:t,parsedHtmlString:e,styleConfig:n})},bO=async({title:l,parsedHtmlString:t,styleConfig:n})=>{const e=`<!DOCTYPE html><html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head><meta charset="UTF-8"><title>Document</title>
67
67
  <style>